@xsolla/payment-client-core 0.1.0 → 0.1.2

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 (31) hide show
  1. package/esm2020/lib/core/payment/actions/next-action.interface.mjs +1 -1
  2. package/esm2020/lib/core/payment/actions/next-actions.mjs +3 -1
  3. package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.class.mjs +1 -1
  4. package/esm2020/lib/core/payment/actions/show-errors/show-errors.action.type.mjs +1 -1
  5. package/esm2020/lib/core/payment/actions/show-field-state/show-field-state.action.class.mjs +12 -0
  6. package/esm2020/lib/core/payment/actions/show-field-state/show-field-state.action.token.mjs +13 -0
  7. package/esm2020/lib/core/payment/actions/show-field-state/show-field-state.action.type.mjs +2 -0
  8. package/esm2020/lib/core/payment/form/input-events.enum.mjs +6 -0
  9. package/esm2020/lib/core/payment/payment.interface.mjs +1 -1
  10. package/esm2020/lib/core/payment/payment.service.mjs +55 -24
  11. package/esm2020/lib/core/payment/show-field-state.interface.mjs +2 -0
  12. package/esm2020/lib/core-library.service.mjs +4 -1
  13. package/fesm2015/xsolla-payment-client-core.mjs +91 -28
  14. package/fesm2015/xsolla-payment-client-core.mjs.map +1 -1
  15. package/fesm2020/xsolla-payment-client-core.mjs +89 -26
  16. package/fesm2020/xsolla-payment-client-core.mjs.map +1 -1
  17. package/lib/core/payment/actions/next-action.interface.d.ts +3 -2
  18. package/lib/core/payment/actions/show-errors/show-errors.action.class.d.ts +2 -2
  19. package/lib/core/payment/actions/show-errors/show-errors.action.type.d.ts +2 -2
  20. package/lib/core/payment/actions/show-field-state/show-field-state.action.class.d.ts +8 -0
  21. package/lib/core/payment/actions/show-field-state/show-field-state.action.token.d.ts +4 -0
  22. package/lib/core/payment/actions/show-field-state/show-field-state.action.type.d.ts +11 -0
  23. package/lib/core/payment/form/input-events.enum.d.ts +4 -0
  24. package/lib/core/payment/payment.interface.d.ts +3 -1
  25. package/lib/core/payment/payment.service.d.ts +5 -1
  26. package/lib/core/payment/show-field-state.interface.d.ts +8 -0
  27. package/package.json +1 -1
  28. package/xsolla-payment-client-core-0.1.2.tgz +0 -0
  29. package/esm2020/lib/core/payment/extended-xps-error.mjs +0 -2
  30. package/lib/core/payment/extended-xps-error.d.ts +0 -4
  31. package/xsolla-payment-client-core-0.1.0.tgz +0 -0
@@ -2,5 +2,6 @@ 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
4
  import { RedirectAction } from './redirect/redirect.action.type';
5
- import { ShowErrorsAction } from './show-errors/show-errors.action.class';
6
- export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | ShowErrorsAction | RedirectAction;
5
+ import { ShowErrorsAction } from './show-errors/show-errors.action.type';
6
+ import { ShowFieldStateAction } from './show-field-state/show-field-state.action.type';
7
+ export type NextAction = CheckStatusAction | ShowFieldsAction | StatusUpdatedAction | ShowErrorsAction | RedirectAction | ShowFieldStateAction;
@@ -1,8 +1,8 @@
1
- import { ExtendedXpsError } from '../../extended-xps-error';
1
+ import { XpsError } from '../../xps-error.interface';
2
2
  import { Action } from '../action.interface';
3
3
  import { ShowErrorsActionData, ShowErrorsActionType } from './show-errors.action.type';
4
4
  export declare class ShowErrorsAction implements Action {
5
5
  type: ShowErrorsActionType;
6
6
  data: ShowErrorsActionData;
7
- constructor(errors: ExtendedXpsError[]);
7
+ constructor(errors: XpsError[]);
8
8
  }
@@ -1,7 +1,7 @@
1
- import { ExtendedXpsError } from '../../extended-xps-error';
1
+ import { XpsError } from '../../xps-error.interface';
2
2
  import { Action } from '../action.interface';
3
3
  export type ShowErrorsActionType = 'show_errors';
4
4
  export interface ShowErrorsActionData {
5
- errors: ExtendedXpsError[] | null;
5
+ errors: XpsError[] | null;
6
6
  }
7
7
  export type ShowErrorsAction = Action<ShowErrorsActionType, ShowErrorsActionData>;
