@xsolla/payment-client-core 0.0.10 → 0.0.11

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 (53) hide show
  1. package/esm2020/lib/core/payment/actions/action-factory-value.interface.mjs +1 -1
  2. package/esm2020/lib/core/payment/actions/check-status/check-status.action.token.mjs +5 -2
  3. package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
  4. package/esm2020/lib/core/payment/actions/next-action.service.mjs +11 -10
  5. package/esm2020/lib/core/payment/actions/next-actions.mjs +3 -1
  6. package/esm2020/lib/core/payment/actions/redirect/redirect.action.class.mjs +20 -0
  7. package/esm2020/lib/core/payment/actions/redirect/redirect.action.token.mjs +16 -0
  8. package/esm2020/lib/core/payment/actions/redirect/redirect.action.type.mjs +2 -0
  9. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.class.mjs +2 -2
  10. package/esm2020/lib/core/payment/actions/show-fields/show-fields.action.token.mjs +5 -2
  11. package/esm2020/lib/core/payment/actions/status-updated/status-updated.action.token.mjs +2 -2
  12. package/esm2020/lib/core/payment/form/converters/converter.abstract.mjs +5 -7
  13. package/esm2020/lib/core/payment/form/converters/zip.converter.mjs +9 -5
  14. package/esm2020/lib/core/payment/form/mask-config.interface.mjs +2 -0
  15. package/esm2020/lib/core/payment/form/masks-functions.map.mjs +7 -0
  16. package/esm2020/lib/core/payment/form/validators/convert.function.mjs +3 -2
  17. package/esm2020/lib/core/payment/form/validators/email-validator.mjs +3 -2
  18. package/esm2020/lib/core/payment/form/validators/errors-codes.enum.mjs +8 -0
  19. package/esm2020/lib/core/payment/form/validators/required-validator.mjs +3 -2
  20. package/esm2020/lib/core/payment/form/validators/validation-error.interface.mjs +1 -1
  21. package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
  22. package/esm2020/lib/core/payment/payment.service.mjs +23 -4
  23. package/esm2020/lib/core/payment/submit/response/is-submit-response.function.mjs +5 -0
  24. package/esm2020/lib/core/payment/sync/field-sync-state.interface.mjs +1 -1
  25. package/esm2020/lib/core/payment/sync/sync.service.mjs +14 -2
  26. package/esm2020/lib/core-library.service.mjs +7 -2
  27. package/fesm2015/xsolla-payment-client-core.mjs +228 -139
  28. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  29. package/fesm2020/xsolla-payment-client-core.mjs +223 -136
  30. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  31. package/lib/core/payment/actions/action-factory-value.interface.d.ts +2 -1
  32. package/lib/core/payment/actions/next-action.interface.d.ts +2 -1
  33. package/lib/core/payment/actions/next-action.service.d.ts +2 -2
  34. package/lib/core/payment/actions/redirect/redirect.action.class.d.ts +9 -0
  35. package/lib/core/payment/actions/redirect/redirect.action.token.d.ts +4 -0
  36. package/lib/core/payment/actions/redirect/redirect.action.type.d.ts +17 -0
  37. package/lib/core/payment/form/converters/converter.abstract.d.ts +1 -2
  38. package/lib/core/payment/form/mask-config.interface.d.ts +6 -0
  39. package/lib/core/payment/form/masks-functions.map.d.ts +3 -0
  40. package/lib/core/payment/form/validators/convert.function.d.ts +1 -1
  41. package/lib/core/payment/form/validators/errors-codes.enum.d.ts +6 -0
  42. package/lib/core/payment/form/validators/validation-error.interface.d.ts +1 -0
  43. package/lib/core/payment/payment.interface.d.ts +1 -2
  44. package/lib/core/payment/payment.service.d.ts +4 -5
  45. package/lib/core/payment/submit/response/is-submit-response.function.d.ts +2 -0
  46. package/lib/core/payment/sync/field-sync-state.interface.d.ts +2 -2
  47. package/lib/core/payment/sync/sync.service.d.ts +1 -0
  48. package/lib/core-library.service.d.ts +2 -0
  49. package/package.json +1 -1
  50. package/xsolla-payment-client-core-0.0.11.tgz +0 -0
  51. package/esm2020/lib/core/payment/actions/action-type-command.map.mjs +0 -6
  52. package/lib/core/payment/actions/action-type-command.map.d.ts +0 -4
  53. package/xsolla-payment-client-core-0.0.10.tgz +0 -0
