@xsolla/payment-client-core 0.2.72 → 0.2.73

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.
Files changed (70) hide show
  1. package/esm2022/lib/core/payment/form/converters/birth-date/birth-date.converter.mjs +7 -7
  2. package/esm2022/lib/core/payment/form/converters/card-expiration/card-expiration.converter.mjs +4 -3
  3. package/esm2022/lib/core/payment/form/converters/card-month/card-month.converter.mjs +4 -3
  4. package/esm2022/lib/core/payment/form/converters/card-year/card-year.converter.mjs +4 -3
  5. package/esm2022/lib/core/payment/form/converters/checkbox/checkbox.converter.mjs +4 -6
  6. package/esm2022/lib/core/payment/form/converters/converter.abstract.mjs +1 -3
  7. package/esm2022/lib/core/payment/form/converters/coupon/coupon.converter.mjs +3 -2
  8. package/esm2022/lib/core/payment/form/converters/cpf-name/cpf-name.converter.mjs +7 -7
  9. package/esm2022/lib/core/payment/form/converters/cpf-number/cpf-number.converter.mjs +4 -3
  10. package/esm2022/lib/core/payment/form/converters/cvv/cvv.converter.mjs +5 -7
  11. package/esm2022/lib/core/payment/form/converters/street-number/street-number.converter.mjs +3 -5
  12. package/esm2022/lib/core/payment/form/converters/zip/zip.converter.mjs +4 -6
  13. package/esm2022/lib/core/payment/form/validators/birth-date/birth-date.validator.mjs +4 -6
  14. package/esm2022/lib/core/payment/form/validators/card-expiration-date-validator/card-expiration-date.validator.mjs +9 -18
  15. package/esm2022/lib/core/payment/form/validators/card-month/card-month.validator.mjs +6 -11
  16. package/esm2022/lib/core/payment/form/validators/card-year/card-year.validator.mjs +6 -11
  17. package/esm2022/lib/core/payment/form/validators/coupon/coupon-validator.mjs +5 -6
  18. package/esm2022/lib/core/payment/form/validators/credit-card-length/credit-card-max-length.validator.mjs +3 -4
  19. package/esm2022/lib/core/payment/form/validators/credit-card-length/credit-card-min-length.validator.mjs +3 -4
  20. package/esm2022/lib/core/payment/form/validators/email/email-validator.mjs +4 -5
  21. package/esm2022/lib/core/payment/form/validators/luhn-formula-validator/luhn-formula.validator.mjs +3 -6
  22. package/esm2022/lib/core/payment/form/validators/max-length-validator.mjs +3 -4
  23. package/esm2022/lib/core/payment/form/validators/min-length-validator.mjs +3 -4
  24. package/esm2022/lib/core/payment/form/validators/phone-validator.mjs +3 -5
  25. package/esm2022/lib/core/payment/form/validators/required/required.validator.mjs +4 -5
  26. package/esm2022/lib/core/payment/form/validators/restricted-value/restricted-value.validator.mjs +10 -2
  27. package/esm2022/lib/core/payment/form/validators/validation-error-params.interface.mjs +1 -1
  28. package/esm2022/lib/core/settings/configuration.interface.mjs +1 -1
  29. package/esm2022/lib/core-library.module.mjs +32 -2
  30. package/esm2022/lib/core-library.service.mjs +9 -4
  31. package/esm2022/lib/shared/translate/translate.helper.mjs +22 -0
  32. package/fesm2022/xsolla-payment-client-core.mjs +125 -128
  33. package/fesm2022/xsolla-payment-client-core.mjs.map +1 -1
  34. package/lib/core/payment/form/validators/validation-error-params.interface.d.ts +0 -2
  35. package/lib/core/settings/configuration.interface.d.ts +1 -0
  36. package/lib/core-library.service.d.ts +3 -1
  37. package/lib/shared/translate/translate.helper.d.ts +7 -0
  38. package/package.json +1 -1
  39. package/src/i18n/ar.json +40 -0
  40. package/src/i18n/bg.json +40 -0
  41. package/src/i18n/cs.json +40 -0
  42. package/src/i18n/de.json +40 -0
  43. package/src/i18n/en.json +40 -0
  44. package/src/i18n/es.json +40 -0
  45. package/src/i18n/fil.json +40 -0
  46. package/src/i18n/fr.json +40 -0
  47. package/src/i18n/he.json +40 -0
  48. package/src/i18n/id.json +40 -0
  49. package/src/i18n/it.json +40 -0
  50. package/src/i18n/ja.json +40 -0
  51. package/src/i18n/km.json +40 -0
  52. package/src/i18n/ko.json +40 -0
  53. package/src/i18n/lo.json +40 -0
  54. package/src/i18n/ms.json +40 -0
  55. package/src/i18n/my.json +40 -0
  56. package/src/i18n/ne.json +40 -0
  57. package/src/i18n/nl.json +40 -0
  58. package/src/i18n/pl.json +40 -0
  59. package/src/i18n/pt.json +40 -0
  60. package/src/i18n/ro.json +40 -0
  61. package/src/i18n/ru.json +40 -0
  62. package/src/i18n/th.json +40 -0
  63. package/src/i18n/tr.json +40 -0
  64. package/src/i18n/vi.json +40 -0
  65. package/src/i18n/zh_HANS.json +40 -0
  66. package/src/i18n/zh_HANT.json +40 -0
  67. package/xsolla-payment-client-core-0.2.73.tgz +0 -0
  68. package/esm2022/lib/core/payment/form/validators/validation-error-id.enum.mjs +0 -24
  69. package/lib/core/payment/form/validators/validation-error-id.enum.d.ts +0 -22
  70. package/xsolla-payment-client-core-0.2.72.tgz +0 -0
