@adyen/kyc-components 3.15.2 → 3.15.3
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 +339 -533
- package/dist/es/{arrow-left-CCxYxfCP.js → arrow-left-CwJQyOFz.js} +1 -1
- package/dist/es/{arrow-right-DF4Qe-8E.js → arrow-right-Cs_AKUOH.js} +1 -1
- package/dist/es/{bin-CGwewvcn.js → bin-8yaAerXc.js} +1 -1
- package/dist/es/{check-CeSLN4_9.js → check-_cOIMziL.js} +1 -1
- package/dist/es/{checkmark-DEh9MPYR.js → checkmark-CZpv8i5a.js} +1 -1
- package/dist/es/{checkmark-small-D_9HLctx.js → checkmark-small-C4TPve-W.js} +1 -1
- package/dist/es/{chevron-down-BzENwYSf.js → chevron-down-CwS2tE_6.js} +1 -1
- package/dist/es/{chevron-right-DczMHcvL.js → chevron-right-B8cQLres.js} +1 -1
- package/dist/es/{chevron-up-BLtnROd5.js → chevron-up-DccG0tVR.js} +1 -1
- package/dist/es/{company-2-JG34IScE.js → company-2-Cof0usfn.js} +1 -1
- package/dist/es/{company-D5_F_6SW.js → company-BKO80hWm.js} +1 -1
- package/dist/es/{contract-C6wDy9zU.js → contract-DrX5y2Qf.js} +1 -1
- package/dist/es/{controlling-person-C4KoSyi2.js → controlling-person-B_dn0b9H.js} +1 -1
- package/dist/es/{cross-BadGfrgB.js → cross-aFMJCrLf.js} +1 -1
- package/dist/es/{decision-maker-Cef3-OzY.js → decision-maker-28_rW1ah.js} +1 -1
- package/dist/es/{document-Cg4kZHpA.js → document-Bn_3PIDG.js} +1 -1
- package/dist/es/{download-DGC5_Bxe.js → download-DgAZobJV.js} +1 -1
- package/dist/es/{edit--fDhojib.js → edit-Dg19Ah77.js} +1 -1
- package/dist/es/{field-error-WElEN1mN.js → field-error-DkFiF_Cv.js} +1 -1
- package/dist/es/{info-circle-DkHN1ugA.js → info-circle-CXFfd_nO.js} +1 -1
- package/dist/es/{light-bulb-DEUhbRWP.js → light-bulb-CQ29JPA7.js} +1 -1
- package/dist/es/{location-B1Til-7Q.js → location-DmmjAv9A.js} +1 -1
- package/dist/es/{more-horiz-BieZKfy3.js → more-horiz-dyZQKaOn.js} +1 -1
- package/dist/es/{new-document-BEAJnXCG.js → new-document-CeV8zHP8.js} +1 -1
- package/dist/es/{owners-D1pksb86.js → owners-C1dyQqRO.js} +1 -1
- package/dist/es/{payout-BFiI--HY.js → payout-B-c43MDS.js} +1 -1
- package/dist/es/{pci-DMQLRoAn.js → pci-CVqIvwR-.js} +1 -1
- package/dist/es/{plus-DAnbeoyS.js → plus-BUH0nzS_.js} +1 -1
- package/dist/es/{remove-CEmd9YX7.js → remove-Bor5X8Xu.js} +1 -1
- package/dist/es/{review-CeQeKHXH.js → review-DcoDSRJT.js} +1 -1
- package/dist/es/{search-hf3HRVbu.js → search-SGLIdnsr.js} +1 -1
- package/dist/es/{signatory-BVoLPYPu.js → signatory-BMaWV_18.js} +1 -1
- package/dist/es/{store-D2z639xh.js → store-N4c2LHJ_.js} +1 -1
- package/dist/es/{trust-CpcaQaV7.js → trust-BcVDhtGL.js} +1 -1
- package/dist/es/{user-D6swzlYs.js → user-C8STPF6-.js} +1 -1
- package/dist/es/{user-business-CwS5j1qX.js → user-business-Dcvcw8gB.js} +1 -1
- package/dist/es/{users-3-BdjQ9rEA.js → users-3-D3QDBEk-.js} +1 -1
- package/dist/es/{warning-99uFf1WU.js → warning-Dxxpni4H.js} +1 -1
- package/dist/es/{wrong-1wvh7nZe.js → wrong-DNwa4zZR.js} +1 -1
- 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/BusinessRegistrationNumberField/types.d.ts +2 -2
- 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/Context/QueryContext/QueryClient.d.ts +2 -0
- package/dist/types/core/Context/QueryContext/QueryClientProvider.d.ts +4 -0
- 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/useLocalStorage.d.ts +2 -2
- package/dist/types/utils/useStateFromProp.d.ts +2 -2
- package/package.json +8 -2
|
@@ -7,9 +7,10 @@ import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
|
7
7
|
import { debounce, noop as noop$1, isEmpty as isEmpty$1, range } from "lodash";
|
|
8
8
|
import isISIN from "validator/es/lib/isISIN.js";
|
|
9
9
|
import OpenBankingSDK from "@adyen/openbankingsdk";
|
|
10
|
-
import { jsxs as jsxs$1, jsx as jsx$1 } from "
|
|
10
|
+
import { jsxs as jsxs$1, jsx as jsx$1 } from "react/jsx-runtime";
|
|
11
11
|
import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
|
|
12
12
|
import AdyenDocumentViewer from "@adyen/adyen-document-viewer";
|
|
13
|
+
import { QueryClient as QueryClient$1, QueryClientProvider as QueryClientProvider$1 } from "@tanstack/react-query";
|
|
13
14
|
const ConfigurationApiContext = createContext(void 0);
|
|
14
15
|
const useConfigurationApi = () => {
|
|
15
16
|
const configurationApi = useContext(ConfigurationApiContext);
|
|
@@ -2629,21 +2630,17 @@ const matchLocale = (locale, supportedLocales) => supportedLocales.find((supLoc)
|
|
|
2629
2630
|
function formatLocale(localeParam) {
|
|
2630
2631
|
const locale = localeParam.replace("_", "-");
|
|
2631
2632
|
const format = /([a-z]{2})(-)([A-Z]{2})/;
|
|
2632
|
-
if (format.test(locale))
|
|
2633
|
-
return locale;
|
|
2633
|
+
if (format.test(locale)) return locale;
|
|
2634
2634
|
const [languageCode, countryCode] = locale.split("-");
|
|
2635
|
-
if (!languageCode || !countryCode)
|
|
2636
|
-
return null;
|
|
2635
|
+
if (!languageCode || !countryCode) return null;
|
|
2637
2636
|
const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join("-");
|
|
2638
2637
|
return fullLocale.length === 5 ? fullLocale : null;
|
|
2639
2638
|
}
|
|
2640
2639
|
function parseLocale(locale, supportedLocales = []) {
|
|
2641
|
-
if (!locale || locale.length < 1 || locale.length > 5)
|
|
2642
|
-
return FALLBACK_LOCALE;
|
|
2640
|
+
if (!locale || locale.length < 1 || locale.length > 5) return FALLBACK_LOCALE;
|
|
2643
2641
|
const formattedLocale = formatLocale(locale);
|
|
2644
2642
|
const hasMatch = Boolean(formattedLocale && supportedLocales.includes(formattedLocale));
|
|
2645
|
-
if (hasMatch)
|
|
2646
|
-
return formattedLocale;
|
|
2643
|
+
if (hasMatch) return formattedLocale;
|
|
2647
2644
|
return matchLocale(formattedLocale || locale, supportedLocales);
|
|
2648
2645
|
}
|
|
2649
2646
|
const formatCustomTranslations = (supportedLocales, customTranslations = {}) => Object.keys(customTranslations).reduce((acc, cur) => {
|
|
@@ -3003,7 +3000,7 @@ const mergeFieldMetadataIntoProps = (fieldName, metadata, otherProps) => {
|
|
|
3003
3000
|
const MAX_LENGTH = 30;
|
|
3004
3001
|
const getMaxLengthByFieldAndCountry = (formattingRules, field, country2, ignoreIfFormatterExists) => {
|
|
3005
3002
|
var _a, _b, _c, _d;
|
|
3006
|
-
if (
|
|
3003
|
+
if ((_b = (_a = formattingRules[country2]) == null ? void 0 : _a[field]) == null ? void 0 : _b.formatter) {
|
|
3007
3004
|
return null;
|
|
3008
3005
|
}
|
|
3009
3006
|
const maxLength = (_d = (_c = formattingRules[country2]) == null ? void 0 : _c[field]) == null ? void 0 : _d.maxlength;
|
|
@@ -3034,8 +3031,7 @@ const createLogger = (namespace) => {
|
|
|
3034
3031
|
const methods = {};
|
|
3035
3032
|
consoleMethodsPrefixable.forEach((method) => {
|
|
3036
3033
|
methods[method] = (arg1, ...args) => {
|
|
3037
|
-
if (!console[method] || suppressed)
|
|
3038
|
-
return;
|
|
3034
|
+
if (!console[method] || suppressed) return;
|
|
3039
3035
|
if (!namespace) {
|
|
3040
3036
|
console[method](arg1, ...args);
|
|
3041
3037
|
} else if (stringSubstitutionRegex.test(arg1)) {
|
|
@@ -3048,45 +3044,45 @@ const createLogger = (namespace) => {
|
|
|
3048
3044
|
return methods;
|
|
3049
3045
|
};
|
|
3050
3046
|
const icons = {
|
|
3051
|
-
"arrow-left": lazy(() => import("./arrow-left-
|
|
3052
|
-
"arrow-right": lazy(() => import("./arrow-right-
|
|
3053
|
-
bin: lazy(() => import("./bin-
|
|
3054
|
-
check: lazy(() => import("./check-
|
|
3055
|
-
checkmark: lazy(() => import("./checkmark-
|
|
3056
|
-
"checkmark-small": lazy(() => import("./checkmark-small-
|
|
3057
|
-
"chevron-down": lazy(() => import("./chevron-down-
|
|
3058
|
-
"chevron-right": lazy(() => import("./chevron-right-
|
|
3059
|
-
"chevron-up": lazy(() => import("./chevron-up-
|
|
3060
|
-
company: lazy(() => import("./company-
|
|
3061
|
-
"company-2": lazy(() => import("./company-2-
|
|
3062
|
-
contract: lazy(() => import("./contract-
|
|
3063
|
-
"controlling-person": lazy(() => import("./controlling-person-
|
|
3064
|
-
cross: lazy(() => import("./cross-
|
|
3065
|
-
"decision-maker": lazy(() => import("./decision-maker-
|
|
3066
|
-
document: lazy(() => import("./document-
|
|
3067
|
-
download: lazy(() => import("./download-
|
|
3068
|
-
edit: lazy(() => import("./edit
|
|
3069
|
-
"field-error": lazy(() => import("./field-error-
|
|
3070
|
-
"info-circle": lazy(() => import("./info-circle-
|
|
3071
|
-
"light-bulb": lazy(() => import("./light-bulb-
|
|
3072
|
-
location: lazy(() => import("./location-
|
|
3073
|
-
"more-horiz": lazy(() => import("./more-horiz-
|
|
3074
|
-
"new-document": lazy(() => import("./new-document-
|
|
3075
|
-
owners: lazy(() => import("./owners-
|
|
3076
|
-
payout: lazy(() => import("./payout-
|
|
3077
|
-
pci: lazy(() => import("./pci-
|
|
3078
|
-
plus: lazy(() => import("./plus-
|
|
3079
|
-
remove: lazy(() => import("./remove-
|
|
3080
|
-
review: lazy(() => import("./review-
|
|
3081
|
-
search: lazy(() => import("./search-
|
|
3082
|
-
signatory: lazy(() => import("./signatory-
|
|
3083
|
-
store: lazy(() => import("./store-
|
|
3084
|
-
trust: lazy(() => import("./trust-
|
|
3085
|
-
user: lazy(() => import("./user-
|
|
3086
|
-
"user-business": lazy(() => import("./user-business-
|
|
3087
|
-
"users-3": lazy(() => import("./users-3-
|
|
3088
|
-
warning: lazy(() => import("./warning-
|
|
3089
|
-
wrong: lazy(() => import("./wrong-
|
|
3047
|
+
"arrow-left": lazy(() => import("./arrow-left-CwJQyOFz.js")),
|
|
3048
|
+
"arrow-right": lazy(() => import("./arrow-right-Cs_AKUOH.js")),
|
|
3049
|
+
bin: lazy(() => import("./bin-8yaAerXc.js")),
|
|
3050
|
+
check: lazy(() => import("./check-_cOIMziL.js")),
|
|
3051
|
+
checkmark: lazy(() => import("./checkmark-CZpv8i5a.js")),
|
|
3052
|
+
"checkmark-small": lazy(() => import("./checkmark-small-C4TPve-W.js")),
|
|
3053
|
+
"chevron-down": lazy(() => import("./chevron-down-CwS2tE_6.js")),
|
|
3054
|
+
"chevron-right": lazy(() => import("./chevron-right-B8cQLres.js")),
|
|
3055
|
+
"chevron-up": lazy(() => import("./chevron-up-DccG0tVR.js")),
|
|
3056
|
+
company: lazy(() => import("./company-BKO80hWm.js")),
|
|
3057
|
+
"company-2": lazy(() => import("./company-2-Cof0usfn.js")),
|
|
3058
|
+
contract: lazy(() => import("./contract-DrX5y2Qf.js")),
|
|
3059
|
+
"controlling-person": lazy(() => import("./controlling-person-B_dn0b9H.js")),
|
|
3060
|
+
cross: lazy(() => import("./cross-aFMJCrLf.js")),
|
|
3061
|
+
"decision-maker": lazy(() => import("./decision-maker-28_rW1ah.js")),
|
|
3062
|
+
document: lazy(() => import("./document-Bn_3PIDG.js")),
|
|
3063
|
+
download: lazy(() => import("./download-DgAZobJV.js")),
|
|
3064
|
+
edit: lazy(() => import("./edit-Dg19Ah77.js")),
|
|
3065
|
+
"field-error": lazy(() => import("./field-error-DkFiF_Cv.js")),
|
|
3066
|
+
"info-circle": lazy(() => import("./info-circle-CXFfd_nO.js")),
|
|
3067
|
+
"light-bulb": lazy(() => import("./light-bulb-CQ29JPA7.js")),
|
|
3068
|
+
location: lazy(() => import("./location-DmmjAv9A.js")),
|
|
3069
|
+
"more-horiz": lazy(() => import("./more-horiz-dyZQKaOn.js")),
|
|
3070
|
+
"new-document": lazy(() => import("./new-document-CeV8zHP8.js")),
|
|
3071
|
+
owners: lazy(() => import("./owners-C1dyQqRO.js")),
|
|
3072
|
+
payout: lazy(() => import("./payout-B-c43MDS.js")),
|
|
3073
|
+
pci: lazy(() => import("./pci-CVqIvwR-.js")),
|
|
3074
|
+
plus: lazy(() => import("./plus-BUH0nzS_.js")),
|
|
3075
|
+
remove: lazy(() => import("./remove-Bor5X8Xu.js")),
|
|
3076
|
+
review: lazy(() => import("./review-DcoDSRJT.js")),
|
|
3077
|
+
search: lazy(() => import("./search-SGLIdnsr.js")),
|
|
3078
|
+
signatory: lazy(() => import("./signatory-BMaWV_18.js")),
|
|
3079
|
+
store: lazy(() => import("./store-N4c2LHJ_.js")),
|
|
3080
|
+
trust: lazy(() => import("./trust-BcVDhtGL.js")),
|
|
3081
|
+
user: lazy(() => import("./user-C8STPF6-.js")),
|
|
3082
|
+
"user-business": lazy(() => import("./user-business-Dcvcw8gB.js")),
|
|
3083
|
+
"users-3": lazy(() => import("./users-3-D3QDBEk-.js")),
|
|
3084
|
+
warning: lazy(() => import("./warning-Dxxpni4H.js")),
|
|
3085
|
+
wrong: lazy(() => import("./wrong-DNwa4zZR.js"))
|
|
3090
3086
|
};
|
|
3091
3087
|
const logger$x = createLogger("Icon");
|
|
3092
3088
|
const Icon = ({
|
|
@@ -3226,8 +3222,7 @@ const Alert = ({
|
|
|
3226
3222
|
i18n
|
|
3227
3223
|
} = useI18nContext();
|
|
3228
3224
|
const [isClosed, setIsClosed] = useState(false);
|
|
3229
|
-
if (isClosed)
|
|
3230
|
-
return null;
|
|
3225
|
+
if (isClosed) return null;
|
|
3231
3226
|
const closeAlert = () => setIsClosed(true);
|
|
3232
3227
|
const classNames = cx("adl-alert", className, {
|
|
3233
3228
|
"adl-alert--basic": type === AlertTypes.BASIC,
|
|
@@ -3339,8 +3334,7 @@ const Link = ({
|
|
|
3339
3334
|
iconLeft = false,
|
|
3340
3335
|
onClick
|
|
3341
3336
|
}) => {
|
|
3342
|
-
if (!isValidLink(href))
|
|
3343
|
-
return null;
|
|
3337
|
+
if (!isValidLink(href)) return null;
|
|
3344
3338
|
const target = external ? "_blank" : "_self";
|
|
3345
3339
|
const rel = external ? "external noopener noreferrer" : void 0;
|
|
3346
3340
|
const showIcon = icon || external;
|
|
@@ -3618,8 +3612,7 @@ const useAllowedCountries = () => {
|
|
|
3618
3612
|
} = useConfigurationApi();
|
|
3619
3613
|
const [allowedCountries, setAllowedCountries] = useState(acceptedCountries);
|
|
3620
3614
|
useEffect(() => {
|
|
3621
|
-
if (acceptedCountries !== void 0)
|
|
3622
|
-
return;
|
|
3615
|
+
if (acceptedCountries !== void 0) return;
|
|
3623
3616
|
getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$v.error);
|
|
3624
3617
|
}, [acceptedCountries]);
|
|
3625
3618
|
return allowedCountries;
|
|
@@ -3750,8 +3743,7 @@ function reducer({
|
|
|
3750
3743
|
const validationSchema = selectedSchema || state2.schema;
|
|
3751
3744
|
switch (type) {
|
|
3752
3745
|
case "setData": {
|
|
3753
|
-
if (!key)
|
|
3754
|
-
return state2;
|
|
3746
|
+
if (!key) return state2;
|
|
3755
3747
|
return {
|
|
3756
3748
|
...state2,
|
|
3757
3749
|
data: {
|
|
@@ -3761,8 +3753,7 @@ function reducer({
|
|
|
3761
3753
|
};
|
|
3762
3754
|
}
|
|
3763
3755
|
case "setValid": {
|
|
3764
|
-
if (!key)
|
|
3765
|
-
return state2;
|
|
3756
|
+
if (!key) return state2;
|
|
3766
3757
|
return {
|
|
3767
3758
|
...state2,
|
|
3768
3759
|
valid: {
|
|
@@ -3772,8 +3763,7 @@ function reducer({
|
|
|
3772
3763
|
};
|
|
3773
3764
|
}
|
|
3774
3765
|
case "setErrors": {
|
|
3775
|
-
if (!key)
|
|
3776
|
-
return state2;
|
|
3766
|
+
if (!key) return state2;
|
|
3777
3767
|
return {
|
|
3778
3768
|
...state2,
|
|
3779
3769
|
errors: {
|
|
@@ -3799,8 +3789,7 @@ function reducer({
|
|
|
3799
3789
|
}, state2);
|
|
3800
3790
|
}
|
|
3801
3791
|
case "setSchema": {
|
|
3802
|
-
if (!schema)
|
|
3803
|
-
return state2;
|
|
3792
|
+
if (!schema) return state2;
|
|
3804
3793
|
const defaultState = init({
|
|
3805
3794
|
schema,
|
|
3806
3795
|
defaultData,
|
|
@@ -3835,8 +3824,7 @@ function reducer({
|
|
|
3835
3824
|
};
|
|
3836
3825
|
}
|
|
3837
3826
|
case "updateField": {
|
|
3838
|
-
if (!key || !mode)
|
|
3839
|
-
return state2;
|
|
3827
|
+
if (!key || !mode) return state2;
|
|
3840
3828
|
const [formattedValue, validation] = processField({
|
|
3841
3829
|
key,
|
|
3842
3830
|
value,
|
|
@@ -3964,11 +3952,9 @@ const useAsyncValidator = (asyncRules) => {
|
|
|
3964
3952
|
const [asyncValidationResults, setAsyncValidationResults] = useState({});
|
|
3965
3953
|
const clearAsyncValidationResults = useCallback(() => setAsyncValidationResults({}), []);
|
|
3966
3954
|
const triggerAsyncValidation = useCallback((field, formState, mode) => {
|
|
3967
|
-
if (!asyncRules)
|
|
3968
|
-
return clearAsyncValidationResults();
|
|
3955
|
+
if (!asyncRules) return clearAsyncValidationResults();
|
|
3969
3956
|
const rule = asyncRules[field];
|
|
3970
|
-
if (!rule || !rule.modes.includes(mode))
|
|
3971
|
-
return clearAsyncValidationResults();
|
|
3957
|
+
if (!rule || !rule.modes.includes(mode)) return clearAsyncValidationResults();
|
|
3972
3958
|
const value = formState.data[field];
|
|
3973
3959
|
return rule.asyncValidate(formState.data[field], {
|
|
3974
3960
|
state: formState
|
|
@@ -4021,8 +4007,7 @@ const useStaticValidator = (rules2) => {
|
|
|
4021
4007
|
};
|
|
4022
4008
|
};
|
|
4023
4009
|
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema) => {
|
|
4024
|
-
if (!schema.length)
|
|
4025
|
-
return staticValidationErrors;
|
|
4010
|
+
if (!schema.length) return staticValidationErrors;
|
|
4026
4011
|
return schema.reduce((acc, field) => {
|
|
4027
4012
|
var _a;
|
|
4028
4013
|
return {
|
|
@@ -4076,8 +4061,7 @@ function useForm({
|
|
|
4076
4061
|
return (_a = state2.schema) == null ? void 0 : _a.every((key) => state2.valid[key]);
|
|
4077
4062
|
}, [state2.schema, state2.valid]);
|
|
4078
4063
|
const getTargetValue = useCallback((key, e) => {
|
|
4079
|
-
if (!(e == null ? void 0 : e.target))
|
|
4080
|
-
return e;
|
|
4064
|
+
if (!(e == null ? void 0 : e.target)) return e;
|
|
4081
4065
|
if (e.target.type === "checkbox") {
|
|
4082
4066
|
return !state2.data[key];
|
|
4083
4067
|
}
|
|
@@ -4173,8 +4157,7 @@ function useDataset(datasetIdentifier2, skip) {
|
|
|
4173
4157
|
const [dataset, setDataset] = useState([]);
|
|
4174
4158
|
const [loaded, setLoaded] = useState(false);
|
|
4175
4159
|
useEffect(() => {
|
|
4176
|
-
if (skip)
|
|
4177
|
-
return;
|
|
4160
|
+
if (skip) return;
|
|
4178
4161
|
getDataset2(datasetIdentifier2, i18n.locale).then((response) => {
|
|
4179
4162
|
const result = response && response.length ? response : [];
|
|
4180
4163
|
setDataset(result);
|
|
@@ -4337,15 +4320,12 @@ const Field = ({
|
|
|
4337
4320
|
isValid: !!isValid,
|
|
4338
4321
|
onBlurHandler: (e) => {
|
|
4339
4322
|
setIsFocused(false);
|
|
4340
|
-
if (onBlur)
|
|
4341
|
-
|
|
4342
|
-
if (onFieldBlur)
|
|
4343
|
-
onFieldBlur(e);
|
|
4323
|
+
if (onBlur) onBlur(e);
|
|
4324
|
+
if (onFieldBlur) onFieldBlur(e);
|
|
4344
4325
|
},
|
|
4345
4326
|
onFocusHandler: (e) => {
|
|
4346
4327
|
setIsFocused(true);
|
|
4347
|
-
if (onFocus)
|
|
4348
|
-
onFocus(e);
|
|
4328
|
+
if (onFocus) onFocus(e);
|
|
4349
4329
|
},
|
|
4350
4330
|
uniqueId
|
|
4351
4331
|
}), helper && helperPosition === "below" && jsx("span", {
|
|
@@ -4382,13 +4362,11 @@ const Field = ({
|
|
|
4382
4362
|
});
|
|
4383
4363
|
};
|
|
4384
4364
|
const getScrollParent = (node) => {
|
|
4385
|
-
if (!node)
|
|
4386
|
-
return null;
|
|
4365
|
+
if (!node) return null;
|
|
4387
4366
|
const isElement = node instanceof HTMLElement;
|
|
4388
4367
|
const overflowY = isElement && window.getComputedStyle(node).overflowY;
|
|
4389
4368
|
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
|
|
4390
|
-
if (isElement && isScrollable)
|
|
4391
|
-
return node;
|
|
4369
|
+
if (isElement && isScrollable) return node;
|
|
4392
4370
|
return getScrollParent(node.parentNode) ?? document.body;
|
|
4393
4371
|
};
|
|
4394
4372
|
function uuidv4() {
|
|
@@ -4438,11 +4416,10 @@ function SelectButtonElement({
|
|
|
4438
4416
|
isSearch,
|
|
4439
4417
|
...props
|
|
4440
4418
|
}) {
|
|
4441
|
-
if (filterable || isMulti || isSearch)
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
});
|
|
4419
|
+
if (filterable || isMulti || isSearch) return jsx("div", {
|
|
4420
|
+
...props,
|
|
4421
|
+
ref: toggleButtonRef
|
|
4422
|
+
});
|
|
4446
4423
|
return jsx("button", {
|
|
4447
4424
|
...props,
|
|
4448
4425
|
ref: toggleButtonRef,
|
|
@@ -4634,13 +4611,11 @@ const SelectListItem = ({
|
|
|
4634
4611
|
"data-disabled": !!item.disabled,
|
|
4635
4612
|
"data-value": item.id,
|
|
4636
4613
|
onClick: () => {
|
|
4637
|
-
if (item.disabled)
|
|
4638
|
-
return;
|
|
4614
|
+
if (item.disabled) return;
|
|
4639
4615
|
onSelect(!selected);
|
|
4640
4616
|
},
|
|
4641
4617
|
onKeyDown: (e) => {
|
|
4642
|
-
if (item.disabled)
|
|
4643
|
-
return;
|
|
4618
|
+
if (item.disabled) return;
|
|
4644
4619
|
onKeyDown(e);
|
|
4645
4620
|
},
|
|
4646
4621
|
role: "option",
|
|
@@ -4772,8 +4747,7 @@ const Select = ({
|
|
|
4772
4747
|
const closeList = () => {
|
|
4773
4748
|
setTextFilter(null);
|
|
4774
4749
|
setIsShowList(false);
|
|
4775
|
-
if (toggleButtonRef.current)
|
|
4776
|
-
toggleButtonRef.current.focus();
|
|
4750
|
+
if (toggleButtonRef.current) toggleButtonRef.current.focus();
|
|
4777
4751
|
};
|
|
4778
4752
|
const showList = () => {
|
|
4779
4753
|
let sp = scrollParent;
|
|
@@ -4800,8 +4774,7 @@ const Select = ({
|
|
|
4800
4774
|
setIsShowList(false);
|
|
4801
4775
|
};
|
|
4802
4776
|
const handleSelect = (selectedItem) => {
|
|
4803
|
-
if (readonly)
|
|
4804
|
-
return;
|
|
4777
|
+
if (readonly) return;
|
|
4805
4778
|
if (isMulti) {
|
|
4806
4779
|
const isAlreadySelected = active.find((item) => item.id === selectedItem.id);
|
|
4807
4780
|
const newActiveItems = isAlreadySelected ? [...active.filter((i) => i.id !== selectedItem.id).map((i) => i.id)] : [...active.map((i) => i.id), selectedItem.id];
|
|
@@ -4864,8 +4837,7 @@ const Select = ({
|
|
|
4864
4837
|
break;
|
|
4865
4838
|
case KEYBOARD_KEYS.arrowDown:
|
|
4866
4839
|
e.preventDefault();
|
|
4867
|
-
if (target.nextElementSibling)
|
|
4868
|
-
target.nextElementSibling.focus();
|
|
4840
|
+
if (target.nextElementSibling) target.nextElementSibling.focus();
|
|
4869
4841
|
break;
|
|
4870
4842
|
case KEYBOARD_KEYS.arrowUp:
|
|
4871
4843
|
e.preventDefault();
|
|
@@ -5664,8 +5636,7 @@ const tryShift = (matchedTokens, remainingTokens, fromIndex, shiftDistance) => {
|
|
|
5664
5636
|
}
|
|
5665
5637
|
return ((_a = token.allow) == null ? void 0 : _a.test(token.potentialValue)) ?? true;
|
|
5666
5638
|
});
|
|
5667
|
-
if (!allValid)
|
|
5668
|
-
return "notPossible";
|
|
5639
|
+
if (!allValid) return "notPossible";
|
|
5669
5640
|
let matchedUpTo = 0;
|
|
5670
5641
|
for (let i = 0; i < normalizedTokens.length; i += 1) {
|
|
5671
5642
|
const token = normalizedInputTokens.find((t) => t.originalIndex === i) ?? normalizedTokens[i];
|
|
@@ -5700,8 +5671,7 @@ const getAvailableInputTokens = (tokens) => {
|
|
|
5700
5671
|
...token,
|
|
5701
5672
|
offset: tokens.indexOf(token)
|
|
5702
5673
|
});
|
|
5703
|
-
if (token.type !== "input" || !token.optional)
|
|
5704
|
-
break;
|
|
5674
|
+
if (token.type !== "input" || !token.optional) break;
|
|
5705
5675
|
}
|
|
5706
5676
|
return availableTokens;
|
|
5707
5677
|
};
|
|
@@ -5710,13 +5680,10 @@ const getEagerSuffix = (tokens) => {
|
|
|
5710
5680
|
let suffix = "";
|
|
5711
5681
|
for (const token of tokens) {
|
|
5712
5682
|
if (token.type === "input") {
|
|
5713
|
-
if (token.optional)
|
|
5714
|
-
|
|
5715
|
-
else
|
|
5716
|
-
break;
|
|
5683
|
+
if (token.optional) continue;
|
|
5684
|
+
else break;
|
|
5717
5685
|
}
|
|
5718
|
-
if (!token.displayEagerly)
|
|
5719
|
-
break;
|
|
5686
|
+
if (!token.displayEagerly) break;
|
|
5720
5687
|
suffix += token.char;
|
|
5721
5688
|
}
|
|
5722
5689
|
return suffix;
|
|
@@ -5744,12 +5711,11 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5744
5711
|
while (true) {
|
|
5745
5712
|
const char = charsToProcess[0];
|
|
5746
5713
|
const token = tokensToProcess[0];
|
|
5747
|
-
if (!char && !tokensToProcess.some((t) => t.type === "input" && !t.optional))
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
};
|
|
5714
|
+
if (!char && !tokensToProcess.some((t) => t.type === "input" && !t.optional)) return {
|
|
5715
|
+
outcome: "correct",
|
|
5716
|
+
displayValue: displayValue() + getEagerSuffix(tokensToProcess),
|
|
5717
|
+
potentialForMoreOptionalInput: getPotentialForMoreOptionalInput(tokensToProcess)
|
|
5718
|
+
};
|
|
5753
5719
|
if (!char) {
|
|
5754
5720
|
const output = shiftRight(mask.possibleShifts, matchedTokens, tokensToProcess);
|
|
5755
5721
|
matchedTokens = output.matchedTokens;
|
|
@@ -5759,24 +5725,22 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5759
5725
|
displayValue: displayValue() + getEagerSuffix(tokensToProcess)
|
|
5760
5726
|
};
|
|
5761
5727
|
}
|
|
5762
|
-
if (!token)
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
};
|
|
5728
|
+
if (!token) return {
|
|
5729
|
+
outcome: "mismatch",
|
|
5730
|
+
badChar: char,
|
|
5731
|
+
mismatchAtChar: charIndex,
|
|
5732
|
+
mismatchedToken: "inputTooLong",
|
|
5733
|
+
partialDisplayValue: displayValue()
|
|
5734
|
+
};
|
|
5770
5735
|
if (token.type === "nonInput") {
|
|
5771
5736
|
if (token.includeInValue) {
|
|
5772
|
-
if (char !== token.char)
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
};
|
|
5737
|
+
if (char !== token.char) return {
|
|
5738
|
+
outcome: "mismatch",
|
|
5739
|
+
badChar: char,
|
|
5740
|
+
mismatchAtChar: charIndex,
|
|
5741
|
+
mismatchedToken: token,
|
|
5742
|
+
partialDisplayValue: displayValue()
|
|
5743
|
+
};
|
|
5780
5744
|
shiftChars(1);
|
|
5781
5745
|
}
|
|
5782
5746
|
matchedTokens.push(token);
|
|
@@ -5785,14 +5749,13 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5785
5749
|
if (token.type === "input") {
|
|
5786
5750
|
const availableTokens = getAvailableInputTokens(tokensToProcess);
|
|
5787
5751
|
const matchingToken = findMatchingToken(availableTokens, char);
|
|
5788
|
-
if (!matchingToken)
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
};
|
|
5752
|
+
if (!matchingToken) return {
|
|
5753
|
+
outcome: "mismatch",
|
|
5754
|
+
badChar: char,
|
|
5755
|
+
mismatchAtChar: charIndex,
|
|
5756
|
+
mismatchedToken: token,
|
|
5757
|
+
partialDisplayValue: displayValue()
|
|
5758
|
+
};
|
|
5796
5759
|
matchedTokens.push({
|
|
5797
5760
|
...matchingToken,
|
|
5798
5761
|
char
|
|
@@ -5803,30 +5766,26 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5803
5766
|
}
|
|
5804
5767
|
};
|
|
5805
5768
|
const deriveInputState = (isValid, isFocused, hasBlurred, isDisabled, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
|
|
5806
|
-
if (isDisabled)
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
return {
|
|
5827
|
-
isError: true,
|
|
5828
|
-
text: typeof errorMessage === "string" && errorMessage ? errorMessage : formatGuidance
|
|
5829
|
-
};
|
|
5769
|
+
if (isDisabled) return {
|
|
5770
|
+
isError: false
|
|
5771
|
+
};
|
|
5772
|
+
if (isValid && (!potentiallyMoreOptionalCharacters || !isFocused)) return {
|
|
5773
|
+
isError: false,
|
|
5774
|
+
text: jsxs(Fragment, {
|
|
5775
|
+
children: [jsx(Icon, {
|
|
5776
|
+
name: "checkmark-small",
|
|
5777
|
+
className: "adyen-kyc-helper-text__valid-format-check"
|
|
5778
|
+
}), i18n.get("formatIsCorrect")]
|
|
5779
|
+
})
|
|
5780
|
+
};
|
|
5781
|
+
if (isFocused && formatGuidance) return {
|
|
5782
|
+
isError: false,
|
|
5783
|
+
text: formatGuidance
|
|
5784
|
+
};
|
|
5785
|
+
if (!isValid && (shouldValidate || hasBlurred)) return {
|
|
5786
|
+
isError: true,
|
|
5787
|
+
text: typeof errorMessage === "string" && errorMessage ? errorMessage : formatGuidance
|
|
5788
|
+
};
|
|
5830
5789
|
return {
|
|
5831
5790
|
isError: false
|
|
5832
5791
|
};
|
|
@@ -5862,12 +5821,10 @@ const MaskedInputText = ({
|
|
|
5862
5821
|
i18n
|
|
5863
5822
|
} = useI18nContext();
|
|
5864
5823
|
const onMismatch = (mismatch) => {
|
|
5865
|
-
if (!inputRef.current)
|
|
5866
|
-
return;
|
|
5824
|
+
if (!inputRef.current) return;
|
|
5867
5825
|
setShowingMismatch(true);
|
|
5868
5826
|
inputRef.current.addEventListener("animationend", (event) => {
|
|
5869
|
-
if (event.animationName !== MISMATCH_ANIMATION_NAME)
|
|
5870
|
-
return;
|
|
5827
|
+
if (event.animationName !== MISMATCH_ANIMATION_NAME) return;
|
|
5871
5828
|
setShowingMismatch(false);
|
|
5872
5829
|
});
|
|
5873
5830
|
onMismatchExternal == null ? void 0 : onMismatchExternal(mismatch);
|
|
@@ -5878,16 +5835,14 @@ const MaskedInputText = ({
|
|
|
5878
5835
|
}
|
|
5879
5836
|
}, [mask]);
|
|
5880
5837
|
const getMaskResult = useCallback((pureValue) => {
|
|
5881
|
-
if (!mask)
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
};
|
|
5838
|
+
if (!mask) return {
|
|
5839
|
+
outcome: "partialCorrect",
|
|
5840
|
+
displayValue: pureValue
|
|
5841
|
+
};
|
|
5886
5842
|
return matchAgainstMask(transformOnType ? transformOnType(pureValue) : pureValue, mask, acceptObscuredValue);
|
|
5887
5843
|
}, [mask, transformOnType, acceptObscuredValue]);
|
|
5888
5844
|
const displayValueToPure = useCallback((displayValue2) => {
|
|
5889
|
-
if (!mask)
|
|
5890
|
-
return displayValue2;
|
|
5845
|
+
if (!mask) return displayValue2;
|
|
5891
5846
|
return displayValueToPureValue(displayValue2, mask);
|
|
5892
5847
|
}, [mask]);
|
|
5893
5848
|
const maskResult = useMemo(() => getMaskResult(value), [getMaskResult, value]);
|
|
@@ -5917,8 +5872,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5917
5872
|
const newPureValue = displayValueToPure(inputEl.value);
|
|
5918
5873
|
const newMaskResult = getMaskResult(newPureValue);
|
|
5919
5874
|
const returnCaretLater = (offset = 0) => {
|
|
5920
|
-
if (!inputEl.selectionStart)
|
|
5921
|
-
return;
|
|
5875
|
+
if (!inputEl.selectionStart) return;
|
|
5922
5876
|
setCaretReturnPosition(inputEl.selectionStart + offset);
|
|
5923
5877
|
};
|
|
5924
5878
|
const cancelInput = () => {
|
|
@@ -5963,8 +5917,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5963
5917
|
selectionStart,
|
|
5964
5918
|
selectionEnd
|
|
5965
5919
|
} = inputEl;
|
|
5966
|
-
if (!pasteValue || !selectionStart || selectionStart !== selectionEnd)
|
|
5967
|
-
return;
|
|
5920
|
+
if (!pasteValue || !selectionStart || selectionStart !== selectionEnd) return;
|
|
5968
5921
|
const pureDisplayValue = displayValueToPure(displayValue);
|
|
5969
5922
|
const purePasteValue = displayValueToPure(pasteValue);
|
|
5970
5923
|
const newPureValue = pureDisplayValue.slice(0, selectionStart) + purePasteValue + pureDisplayValue.slice(selectionStart);
|
|
@@ -5983,8 +5936,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5983
5936
|
onKeyDown: (event) => {
|
|
5984
5937
|
const inputEl = event.target;
|
|
5985
5938
|
const isCaretAtEndWithNoSelection = inputEl.selectionStart === inputEl.value.length && inputEl.selectionStart === inputEl.selectionEnd;
|
|
5986
|
-
if (event.key !== KEYBOARD_KEYS.backspace || !isCaretAtEndWithNoSelection)
|
|
5987
|
-
return;
|
|
5939
|
+
if (event.key !== KEYBOARD_KEYS.backspace || !isCaretAtEndWithNoSelection) return;
|
|
5988
5940
|
event.preventDefault();
|
|
5989
5941
|
const withLastCharRemoved = value.slice(0, value.length - 1);
|
|
5990
5942
|
const newMaskResult = getMaskResult(withLastCharRemoved);
|
|
@@ -6121,8 +6073,7 @@ const companyRegistrationNumberOptions = {
|
|
|
6121
6073
|
};
|
|
6122
6074
|
const getCompanyRegistrationNumberOptions = (country2, companyType2) => {
|
|
6123
6075
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
6124
|
-
if (!companyType2 || !optionsForCountry)
|
|
6125
|
-
return optionsForCountry;
|
|
6076
|
+
if (!companyType2 || !optionsForCountry) return optionsForCountry;
|
|
6126
6077
|
return optionsForCountry.filter((option) => {
|
|
6127
6078
|
var _a;
|
|
6128
6079
|
return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
|
|
@@ -6188,8 +6139,7 @@ const taxIdNumberOptions = {
|
|
|
6188
6139
|
};
|
|
6189
6140
|
const getTaxIdNumberOptions = (country2, companyType2) => {
|
|
6190
6141
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
6191
|
-
if (!companyType2 || !optionsForCountry)
|
|
6192
|
-
return optionsForCountry;
|
|
6142
|
+
if (!companyType2 || !optionsForCountry) return optionsForCountry;
|
|
6193
6143
|
return optionsForCountry.filter((option) => {
|
|
6194
6144
|
var _a;
|
|
6195
6145
|
return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
|
|
@@ -6217,8 +6167,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
6217
6167
|
}, [exemptedOption, setSelected]);
|
|
6218
6168
|
const options = useMemo(() => {
|
|
6219
6169
|
const availableOptions = getCompanyRegistrationNumberOptions(country2, companyType2) ?? [];
|
|
6220
|
-
if (availableOptions.length === 0 || !exemptedOption)
|
|
6221
|
-
return availableOptions;
|
|
6170
|
+
if (availableOptions.length === 0 || !exemptedOption) return availableOptions;
|
|
6222
6171
|
return [...availableOptions, {
|
|
6223
6172
|
id: "exempted",
|
|
6224
6173
|
name: exemptedOption
|
|
@@ -6229,8 +6178,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
6229
6178
|
setSelected(options[0].id);
|
|
6230
6179
|
}
|
|
6231
6180
|
}, [options, selected, setSelected]);
|
|
6232
|
-
if (options.length <= 1)
|
|
6233
|
-
return null;
|
|
6181
|
+
if (options.length <= 1) return null;
|
|
6234
6182
|
return jsx(Field, {
|
|
6235
6183
|
name: "companyRegistrationNumberType",
|
|
6236
6184
|
label: i18n.get("whichTypeOfRegistrationNumberDoYouHave"),
|
|
@@ -7441,15 +7389,13 @@ const defaultFieldConfig$8 = {
|
|
|
7441
7389
|
const inferCompanyRegistrationNumberType = (registrationNumber2, country2, companyType2) => {
|
|
7442
7390
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
7443
7391
|
const metadataFn = defaultFieldConfig$8[country2];
|
|
7444
|
-
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
7445
|
-
return void 0;
|
|
7392
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function") return void 0;
|
|
7446
7393
|
for (const option of optionsForCountry) {
|
|
7447
7394
|
const fieldMetadata = metadataFn({
|
|
7448
7395
|
companyType: companyType2,
|
|
7449
7396
|
registrationNumberType: option.id
|
|
7450
7397
|
});
|
|
7451
|
-
if (!fieldMetadata.validators)
|
|
7452
|
-
continue;
|
|
7398
|
+
if (!fieldMetadata.validators) continue;
|
|
7453
7399
|
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
7454
7400
|
if (validators.every((validator) => validator.validate(registrationNumber2))) {
|
|
7455
7401
|
return option.id;
|
|
@@ -8748,15 +8694,13 @@ const defaultFieldConfig$6 = {
|
|
|
8748
8694
|
const inferTaxIdNumberType = (taxId2, country2) => {
|
|
8749
8695
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
8750
8696
|
const metadataFn = defaultFieldConfig$6[country2] ?? defaultFieldConfig$7[country2];
|
|
8751
|
-
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
8752
|
-
return void 0;
|
|
8697
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function") return void 0;
|
|
8753
8698
|
for (const option of optionsForCountry) {
|
|
8754
8699
|
const fieldMetadata = metadataFn({
|
|
8755
8700
|
taxIdNumberType: option.id,
|
|
8756
8701
|
vatNumberType: option.id
|
|
8757
8702
|
});
|
|
8758
|
-
if (!fieldMetadata.validators)
|
|
8759
|
-
continue;
|
|
8703
|
+
if (!fieldMetadata.validators) continue;
|
|
8760
8704
|
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
8761
8705
|
if (validators.every((validator) => validator.validate(taxId2))) {
|
|
8762
8706
|
return option.id;
|
|
@@ -8785,8 +8729,7 @@ function TaxIdNumberTypeSelector({
|
|
|
8785
8729
|
}, [exemptedOption, setSelected]);
|
|
8786
8730
|
const options = useMemo(() => {
|
|
8787
8731
|
const availableOptions = getTaxIdNumberOptions(country2, companyType2) ?? [];
|
|
8788
|
-
if (availableOptions.length === 0 || !exemptedOption)
|
|
8789
|
-
return availableOptions;
|
|
8732
|
+
if (availableOptions.length === 0 || !exemptedOption) return availableOptions;
|
|
8790
8733
|
return [...availableOptions, {
|
|
8791
8734
|
id: "exempted",
|
|
8792
8735
|
name: exemptedOption
|
|
@@ -8797,8 +8740,7 @@ function TaxIdNumberTypeSelector({
|
|
|
8797
8740
|
handleSelect(options[0].id);
|
|
8798
8741
|
}
|
|
8799
8742
|
}, [options, selected, handleSelect]);
|
|
8800
|
-
if (options.length <= 1)
|
|
8801
|
-
return null;
|
|
8743
|
+
if (options.length <= 1) return null;
|
|
8802
8744
|
return jsx(Field, {
|
|
8803
8745
|
name: "taxIdNumberType",
|
|
8804
8746
|
label: i18n.get("whichTypeOfTaxIdNumberDoYouHave"),
|
|
@@ -9020,8 +8962,7 @@ function VatNumber(props) {
|
|
|
9020
8962
|
}
|
|
9021
8963
|
});
|
|
9022
8964
|
}, [data, valid, errors, isValid]);
|
|
9023
|
-
if (!formUtils.isRequiredField("vatNumber"))
|
|
9024
|
-
return null;
|
|
8965
|
+
if (!formUtils.isRequiredField("vatNumber")) return null;
|
|
9025
8966
|
const exemptionIsPossible = ((_b = mergedProps.requiredFields) == null ? void 0 : _b.includes("exemptedFromVat")) ?? false;
|
|
9026
8967
|
const showTaxIdExemptedOption = exemptionIsPossible && ((_c = taxIdNumberOptions[country2]) == null ? void 0 : _c.length) > 1;
|
|
9027
8968
|
const handleTaxIdNumberTypeChange = (taxIdType) => {
|
|
@@ -9969,10 +9910,9 @@ const EntityTypeSelectionRadioCardBody = ({
|
|
|
9969
9910
|
const {
|
|
9970
9911
|
i18n
|
|
9971
9912
|
} = useI18nContext();
|
|
9972
|
-
if (!examples)
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
});
|
|
9913
|
+
if (!examples) return jsx("span", {
|
|
9914
|
+
children: i18n.get(description2)
|
|
9915
|
+
});
|
|
9976
9916
|
return jsxs(Fragment, {
|
|
9977
9917
|
children: [jsx("span", {
|
|
9978
9918
|
className: "adyen-kyc-entity-type-radio-group-card__description",
|
|
@@ -9991,8 +9931,7 @@ const EntityTypeSelectionRadioCardBody = ({
|
|
|
9991
9931
|
const CoreContext = createContext(void 0);
|
|
9992
9932
|
const useCoreContext = () => {
|
|
9993
9933
|
const context = useContext(CoreContext);
|
|
9994
|
-
if (!context)
|
|
9995
|
-
throw Error("You need a <CoreProvider> to use core context");
|
|
9934
|
+
if (!context) throw Error("You need a <CoreProvider> to use core context");
|
|
9996
9935
|
return context;
|
|
9997
9936
|
};
|
|
9998
9937
|
var TrustMemberTypes = /* @__PURE__ */ ((TrustMemberTypes2) => {
|
|
@@ -10205,22 +10144,17 @@ function getNestedPropertyKeys(obj, includeUndefined = false) {
|
|
|
10205
10144
|
return fieldNames;
|
|
10206
10145
|
}
|
|
10207
10146
|
const getTaskStatus = (type, capabilityProblems, rootLegalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
|
|
10208
|
-
if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity))
|
|
10209
|
-
return TaskStatus.EMPTY;
|
|
10147
|
+
if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity)) return TaskStatus.EMPTY;
|
|
10210
10148
|
const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
|
|
10211
|
-
if (importantCapabilityStatus)
|
|
10212
|
-
|
|
10213
|
-
if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity))
|
|
10214
|
-
return TaskStatus.PROCESSING;
|
|
10149
|
+
if (importantCapabilityStatus) return importantCapabilityStatus;
|
|
10150
|
+
if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity)) return TaskStatus.PROCESSING;
|
|
10215
10151
|
return TaskStatus.FINISHED;
|
|
10216
10152
|
};
|
|
10217
10153
|
const IMPORTANT_STATUSES = [TaskStatus.DETAILS_REQUIRED, TaskStatus.DOWNLOAD, TaskStatus.ERROR, TaskStatus.PROCESSING];
|
|
10218
10154
|
function checkForImportantCapabilityStatus(type, capabilityProblems, entityIds) {
|
|
10219
|
-
if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds)
|
|
10220
|
-
return;
|
|
10155
|
+
if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds) return;
|
|
10221
10156
|
const importantStatuses = Object.entries(capabilityProblems[type] ?? {}).filter(([key]) => entityIds == null ? void 0 : entityIds.includes(key)).map(([, value]) => value.status).filter((status) => status !== void 0 && IMPORTANT_STATUSES.includes(status));
|
|
10222
|
-
if (!importantStatuses.length)
|
|
10223
|
-
return;
|
|
10157
|
+
if (!importantStatuses.length) return;
|
|
10224
10158
|
return importantStatuses.reduce((prev, curr) => curr > prev ? curr : prev);
|
|
10225
10159
|
}
|
|
10226
10160
|
const hasPendingCapabilities = (legalEntityResponse) => Object.values(legalEntityResponse.capabilities ?? {}).some((capability) => capability.verificationStatus === "pending");
|
|
@@ -10239,14 +10173,11 @@ const emptyFieldsByEntityType = {
|
|
|
10239
10173
|
function isEmptyEntity(legalEntity) {
|
|
10240
10174
|
var _a;
|
|
10241
10175
|
const type = legalEntity == null ? void 0 : legalEntity.type;
|
|
10242
|
-
if (!type)
|
|
10243
|
-
|
|
10244
|
-
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length)
|
|
10245
|
-
return false;
|
|
10176
|
+
if (!type) return true;
|
|
10177
|
+
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) return false;
|
|
10246
10178
|
const minimumFields = emptyFieldsByEntityType[type];
|
|
10247
10179
|
const typeSpecificSection = legalEntity[type];
|
|
10248
|
-
if (!typeSpecificSection)
|
|
10249
|
-
return true;
|
|
10180
|
+
if (!typeSpecificSection) return true;
|
|
10250
10181
|
const fieldsOnEntity = getNestedPropertyKeys(typeSpecificSection);
|
|
10251
10182
|
return !fieldsOnEntity.some((field) => !minimumFields.includes(field));
|
|
10252
10183
|
}
|
|
@@ -10261,8 +10192,7 @@ const getDefaultAccountHolderType = (legalEntityResponse, isTypeChanging = false
|
|
|
10261
10192
|
if (accountHolder2) {
|
|
10262
10193
|
return accountHolder2;
|
|
10263
10194
|
}
|
|
10264
|
-
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.type))
|
|
10265
|
-
return void 0;
|
|
10195
|
+
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.type)) return void 0;
|
|
10266
10196
|
if (hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id)) {
|
|
10267
10197
|
return "mySoleProprietorName";
|
|
10268
10198
|
}
|
|
@@ -10704,11 +10634,9 @@ function DocumentGuidance({
|
|
|
10704
10634
|
}
|
|
10705
10635
|
function bytesToSize(bytes) {
|
|
10706
10636
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
10707
|
-
if (bytes === 0)
|
|
10708
|
-
return "n/a";
|
|
10637
|
+
if (bytes === 0) return "n/a";
|
|
10709
10638
|
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
|
|
10710
|
-
if (i === 0)
|
|
10711
|
-
return `${bytes} ${sizes[i]}`;
|
|
10639
|
+
if (i === 0) return `${bytes} ${sizes[i]}`;
|
|
10712
10640
|
return `${(bytes / 1024 ** i).toFixed()} ${sizes[i]}`;
|
|
10713
10641
|
}
|
|
10714
10642
|
const isExistingFile = (file) => "existing" in file && file.existing;
|
|
@@ -10725,11 +10653,9 @@ function DropzoneFile(props) {
|
|
|
10725
10653
|
} = useI18nContext();
|
|
10726
10654
|
const formatSize = (bytes) => {
|
|
10727
10655
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
10728
|
-
if (!bytes || bytes === 0)
|
|
10729
|
-
return "n/a";
|
|
10656
|
+
if (!bytes || bytes === 0) return "n/a";
|
|
10730
10657
|
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
|
|
10731
|
-
if (i === 0)
|
|
10732
|
-
return `${bytes} ${sizes[i]}`;
|
|
10658
|
+
if (i === 0) return `${bytes} ${sizes[i]}`;
|
|
10733
10659
|
return `${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]}`;
|
|
10734
10660
|
};
|
|
10735
10661
|
return jsxs("div", {
|
|
@@ -10785,40 +10711,35 @@ const fileValidationRules = ({
|
|
|
10785
10711
|
isOptional
|
|
10786
10712
|
}) => [{
|
|
10787
10713
|
validate: (files) => {
|
|
10788
|
-
if (isOptional && (!files || files.length === 0))
|
|
10789
|
-
return true;
|
|
10714
|
+
if (isOptional && (!files || files.length === 0)) return true;
|
|
10790
10715
|
return Boolean(files && files.length > 0);
|
|
10791
10716
|
},
|
|
10792
10717
|
errorMessage: "fieldIsRequired",
|
|
10793
10718
|
modes: ["blur", "input"]
|
|
10794
10719
|
}, {
|
|
10795
10720
|
validate: (files) => {
|
|
10796
|
-
if (!files)
|
|
10797
|
-
return true;
|
|
10721
|
+
if (!files) return true;
|
|
10798
10722
|
return files.length <= maxNumberOfFiles;
|
|
10799
10723
|
},
|
|
10800
10724
|
errorMessage: "tooManyFiles",
|
|
10801
10725
|
modes: ["blur", "input"]
|
|
10802
10726
|
}, {
|
|
10803
10727
|
validate: (files) => {
|
|
10804
|
-
if (!files)
|
|
10805
|
-
return true;
|
|
10728
|
+
if (!files) return true;
|
|
10806
10729
|
return !hasDuplicates(files.map((file) => file.name));
|
|
10807
10730
|
},
|
|
10808
10731
|
errorMessage: "duplicatedFiles",
|
|
10809
10732
|
modes: ["blur", "input"]
|
|
10810
10733
|
}, {
|
|
10811
10734
|
validate: (files) => {
|
|
10812
|
-
if (!files)
|
|
10813
|
-
return true;
|
|
10735
|
+
if (!files) return true;
|
|
10814
10736
|
return filterOnlyNewlyUploadedFiles(files).every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
|
|
10815
10737
|
},
|
|
10816
10738
|
errorMessage: "unsupportedFiletype",
|
|
10817
10739
|
modes: ["blur", "input"]
|
|
10818
10740
|
}, {
|
|
10819
10741
|
validate: (files) => {
|
|
10820
|
-
if (!files)
|
|
10821
|
-
return true;
|
|
10742
|
+
if (!files) return true;
|
|
10822
10743
|
return filterOnlyNewlyUploadedFiles(files).every((file) => !file.size || file.size < maxSize);
|
|
10823
10744
|
},
|
|
10824
10745
|
errorMessage: "maximumFileSizeExceeded",
|
|
@@ -11140,10 +11061,9 @@ function DocumentUploadComponent({
|
|
|
11140
11061
|
}, [data, valid, errors, fieldProblems]);
|
|
11141
11062
|
useEffect(() => {
|
|
11142
11063
|
var _a2, _b;
|
|
11143
|
-
if (documentField)
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
});
|
|
11064
|
+
if (documentField) setDocument({
|
|
11065
|
+
[documentField]: (_a2 = props == null ? void 0 : props.data) == null ? void 0 : _a2[documentField]
|
|
11066
|
+
});
|
|
11147
11067
|
setData("description", (_b = props.data) == null ? void 0 : _b.description);
|
|
11148
11068
|
triggerValidation();
|
|
11149
11069
|
}, [props.data]);
|
|
@@ -11348,8 +11268,7 @@ function StateField({
|
|
|
11348
11268
|
} = useDataset(datasetIdentifier.state(selectedCountry), !selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry));
|
|
11349
11269
|
const labelKey = getKeyForField("stateOrProvince", selectedCountry);
|
|
11350
11270
|
const placeholderKey = getKeyForField("stateOrProvincePlaceholder", selectedCountry);
|
|
11351
|
-
if (!loaded || !states.length)
|
|
11352
|
-
return null;
|
|
11271
|
+
if (!loaded || !states.length) return null;
|
|
11353
11272
|
return jsx(Field, {
|
|
11354
11273
|
name: "stateOrProvince",
|
|
11355
11274
|
label: (labels2 == null ? void 0 : labels2.stateOrProvince) || i18n.get(labelKey),
|
|
@@ -11463,14 +11382,12 @@ function useIsElementVisible(ref, fallback = true) {
|
|
|
11463
11382
|
const [isOnScreen, setIsOnScreen] = useState(isIntersectionObserverSupported ? false : fallback);
|
|
11464
11383
|
const observerRef = useRef();
|
|
11465
11384
|
useEffect(() => {
|
|
11466
|
-
if (!isIntersectionObserverSupported)
|
|
11467
|
-
return;
|
|
11385
|
+
if (!isIntersectionObserverSupported) return;
|
|
11468
11386
|
observerRef.current = new IntersectionObserver(([entry]) => setIsOnScreen(entry.isIntersecting));
|
|
11469
11387
|
}, []);
|
|
11470
11388
|
useEffect(() => {
|
|
11471
11389
|
var _a;
|
|
11472
|
-
if (!ref.current)
|
|
11473
|
-
return;
|
|
11390
|
+
if (!ref.current) return;
|
|
11474
11391
|
(_a = observerRef.current) == null ? void 0 : _a.observe(ref.current);
|
|
11475
11392
|
return () => {
|
|
11476
11393
|
var _a2;
|
|
@@ -11906,8 +11823,7 @@ const countrySpecificFormatters = {
|
|
|
11906
11823
|
postalCode: {
|
|
11907
11824
|
// Formatter - excludes non digits & hyphens and limits to a maxlength that varies depending on whether a hyphen is present or not
|
|
11908
11825
|
formatter: (val) => {
|
|
11909
|
-
if (!val)
|
|
11910
|
-
return void 0;
|
|
11826
|
+
if (!val) return void 0;
|
|
11911
11827
|
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
11912
11828
|
const maxlength = nuVal.includes("-") ? 6 : 5;
|
|
11913
11829
|
return nuVal.substring(0, maxlength);
|
|
@@ -11919,8 +11835,7 @@ const countrySpecificFormatters = {
|
|
|
11919
11835
|
[CountryCodes.Portugal]: {
|
|
11920
11836
|
postalCode: {
|
|
11921
11837
|
formatter: (val) => {
|
|
11922
|
-
if (!val)
|
|
11923
|
-
return void 0;
|
|
11838
|
+
if (!val) return void 0;
|
|
11924
11839
|
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
11925
11840
|
return nuVal.substring(0, 8);
|
|
11926
11841
|
},
|
|
@@ -12138,8 +12053,7 @@ function Address(props) {
|
|
|
12138
12053
|
}
|
|
12139
12054
|
}, [shouldValidate]);
|
|
12140
12055
|
const getComponent = (fieldName) => {
|
|
12141
|
-
if (!formUtils.isRequiredField(fieldName))
|
|
12142
|
-
return null;
|
|
12056
|
+
if (!formUtils.isRequiredField(fieldName)) return null;
|
|
12143
12057
|
const hideField = fieldName === "country" && hideCountry;
|
|
12144
12058
|
return jsx(FieldContainer, {
|
|
12145
12059
|
classNameModifiers: [fieldName],
|
|
@@ -12149,7 +12063,7 @@ function Address(props) {
|
|
|
12149
12063
|
fieldProblems,
|
|
12150
12064
|
fieldName,
|
|
12151
12065
|
handleChangeFor,
|
|
12152
|
-
maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country
|
|
12066
|
+
maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country),
|
|
12153
12067
|
hideField,
|
|
12154
12068
|
"aria-label": formUtils.getLabel(fieldName, fieldName),
|
|
12155
12069
|
trimOnBlur: true
|
|
@@ -12897,8 +12811,7 @@ const uploadDocuments = async (documents2, entityId) => {
|
|
|
12897
12811
|
return documentStore[entityId];
|
|
12898
12812
|
};
|
|
12899
12813
|
const updateEntityDocuments = (uploadedDocuments, entityId) => {
|
|
12900
|
-
if (!documentStore[entityId])
|
|
12901
|
-
documentStore[entityId] = [];
|
|
12814
|
+
if (!documentStore[entityId]) documentStore[entityId] = [];
|
|
12902
12815
|
uploadedDocuments.forEach((uploadedDocument) => {
|
|
12903
12816
|
if (uploadedDocument) {
|
|
12904
12817
|
const existingDocumentIndex = documentStore[entityId].findIndex((document2) => document2.id === uploadedDocument.id);
|
|
@@ -13089,11 +13002,10 @@ const rules$2 = ({
|
|
|
13089
13002
|
});
|
|
13090
13003
|
const getAccountIdentificationFromPayoutAccountSchema = (payoutAccount2, bankCountry2) => {
|
|
13091
13004
|
var _a;
|
|
13092
|
-
if ("iban" in payoutAccount2 && payoutAccount2.iban)
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
};
|
|
13005
|
+
if ("iban" in payoutAccount2 && payoutAccount2.iban) return {
|
|
13006
|
+
type: "iban",
|
|
13007
|
+
iban: payoutAccount2.iban
|
|
13008
|
+
};
|
|
13097
13009
|
const countryPrefix = bankCountry2 === "GB" ? "uk" : bankCountry2.toLowerCase();
|
|
13098
13010
|
const localAccount = {
|
|
13099
13011
|
type: `${countryPrefix}Local`,
|
|
@@ -13779,11 +13691,9 @@ const mapSolePropToLegalEntity = (data) => {
|
|
|
13779
13691
|
const getPage = ({
|
|
13780
13692
|
attachments
|
|
13781
13693
|
}, pageType) => {
|
|
13782
|
-
if (!attachments)
|
|
13783
|
-
throw Error("Document has no attachments");
|
|
13694
|
+
if (!attachments) throw Error("Document has no attachments");
|
|
13784
13695
|
const attachment = pageType ? attachments.find((attach) => attach.pageType === pageType) : attachments[0];
|
|
13785
|
-
if (!attachment)
|
|
13786
|
-
throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
13696
|
+
if (!attachment) throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
13787
13697
|
return attachment;
|
|
13788
13698
|
};
|
|
13789
13699
|
const getPageName = (document2, pageType) => getPage(document2, pageType).pageName;
|
|
@@ -14189,8 +14099,7 @@ const useIdVerificationToken = ({
|
|
|
14189
14099
|
const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
|
|
14190
14100
|
useEffect(() => {
|
|
14191
14101
|
(async () => {
|
|
14192
|
-
if (!hasAllUserDetails)
|
|
14193
|
-
return;
|
|
14102
|
+
if (!hasAllUserDetails) return;
|
|
14194
14103
|
try {
|
|
14195
14104
|
setLoadingStatus("loading");
|
|
14196
14105
|
const data = {
|
|
@@ -14351,8 +14260,7 @@ function IdVerificationComponent({
|
|
|
14351
14260
|
const onfidoSdk = useRef();
|
|
14352
14261
|
useEffect(() => {
|
|
14353
14262
|
(async () => {
|
|
14354
|
-
if (!sdkToken2)
|
|
14355
|
-
return;
|
|
14263
|
+
if (!sdkToken2) return;
|
|
14356
14264
|
onfidoSdk.current = await initOnfido({
|
|
14357
14265
|
token: sdkToken2,
|
|
14358
14266
|
i18n,
|
|
@@ -14362,13 +14270,11 @@ function IdVerificationComponent({
|
|
|
14362
14270
|
});
|
|
14363
14271
|
})().catch(logger$p.error);
|
|
14364
14272
|
return () => {
|
|
14365
|
-
if (onfidoSdk.current)
|
|
14366
|
-
onfidoSdk.current.tearDown();
|
|
14273
|
+
if (onfidoSdk.current) onfidoSdk.current.tearDown();
|
|
14367
14274
|
};
|
|
14368
14275
|
}, [sdkToken2]);
|
|
14369
14276
|
useEffect(() => {
|
|
14370
|
-
if (!onfidoSdk.current)
|
|
14371
|
-
return;
|
|
14277
|
+
if (!onfidoSdk.current) return;
|
|
14372
14278
|
onfidoSdk.current.setOptions({
|
|
14373
14279
|
language: getOnfidoLocaleConfig(i18n)
|
|
14374
14280
|
});
|
|
@@ -14534,8 +14440,7 @@ const layoutBreakpointSizes = {
|
|
|
14534
14440
|
const getBreakpointClassNames = (containerSize) => {
|
|
14535
14441
|
const breakPoints = Object.entries(layoutBreakpointSizes);
|
|
14536
14442
|
const classes = breakPoints.reduce((acc, [bp, size]) => {
|
|
14537
|
-
if (size <= containerSize)
|
|
14538
|
-
acc.push(layoutBreakpointClassnames[bp]);
|
|
14443
|
+
if (size <= containerSize) acc.push(layoutBreakpointClassnames[bp]);
|
|
14539
14444
|
return acc;
|
|
14540
14445
|
}, []);
|
|
14541
14446
|
return classes.length > 0 ? classes : ["adyen-layout-xs-only"];
|
|
@@ -14560,8 +14465,7 @@ const AutoResizer = ({
|
|
|
14560
14465
|
const containerRef = useRef(null);
|
|
14561
14466
|
useEffect(() => {
|
|
14562
14467
|
const container = containerRef.current;
|
|
14563
|
-
if (!container)
|
|
14564
|
-
return;
|
|
14468
|
+
if (!container) return;
|
|
14565
14469
|
const resizeObserver = new ResizeObserver((entries) => assignLayoutClasses(entries, container));
|
|
14566
14470
|
resizeObserver.observe(container);
|
|
14567
14471
|
return () => resizeObserver.unobserve(container);
|
|
@@ -14806,8 +14710,7 @@ function useVerification(fieldsToVerify, country2) {
|
|
|
14806
14710
|
const verificationPromises = [];
|
|
14807
14711
|
fieldsToVerify.forEach((field) => {
|
|
14808
14712
|
if (field === "idNumber" && formState.data[field]) {
|
|
14809
|
-
if (formState.data[field] === savedData[field] || country2 === "US" && formState.data[field].length === 4)
|
|
14810
|
-
return;
|
|
14713
|
+
if (formState.data[field] === savedData[field] || country2 === "US" && formState.data[field].length === 4) return;
|
|
14811
14714
|
const request = {
|
|
14812
14715
|
name: {
|
|
14813
14716
|
firstName: formState.data.firstName,
|
|
@@ -14843,10 +14746,8 @@ function InputTelephone(props) {
|
|
|
14843
14746
|
const staticPhoneValidationRules = (phonePrefixes, defaultPrefix) => ({
|
|
14844
14747
|
phoneNumber: {
|
|
14845
14748
|
validate: (phoneNumber2) => {
|
|
14846
|
-
if (!phoneNumber2)
|
|
14847
|
-
|
|
14848
|
-
if (!phonePrefixes.length)
|
|
14849
|
-
return phoneNumber2.startsWith("+");
|
|
14749
|
+
if (!phoneNumber2) return false;
|
|
14750
|
+
if (!phonePrefixes.length) return phoneNumber2.startsWith("+");
|
|
14850
14751
|
return phonePrefixes.map((prefix) => prefix.name).some((name) => phoneNumber2.startsWith(name));
|
|
14851
14752
|
},
|
|
14852
14753
|
errorMessage: {
|
|
@@ -14866,8 +14767,7 @@ const useAsyncPhoneValidationRules = () => {
|
|
|
14866
14767
|
phoneNumber: {
|
|
14867
14768
|
asyncValidate: async (phoneNumber2) => {
|
|
14868
14769
|
var _a;
|
|
14869
|
-
if (!phoneNumber2)
|
|
14870
|
-
return false;
|
|
14770
|
+
if (!phoneNumber2) return false;
|
|
14871
14771
|
return (_a = await validatePhoneNumber2(phoneNumber2)) == null ? void 0 : _a.valid;
|
|
14872
14772
|
},
|
|
14873
14773
|
errorMessage: "invalidPhoneNumber",
|
|
@@ -15596,8 +15496,7 @@ function IdentityNumberComponent(props) {
|
|
|
15596
15496
|
...data
|
|
15597
15497
|
};
|
|
15598
15498
|
adjustedData.idNumber = data.idNumberExempt ? void 0 : data.idNumber;
|
|
15599
|
-
if (data.idNumberExempt && formErrors.idNumber !== null)
|
|
15600
|
-
setFormErrors("idNumber", null);
|
|
15499
|
+
if (data.idNumberExempt && formErrors.idNumber !== null) setFormErrors("idNumber", null);
|
|
15601
15500
|
(_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
|
|
15602
15501
|
type: "addToState",
|
|
15603
15502
|
value: {
|
|
@@ -15717,8 +15616,7 @@ const getRoleName = (role2) => {
|
|
|
15717
15616
|
};
|
|
15718
15617
|
const makeSelectItemForRole = (role2, i18n) => {
|
|
15719
15618
|
const metadata = roleMetadata[role2];
|
|
15720
|
-
if (!metadata)
|
|
15721
|
-
throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
|
|
15619
|
+
if (!metadata) throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
|
|
15722
15620
|
const {
|
|
15723
15621
|
name,
|
|
15724
15622
|
description: description2,
|
|
@@ -15732,11 +15630,9 @@ const makeSelectItemForRole = (role2, i18n) => {
|
|
|
15732
15630
|
};
|
|
15733
15631
|
};
|
|
15734
15632
|
const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
|
|
15735
|
-
if (propagationMode === "stop")
|
|
15736
|
-
event.stopPropagation();
|
|
15633
|
+
if (propagationMode === "stop") event.stopPropagation();
|
|
15737
15634
|
if (keys.includes(event.key)) {
|
|
15738
|
-
if (propagationMode === "stopIfMatches")
|
|
15739
|
-
event.stopPropagation();
|
|
15635
|
+
if (propagationMode === "stopIfMatches") event.stopPropagation();
|
|
15740
15636
|
callback();
|
|
15741
15637
|
}
|
|
15742
15638
|
};
|
|
@@ -15865,8 +15761,7 @@ function IndividualIdNumberTypeSelector({
|
|
|
15865
15761
|
setSelected(options[0].id);
|
|
15866
15762
|
}
|
|
15867
15763
|
}, [options, selected, setSelected]);
|
|
15868
|
-
if (options.length <= 1)
|
|
15869
|
-
return null;
|
|
15764
|
+
if (options.length <= 1) return null;
|
|
15870
15765
|
return jsx(Field, {
|
|
15871
15766
|
name: "individualIdNumberType",
|
|
15872
15767
|
label: i18n.get("whichTypeOfIdNumberDoYouHave"),
|
|
@@ -17339,14 +17234,12 @@ function FilePicker({
|
|
|
17339
17234
|
const handleDrop = (e) => {
|
|
17340
17235
|
e.preventDefault();
|
|
17341
17236
|
e.stopPropagation();
|
|
17342
|
-
if (e.dataTransfer)
|
|
17343
|
-
addFiles(e.dataTransfer.files);
|
|
17237
|
+
if (e.dataTransfer) addFiles(e.dataTransfer.files);
|
|
17344
17238
|
setDragged(false);
|
|
17345
17239
|
};
|
|
17346
17240
|
const handleFilesChosen = (e) => {
|
|
17347
17241
|
const fileInput2 = e.target;
|
|
17348
|
-
if (fileInput2.files)
|
|
17349
|
-
addFiles(fileInput2.files);
|
|
17242
|
+
if (fileInput2.files) addFiles(fileInput2.files);
|
|
17350
17243
|
};
|
|
17351
17244
|
const addFiles = (newFiles) => {
|
|
17352
17245
|
setFiles([...newFiles, ...files]);
|
|
@@ -17679,8 +17572,7 @@ function BankDocument(props) {
|
|
|
17679
17572
|
var _a2;
|
|
17680
17573
|
if (hasAlreadyUploadedDocuments) {
|
|
17681
17574
|
setData("bankStatementDocument", alreadyUploadedDocuments);
|
|
17682
|
-
if ((_a2 = props.data) == null ? void 0 : _a2.description)
|
|
17683
|
-
setData("description", props.data.description);
|
|
17575
|
+
if ((_a2 = props.data) == null ? void 0 : _a2.description) setData("description", props.data.description);
|
|
17684
17576
|
triggerValidation();
|
|
17685
17577
|
}
|
|
17686
17578
|
}, [alreadyUploadedDocuments, hasAlreadyUploadedDocuments, (_b = props.data) == null ? void 0 : _b.description, setData, triggerValidation]);
|
|
@@ -18132,12 +18024,10 @@ const httpDelete = async (options, data) => http({
|
|
|
18132
18024
|
}, data);
|
|
18133
18025
|
const removeElementSiblings = (element) => {
|
|
18134
18026
|
const parent = element.parentNode;
|
|
18135
|
-
if (!parent)
|
|
18136
|
-
return;
|
|
18027
|
+
if (!parent) return;
|
|
18137
18028
|
let child = parent.firstChild;
|
|
18138
18029
|
while (child) {
|
|
18139
|
-
if (child !== element)
|
|
18140
|
-
parent.removeChild(child);
|
|
18030
|
+
if (child !== element) parent.removeChild(child);
|
|
18141
18031
|
child = child.nextSibling;
|
|
18142
18032
|
}
|
|
18143
18033
|
};
|
|
@@ -18151,8 +18041,7 @@ const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(dat
|
|
|
18151
18041
|
const parseMessageJson = (message) => {
|
|
18152
18042
|
try {
|
|
18153
18043
|
const messageData = JSON.parse(message);
|
|
18154
|
-
if (!RELEVANT_MESSAGE_TYPES.includes(messageData.type))
|
|
18155
|
-
return "invalid";
|
|
18044
|
+
if (!RELEVANT_MESSAGE_TYPES.includes(messageData.type)) return "invalid";
|
|
18156
18045
|
return messageData;
|
|
18157
18046
|
} catch {
|
|
18158
18047
|
return "invalid";
|
|
@@ -18179,8 +18068,7 @@ class IFrameWidget {
|
|
|
18179
18068
|
this.listener = async (message) => {
|
|
18180
18069
|
try {
|
|
18181
18070
|
const result = await this.handleMessage(message);
|
|
18182
|
-
if (!result)
|
|
18183
|
-
return;
|
|
18071
|
+
if (!result) return;
|
|
18184
18072
|
resolve(result);
|
|
18185
18073
|
} catch (err) {
|
|
18186
18074
|
reject(err);
|
|
@@ -18199,8 +18087,7 @@ class IFrameWidget {
|
|
|
18199
18087
|
this.sdkToken = sdkToken2;
|
|
18200
18088
|
}
|
|
18201
18089
|
removeMessageEventListener() {
|
|
18202
|
-
if (!this.listener)
|
|
18203
|
-
return;
|
|
18090
|
+
if (!this.listener) return;
|
|
18204
18091
|
window.removeEventListener("message", this.listener);
|
|
18205
18092
|
this.listener = void 0;
|
|
18206
18093
|
}
|
|
@@ -18209,19 +18096,16 @@ class IFrameWidget {
|
|
|
18209
18096
|
origin,
|
|
18210
18097
|
source
|
|
18211
18098
|
}) {
|
|
18212
|
-
if (source !== this.iframeWindow || origin !== this.iframeUrl.origin)
|
|
18213
|
-
return;
|
|
18099
|
+
if (source !== this.iframeWindow || origin !== this.iframeUrl.origin) return;
|
|
18214
18100
|
if (this.vendor !== TINK_VENDOR && isTerminalMessageData(data)) {
|
|
18215
18101
|
if (Object.getOwnPropertyNames(data).includes("error")) {
|
|
18216
18102
|
throw data;
|
|
18217
18103
|
}
|
|
18218
18104
|
return data;
|
|
18219
18105
|
}
|
|
18220
|
-
if (!isString(data))
|
|
18221
|
-
return;
|
|
18106
|
+
if (!isString(data)) return;
|
|
18222
18107
|
const jsonData = parseMessageJson(data);
|
|
18223
|
-
if (jsonData === "invalid")
|
|
18224
|
-
return;
|
|
18108
|
+
if (jsonData === "invalid") return;
|
|
18225
18109
|
const httpOptions = {
|
|
18226
18110
|
errorHandler: callbackErrorHandler,
|
|
18227
18111
|
loadingContext: "",
|
|
@@ -18243,8 +18127,7 @@ class IFrameWidget {
|
|
|
18243
18127
|
...httpOptions,
|
|
18244
18128
|
path: redirectUrl.href
|
|
18245
18129
|
});
|
|
18246
|
-
if (isVerifiedAccountsData(responseData))
|
|
18247
|
-
return responseData;
|
|
18130
|
+
if (isVerifiedAccountsData(responseData)) return responseData;
|
|
18248
18131
|
throw responseData;
|
|
18249
18132
|
} catch (reason) {
|
|
18250
18133
|
throw new AdyenKycSdkError("WIDGET_ACCOUNT_COMMIT_FAILURE", reason);
|
|
@@ -18303,8 +18186,7 @@ class IFrameWidget {
|
|
|
18303
18186
|
reject(new AdyenKycSdkError("WIDGET_TIMEOUT"));
|
|
18304
18187
|
}, MOUNT_TIMEOUT);
|
|
18305
18188
|
const cancelTimeout = () => {
|
|
18306
|
-
if (timeoutId)
|
|
18307
|
-
clearTimeout(timeoutId);
|
|
18189
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
18308
18190
|
};
|
|
18309
18191
|
this.iframeElement.addEventListener("load", () => {
|
|
18310
18192
|
cancelTimeout();
|
|
@@ -18476,8 +18358,6 @@ const useInstantVerificationErrorNotification = (notificationVisibilityDuration)
|
|
|
18476
18358
|
useEffect(() => {
|
|
18477
18359
|
clearNotificationTimeout();
|
|
18478
18360
|
if (errorNotification) {
|
|
18479
|
-
if (notificationVisibilityDuration <= 0)
|
|
18480
|
-
return;
|
|
18481
18361
|
dismissNotificationTimeoutRef.current = setTimeout(() => {
|
|
18482
18362
|
setErrorNotification(null);
|
|
18483
18363
|
clearNotificationTimeout();
|
|
@@ -18543,8 +18423,7 @@ function InstantBankVerification({
|
|
|
18543
18423
|
content: errorContent
|
|
18544
18424
|
});
|
|
18545
18425
|
}
|
|
18546
|
-
if (onBack)
|
|
18547
|
-
onBack();
|
|
18426
|
+
if (onBack) onBack();
|
|
18548
18427
|
break;
|
|
18549
18428
|
}
|
|
18550
18429
|
case "retry_verification":
|
|
@@ -18552,8 +18431,7 @@ function InstantBankVerification({
|
|
|
18552
18431
|
title: i18n.get("failedInitializeInstantVerification"),
|
|
18553
18432
|
content: errorContent
|
|
18554
18433
|
});
|
|
18555
|
-
if (onBack)
|
|
18556
|
-
onBack();
|
|
18434
|
+
if (onBack) onBack();
|
|
18557
18435
|
break;
|
|
18558
18436
|
default: {
|
|
18559
18437
|
const {
|
|
@@ -19326,8 +19204,7 @@ const customPrefixByCountry = {
|
|
|
19326
19204
|
[CountryCodes.IsleOfMan]: "GB"
|
|
19327
19205
|
};
|
|
19328
19206
|
function ibanValidator(input, bankCountry2) {
|
|
19329
|
-
if (isEmpty(input))
|
|
19330
|
-
return false;
|
|
19207
|
+
if (isEmpty(input)) return false;
|
|
19331
19208
|
const ibanInput = input.replace(/ /g, "").toUpperCase();
|
|
19332
19209
|
if (!/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(ibanInput)) {
|
|
19333
19210
|
return false;
|
|
@@ -19897,11 +19774,9 @@ const getMustHaveSameAccountHolderNameText = (legalEntityType, accountHolderName
|
|
|
19897
19774
|
}
|
|
19898
19775
|
};
|
|
19899
19776
|
const getInstantVerificationProvider = (bankVerificationProviders, bankCountry2) => {
|
|
19900
|
-
if (!bankVerificationProviders)
|
|
19901
|
-
return "loading";
|
|
19777
|
+
if (!bankVerificationProviders) return "loading";
|
|
19902
19778
|
const providerForCountry = bankVerificationProviders[bankCountry2];
|
|
19903
|
-
if (!providerForCountry)
|
|
19904
|
-
return void 0;
|
|
19779
|
+
if (!providerForCountry) return void 0;
|
|
19905
19780
|
return providerForCountry.toLowerCase();
|
|
19906
19781
|
};
|
|
19907
19782
|
function PayoutVerificationMethod(props) {
|
|
@@ -20635,8 +20510,7 @@ const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
|
|
|
20635
20510
|
}]
|
|
20636
20511
|
};
|
|
20637
20512
|
const getDecisionMakerRequirements = (country2) => {
|
|
20638
|
-
if (!country2)
|
|
20639
|
-
return DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20513
|
+
if (!country2) return DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20640
20514
|
return PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] ?? DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20641
20515
|
};
|
|
20642
20516
|
function getAvailableDecisionMakerRoleTypes(country2) {
|
|
@@ -20666,8 +20540,7 @@ const getDecisionMakerDescriptionMap = (country2) => ({
|
|
|
20666
20540
|
...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
|
|
20667
20541
|
});
|
|
20668
20542
|
const getOwnDecisionMakers = (rootLegalEntity) => {
|
|
20669
|
-
if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations))
|
|
20670
|
-
return [];
|
|
20543
|
+
if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations)) return [];
|
|
20671
20544
|
return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(DecisionMakerType).includes(entityAssociation.type) && entityAssociation.associatorId === rootLegalEntity.id);
|
|
20672
20545
|
};
|
|
20673
20546
|
const getDecisionMakers = (rootLegalEntity, companyLegalEntityId) => getDirectEntityAssociations(rootLegalEntity, companyLegalEntityId).filter((association2) => Object.values(DecisionMakerType).includes(association2.type));
|
|
@@ -20724,8 +20597,7 @@ const isPartOfTrustFromLegalEntity = (legalEntity) => {
|
|
|
20724
20597
|
};
|
|
20725
20598
|
const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
|
|
20726
20599
|
const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
|
|
20727
|
-
if (!trustLegalEntityId)
|
|
20728
|
-
return [];
|
|
20600
|
+
if (!trustLegalEntityId) return [];
|
|
20729
20601
|
const trustMemberAssociations = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId);
|
|
20730
20602
|
const trustMemberIds = trustMemberAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
|
|
20731
20603
|
return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
|
|
@@ -20899,8 +20771,7 @@ function TrustRegistrationDetailsComponent(props) {
|
|
|
20899
20771
|
classNameModifiers: ["country"],
|
|
20900
20772
|
handleChangeFor: () => (e) => {
|
|
20901
20773
|
handleChangeFor("country", "input")(e);
|
|
20902
|
-
if (onCountryChange)
|
|
20903
|
-
onCountryChange(e);
|
|
20774
|
+
if (onCountryChange) onCountryChange(e);
|
|
20904
20775
|
}
|
|
20905
20776
|
}), formUtils.isRequiredField("legalName") && jsx(Field, {
|
|
20906
20777
|
name: "legalName",
|
|
@@ -21917,8 +21788,7 @@ const getOpeningStep = (forms2, remediationActions) => {
|
|
|
21917
21788
|
var _a2;
|
|
21918
21789
|
return (form2 == null ? void 0 : form2.formId) === ((_a2 = allRemediationActions[0]) == null ? void 0 : _a2.forms[0]);
|
|
21919
21790
|
});
|
|
21920
|
-
if (form)
|
|
21921
|
-
return form;
|
|
21791
|
+
if (form) return form;
|
|
21922
21792
|
}
|
|
21923
21793
|
return forms2[forms2.length - 1];
|
|
21924
21794
|
}
|
|
@@ -21949,8 +21819,7 @@ const useFormComposer = ({
|
|
|
21949
21819
|
}) => formId === activeForm2.formId) ?? activeForm2);
|
|
21950
21820
|
}, [forms2]);
|
|
21951
21821
|
useEffect(() => {
|
|
21952
|
-
if (hasAlreadyNavigatedForm)
|
|
21953
|
-
return;
|
|
21822
|
+
if (hasAlreadyNavigatedForm) return;
|
|
21954
21823
|
const openingStep = getOpeningStep(forms2, problems == null ? void 0 : problems.remediationActions);
|
|
21955
21824
|
if (activeForm !== openingStep) {
|
|
21956
21825
|
setActiveForm(openingStep);
|
|
@@ -22125,14 +21994,12 @@ const useScenarioConfiguration = ({
|
|
|
22125
21994
|
}, [getConfigurationData, setLoadingStatus]);
|
|
22126
21995
|
useEffect(() => {
|
|
22127
21996
|
setLoadingStatus("loading");
|
|
22128
|
-
if (!getPayoutAccountFormatData)
|
|
22129
|
-
return;
|
|
21997
|
+
if (!getPayoutAccountFormatData) return;
|
|
22130
21998
|
const makePayoutFormatCallAndSave = async () => {
|
|
22131
21999
|
try {
|
|
22132
22000
|
const response = await getPayoutAccountFormatData();
|
|
22133
22001
|
setAccountFormatResponse(response);
|
|
22134
|
-
if (!response)
|
|
22135
|
-
return;
|
|
22002
|
+
if (!response) return;
|
|
22136
22003
|
const allowedBankAccountFormats = Object.keys(response);
|
|
22137
22004
|
if (existingBankAccountFormat && !allowedBankAccountFormats.includes(existingBankAccountFormat)) {
|
|
22138
22005
|
throw new AdyenKycSdkError(`Account format, ${existingBankAccountFormat}, of transferInstrument is not in allowed formats for ${country2}`);
|
|
@@ -22152,8 +22019,7 @@ const useScenarioConfiguration = ({
|
|
|
22152
22019
|
bankVerificationVendors,
|
|
22153
22020
|
requiredFields
|
|
22154
22021
|
} = useMemo(() => {
|
|
22155
|
-
if (!configurationResponse)
|
|
22156
|
-
return {};
|
|
22022
|
+
if (!configurationResponse) return {};
|
|
22157
22023
|
const {
|
|
22158
22024
|
matchingScenario,
|
|
22159
22025
|
bankVerificationProviders
|
|
@@ -22449,8 +22315,7 @@ function parsePayoutScenarios({
|
|
|
22449
22315
|
country: country2,
|
|
22450
22316
|
bankVerificationAvailable
|
|
22451
22317
|
}) {
|
|
22452
|
-
if (!requiredFields)
|
|
22453
|
-
return;
|
|
22318
|
+
if (!requiredFields) return;
|
|
22454
22319
|
const fieldConfigurations = {};
|
|
22455
22320
|
fieldConfigurations.payoutVerificationMethod = {
|
|
22456
22321
|
rule: "REQUIRED"
|
|
@@ -22748,8 +22613,7 @@ const getFieldsWithExistingData = (legalEntity, isExperimentEnabled) => {
|
|
|
22748
22613
|
var _a;
|
|
22749
22614
|
const apiFieldsWithExistingData = getNestedPropertyKeys(legalEntity);
|
|
22750
22615
|
const legalEntityType = legalEntity.type;
|
|
22751
|
-
if (!legalEntityType)
|
|
22752
|
-
return [];
|
|
22616
|
+
if (!legalEntityType) return [];
|
|
22753
22617
|
const nonDocumentFields = apiFieldsWithExistingData.map((field) => convertApiFieldNameToSchemaFieldName(field, legalEntityType, isExperimentEnabled)).filter((field) => field !== void 0).filter((field) => !knownProblematicFields.includes(field));
|
|
22754
22618
|
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) {
|
|
22755
22619
|
const documentFields = legalEntity.documentDetails.map((document2) => legalEntityDocumentToFieldMapping[legalEntityType][document2.type]).filter((field) => field !== void 0);
|
|
@@ -23025,8 +22889,7 @@ function FormNavigation({
|
|
|
23025
22889
|
} = useI18nContext();
|
|
23026
22890
|
const getFormIndex = (form) => forms2.findIndex((f) => f.formId === form.formId);
|
|
23027
22891
|
const goToForm = (form) => () => {
|
|
23028
|
-
if (form.formId === activeForm.formId)
|
|
23029
|
-
return;
|
|
22892
|
+
if (form.formId === activeForm.formId) return;
|
|
23030
22893
|
gotoForm(getFormIndex(form));
|
|
23031
22894
|
trackNavigation2({
|
|
23032
22895
|
fromForm: form,
|
|
@@ -23321,8 +23184,7 @@ function CompanyDropinComponent({
|
|
|
23321
23184
|
legalEntity,
|
|
23322
23185
|
dataSubmitted
|
|
23323
23186
|
}) => {
|
|
23324
|
-
if (!isDocumentsRequired$2(forms22))
|
|
23325
|
-
return;
|
|
23187
|
+
if (!isDocumentsRequired$2(forms22)) return;
|
|
23326
23188
|
const formattedDocument = await mapCompanyDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
23327
23189
|
if (formattedDocument) {
|
|
23328
23190
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
@@ -23602,8 +23464,7 @@ function useCompanySearch({
|
|
|
23602
23464
|
deepSearch
|
|
23603
23465
|
}) => {
|
|
23604
23466
|
try {
|
|
23605
|
-
if (!deepSearch)
|
|
23606
|
-
return;
|
|
23467
|
+
if (!deepSearch) return;
|
|
23607
23468
|
setStatus("loading");
|
|
23608
23469
|
setCompaniesList([]);
|
|
23609
23470
|
const {
|
|
@@ -23627,8 +23488,7 @@ function useCompanySearch({
|
|
|
23627
23488
|
return setStatus("idle");
|
|
23628
23489
|
}
|
|
23629
23490
|
try {
|
|
23630
|
-
if (!handleCompanyDeepSearch)
|
|
23631
|
-
return;
|
|
23491
|
+
if (!handleCompanyDeepSearch) return;
|
|
23632
23492
|
setStatus("loading");
|
|
23633
23493
|
setSelectedCompanyId(void 0);
|
|
23634
23494
|
const {
|
|
@@ -23649,8 +23509,7 @@ function useCompanySearch({
|
|
|
23649
23509
|
}, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
|
|
23650
23510
|
const verify2 = useCallback(async (companyTIN, company2) => {
|
|
23651
23511
|
try {
|
|
23652
|
-
if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset)
|
|
23653
|
-
return;
|
|
23512
|
+
if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
|
|
23654
23513
|
setStatus("loading");
|
|
23655
23514
|
setSelectedCompanyId(company2.id);
|
|
23656
23515
|
if (!canVerify || !companyTIN) {
|
|
@@ -23816,10 +23675,8 @@ const CompanyLookupResultsHeader = ({
|
|
|
23816
23675
|
if (status === "loading") {
|
|
23817
23676
|
return selectedCompanyId ? i18n.get("companyLookupResultsHeader__verifying") : i18n.get("companyLookupResultsHeader__searching");
|
|
23818
23677
|
}
|
|
23819
|
-
if (numberOfResults === 0 && status === "loaded")
|
|
23820
|
-
|
|
23821
|
-
if (numberOfResults)
|
|
23822
|
-
return i18n.get("companyLookupResultsHeader__results");
|
|
23678
|
+
if (numberOfResults === 0 && status === "loaded") return i18n.get("companyLookupResultsHeader__noResults");
|
|
23679
|
+
if (numberOfResults) return i18n.get("companyLookupResultsHeader__results");
|
|
23823
23680
|
return i18n.get("companyLookupResultsHeader");
|
|
23824
23681
|
}, [hasInternalError, status, numberOfResults, i18n, selectedCompanyId]);
|
|
23825
23682
|
const descriptionText = useMemo(() => {
|
|
@@ -24220,8 +24077,7 @@ function TaxInformationField({
|
|
|
24220
24077
|
type: countryToTaxInfoTypeMap[country2]
|
|
24221
24078
|
}];
|
|
24222
24079
|
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
24223
|
-
if (taxInfo.country !== country2)
|
|
24224
|
-
return taxInfo;
|
|
24080
|
+
if (taxInfo.country !== country2) return taxInfo;
|
|
24225
24081
|
return {
|
|
24226
24082
|
country: country2,
|
|
24227
24083
|
number: value,
|
|
@@ -24248,8 +24104,7 @@ function TaxInformationField({
|
|
|
24248
24104
|
type: countryToTaxInfoTypeMap[country2]
|
|
24249
24105
|
}];
|
|
24250
24106
|
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
24251
|
-
if (taxInfo.country !== country2)
|
|
24252
|
-
return taxInfo;
|
|
24107
|
+
if (taxInfo.country !== country2) return taxInfo;
|
|
24253
24108
|
return {
|
|
24254
24109
|
country: country2,
|
|
24255
24110
|
number: value,
|
|
@@ -24330,8 +24185,7 @@ const defaultFieldConfig = entriesOf(defaultFieldConfig$7).reduce((fieldConfig,
|
|
|
24330
24185
|
errorMessage: (taxInformation) => {
|
|
24331
24186
|
var _a;
|
|
24332
24187
|
const taxIdNumber2 = (_a = taxInformation == null ? void 0 : taxInformation.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _a.number;
|
|
24333
|
-
if (!taxIdNumber2)
|
|
24334
|
-
return void 0;
|
|
24188
|
+
if (!taxIdNumber2) return void 0;
|
|
24335
24189
|
return typeof validator.errorMessage === "function" ? validator.errorMessage(taxIdNumber2) : validator.errorMessage;
|
|
24336
24190
|
}
|
|
24337
24191
|
}));
|
|
@@ -25265,8 +25119,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25265
25119
|
}, defaultFieldMetadata).label;
|
|
25266
25120
|
return entriesOf(data).reduce((summaryData, [form, formData]) => {
|
|
25267
25121
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
25268
|
-
if (!form)
|
|
25269
|
-
return summaryData;
|
|
25122
|
+
if (!form) return summaryData;
|
|
25270
25123
|
switch (form) {
|
|
25271
25124
|
case "companyBasics":
|
|
25272
25125
|
return {
|
|
@@ -25300,8 +25153,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25300
25153
|
[form]: formatOtherDetails(formData, i18n, (_f = data.companyBasics) == null ? void 0 : _f.country, labels2)
|
|
25301
25154
|
};
|
|
25302
25155
|
case "companyRegistrationDocument":
|
|
25303
|
-
if (!isDocumentsRequired$1(forms2))
|
|
25304
|
-
return summaryData;
|
|
25156
|
+
if (!isDocumentsRequired$1(forms2)) return summaryData;
|
|
25305
25157
|
return {
|
|
25306
25158
|
...summaryData,
|
|
25307
25159
|
[form]: {
|
|
@@ -25311,8 +25163,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25311
25163
|
}
|
|
25312
25164
|
};
|
|
25313
25165
|
case "companyTaxDocument":
|
|
25314
|
-
if (!isDocumentsRequired$1(forms2))
|
|
25315
|
-
return summaryData;
|
|
25166
|
+
if (!isDocumentsRequired$1(forms2)) return summaryData;
|
|
25316
25167
|
return {
|
|
25317
25168
|
...summaryData,
|
|
25318
25169
|
[form]: {
|
|
@@ -25555,8 +25406,7 @@ function useCompanySearchTaskSubmit({
|
|
|
25555
25406
|
legalEntity,
|
|
25556
25407
|
currentForms
|
|
25557
25408
|
}) => {
|
|
25558
|
-
if (!isDocumentsRequired$1(currentForms))
|
|
25559
|
-
return;
|
|
25409
|
+
if (!isDocumentsRequired$1(currentForms)) return;
|
|
25560
25410
|
const formattedDocument = await mapCompanySearchDocumentToApiDocument(data, legalEntity.id);
|
|
25561
25411
|
try {
|
|
25562
25412
|
if (formattedDocument) {
|
|
@@ -25858,8 +25708,7 @@ function CompanySearchDropinComponent({
|
|
|
25858
25708
|
var _a2;
|
|
25859
25709
|
eventEmitter.on("updateLocale", (locale) => setLocale(locale));
|
|
25860
25710
|
const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
|
|
25861
|
-
if (!documentIds.length)
|
|
25862
|
-
return;
|
|
25711
|
+
if (!documentIds.length) return;
|
|
25863
25712
|
documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
|
|
25864
25713
|
setInitialData({
|
|
25865
25714
|
...initialData,
|
|
@@ -26018,8 +25867,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
26018
25867
|
}), [options]);
|
|
26019
25868
|
const rawValueRef = useRef(null);
|
|
26020
25869
|
const [value, setValue] = useState(() => {
|
|
26021
|
-
if (typeof window === "undefined")
|
|
26022
|
-
return defaultValue;
|
|
25870
|
+
if (typeof window === "undefined") return defaultValue;
|
|
26023
25871
|
try {
|
|
26024
25872
|
rawValueRef.current = window.localStorage.getItem(key);
|
|
26025
25873
|
const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
|
|
@@ -26030,8 +25878,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
26030
25878
|
}
|
|
26031
25879
|
});
|
|
26032
25880
|
useEffect(() => {
|
|
26033
|
-
if (typeof window === "undefined")
|
|
26034
|
-
return;
|
|
25881
|
+
if (typeof window === "undefined") return;
|
|
26035
25882
|
const updateLocalStorage = () => {
|
|
26036
25883
|
if (value !== void 0) {
|
|
26037
25884
|
const newValue = serializer(value);
|
|
@@ -26061,11 +25908,9 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
26061
25908
|
}
|
|
26062
25909
|
}, [value]);
|
|
26063
25910
|
useEffect(() => {
|
|
26064
|
-
if (!syncData)
|
|
26065
|
-
return;
|
|
25911
|
+
if (!syncData) return;
|
|
26066
25912
|
const handleStorageChange = (event) => {
|
|
26067
|
-
if (event.key !== key || event.storageArea !== window.localStorage)
|
|
26068
|
-
return;
|
|
25913
|
+
if (event.key !== key || event.storageArea !== window.localStorage) return;
|
|
26069
25914
|
try {
|
|
26070
25915
|
if (event.newValue !== rawValueRef.current) {
|
|
26071
25916
|
rawValueRef.current = event.newValue;
|
|
@@ -26075,8 +25920,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
26075
25920
|
logger$f.error(err);
|
|
26076
25921
|
}
|
|
26077
25922
|
};
|
|
26078
|
-
if (typeof window === "undefined")
|
|
26079
|
-
return;
|
|
25923
|
+
if (typeof window === "undefined") return;
|
|
26080
25924
|
window.addEventListener("storage", handleStorageChange);
|
|
26081
25925
|
return () => window.removeEventListener("storage", handleStorageChange);
|
|
26082
25926
|
}, [key, syncData]);
|
|
@@ -26110,11 +25954,9 @@ const useIsEligibleForSingpass = ({
|
|
|
26110
25954
|
const {
|
|
26111
25955
|
isExperimentEnabled
|
|
26112
25956
|
} = useExperimentsContext();
|
|
26113
|
-
if (!isExperimentEnabled("ShowSingPassButtonForCompanies"))
|
|
26114
|
-
return false;
|
|
25957
|
+
if (!isExperimentEnabled("ShowSingPassButtonForCompanies")) return false;
|
|
26115
25958
|
const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink) && getLegalEntityCountry(legalEntity) === CountryCodes.Singapore;
|
|
26116
|
-
if (!isSingpassEnabled)
|
|
26117
|
-
return false;
|
|
25959
|
+
if (!isSingpassEnabled) return false;
|
|
26118
25960
|
if (accountHolder2) {
|
|
26119
25961
|
return accountHolder2 === "theCompanyIWorkFor";
|
|
26120
25962
|
}
|
|
@@ -26157,8 +25999,7 @@ const useExemptSettlor = ({
|
|
|
26157
25999
|
setExemptSettlor(exemptSettlorLE);
|
|
26158
26000
|
}, [handleGetLegalEntity]);
|
|
26159
26001
|
useEffect(() => {
|
|
26160
|
-
if (!(trust2 == null ? void 0 : trust2.trust))
|
|
26161
|
-
return;
|
|
26002
|
+
if (!(trust2 == null ? void 0 : trust2.trust)) return;
|
|
26162
26003
|
updateExemptSettlor(trust2).catch(logger$d.error);
|
|
26163
26004
|
}, [trust2, updateExemptSettlor]);
|
|
26164
26005
|
return exemptSettlor;
|
|
@@ -26219,8 +26060,7 @@ const saveBlobAsFile = (fileData, filename) => {
|
|
|
26219
26060
|
const isNewEntity = Symbol("isNewEntity");
|
|
26220
26061
|
const splitAtFirstOccurrence = (str, separator) => {
|
|
26221
26062
|
const firstOccurrence = str.indexOf(separator);
|
|
26222
|
-
if (firstOccurrence === -1)
|
|
26223
|
-
return [str];
|
|
26063
|
+
if (firstOccurrence === -1) return [str];
|
|
26224
26064
|
return [str.slice(0, firstOccurrence), str.slice(firstOccurrence + 1)];
|
|
26225
26065
|
};
|
|
26226
26066
|
const getTrustMemberOwnerId = (trustMemberId, entityAssociations) => {
|
|
@@ -26247,23 +26087,21 @@ const convertEntityAssociationIntoTrustMember = (association2, associations, exe
|
|
|
26247
26087
|
name: association2.name
|
|
26248
26088
|
};
|
|
26249
26089
|
}
|
|
26250
|
-
if (association2.entityType === LegalEntityType.ORGANIZATION)
|
|
26251
|
-
|
|
26252
|
-
|
|
26253
|
-
|
|
26254
|
-
|
|
26255
|
-
|
|
26256
|
-
|
|
26257
|
-
|
|
26258
|
-
|
|
26259
|
-
|
|
26260
|
-
|
|
26261
|
-
|
|
26262
|
-
|
|
26263
|
-
|
|
26264
|
-
|
|
26265
|
-
name: association2.name
|
|
26266
|
-
};
|
|
26090
|
+
if (association2.entityType === LegalEntityType.ORGANIZATION) return {
|
|
26091
|
+
trustMemberType: "company",
|
|
26092
|
+
roles: [],
|
|
26093
|
+
legalEntityType: LegalEntityType.ORGANIZATION,
|
|
26094
|
+
legalEntityId: association2.legalEntityId,
|
|
26095
|
+
name: association2.name,
|
|
26096
|
+
ownerId: getTrustMemberOwnerId(association2.legalEntityId, associations)
|
|
26097
|
+
};
|
|
26098
|
+
if (association2.entityType === LegalEntityType.INDIVIDUAL) return {
|
|
26099
|
+
trustMemberType: "regular",
|
|
26100
|
+
roles: [],
|
|
26101
|
+
legalEntityType: LegalEntityType.INDIVIDUAL,
|
|
26102
|
+
legalEntityId: association2.legalEntityId,
|
|
26103
|
+
name: association2.name
|
|
26104
|
+
};
|
|
26267
26105
|
throw new Error(`Not a valid trust member: ${JSON.stringify(association2)}`);
|
|
26268
26106
|
};
|
|
26269
26107
|
const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations, exemptSettlorLE) => {
|
|
@@ -26323,14 +26161,13 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
|
|
|
26323
26161
|
if (trustMember.legalEntityId === isNewEntity) {
|
|
26324
26162
|
throw Error("Cannot map a new trust member, you must create it first");
|
|
26325
26163
|
}
|
|
26326
|
-
if (trustMember.trustMemberType === "exemptSettlor")
|
|
26327
|
-
|
|
26328
|
-
|
|
26329
|
-
|
|
26330
|
-
|
|
26331
|
-
|
|
26332
|
-
|
|
26333
|
-
}];
|
|
26164
|
+
if (trustMember.trustMemberType === "exemptSettlor") return [{
|
|
26165
|
+
legalEntityId: trustMember.legalEntityId,
|
|
26166
|
+
entityType: trustMember.legalEntityType,
|
|
26167
|
+
type: TrustMemberTypes.SETTLOR,
|
|
26168
|
+
settlorExemptionReason: trustMember.settlorExemptionReason,
|
|
26169
|
+
name: trustMember.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName}` : trustMember.name ?? ""
|
|
26170
|
+
}];
|
|
26334
26171
|
return trustMember.roles.map((role2) => ({
|
|
26335
26172
|
legalEntityId: trustMember.legalEntityId,
|
|
26336
26173
|
type: role2
|
|
@@ -26711,8 +26548,7 @@ const BusinessTypeSelection = ({
|
|
|
26711
26548
|
}, []);
|
|
26712
26549
|
const handleNextClick = async () => {
|
|
26713
26550
|
var _a2;
|
|
26714
|
-
if (loadingStatus === "loading")
|
|
26715
|
-
return;
|
|
26551
|
+
if (loadingStatus === "loading") return;
|
|
26716
26552
|
triggerValidation();
|
|
26717
26553
|
if (isValid) {
|
|
26718
26554
|
if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
|
|
@@ -27725,12 +27561,9 @@ const useLegalEntityType = ({
|
|
|
27725
27561
|
switch (legalEntity.type) {
|
|
27726
27562
|
case LegalEntityType.INDIVIDUAL:
|
|
27727
27563
|
case LegalEntityType.ORGANIZATION:
|
|
27728
|
-
if (!hasLegalAssociation)
|
|
27729
|
-
|
|
27730
|
-
if (
|
|
27731
|
-
return LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27732
|
-
if (isTrust)
|
|
27733
|
-
return LegalEntityType.TRUST;
|
|
27564
|
+
if (!hasLegalAssociation) return legalEntity.type;
|
|
27565
|
+
if (isSoleProprietor) return LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27566
|
+
if (isTrust) return LegalEntityType.TRUST;
|
|
27734
27567
|
break;
|
|
27735
27568
|
default:
|
|
27736
27569
|
return void 0;
|
|
@@ -27775,12 +27608,9 @@ const useIntroductionScreens = ({
|
|
|
27775
27608
|
const isSoleProprietor = legalEntityType === LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27776
27609
|
const isTrustScreen = screen === IntroductionScreens.TRUST || screen === IntroductionScreens.TRUST_MEMBER_OVERVIEW;
|
|
27777
27610
|
const isTrust = legalEntityType === LegalEntityType.TRUST;
|
|
27778
|
-
if (isAccountScreen)
|
|
27779
|
-
|
|
27780
|
-
if (
|
|
27781
|
-
return isSoleProprietor;
|
|
27782
|
-
if (isTrustScreen)
|
|
27783
|
-
return isTrust;
|
|
27611
|
+
if (isAccountScreen) return hasAccountTask;
|
|
27612
|
+
if (isSoleProprietorScreen) return isSoleProprietor;
|
|
27613
|
+
if (isTrustScreen) return isTrust;
|
|
27784
27614
|
return tasks.some((task) => screen === task);
|
|
27785
27615
|
}) : [], [legalEntityType, tasks]);
|
|
27786
27616
|
return canSeeIntroduction && (introductionScreens == null ? void 0 : introductionScreens.length) > 0 ? [IntroductionScreens.PROLOGUE, ...introductionScreens, IntroductionScreens.EPILOGUE] : void 0;
|
|
@@ -29230,8 +29060,7 @@ function IndividualDropinComponent({
|
|
|
29230
29060
|
dataSubmitted
|
|
29231
29061
|
}) => {
|
|
29232
29062
|
var _a2;
|
|
29233
|
-
if (!isDocumentsRequired2(forms22))
|
|
29234
|
-
return;
|
|
29063
|
+
if (!isDocumentsRequired2(forms22)) return;
|
|
29235
29064
|
if ((_a2 = dataSubmitted.idDocument) == null ? void 0 : _a2.instantIdVerificationData) {
|
|
29236
29065
|
await handleInstantIdVerificationStartCheck(dataSubmitted.idDocument.instantIdVerificationData, legalEntity.id);
|
|
29237
29066
|
} else {
|
|
@@ -29367,20 +29196,17 @@ function IndividualDropinComponent({
|
|
|
29367
29196
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
29368
29197
|
const formatIdDocument = (idDocument2) => {
|
|
29369
29198
|
var _a2, _b2;
|
|
29370
|
-
if (!idDocument2)
|
|
29371
|
-
return void 0;
|
|
29199
|
+
if (!idDocument2) return void 0;
|
|
29372
29200
|
const documentType2 = (idDocument2 == null ? void 0 : idDocument2.instantIdVerificationData) ? onfidoDocumentTypeMapping.find((document2) => {
|
|
29373
29201
|
var _a3;
|
|
29374
29202
|
return ((_a3 = idDocument2.instantIdVerificationData) == null ? void 0 : _a3.document_front.type) === document2.id;
|
|
29375
29203
|
}) : idDocumentTypeOptions.find(({
|
|
29376
29204
|
id: id2
|
|
29377
29205
|
}) => idDocument2.idDocumentType === id2);
|
|
29378
|
-
if (!documentType2)
|
|
29379
|
-
return void 0;
|
|
29206
|
+
if (!documentType2) return void 0;
|
|
29380
29207
|
const frontPage2 = (_a2 = idDocument2.idFrontPage) == null ? void 0 : _a2[0];
|
|
29381
29208
|
const backPage2 = (_b2 = idDocument2.idBackPage) == null ? void 0 : _b2[0];
|
|
29382
|
-
if (!frontPage2)
|
|
29383
|
-
return void 0;
|
|
29209
|
+
if (!frontPage2) return void 0;
|
|
29384
29210
|
return {
|
|
29385
29211
|
documentType: i18n.get(documentType2.name),
|
|
29386
29212
|
...backPage2 && documentType2.hasBackPage ? {
|
|
@@ -29564,8 +29390,7 @@ const rules$1 = ({
|
|
|
29564
29390
|
}) => ({
|
|
29565
29391
|
whenUsingManualVerification: () => {
|
|
29566
29392
|
var _a;
|
|
29567
|
-
if (!data.payoutVerificationMethod)
|
|
29568
|
-
return;
|
|
29393
|
+
if (!data.payoutVerificationMethod) return;
|
|
29569
29394
|
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "manualVerification") {
|
|
29570
29395
|
return "REQUIRED";
|
|
29571
29396
|
}
|
|
@@ -29829,8 +29654,7 @@ function PayoutDetailsDropinComponent({
|
|
|
29829
29654
|
useEffect(() => {
|
|
29830
29655
|
var _a2;
|
|
29831
29656
|
const payoutAccountData = (_a2 = cloneObject(data)) == null ? void 0 : _a2.payoutAccountDetails;
|
|
29832
|
-
if (payoutAccountData)
|
|
29833
|
-
setAccountDetailsFromInput(payoutAccountData);
|
|
29657
|
+
if (payoutAccountData) setAccountDetailsFromInput(payoutAccountData);
|
|
29834
29658
|
}, [data]);
|
|
29835
29659
|
const onSubmit = async () => {
|
|
29836
29660
|
setLoadingStatus("loading");
|
|
@@ -30119,8 +29943,7 @@ function PciDropinComponent({
|
|
|
30119
29943
|
name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
|
|
30120
29944
|
}];
|
|
30121
29945
|
const handleSignClick = async () => {
|
|
30122
|
-
if (loadingStatus === "loading")
|
|
30123
|
-
return;
|
|
29946
|
+
if (loadingStatus === "loading") return;
|
|
30124
29947
|
userEvents.addEvent("Clicked PCI signing", {
|
|
30125
29948
|
segmentation: {
|
|
30126
29949
|
...baseTrackingPayload
|
|
@@ -30252,8 +30075,7 @@ function PciDropinComponent({
|
|
|
30252
30075
|
});
|
|
30253
30076
|
}
|
|
30254
30077
|
const convertExistingSettlorExemptionReasons = (existingReasons) => {
|
|
30255
|
-
if (!existingReasons || !existingReasons.length)
|
|
30256
|
-
return ["noneOfTheAbove"];
|
|
30078
|
+
if (!existingReasons || !existingReasons.length) return ["noneOfTheAbove"];
|
|
30257
30079
|
return existingReasons;
|
|
30258
30080
|
};
|
|
30259
30081
|
const convertExistingTrustMember = (trustMember) => {
|
|
@@ -30368,8 +30190,7 @@ const getAvailableRolesByTrustMemberTypeAndLegalEntityType = (currentRoles, trus
|
|
|
30368
30190
|
return roles.filter((r) => r !== "secondaryTrustee");
|
|
30369
30191
|
};
|
|
30370
30192
|
const getAvailableRoles = (currentRoles) => {
|
|
30371
|
-
if (!(currentRoles == null ? void 0 : currentRoles.length))
|
|
30372
|
-
return Object.values(TrustMemberTypes);
|
|
30193
|
+
if (!(currentRoles == null ? void 0 : currentRoles.length)) return Object.values(TrustMemberTypes);
|
|
30373
30194
|
return currentRoles.map((role2) => [role2, ...allowedCrossoverRolesMatrix[role2]]).reduce((existingAllowed, allowedForRole) => existingAllowed.filter((role2) => allowedForRole.includes(role2)));
|
|
30374
30195
|
};
|
|
30375
30196
|
const trustMemberLegalEntityTypes = [LegalEntityType.INDIVIDUAL, LegalEntityType.ORGANIZATION];
|
|
@@ -30706,8 +30527,7 @@ const exemptSettlorForms = {
|
|
|
30706
30527
|
summary
|
|
30707
30528
|
};
|
|
30708
30529
|
const decideForms = (trustMember) => {
|
|
30709
|
-
if (trustMember === "incomplete")
|
|
30710
|
-
return regularForms;
|
|
30530
|
+
if (trustMember === "incomplete") return regularForms;
|
|
30711
30531
|
switch (trustMember.trustMemberType) {
|
|
30712
30532
|
case "undefinedBeneficiary":
|
|
30713
30533
|
return undefinedBeneficiaryForms;
|
|
@@ -30757,13 +30577,12 @@ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettl
|
|
|
30757
30577
|
legalEntityId: existingId ?? isNewEntity
|
|
30758
30578
|
};
|
|
30759
30579
|
}
|
|
30760
|
-
if (data.role.includes("undefinedBeneficiary"))
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
|
|
30766
|
-
};
|
|
30580
|
+
if (data.role.includes("undefinedBeneficiary")) return {
|
|
30581
|
+
trustMemberType: "undefinedBeneficiary",
|
|
30582
|
+
roles: [TrustMemberTypes.UNDEFINED_BENEFICIARY],
|
|
30583
|
+
description: data.descriptionUndefinedBeneficiary ?? "",
|
|
30584
|
+
reference: existingId ?? isNewEntity
|
|
30585
|
+
};
|
|
30767
30586
|
if (data.entityType === LegalEntityType.ORGANIZATION) {
|
|
30768
30587
|
return {
|
|
30769
30588
|
trustMemberType: "company",
|
|
@@ -30774,14 +30593,13 @@ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettl
|
|
|
30774
30593
|
country: data.country
|
|
30775
30594
|
};
|
|
30776
30595
|
}
|
|
30777
|
-
if (data.entityType === LegalEntityType.INDIVIDUAL)
|
|
30778
|
-
|
|
30779
|
-
|
|
30780
|
-
|
|
30781
|
-
|
|
30782
|
-
|
|
30783
|
-
|
|
30784
|
-
};
|
|
30596
|
+
if (data.entityType === LegalEntityType.INDIVIDUAL) return {
|
|
30597
|
+
trustMemberType: "regular",
|
|
30598
|
+
roles: data.role,
|
|
30599
|
+
legalEntityType: LegalEntityType.INDIVIDUAL,
|
|
30600
|
+
legalEntityId: existingId ?? isNewEntity,
|
|
30601
|
+
name: ""
|
|
30602
|
+
};
|
|
30785
30603
|
}
|
|
30786
30604
|
return "incomplete";
|
|
30787
30605
|
};
|
|
@@ -30841,8 +30659,7 @@ function RoleAndTypeDropinComponent({
|
|
|
30841
30659
|
setTrustMember(convertDataToTrustMember(data, existingTrustMember, isOrganizationSettlorWithExemptionEnabled));
|
|
30842
30660
|
};
|
|
30843
30661
|
const saveRolesAndNavigate = async () => {
|
|
30844
|
-
if (trustMember === "incomplete")
|
|
30845
|
-
return;
|
|
30662
|
+
if (trustMember === "incomplete") return;
|
|
30846
30663
|
if (hasRolesChanged(trustMember.roles, existingTrustMember == null ? void 0 : existingTrustMember.roles)) {
|
|
30847
30664
|
addOrUpdateTrustMember(trustMember);
|
|
30848
30665
|
}
|
|
@@ -30865,8 +30682,7 @@ function RoleAndTypeDropinComponent({
|
|
|
30865
30682
|
navigateToFullDropinFor(trustMember);
|
|
30866
30683
|
return;
|
|
30867
30684
|
}
|
|
30868
|
-
if (targetForm.formId === summaryStep.formId)
|
|
30869
|
-
return;
|
|
30685
|
+
if (targetForm.formId === summaryStep.formId) return;
|
|
30870
30686
|
}
|
|
30871
30687
|
setActiveForm(targetForm);
|
|
30872
30688
|
};
|
|
@@ -30940,8 +30756,7 @@ const useServiceAgreement = ({
|
|
|
30940
30756
|
}, [language]);
|
|
30941
30757
|
useEffect(() => {
|
|
30942
30758
|
const requestAcceptedServiceAgreement = async () => {
|
|
30943
|
-
if (!handleViewAcceptedTermsOfServiceDocument || !acceptanceId)
|
|
30944
|
-
return;
|
|
30759
|
+
if (!handleViewAcceptedTermsOfServiceDocument || !acceptanceId) return;
|
|
30945
30760
|
setLoading("loading");
|
|
30946
30761
|
const {
|
|
30947
30762
|
id: id2,
|
|
@@ -30957,8 +30772,7 @@ const useServiceAgreement = ({
|
|
|
30957
30772
|
}, [acceptanceId, handleViewAcceptedTermsOfServiceDocument]);
|
|
30958
30773
|
useEffect(() => {
|
|
30959
30774
|
const requestServiceAgreement = async () => {
|
|
30960
|
-
if (acceptanceId)
|
|
30961
|
-
return;
|
|
30775
|
+
if (acceptanceId) return;
|
|
30962
30776
|
setLoading("loading");
|
|
30963
30777
|
try {
|
|
30964
30778
|
const {
|
|
@@ -31094,8 +30908,7 @@ function ServiceAgreementDropinComponent({
|
|
|
31094
30908
|
}
|
|
31095
30909
|
});
|
|
31096
30910
|
triggerValidation();
|
|
31097
|
-
if (loadingStatus === "loading" || !serviceAgreement || !data.signer)
|
|
31098
|
-
return;
|
|
30911
|
+
if (loadingStatus === "loading" || !serviceAgreement || !data.signer) return;
|
|
31099
30912
|
if (isValid) {
|
|
31100
30913
|
try {
|
|
31101
30914
|
setLoadingStatus("loading");
|
|
@@ -31152,8 +30965,7 @@ function ServiceAgreementDropinComponent({
|
|
|
31152
30965
|
});
|
|
31153
30966
|
};
|
|
31154
30967
|
useEffect(() => {
|
|
31155
|
-
if (!serviceAgreementAcceptanceInfos.length)
|
|
31156
|
-
return;
|
|
30968
|
+
if (!serviceAgreementAcceptanceInfos.length) return;
|
|
31157
30969
|
gotoForm(serviceAgreementAcceptanceInfos.length - 1);
|
|
31158
30970
|
}, [serviceAgreementAcceptanceInfos]);
|
|
31159
30971
|
useEffect(() => {
|
|
@@ -31172,8 +30984,7 @@ function ServiceAgreementDropinComponent({
|
|
|
31172
30984
|
};
|
|
31173
30985
|
const onDownloadAcceptedTermsOfServiceDocument = async () => {
|
|
31174
30986
|
try {
|
|
31175
|
-
if (!canDownload)
|
|
31176
|
-
return;
|
|
30987
|
+
if (!canDownload) return;
|
|
31177
30988
|
const response = await handleDownloadAcceptedTermsOfServiceDocument(legalEntityResponse.id, activeForm.acceptanceId);
|
|
31178
30989
|
await downloadFile(response.document, `${i18n.get(activeForm.formName)}.pdf`);
|
|
31179
30990
|
} catch (e) {
|
|
@@ -31941,8 +31752,7 @@ const useNavigation = ({
|
|
|
31941
31752
|
}
|
|
31942
31753
|
}, [onNavigate]);
|
|
31943
31754
|
const navigateBack = useCallback((stepCount = 1) => {
|
|
31944
|
-
if (taskHistory.length <= 1)
|
|
31945
|
-
return;
|
|
31755
|
+
if (taskHistory.length <= 1) return;
|
|
31946
31756
|
const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
|
|
31947
31757
|
if (prevTask === "default") {
|
|
31948
31758
|
throw Error("Cannot navigate back to 'default' task");
|
|
@@ -31983,12 +31793,9 @@ const getDefaultTask = ({
|
|
|
31983
31793
|
shouldShowSingpassSelection
|
|
31984
31794
|
}) => {
|
|
31985
31795
|
const hasLegalEntityProgressedBeyondEntitySelection = hasProgressedBeyondEntitySelection(legalEntity);
|
|
31986
|
-
if (isNewEntryFlowEnabled && !accountHolder2 && !hasLegalEntityProgressedBeyondEntitySelection)
|
|
31987
|
-
|
|
31988
|
-
if (
|
|
31989
|
-
return TaskTypes.INTRODUCTION;
|
|
31990
|
-
if (shouldShowSingpassSelection)
|
|
31991
|
-
return TaskTypes.SINGPASS_SELECTION;
|
|
31796
|
+
if (isNewEntryFlowEnabled && !accountHolder2 && !hasLegalEntityProgressedBeyondEntitySelection) return TaskTypes.BUSINESS_TYPE_SELECTION;
|
|
31797
|
+
if (showIntroduction) return TaskTypes.INTRODUCTION;
|
|
31798
|
+
if (shouldShowSingpassSelection) return TaskTypes.SINGPASS_SELECTION;
|
|
31992
31799
|
return TaskTypes.TASKS_OVERVIEW;
|
|
31993
31800
|
};
|
|
31994
31801
|
const hasProgressedBeyondEntitySelection = (legalEntity) => {
|
|
@@ -32136,8 +31943,7 @@ function DropinComposerComponent({
|
|
|
32136
31943
|
}
|
|
32137
31944
|
}, [additionalSalesChannels, i18n, rootLegalEntity.id, args.handleGetPciTemplate]);
|
|
32138
31945
|
useEffect(() => {
|
|
32139
|
-
if (!tasks.includes(TaskTypes.PCI_DSS))
|
|
32140
|
-
return;
|
|
31946
|
+
if (!tasks.includes(TaskTypes.PCI_DSS)) return;
|
|
32141
31947
|
getPciTemplate2().catch(logger$b.error);
|
|
32142
31948
|
}, [getPciTemplate2, tasks]);
|
|
32143
31949
|
const addFetchedAcceptedByName = async (acceptanceInfo) => {
|
|
@@ -34235,11 +34041,9 @@ function ViewVerificationStatusComponent({
|
|
|
34235
34041
|
const [onboardingStatus, setOnboardingStatus] = useState();
|
|
34236
34042
|
const [alertContent, setAlertContent] = useState();
|
|
34237
34043
|
const content = useMemo(() => {
|
|
34238
|
-
if (!onboardingStatus)
|
|
34239
|
-
return;
|
|
34044
|
+
if (!onboardingStatus) return;
|
|
34240
34045
|
const statusContent = getContentByStatus(onboardingStatus);
|
|
34241
|
-
if (statusContent)
|
|
34242
|
-
return statusContent;
|
|
34046
|
+
if (statusContent) return statusContent;
|
|
34243
34047
|
logger$5.error(`there is no content for status "${onboardingStatus}"`);
|
|
34244
34048
|
}, [onboardingStatus]);
|
|
34245
34049
|
const handleError = ({
|
|
@@ -34495,8 +34299,7 @@ const buildSpriteDOMFromResponse = (responseData) => {
|
|
|
34495
34299
|
return iconContainer;
|
|
34496
34300
|
};
|
|
34497
34301
|
const loadDocumentGuidance = async (loadingContext) => {
|
|
34498
|
-
if (isDocumentGuidanceLoaded)
|
|
34499
|
-
return;
|
|
34302
|
+
if (isDocumentGuidanceLoaded) return;
|
|
34500
34303
|
isDocumentGuidanceLoaded = true;
|
|
34501
34304
|
const responseData = await http({
|
|
34502
34305
|
loadingContext,
|
|
@@ -34819,7 +34622,7 @@ const ConfigurationApiProvider = ({
|
|
|
34819
34622
|
isEmbeddedDropin,
|
|
34820
34623
|
loadingContext
|
|
34821
34624
|
} = authContext;
|
|
34822
|
-
const sdkVersion = "3.15.
|
|
34625
|
+
const sdkVersion = "3.15.3";
|
|
34823
34626
|
useAnalytics({
|
|
34824
34627
|
onUserEvent,
|
|
34825
34628
|
legalEntityId: rootLegalEntityId,
|
|
@@ -34922,12 +34725,10 @@ const useTranslations = ({
|
|
|
34922
34725
|
getDataset: getDataset2
|
|
34923
34726
|
} = useConfigurationApi();
|
|
34924
34727
|
useEffect(() => {
|
|
34925
|
-
if (!allowedLocales)
|
|
34926
|
-
return;
|
|
34728
|
+
if (!allowedLocales) return;
|
|
34927
34729
|
const isLocaleAllowed = allowedLocales.includes(locale);
|
|
34928
34730
|
const localeToUse = isLocaleAllowed ? locale : FALLBACK_LOCALE;
|
|
34929
|
-
if (loaded.locale === localeToUse)
|
|
34930
|
-
return;
|
|
34731
|
+
if (loaded.locale === localeToUse) return;
|
|
34931
34732
|
if (!isLocaleAllowed) {
|
|
34932
34733
|
logger.error(`
|
|
34933
34734
|
"${locale}" isn't a supported locale. Please use one of the following:
|
|
@@ -34978,6 +34779,13 @@ const I18nProvider = ({
|
|
|
34978
34779
|
children
|
|
34979
34780
|
});
|
|
34980
34781
|
};
|
|
34782
|
+
const QueryClient = new QueryClient$1();
|
|
34783
|
+
const QueryClientProvider = ({
|
|
34784
|
+
children
|
|
34785
|
+
}) => jsx(QueryClientProvider$1, {
|
|
34786
|
+
client: QueryClient,
|
|
34787
|
+
children
|
|
34788
|
+
});
|
|
34981
34789
|
const settingsDefaults = {
|
|
34982
34790
|
acceptedCountries: void 0,
|
|
34983
34791
|
allowBankAccountFormatSelection: false,
|
|
@@ -35015,8 +34823,7 @@ function SettingsProvider({
|
|
|
35015
34823
|
}
|
|
35016
34824
|
function removeObjectPropsWithEmptyValues(obj) {
|
|
35017
34825
|
keysOf(obj).forEach((key) => {
|
|
35018
|
-
if (obj[key] === null || isEmpty(obj[key]))
|
|
35019
|
-
delete obj[key];
|
|
34826
|
+
if (obj[key] === null || isEmpty(obj[key])) delete obj[key];
|
|
35020
34827
|
});
|
|
35021
34828
|
return obj;
|
|
35022
34829
|
}
|
|
@@ -35296,10 +35103,8 @@ class BaseElement {
|
|
|
35296
35103
|
}
|
|
35297
35104
|
}
|
|
35298
35105
|
const getRootLegalEntityId = (componentProps) => {
|
|
35299
|
-
if ("legalEntityId" in componentProps)
|
|
35300
|
-
|
|
35301
|
-
if ("legalEntityResponse" in componentProps)
|
|
35302
|
-
return componentProps.legalEntityResponse.id;
|
|
35106
|
+
if ("legalEntityId" in componentProps) return componentProps.legalEntityId;
|
|
35107
|
+
if ("legalEntityResponse" in componentProps) return componentProps.legalEntityResponse.id;
|
|
35303
35108
|
throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
|
|
35304
35109
|
};
|
|
35305
35110
|
class UIElement extends BaseElement {
|
|
@@ -35332,9 +35137,11 @@ class UIElement extends BaseElement {
|
|
|
35332
35137
|
children: jsx(AutoResizer, {
|
|
35333
35138
|
children: jsx(ToastContextProvider, {
|
|
35334
35139
|
children: jsx(StateProvider, {
|
|
35335
|
-
children: jsx(
|
|
35336
|
-
|
|
35337
|
-
|
|
35140
|
+
children: jsx(QueryClientProvider, {
|
|
35141
|
+
children: jsx(Component, {
|
|
35142
|
+
...this.props.componentProps,
|
|
35143
|
+
eventEmitter: this.eventEmitter
|
|
35144
|
+
})
|
|
35338
35145
|
})
|
|
35339
35146
|
})
|
|
35340
35147
|
})
|
|
@@ -36204,8 +36011,7 @@ class Core {
|
|
|
36204
36011
|
};
|
|
36205
36012
|
validateCoreOptions(newOptions);
|
|
36206
36013
|
newOptions.loadingContext = normalizeEnvironment(newOptions.environment);
|
|
36207
|
-
if (!newOptions.locale)
|
|
36208
|
-
newOptions.locale = FALLBACK_LOCALE;
|
|
36014
|
+
if (!newOptions.locale) newOptions.locale = FALLBACK_LOCALE;
|
|
36209
36015
|
return newOptions;
|
|
36210
36016
|
};
|
|
36211
36017
|
this.initializeSession = () => {
|