@adyen/adyen-web 5.13.1 → 5.16.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 (74) hide show
  1. package/README.md +4 -1
  2. package/dist/adyen.css +8 -7
  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 +8 -7
  7. package/dist/cjs/adyen.css.map +1 -1
  8. package/dist/cjs/index.js +1 -1
  9. package/dist/es/adyen.css +8 -7
  10. package/dist/es/adyen.css.map +1 -1
  11. package/dist/es/index.js +1 -1
  12. package/dist/es.modern/adyen.css +8 -7
  13. package/dist/es.modern/adyen.css.map +1 -1
  14. package/dist/es.modern/index.js +1 -1
  15. package/dist/types/components/Atome/config.d.ts +2 -2
  16. package/dist/types/components/BankTransfer/types.d.ts +3 -0
  17. package/dist/types/components/BcmcMobile/BcmcMobile.d.ts +1 -4
  18. package/dist/types/components/Card/Bancontact.d.ts +1 -4
  19. package/dist/types/components/Card/Card.d.ts +1 -4
  20. package/dist/types/components/Card/components/CardInput/components/CardFieldsWrapper.d.ts +3 -1
  21. package/dist/types/components/Card/components/CardInput/components/CardHolderName.d.ts +1 -1
  22. package/dist/types/components/Card/components/CardInput/components/types.d.ts +6 -0
  23. package/dist/types/components/Card/components/CardInput/defaultProps.d.ts +2 -0
  24. package/dist/types/components/Card/components/CardInput/types.d.ts +7 -1
  25. package/dist/types/components/Card/components/CardInput/utils.d.ts +9 -1
  26. package/dist/types/components/Dragonpay/Dragonpay.d.ts +1 -4
  27. package/dist/types/components/Dropin/Dropin.d.ts +1 -4
  28. package/dist/types/components/Dropin/components/DropinComponent.d.ts +5 -0
  29. package/dist/types/components/Dropin/types.d.ts +4 -1
  30. package/dist/types/components/MBWay/components/MBWayInput/MBWayInput.d.ts +2 -0
  31. package/dist/types/components/MBWay/components/MBWayInput/types.d.ts +5 -0
  32. package/dist/types/components/OnlineBankingIN/index.d.ts +11 -0
  33. package/dist/types/components/Pix/Pix.d.ts +1 -4
  34. package/dist/types/components/Swish/Swish.d.ts +1 -4
  35. package/dist/types/components/WalletIN/index.d.ts +17 -0
  36. package/dist/types/components/WeChat/WeChat.d.ts +1 -4
  37. package/dist/types/components/index.d.ts +2 -0
  38. package/dist/types/components/internal/Address/Specifications.d.ts +9 -0
  39. package/dist/types/components/internal/Address/constants.d.ts +9 -0
  40. package/dist/types/components/internal/Address/types.d.ts +4 -1
  41. package/dist/types/components/internal/IFrame/Iframe.d.ts +1 -3
  42. package/dist/types/components/internal/PhoneInput/types.d.ts +4 -0
  43. package/dist/types/components/internal/PhoneInputNew/PhoneInput.d.ts +10 -0
  44. package/dist/types/components/internal/PhoneInputNew/index.d.ts +1 -0
  45. package/dist/types/components/internal/PhoneInputNew/types.d.ts +25 -0
  46. package/dist/types/components/internal/PhoneInputNew/usePhonePrefixes.d.ts +7 -0
  47. package/dist/types/components/internal/PhoneInputNew/validate.d.ts +3 -0
  48. package/dist/types/components/internal/SecuredFields/SFP/SecuredFieldsProvider.d.ts +2 -0
  49. package/dist/types/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.d.ts +2 -0
  50. package/dist/types/components/internal/SecuredFields/SFP/defaultProps.d.ts +1 -0
  51. package/dist/types/components/internal/SecuredFields/lib/CSF/AbstractCSF.d.ts +3 -1
  52. package/dist/types/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.d.ts +39 -0
  53. package/dist/types/components/internal/SecuredFields/lib/CSF/types.d.ts +1 -0
  54. package/dist/types/components/internal/SecuredFields/lib/configuration/constants.d.ts +1 -1
  55. package/dist/types/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.d.ts +1 -1
  56. package/dist/types/components/internal/SecuredFields/lib/securedField/SecuredField.d.ts +1 -1
  57. package/dist/types/components/internal/SecuredFields/lib/utilities/commonUtils.d.ts +5 -6
  58. package/dist/types/components/internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.d.ts +2 -1
  59. package/dist/types/components/types.d.ts +2 -4
  60. package/dist/types/core/Analytics/Analytics.d.ts +1 -1
  61. package/dist/types/core/Analytics/types.d.ts +0 -4
  62. package/dist/types/core/CheckoutSession/CheckoutSession.d.ts +5 -0
  63. package/dist/types/core/Services/data-set.d.ts +6 -0
  64. package/dist/types/core/Services/get-dataset.d.ts +1 -1
  65. package/dist/types/core/Services/sessions/cancel-order.d.ts +6 -0
  66. package/dist/types/utils/Validator/ValidationRuleResult.d.ts +17 -0
  67. package/dist/types/utils/Validator/Validator.d.ts +5 -18
  68. package/dist/types/utils/Validator/types.d.ts +4 -0
  69. package/dist/types/utils/useForm/reducer.d.ts +4 -2
  70. package/dist/types/utils/useForm/types.d.ts +18 -8
  71. package/dist/types/utils/useForm/useForm.d.ts +2 -18
  72. package/dist/types/utils/validator-utils.d.ts +9 -0
  73. package/package.json +3 -3
  74. package/dist/types/components/internal/SecuredFields/lib/CSF/extensions/additionalFields.d.ts +0 -9
