@vpdev2/metakyc-sdk 1.0.5 → 1.0.6
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/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/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +165 -164
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var Xe = (t, e, r) => e in t ? Je(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var K = (t, e, r) => Xe(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import et from "axios";
|
|
5
5
|
import * as Le from "react";
|
|
6
|
-
import le, { createContext as tt, useMemo as $e, useEffect as V, useContext as rt,
|
|
6
|
+
import le, { createContext as tt, useState as x, useMemo as $e, useEffect as V, useContext as rt, useRef as je, useCallback as q, forwardRef as De } from "react";
|
|
7
7
|
import { jsx as n, jsxs as o, Fragment as nt } from "react/jsx-runtime";
|
|
8
8
|
import { get as Ee, set as Ce, appendErrors as _e, useForm as Pe, Controller as G } from "react-hook-form";
|
|
9
9
|
import { z as de } from "zod";
|
|
@@ -1776,49 +1776,50 @@ class Ut {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
const Ue = tt(null), Or = ({ config: t, children: e }) => {
|
|
1779
|
-
const r = $e(() => {
|
|
1780
|
-
const
|
|
1779
|
+
const [r, s] = x(null), a = $e(() => {
|
|
1780
|
+
const i = new xt(t), c = new vt(i), l = new wt(i), d = new kt(i), u = new Nt(i), g = new St(i), p = new Ct(i), m = new At(i), b = new Et(i), y = new It(i), f = new Mt(i), P = 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:
|
|
1783
|
+
httpClient: i,
|
|
1784
|
+
applicantService: c,
|
|
1785
|
+
questionnaireService: l,
|
|
1786
|
+
uploadDocumentService: d,
|
|
1787
|
+
appropriatenessTestService: u,
|
|
1788
|
+
overviewService: g,
|
|
1789
|
+
riskScoringService: p,
|
|
1790
|
+
identityService: m,
|
|
1791
|
+
baseInformationService: b,
|
|
1792
|
+
investorCategorizationService: y,
|
|
1793
1793
|
themeService: f,
|
|
1794
|
-
themeManager:
|
|
1794
|
+
themeManager: P,
|
|
1795
|
+
currentTheme: r,
|
|
1795
1796
|
createOrchestrator: () => new $t(
|
|
1796
|
-
a,
|
|
1797
|
-
i,
|
|
1798
1797
|
c,
|
|
1799
1798
|
l,
|
|
1800
1799
|
d,
|
|
1801
1800
|
u,
|
|
1802
1801
|
g,
|
|
1803
|
-
|
|
1802
|
+
p,
|
|
1803
|
+
m,
|
|
1804
|
+
y
|
|
1804
1805
|
)
|
|
1805
1806
|
};
|
|
1806
|
-
}, [t]);
|
|
1807
|
+
}, [t, r]);
|
|
1807
1808
|
return V(() => ((async () => {
|
|
1808
1809
|
try {
|
|
1809
1810
|
if (t.theme) {
|
|
1810
|
-
console.log("[MetaKYC] Applying static theme from config"),
|
|
1811
|
+
console.log("[MetaKYC] Applying static theme from config"), a.themeManager.applyTheme(t.theme), s(a.themeManager.getCurrentTheme());
|
|
1811
1812
|
return;
|
|
1812
1813
|
}
|
|
1813
1814
|
console.log("[MetaKYC] Fetching theme from backend...");
|
|
1814
|
-
const
|
|
1815
|
-
|
|
1816
|
-
} catch (
|
|
1817
|
-
console.warn("[MetaKYC] Failed to load theme, using default:", a);
|
|
1815
|
+
const c = await a.themeService.getThemeConfiguration();
|
|
1816
|
+
a.themeManager.applyTheme(c), s(a.themeManager.getCurrentTheme()), console.log("[MetaKYC] Theme loaded and applied", c);
|
|
1817
|
+
} catch (c) {
|
|
1818
|
+
console.warn("[MetaKYC] Failed to load theme, using default:", c), s(a.themeManager.getCurrentTheme());
|
|
1818
1819
|
}
|
|
1819
1820
|
})(), () => {
|
|
1820
|
-
|
|
1821
|
-
}), [t.theme,
|
|
1821
|
+
a.themeManager.cleanup();
|
|
1822
|
+
}), [t.theme, a.themeService, a.themeManager]), /* @__PURE__ */ n(Ue.Provider, { value: a, children: e });
|
|
1822
1823
|
};
|
|
1823
1824
|
function re() {
|
|
1824
1825
|
const t = rt(Ue);
|
|
@@ -1964,7 +1965,7 @@ function Gt(t) {
|
|
|
1964
1965
|
i(!1);
|
|
1965
1966
|
}
|
|
1966
1967
|
}
|
|
1967
|
-
}, []),
|
|
1968
|
+
}, []), b = q(async () => {
|
|
1968
1969
|
if (d.current) {
|
|
1969
1970
|
i(!0), l(null);
|
|
1970
1971
|
try {
|
|
@@ -1989,24 +1990,24 @@ function Gt(t) {
|
|
|
1989
1990
|
i(!1);
|
|
1990
1991
|
}
|
|
1991
1992
|
}
|
|
1992
|
-
}, []),
|
|
1993
|
+
}, []), f = Le.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((h, N) => h.order - N.order) : [], [r == null ? void 0 : r.stepInfoList]), P = Le.useMemo(() => r ? r.nextWorkflowKey && r.nextWorkflowKey !== r.workFlowKey : !1, [r]);
|
|
1993
1994
|
return {
|
|
1994
1995
|
progress: r,
|
|
1995
1996
|
applicantId: u,
|
|
1996
1997
|
currentStep: (r == null ? void 0 : r.currentStep) || null,
|
|
1997
|
-
steps:
|
|
1998
|
+
steps: f,
|
|
1998
1999
|
status: (r == null ? void 0 : r.status) || ae.None,
|
|
1999
2000
|
workflowResult: (r == null ? void 0 : r.workflowResult) || null,
|
|
2000
2001
|
workflowKey: r == null ? void 0 : r.workFlowKey,
|
|
2001
2002
|
nextWorkflowKey: r == null ? void 0 : r.nextWorkflowKey,
|
|
2002
|
-
hasWorkflowChanged:
|
|
2003
|
+
hasWorkflowChanged: P,
|
|
2003
2004
|
isLoading: a,
|
|
2004
2005
|
error: c,
|
|
2005
2006
|
isComplete: (r == null ? void 0 : r.status) === ae.Finished,
|
|
2006
2007
|
isOnHold: (r == null ? void 0 : r.status) === ae.OnHold,
|
|
2007
2008
|
refreshProgress: p,
|
|
2008
2009
|
moveToNext: m,
|
|
2009
|
-
moveBack:
|
|
2010
|
+
moveBack: b,
|
|
2010
2011
|
submitCurrentStep: y,
|
|
2011
2012
|
orchestrator: d.current
|
|
2012
2013
|
};
|
|
@@ -2033,8 +2034,8 @@ function Zt(t) {
|
|
|
2033
2034
|
l(!0), u(null);
|
|
2034
2035
|
try {
|
|
2035
2036
|
return await e.fillQuestionnaire(m);
|
|
2036
|
-
} catch (
|
|
2037
|
-
throw u(
|
|
2037
|
+
} catch (b) {
|
|
2038
|
+
throw u(b), b;
|
|
2038
2039
|
} finally {
|
|
2039
2040
|
l(!1);
|
|
2040
2041
|
}
|
|
@@ -2067,13 +2068,13 @@ function Jt(t) {
|
|
|
2067
2068
|
V(() => {
|
|
2068
2069
|
t && m();
|
|
2069
2070
|
}, [t, m]);
|
|
2070
|
-
const
|
|
2071
|
+
const b = q(
|
|
2071
2072
|
async (y) => {
|
|
2072
2073
|
l(!0), u(0), p(null);
|
|
2073
2074
|
try {
|
|
2074
2075
|
await e.fillUploadDocument(y), u(100);
|
|
2075
|
-
} catch (
|
|
2076
|
-
throw p(
|
|
2076
|
+
} catch (f) {
|
|
2077
|
+
throw p(f), f;
|
|
2077
2078
|
} finally {
|
|
2078
2079
|
l(!1);
|
|
2079
2080
|
}
|
|
@@ -2087,7 +2088,7 @@ function Jt(t) {
|
|
|
2087
2088
|
uploadProgress: d,
|
|
2088
2089
|
error: g,
|
|
2089
2090
|
load: m,
|
|
2090
|
-
submit:
|
|
2091
|
+
submit: b
|
|
2091
2092
|
};
|
|
2092
2093
|
}
|
|
2093
2094
|
function Ur(t) {
|
|
@@ -2107,14 +2108,14 @@ function Ur(t) {
|
|
|
2107
2108
|
V(() => {
|
|
2108
2109
|
t && m();
|
|
2109
2110
|
}, [t, m]);
|
|
2110
|
-
const
|
|
2111
|
+
const b = q(
|
|
2111
2112
|
async (y) => {
|
|
2112
2113
|
l(!0), u(null);
|
|
2113
2114
|
try {
|
|
2114
|
-
const
|
|
2115
|
-
return p(
|
|
2116
|
-
} catch (
|
|
2117
|
-
throw u(
|
|
2115
|
+
const f = await e.fillAppropriatenessTest(y);
|
|
2116
|
+
return p(f), f;
|
|
2117
|
+
} catch (f) {
|
|
2118
|
+
throw u(f), f;
|
|
2118
2119
|
} finally {
|
|
2119
2120
|
l(!1);
|
|
2120
2121
|
}
|
|
@@ -2128,7 +2129,7 @@ function Ur(t) {
|
|
|
2128
2129
|
isSubmitting: c,
|
|
2129
2130
|
error: d,
|
|
2130
2131
|
load: m,
|
|
2131
|
-
submit:
|
|
2132
|
+
submit: b
|
|
2132
2133
|
};
|
|
2133
2134
|
}
|
|
2134
2135
|
function Xt(t) {
|
|
@@ -2177,18 +2178,18 @@ function er(t) {
|
|
|
2177
2178
|
if (t) {
|
|
2178
2179
|
i(!0), l(null);
|
|
2179
2180
|
try {
|
|
2180
|
-
const
|
|
2181
|
+
const b = {
|
|
2181
2182
|
applicantId: t,
|
|
2182
2183
|
restart: !1,
|
|
2183
2184
|
redirectUrl: p || "",
|
|
2184
2185
|
ttl: m || 604800
|
|
2185
2186
|
// Default: 7 days
|
|
2186
2187
|
};
|
|
2187
|
-
console.log("Identity request input:",
|
|
2188
|
-
const y = await e.identityRequest(
|
|
2188
|
+
console.log("Identity request input:", b);
|
|
2189
|
+
const y = await e.identityRequest(b);
|
|
2189
2190
|
return console.log("Identity request result:", y), s(y), y;
|
|
2190
|
-
} catch (
|
|
2191
|
-
throw l(
|
|
2191
|
+
} catch (b) {
|
|
2192
|
+
throw l(b), b;
|
|
2192
2193
|
} finally {
|
|
2193
2194
|
i(!1);
|
|
2194
2195
|
}
|
|
@@ -2200,15 +2201,15 @@ function er(t) {
|
|
|
2200
2201
|
if (t) {
|
|
2201
2202
|
i(!0), l(null);
|
|
2202
2203
|
try {
|
|
2203
|
-
const
|
|
2204
|
+
const b = {
|
|
2204
2205
|
applicantId: t,
|
|
2205
2206
|
restart: !1,
|
|
2206
2207
|
redirectUrl: p,
|
|
2207
2208
|
ttl: m
|
|
2208
|
-
}, y = await e.identityCompanyRequest(
|
|
2209
|
+
}, y = await e.identityCompanyRequest(b);
|
|
2209
2210
|
return s(y), y;
|
|
2210
|
-
} catch (
|
|
2211
|
-
throw l(
|
|
2211
|
+
} catch (b) {
|
|
2212
|
+
throw l(b), b;
|
|
2212
2213
|
} finally {
|
|
2213
2214
|
i(!1);
|
|
2214
2215
|
}
|
|
@@ -2264,14 +2265,14 @@ function tr(t) {
|
|
|
2264
2265
|
V(() => {
|
|
2265
2266
|
t && m();
|
|
2266
2267
|
}, [t, m]);
|
|
2267
|
-
const
|
|
2268
|
+
const b = q(
|
|
2268
2269
|
async (y) => {
|
|
2269
2270
|
l(!0), u(null);
|
|
2270
2271
|
try {
|
|
2271
|
-
const
|
|
2272
|
-
return p(
|
|
2273
|
-
} catch (
|
|
2274
|
-
throw u(
|
|
2272
|
+
const f = await e.submitRiskScoring(y);
|
|
2273
|
+
return p(f), f;
|
|
2274
|
+
} catch (f) {
|
|
2275
|
+
throw u(f), f;
|
|
2275
2276
|
} finally {
|
|
2276
2277
|
l(!1);
|
|
2277
2278
|
}
|
|
@@ -2285,7 +2286,7 @@ function tr(t) {
|
|
|
2285
2286
|
isSubmitting: c,
|
|
2286
2287
|
error: d,
|
|
2287
2288
|
load: m,
|
|
2288
|
-
submit:
|
|
2289
|
+
submit: b
|
|
2289
2290
|
};
|
|
2290
2291
|
}
|
|
2291
2292
|
function rr() {
|
|
@@ -2305,8 +2306,8 @@ function rr() {
|
|
|
2305
2306
|
});
|
|
2306
2307
|
}
|
|
2307
2308
|
return await t.createApplicant(p);
|
|
2308
|
-
} catch (
|
|
2309
|
-
throw i(
|
|
2309
|
+
} catch (b) {
|
|
2310
|
+
throw i(b), b;
|
|
2310
2311
|
} finally {
|
|
2311
2312
|
s(!1);
|
|
2312
2313
|
}
|
|
@@ -2597,14 +2598,14 @@ const nr = ({
|
|
|
2597
2598
|
i == null || i(s ? [...c, ...N] : [N[0]]);
|
|
2598
2599
|
}, m = (h) => {
|
|
2599
2600
|
h.preventDefault(), u(!0);
|
|
2600
|
-
},
|
|
2601
|
+
}, b = () => {
|
|
2601
2602
|
u(!1);
|
|
2602
2603
|
}, y = (h) => {
|
|
2603
2604
|
h.preventDefault(), u(!1), p(h.dataTransfer.files);
|
|
2604
|
-
},
|
|
2605
|
+
}, f = () => {
|
|
2605
2606
|
var h;
|
|
2606
2607
|
(h = g.current) == null || h.click();
|
|
2607
|
-
},
|
|
2608
|
+
}, P = (h) => {
|
|
2608
2609
|
const N = c.filter((w, I) => I !== h);
|
|
2609
2610
|
i == null || i(N);
|
|
2610
2611
|
};
|
|
@@ -2619,9 +2620,9 @@ const nr = ({
|
|
|
2619
2620
|
e && "border-danger-500"
|
|
2620
2621
|
),
|
|
2621
2622
|
onDragOver: m,
|
|
2622
|
-
onDragLeave:
|
|
2623
|
+
onDragLeave: b,
|
|
2623
2624
|
onDrop: y,
|
|
2624
|
-
onClick:
|
|
2625
|
+
onClick: f,
|
|
2625
2626
|
children: [
|
|
2626
2627
|
/* @__PURE__ */ n(
|
|
2627
2628
|
"input",
|
|
@@ -2699,7 +2700,7 @@ const nr = ({
|
|
|
2699
2700
|
{
|
|
2700
2701
|
type: "button",
|
|
2701
2702
|
onClick: (w) => {
|
|
2702
|
-
w.stopPropagation(),
|
|
2703
|
+
w.stopPropagation(), P(N);
|
|
2703
2704
|
},
|
|
2704
2705
|
className: "ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",
|
|
2705
2706
|
children: /* @__PURE__ */ n("svg", { className: "h-5 w-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ n(
|
|
@@ -3011,8 +3012,8 @@ const Vr = de.any(), vr = ({
|
|
|
3011
3012
|
onBack: r
|
|
3012
3013
|
}) => {
|
|
3013
3014
|
const { questionnaire: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Zt(t), d = $e(() => s ? { questionResults: s.questionGroups.map(
|
|
3014
|
-
(
|
|
3015
|
-
questionId:
|
|
3015
|
+
(f) => f.questions.map((P) => ({
|
|
3016
|
+
questionId: P.id,
|
|
3016
3017
|
values: []
|
|
3017
3018
|
}))
|
|
3018
3019
|
) } : { questionResults: [] }, [s]), u = s ? yr() : null, {
|
|
@@ -3022,53 +3023,53 @@ const Vr = de.any(), vr = ({
|
|
|
3022
3023
|
} = Pe({
|
|
3023
3024
|
resolver: u ? Ge(u) : void 0,
|
|
3024
3025
|
defaultValues: d
|
|
3025
|
-
}),
|
|
3026
|
+
}), b = async (y) => {
|
|
3026
3027
|
if (s)
|
|
3027
3028
|
try {
|
|
3028
3029
|
console.log("Form submitted with data:", y);
|
|
3029
|
-
const
|
|
3030
|
+
const f = s.questionGroups.flatMap(
|
|
3030
3031
|
(h, N) => h.questions.map((w, I) => {
|
|
3031
|
-
var
|
|
3032
|
+
var F, L, R;
|
|
3032
3033
|
return {
|
|
3033
3034
|
questionId: w.id,
|
|
3034
|
-
values: ((R = (L = (
|
|
3035
|
+
values: ((R = (L = (F = y.questionResults) == null ? void 0 : F[N]) == null ? void 0 : L[I]) == null ? void 0 : R.values) || []
|
|
3035
3036
|
};
|
|
3036
3037
|
})
|
|
3037
3038
|
);
|
|
3038
|
-
console.log("Question results to submit:",
|
|
3039
|
-
const
|
|
3039
|
+
console.log("Question results to submit:", f);
|
|
3040
|
+
const P = {
|
|
3040
3041
|
applicantId: t,
|
|
3041
3042
|
questionnarieId: s.id,
|
|
3042
|
-
questionResults:
|
|
3043
|
+
questionResults: f
|
|
3043
3044
|
};
|
|
3044
|
-
console.log("Final input:",
|
|
3045
|
-
} catch (
|
|
3046
|
-
console.error("Error submitting questionnaire:",
|
|
3045
|
+
console.log("Final input:", P), await l(P), e == null || e();
|
|
3046
|
+
} catch (f) {
|
|
3047
|
+
console.error("Error submitting questionnaire:", f);
|
|
3047
3048
|
}
|
|
3048
3049
|
};
|
|
3049
3050
|
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
3051
|
"Error loading questionnaire: ",
|
|
3051
3052
|
c.message
|
|
3052
|
-
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: p(
|
|
3053
|
+
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: p(b), children: /* @__PURE__ */ o(T, { children: [
|
|
3053
3054
|
/* @__PURE__ */ o(J, { children: [
|
|
3054
3055
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: s.displayName }),
|
|
3055
3056
|
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
|
|
3056
3057
|
] }),
|
|
3057
3058
|
/* @__PURE__ */ n(M, { className: "space-y-8", children: s.questionGroups.flatMap(
|
|
3058
|
-
(y,
|
|
3059
|
-
const w =
|
|
3059
|
+
(y, f) => y.questions.map((P, h) => {
|
|
3060
|
+
const w = P.defaultAnswers && P.defaultAnswers.length > 0 ? P.showAsDropdown ? P.canMultipleAnswer ? "multi-select" : "single-select" : P.canMultipleAnswer ? "checkbox" : "radio" : "text";
|
|
3060
3061
|
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3061
3062
|
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3062
|
-
|
|
3063
|
-
|
|
3063
|
+
P.text,
|
|
3064
|
+
P.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3064
3065
|
] }),
|
|
3065
3066
|
w === "text" && /* @__PURE__ */ n(
|
|
3066
3067
|
G,
|
|
3067
3068
|
{
|
|
3068
3069
|
control: g,
|
|
3069
|
-
name: `questionResults.${
|
|
3070
|
+
name: `questionResults.${f}.${h}.values.0`,
|
|
3070
3071
|
render: ({ field: I }) => {
|
|
3071
|
-
var
|
|
3072
|
+
var F, L, R, C;
|
|
3072
3073
|
return /* @__PURE__ */ n(
|
|
3073
3074
|
Z,
|
|
3074
3075
|
{
|
|
@@ -3077,7 +3078,7 @@ const Vr = de.any(), vr = ({
|
|
|
3077
3078
|
onBlur: I.onBlur,
|
|
3078
3079
|
name: I.name,
|
|
3079
3080
|
placeholder: "Enter your answer...",
|
|
3080
|
-
error: (C = (R = (L = (
|
|
3081
|
+
error: (C = (R = (L = (F = m.questionResults) == null ? void 0 : F[f]) == null ? void 0 : L[h]) == null ? void 0 : R.values) == null ? void 0 : C.message
|
|
3081
3082
|
}
|
|
3082
3083
|
);
|
|
3083
3084
|
}
|
|
@@ -3087,9 +3088,9 @@ const Vr = de.any(), vr = ({
|
|
|
3087
3088
|
G,
|
|
3088
3089
|
{
|
|
3089
3090
|
control: g,
|
|
3090
|
-
name: `questionResults.${
|
|
3091
|
+
name: `questionResults.${f}.${h}.values.0`,
|
|
3091
3092
|
render: ({ field: I }) => {
|
|
3092
|
-
var
|
|
3093
|
+
var F, L, R, C;
|
|
3093
3094
|
return /* @__PURE__ */ n(
|
|
3094
3095
|
ge,
|
|
3095
3096
|
{
|
|
@@ -3097,12 +3098,12 @@ const Vr = de.any(), vr = ({
|
|
|
3097
3098
|
onChange: I.onChange,
|
|
3098
3099
|
onBlur: I.onBlur,
|
|
3099
3100
|
name: I.name,
|
|
3100
|
-
options:
|
|
3101
|
+
options: P.defaultAnswers.map((B) => ({
|
|
3101
3102
|
value: B,
|
|
3102
3103
|
label: B
|
|
3103
3104
|
})),
|
|
3104
3105
|
placeholder: "Select an option...",
|
|
3105
|
-
error: (C = (R = (L = (
|
|
3106
|
+
error: (C = (R = (L = (F = m.questionResults) == null ? void 0 : F[f]) == null ? void 0 : L[h]) == null ? void 0 : R.values) == null ? void 0 : C.message
|
|
3106
3107
|
}
|
|
3107
3108
|
);
|
|
3108
3109
|
}
|
|
@@ -3114,8 +3115,8 @@ const Vr = de.any(), vr = ({
|
|
|
3114
3115
|
G,
|
|
3115
3116
|
{
|
|
3116
3117
|
control: g,
|
|
3117
|
-
name: `questionResults.${
|
|
3118
|
-
render: ({ field: { value: I = [], onChange:
|
|
3118
|
+
name: `questionResults.${f}.${h}.values`,
|
|
3119
|
+
render: ({ field: { value: I = [], onChange: F } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: P.defaultAnswers.map((L, R) => /* @__PURE__ */ o(
|
|
3119
3120
|
"label",
|
|
3120
3121
|
{
|
|
3121
3122
|
className: "flex items-center space-x-2 cursor-pointer",
|
|
@@ -3127,7 +3128,7 @@ const Vr = de.any(), vr = ({
|
|
|
3127
3128
|
checked: Array.isArray(I) && I.includes(L),
|
|
3128
3129
|
onChange: (C) => {
|
|
3129
3130
|
const B = Array.isArray(I) ? I : [], z = C.target.checked ? [...B, L] : B.filter((v) => v !== L);
|
|
3130
|
-
|
|
3131
|
+
F(z);
|
|
3131
3132
|
},
|
|
3132
3133
|
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3133
3134
|
}
|
|
@@ -3135,12 +3136,12 @@ const Vr = de.any(), vr = ({
|
|
|
3135
3136
|
/* @__PURE__ */ n("span", { className: "text-sm", children: L })
|
|
3136
3137
|
]
|
|
3137
3138
|
},
|
|
3138
|
-
`answer-${
|
|
3139
|
+
`answer-${f}-${h}-${R}`
|
|
3139
3140
|
)) })
|
|
3140
3141
|
}
|
|
3141
3142
|
)
|
|
3142
3143
|
] })
|
|
3143
|
-
] },
|
|
3144
|
+
] }, P.id);
|
|
3144
3145
|
})
|
|
3145
3146
|
) }),
|
|
3146
3147
|
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
@@ -3171,23 +3172,23 @@ const Vr = de.any(), vr = ({
|
|
|
3171
3172
|
if (p.preventDefault(), !s) return;
|
|
3172
3173
|
const m = await Promise.all(
|
|
3173
3174
|
s.uploadDocumentFiles.map(async (y) => {
|
|
3174
|
-
const
|
|
3175
|
-
|
|
3175
|
+
const f = d[y.id] || [], P = await Promise.all(
|
|
3176
|
+
f.map(async (h) => ({
|
|
3176
3177
|
fileName: h.name,
|
|
3177
3178
|
fileData: await qt(h)
|
|
3178
3179
|
}))
|
|
3179
3180
|
);
|
|
3180
3181
|
return {
|
|
3181
3182
|
uploadDocumentFileId: y.id,
|
|
3182
|
-
valueList:
|
|
3183
|
+
valueList: P
|
|
3183
3184
|
};
|
|
3184
3185
|
})
|
|
3185
|
-
),
|
|
3186
|
+
), b = {
|
|
3186
3187
|
applicantId: t,
|
|
3187
3188
|
uploadDocumentId: s.id,
|
|
3188
3189
|
uploadDocumentResults: m
|
|
3189
3190
|
};
|
|
3190
|
-
await l(
|
|
3191
|
+
await l(b), e == null || e();
|
|
3191
3192
|
};
|
|
3192
3193
|
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
3194
|
"Error loading document requirements: ",
|
|
@@ -3206,7 +3207,7 @@ const Vr = de.any(), vr = ({
|
|
|
3206
3207
|
maxSize: p.maxEachFileSizeByte,
|
|
3207
3208
|
value: d[p.id] || [],
|
|
3208
3209
|
onChange: (m) => {
|
|
3209
|
-
u((
|
|
3210
|
+
u((b) => ({ ...b, [p.id]: m }));
|
|
3210
3211
|
}
|
|
3211
3212
|
},
|
|
3212
3213
|
p.id
|
|
@@ -3266,7 +3267,7 @@ const Vr = de.any(), vr = ({
|
|
|
3266
3267
|
}))
|
|
3267
3268
|
}, [s]), p = s && s.length > 0 ? br() : null, {
|
|
3268
3269
|
control: m,
|
|
3269
|
-
handleSubmit:
|
|
3270
|
+
handleSubmit: b,
|
|
3270
3271
|
formState: { errors: y }
|
|
3271
3272
|
} = Pe({
|
|
3272
3273
|
resolver: p ? Ge(p) : void 0,
|
|
@@ -3275,14 +3276,14 @@ const Vr = de.any(), vr = ({
|
|
|
3275
3276
|
le.useEffect(() => {
|
|
3276
3277
|
!a && s && s.length === 0 && !d && !i && (u(!0), l({ applicantId: t, criteriaValueInputs: [] }).then(() => e == null ? void 0 : e()).catch(console.error));
|
|
3277
3278
|
}, [a, s, d, i, l, t, e]);
|
|
3278
|
-
const
|
|
3279
|
+
const f = async (h) => {
|
|
3279
3280
|
if (s)
|
|
3280
3281
|
try {
|
|
3281
3282
|
console.log("Risk scoring form submitted:", h), console.log("Criteria metadata:", s);
|
|
3282
|
-
const N = h.criteriaValueInputs.map((I,
|
|
3283
|
+
const N = h.criteriaValueInputs.map((I, F) => {
|
|
3283
3284
|
const L = I.values || [], R = Array.isArray(L) ? L.filter((C) => C && C.trim()) : L && L.toString().trim() ? [L.toString()] : [];
|
|
3284
3285
|
return R.length === 0 ? null : {
|
|
3285
|
-
riskCriteriaId: s[
|
|
3286
|
+
riskCriteriaId: s[F].id,
|
|
3286
3287
|
values: R
|
|
3287
3288
|
};
|
|
3288
3289
|
}).filter((I) => I !== null);
|
|
@@ -3295,7 +3296,7 @@ const Vr = de.any(), vr = ({
|
|
|
3295
3296
|
} catch (N) {
|
|
3296
3297
|
throw console.error("Error submitting risk scoring:", N), N;
|
|
3297
3298
|
}
|
|
3298
|
-
},
|
|
3299
|
+
}, P = (h) => h.builtInType === 1 ? "country" : !h.defaultValues || h.defaultValues.length === 0 ? "text" : h.multipleValue ? "checkbox" : "radio";
|
|
3299
3300
|
return a ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
3300
3301
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
3301
3302
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading risk scoring criteria..." })
|
|
@@ -3305,14 +3306,14 @@ const Vr = de.any(), vr = ({
|
|
|
3305
3306
|
] }) }) }) : !a && s && s.length === 0 ? /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
3306
3307
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
3307
3308
|
/* @__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: f
|
|
3309
|
+
] }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: b(f), children: /* @__PURE__ */ o(T, { children: [
|
|
3309
3310
|
/* @__PURE__ */ o(J, { children: [
|
|
3310
3311
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Risk Assessment" }),
|
|
3311
3312
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please answer the following questions for risk evaluation" })
|
|
3312
3313
|
] }),
|
|
3313
3314
|
/* @__PURE__ */ n(M, { className: "space-y-8", children: s.map((h, N) => {
|
|
3314
|
-
var I,
|
|
3315
|
-
const w =
|
|
3315
|
+
var I, F, L;
|
|
3316
|
+
const w = P(h);
|
|
3316
3317
|
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3317
3318
|
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3318
3319
|
h.displayName,
|
|
@@ -3413,7 +3414,7 @@ const Vr = de.any(), vr = ({
|
|
|
3413
3414
|
}
|
|
3414
3415
|
}
|
|
3415
3416
|
),
|
|
3416
|
-
((L = (
|
|
3417
|
+
((L = (F = (I = y.criteriaValueInputs) == null ? void 0 : I[N]) == null ? void 0 : F.values) == null ? void 0 : L.message) && /* @__PURE__ */ n("p", { className: "text-sm text-danger-500 mt-1", children: y.criteriaValueInputs[N].values.message })
|
|
3417
3418
|
] }, h.id);
|
|
3418
3419
|
}) }),
|
|
3419
3420
|
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
@@ -3453,8 +3454,8 @@ const Vr = de.any(), vr = ({
|
|
|
3453
3454
|
investorType: a
|
|
3454
3455
|
};
|
|
3455
3456
|
console.log("Submitting investor categorization:", m);
|
|
3456
|
-
const
|
|
3457
|
-
console.log("Investor categorization result:",
|
|
3457
|
+
const b = await s.setInvestorCategorization(m);
|
|
3458
|
+
console.log("Investor categorization result:", b), e == null || e();
|
|
3458
3459
|
} catch (m) {
|
|
3459
3460
|
console.error("Error submitting investor categorization:", m), u(m.message || "Failed to submit investor categorization");
|
|
3460
3461
|
} finally {
|
|
@@ -3578,7 +3579,7 @@ const Vr = de.any(), vr = ({
|
|
|
3578
3579
|
onComplete: e,
|
|
3579
3580
|
onBack: r
|
|
3580
3581
|
}) => {
|
|
3581
|
-
const { appropriatenessTestService: s } = re(), [a, i] = x(null), [c, l] = x(!0), [d, u] = x(!1), [g, p] = x(null), [m,
|
|
3582
|
+
const { appropriatenessTestService: s } = re(), [a, i] = x(null), [c, l] = x(!0), [d, u] = x(!1), [g, p] = x(null), [m, b] = x({}), [y, f] = x(0), [P, h] = x(!1), [N, w] = x(!1), [I, F] = x(0);
|
|
3582
3583
|
V(() => {
|
|
3583
3584
|
(async () => {
|
|
3584
3585
|
try {
|
|
@@ -3586,7 +3587,7 @@ const Vr = de.any(), vr = ({
|
|
|
3586
3587
|
const k = await s.getAppropriatenessTest(t);
|
|
3587
3588
|
if (console.log("Appropriateness test data:", k), i(k), k.waitTimeSpanForNextTry && k.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3588
3589
|
const S = L(k.waitTimeSpanForNextTry);
|
|
3589
|
-
S > 0 &&
|
|
3590
|
+
S > 0 && F(S);
|
|
3590
3591
|
}
|
|
3591
3592
|
} catch (k) {
|
|
3592
3593
|
console.error("Error loading appropriateness test:", k), p(k.message || "Failed to load appropriateness test");
|
|
@@ -3607,24 +3608,24 @@ const Vr = de.any(), vr = ({
|
|
|
3607
3608
|
return `${k.toString().padStart(2, "0")}:${S.toString().padStart(2, "0")}`;
|
|
3608
3609
|
};
|
|
3609
3610
|
V(() => {
|
|
3610
|
-
if (!
|
|
3611
|
+
if (!P || y <= 0) return;
|
|
3611
3612
|
const A = setInterval(() => {
|
|
3612
|
-
|
|
3613
|
+
f((k) => k <= 1 ? (w(!0), 0) : k - 1);
|
|
3613
3614
|
}, 1e3);
|
|
3614
3615
|
return () => clearInterval(A);
|
|
3615
|
-
}, [
|
|
3616
|
+
}, [P, y]), V(() => {
|
|
3616
3617
|
if (I <= 0) return;
|
|
3617
3618
|
const A = setInterval(() => {
|
|
3618
|
-
|
|
3619
|
+
F((k) => k <= 1 ? 0 : k - 1);
|
|
3619
3620
|
}, 1e3);
|
|
3620
3621
|
return () => clearInterval(A);
|
|
3621
3622
|
}, [I]), V(() => {
|
|
3622
3623
|
N && !d && z();
|
|
3623
3624
|
}, [N]);
|
|
3624
3625
|
const C = () => {
|
|
3625
|
-
a && (h(!0),
|
|
3626
|
+
a && (h(!0), f(a.testDurationSec));
|
|
3626
3627
|
}, B = (A, k) => {
|
|
3627
|
-
|
|
3628
|
+
b((S) => ({
|
|
3628
3629
|
...S,
|
|
3629
3630
|
[A]: k
|
|
3630
3631
|
}));
|
|
@@ -3653,16 +3654,16 @@ const Vr = de.any(), vr = ({
|
|
|
3653
3654
|
console.log("Submitting appropriateness test:", S);
|
|
3654
3655
|
try {
|
|
3655
3656
|
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."), h(!1), w(!1),
|
|
3657
|
+
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."), h(!1), w(!1), b({}), setTimeout(() => v(), 1e3));
|
|
3657
3658
|
} catch (_) {
|
|
3658
3659
|
if (_.code === 400 && _.message) {
|
|
3659
3660
|
const oe = _.message;
|
|
3660
|
-
console.log("Test failed:", oe), p(oe), h(!1), w(!1),
|
|
3661
|
+
console.log("Test failed:", oe), p(oe), h(!1), w(!1), b({}), setTimeout(() => v(), 1500);
|
|
3661
3662
|
} else
|
|
3662
3663
|
throw _;
|
|
3663
3664
|
}
|
|
3664
3665
|
} catch (k) {
|
|
3665
|
-
console.error("Error submitting appropriateness test:", k), p(k.message || "Failed to submit test. Please try again."), h(!1), w(!1),
|
|
3666
|
+
console.error("Error submitting appropriateness test:", k), p(k.message || "Failed to submit test. Please try again."), h(!1), w(!1), b({});
|
|
3666
3667
|
} finally {
|
|
3667
3668
|
u(!1);
|
|
3668
3669
|
}
|
|
@@ -3672,7 +3673,7 @@ const Vr = de.any(), vr = ({
|
|
|
3672
3673
|
const A = await s.getAppropriatenessTest(t);
|
|
3673
3674
|
if (console.log("Reloaded test data:", A), i(A), A.waitTimeSpanForNextTry && A.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3674
3675
|
const k = L(A.waitTimeSpanForNextTry);
|
|
3675
|
-
k > 0 &&
|
|
3676
|
+
k > 0 && F(k);
|
|
3676
3677
|
}
|
|
3677
3678
|
} catch (A) {
|
|
3678
3679
|
console.error("Error reloading test data:", A), p((k) => k + `
|
|
@@ -3705,7 +3706,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3705
3706
|
] })
|
|
3706
3707
|
] });
|
|
3707
3708
|
const E = a.testAllowedMaxTry - a.totalFailedTries;
|
|
3708
|
-
return
|
|
3709
|
+
return P ? /* @__PURE__ */ n("form", { onSubmit: z, children: /* @__PURE__ */ o(T, { children: [
|
|
3709
3710
|
/* @__PURE__ */ n(J, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
3710
3711
|
/* @__PURE__ */ o("div", { children: [
|
|
3711
3712
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a.displayName }),
|
|
@@ -3861,7 +3862,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3861
3862
|
onBack: r
|
|
3862
3863
|
}) => {
|
|
3863
3864
|
var S, _, oe, Fe;
|
|
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), [
|
|
3865
|
+
const { applicantService: s, baseInformationService: a, config: i } = re(), { identityData: c, provider: l, token: d, isLoading: u, error: g, requestIdentity: p, restartIdentity: m } = er(t), [b, y] = x(null), [f, P] = x(null), [h, N] = x([]), [w, I] = x(!0), [F, L] = x(!1), [R, C] = x(null), [B, z] = x(!1), v = le.useRef(!1), E = Pe({
|
|
3865
3866
|
defaultValues: {
|
|
3866
3867
|
street: "",
|
|
3867
3868
|
streetNumber: "",
|
|
@@ -3879,7 +3880,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3879
3880
|
s.getApplicantData(t),
|
|
3880
3881
|
a.getCountries("", "en")
|
|
3881
3882
|
]);
|
|
3882
|
-
|
|
3883
|
+
P(D);
|
|
3883
3884
|
const H = /* @__PURE__ */ new Set(), ne = W.filter((ue) => {
|
|
3884
3885
|
const Se = ue.abbreviation3 || ue.abbreviation;
|
|
3885
3886
|
return !Se || H.has(Se) ? !1 : (H.add(Se), !0);
|
|
@@ -3909,8 +3910,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3909
3910
|
}
|
|
3910
3911
|
})();
|
|
3911
3912
|
}, [t, s, a, E, p]), V(() => {
|
|
3912
|
-
c && !
|
|
3913
|
-
}, [c,
|
|
3913
|
+
c && !F && (console.log("[Identity] Identity data already loaded, showing provider"), L(!0));
|
|
3914
|
+
}, [c, F]), V(() => {
|
|
3914
3915
|
if (d) {
|
|
3915
3916
|
if (d.expiresAt) {
|
|
3916
3917
|
const O = new Date(d.expiresAt).getTime();
|
|
@@ -3935,7 +3936,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3935
3936
|
}
|
|
3936
3937
|
}
|
|
3937
3938
|
}, [d]), V(() => {
|
|
3938
|
-
if (l !== null && d && !
|
|
3939
|
+
if (l !== null && d && !b && F && !B) {
|
|
3939
3940
|
const O = l;
|
|
3940
3941
|
if (d.url) {
|
|
3941
3942
|
console.log("[Identity] Loading provider URL for user verification:", d.url), C(null);
|
|
@@ -3994,14 +3995,14 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3994
3995
|
}
|
|
3995
3996
|
}
|
|
3996
3997
|
return () => {
|
|
3997
|
-
if (
|
|
3998
|
+
if (b && b.destroy)
|
|
3998
3999
|
try {
|
|
3999
|
-
|
|
4000
|
+
b.destroy();
|
|
4000
4001
|
} catch (O) {
|
|
4001
4002
|
console.error("[Identity] Error destroying provider:", O);
|
|
4002
4003
|
}
|
|
4003
4004
|
};
|
|
4004
|
-
}, [l, d,
|
|
4005
|
+
}, [l, d, b, F, e, B]);
|
|
4005
4006
|
const A = async () => {
|
|
4006
4007
|
try {
|
|
4007
4008
|
C(null), z(!1), await p(), L(!0);
|
|
@@ -4025,7 +4026,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4025
4026
|
"Error: ",
|
|
4026
4027
|
g.message
|
|
4027
4028
|
] }) }) });
|
|
4028
|
-
if (
|
|
4029
|
+
if (F && (R || B))
|
|
4029
4030
|
return /* @__PURE__ */ o(T, { children: [
|
|
4030
4031
|
/* @__PURE__ */ n(J, { children: /* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
|
|
4031
4032
|
/* @__PURE__ */ o(M, { children: [
|
|
@@ -4067,7 +4068,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4067
4068
|
/* @__PURE__ */ n(j, { type: "button", onClick: k, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
|
|
4068
4069
|
] })
|
|
4069
4070
|
] });
|
|
4070
|
-
if (
|
|
4071
|
+
if (F && c) {
|
|
4071
4072
|
const O = l;
|
|
4072
4073
|
return d != null && d.url ? /* @__PURE__ */ o(T, { children: [
|
|
4073
4074
|
/* @__PURE__ */ n(J, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
@@ -4145,18 +4146,18 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4145
4146
|
/* @__PURE__ */ o("div", { children: [
|
|
4146
4147
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
|
|
4147
4148
|
/* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
|
|
4148
|
-
(S =
|
|
4149
|
+
(S = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : S.firstName,
|
|
4149
4150
|
" ",
|
|
4150
|
-
(_ =
|
|
4151
|
+
(_ = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : _.lastName
|
|
4151
4152
|
] })
|
|
4152
4153
|
] }),
|
|
4153
4154
|
/* @__PURE__ */ o("div", { children: [
|
|
4154
4155
|
/* @__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 =
|
|
4156
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: (oe = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : oe.email })
|
|
4156
4157
|
] }),
|
|
4157
4158
|
/* @__PURE__ */ o("div", { children: [
|
|
4158
4159
|
/* @__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: ((Fe =
|
|
4160
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ((Fe = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : Fe.dateOfBirth) || "Not provided" })
|
|
4160
4161
|
] })
|
|
4161
4162
|
] }),
|
|
4162
4163
|
/* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
@@ -4418,11 +4419,11 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4418
4419
|
subtitle: e,
|
|
4419
4420
|
className: r = ""
|
|
4420
4421
|
}) => {
|
|
4421
|
-
const {
|
|
4422
|
+
const { currentTheme: s } = re(), a = t || (s == null ? void 0 : s.title) || "KYC Verification";
|
|
4422
4423
|
return /* @__PURE__ */ o("div", { className: `metakyc-header ${r}`, children: [
|
|
4423
|
-
|
|
4424
|
+
(s == null ? void 0 : s.logo) && s.logo.visible && /* @__PURE__ */ n("div", { className: "mb-3", children: /* @__PURE__ */ n(Er, { config: s.logo }) }),
|
|
4424
4425
|
/* @__PURE__ */ o("div", { children: [
|
|
4425
|
-
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children:
|
|
4426
|
+
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a }),
|
|
4426
4427
|
e && /* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: e })
|
|
4427
4428
|
] })
|
|
4428
4429
|
] });
|
|
@@ -4433,13 +4434,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4433
4434
|
onCancel: s
|
|
4434
4435
|
}) => {
|
|
4435
4436
|
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 (!
|
|
4437
|
+
const { config: a, baseInformationService: i } = re(), { createApplicant: c, isLoading: l } = rr(), [d, u] = x([]), [g, p] = x(!0), [m, b] = x(!1), [y, f] = x(null), P = t || ((C = a.applicantForm) == null ? void 0 : C.workflowKey);
|
|
4438
|
+
if (!P)
|
|
4438
4439
|
throw new Error(
|
|
4439
4440
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
4440
4441
|
);
|
|
4441
4442
|
const h = e || ((B = a.applicantForm) == null ? void 0 : B.externalRefId) || "", N = ((z = a.applicantForm) == null ? void 0 : z.visibleFields) || gt, [w, I] = x({
|
|
4442
|
-
workflowKey:
|
|
4443
|
+
workflowKey: P,
|
|
4443
4444
|
firstName: "",
|
|
4444
4445
|
lastName: "",
|
|
4445
4446
|
title: "",
|
|
@@ -4481,13 +4482,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4481
4482
|
}
|
|
4482
4483
|
})();
|
|
4483
4484
|
}, [i, a.locale]);
|
|
4484
|
-
const
|
|
4485
|
+
const F = (v, E) => {
|
|
4485
4486
|
I((A) => ({ ...A, [v]: E }));
|
|
4486
4487
|
}, L = async (v) => {
|
|
4487
|
-
v.preventDefault(),
|
|
4488
|
+
v.preventDefault(), b(!0), f(null);
|
|
4488
4489
|
try {
|
|
4489
4490
|
if (!w.externalRefId || w.externalRefId.trim() === "") {
|
|
4490
|
-
|
|
4491
|
+
f("External Reference ID is required and cannot be empty"), b(!1);
|
|
4491
4492
|
return;
|
|
4492
4493
|
}
|
|
4493
4494
|
const E = {
|
|
@@ -4505,9 +4506,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4505
4506
|
);
|
|
4506
4507
|
console.log("Applicant created:", A), r(A.applicantId);
|
|
4507
4508
|
} catch (E) {
|
|
4508
|
-
console.error("Error creating applicant:", E),
|
|
4509
|
+
console.error("Error creating applicant:", E), f(E.message || "Failed to create applicant");
|
|
4509
4510
|
} finally {
|
|
4510
|
-
|
|
4511
|
+
b(!1);
|
|
4511
4512
|
}
|
|
4512
4513
|
}, R = (v) => {
|
|
4513
4514
|
var A, k;
|
|
@@ -4519,7 +4520,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4519
4520
|
{
|
|
4520
4521
|
label: E.label,
|
|
4521
4522
|
value: w[v] || "",
|
|
4522
|
-
onChange: (S) =>
|
|
4523
|
+
onChange: (S) => F(v, S.target.value),
|
|
4523
4524
|
options: [
|
|
4524
4525
|
{ value: "", label: `Select ${E.label.toLowerCase()}...` },
|
|
4525
4526
|
...d
|
|
@@ -4532,7 +4533,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4532
4533
|
{
|
|
4533
4534
|
label: E.label,
|
|
4534
4535
|
value: ((A = w[v]) == null ? void 0 : A.toString()) || "",
|
|
4535
|
-
onChange: (S) =>
|
|
4536
|
+
onChange: (S) => F(v, S.target.value ? Number(S.target.value) : null),
|
|
4536
4537
|
options: [
|
|
4537
4538
|
{ value: "", label: "Select salutation..." },
|
|
4538
4539
|
{ value: ke.Male.toString(), label: "Male" },
|
|
@@ -4551,7 +4552,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4551
4552
|
value: ((k = w[v]) == null ? void 0 : k.join(", ")) || "",
|
|
4552
4553
|
onChange: (S) => {
|
|
4553
4554
|
const _ = S.target.value.split(",").map((oe) => oe.trim()).filter(Boolean);
|
|
4554
|
-
|
|
4555
|
+
F(v, _);
|
|
4555
4556
|
},
|
|
4556
4557
|
placeholder: "Enter countries separated by commas"
|
|
4557
4558
|
},
|
|
@@ -4564,7 +4565,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4564
4565
|
type: "date",
|
|
4565
4566
|
label: E.label,
|
|
4566
4567
|
value: w[v] || "",
|
|
4567
|
-
onChange: (S) =>
|
|
4568
|
+
onChange: (S) => F(v, S.target.value)
|
|
4568
4569
|
},
|
|
4569
4570
|
v
|
|
4570
4571
|
);
|
|
@@ -4575,7 +4576,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4575
4576
|
type: "email",
|
|
4576
4577
|
label: E.label,
|
|
4577
4578
|
value: w[v] || "",
|
|
4578
|
-
onChange: (S) =>
|
|
4579
|
+
onChange: (S) => F(v, S.target.value),
|
|
4579
4580
|
required: v === "email"
|
|
4580
4581
|
},
|
|
4581
4582
|
v
|
|
@@ -4587,7 +4588,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4587
4588
|
type: "tel",
|
|
4588
4589
|
label: E.label,
|
|
4589
4590
|
value: w[v] || "",
|
|
4590
|
-
onChange: (S) =>
|
|
4591
|
+
onChange: (S) => F(v, S.target.value),
|
|
4591
4592
|
required: v === "phonenumber"
|
|
4592
4593
|
},
|
|
4593
4594
|
v
|
|
@@ -4600,7 +4601,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4600
4601
|
type: "text",
|
|
4601
4602
|
label: E.label,
|
|
4602
4603
|
value: w[v] || "",
|
|
4603
|
-
onChange: (S) =>
|
|
4604
|
+
onChange: (S) => F(v, S.target.value),
|
|
4604
4605
|
required: v === "firstName" || v === "lastName" || v === "externalRefId"
|
|
4605
4606
|
},
|
|
4606
4607
|
v
|
|
@@ -4647,9 +4648,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4647
4648
|
hasWorkflowChanged: g,
|
|
4648
4649
|
isLoading: p,
|
|
4649
4650
|
error: m,
|
|
4650
|
-
moveBack:
|
|
4651
|
+
moveBack: b,
|
|
4651
4652
|
refreshProgress: y
|
|
4652
|
-
} = Gt(t), [
|
|
4653
|
+
} = Gt(t), [f, P] = le.useState(!1);
|
|
4653
4654
|
if (le.useEffect(() => {
|
|
4654
4655
|
m && r && r(m);
|
|
4655
4656
|
}, [m, r]), le.useEffect(() => {
|
|
@@ -4657,7 +4658,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4657
4658
|
}, [i == null ? void 0 : i.workflowResult, e]), le.useEffect(() => {
|
|
4658
4659
|
s === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
4659
4660
|
}, [s]), le.useEffect(() => {
|
|
4660
|
-
g &&
|
|
4661
|
+
g && P(!1);
|
|
4661
4662
|
}, [g]), p || !i)
|
|
4662
4663
|
return /* @__PURE__ */ n("div", { className: a, children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o(M, { children: [
|
|
4663
4664
|
/* @__PURE__ */ n(ie, { className: "my-8" }),
|
|
@@ -4668,7 +4669,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4668
4669
|
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "An error occurred" }),
|
|
4669
4670
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: m.message })
|
|
4670
4671
|
] }) }) }) });
|
|
4671
|
-
if (g && !
|
|
4672
|
+
if (g && !f)
|
|
4672
4673
|
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
4674
|
/* @__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
4675
|
/* @__PURE__ */ n("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white mb-2", children: "Workflow Transition" }),
|
|
@@ -4690,7 +4691,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4690
4691
|
/* @__PURE__ */ n(
|
|
4691
4692
|
"button",
|
|
4692
4693
|
{
|
|
4693
|
-
onClick: () =>
|
|
4694
|
+
onClick: () => P(!0),
|
|
4694
4695
|
className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",
|
|
4695
4696
|
children: "Continue with New Workflow"
|
|
4696
4697
|
}
|
|
@@ -4716,13 +4717,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4716
4717
|
/* @__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
4718
|
] }) }) });
|
|
4718
4719
|
const h = () => {
|
|
4719
|
-
const w = l.filter((R) => R.visibility !== !1), I = w.findIndex((R) => R.order === c.order),
|
|
4720
|
+
const w = l.filter((R) => R.visibility !== !1), I = w.findIndex((R) => R.order === c.order), F = I >= 0 ? I + 1 : 1, L = w.length;
|
|
4720
4721
|
return /* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
4721
4722
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-4", children: [
|
|
4722
4723
|
/* @__PURE__ */ n(Ze, {}),
|
|
4723
4724
|
/* @__PURE__ */ o(me, { variant: i.status === 1 ? "info" : "success", children: [
|
|
4724
4725
|
"Step ",
|
|
4725
|
-
|
|
4726
|
+
F,
|
|
4726
4727
|
" of ",
|
|
4727
4728
|
L
|
|
4728
4729
|
] })
|
|
@@ -4764,7 +4765,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4764
4765
|
onComplete: async () => {
|
|
4765
4766
|
await y();
|
|
4766
4767
|
},
|
|
4767
|
-
onBack: c.order > 0 ?
|
|
4768
|
+
onBack: c.order > 0 ? b : void 0
|
|
4768
4769
|
};
|
|
4769
4770
|
switch (c.action) {
|
|
4770
4771
|
case U.Questionaries:
|