@xsolla/payment-client-core 0.2.13 → 0.2.15

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 (38) hide show
  1. package/esm2020/lib/core/payment/form/controls/search-select/select-control.config.mjs +8 -0
  2. package/esm2020/lib/core/payment/form/converters/cvv/cvv.converter.mjs +3 -3
  3. package/esm2020/lib/core/payment/form/converters/pricepoint/pricepoint.converter.mjs +2 -2
  4. package/esm2020/lib/core/payment/form/converters/select/select.converter.mjs +4 -3
  5. package/esm2020/lib/core/payment/form/converters/zip/zip.converter.mjs +2 -5
  6. package/esm2020/lib/core/payment/form/form.service.mjs +4 -1
  7. package/esm2020/lib/core/payment/initialize/initialize-request-params.interface.mjs +1 -1
  8. package/esm2020/lib/core/payment/initialize/initialize.service.mjs +1 -4
  9. package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
  10. package/esm2020/lib/core/payment/payment.service.mjs +4 -1
  11. package/esm2020/lib/core/payment/xps-api/xps-api.service.mjs +2 -1
  12. package/esm2020/lib/core/settings/configuration.interface.mjs +1 -1
  13. package/esm2020/lib/core/settings/settings.service.mjs +5 -1
  14. package/esm2020/lib/core-library.service.mjs +2 -6
  15. package/esm2020/public-api.mjs +2 -1
  16. package/fesm2015/xsolla-payment-client-core.mjs +21 -24
  17. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  18. package/fesm2020/xsolla-payment-client-core.mjs +20 -23
  19. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  20. package/lib/core/payment/form/controls/search-select/{search-select-control.config.d.ts → select-control.config.d.ts} +2 -2
  21. package/lib/core/payment/form/converters/select/select.converter.d.ts +2 -2
  22. package/lib/core/payment/form/form.service.d.ts +2 -0
  23. package/lib/core/payment/initialize/initialize-request-params.interface.d.ts +0 -1
  24. package/lib/core/payment/initialize/initialize.service.d.ts +0 -1
  25. package/lib/core/payment/payment.interface.d.ts +1 -0
  26. package/lib/core/payment/payment.service.d.ts +1 -0
  27. package/lib/core/settings/configuration.interface.d.ts +1 -0
  28. package/lib/core/settings/settings.service.d.ts +2 -0
  29. package/lib/core-library.service.d.ts +0 -2
  30. package/package.json +1 -1
  31. package/public-api.d.ts +1 -0
  32. package/xsolla-payment-client-core-0.2.15.tgz +0 -0
  33. package/esm2020/lib/core/payment/form/controls/search-select/search-select-control.config.mjs +0 -8
  34. package/esm2020/lib/core/payment/form/mask-config.interface.mjs +0 -2
  35. package/esm2020/lib/core/payment/form/masks-functions.map.mjs +0 -7
  36. package/lib/core/payment/form/mask-config.interface.d.ts +0 -6
  37. package/lib/core/payment/form/masks-functions.map.d.ts +0 -3
  38. package/xsolla-payment-client-core-0.2.13.tgz +0 -0
@@ -9,13 +9,6 @@ import { filter, map as map$1, tap, debounce, catchError } from 'rxjs/operators'
9
9
  import * as i1$1 from '@angular/router';
10
10
  import { CommonModule } from '@angular/common';
11
11
 
