@vpdev2/metakyc-sdk 1.0.92 → 1.0.93
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/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +323 -318
- package/dist/index.js.map +1 -1
- package/dist/theme/theme-manager.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var Ot = (e, t, a) => t in e ? Mt(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var pe = (e, t, a) => Ot(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
4
|
import $t from "axios";
|
|
5
5
|
import * as xt from "react";
|
|
6
|
-
import
|
|
6
|
+
import Ae, { createContext as Bt, useState as w, useMemo as Le, useEffect as ye, useContext as _t, useRef as ce, useCallback as re, forwardRef as ct, createElement as ht } from "react";
|
|
7
7
|
import { jsx as r, jsxs as s, Fragment as ot } from "react/jsx-runtime";
|
|
8
8
|
import zt, { createPortal as gt } from "react-dom";
|
|
9
9
|
import { useForm as Ht, Controller as Ye } from "react-hook-form";
|
|
@@ -88,7 +88,7 @@ const je = {
|
|
|
88
88
|
{ value: "FI", label: "Finnish" },
|
|
89
89
|
{ value: "NO", label: "Norwegian" }
|
|
90
90
|
];
|
|
91
|
-
var
|
|
91
|
+
var Fe = /* @__PURE__ */ ((e) => (e.Default = "default", e.Corporate = "corporate", e.Fintech = "fintech", e.Healthcare = "healthcare", e.Modern = "modern", e.Minimal = "minimal", e))(Fe || {});
|
|
92
92
|
const tr = {
|
|
93
93
|
timeout: 3e4,
|
|
94
94
|
retries: 3,
|
|
@@ -663,7 +663,7 @@ class mr {
|
|
|
663
663
|
)).result;
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
-
const
|
|
666
|
+
const Ie = {
|
|
667
667
|
name: "Default",
|
|
668
668
|
title: "KYC Verification",
|
|
669
669
|
logo: {
|
|
@@ -897,15 +897,15 @@ const Ae = {
|
|
|
897
897
|
inputHeight: "2.25rem"
|
|
898
898
|
}
|
|
899
899
|
}, br = {
|
|
900
|
-
[
|
|
901
|
-
[
|
|
902
|
-
[
|
|
903
|
-
[
|
|
904
|
-
[
|
|
905
|
-
[
|
|
900
|
+
[Fe.Default]: Ie,
|
|
901
|
+
[Fe.Corporate]: pr,
|
|
902
|
+
[Fe.Fintech]: yr,
|
|
903
|
+
[Fe.Healthcare]: hr,
|
|
904
|
+
[Fe.Modern]: gr,
|
|
905
|
+
[Fe.Minimal]: fr
|
|
906
906
|
};
|
|
907
907
|
function it(e) {
|
|
908
|
-
return br[e] ||
|
|
908
|
+
return br[e] || Ie;
|
|
909
909
|
}
|
|
910
910
|
class xr {
|
|
911
911
|
constructor(t) {
|
|
@@ -922,8 +922,8 @@ class xr {
|
|
|
922
922
|
"GetThemeConfiguration"
|
|
923
923
|
);
|
|
924
924
|
if (!a.result.isEnabled)
|
|
925
|
-
return it(
|
|
926
|
-
let n = a.result.preset ? it(a.result.preset) : it(
|
|
925
|
+
return it(Fe.Default);
|
|
926
|
+
let n = a.result.preset ? it(a.result.preset) : it(Fe.Default);
|
|
927
927
|
if (a.result.title && (n.title = a.result.title), a.result.logo && (n.logo = { ...n.logo, ...a.result.logo }), a.result.colors && (n.colors = { ...n.colors, ...a.result.colors }), a.result.typography && (n.typography = { ...n.typography, ...a.result.typography }), a.result.spacing && (n.spacing = { ...n.spacing, ...a.result.spacing }), a.result.customCSS && (n.customCSS = a.result.customCSS), a.result.darkMode && (n.darkMode = {
|
|
928
928
|
colors: {
|
|
929
929
|
...(t = n.darkMode) == null ? void 0 : t.colors,
|
|
@@ -973,7 +973,7 @@ class xr {
|
|
|
973
973
|
}
|
|
974
974
|
return n;
|
|
975
975
|
} catch (a) {
|
|
976
|
-
return console.warn("[ThemeService] Failed to fetch theme configuration:", a), it(
|
|
976
|
+
return console.warn("[ThemeService] Failed to fetch theme configuration:", a), it(Fe.Default);
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
979
|
/**
|
|
@@ -987,12 +987,12 @@ class xr {
|
|
|
987
987
|
*/
|
|
988
988
|
getAvailablePresets() {
|
|
989
989
|
return [
|
|
990
|
-
{ id:
|
|
991
|
-
{ id:
|
|
992
|
-
{ id:
|
|
993
|
-
{ id:
|
|
994
|
-
{ id:
|
|
995
|
-
{ id:
|
|
990
|
+
{ id: Fe.Default, name: "Default" },
|
|
991
|
+
{ id: Fe.Corporate, name: "Corporate" },
|
|
992
|
+
{ id: Fe.Fintech, name: "Fintech" },
|
|
993
|
+
{ id: Fe.Healthcare, name: "Healthcare" },
|
|
994
|
+
{ id: Fe.Modern, name: "Modern" },
|
|
995
|
+
{ id: Fe.Minimal, name: "Minimal" }
|
|
996
996
|
];
|
|
997
997
|
}
|
|
998
998
|
/**
|
|
@@ -1380,7 +1380,7 @@ class Nr {
|
|
|
1380
1380
|
return this.stepRouter;
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function Et(e, t) {
|
|
1384
1384
|
return new Promise((a, n) => {
|
|
1385
1385
|
if (t && document.getElementById(t)) {
|
|
1386
1386
|
a();
|
|
@@ -1390,10 +1390,10 @@ function It(e, t) {
|
|
|
1390
1390
|
i.src = e, t && (i.id = t), i.async = !0, i.onload = () => a(), i.onerror = () => n(new Error(`Failed to load script: ${e}`)), document.head.appendChild(i);
|
|
1391
1391
|
});
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1393
|
+
function Fa(e) {
|
|
1394
1394
|
return !!document.getElementById(e);
|
|
1395
1395
|
}
|
|
1396
|
-
function
|
|
1396
|
+
function Ea(e) {
|
|
1397
1397
|
const t = document.getElementById(e);
|
|
1398
1398
|
t && t.remove();
|
|
1399
1399
|
}
|
|
@@ -1407,7 +1407,7 @@ class Sr {
|
|
|
1407
1407
|
* Load Sumsub SDK
|
|
1408
1408
|
*/
|
|
1409
1409
|
async loadSDK() {
|
|
1410
|
-
await
|
|
1410
|
+
await Et(
|
|
1411
1411
|
"https://cdn.sumsub.com/websdk/v2/production/websdk.js",
|
|
1412
1412
|
"sumsub-sdk"
|
|
1413
1413
|
);
|
|
@@ -1462,7 +1462,7 @@ class Cr {
|
|
|
1462
1462
|
* Load Onfido SDK
|
|
1463
1463
|
*/
|
|
1464
1464
|
async loadSDK() {
|
|
1465
|
-
await
|
|
1465
|
+
await Et(
|
|
1466
1466
|
"https://sdk.onfido.com/v12.0.0/onfido.min.js",
|
|
1467
1467
|
"onfido-sdk"
|
|
1468
1468
|
);
|
|
@@ -1518,7 +1518,7 @@ class Cr {
|
|
|
1518
1518
|
this.sdk && (this.sdk.tearDown(), this.sdk = null);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
|
-
class
|
|
1521
|
+
class Fr {
|
|
1522
1522
|
constructor(t) {
|
|
1523
1523
|
pe(this, "sardineContext", null);
|
|
1524
1524
|
pe(this, "config");
|
|
@@ -1673,7 +1673,7 @@ class tt {
|
|
|
1673
1673
|
case Pe.Onfido:
|
|
1674
1674
|
return new Cr(a);
|
|
1675
1675
|
case Pe.SardinAI:
|
|
1676
|
-
return new
|
|
1676
|
+
return new Fr(a);
|
|
1677
1677
|
default:
|
|
1678
1678
|
throw new Error(`Unsupported identity provider: ${t}`);
|
|
1679
1679
|
}
|
|
@@ -1712,7 +1712,7 @@ class tt {
|
|
|
1712
1712
|
}
|
|
1713
1713
|
}
|
|
1714
1714
|
}
|
|
1715
|
-
function
|
|
1715
|
+
function Er() {
|
|
1716
1716
|
return `
|
|
1717
1717
|
/* ── metakyc-input-colors (ThemeManager failsafe — same rules as globals.css) ── */
|
|
1718
1718
|
.metakyc-sdk input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
|
|
@@ -1746,9 +1746,9 @@ function Ir() {
|
|
|
1746
1746
|
}
|
|
1747
1747
|
`;
|
|
1748
1748
|
}
|
|
1749
|
-
class
|
|
1749
|
+
class Ir {
|
|
1750
1750
|
constructor(t) {
|
|
1751
|
-
pe(this, "currentTheme",
|
|
1751
|
+
pe(this, "currentTheme", Ie);
|
|
1752
1752
|
pe(this, "customStyleElement", null);
|
|
1753
1753
|
pe(this, "inputStyleElement", null);
|
|
1754
1754
|
pe(this, "container");
|
|
@@ -1829,7 +1829,7 @@ class Ar {
|
|
|
1829
1829
|
* These rules are placed BEFORE any custom CSS so that custom CSS can still override them.
|
|
1830
1830
|
*/
|
|
1831
1831
|
injectInputColors() {
|
|
1832
|
-
this.inputStyleElement && this.inputStyleElement.remove(), this.inputStyleElement = document.createElement("style"), this.inputStyleElement.id = "metakyc-input-colors", this.inputStyleElement.textContent =
|
|
1832
|
+
this.inputStyleElement && this.inputStyleElement.remove(), this.inputStyleElement = document.createElement("style"), this.inputStyleElement.id = "metakyc-input-colors", this.inputStyleElement.textContent = Er(), this.customStyleElement && this.customStyleElement.parentNode ? document.head.insertBefore(this.inputStyleElement, this.customStyleElement) : document.head.appendChild(this.inputStyleElement);
|
|
1833
1833
|
}
|
|
1834
1834
|
/**
|
|
1835
1835
|
* Inject custom CSS into document
|
|
@@ -1843,25 +1843,30 @@ class Ar {
|
|
|
1843
1843
|
mergeWithDefault(t) {
|
|
1844
1844
|
var a;
|
|
1845
1845
|
return {
|
|
1846
|
-
name: t.name ||
|
|
1847
|
-
title: t.title ||
|
|
1848
|
-
logo: { ...
|
|
1849
|
-
colors: { ...
|
|
1850
|
-
typography: t.typography ? { ...
|
|
1851
|
-
spacing: t.spacing ? { ...
|
|
1846
|
+
name: t.name || Ie.name,
|
|
1847
|
+
title: t.title || Ie.title,
|
|
1848
|
+
logo: { ...Ie.logo, ...t.logo },
|
|
1849
|
+
colors: { ...Ie.colors, ...t.colors },
|
|
1850
|
+
typography: t.typography ? { ...Ie.typography, ...t.typography } : Ie.typography,
|
|
1851
|
+
spacing: t.spacing ? { ...Ie.spacing, ...t.spacing } : Ie.spacing,
|
|
1852
1852
|
customCSS: t.customCSS,
|
|
1853
1853
|
darkMode: t.darkMode ? {
|
|
1854
1854
|
colors: {
|
|
1855
|
-
...(a =
|
|
1855
|
+
...(a = Ie.darkMode) == null ? void 0 : a.colors,
|
|
1856
1856
|
...t.darkMode.colors
|
|
1857
1857
|
}
|
|
1858
|
-
} :
|
|
1858
|
+
} : Ie.darkMode,
|
|
1859
1859
|
applicantFormVisibleFields: t.applicantFormVisibleFields,
|
|
1860
1860
|
applicantFormRequiredFields: t.applicantFormRequiredFields,
|
|
1861
1861
|
allowedLanguages: t.allowedLanguages,
|
|
1862
1862
|
applicantFormPages: t.applicantFormPages,
|
|
1863
1863
|
reviewPageFields: t.reviewPageFields,
|
|
1864
|
-
reviewPageDisabled: t.reviewPageDisabled
|
|
1864
|
+
reviewPageDisabled: t.reviewPageDisabled,
|
|
1865
|
+
fieldLabelMode: t.fieldLabelMode,
|
|
1866
|
+
companyFormVisibleFields: t.companyFormVisibleFields,
|
|
1867
|
+
companyFormRequiredFields: t.companyFormRequiredFields,
|
|
1868
|
+
companyFormPages: t.companyFormPages,
|
|
1869
|
+
companyReviewPageFields: t.companyReviewPageFields
|
|
1865
1870
|
};
|
|
1866
1871
|
}
|
|
1867
1872
|
/**
|
|
@@ -1874,7 +1879,7 @@ class Ar {
|
|
|
1874
1879
|
* Reset to default theme
|
|
1875
1880
|
*/
|
|
1876
1881
|
resetTheme() {
|
|
1877
|
-
this.applyTheme(
|
|
1882
|
+
this.applyTheme(Ie);
|
|
1878
1883
|
}
|
|
1879
1884
|
/**
|
|
1880
1885
|
* Remove all custom styles
|
|
@@ -1889,16 +1894,16 @@ class Ar {
|
|
|
1889
1894
|
return t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1890
1895
|
}
|
|
1891
1896
|
}
|
|
1892
|
-
const
|
|
1893
|
-
const [a, n] = w(null), i =
|
|
1894
|
-
const g = new ar(e), p = new nr(g), S = new ir(g),
|
|
1897
|
+
const It = Bt(null), Ia = ({ config: e, children: t }) => {
|
|
1898
|
+
const [a, n] = w(null), i = Ae.useRef(!1), l = Ae.useRef(!1), d = Le(() => {
|
|
1899
|
+
const g = new ar(e), p = new nr(g), S = new ir(g), I = new sr(g), F = new or(g), A = new lr(g), f = new cr(g), N = new dr(g), M = new ur(g), T = new mr(g), U = new xr(g), L = new Ir();
|
|
1895
1900
|
return {
|
|
1896
1901
|
httpClient: g,
|
|
1897
1902
|
applicantService: p,
|
|
1898
1903
|
questionnaireService: S,
|
|
1899
|
-
uploadDocumentService:
|
|
1900
|
-
appropriatenessTestService:
|
|
1901
|
-
overviewService:
|
|
1904
|
+
uploadDocumentService: I,
|
|
1905
|
+
appropriatenessTestService: F,
|
|
1906
|
+
overviewService: A,
|
|
1902
1907
|
riskScoringService: f,
|
|
1903
1908
|
identityService: N,
|
|
1904
1909
|
baseInformationService: M,
|
|
@@ -1942,15 +1947,15 @@ const At = Bt(null), Aa = ({ config: e, children: t }) => {
|
|
|
1942
1947
|
}
|
|
1943
1948
|
})(), () => {
|
|
1944
1949
|
d.themeManager.cleanup();
|
|
1945
|
-
}), []), /* @__PURE__ */ r(
|
|
1950
|
+
}), []), /* @__PURE__ */ r(It.Provider, { value: m, children: t });
|
|
1946
1951
|
};
|
|
1947
|
-
function
|
|
1948
|
-
const e = _t(
|
|
1952
|
+
function Ee() {
|
|
1953
|
+
const e = _t(It);
|
|
1949
1954
|
if (!e)
|
|
1950
1955
|
throw new Error("useMetaKYC must be used within a MetaKYCProvider");
|
|
1951
1956
|
return e;
|
|
1952
1957
|
}
|
|
1953
|
-
async function
|
|
1958
|
+
async function Ar(e) {
|
|
1954
1959
|
return new Promise((t, a) => {
|
|
1955
1960
|
const n = new FileReader();
|
|
1956
1961
|
n.readAsDataURL(e), n.onload = () => {
|
|
@@ -1959,7 +1964,7 @@ async function Fr(e) {
|
|
|
1959
1964
|
}, n.onerror = (i) => a(i);
|
|
1960
1965
|
});
|
|
1961
1966
|
}
|
|
1962
|
-
function
|
|
1967
|
+
function Aa(e, t) {
|
|
1963
1968
|
return e.size <= t;
|
|
1964
1969
|
}
|
|
1965
1970
|
function Ra(e, t) {
|
|
@@ -2034,7 +2039,7 @@ function La() {
|
|
|
2034
2039
|
Tr(), Dr();
|
|
2035
2040
|
}
|
|
2036
2041
|
function Mr(e) {
|
|
2037
|
-
const { createOrchestrator: t } =
|
|
2042
|
+
const { createOrchestrator: t } = Ee(), [a, n] = w(null), [i, l] = w(!1), [d, m] = w(null), g = ce(null), p = e || Pr();
|
|
2038
2043
|
ye(() => {
|
|
2039
2044
|
g.current || (g.current = t());
|
|
2040
2045
|
}, [t]), ye(() => {
|
|
@@ -2048,7 +2053,7 @@ function Mr(e) {
|
|
|
2048
2053
|
nextWorkflowKey: a.nextWorkflowKey
|
|
2049
2054
|
}));
|
|
2050
2055
|
}, [a, p]);
|
|
2051
|
-
const S = ce(!1),
|
|
2056
|
+
const S = ce(!1), I = ce(!1), F = re(async () => {
|
|
2052
2057
|
if (!(!p || !g.current)) {
|
|
2053
2058
|
if (S.current) {
|
|
2054
2059
|
console.log("[Workflow] Load already in progress, skipping...");
|
|
@@ -2057,7 +2062,7 @@ function Mr(e) {
|
|
|
2057
2062
|
S.current = !0, l(!0), m(null);
|
|
2058
2063
|
try {
|
|
2059
2064
|
const L = await g.current.initialize(p);
|
|
2060
|
-
n(L),
|
|
2065
|
+
n(L), I.current = !0;
|
|
2061
2066
|
} catch (L) {
|
|
2062
2067
|
m(L);
|
|
2063
2068
|
} finally {
|
|
@@ -2066,9 +2071,9 @@ function Mr(e) {
|
|
|
2066
2071
|
}
|
|
2067
2072
|
}, [p]);
|
|
2068
2073
|
ye(() => {
|
|
2069
|
-
p && !
|
|
2070
|
-
}, [p,
|
|
2071
|
-
const
|
|
2074
|
+
p && !I.current && F();
|
|
2075
|
+
}, [p, F]);
|
|
2076
|
+
const A = re(async () => {
|
|
2072
2077
|
if (g.current) {
|
|
2073
2078
|
if (S.current) {
|
|
2074
2079
|
console.log("[Workflow] Refresh already in progress, skipping...");
|
|
@@ -2136,7 +2141,7 @@ function Mr(e) {
|
|
|
2136
2141
|
error: d,
|
|
2137
2142
|
isComplete: (a == null ? void 0 : a.status) === Te.Finished,
|
|
2138
2143
|
isOnHold: (a == null ? void 0 : a.status) === Te.OnHold,
|
|
2139
|
-
refreshProgress:
|
|
2144
|
+
refreshProgress: A,
|
|
2140
2145
|
moveToNext: f,
|
|
2141
2146
|
moveBack: N,
|
|
2142
2147
|
submitCurrentStep: M,
|
|
@@ -2144,14 +2149,14 @@ function Mr(e) {
|
|
|
2144
2149
|
};
|
|
2145
2150
|
}
|
|
2146
2151
|
function Or(e) {
|
|
2147
|
-
const { questionnaireService: t, applicantService: a } =
|
|
2152
|
+
const { questionnaireService: t, applicantService: a } = Ee(), [n, i] = w(null), [l, d] = w({}), [m, g] = w(!1), [p, S] = w(!1), [I, F] = w(null), A = ce(!1), f = ce(null), N = re(async () => {
|
|
2148
2153
|
var T, U;
|
|
2149
2154
|
if (e) {
|
|
2150
|
-
if (
|
|
2155
|
+
if (A.current) {
|
|
2151
2156
|
console.log("[Questionnaire] Load already in progress, skipping...");
|
|
2152
2157
|
return;
|
|
2153
2158
|
}
|
|
2154
|
-
|
|
2159
|
+
A.current = !0, g(!0), F(null);
|
|
2155
2160
|
try {
|
|
2156
2161
|
const [L, $] = await Promise.all([
|
|
2157
2162
|
t.getQuestionnaire(e),
|
|
@@ -2170,9 +2175,9 @@ function Or(e) {
|
|
|
2170
2175
|
}
|
|
2171
2176
|
f.current = e;
|
|
2172
2177
|
} catch (L) {
|
|
2173
|
-
|
|
2178
|
+
F(L);
|
|
2174
2179
|
} finally {
|
|
2175
|
-
g(!1),
|
|
2180
|
+
g(!1), A.current = !1;
|
|
2176
2181
|
}
|
|
2177
2182
|
}
|
|
2178
2183
|
}, [e, t, a]);
|
|
@@ -2181,11 +2186,11 @@ function Or(e) {
|
|
|
2181
2186
|
}, [e]);
|
|
2182
2187
|
const M = re(
|
|
2183
2188
|
async (T) => {
|
|
2184
|
-
S(!0),
|
|
2189
|
+
S(!0), F(null);
|
|
2185
2190
|
try {
|
|
2186
2191
|
return await t.fillQuestionnaire(T);
|
|
2187
2192
|
} catch (U) {
|
|
2188
|
-
throw
|
|
2193
|
+
throw F(U), U;
|
|
2189
2194
|
} finally {
|
|
2190
2195
|
S(!1);
|
|
2191
2196
|
}
|
|
@@ -2197,39 +2202,39 @@ function Or(e) {
|
|
|
2197
2202
|
initialAnswers: l,
|
|
2198
2203
|
isLoading: m,
|
|
2199
2204
|
isSubmitting: p,
|
|
2200
|
-
error:
|
|
2205
|
+
error: I,
|
|
2201
2206
|
load: N,
|
|
2202
2207
|
submit: M
|
|
2203
2208
|
};
|
|
2204
2209
|
}
|
|
2205
2210
|
function $r(e) {
|
|
2206
|
-
const { uploadDocumentService: t } =
|
|
2211
|
+
const { uploadDocumentService: t } = Ee(), [a, n] = w(null), [i, l] = w(!1), [d, m] = w(!1), [g, p] = w(0), [S, I] = w(null), F = ce(!1), A = ce(null), f = re(async () => {
|
|
2207
2212
|
if (e) {
|
|
2208
|
-
if (
|
|
2213
|
+
if (F.current) {
|
|
2209
2214
|
console.log("[UploadDocument] Load already in progress, skipping...");
|
|
2210
2215
|
return;
|
|
2211
2216
|
}
|
|
2212
|
-
|
|
2217
|
+
F.current = !0, l(!0), I(null);
|
|
2213
2218
|
try {
|
|
2214
2219
|
const M = await t.getUploadDocument(e);
|
|
2215
|
-
n(M),
|
|
2220
|
+
n(M), A.current = e;
|
|
2216
2221
|
} catch (M) {
|
|
2217
|
-
|
|
2222
|
+
I(M);
|
|
2218
2223
|
} finally {
|
|
2219
|
-
l(!1),
|
|
2224
|
+
l(!1), F.current = !1;
|
|
2220
2225
|
}
|
|
2221
2226
|
}
|
|
2222
2227
|
}, [e, t]);
|
|
2223
2228
|
ye(() => {
|
|
2224
|
-
e &&
|
|
2229
|
+
e && A.current !== e && f();
|
|
2225
2230
|
}, [e]);
|
|
2226
2231
|
const N = re(
|
|
2227
2232
|
async (M) => {
|
|
2228
|
-
m(!0), p(0),
|
|
2233
|
+
m(!0), p(0), I(null);
|
|
2229
2234
|
try {
|
|
2230
2235
|
await t.fillUploadDocument(M), p(100);
|
|
2231
2236
|
} catch (T) {
|
|
2232
|
-
throw
|
|
2237
|
+
throw I(T), T;
|
|
2233
2238
|
} finally {
|
|
2234
2239
|
m(!1);
|
|
2235
2240
|
}
|
|
@@ -2247,32 +2252,32 @@ function $r(e) {
|
|
|
2247
2252
|
};
|
|
2248
2253
|
}
|
|
2249
2254
|
function Da(e) {
|
|
2250
|
-
const { appropriatenessTestService: t } =
|
|
2255
|
+
const { appropriatenessTestService: t } = Ee(), [a, n] = w(null), [i, l] = w(!1), [d, m] = w(!1), [g, p] = w(null), [S, I] = w(null), F = ce(!1), A = ce(null), f = re(async () => {
|
|
2251
2256
|
if (e) {
|
|
2252
|
-
if (
|
|
2257
|
+
if (F.current) {
|
|
2253
2258
|
console.log("[AppropriatenessTest] Load already in progress, skipping...");
|
|
2254
2259
|
return;
|
|
2255
2260
|
}
|
|
2256
|
-
|
|
2261
|
+
F.current = !0, l(!0), p(null);
|
|
2257
2262
|
try {
|
|
2258
2263
|
const M = await t.getAppropriatenessTest(e);
|
|
2259
|
-
n(M),
|
|
2264
|
+
n(M), A.current = e;
|
|
2260
2265
|
} catch (M) {
|
|
2261
2266
|
p(M);
|
|
2262
2267
|
} finally {
|
|
2263
|
-
l(!1),
|
|
2268
|
+
l(!1), F.current = !1;
|
|
2264
2269
|
}
|
|
2265
2270
|
}
|
|
2266
2271
|
}, [e, t]);
|
|
2267
2272
|
ye(() => {
|
|
2268
|
-
e &&
|
|
2273
|
+
e && A.current !== e && f();
|
|
2269
2274
|
}, [e]);
|
|
2270
2275
|
const N = re(
|
|
2271
2276
|
async (M) => {
|
|
2272
2277
|
m(!0), p(null);
|
|
2273
2278
|
try {
|
|
2274
2279
|
const T = await t.fillAppropriatenessTest(M);
|
|
2275
|
-
return
|
|
2280
|
+
return I(T), T;
|
|
2276
2281
|
} catch (T) {
|
|
2277
2282
|
throw p(T), T;
|
|
2278
2283
|
} finally {
|
|
@@ -2292,7 +2297,7 @@ function Da(e) {
|
|
|
2292
2297
|
};
|
|
2293
2298
|
}
|
|
2294
2299
|
function Br(e) {
|
|
2295
|
-
const { overviewService: t } =
|
|
2300
|
+
const { overviewService: t } = Ee(), [a, n] = w(null), [i, l] = w(!1), [d, m] = w(!1), [g, p] = w(null), S = ce(!1), I = ce(null), F = re(async () => {
|
|
2296
2301
|
if (e) {
|
|
2297
2302
|
if (S.current) {
|
|
2298
2303
|
console.log("[Overview] Load already in progress, skipping...");
|
|
@@ -2301,7 +2306,7 @@ function Br(e) {
|
|
|
2301
2306
|
S.current = !0, l(!0), p(null);
|
|
2302
2307
|
try {
|
|
2303
2308
|
const f = await t.getOverviewData(e);
|
|
2304
|
-
n(f),
|
|
2309
|
+
n(f), I.current = e;
|
|
2305
2310
|
} catch (f) {
|
|
2306
2311
|
p(f);
|
|
2307
2312
|
} finally {
|
|
@@ -2310,9 +2315,9 @@ function Br(e) {
|
|
|
2310
2315
|
}
|
|
2311
2316
|
}, [e, t]);
|
|
2312
2317
|
ye(() => {
|
|
2313
|
-
e &&
|
|
2318
|
+
e && I.current !== e && F();
|
|
2314
2319
|
}, [e]);
|
|
2315
|
-
const
|
|
2320
|
+
const A = re(async () => {
|
|
2316
2321
|
if (e) {
|
|
2317
2322
|
m(!0), p(null);
|
|
2318
2323
|
try {
|
|
@@ -2329,15 +2334,15 @@ function Br(e) {
|
|
|
2329
2334
|
isLoading: i,
|
|
2330
2335
|
isSubmitting: d,
|
|
2331
2336
|
error: g,
|
|
2332
|
-
load:
|
|
2333
|
-
passOverview:
|
|
2337
|
+
load: F,
|
|
2338
|
+
passOverview: A
|
|
2334
2339
|
};
|
|
2335
2340
|
}
|
|
2336
2341
|
function _r(e) {
|
|
2337
|
-
const { identityService: t } =
|
|
2342
|
+
const { identityService: t } = Ee(), [a, n] = w(
|
|
2338
2343
|
null
|
|
2339
2344
|
), [i, l] = w(!1), [d, m] = w(null), g = ce(!1), p = re(
|
|
2340
|
-
async (
|
|
2345
|
+
async (F, A) => {
|
|
2341
2346
|
if (e) {
|
|
2342
2347
|
if (g.current) {
|
|
2343
2348
|
console.log("[Identity] Request already in progress, skipping...");
|
|
@@ -2348,8 +2353,8 @@ function _r(e) {
|
|
|
2348
2353
|
const f = {
|
|
2349
2354
|
applicantId: e,
|
|
2350
2355
|
restart: !1,
|
|
2351
|
-
redirectUrl:
|
|
2352
|
-
ttl:
|
|
2356
|
+
redirectUrl: F || "",
|
|
2357
|
+
ttl: A || 604800
|
|
2353
2358
|
// Default: 7 days
|
|
2354
2359
|
};
|
|
2355
2360
|
console.log("Identity request input:", f);
|
|
@@ -2364,15 +2369,15 @@ function _r(e) {
|
|
|
2364
2369
|
},
|
|
2365
2370
|
[e, t]
|
|
2366
2371
|
), S = re(
|
|
2367
|
-
async (
|
|
2372
|
+
async (F, A) => {
|
|
2368
2373
|
if (e) {
|
|
2369
2374
|
l(!0), m(null);
|
|
2370
2375
|
try {
|
|
2371
2376
|
const f = {
|
|
2372
2377
|
applicantId: e,
|
|
2373
2378
|
restart: !1,
|
|
2374
|
-
redirectUrl:
|
|
2375
|
-
ttl:
|
|
2379
|
+
redirectUrl: F,
|
|
2380
|
+
ttl: A
|
|
2376
2381
|
}, N = await t.identityCompanyRequest(f);
|
|
2377
2382
|
return n(N), N;
|
|
2378
2383
|
} catch (f) {
|
|
@@ -2383,7 +2388,7 @@ function _r(e) {
|
|
|
2383
2388
|
}
|
|
2384
2389
|
},
|
|
2385
2390
|
[e, t]
|
|
2386
|
-
),
|
|
2391
|
+
), I = re(async () => {
|
|
2387
2392
|
if (e) {
|
|
2388
2393
|
if (g.current) {
|
|
2389
2394
|
console.log("[Identity] Restart already in progress, skipping...");
|
|
@@ -2391,18 +2396,18 @@ function _r(e) {
|
|
|
2391
2396
|
}
|
|
2392
2397
|
g.current = !0, l(!0), m(null);
|
|
2393
2398
|
try {
|
|
2394
|
-
const
|
|
2399
|
+
const F = {
|
|
2395
2400
|
applicantId: e,
|
|
2396
2401
|
restart: !0,
|
|
2397
2402
|
redirectUrl: "",
|
|
2398
2403
|
ttl: 604800
|
|
2399
2404
|
// 7 days
|
|
2400
2405
|
};
|
|
2401
|
-
console.log("Restarting identity with input:",
|
|
2402
|
-
const
|
|
2403
|
-
return console.log("Restart identity result:",
|
|
2404
|
-
} catch (
|
|
2405
|
-
throw m(
|
|
2406
|
+
console.log("Restarting identity with input:", F);
|
|
2407
|
+
const A = await t.identityRequest(F);
|
|
2408
|
+
return console.log("Restart identity result:", A), n(A), A;
|
|
2409
|
+
} catch (F) {
|
|
2410
|
+
throw m(F), F;
|
|
2406
2411
|
} finally {
|
|
2407
2412
|
l(!1), g.current = !1;
|
|
2408
2413
|
}
|
|
@@ -2416,18 +2421,18 @@ function _r(e) {
|
|
|
2416
2421
|
error: d,
|
|
2417
2422
|
requestIdentity: p,
|
|
2418
2423
|
requestCompanyIdentity: S,
|
|
2419
|
-
restartIdentity:
|
|
2424
|
+
restartIdentity: I
|
|
2420
2425
|
};
|
|
2421
2426
|
}
|
|
2422
2427
|
function zr(e) {
|
|
2423
|
-
const { riskScoringService: t, applicantService: a } =
|
|
2428
|
+
const { riskScoringService: t, applicantService: a } = Ee(), [n, i] = w(null), [l, d] = w({}), [m, g] = w(!1), [p, S] = w(!1), [I, F] = w(null), [A, f] = w(null), N = ce(!1), M = ce(null), T = re(async () => {
|
|
2424
2429
|
var L;
|
|
2425
2430
|
if (e) {
|
|
2426
2431
|
if (N.current) {
|
|
2427
2432
|
console.log("[RiskScoring] Load already in progress, skipping...");
|
|
2428
2433
|
return;
|
|
2429
2434
|
}
|
|
2430
|
-
N.current = !0, g(!0),
|
|
2435
|
+
N.current = !0, g(!0), F(null);
|
|
2431
2436
|
try {
|
|
2432
2437
|
const [$, X] = await Promise.all([
|
|
2433
2438
|
t.getRiskCriterias(e),
|
|
@@ -2446,7 +2451,7 @@ function zr(e) {
|
|
|
2446
2451
|
}
|
|
2447
2452
|
M.current = e;
|
|
2448
2453
|
} catch ($) {
|
|
2449
|
-
|
|
2454
|
+
F($);
|
|
2450
2455
|
} finally {
|
|
2451
2456
|
g(!1), N.current = !1;
|
|
2452
2457
|
}
|
|
@@ -2457,12 +2462,12 @@ function zr(e) {
|
|
|
2457
2462
|
}, [e]);
|
|
2458
2463
|
const U = re(
|
|
2459
2464
|
async (L) => {
|
|
2460
|
-
S(!0),
|
|
2465
|
+
S(!0), F(null);
|
|
2461
2466
|
try {
|
|
2462
2467
|
const $ = await t.submitRiskScoring(L);
|
|
2463
2468
|
return f($), $;
|
|
2464
2469
|
} catch ($) {
|
|
2465
|
-
throw
|
|
2470
|
+
throw F($), $;
|
|
2466
2471
|
} finally {
|
|
2467
2472
|
S(!1);
|
|
2468
2473
|
}
|
|
@@ -2472,33 +2477,33 @@ function zr(e) {
|
|
|
2472
2477
|
return {
|
|
2473
2478
|
criteria: n,
|
|
2474
2479
|
initialAnswers: l,
|
|
2475
|
-
result:
|
|
2480
|
+
result: A,
|
|
2476
2481
|
isLoading: m,
|
|
2477
2482
|
isSubmitting: p,
|
|
2478
|
-
error:
|
|
2483
|
+
error: I,
|
|
2479
2484
|
load: T,
|
|
2480
2485
|
submit: U
|
|
2481
2486
|
};
|
|
2482
2487
|
}
|
|
2483
|
-
function
|
|
2484
|
-
const { applicantService: e, config: t } =
|
|
2488
|
+
function At() {
|
|
2489
|
+
const { applicantService: e, config: t } = Ee(), [a, n] = w(!1), [i, l] = w(null), d = ce(!1), m = ce(!1), g = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(A) {
|
|
2485
2490
|
const f = Math.random() * 16 | 0;
|
|
2486
|
-
return (
|
|
2491
|
+
return (A === "x" ? f : f & 3 | 8).toString(16);
|
|
2487
2492
|
}), p = re(
|
|
2488
|
-
async (
|
|
2493
|
+
async (A) => {
|
|
2489
2494
|
var f;
|
|
2490
2495
|
if (d.current)
|
|
2491
2496
|
throw console.log("[Applicant] Create already in progress, skipping..."), new Error("Creation already in progress");
|
|
2492
2497
|
d.current = !0, n(!0), l(null);
|
|
2493
2498
|
try {
|
|
2494
|
-
if (
|
|
2499
|
+
if (A.applicantAdditionalDatas || (A.applicantAdditionalDatas = []), (f = t.identityProviders) != null && f.sardinai) {
|
|
2495
2500
|
const M = g();
|
|
2496
|
-
console.log("[SardinAI] Generated session key:", M),
|
|
2501
|
+
console.log("[SardinAI] Generated session key:", M), A.applicantAdditionalDatas.push({
|
|
2497
2502
|
paramName: "sessionKey",
|
|
2498
2503
|
value: M
|
|
2499
2504
|
});
|
|
2500
2505
|
}
|
|
2501
|
-
return await e.createApplicant(
|
|
2506
|
+
return await e.createApplicant(A);
|
|
2502
2507
|
} catch (N) {
|
|
2503
2508
|
throw l(N), N;
|
|
2504
2509
|
} finally {
|
|
@@ -2507,10 +2512,10 @@ function Ft() {
|
|
|
2507
2512
|
},
|
|
2508
2513
|
[e, t]
|
|
2509
2514
|
), S = re(
|
|
2510
|
-
async (
|
|
2515
|
+
async (A) => {
|
|
2511
2516
|
n(!0), l(null);
|
|
2512
2517
|
try {
|
|
2513
|
-
return await e.createCompanyApplicant(
|
|
2518
|
+
return await e.createCompanyApplicant(A);
|
|
2514
2519
|
} catch (f) {
|
|
2515
2520
|
throw l(f), f;
|
|
2516
2521
|
} finally {
|
|
@@ -2518,13 +2523,13 @@ function Ft() {
|
|
|
2518
2523
|
}
|
|
2519
2524
|
},
|
|
2520
2525
|
[e]
|
|
2521
|
-
),
|
|
2522
|
-
async (
|
|
2526
|
+
), I = re(
|
|
2527
|
+
async (A) => {
|
|
2523
2528
|
if (m.current)
|
|
2524
2529
|
throw console.log("[Applicant] Data load already in progress, skipping..."), new Error("Data load already in progress");
|
|
2525
2530
|
m.current = !0, n(!0), l(null);
|
|
2526
2531
|
try {
|
|
2527
|
-
return await e.getApplicantData(
|
|
2532
|
+
return await e.getApplicantData(A);
|
|
2528
2533
|
} catch (f) {
|
|
2529
2534
|
throw l(f), f;
|
|
2530
2535
|
} finally {
|
|
@@ -2532,11 +2537,11 @@ function Ft() {
|
|
|
2532
2537
|
}
|
|
2533
2538
|
},
|
|
2534
2539
|
[e]
|
|
2535
|
-
),
|
|
2536
|
-
async (
|
|
2540
|
+
), F = re(
|
|
2541
|
+
async (A) => {
|
|
2537
2542
|
n(!0), l(null);
|
|
2538
2543
|
try {
|
|
2539
|
-
await e.stopProgress(
|
|
2544
|
+
await e.stopProgress(A);
|
|
2540
2545
|
} catch (f) {
|
|
2541
2546
|
throw l(f), f;
|
|
2542
2547
|
} finally {
|
|
@@ -2550,8 +2555,8 @@ function Ft() {
|
|
|
2550
2555
|
error: i,
|
|
2551
2556
|
createApplicant: p,
|
|
2552
2557
|
createCompanyApplicant: S,
|
|
2553
|
-
getApplicantData:
|
|
2554
|
-
stopProgress:
|
|
2558
|
+
getApplicantData: I,
|
|
2559
|
+
stopProgress: F
|
|
2555
2560
|
};
|
|
2556
2561
|
}
|
|
2557
2562
|
const Hr = {
|
|
@@ -2857,7 +2862,7 @@ const kt = 280, jr = ({
|
|
|
2857
2862
|
disabled: l = !1,
|
|
2858
2863
|
required: d = !1
|
|
2859
2864
|
}) => {
|
|
2860
|
-
const [m, g] = w(!1), [p, S] = w(""), [
|
|
2865
|
+
const [m, g] = w(!1), [p, S] = w(""), [I, F] = w(null), [A, f] = w({
|
|
2861
2866
|
bg: "#ffffff",
|
|
2862
2867
|
borderColor: "#d1d5db",
|
|
2863
2868
|
textPrimary: "#111827",
|
|
@@ -2884,7 +2889,7 @@ const kt = 280, jr = ({
|
|
|
2884
2889
|
if (l) return;
|
|
2885
2890
|
L();
|
|
2886
2891
|
const R = U();
|
|
2887
|
-
R &&
|
|
2892
|
+
R && F(R), g(!0);
|
|
2888
2893
|
}, [l, U, L]), X = re(() => {
|
|
2889
2894
|
g(!1), S("");
|
|
2890
2895
|
}, []);
|
|
@@ -2900,7 +2905,7 @@ const kt = 280, jr = ({
|
|
|
2900
2905
|
if (!m) return;
|
|
2901
2906
|
const R = () => {
|
|
2902
2907
|
const K = U();
|
|
2903
|
-
K &&
|
|
2908
|
+
K && F(K);
|
|
2904
2909
|
};
|
|
2905
2910
|
return window.addEventListener("scroll", R, !0), window.addEventListener("resize", R), () => {
|
|
2906
2911
|
window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R);
|
|
@@ -2915,17 +2920,17 @@ const kt = 280, jr = ({
|
|
|
2915
2920
|
}, W = (R) => {
|
|
2916
2921
|
var K;
|
|
2917
2922
|
return ((K = n.find((te) => te.value === R)) == null ? void 0 : K.label) || R;
|
|
2918
|
-
}, { bg: Y, borderColor: z, textPrimary: H, textSecondary: B, primaryColor: D, primaryLight: V, hoverBg: ee } =
|
|
2923
|
+
}, { bg: Y, borderColor: z, textPrimary: H, textSecondary: B, primaryColor: D, primaryLight: V, hoverBg: ee } = A, oe = m && I && /* @__PURE__ */ s(
|
|
2919
2924
|
"div",
|
|
2920
2925
|
{
|
|
2921
2926
|
ref: T,
|
|
2922
2927
|
className: "metakyc-multiselect-dropdown",
|
|
2923
2928
|
style: {
|
|
2924
2929
|
position: "fixed",
|
|
2925
|
-
top:
|
|
2926
|
-
bottom:
|
|
2927
|
-
left:
|
|
2928
|
-
width:
|
|
2930
|
+
top: I.openUp ? void 0 : I.top,
|
|
2931
|
+
bottom: I.openUp ? window.innerHeight - I.top + 4 : void 0,
|
|
2932
|
+
left: I.left,
|
|
2933
|
+
width: I.width,
|
|
2929
2934
|
zIndex: 99999,
|
|
2930
2935
|
borderRadius: "8px",
|
|
2931
2936
|
boxShadow: "0 4px 16px rgba(0,0,0,0.18)",
|
|
@@ -3127,7 +3132,7 @@ const kt = 280, jr = ({
|
|
|
3127
3132
|
className: p
|
|
3128
3133
|
}) => {
|
|
3129
3134
|
var de;
|
|
3130
|
-
const [S,
|
|
3135
|
+
const [S, I] = w(!1), [F, A] = w(""), [f, N] = w(null), [M, T] = w({
|
|
3131
3136
|
bg: "#ffffff",
|
|
3132
3137
|
border: "#d1d5db",
|
|
3133
3138
|
text: "#111827",
|
|
@@ -3159,9 +3164,9 @@ const kt = 280, jr = ({
|
|
|
3159
3164
|
if (m) return;
|
|
3160
3165
|
U();
|
|
3161
3166
|
const P = j();
|
|
3162
|
-
P && N(P),
|
|
3167
|
+
P && N(P), I(!0);
|
|
3163
3168
|
}, [m, j, U]), W = re(() => {
|
|
3164
|
-
|
|
3169
|
+
I(!1), A("");
|
|
3165
3170
|
}, []), Y = () => S ? W() : O();
|
|
3166
3171
|
ye(() => {
|
|
3167
3172
|
if (!S) return;
|
|
@@ -3187,7 +3192,7 @@ const kt = 280, jr = ({
|
|
|
3187
3192
|
}, 0);
|
|
3188
3193
|
}, [S]);
|
|
3189
3194
|
const z = n.filter(
|
|
3190
|
-
(P) => P.label.toLowerCase().includes(
|
|
3195
|
+
(P) => P.label.toLowerCase().includes(F.toLowerCase()) || P.value.toLowerCase().includes(F.toLowerCase())
|
|
3191
3196
|
), H = (de = n.find((P) => P.value === l)) == null ? void 0 : de.label, B = (P, Q) => {
|
|
3192
3197
|
m || Q || (d(P), W());
|
|
3193
3198
|
}, { bg: D, border: V, text: ee, textSecondary: oe, primary: R, primaryLight: K, hoverBg: te } = M, fe = S && f && /* @__PURE__ */ s(
|
|
@@ -3214,8 +3219,8 @@ const kt = 280, jr = ({
|
|
|
3214
3219
|
{
|
|
3215
3220
|
ref: se,
|
|
3216
3221
|
type: "text",
|
|
3217
|
-
value:
|
|
3218
|
-
onChange: (P) =>
|
|
3222
|
+
value: F,
|
|
3223
|
+
onChange: (P) => A(P.target.value),
|
|
3219
3224
|
placeholder: "Search...",
|
|
3220
3225
|
onClick: (P) => P.stopPropagation(),
|
|
3221
3226
|
className: "metakyc-searchable-select-search w-full",
|
|
@@ -3355,7 +3360,7 @@ const Kr = ({
|
|
|
3355
3360
|
value: d = [],
|
|
3356
3361
|
className: m
|
|
3357
3362
|
}) => {
|
|
3358
|
-
const [g, p] = w(!1), S = ce(null),
|
|
3363
|
+
const [g, p] = w(!1), S = ce(null), I = (T) => {
|
|
3359
3364
|
if (!T) return;
|
|
3360
3365
|
const U = Array.from(T);
|
|
3361
3366
|
if (i && U.filter(($) => $.size > i).length > 0) {
|
|
@@ -3364,12 +3369,12 @@ const Kr = ({
|
|
|
3364
3369
|
return;
|
|
3365
3370
|
}
|
|
3366
3371
|
l == null || l(n ? [...d, ...U] : [U[0]]);
|
|
3367
|
-
},
|
|
3372
|
+
}, F = (T) => {
|
|
3368
3373
|
T.preventDefault(), p(!0);
|
|
3369
|
-
},
|
|
3374
|
+
}, A = () => {
|
|
3370
3375
|
p(!1);
|
|
3371
3376
|
}, f = (T) => {
|
|
3372
|
-
T.preventDefault(), p(!1),
|
|
3377
|
+
T.preventDefault(), p(!1), I(T.dataTransfer.files);
|
|
3373
3378
|
}, N = () => {
|
|
3374
3379
|
var T;
|
|
3375
3380
|
(T = S.current) == null || T.click();
|
|
@@ -3387,8 +3392,8 @@ const Kr = ({
|
|
|
3387
3392
|
g ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-300 dark:border-gray-600 hover:border-primary-500",
|
|
3388
3393
|
t && "border-danger-500"
|
|
3389
3394
|
),
|
|
3390
|
-
onDragOver:
|
|
3391
|
-
onDragLeave:
|
|
3395
|
+
onDragOver: F,
|
|
3396
|
+
onDragLeave: A,
|
|
3392
3397
|
onDrop: f,
|
|
3393
3398
|
onClick: N,
|
|
3394
3399
|
children: [
|
|
@@ -3400,7 +3405,7 @@ const Kr = ({
|
|
|
3400
3405
|
className: "hidden",
|
|
3401
3406
|
accept: a,
|
|
3402
3407
|
multiple: n,
|
|
3403
|
-
onChange: (T) =>
|
|
3408
|
+
onChange: (T) => I(T.target.files)
|
|
3404
3409
|
}
|
|
3405
3410
|
),
|
|
3406
3411
|
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
@@ -3711,15 +3716,15 @@ const ta = ({
|
|
|
3711
3716
|
onComplete: t,
|
|
3712
3717
|
onBack: a
|
|
3713
3718
|
}) => {
|
|
3714
|
-
const { questionnaire: n, initialAnswers: i, isLoading: l, isSubmitting: d, error: m, submit: g } = Or(e), [p, S] = w({}), [
|
|
3715
|
-
|
|
3719
|
+
const { questionnaire: n, initialAnswers: i, isLoading: l, isSubmitting: d, error: m, submit: g } = Or(e), [p, S] = w({}), [I, F] = w({}), [A, f] = w(0);
|
|
3720
|
+
Ae.useEffect(() => {
|
|
3716
3721
|
i && Object.keys(i).length > 0 && Object.keys(p).length === 0 && S(i);
|
|
3717
3722
|
}, [i]);
|
|
3718
3723
|
const N = Le(
|
|
3719
3724
|
() => n ? ea(n.questionGroups) : [],
|
|
3720
3725
|
[n]
|
|
3721
|
-
), M =
|
|
3722
|
-
S((W) => ({ ...W, [j]: O })),
|
|
3726
|
+
), M = A === N.length - 1, T = N[A] ?? [], U = re((j, O) => {
|
|
3727
|
+
S((W) => ({ ...W, [j]: O })), F((W) => {
|
|
3723
3728
|
const Y = { ...W };
|
|
3724
3729
|
return delete Y[j], Y;
|
|
3725
3730
|
});
|
|
@@ -3729,11 +3734,11 @@ const ta = ({
|
|
|
3729
3734
|
const W = Xr(O, p[O.id] ?? []);
|
|
3730
3735
|
W && (j[O.id] = W);
|
|
3731
3736
|
}
|
|
3732
|
-
return
|
|
3737
|
+
return F((O) => ({ ...O, ...j })), Object.keys(j).length === 0;
|
|
3733
3738
|
}, [T, p]), $ = () => {
|
|
3734
3739
|
L() && f((j) => j + 1);
|
|
3735
3740
|
}, X = () => {
|
|
3736
|
-
|
|
3741
|
+
A > 0 ? f((j) => j - 1) : a == null || a();
|
|
3737
3742
|
}, se = async () => {
|
|
3738
3743
|
if (!(!L() || !n))
|
|
3739
3744
|
try {
|
|
@@ -3762,7 +3767,7 @@ const ta = ({
|
|
|
3762
3767
|
N.length > 1 && /* @__PURE__ */ s("div", { className: "flex items-center justify-between mt-3", children: [
|
|
3763
3768
|
/* @__PURE__ */ s("span", { className: "text-xs", style: { color: "var(--metakyc-text-muted, #9ca3af)" }, children: [
|
|
3764
3769
|
"Page ",
|
|
3765
|
-
|
|
3770
|
+
A + 1,
|
|
3766
3771
|
" of ",
|
|
3767
3772
|
N.length
|
|
3768
3773
|
] }),
|
|
@@ -3772,8 +3777,8 @@ const ta = ({
|
|
|
3772
3777
|
className: "rounded-full transition-all duration-200",
|
|
3773
3778
|
style: {
|
|
3774
3779
|
height: "6px",
|
|
3775
|
-
width: O ===
|
|
3776
|
-
backgroundColor: O <=
|
|
3780
|
+
width: O === A ? "20px" : "6px",
|
|
3781
|
+
backgroundColor: O <= A ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
|
|
3777
3782
|
}
|
|
3778
3783
|
},
|
|
3779
3784
|
O
|
|
@@ -3785,7 +3790,7 @@ const ta = ({
|
|
|
3785
3790
|
{
|
|
3786
3791
|
question: j,
|
|
3787
3792
|
value: p[j.id] ?? [],
|
|
3788
|
-
error:
|
|
3793
|
+
error: I[j.id],
|
|
3789
3794
|
onChange: (O) => U(j.id, O)
|
|
3790
3795
|
},
|
|
3791
3796
|
j.id
|
|
@@ -3800,7 +3805,7 @@ const ta = ({
|
|
|
3800
3805
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
3801
3806
|
children: [
|
|
3802
3807
|
/* @__PURE__ */ r(Tt, { size: 14 }),
|
|
3803
|
-
|
|
3808
|
+
A > 0 ? "Previous" : "Back"
|
|
3804
3809
|
]
|
|
3805
3810
|
}
|
|
3806
3811
|
),
|
|
@@ -3939,14 +3944,14 @@ const ta = ({
|
|
|
3939
3944
|
onComplete: t,
|
|
3940
3945
|
onBack: a
|
|
3941
3946
|
}) => {
|
|
3942
|
-
const { uploadDocument: n, isLoading: i, isSubmitting: l, error: d, submit: m } = $r(e), [g, p] = w({}), S = async (
|
|
3943
|
-
if (
|
|
3944
|
-
const
|
|
3947
|
+
const { uploadDocument: n, isLoading: i, isSubmitting: l, error: d, submit: m } = $r(e), [g, p] = w({}), S = async (I) => {
|
|
3948
|
+
if (I.preventDefault(), !n) return;
|
|
3949
|
+
const F = await Promise.all(
|
|
3945
3950
|
n.uploadDocumentFiles.map(async (f) => {
|
|
3946
3951
|
const N = g[f.id] || [], M = await Promise.all(
|
|
3947
3952
|
N.map(async (T) => ({
|
|
3948
3953
|
fileName: T.name,
|
|
3949
|
-
fileData: await
|
|
3954
|
+
fileData: await Ar(T)
|
|
3950
3955
|
}))
|
|
3951
3956
|
);
|
|
3952
3957
|
return {
|
|
@@ -3954,12 +3959,12 @@ const ta = ({
|
|
|
3954
3959
|
valueList: M
|
|
3955
3960
|
};
|
|
3956
3961
|
})
|
|
3957
|
-
),
|
|
3962
|
+
), A = {
|
|
3958
3963
|
applicantId: e,
|
|
3959
3964
|
uploadDocumentId: n.id,
|
|
3960
|
-
uploadDocumentResults:
|
|
3965
|
+
uploadDocumentResults: F
|
|
3961
3966
|
};
|
|
3962
|
-
await m(
|
|
3967
|
+
await m(A), t == null || t();
|
|
3963
3968
|
};
|
|
3964
3969
|
return i ? /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ r(Re, { className: "my-8" }) }) }) : d ? /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ s("p", { className: "text-danger-500", children: [
|
|
3965
3970
|
"Error loading document requirements: ",
|
|
@@ -3969,19 +3974,19 @@ const ta = ({
|
|
|
3969
3974
|
/* @__PURE__ */ r("h2", { className: "text-lg font-bold", children: n.displayName }),
|
|
3970
3975
|
n.subtitle && /* @__PURE__ */ r("p", { className: "mt-1", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: n.subtitle })
|
|
3971
3976
|
] }),
|
|
3972
|
-
/* @__PURE__ */ r(J, { className: "space-y-6", children: n.uploadDocumentFiles.map((
|
|
3977
|
+
/* @__PURE__ */ r(J, { className: "space-y-6", children: n.uploadDocumentFiles.map((I) => /* @__PURE__ */ r(
|
|
3973
3978
|
Kr,
|
|
3974
3979
|
{
|
|
3975
|
-
label:
|
|
3976
|
-
accept:
|
|
3977
|
-
multiple:
|
|
3978
|
-
maxSize:
|
|
3979
|
-
value: g[
|
|
3980
|
-
onChange: (
|
|
3981
|
-
p((
|
|
3980
|
+
label: I.displayName,
|
|
3981
|
+
accept: I.allowedTypes,
|
|
3982
|
+
multiple: I.multipleFile,
|
|
3983
|
+
maxSize: I.maxEachFileSizeByte,
|
|
3984
|
+
value: g[I.id] || [],
|
|
3985
|
+
onChange: (F) => {
|
|
3986
|
+
p((A) => ({ ...A, [I.id]: F }));
|
|
3982
3987
|
}
|
|
3983
3988
|
},
|
|
3984
|
-
|
|
3989
|
+
I.id
|
|
3985
3990
|
)) }),
|
|
3986
3991
|
/* @__PURE__ */ s(ke, { className: "flex justify-between", children: [
|
|
3987
3992
|
a && /* @__PURE__ */ r(Z, { type: "button", variant: "outline", onClick: a, children: "Back" }),
|
|
@@ -4098,30 +4103,30 @@ const ua = ({
|
|
|
4098
4103
|
onComplete: t,
|
|
4099
4104
|
onBack: a
|
|
4100
4105
|
}) => {
|
|
4101
|
-
const { config: n } =
|
|
4102
|
-
|
|
4103
|
-
d && Object.keys(d).length > 0 && Object.keys(
|
|
4106
|
+
const { config: n } = Ee(), i = n.locale ?? "en", { criteria: l, initialAnswers: d, isLoading: m, isSubmitting: g, error: p, submit: S } = zr(e), [I, F] = w({}), [A, f] = w({}), [N, M] = w(0), [T, U] = w(!1);
|
|
4107
|
+
Ae.useEffect(() => {
|
|
4108
|
+
d && Object.keys(d).length > 0 && Object.keys(I).length === 0 && F(d);
|
|
4104
4109
|
}, [d]);
|
|
4105
4110
|
const L = Le(
|
|
4106
4111
|
() => l && l.length > 0 ? ca(l) : [],
|
|
4107
4112
|
[l]
|
|
4108
4113
|
), $ = N === L.length - 1, X = L[N] ?? [];
|
|
4109
|
-
|
|
4114
|
+
Ae.useEffect(() => {
|
|
4110
4115
|
!m && l && l.length === 0 && !T && !g && (U(!0), S({ applicantId: e, criteriaValueInputs: [] }).then(() => t == null ? void 0 : t()).catch(console.error));
|
|
4111
4116
|
}, [m, l, T, g, S, e, t]);
|
|
4112
4117
|
const se = re((z, H) => {
|
|
4113
|
-
|
|
4118
|
+
F((B) => ({ ...B, [z]: H })), f((B) => {
|
|
4114
4119
|
const D = { ...B };
|
|
4115
4120
|
return delete D[z], D;
|
|
4116
4121
|
});
|
|
4117
4122
|
}, []), j = re(() => {
|
|
4118
4123
|
const z = {};
|
|
4119
4124
|
for (const { criterion: H } of X) {
|
|
4120
|
-
const B = la(H,
|
|
4125
|
+
const B = la(H, I[H.id] ?? []);
|
|
4121
4126
|
B && (z[H.id] = B);
|
|
4122
4127
|
}
|
|
4123
4128
|
return f((H) => ({ ...H, ...z })), Object.keys(z).length === 0;
|
|
4124
|
-
}, [X,
|
|
4129
|
+
}, [X, I]), O = () => {
|
|
4125
4130
|
j() && M((z) => z + 1);
|
|
4126
4131
|
}, W = () => {
|
|
4127
4132
|
N > 0 ? M((z) => z - 1) : a == null || a();
|
|
@@ -4129,7 +4134,7 @@ const ua = ({
|
|
|
4129
4134
|
if (!(!j() || !l))
|
|
4130
4135
|
try {
|
|
4131
4136
|
const z = l.map((B) => {
|
|
4132
|
-
const D = (
|
|
4137
|
+
const D = (I[B.id] ?? []).filter((V) => V && V.trim());
|
|
4133
4138
|
return D.length > 0 ? { riskCriteriaId: B.id, values: D } : null;
|
|
4134
4139
|
}).filter((B) => B !== null);
|
|
4135
4140
|
await S({ applicantId: e, criteriaValueInputs: z }), t == null || t();
|
|
@@ -4175,8 +4180,8 @@ const ua = ({
|
|
|
4175
4180
|
ma,
|
|
4176
4181
|
{
|
|
4177
4182
|
criterion: z,
|
|
4178
|
-
value:
|
|
4179
|
-
error:
|
|
4183
|
+
value: I[z.id] ?? [],
|
|
4184
|
+
error: A[z.id],
|
|
4180
4185
|
locale: i,
|
|
4181
4186
|
onChange: (H) => se(z.id, H)
|
|
4182
4187
|
},
|
|
@@ -4285,7 +4290,7 @@ const ua = ({
|
|
|
4285
4290
|
type: "checkbox",
|
|
4286
4291
|
checked: t.includes(p),
|
|
4287
4292
|
onChange: (S) => {
|
|
4288
|
-
S.target.checked ? i([...t, p]) : i(t.filter((
|
|
4293
|
+
S.target.checked ? i([...t, p]) : i(t.filter((I) => I !== p));
|
|
4289
4294
|
},
|
|
4290
4295
|
className: "metakyc-option-input",
|
|
4291
4296
|
style: {
|
|
@@ -4333,23 +4338,23 @@ const ua = ({
|
|
|
4333
4338
|
onComplete: t,
|
|
4334
4339
|
onBack: a
|
|
4335
4340
|
}) => {
|
|
4336
|
-
const { investorCategorizationService: n } =
|
|
4337
|
-
return /* @__PURE__ */ r("form", { onSubmit: async (
|
|
4338
|
-
if (
|
|
4341
|
+
const { investorCategorizationService: n } = Ee(), [i, l] = w(null), [d, m] = w(!1), [g, p] = w(null);
|
|
4342
|
+
return /* @__PURE__ */ r("form", { onSubmit: async (I) => {
|
|
4343
|
+
if (I.preventDefault(), i === null) {
|
|
4339
4344
|
p("Please select an investor type");
|
|
4340
4345
|
return;
|
|
4341
4346
|
}
|
|
4342
4347
|
m(!0), p(null);
|
|
4343
4348
|
try {
|
|
4344
|
-
const
|
|
4349
|
+
const F = {
|
|
4345
4350
|
applicantId: e,
|
|
4346
4351
|
investorType: i
|
|
4347
4352
|
};
|
|
4348
|
-
console.log("Submitting investor categorization:",
|
|
4349
|
-
const
|
|
4350
|
-
console.log("Investor categorization result:",
|
|
4351
|
-
} catch (
|
|
4352
|
-
console.error("Error submitting investor categorization:",
|
|
4353
|
+
console.log("Submitting investor categorization:", F);
|
|
4354
|
+
const A = await n.setInvestorCategorization(F);
|
|
4355
|
+
console.log("Investor categorization result:", A), t == null || t();
|
|
4356
|
+
} catch (F) {
|
|
4357
|
+
console.error("Error submitting investor categorization:", F), p(F.message || "Failed to submit investor categorization");
|
|
4353
4358
|
} finally {
|
|
4354
4359
|
m(!1);
|
|
4355
4360
|
}
|
|
@@ -4474,18 +4479,18 @@ const ua = ({
|
|
|
4474
4479
|
onComplete: t,
|
|
4475
4480
|
onBack: a
|
|
4476
4481
|
}) => {
|
|
4477
|
-
const { appropriatenessTestService: n } =
|
|
4482
|
+
const { appropriatenessTestService: n } = Ee(), [i, l] = w(null), [d, m] = w(!0), [g, p] = w(!1), [S, I] = w(null), [F, A] = w({}), [f, N] = w(0), [M, T] = w(!1), [U, L] = w(!1), [$, X] = w(0);
|
|
4478
4483
|
ye(() => {
|
|
4479
4484
|
(async () => {
|
|
4480
4485
|
try {
|
|
4481
|
-
m(!0),
|
|
4486
|
+
m(!0), I(null), console.log("Loading appropriateness test for applicant:", e);
|
|
4482
4487
|
const D = await n.getAppropriatenessTest(e);
|
|
4483
4488
|
if (console.log("Appropriateness test data:", D), l(D), D.waitTimeSpanForNextTry && D.waitTimeSpanForNextTry !== "00:00:00") {
|
|
4484
4489
|
const V = se(D.waitTimeSpanForNextTry);
|
|
4485
4490
|
V > 0 && X(V);
|
|
4486
4491
|
}
|
|
4487
4492
|
} catch (D) {
|
|
4488
|
-
console.error("Error loading appropriateness test:", D),
|
|
4493
|
+
console.error("Error loading appropriateness test:", D), I(D.message || "Failed to load appropriateness test");
|
|
4489
4494
|
} finally {
|
|
4490
4495
|
m(!1);
|
|
4491
4496
|
}
|
|
@@ -4520,25 +4525,25 @@ const ua = ({
|
|
|
4520
4525
|
const O = () => {
|
|
4521
4526
|
i && (T(!0), N(i.testDurationSec));
|
|
4522
4527
|
}, W = (B, D) => {
|
|
4523
|
-
|
|
4528
|
+
A((V) => ({
|
|
4524
4529
|
...V,
|
|
4525
4530
|
[B]: D
|
|
4526
4531
|
}));
|
|
4527
4532
|
}, Y = async (B) => {
|
|
4528
4533
|
if (B && B.preventDefault(), !!i) {
|
|
4529
4534
|
if (!U) {
|
|
4530
|
-
const D = i.appropriatenessQuestions.length - Object.keys(
|
|
4535
|
+
const D = i.appropriatenessQuestions.length - Object.keys(F).length;
|
|
4531
4536
|
if (D > 0) {
|
|
4532
|
-
|
|
4537
|
+
I(`Please answer all questions. ${D} question(s) remaining.`);
|
|
4533
4538
|
return;
|
|
4534
4539
|
}
|
|
4535
4540
|
}
|
|
4536
|
-
p(!0),
|
|
4541
|
+
p(!0), I(null);
|
|
4537
4542
|
try {
|
|
4538
4543
|
const D = i.appropriatenessQuestions.map(
|
|
4539
4544
|
(ee) => ({
|
|
4540
4545
|
appropriatenessQuestionId: ee.id,
|
|
4541
|
-
value:
|
|
4546
|
+
value: F[ee.id] || ""
|
|
4542
4547
|
// Empty string if not answered
|
|
4543
4548
|
})
|
|
4544
4549
|
), V = {
|
|
@@ -4549,16 +4554,16 @@ const ua = ({
|
|
|
4549
4554
|
console.log("Submitting appropriateness test:", V);
|
|
4550
4555
|
try {
|
|
4551
4556
|
const ee = await n.fillAppropriatenessTest(V);
|
|
4552
|
-
console.log("Appropriateness test result:", ee), ee.message && (ee.message.toLowerCase().includes("pass") || ee.message.toLowerCase().includes("success") || ee.message.toLowerCase().includes("congratulations")) ? t == null || t() : (
|
|
4557
|
+
console.log("Appropriateness test result:", ee), ee.message && (ee.message.toLowerCase().includes("pass") || ee.message.toLowerCase().includes("success") || ee.message.toLowerCase().includes("congratulations")) ? t == null || t() : (I(ee.message || "Test completed. Please check the result."), T(!1), L(!1), A({}), setTimeout(() => z(), 1e3));
|
|
4553
4558
|
} catch (ee) {
|
|
4554
4559
|
if (ee.code === 400 && ee.message) {
|
|
4555
4560
|
const oe = ee.message;
|
|
4556
|
-
console.log("Test failed:", oe),
|
|
4561
|
+
console.log("Test failed:", oe), I(oe), T(!1), L(!1), A({}), setTimeout(() => z(), 1500);
|
|
4557
4562
|
} else
|
|
4558
4563
|
throw ee;
|
|
4559
4564
|
}
|
|
4560
4565
|
} catch (D) {
|
|
4561
|
-
console.error("Error submitting appropriateness test:", D),
|
|
4566
|
+
console.error("Error submitting appropriateness test:", D), I(D.message || "Failed to submit test. Please try again."), T(!1), L(!1), A({});
|
|
4562
4567
|
} finally {
|
|
4563
4568
|
p(!1);
|
|
4564
4569
|
}
|
|
@@ -4571,7 +4576,7 @@ const ua = ({
|
|
|
4571
4576
|
D > 0 && X(D);
|
|
4572
4577
|
}
|
|
4573
4578
|
} catch (B) {
|
|
4574
|
-
console.error("Error reloading test data:", B),
|
|
4579
|
+
console.error("Error reloading test data:", B), I((D) => D + `
|
|
4575
4580
|
|
|
4576
4581
|
Failed to reload test data. Please refresh the page.`);
|
|
4577
4582
|
}
|
|
@@ -4622,7 +4627,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4622
4627
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-4", children: [
|
|
4623
4628
|
/* @__PURE__ */ s(Ke, { variant: "info", children: [
|
|
4624
4629
|
"Question ",
|
|
4625
|
-
Object.keys(
|
|
4630
|
+
Object.keys(F).length,
|
|
4626
4631
|
" of ",
|
|
4627
4632
|
i.totalQuestionCount
|
|
4628
4633
|
] }),
|
|
@@ -4651,7 +4656,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4651
4656
|
{
|
|
4652
4657
|
className: `
|
|
4653
4658
|
flex items-center p-3 border-2 rounded-lg cursor-pointer transition-all
|
|
4654
|
-
${
|
|
4659
|
+
${F[B.id] === V ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}
|
|
4655
4660
|
`,
|
|
4656
4661
|
children: [
|
|
4657
4662
|
/* @__PURE__ */ r(
|
|
@@ -4660,7 +4665,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4660
4665
|
type: "radio",
|
|
4661
4666
|
name: `question-${B.id}`,
|
|
4662
4667
|
value: V,
|
|
4663
|
-
checked:
|
|
4668
|
+
checked: F[B.id] === V,
|
|
4664
4669
|
onChange: (oe) => W(B.id, oe.target.value),
|
|
4665
4670
|
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500",
|
|
4666
4671
|
disabled: g
|
|
@@ -4701,7 +4706,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4701
4706
|
{
|
|
4702
4707
|
type: "submit",
|
|
4703
4708
|
isLoading: g,
|
|
4704
|
-
disabled: Object.keys(
|
|
4709
|
+
disabled: Object.keys(F).length < i.totalQuestionCount,
|
|
4705
4710
|
children: U ? "Submitting..." : "Submit Test"
|
|
4706
4711
|
}
|
|
4707
4712
|
)
|
|
@@ -4757,7 +4762,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4757
4762
|
onBack: a
|
|
4758
4763
|
}) => {
|
|
4759
4764
|
var Me, Xe, He, qe;
|
|
4760
|
-
const { applicantService: n, baseInformationService: i, config: l, currentTheme: d } =
|
|
4765
|
+
const { applicantService: n, baseInformationService: i, config: l, currentTheme: d } = Ee(), { identityData: m, provider: g, token: p, isLoading: S, error: I, requestIdentity: F, restartIdentity: A } = _r(e), [f, N] = w(null), [M, T] = w(null), [U, L] = w([]), [$, X] = w([]), [se, j] = w(!0), [O, W] = w(!1), [Y, z] = w(null), [H, B] = w(!1), D = Ae.useRef(!1), [V, ee] = w({}), [oe, R] = w({}), K = d != null && d.reviewPageFields && d.reviewPageFields.length > 0 ? d.reviewPageFields[0] : null, te = !!(d != null && d.reviewPageDisabled), fe = ce(!1);
|
|
4761
4766
|
fe.current = te;
|
|
4762
4767
|
const de = Ht({
|
|
4763
4768
|
defaultValues: {
|
|
@@ -4772,7 +4777,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4772
4777
|
});
|
|
4773
4778
|
ye(() => {
|
|
4774
4779
|
if (te) {
|
|
4775
|
-
D.current || (D.current = !0,
|
|
4780
|
+
D.current || (D.current = !0, F().then(() => W(!0)).catch((_) => console.error("[Identity] Auto-request failed:", _)).finally(() => j(!1)));
|
|
4776
4781
|
return;
|
|
4777
4782
|
}
|
|
4778
4783
|
(async () => {
|
|
@@ -4822,7 +4827,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4822
4827
|
}), _.kycRecords && _.kycRecords.length > 0 && _.kycRecords[0].providerTokenObject !== null && !D.current && fe.current) {
|
|
4823
4828
|
console.log("[Identity] Review page disabled + existing identity — auto-requesting..."), D.current = !0;
|
|
4824
4829
|
try {
|
|
4825
|
-
await
|
|
4830
|
+
await F(), W(!0);
|
|
4826
4831
|
} catch (y) {
|
|
4827
4832
|
console.error("[Identity] Auto-request failed:", y);
|
|
4828
4833
|
}
|
|
@@ -4929,13 +4934,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4929
4934
|
}, [g, p, f, O, t, H]);
|
|
4930
4935
|
const P = async () => {
|
|
4931
4936
|
try {
|
|
4932
|
-
z(null), B(!1), await
|
|
4937
|
+
z(null), B(!1), await F(), W(!0);
|
|
4933
4938
|
} catch (h) {
|
|
4934
4939
|
console.error("Error starting identity verification:", h);
|
|
4935
4940
|
}
|
|
4936
4941
|
}, Q = async () => {
|
|
4937
4942
|
try {
|
|
4938
|
-
z(null), B(!1), N(null), console.log("[Identity] Restarting verification..."), await
|
|
4943
|
+
z(null), B(!1), N(null), console.log("[Identity] Restarting verification..."), await A(), W(!0);
|
|
4939
4944
|
} catch (h) {
|
|
4940
4945
|
console.error("Error restarting identity verification:", h), z(h.message || "Failed to restart verification");
|
|
4941
4946
|
}
|
|
@@ -4945,10 +4950,10 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4945
4950
|
/* @__PURE__ */ r(Re, { className: "my-8" }),
|
|
4946
4951
|
/* @__PURE__ */ r("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading identity verification..." })
|
|
4947
4952
|
] }) });
|
|
4948
|
-
if (
|
|
4953
|
+
if (I)
|
|
4949
4954
|
return /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ s("p", { className: "text-danger-500", children: [
|
|
4950
4955
|
"Error: ",
|
|
4951
|
-
|
|
4956
|
+
I.message
|
|
4952
4957
|
] }) }) });
|
|
4953
4958
|
if (O && (Y || H))
|
|
4954
4959
|
return /* @__PURE__ */ s(G, { children: [
|
|
@@ -5232,7 +5237,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5232
5237
|
const C = Array.isArray(x) ? x : x ? [x] : [], b = (o) => {
|
|
5233
5238
|
h.singleSelect ? R((c) => ({ ...c, [u]: C[0] === o ? [] : [o] })) : R((c) => ({
|
|
5234
5239
|
...c,
|
|
5235
|
-
[u]: C.includes(o) ? C.filter((
|
|
5240
|
+
[u]: C.includes(o) ? C.filter((E) => E !== o) : [...C, o]
|
|
5236
5241
|
}));
|
|
5237
5242
|
};
|
|
5238
5243
|
return /* @__PURE__ */ r("div", { className: ue(h.colSpan), children: xe(
|
|
@@ -5293,7 +5298,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5293
5298
|
{
|
|
5294
5299
|
label: x,
|
|
5295
5300
|
value: String(C),
|
|
5296
|
-
onChange: (c) => ee((
|
|
5301
|
+
onChange: (c) => ee((E) => ({ ...E, [q]: c })),
|
|
5297
5302
|
options: [{ value: "", label: "Select country code…" }, ...$]
|
|
5298
5303
|
}
|
|
5299
5304
|
),
|
|
@@ -5304,7 +5309,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5304
5309
|
{
|
|
5305
5310
|
label: x,
|
|
5306
5311
|
value: String(C),
|
|
5307
|
-
onChange: (c) => ee((
|
|
5312
|
+
onChange: (c) => ee((E) => ({ ...E, [q]: c })),
|
|
5308
5313
|
options: [{ value: "", label: `Select ${x.toLowerCase()}…` }, ...U]
|
|
5309
5314
|
}
|
|
5310
5315
|
),
|
|
@@ -5316,7 +5321,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5316
5321
|
label: x,
|
|
5317
5322
|
type: (u == null ? void 0 : u.type) === "date" ? "date" : (u == null ? void 0 : u.type) === "email" ? "email" : "text",
|
|
5318
5323
|
value: String(C),
|
|
5319
|
-
onChange: (c) => ee((
|
|
5324
|
+
onChange: (c) => ee((E) => ({ ...E, [q]: c.target.value }))
|
|
5320
5325
|
}
|
|
5321
5326
|
),
|
|
5322
5327
|
h.helpText
|
|
@@ -5572,7 +5577,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5572
5577
|
subtitle: t,
|
|
5573
5578
|
className: a = ""
|
|
5574
5579
|
}) => {
|
|
5575
|
-
const { currentTheme: n } =
|
|
5580
|
+
const { currentTheme: n } = Ee(), i = e || (n == null ? void 0 : n.title) || "", l = !!(n != null && n.logo && n.logo.visible && n.logo.url), d = !!i;
|
|
5576
5581
|
return !l && !d ? null : /* @__PURE__ */ s("div", { className: `metakyc-header ${a}`, children: [
|
|
5577
5582
|
/* @__PURE__ */ s(
|
|
5578
5583
|
"div",
|
|
@@ -5611,7 +5616,7 @@ const st = {
|
|
|
5611
5616
|
display: "inline-block",
|
|
5612
5617
|
verticalAlign: "middle"
|
|
5613
5618
|
}, Ct = ({ helpText: e, children: t }) => {
|
|
5614
|
-
const [a, n] =
|
|
5619
|
+
const [a, n] = Ae.useState(!1);
|
|
5615
5620
|
if (!e) return /* @__PURE__ */ r(ot, { children: t });
|
|
5616
5621
|
const i = a ? /* @__PURE__ */ r(
|
|
5617
5622
|
"div",
|
|
@@ -5738,31 +5743,31 @@ const st = {
|
|
|
5738
5743
|
onCancel: n
|
|
5739
5744
|
}) => {
|
|
5740
5745
|
var _, q, u, x, C, b;
|
|
5741
|
-
const { config: i, baseInformationService: l, currentTheme: d } =
|
|
5746
|
+
const { config: i, baseInformationService: l, currentTheme: d } = Ee(), { createApplicant: m, isLoading: g } = At(), p = e || ((_ = i.applicantForm) == null ? void 0 : _.workflowKey);
|
|
5742
5747
|
if (!p)
|
|
5743
5748
|
throw new Error(
|
|
5744
5749
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
5745
5750
|
);
|
|
5746
|
-
const S = t || ((q = i.applicantForm) == null ? void 0 : q.externalRefId) || "",
|
|
5751
|
+
const S = t || ((q = i.applicantForm) == null ? void 0 : q.externalRefId) || "", I = ((u = i.applicantForm) == null ? void 0 : u.email) || "", F = ((x = i.applicantForm) == null ? void 0 : x.hiddenValues) || {}, f = (((C = i.applicantForm) == null ? void 0 : C.fieldLabelMode) || (d == null ? void 0 : d.fieldLabelMode) || "label") !== "placeholder", N = Le(
|
|
5747
5752
|
() => d != null && d.applicantFormPages && d.applicantFormPages.length > 0 ? d.applicantFormPages : null,
|
|
5748
5753
|
[d == null ? void 0 : d.applicantFormPages]
|
|
5749
5754
|
), M = Le(() => {
|
|
5750
5755
|
const o = new Set(dt), c = d == null ? void 0 : d.applicantFormRequiredFields;
|
|
5751
|
-
if (c) for (const
|
|
5756
|
+
if (c) for (const E of c) o.add(E);
|
|
5752
5757
|
if (N)
|
|
5753
|
-
for (const
|
|
5754
|
-
for (const y of
|
|
5758
|
+
for (const E of N)
|
|
5759
|
+
for (const y of E.fields)
|
|
5755
5760
|
!y.isCustom && y.name && y.required && o.add(y.name);
|
|
5756
5761
|
return Array.from(o);
|
|
5757
5762
|
}, [d == null ? void 0 : d.applicantFormRequiredFields, N]), T = Le(() => {
|
|
5758
|
-
var
|
|
5763
|
+
var E;
|
|
5759
5764
|
if (N) {
|
|
5760
5765
|
const y = N.flatMap((v) => v.fields).filter((v) => !v.isCustom && v.name).map((v) => v.name), k = new Set(y);
|
|
5761
5766
|
for (const v of dt) k.add(v);
|
|
5762
5767
|
return Array.from(k);
|
|
5763
5768
|
}
|
|
5764
5769
|
let o;
|
|
5765
|
-
(
|
|
5770
|
+
(E = i.applicantForm) != null && E.visibleFields ? o = i.applicantForm.visibleFields : d != null && d.applicantFormVisibleFields && d.applicantFormVisibleFields.length > 0 ? o = d.applicantFormVisibleFields : o = er;
|
|
5766
5771
|
const c = new Set(o);
|
|
5767
5772
|
for (const y of dt) c.add(y);
|
|
5768
5773
|
return Array.from(c);
|
|
@@ -5774,7 +5779,7 @@ const st = {
|
|
|
5774
5779
|
"mobileCountryCode",
|
|
5775
5780
|
"otherNationality"
|
|
5776
5781
|
]), L = Le(() => {
|
|
5777
|
-
var c,
|
|
5782
|
+
var c, E;
|
|
5778
5783
|
const o = /* @__PURE__ */ new Set();
|
|
5779
5784
|
if (N)
|
|
5780
5785
|
for (const y of N)
|
|
@@ -5782,7 +5787,7 @@ const st = {
|
|
|
5782
5787
|
!k.isCustom && k.name && U.has(k.name) && o.add(k.countriesType ?? ((c = Ge[k.name]) == null ? void 0 : c.countriesType));
|
|
5783
5788
|
else
|
|
5784
5789
|
for (const y of T)
|
|
5785
|
-
U.has(y) && o.add((
|
|
5790
|
+
U.has(y) && o.add((E = Ge[y]) == null ? void 0 : E.countriesType);
|
|
5786
5791
|
return o.size === 0 && o.add(void 0), Array.from(o);
|
|
5787
5792
|
}, [T, N]), [$, X] = w({}), [se, j] = w(!0), O = ce(/* @__PURE__ */ new Set()), W = ce(/* @__PURE__ */ new Set());
|
|
5788
5793
|
ye(() => {
|
|
@@ -5824,10 +5829,10 @@ const st = {
|
|
|
5824
5829
|
}, [L, d]);
|
|
5825
5830
|
const Y = (o, c) => {
|
|
5826
5831
|
var k;
|
|
5827
|
-
const
|
|
5832
|
+
const E = c ?? ((k = Ge[o]) == null ? void 0 : k.countriesType), y = E != null ? String(E) : "all";
|
|
5828
5833
|
return $[y] || [];
|
|
5829
5834
|
}, z = Object.fromEntries(
|
|
5830
|
-
Object.entries(
|
|
5835
|
+
Object.entries(F).filter(([o]) => o in {
|
|
5831
5836
|
firstName: 1,
|
|
5832
5837
|
lastName: 1,
|
|
5833
5838
|
title: 1,
|
|
@@ -5856,7 +5861,7 @@ const st = {
|
|
|
5856
5861
|
firstName: "",
|
|
5857
5862
|
lastName: "",
|
|
5858
5863
|
title: "",
|
|
5859
|
-
email:
|
|
5864
|
+
email: I,
|
|
5860
5865
|
dateOfBirth: "",
|
|
5861
5866
|
phonenumber: "",
|
|
5862
5867
|
externalRefId: S,
|
|
@@ -5878,9 +5883,9 @@ const st = {
|
|
|
5878
5883
|
taxNumber: "",
|
|
5879
5884
|
...z
|
|
5880
5885
|
}), D = Object.fromEntries(
|
|
5881
|
-
Object.entries(
|
|
5882
|
-
), [V, ee] = w({ ...D }), [oe, R] = w(0), [K, te] = w({}), [fe, de] = w(null), [P, Q] = w(!1), ae = (o, c) => B((
|
|
5883
|
-
var
|
|
5886
|
+
Object.entries(F).filter(([o]) => !(o in z) && o !== "externalRefId" && o !== "workflowKey")
|
|
5887
|
+
), [V, ee] = w({ ...D }), [oe, R] = w(0), [K, te] = w({}), [fe, de] = w(null), [P, Q] = w(!1), ae = (o, c) => B((E) => ({ ...E, [o]: c })), ue = (o, c) => ee((E) => ({ ...E, [o]: c })), Ne = (o) => !o.conditionalOn || V[o.conditionalOn] === "true", De = N && oe < N.length - 1 ? oe + 1 : -1, xe = N && oe > 0 ? oe - 1 : -1, Je = (o) => {
|
|
5888
|
+
var E;
|
|
5884
5889
|
const c = {};
|
|
5885
5890
|
for (const y of o.fields)
|
|
5886
5891
|
if (y.isCustom) {
|
|
@@ -5892,7 +5897,7 @@ const st = {
|
|
|
5892
5897
|
} else if (y.name) {
|
|
5893
5898
|
const k = y.name;
|
|
5894
5899
|
if (M.includes(k) && rt(H[k])) {
|
|
5895
|
-
const v = y.displayText || ((
|
|
5900
|
+
const v = y.displayText || ((E = Ge[k]) == null ? void 0 : E.label) || k;
|
|
5896
5901
|
c[k] = `${v} is required.`;
|
|
5897
5902
|
}
|
|
5898
5903
|
}
|
|
@@ -5966,9 +5971,9 @@ const st = {
|
|
|
5966
5971
|
}
|
|
5967
5972
|
for (const [k, v] of Object.entries(z))
|
|
5968
5973
|
o[k] === void 0 && !rt(v) && (o[k] = v);
|
|
5969
|
-
const
|
|
5974
|
+
const E = new Set(c.map((k) => k.paramName));
|
|
5970
5975
|
for (const [k, v] of Object.entries(D))
|
|
5971
|
-
!
|
|
5976
|
+
!E.has(k) && v && c.push({ paramName: k, value: v });
|
|
5972
5977
|
c.length > 0 && (o.applicantAdditionalDatas = c);
|
|
5973
5978
|
const y = await m(o);
|
|
5974
5979
|
a(y.applicantId);
|
|
@@ -5980,18 +5985,18 @@ const st = {
|
|
|
5980
5985
|
}, Xe = async (o) => {
|
|
5981
5986
|
var c;
|
|
5982
5987
|
o.preventDefault();
|
|
5983
|
-
for (const
|
|
5984
|
-
if (rt(H[
|
|
5985
|
-
const y = ((c = Ge[
|
|
5988
|
+
for (const E of M)
|
|
5989
|
+
if (rt(H[E])) {
|
|
5990
|
+
const y = ((c = Ge[E]) == null ? void 0 : c.label) || E;
|
|
5986
5991
|
de(`${y} is required.`);
|
|
5987
5992
|
return;
|
|
5988
5993
|
}
|
|
5989
5994
|
await Me();
|
|
5990
|
-
}, He = (o, c,
|
|
5995
|
+
}, He = (o, c, E, y, k) => {
|
|
5991
5996
|
var bt;
|
|
5992
5997
|
const v = Ge[o];
|
|
5993
5998
|
if (!v) return null;
|
|
5994
|
-
const le = M.includes(o), ne = K[o], ve =
|
|
5999
|
+
const le = M.includes(o), ne = K[o], ve = E || v.label, he = c ?? o, me = { required: le }, Oe = k ? k !== "placeholder" : f, Ue = Oe ? ve : void 0, Dt = Oe ? "..." : ve;
|
|
5995
6000
|
switch (v.type) {
|
|
5996
6001
|
case "select":
|
|
5997
6002
|
if (o === "country" || o === "nationality" || o === "taxCountry" || o === "countryOfBirth" || o === "mobileCountryCode") {
|
|
@@ -6120,7 +6125,7 @@ const st = {
|
|
|
6120
6125
|
);
|
|
6121
6126
|
}
|
|
6122
6127
|
}, qe = (o, c) => {
|
|
6123
|
-
const
|
|
6128
|
+
const E = o.labelMode ? o.labelMode !== "placeholder" : f;
|
|
6124
6129
|
if (o.customType === "paragraph") {
|
|
6125
6130
|
const v = o.displayText || o.label || "";
|
|
6126
6131
|
return /* @__PURE__ */ r(
|
|
@@ -6258,7 +6263,7 @@ const st = {
|
|
|
6258
6263
|
if (o.customType === "group_checkbox") {
|
|
6259
6264
|
const v = (V[o.paramName] || "").split(",").filter(Boolean);
|
|
6260
6265
|
return /* @__PURE__ */ s("div", { className: "flex flex-col gap-1.5", children: [
|
|
6261
|
-
|
|
6266
|
+
E && /* @__PURE__ */ s(
|
|
6262
6267
|
"div",
|
|
6263
6268
|
{
|
|
6264
6269
|
className: "text-sm font-medium",
|
|
@@ -6311,7 +6316,7 @@ const st = {
|
|
|
6311
6316
|
] }, `custom-${c}`);
|
|
6312
6317
|
}
|
|
6313
6318
|
return o.customType === "radio_group" ? /* @__PURE__ */ s("div", { className: "flex flex-col gap-1.5", children: [
|
|
6314
|
-
|
|
6319
|
+
E && /* @__PURE__ */ s(
|
|
6315
6320
|
"div",
|
|
6316
6321
|
{
|
|
6317
6322
|
className: "text-sm font-medium",
|
|
@@ -6356,8 +6361,8 @@ const st = {
|
|
|
6356
6361
|
ge,
|
|
6357
6362
|
{
|
|
6358
6363
|
type: "text",
|
|
6359
|
-
label:
|
|
6360
|
-
placeholder:
|
|
6364
|
+
label: E ? `${k}${o.required ? " *" : ""}` : void 0,
|
|
6365
|
+
placeholder: E ? void 0 : k,
|
|
6361
6366
|
value: V[o.paramName] || "",
|
|
6362
6367
|
onChange: (v) => ue(o.paramName, v.target.value),
|
|
6363
6368
|
required: o.required,
|
|
@@ -6366,7 +6371,7 @@ const st = {
|
|
|
6366
6371
|
`custom-${c}`
|
|
6367
6372
|
);
|
|
6368
6373
|
}, h = (o, c) => {
|
|
6369
|
-
const
|
|
6374
|
+
const E = Ne(o);
|
|
6370
6375
|
return /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
6371
6376
|
o.conditionalOn && /* @__PURE__ */ r(Ct, { helpText: o.conditionalHelpText, children: /* @__PURE__ */ s(
|
|
6372
6377
|
"label",
|
|
@@ -6378,7 +6383,7 @@ const st = {
|
|
|
6378
6383
|
"input",
|
|
6379
6384
|
{
|
|
6380
6385
|
type: "checkbox",
|
|
6381
|
-
checked:
|
|
6386
|
+
checked: E,
|
|
6382
6387
|
onChange: (y) => ue(o.conditionalOn, y.target.checked ? "true" : "false"),
|
|
6383
6388
|
className: "metakyc-option-input",
|
|
6384
6389
|
style: st
|
|
@@ -6395,7 +6400,7 @@ const st = {
|
|
|
6395
6400
|
]
|
|
6396
6401
|
}
|
|
6397
6402
|
) }),
|
|
6398
|
-
|
|
6403
|
+
E && /* @__PURE__ */ r("div", { className: "grid grid-cols-4 gap-4", children: o.fields.map((y, k) => {
|
|
6399
6404
|
const v = y.colSpan === 1 ? "col-span-1" : y.colSpan === 2 ? "col-span-2" : y.colSpan === 3 ? "col-span-3" : "col-span-4", le = y.isCustom ? `custom-${k}-${y.paramName}` : `builtin-${y.name}-${k}`;
|
|
6400
6405
|
return /* @__PURE__ */ r("div", { className: v, children: /* @__PURE__ */ r(Ct, { helpText: y.helpText, children: y.isCustom ? qe(y, k) : He(y.name, le, y.displayText, y.countriesType, y.labelMode) }) }, le);
|
|
6401
6406
|
}) })
|
|
@@ -6407,7 +6412,7 @@ const st = {
|
|
|
6407
6412
|
/* @__PURE__ */ r("p", { className: "text-center mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)", fontSize: "0.875rem" }, children: "Loading form…" })
|
|
6408
6413
|
] }) }) });
|
|
6409
6414
|
if (N) {
|
|
6410
|
-
const o = N[oe] ?? N[0], c = xe === -1,
|
|
6415
|
+
const o = N[oe] ?? N[0], c = xe === -1, E = De === -1, y = N.length, k = Ne(o), v = Object.values(K);
|
|
6411
6416
|
return /* @__PURE__ */ r("div", { className: "metakyc-sdk", children: /* @__PURE__ */ s(G, { children: [
|
|
6412
6417
|
/* @__PURE__ */ r(be, { children: /* @__PURE__ */ r(lt, { title: (d == null ? void 0 : d.title) || "Create Applicant" }) }),
|
|
6413
6418
|
/* @__PURE__ */ s(J, { children: [
|
|
@@ -6483,8 +6488,8 @@ const st = {
|
|
|
6483
6488
|
{
|
|
6484
6489
|
type: "button",
|
|
6485
6490
|
isLoading: P || g,
|
|
6486
|
-
onClick:
|
|
6487
|
-
children:
|
|
6491
|
+
onClick: E ? Me : Ze,
|
|
6492
|
+
children: E ? o.conditionalOn && !k ? "Skip & Submit" : "Submit" : o.conditionalOn && !k ? "Skip" : "Next"
|
|
6488
6493
|
}
|
|
6489
6494
|
)
|
|
6490
6495
|
] })
|
|
@@ -6505,7 +6510,7 @@ const st = {
|
|
|
6505
6510
|
/* @__PURE__ */ r(Z, { type: "submit", isLoading: P || g, children: "Create Applicant" })
|
|
6506
6511
|
] })
|
|
6507
6512
|
] }) }) });
|
|
6508
|
-
},
|
|
6513
|
+
}, Ft = ["companyName", "email"];
|
|
6509
6514
|
function yt(e) {
|
|
6510
6515
|
return e == null || e === "" || Array.isArray(e) && e.length === 0;
|
|
6511
6516
|
}
|
|
@@ -6516,16 +6521,16 @@ const Oa = ({
|
|
|
6516
6521
|
onCancel: n
|
|
6517
6522
|
}) => {
|
|
6518
6523
|
var He, qe, h, _, q;
|
|
6519
|
-
const { config: i, baseInformationService: l, currentTheme: d } =
|
|
6524
|
+
const { config: i, baseInformationService: l, currentTheme: d } = Ee(), { createCompanyApplicant: m, isLoading: g } = At(), p = e || ((He = i.applicantForm) == null ? void 0 : He.workflowKey);
|
|
6520
6525
|
if (!p)
|
|
6521
6526
|
throw new Error(
|
|
6522
6527
|
"workflowKey is required. Provide it either as a prop to CreateCompanyApplicantForm or set it in config.applicantForm.workflowKey"
|
|
6523
6528
|
);
|
|
6524
|
-
const S = t || ((qe = i.applicantForm) == null ? void 0 : qe.externalRefId) || "",
|
|
6529
|
+
const S = t || ((qe = i.applicantForm) == null ? void 0 : qe.externalRefId) || "", I = ((h = i.applicantForm) == null ? void 0 : h.email) || "", A = (((_ = i.applicantForm) == null ? void 0 : _.fieldLabelMode) || (d == null ? void 0 : d.fieldLabelMode) || "label") !== "placeholder", f = Le(
|
|
6525
6530
|
() => d != null && d.companyFormPages && d.companyFormPages.length > 0 ? d.companyFormPages : null,
|
|
6526
6531
|
[d == null ? void 0 : d.companyFormPages]
|
|
6527
6532
|
), N = Le(() => {
|
|
6528
|
-
const u = new Set(
|
|
6533
|
+
const u = new Set(Ft), x = d == null ? void 0 : d.companyFormRequiredFields;
|
|
6529
6534
|
if (x) for (const C of x) u.add(C);
|
|
6530
6535
|
if (f)
|
|
6531
6536
|
for (const C of f)
|
|
@@ -6536,7 +6541,7 @@ const Oa = ({
|
|
|
6536
6541
|
var u;
|
|
6537
6542
|
if (f) {
|
|
6538
6543
|
const x = f.flatMap((b) => b.fields).filter((b) => !b.isCustom && b.name).map((b) => b.name), C = new Set(x);
|
|
6539
|
-
for (const b of
|
|
6544
|
+
for (const b of Ft) C.add(b);
|
|
6540
6545
|
return Array.from(C);
|
|
6541
6546
|
}
|
|
6542
6547
|
return (u = i.applicantForm) != null && u.visibleFields ? i.applicantForm.visibleFields : d != null && d.companyFormVisibleFields && d.companyFormVisibleFields.length > 0 ? d.companyFormVisibleFields : Xt;
|
|
@@ -6568,7 +6573,7 @@ const Oa = ({
|
|
|
6568
6573
|
try {
|
|
6569
6574
|
const b = await Promise.all(
|
|
6570
6575
|
u.map(async (o) => {
|
|
6571
|
-
const c = o != null ? String(o) : "all",
|
|
6576
|
+
const c = o != null ? String(o) : "all", E = await l.getCountries("", i.locale || "en", o), y = /* @__PURE__ */ new Set(), k = E.map((v) => ({ value: v.abbreviation3 || v.abbreviation, label: v.name })).filter((v) => !v.value || y.has(v.value) ? !1 : (y.add(v.value), !0));
|
|
6572
6577
|
return O.current.add(c), j.current.delete(c), [c, k];
|
|
6573
6578
|
})
|
|
6574
6579
|
);
|
|
@@ -6587,7 +6592,7 @@ const Oa = ({
|
|
|
6587
6592
|
}, [Y, z] = w({
|
|
6588
6593
|
workflowKey: p,
|
|
6589
6594
|
companyName: "",
|
|
6590
|
-
email:
|
|
6595
|
+
email: I,
|
|
6591
6596
|
phone: "",
|
|
6592
6597
|
registrationNumber: "",
|
|
6593
6598
|
countryResidence: "",
|
|
@@ -6655,35 +6660,35 @@ const Oa = ({
|
|
|
6655
6660
|
externalRefId: ((u = Y.externalRefId) == null ? void 0 : u.trim()) || void 0
|
|
6656
6661
|
}, C = f ? f.filter((c) => Q(c)).flatMap((c) => c.fields).filter((c) => !c.isCustom && c.name).map((c) => c.name) : M;
|
|
6657
6662
|
for (const c of C) {
|
|
6658
|
-
const
|
|
6659
|
-
if (!yt(
|
|
6663
|
+
const E = Y[c];
|
|
6664
|
+
if (!yt(E))
|
|
6660
6665
|
switch (c) {
|
|
6661
6666
|
case "companyName":
|
|
6662
|
-
x.companyName =
|
|
6667
|
+
x.companyName = E;
|
|
6663
6668
|
break;
|
|
6664
6669
|
case "email":
|
|
6665
|
-
x.companyEmail =
|
|
6670
|
+
x.companyEmail = E;
|
|
6666
6671
|
break;
|
|
6667
6672
|
case "phone":
|
|
6668
|
-
x.companyPhone =
|
|
6673
|
+
x.companyPhone = E;
|
|
6669
6674
|
break;
|
|
6670
6675
|
case "registrationNumber":
|
|
6671
|
-
x.companyRegistrationNumber =
|
|
6676
|
+
x.companyRegistrationNumber = E;
|
|
6672
6677
|
break;
|
|
6673
6678
|
case "countryResidence":
|
|
6674
|
-
x.companyCountry =
|
|
6679
|
+
x.companyCountry = E;
|
|
6675
6680
|
break;
|
|
6676
6681
|
case "city":
|
|
6677
|
-
x.companyCity =
|
|
6682
|
+
x.companyCity = E;
|
|
6678
6683
|
break;
|
|
6679
6684
|
case "street":
|
|
6680
|
-
x.companyStreet =
|
|
6685
|
+
x.companyStreet = E;
|
|
6681
6686
|
break;
|
|
6682
6687
|
case "postalCode":
|
|
6683
|
-
x.companyZip =
|
|
6688
|
+
x.companyZip = E;
|
|
6684
6689
|
break;
|
|
6685
6690
|
default:
|
|
6686
|
-
x[c] =
|
|
6691
|
+
x[c] = E;
|
|
6687
6692
|
break;
|
|
6688
6693
|
}
|
|
6689
6694
|
}
|
|
@@ -6691,14 +6696,14 @@ const Oa = ({
|
|
|
6691
6696
|
if (f) {
|
|
6692
6697
|
for (const c of f)
|
|
6693
6698
|
if (Q(c))
|
|
6694
|
-
for (const
|
|
6695
|
-
if (!
|
|
6696
|
-
const y = H[
|
|
6699
|
+
for (const E of c.fields) {
|
|
6700
|
+
if (!E.isCustom || !E.paramName || E.customType === "paragraph" || E.customType === "html" || E.customType === "br" || E.customType === "link") continue;
|
|
6701
|
+
const y = H[E.paramName] ?? "";
|
|
6697
6702
|
let k;
|
|
6698
|
-
if (
|
|
6703
|
+
if (E.customType === "checkbox" || E.customType === "link_checkbox")
|
|
6699
6704
|
k = y === "true" ? "yes" : "no";
|
|
6700
|
-
else if (k = y, !k && !
|
|
6701
|
-
b.push({ paramName:
|
|
6705
|
+
else if (k = y, !k && !E.required) continue;
|
|
6706
|
+
b.push({ paramName: E.paramName, value: k });
|
|
6702
6707
|
}
|
|
6703
6708
|
}
|
|
6704
6709
|
b.length > 0 && (x.applicantAdditionalDatas = b);
|
|
@@ -6722,7 +6727,7 @@ const Oa = ({
|
|
|
6722
6727
|
}, Ze = (u, x, C, b, o) => {
|
|
6723
6728
|
const c = et[u];
|
|
6724
6729
|
if (!c) return null;
|
|
6725
|
-
const
|
|
6730
|
+
const E = N.includes(u), y = ee[u], k = C || c.label, v = x ?? u, le = o ? o !== "placeholder" : A, ne = le ? k : void 0, ve = le ? "..." : k;
|
|
6726
6731
|
switch (c.type) {
|
|
6727
6732
|
case "select":
|
|
6728
6733
|
if (u === "countryResidence" || u === "addressCountry") {
|
|
@@ -6730,7 +6735,7 @@ const Oa = ({
|
|
|
6730
6735
|
return /* @__PURE__ */ r(
|
|
6731
6736
|
_e,
|
|
6732
6737
|
{
|
|
6733
|
-
required:
|
|
6738
|
+
required: E,
|
|
6734
6739
|
label: ne,
|
|
6735
6740
|
value: Y[u] || "",
|
|
6736
6741
|
onChange: (me) => de(u, me),
|
|
@@ -6746,7 +6751,7 @@ const Oa = ({
|
|
|
6746
6751
|
return /* @__PURE__ */ r(
|
|
6747
6752
|
ge,
|
|
6748
6753
|
{
|
|
6749
|
-
required:
|
|
6754
|
+
required: E,
|
|
6750
6755
|
type: "date",
|
|
6751
6756
|
label: ne,
|
|
6752
6757
|
placeholder: le ? void 0 : k,
|
|
@@ -6760,7 +6765,7 @@ const Oa = ({
|
|
|
6760
6765
|
return /* @__PURE__ */ r(
|
|
6761
6766
|
ge,
|
|
6762
6767
|
{
|
|
6763
|
-
required:
|
|
6768
|
+
required: E,
|
|
6764
6769
|
type: "email",
|
|
6765
6770
|
label: ne,
|
|
6766
6771
|
placeholder: le ? void 0 : k,
|
|
@@ -6774,7 +6779,7 @@ const Oa = ({
|
|
|
6774
6779
|
return /* @__PURE__ */ r(
|
|
6775
6780
|
ge,
|
|
6776
6781
|
{
|
|
6777
|
-
required:
|
|
6782
|
+
required: E,
|
|
6778
6783
|
type: "tel",
|
|
6779
6784
|
label: ne,
|
|
6780
6785
|
placeholder: le ? void 0 : k,
|
|
@@ -6788,7 +6793,7 @@ const Oa = ({
|
|
|
6788
6793
|
return /* @__PURE__ */ r(
|
|
6789
6794
|
ge,
|
|
6790
6795
|
{
|
|
6791
|
-
required:
|
|
6796
|
+
required: E,
|
|
6792
6797
|
type: "text",
|
|
6793
6798
|
label: ne,
|
|
6794
6799
|
placeholder: le ? void 0 : k,
|
|
@@ -6825,7 +6830,7 @@ const Oa = ({
|
|
|
6825
6830
|
}
|
|
6826
6831
|
) }, `custom-${x}`);
|
|
6827
6832
|
if (!u.paramName) return null;
|
|
6828
|
-
const C = ee[u.paramName], b = u.displayText || u.label || u.paramName, o = u.labelMode ? u.labelMode !== "placeholder" :
|
|
6833
|
+
const C = ee[u.paramName], b = u.displayText || u.label || u.paramName, o = u.labelMode ? u.labelMode !== "placeholder" : A;
|
|
6829
6834
|
return u.customType === "checkbox" ? /* @__PURE__ */ s("div", { className: "flex flex-col gap-1", children: [
|
|
6830
6835
|
/* @__PURE__ */ s("label", { style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer" }, children: [
|
|
6831
6836
|
/* @__PURE__ */ r(
|
|
@@ -6897,10 +6902,10 @@ const Oa = ({
|
|
|
6897
6902
|
" ",
|
|
6898
6903
|
R
|
|
6899
6904
|
] }),
|
|
6900
|
-
c.map((
|
|
6905
|
+
c.map((E, y) => /* @__PURE__ */ r("p", { className: "text-red-600 text-sm", children: E }, y))
|
|
6901
6906
|
] }),
|
|
6902
6907
|
b > 1 && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-4", children: [
|
|
6903
|
-
f.map((
|
|
6908
|
+
f.map((E, y) => /* @__PURE__ */ r(
|
|
6904
6909
|
"div",
|
|
6905
6910
|
{
|
|
6906
6911
|
className: `h-1.5 rounded-full transition-all ${y === D ? "flex-1" : "w-8"}`,
|
|
@@ -6965,28 +6970,28 @@ const Oa = ({
|
|
|
6965
6970
|
workflowKey: g,
|
|
6966
6971
|
nextWorkflowKey: p,
|
|
6967
6972
|
hasWorkflowChanged: S,
|
|
6968
|
-
isLoading:
|
|
6969
|
-
error:
|
|
6970
|
-
moveBack:
|
|
6973
|
+
isLoading: I,
|
|
6974
|
+
error: F,
|
|
6975
|
+
moveBack: A,
|
|
6971
6976
|
refreshProgress: f
|
|
6972
|
-
} = Mr(e), [N, M] =
|
|
6973
|
-
if (
|
|
6974
|
-
|
|
6975
|
-
}, [
|
|
6977
|
+
} = Mr(e), [N, M] = Ae.useState(!1);
|
|
6978
|
+
if (Ae.useEffect(() => {
|
|
6979
|
+
F && a && a(F);
|
|
6980
|
+
}, [F, a]), Ae.useEffect(() => {
|
|
6976
6981
|
l != null && l.workflowResult && t && t(l.workflowResult);
|
|
6977
|
-
}, [l == null ? void 0 : l.workflowResult, t]),
|
|
6982
|
+
}, [l == null ? void 0 : l.workflowResult, t]), Ae.useEffect(() => {
|
|
6978
6983
|
n === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
6979
|
-
}, [n]),
|
|
6984
|
+
}, [n]), Ae.useEffect(() => {
|
|
6980
6985
|
S && M(!1);
|
|
6981
|
-
}, [S]),
|
|
6986
|
+
}, [S]), I || !l)
|
|
6982
6987
|
return /* @__PURE__ */ r("div", { className: `metakyc-sdk ${i || ""}`, children: /* @__PURE__ */ r(G, { children: /* @__PURE__ */ s(J, { children: [
|
|
6983
6988
|
/* @__PURE__ */ r(Re, { className: "my-8" }),
|
|
6984
6989
|
/* @__PURE__ */ r("p", { className: "text-center mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: "Loading workflow..." })
|
|
6985
6990
|
] }) }) });
|
|
6986
|
-
if (
|
|
6991
|
+
if (F)
|
|
6987
6992
|
return /* @__PURE__ */ r("div", { className: `metakyc-sdk ${i || ""}`, children: /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ s("div", { className: "text-center py-8", children: [
|
|
6988
6993
|
/* @__PURE__ */ r("p", { className: "text-lg mb-4", style: { color: "var(--metakyc-danger, #ef4444)" }, children: "An error occurred" }),
|
|
6989
|
-
/* @__PURE__ */ r("p", { style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children:
|
|
6994
|
+
/* @__PURE__ */ r("p", { style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: F.message })
|
|
6990
6995
|
] }) }) }) });
|
|
6991
6996
|
if (S && !N)
|
|
6992
6997
|
return /* @__PURE__ */ r("div", { className: `metakyc-sdk ${i || ""}`, children: /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ s("div", { className: "text-center py-8", children: [
|
|
@@ -7073,7 +7078,7 @@ const Oa = ({
|
|
|
7073
7078
|
] }),
|
|
7074
7079
|
/* @__PURE__ */ r("div", { className: "flex items-center", children: $.map((O, W) => {
|
|
7075
7080
|
const Y = W < X, z = O.order === d.order, H = Y || z;
|
|
7076
|
-
return /* @__PURE__ */ s(
|
|
7081
|
+
return /* @__PURE__ */ s(Ae.Fragment, { children: [
|
|
7077
7082
|
/* @__PURE__ */ s("div", { className: "flex items-center", children: [
|
|
7078
7083
|
/* @__PURE__ */ r(
|
|
7079
7084
|
"div",
|
|
@@ -7121,7 +7126,7 @@ const Oa = ({
|
|
|
7121
7126
|
onComplete: async () => {
|
|
7122
7127
|
await f();
|
|
7123
7128
|
},
|
|
7124
|
-
onBack: d.order > 0 ?
|
|
7129
|
+
onBack: d.order > 0 ? A : void 0
|
|
7125
7130
|
};
|
|
7126
7131
|
switch (d.action) {
|
|
7127
7132
|
case ie.Questionaries:
|
|
@@ -7263,9 +7268,9 @@ export {
|
|
|
7263
7268
|
St as KycStatusDisplay,
|
|
7264
7269
|
$a as KycWorkflow,
|
|
7265
7270
|
ga as Logo,
|
|
7266
|
-
|
|
7271
|
+
It as MetaKYCContext,
|
|
7267
7272
|
$e as MetaKYCError,
|
|
7268
|
-
|
|
7273
|
+
Ia as MetaKYCProvider,
|
|
7269
7274
|
jr as MultiSelect,
|
|
7270
7275
|
Cr as OnfidoProvider,
|
|
7271
7276
|
lr as OverviewService,
|
|
@@ -7278,14 +7283,14 @@ export {
|
|
|
7278
7283
|
jt as RiskLevel,
|
|
7279
7284
|
cr as RiskScoringService,
|
|
7280
7285
|
ua as RiskScoringStep,
|
|
7281
|
-
|
|
7286
|
+
Fr as SardinAIProvider,
|
|
7282
7287
|
_e as SearchableSelect,
|
|
7283
7288
|
ft as Select,
|
|
7284
7289
|
Re as Spinner,
|
|
7285
7290
|
wr as StepRouter,
|
|
7286
7291
|
Sr as SumsubProvider,
|
|
7287
|
-
|
|
7288
|
-
|
|
7292
|
+
Ir as ThemeManager,
|
|
7293
|
+
Fe as ThemePreset,
|
|
7289
7294
|
xr as ThemeService,
|
|
7290
7295
|
sr as UploadDocumentService,
|
|
7291
7296
|
aa as UploadDocumentStep,
|
|
@@ -7302,8 +7307,8 @@ export {
|
|
|
7302
7307
|
we as cn,
|
|
7303
7308
|
pr as corporateTheme,
|
|
7304
7309
|
tr as defaultConfig,
|
|
7305
|
-
|
|
7306
|
-
|
|
7310
|
+
Ie as defaultTheme,
|
|
7311
|
+
Ar as fileToBase64,
|
|
7307
7312
|
yr as fintechTheme,
|
|
7308
7313
|
pt as formatFileSize,
|
|
7309
7314
|
Ha as generateAppropriatenessSchema,
|
|
@@ -7315,24 +7320,24 @@ export {
|
|
|
7315
7320
|
it as getThemePreset,
|
|
7316
7321
|
Ta as getWorkflowState,
|
|
7317
7322
|
hr as healthcareTheme,
|
|
7318
|
-
|
|
7319
|
-
|
|
7323
|
+
Fa as isScriptLoaded,
|
|
7324
|
+
Et as loadScript,
|
|
7320
7325
|
fr as minimalTheme,
|
|
7321
7326
|
gr as modernTheme,
|
|
7322
|
-
|
|
7327
|
+
Ea as removeScript,
|
|
7323
7328
|
Rr as saveApplicantId,
|
|
7324
7329
|
Lr as saveWorkflowState,
|
|
7325
7330
|
br as themePresets,
|
|
7326
|
-
|
|
7331
|
+
At as useApplicant,
|
|
7327
7332
|
Da as useAppropriatenessTest,
|
|
7328
7333
|
_r as useIdentityVerification,
|
|
7329
7334
|
Mr as useKycWorkflow,
|
|
7330
|
-
|
|
7335
|
+
Ee as useMetaKYC,
|
|
7331
7336
|
Br as useOverview,
|
|
7332
7337
|
Or as useQuestionnaire,
|
|
7333
7338
|
zr as useRiskScoring,
|
|
7334
7339
|
$r as useUploadDocument,
|
|
7335
|
-
|
|
7340
|
+
Aa as validateFileSize,
|
|
7336
7341
|
Ra as validateFileType
|
|
7337
7342
|
};
|
|
7338
7343
|
//# sourceMappingURL=index.js.map
|