@adyen/adyen-web 5.43.0 → 5.43.1

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.
@@ -9,7 +9,6 @@ declare class DropinElement extends UIElement<DropinElementProps> {
9
9
  isDropin: boolean;
10
10
  onReady: () => void;
11
11
  onComplete: () => void;
12
- onCancel: () => void;
13
12
  onError: () => void;
14
13
  onSelect: () => void;
15
14
  onDisableStoredPaymentMethod: any;
@@ -47,13 +46,14 @@ declare class DropinElement extends UIElement<DropinElementProps> {
47
46
  onSelect?: (paymentMethod: UIElement<any>) => void;
48
47
  showRemovePaymentMethodButton?: boolean;
49
48
  onDisableStoredPaymentMethod?: (storedPaymentMethod: any, resolve: any, reject: any) => void;
49
+ /**
50
+ * Calls the onSubmit event with the state of the activePaymentMethod
51
+ */
50
52
  environment?: string;
51
53
  session?: import("../../core/CheckoutSession/CheckoutSession").default;
52
54
  onChange?: (state: any, element: UIElement<any>) => void;
53
55
  onValid?: (state: any, element: UIElement<any>) => void;
54
- beforeSubmit?: (state: any, element: UIElement<any>, actions: any) => Promise<void>; /**
55
- * Calls the onSubmit event with the state of the activePaymentMethod
56
- */
56
+ beforeSubmit?: (state: any, element: UIElement<any>, actions: any) => Promise<void>;
57
57
  onComplete?: (state: any, element: UIElement<any>) => void;
58
58
  onActionHandled?: (rtnObj: import("../types").ActionHandledReturnObject) => void;
59
59
  onAdditionalDetails?: (state: any, element: UIElement<any>) => void;
@@ -2,7 +2,6 @@ declare const _default: {
2
2
  isDropin: boolean;
3
3
  onReady: () => void;
4
4
  onComplete: () => void;
5
- onCancel: () => void;
6
5
  onError: () => void;
7
6
  onSelect: () => void;
8
7
  onDisableStoredPaymentMethod: any;
@@ -1,23 +1,14 @@
1
1
  import { h } from 'preact';
2
2
  import UIElement from '../UIElement';
3
3
  import { PaymentResponse } from '../types';
4
+ import { GiftCardElementData } from './types';
4
5
  export declare class GiftcardElement extends UIElement {
5
6
  static type: string;
6
7
  protected static defaultProps: {
7
8
  brandsConfiguration: {};
8
9
  };
9
10
  formatProps(props: any): any;
10
- /**
11
- * Formats the component data output
12
- */
13
- formatData(): {
14
- paymentMethod: {
15
- type: any;
16
- brand: any;
17
- encryptedCardNumber: any;
18
- encryptedSecurityCode: any;
19
- };
20
- };
11
+ formatData(): GiftCardElementData;
21
12
  get isValid(): boolean;
22
13
  get icon(): any;
23
14
  get displayName(): any;
@@ -0,0 +1,8 @@
1
+ export interface GiftCardElementData {
2
+ paymentMethod: {
3
+ type: 'giftcard';
4
+ brand: string;
5
+ encryptedCardNumber: string;
6
+ encryptedSecurityCode: string;
7
+ };
8
+ }
@@ -11,7 +11,7 @@ export declare const ENCRYPTED_BANK_LOCATION_FIELD = "encryptedBankLocationId";
11
11
  export declare const ENCRYPTED_SECURITY_CODE_3_DIGITS = "encryptedSecurityCode3digits";
12
12
  export declare const ENCRYPTED_SECURITY_CODE_4_DIGITS = "encryptedSecurityCode4digits";
13
13
  export declare const GIFT_CARD = "giftcard";
14
- export declare const SF_VERSION = "4.4.1";
14
+ export declare const SF_VERSION = "4.5.0";
15
15
  export declare const DEFAULT_CARD_GROUP_TYPES: string[];
16
16
  export declare const NON_CREDIT_CARD_TYPE_SECURED_FIELDS: string[];
17
17
  export declare const CREDIT_CARD_SF_FIELDS: string[];
@@ -38,12 +38,18 @@ export interface PaymentData extends PaymentMethodData {
38
38
  sessionData?: string;
39
39
  storePaymentMethod?: boolean;
40
40
  }
41
+ export type ResultCode = 'Authorised' | 'Cancelled' | 'ChallengeShopper' | 'Error' | 'IdentifyShopper' | 'Pending';
42
+ export interface OnPaymentCompletedData {
43
+ sessionData: string;
44
+ sessionResult: string;
45
+ resultCode: ResultCode;
46
+ }
41
47
  export interface PaymentResponse {
42
48
  action?: PaymentAction;
43
49
  resultCode: string;
44
50
  sessionData?: string;
45
- order?: Order;
46
51
  sessionResult?: string;
52
+ order?: Order;
47
53
  }
48
54
  export interface RawPaymentResponse extends PaymentResponse {
49
55
  [key: string]: any;
@@ -8,6 +8,7 @@ import BaseElement from '../../components/BaseElement';
8
8
  * For testing purposes can be made visible
9
9
  */
10
10
  export declare class SRPanel extends BaseElement<SRPanelProps> {
11
+ static type: string;
11
12
  static defaultProps: {
12
13
  enabled: boolean;
13
14
  node: string;
@@ -1,8 +1,9 @@
1
1
  import { PaymentMethod, StoredPaymentMethod } from '../../../types';
2
+ import { PaymentMethodsResponse as PaymentMethodsResponseType } from './types';
2
3
  declare class PaymentMethodsResponse {
3
4
  paymentMethods: PaymentMethod[];
4
5
  storedPaymentMethods: StoredPaymentMethod[];
5
- constructor(response: PaymentMethodsResponse, options?: {});
6
+ constructor(response: PaymentMethodsResponseType, options?: {});
6
7
  private mapCreatedComponentType;
7
8
  has(paymentMethod: string): boolean;
8
9
  find(paymentMethod: string): PaymentMethod;
@@ -16,13 +16,8 @@ declare class Core {
16
16
  branch: string;
17
17
  buildId: string;
18
18
  };
19
- constructor(options: CoreOptions);
19
+ constructor(props: CoreOptions);
20
20
  initialize(): Promise<this>;
21
- /**
22
- * Submit data to payments using the onSubmit event or the session flow if available
23
- * @param data -
24
- */
25
- submitPayment(data: any): void;
26
21
  /**
27
22
  * Submits details using onAdditionalDetails or the session flow if available
28
23
  * @param details -
@@ -3,12 +3,23 @@ import { PaymentMethods, PaymentMethodOptions, PaymentActionsType, PaymentAmount
3
3
  import { AnalyticsOptions } from './Analytics/types';
4
4
  import { PaymentMethodsResponse } from './ProcessResponse/PaymentMethodsResponse/types';
5
5
  import { RiskModuleOptions } from './RiskModule/RiskModule';
6
+ import { ActionHandledReturnObject, OnPaymentCompletedData, PaymentData } from '../components/types';
7
+ import UIElement from '../components/UIElement';
8
+ import AdyenCheckoutError from './Errors/AdyenCheckoutError';
9
+ import { GiftCardElementData } from '../components/Giftcard/types';
10
+ import { SRPanelProps } from './Errors/types';
11
+ type PromiseResolve = typeof Promise.resolve;
12
+ type PromiseReject = typeof Promise.reject;
6
13
  export interface CoreOptions {
7
14
  session?: any;
8
15
  /**
9
16
  * Use test. When you're ready to accept live payments, change the value to one of our {@link https://docs.adyen.com/checkout/drop-in-web#testing-your-integration | live environments}.
10
17
  */
11
18
  environment?: 'test' | 'live' | 'live-us' | 'live-au' | 'live-apse' | 'live-in' | string;
19
+ /**
20
+ * Show or hides a Pay Button for each payment method
21
+ */
22
+ showPayButton?: boolean;
12
23
  /**
13
24
  * A public key linked to your web service user, used for {@link https://docs.adyen.com/user-management/client-side-authentication | client-side authentication}.
14
25
  */
@@ -53,14 +64,50 @@ export interface CoreOptions {
53
64
  * Never display these payment methods
54
65
  */
55
66
  removePaymentMethods?: string[];
67
+ /**
68
+ * Screen Reader configuration
69
+ */
70
+ srConfig?: SRPanelProps;
56
71
  resourceEnvironment?: string;
57
72
  analytics?: AnalyticsOptions;
58
73
  risk?: RiskModuleOptions;
59
74
  order?: Order;
60
- [key: string]: any;
75
+ setStatusAutomatically?: boolean;
76
+ beforeRedirect?(resolve: PromiseResolve, reject: PromiseReject, redirectData: {
77
+ url: string;
78
+ method: string;
79
+ data?: any;
80
+ }): Promise<void>;
81
+ beforeSubmit?(state: any, element: UIElement, actions: {
82
+ resolve: PromiseResolve;
83
+ reject: PromiseReject;
84
+ }): Promise<void>;
85
+ onPaymentCompleted?(data: OnPaymentCompletedData, element?: UIElement): void;
86
+ onSubmit?(state: any, element: UIElement): void;
87
+ onAdditionalDetails?(state: any, element?: UIElement): void;
88
+ onActionHandled?(data: ActionHandledReturnObject): void;
89
+ onChange?(state: any, element: UIElement): void;
90
+ onError?(error: AdyenCheckoutError, element?: UIElement): void;
91
+ onBalanceCheck?(resolve: PromiseResolve, reject: PromiseReject, data: GiftCardElementData): Promise<void>;
92
+ onOrderRequest?(resolve: PromiseResolve, reject: PromiseReject, data: PaymentData): Promise<void>;
93
+ onOrderCancel?(order: Order): void;
94
+ /**
95
+ * Only used in Components combined with Sessions flow
96
+ * Callback used to inform when the order is created.
97
+ * https://docs.adyen.com/payment-methods/gift-cards/web-component?tab=config-sessions_1
98
+ */
99
+ onOrderCreated?(data: {
100
+ order: Order;
101
+ }): void;
102
+ /**
103
+ * Used only in the Donation Component when shopper declines to donate
104
+ * https://docs.adyen.com/online-payments/donations/web-component
105
+ */
106
+ onCancel?(): void;
61
107
  }
62
108
  export type PaymentMethodsConfiguration = {
63
109
  [key in keyof PaymentMethods]?: Partial<PaymentMethodOptions<key>>;
64
110
  } | {
65
111
  [key in PaymentActionsType]?: any;
66
112
  };
113
+ export {};
@@ -2,6 +2,7 @@ import paymentMethods from '../components';
2
2
  import { ADDRESS_SCHEMA } from '../components/internal/Address/constants';
3
3
  import actionTypes from '../core/ProcessResponse/PaymentAction/actionTypes';
4
4
  import { InstallmentOptions } from '../components/Card/components/CardInput/components/types';
5
+ import { ResultCode } from '../components/types';
5
6
  export type PaymentActionsType = keyof typeof actionTypes;
6
7
  /**
7
8
  * {@link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__resParam_action API Explorer /payments action}
@@ -245,6 +246,11 @@ export type CheckoutSessionSetupResponse = {
245
246
  paymentMethods: any;
246
247
  returnUrl: string;
247
248
  configuration: SessionConfiguration;
249
+ /**
250
+ * 'shopperLocale' set during session creation.
251
+ * @defaultValue en-US
252
+ */
253
+ shopperLocale: string;
248
254
  };
249
255
  export type CheckoutSessionPaymentResponse = {
250
256
  sessionData: string;
@@ -254,8 +260,9 @@ export type CheckoutSessionPaymentResponse = {
254
260
  };
255
261
  export type CheckoutSessionDetailsResponse = {
256
262
  sessionData: string;
263
+ sessionResult: string;
264
+ resultCode: ResultCode;
257
265
  status?: string;
258
- resultCode: string;
259
266
  action?: PaymentAction;
260
267
  };
261
268
  export type CheckoutSessionBalanceResponse = {
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "./dist/es/adyen.css": "./dist/es/adyen.css",
25
25
  "./package.json": "./package.json"
26
26
  },
27
- "version": "5.43.0",
27
+ "version": "5.43.1",
28
28
  "license": "MIT",
29
29
  "homepage": "https://docs.adyen.com/checkout",
30
30
  "repository": "github:Adyen/adyen-web",
@@ -72,8 +72,8 @@
72
72
  "@testing-library/preact-hooks": "1.1.0",
73
73
  "@testing-library/user-event": "14.4.3",
74
74
  "@types/jest": "29.5.1",
75
- "@typescript-eslint/eslint-plugin": "5.56.0",
76
- "@typescript-eslint/parser": "5.56.0",
75
+ "@typescript-eslint/eslint-plugin": "5.59.1",
76
+ "@typescript-eslint/parser": "5.59.1",
77
77
  "autoprefixer": "10.4.14",
78
78
  "babel-jest": "29.5.0",
79
79
  "cross-env": "^7.0.3",
@@ -81,7 +81,7 @@
81
81
  "dotenv": "^16.0.3",
82
82
  "enzyme": "3.11.0",
83
83
  "enzyme-adapter-preact-pure": "4.1.0",
84
- "eslint": "8.36.0",
84
+ "eslint": "8.39.0",
85
85
  "eslint-plugin-import": "^2.26.0",
86
86
  "eslint-plugin-jsx-a11y": "^6.6.1",
87
87
  "eslint-plugin-react": "^7.31.8",
@@ -94,14 +94,14 @@
94
94
  "jest-environment-jsdom": "29.5.0",
95
95
  "jest-mock-extended": "^3.0.1",
96
96
  "lint-staged": "^13.0.3",
97
- "postcss": "8.4.21",
97
+ "postcss": "8.4.23",
98
98
  "rollup": "^2.79.1",
99
99
  "rollup-plugin-postcss": "4.0.2",
100
100
  "rollup-plugin-stylelint": "1.0.0",
101
101
  "rollup-plugin-terser": "^7.0.2",
102
102
  "rollup-plugin-visualizer": "^5.8.3",
103
- "sass": "1.59.3",
104
- "stylelint": "15.3.0",
103
+ "sass": "1.62.1",
104
+ "stylelint": "15.6.0",
105
105
  "stylelint-config-standard-scss": "7.0.1",
106
106
  "tslib": "^2.4.1",
107
107
  "typescript": "4.9.5",
@@ -114,7 +114,7 @@
114
114
  "@types/googlepay": "^0.7.0",
115
115
  "classnames": "^2.3.1",
116
116
  "core-js-pure": "^3.25.3",
117
- "preact": "10.11.3"
117
+ "preact": "10.13.2"
118
118
  },
119
119
  "files": [
120
120
  "dist",