@adyen/adyen-web 5.59.0 → 5.60.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 (79) 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/Ach/Ach.d.ts +2 -1
  7. package/dist/types/components/ApplePay/types.d.ts +1 -8
  8. package/dist/types/components/BaseElement.d.ts +3 -0
  9. package/dist/types/components/BcmcMobile/BcmcMobile.d.ts +2 -1
  10. package/dist/types/components/Card/Bancontact.d.ts +4 -2
  11. package/dist/types/components/Card/Card.d.ts +18 -9
  12. package/dist/types/components/Card/components/CardInput/components/CardFieldsWrapper.d.ts +4 -2
  13. package/dist/types/components/Card/components/CardInput/components/CardHolderName.d.ts +1 -1
  14. package/dist/types/components/Card/components/CardInput/components/types.d.ts +4 -0
  15. package/dist/types/components/Card/components/CardInput/types.d.ts +5 -3
  16. package/dist/types/components/Card/components/CardInput/utils.d.ts +1 -1
  17. package/dist/types/components/Card/types.d.ts +13 -4
  18. package/dist/types/components/CashAppPay/CashAppPay.d.ts +2 -1
  19. package/dist/types/components/ClickToPay/ClickToPay.d.ts +2 -1
  20. package/dist/types/components/Donation/Donation.d.ts +4 -1
  21. package/dist/types/components/Donation/components/types.d.ts +2 -2
  22. package/dist/types/components/Donation/types.d.ts +17 -0
  23. package/dist/types/components/Dragonpay/Dragonpay.d.ts +2 -1
  24. package/dist/types/components/Dropin/Dropin.d.ts +2 -1
  25. package/dist/types/components/DuitNow/DuitNow.d.ts +2 -1
  26. package/dist/types/components/PayMe/PayMe.d.ts +2 -1
  27. package/dist/types/components/PayNow/PayNow.d.ts +2 -1
  28. package/dist/types/components/PromptPay/PromptPay.d.ts +2 -1
  29. package/dist/types/components/Riverty/Riverty.d.ts +2 -1
  30. package/dist/types/components/SecuredFields/SecuredFields.d.ts +1 -0
  31. package/dist/types/components/Swish/Swish.d.ts +2 -1
  32. package/dist/types/components/ThreeDS2/ThreeDS2Challenge.d.ts +6 -1
  33. package/dist/types/components/ThreeDS2/ThreeDS2DeviceFingerprint.d.ts +12 -7
  34. package/dist/types/components/ThreeDS2/components/Challenge/DoChallenge3DS2.d.ts +2 -1
  35. package/dist/types/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.d.ts +4 -3
  36. package/dist/types/components/ThreeDS2/components/Challenge/types.d.ts +3 -0
  37. package/dist/types/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.d.ts +2 -1
  38. package/dist/types/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.d.ts +7 -4
  39. package/dist/types/components/ThreeDS2/components/DeviceFingerprint/types.d.ts +6 -1
  40. package/dist/types/components/ThreeDS2/components/Form/ThreeDS2Form.d.ts +1 -0
  41. package/dist/types/components/ThreeDS2/components/utils.d.ts +9 -3
  42. package/dist/types/components/ThreeDS2/config.d.ts +9 -0
  43. package/dist/types/components/ThreeDS2/types.d.ts +4 -0
  44. package/dist/types/components/UIElement.d.ts +11 -0
  45. package/dist/types/components/WeChat/WeChat.d.ts +3 -1
  46. package/dist/types/components/internal/Address/Address.d.ts +2 -0
  47. package/dist/types/components/internal/Address/types.d.ts +8 -12
  48. package/dist/types/components/internal/Address/utils.d.ts +0 -2
  49. package/dist/types/components/internal/FormFields/Select/Select.d.ts +1 -1
  50. package/dist/types/components/internal/FormFields/Select/types.d.ts +6 -4
  51. package/dist/types/components/internal/IssuerList/types.d.ts +2 -0
  52. package/dist/types/components/internal/QRLoader/types.d.ts +2 -0
  53. package/dist/types/components/internal/SecuredFields/lib/configuration/constants.d.ts +2 -1
  54. package/dist/types/components/internal/SecuredFields/utils.d.ts +3 -13
  55. package/dist/types/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.d.ts +3 -1
  56. package/dist/types/components/types.d.ts +23 -3
  57. package/dist/types/core/Analytics/Analytics.d.ts +3 -13
  58. package/dist/types/core/Analytics/EventsQueue.d.ts +13 -5
  59. package/dist/types/core/Analytics/analyticsPreProcessor.d.ts +3 -0
  60. package/dist/types/core/Analytics/constants.d.ts +72 -0
  61. package/dist/types/core/Analytics/types.d.ts +54 -1
  62. package/dist/types/core/Analytics/utils.d.ts +21 -0
  63. package/dist/types/core/Environment/Environment.d.ts +2 -0
  64. package/dist/types/core/Environment/index.d.ts +1 -1
  65. package/dist/types/core/Errors/types.d.ts +4 -0
  66. package/dist/types/core/Errors/utils.d.ts +1 -0
  67. package/dist/types/core/Services/analytics/collect-id.d.ts +5 -4
  68. package/dist/types/core/Services/analytics/log-event.d.ts +2 -1
  69. package/dist/types/core/Services/analytics/types.d.ts +17 -7
  70. package/dist/types/core/Services/http.d.ts +1 -1
  71. package/dist/types/core/core.d.ts +1 -0
  72. package/dist/types/core/types.d.ts +3 -1
  73. package/dist/types/utils/Formatters/formatters.d.ts +1 -0
  74. package/dist/types/utils/Storage.d.ts +3 -0
  75. package/dist/types/utils/base64.d.ts +4 -1
  76. package/dist/types/utils/debounce.d.ts +2 -0
  77. package/dist/types/utils/textUtils.d.ts +1 -0
  78. package/package.json +2 -2
  79. package/dist/types/core/Services/analytics/post-telemetry.d.ts +0 -13
