@xsolla/payment-client-core 0.2.82 → 0.2.83

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.
@@ -6,7 +6,7 @@ import { HttpParams, HttpHeaders, HttpClientModule, HTTP_INTERCEPTORS, provideHt
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 i24 from '@ngx-translate/core';
9
+ import * as i19 from '@ngx-translate/core';
10
10
  import { provideTranslateService, MissingTranslationHandler } from '@ngx-translate/core';
11
11
  import * as i1$1 from '@angular/router';
12
12
  import { CommonModule } from '@angular/common';
@@ -22,10 +22,10 @@ class TranslateHelper {
22
22
  }
23
23
  static getLocale(locale) {
24
24
  if (locale.toLowerCase() === 'tw') {
25
- return 'zh_HANS';
25
+ return 'zh_HANT';
26
26
  }
27
27
  if (locale.toLowerCase() === 'cn') {
28
- return 'zh_HANT';
28
+ return 'zh_HANS';
29
29
  }
30
30
  if (locale.toLowerCase() === 'ph') {
31
31
  return 'fil';
@@ -7253,7 +7253,7 @@ class PaymentService {
7253
7253
  get formResponseValue() {
7254
7254
  return this._formResponse$.getValue();
7255
7255
  }
7256
- constructor(loggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService, paymentBehaviourService) {
7256
+ constructor(loggerService, initializeService, submitService, syncService, formService, statusService, financeDetailsService, creditCardStateService, nextActionService, initializeNextActionService, controlConfigService, threeDsService, formMessagesService, settingsService, countryService, checkStatusActionCreator, printInstructionService, paymentBehaviourService, translateService) {
7257
7257
  this.loggerService = loggerService;
7258
7258
  this.initializeService = initializeService;
7259
7259
  this.submitService = submitService;
@@ -7272,6 +7272,7 @@ class PaymentService {
7272
7272
  this.checkStatusActionCreator = checkStatusActionCreator;
7273
7273
  this.printInstructionService = printInstructionService;
7274
7274
  this.paymentBehaviourService = paymentBehaviourService;
7275
+ this.translateService = translateService;
7275
7276
  this.form = null;
7276
7277
  this.data = null;
7277
7278
  this.financeDetails = null;
@@ -7414,6 +7415,7 @@ class PaymentService {
7414
7415
  fields: sdkPaymentData.fields,
7415
7416
  submitResponse: isSubmitResponse(this.data) ? this.data : null,
7416
7417
  summary: sdkPaymentData.summary,
7418
+ locale: this.translateService.getCurrentLang(),
7417
7419
  });
7418
7420
  }
7419
7421
  getQrCode() {
@@ -7720,7 +7722,7 @@ class PaymentService {
7720
7722
  return;
7721
7723
  updateAfterErrorRules.forEach((rule) => rule.apply(submitResponse, this.form));
7722
7724
  }
7723
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: LoggerService }, { token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: InitializeNextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }, { token: PaymentBehaviourService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7725
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, deps: [{ token: LoggerService }, { token: InitializeService }, { token: SubmitService }, { token: SyncService }, { token: FormService }, { token: StatusService }, { token: FinanceDetailsService }, { token: CreditCardStateService }, { token: NextActionService }, { token: InitializeNextActionService }, { token: ControlConfigService }, { token: ThreeDsService }, { token: FormMessagesService }, { token: SettingsService }, { token: CountryService }, { token: CheckStatusActionCreator }, { token: PrintInstructionService }, { token: PaymentBehaviourService }, { token: i19.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
7724
7726
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, providedIn: 'root' }); }
7725
7727
  }
7726
7728
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: PaymentService, decorators: [{
@@ -7728,7 +7730,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
7728
7730
  args: [{
7729
7731
  providedIn: 'root',
7730
7732
  }]
7731
- }], ctorParameters: () => [{ type: LoggerService }, { type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: InitializeNextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }, { type: PaymentBehaviourService }] });
7733
+ }], ctorParameters: () => [{ type: LoggerService }, { type: InitializeService }, { type: SubmitService }, { type: SyncService }, { type: FormService }, { type: StatusService }, { type: FinanceDetailsService }, { type: CreditCardStateService }, { type: NextActionService }, { type: InitializeNextActionService }, { type: ControlConfigService }, { type: ThreeDsService }, { type: FormMessagesService }, { type: SettingsService }, { type: CountryService }, { type: CheckStatusActionCreator }, { type: PrintInstructionService }, { type: PaymentBehaviourService }, { type: i19.TranslateService }] });
7732
7734
 