@@ -1,5 +1,6 @@
1
1
  import { Action } from './action.interface';
2
+ import { SubmitResponse } from '../submit/response/submit-response.class';
2
3
  export interface ActionFactoryValue {
3
4
  factory(...args: unknown[]): Action;
4
- type: string;
5
+ isSuitable(submitResponse: SubmitResponse): boolean;
5
6
  }
@@ -1,4 +1,5 @@
1
1
  import { CheckStatusAction } from './check-status/check-status.action.type';
2
2
  import { ShowFieldsAction } from './show-fields/show-fields.action.type';
3
3
  import { StatusUpdatedAction } from './status-updated/status-updated.action.type';
4
- export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction;
4
+ import { RedirectAction } from './redirect/redirect.action.type';
5
+ export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | RedirectAction;
@@ -8,12 +8,12 @@ export declare class NextActionService {
8
8
  private readonly nextActionTokens;
9
9
  private readonly injector;
10
10
  private readonly flowUpdatesSubject;
11
- private readonly nextActionsMap;
11
+ private readonly nextActionsList;
12
12
  get flowUpdates$(): Observable<NextAction>;
13
13
  constructor(nextActionTokens: NextActionTokens, injector: Injector);
14
14
  getNextAction(submitResponse: SubmitResponse): NextAction | null;
15
15
  emitFlowUpdates(action: NextAction): void;
16
- private fillNextActionsMap;
16
+ private fillNextActionsList;
17
17
  private findNextAction;
18
18
  static ɵfac: i0.ɵɵFactoryDeclaration<NextActionService, never>;
19
19
  static ɵprov: i0.ɵɵInjectableDeclaration<NextActionService>;
@@ -0,0 +1,9 @@
1
+ import { SubmitResponse } from '../../submit/response/submit-response.class';
2
+ import { Action } from '../action.interface';
3
+ import { RedirectActionData, RedirectActionType } from './redirect.action.type';
4
+ export declare class RedirectAction implements Action {
5
+ type: RedirectActionType;
6
+ data: RedirectActionData;
7
+ constructor(submitResponse: SubmitResponse);
8
+ private getRedirect;
9
+ }
@@ -0,0 +1,4 @@
1
+ import { InjectionToken, ValueProvider } from '@angular/core';
2
+ import { ActionFactoryValue } from '../action-factory-value.interface';
3
+ export declare const redirectActionFactoryToken: InjectionToken<ActionFactoryValue>;
4
+ export declare const redirectActionFactoryProvider: ValueProvider;
@@ -0,0 +1,17 @@
1
+ import { Action } from '../action.interface';
2
+ import { Field } from '../../field.interface';
3
+ import { XpsError } from '../../xps-error.interface';
4
+ import { XpsMessage } from '../../xps-message.interface';
5
+ export type RedirectActionType = 'redirect';
6
+ export interface RedirectActionData {
7
+ fields: Field[];
8
+ errors: XpsError[] | null;
9
+ messages: XpsMessage[] | undefined;
10
+ invoiceId?: string;
11
+ order?: object;
12
+ redirect: {
13
+ redirectUrl: string;
14
+ data: object;
15
+ };
16
+ }
17
+ export type RedirectAction = Action<RedirectActionType, RedirectActionData>;
@@ -1,4 +1,4 @@
1
- import { AsyncValidatorFn, UntypedFormControl, ValidatorFn } from '@angular/forms';
1
+ import { UntypedFormControl, ValidatorFn } from '@angular/forms';
2
2
  import { Field } from '../../field.interface';
3
3
  import { SyncService } from '../../sync/sync.service';
4
4
  import { ControlConfig } from '../controls/control-config';
@@ -9,7 +9,6 @@ export declare abstract class Converter {
9
9
  convertToConfig(field: Field, formState?: FormState): ControlConfig;
10
10
  convertToFormControl(field: Field): UntypedFormControl;
11
11
  getValidators(field: Field): ValidatorFn[];
12
- getAsyncValidators(field: Field): AsyncValidatorFn | AsyncValidatorFn[] | null;
13
12
  createDefaultControlConfig<T extends {
14
13
  [key: string]: unknown;
15
14
  }>(controlConfigClass: new () => T, field: Field): T;
@@ -0,0 +1,6 @@
1
+ export interface MaskConfig {
2
+ guide: boolean;
3
+ unmaskModelValue: boolean;
4
+ showMask: boolean;
5
+ mask?(): string;
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare const masksFunctionsMap: {
2
+ [fieldNameOrType: string]: () => string;
3
+ };
@@ -1,3 +1,3 @@
1
1
  import { ValidatorFn } from '@angular/forms';
2
2
  import { ValidatorFn as ConvertedValidatorFn } from './validator-fn.type';
3
- export declare function convert(validator: ValidatorFn, message: string): ConvertedValidatorFn;
3
+ export declare function convert(validator: ValidatorFn, message: string, errorCode: string): ConvertedValidatorFn;
@@ -0,0 +1,6 @@
1
+ export declare enum ErrorsCodes {
2
+ minLength = "min-length",
3
+ maxLength = "max-length",
4
+ invalidValue = "invalid-value",
5
+ required = "required"
6
+ }
@@ -1,4 +1,5 @@
1
1
  export interface ValidationError {
2
2
  message?: string;
3
+ code?: string;
3
4
  [parameter: string]: unknown;
4
5
  }
@@ -2,7 +2,6 @@ import { ValidationErrors } from '@angular/forms';
2
2
  import { Observable } from 'rxjs';
3
3
  import { NextAction } from './actions/next-action.interface';
4
4
  import { Status } from './status/status.interface';
5
- import { StatusParams } from './status/status-params.interface';
6
5
  import { Field } from './field.interface';
7
6
  import { ControlConfig } from './form/controls/control-config';
8
7
  import { FinanceDetails } from './finance-details/finance-details.class';
@@ -13,7 +12,7 @@ export interface Payment {
13
12
  validate(field: Field): Promise<ValidationErrors | null>;
14
13
  getFinanceDetails(): FinanceDetails | null;
15
14
  runThreeDs(): NextAction;
16
- getStatus(params: StatusParams): Promise<Status>;
15
+ getStatus(): Promise<Status>;
17
16
  form: {
18
17
  changeFieldValue(name: string, value: string): void;
19
18
  getControlConfig(field: Field): ControlConfig | null;
@@ -1,19 +1,18 @@
1
1
  import { UntypedFormGroup, ValidationErrors } from '@angular/forms';
2
- import { NextAction } from './actions/next-action.interface';
3
- import { Field } from './field.interface';
4
2
  import { FormService } from './form/form.service';
5
3
  import { InitializeService } from './initialize/initialize.service';
6
- import { PaymentConfig } from './payment-config.interface';
7
4
  import { Status } from './status/status.interface';
8
5
  import { SubmitService } from './submit/submit.service';
9
6
  import { SyncService } from './sync/sync.service';
10
7
  import { StatusService } from './status/status.service';
11
- import { StatusParams } from './status/status-params.interface';
12
8
  import { NextActionService } from './actions/next-action.service';
13
9
  import { ControlConfig } from './form/controls/control-config';
14
10
  import { ControlConfigService } from './form/controls/control-config.service';
15
11
  import { FinanceDetails } from './finance-details/finance-details.class';
16
12
  import { FinanceDetailsService } from './finance-details/finance-details.service';
13
+ import { NextAction } from './actions/next-action.interface';
14
+ import { Field } from './field.interface';
15
+ import { PaymentConfig } from './payment-config.interface';
17
16
  import * as i0 from "@angular/core";
18
17
  export declare class PaymentService {
19
18
  private readonly initializeService;
@@ -37,7 +36,7 @@ export declare class PaymentService {
37
36
  validate(field: Field): Promise<ValidationErrors | null>;
38
37
  runThreeDs(): NextAction;
39
38
  getFinanceDetails(): FinanceDetails | null;
40
- getStatus(params: StatusParams): Promise<Status>;
39
+ getStatus(): Promise<Status>;
41
40
  getFieldConfig(field: Field): ControlConfig | null;
42
41
  changeFieldValue(name: string, value: string): void;
43
42
  destroy(): void;
@@ -0,0 +1,2 @@
1
+ import { SubmitResponse } from './submit-response.class';
2
+ export declare const isSubmitResponse: (value: unknown) => value is SubmitResponse;
@@ -1,5 +1,5 @@
1
- import { ValidationErrors } from '@angular/forms';
1
+ import { SyncResponse } from './sync-response.class';
2
2
  export interface FieldSyncState {
3
3
  value: unknown;
4
- result: Promise<ValidationErrors | null>;
4
+ result: Promise<SyncResponse | null>;
5
5
  }
@@ -21,6 +21,7 @@ export declare class SyncService extends EmitDataService<XpsResponse> {
21
21
  setup(form: UntypedFormGroup, fields: Field[]): void;
22
22
  reset(): void;
23
23
  validate(field: Field): Promise<ValidationErrors | null>;
24
+ getSyncValidationErrors(field: Field): ValidationErrors | null;
24
25
  protected request(field: Field): Promise<SyncResponse>;
25
26
  private isReadyField;
26
27
  private getPrevFieldSyncState;
@@ -10,6 +10,7 @@ import { UserBalanceService } from './core/user-balance/user-balance.service';
10
10
  import { PaymentConfig } from './core/payment/payment-config.interface';
11
11
  import { PaymentService } from './core/payment/payment.service';
12
12
  import { Payment } from './core/payment/payment.interface';
13
+ import { Field } from './core/payment/field.interface';
13
14
  import { DeviceFingerPrintService } from './core/device-finger-print/device-finger-print.service';
14
15
  import { LegalService } from './core/legal/legal.service';
15
16
  import { LegalComponentConfig } from './core/legal/legal.component.config';
@@ -38,6 +39,7 @@ export declare class CoreLibraryService {
38
39
  setCountry(country: string): void;
39
40
  createPayment(config: PaymentConfig): Payment;
40
41
  getLegalComponentConfig(): LegalComponentConfig;
42
+ getFieldMask(field: Field): undefined | (() => string);
41
43
  static ɵfac: i0.ɵɵFactoryDeclaration<CoreLibraryService, never>;
42
44
  static ɵprov: i0.ɵɵInjectableDeclaration<CoreLibraryService>;
43
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.0",
6
6
  "@angular/core": "^15.2.0",
@@ -1,6 +0,0 @@
1
- import { XpsCommand } from '../xps-comand.enum';
2
- export const actionTypeCommandMap = {
3
- [XpsCommand.check]: 'show_fields',
4
- [XpsCommand.status]: 'check_status',
5
- };
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLXR5cGUtY29tbWFuZC5tYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9wYXltZW50LWNsaWVudC1jb3JlL3NyYy9saWIvY29yZS9wYXltZW50L2FjdGlvbnMvYWN0aW9uLXR5cGUtY29tbWFuZC5tYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRWhELE1BQU0sQ0FBQyxNQUFNLG9CQUFvQixHQUFxQztJQUNwRSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsRUFBRSxhQUFhO0lBQ2pDLENBQUMsVUFBVSxDQUFDLE1BQU0sQ0FBQyxFQUFFLGNBQWM7Q0FDcEMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFhwc0NvbW1hbmQgfSBmcm9tICcuLi94cHMtY29tYW5kLmVudW0nO1xuXG5leHBvcnQgY29uc3QgYWN0aW9uVHlwZUNvbW1hbmRNYXA6IHsgW2tleSBpbiBYcHNDb21tYW5kXT86IHN0cmluZyB9ID0ge1xuICBbWHBzQ29tbWFuZC5jaGVja106ICdzaG93X2ZpZWxkcycsXG4gIFtYcHNDb21tYW5kLnN0YXR1c106ICdjaGVja19zdGF0dXMnLFxufTtcbiJdfQ==
@@ -1,4 +0,0 @@
1
- import { XpsCommand } from '../xps-comand.enum';
2
- export declare const actionTypeCommandMap: {
3
- [key in XpsCommand]?: string;
4
- };