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