@@ -3,11 +3,11 @@
3
3
  *
4
4
  * @returns Number
5
5
  */
6
- declare function generateRandomNumber(): number;
6
+ export declare function generateRandomNumber(): number;
7
7
  /**
8
8
  * Recursively compare 2 objects
9
9
  */
10
- declare function objectsDeepEqual(x: any, y: any): any;
10
+ export declare function objectsDeepEqual(x: any, y: any): any;
11
11
  /**
12
12
  * Returns true if x is:
13
13
  * null, undefined, false, 0, NaN, empty object or array, empty string
@@ -30,15 +30,14 @@ declare function objectsDeepEqual(x: any, y: any): any;
30
30
  * falsy(true) // => false
31
31
  * ```
32
32
  */
33
- declare function falsy(x: any): boolean;
33
+ export declare function falsy(x: any): boolean;
34
34
  /**
35
35
  * Inverse of falsy - returns true if x is NOT null, undefined, false, 0, NaN, empty object or array, empty string
36
36
  * @param x -
37
37
  */
38
- declare function notFalsy(x: any): boolean;
38
+ export declare function notFalsy(x: any): boolean;
39
39
  /**
40
40
  * This function allows us to partially apply any number of variables to functions that take any number of parameters.
41
41
  * @returns \{function(): *\}
42
42
  */
43
- declare function partial(...args: any[]): (...args2: any[]) => any;
44
- export { generateRandomNumber, existy, falsy, isArray, objectsDeepEqual, notFalsy, partial, truthy };
43
+ export declare function partial(...args: any[]): (...args2: any[]) => any;
@@ -1,9 +1,10 @@
1
1
  import { h } from 'preact';
