@adyen/kyc-components 2.41.4 → 2.42.1
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/es/adyen-kyc-components.es.js +334 -570
- package/dist/style.css +1 -0
- package/dist/types/components/BankDocument/types.d.ts +1 -2
- package/dist/types/components/BankVerification/BankVerification.d.ts +1 -1
- package/dist/types/components/BankVerification/types.d.ts +5 -5
- package/dist/types/components/CompanyBasics/types.d.ts +3 -3
- package/dist/types/components/CompanyLookup/types.d.ts +4 -4
- package/dist/types/components/Individual/types.d.ts +2 -2
- package/dist/types/components/PayoutDetails/types.d.ts +2 -2
- package/dist/types/components/TaskList/types.d.ts +2 -2
- package/dist/types/components/internal/Address/constants.d.ts +1 -0
- package/dist/types/components/internal/BusinessRegistrationNumberField/types.d.ts +2 -2
- package/dist/types/components/internal/DocumentGuidance/DocumentGuidance.d.ts +1 -1
- package/dist/types/components/internal/DocumentGuidance/{type.d.ts → types.d.ts} +5 -0
- package/dist/types/components/internal/EntityAssociation/types.d.ts +2 -2
- package/dist/types/components/internal/Remove/types.d.ts +3 -3
- package/dist/types/components/internal/TaxInformationField/types.d.ts +2 -2
- package/dist/types/components/internal/VatNumberField/types.d.ts +2 -2
- package/dist/types/core/hooks/introduction/useHasSeenIntroduction.d.ts +1 -1
- package/dist/types/core/hooks/singpass/useHasSeenSingpassSelection.d.ts +1 -1
- package/dist/types/core/hooks/useCompanySearch/types.d.ts +2 -2
- package/dist/types/core/hooks/useCompanySearchTaskSubmit.d.ts +3 -3
- package/dist/types/core/hooks/useForm/types.d.ts +8 -8
- package/dist/types/core/hooks/useFormComposer.d.ts +2 -2
- package/dist/types/core/hooks/useIsElementVisible.d.ts +2 -2
- package/dist/types/core/hooks/useLocalStorage.d.ts +2 -2
- package/dist/types/utils/useStateFromProp.d.ts +2 -2
- package/package.json +1 -1
|
@@ -459,7 +459,6 @@ const depositSlip = "Deposit slip";
|
|
|
459
459
|
const screenshotOfOnlineBankingEnviroment = "Screenshot of online banking environment";
|
|
460
460
|
const officialEmailOrALetterFromYourBank = "Official email or a letter from your bank";
|
|
461
461
|
const check = "Check";
|
|
462
|
-
const releveDidentiteBancaire = "Relevé d'Identité Bancaire (RIB)";
|
|
463
462
|
const successFullyRemovedDecisionMaker = "Successfully removed a decision maker";
|
|
464
463
|
const failedToRemoveDecisionMaker = "Failed to remove a decision maker";
|
|
465
464
|
const chamberOfCommerceExtract = "Chamber of Commerce extract";
|
|
@@ -842,21 +841,21 @@ const getYourBusinessVerifiedDetails = "Get your business's verified details ins
|
|
|
842
841
|
const enterTheDetailsYourself = "Enter the details yourself";
|
|
843
842
|
const youAlsoHaveToUploadSomeSupportingDocuments = "You'll also have to upload some supporting documents.";
|
|
844
843
|
const verificationMethod = "Verification method";
|
|
845
|
-
const
|
|
846
|
-
const
|
|
847
|
-
const instantVerificationDescription = "
|
|
844
|
+
const verifyViaMobileBankingAppOrWebsite = "Verify via mobile banking app or website";
|
|
845
|
+
const uploadABankStatement = "Upload a bank statement";
|
|
846
|
+
const instantVerificationDescription = "Log in to your bank account and get instantly verified.";
|
|
848
847
|
const couldNotEstablishBankConnection = "We couldn't establish a connection with your bank";
|
|
849
848
|
const sorryAnErrorOccurred = "We are sorry, an error has occurred";
|
|
850
849
|
const ranIntoTechnicalError = "We ran into a technical error";
|
|
851
850
|
const failedInitializeInstantVerification = "Failed to initialize instant account verification process";
|
|
852
851
|
const couldNotCompleteAccountCheck = "We couldn't complete the account check";
|
|
853
852
|
const tryAgainOrManualAccountDetails = "Please try again later or provide account details manually.";
|
|
854
|
-
const manualVerificationDescription = "
|
|
853
|
+
const manualVerificationDescription = "You also have to provide the bank account details.";
|
|
855
854
|
const poweredBy = "Powered by";
|
|
856
855
|
const youSuccessfullyVerifiedAccount = "You’ve successfully verified your bank account.";
|
|
857
856
|
const verifyBankAccountAgain = "Verify bank account again";
|
|
858
857
|
const accountName = "Account name";
|
|
859
|
-
const
|
|
858
|
+
const mayTakeAFewDays = "May take a few days";
|
|
860
859
|
const instant = "Instant";
|
|
861
860
|
const isOurTrustedPartnerHelpingSpeedUpSetup = "%{provider} is our trusted partner helping speed up your account setup by instantly verifying your bank account.";
|
|
862
861
|
const howDoesVerificationWithOurPartnerWorks = "How does verification with our partner %{provider} work?";
|
|
@@ -1722,7 +1721,6 @@ const defaultTrans = {
|
|
|
1722
1721
|
screenshotOfOnlineBankingEnviroment,
|
|
1723
1722
|
officialEmailOrALetterFromYourBank,
|
|
1724
1723
|
check,
|
|
1725
|
-
releveDidentiteBancaire,
|
|
1726
1724
|
successFullyRemovedDecisionMaker,
|
|
1727
1725
|
failedToRemoveDecisionMaker,
|
|
1728
1726
|
chamberOfCommerceExtract,
|
|
@@ -2113,8 +2111,8 @@ const defaultTrans = {
|
|
|
2113
2111
|
enterTheDetailsYourself,
|
|
2114
2112
|
youAlsoHaveToUploadSomeSupportingDocuments,
|
|
2115
2113
|
verificationMethod,
|
|
2116
|
-
|
|
2117
|
-
|
|
2114
|
+
verifyViaMobileBankingAppOrWebsite,
|
|
2115
|
+
uploadABankStatement,
|
|
2118
2116
|
instantVerificationDescription,
|
|
2119
2117
|
couldNotEstablishBankConnection,
|
|
2120
2118
|
sorryAnErrorOccurred,
|
|
@@ -2127,7 +2125,7 @@ const defaultTrans = {
|
|
|
2127
2125
|
youSuccessfullyVerifiedAccount,
|
|
2128
2126
|
verifyBankAccountAgain,
|
|
2129
2127
|
accountName,
|
|
2130
|
-
|
|
2128
|
+
mayTakeAFewDays,
|
|
2131
2129
|
instant,
|
|
2132
2130
|
isOurTrustedPartnerHelpingSpeedUpSetup,
|
|
2133
2131
|
howDoesVerificationWithOurPartnerWorks,
|
|
@@ -2591,21 +2589,17 @@ const matchLocale = (locale, supportedLocales) => supportedLocales.find((supLoc)
|
|
|
2591
2589
|
function formatLocale(localeParam) {
|
|
2592
2590
|
const locale = localeParam.replace("_", "-");
|
|
2593
2591
|
const format = /([a-z]{2})(-)([A-Z]{2})/;
|
|
2594
|
-
if (format.test(locale))
|
|
2595
|
-
return locale;
|
|
2592
|
+
if (format.test(locale)) return locale;
|
|
2596
2593
|
const [languageCode, countryCode] = locale.split("-");
|
|
2597
|
-
if (!languageCode || !countryCode)
|
|
2598
|
-
return null;
|
|
2594
|
+
if (!languageCode || !countryCode) return null;
|
|
2599
2595
|
const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join("-");
|
|
2600
2596
|
return fullLocale.length === 5 ? fullLocale : null;
|
|
2601
2597
|
}
|
|
2602
2598
|
function parseLocale(locale, supportedLocales = []) {
|
|
2603
|
-
if (!locale || locale.length < 1 || locale.length > 5)
|
|
2604
|
-
return FALLBACK_LOCALE;
|
|
2599
|
+
if (!locale || locale.length < 1 || locale.length > 5) return FALLBACK_LOCALE;
|
|
2605
2600
|
const formattedLocale = formatLocale(locale);
|
|
2606
2601
|
const hasMatch = Boolean(formattedLocale && supportedLocales.includes(formattedLocale));
|
|
2607
|
-
if (hasMatch)
|
|
2608
|
-
return formattedLocale;
|
|
2602
|
+
if (hasMatch) return formattedLocale;
|
|
2609
2603
|
return matchLocale(formattedLocale || locale, supportedLocales);
|
|
2610
2604
|
}
|
|
2611
2605
|
const formatCustomTranslations = (supportedLocales, customTranslations = {}) => Object.keys(customTranslations).reduce((acc, cur) => {
|
|
@@ -2965,7 +2959,7 @@ const mergeFieldMetadataIntoProps = (fieldName, metadata, otherProps) => {
|
|
|
2965
2959
|
const MAX_LENGTH = 30;
|
|
2966
2960
|
const getMaxLengthByFieldAndCountry = (formattingRules, field, country2, ignoreIfFormatterExists) => {
|
|
2967
2961
|
var _a, _b, _c, _d;
|
|
2968
|
-
if (
|
|
2962
|
+
if ((_b = (_a = formattingRules[country2]) == null ? void 0 : _a[field]) == null ? void 0 : _b.formatter) {
|
|
2969
2963
|
return null;
|
|
2970
2964
|
}
|
|
2971
2965
|
const maxLength = (_d = (_c = formattingRules[country2]) == null ? void 0 : _c[field]) == null ? void 0 : _d.maxlength;
|
|
@@ -2985,8 +2979,7 @@ const createLogger = (namespace) => {
|
|
|
2985
2979
|
const methods = {};
|
|
2986
2980
|
consoleMethodsPrefixable.forEach((method) => {
|
|
2987
2981
|
methods[method] = (arg1, ...args) => {
|
|
2988
|
-
if (!console[method] || suppressed)
|
|
2989
|
-
return;
|
|
2982
|
+
if (!console[method] || suppressed) return;
|
|
2990
2983
|
if (!namespace) {
|
|
2991
2984
|
console[method](arg1, ...args);
|
|
2992
2985
|
} else if (stringSubstitutionRegex.test(arg1)) {
|
|
@@ -3177,8 +3170,7 @@ const Alert = ({
|
|
|
3177
3170
|
i18n
|
|
3178
3171
|
} = useI18nContext();
|
|
3179
3172
|
const [isClosed, setIsClosed] = useState(false);
|
|
3180
|
-
if (isClosed)
|
|
3181
|
-
return null;
|
|
3173
|
+
if (isClosed) return null;
|
|
3182
3174
|
const closeAlert = () => setIsClosed(true);
|
|
3183
3175
|
const classNames = cx("adl-alert", className, {
|
|
3184
3176
|
"adl-alert--basic": type === AlertTypes.BASIC,
|
|
@@ -3290,8 +3282,7 @@ const Link = ({
|
|
|
3290
3282
|
iconLeft = false,
|
|
3291
3283
|
onClick
|
|
3292
3284
|
}) => {
|
|
3293
|
-
if (!isValidLink(href))
|
|
3294
|
-
return null;
|
|
3285
|
+
if (!isValidLink(href)) return null;
|
|
3295
3286
|
const target = external ? "_blank" : "_self";
|
|
3296
3287
|
const rel = external ? "external noopener noreferrer" : void 0;
|
|
3297
3288
|
const showIcon = icon || external;
|
|
@@ -3569,8 +3560,7 @@ const useAllowedCountries = () => {
|
|
|
3569
3560
|
} = useConfigurationApi();
|
|
3570
3561
|
const [allowedCountries, setAllowedCountries] = useState(acceptedCountries);
|
|
3571
3562
|
useEffect(() => {
|
|
3572
|
-
if (acceptedCountries !== void 0)
|
|
3573
|
-
return;
|
|
3563
|
+
if (acceptedCountries !== void 0) return;
|
|
3574
3564
|
getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$s.error);
|
|
3575
3565
|
}, [acceptedCountries]);
|
|
3576
3566
|
return allowedCountries;
|
|
@@ -3701,8 +3691,7 @@ function reducer({
|
|
|
3701
3691
|
const validationSchema = selectedSchema || state2.schema;
|
|
3702
3692
|
switch (type) {
|
|
3703
3693
|
case "setData": {
|
|
3704
|
-
if (!key)
|
|
3705
|
-
return state2;
|
|
3694
|
+
if (!key) return state2;
|
|
3706
3695
|
return {
|
|
3707
3696
|
...state2,
|
|
3708
3697
|
data: {
|
|
@@ -3712,8 +3701,7 @@ function reducer({
|
|
|
3712
3701
|
};
|
|
3713
3702
|
}
|
|
3714
3703
|
case "setValid": {
|
|
3715
|
-
if (!key)
|
|
3716
|
-
return state2;
|
|
3704
|
+
if (!key) return state2;
|
|
3717
3705
|
return {
|
|
3718
3706
|
...state2,
|
|
3719
3707
|
valid: {
|
|
@@ -3723,8 +3711,7 @@ function reducer({
|
|
|
3723
3711
|
};
|
|
3724
3712
|
}
|
|
3725
3713
|
case "setErrors": {
|
|
3726
|
-
if (!key)
|
|
3727
|
-
return state2;
|
|
3714
|
+
if (!key) return state2;
|
|
3728
3715
|
return {
|
|
3729
3716
|
...state2,
|
|
3730
3717
|
errors: {
|
|
@@ -3750,8 +3737,7 @@ function reducer({
|
|
|
3750
3737
|
}, state2);
|
|
3751
3738
|
}
|
|
3752
3739
|
case "setSchema": {
|
|
3753
|
-
if (!schema)
|
|
3754
|
-
return state2;
|
|
3740
|
+
if (!schema) return state2;
|
|
3755
3741
|
const defaultState = init({
|
|
3756
3742
|
schema,
|
|
3757
3743
|
defaultData,
|
|
@@ -3786,8 +3772,7 @@ function reducer({
|
|
|
3786
3772
|
};
|
|
3787
3773
|
}
|
|
3788
3774
|
case "updateField": {
|
|
3789
|
-
if (!key || !mode)
|
|
3790
|
-
return state2;
|
|
3775
|
+
if (!key || !mode) return state2;
|
|
3791
3776
|
const [formattedValue, validation] = processField({
|
|
3792
3777
|
key,
|
|
3793
3778
|
value,
|
|
@@ -3915,11 +3900,9 @@ const useAsyncValidator = (asyncRules) => {
|
|
|
3915
3900
|
const [asyncValidationResults, setAsyncValidationResults] = useState({});
|
|
3916
3901
|
const clearAsyncValidationResults = useCallback(() => setAsyncValidationResults({}), []);
|
|
3917
3902
|
const triggerAsyncValidation = useCallback((field, formState, mode) => {
|
|
3918
|
-
if (!asyncRules)
|
|
3919
|
-
return clearAsyncValidationResults();
|
|
3903
|
+
if (!asyncRules) return clearAsyncValidationResults();
|
|
3920
3904
|
const rule = asyncRules[field];
|
|
3921
|
-
if (!rule || !rule.modes.includes(mode))
|
|
3922
|
-
return clearAsyncValidationResults();
|
|
3905
|
+
if (!rule || !rule.modes.includes(mode)) return clearAsyncValidationResults();
|
|
3923
3906
|
const value = formState.data[field];
|
|
3924
3907
|
return rule.asyncValidate(formState.data[field], {
|
|
3925
3908
|
state: formState
|
|
@@ -3972,8 +3955,7 @@ const useStaticValidator = (rules2) => {
|
|
|
3972
3955
|
};
|
|
3973
3956
|
};
|
|
3974
3957
|
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema) => {
|
|
3975
|
-
if (!schema.length)
|
|
3976
|
-
return staticValidationErrors;
|
|
3958
|
+
if (!schema.length) return staticValidationErrors;
|
|
3977
3959
|
return schema.reduce((acc, field) => {
|
|
3978
3960
|
var _a;
|
|
3979
3961
|
return {
|
|
@@ -4027,8 +4009,7 @@ function useForm({
|
|
|
4027
4009
|
return (_a = state2.schema) == null ? void 0 : _a.every((key) => state2.valid[key]);
|
|
4028
4010
|
}, [state2.schema, state2.valid]);
|
|
4029
4011
|
const getTargetValue = useCallback((key, e) => {
|
|
4030
|
-
if (!(e == null ? void 0 : e.target))
|
|
4031
|
-
return e;
|
|
4012
|
+
if (!(e == null ? void 0 : e.target)) return e;
|
|
4032
4013
|
if (e.target.type === "checkbox") {
|
|
4033
4014
|
return !state2.data[key];
|
|
4034
4015
|
}
|
|
@@ -4124,8 +4105,7 @@ function useDataset(datasetIdentifier2, skip) {
|
|
|
4124
4105
|
const [dataset, setDataset] = useState([]);
|
|
4125
4106
|
const [loaded, setLoaded] = useState(false);
|
|
4126
4107
|
useEffect(() => {
|
|
4127
|
-
if (skip)
|
|
4128
|
-
return;
|
|
4108
|
+
if (skip) return;
|
|
4129
4109
|
getDataset2(datasetIdentifier2, i18n.locale).then((response) => {
|
|
4130
4110
|
const result = response && response.length ? response : [];
|
|
4131
4111
|
setDataset(result);
|
|
@@ -4288,15 +4268,12 @@ const Field = ({
|
|
|
4288
4268
|
isValid: !!isValid,
|
|
4289
4269
|
onBlurHandler: (e) => {
|
|
4290
4270
|
setIsFocused(false);
|
|
4291
|
-
if (onBlur)
|
|
4292
|
-
|
|
4293
|
-
if (onFieldBlur)
|
|
4294
|
-
onFieldBlur(e);
|
|
4271
|
+
if (onBlur) onBlur(e);
|
|
4272
|
+
if (onFieldBlur) onFieldBlur(e);
|
|
4295
4273
|
},
|
|
4296
4274
|
onFocusHandler: (e) => {
|
|
4297
4275
|
setIsFocused(true);
|
|
4298
|
-
if (onFocus)
|
|
4299
|
-
onFocus(e);
|
|
4276
|
+
if (onFocus) onFocus(e);
|
|
4300
4277
|
},
|
|
4301
4278
|
uniqueId
|
|
4302
4279
|
}), helper && helperPosition === "below" && jsx("span", {
|
|
@@ -4333,13 +4310,11 @@ const Field = ({
|
|
|
4333
4310
|
});
|
|
4334
4311
|
};
|
|
4335
4312
|
const getScrollParent = (node) => {
|
|
4336
|
-
if (!node)
|
|
4337
|
-
return null;
|
|
4313
|
+
if (!node) return null;
|
|
4338
4314
|
const isElement = node instanceof HTMLElement;
|
|
4339
4315
|
const overflowY = isElement && window.getComputedStyle(node).overflowY;
|
|
4340
4316
|
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
|
|
4341
|
-
if (isElement && isScrollable)
|
|
4342
|
-
return node;
|
|
4317
|
+
if (isElement && isScrollable) return node;
|
|
4343
4318
|
return getScrollParent(node.parentNode) ?? document.body;
|
|
4344
4319
|
};
|
|
4345
4320
|
function uuidv4() {
|
|
@@ -4389,11 +4364,10 @@ function SelectButtonElement({
|
|
|
4389
4364
|
isSearch,
|
|
4390
4365
|
...props
|
|
4391
4366
|
}) {
|
|
4392
|
-
if (filterable || isMulti || isSearch)
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
});
|
|
4367
|
+
if (filterable || isMulti || isSearch) return jsx("div", {
|
|
4368
|
+
...props,
|
|
4369
|
+
ref: toggleButtonRef
|
|
4370
|
+
});
|
|
4397
4371
|
return jsx("button", {
|
|
4398
4372
|
...props,
|
|
4399
4373
|
ref: toggleButtonRef,
|
|
@@ -4585,13 +4559,11 @@ const SelectListItem = ({
|
|
|
4585
4559
|
"data-disabled": !!item.disabled,
|
|
4586
4560
|
"data-value": item.id,
|
|
4587
4561
|
onClick: () => {
|
|
4588
|
-
if (item.disabled)
|
|
4589
|
-
return;
|
|
4562
|
+
if (item.disabled) return;
|
|
4590
4563
|
onSelect(!selected);
|
|
4591
4564
|
},
|
|
4592
4565
|
onKeyDown: (e) => {
|
|
4593
|
-
if (item.disabled)
|
|
4594
|
-
return;
|
|
4566
|
+
if (item.disabled) return;
|
|
4595
4567
|
onKeyDown(e);
|
|
4596
4568
|
},
|
|
4597
4569
|
role: "option",
|
|
@@ -4723,8 +4695,7 @@ const Select = ({
|
|
|
4723
4695
|
const closeList = () => {
|
|
4724
4696
|
setTextFilter(null);
|
|
4725
4697
|
setIsShowList(false);
|
|
4726
|
-
if (toggleButtonRef.current)
|
|
4727
|
-
toggleButtonRef.current.focus();
|
|
4698
|
+
if (toggleButtonRef.current) toggleButtonRef.current.focus();
|
|
4728
4699
|
};
|
|
4729
4700
|
const showList = () => {
|
|
4730
4701
|
let sp = scrollParent;
|
|
@@ -4751,8 +4722,7 @@ const Select = ({
|
|
|
4751
4722
|
setIsShowList(false);
|
|
4752
4723
|
};
|
|
4753
4724
|
const handleSelect = (selectedItem) => {
|
|
4754
|
-
if (readonly)
|
|
4755
|
-
return;
|
|
4725
|
+
if (readonly) return;
|
|
4756
4726
|
if (isMulti) {
|
|
4757
4727
|
const isAlreadySelected = active.find((item) => item.id === selectedItem.id);
|
|
4758
4728
|
const newActiveItems = isAlreadySelected ? [...active.filter((i) => i.id !== selectedItem.id).map((i) => i.id)] : [...active.map((i) => i.id), selectedItem.id];
|
|
@@ -4815,8 +4785,7 @@ const Select = ({
|
|
|
4815
4785
|
break;
|
|
4816
4786
|
case KEYBOARD_KEYS.arrowDown:
|
|
4817
4787
|
e.preventDefault();
|
|
4818
|
-
if (target.nextElementSibling)
|
|
4819
|
-
target.nextElementSibling.focus();
|
|
4788
|
+
if (target.nextElementSibling) target.nextElementSibling.focus();
|
|
4820
4789
|
break;
|
|
4821
4790
|
case KEYBOARD_KEYS.arrowUp:
|
|
4822
4791
|
e.preventDefault();
|
|
@@ -5615,8 +5584,7 @@ const tryShift = (matchedTokens, remainingTokens, fromIndex, shiftDistance) => {
|
|
|
5615
5584
|
}
|
|
5616
5585
|
return ((_a = token.allow) == null ? void 0 : _a.test(token.potentialValue)) ?? true;
|
|
5617
5586
|
});
|
|
5618
|
-
if (!allValid)
|
|
5619
|
-
return "notPossible";
|
|
5587
|
+
if (!allValid) return "notPossible";
|
|
5620
5588
|
let matchedUpTo = 0;
|
|
5621
5589
|
for (let i = 0; i < normalizedTokens.length; i += 1) {
|
|
5622
5590
|
const token = normalizedInputTokens.find((t) => t.originalIndex === i) ?? normalizedTokens[i];
|
|
@@ -5651,8 +5619,7 @@ const getAvailableInputTokens = (tokens) => {
|
|
|
5651
5619
|
...token,
|
|
5652
5620
|
offset: tokens.indexOf(token)
|
|
5653
5621
|
});
|
|
5654
|
-
if (token.type !== "input" || !token.optional)
|
|
5655
|
-
break;
|
|
5622
|
+
if (token.type !== "input" || !token.optional) break;
|
|
5656
5623
|
}
|
|
5657
5624
|
return availableTokens;
|
|
5658
5625
|
};
|
|
@@ -5661,13 +5628,10 @@ const getEagerSuffix = (tokens) => {
|
|
|
5661
5628
|
let suffix = "";
|
|
5662
5629
|
for (const token of tokens) {
|
|
5663
5630
|
if (token.type === "input") {
|
|
5664
|
-
if (token.optional)
|
|
5665
|
-
|
|
5666
|
-
else
|
|
5667
|
-
break;
|
|
5631
|
+
if (token.optional) continue;
|
|
5632
|
+
else break;
|
|
5668
5633
|
}
|
|
5669
|
-
if (!token.displayEagerly)
|
|
5670
|
-
break;
|
|
5634
|
+
if (!token.displayEagerly) break;
|
|
5671
5635
|
suffix += token.char;
|
|
5672
5636
|
}
|
|
5673
5637
|
return suffix;
|
|
@@ -5695,12 +5659,11 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5695
5659
|
while (true) {
|
|
5696
5660
|
const char = charsToProcess[0];
|
|
5697
5661
|
const token = tokensToProcess[0];
|
|
5698
|
-
if (!char && !tokensToProcess.some((t) => t.type === "input" && !t.optional))
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
};
|
|
5662
|
+
if (!char && !tokensToProcess.some((t) => t.type === "input" && !t.optional)) return {
|
|
5663
|
+
outcome: "correct",
|
|
5664
|
+
displayValue: displayValue() + getEagerSuffix(tokensToProcess),
|
|
5665
|
+
potentialForMoreOptionalInput: getPotentialForMoreOptionalInput(tokensToProcess)
|
|
5666
|
+
};
|
|
5704
5667
|
if (!char) {
|
|
5705
5668
|
const output = shiftRight(mask.possibleShifts, matchedTokens, tokensToProcess);
|
|
5706
5669
|
matchedTokens = output.matchedTokens;
|
|
@@ -5710,24 +5673,22 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5710
5673
|
displayValue: displayValue() + getEagerSuffix(tokensToProcess)
|
|
5711
5674
|
};
|
|
5712
5675
|
}
|
|
5713
|
-
if (!token)
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
};
|
|
5676
|
+
if (!token) return {
|
|
5677
|
+
outcome: "mismatch",
|
|
5678
|
+
badChar: char,
|
|
5679
|
+
mismatchAtChar: charIndex,
|
|
5680
|
+
mismatchedToken: "inputTooLong",
|
|
5681
|
+
partialDisplayValue: displayValue()
|
|
5682
|
+
};
|
|
5721
5683
|
if (token.type === "nonInput") {
|
|
5722
5684
|
if (token.includeInValue) {
|
|
5723
|
-
if (char !== token.char)
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
};
|
|
5685
|
+
if (char !== token.char) return {
|
|
5686
|
+
outcome: "mismatch",
|
|
5687
|
+
badChar: char,
|
|
5688
|
+
mismatchAtChar: charIndex,
|
|
5689
|
+
mismatchedToken: token,
|
|
5690
|
+
partialDisplayValue: displayValue()
|
|
5691
|
+
};
|
|
5731
5692
|
shiftChars(1);
|
|
5732
5693
|
}
|
|
5733
5694
|
matchedTokens.push(token);
|
|
@@ -5736,14 +5697,13 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5736
5697
|
if (token.type === "input") {
|
|
5737
5698
|
const availableTokens = getAvailableInputTokens(tokensToProcess);
|
|
5738
5699
|
const matchingToken = findMatchingToken(availableTokens, char);
|
|
5739
|
-
if (!matchingToken)
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
};
|
|
5700
|
+
if (!matchingToken) return {
|
|
5701
|
+
outcome: "mismatch",
|
|
5702
|
+
badChar: char,
|
|
5703
|
+
mismatchAtChar: charIndex,
|
|
5704
|
+
mismatchedToken: token,
|
|
5705
|
+
partialDisplayValue: displayValue()
|
|
5706
|
+
};
|
|
5747
5707
|
matchedTokens.push({
|
|
5748
5708
|
...matchingToken,
|
|
5749
5709
|
char
|
|
@@ -5754,30 +5714,26 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5754
5714
|
}
|
|
5755
5715
|
};
|
|
5756
5716
|
const deriveInputState = (isValid, isFocused, hasBlurred, isDisabled, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
|
|
5757
|
-
if (isDisabled)
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
return {
|
|
5778
|
-
isError: true,
|
|
5779
|
-
text: typeof errorMessage === "string" && errorMessage ? errorMessage : formatGuidance
|
|
5780
|
-
};
|
|
5717
|
+
if (isDisabled) return {
|
|
5718
|
+
isError: false
|
|
5719
|
+
};
|
|
5720
|
+
if (isValid && (!potentiallyMoreOptionalCharacters || !isFocused)) return {
|
|
5721
|
+
isError: false,
|
|
5722
|
+
text: jsxs(Fragment, {
|
|
5723
|
+
children: [jsx(Icon, {
|
|
5724
|
+
name: "checkmark-small",
|
|
5725
|
+
className: "adyen-kyc-helper-text__valid-format-check"
|
|
5726
|
+
}), i18n.get("formatIsCorrect")]
|
|
5727
|
+
})
|
|
5728
|
+
};
|
|
5729
|
+
if (isFocused && formatGuidance) return {
|
|
5730
|
+
isError: false,
|
|
5731
|
+
text: formatGuidance
|
|
5732
|
+
};
|
|
5733
|
+
if (!isValid && (shouldValidate || hasBlurred)) return {
|
|
5734
|
+
isError: true,
|
|
5735
|
+
text: typeof errorMessage === "string" && errorMessage ? errorMessage : formatGuidance
|
|
5736
|
+
};
|
|
5781
5737
|
return {
|
|
5782
5738
|
isError: false
|
|
5783
5739
|
};
|
|
@@ -5813,12 +5769,10 @@ const MaskedInputText = ({
|
|
|
5813
5769
|
i18n
|
|
5814
5770
|
} = useI18nContext();
|
|
5815
5771
|
const onMismatch = (mismatch) => {
|
|
5816
|
-
if (!inputRef.current)
|
|
5817
|
-
return;
|
|
5772
|
+
if (!inputRef.current) return;
|
|
5818
5773
|
setShowingMismatch(true);
|
|
5819
5774
|
inputRef.current.addEventListener("animationend", (event) => {
|
|
5820
|
-
if (event.animationName !== MISMATCH_ANIMATION_NAME)
|
|
5821
|
-
return;
|
|
5775
|
+
if (event.animationName !== MISMATCH_ANIMATION_NAME) return;
|
|
5822
5776
|
setShowingMismatch(false);
|
|
5823
5777
|
});
|
|
5824
5778
|
onMismatchExternal == null ? void 0 : onMismatchExternal(mismatch);
|
|
@@ -5829,16 +5783,14 @@ const MaskedInputText = ({
|
|
|
5829
5783
|
}
|
|
5830
5784
|
}, [mask]);
|
|
5831
5785
|
const getMaskResult = useCallback((pureValue) => {
|
|
5832
|
-
if (!mask)
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
};
|
|
5786
|
+
if (!mask) return {
|
|
5787
|
+
outcome: "partialCorrect",
|
|
5788
|
+
displayValue: pureValue
|
|
5789
|
+
};
|
|
5837
5790
|
return matchAgainstMask(transformOnType ? transformOnType(pureValue) : pureValue, mask, acceptObscuredValue);
|
|
5838
5791
|
}, [mask, transformOnType, acceptObscuredValue]);
|
|
5839
5792
|
const displayValueToPure = useCallback((displayValue2) => {
|
|
5840
|
-
if (!mask)
|
|
5841
|
-
return displayValue2;
|
|
5793
|
+
if (!mask) return displayValue2;
|
|
5842
5794
|
return displayValueToPureValue(displayValue2, mask);
|
|
5843
5795
|
}, [mask]);
|
|
5844
5796
|
const maskResult = useMemo(() => getMaskResult(value), [getMaskResult, value]);
|
|
@@ -5868,8 +5820,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5868
5820
|
const newPureValue = displayValueToPure(inputEl.value);
|
|
5869
5821
|
const newMaskResult = getMaskResult(newPureValue);
|
|
5870
5822
|
const returnCaretLater = (offset = 0) => {
|
|
5871
|
-
if (!inputEl.selectionStart)
|
|
5872
|
-
return;
|
|
5823
|
+
if (!inputEl.selectionStart) return;
|
|
5873
5824
|
setCaretReturnPosition(inputEl.selectionStart + offset);
|
|
5874
5825
|
};
|
|
5875
5826
|
const cancelInput = () => {
|
|
@@ -5914,8 +5865,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5914
5865
|
selectionStart,
|
|
5915
5866
|
selectionEnd
|
|
5916
5867
|
} = inputEl;
|
|
5917
|
-
if (!pasteValue || !selectionStart || selectionStart !== selectionEnd)
|
|
5918
|
-
return;
|
|
5868
|
+
if (!pasteValue || !selectionStart || selectionStart !== selectionEnd) return;
|
|
5919
5869
|
const pureDisplayValue = displayValueToPure(displayValue);
|
|
5920
5870
|
const purePasteValue = displayValueToPure(pasteValue);
|
|
5921
5871
|
const newPureValue = pureDisplayValue.slice(0, selectionStart) + purePasteValue + pureDisplayValue.slice(selectionStart);
|
|
@@ -5934,8 +5884,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5934
5884
|
onKeyDown: (event) => {
|
|
5935
5885
|
const inputEl = event.target;
|
|
5936
5886
|
const isCaretAtEndWithNoSelection = inputEl.selectionStart === inputEl.value.length && inputEl.selectionStart === inputEl.selectionEnd;
|
|
5937
|
-
if (event.key !== KEYBOARD_KEYS.backspace || !isCaretAtEndWithNoSelection)
|
|
5938
|
-
return;
|
|
5887
|
+
if (event.key !== KEYBOARD_KEYS.backspace || !isCaretAtEndWithNoSelection) return;
|
|
5939
5888
|
event.preventDefault();
|
|
5940
5889
|
const withLastCharRemoved = value.slice(0, value.length - 1);
|
|
5941
5890
|
const newMaskResult = getMaskResult(withLastCharRemoved);
|
|
@@ -6072,8 +6021,7 @@ const companyRegistrationNumberOptions = {
|
|
|
6072
6021
|
};
|
|
6073
6022
|
const getCompanyRegistrationNumberOptions = (country2, companyType2) => {
|
|
6074
6023
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
6075
|
-
if (!companyType2 || !optionsForCountry)
|
|
6076
|
-
return optionsForCountry;
|
|
6024
|
+
if (!companyType2 || !optionsForCountry) return optionsForCountry;
|
|
6077
6025
|
return optionsForCountry.filter((option) => {
|
|
6078
6026
|
var _a;
|
|
6079
6027
|
return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
|
|
@@ -6139,8 +6087,7 @@ const taxIdNumberOptions = {
|
|
|
6139
6087
|
};
|
|
6140
6088
|
const getTaxIdNumberOptions = (country2, companyType2) => {
|
|
6141
6089
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
6142
|
-
if (!companyType2 || !optionsForCountry)
|
|
6143
|
-
return optionsForCountry;
|
|
6090
|
+
if (!companyType2 || !optionsForCountry) return optionsForCountry;
|
|
6144
6091
|
return optionsForCountry.filter((option) => {
|
|
6145
6092
|
var _a;
|
|
6146
6093
|
return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
|
|
@@ -6168,8 +6115,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
6168
6115
|
}, [exemptedOption, setSelected]);
|
|
6169
6116
|
const options = useMemo(() => {
|
|
6170
6117
|
const availableOptions = getCompanyRegistrationNumberOptions(country2, companyType2) ?? [];
|
|
6171
|
-
if (availableOptions.length === 0 || !exemptedOption)
|
|
6172
|
-
return availableOptions;
|
|
6118
|
+
if (availableOptions.length === 0 || !exemptedOption) return availableOptions;
|
|
6173
6119
|
return [...availableOptions, {
|
|
6174
6120
|
id: "exempted",
|
|
6175
6121
|
name: exemptedOption
|
|
@@ -6180,8 +6126,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
6180
6126
|
setSelected(options[0].id);
|
|
6181
6127
|
}
|
|
6182
6128
|
}, [options, selected, setSelected]);
|
|
6183
|
-
if (options.length <= 1)
|
|
6184
|
-
return null;
|
|
6129
|
+
if (options.length <= 1) return null;
|
|
6185
6130
|
return jsx(Field, {
|
|
6186
6131
|
name: "companyRegistrationNumberType",
|
|
6187
6132
|
label: i18n.get("whichTypeOfRegistrationNumberDoYouHave"),
|
|
@@ -7392,15 +7337,13 @@ const defaultFieldConfig$8 = {
|
|
|
7392
7337
|
const inferCompanyRegistrationNumberType = (registrationNumber2, country2, companyType2) => {
|
|
7393
7338
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
7394
7339
|
const metadataFn = defaultFieldConfig$8[country2];
|
|
7395
|
-
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
7396
|
-
return void 0;
|
|
7340
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function") return void 0;
|
|
7397
7341
|
for (const option of optionsForCountry) {
|
|
7398
7342
|
const fieldMetadata = metadataFn({
|
|
7399
7343
|
companyType: companyType2,
|
|
7400
7344
|
registrationNumberType: option.id
|
|
7401
7345
|
});
|
|
7402
|
-
if (!fieldMetadata.validators)
|
|
7403
|
-
continue;
|
|
7346
|
+
if (!fieldMetadata.validators) continue;
|
|
7404
7347
|
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
7405
7348
|
if (validators.every((validator) => validator.validate(registrationNumber2))) {
|
|
7406
7349
|
return option.id;
|
|
@@ -8692,15 +8635,13 @@ const defaultFieldConfig$6 = {
|
|
|
8692
8635
|
const inferTaxIdNumberType = (taxId2, country2) => {
|
|
8693
8636
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
8694
8637
|
const metadataFn = defaultFieldConfig$6[country2] ?? defaultFieldConfig$7[country2];
|
|
8695
|
-
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
8696
|
-
return void 0;
|
|
8638
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function") return void 0;
|
|
8697
8639
|
for (const option of optionsForCountry) {
|
|
8698
8640
|
const fieldMetadata = metadataFn({
|
|
8699
8641
|
taxIdNumberType: option.id,
|
|
8700
8642
|
vatNumberType: option.id
|
|
8701
8643
|
});
|
|
8702
|
-
if (!fieldMetadata.validators)
|
|
8703
|
-
continue;
|
|
8644
|
+
if (!fieldMetadata.validators) continue;
|
|
8704
8645
|
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
8705
8646
|
if (validators.every((validator) => validator.validate(taxId2))) {
|
|
8706
8647
|
return option.id;
|
|
@@ -8729,8 +8670,7 @@ function TaxIdNumberTypeSelector({
|
|
|
8729
8670
|
}, [exemptedOption, setSelected]);
|
|
8730
8671
|
const options = useMemo(() => {
|
|
8731
8672
|
const availableOptions = getTaxIdNumberOptions(country2, companyType2) ?? [];
|
|
8732
|
-
if (availableOptions.length === 0 || !exemptedOption)
|
|
8733
|
-
return availableOptions;
|
|
8673
|
+
if (availableOptions.length === 0 || !exemptedOption) return availableOptions;
|
|
8734
8674
|
return [...availableOptions, {
|
|
8735
8675
|
id: "exempted",
|
|
8736
8676
|
name: exemptedOption
|
|
@@ -8741,8 +8681,7 @@ function TaxIdNumberTypeSelector({
|
|
|
8741
8681
|
handleSelect(options[0].id);
|
|
8742
8682
|
}
|
|
8743
8683
|
}, [options, selected, handleSelect]);
|
|
8744
|
-
if (options.length <= 1)
|
|
8745
|
-
return null;
|
|
8684
|
+
if (options.length <= 1) return null;
|
|
8746
8685
|
return jsx(Field, {
|
|
8747
8686
|
name: "taxIdNumberType",
|
|
8748
8687
|
label: i18n.get("whichTypeOfTaxIdNumberDoYouHave"),
|
|
@@ -8964,8 +8903,7 @@ function VatNumber(props) {
|
|
|
8964
8903
|
}
|
|
8965
8904
|
});
|
|
8966
8905
|
}, [data, valid, errors, isValid]);
|
|
8967
|
-
if (!formUtils.isRequiredField("vatNumber"))
|
|
8968
|
-
return null;
|
|
8906
|
+
if (!formUtils.isRequiredField("vatNumber")) return null;
|
|
8969
8907
|
const exemptionIsPossible = ((_b = mergedProps.requiredFields) == null ? void 0 : _b.includes("exemptedFromVat")) ?? false;
|
|
8970
8908
|
const showTaxIdExemptedOption = exemptionIsPossible && ((_c = taxIdNumberOptions[country2]) == null ? void 0 : _c.length) > 1;
|
|
8971
8909
|
const handleTaxIdNumberTypeChange = (taxIdType) => {
|
|
@@ -9913,10 +9851,9 @@ const EntityTypeSelectionRadioCardBody = ({
|
|
|
9913
9851
|
const {
|
|
9914
9852
|
i18n
|
|
9915
9853
|
} = useI18nContext();
|
|
9916
|
-
if (!examples)
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
});
|
|
9854
|
+
if (!examples) return jsx("span", {
|
|
9855
|
+
children: i18n.get(description2)
|
|
9856
|
+
});
|
|
9920
9857
|
return jsxs(Fragment, {
|
|
9921
9858
|
children: [jsx("span", {
|
|
9922
9859
|
className: "adyen-kyc-entity-type-radio-group-card__description",
|
|
@@ -9935,8 +9872,7 @@ const EntityTypeSelectionRadioCardBody = ({
|
|
|
9935
9872
|
const CoreContext = createContext(void 0);
|
|
9936
9873
|
const useCoreContext = () => {
|
|
9937
9874
|
const context = useContext(CoreContext);
|
|
9938
|
-
if (!context)
|
|
9939
|
-
throw Error("You need a <CoreProvider> to use core context");
|
|
9875
|
+
if (!context) throw Error("You need a <CoreProvider> to use core context");
|
|
9940
9876
|
return context;
|
|
9941
9877
|
};
|
|
9942
9878
|
var TrustMemberTypes = /* @__PURE__ */ ((TrustMemberTypes2) => {
|
|
@@ -10149,22 +10085,17 @@ function getNestedPropertyKeys(obj, includeUndefined = false) {
|
|
|
10149
10085
|
return fieldNames;
|
|
10150
10086
|
}
|
|
10151
10087
|
const getTaskStatus = (type, capabilityProblems, rootLegalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
|
|
10152
|
-
if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity))
|
|
10153
|
-
return TaskStatus.EMPTY;
|
|
10088
|
+
if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity)) return TaskStatus.EMPTY;
|
|
10154
10089
|
const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
|
|
10155
|
-
if (importantCapabilityStatus)
|
|
10156
|
-
|
|
10157
|
-
if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity))
|
|
10158
|
-
return TaskStatus.PROCESSING;
|
|
10090
|
+
if (importantCapabilityStatus) return importantCapabilityStatus;
|
|
10091
|
+
if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity)) return TaskStatus.PROCESSING;
|
|
10159
10092
|
return TaskStatus.FINISHED;
|
|
10160
10093
|
};
|
|
10161
10094
|
const IMPORTANT_STATUSES = [TaskStatus.DETAILS_REQUIRED, TaskStatus.DOWNLOAD, TaskStatus.ERROR, TaskStatus.PROCESSING];
|
|
10162
10095
|
function checkForImportantCapabilityStatus(type, capabilityProblems, entityIds) {
|
|
10163
|
-
if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds)
|
|
10164
|
-
return;
|
|
10096
|
+
if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds) return;
|
|
10165
10097
|
const importantStatuses = Object.entries(capabilityProblems[type]).filter(([key]) => entityIds.includes(key)).map(([, value]) => value.status).filter((status) => status !== void 0 && IMPORTANT_STATUSES.includes(status));
|
|
10166
|
-
if (!importantStatuses.length)
|
|
10167
|
-
return;
|
|
10098
|
+
if (!importantStatuses.length) return;
|
|
10168
10099
|
return importantStatuses.reduce((prev, curr) => curr > prev ? curr : prev);
|
|
10169
10100
|
}
|
|
10170
10101
|
const hasPendingCapabilities = (legalEntityResponse) => Object.values(legalEntityResponse.capabilities ?? {}).some((capability) => capability.verificationStatus === "pending");
|
|
@@ -10183,14 +10114,11 @@ const emptyFieldsByEntityType = {
|
|
|
10183
10114
|
function isEmptyEntity(legalEntity) {
|
|
10184
10115
|
var _a;
|
|
10185
10116
|
const type = legalEntity == null ? void 0 : legalEntity.type;
|
|
10186
|
-
if (!type)
|
|
10187
|
-
|
|
10188
|
-
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length)
|
|
10189
|
-
return false;
|
|
10117
|
+
if (!type) return true;
|
|
10118
|
+
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) return false;
|
|
10190
10119
|
const minimumFields = emptyFieldsByEntityType[type];
|
|
10191
10120
|
const typeSpecificSection = legalEntity[type];
|
|
10192
|
-
if (!typeSpecificSection)
|
|
10193
|
-
return true;
|
|
10121
|
+
if (!typeSpecificSection) return true;
|
|
10194
10122
|
const fieldsOnEntity = getNestedPropertyKeys(typeSpecificSection);
|
|
10195
10123
|
return !fieldsOnEntity.some((field) => !minimumFields.includes(field));
|
|
10196
10124
|
}
|
|
@@ -10205,8 +10133,7 @@ const getDefaultAccountHolderType = (legalEntityResponse, isTypeChanging = false
|
|
|
10205
10133
|
if (accountHolder2) {
|
|
10206
10134
|
return accountHolder2;
|
|
10207
10135
|
}
|
|
10208
|
-
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.type))
|
|
10209
|
-
return void 0;
|
|
10136
|
+
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.type)) return void 0;
|
|
10210
10137
|
if (hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id)) {
|
|
10211
10138
|
return "mySoleProprietorName";
|
|
10212
10139
|
}
|
|
@@ -10577,82 +10504,48 @@ function DocumentGuidance({
|
|
|
10577
10504
|
useEffect(() => {
|
|
10578
10505
|
setGuidancePrefix(getDocumentGuidancePrefix(type));
|
|
10579
10506
|
}, [type]);
|
|
10507
|
+
const documentGuidanceItems = useMemo(() => [{
|
|
10508
|
+
type: "valid",
|
|
10509
|
+
translationKey: "good"
|
|
10510
|
+
}, {
|
|
10511
|
+
type: "invalid-cut",
|
|
10512
|
+
translationKey: "notCutOff"
|
|
10513
|
+
}, {
|
|
10514
|
+
type: "invalid-blur",
|
|
10515
|
+
translationKey: "notBlurry"
|
|
10516
|
+
}, guidancePrefix === "generic-document" ? {
|
|
10517
|
+
type: "invalid-expired",
|
|
10518
|
+
translationKey: "notExpired"
|
|
10519
|
+
} : {
|
|
10520
|
+
type: "invalid-glare",
|
|
10521
|
+
translationKey: "noGlare"
|
|
10522
|
+
}], [guidancePrefix]);
|
|
10580
10523
|
return jsx("div", {
|
|
10581
10524
|
className: cx("adl-document-guidance", className),
|
|
10582
|
-
children:
|
|
10525
|
+
children: jsx("div", {
|
|
10583
10526
|
className: "adl-document-guidance__container",
|
|
10584
|
-
children:
|
|
10585
|
-
className: "adl-document-guidance__item",
|
|
10586
|
-
children: [jsx("svg", {
|
|
10587
|
-
width: "100%",
|
|
10588
|
-
role: "img",
|
|
10589
|
-
children: jsx("use", {
|
|
10590
|
-
href: `#adl-${guidancePrefix}-valid`
|
|
10591
|
-
})
|
|
10592
|
-
}), jsx("span", {
|
|
10593
|
-
className: "adl-document-guidance__description",
|
|
10594
|
-
children: i18n.get("good")
|
|
10595
|
-
})]
|
|
10596
|
-
}), jsxs("div", {
|
|
10597
|
-
className: "adl-document-guidance__item",
|
|
10598
|
-
children: [jsx("svg", {
|
|
10599
|
-
width: "100%",
|
|
10600
|
-
role: "img",
|
|
10601
|
-
children: jsx("use", {
|
|
10602
|
-
href: `#adl-${guidancePrefix}-invalid-cut`
|
|
10603
|
-
})
|
|
10604
|
-
}), jsx("span", {
|
|
10605
|
-
className: "adl-document-guidance__description",
|
|
10606
|
-
children: i18n.get("notCutOff")
|
|
10607
|
-
})]
|
|
10608
|
-
}), jsxs("div", {
|
|
10527
|
+
children: documentGuidanceItems.map((item) => jsxs("div", {
|
|
10609
10528
|
className: "adl-document-guidance__item",
|
|
10610
10529
|
children: [jsx("svg", {
|
|
10611
10530
|
width: "100%",
|
|
10531
|
+
height: "100%",
|
|
10612
10532
|
role: "img",
|
|
10613
10533
|
children: jsx("use", {
|
|
10614
|
-
href: `#adl-${guidancePrefix}
|
|
10534
|
+
href: `#adl-${guidancePrefix}-${item.type}`
|
|
10615
10535
|
})
|
|
10616
10536
|
}), jsx("span", {
|
|
10617
10537
|
className: "adl-document-guidance__description",
|
|
10618
|
-
children: i18n.get(
|
|
10538
|
+
children: i18n.get(item.translationKey)
|
|
10619
10539
|
})]
|
|
10620
|
-
}
|
|
10621
|
-
className: "adl-document-guidance__item",
|
|
10622
|
-
children: guidancePrefix === "generic-document" ? jsxs(Fragment, {
|
|
10623
|
-
children: [jsx("svg", {
|
|
10624
|
-
width: "100%",
|
|
10625
|
-
role: "img",
|
|
10626
|
-
children: jsx("use", {
|
|
10627
|
-
href: `#adl-${guidancePrefix}-invalid-expired`
|
|
10628
|
-
})
|
|
10629
|
-
}), jsx("span", {
|
|
10630
|
-
className: "adl-document-guidance__description",
|
|
10631
|
-
children: i18n.get("notExpired")
|
|
10632
|
-
})]
|
|
10633
|
-
}) : jsxs(Fragment, {
|
|
10634
|
-
children: [jsx("svg", {
|
|
10635
|
-
width: "100%",
|
|
10636
|
-
role: "img",
|
|
10637
|
-
children: jsx("use", {
|
|
10638
|
-
href: `#adl-${guidancePrefix}-invalid-glare`
|
|
10639
|
-
})
|
|
10640
|
-
}), jsx("span", {
|
|
10641
|
-
className: "adl-document-guidance__description",
|
|
10642
|
-
children: i18n.get("noGlare")
|
|
10643
|
-
})]
|
|
10644
|
-
})
|
|
10645
|
-
})]
|
|
10540
|
+
}, item.type))
|
|
10646
10541
|
})
|
|
10647
10542
|
});
|
|
10648
10543
|
}
|
|
10649
10544
|
function bytesToSize(bytes) {
|
|
10650
10545
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
10651
|
-
if (bytes === 0)
|
|
10652
|
-
return "n/a";
|
|
10546
|
+
if (bytes === 0) return "n/a";
|
|
10653
10547
|
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
|
|
10654
|
-
if (i === 0)
|
|
10655
|
-
return `${bytes} ${sizes[i]}`;
|
|
10548
|
+
if (i === 0) return `${bytes} ${sizes[i]}`;
|
|
10656
10549
|
return `${(bytes / 1024 ** i).toFixed()} ${sizes[i]}`;
|
|
10657
10550
|
}
|
|
10658
10551
|
const isExistingFile = (file) => "existing" in file && file.existing;
|
|
@@ -10669,11 +10562,9 @@ function DropzoneFile(props) {
|
|
|
10669
10562
|
} = useI18nContext();
|
|
10670
10563
|
const formatSize = (bytes) => {
|
|
10671
10564
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
10672
|
-
if (!bytes || bytes === 0)
|
|
10673
|
-
return "n/a";
|
|
10565
|
+
if (!bytes || bytes === 0) return "n/a";
|
|
10674
10566
|
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
|
|
10675
|
-
if (i === 0)
|
|
10676
|
-
return `${bytes} ${sizes[i]}`;
|
|
10567
|
+
if (i === 0) return `${bytes} ${sizes[i]}`;
|
|
10677
10568
|
return `${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]}`;
|
|
10678
10569
|
};
|
|
10679
10570
|
return jsxs("div", {
|
|
@@ -10729,40 +10620,35 @@ const fileValidationRules = ({
|
|
|
10729
10620
|
isOptional
|
|
10730
10621
|
}) => [{
|
|
10731
10622
|
validate: (files) => {
|
|
10732
|
-
if (isOptional && (!files || files.length === 0))
|
|
10733
|
-
return true;
|
|
10623
|
+
if (isOptional && (!files || files.length === 0)) return true;
|
|
10734
10624
|
return Boolean(files && files.length > 0);
|
|
10735
10625
|
},
|
|
10736
10626
|
errorMessage: "fieldIsRequired",
|
|
10737
10627
|
modes: ["blur", "input"]
|
|
10738
10628
|
}, {
|
|
10739
10629
|
validate: (files) => {
|
|
10740
|
-
if (!files)
|
|
10741
|
-
return true;
|
|
10630
|
+
if (!files) return true;
|
|
10742
10631
|
return files.length <= maxNumberOfFiles;
|
|
10743
10632
|
},
|
|
10744
10633
|
errorMessage: "tooManyFiles",
|
|
10745
10634
|
modes: ["blur", "input"]
|
|
10746
10635
|
}, {
|
|
10747
10636
|
validate: (files) => {
|
|
10748
|
-
if (!files)
|
|
10749
|
-
return true;
|
|
10637
|
+
if (!files) return true;
|
|
10750
10638
|
return !hasDuplicates(files.map((file) => file.name));
|
|
10751
10639
|
},
|
|
10752
10640
|
errorMessage: "duplicatedFiles",
|
|
10753
10641
|
modes: ["blur", "input"]
|
|
10754
10642
|
}, {
|
|
10755
10643
|
validate: (files) => {
|
|
10756
|
-
if (!files)
|
|
10757
|
-
return true;
|
|
10644
|
+
if (!files) return true;
|
|
10758
10645
|
return filterOnlyNewlyUploadedFiles(files).every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
|
|
10759
10646
|
},
|
|
10760
10647
|
errorMessage: "unsupportedFiletype",
|
|
10761
10648
|
modes: ["blur", "input"]
|
|
10762
10649
|
}, {
|
|
10763
10650
|
validate: (files) => {
|
|
10764
|
-
if (!files)
|
|
10765
|
-
return true;
|
|
10651
|
+
if (!files) return true;
|
|
10766
10652
|
return filterOnlyNewlyUploadedFiles(files).every((file) => !file.size || file.size < maxSize);
|
|
10767
10653
|
},
|
|
10768
10654
|
errorMessage: "maximumFileSizeExceeded",
|
|
@@ -11084,10 +10970,9 @@ function DocumentUploadComponent({
|
|
|
11084
10970
|
}, [data, valid, errors, fieldProblems]);
|
|
11085
10971
|
useEffect(() => {
|
|
11086
10972
|
var _a2, _b;
|
|
11087
|
-
if (documentField)
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
});
|
|
10973
|
+
if (documentField) setDocument({
|
|
10974
|
+
[documentField]: (_a2 = props == null ? void 0 : props.data) == null ? void 0 : _a2[documentField]
|
|
10975
|
+
});
|
|
11091
10976
|
setData("description", (_b = props.data) == null ? void 0 : _b.description);
|
|
11092
10977
|
triggerValidation();
|
|
11093
10978
|
}, [props.data]);
|
|
@@ -11184,7 +11069,8 @@ function ListItem({
|
|
|
11184
11069
|
const ADDRESS_SCHEMA = ["address", "otherAddressInformation", "postalCode", "city", "stateOrProvince", "country"];
|
|
11185
11070
|
const [ADDRESS, OTHER_ADDRESS_INFORMATION, POSTAL_CODE, CITY, STATE, COUNTRY] = ADDRESS_SCHEMA;
|
|
11186
11071
|
const COUNTRIES_WITH_STATES_DATASET = [CountryCodes.Australia, CountryCodes.Brazil, CountryCodes.Canada, CountryCodes.NewZealand, CountryCodes.UnitedStates];
|
|
11187
|
-
const COUNTRIES_WITH_HOUSE_NUMBER_FIRST = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.NewZealand, CountryCodes.PuertoRico, CountryCodes.UnitedStates, CountryCodes.UnitedKingdom];
|
|
11072
|
+
const COUNTRIES_WITH_HOUSE_NUMBER_FIRST = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.NewZealand, CountryCodes.PuertoRico, CountryCodes.UnitedStates, CountryCodes.UnitedKingdom, CountryCodes.France];
|
|
11073
|
+
const COUNTRIES_WITH_COMMA_SEPARATED = [CountryCodes.Spain];
|
|
11188
11074
|
const ADDRESS_SCHEMAS = {
|
|
11189
11075
|
[CountryCodes.Australia]: [COUNTRY, ADDRESS, OTHER_ADDRESS_INFORMATION, CITY, STATE, POSTAL_CODE],
|
|
11190
11076
|
[CountryCodes.Canada]: [COUNTRY, ADDRESS, OTHER_ADDRESS_INFORMATION, CITY, POSTAL_CODE, STATE],
|
|
@@ -11292,8 +11178,7 @@ function StateField({
|
|
|
11292
11178
|
} = useDataset(datasetIdentifier.state(selectedCountry), !selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry));
|
|
11293
11179
|
const labelKey = getKeyForField("stateOrProvince", selectedCountry);
|
|
11294
11180
|
const placeholderKey = getKeyForField("stateOrProvincePlaceholder", selectedCountry);
|
|
11295
|
-
if (!loaded || !states.length)
|
|
11296
|
-
return null;
|
|
11181
|
+
if (!loaded || !states.length) return null;
|
|
11297
11182
|
return jsx(Field, {
|
|
11298
11183
|
name: "stateOrProvince",
|
|
11299
11184
|
label: (labels2 == null ? void 0 : labels2.stateOrProvince) || i18n.get(labelKey),
|
|
@@ -11407,14 +11292,12 @@ function useIsElementVisible(ref, fallback = true) {
|
|
|
11407
11292
|
const [isOnScreen, setIsOnScreen] = useState(isIntersectionObserverSupported ? false : fallback);
|
|
11408
11293
|
const observerRef = useRef();
|
|
11409
11294
|
useEffect(() => {
|
|
11410
|
-
if (!isIntersectionObserverSupported)
|
|
11411
|
-
return;
|
|
11295
|
+
if (!isIntersectionObserverSupported) return;
|
|
11412
11296
|
observerRef.current = new IntersectionObserver(([entry]) => setIsOnScreen(entry.isIntersecting));
|
|
11413
11297
|
}, []);
|
|
11414
11298
|
useEffect(() => {
|
|
11415
11299
|
var _a;
|
|
11416
|
-
if (!ref.current)
|
|
11417
|
-
return;
|
|
11300
|
+
if (!ref.current) return;
|
|
11418
11301
|
(_a = observerRef.current) == null ? void 0 : _a.observe(ref.current);
|
|
11419
11302
|
return () => {
|
|
11420
11303
|
var _a2;
|
|
@@ -11850,8 +11733,7 @@ const countrySpecificFormatters = {
|
|
|
11850
11733
|
postalCode: {
|
|
11851
11734
|
// Formatter - excludes non digits & hyphens and limits to a maxlength that varies depending on whether a hyphen is present or not
|
|
11852
11735
|
formatter: (val) => {
|
|
11853
|
-
if (!val)
|
|
11854
|
-
return void 0;
|
|
11736
|
+
if (!val) return void 0;
|
|
11855
11737
|
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
11856
11738
|
const maxlength = nuVal.includes("-") ? 6 : 5;
|
|
11857
11739
|
return nuVal.substring(0, maxlength);
|
|
@@ -11863,8 +11745,7 @@ const countrySpecificFormatters = {
|
|
|
11863
11745
|
[CountryCodes.Portugal]: {
|
|
11864
11746
|
postalCode: {
|
|
11865
11747
|
formatter: (val) => {
|
|
11866
|
-
if (!val)
|
|
11867
|
-
return void 0;
|
|
11748
|
+
if (!val) return void 0;
|
|
11868
11749
|
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
11869
11750
|
return nuVal.substring(0, 8);
|
|
11870
11751
|
},
|
|
@@ -12082,8 +11963,7 @@ function Address(props) {
|
|
|
12082
11963
|
}
|
|
12083
11964
|
}, [shouldValidate]);
|
|
12084
11965
|
const getComponent = (fieldName) => {
|
|
12085
|
-
if (!formUtils.isRequiredField(fieldName))
|
|
12086
|
-
return null;
|
|
11966
|
+
if (!formUtils.isRequiredField(fieldName)) return null;
|
|
12087
11967
|
const hideField = fieldName === "country" && hideCountry;
|
|
12088
11968
|
return jsx(FieldContainer, {
|
|
12089
11969
|
classNameModifiers: [fieldName],
|
|
@@ -12093,7 +11973,7 @@ function Address(props) {
|
|
|
12093
11973
|
fieldProblems,
|
|
12094
11974
|
fieldName,
|
|
12095
11975
|
handleChangeFor,
|
|
12096
|
-
maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country
|
|
11976
|
+
maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country),
|
|
12097
11977
|
hideField,
|
|
12098
11978
|
"aria-label": formUtils.getLabel(fieldName, fieldName),
|
|
12099
11979
|
trimOnBlur: true
|
|
@@ -12104,8 +11984,12 @@ function Address(props) {
|
|
|
12104
11984
|
houseNumberOrName,
|
|
12105
11985
|
street: street2
|
|
12106
11986
|
}) => {
|
|
12107
|
-
const
|
|
12108
|
-
const
|
|
11987
|
+
const isHouseNumberFirst = COUNTRIES_WITH_HOUSE_NUMBER_FIRST.includes(data.country);
|
|
11988
|
+
const needsComma = COUNTRIES_WITH_COMMA_SEPARATED.includes(data.country);
|
|
11989
|
+
let formattedAddress = isHouseNumberFirst ? `${houseNumberOrName} ${street2}` : `${street2} ${houseNumberOrName}`;
|
|
11990
|
+
if (needsComma) {
|
|
11991
|
+
formattedAddress = formattedAddress.replace(" ", ", ");
|
|
11992
|
+
}
|
|
12109
11993
|
handleChangeFor("address", "input")(formattedAddress);
|
|
12110
11994
|
};
|
|
12111
11995
|
const setFieldsData = (address2, field) => {
|
|
@@ -12841,8 +12725,7 @@ const uploadDocuments = async (documents2, entityId) => {
|
|
|
12841
12725
|
return documentStore[entityId];
|
|
12842
12726
|
};
|
|
12843
12727
|
const updateEntityDocuments = (uploadedDocuments, entityId) => {
|
|
12844
|
-
if (!documentStore[entityId])
|
|
12845
|
-
documentStore[entityId] = [];
|
|
12728
|
+
if (!documentStore[entityId]) documentStore[entityId] = [];
|
|
12846
12729
|
uploadedDocuments.forEach((uploadedDocument) => {
|
|
12847
12730
|
if (uploadedDocument) {
|
|
12848
12731
|
const existingDocumentIndex = documentStore[entityId].findIndex((document2) => document2.id === uploadedDocument.id);
|
|
@@ -13647,11 +13530,9 @@ const mapSolePropToLegalEntity = (data) => {
|
|
|
13647
13530
|
const getPage = ({
|
|
13648
13531
|
attachments
|
|
13649
13532
|
}, pageType) => {
|
|
13650
|
-
if (!attachments)
|
|
13651
|
-
throw Error("Document has no attachments");
|
|
13533
|
+
if (!attachments) throw Error("Document has no attachments");
|
|
13652
13534
|
const attachment = pageType ? attachments.find((attach) => attach.pageType === pageType) : attachments[0];
|
|
13653
|
-
if (!attachment)
|
|
13654
|
-
throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
13535
|
+
if (!attachment) throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
13655
13536
|
return attachment;
|
|
13656
13537
|
};
|
|
13657
13538
|
const getPageName = (document2, pageType) => getPage(document2, pageType).pageName;
|
|
@@ -14047,8 +13928,7 @@ const useIdVerificationToken = ({
|
|
|
14047
13928
|
const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
|
|
14048
13929
|
useEffect(() => {
|
|
14049
13930
|
(async () => {
|
|
14050
|
-
if (!hasAllUserDetails)
|
|
14051
|
-
return;
|
|
13931
|
+
if (!hasAllUserDetails) return;
|
|
14052
13932
|
try {
|
|
14053
13933
|
setLoadingStatus("loading");
|
|
14054
13934
|
const data = {
|
|
@@ -14209,8 +14089,7 @@ function IdVerificationComponent({
|
|
|
14209
14089
|
const onfidoSdk = useRef();
|
|
14210
14090
|
useEffect(() => {
|
|
14211
14091
|
(async () => {
|
|
14212
|
-
if (!sdkToken2)
|
|
14213
|
-
return;
|
|
14092
|
+
if (!sdkToken2) return;
|
|
14214
14093
|
onfidoSdk.current = await initOnfido({
|
|
14215
14094
|
token: sdkToken2,
|
|
14216
14095
|
i18n,
|
|
@@ -14220,13 +14099,11 @@ function IdVerificationComponent({
|
|
|
14220
14099
|
});
|
|
14221
14100
|
})().catch(logger$m.error);
|
|
14222
14101
|
return () => {
|
|
14223
|
-
if (onfidoSdk.current)
|
|
14224
|
-
onfidoSdk.current.tearDown();
|
|
14102
|
+
if (onfidoSdk.current) onfidoSdk.current.tearDown();
|
|
14225
14103
|
};
|
|
14226
14104
|
}, [sdkToken2]);
|
|
14227
14105
|
useEffect(() => {
|
|
14228
|
-
if (!onfidoSdk.current)
|
|
14229
|
-
return;
|
|
14106
|
+
if (!onfidoSdk.current) return;
|
|
14230
14107
|
onfidoSdk.current.setOptions({
|
|
14231
14108
|
language: getOnfidoLocaleConfig(i18n)
|
|
14232
14109
|
});
|
|
@@ -14392,8 +14269,7 @@ const layoutBreakpointSizes = {
|
|
|
14392
14269
|
const getBreakpointClassNames = (containerSize) => {
|
|
14393
14270
|
const breakPoints = Object.entries(layoutBreakpointSizes);
|
|
14394
14271
|
const classes = breakPoints.reduce((acc, [bp, size]) => {
|
|
14395
|
-
if (size <= containerSize)
|
|
14396
|
-
acc.push(layoutBreakpointClassnames[bp]);
|
|
14272
|
+
if (size <= containerSize) acc.push(layoutBreakpointClassnames[bp]);
|
|
14397
14273
|
return acc;
|
|
14398
14274
|
}, []);
|
|
14399
14275
|
return classes.length > 0 ? classes : ["adyen-layout-xs-only"];
|
|
@@ -14418,8 +14294,7 @@ const AutoResizer = ({
|
|
|
14418
14294
|
const containerRef = useRef(null);
|
|
14419
14295
|
useEffect(() => {
|
|
14420
14296
|
const container = containerRef.current;
|
|
14421
|
-
if (!container)
|
|
14422
|
-
return;
|
|
14297
|
+
if (!container) return;
|
|
14423
14298
|
const resizeObserver = new ResizeObserver((entries) => assignLayoutClasses(entries, container));
|
|
14424
14299
|
resizeObserver.observe(container);
|
|
14425
14300
|
return () => resizeObserver.unobserve(container);
|
|
@@ -14664,8 +14539,7 @@ function useVerification(fieldsToVerify, country2) {
|
|
|
14664
14539
|
const verificationPromises = [];
|
|
14665
14540
|
fieldsToVerify.forEach((field) => {
|
|
14666
14541
|
if (field === "idNumber" && formState.data[field]) {
|
|
14667
|
-
if (formState.data[field] === savedData[field] || country2 === "US" && formState.data[field].length === 4)
|
|
14668
|
-
return;
|
|
14542
|
+
if (formState.data[field] === savedData[field] || country2 === "US" && formState.data[field].length === 4) return;
|
|
14669
14543
|
const request = {
|
|
14670
14544
|
name: {
|
|
14671
14545
|
firstName: formState.data.firstName,
|
|
@@ -14701,10 +14575,8 @@ function InputTelephone(props) {
|
|
|
14701
14575
|
const staticPhoneValidationRules = (phonePrefixes, defaultPrefix) => ({
|
|
14702
14576
|
phoneNumber: {
|
|
14703
14577
|
validate: (phoneNumber2) => {
|
|
14704
|
-
if (!phoneNumber2)
|
|
14705
|
-
|
|
14706
|
-
if (!phonePrefixes.length)
|
|
14707
|
-
return phoneNumber2.startsWith("+");
|
|
14578
|
+
if (!phoneNumber2) return false;
|
|
14579
|
+
if (!phonePrefixes.length) return phoneNumber2.startsWith("+");
|
|
14708
14580
|
return phonePrefixes.map((prefix) => prefix.name).some((name) => phoneNumber2.startsWith(name));
|
|
14709
14581
|
},
|
|
14710
14582
|
errorMessage: {
|
|
@@ -14724,8 +14596,7 @@ const useAsyncPhoneValidationRules = () => {
|
|
|
14724
14596
|
phoneNumber: {
|
|
14725
14597
|
asyncValidate: async (phoneNumber2) => {
|
|
14726
14598
|
var _a;
|
|
14727
|
-
if (!phoneNumber2)
|
|
14728
|
-
return false;
|
|
14599
|
+
if (!phoneNumber2) return false;
|
|
14729
14600
|
return (_a = await validatePhoneNumber2(phoneNumber2)) == null ? void 0 : _a.valid;
|
|
14730
14601
|
},
|
|
14731
14602
|
errorMessage: "invalidPhoneNumber",
|
|
@@ -15454,8 +15325,7 @@ function IdentityNumberComponent(props) {
|
|
|
15454
15325
|
...data
|
|
15455
15326
|
};
|
|
15456
15327
|
adjustedData.idNumber = data.idNumberExempt ? void 0 : data.idNumber;
|
|
15457
|
-
if (data.idNumberExempt && formErrors.idNumber !== null)
|
|
15458
|
-
setFormErrors("idNumber", null);
|
|
15328
|
+
if (data.idNumberExempt && formErrors.idNumber !== null) setFormErrors("idNumber", null);
|
|
15459
15329
|
(_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
|
|
15460
15330
|
type: "addToState",
|
|
15461
15331
|
value: {
|
|
@@ -15575,8 +15445,7 @@ const getRoleName = (role2) => {
|
|
|
15575
15445
|
};
|
|
15576
15446
|
const makeSelectItemForRole = (role2, i18n) => {
|
|
15577
15447
|
const metadata = roleMetadata[role2];
|
|
15578
|
-
if (!metadata)
|
|
15579
|
-
throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
|
|
15448
|
+
if (!metadata) throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
|
|
15580
15449
|
const {
|
|
15581
15450
|
name,
|
|
15582
15451
|
description: description2,
|
|
@@ -15590,11 +15459,9 @@ const makeSelectItemForRole = (role2, i18n) => {
|
|
|
15590
15459
|
};
|
|
15591
15460
|
};
|
|
15592
15461
|
const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
|
|
15593
|
-
if (propagationMode === "stop")
|
|
15594
|
-
event.stopPropagation();
|
|
15462
|
+
if (propagationMode === "stop") event.stopPropagation();
|
|
15595
15463
|
if (keys.includes(event.key)) {
|
|
15596
|
-
if (propagationMode === "stopIfMatches")
|
|
15597
|
-
event.stopPropagation();
|
|
15464
|
+
if (propagationMode === "stopIfMatches") event.stopPropagation();
|
|
15598
15465
|
callback();
|
|
15599
15466
|
}
|
|
15600
15467
|
};
|
|
@@ -15723,8 +15590,7 @@ function IndividualIdNumberTypeSelector({
|
|
|
15723
15590
|
setSelected(options[0].id);
|
|
15724
15591
|
}
|
|
15725
15592
|
}, [options, selected, setSelected]);
|
|
15726
|
-
if (options.length <= 1)
|
|
15727
|
-
return null;
|
|
15593
|
+
if (options.length <= 1) return null;
|
|
15728
15594
|
return jsx(Field, {
|
|
15729
15595
|
name: "individualIdNumberType",
|
|
15730
15596
|
label: i18n.get("whichTypeOfIdNumberDoYouHave"),
|
|
@@ -17167,14 +17033,12 @@ function FilePicker({
|
|
|
17167
17033
|
const handleDrop = (e) => {
|
|
17168
17034
|
e.preventDefault();
|
|
17169
17035
|
e.stopPropagation();
|
|
17170
|
-
if (e.dataTransfer)
|
|
17171
|
-
addFiles(e.dataTransfer.files);
|
|
17036
|
+
if (e.dataTransfer) addFiles(e.dataTransfer.files);
|
|
17172
17037
|
setDragged(false);
|
|
17173
17038
|
};
|
|
17174
17039
|
const handleFilesChosen = (e) => {
|
|
17175
17040
|
const fileInput2 = e.target;
|
|
17176
|
-
if (fileInput2.files)
|
|
17177
|
-
addFiles(fileInput2.files);
|
|
17041
|
+
if (fileInput2.files) addFiles(fileInput2.files);
|
|
17178
17042
|
};
|
|
17179
17043
|
const addFiles = (newFiles) => {
|
|
17180
17044
|
setFiles([...newFiles, ...files]);
|
|
@@ -17255,7 +17119,6 @@ var BankDocumentTypes = /* @__PURE__ */ ((BankDocumentTypes2) => {
|
|
|
17255
17119
|
BankDocumentTypes2["SCREENSHOT_OF_BANK"] = "screenshotOfOnlineBankingEnviroment";
|
|
17256
17120
|
BankDocumentTypes2["OFFICIAL_EMAIL"] = "officialEmailOrALetterFromYourBank";
|
|
17257
17121
|
BankDocumentTypes2["CHECK"] = "check";
|
|
17258
|
-
BankDocumentTypes2["RELEVE_DIDENTITE"] = "releveDidentiteBancaire";
|
|
17259
17122
|
return BankDocumentTypes2;
|
|
17260
17123
|
})(BankDocumentTypes || {});
|
|
17261
17124
|
const bankDocumentOptions = [{
|
|
@@ -17273,9 +17136,6 @@ const bankDocumentOptions = [{
|
|
|
17273
17136
|
}, {
|
|
17274
17137
|
id: "check",
|
|
17275
17138
|
name: "check"
|
|
17276
|
-
}, {
|
|
17277
|
-
id: "releveDidentiteBancaire",
|
|
17278
|
-
name: "releveDidentiteBancaire"
|
|
17279
17139
|
}];
|
|
17280
17140
|
var BankDocumentRequirement = /* @__PURE__ */ ((BankDocumentRequirement2) => {
|
|
17281
17141
|
BankDocumentRequirement2["ACCOUNT_NAME_INDIVIDUAL"] = "bankAccountNameIndividual";
|
|
@@ -17507,8 +17367,7 @@ function BankDocument(props) {
|
|
|
17507
17367
|
var _a2;
|
|
17508
17368
|
if (hasAlreadyUploadedDocuments) {
|
|
17509
17369
|
setData("bankStatementDocument", alreadyUploadedDocuments);
|
|
17510
|
-
if ((_a2 = props.data) == null ? void 0 : _a2.description)
|
|
17511
|
-
setData("description", props.data.description);
|
|
17370
|
+
if ((_a2 = props.data) == null ? void 0 : _a2.description) setData("description", props.data.description);
|
|
17512
17371
|
triggerValidation();
|
|
17513
17372
|
}
|
|
17514
17373
|
}, [alreadyUploadedDocuments, hasAlreadyUploadedDocuments, (_b = props.data) == null ? void 0 : _b.description, setData, triggerValidation]);
|
|
@@ -17527,19 +17386,13 @@ function BankDocument(props) {
|
|
|
17527
17386
|
}
|
|
17528
17387
|
});
|
|
17529
17388
|
}, [data, valid, errors, fieldProblems]);
|
|
17530
|
-
const getBankDocumentOptions = () => {
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
name
|
|
17538
|
-
}) => ({
|
|
17539
|
-
id: id2,
|
|
17540
|
-
name: i18n.get(name)
|
|
17541
|
-
}));
|
|
17542
|
-
};
|
|
17389
|
+
const getBankDocumentOptions = () => bankDocumentOptions.map(({
|
|
17390
|
+
id: id2,
|
|
17391
|
+
name
|
|
17392
|
+
}) => ({
|
|
17393
|
+
id: id2,
|
|
17394
|
+
name: i18n.get(name)
|
|
17395
|
+
}));
|
|
17543
17396
|
const documentsModifiers = useMemo(() => {
|
|
17544
17397
|
var _a2, _b2;
|
|
17545
17398
|
return {
|
|
@@ -17953,12 +17806,10 @@ const httpPost = async (options, data) => http({
|
|
|
17953
17806
|
}, data);
|
|
17954
17807
|
const removeElementSiblings = (element) => {
|
|
17955
17808
|
const parent = element.parentNode;
|
|
17956
|
-
if (!parent)
|
|
17957
|
-
return;
|
|
17809
|
+
if (!parent) return;
|
|
17958
17810
|
let child = parent.firstChild;
|
|
17959
17811
|
while (child) {
|
|
17960
|
-
if (child !== element)
|
|
17961
|
-
parent.removeChild(child);
|
|
17812
|
+
if (child !== element) parent.removeChild(child);
|
|
17962
17813
|
child = child.nextSibling;
|
|
17963
17814
|
}
|
|
17964
17815
|
};
|
|
@@ -17972,8 +17823,7 @@ const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(dat
|
|
|
17972
17823
|
const parseMessageJson = (message) => {
|
|
17973
17824
|
try {
|
|
17974
17825
|
const messageData = JSON.parse(message);
|
|
17975
|
-
if (!RELEVANT_MESSAGE_TYPES.includes(messageData.type))
|
|
17976
|
-
return "invalid";
|
|
17826
|
+
if (!RELEVANT_MESSAGE_TYPES.includes(messageData.type)) return "invalid";
|
|
17977
17827
|
return messageData;
|
|
17978
17828
|
} catch {
|
|
17979
17829
|
return "invalid";
|
|
@@ -18000,8 +17850,7 @@ class IFrameWidget {
|
|
|
18000
17850
|
this.listener = async (message) => {
|
|
18001
17851
|
try {
|
|
18002
17852
|
const result = await this.handleMessage(message);
|
|
18003
|
-
if (!result)
|
|
18004
|
-
return;
|
|
17853
|
+
if (!result) return;
|
|
18005
17854
|
resolve(result);
|
|
18006
17855
|
} catch (err) {
|
|
18007
17856
|
reject(err);
|
|
@@ -18020,8 +17869,7 @@ class IFrameWidget {
|
|
|
18020
17869
|
this.sdkToken = sdkToken2;
|
|
18021
17870
|
}
|
|
18022
17871
|
removeMessageEventListener() {
|
|
18023
|
-
if (!this.listener)
|
|
18024
|
-
return;
|
|
17872
|
+
if (!this.listener) return;
|
|
18025
17873
|
window.removeEventListener("message", this.listener);
|
|
18026
17874
|
this.listener = void 0;
|
|
18027
17875
|
}
|
|
@@ -18030,19 +17878,16 @@ class IFrameWidget {
|
|
|
18030
17878
|
origin,
|
|
18031
17879
|
source
|
|
18032
17880
|
}) {
|
|
18033
|
-
if (source !== this.iframeWindow || origin !== this.iframeUrl.origin)
|
|
18034
|
-
return;
|
|
17881
|
+
if (source !== this.iframeWindow || origin !== this.iframeUrl.origin) return;
|
|
18035
17882
|
if (this.vendor !== TINK_VENDOR && isTerminalMessageData(data)) {
|
|
18036
17883
|
if (Object.getOwnPropertyNames(data).includes("error")) {
|
|
18037
17884
|
throw data;
|
|
18038
17885
|
}
|
|
18039
17886
|
return data;
|
|
18040
17887
|
}
|
|
18041
|
-
if (!isString(data))
|
|
18042
|
-
return;
|
|
17888
|
+
if (!isString(data)) return;
|
|
18043
17889
|
const jsonData = parseMessageJson(data);
|
|
18044
|
-
if (jsonData === "invalid")
|
|
18045
|
-
return;
|
|
17890
|
+
if (jsonData === "invalid") return;
|
|
18046
17891
|
const httpOptions = {
|
|
18047
17892
|
errorHandler: callbackErrorHandler,
|
|
18048
17893
|
loadingContext: "",
|
|
@@ -18064,8 +17909,7 @@ class IFrameWidget {
|
|
|
18064
17909
|
...httpOptions,
|
|
18065
17910
|
path: redirectUrl.href
|
|
18066
17911
|
});
|
|
18067
|
-
if (isVerifiedAccountsData(responseData))
|
|
18068
|
-
return responseData;
|
|
17912
|
+
if (isVerifiedAccountsData(responseData)) return responseData;
|
|
18069
17913
|
throw responseData;
|
|
18070
17914
|
} catch (reason) {
|
|
18071
17915
|
throw new AdyenKycSdkError("WIDGET_ACCOUNT_COMMIT_FAILURE", reason);
|
|
@@ -18124,8 +17968,7 @@ class IFrameWidget {
|
|
|
18124
17968
|
reject(new AdyenKycSdkError("WIDGET_TIMEOUT"));
|
|
18125
17969
|
}, MOUNT_TIMEOUT);
|
|
18126
17970
|
const cancelTimeout = () => {
|
|
18127
|
-
if (timeoutId)
|
|
18128
|
-
clearTimeout(timeoutId);
|
|
17971
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
18129
17972
|
};
|
|
18130
17973
|
this.iframeElement.addEventListener("load", () => {
|
|
18131
17974
|
cancelTimeout();
|
|
@@ -18297,8 +18140,6 @@ const useInstantVerificationErrorNotification = (notificationVisibilityDuration)
|
|
|
18297
18140
|
useEffect(() => {
|
|
18298
18141
|
clearNotificationTimeout();
|
|
18299
18142
|
if (errorNotification) {
|
|
18300
|
-
if (notificationVisibilityDuration <= 0)
|
|
18301
|
-
return;
|
|
18302
18143
|
dismissNotificationTimeoutRef.current = setTimeout(() => {
|
|
18303
18144
|
setErrorNotification(null);
|
|
18304
18145
|
clearNotificationTimeout();
|
|
@@ -18364,8 +18205,7 @@ function InstantBankVerification({
|
|
|
18364
18205
|
content: errorContent
|
|
18365
18206
|
});
|
|
18366
18207
|
}
|
|
18367
|
-
if (onBack)
|
|
18368
|
-
onBack();
|
|
18208
|
+
if (onBack) onBack();
|
|
18369
18209
|
break;
|
|
18370
18210
|
}
|
|
18371
18211
|
case "retry_verification":
|
|
@@ -18373,8 +18213,7 @@ function InstantBankVerification({
|
|
|
18373
18213
|
title: i18n.get("failedInitializeInstantVerification"),
|
|
18374
18214
|
content: errorContent
|
|
18375
18215
|
});
|
|
18376
|
-
if (onBack)
|
|
18377
|
-
onBack();
|
|
18216
|
+
if (onBack) onBack();
|
|
18378
18217
|
break;
|
|
18379
18218
|
default: {
|
|
18380
18219
|
const {
|
|
@@ -19161,8 +19000,7 @@ const customPrefixByCountry = {
|
|
|
19161
19000
|
[CountryCodes.IsleOfMan]: "GB"
|
|
19162
19001
|
};
|
|
19163
19002
|
function ibanValidator(input, bankCountry2) {
|
|
19164
|
-
if (isEmpty(input))
|
|
19165
|
-
return false;
|
|
19003
|
+
if (isEmpty(input)) return false;
|
|
19166
19004
|
const ibanInput = input.replace(/ /g, "").toUpperCase();
|
|
19167
19005
|
if (!/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(ibanInput)) {
|
|
19168
19006
|
return false;
|
|
@@ -19558,7 +19396,7 @@ const regions = {
|
|
|
19558
19396
|
const getAllowedBankCountries = (country2) => Object.values(regions).find((countriesInARegion) => countriesInARegion.includes(country2)) ?? [country2];
|
|
19559
19397
|
const makePayoutVerificationMethodsMetadata = (svgPath, instantVerificationProvider) => ({
|
|
19560
19398
|
instantVerification: {
|
|
19561
|
-
name: "
|
|
19399
|
+
name: "verifyViaMobileBankingAppOrWebsite",
|
|
19562
19400
|
subtitle: "instant",
|
|
19563
19401
|
description: "instantVerificationDescription",
|
|
19564
19402
|
iconComponentDesktop: `${svgPath}/instant-verification-desktop.svg`,
|
|
@@ -19569,8 +19407,8 @@ const makePayoutVerificationMethodsMetadata = (svgPath, instantVerificationProvi
|
|
|
19569
19407
|
} : void 0
|
|
19570
19408
|
},
|
|
19571
19409
|
manualVerification: {
|
|
19572
|
-
name: "
|
|
19573
|
-
subtitle: "
|
|
19410
|
+
name: "uploadABankStatement",
|
|
19411
|
+
subtitle: "mayTakeAFewDays",
|
|
19574
19412
|
description: "manualVerificationDescription",
|
|
19575
19413
|
iconComponentDesktop: `${svgPath}/manual-verification-desktop.svg`,
|
|
19576
19414
|
iconComponentMobile: `${svgPath}/manual-verification-mobile.svg`
|
|
@@ -19721,11 +19559,9 @@ const getMustHaveSameAccountHolderNameText = (legalEntityType, accountHolderName
|
|
|
19721
19559
|
}
|
|
19722
19560
|
};
|
|
19723
19561
|
const getInstantVerificationProvider = (bankVerificationProviders, bankCountry2) => {
|
|
19724
|
-
if (!bankVerificationProviders)
|
|
19725
|
-
return "loading";
|
|
19562
|
+
if (!bankVerificationProviders) return "loading";
|
|
19726
19563
|
const providerForCountry = bankVerificationProviders[bankCountry2];
|
|
19727
|
-
if (!providerForCountry)
|
|
19728
|
-
return void 0;
|
|
19564
|
+
if (!providerForCountry) return void 0;
|
|
19729
19565
|
return providerForCountry.toLowerCase();
|
|
19730
19566
|
};
|
|
19731
19567
|
function PayoutVerificationMethod(props) {
|
|
@@ -20434,11 +20270,15 @@ const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
|
|
|
20434
20270
|
roleTypes: [DecisionMakerType.DIRECTOR],
|
|
20435
20271
|
min: 1,
|
|
20436
20272
|
max: Infinity
|
|
20273
|
+
}],
|
|
20274
|
+
GB: [...DEFAULT_DECISION_MAKER_REQUIREMENTS, {
|
|
20275
|
+
roleTypes: [DecisionMakerType.DIRECTOR],
|
|
20276
|
+
min: 1,
|
|
20277
|
+
max: Infinity
|
|
20437
20278
|
}]
|
|
20438
20279
|
};
|
|
20439
20280
|
const getDecisionMakerRequirements = (country2) => {
|
|
20440
|
-
if (!country2)
|
|
20441
|
-
return DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20281
|
+
if (!country2) return DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20442
20282
|
return PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] ?? DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20443
20283
|
};
|
|
20444
20284
|
function getAvailableDecisionMakerRoleTypes(country2) {
|
|
@@ -20468,8 +20308,7 @@ const getDecisionMakerDescriptionMap = (country2) => ({
|
|
|
20468
20308
|
...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
|
|
20469
20309
|
});
|
|
20470
20310
|
const getOwnDecisionMakers = (rootLegalEntity) => {
|
|
20471
|
-
if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations))
|
|
20472
|
-
return [];
|
|
20311
|
+
if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations)) return [];
|
|
20473
20312
|
return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(DecisionMakerType).includes(entityAssociation.type) && entityAssociation.associatorId === rootLegalEntity.id);
|
|
20474
20313
|
};
|
|
20475
20314
|
const getDecisionMakers = (rootLegalEntity, companyLegalEntityId) => getDirectEntityAssociations(rootLegalEntity, companyLegalEntityId).filter((association2) => Object.values(DecisionMakerType).includes(association2.type));
|
|
@@ -20526,8 +20365,7 @@ const isPartOfTrustFromLegalEntity = (legalEntity) => {
|
|
|
20526
20365
|
};
|
|
20527
20366
|
const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
|
|
20528
20367
|
const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
|
|
20529
|
-
if (!trustLegalEntityId)
|
|
20530
|
-
return [];
|
|
20368
|
+
if (!trustLegalEntityId) return [];
|
|
20531
20369
|
const trustMemberAssociations = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId);
|
|
20532
20370
|
const trustMemberIds = trustMemberAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
|
|
20533
20371
|
return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
|
|
@@ -20701,8 +20539,7 @@ function TrustRegistrationDetailsComponent(props) {
|
|
|
20701
20539
|
classNameModifiers: ["country"],
|
|
20702
20540
|
handleChangeFor: () => (e) => {
|
|
20703
20541
|
handleChangeFor("country", "input")(e);
|
|
20704
|
-
if (onCountryChange)
|
|
20705
|
-
onCountryChange(e);
|
|
20542
|
+
if (onCountryChange) onCountryChange(e);
|
|
20706
20543
|
}
|
|
20707
20544
|
}), formUtils.isRequiredField("legalName") && jsx(Field, {
|
|
20708
20545
|
name: "legalName",
|
|
@@ -21661,8 +21498,7 @@ const getOpeningStep = (forms2, remediationActions) => {
|
|
|
21661
21498
|
var _a2;
|
|
21662
21499
|
return (form2 == null ? void 0 : form2.formId) === ((_a2 = allRemediationActions[0]) == null ? void 0 : _a2.forms[0]);
|
|
21663
21500
|
});
|
|
21664
|
-
if (form)
|
|
21665
|
-
return form;
|
|
21501
|
+
if (form) return form;
|
|
21666
21502
|
}
|
|
21667
21503
|
return forms2[forms2.length - 1];
|
|
21668
21504
|
}
|
|
@@ -21695,8 +21531,7 @@ const useFormComposer = ({
|
|
|
21695
21531
|
}) => formId === activeForm2.formId) ?? activeForm2);
|
|
21696
21532
|
}, [forms2]);
|
|
21697
21533
|
useEffect(() => {
|
|
21698
|
-
if (hasAlreadyNavigatedForm)
|
|
21699
|
-
return;
|
|
21534
|
+
if (hasAlreadyNavigatedForm) return;
|
|
21700
21535
|
const openingStep = getOpeningStep(forms2, problems == null ? void 0 : problems.remediationActions);
|
|
21701
21536
|
if (activeForm !== openingStep) {
|
|
21702
21537
|
setActiveForm(openingStep);
|
|
@@ -21875,14 +21710,12 @@ const useScenarioConfiguration = ({
|
|
|
21875
21710
|
}, [getConfigurationData, setLoadingStatus]);
|
|
21876
21711
|
useEffect(() => {
|
|
21877
21712
|
setLoadingStatus("loading");
|
|
21878
|
-
if (!getPayoutAccountFormatData)
|
|
21879
|
-
return;
|
|
21713
|
+
if (!getPayoutAccountFormatData) return;
|
|
21880
21714
|
const makePayoutFormatCallAndSave = async () => {
|
|
21881
21715
|
try {
|
|
21882
21716
|
const response = await getPayoutAccountFormatData();
|
|
21883
21717
|
setAccountFormatResponse(response);
|
|
21884
|
-
if (!response)
|
|
21885
|
-
return;
|
|
21718
|
+
if (!response) return;
|
|
21886
21719
|
const allowedBankAccountFormats = Object.keys(response);
|
|
21887
21720
|
if (existingBankAccountFormat && !allowedBankAccountFormats.includes(existingBankAccountFormat)) {
|
|
21888
21721
|
throw new AdyenKycSdkError(`Account format, ${existingBankAccountFormat}, of transferInstrument is not in allowed formats for ${country2}`);
|
|
@@ -21902,8 +21735,7 @@ const useScenarioConfiguration = ({
|
|
|
21902
21735
|
bankVerificationVendors,
|
|
21903
21736
|
requiredFields
|
|
21904
21737
|
} = useMemo(() => {
|
|
21905
|
-
if (!configurationResponse)
|
|
21906
|
-
return {};
|
|
21738
|
+
if (!configurationResponse) return {};
|
|
21907
21739
|
const {
|
|
21908
21740
|
matchingScenario,
|
|
21909
21741
|
bankVerificationProviders
|
|
@@ -22199,8 +22031,7 @@ function parsePayoutScenarios({
|
|
|
22199
22031
|
country: country2,
|
|
22200
22032
|
bankVerificationAvailable
|
|
22201
22033
|
}) {
|
|
22202
|
-
if (!requiredFields)
|
|
22203
|
-
return;
|
|
22034
|
+
if (!requiredFields) return;
|
|
22204
22035
|
const fieldConfigurations = {};
|
|
22205
22036
|
fieldConfigurations.payoutVerificationMethod = {
|
|
22206
22037
|
rule: "REQUIRED"
|
|
@@ -22492,8 +22323,7 @@ const getFieldsWithExistingData = (legalEntity, isExperimentEnabled) => {
|
|
|
22492
22323
|
var _a;
|
|
22493
22324
|
const apiFieldsWithExistingData = getNestedPropertyKeys(legalEntity);
|
|
22494
22325
|
const legalEntityType = legalEntity.type;
|
|
22495
|
-
if (!legalEntityType)
|
|
22496
|
-
return [];
|
|
22326
|
+
if (!legalEntityType) return [];
|
|
22497
22327
|
const nonDocumentFields = apiFieldsWithExistingData.map((field) => convertApiFieldNameToSchemaFieldName(field, legalEntityType, isExperimentEnabled)).filter((field) => field !== void 0).filter((field) => !knownProblematicFields.includes(field));
|
|
22498
22328
|
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) {
|
|
22499
22329
|
const documentFields = legalEntity.documentDetails.map((document2) => legalEntityDocumentToFieldMapping[legalEntityType][document2.type]).filter((field) => field !== void 0);
|
|
@@ -22769,8 +22599,7 @@ function FormNavigation({
|
|
|
22769
22599
|
} = useI18nContext();
|
|
22770
22600
|
const getFormIndex = (form) => forms2.findIndex((f) => f.formId === form.formId);
|
|
22771
22601
|
const goToForm = (form) => () => {
|
|
22772
|
-
if (form.formId === activeForm.formId)
|
|
22773
|
-
return;
|
|
22602
|
+
if (form.formId === activeForm.formId) return;
|
|
22774
22603
|
gotoForm(getFormIndex(form));
|
|
22775
22604
|
trackNavigation2({
|
|
22776
22605
|
fromForm: form,
|
|
@@ -23065,8 +22894,7 @@ function CompanyDropinComponent({
|
|
|
23065
22894
|
legalEntity,
|
|
23066
22895
|
dataSubmitted
|
|
23067
22896
|
}) => {
|
|
23068
|
-
if (!isDocumentsRequired$2(forms22))
|
|
23069
|
-
return;
|
|
22897
|
+
if (!isDocumentsRequired$2(forms22)) return;
|
|
23070
22898
|
const formattedDocument = await mapCompanyDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
23071
22899
|
if (formattedDocument) {
|
|
23072
22900
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
@@ -23346,8 +23174,7 @@ function useCompanySearch({
|
|
|
23346
23174
|
deepSearch
|
|
23347
23175
|
}) => {
|
|
23348
23176
|
try {
|
|
23349
|
-
if (!deepSearch)
|
|
23350
|
-
return;
|
|
23177
|
+
if (!deepSearch) return;
|
|
23351
23178
|
setStatus("loading");
|
|
23352
23179
|
setCompaniesList([]);
|
|
23353
23180
|
const {
|
|
@@ -23371,8 +23198,7 @@ function useCompanySearch({
|
|
|
23371
23198
|
return setStatus("idle");
|
|
23372
23199
|
}
|
|
23373
23200
|
try {
|
|
23374
|
-
if (!handleCompanyDeepSearch)
|
|
23375
|
-
return;
|
|
23201
|
+
if (!handleCompanyDeepSearch) return;
|
|
23376
23202
|
setStatus("loading");
|
|
23377
23203
|
setSelectedCompanyId(void 0);
|
|
23378
23204
|
const {
|
|
@@ -23393,8 +23219,7 @@ function useCompanySearch({
|
|
|
23393
23219
|
}, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
|
|
23394
23220
|
const verify2 = useCallback(async (companyTIN, company2) => {
|
|
23395
23221
|
try {
|
|
23396
|
-
if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset)
|
|
23397
|
-
return;
|
|
23222
|
+
if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
|
|
23398
23223
|
setStatus("loading");
|
|
23399
23224
|
setSelectedCompanyId(company2.id);
|
|
23400
23225
|
if (!canVerify || !companyTIN) {
|
|
@@ -23560,10 +23385,8 @@ const CompanyLookupResultsHeader = ({
|
|
|
23560
23385
|
if (status === "loading") {
|
|
23561
23386
|
return selectedCompanyId ? i18n.get("companyLookupResultsHeader__verifying") : i18n.get("companyLookupResultsHeader__searching");
|
|
23562
23387
|
}
|
|
23563
|
-
if (numberOfResults === 0 && status === "loaded")
|
|
23564
|
-
|
|
23565
|
-
if (numberOfResults)
|
|
23566
|
-
return i18n.get("companyLookupResultsHeader__results");
|
|
23388
|
+
if (numberOfResults === 0 && status === "loaded") return i18n.get("companyLookupResultsHeader__noResults");
|
|
23389
|
+
if (numberOfResults) return i18n.get("companyLookupResultsHeader__results");
|
|
23567
23390
|
return i18n.get("companyLookupResultsHeader");
|
|
23568
23391
|
}, [hasInternalError, status, numberOfResults, i18n, selectedCompanyId]);
|
|
23569
23392
|
const descriptionText = useMemo(() => {
|
|
@@ -23964,8 +23787,7 @@ function TaxInformationField({
|
|
|
23964
23787
|
type: countryToTaxInfoTypeMap[country2]
|
|
23965
23788
|
}];
|
|
23966
23789
|
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
23967
|
-
if (taxInfo.country !== country2)
|
|
23968
|
-
return taxInfo;
|
|
23790
|
+
if (taxInfo.country !== country2) return taxInfo;
|
|
23969
23791
|
return {
|
|
23970
23792
|
country: country2,
|
|
23971
23793
|
number: value,
|
|
@@ -23992,8 +23814,7 @@ function TaxInformationField({
|
|
|
23992
23814
|
type: countryToTaxInfoTypeMap[country2]
|
|
23993
23815
|
}];
|
|
23994
23816
|
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
23995
|
-
if (taxInfo.country !== country2)
|
|
23996
|
-
return taxInfo;
|
|
23817
|
+
if (taxInfo.country !== country2) return taxInfo;
|
|
23997
23818
|
return {
|
|
23998
23819
|
country: country2,
|
|
23999
23820
|
number: value,
|
|
@@ -24074,8 +23895,7 @@ const defaultFieldConfig = entriesOf(defaultFieldConfig$7).reduce((fieldConfig,
|
|
|
24074
23895
|
errorMessage: (taxInformation) => {
|
|
24075
23896
|
var _a;
|
|
24076
23897
|
const taxIdNumber2 = (_a = taxInformation == null ? void 0 : taxInformation.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _a.number;
|
|
24077
|
-
if (!taxIdNumber2)
|
|
24078
|
-
return void 0;
|
|
23898
|
+
if (!taxIdNumber2) return void 0;
|
|
24079
23899
|
return typeof validator.errorMessage === "function" ? validator.errorMessage(taxIdNumber2) : validator.errorMessage;
|
|
24080
23900
|
}
|
|
24081
23901
|
}));
|
|
@@ -25009,8 +24829,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25009
24829
|
}, defaultFieldMetadata).label;
|
|
25010
24830
|
return entriesOf(data).reduce((summaryData, [form, formData]) => {
|
|
25011
24831
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
25012
|
-
if (!form)
|
|
25013
|
-
return summaryData;
|
|
24832
|
+
if (!form) return summaryData;
|
|
25014
24833
|
switch (form) {
|
|
25015
24834
|
case "companyBasics":
|
|
25016
24835
|
return {
|
|
@@ -25044,8 +24863,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25044
24863
|
[form]: formatOtherDetails(formData, i18n, (_f = data.companyBasics) == null ? void 0 : _f.country, labels2)
|
|
25045
24864
|
};
|
|
25046
24865
|
case "companyRegistrationDocument":
|
|
25047
|
-
if (!isDocumentsRequired$1(forms2))
|
|
25048
|
-
return summaryData;
|
|
24866
|
+
if (!isDocumentsRequired$1(forms2)) return summaryData;
|
|
25049
24867
|
return {
|
|
25050
24868
|
...summaryData,
|
|
25051
24869
|
[form]: {
|
|
@@ -25055,8 +24873,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25055
24873
|
}
|
|
25056
24874
|
};
|
|
25057
24875
|
case "companyTaxDocument":
|
|
25058
|
-
if (!isDocumentsRequired$1(forms2))
|
|
25059
|
-
return summaryData;
|
|
24876
|
+
if (!isDocumentsRequired$1(forms2)) return summaryData;
|
|
25060
24877
|
return {
|
|
25061
24878
|
...summaryData,
|
|
25062
24879
|
[form]: {
|
|
@@ -25299,8 +25116,7 @@ function useCompanySearchTaskSubmit({
|
|
|
25299
25116
|
legalEntity,
|
|
25300
25117
|
currentForms
|
|
25301
25118
|
}) => {
|
|
25302
|
-
if (!isDocumentsRequired$1(currentForms))
|
|
25303
|
-
return;
|
|
25119
|
+
if (!isDocumentsRequired$1(currentForms)) return;
|
|
25304
25120
|
const formattedDocument = await mapCompanySearchDocumentToApiDocument(data, legalEntity.id);
|
|
25305
25121
|
try {
|
|
25306
25122
|
if (formattedDocument) {
|
|
@@ -25602,8 +25418,7 @@ function CompanySearchDropinComponent({
|
|
|
25602
25418
|
var _a2;
|
|
25603
25419
|
eventEmitter.on("updateLocale", (locale) => setLocale(locale));
|
|
25604
25420
|
const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
|
|
25605
|
-
if (!documentIds.length)
|
|
25606
|
-
return;
|
|
25421
|
+
if (!documentIds.length) return;
|
|
25607
25422
|
documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
|
|
25608
25423
|
setInitialData({
|
|
25609
25424
|
...initialData,
|
|
@@ -25762,8 +25577,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25762
25577
|
}), [options]);
|
|
25763
25578
|
const rawValueRef = useRef(null);
|
|
25764
25579
|
const [value, setValue] = useState(() => {
|
|
25765
|
-
if (typeof window === "undefined")
|
|
25766
|
-
return defaultValue;
|
|
25580
|
+
if (typeof window === "undefined") return defaultValue;
|
|
25767
25581
|
try {
|
|
25768
25582
|
rawValueRef.current = window.localStorage.getItem(key);
|
|
25769
25583
|
const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
|
|
@@ -25774,8 +25588,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25774
25588
|
}
|
|
25775
25589
|
});
|
|
25776
25590
|
useEffect(() => {
|
|
25777
|
-
if (typeof window === "undefined")
|
|
25778
|
-
return;
|
|
25591
|
+
if (typeof window === "undefined") return;
|
|
25779
25592
|
const updateLocalStorage = () => {
|
|
25780
25593
|
if (value !== void 0) {
|
|
25781
25594
|
const newValue = serializer(value);
|
|
@@ -25805,11 +25618,9 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25805
25618
|
}
|
|
25806
25619
|
}, [value]);
|
|
25807
25620
|
useEffect(() => {
|
|
25808
|
-
if (!syncData)
|
|
25809
|
-
return;
|
|
25621
|
+
if (!syncData) return;
|
|
25810
25622
|
const handleStorageChange = (event) => {
|
|
25811
|
-
if (event.key !== key || event.storageArea !== window.localStorage)
|
|
25812
|
-
return;
|
|
25623
|
+
if (event.key !== key || event.storageArea !== window.localStorage) return;
|
|
25813
25624
|
try {
|
|
25814
25625
|
if (event.newValue !== rawValueRef.current) {
|
|
25815
25626
|
rawValueRef.current = event.newValue;
|
|
@@ -25819,8 +25630,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25819
25630
|
logger$c.error(err);
|
|
25820
25631
|
}
|
|
25821
25632
|
};
|
|
25822
|
-
if (typeof window === "undefined")
|
|
25823
|
-
return;
|
|
25633
|
+
if (typeof window === "undefined") return;
|
|
25824
25634
|
window.addEventListener("storage", handleStorageChange);
|
|
25825
25635
|
return () => window.removeEventListener("storage", handleStorageChange);
|
|
25826
25636
|
}, [key, syncData]);
|
|
@@ -25854,11 +25664,9 @@ const useIsEligibleForSingpass = ({
|
|
|
25854
25664
|
const {
|
|
25855
25665
|
isExperimentEnabled
|
|
25856
25666
|
} = useExperimentsContext();
|
|
25857
|
-
if (!isExperimentEnabled("ShowSingPassButtonForCompanies"))
|
|
25858
|
-
return false;
|
|
25667
|
+
if (!isExperimentEnabled("ShowSingPassButtonForCompanies")) return false;
|
|
25859
25668
|
const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink) && getLegalEntityCountry(legalEntity) === CountryCodes.Singapore;
|
|
25860
|
-
if (!isSingpassEnabled)
|
|
25861
|
-
return false;
|
|
25669
|
+
if (!isSingpassEnabled) return false;
|
|
25862
25670
|
if (accountHolder2) {
|
|
25863
25671
|
return accountHolder2 === "theCompanyIWorkFor";
|
|
25864
25672
|
}
|
|
@@ -25901,8 +25709,7 @@ const useExemptSettlor = ({
|
|
|
25901
25709
|
setExemptSettlor(exemptSettlorLE);
|
|
25902
25710
|
}, [handleGetLegalEntity]);
|
|
25903
25711
|
useEffect(() => {
|
|
25904
|
-
if (!(trust2 == null ? void 0 : trust2.trust))
|
|
25905
|
-
return;
|
|
25712
|
+
if (!(trust2 == null ? void 0 : trust2.trust)) return;
|
|
25906
25713
|
updateExemptSettlor(trust2).catch(logger$a.error);
|
|
25907
25714
|
}, [trust2, updateExemptSettlor]);
|
|
25908
25715
|
return exemptSettlor;
|
|
@@ -25963,8 +25770,7 @@ const saveBlobAsFile = (fileData, filename) => {
|
|
|
25963
25770
|
const isNewEntity = Symbol("isNewEntity");
|
|
25964
25771
|
const splitAtFirstOccurrence = (str, separator) => {
|
|
25965
25772
|
const firstOccurrence = str.indexOf(separator);
|
|
25966
|
-
if (firstOccurrence === -1)
|
|
25967
|
-
return [str];
|
|
25773
|
+
if (firstOccurrence === -1) return [str];
|
|
25968
25774
|
return [str.slice(0, firstOccurrence), str.slice(firstOccurrence + 1)];
|
|
25969
25775
|
};
|
|
25970
25776
|
const getTrustMemberOwnerId = (trustMemberId, entityAssociations) => {
|
|
@@ -25991,23 +25797,21 @@ const convertEntityAssociationIntoTrustMember = (association2, associations, exe
|
|
|
25991
25797
|
name: association2.name
|
|
25992
25798
|
};
|
|
25993
25799
|
}
|
|
25994
|
-
if (association2.entityType === LegalEntityType.ORGANIZATION)
|
|
25995
|
-
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
|
|
26007
|
-
|
|
26008
|
-
|
|
26009
|
-
name: association2.name
|
|
26010
|
-
};
|
|
25800
|
+
if (association2.entityType === LegalEntityType.ORGANIZATION) return {
|
|
25801
|
+
trustMemberType: "company",
|
|
25802
|
+
roles: [],
|
|
25803
|
+
legalEntityType: LegalEntityType.ORGANIZATION,
|
|
25804
|
+
legalEntityId: association2.legalEntityId,
|
|
25805
|
+
name: association2.name,
|
|
25806
|
+
ownerId: getTrustMemberOwnerId(association2.legalEntityId, associations)
|
|
25807
|
+
};
|
|
25808
|
+
if (association2.entityType === LegalEntityType.INDIVIDUAL) return {
|
|
25809
|
+
trustMemberType: "regular",
|
|
25810
|
+
roles: [],
|
|
25811
|
+
legalEntityType: LegalEntityType.INDIVIDUAL,
|
|
25812
|
+
legalEntityId: association2.legalEntityId,
|
|
25813
|
+
name: association2.name
|
|
25814
|
+
};
|
|
26011
25815
|
throw new Error(`Not a valid trust member: ${JSON.stringify(association2)}`);
|
|
26012
25816
|
};
|
|
26013
25817
|
const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations, exemptSettlorLE) => {
|
|
@@ -26067,14 +25871,13 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
|
|
|
26067
25871
|
if (trustMember.legalEntityId === isNewEntity) {
|
|
26068
25872
|
throw Error("Cannot map a new trust member, you must create it first");
|
|
26069
25873
|
}
|
|
26070
|
-
if (trustMember.trustMemberType === "exemptSettlor")
|
|
26071
|
-
|
|
26072
|
-
|
|
26073
|
-
|
|
26074
|
-
|
|
26075
|
-
|
|
26076
|
-
|
|
26077
|
-
}];
|
|
25874
|
+
if (trustMember.trustMemberType === "exemptSettlor") return [{
|
|
25875
|
+
legalEntityId: trustMember.legalEntityId,
|
|
25876
|
+
entityType: trustMember.legalEntityType,
|
|
25877
|
+
type: TrustMemberTypes.SETTLOR,
|
|
25878
|
+
settlorExemptionReason: trustMember.settlorExemptionReason,
|
|
25879
|
+
name: trustMember.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName}` : trustMember.name ?? ""
|
|
25880
|
+
}];
|
|
26078
25881
|
return trustMember.roles.map((role2) => ({
|
|
26079
25882
|
legalEntityId: trustMember.legalEntityId,
|
|
26080
25883
|
type: role2
|
|
@@ -26455,8 +26258,7 @@ const BusinessTypeSelection = ({
|
|
|
26455
26258
|
}, []);
|
|
26456
26259
|
const handleNextClick = async () => {
|
|
26457
26260
|
var _a2;
|
|
26458
|
-
if (loadingStatus === "loading")
|
|
26459
|
-
return;
|
|
26261
|
+
if (loadingStatus === "loading") return;
|
|
26460
26262
|
triggerValidation();
|
|
26461
26263
|
if (isValid) {
|
|
26462
26264
|
if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
|
|
@@ -27449,12 +27251,9 @@ const useLegalEntityType = ({
|
|
|
27449
27251
|
switch (legalEntity.type) {
|
|
27450
27252
|
case LegalEntityType.INDIVIDUAL:
|
|
27451
27253
|
case LegalEntityType.ORGANIZATION:
|
|
27452
|
-
if (!hasLegalAssociation)
|
|
27453
|
-
|
|
27454
|
-
if (
|
|
27455
|
-
return LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27456
|
-
if (isTrust)
|
|
27457
|
-
return LegalEntityType.TRUST;
|
|
27254
|
+
if (!hasLegalAssociation) return legalEntity.type;
|
|
27255
|
+
if (isSoleProprietor) return LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27256
|
+
if (isTrust) return LegalEntityType.TRUST;
|
|
27458
27257
|
break;
|
|
27459
27258
|
default:
|
|
27460
27259
|
return void 0;
|
|
@@ -27499,12 +27298,9 @@ const useIntroductionScreens = ({
|
|
|
27499
27298
|
const isSoleProprietor = legalEntityType === LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27500
27299
|
const isTrustScreen = screen === IntroductionScreens.TRUST || screen === IntroductionScreens.TRUST_MEMBER_OVERVIEW;
|
|
27501
27300
|
const isTrust = legalEntityType === LegalEntityType.TRUST;
|
|
27502
|
-
if (isAccountScreen)
|
|
27503
|
-
|
|
27504
|
-
if (
|
|
27505
|
-
return isSoleProprietor;
|
|
27506
|
-
if (isTrustScreen)
|
|
27507
|
-
return isTrust;
|
|
27301
|
+
if (isAccountScreen) return hasAccountTask;
|
|
27302
|
+
if (isSoleProprietorScreen) return isSoleProprietor;
|
|
27303
|
+
if (isTrustScreen) return isTrust;
|
|
27508
27304
|
return tasks.some((task) => screen === task);
|
|
27509
27305
|
}) : [], [legalEntityType, tasks]);
|
|
27510
27306
|
return canSeeIntroduction && (introductionScreens == null ? void 0 : introductionScreens.length) > 0 ? [IntroductionScreens.PROLOGUE, ...introductionScreens, IntroductionScreens.EPILOGUE] : void 0;
|
|
@@ -28954,8 +28750,7 @@ function IndividualDropinComponent({
|
|
|
28954
28750
|
dataSubmitted
|
|
28955
28751
|
}) => {
|
|
28956
28752
|
var _a2;
|
|
28957
|
-
if (!isDocumentsRequired2(forms22))
|
|
28958
|
-
return;
|
|
28753
|
+
if (!isDocumentsRequired2(forms22)) return;
|
|
28959
28754
|
if ((_a2 = dataSubmitted.idDocument) == null ? void 0 : _a2.instantIdVerificationData) {
|
|
28960
28755
|
await handleInstantIdVerificationStartCheck(dataSubmitted.idDocument.instantIdVerificationData, legalEntity.id);
|
|
28961
28756
|
} else {
|
|
@@ -29091,20 +28886,17 @@ function IndividualDropinComponent({
|
|
|
29091
28886
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
29092
28887
|
const formatIdDocument = (idDocument2) => {
|
|
29093
28888
|
var _a2, _b2;
|
|
29094
|
-
if (!idDocument2)
|
|
29095
|
-
return void 0;
|
|
28889
|
+
if (!idDocument2) return void 0;
|
|
29096
28890
|
const documentType2 = (idDocument2 == null ? void 0 : idDocument2.instantIdVerificationData) ? onfidoDocumentTypeMapping.find((document2) => {
|
|
29097
28891
|
var _a3;
|
|
29098
28892
|
return ((_a3 = idDocument2.instantIdVerificationData) == null ? void 0 : _a3.document_front.type) === document2.id;
|
|
29099
28893
|
}) : idDocumentTypeOptions.find(({
|
|
29100
28894
|
id: id2
|
|
29101
28895
|
}) => idDocument2.idDocumentType === id2);
|
|
29102
|
-
if (!documentType2)
|
|
29103
|
-
return void 0;
|
|
28896
|
+
if (!documentType2) return void 0;
|
|
29104
28897
|
const frontPage2 = (_a2 = idDocument2.idFrontPage) == null ? void 0 : _a2[0];
|
|
29105
28898
|
const backPage2 = (_b2 = idDocument2.idBackPage) == null ? void 0 : _b2[0];
|
|
29106
|
-
if (!frontPage2)
|
|
29107
|
-
return void 0;
|
|
28899
|
+
if (!frontPage2) return void 0;
|
|
29108
28900
|
return {
|
|
29109
28901
|
documentType: i18n.get(documentType2.name),
|
|
29110
28902
|
...backPage2 && documentType2.hasBackPage ? {
|
|
@@ -29288,8 +29080,7 @@ const rules$1 = ({
|
|
|
29288
29080
|
}) => ({
|
|
29289
29081
|
whenUsingManualVerification: () => {
|
|
29290
29082
|
var _a;
|
|
29291
|
-
if (!data.payoutVerificationMethod)
|
|
29292
|
-
return;
|
|
29083
|
+
if (!data.payoutVerificationMethod) return;
|
|
29293
29084
|
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "manualVerification") {
|
|
29294
29085
|
return "REQUIRED";
|
|
29295
29086
|
}
|
|
@@ -29849,8 +29640,7 @@ function PciDropinComponent({
|
|
|
29849
29640
|
name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
|
|
29850
29641
|
}];
|
|
29851
29642
|
const handleSignClick = async () => {
|
|
29852
|
-
if (loadingStatus === "loading")
|
|
29853
|
-
return;
|
|
29643
|
+
if (loadingStatus === "loading") return;
|
|
29854
29644
|
userEvents.addEvent("Clicked PCI signing", {
|
|
29855
29645
|
segmentation: {
|
|
29856
29646
|
...baseTrackingPayload
|
|
@@ -29982,8 +29772,7 @@ function PciDropinComponent({
|
|
|
29982
29772
|
});
|
|
29983
29773
|
}
|
|
29984
29774
|
const convertExistingSettlorExemptionReasons = (existingReasons) => {
|
|
29985
|
-
if (!existingReasons || !existingReasons.length)
|
|
29986
|
-
return ["noneOfTheAbove"];
|
|
29775
|
+
if (!existingReasons || !existingReasons.length) return ["noneOfTheAbove"];
|
|
29987
29776
|
return existingReasons;
|
|
29988
29777
|
};
|
|
29989
29778
|
const convertExistingTrustMember = (trustMember) => {
|
|
@@ -30098,8 +29887,7 @@ const getAvailableRolesByTrustMemberTypeAndLegalEntityType = (currentRoles, trus
|
|
|
30098
29887
|
return roles.filter((r) => r !== "secondaryTrustee");
|
|
30099
29888
|
};
|
|
30100
29889
|
const getAvailableRoles = (currentRoles) => {
|
|
30101
|
-
if (!(currentRoles == null ? void 0 : currentRoles.length))
|
|
30102
|
-
return Object.values(TrustMemberTypes);
|
|
29890
|
+
if (!(currentRoles == null ? void 0 : currentRoles.length)) return Object.values(TrustMemberTypes);
|
|
30103
29891
|
return currentRoles.map((role2) => [role2, ...allowedCrossoverRolesMatrix[role2]]).reduce((existingAllowed, allowedForRole) => existingAllowed.filter((role2) => allowedForRole.includes(role2)));
|
|
30104
29892
|
};
|
|
30105
29893
|
const trustMemberLegalEntityTypes = [LegalEntityType.INDIVIDUAL, LegalEntityType.ORGANIZATION];
|
|
@@ -30436,8 +30224,7 @@ const exemptSettlorForms = {
|
|
|
30436
30224
|
summary
|
|
30437
30225
|
};
|
|
30438
30226
|
const decideForms = (trustMember) => {
|
|
30439
|
-
if (trustMember === "incomplete")
|
|
30440
|
-
return regularForms;
|
|
30227
|
+
if (trustMember === "incomplete") return regularForms;
|
|
30441
30228
|
switch (trustMember.trustMemberType) {
|
|
30442
30229
|
case "undefinedBeneficiary":
|
|
30443
30230
|
return undefinedBeneficiaryForms;
|
|
@@ -30487,13 +30274,12 @@ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettl
|
|
|
30487
30274
|
legalEntityId: existingId ?? isNewEntity
|
|
30488
30275
|
};
|
|
30489
30276
|
}
|
|
30490
|
-
if (data.role.includes("undefinedBeneficiary"))
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
};
|
|
30277
|
+
if (data.role.includes("undefinedBeneficiary")) return {
|
|
30278
|
+
trustMemberType: "undefinedBeneficiary",
|
|
30279
|
+
roles: [TrustMemberTypes.UNDEFINED_BENEFICIARY],
|
|
30280
|
+
description: data.descriptionUndefinedBeneficiary ?? "",
|
|
30281
|
+
reference: existingId ?? isNewEntity
|
|
30282
|
+
};
|
|
30497
30283
|
if (data.entityType === LegalEntityType.ORGANIZATION) {
|
|
30498
30284
|
return {
|
|
30499
30285
|
trustMemberType: "company",
|
|
@@ -30504,14 +30290,13 @@ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettl
|
|
|
30504
30290
|
country: data.country
|
|
30505
30291
|
};
|
|
30506
30292
|
}
|
|
30507
|
-
if (data.entityType === LegalEntityType.INDIVIDUAL)
|
|
30508
|
-
|
|
30509
|
-
|
|
30510
|
-
|
|
30511
|
-
|
|
30512
|
-
|
|
30513
|
-
|
|
30514
|
-
};
|
|
30293
|
+
if (data.entityType === LegalEntityType.INDIVIDUAL) return {
|
|
30294
|
+
trustMemberType: "regular",
|
|
30295
|
+
roles: data.role,
|
|
30296
|
+
legalEntityType: LegalEntityType.INDIVIDUAL,
|
|
30297
|
+
legalEntityId: existingId ?? isNewEntity,
|
|
30298
|
+
name: ""
|
|
30299
|
+
};
|
|
30515
30300
|
}
|
|
30516
30301
|
return "incomplete";
|
|
30517
30302
|
};
|
|
@@ -30571,8 +30356,7 @@ function RoleAndTypeDropinComponent({
|
|
|
30571
30356
|
setTrustMember(convertDataToTrustMember(data, existingTrustMember, isOrganizationSettlorWithExemptionEnabled));
|
|
30572
30357
|
};
|
|
30573
30358
|
const saveRolesAndNavigate = async () => {
|
|
30574
|
-
if (trustMember === "incomplete")
|
|
30575
|
-
return;
|
|
30359
|
+
if (trustMember === "incomplete") return;
|
|
30576
30360
|
if (hasRolesChanged(trustMember.roles, existingTrustMember == null ? void 0 : existingTrustMember.roles)) {
|
|
30577
30361
|
addOrUpdateTrustMember(trustMember);
|
|
30578
30362
|
}
|
|
@@ -30595,8 +30379,7 @@ function RoleAndTypeDropinComponent({
|
|
|
30595
30379
|
navigateToFullDropinFor(trustMember);
|
|
30596
30380
|
return;
|
|
30597
30381
|
}
|
|
30598
|
-
if (targetForm.formId === summaryStep.formId)
|
|
30599
|
-
return;
|
|
30382
|
+
if (targetForm.formId === summaryStep.formId) return;
|
|
30600
30383
|
}
|
|
30601
30384
|
setActiveForm(targetForm);
|
|
30602
30385
|
};
|
|
@@ -30670,8 +30453,7 @@ const useServiceAgreement = ({
|
|
|
30670
30453
|
}, [language]);
|
|
30671
30454
|
useEffect(() => {
|
|
30672
30455
|
const requestAcceptedServiceAgreement = async () => {
|
|
30673
|
-
if (!handleViewAcceptedTermsOfServiceDocument || !acceptanceId)
|
|
30674
|
-
return;
|
|
30456
|
+
if (!handleViewAcceptedTermsOfServiceDocument || !acceptanceId) return;
|
|
30675
30457
|
setLoading("loading");
|
|
30676
30458
|
const {
|
|
30677
30459
|
id: id2,
|
|
@@ -30687,8 +30469,7 @@ const useServiceAgreement = ({
|
|
|
30687
30469
|
}, [acceptanceId, handleViewAcceptedTermsOfServiceDocument]);
|
|
30688
30470
|
useEffect(() => {
|
|
30689
30471
|
const requestServiceAgreement = async () => {
|
|
30690
|
-
if (acceptanceId)
|
|
30691
|
-
return;
|
|
30472
|
+
if (acceptanceId) return;
|
|
30692
30473
|
setLoading("loading");
|
|
30693
30474
|
try {
|
|
30694
30475
|
const {
|
|
@@ -30824,8 +30605,7 @@ function ServiceAgreementDropinComponent({
|
|
|
30824
30605
|
}
|
|
30825
30606
|
});
|
|
30826
30607
|
triggerValidation();
|
|
30827
|
-
if (loadingStatus === "loading" || !serviceAgreement || !data.signer)
|
|
30828
|
-
return;
|
|
30608
|
+
if (loadingStatus === "loading" || !serviceAgreement || !data.signer) return;
|
|
30829
30609
|
if (isValid) {
|
|
30830
30610
|
try {
|
|
30831
30611
|
setLoadingStatus("loading");
|
|
@@ -30882,8 +30662,7 @@ function ServiceAgreementDropinComponent({
|
|
|
30882
30662
|
});
|
|
30883
30663
|
};
|
|
30884
30664
|
useEffect(() => {
|
|
30885
|
-
if (!serviceAgreementAcceptanceInfos.length)
|
|
30886
|
-
return;
|
|
30665
|
+
if (!serviceAgreementAcceptanceInfos.length) return;
|
|
30887
30666
|
gotoForm(serviceAgreementAcceptanceInfos.length - 1);
|
|
30888
30667
|
}, [serviceAgreementAcceptanceInfos]);
|
|
30889
30668
|
useEffect(() => {
|
|
@@ -30902,8 +30681,7 @@ function ServiceAgreementDropinComponent({
|
|
|
30902
30681
|
};
|
|
30903
30682
|
const onDownloadAcceptedTermsOfServiceDocument = async () => {
|
|
30904
30683
|
try {
|
|
30905
|
-
if (!canDownload)
|
|
30906
|
-
return;
|
|
30684
|
+
if (!canDownload) return;
|
|
30907
30685
|
const response = await handleDownloadAcceptedTermsOfServiceDocument(legalEntityResponse.id, activeForm.acceptanceId);
|
|
30908
30686
|
await downloadFile(response.document, `${i18n.get(activeForm.formName)}.pdf`);
|
|
30909
30687
|
} catch (e) {
|
|
@@ -31671,8 +31449,7 @@ const useNavigation = ({
|
|
|
31671
31449
|
}
|
|
31672
31450
|
}, [onNavigate]);
|
|
31673
31451
|
const navigateBack = useCallback((stepCount = 1) => {
|
|
31674
|
-
if (taskHistory.length <= 1)
|
|
31675
|
-
return;
|
|
31452
|
+
if (taskHistory.length <= 1) return;
|
|
31676
31453
|
const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
|
|
31677
31454
|
if (prevTask === "default") {
|
|
31678
31455
|
throw Error("Cannot navigate back to 'default' task");
|
|
@@ -31713,12 +31490,9 @@ const getDefaultTask = ({
|
|
|
31713
31490
|
shouldShowSingpassSelection
|
|
31714
31491
|
}) => {
|
|
31715
31492
|
const hasLegalEntityProgressedBeyondEntitySelection = hasProgressedBeyondEntitySelection(legalEntity);
|
|
31716
|
-
if (isNewEntryFlowEnabled && !accountHolder2 && !hasLegalEntityProgressedBeyondEntitySelection)
|
|
31717
|
-
|
|
31718
|
-
if (
|
|
31719
|
-
return TaskTypes.INTRODUCTION;
|
|
31720
|
-
if (shouldShowSingpassSelection)
|
|
31721
|
-
return TaskTypes.SINGPASS_SELECTION;
|
|
31493
|
+
if (isNewEntryFlowEnabled && !accountHolder2 && !hasLegalEntityProgressedBeyondEntitySelection) return TaskTypes.BUSINESS_TYPE_SELECTION;
|
|
31494
|
+
if (showIntroduction) return TaskTypes.INTRODUCTION;
|
|
31495
|
+
if (shouldShowSingpassSelection) return TaskTypes.SINGPASS_SELECTION;
|
|
31722
31496
|
return TaskTypes.TASKS_OVERVIEW;
|
|
31723
31497
|
};
|
|
31724
31498
|
const hasProgressedBeyondEntitySelection = (legalEntity) => {
|
|
@@ -31866,8 +31640,7 @@ function DropinComposerComponent({
|
|
|
31866
31640
|
}
|
|
31867
31641
|
}, [additionalSalesChannels, i18n, rootLegalEntity.id, args.handleGetPciTemplate]);
|
|
31868
31642
|
useEffect(() => {
|
|
31869
|
-
if (!tasks.includes(TaskTypes.PCI_DSS))
|
|
31870
|
-
return;
|
|
31643
|
+
if (!tasks.includes(TaskTypes.PCI_DSS)) return;
|
|
31871
31644
|
getPciTemplate().catch(logger$8.error);
|
|
31872
31645
|
}, [getPciTemplate, tasks]);
|
|
31873
31646
|
const addFetchedAcceptedByName = async (acceptanceInfo) => {
|
|
@@ -33357,11 +33130,9 @@ function ViewVerificationStatusComponent({
|
|
|
33357
33130
|
const [onboardingStatus, setOnboardingStatus] = useState();
|
|
33358
33131
|
const [alertContent, setAlertContent] = useState();
|
|
33359
33132
|
const content = useMemo(() => {
|
|
33360
|
-
if (!onboardingStatus)
|
|
33361
|
-
return;
|
|
33133
|
+
if (!onboardingStatus) return;
|
|
33362
33134
|
const statusContent = getContentByStatus(onboardingStatus);
|
|
33363
|
-
if (statusContent)
|
|
33364
|
-
return statusContent;
|
|
33135
|
+
if (statusContent) return statusContent;
|
|
33365
33136
|
logger$5.error(`there is no content for status "${onboardingStatus}"`);
|
|
33366
33137
|
}, [onboardingStatus]);
|
|
33367
33138
|
const handleError = ({
|
|
@@ -33615,8 +33386,7 @@ const buildSpriteDOMFromResponse = (responseData) => {
|
|
|
33615
33386
|
return iconContainer;
|
|
33616
33387
|
};
|
|
33617
33388
|
const loadDocumentGuidance = async (loadingContext) => {
|
|
33618
|
-
if (isDocumentGuidanceLoaded)
|
|
33619
|
-
return;
|
|
33389
|
+
if (isDocumentGuidanceLoaded) return;
|
|
33620
33390
|
isDocumentGuidanceLoaded = true;
|
|
33621
33391
|
const responseData = await http({
|
|
33622
33392
|
loadingContext,
|
|
@@ -33898,7 +33668,7 @@ const ConfigurationApiProvider = ({
|
|
|
33898
33668
|
isEmbeddedDropin,
|
|
33899
33669
|
loadingContext
|
|
33900
33670
|
} = authContext;
|
|
33901
|
-
const sdkVersion = "2.
|
|
33671
|
+
const sdkVersion = "2.42.1";
|
|
33902
33672
|
useAnalytics({
|
|
33903
33673
|
onUserEvent,
|
|
33904
33674
|
legalEntityId: rootLegalEntityId,
|
|
@@ -34001,12 +33771,10 @@ const useTranslations = ({
|
|
|
34001
33771
|
getDataset: getDataset2
|
|
34002
33772
|
} = useConfigurationApi();
|
|
34003
33773
|
useEffect(() => {
|
|
34004
|
-
if (!allowedLocales)
|
|
34005
|
-
return;
|
|
33774
|
+
if (!allowedLocales) return;
|
|
34006
33775
|
const isLocaleAllowed = allowedLocales.includes(locale);
|
|
34007
33776
|
const localeToUse = isLocaleAllowed ? locale : FALLBACK_LOCALE;
|
|
34008
|
-
if (loaded.locale === localeToUse)
|
|
34009
|
-
return;
|
|
33777
|
+
if (loaded.locale === localeToUse) return;
|
|
34010
33778
|
if (!isLocaleAllowed) {
|
|
34011
33779
|
logger.error(`
|
|
34012
33780
|
"${locale}" isn't a supported locale. Please use one of the following:
|
|
@@ -34094,8 +33862,7 @@ function SettingsProvider({
|
|
|
34094
33862
|
}
|
|
34095
33863
|
function removeObjectPropsWithEmptyValues(obj) {
|
|
34096
33864
|
keysOf(obj).forEach((key) => {
|
|
34097
|
-
if (obj[key] === null || isEmpty(obj[key]))
|
|
34098
|
-
delete obj[key];
|
|
33865
|
+
if (obj[key] === null || isEmpty(obj[key])) delete obj[key];
|
|
34099
33866
|
});
|
|
34100
33867
|
return obj;
|
|
34101
33868
|
}
|
|
@@ -34375,10 +34142,8 @@ class BaseElement {
|
|
|
34375
34142
|
}
|
|
34376
34143
|
}
|
|
34377
34144
|
const getRootLegalEntityId = (componentProps) => {
|
|
34378
|
-
if ("legalEntityId" in componentProps)
|
|
34379
|
-
|
|
34380
|
-
if ("legalEntityResponse" in componentProps)
|
|
34381
|
-
return componentProps.legalEntityResponse.id;
|
|
34145
|
+
if ("legalEntityId" in componentProps) return componentProps.legalEntityId;
|
|
34146
|
+
if ("legalEntityResponse" in componentProps) return componentProps.legalEntityResponse.id;
|
|
34382
34147
|
throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
|
|
34383
34148
|
};
|
|
34384
34149
|
class UIElement extends BaseElement {
|
|
@@ -35269,8 +35034,7 @@ class Core {
|
|
|
35269
35034
|
};
|
|
35270
35035
|
validateCoreOptions(newOptions);
|
|
35271
35036
|
newOptions.loadingContext = normalizeEnvironment(newOptions.environment);
|
|
35272
|
-
if (!newOptions.locale)
|
|
35273
|
-
newOptions.locale = FALLBACK_LOCALE;
|
|
35037
|
+
if (!newOptions.locale) newOptions.locale = FALLBACK_LOCALE;
|
|
35274
35038
|
return newOptions;
|
|
35275
35039
|
};
|
|
35276
35040
|
this.initializeSession = () => {
|