@@ -0,0 +1,8 @@
1
+ import { Action } from '../action.interface';
2
+ import { ShowFieldState } from '../../show-field-state.interface';
3
+ import { ShowFieldStateActionData, ShowFieldStateActionType } from './show-field-state.action.type';
4
+ export declare class ShowFieldStateAction implements Action {
5
+ type: ShowFieldStateActionType;
6
+ data: ShowFieldStateActionData;
7
+ constructor(control: ShowFieldState);
8
+ }
@@ -0,0 +1,4 @@
1
+ import { InjectionToken, ValueProvider } from '@angular/core';
2
+ import { ActionFactoryValue } from '../action-factory-value.interface';
3
+ export declare const showFieldStateActionFactoryToken: InjectionToken<ActionFactoryValue>;
4
+ export declare const showFieldStateActionFactoryProvider: ValueProvider;
@@ -0,0 +1,11 @@
1
+ import { FormControlStatus } from '@angular/forms';
2
+ import { ValidationError as ControlValidationError } from '../../form/validators/validation-error.interface';
3
+ import { Action } from '../action.interface';
4
+ export type ShowFieldStateActionType = 'show_field_state';
5
+ export interface ShowFieldStateActionData {
6
+ fieldName: string;
7
+ fieldState: FormControlStatus;
8
+ error: ControlValidationError | null;
9
+ isFocused?: boolean;
10
+ }
11
+ export type ShowFieldStateAction = Action<ShowFieldStateActionType, ShowFieldStateActionData>;
@@ -0,0 +1,4 @@
1
+ export declare enum InputEventName {
2
+ blur = "blur",
3
+ focus = "focus"
4
+ }
@@ -5,9 +5,10 @@ import { Status } from './status/status.interface';
5
5
  import { Field } from './field.interface';
6
6
  import { ControlConfig } from './form/controls/control-config';
7
7
  import { FinanceDetails } from './finance-details/finance-details.class';
8
+ import { InputEventName } from './form/input-events.enum';
8
9
  export interface Payment {
9
10
  initialize(): Promise<Field[]>;
10
- submit(): Promise<NextAction | null>;
11
+ submit(): Promise<NextAction | null | void>;
11
12
  getFields(): Field[];
12
13
  validate(field: Field): Promise<ValidationErrors | null>;
13
14
  getFinanceDetails(): FinanceDetails | null;
@@ -16,6 +17,7 @@ export interface Payment {
16
17
  form: {
17
18
  changeFieldValue(name: string, value: string): void;
18
19
  getControlConfig(field: Field): ControlConfig | null;
20
+ changeFieldState(name: string, state: InputEventName): void;
19
21
  };
20
22
  flowUpdates$: Observable<NextAction>;
21
23
  financeDetailsUpdates$: Observable<FinanceDetails>;
@@ -14,6 +14,7 @@ import { NextAction } from './actions/next-action.interface';
14
14
  import { Field } from './field.interface';
15
15
  import { PaymentConfig } from './payment-config.interface';
16
16
  import { ValidationErrors } from './form/validators/validation-errors.interface';
17
+ import { InputEventName } from './form/input-events.enum';
17
18
  import * as i0 from "@angular/core";
18
19
  export declare class PaymentService {
19
20
  private readonly initializeService;
@@ -30,9 +31,10 @@ export declare class PaymentService {
30
31
  private fields;
31
32
  private config;
32
33
  private destroy$;
34
+ private formDestroy$;
33
35
  constructor(initializeService: InitializeService, submitService: SubmitService, syncService: SyncService, formService: FormService, statusService: StatusService, financeDetailsService: FinanceDetailsService, nextActionService: NextActionService, controlConfigService: ControlConfigService);
34
36
  initialize(config: PaymentConfig): Promise<Field[]>;
35
- submit(): Promise<NextAction | null>;
37
+ submit(): Promise<NextAction | null | void>;
36
38
  getFields(): Field[];
37
39
  validate(field: Field): Promise<ValidationErrors | null>;
38
40
  runThreeDs(): NextAction;
@@ -40,11 +42,13 @@ export declare class PaymentService {
40
42
  getStatus(): Promise<Status>;
41
43
  getFieldConfig(field: Field): ControlConfig | null;
42
44
  changeFieldValue(name: string, value: string): void;
45
+ changeFieldState(name: string, state: InputEventName): void;
43
46
  destroy(): void;
44
47
  private emitFinanceDetails;
45
48
  private setupSyncService;
46
49
  private listenFinanceDetails;
47
50
  private listenSyncValidationErrors;
51
+ private getControlState;
48
52
  static ɵfac: i0.ɵɵFactoryDeclaration<PaymentService, never>;
49
53
  static ɵprov: i0.ɵɵInjectableDeclaration<PaymentService>;
50
54
  }
@@ -0,0 +1,8 @@
1
+ import { FormControlStatus } from '@angular/forms';
2
+ import { ValidationError as ControlValidationError } from './form/validators/validation-error.interface';
3
+ export interface ShowFieldState {
4
+ fieldName: string;
5
+ fieldState: FormControlStatus;
6
+ error: ControlValidationError | null;
7
+ isFocused?: boolean;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/payment-client-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.0",
6
6
  "@angular/core": "^15.2.0",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0ZW5kZWQteHBzLWVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGF5bWVudC1jbGllbnQtY29yZS9zcmMvbGliL2NvcmUvcGF5bWVudC9leHRlbmRlZC14cHMtZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFhwc0Vycm9yIH0gZnJvbSAnLi94cHMtZXJyb3IuaW50ZXJmYWNlJztcblxuZXhwb3J0IGludGVyZmFjZSBFeHRlbmRlZFhwc0Vycm9yIGV4dGVuZHMgWHBzRXJyb3Ige1xuICBmaWVsZFZhbGlkYXRpb25FcnJvcj86IHN0cmluZztcbn1cbiJdfQ==
@@ -1,4 +0,0 @@
1
- import { XpsError } from './xps-error.interface';
2
- export interface ExtendedXpsError extends XpsError {
3
- fieldValidationError?: string;
4
- }