@adyen/kyc-components 2.41.2 → 2.41.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/adyen-kyc-components.es.js +334 -526
- package/dist/es/{arrow-left-CCxYxfCP.js → arrow-left-CwJQyOFz.js} +1 -1
- package/dist/es/{arrow-right-DF4Qe-8E.js → arrow-right-Cs_AKUOH.js} +1 -1
- package/dist/es/{bin-CGwewvcn.js → bin-8yaAerXc.js} +1 -1
- package/dist/es/{check-CeSLN4_9.js → check-_cOIMziL.js} +1 -1
- package/dist/es/{checkmark-DEh9MPYR.js → checkmark-CZpv8i5a.js} +1 -1
- package/dist/es/{checkmark-small-D_9HLctx.js → checkmark-small-C4TPve-W.js} +1 -1
- package/dist/es/{chevron-down-BzENwYSf.js → chevron-down-CwS2tE_6.js} +1 -1
- package/dist/es/{chevron-right-DczMHcvL.js → chevron-right-B8cQLres.js} +1 -1
- package/dist/es/{chevron-up-BLtnROd5.js → chevron-up-DccG0tVR.js} +1 -1
- package/dist/es/{company-2-JG34IScE.js → company-2-Cof0usfn.js} +1 -1
- package/dist/es/{company-D5_F_6SW.js → company-BKO80hWm.js} +1 -1
- package/dist/es/{contract-C6wDy9zU.js → contract-DrX5y2Qf.js} +1 -1
- package/dist/es/{controlling-person-C4KoSyi2.js → controlling-person-B_dn0b9H.js} +1 -1
- package/dist/es/{cross-BadGfrgB.js → cross-aFMJCrLf.js} +1 -1
- package/dist/es/{decision-maker-Cef3-OzY.js → decision-maker-28_rW1ah.js} +1 -1
- package/dist/es/{document-Cg4kZHpA.js → document-Bn_3PIDG.js} +1 -1
- package/dist/es/{download-DGC5_Bxe.js → download-DgAZobJV.js} +1 -1
- package/dist/es/{edit--fDhojib.js → edit-Dg19Ah77.js} +1 -1
- package/dist/es/{field-error-WElEN1mN.js → field-error-DkFiF_Cv.js} +1 -1
- package/dist/es/{info-circle-DkHN1ugA.js → info-circle-CXFfd_nO.js} +1 -1
- package/dist/es/{light-bulb-DEUhbRWP.js → light-bulb-CQ29JPA7.js} +1 -1
- package/dist/es/{location-B1Til-7Q.js → location-DmmjAv9A.js} +1 -1
- package/dist/es/{more-horiz-BieZKfy3.js → more-horiz-dyZQKaOn.js} +1 -1
- package/dist/es/{new-document-BEAJnXCG.js → new-document-CeV8zHP8.js} +1 -1
- package/dist/es/{owners-D1pksb86.js → owners-C1dyQqRO.js} +1 -1
- package/dist/es/{payout-BFiI--HY.js → payout-B-c43MDS.js} +1 -1
- package/dist/es/{pci-DMQLRoAn.js → pci-CVqIvwR-.js} +1 -1
- package/dist/es/{plus-DAnbeoyS.js → plus-BUH0nzS_.js} +1 -1
- package/dist/es/{remove-CEmd9YX7.js → remove-Bor5X8Xu.js} +1 -1
- package/dist/es/{review-CeQeKHXH.js → review-DcoDSRJT.js} +1 -1
- package/dist/es/{search-hf3HRVbu.js → search-SGLIdnsr.js} +1 -1
- package/dist/es/{signatory-BVoLPYPu.js → signatory-BMaWV_18.js} +1 -1
- package/dist/es/{store-D2z639xh.js → store-N4c2LHJ_.js} +1 -1
- package/dist/es/{trust-CpcaQaV7.js → trust-BcVDhtGL.js} +1 -1
- package/dist/es/{user-D6swzlYs.js → user-C8STPF6-.js} +1 -1
- package/dist/es/{user-business-CwS5j1qX.js → user-business-Dcvcw8gB.js} +1 -1
- package/dist/es/{users-3-BdjQ9rEA.js → users-3-D3QDBEk-.js} +1 -1
- package/dist/es/{warning-99uFf1WU.js → warning-Dxxpni4H.js} +1 -1
- package/dist/es/{wrong-1wvh7nZe.js → wrong-DNwa4zZR.js} +1 -1
- package/dist/types/components/BankVerification/BankVerification.d.ts +1 -1
- package/dist/types/components/BankVerification/types.d.ts +5 -5
- package/dist/types/components/CompanyBasics/types.d.ts +3 -3
- package/dist/types/components/CompanyLookup/types.d.ts +4 -4
- package/dist/types/components/Individual/types.d.ts +2 -2
- package/dist/types/components/PayoutDetails/types.d.ts +2 -2
- package/dist/types/components/TaskList/types.d.ts +2 -2
- package/dist/types/components/internal/BusinessRegistrationNumberField/types.d.ts +2 -2
- package/dist/types/components/internal/EntityAssociation/types.d.ts +2 -2
- package/dist/types/components/internal/Remove/types.d.ts +3 -3
- package/dist/types/components/internal/TaxInformationField/types.d.ts +2 -2
- package/dist/types/components/internal/VatNumberField/types.d.ts +2 -2
- package/dist/types/core/Context/QueryContext/QueryClient.d.ts +2 -0
- package/dist/types/core/Context/QueryContext/QueryClientProvider.d.ts +4 -0
- package/dist/types/core/hooks/introduction/useHasSeenIntroduction.d.ts +1 -1
- package/dist/types/core/hooks/singpass/useHasSeenSingpassSelection.d.ts +1 -1
- package/dist/types/core/hooks/useCompanySearch/types.d.ts +2 -2
- package/dist/types/core/hooks/useCompanySearchTaskSubmit.d.ts +3 -3
- package/dist/types/core/hooks/useForm/types.d.ts +8 -8
- package/dist/types/core/hooks/useFormComposer.d.ts +2 -2
- package/dist/types/core/hooks/useLocalStorage.d.ts +2 -2
- package/dist/types/utils/useStateFromProp.d.ts +2 -2
- package/package.json +8 -2
|
@@ -7,9 +7,10 @@ import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
|
7
7
|
import { debounce, noop as noop$1, isEmpty as isEmpty$1, range } from "lodash";
|
|
8
8
|
import isISIN from "validator/es/lib/isISIN.js";
|
|
9
9
|
import OpenBankingSDK from "@adyen/openbankingsdk";
|
|
10
|
-
import { jsxs as jsxs$1, jsx as jsx$1 } from "
|
|
10
|
+
import { jsxs as jsxs$1, jsx as jsx$1 } from "react/jsx-runtime";
|
|
11
11
|
import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
|
|
12
12
|
import AdyenDocumentViewer from "@adyen/adyen-document-viewer";
|
|
13
|
+
import { QueryClient as QueryClient$1, QueryClientProvider as QueryClientProvider$1 } from "@tanstack/react-query";
|
|
13
14
|
const ConfigurationApiContext = createContext(void 0);
|
|
14
15
|
const useConfigurationApi = () => {
|
|
15
16
|
const configurationApi = useContext(ConfigurationApiContext);
|
|
@@ -2591,21 +2592,17 @@ const matchLocale = (locale, supportedLocales) => supportedLocales.find((supLoc)
|
|
|
2591
2592
|
function formatLocale(localeParam) {
|
|
2592
2593
|
const locale = localeParam.replace("_", "-");
|
|
2593
2594
|
const format = /([a-z]{2})(-)([A-Z]{2})/;
|
|
2594
|
-
if (format.test(locale))
|
|
2595
|
-
return locale;
|
|
2595
|
+
if (format.test(locale)) return locale;
|
|
2596
2596
|
const [languageCode, countryCode] = locale.split("-");
|
|
2597
|
-
if (!languageCode || !countryCode)
|
|
2598
|
-
return null;
|
|
2597
|
+
if (!languageCode || !countryCode) return null;
|
|
2599
2598
|
const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join("-");
|
|
2600
2599
|
return fullLocale.length === 5 ? fullLocale : null;
|
|
2601
2600
|
}
|
|
2602
2601
|
function parseLocale(locale, supportedLocales = []) {
|
|
2603
|
-
if (!locale || locale.length < 1 || locale.length > 5)
|
|
2604
|
-
return FALLBACK_LOCALE;
|
|
2602
|
+
if (!locale || locale.length < 1 || locale.length > 5) return FALLBACK_LOCALE;
|
|
2605
2603
|
const formattedLocale = formatLocale(locale);
|
|
2606
2604
|
const hasMatch = Boolean(formattedLocale && supportedLocales.includes(formattedLocale));
|
|
2607
|
-
if (hasMatch)
|
|
2608
|
-
return formattedLocale;
|
|
2605
|
+
if (hasMatch) return formattedLocale;
|
|
2609
2606
|
return matchLocale(formattedLocale || locale, supportedLocales);
|
|
2610
2607
|
}
|
|
2611
2608
|
const formatCustomTranslations = (supportedLocales, customTranslations = {}) => Object.keys(customTranslations).reduce((acc, cur) => {
|
|
@@ -2965,7 +2962,7 @@ const mergeFieldMetadataIntoProps = (fieldName, metadata, otherProps) => {
|
|
|
2965
2962
|
const MAX_LENGTH = 30;
|
|
2966
2963
|
const getMaxLengthByFieldAndCountry = (formattingRules, field, country2, ignoreIfFormatterExists) => {
|
|
2967
2964
|
var _a, _b, _c, _d;
|
|
2968
|
-
if (
|
|
2965
|
+
if ((_b = (_a = formattingRules[country2]) == null ? void 0 : _a[field]) == null ? void 0 : _b.formatter) {
|
|
2969
2966
|
return null;
|
|
2970
2967
|
}
|
|
2971
2968
|
const maxLength = (_d = (_c = formattingRules[country2]) == null ? void 0 : _c[field]) == null ? void 0 : _d.maxlength;
|
|
@@ -2985,8 +2982,7 @@ const createLogger = (namespace) => {
|
|
|
2985
2982
|
const methods = {};
|
|
2986
2983
|
consoleMethodsPrefixable.forEach((method) => {
|
|
2987
2984
|
methods[method] = (arg1, ...args) => {
|
|
2988
|
-
if (!console[method] || suppressed)
|
|
2989
|
-
return;
|
|
2985
|
+
if (!console[method] || suppressed) return;
|
|
2990
2986
|
if (!namespace) {
|
|
2991
2987
|
console[method](arg1, ...args);
|
|
2992
2988
|
} else if (stringSubstitutionRegex.test(arg1)) {
|
|
@@ -2999,45 +2995,45 @@ const createLogger = (namespace) => {
|
|
|
2999
2995
|
return methods;
|
|
3000
2996
|
};
|
|
3001
2997
|
const icons = {
|
|
3002
|
-
"arrow-left": lazy(() => import("./arrow-left-
|
|
3003
|
-
"arrow-right": lazy(() => import("./arrow-right-
|
|
3004
|
-
bin: lazy(() => import("./bin-
|
|
3005
|
-
check: lazy(() => import("./check-
|
|
3006
|
-
checkmark: lazy(() => import("./checkmark-
|
|
3007
|
-
"checkmark-small": lazy(() => import("./checkmark-small-
|
|
3008
|
-
"chevron-down": lazy(() => import("./chevron-down-
|
|
3009
|
-
"chevron-right": lazy(() => import("./chevron-right-
|
|
3010
|
-
"chevron-up": lazy(() => import("./chevron-up-
|
|
3011
|
-
company: lazy(() => import("./company-
|
|
3012
|
-
"company-2": lazy(() => import("./company-2-
|
|
3013
|
-
contract: lazy(() => import("./contract-
|
|
3014
|
-
"controlling-person": lazy(() => import("./controlling-person-
|
|
3015
|
-
cross: lazy(() => import("./cross-
|
|
3016
|
-
"decision-maker": lazy(() => import("./decision-maker-
|
|
3017
|
-
document: lazy(() => import("./document-
|
|
3018
|
-
download: lazy(() => import("./download-
|
|
3019
|
-
edit: lazy(() => import("./edit
|
|
3020
|
-
"field-error": lazy(() => import("./field-error-
|
|
3021
|
-
"info-circle": lazy(() => import("./info-circle-
|
|
3022
|
-
"light-bulb": lazy(() => import("./light-bulb-
|
|
3023
|
-
location: lazy(() => import("./location-
|
|
3024
|
-
"more-horiz": lazy(() => import("./more-horiz-
|
|
3025
|
-
"new-document": lazy(() => import("./new-document-
|
|
3026
|
-
owners: lazy(() => import("./owners-
|
|
3027
|
-
payout: lazy(() => import("./payout-
|
|
3028
|
-
pci: lazy(() => import("./pci-
|
|
3029
|
-
plus: lazy(() => import("./plus-
|
|
3030
|
-
remove: lazy(() => import("./remove-
|
|
3031
|
-
review: lazy(() => import("./review-
|
|
3032
|
-
search: lazy(() => import("./search-
|
|
3033
|
-
signatory: lazy(() => import("./signatory-
|
|
3034
|
-
store: lazy(() => import("./store-
|
|
3035
|
-
trust: lazy(() => import("./trust-
|
|
3036
|
-
user: lazy(() => import("./user-
|
|
3037
|
-
"user-business": lazy(() => import("./user-business-
|
|
3038
|
-
"users-3": lazy(() => import("./users-3-
|
|
3039
|
-
warning: lazy(() => import("./warning-
|
|
3040
|
-
wrong: lazy(() => import("./wrong-
|
|
2998
|
+
"arrow-left": lazy(() => import("./arrow-left-CwJQyOFz.js")),
|
|
2999
|
+
"arrow-right": lazy(() => import("./arrow-right-Cs_AKUOH.js")),
|
|
3000
|
+
bin: lazy(() => import("./bin-8yaAerXc.js")),
|
|
3001
|
+
check: lazy(() => import("./check-_cOIMziL.js")),
|
|
3002
|
+
checkmark: lazy(() => import("./checkmark-CZpv8i5a.js")),
|
|
3003
|
+
"checkmark-small": lazy(() => import("./checkmark-small-C4TPve-W.js")),
|
|
3004
|
+
"chevron-down": lazy(() => import("./chevron-down-CwS2tE_6.js")),
|
|
3005
|
+
"chevron-right": lazy(() => import("./chevron-right-B8cQLres.js")),
|
|
3006
|
+
"chevron-up": lazy(() => import("./chevron-up-DccG0tVR.js")),
|
|
3007
|
+
company: lazy(() => import("./company-BKO80hWm.js")),
|
|
3008
|
+
"company-2": lazy(() => import("./company-2-Cof0usfn.js")),
|
|
3009
|
+
contract: lazy(() => import("./contract-DrX5y2Qf.js")),
|
|
3010
|
+
"controlling-person": lazy(() => import("./controlling-person-B_dn0b9H.js")),
|
|
3011
|
+
cross: lazy(() => import("./cross-aFMJCrLf.js")),
|
|
3012
|
+
"decision-maker": lazy(() => import("./decision-maker-28_rW1ah.js")),
|
|
3013
|
+
document: lazy(() => import("./document-Bn_3PIDG.js")),
|
|
3014
|
+
download: lazy(() => import("./download-DgAZobJV.js")),
|
|
3015
|
+
edit: lazy(() => import("./edit-Dg19Ah77.js")),
|
|
3016
|
+
"field-error": lazy(() => import("./field-error-DkFiF_Cv.js")),
|
|
3017
|
+
"info-circle": lazy(() => import("./info-circle-CXFfd_nO.js")),
|
|
3018
|
+
"light-bulb": lazy(() => import("./light-bulb-CQ29JPA7.js")),
|
|
3019
|
+
location: lazy(() => import("./location-DmmjAv9A.js")),
|
|
3020
|
+
"more-horiz": lazy(() => import("./more-horiz-dyZQKaOn.js")),
|
|
3021
|
+
"new-document": lazy(() => import("./new-document-CeV8zHP8.js")),
|
|
3022
|
+
owners: lazy(() => import("./owners-C1dyQqRO.js")),
|
|
3023
|
+
payout: lazy(() => import("./payout-B-c43MDS.js")),
|
|
3024
|
+
pci: lazy(() => import("./pci-CVqIvwR-.js")),
|
|
3025
|
+
plus: lazy(() => import("./plus-BUH0nzS_.js")),
|
|
3026
|
+
remove: lazy(() => import("./remove-Bor5X8Xu.js")),
|
|
3027
|
+
review: lazy(() => import("./review-DcoDSRJT.js")),
|
|
3028
|
+
search: lazy(() => import("./search-SGLIdnsr.js")),
|
|
3029
|
+
signatory: lazy(() => import("./signatory-BMaWV_18.js")),
|
|
3030
|
+
store: lazy(() => import("./store-N4c2LHJ_.js")),
|
|
3031
|
+
trust: lazy(() => import("./trust-BcVDhtGL.js")),
|
|
3032
|
+
user: lazy(() => import("./user-C8STPF6-.js")),
|
|
3033
|
+
"user-business": lazy(() => import("./user-business-Dcvcw8gB.js")),
|
|
3034
|
+
"users-3": lazy(() => import("./users-3-D3QDBEk-.js")),
|
|
3035
|
+
warning: lazy(() => import("./warning-Dxxpni4H.js")),
|
|
3036
|
+
wrong: lazy(() => import("./wrong-DNwa4zZR.js"))
|
|
3041
3037
|
};
|
|
3042
3038
|
const logger$u = createLogger("Icon");
|
|
3043
3039
|
const Icon = ({
|
|
@@ -3177,8 +3173,7 @@ const Alert = ({
|
|
|
3177
3173
|
i18n
|
|
3178
3174
|
} = useI18nContext();
|
|
3179
3175
|
const [isClosed, setIsClosed] = useState(false);
|
|
3180
|
-
if (isClosed)
|
|
3181
|
-
return null;
|
|
3176
|
+
if (isClosed) return null;
|
|
3182
3177
|
const closeAlert = () => setIsClosed(true);
|
|
3183
3178
|
const classNames = cx("adl-alert", className, {
|
|
3184
3179
|
"adl-alert--basic": type === AlertTypes.BASIC,
|
|
@@ -3290,8 +3285,7 @@ const Link = ({
|
|
|
3290
3285
|
iconLeft = false,
|
|
3291
3286
|
onClick
|
|
3292
3287
|
}) => {
|
|
3293
|
-
if (!isValidLink(href))
|
|
3294
|
-
return null;
|
|
3288
|
+
if (!isValidLink(href)) return null;
|
|
3295
3289
|
const target = external ? "_blank" : "_self";
|
|
3296
3290
|
const rel = external ? "external noopener noreferrer" : void 0;
|
|
3297
3291
|
const showIcon = icon || external;
|
|
@@ -3569,8 +3563,7 @@ const useAllowedCountries = () => {
|
|
|
3569
3563
|
} = useConfigurationApi();
|
|
3570
3564
|
const [allowedCountries, setAllowedCountries] = useState(acceptedCountries);
|
|
3571
3565
|
useEffect(() => {
|
|
3572
|
-
if (acceptedCountries !== void 0)
|
|
3573
|
-
return;
|
|
3566
|
+
if (acceptedCountries !== void 0) return;
|
|
3574
3567
|
getAllowedCountries2().then((response) => setAllowedCountries(response.countries)).catch(logger$s.error);
|
|
3575
3568
|
}, [acceptedCountries]);
|
|
3576
3569
|
return allowedCountries;
|
|
@@ -3701,8 +3694,7 @@ function reducer({
|
|
|
3701
3694
|
const validationSchema = selectedSchema || state2.schema;
|
|
3702
3695
|
switch (type) {
|
|
3703
3696
|
case "setData": {
|
|
3704
|
-
if (!key)
|
|
3705
|
-
return state2;
|
|
3697
|
+
if (!key) return state2;
|
|
3706
3698
|
return {
|
|
3707
3699
|
...state2,
|
|
3708
3700
|
data: {
|
|
@@ -3712,8 +3704,7 @@ function reducer({
|
|
|
3712
3704
|
};
|
|
3713
3705
|
}
|
|
3714
3706
|
case "setValid": {
|
|
3715
|
-
if (!key)
|
|
3716
|
-
return state2;
|
|
3707
|
+
if (!key) return state2;
|
|
3717
3708
|
return {
|
|
3718
3709
|
...state2,
|
|
3719
3710
|
valid: {
|
|
@@ -3723,8 +3714,7 @@ function reducer({
|
|
|
3723
3714
|
};
|
|
3724
3715
|
}
|
|
3725
3716
|
case "setErrors": {
|
|
3726
|
-
if (!key)
|
|
3727
|
-
return state2;
|
|
3717
|
+
if (!key) return state2;
|
|
3728
3718
|
return {
|
|
3729
3719
|
...state2,
|
|
3730
3720
|
errors: {
|
|
@@ -3750,8 +3740,7 @@ function reducer({
|
|
|
3750
3740
|
}, state2);
|
|
3751
3741
|
}
|
|
3752
3742
|
case "setSchema": {
|
|
3753
|
-
if (!schema)
|
|
3754
|
-
return state2;
|
|
3743
|
+
if (!schema) return state2;
|
|
3755
3744
|
const defaultState = init({
|
|
3756
3745
|
schema,
|
|
3757
3746
|
defaultData,
|
|
@@ -3786,8 +3775,7 @@ function reducer({
|
|
|
3786
3775
|
};
|
|
3787
3776
|
}
|
|
3788
3777
|
case "updateField": {
|
|
3789
|
-
if (!key || !mode)
|
|
3790
|
-
return state2;
|
|
3778
|
+
if (!key || !mode) return state2;
|
|
3791
3779
|
const [formattedValue, validation] = processField({
|
|
3792
3780
|
key,
|
|
3793
3781
|
value,
|
|
@@ -3915,11 +3903,9 @@ const useAsyncValidator = (asyncRules) => {
|
|
|
3915
3903
|
const [asyncValidationResults, setAsyncValidationResults] = useState({});
|
|
3916
3904
|
const clearAsyncValidationResults = useCallback(() => setAsyncValidationResults({}), []);
|
|
3917
3905
|
const triggerAsyncValidation = useCallback((field, formState, mode) => {
|
|
3918
|
-
if (!asyncRules)
|
|
3919
|
-
return clearAsyncValidationResults();
|
|
3906
|
+
if (!asyncRules) return clearAsyncValidationResults();
|
|
3920
3907
|
const rule = asyncRules[field];
|
|
3921
|
-
if (!rule || !rule.modes.includes(mode))
|
|
3922
|
-
return clearAsyncValidationResults();
|
|
3908
|
+
if (!rule || !rule.modes.includes(mode)) return clearAsyncValidationResults();
|
|
3923
3909
|
const value = formState.data[field];
|
|
3924
3910
|
return rule.asyncValidate(formState.data[field], {
|
|
3925
3911
|
state: formState
|
|
@@ -3972,8 +3958,7 @@ const useStaticValidator = (rules2) => {
|
|
|
3972
3958
|
};
|
|
3973
3959
|
};
|
|
3974
3960
|
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema) => {
|
|
3975
|
-
if (!schema.length)
|
|
3976
|
-
return staticValidationErrors;
|
|
3961
|
+
if (!schema.length) return staticValidationErrors;
|
|
3977
3962
|
return schema.reduce((acc, field) => {
|
|
3978
3963
|
var _a;
|
|
3979
3964
|
return {
|
|
@@ -4027,8 +4012,7 @@ function useForm({
|
|
|
4027
4012
|
return (_a = state2.schema) == null ? void 0 : _a.every((key) => state2.valid[key]);
|
|
4028
4013
|
}, [state2.schema, state2.valid]);
|
|
4029
4014
|
const getTargetValue = useCallback((key, e) => {
|
|
4030
|
-
if (!(e == null ? void 0 : e.target))
|
|
4031
|
-
return e;
|
|
4015
|
+
if (!(e == null ? void 0 : e.target)) return e;
|
|
4032
4016
|
if (e.target.type === "checkbox") {
|
|
4033
4017
|
return !state2.data[key];
|
|
4034
4018
|
}
|
|
@@ -4124,8 +4108,7 @@ function useDataset(datasetIdentifier2, skip) {
|
|
|
4124
4108
|
const [dataset, setDataset] = useState([]);
|
|
4125
4109
|
const [loaded, setLoaded] = useState(false);
|
|
4126
4110
|
useEffect(() => {
|
|
4127
|
-
if (skip)
|
|
4128
|
-
return;
|
|
4111
|
+
if (skip) return;
|
|
4129
4112
|
getDataset2(datasetIdentifier2, i18n.locale).then((response) => {
|
|
4130
4113
|
const result = response && response.length ? response : [];
|
|
4131
4114
|
setDataset(result);
|
|
@@ -4288,15 +4271,12 @@ const Field = ({
|
|
|
4288
4271
|
isValid: !!isValid,
|
|
4289
4272
|
onBlurHandler: (e) => {
|
|
4290
4273
|
setIsFocused(false);
|
|
4291
|
-
if (onBlur)
|
|
4292
|
-
|
|
4293
|
-
if (onFieldBlur)
|
|
4294
|
-
onFieldBlur(e);
|
|
4274
|
+
if (onBlur) onBlur(e);
|
|
4275
|
+
if (onFieldBlur) onFieldBlur(e);
|
|
4295
4276
|
},
|
|
4296
4277
|
onFocusHandler: (e) => {
|
|
4297
4278
|
setIsFocused(true);
|
|
4298
|
-
if (onFocus)
|
|
4299
|
-
onFocus(e);
|
|
4279
|
+
if (onFocus) onFocus(e);
|
|
4300
4280
|
},
|
|
4301
4281
|
uniqueId
|
|
4302
4282
|
}), helper && helperPosition === "below" && jsx("span", {
|
|
@@ -4333,13 +4313,11 @@ const Field = ({
|
|
|
4333
4313
|
});
|
|
4334
4314
|
};
|
|
4335
4315
|
const getScrollParent = (node) => {
|
|
4336
|
-
if (!node)
|
|
4337
|
-
return null;
|
|
4316
|
+
if (!node) return null;
|
|
4338
4317
|
const isElement = node instanceof HTMLElement;
|
|
4339
4318
|
const overflowY = isElement && window.getComputedStyle(node).overflowY;
|
|
4340
4319
|
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
|
|
4341
|
-
if (isElement && isScrollable)
|
|
4342
|
-
return node;
|
|
4320
|
+
if (isElement && isScrollable) return node;
|
|
4343
4321
|
return getScrollParent(node.parentNode) ?? document.body;
|
|
4344
4322
|
};
|
|
4345
4323
|
function uuidv4() {
|
|
@@ -4389,11 +4367,10 @@ function SelectButtonElement({
|
|
|
4389
4367
|
isSearch,
|
|
4390
4368
|
...props
|
|
4391
4369
|
}) {
|
|
4392
|
-
if (filterable || isMulti || isSearch)
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
});
|
|
4370
|
+
if (filterable || isMulti || isSearch) return jsx("div", {
|
|
4371
|
+
...props,
|
|
4372
|
+
ref: toggleButtonRef
|
|
4373
|
+
});
|
|
4397
4374
|
return jsx("button", {
|
|
4398
4375
|
...props,
|
|
4399
4376
|
ref: toggleButtonRef,
|
|
@@ -4585,13 +4562,11 @@ const SelectListItem = ({
|
|
|
4585
4562
|
"data-disabled": !!item.disabled,
|
|
4586
4563
|
"data-value": item.id,
|
|
4587
4564
|
onClick: () => {
|
|
4588
|
-
if (item.disabled)
|
|
4589
|
-
return;
|
|
4565
|
+
if (item.disabled) return;
|
|
4590
4566
|
onSelect(!selected);
|
|
4591
4567
|
},
|
|
4592
4568
|
onKeyDown: (e) => {
|
|
4593
|
-
if (item.disabled)
|
|
4594
|
-
return;
|
|
4569
|
+
if (item.disabled) return;
|
|
4595
4570
|
onKeyDown(e);
|
|
4596
4571
|
},
|
|
4597
4572
|
role: "option",
|
|
@@ -4723,8 +4698,7 @@ const Select = ({
|
|
|
4723
4698
|
const closeList = () => {
|
|
4724
4699
|
setTextFilter(null);
|
|
4725
4700
|
setIsShowList(false);
|
|
4726
|
-
if (toggleButtonRef.current)
|
|
4727
|
-
toggleButtonRef.current.focus();
|
|
4701
|
+
if (toggleButtonRef.current) toggleButtonRef.current.focus();
|
|
4728
4702
|
};
|
|
4729
4703
|
const showList = () => {
|
|
4730
4704
|
let sp = scrollParent;
|
|
@@ -4751,8 +4725,7 @@ const Select = ({
|
|
|
4751
4725
|
setIsShowList(false);
|
|
4752
4726
|
};
|
|
4753
4727
|
const handleSelect = (selectedItem) => {
|
|
4754
|
-
if (readonly)
|
|
4755
|
-
return;
|
|
4728
|
+
if (readonly) return;
|
|
4756
4729
|
if (isMulti) {
|
|
4757
4730
|
const isAlreadySelected = active.find((item) => item.id === selectedItem.id);
|
|
4758
4731
|
const newActiveItems = isAlreadySelected ? [...active.filter((i) => i.id !== selectedItem.id).map((i) => i.id)] : [...active.map((i) => i.id), selectedItem.id];
|
|
@@ -4815,8 +4788,7 @@ const Select = ({
|
|
|
4815
4788
|
break;
|
|
4816
4789
|
case KEYBOARD_KEYS.arrowDown:
|
|
4817
4790
|
e.preventDefault();
|
|
4818
|
-
if (target.nextElementSibling)
|
|
4819
|
-
target.nextElementSibling.focus();
|
|
4791
|
+
if (target.nextElementSibling) target.nextElementSibling.focus();
|
|
4820
4792
|
break;
|
|
4821
4793
|
case KEYBOARD_KEYS.arrowUp:
|
|
4822
4794
|
e.preventDefault();
|
|
@@ -5615,8 +5587,7 @@ const tryShift = (matchedTokens, remainingTokens, fromIndex, shiftDistance) => {
|
|
|
5615
5587
|
}
|
|
5616
5588
|
return ((_a = token.allow) == null ? void 0 : _a.test(token.potentialValue)) ?? true;
|
|
5617
5589
|
});
|
|
5618
|
-
if (!allValid)
|
|
5619
|
-
return "notPossible";
|
|
5590
|
+
if (!allValid) return "notPossible";
|
|
5620
5591
|
let matchedUpTo = 0;
|
|
5621
5592
|
for (let i = 0; i < normalizedTokens.length; i += 1) {
|
|
5622
5593
|
const token = normalizedInputTokens.find((t) => t.originalIndex === i) ?? normalizedTokens[i];
|
|
@@ -5651,8 +5622,7 @@ const getAvailableInputTokens = (tokens) => {
|
|
|
5651
5622
|
...token,
|
|
5652
5623
|
offset: tokens.indexOf(token)
|
|
5653
5624
|
});
|
|
5654
|
-
if (token.type !== "input" || !token.optional)
|
|
5655
|
-
break;
|
|
5625
|
+
if (token.type !== "input" || !token.optional) break;
|
|
5656
5626
|
}
|
|
5657
5627
|
return availableTokens;
|
|
5658
5628
|
};
|
|
@@ -5661,13 +5631,10 @@ const getEagerSuffix = (tokens) => {
|
|
|
5661
5631
|
let suffix = "";
|
|
5662
5632
|
for (const token of tokens) {
|
|
5663
5633
|
if (token.type === "input") {
|
|
5664
|
-
if (token.optional)
|
|
5665
|
-
|
|
5666
|
-
else
|
|
5667
|
-
break;
|
|
5634
|
+
if (token.optional) continue;
|
|
5635
|
+
else break;
|
|
5668
5636
|
}
|
|
5669
|
-
if (!token.displayEagerly)
|
|
5670
|
-
break;
|
|
5637
|
+
if (!token.displayEagerly) break;
|
|
5671
5638
|
suffix += token.char;
|
|
5672
5639
|
}
|
|
5673
5640
|
return suffix;
|
|
@@ -5695,12 +5662,11 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5695
5662
|
while (true) {
|
|
5696
5663
|
const char = charsToProcess[0];
|
|
5697
5664
|
const token = tokensToProcess[0];
|
|
5698
|
-
if (!char && !tokensToProcess.some((t) => t.type === "input" && !t.optional))
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
};
|
|
5665
|
+
if (!char && !tokensToProcess.some((t) => t.type === "input" && !t.optional)) return {
|
|
5666
|
+
outcome: "correct",
|
|
5667
|
+
displayValue: displayValue() + getEagerSuffix(tokensToProcess),
|
|
5668
|
+
potentialForMoreOptionalInput: getPotentialForMoreOptionalInput(tokensToProcess)
|
|
5669
|
+
};
|
|
5704
5670
|
if (!char) {
|
|
5705
5671
|
const output = shiftRight(mask.possibleShifts, matchedTokens, tokensToProcess);
|
|
5706
5672
|
matchedTokens = output.matchedTokens;
|
|
@@ -5710,24 +5676,22 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5710
5676
|
displayValue: displayValue() + getEagerSuffix(tokensToProcess)
|
|
5711
5677
|
};
|
|
5712
5678
|
}
|
|
5713
|
-
if (!token)
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
};
|
|
5679
|
+
if (!token) return {
|
|
5680
|
+
outcome: "mismatch",
|
|
5681
|
+
badChar: char,
|
|
5682
|
+
mismatchAtChar: charIndex,
|
|
5683
|
+
mismatchedToken: "inputTooLong",
|
|
5684
|
+
partialDisplayValue: displayValue()
|
|
5685
|
+
};
|
|
5721
5686
|
if (token.type === "nonInput") {
|
|
5722
5687
|
if (token.includeInValue) {
|
|
5723
|
-
if (char !== token.char)
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
};
|
|
5688
|
+
if (char !== token.char) return {
|
|
5689
|
+
outcome: "mismatch",
|
|
5690
|
+
badChar: char,
|
|
5691
|
+
mismatchAtChar: charIndex,
|
|
5692
|
+
mismatchedToken: token,
|
|
5693
|
+
partialDisplayValue: displayValue()
|
|
5694
|
+
};
|
|
5731
5695
|
shiftChars(1);
|
|
5732
5696
|
}
|
|
5733
5697
|
matchedTokens.push(token);
|
|
@@ -5736,14 +5700,13 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5736
5700
|
if (token.type === "input") {
|
|
5737
5701
|
const availableTokens = getAvailableInputTokens(tokensToProcess);
|
|
5738
5702
|
const matchingToken = findMatchingToken(availableTokens, char);
|
|
5739
|
-
if (!matchingToken)
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
};
|
|
5703
|
+
if (!matchingToken) return {
|
|
5704
|
+
outcome: "mismatch",
|
|
5705
|
+
badChar: char,
|
|
5706
|
+
mismatchAtChar: charIndex,
|
|
5707
|
+
mismatchedToken: token,
|
|
5708
|
+
partialDisplayValue: displayValue()
|
|
5709
|
+
};
|
|
5747
5710
|
matchedTokens.push({
|
|
5748
5711
|
...matchingToken,
|
|
5749
5712
|
char
|
|
@@ -5754,30 +5717,26 @@ const matchAgainstMask = (pureValue, mask, acceptObscuredValue = false) => {
|
|
|
5754
5717
|
}
|
|
5755
5718
|
};
|
|
5756
5719
|
const deriveInputState = (isValid, isFocused, hasBlurred, isDisabled, errorMessage, shouldValidate, potentiallyMoreOptionalCharacters, formatGuidance, i18n) => {
|
|
5757
|
-
if (isDisabled)
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
return {
|
|
5778
|
-
isError: true,
|
|
5779
|
-
text: typeof errorMessage === "string" && errorMessage ? errorMessage : formatGuidance
|
|
5780
|
-
};
|
|
5720
|
+
if (isDisabled) return {
|
|
5721
|
+
isError: false
|
|
5722
|
+
};
|
|
5723
|
+
if (isValid && (!potentiallyMoreOptionalCharacters || !isFocused)) return {
|
|
5724
|
+
isError: false,
|
|
5725
|
+
text: jsxs(Fragment, {
|
|
5726
|
+
children: [jsx(Icon, {
|
|
5727
|
+
name: "checkmark-small",
|
|
5728
|
+
className: "adyen-kyc-helper-text__valid-format-check"
|
|
5729
|
+
}), i18n.get("formatIsCorrect")]
|
|
5730
|
+
})
|
|
5731
|
+
};
|
|
5732
|
+
if (isFocused && formatGuidance) return {
|
|
5733
|
+
isError: false,
|
|
5734
|
+
text: formatGuidance
|
|
5735
|
+
};
|
|
5736
|
+
if (!isValid && (shouldValidate || hasBlurred)) return {
|
|
5737
|
+
isError: true,
|
|
5738
|
+
text: typeof errorMessage === "string" && errorMessage ? errorMessage : formatGuidance
|
|
5739
|
+
};
|
|
5781
5740
|
return {
|
|
5782
5741
|
isError: false
|
|
5783
5742
|
};
|
|
@@ -5813,12 +5772,10 @@ const MaskedInputText = ({
|
|
|
5813
5772
|
i18n
|
|
5814
5773
|
} = useI18nContext();
|
|
5815
5774
|
const onMismatch = (mismatch) => {
|
|
5816
|
-
if (!inputRef.current)
|
|
5817
|
-
return;
|
|
5775
|
+
if (!inputRef.current) return;
|
|
5818
5776
|
setShowingMismatch(true);
|
|
5819
5777
|
inputRef.current.addEventListener("animationend", (event) => {
|
|
5820
|
-
if (event.animationName !== MISMATCH_ANIMATION_NAME)
|
|
5821
|
-
return;
|
|
5778
|
+
if (event.animationName !== MISMATCH_ANIMATION_NAME) return;
|
|
5822
5779
|
setShowingMismatch(false);
|
|
5823
5780
|
});
|
|
5824
5781
|
onMismatchExternal == null ? void 0 : onMismatchExternal(mismatch);
|
|
@@ -5829,16 +5786,14 @@ const MaskedInputText = ({
|
|
|
5829
5786
|
}
|
|
5830
5787
|
}, [mask]);
|
|
5831
5788
|
const getMaskResult = useCallback((pureValue) => {
|
|
5832
|
-
if (!mask)
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
};
|
|
5789
|
+
if (!mask) return {
|
|
5790
|
+
outcome: "partialCorrect",
|
|
5791
|
+
displayValue: pureValue
|
|
5792
|
+
};
|
|
5837
5793
|
return matchAgainstMask(transformOnType ? transformOnType(pureValue) : pureValue, mask, acceptObscuredValue);
|
|
5838
5794
|
}, [mask, transformOnType, acceptObscuredValue]);
|
|
5839
5795
|
const displayValueToPure = useCallback((displayValue2) => {
|
|
5840
|
-
if (!mask)
|
|
5841
|
-
return displayValue2;
|
|
5796
|
+
if (!mask) return displayValue2;
|
|
5842
5797
|
return displayValueToPureValue(displayValue2, mask);
|
|
5843
5798
|
}, [mask]);
|
|
5844
5799
|
const maskResult = useMemo(() => getMaskResult(value), [getMaskResult, value]);
|
|
@@ -5868,8 +5823,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5868
5823
|
const newPureValue = displayValueToPure(inputEl.value);
|
|
5869
5824
|
const newMaskResult = getMaskResult(newPureValue);
|
|
5870
5825
|
const returnCaretLater = (offset = 0) => {
|
|
5871
|
-
if (!inputEl.selectionStart)
|
|
5872
|
-
return;
|
|
5826
|
+
if (!inputEl.selectionStart) return;
|
|
5873
5827
|
setCaretReturnPosition(inputEl.selectionStart + offset);
|
|
5874
5828
|
};
|
|
5875
5829
|
const cancelInput = () => {
|
|
@@ -5914,8 +5868,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5914
5868
|
selectionStart,
|
|
5915
5869
|
selectionEnd
|
|
5916
5870
|
} = inputEl;
|
|
5917
|
-
if (!pasteValue || !selectionStart || selectionStart !== selectionEnd)
|
|
5918
|
-
return;
|
|
5871
|
+
if (!pasteValue || !selectionStart || selectionStart !== selectionEnd) return;
|
|
5919
5872
|
const pureDisplayValue = displayValueToPure(displayValue);
|
|
5920
5873
|
const purePasteValue = displayValueToPure(pasteValue);
|
|
5921
5874
|
const newPureValue = pureDisplayValue.slice(0, selectionStart) + purePasteValue + pureDisplayValue.slice(selectionStart);
|
|
@@ -5934,8 +5887,7 @@ Falling back to partially valid value "${fallback}"`);
|
|
|
5934
5887
|
onKeyDown: (event) => {
|
|
5935
5888
|
const inputEl = event.target;
|
|
5936
5889
|
const isCaretAtEndWithNoSelection = inputEl.selectionStart === inputEl.value.length && inputEl.selectionStart === inputEl.selectionEnd;
|
|
5937
|
-
if (event.key !== KEYBOARD_KEYS.backspace || !isCaretAtEndWithNoSelection)
|
|
5938
|
-
return;
|
|
5890
|
+
if (event.key !== KEYBOARD_KEYS.backspace || !isCaretAtEndWithNoSelection) return;
|
|
5939
5891
|
event.preventDefault();
|
|
5940
5892
|
const withLastCharRemoved = value.slice(0, value.length - 1);
|
|
5941
5893
|
const newMaskResult = getMaskResult(withLastCharRemoved);
|
|
@@ -6072,8 +6024,7 @@ const companyRegistrationNumberOptions = {
|
|
|
6072
6024
|
};
|
|
6073
6025
|
const getCompanyRegistrationNumberOptions = (country2, companyType2) => {
|
|
6074
6026
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
6075
|
-
if (!companyType2 || !optionsForCountry)
|
|
6076
|
-
return optionsForCountry;
|
|
6027
|
+
if (!companyType2 || !optionsForCountry) return optionsForCountry;
|
|
6077
6028
|
return optionsForCountry.filter((option) => {
|
|
6078
6029
|
var _a;
|
|
6079
6030
|
return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
|
|
@@ -6139,8 +6090,7 @@ const taxIdNumberOptions = {
|
|
|
6139
6090
|
};
|
|
6140
6091
|
const getTaxIdNumberOptions = (country2, companyType2) => {
|
|
6141
6092
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
6142
|
-
if (!companyType2 || !optionsForCountry)
|
|
6143
|
-
return optionsForCountry;
|
|
6093
|
+
if (!companyType2 || !optionsForCountry) return optionsForCountry;
|
|
6144
6094
|
return optionsForCountry.filter((option) => {
|
|
6145
6095
|
var _a;
|
|
6146
6096
|
return ((_a = option.applicableOnlyFor) == null ? void 0 : _a.includes(companyType2)) ?? true;
|
|
@@ -6168,8 +6118,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
6168
6118
|
}, [exemptedOption, setSelected]);
|
|
6169
6119
|
const options = useMemo(() => {
|
|
6170
6120
|
const availableOptions = getCompanyRegistrationNumberOptions(country2, companyType2) ?? [];
|
|
6171
|
-
if (availableOptions.length === 0 || !exemptedOption)
|
|
6172
|
-
return availableOptions;
|
|
6121
|
+
if (availableOptions.length === 0 || !exemptedOption) return availableOptions;
|
|
6173
6122
|
return [...availableOptions, {
|
|
6174
6123
|
id: "exempted",
|
|
6175
6124
|
name: exemptedOption
|
|
@@ -6180,8 +6129,7 @@ function CompanyRegistrationNumberTypeSelector({
|
|
|
6180
6129
|
setSelected(options[0].id);
|
|
6181
6130
|
}
|
|
6182
6131
|
}, [options, selected, setSelected]);
|
|
6183
|
-
if (options.length <= 1)
|
|
6184
|
-
return null;
|
|
6132
|
+
if (options.length <= 1) return null;
|
|
6185
6133
|
return jsx(Field, {
|
|
6186
6134
|
name: "companyRegistrationNumberType",
|
|
6187
6135
|
label: i18n.get("whichTypeOfRegistrationNumberDoYouHave"),
|
|
@@ -7392,15 +7340,13 @@ const defaultFieldConfig$8 = {
|
|
|
7392
7340
|
const inferCompanyRegistrationNumberType = (registrationNumber2, country2, companyType2) => {
|
|
7393
7341
|
const optionsForCountry = companyRegistrationNumberOptions[country2];
|
|
7394
7342
|
const metadataFn = defaultFieldConfig$8[country2];
|
|
7395
|
-
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
7396
|
-
return void 0;
|
|
7343
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function") return void 0;
|
|
7397
7344
|
for (const option of optionsForCountry) {
|
|
7398
7345
|
const fieldMetadata = metadataFn({
|
|
7399
7346
|
companyType: companyType2,
|
|
7400
7347
|
registrationNumberType: option.id
|
|
7401
7348
|
});
|
|
7402
|
-
if (!fieldMetadata.validators)
|
|
7403
|
-
continue;
|
|
7349
|
+
if (!fieldMetadata.validators) continue;
|
|
7404
7350
|
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
7405
7351
|
if (validators.every((validator) => validator.validate(registrationNumber2))) {
|
|
7406
7352
|
return option.id;
|
|
@@ -8692,15 +8638,13 @@ const defaultFieldConfig$6 = {
|
|
|
8692
8638
|
const inferTaxIdNumberType = (taxId2, country2) => {
|
|
8693
8639
|
const optionsForCountry = taxIdNumberOptions[country2];
|
|
8694
8640
|
const metadataFn = defaultFieldConfig$6[country2] ?? defaultFieldConfig$7[country2];
|
|
8695
|
-
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function")
|
|
8696
|
-
return void 0;
|
|
8641
|
+
if (!optionsForCountry || !metadataFn || typeof metadataFn !== "function") return void 0;
|
|
8697
8642
|
for (const option of optionsForCountry) {
|
|
8698
8643
|
const fieldMetadata = metadataFn({
|
|
8699
8644
|
taxIdNumberType: option.id,
|
|
8700
8645
|
vatNumberType: option.id
|
|
8701
8646
|
});
|
|
8702
|
-
if (!fieldMetadata.validators)
|
|
8703
|
-
continue;
|
|
8647
|
+
if (!fieldMetadata.validators) continue;
|
|
8704
8648
|
const validators = Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators];
|
|
8705
8649
|
if (validators.every((validator) => validator.validate(taxId2))) {
|
|
8706
8650
|
return option.id;
|
|
@@ -8729,8 +8673,7 @@ function TaxIdNumberTypeSelector({
|
|
|
8729
8673
|
}, [exemptedOption, setSelected]);
|
|
8730
8674
|
const options = useMemo(() => {
|
|
8731
8675
|
const availableOptions = getTaxIdNumberOptions(country2, companyType2) ?? [];
|
|
8732
|
-
if (availableOptions.length === 0 || !exemptedOption)
|
|
8733
|
-
return availableOptions;
|
|
8676
|
+
if (availableOptions.length === 0 || !exemptedOption) return availableOptions;
|
|
8734
8677
|
return [...availableOptions, {
|
|
8735
8678
|
id: "exempted",
|
|
8736
8679
|
name: exemptedOption
|
|
@@ -8741,8 +8684,7 @@ function TaxIdNumberTypeSelector({
|
|
|
8741
8684
|
handleSelect(options[0].id);
|
|
8742
8685
|
}
|
|
8743
8686
|
}, [options, selected, handleSelect]);
|
|
8744
|
-
if (options.length <= 1)
|
|
8745
|
-
return null;
|
|
8687
|
+
if (options.length <= 1) return null;
|
|
8746
8688
|
return jsx(Field, {
|
|
8747
8689
|
name: "taxIdNumberType",
|
|
8748
8690
|
label: i18n.get("whichTypeOfTaxIdNumberDoYouHave"),
|
|
@@ -8964,8 +8906,7 @@ function VatNumber(props) {
|
|
|
8964
8906
|
}
|
|
8965
8907
|
});
|
|
8966
8908
|
}, [data, valid, errors, isValid]);
|
|
8967
|
-
if (!formUtils.isRequiredField("vatNumber"))
|
|
8968
|
-
return null;
|
|
8909
|
+
if (!formUtils.isRequiredField("vatNumber")) return null;
|
|
8969
8910
|
const exemptionIsPossible = ((_b = mergedProps.requiredFields) == null ? void 0 : _b.includes("exemptedFromVat")) ?? false;
|
|
8970
8911
|
const showTaxIdExemptedOption = exemptionIsPossible && ((_c = taxIdNumberOptions[country2]) == null ? void 0 : _c.length) > 1;
|
|
8971
8912
|
const handleTaxIdNumberTypeChange = (taxIdType) => {
|
|
@@ -9913,10 +9854,9 @@ const EntityTypeSelectionRadioCardBody = ({
|
|
|
9913
9854
|
const {
|
|
9914
9855
|
i18n
|
|
9915
9856
|
} = useI18nContext();
|
|
9916
|
-
if (!examples)
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
});
|
|
9857
|
+
if (!examples) return jsx("span", {
|
|
9858
|
+
children: i18n.get(description2)
|
|
9859
|
+
});
|
|
9920
9860
|
return jsxs(Fragment, {
|
|
9921
9861
|
children: [jsx("span", {
|
|
9922
9862
|
className: "adyen-kyc-entity-type-radio-group-card__description",
|
|
@@ -9935,8 +9875,7 @@ const EntityTypeSelectionRadioCardBody = ({
|
|
|
9935
9875
|
const CoreContext = createContext(void 0);
|
|
9936
9876
|
const useCoreContext = () => {
|
|
9937
9877
|
const context = useContext(CoreContext);
|
|
9938
|
-
if (!context)
|
|
9939
|
-
throw Error("You need a <CoreProvider> to use core context");
|
|
9878
|
+
if (!context) throw Error("You need a <CoreProvider> to use core context");
|
|
9940
9879
|
return context;
|
|
9941
9880
|
};
|
|
9942
9881
|
var TrustMemberTypes = /* @__PURE__ */ ((TrustMemberTypes2) => {
|
|
@@ -10149,22 +10088,17 @@ function getNestedPropertyKeys(obj, includeUndefined = false) {
|
|
|
10149
10088
|
return fieldNames;
|
|
10150
10089
|
}
|
|
10151
10090
|
const getTaskStatus = (type, capabilityProblems, rootLegalEntity, entityIds, skipPendingCapabilitiesCheck = false) => {
|
|
10152
|
-
if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity))
|
|
10153
|
-
return TaskStatus.EMPTY;
|
|
10091
|
+
if (!(entityIds == null ? void 0 : entityIds.length) || entityIds.includes(rootLegalEntity.id) && isEmptyEntity(rootLegalEntity)) return TaskStatus.EMPTY;
|
|
10154
10092
|
const importantCapabilityStatus = checkForImportantCapabilityStatus(type, capabilityProblems, entityIds);
|
|
10155
|
-
if (importantCapabilityStatus)
|
|
10156
|
-
|
|
10157
|
-
if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity))
|
|
10158
|
-
return TaskStatus.PROCESSING;
|
|
10093
|
+
if (importantCapabilityStatus) return importantCapabilityStatus;
|
|
10094
|
+
if (!skipPendingCapabilitiesCheck && hasPendingCapabilities(rootLegalEntity)) return TaskStatus.PROCESSING;
|
|
10159
10095
|
return TaskStatus.FINISHED;
|
|
10160
10096
|
};
|
|
10161
10097
|
const IMPORTANT_STATUSES = [TaskStatus.DETAILS_REQUIRED, TaskStatus.DOWNLOAD, TaskStatus.ERROR, TaskStatus.PROCESSING];
|
|
10162
10098
|
function checkForImportantCapabilityStatus(type, capabilityProblems, entityIds) {
|
|
10163
|
-
if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds)
|
|
10164
|
-
return;
|
|
10099
|
+
if (!(capabilityProblems == null ? void 0 : capabilityProblems[type]) || !entityIds) return;
|
|
10165
10100
|
const importantStatuses = Object.entries(capabilityProblems[type]).filter(([key]) => entityIds.includes(key)).map(([, value]) => value.status).filter((status) => status !== void 0 && IMPORTANT_STATUSES.includes(status));
|
|
10166
|
-
if (!importantStatuses.length)
|
|
10167
|
-
return;
|
|
10101
|
+
if (!importantStatuses.length) return;
|
|
10168
10102
|
return importantStatuses.reduce((prev, curr) => curr > prev ? curr : prev);
|
|
10169
10103
|
}
|
|
10170
10104
|
const hasPendingCapabilities = (legalEntityResponse) => Object.values(legalEntityResponse.capabilities ?? {}).some((capability) => capability.verificationStatus === "pending");
|
|
@@ -10183,14 +10117,11 @@ const emptyFieldsByEntityType = {
|
|
|
10183
10117
|
function isEmptyEntity(legalEntity) {
|
|
10184
10118
|
var _a;
|
|
10185
10119
|
const type = legalEntity == null ? void 0 : legalEntity.type;
|
|
10186
|
-
if (!type)
|
|
10187
|
-
|
|
10188
|
-
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length)
|
|
10189
|
-
return false;
|
|
10120
|
+
if (!type) return true;
|
|
10121
|
+
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) return false;
|
|
10190
10122
|
const minimumFields = emptyFieldsByEntityType[type];
|
|
10191
10123
|
const typeSpecificSection = legalEntity[type];
|
|
10192
|
-
if (!typeSpecificSection)
|
|
10193
|
-
return true;
|
|
10124
|
+
if (!typeSpecificSection) return true;
|
|
10194
10125
|
const fieldsOnEntity = getNestedPropertyKeys(typeSpecificSection);
|
|
10195
10126
|
return !fieldsOnEntity.some((field) => !minimumFields.includes(field));
|
|
10196
10127
|
}
|
|
@@ -10205,8 +10136,7 @@ const getDefaultAccountHolderType = (legalEntityResponse, isTypeChanging = false
|
|
|
10205
10136
|
if (accountHolder2) {
|
|
10206
10137
|
return accountHolder2;
|
|
10207
10138
|
}
|
|
10208
|
-
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.type))
|
|
10209
|
-
return void 0;
|
|
10139
|
+
if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.type)) return void 0;
|
|
10210
10140
|
if (hasOwnEntityAssociationOfType(LegalEntityType.SOLE_PROPRIETORSHIP, legalEntityResponse.entityAssociations, legalEntityResponse.id)) {
|
|
10211
10141
|
return "mySoleProprietorName";
|
|
10212
10142
|
}
|
|
@@ -10648,11 +10578,9 @@ function DocumentGuidance({
|
|
|
10648
10578
|
}
|
|
10649
10579
|
function bytesToSize(bytes) {
|
|
10650
10580
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
10651
|
-
if (bytes === 0)
|
|
10652
|
-
return "n/a";
|
|
10581
|
+
if (bytes === 0) return "n/a";
|
|
10653
10582
|
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
|
|
10654
|
-
if (i === 0)
|
|
10655
|
-
return `${bytes} ${sizes[i]}`;
|
|
10583
|
+
if (i === 0) return `${bytes} ${sizes[i]}`;
|
|
10656
10584
|
return `${(bytes / 1024 ** i).toFixed()} ${sizes[i]}`;
|
|
10657
10585
|
}
|
|
10658
10586
|
const isExistingFile = (file) => "existing" in file && file.existing;
|
|
@@ -10669,11 +10597,9 @@ function DropzoneFile(props) {
|
|
|
10669
10597
|
} = useI18nContext();
|
|
10670
10598
|
const formatSize = (bytes) => {
|
|
10671
10599
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
10672
|
-
if (!bytes || bytes === 0)
|
|
10673
|
-
return "n/a";
|
|
10600
|
+
if (!bytes || bytes === 0) return "n/a";
|
|
10674
10601
|
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)).toString());
|
|
10675
|
-
if (i === 0)
|
|
10676
|
-
return `${bytes} ${sizes[i]}`;
|
|
10602
|
+
if (i === 0) return `${bytes} ${sizes[i]}`;
|
|
10677
10603
|
return `${(bytes / 1024 ** i).toFixed(1)} ${sizes[i]}`;
|
|
10678
10604
|
};
|
|
10679
10605
|
return jsxs("div", {
|
|
@@ -10729,40 +10655,35 @@ const fileValidationRules = ({
|
|
|
10729
10655
|
isOptional
|
|
10730
10656
|
}) => [{
|
|
10731
10657
|
validate: (files) => {
|
|
10732
|
-
if (isOptional && (!files || files.length === 0))
|
|
10733
|
-
return true;
|
|
10658
|
+
if (isOptional && (!files || files.length === 0)) return true;
|
|
10734
10659
|
return Boolean(files && files.length > 0);
|
|
10735
10660
|
},
|
|
10736
10661
|
errorMessage: "fieldIsRequired",
|
|
10737
10662
|
modes: ["blur", "input"]
|
|
10738
10663
|
}, {
|
|
10739
10664
|
validate: (files) => {
|
|
10740
|
-
if (!files)
|
|
10741
|
-
return true;
|
|
10665
|
+
if (!files) return true;
|
|
10742
10666
|
return files.length <= maxNumberOfFiles;
|
|
10743
10667
|
},
|
|
10744
10668
|
errorMessage: "tooManyFiles",
|
|
10745
10669
|
modes: ["blur", "input"]
|
|
10746
10670
|
}, {
|
|
10747
10671
|
validate: (files) => {
|
|
10748
|
-
if (!files)
|
|
10749
|
-
return true;
|
|
10672
|
+
if (!files) return true;
|
|
10750
10673
|
return !hasDuplicates(files.map((file) => file.name));
|
|
10751
10674
|
},
|
|
10752
10675
|
errorMessage: "duplicatedFiles",
|
|
10753
10676
|
modes: ["blur", "input"]
|
|
10754
10677
|
}, {
|
|
10755
10678
|
validate: (files) => {
|
|
10756
|
-
if (!files)
|
|
10757
|
-
return true;
|
|
10679
|
+
if (!files) return true;
|
|
10758
10680
|
return filterOnlyNewlyUploadedFiles(files).every((file) => allowedFileTypes.some((filetype) => file.name.toLowerCase().endsWith(filetype.toLowerCase())));
|
|
10759
10681
|
},
|
|
10760
10682
|
errorMessage: "unsupportedFiletype",
|
|
10761
10683
|
modes: ["blur", "input"]
|
|
10762
10684
|
}, {
|
|
10763
10685
|
validate: (files) => {
|
|
10764
|
-
if (!files)
|
|
10765
|
-
return true;
|
|
10686
|
+
if (!files) return true;
|
|
10766
10687
|
return filterOnlyNewlyUploadedFiles(files).every((file) => !file.size || file.size < maxSize);
|
|
10767
10688
|
},
|
|
10768
10689
|
errorMessage: "maximumFileSizeExceeded",
|
|
@@ -11084,10 +11005,9 @@ function DocumentUploadComponent({
|
|
|
11084
11005
|
}, [data, valid, errors, fieldProblems]);
|
|
11085
11006
|
useEffect(() => {
|
|
11086
11007
|
var _a2, _b;
|
|
11087
|
-
if (documentField)
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
});
|
|
11008
|
+
if (documentField) setDocument({
|
|
11009
|
+
[documentField]: (_a2 = props == null ? void 0 : props.data) == null ? void 0 : _a2[documentField]
|
|
11010
|
+
});
|
|
11091
11011
|
setData("description", (_b = props.data) == null ? void 0 : _b.description);
|
|
11092
11012
|
triggerValidation();
|
|
11093
11013
|
}, [props.data]);
|
|
@@ -11292,8 +11212,7 @@ function StateField({
|
|
|
11292
11212
|
} = useDataset(datasetIdentifier.state(selectedCountry), !selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry));
|
|
11293
11213
|
const labelKey = getKeyForField("stateOrProvince", selectedCountry);
|
|
11294
11214
|
const placeholderKey = getKeyForField("stateOrProvincePlaceholder", selectedCountry);
|
|
11295
|
-
if (!loaded || !states.length)
|
|
11296
|
-
return null;
|
|
11215
|
+
if (!loaded || !states.length) return null;
|
|
11297
11216
|
return jsx(Field, {
|
|
11298
11217
|
name: "stateOrProvince",
|
|
11299
11218
|
label: (labels2 == null ? void 0 : labels2.stateOrProvince) || i18n.get(labelKey),
|
|
@@ -11407,14 +11326,12 @@ function useIsElementVisible(ref, fallback = true) {
|
|
|
11407
11326
|
const [isOnScreen, setIsOnScreen] = useState(isIntersectionObserverSupported ? false : fallback);
|
|
11408
11327
|
const observerRef = useRef();
|
|
11409
11328
|
useEffect(() => {
|
|
11410
|
-
if (!isIntersectionObserverSupported)
|
|
11411
|
-
return;
|
|
11329
|
+
if (!isIntersectionObserverSupported) return;
|
|
11412
11330
|
observerRef.current = new IntersectionObserver(([entry]) => setIsOnScreen(entry.isIntersecting));
|
|
11413
11331
|
}, []);
|
|
11414
11332
|
useEffect(() => {
|
|
11415
11333
|
var _a;
|
|
11416
|
-
if (!ref.current)
|
|
11417
|
-
return;
|
|
11334
|
+
if (!ref.current) return;
|
|
11418
11335
|
(_a = observerRef.current) == null ? void 0 : _a.observe(ref.current);
|
|
11419
11336
|
return () => {
|
|
11420
11337
|
var _a2;
|
|
@@ -11850,8 +11767,7 @@ const countrySpecificFormatters = {
|
|
|
11850
11767
|
postalCode: {
|
|
11851
11768
|
// Formatter - excludes non digits & hyphens and limits to a maxlength that varies depending on whether a hyphen is present or not
|
|
11852
11769
|
formatter: (val) => {
|
|
11853
|
-
if (!val)
|
|
11854
|
-
return void 0;
|
|
11770
|
+
if (!val) return void 0;
|
|
11855
11771
|
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
11856
11772
|
const maxlength = nuVal.includes("-") ? 6 : 5;
|
|
11857
11773
|
return nuVal.substring(0, maxlength);
|
|
@@ -11863,8 +11779,7 @@ const countrySpecificFormatters = {
|
|
|
11863
11779
|
[CountryCodes.Portugal]: {
|
|
11864
11780
|
postalCode: {
|
|
11865
11781
|
formatter: (val) => {
|
|
11866
|
-
if (!val)
|
|
11867
|
-
return void 0;
|
|
11782
|
+
if (!val) return void 0;
|
|
11868
11783
|
const nuVal = val.replace(getFormattingRegEx("^\\d-", "g"), "");
|
|
11869
11784
|
return nuVal.substring(0, 8);
|
|
11870
11785
|
},
|
|
@@ -12082,8 +11997,7 @@ function Address(props) {
|
|
|
12082
11997
|
}
|
|
12083
11998
|
}, [shouldValidate]);
|
|
12084
11999
|
const getComponent = (fieldName) => {
|
|
12085
|
-
if (!formUtils.isRequiredField(fieldName))
|
|
12086
|
-
return null;
|
|
12000
|
+
if (!formUtils.isRequiredField(fieldName)) return null;
|
|
12087
12001
|
const hideField = fieldName === "country" && hideCountry;
|
|
12088
12002
|
return jsx(FieldContainer, {
|
|
12089
12003
|
classNameModifiers: [fieldName],
|
|
@@ -12093,7 +12007,7 @@ function Address(props) {
|
|
|
12093
12007
|
fieldProblems,
|
|
12094
12008
|
fieldName,
|
|
12095
12009
|
handleChangeFor,
|
|
12096
|
-
maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country
|
|
12010
|
+
maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country),
|
|
12097
12011
|
hideField,
|
|
12098
12012
|
"aria-label": formUtils.getLabel(fieldName, fieldName),
|
|
12099
12013
|
trimOnBlur: true
|
|
@@ -12841,8 +12755,7 @@ const uploadDocuments = async (documents2, entityId) => {
|
|
|
12841
12755
|
return documentStore[entityId];
|
|
12842
12756
|
};
|
|
12843
12757
|
const updateEntityDocuments = (uploadedDocuments, entityId) => {
|
|
12844
|
-
if (!documentStore[entityId])
|
|
12845
|
-
documentStore[entityId] = [];
|
|
12758
|
+
if (!documentStore[entityId]) documentStore[entityId] = [];
|
|
12846
12759
|
uploadedDocuments.forEach((uploadedDocument) => {
|
|
12847
12760
|
if (uploadedDocument) {
|
|
12848
12761
|
const existingDocumentIndex = documentStore[entityId].findIndex((document2) => document2.id === uploadedDocument.id);
|
|
@@ -13647,11 +13560,9 @@ const mapSolePropToLegalEntity = (data) => {
|
|
|
13647
13560
|
const getPage = ({
|
|
13648
13561
|
attachments
|
|
13649
13562
|
}, pageType) => {
|
|
13650
|
-
if (!attachments)
|
|
13651
|
-
throw Error("Document has no attachments");
|
|
13563
|
+
if (!attachments) throw Error("Document has no attachments");
|
|
13652
13564
|
const attachment = pageType ? attachments.find((attach) => attach.pageType === pageType) : attachments[0];
|
|
13653
|
-
if (!attachment)
|
|
13654
|
-
throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
13565
|
+
if (!attachment) throw Error(`Attachment not found${pageType ? ` with type '${pageType}'` : ""}`);
|
|
13655
13566
|
return attachment;
|
|
13656
13567
|
};
|
|
13657
13568
|
const getPageName = (document2, pageType) => getPage(document2, pageType).pageName;
|
|
@@ -14047,8 +13958,7 @@ const useIdVerificationToken = ({
|
|
|
14047
13958
|
const hasAllUserDetails = userDetails && Object.values(userDetails).every(Boolean);
|
|
14048
13959
|
useEffect(() => {
|
|
14049
13960
|
(async () => {
|
|
14050
|
-
if (!hasAllUserDetails)
|
|
14051
|
-
return;
|
|
13961
|
+
if (!hasAllUserDetails) return;
|
|
14052
13962
|
try {
|
|
14053
13963
|
setLoadingStatus("loading");
|
|
14054
13964
|
const data = {
|
|
@@ -14209,8 +14119,7 @@ function IdVerificationComponent({
|
|
|
14209
14119
|
const onfidoSdk = useRef();
|
|
14210
14120
|
useEffect(() => {
|
|
14211
14121
|
(async () => {
|
|
14212
|
-
if (!sdkToken2)
|
|
14213
|
-
return;
|
|
14122
|
+
if (!sdkToken2) return;
|
|
14214
14123
|
onfidoSdk.current = await initOnfido({
|
|
14215
14124
|
token: sdkToken2,
|
|
14216
14125
|
i18n,
|
|
@@ -14220,13 +14129,11 @@ function IdVerificationComponent({
|
|
|
14220
14129
|
});
|
|
14221
14130
|
})().catch(logger$m.error);
|
|
14222
14131
|
return () => {
|
|
14223
|
-
if (onfidoSdk.current)
|
|
14224
|
-
onfidoSdk.current.tearDown();
|
|
14132
|
+
if (onfidoSdk.current) onfidoSdk.current.tearDown();
|
|
14225
14133
|
};
|
|
14226
14134
|
}, [sdkToken2]);
|
|
14227
14135
|
useEffect(() => {
|
|
14228
|
-
if (!onfidoSdk.current)
|
|
14229
|
-
return;
|
|
14136
|
+
if (!onfidoSdk.current) return;
|
|
14230
14137
|
onfidoSdk.current.setOptions({
|
|
14231
14138
|
language: getOnfidoLocaleConfig(i18n)
|
|
14232
14139
|
});
|
|
@@ -14392,8 +14299,7 @@ const layoutBreakpointSizes = {
|
|
|
14392
14299
|
const getBreakpointClassNames = (containerSize) => {
|
|
14393
14300
|
const breakPoints = Object.entries(layoutBreakpointSizes);
|
|
14394
14301
|
const classes = breakPoints.reduce((acc, [bp, size]) => {
|
|
14395
|
-
if (size <= containerSize)
|
|
14396
|
-
acc.push(layoutBreakpointClassnames[bp]);
|
|
14302
|
+
if (size <= containerSize) acc.push(layoutBreakpointClassnames[bp]);
|
|
14397
14303
|
return acc;
|
|
14398
14304
|
}, []);
|
|
14399
14305
|
return classes.length > 0 ? classes : ["adyen-layout-xs-only"];
|
|
@@ -14418,8 +14324,7 @@ const AutoResizer = ({
|
|
|
14418
14324
|
const containerRef = useRef(null);
|
|
14419
14325
|
useEffect(() => {
|
|
14420
14326
|
const container = containerRef.current;
|
|
14421
|
-
if (!container)
|
|
14422
|
-
return;
|
|
14327
|
+
if (!container) return;
|
|
14423
14328
|
const resizeObserver = new ResizeObserver((entries) => assignLayoutClasses(entries, container));
|
|
14424
14329
|
resizeObserver.observe(container);
|
|
14425
14330
|
return () => resizeObserver.unobserve(container);
|
|
@@ -14664,8 +14569,7 @@ function useVerification(fieldsToVerify, country2) {
|
|
|
14664
14569
|
const verificationPromises = [];
|
|
14665
14570
|
fieldsToVerify.forEach((field) => {
|
|
14666
14571
|
if (field === "idNumber" && formState.data[field]) {
|
|
14667
|
-
if (formState.data[field] === savedData[field] || country2 === "US" && formState.data[field].length === 4)
|
|
14668
|
-
return;
|
|
14572
|
+
if (formState.data[field] === savedData[field] || country2 === "US" && formState.data[field].length === 4) return;
|
|
14669
14573
|
const request = {
|
|
14670
14574
|
name: {
|
|
14671
14575
|
firstName: formState.data.firstName,
|
|
@@ -14701,10 +14605,8 @@ function InputTelephone(props) {
|
|
|
14701
14605
|
const staticPhoneValidationRules = (phonePrefixes, defaultPrefix) => ({
|
|
14702
14606
|
phoneNumber: {
|
|
14703
14607
|
validate: (phoneNumber2) => {
|
|
14704
|
-
if (!phoneNumber2)
|
|
14705
|
-
|
|
14706
|
-
if (!phonePrefixes.length)
|
|
14707
|
-
return phoneNumber2.startsWith("+");
|
|
14608
|
+
if (!phoneNumber2) return false;
|
|
14609
|
+
if (!phonePrefixes.length) return phoneNumber2.startsWith("+");
|
|
14708
14610
|
return phonePrefixes.map((prefix) => prefix.name).some((name) => phoneNumber2.startsWith(name));
|
|
14709
14611
|
},
|
|
14710
14612
|
errorMessage: {
|
|
@@ -14724,8 +14626,7 @@ const useAsyncPhoneValidationRules = () => {
|
|
|
14724
14626
|
phoneNumber: {
|
|
14725
14627
|
asyncValidate: async (phoneNumber2) => {
|
|
14726
14628
|
var _a;
|
|
14727
|
-
if (!phoneNumber2)
|
|
14728
|
-
return false;
|
|
14629
|
+
if (!phoneNumber2) return false;
|
|
14729
14630
|
return (_a = await validatePhoneNumber2(phoneNumber2)) == null ? void 0 : _a.valid;
|
|
14730
14631
|
},
|
|
14731
14632
|
errorMessage: "invalidPhoneNumber",
|
|
@@ -15454,8 +15355,7 @@ function IdentityNumberComponent(props) {
|
|
|
15454
15355
|
...data
|
|
15455
15356
|
};
|
|
15456
15357
|
adjustedData.idNumber = data.idNumberExempt ? void 0 : data.idNumber;
|
|
15457
|
-
if (data.idNumberExempt && formErrors.idNumber !== null)
|
|
15458
|
-
setFormErrors("idNumber", null);
|
|
15358
|
+
if (data.idNumberExempt && formErrors.idNumber !== null) setFormErrors("idNumber", null);
|
|
15459
15359
|
(_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
|
|
15460
15360
|
type: "addToState",
|
|
15461
15361
|
value: {
|
|
@@ -15575,8 +15475,7 @@ const getRoleName = (role2) => {
|
|
|
15575
15475
|
};
|
|
15576
15476
|
const makeSelectItemForRole = (role2, i18n) => {
|
|
15577
15477
|
const metadata = roleMetadata[role2];
|
|
15578
|
-
if (!metadata)
|
|
15579
|
-
throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
|
|
15478
|
+
if (!metadata) throw Error(`Cannot make select item for role "${role2}"; no metadata found. Valid roles include: ${Object.keys(roleMetadata).join("\n")}`);
|
|
15580
15479
|
const {
|
|
15581
15480
|
name,
|
|
15582
15481
|
description: description2,
|
|
@@ -15590,11 +15489,9 @@ const makeSelectItemForRole = (role2, i18n) => {
|
|
|
15590
15489
|
};
|
|
15591
15490
|
};
|
|
15592
15491
|
const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
|
|
15593
|
-
if (propagationMode === "stop")
|
|
15594
|
-
event.stopPropagation();
|
|
15492
|
+
if (propagationMode === "stop") event.stopPropagation();
|
|
15595
15493
|
if (keys.includes(event.key)) {
|
|
15596
|
-
if (propagationMode === "stopIfMatches")
|
|
15597
|
-
event.stopPropagation();
|
|
15494
|
+
if (propagationMode === "stopIfMatches") event.stopPropagation();
|
|
15598
15495
|
callback();
|
|
15599
15496
|
}
|
|
15600
15497
|
};
|
|
@@ -15723,8 +15620,7 @@ function IndividualIdNumberTypeSelector({
|
|
|
15723
15620
|
setSelected(options[0].id);
|
|
15724
15621
|
}
|
|
15725
15622
|
}, [options, selected, setSelected]);
|
|
15726
|
-
if (options.length <= 1)
|
|
15727
|
-
return null;
|
|
15623
|
+
if (options.length <= 1) return null;
|
|
15728
15624
|
return jsx(Field, {
|
|
15729
15625
|
name: "individualIdNumberType",
|
|
15730
15626
|
label: i18n.get("whichTypeOfIdNumberDoYouHave"),
|
|
@@ -17167,14 +17063,12 @@ function FilePicker({
|
|
|
17167
17063
|
const handleDrop = (e) => {
|
|
17168
17064
|
e.preventDefault();
|
|
17169
17065
|
e.stopPropagation();
|
|
17170
|
-
if (e.dataTransfer)
|
|
17171
|
-
addFiles(e.dataTransfer.files);
|
|
17066
|
+
if (e.dataTransfer) addFiles(e.dataTransfer.files);
|
|
17172
17067
|
setDragged(false);
|
|
17173
17068
|
};
|
|
17174
17069
|
const handleFilesChosen = (e) => {
|
|
17175
17070
|
const fileInput2 = e.target;
|
|
17176
|
-
if (fileInput2.files)
|
|
17177
|
-
addFiles(fileInput2.files);
|
|
17071
|
+
if (fileInput2.files) addFiles(fileInput2.files);
|
|
17178
17072
|
};
|
|
17179
17073
|
const addFiles = (newFiles) => {
|
|
17180
17074
|
setFiles([...newFiles, ...files]);
|
|
@@ -17507,8 +17401,7 @@ function BankDocument(props) {
|
|
|
17507
17401
|
var _a2;
|
|
17508
17402
|
if (hasAlreadyUploadedDocuments) {
|
|
17509
17403
|
setData("bankStatementDocument", alreadyUploadedDocuments);
|
|
17510
|
-
if ((_a2 = props.data) == null ? void 0 : _a2.description)
|
|
17511
|
-
setData("description", props.data.description);
|
|
17404
|
+
if ((_a2 = props.data) == null ? void 0 : _a2.description) setData("description", props.data.description);
|
|
17512
17405
|
triggerValidation();
|
|
17513
17406
|
}
|
|
17514
17407
|
}, [alreadyUploadedDocuments, hasAlreadyUploadedDocuments, (_b = props.data) == null ? void 0 : _b.description, setData, triggerValidation]);
|
|
@@ -17953,12 +17846,10 @@ const httpPost = async (options, data) => http({
|
|
|
17953
17846
|
}, data);
|
|
17954
17847
|
const removeElementSiblings = (element) => {
|
|
17955
17848
|
const parent = element.parentNode;
|
|
17956
|
-
if (!parent)
|
|
17957
|
-
return;
|
|
17849
|
+
if (!parent) return;
|
|
17958
17850
|
let child = parent.firstChild;
|
|
17959
17851
|
while (child) {
|
|
17960
|
-
if (child !== element)
|
|
17961
|
-
parent.removeChild(child);
|
|
17852
|
+
if (child !== element) parent.removeChild(child);
|
|
17962
17853
|
child = child.nextSibling;
|
|
17963
17854
|
}
|
|
17964
17855
|
};
|
|
@@ -17972,8 +17863,7 @@ const isTerminalMessageData = (data) => isObjectData(data) && Object.entries(dat
|
|
|
17972
17863
|
const parseMessageJson = (message) => {
|
|
17973
17864
|
try {
|
|
17974
17865
|
const messageData = JSON.parse(message);
|
|
17975
|
-
if (!RELEVANT_MESSAGE_TYPES.includes(messageData.type))
|
|
17976
|
-
return "invalid";
|
|
17866
|
+
if (!RELEVANT_MESSAGE_TYPES.includes(messageData.type)) return "invalid";
|
|
17977
17867
|
return messageData;
|
|
17978
17868
|
} catch {
|
|
17979
17869
|
return "invalid";
|
|
@@ -18000,8 +17890,7 @@ class IFrameWidget {
|
|
|
18000
17890
|
this.listener = async (message) => {
|
|
18001
17891
|
try {
|
|
18002
17892
|
const result = await this.handleMessage(message);
|
|
18003
|
-
if (!result)
|
|
18004
|
-
return;
|
|
17893
|
+
if (!result) return;
|
|
18005
17894
|
resolve(result);
|
|
18006
17895
|
} catch (err) {
|
|
18007
17896
|
reject(err);
|
|
@@ -18020,8 +17909,7 @@ class IFrameWidget {
|
|
|
18020
17909
|
this.sdkToken = sdkToken2;
|
|
18021
17910
|
}
|
|
18022
17911
|
removeMessageEventListener() {
|
|
18023
|
-
if (!this.listener)
|
|
18024
|
-
return;
|
|
17912
|
+
if (!this.listener) return;
|
|
18025
17913
|
window.removeEventListener("message", this.listener);
|
|
18026
17914
|
this.listener = void 0;
|
|
18027
17915
|
}
|
|
@@ -18030,19 +17918,16 @@ class IFrameWidget {
|
|
|
18030
17918
|
origin,
|
|
18031
17919
|
source
|
|
18032
17920
|
}) {
|
|
18033
|
-
if (source !== this.iframeWindow || origin !== this.iframeUrl.origin)
|
|
18034
|
-
return;
|
|
17921
|
+
if (source !== this.iframeWindow || origin !== this.iframeUrl.origin) return;
|
|
18035
17922
|
if (this.vendor !== TINK_VENDOR && isTerminalMessageData(data)) {
|
|
18036
17923
|
if (Object.getOwnPropertyNames(data).includes("error")) {
|
|
18037
17924
|
throw data;
|
|
18038
17925
|
}
|
|
18039
17926
|
return data;
|
|
18040
17927
|
}
|
|
18041
|
-
if (!isString(data))
|
|
18042
|
-
return;
|
|
17928
|
+
if (!isString(data)) return;
|
|
18043
17929
|
const jsonData = parseMessageJson(data);
|
|
18044
|
-
if (jsonData === "invalid")
|
|
18045
|
-
return;
|
|
17930
|
+
if (jsonData === "invalid") return;
|
|
18046
17931
|
const httpOptions = {
|
|
18047
17932
|
errorHandler: callbackErrorHandler,
|
|
18048
17933
|
loadingContext: "",
|
|
@@ -18064,8 +17949,7 @@ class IFrameWidget {
|
|
|
18064
17949
|
...httpOptions,
|
|
18065
17950
|
path: redirectUrl.href
|
|
18066
17951
|
});
|
|
18067
|
-
if (isVerifiedAccountsData(responseData))
|
|
18068
|
-
return responseData;
|
|
17952
|
+
if (isVerifiedAccountsData(responseData)) return responseData;
|
|
18069
17953
|
throw responseData;
|
|
18070
17954
|
} catch (reason) {
|
|
18071
17955
|
throw new AdyenKycSdkError("WIDGET_ACCOUNT_COMMIT_FAILURE", reason);
|
|
@@ -18124,8 +18008,7 @@ class IFrameWidget {
|
|
|
18124
18008
|
reject(new AdyenKycSdkError("WIDGET_TIMEOUT"));
|
|
18125
18009
|
}, MOUNT_TIMEOUT);
|
|
18126
18010
|
const cancelTimeout = () => {
|
|
18127
|
-
if (timeoutId)
|
|
18128
|
-
clearTimeout(timeoutId);
|
|
18011
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
18129
18012
|
};
|
|
18130
18013
|
this.iframeElement.addEventListener("load", () => {
|
|
18131
18014
|
cancelTimeout();
|
|
@@ -18297,8 +18180,6 @@ const useInstantVerificationErrorNotification = (notificationVisibilityDuration)
|
|
|
18297
18180
|
useEffect(() => {
|
|
18298
18181
|
clearNotificationTimeout();
|
|
18299
18182
|
if (errorNotification) {
|
|
18300
|
-
if (notificationVisibilityDuration <= 0)
|
|
18301
|
-
return;
|
|
18302
18183
|
dismissNotificationTimeoutRef.current = setTimeout(() => {
|
|
18303
18184
|
setErrorNotification(null);
|
|
18304
18185
|
clearNotificationTimeout();
|
|
@@ -18364,8 +18245,7 @@ function InstantBankVerification({
|
|
|
18364
18245
|
content: errorContent
|
|
18365
18246
|
});
|
|
18366
18247
|
}
|
|
18367
|
-
if (onBack)
|
|
18368
|
-
onBack();
|
|
18248
|
+
if (onBack) onBack();
|
|
18369
18249
|
break;
|
|
18370
18250
|
}
|
|
18371
18251
|
case "retry_verification":
|
|
@@ -18373,8 +18253,7 @@ function InstantBankVerification({
|
|
|
18373
18253
|
title: i18n.get("failedInitializeInstantVerification"),
|
|
18374
18254
|
content: errorContent
|
|
18375
18255
|
});
|
|
18376
|
-
if (onBack)
|
|
18377
|
-
onBack();
|
|
18256
|
+
if (onBack) onBack();
|
|
18378
18257
|
break;
|
|
18379
18258
|
default: {
|
|
18380
18259
|
const {
|
|
@@ -19161,8 +19040,7 @@ const customPrefixByCountry = {
|
|
|
19161
19040
|
[CountryCodes.IsleOfMan]: "GB"
|
|
19162
19041
|
};
|
|
19163
19042
|
function ibanValidator(input, bankCountry2) {
|
|
19164
|
-
if (isEmpty(input))
|
|
19165
|
-
return false;
|
|
19043
|
+
if (isEmpty(input)) return false;
|
|
19166
19044
|
const ibanInput = input.replace(/ /g, "").toUpperCase();
|
|
19167
19045
|
if (!/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(ibanInput)) {
|
|
19168
19046
|
return false;
|
|
@@ -19721,11 +19599,9 @@ const getMustHaveSameAccountHolderNameText = (legalEntityType, accountHolderName
|
|
|
19721
19599
|
}
|
|
19722
19600
|
};
|
|
19723
19601
|
const getInstantVerificationProvider = (bankVerificationProviders, bankCountry2) => {
|
|
19724
|
-
if (!bankVerificationProviders)
|
|
19725
|
-
return "loading";
|
|
19602
|
+
if (!bankVerificationProviders) return "loading";
|
|
19726
19603
|
const providerForCountry = bankVerificationProviders[bankCountry2];
|
|
19727
|
-
if (!providerForCountry)
|
|
19728
|
-
return void 0;
|
|
19604
|
+
if (!providerForCountry) return void 0;
|
|
19729
19605
|
return providerForCountry.toLowerCase();
|
|
19730
19606
|
};
|
|
19731
19607
|
function PayoutVerificationMethod(props) {
|
|
@@ -20437,8 +20313,7 @@ const PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES = {
|
|
|
20437
20313
|
}]
|
|
20438
20314
|
};
|
|
20439
20315
|
const getDecisionMakerRequirements = (country2) => {
|
|
20440
|
-
if (!country2)
|
|
20441
|
-
return DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20316
|
+
if (!country2) return DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20442
20317
|
return PER_COUNTRY_DECISION_MAKER_REQUIREMENTS_OVERRIDES[country2] ?? DEFAULT_DECISION_MAKER_REQUIREMENTS;
|
|
20443
20318
|
};
|
|
20444
20319
|
function getAvailableDecisionMakerRoleTypes(country2) {
|
|
@@ -20468,8 +20343,7 @@ const getDecisionMakerDescriptionMap = (country2) => ({
|
|
|
20468
20343
|
...PER_COUNTRY_DESCRIPTION_OVERRIDES[country2]
|
|
20469
20344
|
});
|
|
20470
20345
|
const getOwnDecisionMakers = (rootLegalEntity) => {
|
|
20471
|
-
if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations))
|
|
20472
|
-
return [];
|
|
20346
|
+
if (!(rootLegalEntity == null ? void 0 : rootLegalEntity.entityAssociations)) return [];
|
|
20473
20347
|
return rootLegalEntity.entityAssociations.filter((entityAssociation) => Object.values(DecisionMakerType).includes(entityAssociation.type) && entityAssociation.associatorId === rootLegalEntity.id);
|
|
20474
20348
|
};
|
|
20475
20349
|
const getDecisionMakers = (rootLegalEntity, companyLegalEntityId) => getDirectEntityAssociations(rootLegalEntity, companyLegalEntityId).filter((association2) => Object.values(DecisionMakerType).includes(association2.type));
|
|
@@ -20526,8 +20400,7 @@ const isPartOfTrustFromLegalEntity = (legalEntity) => {
|
|
|
20526
20400
|
};
|
|
20527
20401
|
const getOwnTrustMembersLegalEntityIds = (rootLegalEntity) => {
|
|
20528
20402
|
const trustLegalEntityId = getOwnTrustLegalEntityId(rootLegalEntity);
|
|
20529
|
-
if (!trustLegalEntityId)
|
|
20530
|
-
return [];
|
|
20403
|
+
if (!trustLegalEntityId) return [];
|
|
20531
20404
|
const trustMemberAssociations = getDirectEntityAssociations(rootLegalEntity, trustLegalEntityId);
|
|
20532
20405
|
const trustMemberIds = trustMemberAssociations.map((association2) => association2.legalEntityId).filter((id2) => id2 !== void 0);
|
|
20533
20406
|
return [...trustMemberIds, ...trustMemberIds.flatMap((trustMemberId) => getTrustMemberCompanyDecisionMakerIds(rootLegalEntity, trustMemberId))];
|
|
@@ -20701,8 +20574,7 @@ function TrustRegistrationDetailsComponent(props) {
|
|
|
20701
20574
|
classNameModifiers: ["country"],
|
|
20702
20575
|
handleChangeFor: () => (e) => {
|
|
20703
20576
|
handleChangeFor("country", "input")(e);
|
|
20704
|
-
if (onCountryChange)
|
|
20705
|
-
onCountryChange(e);
|
|
20577
|
+
if (onCountryChange) onCountryChange(e);
|
|
20706
20578
|
}
|
|
20707
20579
|
}), formUtils.isRequiredField("legalName") && jsx(Field, {
|
|
20708
20580
|
name: "legalName",
|
|
@@ -21661,8 +21533,7 @@ const getOpeningStep = (forms2, remediationActions) => {
|
|
|
21661
21533
|
var _a2;
|
|
21662
21534
|
return (form2 == null ? void 0 : form2.formId) === ((_a2 = allRemediationActions[0]) == null ? void 0 : _a2.forms[0]);
|
|
21663
21535
|
});
|
|
21664
|
-
if (form)
|
|
21665
|
-
return form;
|
|
21536
|
+
if (form) return form;
|
|
21666
21537
|
}
|
|
21667
21538
|
return forms2[forms2.length - 1];
|
|
21668
21539
|
}
|
|
@@ -21695,8 +21566,7 @@ const useFormComposer = ({
|
|
|
21695
21566
|
}) => formId === activeForm2.formId) ?? activeForm2);
|
|
21696
21567
|
}, [forms2]);
|
|
21697
21568
|
useEffect(() => {
|
|
21698
|
-
if (hasAlreadyNavigatedForm)
|
|
21699
|
-
return;
|
|
21569
|
+
if (hasAlreadyNavigatedForm) return;
|
|
21700
21570
|
const openingStep = getOpeningStep(forms2, problems == null ? void 0 : problems.remediationActions);
|
|
21701
21571
|
if (activeForm !== openingStep) {
|
|
21702
21572
|
setActiveForm(openingStep);
|
|
@@ -21875,14 +21745,12 @@ const useScenarioConfiguration = ({
|
|
|
21875
21745
|
}, [getConfigurationData, setLoadingStatus]);
|
|
21876
21746
|
useEffect(() => {
|
|
21877
21747
|
setLoadingStatus("loading");
|
|
21878
|
-
if (!getPayoutAccountFormatData)
|
|
21879
|
-
return;
|
|
21748
|
+
if (!getPayoutAccountFormatData) return;
|
|
21880
21749
|
const makePayoutFormatCallAndSave = async () => {
|
|
21881
21750
|
try {
|
|
21882
21751
|
const response = await getPayoutAccountFormatData();
|
|
21883
21752
|
setAccountFormatResponse(response);
|
|
21884
|
-
if (!response)
|
|
21885
|
-
return;
|
|
21753
|
+
if (!response) return;
|
|
21886
21754
|
const allowedBankAccountFormats = Object.keys(response);
|
|
21887
21755
|
if (existingBankAccountFormat && !allowedBankAccountFormats.includes(existingBankAccountFormat)) {
|
|
21888
21756
|
throw new AdyenKycSdkError(`Account format, ${existingBankAccountFormat}, of transferInstrument is not in allowed formats for ${country2}`);
|
|
@@ -21902,8 +21770,7 @@ const useScenarioConfiguration = ({
|
|
|
21902
21770
|
bankVerificationVendors,
|
|
21903
21771
|
requiredFields
|
|
21904
21772
|
} = useMemo(() => {
|
|
21905
|
-
if (!configurationResponse)
|
|
21906
|
-
return {};
|
|
21773
|
+
if (!configurationResponse) return {};
|
|
21907
21774
|
const {
|
|
21908
21775
|
matchingScenario,
|
|
21909
21776
|
bankVerificationProviders
|
|
@@ -22199,8 +22066,7 @@ function parsePayoutScenarios({
|
|
|
22199
22066
|
country: country2,
|
|
22200
22067
|
bankVerificationAvailable
|
|
22201
22068
|
}) {
|
|
22202
|
-
if (!requiredFields)
|
|
22203
|
-
return;
|
|
22069
|
+
if (!requiredFields) return;
|
|
22204
22070
|
const fieldConfigurations = {};
|
|
22205
22071
|
fieldConfigurations.payoutVerificationMethod = {
|
|
22206
22072
|
rule: "REQUIRED"
|
|
@@ -22492,8 +22358,7 @@ const getFieldsWithExistingData = (legalEntity, isExperimentEnabled) => {
|
|
|
22492
22358
|
var _a;
|
|
22493
22359
|
const apiFieldsWithExistingData = getNestedPropertyKeys(legalEntity);
|
|
22494
22360
|
const legalEntityType = legalEntity.type;
|
|
22495
|
-
if (!legalEntityType)
|
|
22496
|
-
return [];
|
|
22361
|
+
if (!legalEntityType) return [];
|
|
22497
22362
|
const nonDocumentFields = apiFieldsWithExistingData.map((field) => convertApiFieldNameToSchemaFieldName(field, legalEntityType, isExperimentEnabled)).filter((field) => field !== void 0).filter((field) => !knownProblematicFields.includes(field));
|
|
22498
22363
|
if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) {
|
|
22499
22364
|
const documentFields = legalEntity.documentDetails.map((document2) => legalEntityDocumentToFieldMapping[legalEntityType][document2.type]).filter((field) => field !== void 0);
|
|
@@ -22769,8 +22634,7 @@ function FormNavigation({
|
|
|
22769
22634
|
} = useI18nContext();
|
|
22770
22635
|
const getFormIndex = (form) => forms2.findIndex((f) => f.formId === form.formId);
|
|
22771
22636
|
const goToForm = (form) => () => {
|
|
22772
|
-
if (form.formId === activeForm.formId)
|
|
22773
|
-
return;
|
|
22637
|
+
if (form.formId === activeForm.formId) return;
|
|
22774
22638
|
gotoForm(getFormIndex(form));
|
|
22775
22639
|
trackNavigation2({
|
|
22776
22640
|
fromForm: form,
|
|
@@ -23065,8 +22929,7 @@ function CompanyDropinComponent({
|
|
|
23065
22929
|
legalEntity,
|
|
23066
22930
|
dataSubmitted
|
|
23067
22931
|
}) => {
|
|
23068
|
-
if (!isDocumentsRequired$2(forms22))
|
|
23069
|
-
return;
|
|
22932
|
+
if (!isDocumentsRequired$2(forms22)) return;
|
|
23070
22933
|
const formattedDocument = await mapCompanyDocumentToApiDocument(dataSubmitted, legalEntity.id);
|
|
23071
22934
|
if (formattedDocument) {
|
|
23072
22935
|
await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
|
|
@@ -23346,8 +23209,7 @@ function useCompanySearch({
|
|
|
23346
23209
|
deepSearch
|
|
23347
23210
|
}) => {
|
|
23348
23211
|
try {
|
|
23349
|
-
if (!deepSearch)
|
|
23350
|
-
return;
|
|
23212
|
+
if (!deepSearch) return;
|
|
23351
23213
|
setStatus("loading");
|
|
23352
23214
|
setCompaniesList([]);
|
|
23353
23215
|
const {
|
|
@@ -23371,8 +23233,7 @@ function useCompanySearch({
|
|
|
23371
23233
|
return setStatus("idle");
|
|
23372
23234
|
}
|
|
23373
23235
|
try {
|
|
23374
|
-
if (!handleCompanyDeepSearch)
|
|
23375
|
-
return;
|
|
23236
|
+
if (!handleCompanyDeepSearch) return;
|
|
23376
23237
|
setStatus("loading");
|
|
23377
23238
|
setSelectedCompanyId(void 0);
|
|
23378
23239
|
const {
|
|
@@ -23393,8 +23254,7 @@ function useCompanySearch({
|
|
|
23393
23254
|
}, [handleCompanyDeepSearch, country2, legalCompanyName2, limit, stateOrProvince2]);
|
|
23394
23255
|
const verify2 = useCallback(async (companyTIN, company2) => {
|
|
23395
23256
|
try {
|
|
23396
|
-
if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset)
|
|
23397
|
-
return;
|
|
23257
|
+
if (!handleVerifyTin || !handleGetCompanyDataset || !handleRefreshCompanyDataset) return;
|
|
23398
23258
|
setStatus("loading");
|
|
23399
23259
|
setSelectedCompanyId(company2.id);
|
|
23400
23260
|
if (!canVerify || !companyTIN) {
|
|
@@ -23560,10 +23420,8 @@ const CompanyLookupResultsHeader = ({
|
|
|
23560
23420
|
if (status === "loading") {
|
|
23561
23421
|
return selectedCompanyId ? i18n.get("companyLookupResultsHeader__verifying") : i18n.get("companyLookupResultsHeader__searching");
|
|
23562
23422
|
}
|
|
23563
|
-
if (numberOfResults === 0 && status === "loaded")
|
|
23564
|
-
|
|
23565
|
-
if (numberOfResults)
|
|
23566
|
-
return i18n.get("companyLookupResultsHeader__results");
|
|
23423
|
+
if (numberOfResults === 0 && status === "loaded") return i18n.get("companyLookupResultsHeader__noResults");
|
|
23424
|
+
if (numberOfResults) return i18n.get("companyLookupResultsHeader__results");
|
|
23567
23425
|
return i18n.get("companyLookupResultsHeader");
|
|
23568
23426
|
}, [hasInternalError, status, numberOfResults, i18n, selectedCompanyId]);
|
|
23569
23427
|
const descriptionText = useMemo(() => {
|
|
@@ -23964,8 +23822,7 @@ function TaxInformationField({
|
|
|
23964
23822
|
type: countryToTaxInfoTypeMap[country2]
|
|
23965
23823
|
}];
|
|
23966
23824
|
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
23967
|
-
if (taxInfo.country !== country2)
|
|
23968
|
-
return taxInfo;
|
|
23825
|
+
if (taxInfo.country !== country2) return taxInfo;
|
|
23969
23826
|
return {
|
|
23970
23827
|
country: country2,
|
|
23971
23828
|
number: value,
|
|
@@ -23992,8 +23849,7 @@ function TaxInformationField({
|
|
|
23992
23849
|
type: countryToTaxInfoTypeMap[country2]
|
|
23993
23850
|
}];
|
|
23994
23851
|
const updatedTaxInformation = taxInformation.map((taxInfo) => {
|
|
23995
|
-
if (taxInfo.country !== country2)
|
|
23996
|
-
return taxInfo;
|
|
23852
|
+
if (taxInfo.country !== country2) return taxInfo;
|
|
23997
23853
|
return {
|
|
23998
23854
|
country: country2,
|
|
23999
23855
|
number: value,
|
|
@@ -24074,8 +23930,7 @@ const defaultFieldConfig = entriesOf(defaultFieldConfig$7).reduce((fieldConfig,
|
|
|
24074
23930
|
errorMessage: (taxInformation) => {
|
|
24075
23931
|
var _a;
|
|
24076
23932
|
const taxIdNumber2 = (_a = taxInformation == null ? void 0 : taxInformation.find((taxId2) => country2 === taxId2.country)) == null ? void 0 : _a.number;
|
|
24077
|
-
if (!taxIdNumber2)
|
|
24078
|
-
return void 0;
|
|
23933
|
+
if (!taxIdNumber2) return void 0;
|
|
24079
23934
|
return typeof validator.errorMessage === "function" ? validator.errorMessage(taxIdNumber2) : validator.errorMessage;
|
|
24080
23935
|
}
|
|
24081
23936
|
}));
|
|
@@ -25009,8 +24864,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25009
24864
|
}, defaultFieldMetadata).label;
|
|
25010
24865
|
return entriesOf(data).reduce((summaryData, [form, formData]) => {
|
|
25011
24866
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
25012
|
-
if (!form)
|
|
25013
|
-
return summaryData;
|
|
24867
|
+
if (!form) return summaryData;
|
|
25014
24868
|
switch (form) {
|
|
25015
24869
|
case "companyBasics":
|
|
25016
24870
|
return {
|
|
@@ -25044,8 +24898,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25044
24898
|
[form]: formatOtherDetails(formData, i18n, (_f = data.companyBasics) == null ? void 0 : _f.country, labels2)
|
|
25045
24899
|
};
|
|
25046
24900
|
case "companyRegistrationDocument":
|
|
25047
|
-
if (!isDocumentsRequired$1(forms2))
|
|
25048
|
-
return summaryData;
|
|
24901
|
+
if (!isDocumentsRequired$1(forms2)) return summaryData;
|
|
25049
24902
|
return {
|
|
25050
24903
|
...summaryData,
|
|
25051
24904
|
[form]: {
|
|
@@ -25055,8 +24908,7 @@ const formatDataForSummary = (data, forms2, labels2, i18n) => {
|
|
|
25055
24908
|
}
|
|
25056
24909
|
};
|
|
25057
24910
|
case "companyTaxDocument":
|
|
25058
|
-
if (!isDocumentsRequired$1(forms2))
|
|
25059
|
-
return summaryData;
|
|
24911
|
+
if (!isDocumentsRequired$1(forms2)) return summaryData;
|
|
25060
24912
|
return {
|
|
25061
24913
|
...summaryData,
|
|
25062
24914
|
[form]: {
|
|
@@ -25299,8 +25151,7 @@ function useCompanySearchTaskSubmit({
|
|
|
25299
25151
|
legalEntity,
|
|
25300
25152
|
currentForms
|
|
25301
25153
|
}) => {
|
|
25302
|
-
if (!isDocumentsRequired$1(currentForms))
|
|
25303
|
-
return;
|
|
25154
|
+
if (!isDocumentsRequired$1(currentForms)) return;
|
|
25304
25155
|
const formattedDocument = await mapCompanySearchDocumentToApiDocument(data, legalEntity.id);
|
|
25305
25156
|
try {
|
|
25306
25157
|
if (formattedDocument) {
|
|
@@ -25602,8 +25453,7 @@ function CompanySearchDropinComponent({
|
|
|
25602
25453
|
var _a2;
|
|
25603
25454
|
eventEmitter.on("updateLocale", (locale) => setLocale(locale));
|
|
25604
25455
|
const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
|
|
25605
|
-
if (!documentIds.length)
|
|
25606
|
-
return;
|
|
25456
|
+
if (!documentIds.length) return;
|
|
25607
25457
|
documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
|
|
25608
25458
|
setInitialData({
|
|
25609
25459
|
...initialData,
|
|
@@ -25762,8 +25612,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25762
25612
|
}), [options]);
|
|
25763
25613
|
const rawValueRef = useRef(null);
|
|
25764
25614
|
const [value, setValue] = useState(() => {
|
|
25765
|
-
if (typeof window === "undefined")
|
|
25766
|
-
return defaultValue;
|
|
25615
|
+
if (typeof window === "undefined") return defaultValue;
|
|
25767
25616
|
try {
|
|
25768
25617
|
rawValueRef.current = window.localStorage.getItem(key);
|
|
25769
25618
|
const res = rawValueRef.current ? parser(rawValueRef.current) : defaultValue;
|
|
@@ -25774,8 +25623,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25774
25623
|
}
|
|
25775
25624
|
});
|
|
25776
25625
|
useEffect(() => {
|
|
25777
|
-
if (typeof window === "undefined")
|
|
25778
|
-
return;
|
|
25626
|
+
if (typeof window === "undefined") return;
|
|
25779
25627
|
const updateLocalStorage = () => {
|
|
25780
25628
|
if (value !== void 0) {
|
|
25781
25629
|
const newValue = serializer(value);
|
|
@@ -25805,11 +25653,9 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25805
25653
|
}
|
|
25806
25654
|
}, [value]);
|
|
25807
25655
|
useEffect(() => {
|
|
25808
|
-
if (!syncData)
|
|
25809
|
-
return;
|
|
25656
|
+
if (!syncData) return;
|
|
25810
25657
|
const handleStorageChange = (event) => {
|
|
25811
|
-
if (event.key !== key || event.storageArea !== window.localStorage)
|
|
25812
|
-
return;
|
|
25658
|
+
if (event.key !== key || event.storageArea !== window.localStorage) return;
|
|
25813
25659
|
try {
|
|
25814
25660
|
if (event.newValue !== rawValueRef.current) {
|
|
25815
25661
|
rawValueRef.current = event.newValue;
|
|
@@ -25819,8 +25665,7 @@ const useLocalStorage = (key, defaultValue, options) => {
|
|
|
25819
25665
|
logger$c.error(err);
|
|
25820
25666
|
}
|
|
25821
25667
|
};
|
|
25822
|
-
if (typeof window === "undefined")
|
|
25823
|
-
return;
|
|
25668
|
+
if (typeof window === "undefined") return;
|
|
25824
25669
|
window.addEventListener("storage", handleStorageChange);
|
|
25825
25670
|
return () => window.removeEventListener("storage", handleStorageChange);
|
|
25826
25671
|
}, [key, syncData]);
|
|
@@ -25854,11 +25699,9 @@ const useIsEligibleForSingpass = ({
|
|
|
25854
25699
|
const {
|
|
25855
25700
|
isExperimentEnabled
|
|
25856
25701
|
} = useExperimentsContext();
|
|
25857
|
-
if (!isExperimentEnabled("ShowSingPassButtonForCompanies"))
|
|
25858
|
-
return false;
|
|
25702
|
+
if (!isExperimentEnabled("ShowSingPassButtonForCompanies")) return false;
|
|
25859
25703
|
const isSingpassEnabled = Boolean(handleOpenSingpassAuthorizationLink) && getLegalEntityCountry(legalEntity) === CountryCodes.Singapore;
|
|
25860
|
-
if (!isSingpassEnabled)
|
|
25861
|
-
return false;
|
|
25704
|
+
if (!isSingpassEnabled) return false;
|
|
25862
25705
|
if (accountHolder2) {
|
|
25863
25706
|
return accountHolder2 === "theCompanyIWorkFor";
|
|
25864
25707
|
}
|
|
@@ -25901,8 +25744,7 @@ const useExemptSettlor = ({
|
|
|
25901
25744
|
setExemptSettlor(exemptSettlorLE);
|
|
25902
25745
|
}, [handleGetLegalEntity]);
|
|
25903
25746
|
useEffect(() => {
|
|
25904
|
-
if (!(trust2 == null ? void 0 : trust2.trust))
|
|
25905
|
-
return;
|
|
25747
|
+
if (!(trust2 == null ? void 0 : trust2.trust)) return;
|
|
25906
25748
|
updateExemptSettlor(trust2).catch(logger$a.error);
|
|
25907
25749
|
}, [trust2, updateExemptSettlor]);
|
|
25908
25750
|
return exemptSettlor;
|
|
@@ -25963,8 +25805,7 @@ const saveBlobAsFile = (fileData, filename) => {
|
|
|
25963
25805
|
const isNewEntity = Symbol("isNewEntity");
|
|
25964
25806
|
const splitAtFirstOccurrence = (str, separator) => {
|
|
25965
25807
|
const firstOccurrence = str.indexOf(separator);
|
|
25966
|
-
if (firstOccurrence === -1)
|
|
25967
|
-
return [str];
|
|
25808
|
+
if (firstOccurrence === -1) return [str];
|
|
25968
25809
|
return [str.slice(0, firstOccurrence), str.slice(firstOccurrence + 1)];
|
|
25969
25810
|
};
|
|
25970
25811
|
const getTrustMemberOwnerId = (trustMemberId, entityAssociations) => {
|
|
@@ -25991,23 +25832,21 @@ const convertEntityAssociationIntoTrustMember = (association2, associations, exe
|
|
|
25991
25832
|
name: association2.name
|
|
25992
25833
|
};
|
|
25993
25834
|
}
|
|
25994
|
-
if (association2.entityType === LegalEntityType.ORGANIZATION)
|
|
25995
|
-
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
|
|
25999
|
-
|
|
26000
|
-
|
|
26001
|
-
|
|
26002
|
-
|
|
26003
|
-
|
|
26004
|
-
|
|
26005
|
-
|
|
26006
|
-
|
|
26007
|
-
|
|
26008
|
-
|
|
26009
|
-
name: association2.name
|
|
26010
|
-
};
|
|
25835
|
+
if (association2.entityType === LegalEntityType.ORGANIZATION) return {
|
|
25836
|
+
trustMemberType: "company",
|
|
25837
|
+
roles: [],
|
|
25838
|
+
legalEntityType: LegalEntityType.ORGANIZATION,
|
|
25839
|
+
legalEntityId: association2.legalEntityId,
|
|
25840
|
+
name: association2.name,
|
|
25841
|
+
ownerId: getTrustMemberOwnerId(association2.legalEntityId, associations)
|
|
25842
|
+
};
|
|
25843
|
+
if (association2.entityType === LegalEntityType.INDIVIDUAL) return {
|
|
25844
|
+
trustMemberType: "regular",
|
|
25845
|
+
roles: [],
|
|
25846
|
+
legalEntityType: LegalEntityType.INDIVIDUAL,
|
|
25847
|
+
legalEntityId: association2.legalEntityId,
|
|
25848
|
+
name: association2.name
|
|
25849
|
+
};
|
|
26011
25850
|
throw new Error(`Not a valid trust member: ${JSON.stringify(association2)}`);
|
|
26012
25851
|
};
|
|
26013
25852
|
const mapEntityAssociationsToTrustMembers = (trustEntityId, entityAssociations, exemptSettlorLE) => {
|
|
@@ -26067,14 +25906,13 @@ const mapTrustMemberToEntityAssociations = (trustMember) => {
|
|
|
26067
25906
|
if (trustMember.legalEntityId === isNewEntity) {
|
|
26068
25907
|
throw Error("Cannot map a new trust member, you must create it first");
|
|
26069
25908
|
}
|
|
26070
|
-
if (trustMember.trustMemberType === "exemptSettlor")
|
|
26071
|
-
|
|
26072
|
-
|
|
26073
|
-
|
|
26074
|
-
|
|
26075
|
-
|
|
26076
|
-
|
|
26077
|
-
}];
|
|
25909
|
+
if (trustMember.trustMemberType === "exemptSettlor") return [{
|
|
25910
|
+
legalEntityId: trustMember.legalEntityId,
|
|
25911
|
+
entityType: trustMember.legalEntityType,
|
|
25912
|
+
type: TrustMemberTypes.SETTLOR,
|
|
25913
|
+
settlorExemptionReason: trustMember.settlorExemptionReason,
|
|
25914
|
+
name: trustMember.legalEntityType === LegalEntityType.INDIVIDUAL ? `${(_a = trustMember.exemptSettlorName) == null ? void 0 : _a.firstName} ${(_b = trustMember.exemptSettlorName) == null ? void 0 : _b.lastName}` : trustMember.name ?? ""
|
|
25915
|
+
}];
|
|
26078
25916
|
return trustMember.roles.map((role2) => ({
|
|
26079
25917
|
legalEntityId: trustMember.legalEntityId,
|
|
26080
25918
|
type: role2
|
|
@@ -26455,8 +26293,7 @@ const BusinessTypeSelection = ({
|
|
|
26455
26293
|
}, []);
|
|
26456
26294
|
const handleNextClick = async () => {
|
|
26457
26295
|
var _a2;
|
|
26458
|
-
if (loadingStatus === "loading")
|
|
26459
|
-
return;
|
|
26296
|
+
if (loadingStatus === "loading") return;
|
|
26460
26297
|
triggerValidation();
|
|
26461
26298
|
if (isValid) {
|
|
26462
26299
|
if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
|
|
@@ -27449,12 +27286,9 @@ const useLegalEntityType = ({
|
|
|
27449
27286
|
switch (legalEntity.type) {
|
|
27450
27287
|
case LegalEntityType.INDIVIDUAL:
|
|
27451
27288
|
case LegalEntityType.ORGANIZATION:
|
|
27452
|
-
if (!hasLegalAssociation)
|
|
27453
|
-
|
|
27454
|
-
if (
|
|
27455
|
-
return LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27456
|
-
if (isTrust)
|
|
27457
|
-
return LegalEntityType.TRUST;
|
|
27289
|
+
if (!hasLegalAssociation) return legalEntity.type;
|
|
27290
|
+
if (isSoleProprietor) return LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27291
|
+
if (isTrust) return LegalEntityType.TRUST;
|
|
27458
27292
|
break;
|
|
27459
27293
|
default:
|
|
27460
27294
|
return void 0;
|
|
@@ -27499,12 +27333,9 @@ const useIntroductionScreens = ({
|
|
|
27499
27333
|
const isSoleProprietor = legalEntityType === LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
27500
27334
|
const isTrustScreen = screen === IntroductionScreens.TRUST || screen === IntroductionScreens.TRUST_MEMBER_OVERVIEW;
|
|
27501
27335
|
const isTrust = legalEntityType === LegalEntityType.TRUST;
|
|
27502
|
-
if (isAccountScreen)
|
|
27503
|
-
|
|
27504
|
-
if (
|
|
27505
|
-
return isSoleProprietor;
|
|
27506
|
-
if (isTrustScreen)
|
|
27507
|
-
return isTrust;
|
|
27336
|
+
if (isAccountScreen) return hasAccountTask;
|
|
27337
|
+
if (isSoleProprietorScreen) return isSoleProprietor;
|
|
27338
|
+
if (isTrustScreen) return isTrust;
|
|
27508
27339
|
return tasks.some((task) => screen === task);
|
|
27509
27340
|
}) : [], [legalEntityType, tasks]);
|
|
27510
27341
|
return canSeeIntroduction && (introductionScreens == null ? void 0 : introductionScreens.length) > 0 ? [IntroductionScreens.PROLOGUE, ...introductionScreens, IntroductionScreens.EPILOGUE] : void 0;
|
|
@@ -28954,8 +28785,7 @@ function IndividualDropinComponent({
|
|
|
28954
28785
|
dataSubmitted
|
|
28955
28786
|
}) => {
|
|
28956
28787
|
var _a2;
|
|
28957
|
-
if (!isDocumentsRequired2(forms22))
|
|
28958
|
-
return;
|
|
28788
|
+
if (!isDocumentsRequired2(forms22)) return;
|
|
28959
28789
|
if ((_a2 = dataSubmitted.idDocument) == null ? void 0 : _a2.instantIdVerificationData) {
|
|
28960
28790
|
await handleInstantIdVerificationStartCheck(dataSubmitted.idDocument.instantIdVerificationData, legalEntity.id);
|
|
28961
28791
|
} else {
|
|
@@ -29091,20 +28921,17 @@ function IndividualDropinComponent({
|
|
|
29091
28921
|
const datasetUtils = datasetUtilities(i18n.locale);
|
|
29092
28922
|
const formatIdDocument = (idDocument2) => {
|
|
29093
28923
|
var _a2, _b2;
|
|
29094
|
-
if (!idDocument2)
|
|
29095
|
-
return void 0;
|
|
28924
|
+
if (!idDocument2) return void 0;
|
|
29096
28925
|
const documentType2 = (idDocument2 == null ? void 0 : idDocument2.instantIdVerificationData) ? onfidoDocumentTypeMapping.find((document2) => {
|
|
29097
28926
|
var _a3;
|
|
29098
28927
|
return ((_a3 = idDocument2.instantIdVerificationData) == null ? void 0 : _a3.document_front.type) === document2.id;
|
|
29099
28928
|
}) : idDocumentTypeOptions.find(({
|
|
29100
28929
|
id: id2
|
|
29101
28930
|
}) => idDocument2.idDocumentType === id2);
|
|
29102
|
-
if (!documentType2)
|
|
29103
|
-
return void 0;
|
|
28931
|
+
if (!documentType2) return void 0;
|
|
29104
28932
|
const frontPage2 = (_a2 = idDocument2.idFrontPage) == null ? void 0 : _a2[0];
|
|
29105
28933
|
const backPage2 = (_b2 = idDocument2.idBackPage) == null ? void 0 : _b2[0];
|
|
29106
|
-
if (!frontPage2)
|
|
29107
|
-
return void 0;
|
|
28934
|
+
if (!frontPage2) return void 0;
|
|
29108
28935
|
return {
|
|
29109
28936
|
documentType: i18n.get(documentType2.name),
|
|
29110
28937
|
...backPage2 && documentType2.hasBackPage ? {
|
|
@@ -29288,8 +29115,7 @@ const rules$1 = ({
|
|
|
29288
29115
|
}) => ({
|
|
29289
29116
|
whenUsingManualVerification: () => {
|
|
29290
29117
|
var _a;
|
|
29291
|
-
if (!data.payoutVerificationMethod)
|
|
29292
|
-
return;
|
|
29118
|
+
if (!data.payoutVerificationMethod) return;
|
|
29293
29119
|
if (((_a = data == null ? void 0 : data.payoutVerificationMethod) == null ? void 0 : _a.payoutVerificationMethod) === "manualVerification") {
|
|
29294
29120
|
return "REQUIRED";
|
|
29295
29121
|
}
|
|
@@ -29849,8 +29675,7 @@ function PciDropinComponent({
|
|
|
29849
29675
|
name: `${(_a = legalEntityResponse == null ? void 0 : legalEntityResponse.individual) == null ? void 0 : _a.name.firstName} ${(_b = legalEntityResponse.individual) == null ? void 0 : _b.name.lastName}`
|
|
29850
29676
|
}];
|
|
29851
29677
|
const handleSignClick = async () => {
|
|
29852
|
-
if (loadingStatus === "loading")
|
|
29853
|
-
return;
|
|
29678
|
+
if (loadingStatus === "loading") return;
|
|
29854
29679
|
userEvents.addEvent("Clicked PCI signing", {
|
|
29855
29680
|
segmentation: {
|
|
29856
29681
|
...baseTrackingPayload
|
|
@@ -29982,8 +29807,7 @@ function PciDropinComponent({
|
|
|
29982
29807
|
});
|
|
29983
29808
|
}
|
|
29984
29809
|
const convertExistingSettlorExemptionReasons = (existingReasons) => {
|
|
29985
|
-
if (!existingReasons || !existingReasons.length)
|
|
29986
|
-
return ["noneOfTheAbove"];
|
|
29810
|
+
if (!existingReasons || !existingReasons.length) return ["noneOfTheAbove"];
|
|
29987
29811
|
return existingReasons;
|
|
29988
29812
|
};
|
|
29989
29813
|
const convertExistingTrustMember = (trustMember) => {
|
|
@@ -30098,8 +29922,7 @@ const getAvailableRolesByTrustMemberTypeAndLegalEntityType = (currentRoles, trus
|
|
|
30098
29922
|
return roles.filter((r) => r !== "secondaryTrustee");
|
|
30099
29923
|
};
|
|
30100
29924
|
const getAvailableRoles = (currentRoles) => {
|
|
30101
|
-
if (!(currentRoles == null ? void 0 : currentRoles.length))
|
|
30102
|
-
return Object.values(TrustMemberTypes);
|
|
29925
|
+
if (!(currentRoles == null ? void 0 : currentRoles.length)) return Object.values(TrustMemberTypes);
|
|
30103
29926
|
return currentRoles.map((role2) => [role2, ...allowedCrossoverRolesMatrix[role2]]).reduce((existingAllowed, allowedForRole) => existingAllowed.filter((role2) => allowedForRole.includes(role2)));
|
|
30104
29927
|
};
|
|
30105
29928
|
const trustMemberLegalEntityTypes = [LegalEntityType.INDIVIDUAL, LegalEntityType.ORGANIZATION];
|
|
@@ -30436,8 +30259,7 @@ const exemptSettlorForms = {
|
|
|
30436
30259
|
summary
|
|
30437
30260
|
};
|
|
30438
30261
|
const decideForms = (trustMember) => {
|
|
30439
|
-
if (trustMember === "incomplete")
|
|
30440
|
-
return regularForms;
|
|
30262
|
+
if (trustMember === "incomplete") return regularForms;
|
|
30441
30263
|
switch (trustMember.trustMemberType) {
|
|
30442
30264
|
case "undefinedBeneficiary":
|
|
30443
30265
|
return undefinedBeneficiaryForms;
|
|
@@ -30487,13 +30309,12 @@ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettl
|
|
|
30487
30309
|
legalEntityId: existingId ?? isNewEntity
|
|
30488
30310
|
};
|
|
30489
30311
|
}
|
|
30490
|
-
if (data.role.includes("undefinedBeneficiary"))
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
};
|
|
30312
|
+
if (data.role.includes("undefinedBeneficiary")) return {
|
|
30313
|
+
trustMemberType: "undefinedBeneficiary",
|
|
30314
|
+
roles: [TrustMemberTypes.UNDEFINED_BENEFICIARY],
|
|
30315
|
+
description: data.descriptionUndefinedBeneficiary ?? "",
|
|
30316
|
+
reference: existingId ?? isNewEntity
|
|
30317
|
+
};
|
|
30497
30318
|
if (data.entityType === LegalEntityType.ORGANIZATION) {
|
|
30498
30319
|
return {
|
|
30499
30320
|
trustMemberType: "company",
|
|
@@ -30504,14 +30325,13 @@ const convertDataToTrustMember = (data, existingTrustMember, isOrganizationSettl
|
|
|
30504
30325
|
country: data.country
|
|
30505
30326
|
};
|
|
30506
30327
|
}
|
|
30507
|
-
if (data.entityType === LegalEntityType.INDIVIDUAL)
|
|
30508
|
-
|
|
30509
|
-
|
|
30510
|
-
|
|
30511
|
-
|
|
30512
|
-
|
|
30513
|
-
|
|
30514
|
-
};
|
|
30328
|
+
if (data.entityType === LegalEntityType.INDIVIDUAL) return {
|
|
30329
|
+
trustMemberType: "regular",
|
|
30330
|
+
roles: data.role,
|
|
30331
|
+
legalEntityType: LegalEntityType.INDIVIDUAL,
|
|
30332
|
+
legalEntityId: existingId ?? isNewEntity,
|
|
30333
|
+
name: ""
|
|
30334
|
+
};
|
|
30515
30335
|
}
|
|
30516
30336
|
return "incomplete";
|
|
30517
30337
|
};
|
|
@@ -30571,8 +30391,7 @@ function RoleAndTypeDropinComponent({
|
|
|
30571
30391
|
setTrustMember(convertDataToTrustMember(data, existingTrustMember, isOrganizationSettlorWithExemptionEnabled));
|
|
30572
30392
|
};
|
|
30573
30393
|
const saveRolesAndNavigate = async () => {
|
|
30574
|
-
if (trustMember === "incomplete")
|
|
30575
|
-
return;
|
|
30394
|
+
if (trustMember === "incomplete") return;
|
|
30576
30395
|
if (hasRolesChanged(trustMember.roles, existingTrustMember == null ? void 0 : existingTrustMember.roles)) {
|
|
30577
30396
|
addOrUpdateTrustMember(trustMember);
|
|
30578
30397
|
}
|
|
@@ -30595,8 +30414,7 @@ function RoleAndTypeDropinComponent({
|
|
|
30595
30414
|
navigateToFullDropinFor(trustMember);
|
|
30596
30415
|
return;
|
|
30597
30416
|
}
|
|
30598
|
-
if (targetForm.formId === summaryStep.formId)
|
|
30599
|
-
return;
|
|
30417
|
+
if (targetForm.formId === summaryStep.formId) return;
|
|
30600
30418
|
}
|
|
30601
30419
|
setActiveForm(targetForm);
|
|
30602
30420
|
};
|
|
@@ -30670,8 +30488,7 @@ const useServiceAgreement = ({
|
|
|
30670
30488
|
}, [language]);
|
|
30671
30489
|
useEffect(() => {
|
|
30672
30490
|
const requestAcceptedServiceAgreement = async () => {
|
|
30673
|
-
if (!handleViewAcceptedTermsOfServiceDocument || !acceptanceId)
|
|
30674
|
-
return;
|
|
30491
|
+
if (!handleViewAcceptedTermsOfServiceDocument || !acceptanceId) return;
|
|
30675
30492
|
setLoading("loading");
|
|
30676
30493
|
const {
|
|
30677
30494
|
id: id2,
|
|
@@ -30687,8 +30504,7 @@ const useServiceAgreement = ({
|
|
|
30687
30504
|
}, [acceptanceId, handleViewAcceptedTermsOfServiceDocument]);
|
|
30688
30505
|
useEffect(() => {
|
|
30689
30506
|
const requestServiceAgreement = async () => {
|
|
30690
|
-
if (acceptanceId)
|
|
30691
|
-
return;
|
|
30507
|
+
if (acceptanceId) return;
|
|
30692
30508
|
setLoading("loading");
|
|
30693
30509
|
try {
|
|
30694
30510
|
const {
|
|
@@ -30824,8 +30640,7 @@ function ServiceAgreementDropinComponent({
|
|
|
30824
30640
|
}
|
|
30825
30641
|
});
|
|
30826
30642
|
triggerValidation();
|
|
30827
|
-
if (loadingStatus === "loading" || !serviceAgreement || !data.signer)
|
|
30828
|
-
return;
|
|
30643
|
+
if (loadingStatus === "loading" || !serviceAgreement || !data.signer) return;
|
|
30829
30644
|
if (isValid) {
|
|
30830
30645
|
try {
|
|
30831
30646
|
setLoadingStatus("loading");
|
|
@@ -30882,8 +30697,7 @@ function ServiceAgreementDropinComponent({
|
|
|
30882
30697
|
});
|
|
30883
30698
|
};
|
|
30884
30699
|
useEffect(() => {
|
|
30885
|
-
if (!serviceAgreementAcceptanceInfos.length)
|
|
30886
|
-
return;
|
|
30700
|
+
if (!serviceAgreementAcceptanceInfos.length) return;
|
|
30887
30701
|
gotoForm(serviceAgreementAcceptanceInfos.length - 1);
|
|
30888
30702
|
}, [serviceAgreementAcceptanceInfos]);
|
|
30889
30703
|
useEffect(() => {
|
|
@@ -30902,8 +30716,7 @@ function ServiceAgreementDropinComponent({
|
|
|
30902
30716
|
};
|
|
30903
30717
|
const onDownloadAcceptedTermsOfServiceDocument = async () => {
|
|
30904
30718
|
try {
|
|
30905
|
-
if (!canDownload)
|
|
30906
|
-
return;
|
|
30719
|
+
if (!canDownload) return;
|
|
30907
30720
|
const response = await handleDownloadAcceptedTermsOfServiceDocument(legalEntityResponse.id, activeForm.acceptanceId);
|
|
30908
30721
|
await downloadFile(response.document, `${i18n.get(activeForm.formName)}.pdf`);
|
|
30909
30722
|
} catch (e) {
|
|
@@ -31671,8 +31484,7 @@ const useNavigation = ({
|
|
|
31671
31484
|
}
|
|
31672
31485
|
}, [onNavigate]);
|
|
31673
31486
|
const navigateBack = useCallback((stepCount = 1) => {
|
|
31674
|
-
if (taskHistory.length <= 1)
|
|
31675
|
-
return;
|
|
31487
|
+
if (taskHistory.length <= 1) return;
|
|
31676
31488
|
const prevTask = taskHistory[taskHistory.length - (stepCount + 1)];
|
|
31677
31489
|
if (prevTask === "default") {
|
|
31678
31490
|
throw Error("Cannot navigate back to 'default' task");
|
|
@@ -31713,12 +31525,9 @@ const getDefaultTask = ({
|
|
|
31713
31525
|
shouldShowSingpassSelection
|
|
31714
31526
|
}) => {
|
|
31715
31527
|
const hasLegalEntityProgressedBeyondEntitySelection = hasProgressedBeyondEntitySelection(legalEntity);
|
|
31716
|
-
if (isNewEntryFlowEnabled && !accountHolder2 && !hasLegalEntityProgressedBeyondEntitySelection)
|
|
31717
|
-
|
|
31718
|
-
if (
|
|
31719
|
-
return TaskTypes.INTRODUCTION;
|
|
31720
|
-
if (shouldShowSingpassSelection)
|
|
31721
|
-
return TaskTypes.SINGPASS_SELECTION;
|
|
31528
|
+
if (isNewEntryFlowEnabled && !accountHolder2 && !hasLegalEntityProgressedBeyondEntitySelection) return TaskTypes.BUSINESS_TYPE_SELECTION;
|
|
31529
|
+
if (showIntroduction) return TaskTypes.INTRODUCTION;
|
|
31530
|
+
if (shouldShowSingpassSelection) return TaskTypes.SINGPASS_SELECTION;
|
|
31722
31531
|
return TaskTypes.TASKS_OVERVIEW;
|
|
31723
31532
|
};
|
|
31724
31533
|
const hasProgressedBeyondEntitySelection = (legalEntity) => {
|
|
@@ -31866,8 +31675,7 @@ function DropinComposerComponent({
|
|
|
31866
31675
|
}
|
|
31867
31676
|
}, [additionalSalesChannels, i18n, rootLegalEntity.id, args.handleGetPciTemplate]);
|
|
31868
31677
|
useEffect(() => {
|
|
31869
|
-
if (!tasks.includes(TaskTypes.PCI_DSS))
|
|
31870
|
-
return;
|
|
31678
|
+
if (!tasks.includes(TaskTypes.PCI_DSS)) return;
|
|
31871
31679
|
getPciTemplate().catch(logger$8.error);
|
|
31872
31680
|
}, [getPciTemplate, tasks]);
|
|
31873
31681
|
const addFetchedAcceptedByName = async (acceptanceInfo) => {
|
|
@@ -33357,11 +33165,9 @@ function ViewVerificationStatusComponent({
|
|
|
33357
33165
|
const [onboardingStatus, setOnboardingStatus] = useState();
|
|
33358
33166
|
const [alertContent, setAlertContent] = useState();
|
|
33359
33167
|
const content = useMemo(() => {
|
|
33360
|
-
if (!onboardingStatus)
|
|
33361
|
-
return;
|
|
33168
|
+
if (!onboardingStatus) return;
|
|
33362
33169
|
const statusContent = getContentByStatus(onboardingStatus);
|
|
33363
|
-
if (statusContent)
|
|
33364
|
-
return statusContent;
|
|
33170
|
+
if (statusContent) return statusContent;
|
|
33365
33171
|
logger$5.error(`there is no content for status "${onboardingStatus}"`);
|
|
33366
33172
|
}, [onboardingStatus]);
|
|
33367
33173
|
const handleError = ({
|
|
@@ -33615,8 +33421,7 @@ const buildSpriteDOMFromResponse = (responseData) => {
|
|
|
33615
33421
|
return iconContainer;
|
|
33616
33422
|
};
|
|
33617
33423
|
const loadDocumentGuidance = async (loadingContext) => {
|
|
33618
|
-
if (isDocumentGuidanceLoaded)
|
|
33619
|
-
return;
|
|
33424
|
+
if (isDocumentGuidanceLoaded) return;
|
|
33620
33425
|
isDocumentGuidanceLoaded = true;
|
|
33621
33426
|
const responseData = await http({
|
|
33622
33427
|
loadingContext,
|
|
@@ -33898,7 +33703,7 @@ const ConfigurationApiProvider = ({
|
|
|
33898
33703
|
isEmbeddedDropin,
|
|
33899
33704
|
loadingContext
|
|
33900
33705
|
} = authContext;
|
|
33901
|
-
const sdkVersion = "2.41.
|
|
33706
|
+
const sdkVersion = "2.41.3";
|
|
33902
33707
|
useAnalytics({
|
|
33903
33708
|
onUserEvent,
|
|
33904
33709
|
legalEntityId: rootLegalEntityId,
|
|
@@ -34001,12 +33806,10 @@ const useTranslations = ({
|
|
|
34001
33806
|
getDataset: getDataset2
|
|
34002
33807
|
} = useConfigurationApi();
|
|
34003
33808
|
useEffect(() => {
|
|
34004
|
-
if (!allowedLocales)
|
|
34005
|
-
return;
|
|
33809
|
+
if (!allowedLocales) return;
|
|
34006
33810
|
const isLocaleAllowed = allowedLocales.includes(locale);
|
|
34007
33811
|
const localeToUse = isLocaleAllowed ? locale : FALLBACK_LOCALE;
|
|
34008
|
-
if (loaded.locale === localeToUse)
|
|
34009
|
-
return;
|
|
33812
|
+
if (loaded.locale === localeToUse) return;
|
|
34010
33813
|
if (!isLocaleAllowed) {
|
|
34011
33814
|
logger.error(`
|
|
34012
33815
|
"${locale}" isn't a supported locale. Please use one of the following:
|
|
@@ -34057,6 +33860,13 @@ const I18nProvider = ({
|
|
|
34057
33860
|
children
|
|
34058
33861
|
});
|
|
34059
33862
|
};
|
|
33863
|
+
const QueryClient = new QueryClient$1();
|
|
33864
|
+
const QueryClientProvider = ({
|
|
33865
|
+
children
|
|
33866
|
+
}) => jsx(QueryClientProvider$1, {
|
|
33867
|
+
client: QueryClient,
|
|
33868
|
+
children
|
|
33869
|
+
});
|
|
34060
33870
|
const settingsDefaults = {
|
|
34061
33871
|
acceptedCountries: void 0,
|
|
34062
33872
|
allowBankAccountFormatSelection: false,
|
|
@@ -34094,8 +33904,7 @@ function SettingsProvider({
|
|
|
34094
33904
|
}
|
|
34095
33905
|
function removeObjectPropsWithEmptyValues(obj) {
|
|
34096
33906
|
keysOf(obj).forEach((key) => {
|
|
34097
|
-
if (obj[key] === null || isEmpty(obj[key]))
|
|
34098
|
-
delete obj[key];
|
|
33907
|
+
if (obj[key] === null || isEmpty(obj[key])) delete obj[key];
|
|
34099
33908
|
});
|
|
34100
33909
|
return obj;
|
|
34101
33910
|
}
|
|
@@ -34375,10 +34184,8 @@ class BaseElement {
|
|
|
34375
34184
|
}
|
|
34376
34185
|
}
|
|
34377
34186
|
const getRootLegalEntityId = (componentProps) => {
|
|
34378
|
-
if ("legalEntityId" in componentProps)
|
|
34379
|
-
|
|
34380
|
-
if ("legalEntityResponse" in componentProps)
|
|
34381
|
-
return componentProps.legalEntityResponse.id;
|
|
34187
|
+
if ("legalEntityId" in componentProps) return componentProps.legalEntityId;
|
|
34188
|
+
if ("legalEntityResponse" in componentProps) return componentProps.legalEntityResponse.id;
|
|
34382
34189
|
throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
|
|
34383
34190
|
};
|
|
34384
34191
|
class UIElement extends BaseElement {
|
|
@@ -34411,9 +34218,11 @@ class UIElement extends BaseElement {
|
|
|
34411
34218
|
children: jsx(AutoResizer, {
|
|
34412
34219
|
children: jsx(ToastContextProvider, {
|
|
34413
34220
|
children: jsx(StateProvider, {
|
|
34414
|
-
children: jsx(
|
|
34415
|
-
|
|
34416
|
-
|
|
34221
|
+
children: jsx(QueryClientProvider, {
|
|
34222
|
+
children: jsx(Component, {
|
|
34223
|
+
...this.props.componentProps,
|
|
34224
|
+
eventEmitter: this.eventEmitter
|
|
34225
|
+
})
|
|
34417
34226
|
})
|
|
34418
34227
|
})
|
|
34419
34228
|
})
|
|
@@ -35269,8 +35078,7 @@ class Core {
|
|
|
35269
35078
|
};
|
|
35270
35079
|
validateCoreOptions(newOptions);
|
|
35271
35080
|
newOptions.loadingContext = normalizeEnvironment(newOptions.environment);
|
|
35272
|
-
if (!newOptions.locale)
|
|
35273
|
-
newOptions.locale = FALLBACK_LOCALE;
|
|
35081
|
+
if (!newOptions.locale) newOptions.locale = FALLBACK_LOCALE;
|
|
35274
35082
|
return newOptions;
|
|
35275
35083
|
};
|
|
35276
35084
|
this.initializeSession = () => {
|