@adyen/adyen-web 5.1.0 → 5.2.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 (31) hide show
  1. package/dist/adyen.css +1 -0
  2. package/dist/adyen.css.map +1 -1
  3. package/dist/adyen.js +1 -1
  4. package/dist/adyen.js.map +1 -1
  5. package/dist/cjs/adyen.css +1 -0
  6. package/dist/cjs/adyen.css.map +1 -1
  7. package/dist/cjs/index.js +1 -1
  8. package/dist/es/adyen.css +1 -0
  9. package/dist/es/adyen.css.map +1 -1
  10. package/dist/es/index.js +1 -1
  11. package/dist/types/components/Card/Bancontact.d.ts +6 -2
  12. package/dist/types/components/Card/components/CardInput/components/CardFields.d.ts +1 -1
  13. package/dist/types/components/Card/components/CardInput/components/types.d.ts +6 -5
  14. package/dist/types/components/Card/components/CardInput/types.d.ts +4 -3
  15. package/dist/types/components/Card/types.d.ts +2 -1
  16. package/dist/types/components/Econtext/Econtext.d.ts +11 -1
  17. package/dist/types/components/Econtext/components/EcontextInput/EcontextInput.d.ts +14 -2
  18. package/dist/types/components/PayPal/types.d.ts +4 -0
  19. package/dist/types/components/internal/SecuredFields/SecuredFieldsProvider.d.ts +3 -3
  20. package/dist/types/components/internal/SecuredFields/defaultProps.d.ts +2 -1
  21. package/dist/types/components/internal/SecuredFields/lib/configuration/constants.d.ts +11 -6
  22. package/dist/types/components/internal/SecuredFields/lib/core/AbstractCSF.d.ts +2 -1
  23. package/dist/types/components/internal/SecuredFields/lib/core/AbstractSecuredField.d.ts +4 -3
  24. package/dist/types/components/internal/SecuredFields/lib/core/SecuredField.d.ts +2 -2
  25. package/dist/types/components/internal/SecuredFields/lib/core/utils/handleBrandFromBinLookup.d.ts +2 -1
  26. package/dist/types/components/internal/SecuredFields/lib/core/utils/processBrand.d.ts +6 -0
  27. package/dist/types/components/internal/SecuredFields/lib/types.d.ts +9 -4
  28. package/dist/types/components/internal/SecuredFields/lib/utilities/commonUtils.d.ts +4 -1
  29. package/dist/types/utils/Script.d.ts +3 -1
  30. package/dist/types/utils/hasOwnProperty.d.ts +1 -0
  31. package/package.json +1 -1
@@ -2,6 +2,10 @@ import { CardElement } from './Card';
2
2
  import { CardElementProps } from './types';