7733
7735
  const euCountries = new Set([
7734
7736
  'AT',
@@ -8542,7 +8544,7 @@ class CoreLibraryService {
8542
8544
  get commonLogAttributes() {
8543
8545
  return this.commonLogAttributesService.getAttributes();
8544
8546
  }
8545
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: LoggerService }, { 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: i24.TranslateService }, { token: CommonLogAttributesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
8547
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, deps: [{ token: SettingsService }, { token: LoggerService }, { 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: i19.TranslateService }, { token: CommonLogAttributesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
8546
8548
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, providedIn: 'root' }); }
8547
8549
  }
8548
8550
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: CoreLibraryService, decorators: [{
@@ -8550,7 +8552,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
8550
8552
  args: [{
8551
8553
  providedIn: 'root',
8552
8554
  }]
8553
- }], ctorParameters: () => [{ type: SettingsService }, { type: LoggerService }, { 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: i24.TranslateService }, { type: CommonLogAttributesService }] });
8555
+ }], ctorParameters: () => [{ type: SettingsService }, { type: LoggerService }, { 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: i19.TranslateService }, { type: CommonLogAttributesService }] });
8554
8556
 
8555
8557
  class HttpError extends AppError {
8556
8558
  constructor(error, req) {
@@ -9548,7 +9550,7 @@ class GooglePayService {
9548
9550
  return checkStatusAction;
9549
9551
  }
9550
9552
  }
9551
- createButton(onClickHandler, buttonColor = 'default') {
9553
+ createButton(onClickHandler, configuration) {
9552
9554
  if (!this.googlePaymentClient) {
9553
9555
  return null;
9554
9556
  }
@@ -9558,7 +9560,8 @@ class GooglePayService {
9558
9560
  allowedPaymentMethods: allowedPaymentMethods,
9559
9561
  buttonSizeMode: 'fill',
9560
9562
  buttonType: 'buy',
9561
- buttonColor,
9563
+ buttonColor: configuration.color ?? 'default',
9564
+ buttonLocale: this.getLocaleForButton(configuration.locale),
9562
9565
  });
9563
9566
  }
9564
9567
  setupGooglePayClient() {
@@ -9606,6 +9609,48 @@ class GooglePayService {
9606
9609
  isCanceledStatus(statusCode) {
9607
9610
  return statusCode.toLowerCase() === 'canceled';
9608
9611
  }
9612
+ getLocaleForButton(userLocale) {
9613
+ const allowedLocales = [
9614
+ 'en',
9615
+ 'ar',
9616
+ 'bg',
9617
+ 'ca',
9618
+ 'cs',
9619
+ 'da',
9620
+ 'de',
9621
+ 'el',
9622
+ 'es',
9623
+ 'et',
9624
+ 'fi',
9625
+ 'fr',
9626
+ 'hr',
9627
+ 'id',
9628
+ 'it',
9629
+ 'ja',
9630
+ 'ko',
9631
+ 'ms',
9632
+ 'nl',
9633
+ 'no',
9634
+ 'pl',
9635
+ 'pt',
9636
+ 'ru',
9637
+ 'sk',
9638
+ 'sl',
9639
+ 'sr',
9640
+ 'sv',
9641
+ 'th',
9642
+ 'tr',
9643
+ 'uk',
9644
+ 'zh',
9645
+ ];
9646
+ if (['cn', 'zh_HANT'].includes(userLocale)) {
9647
+ return 'zh';
9648
+ }
9649
+ if (['zh_HANS'].includes(userLocale)) {
9650
+ return 'tw';
9651
+ }
9652
+ return allowedLocales.find((locale) => locale === userLocale) ?? 'en';
9653
+ }
9609
9654
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, deps: [{ token: windowToken }, { token: LoggerService }, { token: PaymentSystemProcessingService }, { token: GooglePayCheckoutPaymentService }, { token: GooglePayInstantPaymentService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
9610
9655
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: GooglePayService, providedIn: 'root' }); }
9611
9656
  }