@adyen/adyen-web 5.48.0 → 5.49.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 (25) hide show
  1. package/dist/adyen.js +1 -1
  2. package/dist/adyen.js.map +1 -1
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/es/index.js +1 -1
  5. package/dist/es.modern/index.js +1 -1
  6. package/dist/types/components/Card/Bancontact.d.ts +1 -0
  7. package/dist/types/components/Card/Card.d.ts +1 -0
  8. package/dist/types/components/ClickToPay/ClickToPay.d.ts +1 -0
  9. package/dist/types/components/Klarna/KlarnaPayments.d.ts +1 -0
  10. package/dist/types/components/Klarna/types.d.ts +2 -0
  11. package/dist/types/components/UPI/components/VpaInput/VpaInput.d.ts +1 -0
  12. package/dist/types/components/internal/ClickToPay/ClickToPayComponent.d.ts +1 -0
  13. package/dist/types/components/internal/ClickToPay/components/CtPLoader/CtPLoader.d.ts +1 -0
  14. package/dist/types/components/internal/ClickToPay/components/CtPLogin/CtPLogin.d.ts +1 -0
  15. package/dist/types/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.d.ts +1 -0
  16. package/dist/types/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.d.ts +1 -0
  17. package/dist/types/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.d.ts +1 -0
  18. package/dist/types/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.d.ts +1 -0
  19. package/dist/types/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.d.ts +1 -0
  20. package/dist/types/components/internal/ClickToPay/components/CtPSection/CtPSection.d.ts +1 -0
  21. package/dist/types/components/internal/ClickToPay/errors/TimeoutError.d.ts +4 -0
  22. package/dist/types/components/internal/ClickToPay/services/ClickToPayService.d.ts +3 -1
  23. package/dist/types/components/internal/ClickToPay/types.d.ts +6 -0
  24. package/dist/types/language/utils.d.ts +1 -0
  25. package/package.json +18 -5
@@ -51,6 +51,7 @@ declare class BancontactElement extends CardElement {
51
51
  locale: string;
52
52
  merchantDisplayName?: string;
53
53
  onReady?(): void;
54
+ onTimeout?(error: import("../internal/ClickToPay/errors/TimeoutError").default): void;
54
55
  };
55
56
  brand?: string;
56
57
  _disableClickToPay?: boolean;
@@ -58,6 +58,7 @@ export declare class CardElement extends UIElement<CardElementProps> {
58
58
  locale: string;
59
59
  merchantDisplayName?: string;
60
60
  onReady?(): void;
61
+ onTimeout?(error: import("../internal/ClickToPay/errors/TimeoutError").default): void;
61
62
  };
62
63
  brand?: string;
63
64
  _disableClickToPay?: boolean;
@@ -51,6 +51,7 @@ export declare class ClickToPayElement extends UIElement<ClickToPayElementProps>
51
51
  isDropin?: boolean;
52
52
  merchantDisplayName?: string;
53
53
  onReady?(): void;
54
+ onTimeout?(error: import("../internal/ClickToPay/errors/TimeoutError").default): void;
54
55
  configuration?: {
55
56
  mcDpaId?: string;
56
57
  mcSrcClientId?: string;
@@ -17,6 +17,7 @@ declare class KlarnaPayments extends UIElement<KlarnaPaymentsProps> {
17
17
  };
18
18
  payButton: (props: any) => h.JSX.Element;
19
19
  updateWithAction(action: PaymentAction): void;
20
+ onLoaded(): void;
20
21
  render(): h.JSX.Element;
21
22
  }
22
23
  export default KlarnaPayments;
