@adyen/adyen-web 5.36.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 +5 -5
- 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 +5 -5
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/es/adyen.css +5 -5
- 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 +5 -5
- 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 +1 -0
- 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/DuitNow/DuitNow.d.ts +1 -0
- package/dist/types/components/PayNow/PayNow.d.ts +1 -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 -1
- package/dist/types/components/internal/SecuredFields/SFP/types.d.ts +0 -1
- package/dist/types/components/internal/SecuredFields/lib/CSF/types.d.ts +0 -1
- package/dist/types/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.d.ts +0 -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 +3 -0
- package/dist/types/language/locales/index.d.ts +156 -0
- package/dist/types/utils/setFocus.d.ts +6 -0
- package/package.json +1 -1
- package/dist/types/core/Errors/ErrorPanel.d.ts +0 -14
|
@@ -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
|
|
@@ -66,7 +67,7 @@ declare class SecuredFieldsProvider extends Component<SFPProps, SFPState> {
|
|
|
66
67
|
/**
|
|
67
68
|
* Map SF errors to ValidationRuleResult-like objects, for CardInput component
|
|
68
69
|
*/
|
|
69
|
-
mapErrorsToValidationRuleResult():
|
|
70
|
+
mapErrorsToValidationRuleResult(): SFStateErrorObj;
|
|
70
71
|
processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void;
|
|
71
72
|
private setRootNode;
|
|
72
73
|
render(props: any, state: any): any;
|
|
@@ -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) => {};
|
|
@@ -52,7 +52,10 @@ export declare const defaultTranslation: {
|
|
|
52
52
|
personalDetails: string;
|
|
53
53
|
companyDetails: string;
|
|
54
54
|
"companyDetails.name": string;
|
|
55
|
+
"companyDetails.name.invalid": string;
|
|
55
56
|
"companyDetails.registrationNumber": string;
|
|
57
|
+
"companyDetails.registrationNumber.invalid": string;
|
|
58
|
+
"consent.checkbox.invalid": string;
|
|
56
59
|
socialSecurityNumber: string;
|
|
57
60
|
firstName: string;
|
|
58
61
|
"firstName.invalid": string;
|