@adyen/adyen-web 5.35.0 → 5.37.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.
- package/dist/adyen.css +11 -10
- package/dist/adyen.css.map +1 -1
- package/dist/adyen.js +1 -1
- package/dist/adyen.js.map +1 -1
- package/dist/cjs/adyen.css +11 -10
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/es/adyen.css +11 -10
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/ar.js +1 -1
- package/dist/es/cs-CZ.js +1 -1
- package/dist/es/da-DK.js +1 -1
- package/dist/es/de-DE.js +1 -1
- package/dist/es/el-GR.js +1 -1
- package/dist/es/es-ES.js +1 -1
- package/dist/es/fi-FI.js +1 -1
- package/dist/es/fr-FR.js +1 -1
- package/dist/es/hr-HR.js +1 -1
- package/dist/es/hu-HU.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/it-IT.js +1 -1
- package/dist/es/ja-JP.js +1 -1
- package/dist/es/ko-KR.js +1 -1
- package/dist/es/nl-NL.js +1 -1
- package/dist/es/no-NO.js +1 -1
- package/dist/es/pl-PL.js +1 -1
- package/dist/es/pt-BR.js +1 -1
- package/dist/es/pt-PT.js +1 -1
- package/dist/es/ro-RO.js +1 -1
- package/dist/es/ru-RU.js +1 -1
- package/dist/es/sk-SK.js +1 -1
- package/dist/es/sl-SI.js +1 -1
- package/dist/es/sv-SE.js +1 -1
- package/dist/es/zh-CN.js +1 -1
- package/dist/es/zh-TW.js +1 -1
- package/dist/es.modern/adyen.css +11 -10
- package/dist/es.modern/adyen.css.map +1 -1
- package/dist/es.modern/ar.js +1 -1
- package/dist/es.modern/cs-CZ.js +1 -1
- package/dist/es.modern/da-DK.js +1 -1
- package/dist/es.modern/de-DE.js +1 -1
- package/dist/es.modern/el-GR.js +1 -1
- package/dist/es.modern/es-ES.js +1 -1
- package/dist/es.modern/fi-FI.js +1 -1
- package/dist/es.modern/fr-FR.js +1 -1
- package/dist/es.modern/hr-HR.js +1 -1
- package/dist/es.modern/hu-HU.js +1 -1
- package/dist/es.modern/index.js +1 -1
- package/dist/es.modern/it-IT.js +1 -1
- package/dist/es.modern/ja-JP.js +1 -1
- package/dist/es.modern/ko-KR.js +1 -1
- package/dist/es.modern/nl-NL.js +1 -1
- package/dist/es.modern/no-NO.js +1 -1
- package/dist/es.modern/pl-PL.js +1 -1
- package/dist/es.modern/pt-BR.js +1 -1
- package/dist/es.modern/pt-PT.js +1 -1
- package/dist/es.modern/ro-RO.js +1 -1
- package/dist/es.modern/ru-RU.js +1 -1
- package/dist/es.modern/sk-SK.js +1 -1
- package/dist/es.modern/sl-SI.js +1 -1
- package/dist/es.modern/sv-SE.js +1 -1
- package/dist/es.modern/zh-CN.js +1 -1
- package/dist/es.modern/zh-TW.js +1 -1
- package/dist/types/components/Ach/Ach.d.ts +3 -0
- package/dist/types/components/Ach/types.d.ts +1 -0
- package/dist/types/components/ApplePay/ApplePayService.d.ts +4 -2
- package/dist/types/components/ApplePay/types.d.ts +2 -1
- package/dist/types/components/BcmcMobile/BcmcMobile.d.ts +1 -0
- package/dist/types/components/Card/Bancontact.d.ts +1 -6
- package/dist/types/components/Card/Card.d.ts +2 -9
- package/dist/types/components/Card/components/CardInput/components/CardFieldsWrapper.d.ts +1 -7
- package/dist/types/components/Card/components/CardInput/components/StoredCardFieldsWrapper.d.ts +1 -7
- package/dist/types/components/Card/components/CardInput/defaultProps.d.ts +0 -1
- package/dist/types/components/Card/components/CardInput/handlers.d.ts +2 -3
- package/dist/types/components/Card/components/CardInput/types.d.ts +20 -28
- package/dist/types/components/Card/components/CardInput/utils.d.ts +9 -4
- package/dist/types/components/Dragonpay/Dragonpay.d.ts +1 -0
- package/dist/types/components/Dropin/Dropin.d.ts +4 -0
- package/dist/types/components/Dropin/components/PaymentMethod/PaymentMethodName.d.ts +8 -0
- package/dist/types/components/DuitNow/DuitNow.d.ts +1 -0
- package/dist/types/components/PayNow/PayNow.d.ts +1 -0
- package/dist/types/components/PayPal/Paypal.d.ts +8 -9
- package/dist/types/components/PayPal/components/PaypalButtons.d.ts +1 -1
- package/dist/types/components/PayPal/components/PaypalComponent.d.ts +1 -1
- package/dist/types/components/PayPal/types.d.ts +7 -2
- package/dist/types/components/PayPal/utils/create-shopper-details.d.ts +6 -0
- package/dist/types/components/PromptPay/PromptPay.d.ts +1 -0
- package/dist/types/components/SecuredFields/SecuredFieldsInput/SecuredFieldsInput.d.ts +0 -1
- package/dist/types/components/Swish/Swish.d.ts +1 -0
- package/dist/types/components/WeChat/WeChat.d.ts +1 -0
- package/dist/types/components/internal/Address/utils.d.ts +8 -0
- package/dist/types/components/internal/CompanyDetails/CompanyDetails.d.ts +2 -6
- package/dist/types/components/internal/CompanyDetails/validate.d.ts +2 -6
- package/dist/types/components/internal/FormFields/Field/types.d.ts +1 -0
- package/dist/types/components/internal/FormFields/Select/Select.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/components/SelectList.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/components/SelectListItem.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/types.d.ts +17 -6
- package/dist/types/components/internal/FormFields/utils.d.ts +7 -1
- package/dist/types/components/internal/OpenInvoice/types.d.ts +7 -6
- package/dist/types/components/internal/OpenInvoice/utils.d.ts +8 -0
- package/dist/types/components/internal/PersonalDetails/PersonalDetails.d.ts +1 -0
- package/dist/types/components/internal/PersonalDetails/utils.d.ts +7 -0
- package/dist/types/components/internal/SecuredFields/SFP/SecuredFieldsProvider.d.ts +2 -2
- package/dist/types/components/internal/SecuredFields/SFP/defaultProps.d.ts +0 -1
- package/dist/types/components/internal/SecuredFields/SFP/types.d.ts +2 -1
- package/dist/types/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.d.ts +1 -1
- package/dist/types/components/internal/SecuredFields/lib/CSF/types.d.ts +1 -1
- package/dist/types/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.d.ts +1 -1
- package/dist/types/components/types.d.ts +2 -0
- package/dist/types/core/Errors/SRMessages.d.ts +6 -0
- package/dist/types/core/Errors/SRPanel.d.ts +28 -0
- package/dist/types/core/Errors/SRPanelContext.d.ts +12 -0
- package/dist/types/core/Errors/SRPanelProvider.d.ts +15 -0
- package/dist/types/core/Errors/constants.d.ts +2 -0
- package/dist/types/core/Errors/types.d.ts +38 -1
- package/dist/types/core/Errors/useSRPanelContext.d.ts +3 -0
- package/dist/types/core/Errors/utils.d.ts +28 -0
- package/dist/types/language/config.d.ts +4 -0
- package/dist/types/language/locales/index.d.ts +208 -0
- package/dist/types/types/index.d.ts +13 -1
- package/dist/types/utils/Storage.d.ts +1 -1
- package/dist/types/utils/setFocus.d.ts +6 -0
- package/package.json +11 -11
- package/dist/types/core/Errors/ErrorPanel.d.ts +0 -14
|
@@ -39,6 +39,7 @@ declare class DuitNowElement extends QRLoaderContainer {
|
|
|
39
39
|
_parentInstance?: import("../../core/core").default;
|
|
40
40
|
order?: import("../../types").Order;
|
|
41
41
|
modules?: {
|
|
42
|
+
srPanel: import("../../core/Errors/SRPanel").SRPanel;
|
|
42
43
|
analytics: import("../../core/Analytics/Analytics").default;
|
|
43
44
|
risk: import("../../core/RiskModule").default;
|
|
44
45
|
};
|
|
@@ -39,6 +39,7 @@ declare class PayNowElement extends QRLoaderContainer {
|
|
|
39
39
|
_parentInstance?: import("../../core/core").default;
|
|
40
40
|
order?: import("../../types").Order;
|
|
41
41
|
modules?: {
|
|
42
|
+
srPanel: import("../../core/Errors/SRPanel").SRPanel;
|
|
42
43
|
analytics: import("../../core/Analytics/Analytics").default;
|
|
43
44
|
risk: import("../../core/RiskModule").default;
|
|
44
45
|
};
|
|
@@ -6,12 +6,13 @@ import './Paypal.scss';
|
|
|
6
6
|
declare class PaypalElement extends UIElement<PayPalElementProps> {
|
|
7
7
|
static type: string;
|
|
8
8
|
static subtype: string;
|
|
9
|
-
protected static defaultProps: PayPalElementProps;
|
|
10
9
|
private paymentData;
|
|
11
10
|
private resolve;
|
|
12
11
|
private reject;
|
|
13
|
-
|
|
12
|
+
protected static defaultProps: PayPalElementProps;
|
|
13
|
+
constructor(props: any);
|
|
14
14
|
formatProps(props: PayPalElementProps): PayPalElementProps;
|
|
15
|
+
submit: () => void;
|
|
15
16
|
/**
|
|
16
17
|
* Formats the component data output
|
|
17
18
|
*/
|
|
@@ -21,8 +22,8 @@ declare class PaypalElement extends UIElement<PayPalElementProps> {
|
|
|
21
22
|
subtype: string;
|
|
22
23
|
};
|
|
23
24
|
};
|
|
24
|
-
handleAction(action: PaymentAction)
|
|
25
|
-
updateWithAction(action: PaymentAction)
|
|
25
|
+
handleAction: (action: PaymentAction) => any;
|
|
26
|
+
updateWithAction: (action: PaymentAction) => any;
|
|
26
27
|
/**
|
|
27
28
|
* Dropin Validation
|
|
28
29
|
*
|
|
@@ -30,13 +31,11 @@ declare class PaypalElement extends UIElement<PayPalElementProps> {
|
|
|
30
31
|
* Paypal does not require any specific Dropin validation
|
|
31
32
|
*/
|
|
32
33
|
get isValid(): boolean;
|
|
33
|
-
handleCancel
|
|
34
|
-
|
|
34
|
+
private handleCancel;
|
|
35
|
+
private handleOnApprove;
|
|
35
36
|
handleResolve(token: string): void;
|
|
36
37
|
handleReject(errorMessage: string): void;
|
|
37
|
-
|
|
38
|
-
handleSubmit(): Promise<unknown>;
|
|
39
|
-
submit(): void;
|
|
38
|
+
private handleSubmit;
|
|
40
39
|
render(): h.JSX.Element;
|
|
41
40
|
}
|
|
42
41
|
export default PaypalElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { PayPalButtonsProps } from '../types';
|
|
3
|
-
export default function PaypalButtons(props: PayPalButtonsProps): h.JSX.Element;
|
|
3
|
+
export default function PaypalButtons({ onInit, onApprove, onClick, onCancel, onError, onShippingChange, onSubmit, isProcessingPayment, paypalRef, style, ...props }: PayPalButtonsProps): h.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { PayPalComponentProps } from '../types';
|
|
3
|
-
export default function PaypalComponent(props: PayPalComponentProps): h.JSX.Element;
|
|
3
|
+
export default function PaypalComponent({ onApprove, onCancel, onChange, onError, onSubmit, ...props }: PayPalComponentProps): h.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaymentAmount, PaymentMethod } from '../../types';
|
|
1
|
+
import { PaymentAmount, PaymentMethod, ShopperDetails } from '../../types';
|
|
2
2
|
import UIElement from '../UIElement';
|
|
3
3
|
import { UIElementProps } from '../types';
|
|
4
4
|
import { SUPPORTED_LOCALES } from './config';
|
|
@@ -127,19 +127,24 @@ export interface PayPalElementProps extends PayPalCommonProps, UIElementProps {
|
|
|
127
127
|
onAdditionalDetails?: (state: any, element: UIElement) => void;
|
|
128
128
|
onCancel?: (state: any, element: UIElement) => void;
|
|
129
129
|
onError?: (state: any, element?: UIElement) => void;
|
|
130
|
+
onShopperDetails?(shopperDetails: ShopperDetails, rawData: any, actions: {
|
|
131
|
+
resolve: () => void;
|
|
132
|
+
reject: () => void;
|
|
133
|
+
}): void;
|
|
130
134
|
paymentMethods?: PaymentMethod[];
|
|
131
135
|
showPayButton?: boolean;
|
|
132
136
|
}
|
|
133
137
|
export interface PayPalComponentProps extends PayPalCommonProps {
|
|
138
|
+
onApprove: (data: any, actions: any) => void;
|
|
134
139
|
onCancel?: (data: object) => void;
|
|
135
140
|
onChange?: (newState: object) => void;
|
|
136
|
-
onComplete?: (details: object) => void;
|
|
137
141
|
onError?: (data: object) => void;
|
|
138
142
|
onSubmit?: () => Promise<any>;
|
|
139
143
|
ref?: any;
|
|
140
144
|
}
|
|
141
145
|
export interface PayPalButtonsProps extends PayPalComponentProps {
|
|
142
146
|
paypalRef: any;
|
|
147
|
+
isProcessingPayment: boolean;
|
|
143
148
|
}
|
|
144
149
|
export interface PaypalSettings {
|
|
145
150
|
'merchant-id'?: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ShopperDetails } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Parses the Order data from PayPal, and create the shopper details object according to how Adyen expects
|
|
4
|
+
*/
|
|
5
|
+
declare const createShopperDetails: (order: any) => ShopperDetails | null;
|
|
6
|
+
export { createShopperDetails };
|
|
@@ -39,6 +39,7 @@ declare class PromptPayElement extends QRLoaderContainer {
|
|
|
39
39
|
_parentInstance?: import("../../core/core").default;
|
|
40
40
|
order?: import("../../types").Order;
|
|
41
41
|
modules?: {
|
|
42
|
+
srPanel: import("../../core/Errors/SRPanel").SRPanel;
|
|
42
43
|
analytics: import("../../core/Analytics/Analytics").default;
|
|
43
44
|
risk: import("../../core/RiskModule").default;
|
|
44
45
|
};
|
|
@@ -39,6 +39,7 @@ declare class SwishElement extends QRLoaderContainer {
|
|
|
39
39
|
_parentInstance?: import("../../core/core").default;
|
|
40
40
|
order?: import("../../types").Order;
|
|
41
41
|
modules?: {
|
|
42
|
+
srPanel: import("../../core/Errors/SRPanel").SRPanel;
|
|
42
43
|
analytics: import("../../core/Analytics/Analytics").default;
|
|
43
44
|
risk: import("../../core/RiskModule").default;
|
|
44
45
|
};
|
|
@@ -39,6 +39,7 @@ declare class WeChatPayElement extends QRLoaderContainer {
|
|
|
39
39
|
_parentInstance?: import("../../core/core").default;
|
|
40
40
|
order?: import("../../types").Order;
|
|
41
41
|
modules?: {
|
|
42
|
+
srPanel: import("../../core/Errors/SRPanel").SRPanel;
|
|
42
43
|
analytics: import("../../core/Analytics/Analytics").default;
|
|
43
44
|
risk: import("../../core/RiskModule").default;
|
|
44
45
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Language from '../../../language';
|
|
2
|
+
import { StringObject } from './types';
|
|
3
|
+
/**
|
|
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.
|
|
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
|
|
6
|
+
* and this mapping fn will become redundant)
|
|
7
|
+
*/
|
|
8
|
+
export declare const mapFieldKey: (key: string, i18n: Language, countrySpecificLabels: StringObject) => string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { CompanyDetailsProps } from './types';
|
|
3
|
+
export declare const COMPANY_DETAILS_SCHEMA: string[];
|
|
3
4
|
declare function CompanyDetails(props: CompanyDetailsProps): h.JSX.Element;
|
|
4
5
|
declare namespace CompanyDetails {
|
|
5
6
|
var defaultProps: {
|
|
@@ -7,12 +8,7 @@ declare namespace CompanyDetails {
|
|
|
7
8
|
onChange: () => void;
|
|
8
9
|
visibility: string;
|
|
9
10
|
requiredFields: string[];
|
|
10
|
-
validationRules:
|
|
11
|
-
default: {
|
|
12
|
-
validate: (value: any) => boolean;
|
|
13
|
-
modes: string[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
11
|
+
validationRules: import("../../../utils/Validator/types").ValidatorRules;
|
|
16
12
|
};
|
|
17
13
|
}
|
|
18
14
|
export default CompanyDetails;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
validate: (value: any) => boolean;
|
|
4
|
-
modes: string[];
|
|
5
|
-
};
|
|
6
|
-
};
|
|
1
|
+
import { ValidatorRules } from '../../../utils/Validator/types';
|
|
2
|
+
export declare const companyDetailsValidationRules: ValidatorRules;
|
|
@@ -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, selected, name, isInvalid, isValid, placeholder, uniqueId, isCollatingErrors }: SelectProps): h.JSX.Element;
|
|
4
|
+
declare function Select({ items, className, classNameModifiers, filterable, readonly, onChange, selected, name, isInvalid, isValid, placeholder, uniqueId, isCollatingErrors, disabled }: SelectProps): h.JSX.Element;
|
|
5
5
|
declare namespace Select {
|
|
6
6
|
var defaultProps: {
|
|
7
7
|
className: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { SelectListProps } from '../types';
|
|
3
|
-
declare function SelectList({ active,
|
|
3
|
+
declare function SelectList({ selected, active, filteredItems, showList, ...props }: SelectListProps): h.JSX.Element;
|
|
4
4
|
export default SelectList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { SelectItemProps } from '../types';
|
|
3
|
-
declare const SelectListItem: ({ item, selected, ...props }: SelectItemProps) => h.JSX.Element;
|
|
3
|
+
declare const SelectListItem: ({ item, active, selected, ...props }: SelectItemProps) => h.JSX.Element;
|
|
4
4
|
export default SelectListItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface SelectItem {
|
|
2
2
|
disabled?: boolean;
|
|
3
3
|
icon?: string;
|
|
4
|
-
id: string;
|
|
4
|
+
id: string | number;
|
|
5
5
|
name: string;
|
|
6
6
|
secondaryText?: string;
|
|
7
7
|
selectedOptionName?: string;
|
|
@@ -14,20 +14,29 @@ export interface SelectProps {
|
|
|
14
14
|
isValid?: boolean;
|
|
15
15
|
items: SelectItem[];
|
|
16
16
|
name?: string;
|
|
17
|
-
onChange: (e:
|
|
17
|
+
onChange: (e: {
|
|
18
|
+
target: {
|
|
19
|
+
value: string | number;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
}) => void;
|
|
18
23
|
placeholder: string;
|
|
19
24
|
readonly: boolean;
|
|
20
25
|
selected: string;
|
|
21
26
|
uniqueId?: string;
|
|
22
27
|
isCollatingErrors: boolean;
|
|
28
|
+
disabled: boolean;
|
|
23
29
|
}
|
|
24
30
|
export interface SelectButtonProps {
|
|
31
|
+
inputText: string;
|
|
25
32
|
active: SelectItem;
|
|
33
|
+
selected: SelectItem;
|
|
26
34
|
filterInputRef: any;
|
|
27
35
|
filterable: boolean;
|
|
28
36
|
isInvalid: boolean;
|
|
29
37
|
isValid?: boolean;
|
|
30
38
|
onButtonKeyDown: (e: KeyboardEvent) => void;
|
|
39
|
+
onFocus: (e: Event) => void;
|
|
31
40
|
onInput: (e: Event) => void;
|
|
32
41
|
placeholder: string;
|
|
33
42
|
readonly: boolean;
|
|
@@ -37,20 +46,22 @@ export interface SelectButtonProps {
|
|
|
37
46
|
toggleList: (e: Event) => void;
|
|
38
47
|
id?: string;
|
|
39
48
|
ariaDescribedBy: string;
|
|
49
|
+
disabled: boolean;
|
|
40
50
|
}
|
|
41
51
|
export interface SelectListProps {
|
|
42
52
|
active: SelectItem;
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
filteredItems: SelectItem[];
|
|
54
|
+
onHover: (e: Event) => void;
|
|
45
55
|
onSelect: (e: Event) => void;
|
|
56
|
+
selected: SelectItem;
|
|
46
57
|
selectListId: string;
|
|
47
58
|
selectListRef: any;
|
|
48
59
|
showList: boolean;
|
|
49
|
-
textFilter: string;
|
|
50
60
|
}
|
|
51
61
|
export interface SelectItemProps {
|
|
62
|
+
active: boolean;
|
|
52
63
|
item: SelectItem;
|
|
53
64
|
selected: boolean;
|
|
54
|
-
|
|
65
|
+
onHover: (e: Event) => void;
|
|
55
66
|
onSelect: (e: Event) => void;
|
|
56
67
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
declare const convertFullToHalf: (str: any) => any;
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* This function scrolls and element to view and simulates the default behaviour of .focus() by a given browser
|
|
4
|
+
* This function is inspired, yet simplified of the code found here https://gist.github.com/hsablonniere/2581101
|
|
5
|
+
* @param element - element to focus
|
|
6
|
+
*/
|
|
7
|
+
declare const simulateFocusScroll: (element: HTMLElement) => void;
|
|
8
|
+
export { convertFullToHalf, simulateFocusScroll };
|
|
@@ -3,6 +3,7 @@ import { CompanyDetailsSchema } from '../CompanyDetails/types';
|
|
|
3
3
|
import { AddressSpecifications } from '../Address/types';
|
|
4
4
|
import { UIElementProps } from '../../types';
|
|
5
5
|
import UIElement from '../../UIElement';
|
|
6
|
+
import { GenericError, ValidationRuleErrorObj } from '../../../core/Errors/types';
|
|
6
7
|
export interface OpenInvoiceVisibility {
|
|
7
8
|
companyDetails?: FieldsetVisibility;
|
|
8
9
|
personalDetails?: FieldsetVisibility;
|
|
@@ -44,12 +45,12 @@ export interface OpenInvoiceStateData {
|
|
|
44
45
|
consentCheckbox?: boolean;
|
|
45
46
|
}
|
|
46
47
|
export interface OpenInvoiceStateError {
|
|
47
|
-
consentCheckbox?: boolean;
|
|
48
|
-
companyDetails?: boolean;
|
|
49
|
-
billingAddress?: boolean;
|
|
50
|
-
deliveryAddress?: boolean;
|
|
51
|
-
personalDetails?: boolean;
|
|
52
|
-
bankAccount?: boolean;
|
|
48
|
+
consentCheckbox?: boolean | GenericError;
|
|
49
|
+
companyDetails?: boolean | ValidationRuleErrorObj;
|
|
50
|
+
billingAddress?: boolean | ValidationRuleErrorObj;
|
|
51
|
+
deliveryAddress?: boolean | ValidationRuleErrorObj;
|
|
52
|
+
personalDetails?: boolean | ValidationRuleErrorObj;
|
|
53
|
+
bankAccount?: boolean | object;
|
|
53
54
|
}
|
|
54
55
|
export interface OpenInvoiceStateValid {
|
|
55
56
|
consentCheckbox?: boolean;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { OpenInvoiceActiveFieldsets, OpenInvoiceStateData, OpenInvoiceVisibility } from './types';
|
|
2
|
+
import Language from '../../../language';
|
|
3
|
+
import { StringObject } from '../Address/types';
|
|
2
4
|
export declare const fieldsetsSchema: Array<keyof OpenInvoiceStateData>;
|
|
3
5
|
export declare const getActiveFieldsData: (activeFieldsets: OpenInvoiceActiveFieldsets, data: OpenInvoiceStateData) => OpenInvoiceStateData;
|
|
4
6
|
export declare const getInitialActiveFieldsets: (visibility: OpenInvoiceVisibility, data?: OpenInvoiceStateData) => OpenInvoiceActiveFieldsets;
|
|
7
|
+
/**
|
|
8
|
+
* 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.
|
|
9
|
+
* (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
|
|
10
|
+
* and this mapping fn will become redundant)
|
|
11
|
+
*/
|
|
12
|
+
export declare const mapFieldKey: (key: string, i18n: Language, countrySpecificLabels: StringObject) => string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
2
|
import { PersonalDetailsProps } from './types';
|
|
3
3
|
import './PersonalDetails.scss';
|
|
4
|
+
export declare const PERSONAL_DETAILS_SCHEMA: string[];
|
|
4
5
|
declare function PersonalDetails(props: PersonalDetailsProps): h.JSX.Element;
|
|
5
6
|
declare namespace PersonalDetails {
|
|
6
7
|
var defaultProps: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Language from '../../../language';
|
|
1
2
|
export declare const getFormattedData: (data: any) => {
|
|
2
3
|
telephoneNumber: any;
|
|
3
4
|
shopperEmail: any;
|
|
@@ -8,3 +9,9 @@ export declare const getFormattedData: (data: any) => {
|
|
|
8
9
|
firstName: any;
|
|
9
10
|
};
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
* (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
|
|
15
|
+
* and this mapping fn will become redundant)
|
|
16
|
+
*/
|
|
17
|
+
export declare const mapFieldKey: (key: string, i18n: Language) => string;
|
|
@@ -2,6 +2,7 @@ import { Component } from 'preact';
|
|
|
2
2
|
import { SFPProps, SFPState, SingleBrandResetObject } from './types';
|
|
3
3
|
import { StylesObject, CbObjOnError } from '../lib/types';
|
|
4
4
|
import { BinLookupResponse } from '../../../Card/types';
|
|
5
|
+
import { SFStateErrorObj } from '../../../Card/components/CardInput/types';
|
|
5
6
|
/**
|
|
6
7
|
* SecuredFieldsProvider:
|
|
7
8
|
* Initialises & handles the client-side part of SecuredFields
|
|
@@ -49,7 +50,6 @@ declare class SecuredFieldsProvider extends Component<SFPProps, SFPState> {
|
|
|
49
50
|
onBinValue: () => void;
|
|
50
51
|
onFocus: () => void;
|
|
51
52
|
onAutoComplete: () => void;
|
|
52
|
-
onTouchstartIOS: () => any;
|
|
53
53
|
styles: {};
|
|
54
54
|
};
|
|
55
55
|
componentDidMount(): void;
|
|
@@ -67,7 +67,7 @@ declare class SecuredFieldsProvider extends Component<SFPProps, SFPState> {
|
|
|
67
67
|
/**
|
|
68
68
|
* Map SF errors to ValidationRuleResult-like objects, for CardInput component
|
|
69
69
|
*/
|
|
70
|
-
mapErrorsToValidationRuleResult():
|
|
70
|
+
mapErrorsToValidationRuleResult(): SFStateErrorObj;
|
|
71
71
|
processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void;
|
|
72
72
|
private setRootNode;
|
|
73
73
|
render(props: any, state: any): any;
|
|
@@ -2,6 +2,7 @@ import { CVCPolicyType, DatePolicyType, StylesObject } from '../lib/types';
|
|
|
2
2
|
import { AddressData } from '../../../../types';
|
|
3
3
|
import { CardBrandsConfiguration } from '../../../Card/types';
|
|
4
4
|
import { Language } from '../../../../language/Language';
|
|
5
|
+
import { TouchStartEventObj } from '../../../Card/components/CardInput/components/types';
|
|
5
6
|
/**
|
|
6
7
|
* Should be the only props that can be sent to SFP (from CardInput, SecuredFieldsInput, AchInput, GiftcardComponent)
|
|
7
8
|
*/
|
|
@@ -16,7 +17,6 @@ export interface SFPProps {
|
|
|
16
17
|
hasKoreanFields?: boolean;
|
|
17
18
|
i18n: Language;
|
|
18
19
|
implementationType?: string;
|
|
19
|
-
isCollatingErrors?: boolean;
|
|
20
20
|
keypadFix?: boolean;
|
|
21
21
|
koreanAuthenticationRequired?: boolean;
|
|
22
22
|
legacyInputMode?: boolean;
|
|
@@ -41,6 +41,7 @@ export interface SFPProps {
|
|
|
41
41
|
type: string;
|
|
42
42
|
render: () => {};
|
|
43
43
|
maskSecurityCode: boolean;
|
|
44
|
+
disableIOSArrowKeys: (obj: TouchStartEventObj) => void | null;
|
|
44
45
|
}
|
|
45
46
|
export interface SFPState {
|
|
46
47
|
status?: string;
|
package/dist/types/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare function touchendListener(e: Event): void;
|
|
|
12
12
|
/**
|
|
13
13
|
* re. Disabling arrow keys in iOS - need to enable all fields in the form and tell SFs to disable
|
|
14
14
|
*
|
|
15
|
-
* NOTE: Only called when iOS detected
|
|
15
|
+
* NOTE: Only called when iOS detected & this.config.disableIOSArrowKeys = true
|
|
16
16
|
*/
|
|
17
17
|
declare function touchstartListener(e: Event): void;
|
|
18
18
|
/**
|
|
@@ -34,8 +34,8 @@ interface CSFCommonProps {
|
|
|
34
34
|
legacyInputMode?: boolean;
|
|
35
35
|
minimumExpiryDate?: string;
|
|
36
36
|
implementationType?: 'components' | 'custom';
|
|
37
|
-
isCollatingErrors?: boolean;
|
|
38
37
|
maskSecurityCode: boolean;
|
|
38
|
+
disableIOSArrowKeys: boolean;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* The object sent when SecuredFieldsProvider initialises CSF
|
package/dist/types/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export interface SFInternalConfig {
|
|
|
22
22
|
legacyInputMode: boolean;
|
|
23
23
|
minimumExpiryDate: string;
|
|
24
24
|
implementationType: string;
|
|
25
|
-
isCollatingErrors: boolean;
|
|
26
25
|
maskSecurityCode: boolean;
|
|
26
|
+
disableIOSArrowKeys: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* The object sent when createSecuredFields initialises a new instance of SecuredField.ts
|
|
@@ -5,6 +5,7 @@ import Analytics from '../core/Analytics';
|
|
|
5
5
|
import RiskElement from '../core/RiskModule';
|
|
6
6
|
import { PayButtonProps } from './internal/PayButton/PayButton';
|
|
7
7
|
import Session from '../core/CheckoutSession';
|
|
8
|
+
import { SRPanel } from '../core/Errors/SRPanel';
|
|
8
9
|
export interface PaymentMethodData {
|
|
9
10
|
paymentMethod: {
|
|
10
11
|
[key: string]: any;
|
|
@@ -50,6 +51,7 @@ export interface BaseElementProps {
|
|
|
50
51
|
_parentInstance?: Core;
|
|
51
52
|
order?: Order;
|
|
52
53
|
modules?: {
|
|
54
|
+
srPanel: SRPanel;
|
|
53
55
|
analytics: Analytics;
|
|
54
56
|
risk: RiskElement;
|
|
55
57
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import './SRPanel.scss';
|
|
3
|
+
import { SRPanelProps } from './types';
|
|
4
|
+
import BaseElement from '../../components/BaseElement';
|
|
5
|
+
/**
|
|
6
|
+
* A panel meant to hold messages that will be read out by ScreenReaders on an aria-live="polite" basis
|
|
7
|
+
* Expects a string or string array of message to add to the panel to be read out
|
|
8
|
+
* For testing purposes can be made visible
|
|
9
|
+
*/
|
|
10
|
+
export declare class SRPanel extends BaseElement<SRPanelProps> {
|
|
11
|
+
static defaultProps: {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
node: string;
|
|
14
|
+
showPanel: boolean;
|
|
15
|
+
};
|
|
16
|
+
private readonly srPanelContainer;
|
|
17
|
+
private readonly id;
|
|
18
|
+
private readonly showPanel;
|
|
19
|
+
private readonly _enabled;
|
|
20
|
+
private readonly _moveFocus;
|
|
21
|
+
private componentRef;
|
|
22
|
+
constructor(props: SRPanelProps);
|
|
23
|
+
setComponentRef: (ref: any) => void;
|
|
24
|
+
get enabled(): boolean;
|
|
25
|
+
get moveFocus(): boolean;
|
|
26
|
+
setMessages: (messages: string[] | string) => void;
|
|
27
|
+
render(): h.JSX.Element;
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SRPanel } from './SRPanel';
|
|
2
|
+
import { SetSRMessagesReturnFn } from './SRPanelProvider';
|
|
3
|
+
export interface ISRPanelContext {
|
|
4
|
+
srPanel: SRPanel;
|
|
5
|
+
setSRMessagesFromObjects: ({ fieldTypeMappingFn }: {
|
|
6
|
+
fieldTypeMappingFn: any;
|
|
7
|
+
}) => SetSRMessagesReturnFn;
|
|
8
|
+
setSRMessagesFromStrings: (strs: any) => void;
|
|
9
|
+
clearSRPanel: () => void;
|
|
10
|
+
shouldMoveFocusSR: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const SRPanelContext: import("preact").Context<ISRPanelContext>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { h, ComponentChildren } from 'preact';
|
|
2
|
+
import { SRPanel } from './SRPanel';
|
|
3
|
+
import { SetSRMessagesReturnObject } from './types';
|
|
4
|
+
type SRPanelProviderProps = {
|
|
5
|
+
srPanel: SRPanel;
|
|
6
|
+
children: ComponentChildren;
|
|
7
|
+
};
|
|
8
|
+
export type SetSRMessagesReturnFn = ({ errors, isValidating, layout, countrySpecificLabels }: {
|
|
9
|
+
errors: any;
|
|
10
|
+
isValidating: any;
|
|
11
|
+
layout?: any;
|
|
12
|
+
countrySpecificLabels?: any;
|
|
13
|
+
}) => SetSRMessagesReturnObject;
|
|
14
|
+
declare const SRPanelProvider: ({ srPanel, children }: SRPanelProviderProps) => h.JSX.Element;
|
|
15
|
+
export default SRPanelProvider;
|
|
@@ -67,3 +67,5 @@ export declare const EMPTY_FIELD_ERROR_MESSAGES: {
|
|
|
67
67
|
encryptedBankAccountNumber: string;
|
|
68
68
|
encryptedBankLocationId: string;
|
|
69
69
|
};
|
|
70
|
+
export declare const ERROR_ACTION_FOCUS_FIELD = "focusField";
|
|
71
|
+
export declare const ERROR_ACTION_BLUR_SCENARIO = "notValidating:blurScenario";
|
|
@@ -1,5 +1,42 @@
|
|
|
1
|
+
import { ValidationRuleResult } from '../../utils/Validator/ValidationRuleResult';
|
|
2
|
+
import { SFError } from '../../components/Card/components/CardInput/types';
|
|
3
|
+
import Language from '../../language';
|
|
4
|
+
import { StringObject } from '../../components/internal/Address/types';
|
|
5
|
+
import { BaseElementProps } from '../../components/types';
|
|
6
|
+
export interface ErrorObj {
|
|
7
|
+
[key: string]: ValidationRuleResult | SFError;
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationRuleErrorObj {
|
|
10
|
+
[key: string]: ValidationRuleResult;
|
|
11
|
+
}
|
|
12
|
+
export interface SortErrorsObj {
|
|
13
|
+
errors: ErrorObj;
|
|
14
|
+
layout?: string[];
|
|
15
|
+
i18n: Language;
|
|
16
|
+
countrySpecificLabels?: StringObject;
|
|
17
|
+
fieldTypeMappingFn?: (key: string, i18n: Language, countrySpecificLabels: StringObject) => string;
|
|
18
|
+
}
|
|
19
|
+
export interface SortedErrorObject {
|
|
20
|
+
field: string;
|
|
21
|
+
errorMessage: string;
|
|
22
|
+
errorCode: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SRPanelProps extends BaseElementProps {
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
node?: string;
|
|
27
|
+
showPanel?: boolean;
|
|
28
|
+
moveFocus?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface SRMessagesProps {
|
|
31
|
+
setComponentRef: (ref: any) => void;
|
|
32
|
+
}
|
|
1
33
|
export interface GenericError {
|
|
2
|
-
isValid
|
|
34
|
+
isValid: boolean;
|
|
3
35
|
errorMessage: string;
|
|
4
36
|
error: string;
|
|
5
37
|
}
|
|
38
|
+
export interface SetSRMessagesReturnObject {
|
|
39
|
+
currentErrorsSortedByLayout: SortedErrorObject[];
|
|
40
|
+
action: string;
|
|
41
|
+
fieldToFocus?: string;
|
|
42
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SortErrorsObj, SortedErrorObject, SetSRMessagesReturnObject } from './types';
|
|
1
2
|
/**
|
|
2
3
|
* Access items stored in the ERROR_CODES object by either sending in the key - in which case you get the value
|
|
3
4
|
* or by sending in the value - in which case you get the key
|
|
@@ -13,3 +14,30 @@ export declare const addAriaErrorTranslationsObject: (i18n: any) => {};
|
|
|
13
14
|
* @returns a duplicate of the original object with a new property: "error" whose value is a object containing the translated errors
|
|
14
15
|
*/
|
|
15
16
|
export declare const addErrorTranslationsToObject: (originalObj: any, i18n: any) => any;
|
|
17
|
+
/**
|
|
18
|
+
* sortErrorsByLayout - takes a list of errors and a layout, and returns a sorted array of error objects with translated error messages
|
|
19
|
+
*
|
|
20
|
+
* @param errors - an object containing errors, referenced by field type
|
|
21
|
+
* @param layout - a string[] controlling how the output error objects will be ordered. Required when it is known that the way the error object is populated can vary e.g. Card comp, &/or anything with a country selector
|
|
22
|
+
* @param i18n - our internal Language mechanism
|
|
23
|
+
* @param countrySpecificLabels - some errors are region specific, e.g. in the US "postal code" = "zip code", so map the fieldType value accordingly (if it is being added to the errorMessage string)
|
|
24
|
+
* @param fieldTypeMappingFn - a component specific lookup function that will tell us both if we need to prepend the field type to the SR panel message, and, if so, will retrieve the correct translation for the field type
|
|
25
|
+
*/
|
|
26
|
+
export declare const sortErrorsByLayout: ({ errors, i18n, layout, countrySpecificLabels, fieldTypeMappingFn }: SortErrorsObj) => SortedErrorObject[];
|
|
27
|
+
/**
|
|
28
|
+
* Implemented as a partial, with an object containing the first 6 arguments; then the final argument, errors, is passed to the partial
|
|
29
|
+
*
|
|
30
|
+
* NOTE: using this generic error setting fny is only suitable when errors for the SRPanel are *only* generated by showValidation().
|
|
31
|
+
* When errors are also generated onBlur, as the user leaves the input, the SR message generation becomes more complex - see CardInput as an example
|
|
32
|
+
*/
|
|
33
|
+
export declare const setSRMessagesFromErrors: ({ i18n, fieldTypeMappingFn, SRPanelRef }: {
|
|
34
|
+
i18n: any;
|
|
35
|
+
fieldTypeMappingFn: any;
|
|
36
|
+
SRPanelRef: any;
|
|
37
|
+
}, { errors, isValidating, layout, countrySpecificLabels }: {
|
|
38
|
+
errors: any;
|
|
39
|
+
isValidating: any;
|
|
40
|
+
layout: any;
|
|
41
|
+
countrySpecificLabels: any;
|
|
42
|
+
}) => SetSRMessagesReturnObject;
|
|
43
|
+
export declare const enhanceErrorObjectKeys: (errorObj: any, keyPrefix: any) => {};
|