@adyen/adyen-web 5.43.0 → 5.44.0

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 (56) hide show
  1. package/README.md +1 -1
  2. package/dist/adyen.css +1 -0
  3. package/dist/adyen.css.map +1 -1
  4. package/dist/adyen.js +1 -1
  5. package/dist/adyen.js.map +1 -1
  6. package/dist/cjs/adyen.css +1 -0
  7. package/dist/cjs/adyen.css.map +1 -1
  8. package/dist/cjs/index.js +1 -1
  9. package/dist/es/adyen.css +1 -0
  10. package/dist/es/adyen.css.map +1 -1
  11. package/dist/es/index.js +1 -1
  12. package/dist/es.modern/adyen.css +1 -0
  13. package/dist/es.modern/adyen.css.map +1 -1
  14. package/dist/es.modern/index.js +1 -1
  15. package/dist/types/components/Ach/Ach.d.ts +1 -1
  16. package/dist/types/components/BcmcMobile/BcmcMobile.d.ts +1 -1
  17. package/dist/types/components/Card/Bancontact.d.ts +1 -1
  18. package/dist/types/components/Card/Card.d.ts +1 -1
  19. package/dist/types/components/CashAppPay/CashAppPay.d.ts +80 -0
  20. package/dist/types/components/CashAppPay/components/CashAppComponent.d.ts +16 -0
  21. package/dist/types/components/CashAppPay/defaultProps.d.ts +7 -0
  22. package/dist/types/components/CashAppPay/index.d.ts +1 -0
  23. package/dist/types/components/CashAppPay/services/CashAppSdkLoader.d.ts +9 -0
  24. package/dist/types/components/CashAppPay/services/CashAppService.d.ts +21 -0
  25. package/dist/types/components/CashAppPay/services/config.d.ts +3 -0
  26. package/dist/types/components/CashAppPay/services/types.d.ts +49 -0
  27. package/dist/types/components/CashAppPay/types.d.ts +60 -0
  28. package/dist/types/components/ClickToPay/ClickToPay.d.ts +1 -1
  29. package/dist/types/components/Dragonpay/Dragonpay.d.ts +1 -1
  30. package/dist/types/components/Dropin/Dropin.d.ts +5 -5
  31. package/dist/types/components/Dropin/defaultProps.d.ts +0 -1
  32. package/dist/types/components/DuitNow/DuitNow.d.ts +1 -1
  33. package/dist/types/components/Giftcard/Giftcard.d.ts +2 -11
  34. package/dist/types/components/Giftcard/types.d.ts +8 -0
  35. package/dist/types/components/PayNow/PayNow.d.ts +1 -1
  36. package/dist/types/components/PromptPay/PromptPay.d.ts +1 -1
  37. package/dist/types/components/Swish/Swish.d.ts +1 -1
  38. package/dist/types/components/WeChat/WeChat.d.ts +1 -1
  39. package/dist/types/components/index.d.ts +2 -0
  40. package/dist/types/components/internal/Countdown/CountdownA11yReporter.d.ts +25 -0
  41. package/dist/types/components/internal/Countdown/index.d.ts +3 -29
  42. package/dist/types/components/internal/Countdown/types.d.ts +9 -0
  43. package/dist/types/components/internal/Countdown/useCountdownA11yReporter.d.ts +2 -0
  44. package/dist/types/components/internal/RedirectButton/RedirectButton.d.ts +3 -1
  45. package/dist/types/components/internal/SecuredFields/lib/configuration/constants.d.ts +1 -1
  46. package/dist/types/components/types.d.ts +8 -2
  47. package/dist/types/core/Errors/SRPanel.d.ts +4 -7
  48. package/dist/types/core/Errors/types.d.ts +6 -0
  49. package/dist/types/core/ProcessResponse/PaymentMethodsResponse/PaymentMethodsResponse.d.ts +2 -1
  50. package/dist/types/core/core.d.ts +1 -6
  51. package/dist/types/core/types.d.ts +48 -1
  52. package/dist/types/language/config.d.ts +1 -0
  53. package/dist/types/language/locales/index.d.ts +2 -0
  54. package/dist/types/language/utils.d.ts +1 -1
  55. package/dist/types/types/index.d.ts +8 -1
  56. package/package.json +9 -9
@@ -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;
@@ -83,7 +89,6 @@ export interface ActionHandledReturnObject {
83
89
  actionDescription: ActionDescriptionType;
84
90
  }
