@xsolla/payment-client-core 0.2.83 → 0.2.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/core/payment/actions/status-updated/status-updated.action.class.mjs +2 -1
- package/esm2022/lib/core/payment/actions/status-updated/status-updated.action.type.mjs +1 -1
- package/esm2022/lib/core/payment/form/converters/cvv/cvv.converter.mjs +3 -3
- package/esm2022/lib/core/payment/form/converters/zip/zip.converter.mjs +25 -9
- package/esm2022/lib/core/payment/requests/initialize/initialize.service.mjs +7 -4
- package/esm2022/lib/core/payment/requests/sync/sync.service.mjs +7 -4
- package/fesm2022/xsolla-payment-client-core.mjs +106 -85
- package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
- package/lib/core/payment/actions/status-updated/status-updated.action.type.d.ts +1 -0
- package/lib/core/payment/form/converters/zip/zip.converter.d.ts +4 -1
- package/lib/core/payment/requests/initialize/initialize.service.d.ts +3 -1
- package/lib/core/payment/requests/sync/sync.service.d.ts +3 -1
- package/package.json +1 -1
- package/src/i18n/ar.json +3 -1
- package/src/i18n/bg.json +3 -1
- package/src/i18n/cs.json +3 -1
- package/src/i18n/de.json +3 -1
- package/src/i18n/en.json +3 -1
- package/src/i18n/es.json +3 -1
- package/src/i18n/fil.json +3 -1
- package/src/i18n/fr.json +3 -1
- package/src/i18n/he.json +3 -1
- package/src/i18n/id.json +3 -1
- package/src/i18n/it.json +3 -1
- package/src/i18n/ja.json +3 -1
- package/src/i18n/km.json +3 -1
- package/src/i18n/ko.json +3 -1
- package/src/i18n/lo.json +3 -1
- package/src/i18n/ms.json +3 -1
- package/src/i18n/my.json +3 -1
- package/src/i18n/ne.json +3 -1
- package/src/i18n/nl.json +3 -1
- package/src/i18n/pl.json +4 -2
- package/src/i18n/pt.json +3 -1
- package/src/i18n/ro.json +3 -1
- package/src/i18n/ru.json +3 -1
- package/src/i18n/th.json +3 -1
- package/src/i18n/tr.json +3 -1
- package/src/i18n/vi.json +3 -1
- package/src/i18n/zh_HANS.json +3 -1
- package/src/i18n/zh_HANT.json +3 -1
- package/xsolla-payment-client-core-0.2.85.tgz +0 -0
- package/xsolla-payment-client-core-0.2.83.tgz +0 -0
|
@@ -1944,6 +1944,7 @@ class StatusUpdatedActionCreator {
|
|
|
1944
1944
|
isSuccess: status.isSuccess,
|
|
1945
1945
|
isCanceled: status.isCanceled,
|
|
1946
1946
|
group: status.group,
|
|
1947
|
+
email: status.email,
|
|
1947
1948
|
isSavePaymentMethodMode: Boolean(isSavePaymentMethodMode),
|
|
1948
1949
|
savePaymentMethodStatus,
|
|
1949
1950
|
},
|
|
@@ -2978,8 +2979,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
2978
2979
|
}]
|
|
2979
2980
|
}] });
|
|
2980
2981
|
|
|
2982
|
+
function isNull(value) {
|
|
2983
|
+
return value === null;
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
function isUndefined(value) {
|
|
2987
|
+
return typeof value === 'undefined';
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
class SessionService {
|
|
2991
|
+
constructor(window, settingsService) {
|
|
2992
|
+
this.window = window;
|
|
2993
|
+
this.settingsService = settingsService;
|
|
2994
|
+
this.cache = {};
|
|
2995
|
+
}
|
|
2996
|
+
/**
|
|
2997
|
+
* @param {string} key must be uniq entire all app
|
|
2998
|
+
* @param {unknown} value can be anything
|
|
2999
|
+
*/
|
|
3000
|
+
set(key, value) {
|
|
3001
|
+
this.cache[key] = value;
|
|
3002
|
+
try {
|
|
3003
|
+
this.window.sessionStorage.setItem(this.getStorageKey(key), JSON.stringify(value));
|
|
3004
|
+
}
|
|
3005
|
+
catch (error) {
|
|
3006
|
+
console.warn('Session storage not available.');
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
get(key) {
|
|
3010
|
+
const cacheValue = this.cache[key];
|
|
3011
|
+
if (!isUndefined(cacheValue)) {
|
|
3012
|
+
return cacheValue;
|
|
3013
|
+
}
|
|
3014
|
+
try {
|
|
3015
|
+
const storageValue = this.window.sessionStorage.getItem(this.getStorageKey(key));
|
|
3016
|
+
if (isNull(storageValue)) {
|
|
3017
|
+
return null;
|
|
3018
|
+
}
|
|
3019
|
+
return JSON.parse(storageValue);
|
|
3020
|
+
}
|
|
3021
|
+
catch (error) {
|
|
3022
|
+
return null;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
getStorageKey(key) {
|
|
3026
|
+
return `${key}${this.settingsService.token}`;
|
|
3027
|
+
}
|
|
3028
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, deps: [{ token: windowToken }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3029
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, providedIn: 'root' }); }
|
|
3030
|
+
}
|
|
3031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, decorators: [{
|
|
3032
|
+
type: Injectable,
|
|
3033
|
+
args: [{
|
|
3034
|
+
providedIn: 'root',
|
|
3035
|
+
}]
|
|
3036
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3037
|
+
type: Inject,
|
|
3038
|
+
args: [windowToken]
|
|
3039
|
+
}] }, { type: SettingsService }] });
|
|
3040
|
+
|
|
2981
3041
|
class InitializeService {
|
|
2982
|
-
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService) {
|
|
3042
|
+
constructor(responseFactory, xpsApiService, settingsService, countryService, nextActionService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService, sessionService) {
|
|
2983
3043
|
this.responseFactory = responseFactory;
|
|
2984
3044
|
this.xpsApiService = xpsApiService;
|
|
2985
3045
|
this.settingsService = settingsService;
|
|
@@ -2990,9 +3050,11 @@ class InitializeService {
|
|
|
2990
3050
|
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
2991
3051
|
this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
|
|
2992
3052
|
this.paymentSettingsService = paymentSettingsService;
|
|
3053
|
+
this.sessionService = sessionService;
|
|
2993
3054
|
}
|
|
2994
3055
|
async request(config) {
|
|
2995
3056
|
const paymentSettingsParams = this.paymentSettingsService.getPaymentSettingsParams(config);
|
|
3057
|
+
this.sessionService.set('cardNumberCountry', null);
|
|
2996
3058
|
const requestParams = {
|
|
2997
3059
|
access_token: this.settingsService.token,
|
|
2998
3060
|
pid: String(config.paymentMethodId),
|
|
@@ -3039,7 +3101,7 @@ class InitializeService {
|
|
|
3039
3101
|
}
|
|
3040
3102
|
this.encryptCreditCardService.setPublicKey(atob(publicKeyField.value));
|
|
3041
3103
|
}
|
|
3042
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: XpsApiService }, { token: SettingsService }, { token: CountryService }, { token: NextActionService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3104
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, deps: [{ token: initializeResponseFactoryToken }, { token: XpsApiService }, { token: SettingsService }, { token: CountryService }, { token: NextActionService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3043
3105
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, providedIn: 'root' }); }
|
|
3044
3106
|
}
|
|
3045
3107
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: InitializeService, decorators: [{
|
|
@@ -3050,7 +3112,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
3050
3112
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
3051
3113
|
type: Inject,
|
|
3052
3114
|
args: [initializeResponseFactoryToken]
|
|
3053
|
-
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }] });
|
|
3115
|
+
}] }, { type: XpsApiService }, { type: SettingsService }, { type: CountryService }, { type: NextActionService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }, { type: SessionService }] });
|
|
3054
3116
|
|
|
3055
3117
|
class XpsApiPartRequest {
|
|
3056
3118
|
addXpsParameters(parameters) {
|
|
@@ -3321,7 +3383,7 @@ const syncResponseFactoryProvider = {
|
|
|
3321
3383
|
};
|
|
3322
3384
|
|
|
3323
3385
|
class SyncService extends EmitDataService {
|
|
3324
|
-
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService) {
|
|
3386
|
+
constructor(requestFactory, responseFactory, xpsApiService, nextActionService, settingsService, xpsResponseErrorsMappingService, encryptCreditCardService, showErrorsActionCreator, userBehaviourAnalyticsService, paymentSettingsService, sessionService) {
|
|
3325
3387
|
super();
|
|
3326
3388
|
this.requestFactory = requestFactory;
|
|
3327
3389
|
this.responseFactory = responseFactory;
|
|
@@ -3333,6 +3395,7 @@ class SyncService extends EmitDataService {
|
|
|
3333
3395
|
this.showErrorsActionCreator = showErrorsActionCreator;
|
|
3334
3396
|
this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
|
|
3335
3397
|
this.paymentSettingsService = paymentSettingsService;
|
|
3398
|
+
this.sessionService = sessionService;
|
|
3336
3399
|
this.prevFieldSyncStates = {};
|
|
3337
3400
|
this.form = new UntypedFormGroup({});
|
|
3338
3401
|
this.paymentConfiguration = null;
|
|
@@ -3436,6 +3499,7 @@ class SyncService extends EmitDataService {
|
|
|
3436
3499
|
.directPaymentRequest(encryptedRequest)
|
|
3437
3500
|
.then((xpsResponse) => {
|
|
3438
3501
|
const response = this.xpsResponseErrorsMappingService.mapErrors(xpsResponse);
|
|
3502
|
+
this.sessionService.set('cardNumberCountry', response.cardBinCountry);
|
|
3439
3503
|
this.emitFormErrors(response);
|
|
3440
3504
|
this.emit(response);
|
|
3441
3505
|
return this.responseFactory(field, response);
|
|
@@ -3471,7 +3535,7 @@ class SyncService extends EmitDataService {
|
|
|
3471
3535
|
}
|
|
3472
3536
|
this.fieldSyncTimers[field.name] = timerId;
|
|
3473
3537
|
}
|
|
3474
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, deps: [{ token: syncRequestFactoryToken }, { token: syncResponseFactoryToken }, { token: XpsApiService }, { token: NextActionService }, { token: SettingsService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3538
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, deps: [{ token: syncRequestFactoryToken }, { token: syncResponseFactoryToken }, { token: XpsApiService }, { token: NextActionService }, { token: SettingsService }, { token: XpsResponseErrorsMappingService }, { token: EncryptCreditCardService }, { token: ShowErrorsActionCreator }, { token: UserBehaviourAnalyticsService }, { token: PaymentSettingsService }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3475
3539
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, providedIn: 'root' }); }
|
|
3476
3540
|
}
|
|
3477
3541
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SyncService, decorators: [{
|
|
@@ -3485,7 +3549,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
3485
3549
|
}] }, { type: undefined, decorators: [{
|
|
3486
3550
|
type: Inject,
|
|
3487
3551
|
args: [syncResponseFactoryToken]
|
|
3488
|
-
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }] });
|
|
3552
|
+
}] }, { type: XpsApiService }, { type: NextActionService }, { type: SettingsService }, { type: XpsResponseErrorsMappingService }, { type: EncryptCreditCardService }, { type: ShowErrorsActionCreator }, { type: UserBehaviourAnalyticsService }, { type: PaymentSettingsService }, { type: SessionService }] });
|
|
3489
3553
|
|
|
3490
3554
|
function isObject(value) {
|
|
3491
3555
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -3640,18 +3704,6 @@ class TextControlConfig extends ControlConfig {
|
|
|
3640
3704
|
}
|
|
3641
3705
|
}
|
|
3642
3706
|
|
|
3643
|
-
function minLengthValidator(minLength) {
|
|
3644
|
-
return convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength }), {
|
|
3645
|
-
minLength,
|
|
3646
|
-
});
|
|
3647
|
-
}
|
|
3648
|
-
|
|
3649
|
-
function maxLengthValidator(maxLength) {
|
|
3650
|
-
return convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength }), {
|
|
3651
|
-
maxLength,
|
|
3652
|
-
});
|
|
3653
|
-
}
|
|
3654
|
-
|
|
3655
3707
|
const restrictedValueValidator = (restrictedValue) => {
|
|
3656
3708
|
return ({ value }) => {
|
|
3657
3709
|
return value !== restrictedValue
|
|
@@ -3666,24 +3718,38 @@ const restrictedValueValidator = (restrictedValue) => {
|
|
|
3666
3718
|
};
|
|
3667
3719
|
|
|
3668
3720
|
class ZipConverter extends Converter {
|
|
3669
|
-
constructor(syncService, countryService) {
|
|
3721
|
+
constructor(syncService, countryService, sessionService) {
|
|
3670
3722
|
super(syncService);
|
|
3671
3723
|
this.countryService = countryService;
|
|
3724
|
+
this.sessionService = sessionService;
|
|
3672
3725
|
this.minLength = 3;
|
|
3673
3726
|
this.maxLength = 10;
|
|
3674
3727
|
this.usCountryLength = 5;
|
|
3675
3728
|
}
|
|
3676
3729
|
get isUsCountry() {
|
|
3677
|
-
|
|
3730
|
+
const currentCountry = this.countryService.getCountry().toUpperCase();
|
|
3731
|
+
const cardNumberCountry = this.sessionService.get('cardNumberCountry');
|
|
3732
|
+
return (cardNumberCountry ?? currentCountry) === 'US';
|
|
3733
|
+
}
|
|
3734
|
+
get isCanadaCountry() {
|
|
3735
|
+
const currentCountry = this.countryService.getCountry().toUpperCase();
|
|
3736
|
+
const cardNumberCountry = this.sessionService.get('cardNumberCountry');
|
|
3737
|
+
return (cardNumberCountry ?? currentCountry) === 'CA';
|
|
3678
3738
|
}
|
|
3679
3739
|
getValidators(field) {
|
|
3680
3740
|
const minLength = this.isUsCountry ? this.usCountryLength : this.minLength;
|
|
3681
3741
|
const maxLength = this.isUsCountry ? this.usCountryLength : this.maxLength;
|
|
3682
3742
|
const validators = super
|
|
3683
3743
|
.getValidators(field)
|
|
3684
|
-
.concat([
|
|
3744
|
+
.concat([
|
|
3745
|
+
convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength })),
|
|
3746
|
+
convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength })),
|
|
3747
|
+
]);
|
|
3685
3748
|
if (this.isUsCountry) {
|
|
3686
|
-
validators.push(convert(restrictedValueValidator('00000'), TranslateHelper.t('errors.validation.zip-pattern', 'Enter a valid ZIP code')
|
|
3749
|
+
validators.push(convert(restrictedValueValidator('00000'), TranslateHelper.t('errors.validation.zip-pattern', 'Enter a valid ZIP code')));
|
|
3750
|
+
}
|
|
3751
|
+
if (this.isCanadaCountry) {
|
|
3752
|
+
validators.push(convert(Validators.pattern(/^[A-Za-z0-9]{3}\s?[A-Za-z0-9]{0,3}$/), TranslateHelper.t('errors.validation.zip-pattern-non-us', 'Enter a valid postal code')));
|
|
3687
3753
|
}
|
|
3688
3754
|
return validators;
|
|
3689
3755
|
}
|
|
@@ -3698,10 +3764,12 @@ class ZipConverter extends Converter {
|
|
|
3698
3764
|
unmaskModelValue: true,
|
|
3699
3765
|
showMask: true,
|
|
3700
3766
|
};
|
|
3767
|
+
config.placeholder = TranslateHelper.t('zip.converter.placeholder', 'ZIP code');
|
|
3701
3768
|
config.inputMode = 'numeric';
|
|
3702
3769
|
}
|
|
3703
3770
|
else {
|
|
3704
3771
|
config.maxLength = this.maxLength;
|
|
3772
|
+
config.placeholder = TranslateHelper.t('zip.converter.placeholder-non-us', 'Postal code');
|
|
3705
3773
|
}
|
|
3706
3774
|
return config;
|
|
3707
3775
|
}
|
|
@@ -3711,12 +3779,12 @@ class ZipConverter extends Converter {
|
|
|
3711
3779
|
getDataType() {
|
|
3712
3780
|
return 'text';
|
|
3713
3781
|
}
|
|
3714
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter, deps: [{ token: SyncService }, { token: CountryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3782
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter, deps: [{ token: SyncService }, { token: CountryService }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3715
3783
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter }); }
|
|
3716
3784
|
}
|
|
3717
3785
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: ZipConverter, decorators: [{
|
|
3718
3786
|
type: Injectable
|
|
3719
|
-
}], ctorParameters: () => [{ type: SyncService }, { type: CountryService }] });
|
|
3787
|
+
}], ctorParameters: () => [{ type: SyncService }, { type: CountryService }, { type: SessionService }] });
|
|
3720
3788
|
|
|
3721
3789
|
function isEmptyInputValue(value) {
|
|
3722
3790
|
return value == null || value.length === 0;
|
|
@@ -3964,8 +4032,8 @@ class CvvConverter extends Converter {
|
|
|
3964
4032
|
break;
|
|
3965
4033
|
}
|
|
3966
4034
|
case CreditCardTypes.MAESTRO: {
|
|
3967
|
-
this.maxFieldLength =
|
|
3968
|
-
validators.push(getPatternValidator(
|
|
4035
|
+
this.maxFieldLength = 4;
|
|
4036
|
+
validators.push(getPatternValidator(/^(?:\d{3,4})?$/));
|
|
3969
4037
|
break;
|
|
3970
4038
|
}
|
|
3971
4039
|
default: {
|
|
@@ -4473,6 +4541,18 @@ function phoneValidator() {
|
|
|
4473
4541
|
return convert(Validators.pattern(/^\d*$/), TranslateHelper.t('errors.validation.phone-pattern', 'Enter a valid phone'));
|
|
4474
4542
|
}
|
|
4475
4543
|
|
|
4544
|
+
function minLengthValidator(minLength) {
|
|
4545
|
+
return convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength }), {
|
|
4546
|
+
minLength,
|
|
4547
|
+
});
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4550
|
+
function maxLengthValidator(maxLength) {
|
|
4551
|
+
return convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength }), {
|
|
4552
|
+
maxLength,
|
|
4553
|
+
});
|
|
4554
|
+
}
|
|
4555
|
+
|
|
4476
4556
|
class PhoneControlConfig extends ControlConfig {
|
|
4477
4557
|
constructor() {
|
|
4478
4558
|
super(...arguments);
|
|
@@ -4938,65 +5018,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
|
4938
5018
|
args: [statusResponseFactoryToken]
|
|
4939
5019
|
}] }] });
|
|
4940
5020
|
|
|
4941
|
-
function isNull(value) {
|
|
4942
|
-
return value === null;
|
|
4943
|
-
}
|
|
4944
|
-
|
|
4945
|
-
function isUndefined(value) {
|
|
4946
|
-
return typeof value === 'undefined';
|
|
4947
|
-
}
|
|
4948
|
-
|
|
4949
|
-
class SessionService {
|
|
4950
|
-
constructor(window, settingsService) {
|
|
4951
|
-
this.window = window;
|
|
4952
|
-
this.settingsService = settingsService;
|
|
4953
|
-
this.cache = {};
|
|
4954
|
-
}
|
|
4955
|
-
/**
|
|
4956
|
-
* @param {string} key must be uniq entire all app
|
|
4957
|
-
* @param {unknown} value can be anything
|
|
4958
|
-
*/
|
|
4959
|
-
set(key, value) {
|
|
4960
|
-
this.cache[key] = value;
|
|
4961
|
-
try {
|
|
4962
|
-
this.window.sessionStorage.setItem(this.getStorageKey(key), JSON.stringify(value));
|
|
4963
|
-
}
|
|
4964
|
-
catch (error) {
|
|
4965
|
-
console.warn('Session storage not available.');
|
|
4966
|
-
}
|
|
4967
|
-
}
|
|
4968
|
-
get(key) {
|
|
4969
|
-
const cacheValue = this.cache[key];
|
|
4970
|
-
if (!isUndefined(cacheValue)) {
|
|
4971
|
-
return cacheValue;
|
|
4972
|
-
}
|
|
4973
|
-
try {
|
|
4974
|
-
const storageValue = this.window.sessionStorage.getItem(this.getStorageKey(key));
|
|
4975
|
-
if (isNull(storageValue)) {
|
|
4976
|
-
return null;
|
|
4977
|
-
}
|
|
4978
|
-
return JSON.parse(storageValue);
|
|
4979
|
-
}
|
|
4980
|
-
catch (error) {
|
|
4981
|
-
return null;
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
getStorageKey(key) {
|
|
4985
|
-
return `${key}${this.settingsService.token}`;
|
|
4986
|
-
}
|
|
4987
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, deps: [{ token: windowToken }, { token: SettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4988
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, providedIn: 'root' }); }
|
|
4989
|
-
}
|
|
4990
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: SessionService, decorators: [{
|
|
4991
|
-
type: Injectable,
|
|
4992
|
-
args: [{
|
|
4993
|
-
providedIn: 'root',
|
|
4994
|
-
}]
|
|
4995
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4996
|
-
type: Inject,
|
|
4997
|
-
args: [windowToken]
|
|
4998
|
-
}] }, { type: SettingsService }] });
|
|
4999
|
-
|
|
5000
5021
|
function extractMoneyCurrency(money, allowZero = true) {
|
|
5001
5022
|
return {
|
|
5002
5023
|
amount: money?.amount ?? (allowZero ? 0 : null),
|