2
- export default function ({ onBlur, onInput, valid, error, data, required }: {
2
+ export default function ({ onBlur, onInput, valid, error, data, required, disabled }: {
3
3
  onBlur: any;
4
4
  onInput: any;
5
5
  valid?: boolean;
6
6
  error?: any;
7
7
  data?: string;
8
8
  required?: boolean;
9
+ disabled?: boolean;
9
10
  }): h.JSX.Element;
@@ -3,6 +3,7 @@ import UIElement from './UIElement';
3
3
  import Core from '../core';
4
4
  import Analytics from '../core/Analytics';
5
5
  import RiskElement from '../core/RiskModule';
6
+ import Session from "../core/CheckoutSession";
6
7
  export interface PaymentResponse {
7
8
  action?: PaymentAction;
8
9
  resultCode: string;
@@ -38,10 +39,7 @@ export interface IUIElement {
38
39
  }
39
40
  export declare type UIElementStatus = 'ready' | 'loading' | 'error' | 'success';
40
41
  export interface UIElementProps extends BaseElementProps {
41
- session?: {
42
- id: string;
43
- data: string;
44
- };
42
+ session?: Session;
45
43
  onChange?: (state: any, element: UIElement) => void;
46
44
  onValid?: (state: any, element: UIElement) => void;
47
45
  beforeSubmit?: (state: any, element: UIElement, actions: any) => Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { CoreOptions } from '../types';
2
2
  declare class Analytics {
3
3
  private static defaultProps;
4
- checkoutAttemptId: any;
4
+ checkoutAttemptId: string;
5
5
  props: any;
6
6
  private readonly logEvent;
7
7
  private readonly logTelemetry;
@@ -12,10 +12,6 @@ export interface AnalyticsOptions {
12
12
  * Enable/Disable telemetry data
13
13
  */
14
14
  telemetry?: boolean;
15
- /**
16
- * Enable/Disable conversion events
17
- */
18
- conversion?: boolean;
19
15
  /**
20
16
  * Reuse a previous checkoutAttemptId from a previous page
21
17
  */
@@ -1,4 +1,5 @@
1
1
  import { CheckoutSession, CheckoutSessionBalanceResponse, CheckoutSessionDetailsResponse, CheckoutSessionOrdersResponse, CheckoutSessionPaymentResponse, CheckoutSessionSetupResponse } from '../../types';
2
+ import { onOrderCancelData } from "../../components/Dropin/types";
2
3
  declare class Session {
3
4
  private readonly session;
4
5
  private readonly storage;
@@ -31,6 +32,10 @@ declare class Session {
31
32
  * Creates an order for the current session
32
33
  */
33
34
  createOrder(): Promise<CheckoutSessionOrdersResponse>;
35
+ /**
36
+ * Cancels an order for the current session
37
+ */
38
+ cancelOrder(data: onOrderCancelData): Promise<CheckoutSessionOrdersResponse>;
34
39
  /**
35
40
  * Gets the stored session but only if the current id and the stored id match
36
41
  */
@@ -0,0 +1,6 @@
1
+ export declare type DataSet = DataSetItem[];
2
+ export interface DataSetItem {
3
+ id: string;
4
+ name: string;
5
+ selectedOptionName?: string;
6
+ }
@@ -1 +1 @@
1
- export default function getDataset(name: string, loadingContext: any, locale: any): Promise<any>;
1
+ export default function getDataset(name: string, loadingContext: any, locale?: any): Promise<any>;
@@ -0,0 +1,6 @@
1
+ import Session from '../../CheckoutSession';
2
+ import { CheckoutSessionOrdersResponse, Order } from '../../../types';
3
+ /**
4
+ */
5
+ declare function cancelOrder(order: Order, session: Session): Promise<CheckoutSessionOrdersResponse>;
6
+ export default cancelOrder;
@@ -0,0 +1,17 @@
1
+ import { ErrorMessageObject } from './types';
2
+ /**
3
+ * Holds the result of a validation
4
+ */
5
+ export declare class ValidationRuleResult {
6
+ private readonly shouldValidate;
7
+ isValid: boolean;
8
+ errorMessage: string | ErrorMessageObject;
9
+ constructor(rule: any, value: any, mode: any, context: any);
10
+ /**
11
+ * Whether the validation is considered an error.
12
+ * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.
13
+ * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error
14
+ * unless the whole form is being validated
15
+ */
16
+ hasError(isValidatingForm?: boolean): boolean;
17
+ }
@@ -1,33 +1,20 @@
1
- import { ErrorMessageObject, FieldContext, FieldData, ValidatorRules } from './types';
2
- /**
3
- * Holds the result of a validation
4
- */
5
- export declare class ValidationRuleResult {
6
- private readonly shouldValidate;
7
- isValid: boolean;
8
- errorMessage: string | ErrorMessageObject;
9
- constructor(rule: any, value: any, mode: any, context: any);
10
- /**
11
- * Whether the validation is considered an error.
12
- * A field is only considered to be an error if the validation rule applies to the current mode.
13
- */
14
- hasError(): boolean;
15
- }
1
+ import { ValidatorRules, FieldContext, FieldData } from './types';
2
+ import { ValidationRuleResult } from './ValidationRuleResult';
16
3
  declare class ValidationResult {
17
4
  private validationResults;
18
5
  constructor(results: ValidationRuleResult[]);
19
6
  /** Checks if all validation rules have passed */
20
7
  get isValid(): boolean;
21
8
  /** Checks if any validation rule returned an error */
22
- hasError(): boolean;
9
+ hasError(isValidatingForm?: boolean): boolean;
23
10
  /** Returns the first validation result that returned an error */
24
- getError(): ValidationRuleResult;
11
+ getError(isValidatingForm?: boolean): ValidationRuleResult;
25
12
  /** Returns all validation results that returned an error */
26
13
  getAllErrors(): ValidationRuleResult[];
27
14
  }
28
15
  declare class Validator {
29
16
  rules: ValidatorRules;
30
- constructor(rules?: {});
17
+ constructor(rules: any);
31
18
  setRules(newRules: any): void;
32
19
  /**
33
20
  * Get all validation rules for a field
@@ -1,3 +1,4 @@
1
+ import { ValidationRuleResult } from './ValidationRuleResult';
1
2
  declare type ValidatorMode = 'blur' | 'input';
2
3
  export declare type ErrorMessageObject = {
3
4
  translationKey: string;
@@ -42,4 +43,7 @@ export interface FieldContext {
42
43
  [key: string]: any;
43
44
  };
44
45
  }
46
+ export declare type ValidationRuleResults = {
47
+ [key: string]: ValidationRuleResult;
48
+ };
45
49
  export {};
@@ -1,14 +1,16 @@
1
1
  /**
2
2
  * Processes default data and sets as default in state
3
3
  */
4
- export declare function init({ schema, defaultData, processField }: {
4
+ export declare function init({ schema, defaultData, processField, fieldProblems }: {
5
5
  schema: any;
6
6
  defaultData: any;
7
7
  processField: any;
8
+ fieldProblems: any;
8
9
  }): {
9
10
  schema: any;
10
11
  data: any;
11
12
  valid: any;
12
13
  errors: any;
14
+ fieldProblems: any;
13
15
  };
14
- export declare function getReducer(processField: any): (state: any, { type, key, value, mode, defaultData, schema }: any) => any;
16
+ export declare function getReducer(processField: any): (state: any, { type, key, value, mode, schema, defaultData, formValue, selectedSchema, fieldProblems }: any) => any;
@@ -1,19 +1,29 @@
1
- import { ValidationResult } from '../../components/internal/PersonalDetails/types';
2
1
  import { ValidatorRules } from '../Validator/types';
3
- export declare type FormState<DataState> = {
4
- schema: string[];
5
- data: DataState;
2
+ export declare type FormState<FormSchema> = {
3
+ schema?: string[];
4
+ data: FormSchema;
6
5
  errors: {
7
- [key: string]: ValidationResult;
6
+ [key: string]: any;
8
7
  };
9
8
  valid: {
10
9
  [key: string]: boolean;
11
10
  };
11
+ fieldProblems?: {
12
+ [key: string]: any;
13
+ };
14
+ isValid?: boolean;
12
15
  };
13
16
  export declare type FormProps = {
14
17
  rules?: ValidatorRules;
15
18
  [key: string]: any;
16
19
  };
17
- export declare type DefaultDataState = {
18
- [key: string]: any;
19
- };
20
+ export interface Form<FormSchema> extends FormState<FormSchema> {
21
+ handleChangeFor: (key: string, mode?: string) => (e: any) => void;
22
+ triggerValidation: (schema?: any) => void;
23
+ setSchema: (schema: any) => void;
24
+ setData: (key: string, value: any) => void;
25
+ setValid: (key: string, value: any) => void;
26
+ setErrors: (key: string, value: any) => void;
27
+ mergeForm: (formValue: any) => void;
28
+ setFieldProblems: (fieldProblems: any) => void;
29
+ }
@@ -1,19 +1,3 @@
1
- import { FormProps, DefaultDataState } from './types';
2
- declare function useForm<DataState = DefaultDataState>(props: FormProps): {
3
- handleChangeFor: (key: any, mode?: string) => (e: any) => void;
4
- triggerValidation: () => void;
5
- setSchema: (schema: any) => void;
6
- setData: (key: any, value: any) => void;
7
- setValid: (key: any, value: any) => void;
8
- setErrors: (key: any, value: any) => void;
9
- isValid: boolean;
10
- schema: string[];
11
- valid: {
12
- [key: string]: boolean;
13
- };
14
- errors: {
15
- [key: string]: import("../../components/internal/PersonalDetails/types").ValidationResult;
16
- };
17
- data: DataState;
18
- };
1
+ import { Form, FormProps } from './types';
2
+ declare function useForm<FormSchema>(props: FormProps): Form<FormSchema>;
19
3
  export default useForm;
@@ -1,5 +1,14 @@
1
1
  import { CountryFormatRules } from './Validator/types';
2
2
  export declare const getMaxLengthByFieldAndCountry: (formattingRules: CountryFormatRules, field: string, country: string, ignoreIfFormatterExists: boolean) => number | null;
3
+ export declare const isEmpty: (input: any) => boolean;
4
+ export declare const isString: (input: any) => boolean;
5
+ export declare const hasText: (input: any) => boolean;
3
6
  export declare const SPECIAL_CHARS = "?\\-\\+_=!@#$%^&*(){}~<>\\[\\]\\/\\\\";
4
7
  export declare const getFormattingRegEx: (specChars: string, flags?: string) => RegExp;
8
+ export declare const getValidatingRegEx: (specChars: string, exclude: boolean) => RegExp;
9
+ export declare const CHARACTER_PATTERNS: {
10
+ [key: string]: RegExp;
11
+ };
12
+ export declare const exactLength: (input: string, length: number) => boolean;
13
+ export declare const validateForSpecialChars: (name: any) => boolean;
5
14
  export declare const trimValWithOneSpace: (val: string) => string;
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "./dist/adyen.css": "./dist/adyen.css",
24
24
  "./package.json": "./package.json"
25
25
  },
26
- "version": "5.13.1",
26
+ "version": "5.16.0",
27
27
  "license": "MIT",
28
28
  "homepage": "https://docs.adyen.com/checkout",
29
29
  "repository": "github:Adyen/adyen-web",
@@ -51,12 +51,12 @@
51
51
  "@babel/cli": "^7.17.6",
52
52
  "@babel/core": "^7.16.0",
53
53
  "@babel/plugin-transform-runtime": "^7.17.0",
54
- "@babel/preset-env": "^7.16.0",
54
+ "@babel/preset-env": "^7.16.11",
55
55
  "@babel/preset-react": "^7.14.5",
56
56
  "@babel/preset-typescript": "^7.15.0",
57
57
  "@babel/runtime-corejs3": "^7.16.3",
58
58
  "@rollup/plugin-babel": "^5.3.0",
59
- "@rollup/plugin-commonjs": "^21.0.1",
59
+ "@rollup/plugin-commonjs": "^21.0.3",
60
60
  "@rollup/plugin-eslint": "^8.0.1",
61
61
  "@rollup/plugin-json": "^4.1.0",
62
62
  "@rollup/plugin-node-resolve": "^13.1.3",
@@ -1,9 +0,0 @@
1
- declare function touchendListener(e: Event): void;
2
- declare function handleAdditionalFields(): void;
3
- declare function destroyTouchendListener(): void;
4
- declare const _default: {
5
- touchendListener: typeof touchendListener;
6
- handleAdditionalFields: typeof handleAdditionalFields;
7
- destroyTouchendListener: typeof destroyTouchendListener;
8
- };
9
- export default _default;