Skip to content

Commit

Permalink
version 4.16.4
Browse files Browse the repository at this point in the history
s Please enter the commit message for your changes. Lines starting
  • Loading branch information
acaurrinhos committed Sep 18, 2023
1 parent 2a58eb1 commit 3711309
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Cyclos 4 UI",
"description": "The new Cyclos 4 frontend",
"icon": "cyclos.png",
"version": "4.16.3",
"version": "4.16.4",
"license": "MIT",
"author": {
"name": "Cyclos development team",
Expand Down
18 changes: 17 additions & 1 deletion src/app/core/error-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ErrorKind, ForbiddenError, ForbiddenErrorCode, ForgottenPasswordError,
ForgottenPasswordErrorCode, InputError, InputErrorCode, NestedError, NotFoundError,
PasswordStatusEnum, PaymentError, PaymentErrorCode, RedeemVoucherError,
RedeemVoucherErrorCode, ShoppingCartError, ShoppingCartErrorCode,
RedeemVoucherErrorCode, ShoppingCartCheckoutError, ShoppingCartCheckoutErrorCode, ShoppingCartError, ShoppingCartErrorCode,
TopUpVoucherError,
TopUpVoucherErrorCode,
UnauthorizedError, UnauthorizedErrorCode, UnavailableError, UnavailableErrorCode, UserStatusEnum
Expand Down Expand Up @@ -120,6 +120,9 @@ export class ErrorHandlerService {
case ErrorKind.SHOPPING_CART:
this.handleShoppingCartError(error as ShoppingCartError);
return;
case ErrorKind.SHOPPING_CART_CHECKOUT:
this.handleShoppingCartCheckoutError(error as ShoppingCartCheckoutError);
return;
case ErrorKind.NESTED:
// An error in a nested property
this.handleNestedError(error as NestedError);
Expand Down Expand Up @@ -223,6 +226,10 @@ export class ErrorHandlerService {
this.notification.error(this.shoppingCartErrorMessage(error));
}

public handleShoppingCartCheckoutError(error: ShoppingCartCheckoutError) {
this.notification.error(this.shoppingCartCheckoutErrorMessage(error));
}

private shoppingCartErrorMessage(error: ShoppingCartError) {
if (error?.code === ShoppingCartErrorCode.CAN_NOT_BUY_FROM_SELLER) {
return this.i18n.ad.error.cannotBuyFromSeller;
Expand All @@ -232,6 +239,15 @@ export class ErrorHandlerService {
return this.general;
}

private shoppingCartCheckoutErrorMessage(error: ShoppingCartCheckoutError) {
if (error?.code == ShoppingCartCheckoutErrorCode.INSUFFICIENT_BALANCE) {
return this.i18n.ad.error.insufficientBalance;
} else if (error?.code === ShoppingCartCheckoutErrorCode.PRODUCTS) {
return this.shoppingCartErrorMessage(error?.shoppingCartError);
}
return this.general;
}

public handleBuyVoucherError(error: BuyVoucherError) {
if (error?.code === BuyVoucherErrorCode.PAYMENT) {
this.handlePaymentError(error.paymentError);
Expand Down
7 changes: 7 additions & 0 deletions src/app/shared/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,13 @@ export function ensureInScroll(el: ElementReference) {
}
}

/**
* Returns true if the given string is not null and composed of numbers only
*/
export function isNumeric(value: string): boolean {
return value && value.length > 0 && /^[\-\+]?\d+$/.test(value);
}

/**
* Returns the first words of a text, up to a maximum length.
* For example: words('Social Trade Organization', 15) will return 'Social Trade'.
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/content/content-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CardMode } from 'app/ui/content/card-mode';
import { BaseViewPageComponent } from 'app/ui/shared/base-view-page.component';
import { ActiveMenu, Menu } from 'app/ui/shared/menu';

export const IframeResizerUrl = 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.2.11/iframeResizer.min.js';
export const IframeResizerUrl = 'https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.6/iframeResizer.min.js';

/**
* Displays a content page with layout
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/marketplace/checkout/view-cart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class ViewCartComponent
* Validates and navigates to the checkout page
*/
protected checkout() {
if (this.unavailable || this.outOfStock || this.data.insufficientBalance) {
if (this.unavailable || this.outOfStock) {
this.notification.error(this.i18n.ad.error.cannotProceedToCheckout);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/ui/marketplace/view/view-order.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class ViewOrderComponent extends BaseViewPageComponent<OrderView> impleme
const ref = this.modal.show(SetDeliveryMethodComponent, {
class: 'modal-form', initialState: {
name: dm.name,
chargeAmount: parseFloat(dm.price),
chargeAmount: dm.price == null ? null : parseFloat(dm.price),
minTime: dm.minTime,
maxTime: dm.maxTime,
deliveryType: dm.deliveryType,
Expand Down
19 changes: 14 additions & 5 deletions src/app/ui/shared/password-hints.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
[ngClass]="(fixedLength$ | async) ? 'valid' : 'invalid'">
{{
(fixedLength$ | async)
? i18n.password.hints.ok(i18n.password.hints.fixedLength(fixedLength))
: i18n.password.hints.fail(i18n.password.hints.fixedLength(fixedLength))
? i18n.password.hints.ok(this.passwordType.onlyNumeric ?
i18n.password.hints.fixedLengthNumbers(fixedLength) :
i18n.password.hints.fixedLength(fixedLength))
: i18n.password.hints.fail(this.passwordType.onlyNumeric ?
i18n.password.hints.fixedLengthNumbers(fixedLength) :
i18n.password.hints.fixedLength(fixedLength))
}}
</li>
<li *ngIf="minLength"
[ngClass]="(minLength$ | async) ? 'valid' : 'invalid'">
{{
(minLength$ | async)
? i18n.password.hints.ok(i18n.password.hints.minLength(minLength))
: i18n.password.hints.fail(i18n.password.hints.minLength(minLength))
? i18n.password.hints.ok(this.passwordType.onlyNumeric ?
i18n.password.hints.minLengthNumbers(minLength) :
i18n.password.hints.minLength(minLength))
: i18n.password.hints.fail(this.passwordType.onlyNumeric ?
i18n.password.hints.minLengthNumbers(minLength) :
i18n.password.hints.minLength(minLength))
}}
</li>
<li *ngIf="lowerCaseLetters"
Expand All @@ -32,7 +40,8 @@
: i18n.password.hints.fail(i18n.password.hints.upperCaseLetters)
}}
</li>
<li *ngIf="numbers" [ngClass]="(numbers$ | async) ? 'valid' : 'invalid'">
<li *ngIf="!this.passwordType.onlyNumeric && numbers"
[ngClass]="(numbers$ | async) ? 'valid' : 'invalid'">
{{
(numbers$ | async)
? i18n.password.hints.ok(i18n.password.hints.numbers)
Expand Down
5 changes: 3 additions & 2 deletions src/app/ui/shared/password-hints.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChangeDetectionStrategy, Component, Injector, Input, OnInit } from '@an
import { FormControl } from '@angular/forms';
import { AvailabilityEnum, PasswordTypeDetailed } from 'app/api/models';
import { BaseComponent } from 'app/shared/base.component';
import { isNumeric } from 'app/shared/helper';
import { BehaviorSubject } from 'rxjs';

const UpperCaseLetters = /[A-Z]/;
Expand Down Expand Up @@ -51,8 +52,8 @@ export class PasswordHintsComponent extends BaseComponent implements OnInit {

this.addSub(this.control.valueChanges.subscribe(v => {
v = v ?? '';
this.fixedLength$.next(v.length == this.fixedLength);
this.minLength$.next(v.length >= this.minLength);
this.fixedLength$.next(v.length == this.fixedLength && (!this.passwordType.onlyNumeric || isNumeric(v)));
this.minLength$.next(v.length >= this.minLength && (!this.passwordType.onlyNumeric || isNumeric(v)));
this.lowerCaseLetters$.next(LowerCaseLetters.test(v));
this.upperCaseLetters$.next(UpperCaseLetters.test(v));
this.numbers$.next(Numbers.test(v));
Expand Down
1 change: 0 additions & 1 deletion src/i18n/i18n.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,6 @@
"endDate": "Veröffentlichtes Enddatum",
"error": {
"cannotBuyFromSeller": "Im Moment sind Sie nicht berechtigt, Produkte von diesem Benutzer zu kaufen. Bitte kontaktieren Sie Ihren Administrator.",
"cannotProceedToCheckout": "Sie können nicht mit der Kasse fortfahren, weil einige Elemente nicht verfügbar sind oder Sie nicht genug Guthaben haben",
"notEnoughStock": "Die geforderte Menge kann nicht geliefert werden, da der Artikel fast ausverkauft ist."
},
"deliveryAddress": "Lieferadresse",
Expand Down
7 changes: 5 additions & 2 deletions src/i18n/i18n.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@
"fail": "{text} ✗",
"preface": "La contraseña debe contener:",
"fixedLength": "Exactamente {length} caracteres",
"fixedLengthNumbers": "Exactamente {length} números",
"minLength": "Al menos {count} caracteres",
"minLengthNumbers": "Al menos {count} números",
"lowerCaseLetters": "Al menos 1 letra minúscula",
"upperCaseLetters": "Al menos 1 letra mayúscula",
"numbers": "Al menos 1 número",
Expand Down Expand Up @@ -1887,9 +1889,10 @@
"endDate": "Publicado hasta",
"error": {
"cannotBuyFromSeller": "Por el momento, no puede comprar productos de este usuario. Por favor, contacte a su administración.",
"cannotProceedToCheckout": "No se puede continuar con la generación de la orden de compra debido a que algunos productos no están disponibles, o usted no posee saldo suficiente",
"cannotProceedToCheckout": "No puede finalizar el pedido porque algunos artículos no están disponibles",
"notEnoughStock": "La cantidad solicitada no puede ser entregada porque no posee stock suficiente del el producto.",
"noAvailableAccounts": "El anuncio no se puede guardar porque no hay cuentas disponibles y el precio no se puede definir.\nPor favor, consulte a la administración."
"noAvailableAccounts": "El anuncio no se puede guardar porque no hay cuentas disponibles y el precio no se puede definir.\nPor favor, consulte a la administración.",
"insufficientBalance": "Saldo insuficiente para finalizar el pedido."
},
"deliveryAddress": "Dirección de entrega",
"deliveryInformation": "Información de entrega",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/i18n.it.json
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,6 @@
"endDate": "al",
"error": {
"cannotBuyFromSeller": "Al momento non è consentito acquistare prodotti da questo utente. Contatta l'amministratore.",
"cannotProceedToCheckout": "Non puoi procedere con il checkout perché alcuni elementi non sono disponibili o non hai abbastanza disponibile sul conto",
"notEnoughStock": "La quantità richiesta non può essere consegnata, perché l'articolo è quasi esaurito."
},
"deliveryAddress": "Indirizzo di consegna",
Expand Down
7 changes: 5 additions & 2 deletions src/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@
"fail": "{text} ✗",
"preface": "The password needs to contain:",
"fixedLength": "Exactly {length} characters",
"fixedLengthNumbers": "Exactly {length} numbers",
"minLength": "At least {count} characters",
"minLengthNumbers": "At least {count} numbers",
"lowerCaseLetters": "At least 1 lower case letter",
"upperCaseLetters": "At least 1 upper case letter",
"numbers": "At least 1 number",
Expand Down Expand Up @@ -1887,9 +1889,10 @@
"endDate": "Published end date",
"error": {
"cannotBuyFromSeller": "At the moment, you are not allowed to buy products from this user. Please contact your administrator.",
"cannotProceedToCheckout": "You can not proceed with checkout because some items are unavailable or you do not have enough balance",
"cannotProceedToCheckout": "You can not proceed with checkout because some items are unavailable",
"notEnoughStock": "The quantity demanded cannot be delivered, because the article is almost out of stock.",
"noAvailableAccounts": "The advertisement can not be saved because there is not available accounts and price can not be set. Please contact the administration"
"noAvailableAccounts": "The advertisement can not be saved because there is not available accounts and price can not be set. Please contact the administration",
"insufficientBalance": "Insufficient balance to proceed with the checkout confirmation."
},
"deliveryAddress": "Delivery address",
"deliveryInformation": "Delivery information",
Expand Down
1 change: 0 additions & 1 deletion src/i18n/i18n.nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,6 @@
"endDate": "Gepubliceerde einddatum",
"error": {
"cannotBuyFromSeller": "Op het moment, is het niet toegestaan om producten te kopen van deze gebruiker. Neem contact op met de administratie",
"cannotProceedToCheckout": "U kunt niet doorgaan met het afrekenen omdat sommige items niet beschikbaar zijn of omdat u niet genoeg saldo heeft",
"notEnoughStock": "De gevraagde hoeveelheid kan niet worden geleverd, omdat het artikel bijna niet meer op voorraad is.",
"noAvailableAccounts": "De advertentie kan niet worden opgeslagen omdat er geen rekeningen beschikbaar zijn en de prijs niet kan worden ingesteld.\nNeem contact op met de administratie"
},
Expand Down
7 changes: 5 additions & 2 deletions src/i18n/i18n.pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@
"fail": "{text} ✗",
"preface": "A senha precisa conter:",
"fixedLength": "Exatamente {length} caracteres",
"fixedLengthNumbers": "Exatamente {length} números",
"minLength": "Pelo menos {count} caracteres",
"minLengthNumbers": "Pelo menos {count} números",
"lowerCaseLetters": "Pelo menos 1 letra minúscula",
"upperCaseLetters": "Pelo menos 1 letra maiúscula",
"numbers": "Pelo menos 1 número",
Expand Down Expand Up @@ -1887,9 +1889,10 @@
"endDate": "Data final de publicação",
"error": {
"cannotBuyFromSeller": "No momento, você não está autorizado a comprar produtos deste usuário. Por favor, contate o seu administrador.",
"cannotProceedToCheckout": "Você não pode prosseguir com a finalização da compra, porque alguns itens não estão disponíveis ou você não tem saldo suficiente",
"cannotProceedToCheckout": "Você não pode prosseguir com a finalização da compra porque alguns itens estão indisponíveis",
"notEnoughStock": "A quantidade solicitada não pode ser entregue, porque o artigo está quase sem estoque.",
"noAvailableAccounts": "O anúncio não pode ser salvo porque não há contas disponíveis e o preço não pode ser definido. Por favor, contate a administração"
"noAvailableAccounts": "O anúncio não pode ser salvo porque não há contas disponíveis e o preço não pode ser definido. Por favor, contate a administração",
"insufficientBalance": "Saldo insuficiente para prosseguir com a finalização da compra."
},
"deliveryAddress": "Endereço de entrega",
"deliveryInformation": "Informações de entrega",
Expand Down
4 changes: 2 additions & 2 deletions src/openapi/cyclos-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ info:

For details of the deprecated elements (operations and model) please visit the
[deprecation notes
page](https://documentation.cyclos.org/4.16.3/api-deprecation.html)
page](https://documentation.cyclos.org/4.16.4/api-deprecation.html)
for this version.
version: '4.16.3'
version: '4.16.4'
servers:
- url: 'http://root/api'

Expand Down

0 comments on commit 3711309

Please sign in to comment.