@@ -27,6 +27,8 @@ interface KlarnaPaymentsShared {
27
27
  export interface KlarnaWidgetProps extends KlarnaPaymentsShared {
28
28
  /** @internal */
29
29
  payButton: (options: any) => any;
30
+ /** @internal */
31
+ onLoaded: () => void;
30
32
  onComplete: (detailsData: any) => void;
31
33
  onError: (error: any) => void;
32
34
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './VpaInput.scss';
3
4
  type OnChangeProps = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  type ClickToPayComponentProps = {
3
4
  onDisplayCardComponent?(): void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './CtPLoader.scss';
3
4
  declare const CtPLoader: () => h.JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './CtPLogin.scss';
3
4
  declare const CtPLogin: () => h.JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  type OnChangeProps = {
3
4
  data: CtPLoginInputDataState;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './CtPOneTimePassword.scss';
3
4
  type CtPOneTimePasswordProps = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './CtPOneTimePasswordInput.scss';
3
4
  type OnChangeProps = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  interface CtPResendOtpLinkProps {
3
4
  onError(errorCode: string): void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './CtPLogoutLink.scss';
3
4
  declare const CtPLogoutLink: () => h.JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  import './CtPSection.scss';
3
4
  interface CtPSectionProps {
@@ -0,0 +1,4 @@
1
+ declare class TimeoutError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export default TimeoutError;
@@ -1,6 +1,7 @@
1
1
  import { CallbackStateSubscriber, IClickToPayService, IdentityLookupParams, ClickToPayCheckoutPayload, SchemesConfiguration, IdentityValidationData } from './types';
2
2
  import { ISrcSdkLoader } from './sdks/SrcSdkLoader';
3
3
  import ShopperCard from '../models/ShopperCard';
4
+ import TimeoutError from '../errors/TimeoutError';
4
5
  export declare enum CtpState {
5
6
  Idle = "Idle",
6
7
  Loading = "Loading",
@@ -15,6 +16,7 @@ declare class ClickToPayService implements IClickToPayService {
15
16
  private readonly schemesConfig;
16
17
  private readonly shopperIdentity?;
17
18
  private readonly environment;
19
+ private readonly onTimeout?;
18
20
  /**
19
21
  * Mandatory unique ID passed to all the networks (Click to Pay systems), used to track user journey
20
22
  */
@@ -25,7 +27,7 @@ declare class ClickToPayService implements IClickToPayService {
25
27
  state: CtpState;
26
28
  shopperCards: ShopperCard[];
27
29
  identityValidationData: IdentityValidationData;
28
- constructor(schemesConfig: SchemesConfiguration, sdkLoader: ISrcSdkLoader, environment: string, shopperIdentity?: IdentityLookupParams);
30
+ constructor(schemesConfig: SchemesConfiguration, sdkLoader: ISrcSdkLoader, environment: string, shopperIdentity?: IdentityLookupParams, onTimeout?: (error: TimeoutError) => void);
29
31
  get shopperAccountFound(): boolean;
30
32
  get schemes(): string[];
31
33
  initialize(): Promise<void>;
@@ -1,3 +1,4 @@
1
+ import TimeoutError from './errors/TimeoutError';
1
2
  export type ClickToPayConfiguration = {
2
3
  /**
3
4
  * Shopper email used to be recognized with the Network schemes
@@ -28,5 +29,10 @@ export type ClickToPayConfiguration = {
28
29
  * Callback triggered when the Click to Pay component is ready to be used
29
30
  */
30
31
  onReady?(): void;
32
+ /**
33
+ * Callback triggered when a timeout happens within Click to Pay service.
34
+ * Ex: Network schemes took too long to initialize
35
+ */
36
+ onTimeout?(error: TimeoutError): void;
31
37
  };
32
38
  export type ClickToPayScheme = 'mc' | 'visa';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { h } from 'preact';
2
3
  /**
3
4
  * Matches a string with one of the locales
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.48.0",
27
+ "version": "5.49.0",
28
28
  "license": "MIT",
29
29
  "homepage": "https://docs.adyen.com/checkout",
30
30
  "repository": "github:Adyen/adyen-web",
@@ -34,9 +34,11 @@
34
34
  "scripts": {
35
35
  "start": "npm run dev-server",
36
36
  "dev-server": "cross-env NODE_ENV=development rollup --watch --config config/rollup.dev.config.js",
37
+ "start:storybook": "node .storybook/run.js",
37
38
  "docs:generate": "typedoc --out docs src --exclude \"**/*+(index|.test).ts\"",
38
39
  "build": "rm -rf dist/ && npm run type-check-generate && cross-env NODE_ENV=production rollup --config config/rollup.config.js",
39
40
  "build:analyze": "rm -rf dist/ && cross-env NODE_ENV=analyze rollup --config config/rollup.config.js",
41
+ "build:storybook": "storybook build --disable-telemetry",
40
42
  "test": "jest --config config/jest.config.js",
41
43
  "test:watch": "npm run test -- --watchAll",
42
44
  "test:coverage": "npm run test -- --coverage",
@@ -57,9 +59,9 @@
57
59
  "@babel/cli": "^7.18.10",
58
60
  "@babel/core": "^7.16.0",
59
61
  "@babel/plugin-transform-runtime": "^7.19.1",
60
- "@babel/preset-env": "^7.20.2",
62
+ "@babel/preset-env": "^7.21.5",
61
63
  "@babel/preset-react": "^7.18.6",
62
- "@babel/preset-typescript": "^7.15.0",
64
+ "@babel/preset-typescript": "^7.21.5",
63
65
  "@babel/runtime-corejs3": "^7.20.1",
64
66
  "@rollup/plugin-babel": "^6.0.2",
65
67
  "@rollup/plugin-commonjs": "^24.0.0",
@@ -67,11 +69,16 @@
67
69
  "@rollup/plugin-json": "^6.0.0",
68
70
  "@rollup/plugin-node-resolve": "^15.0.0",
69
71
  "@rollup/plugin-replace": "^5.0.1",
72
+ "@storybook/addon-a11y": "^7.0.20",
73
+ "@storybook/addon-essentials": "^7.0.20",
74
+ "@storybook/manager-api": "^7.0.20",
75
+ "@storybook/preact": "^7.0.20",
76
+ "@storybook/preact-vite": "^7.0.20",
70
77
  "@testing-library/jest-dom": "5.16.5",
71
78
  "@testing-library/preact": "3.2.3",
72
79
  "@testing-library/preact-hooks": "1.1.0",
73
80
  "@testing-library/user-event": "14.4.3",
74
- "@types/jest": "29.5.1",
81
+ "@types/jest": "29.5.2",
75
82
  "@typescript-eslint/eslint-plugin": "5.59.1",
76
83
  "@typescript-eslint/parser": "5.59.1",
77
84
  "autoprefixer": "10.4.14",
@@ -85,6 +92,7 @@
85
92
  "eslint-plugin-import": "^2.26.0",
86
93
  "eslint-plugin-jsx-a11y": "^6.6.1",
87
94
  "eslint-plugin-react": "^7.31.8",
95
+ "eslint-plugin-storybook": "^0.6.12",
88
96
  "eslint-plugin-testing-library": "^5.9.1",
89
97
  "eslint-plugin-tsdoc": "^0.2.17",
90
98
  "filesize": "^10.0.0",
@@ -95,16 +103,21 @@
95
103
  "jest-mock-extended": "^3.0.1",
96
104
  "lint-staged": "^13.0.3",
97
105
  "postcss": "8.4.23",
106
+ "react": "^18.2.0",
107
+ "react-dom": "^18.2.0",
98
108
  "rollup": "^2.79.1",
99
109
  "rollup-plugin-postcss": "4.0.2",
100
110
  "rollup-plugin-stylelint": "1.0.0",
101
111
  "rollup-plugin-terser": "^7.0.2",
102
112
  "rollup-plugin-visualizer": "^5.8.3",
103
113
  "sass": "1.62.1",
104
- "stylelint": "15.6.0",
114
+ "storybook": "^7.0.20",
115
+ "stylelint": "15.10.1",
105
116
  "stylelint-config-standard-scss": "7.0.1",
106
117
  "tslib": "^2.4.1",
107
118
  "typescript": "4.9.5",
119
+ "vite": "4.3.9",
120
+ "vite-plugin-stylelint": "^4.3.0",
108
121
  "whatwg-fetch": "^3.6.2"
109
122
  },
110
123
  "dependencies": {