3
3
  declare class BancontactElement extends CardElement {
4
4
  constructor(props: CardElementProps);
5
+ protected static defaultProps: {
6
+ brands: string[];
7
+ onBinLookup: () => void;
8
+ };
5
9
  /**
6
10
  * Now that the Bancontact (BCMC) Card component can accept a number dual branded with Visa (which requires a CVC) it has to be handled differently
7
11
  * at creation time (no automatic removing of the CVC securedField).
@@ -9,9 +13,8 @@ declare class BancontactElement extends CardElement {
9
13
  * as well as show the BCMC logo in the number field and ignore any of the internal, regEx driven, brand detection.
10
14
  */
11
15
  formatProps(props: CardElementProps): {
12
- brands: string[];
13
16
  type: string;
14
- cvcPolicy: string;
17
+ cvcPolicy: import("../internal/SecuredFields/lib/core/AbstractSecuredField").CVCPolicyType;
15
18
  countryCode: any;
16
19
  configuration: {
17
20
  socialSecurityNumberMode: import("./types").SocialSecurityMode;
@@ -26,6 +29,7 @@ declare class BancontactElement extends CardElement {
26
29
  hasCVC: boolean;
27
30
  billingAddressRequired: any;
28
31
  brand?: string;
32
+ brands?: string[];
29
33
  enableStoreDetails?: boolean;
30
34
  hideCVC?: boolean;
31
35
  hasHolderName?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { h } from 'preact';
2
2
  import { CardFieldsProps } from './types';
3
- export default function CardFields({ brand, brandsConfiguration, dualBrandingElements, dualBrandingChangeHandler, dualBrandingSelected, errors, focusedElement, hasCVC, cvcPolicy, hideDateForBrand, onFocusField, showBrandIcon, valid }: CardFieldsProps): h.JSX.Element;
3
+ export default function CardFields({ brand, brandsConfiguration, dualBrandingElements, dualBrandingChangeHandler, dualBrandingSelected, errors, focusedElement, hasCVC, cvcPolicy, expiryDatePolicy, onFocusField, showBrandIcon, valid }: CardFieldsProps): h.JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { PaymentAmount } from '../../../../../types';
2
2
  import { CardBrandsConfiguration } from '../../../types';
3
3
  import { ComponentChildren } from 'preact';
4
+ import { CVCPolicyType, DatePolicyType } from '../../../../internal/SecuredFields/lib/core/AbstractSecuredField';
4
5
  export interface BrandIconProps {
5
6
  brand: string;
6
7
  brandsConfiguration: CardBrandsConfiguration;
@@ -14,8 +15,8 @@ export interface CardFieldsProps {
14
15
  errors?: any;
15
16
  focusedElement?: any;
16
17
  hasCVC?: any;
17
- cvcPolicy?: string;
18
- hideDateForBrand?: any;
18
+ cvcPolicy?: CVCPolicyType;
19
+ expiryDatePolicy?: DatePolicyType;
19
20
  onFocusField?: any;
20
21
  showBrandIcon?: boolean;
21
22
  valid?: any;
@@ -50,7 +51,7 @@ export interface CVCProps {
50
51
  filled?: any;
51
52
  focused?: any;
52
53
  frontCVC?: boolean;
53
- cvcPolicy?: string;
54
+ cvcPolicy?: CVCPolicyType;
54
55
  isValid?: any;
55
56
  label?: any;
56
57
  onFocusField: (field: string) => void;
@@ -74,7 +75,7 @@ export interface ExpirationDateProps {
74
75
  isValid?: boolean;
75
76
  label?: string;
76
77
  onFocusField: (fieldName: string) => {};
77
- hideDateForBrand?: boolean;
78
+ expiryDatePolicy?: DatePolicyType;
78
79
  }
79
80
  export interface InstallmentsProps {
80
81
  amount?: PaymentAmount;
@@ -122,7 +123,7 @@ export interface StoredCardFieldsProps {
122
123
  expiryYear?: string;
123
124
  focusedElement: string;
124
125
  hasCVC: boolean;
125
- cvcPolicy: string;
126
+ cvcPolicy: CVCPolicyType;
126
127
  lastFour?: string;
127
128
  onFocusField: any;
128
129
  valid: any;
@@ -3,6 +3,7 @@ import { CardBrandsConfiguration, CardConfiguration, DualBrandSelectElement, Soc
3
3
  import { PaymentAmount } from '../../../../types';
4
4
  import { InstallmentOptions } from './components/types';
5
5
  import { ValidationResult } from '../../../internal/PersonalDetails/types';
6
+ import { CVCPolicyType, DatePolicyType } from '../../../internal/SecuredFields/lib/core/AbstractSecuredField';
6
7
  export interface CardInputValidState {
7
8
  holderName?: boolean;
8
9
  billingAddress?: boolean;
@@ -42,7 +43,7 @@ export interface CardInputProps {
42
43
  brandsConfiguration?: CardBrandsConfiguration;
43
44
  configuration?: CardConfiguration;
44
45
  countryCode?: string;
45
- cvcPolicy?: string;
46
+ cvcPolicy?: CVCPolicyType;
46
47
  data?: CardInputDataState;
47
48
  enableStoreDetails?: boolean;
48
49
  fundingSource?: string;
@@ -79,8 +80,8 @@ export interface CardInputState {
79
80
  data?: object;
80
81
  errors?: object;
81
82
  focusedElement: string;
82
- cvcPolicy: string;
83
- hideDateForBrand: boolean;
83
+ cvcPolicy: CVCPolicyType;
84
+ expiryDatePolicy: DatePolicyType;
84
85
  isValid: boolean;
85
86
  status: string;
86
87
  valid?: object;
@@ -1,7 +1,7 @@
1
1
  import { UIElementProps } from '../types';
2
2
  import { AddressData, BrowserInfo } from '../../types';
3
3
  import { CbObjOnBinValue, CbObjOnBrand, CbObjOnConfigSuccess, CbObjOnError, CbObjOnFieldValid, CbObjOnFocus, CbObjOnLoad, CbObjOnBinLookup } from '../internal/SecuredFields/lib/types';
4
- import { CVCPolicyType } from '../internal/SecuredFields/lib/core/AbstractSecuredField';
4
+ import { CVCPolicyType, DatePolicyType } from '../internal/SecuredFields/lib/core/AbstractSecuredField';
5
5
  export interface CardElementProps extends UIElementProps {
6
6
  /**
7
7
  * Only set for a stored card,
@@ -109,6 +109,7 @@ export interface BrandObject {
109
109
  cvcPolicy: CVCPolicyType;
110
110
  enableLuhnCheck: boolean;
111
111
  showExpiryDate: boolean;
112
+ expiryDatePolicy?: DatePolicyType;
112
113
  showSocialSecurityNumber?: boolean;
113
114
  supported: boolean;
114
115
  brandImageUrl?: string;
@@ -1,7 +1,17 @@
1
1
  import { h } from 'preact';
2
2
  import UIElement from '../UIElement';
3
- export declare class EcontextElement extends UIElement {
3
+ import { UIElementProps } from '../types';
4
+ import { PersonalDetailsSchema } from '../../types';
5
+ interface EcontextElementProps extends UIElementProps {
6
+ reference?: string;
7
+ personalDetailsRequired?: boolean;
8
+ data?: PersonalDetailsSchema;
9
+ }
10
+ export declare class EcontextElement extends UIElement<EcontextElementProps> {
4
11
  static type: string;
12
+ protected static defaultProps: {
13
+ personalDetailsRequired: boolean;
14
+ };
5
15
  get isValid(): boolean;
6
16
  /**
7
17
  * Formats the component data output
@@ -1,2 +1,14 @@
1
- import { h } from 'preact';
2
- export default function EcontextInput(props: any): h.JSX.Element;
1
+ import { h, VNode } from 'preact';
2
+ import { PersonalDetailsSchema } from '../../../../types';
3
+ import './EcontextInput.scss';
4
+ interface EcontextInputProps {
5
+ personalDetailsRequired?: boolean;
6
+ data?: PersonalDetailsSchema;
7
+ showPayButton?: boolean;
8
+ payButton(config: any): VNode;
9
+ onChange?(data: any): void;
10
+ onSubmit?(state: any, component: any): void;
11
+ [key: string]: any;
12
+ }
13
+ export default function EcontextInput({ personalDetailsRequired, data, onChange, showPayButton, payButton }: EcontextInputProps): h.JSX.Element;
14
+ export {};
@@ -57,6 +57,10 @@ interface PayPalCommonProps {
57
57
  debug?: boolean;
58
58
  environment?: string;
59
59
  blockPayPalCreditButton?: boolean;
60
+ /**
61
+ * @see {@link https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-configuration/#csp-nonce}
62
+ */
63
+ cspNonce?: string;
60
64
  /**
61
65
  * @see {@link https://developer.paypal.com/docs/checkout/reference/customize-sdk/#intent}
62
66
  */
@@ -3,7 +3,7 @@ import { SFPProps } from './defaultProps';
3
3
  import { StylesObject, CbObjOnError } from './lib/types';
4
4
  import { AddressData } from '../../../types';
5
5
  import { BinLookupResponse } from '../../Card/types';
6
- import { CVCPolicyType } from './lib/core/AbstractSecuredField';
6
+ import { CVCPolicyType, DatePolicyType } from './lib/core/AbstractSecuredField';
7
7
  export interface SFPState {
8
8
  status?: string;
9
9
  brand?: string;
@@ -17,7 +17,7 @@ export interface SFPState {
17
17
  hasUnsupportedCard?: boolean;
18
18
  hasKoreanFields?: boolean;
19
19
  showSocialSecurityNumber?: boolean;
20
- hideDateForBrand?: boolean;
20
+ expiryDatePolicy?: DatePolicyType;
21
21
  socialSecurityNumber?: string;
22
22
  }
23
23
  export interface SingleBrandResetObject {
@@ -31,7 +31,7 @@ export interface SingleBrandResetObject {
31
31
  declare class SecuredFieldsProvider extends Component<SFPProps, SFPState> {
32
32
  private originKeyErrorTimeout;
33
33
  private originKeyTimeoutMS;
34
- private numCharsInCVC;
34
+ private numCharsInField;
35
35
  private rootNode;
36
36
  private numDateFields;
37
37
  private csf;
@@ -1,4 +1,5 @@
1
1
  import { Language } from '../../../language/Language';
2
+ import { CVCPolicyType } from './lib/core/AbstractSecuredField';
2
3
  export interface SFPProps {
3
4
  /**
4
5
  * CSF RELATED (±22)
@@ -44,7 +45,7 @@ export interface SFPProps {
44
45
  billingAddressRequiredFields: string[];
45
46
  brand: string;
46
47
  createFromAction: () => {};
47
- cvcPolicy: string;
48
+ cvcPolicy: CVCPolicyType;
48
49
  data: object;
49
50
  details: object[];
50
51
  enableStoreDetails: boolean;
@@ -1,3 +1,4 @@
1
+ import { CVCPolicyType, DatePolicyType } from '../core/AbstractSecuredField';
1
2
  export declare const ENCRYPTED_CARD_NUMBER = "encryptedCardNumber";
2
3
  export declare const ENCRYPTED_EXPIRY_DATE = "encryptedExpiryDate";
3
4
  export declare const ENCRYPTED_EXPIRY_MONTH = "encryptedExpiryMonth";
@@ -10,15 +11,19 @@ export declare const ENCRYPTED_PIN_FIELD = "encryptedPin";
10
11
  export declare const GIFT_CARD = "giftcard";
11
12
  export declare const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = "encryptedBankAccountNumber";
12
13
  export declare const ENCRYPTED_BANK_LOCATION_FIELD = "encryptedBankLocationId";
13
- export declare const SF_VERSION = "3.5.4";
14
+ export declare const SF_VERSION = "3.7.1";
14
15
  export declare const DEFAULT_CARD_GROUP_TYPES: string[];
15
16
  export declare const NON_CREDIT_CARD_TYPE_SECURED_FIELDS: string[];
16
17
  export declare const CSF_FIELDS_ARRAY: string[];
17
- export declare const CVC_POLICY_REQUIRED = "required";
18
- export declare const CVC_POLICY_OPTIONAL = "optional";
19
- export declare const CVC_POLICY_HIDDEN = "hidden";
20
- export declare const DATE_POLICY_REQUIRED = "required";
21
- export declare const DATE_POLICY_HIDDEN = "hidden";
18
+ export declare const REQUIRED = "required";
19
+ export declare const OPTIONAL = "optional";
20
+ export declare const HIDDEN = "hidden";
21
+ export declare const CVC_POLICY_REQUIRED: CVCPolicyType;
22
+ export declare const CVC_POLICY_OPTIONAL: CVCPolicyType;
23
+ export declare const CVC_POLICY_HIDDEN: CVCPolicyType;
24
+ export declare const DATE_POLICY_REQUIRED: DatePolicyType;
25
+ export declare const DATE_POLICY_OPTIONAL: DatePolicyType;
26
+ export declare const DATE_POLICY_HIDDEN: DatePolicyType;
22
27
  export declare const DATA_ENCRYPTED_FIELD_ATTR = "data-cse";
23
28
  export declare const DATA_INFO = "data-info";
24
29
  export declare const DATA_UID = "data-uid";
@@ -1,4 +1,4 @@
1
- import { CSFSetupObject, CSFConfigObject, CSFCallbacksConfig, CSFStateObject, SFFeedbackObj, SendBrandObject } from '../types';
1
+ import { CSFSetupObject, CSFConfigObject, CSFCallbacksConfig, CSFStateObject, SFFeedbackObj, SendBrandObject, SendExpiryDateObject } from '../types';
2
2
  import { createSecuredFields } from './createSecuredFields';
3
3
  import { handleProcessBrand } from './utils/processBrand';
4
4
  import { handleBrandFromBinLookup } from './utils/handleBrandFromBinLookup';
@@ -29,6 +29,7 @@ declare abstract class AbstractCSF {
29
29
  protected processAutoComplete: (pFeedbackObj: SFFeedbackObj) => void;
30
30
  protected processBrand: typeof handleProcessBrand;
31
31
  protected sendBrandToCardSF: (brandObj: SendBrandObject) => void;
32
+ protected sendExpiryDatePolicyToSF: (dateObj: SendExpiryDateObject) => void;
32
33
  protected setFocusOnFrame: (pFieldType: string, doLog?: boolean) => void;
33
34
  protected setupSecuredField: (pItem: HTMLElement) => void;
34
35
  protected touchendListener: (e: Event) => void;
@@ -4,7 +4,7 @@ export declare type RtnType_noParamVoidFn = () => void;
4
4
  export declare type RtnType_postMessageListener = (event: Event) => void;
5
5
  export declare type RtnType_callbackFn = (feedbackObj: SFFeedbackObj) => void;
6
6
  export declare type CVCPolicyType = 'required' | 'optional' | 'hidden';
7
- export declare type DatePolicyType = 'required' | 'hidden';
7
+ export declare type DatePolicyType = 'required' | 'optional' | 'hidden';
8
8
  /**
9
9
  * Base interface, props common to both SFSetupObject & IframeConfigObject
10
10
  */
@@ -19,6 +19,7 @@ export interface SFInternalConfig {
19
19
  isCreditCardType: boolean;
20
20
  showWarnings: boolean;
21
21
  cvcPolicy: CVCPolicyType;
22
+ expiryDatePolicy: DatePolicyType;
22
23
  legacyInputMode: boolean;
23
24
  minimumExpiryDate: string;
24
25
  uid: string;
@@ -28,7 +29,7 @@ export interface SFInternalConfig {
28
29
  * The object passed from createSecuredFields to a new instance of SecuredField.ts
29
30
  */
30
31
  export interface SFSetupObject extends SFInternalConfig {
31
- datePolicy: DatePolicyType;
32
+ expiryDatePolicy: DatePolicyType;
32
33
  iframeSrc: string;
33
34
  loadingContext: string;
34
35
  holderEl: HTMLElement;
@@ -76,7 +77,7 @@ declare abstract class AbstractSecuredField {
76
77
  protected _hasError: boolean;
77
78
  protected _isValid: boolean;
78
79
  protected _cvcPolicy: CVCPolicyType;
79
- protected _datePolicy: DatePolicyType;
80
+ protected _expiryDatePolicy: DatePolicyType;
80
81
  protected _iframeContentWindow: Window;
81
82
  protected _isEncrypted: boolean;
82
83
  protected _numKey: number;
@@ -23,8 +23,8 @@ declare class SecuredField extends AbstractSecuredField {
23
23
  set isValid(value: boolean);
24
24
  get cvcPolicy(): CVCPolicyType;
25
25
  set cvcPolicy(value: CVCPolicyType);
26
- get datePolicy(): DatePolicyType;
27
- set datePolicy(value: DatePolicyType);
26
+ get expiryDatePolicy(): DatePolicyType;
27
+ set expiryDatePolicy(value: DatePolicyType);
28
28
  get iframeContentWindow(): Window;
29
29
  set iframeContentWindow(value: Window);
30
30
  get isEncrypted(): boolean;
@@ -1,4 +1,5 @@
1
- import { SendBrandObject } from '../../types';
1
+ import { SendBrandObject, SendExpiryDateObject } from '../../types';
2
2
  import { BinLookupResponse } from '../../../../../Card/types';
3
3
  export declare function sendBrandToCardSF(brandObj: SendBrandObject): void;
4
+ export declare function sendExpiryDatePolicyToSF(expiryDateObj: SendExpiryDateObject): void;
4
5
  export declare function handleBrandFromBinLookup(binLookupResponse: BinLookupResponse): void;
@@ -1,2 +1,8 @@
1
1
  import { SFFeedbackObj } from '../../types';
2
+ /**
3
+ * - If generic card type AND passed brand doesn't equal stored brand - send the new brand to the cvc input
4
+ * (so it can reassess what length it should be and if any value it contains is now valid)
5
+ *
6
+ * - Create object for onBrand callback aka SFPHandlers.handleOnBrand
7
+ */
2
8
  export declare function handleProcessBrand(pFeedbackObj: SFFeedbackObj): boolean;
@@ -4,11 +4,13 @@ import { BrandObject } from '../../../Card/types';
4
4
  declare global {
5
5
  interface Window {
6
6
  _b$dl: boolean;
7
+ mockBinCount: number;
7
8
  }
8
9
  }
9
10
  export interface BrandStorageObject {
10
11
  brand: string;
11
- cvcPolicy: string;
12
+ cvcPolicy: CVCPolicyType;
13
+ expiryDatePolicy: DatePolicyType;
12
14
  showSocialSecurityNumber?: boolean;
13
15
  }
14
16
  /**
@@ -136,14 +138,14 @@ export interface CardObject {
136
138
  pattern: RegExp;
137
139
  securityCode?: string;
138
140
  displayName?: string;
139
- cvcPolicy?: string;
141
+ cvcPolicy?: CVCPolicyType;
140
142
  }
141
143
  export interface CbObjOnBrand {
142
144
  type: string;
143
145
  rootNode: HTMLElement;
144
146
  brand: string;
145
147
  cvcPolicy: CVCPolicyType;
146
- datePolicy?: DatePolicyType;
148
+ expiryDatePolicy?: DatePolicyType;
147
149
  cvcText: string;
148
150
  showSocialSecurityNumber?: boolean;
149
151
  brandImageUrl?: string;
@@ -224,7 +226,7 @@ export interface SFFeedbackObj {
224
226
  code?: string;
225
227
  cvcText?: string;
226
228
  cvcPolicy?: CVCPolicyType;
227
- datePolicy?: DatePolicyType;
229
+ expiryDatePolicy?: DatePolicyType;
228
230
  showSocialSecurityNumber?: boolean;
229
231
  maxLength?: number;
230
232
  error?: string;
@@ -254,4 +256,7 @@ export interface SendBrandObject {
254
256
  brand: string;
255
257
  enableLuhnCheck: boolean;
256
258
  }
259
+ export interface SendExpiryDateObject {
260
+ expiryDatePolicy: DatePolicyType;
261
+ }
257
262
  export {};
@@ -4,7 +4,10 @@
4
4
  * @returns Number
5
5
  */
6
6
  declare function generateRandomNumber(): number;
7
- declare function objectsDeepEqual(obj1?: {}, obj2?: {}): boolean;
7
+ /**
8
+ * Recursively compare 2 objects
9
+ */
10
+ declare function objectsDeepEqual(x: any, y: any): any;
8
11
  /**
9
12
  * Returns true if x is:
10
13
  * null, undefined, false, 0, NaN, empty object or array, empty string
@@ -15,7 +15,9 @@ declare class Script {
15
15
  private readonly script;
16
16
  private readonly src;
17
17
  private readonly node;
18
- constructor(src: any, node?: string);
18
+ private readonly attributes;
19
+ private readonly dataAttributes;
20
+ constructor(src: any, node?: string, attributes?: Partial<HTMLScriptElement>, dataAttributes?: Record<string, string | undefined>);
19
21
  load: () => Promise<any>;
20
22
  remove: () => void;
21
23
  }
@@ -0,0 +1 @@
1
+ export declare function hasOwnProperty(obj: any, prop: any): any;
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "./dist/adyen.css": "./dist/adyen.css",
23
23
  "./package.json": "./package.json"
24
24
  },
25
- "version": "5.1.0",
25
+ "version": "5.2.0",
26
26
  "license": "MIT",
27
27
  "homepage": "https://docs.adyen.com/checkout",
28
28
  "repository": "github:Adyen/adyen-web",