12
- const masksFunctionsMap = {
13
- zip: () => {
14
- const zipLength = 5;
15
- return new Array(zipLength).fill('9').join('');
16
- },
17
- };
18
-
19
12
  class AppError extends Error {
20
13
  constructor(message) {
21
14
  super(message);
@@ -144,12 +137,16 @@ class SettingsService {
144
137
  }
145
138
  this._token = configuration.token;
146
139
  this.sandboxMode = !!configuration.sandbox;
140
+ this._refer = configuration.refer;
147
141
  await this.sendRequest(this.token);
148
142
  this.isInitialized = true;
149
143
  }
150
144
  isSandboxMode() {
151
145
  return this.sandboxMode;
152
146
  }
147
+ get refer() {
148
+ return this._refer;
149
+ }
153
150
  async sendRequest(token) {
154
151
  const params = new HttpParams().set('access_token', token);
155
152
  this.secureApi.setSandboxMode(this.isSandboxMode());
@@ -1225,6 +1222,7 @@ class XpsApiService {
1225
1222
  ...this.collectAnalyticsParameters(pid, paymentWithSavedMethod),
1226
1223
  ...this.collectUserSessionId(),
1227
1224
  country: this.countryService.getCountry(),
1225
+ refer: this.settingsService.refer,
1228
1226
  ...parameters,
1229
1227
  };
1230
1228
  if (this.userAgentService.isMobileDevice) {
@@ -2548,14 +2546,11 @@ class InitializeService {
2548
2546
  this.encryptCreditCardService = encryptCreditCardService;
2549
2547
  this.showErrorsActionCreator = showErrorsActionCreator;
2550
2548
  this.userBehaviourAnalyticsService = userBehaviourAnalyticsService;
2551
- // TODO PAYMENTS-15743: replace with new refer id for headless core
2552
- this.ps4ReferId = '22';
2553
2549
  }
2554
2550
  async request(config) {
2555
2551
  const requestParams = {
2556
2552
  access_token: this.settingsService.token,
2557
2553
  pid: String(config.paymentMethodId),
2558
- refer: this.ps4ReferId,
2559
2554
  country: this.countryService.getCountry(),
2560
2555
  returnUrl: config.returnUrl,
2561
2556
  paymentWithSavedMethod: config.paymentWithSavedMethod === true
@@ -3167,14 +3162,12 @@ class ZipConverter extends Converter {
3167
3162
  config.icon = 'location';
3168
3163
  if (this.isUsCountry) {
3169
3164
  config.maskConfig = {
3165
+ mask: new Array(this.usCountryLength).fill('9').join(''),
3170
3166
  guide: false,
3171
3167
  unmaskModelValue: true,
3172
3168
  showMask: true,
3173
3169
  };
3174
3170
  config.inputMode = 'numeric';
3175
- if (masksFunctionsMap['zip']) {
3176
- config.maskConfig.mask = masksFunctionsMap['zip'];
3177
- }
3178
3171
  }
3179
3172
  else {
3180
3173
  config.maxLength = this.maxLength;
@@ -3414,7 +3407,7 @@ class CvvConverter extends Converter {
3414
3407
  createControlConfig(field, formState) {
3415
3408
  const config = this.createDefaultControlConfig(TextControlConfig, field);
3416
3409
  config.maskConfig = {
3417
- mask: () => new Array(this.maxFieldLength).fill('9').join(''),
3410
+ mask: new Array(this.maxFieldLength).fill('9').join(''),
3418
3411
  unmaskModelValue: false,
3419
3412
  guide: false,
3420
3413
  };
@@ -3434,7 +3427,7 @@ class CvvConverter extends Converter {
3434
3427
  return 'cc-csc';
3435
3428
  }
3436
3429
  getDataType() {
3437
- return 'password';
3430
+ return 'text';
3438
3431
  }
3439
3432
  shouldHideUserInput() {
3440
3433
  return true;
@@ -3654,7 +3647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
3654
3647
  type: Injectable
3655
3648
  }], ctorParameters: function () { return [{ type: SyncService }]; } });
3656
3649
 
3657
- class SearchSelectControlConfig extends ControlConfig {
3650
+ class SelectControlConfig extends ControlConfig {
3658
3651
  constructor() {
3659
3652
  super(...arguments);
3660
3653
  this.controlType = 'search-select';
@@ -3666,8 +3659,9 @@ class SelectConverter extends Converter {
3666
3659
  super(syncService);
3667
3660
  }
3668
3661
  createControlConfig(field) {
3669
- const config = this.createDefaultControlConfig(SearchSelectControlConfig, field);
3662
+ const config = this.createDefaultControlConfig(SelectControlConfig, field);
3670
3663
  config.options = field.options;
3664
+ config.initValue = field.value;
3671
3665
  return config;
3672
3666
  }
3673
3667
  }
@@ -3727,7 +3721,7 @@ class PricepointConverter extends Converter {
3727
3721
  createControlConfig(field) {
3728
3722
  const config = this.createDefaultControlConfig(TextControlConfig, field);
3729
3723
  config.maskConfig = {
3730
- mask: () => new Array(this.maxFieldLength).fill('9').join(``),
3724
+ mask: new Array(this.maxFieldLength).fill('9').join(``),
3731
3725
  unmaskModelValue: false,
3732
3726
  guide: false,
3733
3727
  };
@@ -3970,6 +3964,9 @@ class FormService {
3970
3964
  }, {});
3971
3965
  return new UntypedFormGroup(controls);
3972
3966
  }
3967
+ getFieldFormState(fieldName) {
3968
+ return this.fieldFormStates[fieldName] ?? null;
3969
+ }
3973
3970
  updateFieldFormState(form, fields, fieldName, formState) {
3974
3971
  const field = fields.find((fieldItem) => fieldItem.name === fieldName);
3975
3972
  if (!field) {
@@ -6450,6 +6447,9 @@ class PaymentService {
6450
6447
  this.formService.updateFieldFormState(this.form, this.fields, fieldName, formState);
6451
6448
  }
6452
6449
  }
6450
+ getFieldFormState(fieldName) {
6451
+ return this.formService.getFieldFormState(fieldName);
6452
+ }
6453
6453
  async getStatus() {
6454
6454
  if (!isSubmitResponse(this.data)) {
6455
6455
  throw new Error('Should submit form first');
@@ -7078,6 +7078,7 @@ class CoreLibraryService {
7078
7078
  changeFieldValue: (name, value) => this.paymentService.changeFieldValue(name, value),
7079
7079
  changeFieldState: (name, state) => this.paymentService.changeFieldState(name, state),
7080
7080
  updateFieldFormState: (fieldName, formState) => this.paymentService.updateFieldFormState(fieldName, formState),
7081
+ getFieldFormState: (fieldName) => this.paymentService.getFieldFormState(fieldName),
7081
7082
  formMessages$: this.formMessagesService.data$,
7082
7083
  getFormStatus: () => this.paymentService.form?.status,
7083
7084
  getControlStatus: (name) => this.paymentService.getControlStatus(name),
@@ -7104,10 +7105,6 @@ class CoreLibraryService {
7104
7105
  getLegalComponentConfig() {
7105
7106
  return this.legalService.getLegalComponentConfig();
7106
7107
  }
7107
- getFieldMask(field) {
7108
- const sanitizedName = field.name.replace(/^fix_/i, '');
7109
- return masksFunctionsMap[sanitizedName];
7110
- }
7111
7108
  getUserBalanceValue() {
7112
7109
  return this.userBalanceService.getUserBalanceValue();
7113
7110
  }
@@ -7888,5 +7885,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
7888
7885
  * Generated bundle index. Do not edit.
7889
7886
  */
7890
7887
 
7891
- export { ApplePayService, CoreLibraryModule, CoreLibraryService, FieldNames, GooglePayService, PaymentSystemProcessingService, userBehaviourEventTypes };
7888
+ export { ApplePayService, CoreLibraryModule, CoreLibraryService, CreditCardTypes, FieldNames, GooglePayService, PaymentSystemProcessingService, userBehaviourEventTypes };
7892
7889
  //# sourceMappingURL=xsolla-payment-client-core.mjs.map