85
91
  export interface UIElementProps extends BaseElementProps {
86
- environment?: string;
87
92
  session?: Session;
88
93
  onChange?: (state: any, element: UIElement) => void;
89
94
  onValid?: (state: any, element: UIElement) => void;
@@ -96,6 +101,7 @@ export interface UIElementProps extends BaseElementProps {
96
101
  onPaymentCompleted?: (result: any, element: UIElement) => void;
97
102
  beforeRedirect?: (resolve: any, reject: any, redirectData: any, element: UIElement) => void;
98
103
  isInstantPayment?: boolean;
104
+ environment?: string;
99
105
  type?: string;
100
106
  name?: string;
101
107
  icon?: string;
@@ -1,6 +1,6 @@
1
1
  import { h } from 'preact';
2
2
  import './SRPanel.scss';
3
- import { SRPanelProps } from './types';
3
+ import { AriaAttributes, SRPanelProps } from './types';
4
4
  import BaseElement from '../../components/BaseElement';
5
5
  /**
6
6
  * A panel meant to hold messages that will be read out by ScreenReaders on an aria-live="polite" basis
@@ -8,12 +8,8 @@ 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 defaultProps: {
12
- enabled: boolean;
13
- node: string;
14
- showPanel: boolean;
15
- id: string;
16
- };
11
+ static type: string;
12
+ static defaultProps: SRPanelProps;
17
13
  private readonly srPanelContainer;
18
14
  private readonly id;
19
15
  private readonly showPanel;
@@ -24,6 +20,7 @@ export declare class SRPanel extends BaseElement<SRPanelProps> {
24
20
  setComponentRef: (ref: any) => void;
25
21
  get enabled(): boolean;
26
22
  get moveFocus(): boolean;
23
+ setAriaProps(ariaAttributes: AriaAttributes): void;
27
24
  setMessages: (messages: string[] | string) => void;
28
25
  render(): h.JSX.Element;
29
26
  }
@@ -21,12 +21,18 @@ export interface SortedErrorObject {
21
21
  errorMessage: string;
22
22
  errorCode: string;
23
23
  }
24
+ export interface AriaAttributes {
25
+ 'aria-relevant'?: 'additions' | 'all' | 'removals' | 'text' | 'additions text';
26
+ 'aria-live'?: 'off' | 'polite' | 'assertive';
27
+ 'aria-atomic'?: 'true' | 'false';
28
+ }
24
29
  export interface SRPanelProps extends BaseElementProps {
25
30
  enabled?: boolean;
26
31
  node?: string;
27
32
  showPanel?: boolean;
28
33
  moveFocus?: boolean;
29
34
  id?: string;
35
+ ariaAttributes?: AriaAttributes;
30
36
  }
31
37
  export interface SRMessagesProps {
32
38
  setComponentRef: (ref: any) => void;
@@ -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 {};
@@ -48,6 +48,7 @@ export declare const defaultTranslation: {
48
48
  continue: string;
49
49
  continueTo: string;
50
50
  "wechatpay.timetopay": string;
51
+ "sr.wechatpay.timetopay": string;
51
52
  "wechatpay.scanqrcode": string;
52
53
  personalDetails: string;
53
54
  companyDetails: string;
@@ -2930,6 +2930,7 @@ declare const _default: {
2930
2930
  continue: string;
2931
2931
  continueTo: string;
2932
2932
  "wechatpay.timetopay": string;
2933
+ "sr.wechatpay.timetopay": string;
2933
2934
  "wechatpay.scanqrcode": string;
2934
2935
  personalDetails: string;
2935
2936
  companyDetails: string;
@@ -3219,6 +3220,7 @@ declare const _default: {
3219
3220
  continue: string;
3220
3221
  continueTo: string;
3221
3222
  "wechatpay.timetopay": string;
3223
+ "sr.wechatpay.timetopay": string;
3222
3224
  "wechatpay.scanqrcode": string;
3223
3225
  personalDetails: string;
3224
3226
  companyDetails: string;
@@ -45,4 +45,4 @@ export declare const loadTranslations: (locale: string, customTranslations?: obj
45
45
  * @param translation - Translation string
46
46
  * @param renderFunctions - An array function that renders JSX elements
47
47
  */
48
- export declare const interpolateElement: (translation: string, renderFunctions: ((translation: string) => h.JSX.Element)[]) => (string | h.JSX.Element)[];
48
+ export declare const interpolateElement: (translation: string, renderFunctions: ((translation: string) => h.JSX.Element | string)[]) => (string | h.JSX.Element)[];
@@ -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.44.0",
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",
@@ -124,6 +124,6 @@
124
124
  "lint-staged": {
125
125
  "*.{js,jsx,ts,tsx}": "eslint",
126
126
  "*.{scss,css}": "stylelint",
127
- "*.{js,jsx,ts,tsx,html}": "prettier --write"
127
+ "*.{js,jsx,ts,tsx,html,md}": "prettier --write"
128
128
  }
129
129
  }