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