@@ -2,12 +2,37 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, Inject, isDevMode, Pipe, NgModule } from '@angular/core';
3
3
  import { firstValueFrom, lastValueFrom, map, Subject, BehaviorSubject, filter as filter$1, takeUntil, skip, take, of, interval, throwError, share } from 'rxjs';
4
4
  import * as i1 from '@angular/common/http';
5
- import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
5
+ import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS, provideHttpClient } from '@angular/common/http';
6
6
  import { UntypedFormGroup, Validators, UntypedFormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
7
7
  import JSEncrypt from 'jsencrypt';
8
8
  import { filter, map as map$1, tap, debounce, debounceTime, catchError } from 'rxjs/operators';
9
+ import * as i23 from '@ngx-translate/core';
10
+ import { provideTranslateService, MissingTranslationHandler } from '@ngx-translate/core';
9
11
  import * as i1$1 from '@angular/router';
10
12
  import { CommonModule } from '@angular/common';
13
+ import { provideTranslateHttpLoader } from '@ngx-translate/http-loader';
14
+
15
+ class TranslateHelper {
16
+ static init(service) {
17
+ this.service = service;
18
+ }
19
+ static t(key, defaultValue, interpolateParams) {
20
+ return (this.service.instant(key, interpolateParams) ??
21
+ defaultValue);
22
+ }
23
+ static getLocale(locale) {
24
+ if (locale === 'tw') {
25
+ return 'zh-Hant';
26
+ }
27
+ if (locale === 'cn') {
28
+ return 'zh-Hans';
29
+ }
30
+ if (locale === 'ph') {
31
+ return 'fil';
32
+ }
33
+ return locale;
34
+ }
35
+ }
11
36
 
12
37
  class AppError extends Error {
13
38
  constructor(message) {
@@ -3330,41 +3355,15 @@ function convert(validator, message, params) {
3330
3355
  };
3331
3356
  }
3332
3357
 
3333
- var ValidationErrorId;
3334
- (function (ValidationErrorId) {
3335
- ValidationErrorId["birthDatePattern"] = "birthDatePattern";
3336
- ValidationErrorId["expirationLength"] = "expirationLength";
3337
- ValidationErrorId["expirationMonthPattern"] = "expirationMonthPattern";
3338
- ValidationErrorId["expirationMinMonth"] = "expirationMinMonth";
3339
- ValidationErrorId["expirationMaxMonth"] = "expirationMaxMonth";
3340
- ValidationErrorId["expirationYearPattern"] = "expirationYearPattern";
3341
- ValidationErrorId["expirationMinYear"] = "expirationMinYear";
3342
- ValidationErrorId["expirationMaxYear"] = "expirationMaxYear";
3343
- ValidationErrorId["couponPattern"] = "couponPattern";
3344
- ValidationErrorId["emailPattern"] = "emailPattern";
3345
- ValidationErrorId["cardNumberPattern"] = "cardNumberPattern";
3346
- ValidationErrorId["required"] = "required";
3347
- ValidationErrorId["minLength"] = "minLength";
3348
- ValidationErrorId["maxLength"] = "maxLength";
3349
- ValidationErrorId["cpfNumberPattern"] = "cpfNumberPattern";
3350
- ValidationErrorId["cvvPattern"] = "cvvPattern";
3351
- ValidationErrorId["phonePattern"] = "phonePattern";
3352
- ValidationErrorId["buildingNumberPattern"] = "buildingNumberPattern";
3353
- ValidationErrorId["zipPattern"] = "zipPattern";
3354
- ValidationErrorId["dataPattern"] = "dataPattern";
3355
- })(ValidationErrorId || (ValidationErrorId = {}));
3356
-
3357
3358
  const emailRegexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; // eslint-disable-line
3358
3359
  function convertedEmailValidator() {
3359
- return convert(Validators.pattern(emailRegexp), 'Enter a valid email', {
3360
- id: ValidationErrorId.emailPattern,
3361
- });
3360
+ const message = TranslateHelper.t('errors.validation.email-pattern', 'Enter a valid email');
3361
+ return convert(Validators.pattern(emailRegexp), message);
3362
3362
  }
3363
3363
 
3364
3364
  function convertedRequiredValidator() {
3365
- return convert(Validators.required, 'Required', {
3366
- id: ValidationErrorId.required,
3367
- });
3365
+ console.log();
3366
+ return convert(Validators.required, TranslateHelper.t('errors.validation.required', 'Required'));
3368
3367
  }
3369
3368
 
3370
3369
  class Converter {
@@ -3398,7 +3397,6 @@ class Converter {
3398
3397
  ? field.validation_error_msg
3399
3398
  : 'Enter valid data';
3400
3399
  validators.push(convert(Validators.pattern(pattern), errorMessage, {
3401
- id: ValidationErrorId.dataPattern,
3402
3400
  defaultMessage: field.validation_error_msg,
3403
3401
  }));
3404
3402
  }
@@ -3492,22 +3490,27 @@ class TextControlConfig extends ControlConfig {
3492
3490
  }
3493
3491
 
3494
3492
  function minLengthValidator(minLength) {
3495
- return convert(Validators.minLength(minLength), `Enter at least ${minLength} characters`, {
3496
- id: ValidationErrorId.minLength,
3493
+ return convert(Validators.minLength(minLength), TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength }), {
3497
3494
  minLength,
3498
3495
  });
3499
3496
  }
3500
3497
 
3501
3498
  function maxLengthValidator(maxLength) {
3502
- return convert(Validators.maxLength(maxLength), `Enter no more than ${maxLength} characters`, {
3503
- id: ValidationErrorId.maxLength,
3499
+ return convert(Validators.maxLength(maxLength), TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength }), {
3504
3500
  maxLength,
3505
3501
  });
3506
3502
  }
3507
3503
 
3508
3504
  const restrictedValueValidator = (restrictedValue) => {
3509
3505
  return ({ value }) => {
3510
- return value !== restrictedValue ? null : { valueAllowed: false };
3506
+ return value !== restrictedValue
3507
+ ? null
3508
+ : {
3509
+ valueAllowed: {
3510
+ message: TranslateHelper.t('errors.validation.restrictedValue', 'This value is not allowed'),
3511
+ params: { restrictedValue },
3512
+ },
3513
+ };
3511
3514
  };
3512
3515
  };
3513
3516
 
@@ -3529,16 +3532,14 @@ class ZipConverter extends Converter {
3529
3532
  .getValidators(field)
3530
3533
  .concat([minLengthValidator(minLength), maxLengthValidator(maxLength)]);
3531
3534
  if (this.isUsCountry) {
3532
- validators.push(convert(restrictedValueValidator('00000'), 'Enter a valid ZIP code', {
3533
- id: ValidationErrorId.zipPattern,
3534
- }));
3535
+ validators.push(convert(restrictedValueValidator('00000'), TranslateHelper.t('zip.converter.validation.pattern', 'Enter a valid ZIP code'), {}));
3535
3536
  }
3536
3537
  return validators;
3537
3538
  }
3538
3539
  createControlConfig(field) {
3539
3540
  const config = this.createDefaultControlConfig(TextControlConfig, field);
3540
3541
  config.icon = 'location';
3541
- config.placeholder = 'ZIP code';
3542
+ config.placeholder = TranslateHelper.t('zip.converter.placeholder', 'ZIP code');
3542
3543
  if (this.isUsCountry) {
3543
3544
  config.maskConfig = {
3544
3545
  mask: new Array(this.usCountryLength).fill('9').join(''),
@@ -3584,10 +3585,7 @@ const luhnFormulaValidator = ({ value }) => {
3584
3585
  }
3585
3586
  const error = {
3586
3587
  rewritableError: {
3587
- message: 'Enter a valid card number',
3588
- params: {
3589
- id: ValidationErrorId.cardNumberPattern,
3590
- },
3588
+ message: TranslateHelper.t('errors.validation.cardNumber', 'Enter a valid card number'),
3591
3589
  },
3592
3590
  };
3593
3591
  if (/[^0-9 -]+/.test(value)) {
@@ -3638,10 +3636,9 @@ class CreditCardMaxLengthValidator {
3638
3636
  return null;
3639
3637
  return {
3640
3638
  rewritableError: {
3641
- message: `Enter no more than ${maxLength} characters`,
3639
+ message: TranslateHelper.t('errors.validation.max-length', `Enter no more than ${maxLength} characters`, { maxLength }),
3642
3640
  number: maxLength,
3643
3641
  params: {
3644
- id: ValidationErrorId.maxLength,
3645
3642
  maxLength,
3646
3643
  },
3647
3644
  },
@@ -3669,10 +3666,9 @@ class CreditCardMinLengthValidator {
3669
3666
  return null;
3670
3667
  return {
3671
3668
  rewritableError: {
3672
- message: `Enter at least ${minLength} characters`,
3669
+ message: TranslateHelper.t('errors.validation.min-length', `Enter at least ${minLength} characters`, { minLength }),
3673
3670
  number: minLength,
3674
3671
  params: {
3675
- id: ValidationErrorId.minLength,
3676
3672
  minLength,
3677
3673
  },
3678
3674
  },
@@ -3747,25 +3743,20 @@ function cardMonthValidator(formState) {
3747
3743
  const twoDigitsRegex = new RegExp(/^\d{2}$/);
3748
3744
  const fieldCommonLength = 2;
3749
3745
  if (value.length !== fieldCommonLength) {
3750
- return sendErrMessage$2(`Enter ${fieldCommonLength} characters`, {
3751
- id: ValidationErrorId.expirationLength,
3746
+ return sendErrMessage$2(TranslateHelper.t('errors.validation.expiration-length', `Enter ${fieldCommonLength} characters`, { requiredLength: fieldCommonLength }), {
3752
3747
  requiredLength: fieldCommonLength,
3753
3748
  });
3754
3749
  }
3755
3750
  if (!twoDigitsRegex.test(value)) {
3756
- return sendErrMessage$2('Enter a valid expiration month', {
3757
- id: ValidationErrorId.expirationMonthPattern,
3758
- });
3751
+ return sendErrMessage$2(TranslateHelper.t('errors.validation.expiration-month-pattern', 'Enter a valid expiration month'), {});
3759
3752
  }
3760
3753
  if (Number(value) < minMonth) {
3761
- return sendErrMessage$2(`Enter a month greater than or equal to ${minMonth}`, {
3762
- id: ValidationErrorId.expirationMinMonth,
3754
+ return sendErrMessage$2(TranslateHelper.t('errors.validation.expiration-min-month', `Enter a month that includes or comes after ${minMonth}`, { minMonth }), {
3763
3755
  minMonth,
3764
3756
  });
3765
3757
  }
3766
3758
  if (Number(value) > maxMonths$1) {
3767
- return sendErrMessage$2(`Enter a month less than or equal to ${maxMonths$1}`, {
3768
- id: ValidationErrorId.expirationMaxMonth,
3759
+ return sendErrMessage$2(TranslateHelper.t('errors.validation.expiration-max-month', `Enter a month that includes or comes before ${maxMonths$1}`, { maxMonth: maxMonths$1 }), {
3769
3760
  maxMonth: maxMonths$1,
3770
3761
  });
3771
3762
  }
@@ -3787,8 +3778,8 @@ class CardMonthConverter extends Converter {
3787
3778
  guide: false,
3788
3779
  };
3789
3780
  config.inputMode = 'numeric';
3790
- config.placeholder = `MM`;
3791
- config.title = `MM`;
3781
+ config.placeholder = TranslateHelper.t('card-month.converter.placeholder', 'MM');
3782
+ config.title = TranslateHelper.t('card-month.converter.title', 'MM');
3792
3783
  config.disabled = formState?.disabled ?? false;
3793
3784
  return config;
3794
3785
  }
@@ -3814,9 +3805,7 @@ class CvvConverter extends Converter {
3814
3805
  getValidators(field, formState) {
3815
3806
  const validators = super.getValidators(field);
3816
3807
  const activeCardType = formState ? formState.activeCardType : null;
3817
- const getPatternValidator = (pattern) => convert(Validators.pattern(pattern), 'Enter a valid CVV/CVC', {
3818
- id: ValidationErrorId.cvvPattern,
3819
- });
3808
+ const getPatternValidator = (pattern) => convert(Validators.pattern(pattern), TranslateHelper.t('errors.validation.cvv-pattern', 'Enter a valid CVV/CVC'), {});
3820
3809
  switch (activeCardType) {
3821
3810
  case CreditCardTypes.AMERICAN_EXPRESS: {
3822
3811
  this.maxFieldLength = 4;
@@ -3843,13 +3832,13 @@ class CvvConverter extends Converter {
3843
3832
  guide: false,
3844
3833
  };
3845
3834
  config.tooltip = {
3846
- text: 'The code is on the back of your card',
3835
+ text: TranslateHelper.t('cvv.converter.tooltip.text', 'Where to find your CVV/CVC'),
3847
3836
  image: 'cvv',
3848
3837
  parentField: FieldNames.cvv,
3849
3838
  position: 'input',
3850
3839
  analyticsAction: 'show-cvv-tooltip',
3851
3840
  };
3852
- config.placeholder = `CVV2/CVC2`;
3841
+ config.placeholder = TranslateHelper.t('cvv.converter.placeholder', 'CVV2/CVC2');
3853
3842
  config.inputMode = 'numeric';
3854
3843
  config.shouldHideUserInput = this.shouldHideUserInput();
3855
3844
  config.disabled = formState?.disabled ?? false;
@@ -3877,10 +3866,8 @@ const birthdateValidator = ({ value }) => {
3877
3866
  }
3878
3867
  const error = {
3879
3868
  invalidBirthDate: {
3880
- message: 'Enter a valid birth date',
3881
- params: {
3882
- id: ValidationErrorId.birthDatePattern,
3883
- },
3869
+ message: TranslateHelper.t('errors.validation.birthDate', 'Enter a valid birth date'),
3870
+ params: {},
3884
3871
  },
3885
3872
  };
3886
3873
  const dateArr = value.split('/');
@@ -3915,10 +3902,10 @@ class BirthDateConverter extends Converter {
3915
3902
  super(syncService);
3916
3903
  }
3917
3904
  getValidators(field) {
3918
- return super.getValidators(field).concat([
3919
- convert(Validators.pattern(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}$/), 'Enter a valid birth date', {
3920
- id: ValidationErrorId.birthDatePattern,
3921
- }),
3905
+ return super
3906
+ .getValidators(field)
3907
+ .concat([
3908
+ convert(Validators.pattern(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}$/), TranslateHelper.t('birth-date.converter.validation.pattern', 'Enter a valid birth date')),
3922
3909
  birthdateValidator,
3923
3910
  ]);
3924
3911
  }
@@ -3929,7 +3916,7 @@ class BirthDateConverter extends Converter {
3929
3916
  unmaskModelValue: false,
3930
3917
  guide: false,
3931
3918
  };
3932
- config.placeholder = `DD/MM/YYYY`;
3919
+ config.placeholder = TranslateHelper.t('birth-date.converter.placeholder', 'DD/MM/YYYY');
3933
3920
  config.inputMode = 'numeric';
3934
3921
  return config;
3935
3922
  }
@@ -3967,16 +3954,16 @@ class CpfNameConverter extends Converter {
3967
3954
  super(syncService);
3968
3955
  }
3969
3956
  getValidators(field) {
3970
- return super.getValidators(field).concat([
3971
- convert(Validators.pattern(cpfNameRegex), 'Enter a valid CPF number', {
3972
- id: ValidationErrorId.cpfNumberPattern,
3973
- }),
3957
+ return super
3958
+ .getValidators(field)
3959
+ .concat([
3960
+ convert(Validators.pattern(cpfNameRegex), TranslateHelper.t('cpf-name.converter.validation.pattern', 'Enter a valid name'), {}),
3974
3961
  ]);
3975
3962
  }
3976
3963
  createControlConfig(field) {
3977
3964
  const config = this.createDefaultControlConfig(TextControlConfig, field);
3978
3965
  config.tooltip = {
3979
- text: `Where to find your name`,
3966
+ text: TranslateHelper.t('cpf-name.converter.tooltip.text', 'Where to find your name'),
3980
3967
  image: 'cpf-name',
3981
3968
  };
3982
3969
  return config;
@@ -4000,9 +3987,9 @@ class CpfNumberConverter extends Converter {
4000
3987
  guide: false,
4001
3988
  };
4002
3989
  config.inputMode = 'numeric';
4003
- config.placeholder = '000.000.000-00';
3990
+ config.placeholder = TranslateHelper.t('cpf-number.converter.placeholder', '000.000.000-00');
4004
3991
  config.tooltip = {
4005
- text: `Where to find your registration number`,
3992
+ text: TranslateHelper.t('cpf-number.converter.tooltip.text', 'Where to find your registration number'),
4006
3993
  image: 'cpf-number',
4007
3994
  };
4008
3995
  return config;
@@ -4021,9 +4008,7 @@ class StreetNumberConverter extends Converter {
4021
4008
  getValidators(field, formState) {
4022
4009
  const validators = super.getValidators(field);
4023
4010
  if (formState?.country === 'BL') {
4024
- validators.push(convert(restrictedValueValidator('0'), 'Enter a valid building number', {
4025
- id: ValidationErrorId.buildingNumberPattern,
4026
- }));
4011
+ validators.push(convert(restrictedValueValidator('0'), TranslateHelper.t('street-number.converter.validation.building-number', 'Enter a valid building number'), {}));
4027
4012
  }
4028
4013
  return validators;
4029
4014
  }
@@ -4067,10 +4052,8 @@ class CheckboxConverter extends Converter {
4067
4052
  getValidators(field) {
4068
4053
  const validators = [];
4069
4054
  if (field.isMandatory === this.checkedValue) {
4070
- validators.push(convert(restrictedValueValidator(this.uncheckedValue), field.validation_error_msg || 'Required', {
4071
- id: ValidationErrorId.required,
4072
- defaultMessage: field.validation_error_msg,
4073
- }));
4055
+ validators.push(convert(restrictedValueValidator(this.uncheckedValue), field.validation_error_msg ||
4056
+ TranslateHelper.t('checkbox.converter.validation.required', 'Required')));
4074
4057
  }
4075
4058
  return validators;
4076
4059
  }
@@ -4183,10 +4166,9 @@ class CouponControlConfig extends ControlConfig {
4183
4166
  }
4184
4167
  }
4185
4168
 
4186
- function couponValidator(message = 'Enter a valid promo code') {
4187
- return convert(Validators.pattern(/^[0-9a-z_-]+$/i), message, {
4188
- id: ValidationErrorId.couponPattern,
4189
- });
4169
+ function couponValidator(message) {
4170
+ const defaultMessage = TranslateHelper.t('errors.validation.coupon-pattern', 'Enter a valid promo code');
4171
+ return convert(Validators.pattern(/^[0-9a-z_-]+$/i), message || defaultMessage);
4190
4172
  }
4191
4173
 
4192
4174
  class CouponConverter extends Converter {
@@ -4198,7 +4180,7 @@ class CouponConverter extends Converter {
4198
4180
  }
4199
4181
  createControlConfig(field) {
4200
4182
  const config = this.createDefaultControlConfig(CouponControlConfig, field);
4201
- config.placeholder = `Enter promo code`;
4183
+ config.placeholder = TranslateHelper.t('coupon.converter.placeholder', 'Enter promo code');
4202
4184
  return config;
4203
4185
  }
4204
4186
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CouponConverter, deps: [{ token: SyncService }], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -4228,26 +4210,21 @@ function cardYearValidator(control) {
4228
4210
  const twoDigitsRegex = new RegExp(/^\d{2}$/);
4229
4211
  const fieldCommonLength = 2;
4230
4212
  if (value.length !== fieldCommonLength) {
4231
- return sendErrMessage$1(`Enter ${fieldCommonLength} characters`, {
4232
- id: ValidationErrorId.expirationLength,
4213
+ return sendErrMessage$1(TranslateHelper.t('errors.validation.expiration-length', `Enter ${fieldCommonLength} characters`, { requiredLength: fieldCommonLength }), {
4233
4214
  requiredLength: fieldCommonLength,
4234
4215
  });
4235
4216
  }
4236
4217
  if (!twoDigitsRegex.test(value)) {
4237
- return sendErrMessage$1('Enter a valid expiration year', {
4238
- id: ValidationErrorId.expirationYearPattern,
4239
- });
4218
+ return sendErrMessage$1(TranslateHelper.t('errors.validation.expiration-year-pattern', 'Enter a valid expiration year'), {});
4240
4219
  }
4241
4220
  if (Number(value) < minYear) {
4242
- return sendErrMessage$1(`Enter a year greater than or equal to ${minYear}`, {
4243
- id: ValidationErrorId.expirationMinYear,
4221
+ return sendErrMessage$1(TranslateHelper.t('errors.validation.expiration-min-year', `Enter a year that includes or comes after ${minYear}`, { minYear }), {
4244
4222
  minYear,
4245
4223
  });
4246
4224
  }
4247
4225
  const maxValidYear = minYear + maxYearsCount$1;
4248
4226
  if (Number(value) > maxValidYear) {
4249
- return sendErrMessage$1(`Enter a year less than or equal to ${maxValidYear}`, {
4250
- id: ValidationErrorId.expirationMaxYear,
4227
+ return sendErrMessage$1(TranslateHelper.t('errors.validation.expiration-max-year', `Enter a year that includes or comes before ${maxValidYear}`, { maxYear: maxValidYear }), {
4251
4228
  maxYear: maxValidYear,
4252
4229
  });
4253
4230
  }
@@ -4268,8 +4245,8 @@ class CardYearConverter extends Converter {
4268
4245
  guide: false,
4269
4246
  };
4270
4247
  config.inputMode = 'numeric';
4271
- config.placeholder = `YY`;
4272
- config.title = `YY`;
4248
+ config.placeholder = TranslateHelper.t('card-year.converter.placeholder', 'YY');
4249
+ config.title = TranslateHelper.t('card-year.converter.title', 'YY');
4273
4250
  config.disabled = formState?.disabled ?? false;
4274
4251
  return config;
4275
4252
  }
@@ -4287,9 +4264,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
4287
4264
  }], ctorParameters: () => [{ type: SyncService }] });
4288
4265
 
4289
4266
  function phoneValidator() {
4290
- return convert(Validators.pattern(/^\d*$/), 'Enter a valid phone', {
4291
- id: ValidationErrorId.phonePattern,
4292
- });
4267
+ return convert(Validators.pattern(/^\d*$/), TranslateHelper.t('errors.validation.phone-pattern', 'Enter a valid phone'));
4293
4268
  }
4294
4269
 
4295
4270
  class PhoneControlConfig extends ControlConfig {
@@ -4366,43 +4341,34 @@ function cardExpValidator(control) {
4366
4341
  const fieldCommonLength = 4;
4367
4342
  const trickyFieldLength = fieldCommonLength + 1;
4368
4343
  if (value.length !== trickyFieldLength) {
4369
- return sendErrMessage(`Enter ${fieldCommonLength} characters`, {
4370
- id: ValidationErrorId.expirationLength,
4344
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-length', `Enter ${fieldCommonLength} characters`, { requiredLength: fieldCommonLength }), {
4371
4345
  requiredLength: fieldCommonLength,
4372
4346
  });
4373
4347
  }
4374
4348
  if (!twoDigitsRegex.test(month)) {
4375
- return sendErrMessage('Enter a valid expiration month', {
4376
- id: ValidationErrorId.expirationMonthPattern,
4377
- });
4349
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-month-pattern', 'Enter a valid expiration month'), {});
4378
4350
  }
4379
4351
  if (Number(month) < minMonth) {
4380
- return sendErrMessage(`Enter a month greater than or equal to ${minMonth}`, {
4381
- id: ValidationErrorId.expirationMinMonth,
4352
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-min-month', `Enter a month that includes or comes after ${minMonth}`, { minMonth }), {
4382
4353
  minMonth,
4383
4354
  });
4384
4355
  }
4385
4356
  if (Number(month) > maxMonths) {
4386
- return sendErrMessage(`Enter a month less than or equal to ${maxMonths}`, {
4387
- id: ValidationErrorId.expirationMaxMonth,
4357
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-max-month', `Enter a month that includes or comes before ${maxMonths}`, { maxMonth: maxMonths }), {
4388
4358
  maxMonth: maxMonths,
4389
4359
  });
4390
4360
  }
4391
4361
  if (!twoDigitsRegex.test(year)) {
4392
- return sendErrMessage('Enter a valid expiration year', {
4393
- id: ValidationErrorId.expirationYearPattern,
4394
- });
4362
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-year-pattern', 'Enter a valid expiration year'), {});
4395
4363
  }
4396
4364
  if (Number(year) < minYear) {
4397
- return sendErrMessage(`Enter a year greater than or equal to ${minYear}`, {
4398
- id: ValidationErrorId.expirationMinYear,
4365
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-min-year', `Enter a year that includes or comes after ${minYear}`, { minYear }), {
4399
4366
  minYear,
4400
4367
  });
4401
4368
  }
4402
4369
  const maxValidYear = minYear + maxYearsCount;
4403
4370
  if (Number(year) > maxValidYear) {
4404
- return sendErrMessage(`Enter a year less than or equal to ${maxValidYear}`, {
4405
- id: ValidationErrorId.expirationMaxYear,
4371
+ return sendErrMessage(TranslateHelper.t('errors.validation.expiration-max-year', `Enter a year that includes or comes before ${maxValidYear}`, { maxYear: maxValidYear }), {
4406
4372
  maxYear: maxValidYear,
4407
4373
  });
4408
4374
  }
@@ -4424,8 +4390,8 @@ class CardExpirationConverter extends Converter {
4424
4390
  guide: false,
4425
4391
  };
4426
4392
  config.inputMode = 'numeric';
4427
- config.placeholder = 'MM/YY';
4428
- config.title = 'MM/YY';
4393
+ config.placeholder = TranslateHelper.t('card-expiration.converter.placeholder', 'MM/YY');
4394
+ config.title = TranslateHelper.t('card-expiration.converter.title', 'MM/YY');
4429
4395
  config.disabled = formState?.disabled ?? false;
4430
4396
  return config;
4431
4397
  }
@@ -8108,7 +8074,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
8108
8074
  }] }] });
8109
8075
 
8110
8076
  class CoreLibraryService {
8111
- constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService) {
8077
+ constructor(settingsService, countryService, paymentMethodsService, savedMethodsService, userBalanceService, paymentConfigService, paymentService, deviceFingerPrintService, financeDetailsService, legalService, statusService, nextActionService, creditCardService, creditCardStateService, formMessagesService, editSavedMethodsService, userBehaviourAnalyticsService, performanceService, combinedPaymentMethodsService, countriesApiService, sendInstructionService, scriptTrackerService, translateService) {
8112
8078
  this.settingsService = settingsService;
8113
8079
  this.countryService = countryService;
8114
8080
  this.paymentMethodsService = paymentMethodsService;
@@ -8131,6 +8097,7 @@ class CoreLibraryService {
8131
8097
  this.countriesApiService = countriesApiService;
8132
8098
  this.sendInstructionService = sendInstructionService;
8133
8099
  this.scriptTrackerService = scriptTrackerService;
8100
+ this.translateService = translateService;
8134
8101
  this.paymentMethods = {
8135
8102
  getList: async (isSaveMethodMode) => this.paymentMethodsService.getList(isSaveMethodMode),
8136
8103
  getQuickMethods: async () => this.paymentMethodsService.getQuickMethods(),
@@ -8154,6 +8121,8 @@ class CoreLibraryService {
8154
8121
  this.userBehaviourAnalyticsService.init();
8155
8122
  this.deviceFingerPrintService.init();
8156
8123
  this.scriptTrackerService.initScriptTracking(configuration.environment);
8124
+ TranslateHelper.init(this.translateService);
8125
+ this.translateService.use(TranslateHelper.getLocale(configuration.locale));
8157
8126
  }
8158
8127
  async getStatus(url) {
8159
8128
  return this.statusService.getStatusWithUrlSearchParams(url);
@@ -8257,7 +8226,7 @@ class CoreLibraryService {
8257
8226
  get isApplePayInstantFlowEnabled() {
8258
8227
  return this.settingsService.isApplePayInstantFlowEnabled;
8259
8228
  }
8260
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }], target: i0.ɵɵFactoryTarget.Injectable }); }
8229
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: CountryService }, { token: PaymentMethodsService }, { token: SavedMethodsService }, { token: UserBalanceService }, { token: PaymentConfigService }, { token: PaymentService }, { token: DeviceFingerPrintService }, { token: FinanceDetailsService }, { token: LegalService }, { token: StatusService }, { token: NextActionService }, { token: CreditCardService }, { token: CreditCardStateService }, { token: FormMessagesService }, { token: EditSavedMethodsService }, { token: UserBehaviourAnalyticsService }, { token: PerformanceService }, { token: CombinedPaymentMethodsService }, { token: CountriesApiService }, { token: SendInstructionService }, { token: ScriptTrackerService }, { token: i23.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
8261
8230
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
8262
8231
  }
8263
8232
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
@@ -8265,7 +8234,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
8265
8234
  args: [{
8266
8235
  providedIn: 'root',
8267
8236
  }]
8268
- }], ctorParameters: () => [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }] });
8237
+ }], ctorParameters: () => [{ type: SettingsService }, { type: CountryService }, { type: PaymentMethodsService }, { type: SavedMethodsService }, { type: UserBalanceService }, { type: PaymentConfigService }, { type: PaymentService }, { type: DeviceFingerPrintService }, { type: FinanceDetailsService }, { type: LegalService }, { type: StatusService }, { type: NextActionService }, { type: CreditCardService }, { type: CreditCardStateService }, { type: FormMessagesService }, { type: EditSavedMethodsService }, { type: UserBehaviourAnalyticsService }, { type: PerformanceService }, { type: CombinedPaymentMethodsService }, { type: CountriesApiService }, { type: SendInstructionService }, { type: ScriptTrackerService }, { type: i23.TranslateService }] });
8269
8238
 
8270
8239
  class HttpError extends AppError {
8271
8240
  constructor(error, req) {
@@ -8804,6 +8773,20 @@ class CoreLibraryModule {
8804
8773
  sendInstructionStatusResponseFactoryProvider,
8805
8774
  BraintreeHandler,
8806
8775
  CheckoutHandler,
8776
+ provideHttpClient(),
8777
+ provideTranslateService({
8778
+ loader: provideTranslateHttpLoader({
8779
+ prefix: './i18n/',
8780
+ suffix: '.json',
8781
+ }),
8782
+ fallbackLang: 'en',
8783
+ missingTranslationHandler: {
8784
+ provide: MissingTranslationHandler,
8785
+ useValue: {
8786
+ handle: () => null,
8787
+ },
8788
+ },
8789
+ }),
8807
8790
  ], imports: [HttpClientModule, FormModule, PipesModule, PaymentBehaviourModule] }); }
8808
8791
  }
8809
8792
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryModule, decorators: [{
@@ -8848,6 +8831,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
8848
8831
  sendInstructionStatusResponseFactoryProvider,
8849
8832
  BraintreeHandler,
8850
8833
  CheckoutHandler,
8834
+ provideHttpClient(),
8835
+ provideTranslateService({
8836
+ loader: provideTranslateHttpLoader({
8837
+ prefix: './i18n/',
8838
+ suffix: '.json',
8839
+ }),
8840
+ fallbackLang: 'en',
8841
+ missingTranslationHandler: {
8842
+ provide: MissingTranslationHandler,
8843
+ useValue: {
8844
+ handle: () => null,
8845
+ },
8846
+ },
8847
+ }),
8851
8848
  ],
8852
8849
  }]
8853
8850
  }] });