@vpdev2/metakyc-sdk 1.0.5 → 1.0.7
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/components/Header.d.ts.map +1 -1
- package/dist/components/identity/IdentityVerificationStep.d.ts.map +1 -1
- package/dist/context/MetaKYCContext.d.ts +2 -0
- package/dist/context/MetaKYCContext.d.ts.map +1 -1
- package/dist/context/MetaKYCProvider.d.ts.map +1 -1
- package/dist/hooks/useIdentityVerification.d.ts.map +1 -1
- package/dist/hooks/useKycWorkflow.d.ts.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +489 -465
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@ var Je = Object.defineProperty;
|
|
|
2
2
|
var Xe = (t, e, r) => e in t ? Je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var K = (t, e, r) => Xe(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import et from "axios";
|
|
5
|
-
import * as
|
|
6
|
-
import le, { createContext as tt, useMemo as
|
|
5
|
+
import * as Te from "react";
|
|
6
|
+
import le, { createContext as tt, useState as x, useMemo as je, useEffect as V, useContext as rt, useRef as ve, useCallback as q, forwardRef as Pe } from "react";
|
|
7
7
|
import { jsx as n, jsxs as o, Fragment as nt } from "react/jsx-runtime";
|
|
8
|
-
import { get as
|
|
8
|
+
import { get as Ie, set as Ae, appendErrors as _e, useForm as Fe, Controller as G } from "react-hook-form";
|
|
9
9
|
import { z as de } from "zod";
|
|
10
|
-
var U = /* @__PURE__ */ ((t) => (t[t.IdentitySdk = 0] = "IdentitySdk", t[t.RiskScoring = 1] = "RiskScoring", t[t.Questionaries = 2] = "Questionaries", t[t.AdditionalData = 3] = "AdditionalData", t[t.AppropriatenessTest = 4] = "AppropriatenessTest", t[t.UploadDocument = 5] = "UploadDocument", t[t.ManualReview = 6] = "ManualReview", t[t.Overview = 7] = "Overview", t[t.InvestorCategorization = 8] = "InvestorCategorization", t))(U || {}),
|
|
10
|
+
var U = /* @__PURE__ */ ((t) => (t[t.IdentitySdk = 0] = "IdentitySdk", t[t.RiskScoring = 1] = "RiskScoring", t[t.Questionaries = 2] = "Questionaries", t[t.AdditionalData = 3] = "AdditionalData", t[t.AppropriatenessTest = 4] = "AppropriatenessTest", t[t.UploadDocument = 5] = "UploadDocument", t[t.ManualReview = 6] = "ManualReview", t[t.Overview = 7] = "Overview", t[t.InvestorCategorization = 8] = "InvestorCategorization", t))(U || {}), ke = /* @__PURE__ */ ((t) => (t[t.NotStarted = 0] = "NotStarted", t[t.InProgress = 1] = "InProgress", t[t.Success = 2] = "Success", t[t.PartialSuccess = 3] = "PartialSuccess", t[t.Failed = 4] = "Failed", t[t.Skipped = 5] = "Skipped", t[t.AdminReview = 6] = "AdminReview", t[t.SkippedAndAdminReview = 7] = "SkippedAndAdminReview", t))(ke || {}), ae = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.InProgress = 1] = "InProgress", t[t.Finished = 2] = "Finished", t[t.OnHold = 3] = "OnHold", t[t.IdentityPending = 4] = "IdentityPending", t))(ae || {}), st = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.RepresentativeKYC = 1] = "RepresentativeKYC", t[t.ManualRiskCriteria = 2] = "ManualRiskCriteria", t[t.UploadDocumentReview = 3] = "UploadDocumentReview", t[t.AdminReview = 4] = "AdminReview", t))(st || {}), at = /* @__PURE__ */ ((t) => (t[t.LowRisk = 0] = "LowRisk", t[t.MediumRisk = 1] = "MediumRisk", t[t.HighRisk = 2] = "HighRisk", t[t.Alert = 3] = "Alert", t))(at || {}), he = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Pending = 1] = "Pending", t[t.Approved = 2] = "Approved", t[t.Rejected = 3] = "Rejected", t[t.ResendRequested = 4] = "ResendRequested", t[t.Unknown = 5] = "Unknown", t[t.InProgress = 6] = "InProgress", t))(he || {}), pe = /* @__PURE__ */ ((t) => (t[t.Approved = 0] = "Approved", t[t.Reject = 1] = "Reject", t[t.UnderReview = 2] = "UnderReview", t[t.Closed = 3] = "Closed", t[t.AdminReview = 4] = "AdminReview", t[t.New = 5] = "New", t[t.InProgress = 6] = "InProgress", t))(pe || {}), it = /* @__PURE__ */ ((t) => (t[t.ProviderResultPending = 0] = "ProviderResultPending", t[t.ProviderResultReceived = 1] = "ProviderResultReceived", t[t.Canceled = 2] = "Canceled", t[t.ExtendedToNewApplicant = 3] = "ExtendedToNewApplicant", t))(it || {}), ot = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.ProviderResultPending = 1] = "ProviderResultPending", t[t.ProviderResultReceived = 2] = "ProviderResultReceived", t[t.Canceled = 3] = "Canceled", t))(ot || {}), se = /* @__PURE__ */ ((t) => (t[t.Onfido = 0] = "Onfido", t[t.Sumsub = 2] = "Sumsub", t[t.SardinAI = 3] = "SardinAI", t))(se || {}), lt = /* @__PURE__ */ ((t) => (t[t.Individual = 0] = "Individual", t[t.Company = 1] = "Company", t))(lt || {}), Ne = /* @__PURE__ */ ((t) => (t[t.Male = 0] = "Male", t[t.Female = 1] = "Female", t[t.Other = 2] = "Other", t))(Ne || {}), ct = /* @__PURE__ */ ((t) => (t[t.Image = 0] = "Image", t[t.Video = 1] = "Video", t[t.PDF = 2] = "PDF", t[t.OfficePDF = 3] = "OfficePDF", t[t.Custom = 4] = "Custom", t))(ct || {}), dt = /* @__PURE__ */ ((t) => (t[t.Pending = 0] = "Pending", t[t.Approved = 1] = "Approved", t[t.Rejected = 2] = "Rejected", t[t.RequiresRevision = 3] = "RequiresRevision", t))(dt || {}), ut = /* @__PURE__ */ ((t) => (t[t.SingleChoice = 0] = "SingleChoice", t[t.MultipleChoice = 1] = "MultipleChoice", t[t.Text = 2] = "Text", t))(ut || {}), Re = /* @__PURE__ */ ((t) => (t[t.String = 0] = "String", t[t.Integer = 1] = "Integer", t[t.Decimal = 2] = "Decimal", t[t.Boolean = 3] = "Boolean", t[t.Date = 4] = "Date", t[t.Country = 5] = "Country", t[t.DigitOnly = 6] = "DigitOnly", t))(Re || {}), mt = /* @__PURE__ */ ((t) => (t[t.Text = 0] = "Text", t[t.Radio = 1] = "Radio", t[t.Checkbox = 2] = "Checkbox", t[t.Dropdown = 3] = "Dropdown", t[t.Country = 4] = "Country", t))(mt || {}), ht = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Country = 1] = "Country", t))(ht || {}), ee = /* @__PURE__ */ ((t) => (t[t.Individual = 0] = "Individual", t[t.Sophisticated = 1] = "Sophisticated", t[t.HighNetWorth = 2] = "HighNetWorth", t[t.Business = 3] = "Business", t))(ee || {}), pt = /* @__PURE__ */ ((t) => (t[t.Retail = 0] = "Retail", t[t.Professional = 1] = "Professional", t[t.EligibleCounterparty = 2] = "EligibleCounterparty", t))(pt || {});
|
|
11
11
|
const gt = [
|
|
12
12
|
"firstName",
|
|
13
13
|
"lastName",
|
|
@@ -1776,49 +1776,57 @@ class Ut {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
const Ue = tt(null), Or = ({ config: t, children: e }) => {
|
|
1779
|
-
const r =
|
|
1780
|
-
const
|
|
1779
|
+
const [r, s] = x(null), a = le.useRef(!1), i = je(() => {
|
|
1780
|
+
const c = new xt(t), l = new vt(c), d = new wt(c), u = new kt(c), g = new Nt(c), p = new St(c), m = new Ct(c), v = new At(c), b = new Et(c), y = new It(c), P = new Mt(c), f = new Ut();
|
|
1781
1781
|
return {
|
|
1782
1782
|
config: t,
|
|
1783
|
-
httpClient:
|
|
1784
|
-
applicantService:
|
|
1785
|
-
questionnaireService:
|
|
1786
|
-
uploadDocumentService:
|
|
1787
|
-
appropriatenessTestService:
|
|
1788
|
-
overviewService:
|
|
1789
|
-
riskScoringService:
|
|
1790
|
-
identityService:
|
|
1791
|
-
baseInformationService:
|
|
1792
|
-
investorCategorizationService:
|
|
1793
|
-
themeService:
|
|
1794
|
-
themeManager:
|
|
1783
|
+
httpClient: c,
|
|
1784
|
+
applicantService: l,
|
|
1785
|
+
questionnaireService: d,
|
|
1786
|
+
uploadDocumentService: u,
|
|
1787
|
+
appropriatenessTestService: g,
|
|
1788
|
+
overviewService: p,
|
|
1789
|
+
riskScoringService: m,
|
|
1790
|
+
identityService: v,
|
|
1791
|
+
baseInformationService: b,
|
|
1792
|
+
investorCategorizationService: y,
|
|
1793
|
+
themeService: P,
|
|
1794
|
+
themeManager: f,
|
|
1795
|
+
currentTheme: r,
|
|
1795
1796
|
createOrchestrator: () => new $t(
|
|
1796
|
-
a,
|
|
1797
|
-
i,
|
|
1798
|
-
c,
|
|
1799
1797
|
l,
|
|
1800
1798
|
d,
|
|
1801
1799
|
u,
|
|
1802
1800
|
g,
|
|
1803
|
-
|
|
1801
|
+
p,
|
|
1802
|
+
m,
|
|
1803
|
+
v,
|
|
1804
|
+
y
|
|
1804
1805
|
)
|
|
1805
1806
|
};
|
|
1806
|
-
}, [t]);
|
|
1807
|
+
}, [t, r]);
|
|
1807
1808
|
return V(() => ((async () => {
|
|
1809
|
+
if (a.current) {
|
|
1810
|
+
console.log("[MetaKYC] Theme load already in progress, skipping...");
|
|
1811
|
+
return;
|
|
1812
|
+
}
|
|
1813
|
+
a.current = !0;
|
|
1808
1814
|
try {
|
|
1809
1815
|
if (t.theme) {
|
|
1810
|
-
console.log("[MetaKYC] Applying static theme from config"),
|
|
1816
|
+
console.log("[MetaKYC] Applying static theme from config"), i.themeManager.applyTheme(t.theme), s(i.themeManager.getCurrentTheme());
|
|
1811
1817
|
return;
|
|
1812
1818
|
}
|
|
1813
1819
|
console.log("[MetaKYC] Fetching theme from backend...");
|
|
1814
|
-
const
|
|
1815
|
-
|
|
1816
|
-
} catch (
|
|
1817
|
-
console.warn("[MetaKYC] Failed to load theme, using default:",
|
|
1820
|
+
const l = await i.themeService.getThemeConfiguration();
|
|
1821
|
+
i.themeManager.applyTheme(l), s(i.themeManager.getCurrentTheme()), console.log("[MetaKYC] Theme loaded and applied", l);
|
|
1822
|
+
} catch (l) {
|
|
1823
|
+
console.warn("[MetaKYC] Failed to load theme, using default:", l), s(i.themeManager.getCurrentTheme());
|
|
1824
|
+
} finally {
|
|
1825
|
+
a.current = !1;
|
|
1818
1826
|
}
|
|
1819
1827
|
})(), () => {
|
|
1820
|
-
|
|
1821
|
-
}), [t.theme,
|
|
1828
|
+
i.themeManager.cleanup();
|
|
1829
|
+
}), [t.theme, i.themeService, i.themeManager]), /* @__PURE__ */ n(Ue.Provider, { value: i, children: e });
|
|
1822
1830
|
};
|
|
1823
1831
|
function re() {
|
|
1824
1832
|
const t = rt(Ue);
|
|
@@ -1847,7 +1855,7 @@ function $r(t, e) {
|
|
|
1847
1855
|
return t.type === s;
|
|
1848
1856
|
});
|
|
1849
1857
|
}
|
|
1850
|
-
function
|
|
1858
|
+
function Ee(t) {
|
|
1851
1859
|
if (t === 0) return "0 Bytes";
|
|
1852
1860
|
const e = 1024, r = ["Bytes", "KB", "MB", "GB"], s = Math.floor(Math.log(t) / Math.log(e));
|
|
1853
1861
|
return Math.round(t / Math.pow(e, s) * 100) / 100 + " " + r[s];
|
|
@@ -1910,7 +1918,7 @@ function Kr() {
|
|
|
1910
1918
|
Yt(), Qt();
|
|
1911
1919
|
}
|
|
1912
1920
|
function Gt(t) {
|
|
1913
|
-
const { createOrchestrator: e } = re(), [r, s] = x(null), [a, i] = x(!1), [c, l] = x(null), d =
|
|
1921
|
+
const { createOrchestrator: e } = re(), [r, s] = x(null), [a, i] = x(!1), [c, l] = x(null), d = ve(null), u = t || Vt();
|
|
1914
1922
|
V(() => {
|
|
1915
1923
|
d.current || (d.current = e());
|
|
1916
1924
|
}, [e]), V(() => {
|
|
@@ -1924,35 +1932,43 @@ function Gt(t) {
|
|
|
1924
1932
|
nextWorkflowKey: r.nextWorkflowKey
|
|
1925
1933
|
}));
|
|
1926
1934
|
}, [r, u]);
|
|
1927
|
-
const g = q(async () => {
|
|
1935
|
+
const g = ve(!1), p = ve(!1), m = q(async () => {
|
|
1928
1936
|
if (!(!u || !d.current)) {
|
|
1929
|
-
|
|
1937
|
+
if (g.current) {
|
|
1938
|
+
console.log("[Workflow] Load already in progress, skipping...");
|
|
1939
|
+
return;
|
|
1940
|
+
}
|
|
1941
|
+
g.current = !0, i(!0), l(null);
|
|
1930
1942
|
try {
|
|
1931
1943
|
const h = await d.current.initialize(u);
|
|
1932
|
-
s(h);
|
|
1944
|
+
s(h), p.current = !0;
|
|
1933
1945
|
} catch (h) {
|
|
1934
1946
|
l(h);
|
|
1935
1947
|
} finally {
|
|
1936
|
-
i(!1);
|
|
1948
|
+
i(!1), g.current = !1;
|
|
1937
1949
|
}
|
|
1938
1950
|
}
|
|
1939
1951
|
}, [u]);
|
|
1940
1952
|
V(() => {
|
|
1941
|
-
u &&
|
|
1942
|
-
}, [u,
|
|
1943
|
-
const
|
|
1953
|
+
u && !p.current && m();
|
|
1954
|
+
}, [u, m]);
|
|
1955
|
+
const v = q(async () => {
|
|
1944
1956
|
if (d.current) {
|
|
1945
|
-
|
|
1957
|
+
if (g.current) {
|
|
1958
|
+
console.log("[Workflow] Refresh already in progress, skipping...");
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
g.current = !0, i(!0), l(null);
|
|
1946
1962
|
try {
|
|
1947
1963
|
const h = await d.current.refreshProgress();
|
|
1948
1964
|
s(h);
|
|
1949
1965
|
} catch (h) {
|
|
1950
1966
|
l(h);
|
|
1951
1967
|
} finally {
|
|
1952
|
-
i(!1);
|
|
1968
|
+
i(!1), g.current = !1;
|
|
1953
1969
|
}
|
|
1954
1970
|
}
|
|
1955
|
-
}, []),
|
|
1971
|
+
}, []), b = q(async () => {
|
|
1956
1972
|
if (d.current) {
|
|
1957
1973
|
i(!0), l(null);
|
|
1958
1974
|
try {
|
|
@@ -1964,7 +1980,7 @@ function Gt(t) {
|
|
|
1964
1980
|
i(!1);
|
|
1965
1981
|
}
|
|
1966
1982
|
}
|
|
1967
|
-
}, []),
|
|
1983
|
+
}, []), y = q(async () => {
|
|
1968
1984
|
if (d.current) {
|
|
1969
1985
|
i(!0), l(null);
|
|
1970
1986
|
try {
|
|
@@ -1976,7 +1992,7 @@ function Gt(t) {
|
|
|
1976
1992
|
i(!1);
|
|
1977
1993
|
}
|
|
1978
1994
|
}
|
|
1979
|
-
}, []),
|
|
1995
|
+
}, []), P = q(async (h) => {
|
|
1980
1996
|
if (d.current) {
|
|
1981
1997
|
i(!0), l(null);
|
|
1982
1998
|
try {
|
|
@@ -1989,25 +2005,25 @@ function Gt(t) {
|
|
|
1989
2005
|
i(!1);
|
|
1990
2006
|
}
|
|
1991
2007
|
}
|
|
1992
|
-
}, []),
|
|
2008
|
+
}, []), f = Te.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((h, N) => h.order - N.order) : [], [r == null ? void 0 : r.stepInfoList]), E = Te.useMemo(() => r ? r.nextWorkflowKey && r.nextWorkflowKey !== r.workFlowKey : !1, [r]);
|
|
1993
2009
|
return {
|
|
1994
2010
|
progress: r,
|
|
1995
2011
|
applicantId: u,
|
|
1996
2012
|
currentStep: (r == null ? void 0 : r.currentStep) || null,
|
|
1997
|
-
steps:
|
|
2013
|
+
steps: f,
|
|
1998
2014
|
status: (r == null ? void 0 : r.status) || ae.None,
|
|
1999
2015
|
workflowResult: (r == null ? void 0 : r.workflowResult) || null,
|
|
2000
2016
|
workflowKey: r == null ? void 0 : r.workFlowKey,
|
|
2001
2017
|
nextWorkflowKey: r == null ? void 0 : r.nextWorkflowKey,
|
|
2002
|
-
hasWorkflowChanged:
|
|
2018
|
+
hasWorkflowChanged: E,
|
|
2003
2019
|
isLoading: a,
|
|
2004
2020
|
error: c,
|
|
2005
2021
|
isComplete: (r == null ? void 0 : r.status) === ae.Finished,
|
|
2006
2022
|
isOnHold: (r == null ? void 0 : r.status) === ae.OnHold,
|
|
2007
|
-
refreshProgress:
|
|
2008
|
-
moveToNext:
|
|
2009
|
-
moveBack:
|
|
2010
|
-
submitCurrentStep:
|
|
2023
|
+
refreshProgress: v,
|
|
2024
|
+
moveToNext: b,
|
|
2025
|
+
moveBack: y,
|
|
2026
|
+
submitCurrentStep: P,
|
|
2011
2027
|
orchestrator: d.current
|
|
2012
2028
|
};
|
|
2013
2029
|
}
|
|
@@ -2033,8 +2049,8 @@ function Zt(t) {
|
|
|
2033
2049
|
l(!0), u(null);
|
|
2034
2050
|
try {
|
|
2035
2051
|
return await e.fillQuestionnaire(m);
|
|
2036
|
-
} catch (
|
|
2037
|
-
throw u(
|
|
2052
|
+
} catch (v) {
|
|
2053
|
+
throw u(v), v;
|
|
2038
2054
|
} finally {
|
|
2039
2055
|
l(!1);
|
|
2040
2056
|
}
|
|
@@ -2055,10 +2071,10 @@ function Jt(t) {
|
|
|
2055
2071
|
if (t) {
|
|
2056
2072
|
i(!0), p(null);
|
|
2057
2073
|
try {
|
|
2058
|
-
const
|
|
2059
|
-
s(
|
|
2060
|
-
} catch (
|
|
2061
|
-
p(
|
|
2074
|
+
const b = await e.getUploadDocument(t);
|
|
2075
|
+
s(b);
|
|
2076
|
+
} catch (b) {
|
|
2077
|
+
p(b);
|
|
2062
2078
|
} finally {
|
|
2063
2079
|
i(!1);
|
|
2064
2080
|
}
|
|
@@ -2067,13 +2083,13 @@ function Jt(t) {
|
|
|
2067
2083
|
V(() => {
|
|
2068
2084
|
t && m();
|
|
2069
2085
|
}, [t, m]);
|
|
2070
|
-
const
|
|
2071
|
-
async (
|
|
2086
|
+
const v = q(
|
|
2087
|
+
async (b) => {
|
|
2072
2088
|
l(!0), u(0), p(null);
|
|
2073
2089
|
try {
|
|
2074
|
-
await e.fillUploadDocument(
|
|
2075
|
-
} catch (
|
|
2076
|
-
throw p(
|
|
2090
|
+
await e.fillUploadDocument(b), u(100);
|
|
2091
|
+
} catch (y) {
|
|
2092
|
+
throw p(y), y;
|
|
2077
2093
|
} finally {
|
|
2078
2094
|
l(!1);
|
|
2079
2095
|
}
|
|
@@ -2087,7 +2103,7 @@ function Jt(t) {
|
|
|
2087
2103
|
uploadProgress: d,
|
|
2088
2104
|
error: g,
|
|
2089
2105
|
load: m,
|
|
2090
|
-
submit:
|
|
2106
|
+
submit: v
|
|
2091
2107
|
};
|
|
2092
2108
|
}
|
|
2093
2109
|
function Ur(t) {
|
|
@@ -2095,10 +2111,10 @@ function Ur(t) {
|
|
|
2095
2111
|
if (t) {
|
|
2096
2112
|
i(!0), u(null);
|
|
2097
2113
|
try {
|
|
2098
|
-
const
|
|
2099
|
-
s(
|
|
2100
|
-
} catch (
|
|
2101
|
-
u(
|
|
2114
|
+
const b = await e.getAppropriatenessTest(t);
|
|
2115
|
+
s(b);
|
|
2116
|
+
} catch (b) {
|
|
2117
|
+
u(b);
|
|
2102
2118
|
} finally {
|
|
2103
2119
|
i(!1);
|
|
2104
2120
|
}
|
|
@@ -2107,14 +2123,14 @@ function Ur(t) {
|
|
|
2107
2123
|
V(() => {
|
|
2108
2124
|
t && m();
|
|
2109
2125
|
}, [t, m]);
|
|
2110
|
-
const
|
|
2111
|
-
async (
|
|
2126
|
+
const v = q(
|
|
2127
|
+
async (b) => {
|
|
2112
2128
|
l(!0), u(null);
|
|
2113
2129
|
try {
|
|
2114
|
-
const
|
|
2115
|
-
return p(
|
|
2116
|
-
} catch (
|
|
2117
|
-
throw u(
|
|
2130
|
+
const y = await e.fillAppropriatenessTest(b);
|
|
2131
|
+
return p(y), y;
|
|
2132
|
+
} catch (y) {
|
|
2133
|
+
throw u(y), y;
|
|
2118
2134
|
} finally {
|
|
2119
2135
|
l(!1);
|
|
2120
2136
|
}
|
|
@@ -2128,7 +2144,7 @@ function Ur(t) {
|
|
|
2128
2144
|
isSubmitting: c,
|
|
2129
2145
|
error: d,
|
|
2130
2146
|
load: m,
|
|
2131
|
-
submit:
|
|
2147
|
+
submit: v
|
|
2132
2148
|
};
|
|
2133
2149
|
}
|
|
2134
2150
|
function Xt(t) {
|
|
@@ -2172,67 +2188,75 @@ function Xt(t) {
|
|
|
2172
2188
|
function er(t) {
|
|
2173
2189
|
const { identityService: e } = re(), [r, s] = x(
|
|
2174
2190
|
null
|
|
2175
|
-
), [a, i] = x(!1), [c, l] = x(null), d = q(
|
|
2176
|
-
async (
|
|
2191
|
+
), [a, i] = x(!1), [c, l] = x(null), d = ve(!1), u = q(
|
|
2192
|
+
async (m, v) => {
|
|
2177
2193
|
if (t) {
|
|
2178
|
-
|
|
2194
|
+
if (d.current) {
|
|
2195
|
+
console.log("[Identity] Request already in progress, skipping...");
|
|
2196
|
+
return;
|
|
2197
|
+
}
|
|
2198
|
+
d.current = !0, i(!0), l(null);
|
|
2179
2199
|
try {
|
|
2180
|
-
const
|
|
2200
|
+
const b = {
|
|
2181
2201
|
applicantId: t,
|
|
2182
2202
|
restart: !1,
|
|
2183
|
-
redirectUrl:
|
|
2184
|
-
ttl:
|
|
2203
|
+
redirectUrl: m || "",
|
|
2204
|
+
ttl: v || 604800
|
|
2185
2205
|
// Default: 7 days
|
|
2186
2206
|
};
|
|
2187
|
-
console.log("Identity request input:",
|
|
2188
|
-
const y = await e.identityRequest(
|
|
2207
|
+
console.log("Identity request input:", b);
|
|
2208
|
+
const y = await e.identityRequest(b);
|
|
2189
2209
|
return console.log("Identity request result:", y), s(y), y;
|
|
2190
|
-
} catch (
|
|
2191
|
-
throw l(
|
|
2210
|
+
} catch (b) {
|
|
2211
|
+
throw l(b), b;
|
|
2192
2212
|
} finally {
|
|
2193
|
-
i(!1);
|
|
2213
|
+
i(!1), d.current = !1;
|
|
2194
2214
|
}
|
|
2195
2215
|
}
|
|
2196
2216
|
},
|
|
2197
2217
|
[t, e]
|
|
2198
|
-
),
|
|
2199
|
-
async (
|
|
2218
|
+
), g = q(
|
|
2219
|
+
async (m, v) => {
|
|
2200
2220
|
if (t) {
|
|
2201
2221
|
i(!0), l(null);
|
|
2202
2222
|
try {
|
|
2203
|
-
const
|
|
2223
|
+
const b = {
|
|
2204
2224
|
applicantId: t,
|
|
2205
2225
|
restart: !1,
|
|
2206
|
-
redirectUrl:
|
|
2207
|
-
ttl:
|
|
2208
|
-
}, y = await e.identityCompanyRequest(
|
|
2226
|
+
redirectUrl: m,
|
|
2227
|
+
ttl: v
|
|
2228
|
+
}, y = await e.identityCompanyRequest(b);
|
|
2209
2229
|
return s(y), y;
|
|
2210
|
-
} catch (
|
|
2211
|
-
throw l(
|
|
2230
|
+
} catch (b) {
|
|
2231
|
+
throw l(b), b;
|
|
2212
2232
|
} finally {
|
|
2213
2233
|
i(!1);
|
|
2214
2234
|
}
|
|
2215
2235
|
}
|
|
2216
2236
|
},
|
|
2217
2237
|
[t, e]
|
|
2218
|
-
),
|
|
2238
|
+
), p = q(async () => {
|
|
2219
2239
|
if (t) {
|
|
2220
|
-
|
|
2240
|
+
if (d.current) {
|
|
2241
|
+
console.log("[Identity] Restart already in progress, skipping...");
|
|
2242
|
+
return;
|
|
2243
|
+
}
|
|
2244
|
+
d.current = !0, i(!0), l(null);
|
|
2221
2245
|
try {
|
|
2222
|
-
const
|
|
2246
|
+
const m = {
|
|
2223
2247
|
applicantId: t,
|
|
2224
2248
|
restart: !0,
|
|
2225
2249
|
redirectUrl: "",
|
|
2226
2250
|
ttl: 604800
|
|
2227
2251
|
// 7 days
|
|
2228
2252
|
};
|
|
2229
|
-
console.log("Restarting identity with input:",
|
|
2230
|
-
const
|
|
2231
|
-
return console.log("Restart identity result:",
|
|
2232
|
-
} catch (
|
|
2233
|
-
throw l(
|
|
2253
|
+
console.log("Restarting identity with input:", m);
|
|
2254
|
+
const v = await e.identityRequest(m);
|
|
2255
|
+
return console.log("Restart identity result:", v), s(v), v;
|
|
2256
|
+
} catch (m) {
|
|
2257
|
+
throw l(m), m;
|
|
2234
2258
|
} finally {
|
|
2235
|
-
i(!1);
|
|
2259
|
+
i(!1), d.current = !1;
|
|
2236
2260
|
}
|
|
2237
2261
|
}
|
|
2238
2262
|
}, [t, e]);
|
|
@@ -2242,9 +2266,9 @@ function er(t) {
|
|
|
2242
2266
|
token: (r == null ? void 0 : r.publicProviderTokenObject) || null,
|
|
2243
2267
|
isLoading: a,
|
|
2244
2268
|
error: c,
|
|
2245
|
-
requestIdentity:
|
|
2246
|
-
requestCompanyIdentity:
|
|
2247
|
-
restartIdentity:
|
|
2269
|
+
requestIdentity: u,
|
|
2270
|
+
requestCompanyIdentity: g,
|
|
2271
|
+
restartIdentity: p
|
|
2248
2272
|
};
|
|
2249
2273
|
}
|
|
2250
2274
|
function tr(t) {
|
|
@@ -2252,10 +2276,10 @@ function tr(t) {
|
|
|
2252
2276
|
if (t) {
|
|
2253
2277
|
i(!0), u(null);
|
|
2254
2278
|
try {
|
|
2255
|
-
const
|
|
2256
|
-
s(
|
|
2257
|
-
} catch (
|
|
2258
|
-
u(
|
|
2279
|
+
const b = await e.getRiskCriterias(t);
|
|
2280
|
+
s(b);
|
|
2281
|
+
} catch (b) {
|
|
2282
|
+
u(b);
|
|
2259
2283
|
} finally {
|
|
2260
2284
|
i(!1);
|
|
2261
2285
|
}
|
|
@@ -2264,14 +2288,14 @@ function tr(t) {
|
|
|
2264
2288
|
V(() => {
|
|
2265
2289
|
t && m();
|
|
2266
2290
|
}, [t, m]);
|
|
2267
|
-
const
|
|
2268
|
-
async (
|
|
2291
|
+
const v = q(
|
|
2292
|
+
async (b) => {
|
|
2269
2293
|
l(!0), u(null);
|
|
2270
2294
|
try {
|
|
2271
|
-
const
|
|
2272
|
-
return p(
|
|
2273
|
-
} catch (
|
|
2274
|
-
throw u(
|
|
2295
|
+
const y = await e.submitRiskScoring(b);
|
|
2296
|
+
return p(y), y;
|
|
2297
|
+
} catch (y) {
|
|
2298
|
+
throw u(y), y;
|
|
2275
2299
|
} finally {
|
|
2276
2300
|
l(!1);
|
|
2277
2301
|
}
|
|
@@ -2285,7 +2309,7 @@ function tr(t) {
|
|
|
2285
2309
|
isSubmitting: c,
|
|
2286
2310
|
error: d,
|
|
2287
2311
|
load: m,
|
|
2288
|
-
submit:
|
|
2312
|
+
submit: v
|
|
2289
2313
|
};
|
|
2290
2314
|
}
|
|
2291
2315
|
function rr() {
|
|
@@ -2298,15 +2322,15 @@ function rr() {
|
|
|
2298
2322
|
s(!0), i(null);
|
|
2299
2323
|
try {
|
|
2300
2324
|
if (p.applicantAdditionalDatas || (p.applicantAdditionalDatas = []), (m = e.identityProviders) != null && m.sardinai) {
|
|
2301
|
-
const
|
|
2302
|
-
console.log("[SardinAI] Generated session key:",
|
|
2325
|
+
const b = c();
|
|
2326
|
+
console.log("[SardinAI] Generated session key:", b), p.applicantAdditionalDatas.push({
|
|
2303
2327
|
paramName: "sessionKey",
|
|
2304
|
-
value:
|
|
2328
|
+
value: b
|
|
2305
2329
|
});
|
|
2306
2330
|
}
|
|
2307
2331
|
return await t.createApplicant(p);
|
|
2308
|
-
} catch (
|
|
2309
|
-
throw i(
|
|
2332
|
+
} catch (v) {
|
|
2333
|
+
throw i(v), v;
|
|
2310
2334
|
} finally {
|
|
2311
2335
|
s(!1);
|
|
2312
2336
|
}
|
|
@@ -2419,7 +2443,7 @@ const j = ({
|
|
|
2419
2443
|
]
|
|
2420
2444
|
}
|
|
2421
2445
|
);
|
|
2422
|
-
}, Z =
|
|
2446
|
+
}, Z = Pe(
|
|
2423
2447
|
({ label: t, error: e, helperText: r, leftIcon: s, rightIcon: a, className: i, ...c }, l) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2424
2448
|
t && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2425
2449
|
t,
|
|
@@ -2538,7 +2562,7 @@ const T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
|
2538
2562
|
]
|
|
2539
2563
|
}
|
|
2540
2564
|
) });
|
|
2541
|
-
}, ge =
|
|
2565
|
+
}, ge = Pe(
|
|
2542
2566
|
({ label: t, error: e, helperText: r, options: s, placeholder: a, className: i, ...c }, l) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2543
2567
|
t && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2544
2568
|
t,
|
|
@@ -2586,27 +2610,27 @@ const nr = ({
|
|
|
2586
2610
|
value: c = [],
|
|
2587
2611
|
className: l
|
|
2588
2612
|
}) => {
|
|
2589
|
-
const [d, u] = x(!1), g =
|
|
2590
|
-
if (!
|
|
2591
|
-
const
|
|
2592
|
-
if (a &&
|
|
2593
|
-
const
|
|
2594
|
-
alert(`Some files exceed the maximum size of ${
|
|
2613
|
+
const [d, u] = x(!1), g = ve(null), p = (f) => {
|
|
2614
|
+
if (!f) return;
|
|
2615
|
+
const E = Array.from(f);
|
|
2616
|
+
if (a && E.filter((N) => N.size > a).length > 0) {
|
|
2617
|
+
const N = Ee(a);
|
|
2618
|
+
alert(`Some files exceed the maximum size of ${N}`);
|
|
2595
2619
|
return;
|
|
2596
2620
|
}
|
|
2597
|
-
i == null || i(s ? [...c, ...
|
|
2598
|
-
}, m = (
|
|
2599
|
-
|
|
2600
|
-
},
|
|
2621
|
+
i == null || i(s ? [...c, ...E] : [E[0]]);
|
|
2622
|
+
}, m = (f) => {
|
|
2623
|
+
f.preventDefault(), u(!0);
|
|
2624
|
+
}, v = () => {
|
|
2601
2625
|
u(!1);
|
|
2602
|
-
},
|
|
2603
|
-
|
|
2604
|
-
},
|
|
2605
|
-
var
|
|
2606
|
-
(
|
|
2607
|
-
},
|
|
2608
|
-
const
|
|
2609
|
-
i == null || i(
|
|
2626
|
+
}, b = (f) => {
|
|
2627
|
+
f.preventDefault(), u(!1), p(f.dataTransfer.files);
|
|
2628
|
+
}, y = () => {
|
|
2629
|
+
var f;
|
|
2630
|
+
(f = g.current) == null || f.click();
|
|
2631
|
+
}, P = (f) => {
|
|
2632
|
+
const E = c.filter((h, N) => N !== f);
|
|
2633
|
+
i == null || i(E);
|
|
2610
2634
|
};
|
|
2611
2635
|
return /* @__PURE__ */ o("div", { className: X("w-full", l), children: [
|
|
2612
2636
|
t && /* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: t }),
|
|
@@ -2619,9 +2643,9 @@ const nr = ({
|
|
|
2619
2643
|
e && "border-danger-500"
|
|
2620
2644
|
),
|
|
2621
2645
|
onDragOver: m,
|
|
2622
|
-
onDragLeave:
|
|
2623
|
-
onDrop:
|
|
2624
|
-
onClick:
|
|
2646
|
+
onDragLeave: v,
|
|
2647
|
+
onDrop: b,
|
|
2648
|
+
onClick: y,
|
|
2625
2649
|
children: [
|
|
2626
2650
|
/* @__PURE__ */ n(
|
|
2627
2651
|
"input",
|
|
@@ -2631,7 +2655,7 @@ const nr = ({
|
|
|
2631
2655
|
className: "hidden",
|
|
2632
2656
|
accept: r,
|
|
2633
2657
|
multiple: s,
|
|
2634
|
-
onChange: (
|
|
2658
|
+
onChange: (f) => p(f.target.files)
|
|
2635
2659
|
}
|
|
2636
2660
|
),
|
|
2637
2661
|
/* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
@@ -2659,13 +2683,13 @@ const nr = ({
|
|
|
2659
2683
|
] }),
|
|
2660
2684
|
a && /* @__PURE__ */ o("p", { className: "text-xs text-gray-500", children: [
|
|
2661
2685
|
"Maximum file size: ",
|
|
2662
|
-
|
|
2686
|
+
Ee(a)
|
|
2663
2687
|
] })
|
|
2664
2688
|
] })
|
|
2665
2689
|
]
|
|
2666
2690
|
}
|
|
2667
2691
|
),
|
|
2668
|
-
c.length > 0 && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2", children: c.map((
|
|
2692
|
+
c.length > 0 && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2", children: c.map((f, E) => /* @__PURE__ */ o(
|
|
2669
2693
|
"div",
|
|
2670
2694
|
{
|
|
2671
2695
|
className: "flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",
|
|
@@ -2687,10 +2711,10 @@ const nr = ({
|
|
|
2687
2711
|
)
|
|
2688
2712
|
}
|
|
2689
2713
|
),
|
|
2690
|
-
/* @__PURE__ */ n("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children:
|
|
2714
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children: f.name }),
|
|
2691
2715
|
/* @__PURE__ */ o("span", { className: "text-xs text-gray-500", children: [
|
|
2692
2716
|
"(",
|
|
2693
|
-
|
|
2717
|
+
Ee(f.size),
|
|
2694
2718
|
")"
|
|
2695
2719
|
] })
|
|
2696
2720
|
] }),
|
|
@@ -2698,8 +2722,8 @@ const nr = ({
|
|
|
2698
2722
|
"button",
|
|
2699
2723
|
{
|
|
2700
2724
|
type: "button",
|
|
2701
|
-
onClick: (
|
|
2702
|
-
|
|
2725
|
+
onClick: (h) => {
|
|
2726
|
+
h.stopPropagation(), P(E);
|
|
2703
2727
|
},
|
|
2704
2728
|
className: "ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",
|
|
2705
2729
|
children: /* @__PURE__ */ n("svg", { className: "h-5 w-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ n(
|
|
@@ -2714,11 +2738,11 @@ const nr = ({
|
|
|
2714
2738
|
)
|
|
2715
2739
|
]
|
|
2716
2740
|
},
|
|
2717
|
-
|
|
2741
|
+
E
|
|
2718
2742
|
)) }),
|
|
2719
2743
|
e && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-danger-500", children: e })
|
|
2720
2744
|
] });
|
|
2721
|
-
}, sr =
|
|
2745
|
+
}, sr = Pe(
|
|
2722
2746
|
({ countryCode: t = "+1", onCountryCodeChange: e, className: r, ...s }, a) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2723
2747
|
s.label && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2724
2748
|
s.label,
|
|
@@ -2754,32 +2778,32 @@ const nr = ({
|
|
|
2754
2778
|
] })
|
|
2755
2779
|
);
|
|
2756
2780
|
sr.displayName = "PhoneInput";
|
|
2757
|
-
const
|
|
2781
|
+
const Me = (t, e, r) => {
|
|
2758
2782
|
if (t && "reportValidity" in t) {
|
|
2759
|
-
const s =
|
|
2783
|
+
const s = Ie(r, e);
|
|
2760
2784
|
t.setCustomValidity(s && s.message || ""), t.reportValidity();
|
|
2761
2785
|
}
|
|
2762
|
-
},
|
|
2786
|
+
}, De = (t, e) => {
|
|
2763
2787
|
for (const r in e.fields) {
|
|
2764
2788
|
const s = e.fields[r];
|
|
2765
|
-
s && s.ref && "reportValidity" in s.ref ?
|
|
2789
|
+
s && s.ref && "reportValidity" in s.ref ? Me(s.ref, r, t) : s && s.refs && s.refs.forEach((a) => Me(a, r, t));
|
|
2766
2790
|
}
|
|
2767
|
-
},
|
|
2768
|
-
e.shouldUseNativeValidation &&
|
|
2791
|
+
}, Be = (t, e) => {
|
|
2792
|
+
e.shouldUseNativeValidation && De(t, e);
|
|
2769
2793
|
const r = {};
|
|
2770
2794
|
for (const s in t) {
|
|
2771
|
-
const a =
|
|
2795
|
+
const a = Ie(e.fields, s), i = Object.assign(t[s] || {}, { ref: a && a.ref });
|
|
2772
2796
|
if (ar(e.names || Object.keys(t), s)) {
|
|
2773
|
-
const c = Object.assign({},
|
|
2774
|
-
|
|
2775
|
-
} else
|
|
2797
|
+
const c = Object.assign({}, Ie(r, s));
|
|
2798
|
+
Ae(c, "root", i), Ae(r, s, c);
|
|
2799
|
+
} else Ae(r, s, i);
|
|
2776
2800
|
}
|
|
2777
2801
|
return r;
|
|
2778
2802
|
}, ar = (t, e) => {
|
|
2779
|
-
const r =
|
|
2780
|
-
return t.some((s) =>
|
|
2803
|
+
const r = Oe(e);
|
|
2804
|
+
return t.some((s) => Oe(s).match(`^${r}\\.\\d+`));
|
|
2781
2805
|
};
|
|
2782
|
-
function
|
|
2806
|
+
function Oe(t) {
|
|
2783
2807
|
return t.replace(/\]|\[/g, "");
|
|
2784
2808
|
}
|
|
2785
2809
|
function qe(t, e, r) {
|
|
@@ -2826,14 +2850,14 @@ function lr(t, e) {
|
|
|
2826
2850
|
}
|
|
2827
2851
|
const Ve = Error.captureStackTrace ? Error.captureStackTrace : (...t) => {
|
|
2828
2852
|
};
|
|
2829
|
-
function
|
|
2853
|
+
function we(t) {
|
|
2830
2854
|
return typeof t == "string" ? t : t == null ? void 0 : t.message;
|
|
2831
2855
|
}
|
|
2832
2856
|
function Ye(t, e, r) {
|
|
2833
2857
|
var a, i, c, l, d, u;
|
|
2834
2858
|
const s = { ...t, path: t.path ?? [] };
|
|
2835
2859
|
if (!t.message) {
|
|
2836
|
-
const g =
|
|
2860
|
+
const g = we((c = (i = (a = t.inst) == null ? void 0 : a._zod.def) == null ? void 0 : i.error) == null ? void 0 : c.call(i, t)) ?? we((l = e == null ? void 0 : e.error) == null ? void 0 : l.call(e, t)) ?? we((d = r.customError) == null ? void 0 : d.call(r, t)) ?? we((u = r.localeError) == null ? void 0 : u.call(r, t)) ?? "Invalid input";
|
|
2837
2861
|
s.message = g;
|
|
2838
2862
|
}
|
|
2839
2863
|
return delete s.inst, delete s.continue, e != null && e.reportInput || delete s.input, s;
|
|
@@ -2873,7 +2897,7 @@ const We = (t, e) => {
|
|
|
2873
2897
|
}
|
|
2874
2898
|
return c.value;
|
|
2875
2899
|
}, hr = /* @__PURE__ */ mr(Qe);
|
|
2876
|
-
function
|
|
2900
|
+
function ze(t, e) {
|
|
2877
2901
|
try {
|
|
2878
2902
|
var r = t();
|
|
2879
2903
|
} catch (s) {
|
|
@@ -2924,14 +2948,14 @@ function Ge(t, e, r) {
|
|
|
2924
2948
|
return "_def" in s && typeof s._def == "object" && "typeName" in s._def;
|
|
2925
2949
|
}(t)) return function(s, a, i) {
|
|
2926
2950
|
try {
|
|
2927
|
-
return Promise.resolve(
|
|
2951
|
+
return Promise.resolve(ze(function() {
|
|
2928
2952
|
return Promise.resolve(t[r.mode === "sync" ? "parse" : "parseAsync"](s, e)).then(function(c) {
|
|
2929
|
-
return i.shouldUseNativeValidation &&
|
|
2953
|
+
return i.shouldUseNativeValidation && De({}, i), { errors: {}, values: r.raw ? Object.assign({}, s) : c };
|
|
2930
2954
|
});
|
|
2931
2955
|
}, function(c) {
|
|
2932
2956
|
if (function(l) {
|
|
2933
2957
|
return Array.isArray(l == null ? void 0 : l.issues);
|
|
2934
|
-
}(c)) return { values: {}, errors:
|
|
2958
|
+
}(c)) return { values: {}, errors: Be(pr(c.errors, !i.shouldUseNativeValidation && i.criteriaMode === "all"), i) };
|
|
2935
2959
|
throw c;
|
|
2936
2960
|
}));
|
|
2937
2961
|
} catch (c) {
|
|
@@ -2942,14 +2966,14 @@ function Ge(t, e, r) {
|
|
|
2942
2966
|
return "_zod" in s && typeof s._zod == "object";
|
|
2943
2967
|
}(t)) return function(s, a, i) {
|
|
2944
2968
|
try {
|
|
2945
|
-
return Promise.resolve(
|
|
2969
|
+
return Promise.resolve(ze(function() {
|
|
2946
2970
|
return Promise.resolve((r.mode === "sync" ? ur : hr)(t, s, e)).then(function(c) {
|
|
2947
|
-
return i.shouldUseNativeValidation &&
|
|
2971
|
+
return i.shouldUseNativeValidation && De({}, i), { errors: {}, values: r.raw ? Object.assign({}, s) : c };
|
|
2948
2972
|
});
|
|
2949
2973
|
}, function(c) {
|
|
2950
2974
|
if (function(l) {
|
|
2951
2975
|
return l instanceof cr;
|
|
2952
|
-
}(c)) return { values: {}, errors:
|
|
2976
|
+
}(c)) return { values: {}, errors: Be(gr(c.issues, !i.shouldUseNativeValidation && i.criteriaMode === "all"), i) };
|
|
2953
2977
|
throw c;
|
|
2954
2978
|
}));
|
|
2955
2979
|
} catch (c) {
|
|
@@ -3010,112 +3034,112 @@ const Vr = de.any(), vr = ({
|
|
|
3010
3034
|
onComplete: e,
|
|
3011
3035
|
onBack: r
|
|
3012
3036
|
}) => {
|
|
3013
|
-
const { questionnaire: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Zt(t), d =
|
|
3014
|
-
(
|
|
3015
|
-
questionId:
|
|
3037
|
+
const { questionnaire: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Zt(t), d = je(() => s ? { questionResults: s.questionGroups.map(
|
|
3038
|
+
(y) => y.questions.map((P) => ({
|
|
3039
|
+
questionId: P.id,
|
|
3016
3040
|
values: []
|
|
3017
3041
|
}))
|
|
3018
3042
|
) } : { questionResults: [] }, [s]), u = s ? yr() : null, {
|
|
3019
3043
|
control: g,
|
|
3020
3044
|
handleSubmit: p,
|
|
3021
3045
|
formState: { errors: m }
|
|
3022
|
-
} =
|
|
3046
|
+
} = Fe({
|
|
3023
3047
|
resolver: u ? Ge(u) : void 0,
|
|
3024
3048
|
defaultValues: d
|
|
3025
|
-
}),
|
|
3049
|
+
}), v = async (b) => {
|
|
3026
3050
|
if (s)
|
|
3027
3051
|
try {
|
|
3028
|
-
console.log("Form submitted with data:",
|
|
3029
|
-
const
|
|
3030
|
-
(
|
|
3031
|
-
var
|
|
3052
|
+
console.log("Form submitted with data:", b);
|
|
3053
|
+
const y = s.questionGroups.flatMap(
|
|
3054
|
+
(f, E) => f.questions.map((h, N) => {
|
|
3055
|
+
var F, L, R;
|
|
3032
3056
|
return {
|
|
3033
|
-
questionId:
|
|
3034
|
-
values: ((R = (L = (
|
|
3057
|
+
questionId: h.id,
|
|
3058
|
+
values: ((R = (L = (F = b.questionResults) == null ? void 0 : F[E]) == null ? void 0 : L[N]) == null ? void 0 : R.values) || []
|
|
3035
3059
|
};
|
|
3036
3060
|
})
|
|
3037
3061
|
);
|
|
3038
|
-
console.log("Question results to submit:",
|
|
3039
|
-
const
|
|
3062
|
+
console.log("Question results to submit:", y);
|
|
3063
|
+
const P = {
|
|
3040
3064
|
applicantId: t,
|
|
3041
3065
|
questionnarieId: s.id,
|
|
3042
|
-
questionResults:
|
|
3066
|
+
questionResults: y
|
|
3043
3067
|
};
|
|
3044
|
-
console.log("Final input:",
|
|
3045
|
-
} catch (
|
|
3046
|
-
console.error("Error submitting questionnaire:",
|
|
3068
|
+
console.log("Final input:", P), await l(P), e == null || e();
|
|
3069
|
+
} catch (y) {
|
|
3070
|
+
console.error("Error submitting questionnaire:", y);
|
|
3047
3071
|
}
|
|
3048
3072
|
};
|
|
3049
3073
|
return a ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(M, { children: /* @__PURE__ */ n(ie, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(M, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3050
3074
|
"Error loading questionnaire: ",
|
|
3051
3075
|
c.message
|
|
3052
|
-
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: p(
|
|
3076
|
+
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: p(v), children: /* @__PURE__ */ o(T, { children: [
|
|
3053
3077
|
/* @__PURE__ */ o(J, { children: [
|
|
3054
3078
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: s.displayName }),
|
|
3055
3079
|
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
|
|
3056
3080
|
] }),
|
|
3057
3081
|
/* @__PURE__ */ n(M, { className: "space-y-8", children: s.questionGroups.flatMap(
|
|
3058
|
-
(
|
|
3059
|
-
const
|
|
3082
|
+
(b, y) => b.questions.map((P, f) => {
|
|
3083
|
+
const h = P.defaultAnswers && P.defaultAnswers.length > 0 ? P.showAsDropdown ? P.canMultipleAnswer ? "multi-select" : "single-select" : P.canMultipleAnswer ? "checkbox" : "radio" : "text";
|
|
3060
3084
|
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3061
3085
|
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3062
|
-
|
|
3063
|
-
|
|
3086
|
+
P.text,
|
|
3087
|
+
P.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3064
3088
|
] }),
|
|
3065
|
-
|
|
3089
|
+
h === "text" && /* @__PURE__ */ n(
|
|
3066
3090
|
G,
|
|
3067
3091
|
{
|
|
3068
3092
|
control: g,
|
|
3069
|
-
name: `questionResults.${
|
|
3070
|
-
render: ({ field:
|
|
3071
|
-
var
|
|
3093
|
+
name: `questionResults.${y}.${f}.values.0`,
|
|
3094
|
+
render: ({ field: N }) => {
|
|
3095
|
+
var F, L, R, C;
|
|
3072
3096
|
return /* @__PURE__ */ n(
|
|
3073
3097
|
Z,
|
|
3074
3098
|
{
|
|
3075
|
-
value:
|
|
3076
|
-
onChange:
|
|
3077
|
-
onBlur:
|
|
3078
|
-
name:
|
|
3099
|
+
value: N.value || "",
|
|
3100
|
+
onChange: N.onChange,
|
|
3101
|
+
onBlur: N.onBlur,
|
|
3102
|
+
name: N.name,
|
|
3079
3103
|
placeholder: "Enter your answer...",
|
|
3080
|
-
error: (C = (R = (L = (
|
|
3104
|
+
error: (C = (R = (L = (F = m.questionResults) == null ? void 0 : F[y]) == null ? void 0 : L[f]) == null ? void 0 : R.values) == null ? void 0 : C.message
|
|
3081
3105
|
}
|
|
3082
3106
|
);
|
|
3083
3107
|
}
|
|
3084
3108
|
}
|
|
3085
3109
|
),
|
|
3086
|
-
(
|
|
3110
|
+
(h === "single-select" || h === "radio") && /* @__PURE__ */ n(
|
|
3087
3111
|
G,
|
|
3088
3112
|
{
|
|
3089
3113
|
control: g,
|
|
3090
|
-
name: `questionResults.${
|
|
3091
|
-
render: ({ field:
|
|
3092
|
-
var
|
|
3114
|
+
name: `questionResults.${y}.${f}.values.0`,
|
|
3115
|
+
render: ({ field: N }) => {
|
|
3116
|
+
var F, L, R, C;
|
|
3093
3117
|
return /* @__PURE__ */ n(
|
|
3094
3118
|
ge,
|
|
3095
3119
|
{
|
|
3096
|
-
value:
|
|
3097
|
-
onChange:
|
|
3098
|
-
onBlur:
|
|
3099
|
-
name:
|
|
3100
|
-
options:
|
|
3120
|
+
value: N.value || "",
|
|
3121
|
+
onChange: N.onChange,
|
|
3122
|
+
onBlur: N.onBlur,
|
|
3123
|
+
name: N.name,
|
|
3124
|
+
options: P.defaultAnswers.map((B) => ({
|
|
3101
3125
|
value: B,
|
|
3102
3126
|
label: B
|
|
3103
3127
|
})),
|
|
3104
3128
|
placeholder: "Select an option...",
|
|
3105
|
-
error: (C = (R = (L = (
|
|
3129
|
+
error: (C = (R = (L = (F = m.questionResults) == null ? void 0 : F[y]) == null ? void 0 : L[f]) == null ? void 0 : R.values) == null ? void 0 : C.message
|
|
3106
3130
|
}
|
|
3107
3131
|
);
|
|
3108
3132
|
}
|
|
3109
3133
|
}
|
|
3110
3134
|
),
|
|
3111
|
-
(
|
|
3135
|
+
(h === "checkbox" || h === "multi-select") && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3112
3136
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-2", children: "Choose one or more options" }),
|
|
3113
3137
|
/* @__PURE__ */ n(
|
|
3114
3138
|
G,
|
|
3115
3139
|
{
|
|
3116
3140
|
control: g,
|
|
3117
|
-
name: `questionResults.${
|
|
3118
|
-
render: ({ field: { value:
|
|
3141
|
+
name: `questionResults.${y}.${f}.values`,
|
|
3142
|
+
render: ({ field: { value: N = [], onChange: F } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: P.defaultAnswers.map((L, R) => /* @__PURE__ */ o(
|
|
3119
3143
|
"label",
|
|
3120
3144
|
{
|
|
3121
3145
|
className: "flex items-center space-x-2 cursor-pointer",
|
|
@@ -3124,10 +3148,10 @@ const Vr = de.any(), vr = ({
|
|
|
3124
3148
|
"input",
|
|
3125
3149
|
{
|
|
3126
3150
|
type: "checkbox",
|
|
3127
|
-
checked: Array.isArray(
|
|
3151
|
+
checked: Array.isArray(N) && N.includes(L),
|
|
3128
3152
|
onChange: (C) => {
|
|
3129
|
-
const B = Array.isArray(
|
|
3130
|
-
|
|
3153
|
+
const B = Array.isArray(N) ? N : [], z = C.target.checked ? [...B, L] : B.filter((w) => w !== L);
|
|
3154
|
+
F(z);
|
|
3131
3155
|
},
|
|
3132
3156
|
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3133
3157
|
}
|
|
@@ -3135,12 +3159,12 @@ const Vr = de.any(), vr = ({
|
|
|
3135
3159
|
/* @__PURE__ */ n("span", { className: "text-sm", children: L })
|
|
3136
3160
|
]
|
|
3137
3161
|
},
|
|
3138
|
-
`answer-${
|
|
3162
|
+
`answer-${y}-${f}-${R}`
|
|
3139
3163
|
)) })
|
|
3140
3164
|
}
|
|
3141
3165
|
)
|
|
3142
3166
|
] })
|
|
3143
|
-
] },
|
|
3167
|
+
] }, P.id);
|
|
3144
3168
|
})
|
|
3145
3169
|
) }),
|
|
3146
3170
|
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
@@ -3170,24 +3194,24 @@ const Vr = de.any(), vr = ({
|
|
|
3170
3194
|
const { uploadDocument: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Jt(t), [d, u] = x({}), g = async (p) => {
|
|
3171
3195
|
if (p.preventDefault(), !s) return;
|
|
3172
3196
|
const m = await Promise.all(
|
|
3173
|
-
s.uploadDocumentFiles.map(async (
|
|
3174
|
-
const
|
|
3175
|
-
|
|
3176
|
-
fileName:
|
|
3177
|
-
fileData: await qt(
|
|
3197
|
+
s.uploadDocumentFiles.map(async (b) => {
|
|
3198
|
+
const y = d[b.id] || [], P = await Promise.all(
|
|
3199
|
+
y.map(async (f) => ({
|
|
3200
|
+
fileName: f.name,
|
|
3201
|
+
fileData: await qt(f)
|
|
3178
3202
|
}))
|
|
3179
3203
|
);
|
|
3180
3204
|
return {
|
|
3181
|
-
uploadDocumentFileId:
|
|
3182
|
-
valueList:
|
|
3205
|
+
uploadDocumentFileId: b.id,
|
|
3206
|
+
valueList: P
|
|
3183
3207
|
};
|
|
3184
3208
|
})
|
|
3185
|
-
),
|
|
3209
|
+
), v = {
|
|
3186
3210
|
applicantId: t,
|
|
3187
3211
|
uploadDocumentId: s.id,
|
|
3188
3212
|
uploadDocumentResults: m
|
|
3189
3213
|
};
|
|
3190
|
-
await l(
|
|
3214
|
+
await l(v), e == null || e();
|
|
3191
3215
|
};
|
|
3192
3216
|
return a ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(M, { children: /* @__PURE__ */ n(ie, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(M, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3193
3217
|
"Error loading document requirements: ",
|
|
@@ -3206,7 +3230,7 @@ const Vr = de.any(), vr = ({
|
|
|
3206
3230
|
maxSize: p.maxEachFileSizeByte,
|
|
3207
3231
|
value: d[p.id] || [],
|
|
3208
3232
|
onChange: (m) => {
|
|
3209
|
-
u((
|
|
3233
|
+
u((v) => ({ ...v, [p.id]: m }));
|
|
3210
3234
|
}
|
|
3211
3235
|
},
|
|
3212
3236
|
p.id
|
|
@@ -3259,43 +3283,43 @@ const Vr = de.any(), vr = ({
|
|
|
3259
3283
|
onBack: r
|
|
3260
3284
|
}) => {
|
|
3261
3285
|
const { criteria: s, isLoading: a, isSubmitting: i, error: c, submit: l } = tr(t), [d, u] = le.useState(!1), g = le.useMemo(() => !s || s.length === 0 ? { criteriaValueInputs: [] } : {
|
|
3262
|
-
criteriaValueInputs: s.map((
|
|
3263
|
-
riskCriteriaId:
|
|
3286
|
+
criteriaValueInputs: s.map((f) => ({
|
|
3287
|
+
riskCriteriaId: f.id,
|
|
3264
3288
|
values: [""]
|
|
3265
3289
|
// Initialize with empty string to prevent uncontrolled input warning
|
|
3266
3290
|
}))
|
|
3267
3291
|
}, [s]), p = s && s.length > 0 ? br() : null, {
|
|
3268
3292
|
control: m,
|
|
3269
|
-
handleSubmit:
|
|
3270
|
-
formState: { errors:
|
|
3271
|
-
} =
|
|
3293
|
+
handleSubmit: v,
|
|
3294
|
+
formState: { errors: b }
|
|
3295
|
+
} = Fe({
|
|
3272
3296
|
resolver: p ? Ge(p) : void 0,
|
|
3273
3297
|
defaultValues: g
|
|
3274
3298
|
});
|
|
3275
3299
|
le.useEffect(() => {
|
|
3276
3300
|
!a && s && s.length === 0 && !d && !i && (u(!0), l({ applicantId: t, criteriaValueInputs: [] }).then(() => e == null ? void 0 : e()).catch(console.error));
|
|
3277
3301
|
}, [a, s, d, i, l, t, e]);
|
|
3278
|
-
const
|
|
3302
|
+
const y = async (f) => {
|
|
3279
3303
|
if (s)
|
|
3280
3304
|
try {
|
|
3281
|
-
console.log("Risk scoring form submitted:",
|
|
3282
|
-
const
|
|
3283
|
-
const L =
|
|
3305
|
+
console.log("Risk scoring form submitted:", f), console.log("Criteria metadata:", s);
|
|
3306
|
+
const E = f.criteriaValueInputs.map((N, F) => {
|
|
3307
|
+
const L = N.values || [], R = Array.isArray(L) ? L.filter((C) => C && C.trim()) : L && L.toString().trim() ? [L.toString()] : [];
|
|
3284
3308
|
return R.length === 0 ? null : {
|
|
3285
|
-
riskCriteriaId: s[
|
|
3309
|
+
riskCriteriaId: s[F].id,
|
|
3286
3310
|
values: R
|
|
3287
3311
|
};
|
|
3288
|
-
}).filter((
|
|
3289
|
-
console.log("Risk scoring criteriaValueInputs to submit:",
|
|
3290
|
-
const
|
|
3312
|
+
}).filter((N) => N !== null);
|
|
3313
|
+
console.log("Risk scoring criteriaValueInputs to submit:", E);
|
|
3314
|
+
const h = {
|
|
3291
3315
|
applicantId: t,
|
|
3292
|
-
criteriaValueInputs:
|
|
3316
|
+
criteriaValueInputs: E
|
|
3293
3317
|
};
|
|
3294
|
-
console.log("Final risk scoring input:",
|
|
3295
|
-
} catch (
|
|
3296
|
-
throw console.error("Error submitting risk scoring:",
|
|
3318
|
+
console.log("Final risk scoring input:", h), await l(h), console.log("Risk scoring submitted successfully!"), e == null || e();
|
|
3319
|
+
} catch (E) {
|
|
3320
|
+
throw console.error("Error submitting risk scoring:", E), E;
|
|
3297
3321
|
}
|
|
3298
|
-
},
|
|
3322
|
+
}, P = (f) => f.builtInType === 1 ? "country" : !f.defaultValues || f.defaultValues.length === 0 ? "text" : f.multipleValue ? "checkbox" : "radio";
|
|
3299
3323
|
return a ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
3300
3324
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
3301
3325
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading risk scoring criteria..." })
|
|
@@ -3305,25 +3329,25 @@ const Vr = de.any(), vr = ({
|
|
|
3305
3329
|
] }) }) }) : !a && s && s.length === 0 ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
3306
3330
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
3307
3331
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400", children: "No risk scoring criteria required. Moving to next step..." })
|
|
3308
|
-
] }) }) : s ? /* @__PURE__ */ n("form", { onSubmit:
|
|
3332
|
+
] }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: v(y), children: /* @__PURE__ */ o(T, { children: [
|
|
3309
3333
|
/* @__PURE__ */ o(J, { children: [
|
|
3310
3334
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Risk Assessment" }),
|
|
3311
3335
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please answer the following questions for risk evaluation" })
|
|
3312
3336
|
] }),
|
|
3313
|
-
/* @__PURE__ */ n(M, { className: "space-y-8", children: s.map((
|
|
3314
|
-
var
|
|
3315
|
-
const
|
|
3337
|
+
/* @__PURE__ */ n(M, { className: "space-y-8", children: s.map((f, E) => {
|
|
3338
|
+
var N, F, L;
|
|
3339
|
+
const h = P(f);
|
|
3316
3340
|
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3317
3341
|
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3318
|
-
|
|
3319
|
-
|
|
3342
|
+
f.displayName,
|
|
3343
|
+
f.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3320
3344
|
] }),
|
|
3321
|
-
|
|
3322
|
-
|
|
3345
|
+
f.description && /* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: f.description }),
|
|
3346
|
+
h === "text" && /* @__PURE__ */ n(
|
|
3323
3347
|
G,
|
|
3324
3348
|
{
|
|
3325
3349
|
control: m,
|
|
3326
|
-
name: `criteriaValueInputs.${
|
|
3350
|
+
name: `criteriaValueInputs.${E}.values.0`,
|
|
3327
3351
|
render: ({ field: R }) => {
|
|
3328
3352
|
var C, B, z;
|
|
3329
3353
|
return /* @__PURE__ */ n(
|
|
@@ -3331,25 +3355,25 @@ const Vr = de.any(), vr = ({
|
|
|
3331
3355
|
{
|
|
3332
3356
|
...R,
|
|
3333
3357
|
value: R.value || "",
|
|
3334
|
-
type:
|
|
3358
|
+
type: f.valueDataType === Re.DigitOnly ? "number" : "text",
|
|
3335
3359
|
placeholder: "Enter your answer...",
|
|
3336
|
-
error: (z = (B = (C =
|
|
3337
|
-
onKeyDown: (
|
|
3338
|
-
|
|
3360
|
+
error: (z = (B = (C = b.criteriaValueInputs) == null ? void 0 : C[E]) == null ? void 0 : B.values) == null ? void 0 : z.message,
|
|
3361
|
+
onKeyDown: (w) => {
|
|
3362
|
+
f.valueDataType === Re.DigitOnly && ["e", "E", "+", "-", "."].includes(w.key) && w.preventDefault();
|
|
3339
3363
|
}
|
|
3340
3364
|
}
|
|
3341
3365
|
);
|
|
3342
3366
|
}
|
|
3343
3367
|
}
|
|
3344
3368
|
),
|
|
3345
|
-
|
|
3369
|
+
h === "radio" && f.defaultValues && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3346
3370
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Choose one option" }),
|
|
3347
3371
|
/* @__PURE__ */ n(
|
|
3348
3372
|
G,
|
|
3349
3373
|
{
|
|
3350
3374
|
control: m,
|
|
3351
|
-
name: `criteriaValueInputs.${
|
|
3352
|
-
render: ({ field: { value: R, onChange: C } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children:
|
|
3375
|
+
name: `criteriaValueInputs.${E}.values.0`,
|
|
3376
|
+
render: ({ field: { value: R, onChange: C } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: f.defaultValues.map((B, z) => /* @__PURE__ */ o("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
3353
3377
|
/* @__PURE__ */ n(
|
|
3354
3378
|
"input",
|
|
3355
3379
|
{
|
|
@@ -3360,40 +3384,40 @@ const Vr = de.any(), vr = ({
|
|
|
3360
3384
|
}
|
|
3361
3385
|
),
|
|
3362
3386
|
/* @__PURE__ */ n("span", { className: "text-sm", children: B })
|
|
3363
|
-
] }, `${
|
|
3387
|
+
] }, `${E}-${z}`)) })
|
|
3364
3388
|
}
|
|
3365
3389
|
)
|
|
3366
3390
|
] }),
|
|
3367
|
-
|
|
3391
|
+
h === "checkbox" && f.defaultValues && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3368
3392
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Choose one or more options" }),
|
|
3369
3393
|
/* @__PURE__ */ n(
|
|
3370
3394
|
G,
|
|
3371
3395
|
{
|
|
3372
3396
|
control: m,
|
|
3373
|
-
name: `criteriaValueInputs.${
|
|
3374
|
-
render: ({ field: { value: R = [], onChange: C } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children:
|
|
3397
|
+
name: `criteriaValueInputs.${E}.values`,
|
|
3398
|
+
render: ({ field: { value: R = [], onChange: C } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: f.defaultValues.map((B, z) => /* @__PURE__ */ o("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
3375
3399
|
/* @__PURE__ */ n(
|
|
3376
3400
|
"input",
|
|
3377
3401
|
{
|
|
3378
3402
|
type: "checkbox",
|
|
3379
3403
|
checked: Array.isArray(R) && R.includes(B),
|
|
3380
|
-
onChange: (
|
|
3381
|
-
const
|
|
3404
|
+
onChange: (w) => {
|
|
3405
|
+
const I = Array.isArray(R) ? R : [], A = w.target.checked ? [...I, B] : I.filter((k) => k !== B);
|
|
3382
3406
|
C(A);
|
|
3383
3407
|
},
|
|
3384
3408
|
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3385
3409
|
}
|
|
3386
3410
|
),
|
|
3387
3411
|
/* @__PURE__ */ n("span", { className: "text-sm", children: B })
|
|
3388
|
-
] }, `${
|
|
3412
|
+
] }, `${E}-${z}`)) })
|
|
3389
3413
|
}
|
|
3390
3414
|
)
|
|
3391
3415
|
] }),
|
|
3392
|
-
|
|
3416
|
+
h === "country" && /* @__PURE__ */ n(
|
|
3393
3417
|
G,
|
|
3394
3418
|
{
|
|
3395
3419
|
control: m,
|
|
3396
|
-
name: `criteriaValueInputs.${
|
|
3420
|
+
name: `criteriaValueInputs.${E}.values.0`,
|
|
3397
3421
|
render: ({ field: R }) => {
|
|
3398
3422
|
var C, B, z;
|
|
3399
3423
|
return /* @__PURE__ */ n(
|
|
@@ -3407,14 +3431,14 @@ const Vr = de.any(), vr = ({
|
|
|
3407
3431
|
// TODO: Load from base information service
|
|
3408
3432
|
],
|
|
3409
3433
|
placeholder: "Select a country...",
|
|
3410
|
-
error: (z = (B = (C =
|
|
3434
|
+
error: (z = (B = (C = b.criteriaValueInputs) == null ? void 0 : C[E]) == null ? void 0 : B.values) == null ? void 0 : z.message
|
|
3411
3435
|
}
|
|
3412
3436
|
);
|
|
3413
3437
|
}
|
|
3414
3438
|
}
|
|
3415
3439
|
),
|
|
3416
|
-
((L = (
|
|
3417
|
-
] },
|
|
3440
|
+
((L = (F = (N = b.criteriaValueInputs) == null ? void 0 : N[E]) == null ? void 0 : F.values) == null ? void 0 : L.message) && /* @__PURE__ */ n("p", { className: "text-sm text-danger-500 mt-1", children: b.criteriaValueInputs[E].values.message })
|
|
3441
|
+
] }, f.id);
|
|
3418
3442
|
}) }),
|
|
3419
3443
|
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3420
3444
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
@@ -3424,7 +3448,7 @@ const Vr = de.any(), vr = ({
|
|
|
3424
3448
|
type: "submit",
|
|
3425
3449
|
isLoading: i,
|
|
3426
3450
|
onClick: () => {
|
|
3427
|
-
console.log("Risk scoring submit button clicked"), console.log("Form errors:",
|
|
3451
|
+
console.log("Risk scoring submit button clicked"), console.log("Form errors:", b);
|
|
3428
3452
|
},
|
|
3429
3453
|
children: "Continue"
|
|
3430
3454
|
}
|
|
@@ -3453,8 +3477,8 @@ const Vr = de.any(), vr = ({
|
|
|
3453
3477
|
investorType: a
|
|
3454
3478
|
};
|
|
3455
3479
|
console.log("Submitting investor categorization:", m);
|
|
3456
|
-
const
|
|
3457
|
-
console.log("Investor categorization result:",
|
|
3480
|
+
const v = await s.setInvestorCategorization(m);
|
|
3481
|
+
console.log("Investor categorization result:", v), e == null || e();
|
|
3458
3482
|
} catch (m) {
|
|
3459
3483
|
console.error("Error submitting investor categorization:", m), u(m.message || "Failed to submit investor categorization");
|
|
3460
3484
|
} finally {
|
|
@@ -3578,7 +3602,7 @@ const Vr = de.any(), vr = ({
|
|
|
3578
3602
|
onComplete: e,
|
|
3579
3603
|
onBack: r
|
|
3580
3604
|
}) => {
|
|
3581
|
-
const { appropriatenessTestService: s } = re(), [a, i] = x(null), [c, l] = x(!0), [d, u] = x(!1), [g, p] = x(null), [m,
|
|
3605
|
+
const { appropriatenessTestService: s } = re(), [a, i] = x(null), [c, l] = x(!0), [d, u] = x(!1), [g, p] = x(null), [m, v] = x({}), [b, y] = x(0), [P, f] = x(!1), [E, h] = x(!1), [N, F] = x(0);
|
|
3582
3606
|
V(() => {
|
|
3583
3607
|
(async () => {
|
|
3584
3608
|
try {
|
|
@@ -3586,7 +3610,7 @@ const Vr = de.any(), vr = ({
|
|
|
3586
3610
|
const k = await s.getAppropriatenessTest(t);
|
|
3587
3611
|
if (console.log("Appropriateness test data:", k), i(k), k.waitTimeSpanForNextTry && k.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3588
3612
|
const S = L(k.waitTimeSpanForNextTry);
|
|
3589
|
-
S > 0 &&
|
|
3613
|
+
S > 0 && F(S);
|
|
3590
3614
|
}
|
|
3591
3615
|
} catch (k) {
|
|
3592
3616
|
console.error("Error loading appropriateness test:", k), p(k.message || "Failed to load appropriateness test");
|
|
@@ -3607,30 +3631,30 @@ const Vr = de.any(), vr = ({
|
|
|
3607
3631
|
return `${k.toString().padStart(2, "0")}:${S.toString().padStart(2, "0")}`;
|
|
3608
3632
|
};
|
|
3609
3633
|
V(() => {
|
|
3610
|
-
if (!
|
|
3634
|
+
if (!P || b <= 0) return;
|
|
3611
3635
|
const A = setInterval(() => {
|
|
3612
|
-
|
|
3636
|
+
y((k) => k <= 1 ? (h(!0), 0) : k - 1);
|
|
3613
3637
|
}, 1e3);
|
|
3614
3638
|
return () => clearInterval(A);
|
|
3615
|
-
}, [
|
|
3616
|
-
if (
|
|
3639
|
+
}, [P, b]), V(() => {
|
|
3640
|
+
if (N <= 0) return;
|
|
3617
3641
|
const A = setInterval(() => {
|
|
3618
|
-
|
|
3642
|
+
F((k) => k <= 1 ? 0 : k - 1);
|
|
3619
3643
|
}, 1e3);
|
|
3620
3644
|
return () => clearInterval(A);
|
|
3621
|
-
}, [
|
|
3622
|
-
|
|
3623
|
-
}, [
|
|
3645
|
+
}, [N]), V(() => {
|
|
3646
|
+
E && !d && z();
|
|
3647
|
+
}, [E]);
|
|
3624
3648
|
const C = () => {
|
|
3625
|
-
a && (
|
|
3649
|
+
a && (f(!0), y(a.testDurationSec));
|
|
3626
3650
|
}, B = (A, k) => {
|
|
3627
|
-
|
|
3651
|
+
v((S) => ({
|
|
3628
3652
|
...S,
|
|
3629
3653
|
[A]: k
|
|
3630
3654
|
}));
|
|
3631
3655
|
}, z = async (A) => {
|
|
3632
3656
|
if (A && A.preventDefault(), !!a) {
|
|
3633
|
-
if (!
|
|
3657
|
+
if (!E) {
|
|
3634
3658
|
const k = a.appropriatenessQuestions.length - Object.keys(m).length;
|
|
3635
3659
|
if (k > 0) {
|
|
3636
3660
|
p(`Please answer all questions. ${k} question(s) remaining.`);
|
|
@@ -3653,26 +3677,26 @@ const Vr = de.any(), vr = ({
|
|
|
3653
3677
|
console.log("Submitting appropriateness test:", S);
|
|
3654
3678
|
try {
|
|
3655
3679
|
const _ = await s.fillAppropriatenessTest(S);
|
|
3656
|
-
console.log("Appropriateness test result:", _), _.message && (_.message.toLowerCase().includes("pass") || _.message.toLowerCase().includes("success") || _.message.toLowerCase().includes("congratulations")) ? e == null || e() : (p(_.message || "Test completed. Please check the result."),
|
|
3680
|
+
console.log("Appropriateness test result:", _), _.message && (_.message.toLowerCase().includes("pass") || _.message.toLowerCase().includes("success") || _.message.toLowerCase().includes("congratulations")) ? e == null || e() : (p(_.message || "Test completed. Please check the result."), f(!1), h(!1), v({}), setTimeout(() => w(), 1e3));
|
|
3657
3681
|
} catch (_) {
|
|
3658
3682
|
if (_.code === 400 && _.message) {
|
|
3659
3683
|
const oe = _.message;
|
|
3660
|
-
console.log("Test failed:", oe), p(oe),
|
|
3684
|
+
console.log("Test failed:", oe), p(oe), f(!1), h(!1), v({}), setTimeout(() => w(), 1500);
|
|
3661
3685
|
} else
|
|
3662
3686
|
throw _;
|
|
3663
3687
|
}
|
|
3664
3688
|
} catch (k) {
|
|
3665
|
-
console.error("Error submitting appropriateness test:", k), p(k.message || "Failed to submit test. Please try again."),
|
|
3689
|
+
console.error("Error submitting appropriateness test:", k), p(k.message || "Failed to submit test. Please try again."), f(!1), h(!1), v({});
|
|
3666
3690
|
} finally {
|
|
3667
3691
|
u(!1);
|
|
3668
3692
|
}
|
|
3669
3693
|
}
|
|
3670
|
-
},
|
|
3694
|
+
}, w = async () => {
|
|
3671
3695
|
try {
|
|
3672
3696
|
const A = await s.getAppropriatenessTest(t);
|
|
3673
3697
|
if (console.log("Reloaded test data:", A), i(A), A.waitTimeSpanForNextTry && A.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3674
3698
|
const k = L(A.waitTimeSpanForNextTry);
|
|
3675
|
-
k > 0 &&
|
|
3699
|
+
k > 0 && F(k);
|
|
3676
3700
|
}
|
|
3677
3701
|
} catch (A) {
|
|
3678
3702
|
console.error("Error reloading test data:", A), p((k) => k + `
|
|
@@ -3690,7 +3714,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3690
3714
|
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "No test data available" }),
|
|
3691
3715
|
g && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: g })
|
|
3692
3716
|
] }) });
|
|
3693
|
-
if (
|
|
3717
|
+
if (N > 0)
|
|
3694
3718
|
return /* @__PURE__ */ o(T, { children: [
|
|
3695
3719
|
/* @__PURE__ */ o(J, { children: [
|
|
3696
3720
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a.displayName }),
|
|
@@ -3698,14 +3722,14 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3698
3722
|
] }),
|
|
3699
3723
|
/* @__PURE__ */ o(M, { className: "py-12 text-center", children: [
|
|
3700
3724
|
/* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
3701
|
-
/* @__PURE__ */ n("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: R(
|
|
3725
|
+
/* @__PURE__ */ n("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: R(N) }),
|
|
3702
3726
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait before attempting the test again" })
|
|
3703
3727
|
] }),
|
|
3704
3728
|
g && /* @__PURE__ */ n("div", { className: "mt-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ n("p", { className: "text-red-600 dark:text-red-400 text-sm", children: g }) })
|
|
3705
3729
|
] })
|
|
3706
3730
|
] });
|
|
3707
|
-
const
|
|
3708
|
-
return
|
|
3731
|
+
const I = a.testAllowedMaxTry - a.totalFailedTries;
|
|
3732
|
+
return P ? /* @__PURE__ */ n("form", { onSubmit: z, children: /* @__PURE__ */ o(T, { children: [
|
|
3709
3733
|
/* @__PURE__ */ n(J, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
3710
3734
|
/* @__PURE__ */ o("div", { children: [
|
|
3711
3735
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a.displayName }),
|
|
@@ -3715,8 +3739,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3715
3739
|
/* @__PURE__ */ n(
|
|
3716
3740
|
"div",
|
|
3717
3741
|
{
|
|
3718
|
-
className: `text-3xl font-bold ${
|
|
3719
|
-
children: R(
|
|
3742
|
+
className: `text-3xl font-bold ${b <= 60 ? "text-danger-500" : "text-primary-500"}`,
|
|
3743
|
+
children: R(b)
|
|
3720
3744
|
}
|
|
3721
3745
|
),
|
|
3722
3746
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Time Remaining" })
|
|
@@ -3730,10 +3754,10 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3730
3754
|
" of ",
|
|
3731
3755
|
a.totalQuestionCount
|
|
3732
3756
|
] }),
|
|
3733
|
-
/* @__PURE__ */ o(me, { variant:
|
|
3734
|
-
|
|
3757
|
+
/* @__PURE__ */ o(me, { variant: I > 1 ? "success" : "warning", children: [
|
|
3758
|
+
I,
|
|
3735
3759
|
" attempt",
|
|
3736
|
-
|
|
3760
|
+
I !== 1 ? "s" : "",
|
|
3737
3761
|
" remaining"
|
|
3738
3762
|
] })
|
|
3739
3763
|
] }),
|
|
@@ -3779,12 +3803,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3779
3803
|
},
|
|
3780
3804
|
A.id
|
|
3781
3805
|
)),
|
|
3782
|
-
g && !
|
|
3806
|
+
g && !E && /* @__PURE__ */ n("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
|
|
3783
3807
|
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
3784
3808
|
" ",
|
|
3785
3809
|
g
|
|
3786
3810
|
] }) }),
|
|
3787
|
-
|
|
3811
|
+
E && /* @__PURE__ */ n("div", { className: "p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-yellow-700 dark:text-yellow-400 text-sm", children: [
|
|
3788
3812
|
/* @__PURE__ */ n("strong", { children: "Time's up!" }),
|
|
3789
3813
|
" Your answers are being submitted automatically."
|
|
3790
3814
|
] }) })
|
|
@@ -3806,7 +3830,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3806
3830
|
type: "submit",
|
|
3807
3831
|
isLoading: d,
|
|
3808
3832
|
disabled: Object.keys(m).length < a.totalQuestionCount,
|
|
3809
|
-
children:
|
|
3833
|
+
children: E ? "Submitting..." : "Submit Test"
|
|
3810
3834
|
}
|
|
3811
3835
|
)
|
|
3812
3836
|
] })
|
|
@@ -3832,7 +3856,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3832
3856
|
] }),
|
|
3833
3857
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3834
3858
|
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Attempts Remaining:" }),
|
|
3835
|
-
/* @__PURE__ */ n(me, { variant:
|
|
3859
|
+
/* @__PURE__ */ n(me, { variant: I > 1 ? "success" : "warning", children: I })
|
|
3836
3860
|
] })
|
|
3837
3861
|
] }),
|
|
3838
3862
|
g && /* @__PURE__ */ n("div", { className: "mb-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
|
|
@@ -3840,7 +3864,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3840
3864
|
" ",
|
|
3841
3865
|
g
|
|
3842
3866
|
] }) }),
|
|
3843
|
-
|
|
3867
|
+
I <= 0 && /* @__PURE__ */ n("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ n("p", { className: "text-red-600 dark:text-red-400", children: "You have used all your attempts. Please contact support for assistance." }) })
|
|
3844
3868
|
] }),
|
|
3845
3869
|
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3846
3870
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
@@ -3849,7 +3873,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3849
3873
|
{
|
|
3850
3874
|
type: "button",
|
|
3851
3875
|
onClick: C,
|
|
3852
|
-
disabled:
|
|
3876
|
+
disabled: I <= 0,
|
|
3853
3877
|
children: "Start Test"
|
|
3854
3878
|
}
|
|
3855
3879
|
)
|
|
@@ -3860,8 +3884,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3860
3884
|
onComplete: e,
|
|
3861
3885
|
onBack: r
|
|
3862
3886
|
}) => {
|
|
3863
|
-
var S, _, oe,
|
|
3864
|
-
const { applicantService: s, baseInformationService: a, config: i } = re(), { identityData: c, provider: l, token: d, isLoading: u, error: g, requestIdentity: p, restartIdentity: m } = er(t), [
|
|
3887
|
+
var S, _, oe, Le;
|
|
3888
|
+
const { applicantService: s, baseInformationService: a, config: i } = re(), { identityData: c, provider: l, token: d, isLoading: u, error: g, requestIdentity: p, restartIdentity: m } = er(t), [v, b] = x(null), [y, P] = x(null), [f, E] = x([]), [h, N] = x(!0), [F, L] = x(!1), [R, C] = x(null), [B, z] = x(!1), w = le.useRef(!1), I = Fe({
|
|
3865
3889
|
defaultValues: {
|
|
3866
3890
|
street: "",
|
|
3867
3891
|
streetNumber: "",
|
|
@@ -3879,14 +3903,14 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3879
3903
|
s.getApplicantData(t),
|
|
3880
3904
|
a.getCountries("", "en")
|
|
3881
3905
|
]);
|
|
3882
|
-
|
|
3906
|
+
P(D);
|
|
3883
3907
|
const H = /* @__PURE__ */ new Set(), ne = W.filter((ue) => {
|
|
3884
|
-
const
|
|
3885
|
-
return !
|
|
3908
|
+
const Ce = ue.abbreviation3 || ue.abbreviation;
|
|
3909
|
+
return !Ce || H.has(Ce) ? !1 : (H.add(Ce), !0);
|
|
3886
3910
|
});
|
|
3887
|
-
|
|
3911
|
+
E(ne);
|
|
3888
3912
|
const $ = D.applicantRequestData;
|
|
3889
|
-
if (
|
|
3913
|
+
if (I.reset({
|
|
3890
3914
|
street: ($ == null ? void 0 : $.street) || "",
|
|
3891
3915
|
streetNumber: ($ == null ? void 0 : $.streetNumber) || "",
|
|
3892
3916
|
city: ($ == null ? void 0 : $.city) || "",
|
|
@@ -3894,8 +3918,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3894
3918
|
country: ($ == null ? void 0 : $.country) || "",
|
|
3895
3919
|
nationality: ($ == null ? void 0 : $.nationality) || "",
|
|
3896
3920
|
phonenumber: ($ == null ? void 0 : $.phonenumber) || ""
|
|
3897
|
-
}), D.kycRecords && D.kycRecords.length > 0 && D.kycRecords[0].providerTokenObject !== null && !
|
|
3898
|
-
console.log("[Identity] Found existing identity verification, auto-requesting..."),
|
|
3921
|
+
}), D.kycRecords && D.kycRecords.length > 0 && D.kycRecords[0].providerTokenObject !== null && !w.current) {
|
|
3922
|
+
console.log("[Identity] Found existing identity verification, auto-requesting..."), w.current = !0;
|
|
3899
3923
|
try {
|
|
3900
3924
|
await p(), L(!0);
|
|
3901
3925
|
} catch (ue) {
|
|
@@ -3905,12 +3929,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3905
3929
|
} catch (D) {
|
|
3906
3930
|
console.error("Error loading applicant data:", D);
|
|
3907
3931
|
} finally {
|
|
3908
|
-
|
|
3932
|
+
N(!1);
|
|
3909
3933
|
}
|
|
3910
3934
|
})();
|
|
3911
|
-
}, [t
|
|
3912
|
-
c && !
|
|
3913
|
-
}, [c,
|
|
3935
|
+
}, [t]), V(() => {
|
|
3936
|
+
c && !F && (console.log("[Identity] Identity data already loaded, showing provider"), L(!0));
|
|
3937
|
+
}, [c, F]), V(() => {
|
|
3914
3938
|
if (d) {
|
|
3915
3939
|
if (d.expiresAt) {
|
|
3916
3940
|
const O = new Date(d.expiresAt).getTime();
|
|
@@ -3935,7 +3959,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3935
3959
|
}
|
|
3936
3960
|
}
|
|
3937
3961
|
}, [d]), V(() => {
|
|
3938
|
-
if (l !== null && d && !
|
|
3962
|
+
if (l !== null && d && !v && F && !B) {
|
|
3939
3963
|
const O = l;
|
|
3940
3964
|
if (d.url) {
|
|
3941
3965
|
console.log("[Identity] Loading provider URL for user verification:", d.url), C(null);
|
|
@@ -3953,7 +3977,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3953
3977
|
console.warn("[SardinAI] Risk SDK setup failed (non-blocking):", D);
|
|
3954
3978
|
}
|
|
3955
3979
|
}
|
|
3956
|
-
|
|
3980
|
+
b({ type: "url", url: d.url });
|
|
3957
3981
|
} catch (D) {
|
|
3958
3982
|
console.error("[Identity] Invalid URL:", D), C("Invalid verification URL. Please restart."), z(!0);
|
|
3959
3983
|
}
|
|
@@ -3964,7 +3988,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3964
3988
|
try {
|
|
3965
3989
|
const D = ye.parseProviderConfig(l, d, i), W = ye.createProvider(l, D);
|
|
3966
3990
|
W.initialize().then(() => {
|
|
3967
|
-
console.log("[SardinAI] Risk SDK initialized successfully"),
|
|
3991
|
+
console.log("[SardinAI] Risk SDK initialized successfully"), b(W), setTimeout(() => {
|
|
3968
3992
|
e == null || e();
|
|
3969
3993
|
}, 2e3);
|
|
3970
3994
|
}).catch((H) => {
|
|
@@ -3988,20 +4012,20 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3988
4012
|
e == null || e();
|
|
3989
4013
|
})) : O === se.Onfido && W.initialize("identity-container").catch((H) => {
|
|
3990
4014
|
console.error("[Onfido] Initialization error:", H), C(`Failed to initialize: ${H.message}`);
|
|
3991
|
-
}),
|
|
4015
|
+
}), b(W);
|
|
3992
4016
|
} catch (D) {
|
|
3993
4017
|
console.error("[Identity] Provider setup error:", D), C(`Setup error: ${D.message}`);
|
|
3994
4018
|
}
|
|
3995
4019
|
}
|
|
3996
4020
|
return () => {
|
|
3997
|
-
if (
|
|
4021
|
+
if (v && v.destroy)
|
|
3998
4022
|
try {
|
|
3999
|
-
|
|
4023
|
+
v.destroy();
|
|
4000
4024
|
} catch (O) {
|
|
4001
4025
|
console.error("[Identity] Error destroying provider:", O);
|
|
4002
4026
|
}
|
|
4003
4027
|
};
|
|
4004
|
-
}, [l, d,
|
|
4028
|
+
}, [l, d, v, F, e, B]);
|
|
4005
4029
|
const A = async () => {
|
|
4006
4030
|
try {
|
|
4007
4031
|
C(null), z(!1), await p(), L(!0);
|
|
@@ -4010,12 +4034,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4010
4034
|
}
|
|
4011
4035
|
}, k = async () => {
|
|
4012
4036
|
try {
|
|
4013
|
-
C(null), z(!1),
|
|
4037
|
+
C(null), z(!1), b(null), console.log("[Identity] Restarting verification..."), await m(), L(!0);
|
|
4014
4038
|
} catch (O) {
|
|
4015
4039
|
console.error("Error restarting identity verification:", O), C(O.message || "Failed to restart verification");
|
|
4016
4040
|
}
|
|
4017
4041
|
};
|
|
4018
|
-
if (
|
|
4042
|
+
if (h || u)
|
|
4019
4043
|
return /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
4020
4044
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
4021
4045
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading identity verification..." })
|
|
@@ -4025,7 +4049,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4025
4049
|
"Error: ",
|
|
4026
4050
|
g.message
|
|
4027
4051
|
] }) }) });
|
|
4028
|
-
if (
|
|
4052
|
+
if (F && (R || B))
|
|
4029
4053
|
return /* @__PURE__ */ o(T, { children: [
|
|
4030
4054
|
/* @__PURE__ */ n(J, { children: /* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
|
|
4031
4055
|
/* @__PURE__ */ o(M, { children: [
|
|
@@ -4067,7 +4091,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4067
4091
|
/* @__PURE__ */ n(j, { type: "button", onClick: k, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
|
|
4068
4092
|
] })
|
|
4069
4093
|
] });
|
|
4070
|
-
if (
|
|
4094
|
+
if (F && c) {
|
|
4071
4095
|
const O = l;
|
|
4072
4096
|
return d != null && d.url ? /* @__PURE__ */ o(T, { children: [
|
|
4073
4097
|
/* @__PURE__ */ n(J, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
@@ -4103,9 +4127,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4103
4127
|
var W, H, ne;
|
|
4104
4128
|
console.log("[Identity] Iframe loaded");
|
|
4105
4129
|
try {
|
|
4106
|
-
const $ = D.target,
|
|
4107
|
-
if (
|
|
4108
|
-
const ue = ((ne = (H =
|
|
4130
|
+
const $ = D.target, Se = $.contentDocument || ((W = $.contentWindow) == null ? void 0 : W.document);
|
|
4131
|
+
if (Se) {
|
|
4132
|
+
const ue = ((ne = (H = Se.body) == null ? void 0 : H.textContent) == null ? void 0 : ne.toLowerCase()) || "";
|
|
4109
4133
|
(ue.includes("expired") || ue.includes("invalid") || ue.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"), z(!0), C("Your verification link has expired."));
|
|
4110
4134
|
}
|
|
4111
4135
|
} catch {
|
|
@@ -4135,7 +4159,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4135
4159
|
r && /* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(j, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4136
4160
|
] });
|
|
4137
4161
|
}
|
|
4138
|
-
return /* @__PURE__ */ n("form", { onSubmit:
|
|
4162
|
+
return /* @__PURE__ */ n("form", { onSubmit: I.handleSubmit(A), children: /* @__PURE__ */ o(T, { children: [
|
|
4139
4163
|
/* @__PURE__ */ o(J, { children: [
|
|
4140
4164
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Review Your Information" }),
|
|
4141
4165
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please review and confirm your information before starting identity verification" })
|
|
@@ -4145,18 +4169,18 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4145
4169
|
/* @__PURE__ */ o("div", { children: [
|
|
4146
4170
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
|
|
4147
4171
|
/* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
|
|
4148
|
-
(S =
|
|
4172
|
+
(S = y == null ? void 0 : y.applicantRequestData) == null ? void 0 : S.firstName,
|
|
4149
4173
|
" ",
|
|
4150
|
-
(_ =
|
|
4174
|
+
(_ = y == null ? void 0 : y.applicantRequestData) == null ? void 0 : _.lastName
|
|
4151
4175
|
] })
|
|
4152
4176
|
] }),
|
|
4153
4177
|
/* @__PURE__ */ o("div", { children: [
|
|
4154
4178
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Email" }),
|
|
4155
|
-
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: (oe =
|
|
4179
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: (oe = y == null ? void 0 : y.applicantRequestData) == null ? void 0 : oe.email })
|
|
4156
4180
|
] }),
|
|
4157
4181
|
/* @__PURE__ */ o("div", { children: [
|
|
4158
4182
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Date of Birth" }),
|
|
4159
|
-
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ((
|
|
4183
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ((Le = y == null ? void 0 : y.applicantRequestData) == null ? void 0 : Le.dateOfBirth) || "Not provided" })
|
|
4160
4184
|
] })
|
|
4161
4185
|
] }),
|
|
4162
4186
|
/* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
@@ -4165,7 +4189,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4165
4189
|
/* @__PURE__ */ n(
|
|
4166
4190
|
G,
|
|
4167
4191
|
{
|
|
4168
|
-
control:
|
|
4192
|
+
control: I.control,
|
|
4169
4193
|
name: "country",
|
|
4170
4194
|
render: ({ field: O }) => /* @__PURE__ */ n(
|
|
4171
4195
|
ge,
|
|
@@ -4174,7 +4198,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4174
4198
|
label: "Country",
|
|
4175
4199
|
options: [
|
|
4176
4200
|
{ value: "", label: "Select country..." },
|
|
4177
|
-
...
|
|
4201
|
+
...f.map((D) => ({
|
|
4178
4202
|
value: D.abbreviation3 || D.abbreviation,
|
|
4179
4203
|
label: D.name
|
|
4180
4204
|
}))
|
|
@@ -4186,7 +4210,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4186
4210
|
/* @__PURE__ */ n(
|
|
4187
4211
|
G,
|
|
4188
4212
|
{
|
|
4189
|
-
control:
|
|
4213
|
+
control: I.control,
|
|
4190
4214
|
name: "nationality",
|
|
4191
4215
|
render: ({ field: O }) => /* @__PURE__ */ n(
|
|
4192
4216
|
ge,
|
|
@@ -4195,7 +4219,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4195
4219
|
label: "Nationality",
|
|
4196
4220
|
options: [
|
|
4197
4221
|
{ value: "", label: "Select nationality..." },
|
|
4198
|
-
...
|
|
4222
|
+
...f.map((D) => ({
|
|
4199
4223
|
value: D.abbreviation3 || D.abbreviation,
|
|
4200
4224
|
label: D.name
|
|
4201
4225
|
}))
|
|
@@ -4209,7 +4233,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4209
4233
|
/* @__PURE__ */ n(
|
|
4210
4234
|
G,
|
|
4211
4235
|
{
|
|
4212
|
-
control:
|
|
4236
|
+
control: I.control,
|
|
4213
4237
|
name: "street",
|
|
4214
4238
|
render: ({ field: O }) => /* @__PURE__ */ n(Z, { ...O, label: "Street" })
|
|
4215
4239
|
}
|
|
@@ -4217,7 +4241,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4217
4241
|
/* @__PURE__ */ n(
|
|
4218
4242
|
G,
|
|
4219
4243
|
{
|
|
4220
|
-
control:
|
|
4244
|
+
control: I.control,
|
|
4221
4245
|
name: "streetNumber",
|
|
4222
4246
|
render: ({ field: O }) => /* @__PURE__ */ n(Z, { ...O, label: "Street Number" })
|
|
4223
4247
|
}
|
|
@@ -4227,7 +4251,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4227
4251
|
/* @__PURE__ */ n(
|
|
4228
4252
|
G,
|
|
4229
4253
|
{
|
|
4230
|
-
control:
|
|
4254
|
+
control: I.control,
|
|
4231
4255
|
name: "city",
|
|
4232
4256
|
render: ({ field: O }) => /* @__PURE__ */ n(Z, { ...O, label: "City" })
|
|
4233
4257
|
}
|
|
@@ -4235,7 +4259,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4235
4259
|
/* @__PURE__ */ n(
|
|
4236
4260
|
G,
|
|
4237
4261
|
{
|
|
4238
|
-
control:
|
|
4262
|
+
control: I.control,
|
|
4239
4263
|
name: "zip",
|
|
4240
4264
|
render: ({ field: O }) => /* @__PURE__ */ n(Z, { ...O, label: "ZIP/Postal Code" })
|
|
4241
4265
|
}
|
|
@@ -4244,7 +4268,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4244
4268
|
/* @__PURE__ */ n(
|
|
4245
4269
|
G,
|
|
4246
4270
|
{
|
|
4247
|
-
control:
|
|
4271
|
+
control: I.control,
|
|
4248
4272
|
name: "phonenumber",
|
|
4249
4273
|
render: ({ field: O }) => /* @__PURE__ */ n(Z, { ...O, label: "Phone Number", type: "tel" })
|
|
4250
4274
|
}
|
|
@@ -4256,7 +4280,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4256
4280
|
/* @__PURE__ */ n(j, { type: "submit", isLoading: u, children: "Confirm and Start Verification" })
|
|
4257
4281
|
] })
|
|
4258
4282
|
] }) });
|
|
4259
|
-
},
|
|
4283
|
+
}, $e = ({
|
|
4260
4284
|
kycStatus: t,
|
|
4261
4285
|
reviewStatus: e,
|
|
4262
4286
|
workflowResult: r,
|
|
@@ -4306,21 +4330,21 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4306
4330
|
iconBg: "bg-yellow-100 dark:bg-yellow-900/30",
|
|
4307
4331
|
iconColor: "text-yellow-700 dark:text-yellow-400",
|
|
4308
4332
|
message: "Your application is currently under manual review."
|
|
4309
|
-
} : r ===
|
|
4333
|
+
} : r === ke.Success ? {
|
|
4310
4334
|
type: "success",
|
|
4311
4335
|
title: "Process Complete",
|
|
4312
4336
|
icon: "✓",
|
|
4313
4337
|
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4314
4338
|
iconColor: "text-green-600 dark:text-green-400",
|
|
4315
4339
|
message: "Your verification process has been completed successfully."
|
|
4316
|
-
} : r ===
|
|
4340
|
+
} : r === ke.Failed ? {
|
|
4317
4341
|
type: "error",
|
|
4318
4342
|
title: "Process Failed",
|
|
4319
4343
|
icon: "✕",
|
|
4320
4344
|
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4321
4345
|
iconColor: "text-red-600 dark:text-red-400",
|
|
4322
4346
|
message: "The verification process could not be completed."
|
|
4323
|
-
} : r ===
|
|
4347
|
+
} : r === ke.AdminReview ? {
|
|
4324
4348
|
type: "pending",
|
|
4325
4349
|
title: "Admin Review Required",
|
|
4326
4350
|
icon: "📋",
|
|
@@ -4418,11 +4442,11 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4418
4442
|
subtitle: e,
|
|
4419
4443
|
className: r = ""
|
|
4420
4444
|
}) => {
|
|
4421
|
-
const {
|
|
4445
|
+
const { currentTheme: s } = re(), a = t || (s == null ? void 0 : s.title) || "KYC Verification";
|
|
4422
4446
|
return /* @__PURE__ */ o("div", { className: `metakyc-header ${r}`, children: [
|
|
4423
|
-
|
|
4447
|
+
(s == null ? void 0 : s.logo) && s.logo.visible && /* @__PURE__ */ n("div", { className: "mb-3", children: /* @__PURE__ */ n(Er, { config: s.logo }) }),
|
|
4424
4448
|
/* @__PURE__ */ o("div", { children: [
|
|
4425
|
-
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children:
|
|
4449
|
+
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a }),
|
|
4426
4450
|
e && /* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: e })
|
|
4427
4451
|
] })
|
|
4428
4452
|
] });
|
|
@@ -4433,20 +4457,20 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4433
4457
|
onCancel: s
|
|
4434
4458
|
}) => {
|
|
4435
4459
|
var C, B, z;
|
|
4436
|
-
const { config: a, baseInformationService: i } = re(), { createApplicant: c, isLoading: l } = rr(), [d, u] = x([]), [g, p] = x(!0), [m,
|
|
4437
|
-
if (!
|
|
4460
|
+
const { config: a, baseInformationService: i } = re(), { createApplicant: c, isLoading: l } = rr(), [d, u] = x([]), [g, p] = x(!0), [m, v] = x(!1), [b, y] = x(null), P = t || ((C = a.applicantForm) == null ? void 0 : C.workflowKey);
|
|
4461
|
+
if (!P)
|
|
4438
4462
|
throw new Error(
|
|
4439
4463
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
4440
4464
|
);
|
|
4441
|
-
const
|
|
4442
|
-
workflowKey:
|
|
4465
|
+
const f = e || ((B = a.applicantForm) == null ? void 0 : B.externalRefId) || "", E = ((z = a.applicantForm) == null ? void 0 : z.visibleFields) || gt, [h, N] = x({
|
|
4466
|
+
workflowKey: P,
|
|
4443
4467
|
firstName: "",
|
|
4444
4468
|
lastName: "",
|
|
4445
4469
|
title: "",
|
|
4446
4470
|
email: "",
|
|
4447
4471
|
dateOfBirth: "",
|
|
4448
4472
|
phonenumber: "",
|
|
4449
|
-
externalRefId:
|
|
4473
|
+
externalRefId: f,
|
|
4450
4474
|
// Set from config or prop
|
|
4451
4475
|
mobileCountryCode: "",
|
|
4452
4476
|
street: "",
|
|
@@ -4469,128 +4493,128 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4469
4493
|
(async () => {
|
|
4470
4494
|
try {
|
|
4471
4495
|
p(!0);
|
|
4472
|
-
const
|
|
4496
|
+
const I = await i.getCountries("", a.locale || "en"), A = /* @__PURE__ */ new Set(), k = I.map((S) => ({
|
|
4473
4497
|
value: S.abbreviation3 || S.abbreviation,
|
|
4474
4498
|
label: S.name
|
|
4475
4499
|
})).filter((S) => !S.value || A.has(S.value) ? !1 : (A.add(S.value), !0));
|
|
4476
4500
|
u(k);
|
|
4477
|
-
} catch (
|
|
4478
|
-
console.error("Failed to load countries:",
|
|
4501
|
+
} catch (I) {
|
|
4502
|
+
console.error("Failed to load countries:", I);
|
|
4479
4503
|
} finally {
|
|
4480
4504
|
p(!1);
|
|
4481
4505
|
}
|
|
4482
4506
|
})();
|
|
4483
4507
|
}, [i, a.locale]);
|
|
4484
|
-
const
|
|
4485
|
-
|
|
4486
|
-
}, L = async (
|
|
4487
|
-
|
|
4508
|
+
const F = (w, I) => {
|
|
4509
|
+
N((A) => ({ ...A, [w]: I }));
|
|
4510
|
+
}, L = async (w) => {
|
|
4511
|
+
w.preventDefault(), v(!0), y(null);
|
|
4488
4512
|
try {
|
|
4489
|
-
if (!
|
|
4490
|
-
|
|
4513
|
+
if (!h.externalRefId || h.externalRefId.trim() === "") {
|
|
4514
|
+
y("External Reference ID is required and cannot be empty"), v(!1);
|
|
4491
4515
|
return;
|
|
4492
4516
|
}
|
|
4493
|
-
const
|
|
4494
|
-
workflowKey:
|
|
4495
|
-
externalRefId:
|
|
4517
|
+
const I = {
|
|
4518
|
+
workflowKey: h.workflowKey,
|
|
4519
|
+
externalRefId: h.externalRefId.trim()
|
|
4496
4520
|
// Always include, never empty
|
|
4497
4521
|
};
|
|
4498
|
-
|
|
4522
|
+
E.forEach((k) => {
|
|
4499
4523
|
if (k === "externalRefId") return;
|
|
4500
|
-
const S =
|
|
4501
|
-
S != null && S !== "" && !(Array.isArray(S) && S.length === 0) && (
|
|
4502
|
-
}), console.log("Creating applicant with data:",
|
|
4524
|
+
const S = h[k];
|
|
4525
|
+
S != null && S !== "" && !(Array.isArray(S) && S.length === 0) && (I[k] = S);
|
|
4526
|
+
}), console.log("Creating applicant with data:", I);
|
|
4503
4527
|
const A = await c(
|
|
4504
|
-
|
|
4528
|
+
I
|
|
4505
4529
|
);
|
|
4506
4530
|
console.log("Applicant created:", A), r(A.applicantId);
|
|
4507
|
-
} catch (
|
|
4508
|
-
console.error("Error creating applicant:",
|
|
4531
|
+
} catch (I) {
|
|
4532
|
+
console.error("Error creating applicant:", I), y(I.message || "Failed to create applicant");
|
|
4509
4533
|
} finally {
|
|
4510
|
-
|
|
4534
|
+
v(!1);
|
|
4511
4535
|
}
|
|
4512
|
-
}, R = (
|
|
4536
|
+
}, R = (w) => {
|
|
4513
4537
|
var A, k;
|
|
4514
|
-
const
|
|
4515
|
-
switch (
|
|
4538
|
+
const I = yt[w];
|
|
4539
|
+
switch (I.type) {
|
|
4516
4540
|
case "select":
|
|
4517
|
-
return
|
|
4541
|
+
return w === "country" || w === "nationality" || w === "taxCountry" || w === "countryOfBirth" ? /* @__PURE__ */ n(
|
|
4518
4542
|
ge,
|
|
4519
4543
|
{
|
|
4520
|
-
label:
|
|
4521
|
-
value: w
|
|
4522
|
-
onChange: (S) =>
|
|
4544
|
+
label: I.label,
|
|
4545
|
+
value: h[w] || "",
|
|
4546
|
+
onChange: (S) => F(w, S.target.value),
|
|
4523
4547
|
options: [
|
|
4524
|
-
{ value: "", label: `Select ${
|
|
4548
|
+
{ value: "", label: `Select ${I.label.toLowerCase()}...` },
|
|
4525
4549
|
...d
|
|
4526
4550
|
],
|
|
4527
4551
|
disabled: g
|
|
4528
4552
|
},
|
|
4529
|
-
|
|
4530
|
-
) :
|
|
4553
|
+
w
|
|
4554
|
+
) : w === "salutation" ? /* @__PURE__ */ n(
|
|
4531
4555
|
ge,
|
|
4532
4556
|
{
|
|
4533
|
-
label:
|
|
4534
|
-
value: ((A = w
|
|
4535
|
-
onChange: (S) =>
|
|
4557
|
+
label: I.label,
|
|
4558
|
+
value: ((A = h[w]) == null ? void 0 : A.toString()) || "",
|
|
4559
|
+
onChange: (S) => F(w, S.target.value ? Number(S.target.value) : null),
|
|
4536
4560
|
options: [
|
|
4537
4561
|
{ value: "", label: "Select salutation..." },
|
|
4538
|
-
{ value:
|
|
4539
|
-
{ value:
|
|
4540
|
-
{ value:
|
|
4562
|
+
{ value: Ne.Male.toString(), label: "Male" },
|
|
4563
|
+
{ value: Ne.Female.toString(), label: "Female" },
|
|
4564
|
+
{ value: Ne.Other.toString(), label: "Other" }
|
|
4541
4565
|
]
|
|
4542
4566
|
},
|
|
4543
|
-
|
|
4567
|
+
w
|
|
4544
4568
|
) : null;
|
|
4545
4569
|
case "multiselect":
|
|
4546
|
-
return
|
|
4570
|
+
return w === "otherNationality" ? /* @__PURE__ */ n(
|
|
4547
4571
|
Z,
|
|
4548
4572
|
{
|
|
4549
4573
|
type: "text",
|
|
4550
|
-
label:
|
|
4551
|
-
value: ((k = w
|
|
4574
|
+
label: I.label,
|
|
4575
|
+
value: ((k = h[w]) == null ? void 0 : k.join(", ")) || "",
|
|
4552
4576
|
onChange: (S) => {
|
|
4553
4577
|
const _ = S.target.value.split(",").map((oe) => oe.trim()).filter(Boolean);
|
|
4554
|
-
|
|
4578
|
+
F(w, _);
|
|
4555
4579
|
},
|
|
4556
4580
|
placeholder: "Enter countries separated by commas"
|
|
4557
4581
|
},
|
|
4558
|
-
|
|
4582
|
+
w
|
|
4559
4583
|
) : null;
|
|
4560
4584
|
case "date":
|
|
4561
4585
|
return /* @__PURE__ */ n(
|
|
4562
4586
|
Z,
|
|
4563
4587
|
{
|
|
4564
4588
|
type: "date",
|
|
4565
|
-
label:
|
|
4566
|
-
value: w
|
|
4567
|
-
onChange: (S) =>
|
|
4589
|
+
label: I.label,
|
|
4590
|
+
value: h[w] || "",
|
|
4591
|
+
onChange: (S) => F(w, S.target.value)
|
|
4568
4592
|
},
|
|
4569
|
-
|
|
4593
|
+
w
|
|
4570
4594
|
);
|
|
4571
4595
|
case "email":
|
|
4572
4596
|
return /* @__PURE__ */ n(
|
|
4573
4597
|
Z,
|
|
4574
4598
|
{
|
|
4575
4599
|
type: "email",
|
|
4576
|
-
label:
|
|
4577
|
-
value: w
|
|
4578
|
-
onChange: (S) =>
|
|
4579
|
-
required:
|
|
4600
|
+
label: I.label,
|
|
4601
|
+
value: h[w] || "",
|
|
4602
|
+
onChange: (S) => F(w, S.target.value),
|
|
4603
|
+
required: w === "email"
|
|
4580
4604
|
},
|
|
4581
|
-
|
|
4605
|
+
w
|
|
4582
4606
|
);
|
|
4583
4607
|
case "tel":
|
|
4584
4608
|
return /* @__PURE__ */ n(
|
|
4585
4609
|
Z,
|
|
4586
4610
|
{
|
|
4587
4611
|
type: "tel",
|
|
4588
|
-
label:
|
|
4589
|
-
value: w
|
|
4590
|
-
onChange: (S) =>
|
|
4591
|
-
required:
|
|
4612
|
+
label: I.label,
|
|
4613
|
+
value: h[w] || "",
|
|
4614
|
+
onChange: (S) => F(w, S.target.value),
|
|
4615
|
+
required: w === "phonenumber"
|
|
4592
4616
|
},
|
|
4593
|
-
|
|
4617
|
+
w
|
|
4594
4618
|
);
|
|
4595
4619
|
case "text":
|
|
4596
4620
|
default:
|
|
@@ -4598,12 +4622,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4598
4622
|
Z,
|
|
4599
4623
|
{
|
|
4600
4624
|
type: "text",
|
|
4601
|
-
label:
|
|
4602
|
-
value: w
|
|
4603
|
-
onChange: (S) =>
|
|
4604
|
-
required:
|
|
4625
|
+
label: I.label,
|
|
4626
|
+
value: h[w] || "",
|
|
4627
|
+
onChange: (S) => F(w, S.target.value),
|
|
4628
|
+
required: w === "firstName" || w === "lastName" || w === "externalRefId"
|
|
4605
4629
|
},
|
|
4606
|
-
|
|
4630
|
+
w
|
|
4607
4631
|
);
|
|
4608
4632
|
}
|
|
4609
4633
|
};
|
|
@@ -4619,12 +4643,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4619
4643
|
}
|
|
4620
4644
|
) }),
|
|
4621
4645
|
/* @__PURE__ */ o(M, { children: [
|
|
4622
|
-
|
|
4646
|
+
b && /* @__PURE__ */ n("div", { className: "mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
|
|
4623
4647
|
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
4624
4648
|
" ",
|
|
4625
|
-
|
|
4649
|
+
b
|
|
4626
4650
|
] }) }),
|
|
4627
|
-
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
4651
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: E.map((w) => R(w)) })
|
|
4628
4652
|
] }),
|
|
4629
4653
|
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
4630
4654
|
s && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: s, disabled: m || l, children: "Cancel" }),
|
|
@@ -4647,9 +4671,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4647
4671
|
hasWorkflowChanged: g,
|
|
4648
4672
|
isLoading: p,
|
|
4649
4673
|
error: m,
|
|
4650
|
-
moveBack:
|
|
4651
|
-
refreshProgress:
|
|
4652
|
-
} = Gt(t), [
|
|
4674
|
+
moveBack: v,
|
|
4675
|
+
refreshProgress: b
|
|
4676
|
+
} = Gt(t), [y, P] = le.useState(!1);
|
|
4653
4677
|
if (le.useEffect(() => {
|
|
4654
4678
|
m && r && r(m);
|
|
4655
4679
|
}, [m, r]), le.useEffect(() => {
|
|
@@ -4657,7 +4681,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4657
4681
|
}, [i == null ? void 0 : i.workflowResult, e]), le.useEffect(() => {
|
|
4658
4682
|
s === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
4659
4683
|
}, [s]), le.useEffect(() => {
|
|
4660
|
-
g &&
|
|
4684
|
+
g && P(!1);
|
|
4661
4685
|
}, [g]), p || !i)
|
|
4662
4686
|
return /* @__PURE__ */ n("div", { className: a, children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
4663
4687
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
@@ -4668,7 +4692,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4668
4692
|
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "An error occurred" }),
|
|
4669
4693
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: m.message })
|
|
4670
4694
|
] }) }) }) });
|
|
4671
|
-
if (g && !
|
|
4695
|
+
if (g && !y)
|
|
4672
4696
|
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(M, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
4673
4697
|
/* @__PURE__ */ n("div", { className: "mb-6", children: /* @__PURE__ */ n("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900 mb-4", children: /* @__PURE__ */ n("svg", { className: "w-8 h-8 text-blue-600 dark:text-blue-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) }) }),
|
|
4674
4698
|
/* @__PURE__ */ n("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white mb-2", children: "Workflow Transition" }),
|
|
@@ -4690,7 +4714,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4690
4714
|
/* @__PURE__ */ n(
|
|
4691
4715
|
"button",
|
|
4692
4716
|
{
|
|
4693
|
-
onClick: () =>
|
|
4717
|
+
onClick: () => P(!0),
|
|
4694
4718
|
className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",
|
|
4695
4719
|
children: "Continue with New Workflow"
|
|
4696
4720
|
}
|
|
@@ -4698,7 +4722,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4698
4722
|
] }) }) }) });
|
|
4699
4723
|
if (i.status === ae.Finished || i.status === ae.OnHold)
|
|
4700
4724
|
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(
|
|
4701
|
-
|
|
4725
|
+
$e,
|
|
4702
4726
|
{
|
|
4703
4727
|
kycStatus: i.kycStatus,
|
|
4704
4728
|
reviewStatus: i.reviewStatus,
|
|
@@ -4715,20 +4739,20 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4715
4739
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
4716
4740
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: i.status === ae.IdentityPending ? "Loading identity verification..." : "Loading current step..." })
|
|
4717
4741
|
] }) }) });
|
|
4718
|
-
const
|
|
4719
|
-
const
|
|
4742
|
+
const f = () => {
|
|
4743
|
+
const h = l.filter((R) => R.visibility !== !1), N = h.findIndex((R) => R.order === c.order), F = N >= 0 ? N + 1 : 1, L = h.length;
|
|
4720
4744
|
return /* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
4721
4745
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-4", children: [
|
|
4722
4746
|
/* @__PURE__ */ n(Ze, {}),
|
|
4723
4747
|
/* @__PURE__ */ o(me, { variant: i.status === 1 ? "info" : "success", children: [
|
|
4724
4748
|
"Step ",
|
|
4725
|
-
|
|
4749
|
+
F,
|
|
4726
4750
|
" of ",
|
|
4727
4751
|
L
|
|
4728
4752
|
] })
|
|
4729
4753
|
] }),
|
|
4730
|
-
/* @__PURE__ */ n("div", { className: "flex items-center", children:
|
|
4731
|
-
const B = C <
|
|
4754
|
+
/* @__PURE__ */ n("div", { className: "flex items-center", children: h.map((R, C) => {
|
|
4755
|
+
const B = C < N, z = R.order === c.order;
|
|
4732
4756
|
return /* @__PURE__ */ o(le.Fragment, { children: [
|
|
4733
4757
|
/* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
4734
4758
|
/* @__PURE__ */ n(
|
|
@@ -4749,7 +4773,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4749
4773
|
}
|
|
4750
4774
|
)
|
|
4751
4775
|
] }),
|
|
4752
|
-
C <
|
|
4776
|
+
C < h.length - 1 && /* @__PURE__ */ n(
|
|
4753
4777
|
"div",
|
|
4754
4778
|
{
|
|
4755
4779
|
className: `flex-1 h-0.5 mx-4 ${B ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
|
|
@@ -4758,33 +4782,33 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4758
4782
|
] }, R.order);
|
|
4759
4783
|
}) })
|
|
4760
4784
|
] });
|
|
4761
|
-
},
|
|
4762
|
-
const
|
|
4785
|
+
}, E = () => {
|
|
4786
|
+
const h = {
|
|
4763
4787
|
applicantId: t,
|
|
4764
4788
|
onComplete: async () => {
|
|
4765
|
-
await
|
|
4789
|
+
await b();
|
|
4766
4790
|
},
|
|
4767
|
-
onBack: c.order > 0 ?
|
|
4791
|
+
onBack: c.order > 0 ? v : void 0
|
|
4768
4792
|
};
|
|
4769
4793
|
switch (c.action) {
|
|
4770
4794
|
case U.Questionaries:
|
|
4771
|
-
return /* @__PURE__ */ n(vr, { ...
|
|
4795
|
+
return /* @__PURE__ */ n(vr, { ...h });
|
|
4772
4796
|
case U.UploadDocument:
|
|
4773
|
-
return /* @__PURE__ */ n(wr, { ...
|
|
4797
|
+
return /* @__PURE__ */ n(wr, { ...h });
|
|
4774
4798
|
case U.Overview:
|
|
4775
|
-
return /* @__PURE__ */ n(kr, { ...
|
|
4799
|
+
return /* @__PURE__ */ n(kr, { ...h });
|
|
4776
4800
|
case U.IdentitySdk:
|
|
4777
|
-
return /* @__PURE__ */ n(Ar, { ...
|
|
4801
|
+
return /* @__PURE__ */ n(Ar, { ...h });
|
|
4778
4802
|
case U.RiskScoring:
|
|
4779
|
-
return /* @__PURE__ */ n(Nr, { ...
|
|
4803
|
+
return /* @__PURE__ */ n(Nr, { ...h });
|
|
4780
4804
|
case U.AdditionalData:
|
|
4781
4805
|
case U.InvestorCategorization:
|
|
4782
|
-
return /* @__PURE__ */ n(Sr, { ...
|
|
4806
|
+
return /* @__PURE__ */ n(Sr, { ...h });
|
|
4783
4807
|
case U.AppropriatenessTest:
|
|
4784
|
-
return /* @__PURE__ */ n(Cr, { ...
|
|
4808
|
+
return /* @__PURE__ */ n(Cr, { ...h });
|
|
4785
4809
|
case U.ManualReview:
|
|
4786
4810
|
return /* @__PURE__ */ n(
|
|
4787
|
-
|
|
4811
|
+
$e,
|
|
4788
4812
|
{
|
|
4789
4813
|
kycStatus: i.kycStatus,
|
|
4790
4814
|
reviewStatus: i.reviewStatus,
|
|
@@ -4807,8 +4831,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4807
4831
|
}
|
|
4808
4832
|
};
|
|
4809
4833
|
return /* @__PURE__ */ o("div", { className: `metakyc-sdk ${a || ""}`, children: [
|
|
4810
|
-
|
|
4811
|
-
|
|
4834
|
+
f(),
|
|
4835
|
+
E()
|
|
4812
4836
|
] });
|
|
4813
4837
|
};
|
|
4814
4838
|
export {
|
|
@@ -4837,7 +4861,7 @@ export {
|
|
|
4837
4861
|
yt as FIELD_METADATA,
|
|
4838
4862
|
ct as FileType,
|
|
4839
4863
|
nr as FileUpload,
|
|
4840
|
-
|
|
4864
|
+
Ne as GenderType,
|
|
4841
4865
|
Ze as Header,
|
|
4842
4866
|
xt as HttpClient,
|
|
4843
4867
|
ye as IdentityProviderManager,
|
|
@@ -4851,7 +4875,7 @@ export {
|
|
|
4851
4875
|
pt as InvestorCategoryType,
|
|
4852
4876
|
ot as KycProcessStatus,
|
|
4853
4877
|
he as KycStatus,
|
|
4854
|
-
|
|
4878
|
+
$e as KycStatusDisplay,
|
|
4855
4879
|
Wr as KycWorkflow,
|
|
4856
4880
|
Er as Logo,
|
|
4857
4881
|
Ue as MetaKYCContext,
|
|
@@ -4879,9 +4903,9 @@ export {
|
|
|
4879
4903
|
kt as UploadDocumentService,
|
|
4880
4904
|
wr as UploadDocumentStep,
|
|
4881
4905
|
lt as UserType,
|
|
4882
|
-
|
|
4906
|
+
Re as ValueDataType,
|
|
4883
4907
|
$t as WorkflowOrchestrator,
|
|
4884
|
-
|
|
4908
|
+
ke as WorkflowResultType,
|
|
4885
4909
|
Ot as WorkflowState,
|
|
4886
4910
|
U as WorkflowStepAction,
|
|
4887
4911
|
Vr as appropriatenessTestSchema,
|
|
@@ -4894,7 +4918,7 @@ export {
|
|
|
4894
4918
|
Q as defaultTheme,
|
|
4895
4919
|
qt as fileToBase64,
|
|
4896
4920
|
Dt as fintechTheme,
|
|
4897
|
-
|
|
4921
|
+
Ee as formatFileSize,
|
|
4898
4922
|
Hr as generateAppropriatenessSchema,
|
|
4899
4923
|
yr as generateQuestionnaireSchema,
|
|
4900
4924
|
br as generateRiskScoringSchema,
|