@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
@@ -2,6 +2,7 @@ import { Component, h } from 'preact';
2
2
  import { PrepareChallenge3DS2Props, PrepareChallenge3DS2State } from './types';
3
3
  import '../../ThreeDS2.scss';
4
4
  import './challenge.scss';
5
+ import { ActionHandledReturnObject } from '../../../types';
5
6
  declare class PrepareChallenge3DS2 extends Component<PrepareChallenge3DS2Props, PrepareChallenge3DS2State> {
6
7
  static defaultProps: {
7
8
  onComplete: () => void;
@@ -9,11 +10,11 @@ declare class PrepareChallenge3DS2 extends Component<PrepareChallenge3DS2Props,
9
10
  onActionHandled: () => void;
10
11
  };
11
12
  constructor(props: any);
13
+ onActionHandled: (rtnObj: ActionHandledReturnObject) => void;
14
+ onFormSubmit: (msg: string) => void;
12
15
  setStatusComplete(resultObj: any): void;
13
16
  setStatusError(errorInfoObj: any): void;
14
- render({ onActionHandled }: {
15
- onActionHandled: any;
16
- }, { challengeData }: {
17
+ render(_: any, { challengeData }: {
17
18
  challengeData: any;
18
19
  }): h.JSX.Element;
19
20
  }
@@ -2,10 +2,12 @@ import { ChallengeData, ThreeDS2FlowObject } from '../../types';
2
2
  import { ChallengeResolveData } from '../utils';
3
3
  import { ThreeDS2ChallengeProps } from '../../ThreeDS2Challenge';
4
4
  import { ActionHandledReturnObject } from '../../../types';
5
+ import { SendAnalyticsObject } from '../../../../core/Analytics/types';
5
6
  export interface DoChallenge3DS2Props extends ChallengeData {
6
7
  onCompleteChallenge: (resolveObject: ThreeDS2FlowObject) => void;
7
8
  onErrorChallenge: (rejectObject: ThreeDS2FlowObject) => void;
8
9
  onActionHandled: (rtnObj: ActionHandledReturnObject) => void;
10
+ onFormSubmit: (msg: string) => void;
9
11
  }
10
12
  export interface DoChallenge3DS2State {
11
13
  base64URLencodedData?: string;
@@ -13,6 +15,7 @@ export interface DoChallenge3DS2State {
13
15
  }
14
16
  export interface PrepareChallenge3DS2Props extends ThreeDS2ChallengeProps {
15
17
  onComplete?: (data: ChallengeResolveData) => void;
18
+ onSubmitAnalytics: (aObj: SendAnalyticsObject) => void;
16
19
  }
17
20
  export interface PrepareChallenge3DS2State {
18
21
  challengeData?: ChallengeData;
@@ -19,9 +19,10 @@ declare class DoFingerprint3DS2 extends Component<DoFingerprint3DS2Props, DoFing
19
19
  get3DS2MethodPromise(): Promise<unknown>;
20
20
  componentDidMount(): void;
21
21
  componentWillUnmount(): void;
22
- render({ threeDSMethodURL, onActionHandled }: {
22
+ render({ threeDSMethodURL, onActionHandled, onFormSubmit }: {
23
23
  threeDSMethodURL: any;
24
24
  onActionHandled: any;
25
+ onFormSubmit: any;
25
26
  }, { base64URLencodedData }: {
26
27
  base64URLencodedData: any;
27
28
  }): h.JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import { Component, h } from 'preact';
2
2
  import { PrepareFingerprint3DS2Props, PrepareFingerprint3DS2State } from './types';
3
3
  import { ResultObject } from '../../types';
4
+ import { ActionHandledReturnObject } from '../../../types';
4
5
  declare class PrepareFingerprint3DS2 extends Component<PrepareFingerprint3DS2Props, PrepareFingerprint3DS2State> {
5
6
  static type: string;
6
- constructor(props: any);
7
7
  static defaultProps: {
8
8
  onComplete: () => void;
9
9
  onError: () => void;
@@ -11,12 +11,15 @@ declare class PrepareFingerprint3DS2 extends Component<PrepareFingerprint3DS2Pro
11
11
  showSpinner: boolean;
12
12
  onActionHandled: () => void;
13
13
  };
14
+ constructor(props: any);
15
+ onActionHandled: (rtnObj: ActionHandledReturnObject) => void;
16
+ onFormSubmit: (msg: string) => void;
14
17
  componentDidMount(): void;
15
18
  setStatusComplete(resultObj: ResultObject): void;
16
- render({ showSpinner, onActionHandled }: {
19
+ render({ showSpinner }: {
17
20
  showSpinner: any;
18
- onActionHandled: any;
19
- }, { fingerPrintData }: {
21
+ }, { status, fingerPrintData }: {
22
+ status: any;
20
23
  fingerPrintData: any;
21
24
  }): h.JSX.Element;
22
25
  }
@@ -2,19 +2,24 @@ import { ThreeDS2FlowObject, FingerPrintData } from '../../types';
2
2
  import { ThreeDS2DeviceFingerprintProps } from '../../ThreeDS2DeviceFingerprint';
3
3
  import { FingerprintResolveData } from '../utils';
4
4
  import { ActionHandledReturnObject } from '../../../types';
5
+ import { SendAnalyticsObject } from '../../../../core/Analytics/types';
6
+ import { ErrorObject } from '../../../../core/Errors/types';
5
7
  export interface DoFingerprint3DS2Props extends FingerPrintData {
6
8
  onCompleteFingerprint: (resolveObject: ThreeDS2FlowObject) => void;
7
9
  onErrorFingerprint: (rejectObject: ThreeDS2FlowObject) => void;
8
10
  showSpinner: boolean;
9
11
  onActionHandled: (rtnObj: ActionHandledReturnObject) => void;
12
+ onFormSubmit: (msg: string) => void;
10
13
  }
11
14
  export interface DoFingerprint3DS2State {
12
15
  base64URLencodedData: string;
13
16
  }
14
17
  export interface PrepareFingerprint3DS2Props extends ThreeDS2DeviceFingerprintProps {
15
18
  onComplete: (data: FingerprintResolveData) => void;
19
+ onSubmitAnalytics: (aObj: SendAnalyticsObject) => void;
20
+ isMDFlow: boolean;
16
21
  }
17
22
  export interface PrepareFingerprint3DS2State {
18
23
  status?: string;
19
- fingerPrintData?: FingerPrintData;
24
+ fingerPrintData?: FingerPrintData | ErrorObject;
20
25
  }
@@ -5,6 +5,7 @@ interface ThreeDS2FormProps {
5
5
  target: string;
6
6
  inputName: string;
7
7
  inputValue: string;
8
+ onFormSubmit: (msg: string) => void;
8
9
  }
9
10
  export default class ThreeDS2Form extends Component<ThreeDS2FormProps> {
10
11
  protected formEl: any;
@@ -1,4 +1,5 @@
1
1
  import { ChallengeData, ThreeDS2Token, FingerPrintData, ResultObject } from '../types';
2
+ import { ErrorObject } from '../../../core/Errors/types';
2
3
  export interface FingerprintResolveData {
3
4
  data: {
4
5
  [key: string]: string;
@@ -16,7 +17,12 @@ export interface ErrorCodeObject {
16
17
  errorCode: string;
17
18
  message: string;
18
19
  }
19
- export declare const decodeAndParseToken: (token: string) => ThreeDS2Token;
20
+ /**
21
+ * Check if we have been passed an ErrorObject because either base64 decoding or JSON.parse failed
22
+ * @param obj -
23
+ */
24
+ export declare const isErrorObject: (obj: ErrorObject | ThreeDS2Token) => boolean;
25
+ export declare const decodeAndParseToken: (token: string) => ThreeDS2Token | ErrorObject;
20
26
  /**
21
27
  * Performs JSON.stringify on passed object & and base64 encodes result
22
28
  * @param obj -
@@ -45,7 +51,7 @@ export declare const getChallengeWindowSize: (sizeStr: string) => string[];
45
51
  export declare const prepareChallengeData: ({ token, size }: {
46
52
  token: any;
47
53
  size: any;
48
- }) => ChallengeData;
54
+ }) => ChallengeData | ErrorObject;
49
55
  /**
50
56
  * prepareFingerPrintData
51
57
  *
@@ -62,7 +68,7 @@ export declare const prepareChallengeData: ({ token, size }: {
62
68
  export declare const prepareFingerPrintData: ({ token, notificationURL }: {
63
69
  token: any;
64
70
  notificationURL: any;
65
- }) => FingerPrintData;
71
+ }) => FingerPrintData | ErrorObject;
66
72
  export declare const createFingerprintResolveData: (dataKey: string, resultObj: ResultObject, paymentData: string) => FingerprintResolveData;
67
73
  export declare const createOldFingerprintResolveData: (dataKey: string, resultObj: ResultObject, paymentData: string) => any;
68
74
  export declare const createChallengeResolveData: (dataKey: string, transStatus: string, authorisationToken: string) => ChallengeResolveData;
@@ -1,4 +1,13 @@
1
1
  import { ThreeDS2FlowObject } from './types';
2
+ export declare const THREEDS2_FINGERPRINT = "threeDS2Fingerprint";
3
+ export declare const THREEDS2_FINGERPRINT_ERROR = "3DS2Fingerprint_Error";
4
+ export declare const THREEDS2_FINGERPRINT_SUBMIT = "callSubmit3DS2Fingerprint_Response";
5
+ export declare const THREEDS2_CHALLENGE = "threeDS2Challenge";
6
+ export declare const THREEDS2_CHALLENGE_ERROR = "3DS2Challenge_Error";
7
+ export declare const THREEDS2_ERROR = "threeDS2Error";
8
+ export declare const THREEDS2_FULL = "threeDS2";
9
+ export declare const THREEDS2_NUM = "3DS2";
10
+ export declare const MISSING_TOKEN_IN_ACTION_MSG = "Missing \"token\" property from threeDS2 action";
2
11
  export declare const DEFAULT_CHALLENGE_WINDOW_SIZE = "02";
3
12
  export declare const THREEDS_METHOD_TIMEOUT = 10000;
4
13
  export declare const CHALLENGE_TIMEOUT = 600000;
@@ -1,3 +1,4 @@
1
+ import { ANALYTICS_EVENT, AnalyticsObject } from '../../core/Analytics/types';
1
2
  /**
2
3
  * See
3
4
  * https://docs.adyen.com/checkout/3d-secure/api-reference#threeds2result
@@ -67,4 +68,7 @@ type CheckoutThreeDS2Action = {
67
68
  subtype: string;
68
69
  authorisationToken: string;
69
70
  };
71
+ export type ThreeDS2AnalyticsObject = Pick<AnalyticsObject, 'code' | 'errorType' | 'message' | 'type' | 'metadata'> & {
72
+ event: ANALYTICS_EVENT;
73
+ };
70
74
  export {};
@@ -7,12 +7,23 @@ import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';
7
7
  import { UIElementStatus } from './types';
8
8
  import { CoreOptions } from '../core/types';
9
9
  import Core from '../core';
10
+ import { AnalyticsInitialEvent, SendAnalyticsObject } from '../core/Analytics/types';
10
11
  export declare class UIElement<P extends UIElementProps = any> extends BaseElement<P> implements IUIElement {
11
12
  protected componentRef: any;
12
13
  elementRef: UIElement;
13
14
  constructor(props: P);
14
15
  setState(newState: object): void;
15
16
  protected onChange(): object;
17
+ protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent): Promise<any>;
18
+ /**
19
+ * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:
20
+ * - mounted,
21
+ * - a PM has been selected
22
+ * - onSubmit has been called (as a result of the pay button being pressed)
23
+ *
24
+ * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created
25
+ */
26
+ protected submitAnalytics(analyticsObj: SendAnalyticsObject): void;
16
27
  private onSubmit;
17
28
  private onValid;
18
29
  onComplete(state: any): void;
@@ -1,6 +1,7 @@
1
1
  import QRLoaderContainer from '../helpers/QRLoaderContainer';
2
2
  declare class WeChatPayElement extends QRLoaderContainer {
3
3
  static type: string;
4
+ static analyticsType: string;
4
5
  formatProps(props: any): {
5
6
  delay: number;
6
7
  countdownTime: number;
@@ -31,6 +32,7 @@ declare class WeChatPayElement extends QRLoaderContainer {
31
32
  icon?: string;
32
33
  amount?: import("../../types").PaymentAmount;
33
34
  secondaryAmount?: import("../../types").PaymentAmountExtended;
35
+ brand?: string;
34
36
  showPayButton?: boolean;
35
37
  setStatusAutomatically?: boolean;
36
38
  payButton?: (options: import("../types").PayButtonFunctionProps) => import("preact").JSX.Element;
@@ -44,7 +46,7 @@ declare class WeChatPayElement extends QRLoaderContainer {
44
46
  order?: import("../../types").Order;
45
47
  modules?: {
46
48
  srPanel?: import("../../core/Errors/SRPanel").SRPanel;
47
- analytics?: import("../../core/Analytics/Analytics").default;
49
+ analytics?: import("../types").AnalyticsModule;
48
50
  resources?: import("../../core/Context/Resources").Resources;
49
51
  risk?: import("../../core/RiskModule").default;
50
52
  };
@@ -10,6 +10,8 @@ declare namespace Address {
10
10
  visibility: string;
11
11
  requiredFields: readonly ["street", "houseNumberOrName", "postalCode", "city", "stateOrProvince", "country", "firstName", "lastName"];
12
12
  specifications: {};
13
+ onFieldFocusAnalytics: () => void;
14
+ onFieldBlurAnalytics: () => void;
13
15
  };
14
16
  }
15
17
  export default Address;
@@ -3,6 +3,7 @@ import Specifications from './Specifications';
3
3
  import { ValidatorRules } from '../../../utils/Validator/types';
4
4
  import { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';
5
5
  import { OnAddressLookupType, OnAddressSelectedType } from './components/AddressSearch';
6
+ import { SelectTargetObject } from '../FormFields/Select/types';
6
7
  export type StringObject = {
7
8
  [key: string]: string;
8
9
  };
@@ -25,6 +26,8 @@ export interface AddressProps {
25
26
  payButton?: (obj: any) => {};
26
27
  showPayButton?: boolean;
27
28
  setComponentRef?: (ref: any) => void;
29
+ onFieldFocusAnalytics?: (who: string, event: Event) => void;
30
+ onFieldBlurAnalytics?: (who: string, event: Event) => void;
28
31
  }
29
32
  export interface AddressLookupItem extends AddressData {
30
33
  id: string;
@@ -49,16 +52,15 @@ export interface FieldContainerProps {
49
52
  onInput?: (e: Event) => void;
50
53
  onBlur?: (e: Event) => void;
51
54
  onDropdownChange: (e: {
52
- target: {
53
- value: string | number;
54
- name: string;
55
- };
55
+ target: SelectTargetObject;
56
56
  }) => void;
57
57
  readOnly?: boolean;
58
58
  specifications: Specifications;
59
59
  maxLength?: number;
60
60
  trimOnBlur?: boolean;
61
61
  disabled?: boolean;
62
+ onFieldFocusAnalytics?: (who: string, event: Event) => void;
63
+ onFieldBlurAnalytics?: (who: string, event: Event) => void;
62
64
  }
63
65
  export interface ReadOnlyAddressProps {
64
66
  data: AddressData;
@@ -70,10 +72,7 @@ export interface CountryFieldProps {
70
72
  label: string;
71
73
  errorMessage: boolean | string;
72
74
  onDropdownChange: (e: {
73
- target: {
74
- value: string | number;
75
- name: string;
76
- };
75
+ target: SelectTargetObject;
77
76
  }) => void;
78
77
  readOnly?: boolean;
79
78
  value: string;
@@ -87,10 +86,7 @@ export interface StateFieldProps {
87
86
  label: string;
88
87
  errorMessage: boolean | string;
89
88
  onDropdownChange: (e: {
90
- target: {
91
- value: string | number;
92
- name: string;
93
- };
89
+ target: SelectTargetObject;
94
90
  }) => void;
95
91
  readOnly?: boolean;
96
92
  selectedCountry: string;
@@ -1,10 +1,8 @@
1
1
  import Language from '../../../language';
2
2
  import { StringObject } from './types';
3
- export declare const DEFAULT_DEBOUNCE_TIME_MS = 300;
4
3
  /**
5
4
  * Used by the SRPanel sorting function to tell it whether we need to prepend the field type to the SR panel message, and, if so, we retrieve the correct translation for the field type.
6
5
  * (Whether we need to prepend the field type depends on whether we know that the error message correctly reflects the label of the field. Ultimately all error messages should do this
7
6
  * and this mapping fn will become redundant)
8
7
  */
9
8
  export declare const mapFieldKey: (key: string, i18n: Language, countrySpecificLabels: StringObject) => string;
10
- export declare const debounce: (fn: Function, ms?: number) => (this: any, ...args: any[]) => void;
@@ -1,7 +1,7 @@
1
1
  import { h } from 'preact';
2
2
  import { SelectProps } from './types';
3
3
  import './Select.scss';
4
- declare function Select({ items, className, classNameModifiers, filterable, readonly, onChange, onInput, selectedValue, name, isInvalid, isValid, placeholder, uniqueId, disabled, disableTextFilter, clearOnSelect, blurOnClose }: SelectProps): h.JSX.Element;
4
+ declare function Select({ items, className, classNameModifiers, filterable, readonly, onChange, onInput, selectedValue, name, isInvalid, isValid, placeholder, uniqueId, disabled, disableTextFilter, clearOnSelect, blurOnClose, onListToggle }: SelectProps): h.JSX.Element;
5
5
  declare namespace Select {
6
6
  var defaultProps: {
7
7
  className: string;
@@ -7,6 +7,10 @@ export interface SelectItem {
7
7
  secondaryText?: string;
8
8
  selectedOptionName?: string;
9
9
  }
10
+ export interface SelectTargetObject {
11
+ value?: string | number;
12
+ name?: string;
13
+ }
10
14
  export interface SelectProps {
11
15
  className: string;
12
16
  classNameModifiers: string[];
@@ -16,10 +20,7 @@ export interface SelectProps {
16
20
  items: SelectItem[];
17
21
  name?: string;
18
22
  onChange: (e: {
19
- target: {
20
- value: string | number;
21
- name: string;
22
- };
23
+ target: SelectTargetObject;
23
24
  } | Partial<h.JSX.TargetedKeyboardEvent<HTMLInputElement>>) => void;
24
25
  onInput?: (value: string) => void;
25
26
  placeholder?: string;
@@ -30,6 +31,7 @@ export interface SelectProps {
30
31
  disableTextFilter?: boolean;
31
32
  clearOnSelect?: boolean;
32
33
  blurOnClose?: boolean;
34
+ onListToggle?: (isOpen: boolean) => void;
33
35
  }
34
36
  export interface SelectButtonProps {
35
37
  inputText: string;
@@ -1,5 +1,6 @@
1
1
  import { PayButtonProps } from '../PayButton/PayButton';
2
2
  import { ComponentChildren } from 'preact';
3
+ import { SendAnalyticsObject } from '../../../core/Analytics/types';
3
4
  export interface IssuerListProps {
4
5
  items: IssuerItem[];
5
6
  showPayButton: boolean;
@@ -9,6 +10,7 @@ export interface IssuerListProps {
9
10
  placeholder?: string;
10
11
  issuer?: string;
11
12
  termsAndConditions?: TermsAndConditions;
13
+ onSubmitAnalytics: (aObj: SendAnalyticsObject) => void;
12
14
  }
13
15
  export interface IssuerItem {
14
16
  id: string;
@@ -2,6 +2,7 @@ import { PaymentAmount } from '../../../types';
2
2
  import Language from '../../../language/Language';
3
3
  import { ActionHandledReturnObject } from '../../types';
4
4
  import { h } from 'preact';
5
+ import { SendAnalyticsObject } from '../../../core/Analytics/types';
5
6
  export interface QRLoaderProps {
6
7
  delay?: number;
7
8
  countdownTime?: number;
@@ -28,6 +29,7 @@ export interface QRLoaderProps {
28
29
  instructions?: string | (() => h.JSX.Element);
29
30
  copyBtn?: boolean;
30
31
  onActionHandled?: (rtnObj: ActionHandledReturnObject) => void;
32
+ onSubmitAnalytics?: (aObj: SendAnalyticsObject) => void;
31
33
  }
32
34
  export interface QRLoaderState {
33
35
  buttonStatus: string;
@@ -1,4 +1,5 @@
1
1
  import { CVCPolicyType, DatePolicyType } from '../types';
2
+ export declare const ENCRYPTED = "encrypted";
2
3
  export declare const ENCRYPTED_CARD_NUMBER = "encryptedCardNumber";
3
4
  export declare const ENCRYPTED_EXPIRY_DATE = "encryptedExpiryDate";
4
5
  export declare const ENCRYPTED_EXPIRY_MONTH = "encryptedExpiryMonth";
@@ -11,7 +12,7 @@ export declare const ENCRYPTED_BANK_LOCATION_FIELD = "encryptedBankLocationId";
11
12
  export declare const ENCRYPTED_SECURITY_CODE_3_DIGITS = "encryptedSecurityCode3digits";
12
13
  export declare const ENCRYPTED_SECURITY_CODE_4_DIGITS = "encryptedSecurityCode4digits";
13
14
  export declare const GIFT_CARD = "giftcard";
14
- export declare const SF_VERSION = "4.8.0";
15
+ export declare const SF_VERSION = "4.8.2";
15
16
  export declare const DEFAULT_CARD_GROUP_TYPES: string[];
16
17
  export declare const NON_CREDIT_CARD_TYPE_SECURED_FIELDS: string[];
17
18
  export declare const CREDIT_CARD_SF_FIELDS: string[];
@@ -11,20 +11,10 @@ export declare const resolvePlaceholders: (i18n?: Language) => SFPlaceholdersObj
11
11
  */
12
12
  export declare const getCardImageUrl: (brand: any, resources: Resources) => string;
13
13
  /**
14
- * Checks if `prop` is classified as an `Array` primitive or object.
15
- * @internal
16
- * @param prop - The value to check.
17
- * @returns Returns `true` if `prop` is correctly classified, else `false`.
18
- * @example
19
- * ```
20
- * isArray([1, 2, 3]);
21
- * // => true
22
- *
23
- * isArray(1);
24
- * // => false
25
- * ```
14
+ * Used by Card.tsx & SecuredFields.tsx
15
+ * @param fieldType -
26
16
  */
27
- export declare function isArray(prop: any): boolean;
17
+ export declare const fieldTypeToSnakeCase: (fieldType: string) => any;
28
18
  /**
29
19
  * 'Destructures' properties from object - returns a new object only containing those properties that were asked for (including if those properties
30
20
  * have values that are falsy: null, undefined, false, '').
@@ -1,5 +1,5 @@
1
1
  import { h } from 'preact';
2
- export default function ({ onBlur, onInput, valid, error, data, required, disabled }: {
2
+ export default function ({ onBlur, onInput, valid, error, data, required, disabled, onFieldFocusAnalytics, onFieldBlurAnalytics }: {
3
3
  onBlur: any;
4
4
  onInput: any;
5
5
  valid?: boolean;
@@ -7,4 +7,6 @@ export default function ({ onBlur, onInput, valid, error, data, required, disabl
7
7
  data?: string;
8
8
  required?: boolean;
9
9
  disabled?: boolean;
10
+ onFieldFocusAnalytics?: any;
11
+ onFieldBlurAnalytics?: any;
10
12
  }): h.JSX.Element;
@@ -3,12 +3,14 @@ import { Order, PaymentAction, PaymentAmount, PaymentAmountExtended } from '../t
3
3
  import Language from '../language/Language';
4
4
  import UIElement from './UIElement';
5
5
  import Core from '../core';
6
- import Analytics from '../core/Analytics';
7
6
  import RiskElement from '../core/RiskModule';
8
7
  import { PayButtonProps } from './internal/PayButton/PayButton';
9
8
  import Session from '../core/CheckoutSession';
10
9
  import { SRPanel } from '../core/Errors/SRPanel';
11
10
  import { Resources } from '../core/Context/Resources';
11
+ import { AnalyticsInitialEvent, AnalyticsObject, CreateAnalyticsEventObject, SendAnalyticsObject } from '../core/Analytics/types';
12
+ import { EventsQueueModule } from '../core/Analytics/EventsQueue';
13
+ import { CbObjOnFocus } from './internal/SecuredFields/lib/types';
12
14
  export interface PaymentMethodData {
13
15
  paymentMethod: {
14
16
  [key: string]: any;
@@ -56,12 +58,20 @@ export interface PaymentResponse {
56
58
  export interface RawPaymentResponse extends PaymentResponse {
57
59
  [key: string]: any;
58
60
  }
61
+ export interface AnalyticsModule {
62
+ setUp: (a: AnalyticsInitialEvent) => Promise<any>;
63
+ getCheckoutAttemptId: () => string;
64
+ getEventsQueue: () => EventsQueueModule;
65
+ createAnalyticsEvent: (a: CreateAnalyticsEventObject) => AnalyticsObject;
66
+ getEnabled: () => boolean;
67
+ sendAnalytics: (component: string, analyticsObj: SendAnalyticsObject) => void;
68
+ }
59
69
  export interface BaseElementProps {
60
70
  _parentInstance?: Core;
61
71
  order?: Order;
62
72
  modules?: {
63
73
  srPanel?: SRPanel;
64
- analytics?: Analytics;
74
+ analytics?: AnalyticsModule;
65
75
  resources?: Resources;
66
76
  risk?: RiskElement;
67
77
  };
@@ -84,7 +94,7 @@ export interface IUIElement {
84
94
  setState(newState: object): void;
85
95
  }
86
96
  export type UIElementStatus = 'ready' | 'loading' | 'error' | 'success';
87
- export type ActionDescriptionType = 'qr-code-loaded' | 'polling-started' | 'fingerprint-iframe-loaded' | 'challenge-iframe-loaded';
97
+ export type ActionDescriptionType = 'qr-code-loaded' | 'polling-started' | string;
88
98
  export type PayButtonFunctionProps = Omit<PayButtonProps, 'amount'>;
89
99
  export interface ActionHandledReturnObject {
90
100
  componentType: string;
@@ -109,6 +119,7 @@ export interface UIElementProps extends BaseElementProps {
109
119
  icon?: string;
110
120
  amount?: PaymentAmount;
111
121
  secondaryAmount?: PaymentAmountExtended;
122
+ brand?: string;
112
123
  /**
113
124
  * Show/Hide pay button
114
125
  * @defaultValue true
@@ -142,3 +153,12 @@ export interface ComponentMethodsRef {
142
153
  showValidation?: () => void;
143
154
  setStatus?(status: UIElementStatus): void;
144
155
  }
156
+ export type DecodeObject = {
157
+ success: boolean;
158
+ error?: string;
159
+ data?: string;
160
+ };
161
+ export type ComponentFocusObject = {
162
+ fieldType: string;
163
+ event: Event | CbObjOnFocus;
164
+ };
@@ -1,14 +1,4 @@
1
- import { CoreOptions } from '../types';
2
- export type AnalyticsProps = Pick<CoreOptions, 'loadingContext' | 'locale' | 'clientKey' | 'analytics' | 'amount'>;
3
- declare class Analytics {
4
- private static defaultProps;
5
- checkoutAttemptId: string;
6
- props: any;
7
- private readonly logEvent;
8
- private readonly logTelemetry;
9
- private readonly queue;
10
- readonly collectId: any;
11
- constructor({ loadingContext, locale, clientKey, analytics, amount }: AnalyticsProps);
12
- send(event: any): void;
13
- }
1
+ import { AnalyticsProps } from './types';
2
+ import { AnalyticsModule } from '../../components/types';
3
+ declare const Analytics: ({ loadingContext, locale, clientKey, analytics, amount, analyticsContext }: AnalyticsProps) => AnalyticsModule;
14
4
  export default Analytics;
@@ -1,7 +1,15 @@
1
- type EventItem = (checkoutAttemptId: string) => Promise<any>;
2
- declare class EventsQueue {
3
- events: EventItem[];
4
- add(event: any): void;
5
- run(checkoutAttemptId?: string): Promise<any[]>;
1
+ import { AnalyticsObject, EventQueueProps } from './types';
2
+ interface CAActions {
3
+ channel: 'Web';
4
+ platform: 'Web';
5
+ info: AnalyticsObject[];
6
+ errors: AnalyticsObject[];
7
+ logs: AnalyticsObject[];
6
8
  }
9
+ export interface EventsQueueModule {
10
+ add: (t: string, o: AnalyticsObject) => void;
11
+ run: (id: string) => Promise<any>;
12
+ getQueue: () => CAActions;
13
+ }
14
+ declare const EventsQueue: ({ analyticsContext, clientKey, analyticsPath }: EventQueueProps) => EventsQueueModule;
7
15
  export default EventsQueue;
@@ -0,0 +1,3 @@
1
+ import { AnalyticsModule } from '../../components/types';
2
+ import { SendAnalyticsObject } from './types';
3
+ export declare const analyticsPreProcessor: (analyticsModule: AnalyticsModule) => (component: string, analyticsObj: SendAnalyticsObject) => void;
@@ -0,0 +1,72 @@
1
+ export declare const ANALYTICS_PATH = "v3/analytics";
2
+ export declare const ANALYTICS_INFO_TIMER_INTERVAL: number;
3
+ export declare const ANALYTICS_SEARCH_DEBOUNCE_TIME = 3000;
4
+ export declare const ANALYTICS_EVENT_LOG = "log";
5
+ export declare const ANALYTICS_EVENT_ERROR = "error";
6
+ export declare const ANALYTICS_EVENT_INFO = "info";
7
+ export declare const ANALYTICS_ACTION_STR = "action";
8
+ export declare const ANALYTICS_SUBMIT_STR = "submit";
9
+ export declare const ANALYTICS_SELECTED_STR = "selected";
10
+ export declare const ANALYTICS_RENDERED_STR = "rendered";
11
+ export declare const ANALYTICS_DISPLAYED_STR = "displayed";
12
+ export declare const ANALYTICS_INPUT_STR = "input";
13
+ export declare const ANALYTICS_DOWNLOAD_STR = "download";
14
+ export declare const ANALYTICS_VALIDATION_ERROR_STR = "validationError";
15
+ export declare const ANALYTICS_FOCUS_STR = "focus";
16
+ export declare const ANALYTICS_UNFOCUS_STR = "unfocus";
17
+ export declare const ANALYTICS_CONFIGURED_STR = "configured";
18
+ export declare const ANALYTICS_QR_CODE_DOWNLOAD = "qr_download_button";
19
+ export declare const ANALYTICS_INSTANT_PAYMENT_BUTTON = "instant_payment_button";
20
+ export declare const ANALYTICS_FEATURED_ISSUER = "featured_issuer";
21
+ export declare const ANALYTICS_LIST = "list";
22
+ export declare const ANALYTICS_LIST_SEARCH = "list_search";
23
+ export declare const ANALYTICS_IMPLEMENTATION_ERROR = "ImplementationError";
24
+ export declare const ANALYTICS_API_ERROR = "ApiError";
25
+ export declare const ANALYTICS_SDK_ERROR = "SdkError";
26
+ export declare const ANALYTICS_NETWORK_ERROR = "Network";
27
+ export declare const ANALYTICS_INTERNAL_ERROR = "Internal";
28
+ export declare const ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_PAYMENT_DATA = "web_700";
29
+ export declare const ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_TOKEN = "web_701";
30
+ export declare const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_THREEDSMETHODURL = "web_702";
31
+ /**
32
+ * Decoded token is missing one or more of the following properties:
33
+ * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)
34
+ * challenge: (acsTransID | messageVersion | threeDSServerTransID)
35
+ */
36
+ export declare const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_OTHER_PROPS = "web_703";
37
+ export declare const ANALYTICS_ERROR_CODE_TOKEN_DECODE_OR_PARSING_FAILED = "web_704";
38
+ export declare const ANALYTICS_ERROR_CODE_3DS2_TIMEOUT = "web_705";
39
+ export declare const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_ACSURL = "web_800";
40
+ export declare const ANALYTICS_ERROR_CODE_NO_TRANSSTATUS = "web_801";
41
+ export declare const errorCodeMapping: {
42
+ "error.va.sf-cc-num.02": string;
43
+ "error.va.sf-cc-num.04": string;
44
+ "error.va.sf-cc-num.01": string;
45
+ "error.va.sf-cc-num.03": string;
46
+ "error.va.sf-cc-dat.04": string;
47
+ "error.va.sf-cc-dat.05": string;
48
+ "error.va.sf-cc-dat.01": string;
49
+ "error.va.sf-cc-dat.02": string;
50
+ "error.va.sf-cc-dat.03": string;
51
+ "error.va.sf-cc-mth.01": string;
52
+ "error.va.sf-cc-yr.01": string;
53
+ "error.va.sf-cc-yr.02": string;
54
+ "error.va.sf-cc-cvc.01": string;
55
+ "error.va.sf-cc-cvc.02": string;
56
+ "creditCard.holderName.invalid": string;
57
+ "boleto.socialSecurityNumber.invalid": string;
58
+ "error.va.gen.01.country": string;
59
+ "error.va.gen.01.street": string;
60
+ "error.va.gen.01.house_number_or_name": string;
61
+ "error.va.gen.01.postal_code": string;
62
+ "invalidFormatExpects.postal_code": string;
63
+ "error.va.gen.01.city": string;
64
+ "error.va.gen.01.state_or_province": string;
65
+ "error.va.sf-kcp-pwd.01": string;
66
+ "error.va.sf-kcp-pwd.02": string;
67
+ "creditCard.taxNumber.invalid": string;
68
+ "error.va.sf-ach-num.01": string;
69
+ "error.va.sf-ach-num.02": string;
70
+ "error.va.sf-ach-loc.01": string;
71
+ "error.va.sf-ach-loc.02": string;
72
+ };