@@ -1,3 +1,5 @@
1
+ import { PaymentAmount } from '../../types';
2
+ import { CoreOptions } from '../types';
1
3
  export interface Experiment {
2
4
  controlGroup: boolean;
3
5
  experimentId: string;
@@ -21,7 +23,58 @@ export interface AnalyticsOptions {
21
23
  */
22
24
  payload?: any;
23
25
  /**
24
- * List of experiments to be sent in the collectId call
26
+ * List of experiments to be sent in the collectId call // TODO - still used?
25
27
  */
26
28
  experiments?: Experiment[];
27
29
  }
30
+ export type AnalyticsProps = Pick<CoreOptions, 'loadingContext' | 'locale' | 'clientKey' | 'analytics' | 'amount'> & {
31
+ analyticsContext?: string;
32
+ };
33
+ export interface AnalyticsObject {
34
+ timestamp: string;
35
+ component: string;
36
+ id: string;
37
+ code?: string;
38
+ errorType?: string;
39
+ message?: string;
40
+ type?: string;
41
+ subtype?: string;
42
+ target?: string;
43
+ metadata?: Record<string, any>;
44
+ isStoredPaymentMethod?: boolean;
45
+ brand?: string;
46
+ validationErrorCode?: string;
47
+ validationErrorMessage?: string;
48
+ issuer?: string;
49
+ }
50
+ export type ANALYTICS_EVENT = 'log' | 'error' | 'info';
51
+ export type CreateAnalyticsObject = Omit<AnalyticsObject, 'timestamp' | 'id'> & {
52
+ event: ANALYTICS_EVENT;
53
+ };
54
+ export type AnalyticsInitialEvent = {
55
+ containerWidth: number;
56
+ component: string;
57
+ flavor: string;
58
+ paymentMethods?: any[];
59
+ sessionId?: string;
60
+ };
61
+ export type AnalyticsConfig = {
62
+ analyticsContext?: string;
63
+ clientKey?: string;
64
+ locale?: string;
65
+ amount?: PaymentAmount;
66
+ loadingContext?: string;
67
+ };
68
+ export type CreateAnalyticsEventData = Omit<AnalyticsObject, 'timestamp' | 'id'>;
69
+ export type CreateAnalyticsEventObject = {
70
+ event: ANALYTICS_EVENT;
71
+ data: CreateAnalyticsEventData;
72
+ };
73
+ export type EventQueueProps = Pick<AnalyticsConfig, 'analyticsContext' | 'clientKey'> & {
74
+ analyticsPath: string;
75
+ };
76
+ export type SendAnalyticsObject = Omit<AnalyticsObject, 'timestamp' | 'component' | 'id'>;
77
+ export type FieldErrorAnalyticsObject = {
78
+ fieldType: string;
79
+ errorCode: string;
80
+ };
@@ -0,0 +1,21 @@
1
+ import { AnalyticsObject, CreateAnalyticsObject } from './types';
2
+ export declare const getUTCTimestamp: () => number;
3
+ /**
4
+ * All objects for the /checkoutanalytics endpoint have base props:
5
+ * "timestamp" & "component"
6
+ *
7
+ * Error objects have, in addition to the base props:
8
+ * "code", "errorType" & "message"
9
+ *
10
+ * Log objects have, in addition to the base props:
11
+ * "message" & "type" &
12
+ * "subtype" (e.g. when an action is handled)
13
+ *
14
+ * Info objects have, in addition to the base props:
15
+ * "type" & "target" &
16
+ * "isStoredPaymentMethod" & "brand" (when a storedCard is "selected"), or,
17
+ * "validationErrorCode" & "validationErrorMessage" (when the event is describing a validation error)
18
+ *
19
+ * All objects can also have a "metadata" object of key-value pairs
20
+ */
21
+ export declare const createAnalyticsObject: (aObj: CreateAnalyticsObject) => AnalyticsObject;
@@ -2,3 +2,5 @@ export declare const FALLBACK_CONTEXT = "https://checkoutshopper-live.adyen.com/
2
2
  export declare const resolveEnvironment: (env?: string, environmentUrl?: string) => string;
3
3
  export declare const FALLBACK_CDN_CONTEXT = "https://checkoutshopper-live.adyen.com/checkoutshopper/";
4
4
  export declare const resolveCDNEnvironment: (env?: string, environmentUrl?: string) => any;
5
+ export declare const FALLBACK_ANALYTICS_CONTEXT = "https://checkoutanalytics-live.adyen.com/checkoutanalytics/";
6
+ export declare const resolveAnalyticsEnvironment: (env?: string) => any;
@@ -1 +1 @@
1
- export { resolveCDNEnvironment, resolveEnvironment } from './Environment';
1
+ export { resolveCDNEnvironment, resolveEnvironment, resolveAnalyticsEnvironment } from './Environment';
@@ -48,3 +48,7 @@ export interface SetSRMessagesReturnObject {
48
48
  action: string;
49
49
  fieldToFocus?: string;
50
50
  }
51
+ export type ErrorObject = {
52
+ success: false;
53
+ error: string;
54
+ };
@@ -14,6 +14,7 @@ export declare const addAriaErrorTranslationsObject: (i18n: any) => {};
14
14
  * @returns a duplicate of the original object with a new property: "error" whose value is a object containing the translated errors
15
15
  */
16
16
  export declare const addErrorTranslationsToObject: (originalObj: any, i18n: any) => any;
17
+ export declare const getErrorMessageFromCode: (errorCode: string, codeMap: Record<string, string>) => string;
17
18
  /**
18
19
  * sortErrorsByLayout - takes a list of errors and a layout, and returns a sorted array of error objects with translated error messages
19
20
  *
@@ -1,8 +1,9 @@
1
1
  import { CollectIdProps } from './types';
2
+ export declare const FAILURE_MSG = "WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.";
2
3
  /**
3
- * Log event to Adyen
4
- * @param config - ready to be serialized and included in the body of request
5
- * @returns a function returning a promise containing the response of the call
4
+ * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response
5
+ * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request
6
+ * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)
6
7
  */
7
- declare const collectId: ({ loadingContext, clientKey, experiments }: CollectIdProps) => () => Promise<string>;
8
+ declare const collectId: ({ analyticsContext, clientKey, locale, analyticsPath }: CollectIdProps) => (event: any) => Promise<string>;
8
9
  export default collectId;
@@ -1,7 +1,8 @@
1
+ import { LogEventProps } from './types';
1
2
  /**
2
3
  * Log event to Adyen
3
4
  * @param config - ready to be serialized and included in the request
4
5
  * @returns A log event function
5
6
  */
6
- declare const logEvent: (config: any) => (event: any) => void;
7
+ declare const logEvent: (config: LogEventProps) => (initialEvent: any) => void;
7
8
  export default logEvent;
@@ -1,11 +1,21 @@
1
- import { Experiment } from '../../Analytics/types';
2
- type CheckoutAttemptIdSession = {
1
+ import { AnalyticsConfig } from '../../Analytics/types';
2
+ import { PaymentAmount } from '../../../types';
3
+ export type CheckoutAttemptIdSession = {
3
4
  id: string;
4
5
  timestamp: number;
5
6
  };
6
- type CollectIdProps = {
7
- clientKey: string;
8
- loadingContext: string;
9
- experiments: Experiment[];
7
+ export type CollectIdProps = Pick<AnalyticsConfig, 'clientKey' | 'analyticsContext' | 'locale' | 'amount'> & {
8
+ analyticsPath: string;
9
+ };
10
+ export type LogEventProps = Pick<AnalyticsConfig, 'loadingContext' | 'locale'>;
11
+ export type TelemetryEvent = {
12
+ version: string;
13
+ channel: 'Web';
14
+ locale: string;
15
+ referrer: string;
16
+ screenWidth: number;
17
+ containerWidth: number;
18
+ component: string;
19
+ flavor: string;
20
+ amount?: PaymentAmount;
10
21
  };
11
- export { CheckoutAttemptIdSession, CollectIdProps };
@@ -1,4 +1,4 @@
1
- interface HttpOptions {
1
+ export interface HttpOptions {
2
2
  accept?: string;
3
3
  contentType?: string;
4
4
  errorMessage?: string;
@@ -12,6 +12,7 @@ declare class Core {
12
12
  components: any[];
13
13
  loadingContext?: string;
14
14
  cdnContext?: string;
15
+ analyticsContext?: string;
15
16
  static readonly version: {
16
17
  version: string;
17
18
  revision: string;
@@ -126,7 +126,9 @@ type PaymentMethodsConfigurationMap = {
126
126
  [key in keyof PaymentMethods]?: Partial<PaymentMethodOptions<key>>;
127
127
  };
128
128
  type PaymentActionTypesMap = {
129
- [key in PaymentActionsType]?: Partial<UIElementProps>;
129
+ [key in PaymentActionsType]?: Partial<UIElementProps> & {
130
+ challengeWindowSize?: string;
131
+ };
130
132
  };
131
133
  /**
132
134
  * Type must be loose, otherwise it will take priority over the rest
@@ -1,2 +1,3 @@
1
1
  import { FormatterFn } from './types';
2
2
  export declare const digitsOnlyFormatter: FormatterFn;
3
+ export declare const capitalizeFirstLetter: (str: string) => string;
@@ -6,5 +6,8 @@ declare class Storage<T> {
6
6
  get(): T;
7
7
  set(value: T): void;
8
8
  remove(): void;
9
+ clear(): void;
10
+ keyByIndex(index: any): string;
11
+ get length(): number;
9
12
  }
10
13
  export default Storage;
@@ -1,8 +1,11 @@
1
+ import { DecodeObject } from '../components/types';
2
+ export declare const NOT_BASE64_ERROR = "not base64";
3
+ export declare const BASE64_MALFORMED_URI_ERROR = "malformed URI sequence";
1
4
  /**
2
5
  * @internal
3
6
  */
4
7
  declare const base64: {
5
- decode: (pData: any) => string | false;
8
+ decode: (pData: string) => DecodeObject;
6
9
  encode: (pData: any) => string;
7
10
  isBase64: (pDataStr: any) => boolean;
8
11
  };
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_DEBOUNCE_TIME_MS = 300;
2
+ export declare const debounce: (fn: Function, ms?: number) => (this: any, ...args: any[]) => void;
@@ -0,0 +1 @@
1
+ export declare const camelCaseToSnakeCase: (camelCaseString: any) => any;
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "./dist/es/adyen.css": "./dist/es/adyen.css",
26
26
  "./package.json": "./package.json"
27
27
  },
28
- "version": "5.59.0",
28
+ "version": "5.60.0",
29
29
  "license": "MIT",
30
30
  "homepage": "https://docs.adyen.com/checkout",
31
31
  "repository": "github:Adyen/adyen-web",
@@ -124,7 +124,7 @@
124
124
  "dependencies": {
125
125
  "@babel/runtime": "^7.15.4",
126
126
  "@babel/runtime-corejs3": "^7.20.1",
127
- "@types/applepayjs": "^3.0.4",
127
+ "@types/applepayjs": "14.0.6",
128
128
  "@types/googlepay": "^0.7.0",
129
129
  "classnames": "^2.3.1",
130
130
  "core-js-pure": "^3.25.3",
@@ -1,13 +0,0 @@
1
- import { PaymentAmount } from '../../../types';
2
- type LogTelemetryConfig = {
3
- loadingContext: string;
4
- locale: string;
5
- clientKey: string;
6
- amount: PaymentAmount;
7
- };
8
- /**
9
- * Log event to Adyen
10
- * @param config -
11
- */
12
- declare const logTelemetry: (config: LogTelemetryConfig) => (event: any) => Promise<any>;
13
- export default logTelemetry;