@vpdev2/metakyc-sdk 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +270 -216
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
1
|
+
var He = Object.defineProperty;
|
|
2
|
+
var je = (e, t, r) => t in e ? He(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var H = (e, t, r) => je(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import qe from "axios";
|
|
5
5
|
import * as Fe from "react";
|
|
6
6
|
import ie, { createContext as Ye, useState as v, useMemo as Ae, useEffect as V, useContext as We, useRef as W, useCallback as K, forwardRef as Ne, createElement as De } from "react";
|
|
7
7
|
import { jsx as a, jsxs as o, Fragment as Qe } from "react/jsx-runtime";
|
|
@@ -40,7 +40,7 @@ const Pe = [
|
|
|
40
40
|
"nationality",
|
|
41
41
|
"taxCountry",
|
|
42
42
|
"taxNumber"
|
|
43
|
-
],
|
|
43
|
+
], Ir = [
|
|
44
44
|
"firstName",
|
|
45
45
|
"lastName",
|
|
46
46
|
"title",
|
|
@@ -141,7 +141,7 @@ class ct {
|
|
|
141
141
|
class de extends Error {
|
|
142
142
|
constructor(r, n, s, i, l) {
|
|
143
143
|
super(r);
|
|
144
|
-
|
|
144
|
+
H(this, "response");
|
|
145
145
|
this.code = n, this.details = s, this.validationErrors = i, this.name = "MetaKYCError", this.response = l, Object.setPrototypeOf(this, de.prototype);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -197,10 +197,10 @@ class we {
|
|
|
197
197
|
}
|
|
198
198
|
class dt {
|
|
199
199
|
constructor(t) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
this.config = { ...lt, ...t }, this.endpointBuilder = new ct(this.config.endpoints), this.axiosInstance =
|
|
200
|
+
H(this, "axiosInstance");
|
|
201
|
+
H(this, "endpointBuilder");
|
|
202
|
+
H(this, "config");
|
|
203
|
+
this.config = { ...lt, ...t }, this.endpointBuilder = new ct(this.config.endpoints), this.axiosInstance = qe.create({
|
|
204
204
|
baseURL: this.config.baseUrl,
|
|
205
205
|
timeout: this.config.timeout,
|
|
206
206
|
headers: {
|
|
@@ -969,9 +969,9 @@ class At {
|
|
|
969
969
|
} : n;
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
|
-
class
|
|
972
|
+
class It {
|
|
973
973
|
constructor() {
|
|
974
|
-
|
|
974
|
+
H(this, "listeners", /* @__PURE__ */ new Map());
|
|
975
975
|
}
|
|
976
976
|
/**
|
|
977
977
|
* Subscribe to an event
|
|
@@ -1014,12 +1014,12 @@ class Et {
|
|
|
1014
1014
|
this.listeners.delete(t);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
class
|
|
1017
|
+
class Et {
|
|
1018
1018
|
constructor() {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1019
|
+
H(this, "events", new It());
|
|
1020
|
+
H(this, "_applicantId", null);
|
|
1021
|
+
H(this, "_progress", null);
|
|
1022
|
+
H(this, "_error", null);
|
|
1023
1023
|
}
|
|
1024
1024
|
/**
|
|
1025
1025
|
* Get current applicant ID
|
|
@@ -1156,7 +1156,7 @@ class It {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
class Rt {
|
|
1158
1158
|
constructor() {
|
|
1159
|
-
|
|
1159
|
+
H(this, "handlers", /* @__PURE__ */ new Map());
|
|
1160
1160
|
}
|
|
1161
1161
|
/**
|
|
1162
1162
|
* Register a step handler
|
|
@@ -1197,9 +1197,9 @@ class Rt {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
class Dt {
|
|
1199
1199
|
constructor(t, r, n, s, i, l, c, d) {
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
this.applicantService = t, this.questionnaireService = r, this.uploadDocumentService = n, this.appropriatenessTestService = s, this.overviewService = i, this.riskScoringService = l, this.investorCategorizationService = d, this.state = new
|
|
1200
|
+
H(this, "state");
|
|
1201
|
+
H(this, "stepRouter");
|
|
1202
|
+
this.applicantService = t, this.questionnaireService = r, this.uploadDocumentService = n, this.appropriatenessTestService = s, this.overviewService = i, this.riskScoringService = l, this.investorCategorizationService = d, this.state = new Et(), this.stepRouter = new Rt(), this.registerStepHandlers();
|
|
1203
1203
|
}
|
|
1204
1204
|
/**
|
|
1205
1205
|
* Register all step handlers
|
|
@@ -1349,7 +1349,7 @@ function Be(e, t) {
|
|
|
1349
1349
|
s.src = e, t && (s.id = t), s.async = !0, s.onload = () => r(), s.onerror = () => n(new Error(`Failed to load script: ${e}`)), document.head.appendChild(s);
|
|
1350
1350
|
});
|
|
1351
1351
|
}
|
|
1352
|
-
function
|
|
1352
|
+
function Er(e) {
|
|
1353
1353
|
return !!document.getElementById(e);
|
|
1354
1354
|
}
|
|
1355
1355
|
function Rr(e) {
|
|
@@ -1358,8 +1358,8 @@ function Rr(e) {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
class Ft {
|
|
1360
1360
|
constructor(t) {
|
|
1361
|
-
|
|
1362
|
-
|
|
1361
|
+
H(this, "sdk", null);
|
|
1362
|
+
H(this, "config");
|
|
1363
1363
|
this.config = t;
|
|
1364
1364
|
}
|
|
1365
1365
|
/**
|
|
@@ -1413,8 +1413,8 @@ class Ft {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
class Pt {
|
|
1415
1415
|
constructor(t) {
|
|
1416
|
-
|
|
1417
|
-
|
|
1416
|
+
H(this, "sdk", null);
|
|
1417
|
+
H(this, "config");
|
|
1418
1418
|
this.config = t;
|
|
1419
1419
|
}
|
|
1420
1420
|
/**
|
|
@@ -1479,9 +1479,9 @@ class Pt {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
class Lt {
|
|
1481
1481
|
constructor(t) {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1482
|
+
H(this, "sardineContext", null);
|
|
1483
|
+
H(this, "config");
|
|
1484
|
+
H(this, "sessionKey");
|
|
1485
1485
|
this.config = t, this.sessionKey = t.sessionKey || this.generateSessionKey();
|
|
1486
1486
|
}
|
|
1487
1487
|
/**
|
|
@@ -1673,9 +1673,9 @@ class xe {
|
|
|
1673
1673
|
}
|
|
1674
1674
|
class Mt {
|
|
1675
1675
|
constructor(t) {
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1676
|
+
H(this, "currentTheme", ee);
|
|
1677
|
+
H(this, "customStyleElement", null);
|
|
1678
|
+
H(this, "container");
|
|
1679
1679
|
this.container = t || document.documentElement;
|
|
1680
1680
|
}
|
|
1681
1681
|
/**
|
|
@@ -1798,7 +1798,7 @@ class Mt {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
const Oe = Ye(null), Dr = ({ config: e, children: t }) => {
|
|
1800
1800
|
const [r, n] = v(null), s = ie.useRef(!1), i = ie.useRef(!1), l = Ae(() => {
|
|
1801
|
-
const d = new dt(e), u = new ut(d), k = new mt(d), w = new pt(d), p = new ht(d), b = new gt(d), m = new yt(d), N = new ft(d), h = new bt(d), x = new xt(d),
|
|
1801
|
+
const d = new dt(e), u = new ut(d), k = new mt(d), w = new pt(d), p = new ht(d), b = new gt(d), m = new yt(d), N = new ft(d), h = new bt(d), x = new xt(d), E = new At(d), S = new Mt();
|
|
1802
1802
|
return {
|
|
1803
1803
|
httpClient: d,
|
|
1804
1804
|
applicantService: u,
|
|
@@ -1810,7 +1810,7 @@ const Oe = Ye(null), Dr = ({ config: e, children: t }) => {
|
|
|
1810
1810
|
identityService: N,
|
|
1811
1811
|
baseInformationService: h,
|
|
1812
1812
|
investorCategorizationService: x,
|
|
1813
|
-
themeService:
|
|
1813
|
+
themeService: E,
|
|
1814
1814
|
themeManager: S
|
|
1815
1815
|
};
|
|
1816
1816
|
}, [e]), c = Ae(() => ({
|
|
@@ -2020,15 +2020,15 @@ function Ut(e) {
|
|
|
2020
2020
|
i(!0), c(null);
|
|
2021
2021
|
try {
|
|
2022
2022
|
await d.current.submitCurrentStep(S);
|
|
2023
|
-
const
|
|
2024
|
-
n(
|
|
2025
|
-
} catch (
|
|
2026
|
-
throw c(
|
|
2023
|
+
const I = await d.current.refreshProgress();
|
|
2024
|
+
n(I);
|
|
2025
|
+
} catch (I) {
|
|
2026
|
+
throw c(I), I;
|
|
2027
2027
|
} finally {
|
|
2028
2028
|
i(!1);
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
|
-
}, []), x = Fe.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((S,
|
|
2031
|
+
}, []), x = Fe.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((S, I) => S.order - I.order) : [], [r == null ? void 0 : r.stepInfoList]), E = Fe.useMemo(() => r ? r.nextWorkflowKey && r.nextWorkflowKey !== r.workFlowKey : !1, [r]);
|
|
2032
2032
|
return {
|
|
2033
2033
|
progress: r,
|
|
2034
2034
|
applicantId: u,
|
|
@@ -2038,7 +2038,7 @@ function Ut(e) {
|
|
|
2038
2038
|
workflowResult: (r == null ? void 0 : r.workflowResult) || null,
|
|
2039
2039
|
workflowKey: r == null ? void 0 : r.workFlowKey,
|
|
2040
2040
|
nextWorkflowKey: r == null ? void 0 : r.nextWorkflowKey,
|
|
2041
|
-
hasWorkflowChanged:
|
|
2041
|
+
hasWorkflowChanged: E,
|
|
2042
2042
|
isLoading: s,
|
|
2043
2043
|
error: l,
|
|
2044
2044
|
isComplete: (r == null ? void 0 : r.status) === le.Finished,
|
|
@@ -2093,7 +2093,7 @@ function Kt(e) {
|
|
|
2093
2093
|
submit: b
|
|
2094
2094
|
};
|
|
2095
2095
|
}
|
|
2096
|
-
function
|
|
2096
|
+
function Ht(e) {
|
|
2097
2097
|
const { uploadDocumentService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(0), [k, w] = v(null), p = W(!1), b = W(null), m = K(async () => {
|
|
2098
2098
|
if (e) {
|
|
2099
2099
|
if (p.current) {
|
|
@@ -2182,7 +2182,7 @@ function Br(e) {
|
|
|
2182
2182
|
submit: N
|
|
2183
2183
|
};
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2185
|
+
function jt(e) {
|
|
2186
2186
|
const { overviewService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), k = W(!1), w = W(null), p = K(async () => {
|
|
2187
2187
|
if (e) {
|
|
2188
2188
|
if (k.current) {
|
|
@@ -2224,7 +2224,7 @@ function qt(e) {
|
|
|
2224
2224
|
passOverview: b
|
|
2225
2225
|
};
|
|
2226
2226
|
}
|
|
2227
|
-
function
|
|
2227
|
+
function qt(e) {
|
|
2228
2228
|
const { identityService: t } = se(), [r, n] = v(
|
|
2229
2229
|
null
|
|
2230
2230
|
), [s, i] = v(!1), [l, c] = v(null), d = W(!1), u = K(
|
|
@@ -2668,10 +2668,10 @@ const Qt = ({
|
|
|
2668
2668
|
), b = (h) => {
|
|
2669
2669
|
i || (t.includes(h) ? r(t.filter((x) => x !== h)) : r([...t, h]));
|
|
2670
2670
|
}, m = (h, x) => {
|
|
2671
|
-
x.stopPropagation(), i || r(t.filter((
|
|
2671
|
+
x.stopPropagation(), i || r(t.filter((E) => E !== h));
|
|
2672
2672
|
}, N = (h) => {
|
|
2673
2673
|
var x;
|
|
2674
|
-
return ((x = n.find((
|
|
2674
|
+
return ((x = n.find((E) => E.value === h)) == null ? void 0 : x.label) || h;
|
|
2675
2675
|
};
|
|
2676
2676
|
return /* @__PURE__ */ o("div", { className: "w-full metakyc-multiselect", ref: w, children: [
|
|
2677
2677
|
e && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
@@ -2810,13 +2810,13 @@ const Qt = ({
|
|
|
2810
2810
|
}) => {
|
|
2811
2811
|
const [d, u] = v(!1), k = W(null), w = (x) => {
|
|
2812
2812
|
if (!x) return;
|
|
2813
|
-
const
|
|
2814
|
-
if (s &&
|
|
2815
|
-
const
|
|
2816
|
-
alert(`Some files exceed the maximum size of ${
|
|
2813
|
+
const E = Array.from(x);
|
|
2814
|
+
if (s && E.filter((I) => I.size > s).length > 0) {
|
|
2815
|
+
const I = Re(s);
|
|
2816
|
+
alert(`Some files exceed the maximum size of ${I}`);
|
|
2817
2817
|
return;
|
|
2818
2818
|
}
|
|
2819
|
-
i == null || i(n ? [...l, ...
|
|
2819
|
+
i == null || i(n ? [...l, ...E] : [E[0]]);
|
|
2820
2820
|
}, p = (x) => {
|
|
2821
2821
|
x.preventDefault(), u(!0);
|
|
2822
2822
|
}, b = () => {
|
|
@@ -2827,8 +2827,8 @@ const Qt = ({
|
|
|
2827
2827
|
var x;
|
|
2828
2828
|
(x = k.current) == null || x.click();
|
|
2829
2829
|
}, h = (x) => {
|
|
2830
|
-
const
|
|
2831
|
-
i == null || i(
|
|
2830
|
+
const E = l.filter((S, I) => I !== x);
|
|
2831
|
+
i == null || i(E);
|
|
2832
2832
|
};
|
|
2833
2833
|
return /* @__PURE__ */ o("div", { className: J("w-full", c), children: [
|
|
2834
2834
|
e && /* @__PURE__ */ a("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: e }),
|
|
@@ -2887,7 +2887,7 @@ const Qt = ({
|
|
|
2887
2887
|
]
|
|
2888
2888
|
}
|
|
2889
2889
|
),
|
|
2890
|
-
l.length > 0 && /* @__PURE__ */ a("div", { className: "mt-3 space-y-2", children: l.map((x,
|
|
2890
|
+
l.length > 0 && /* @__PURE__ */ a("div", { className: "mt-3 space-y-2", children: l.map((x, E) => /* @__PURE__ */ o(
|
|
2891
2891
|
"div",
|
|
2892
2892
|
{
|
|
2893
2893
|
className: "flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",
|
|
@@ -2921,7 +2921,7 @@ const Qt = ({
|
|
|
2921
2921
|
{
|
|
2922
2922
|
type: "button",
|
|
2923
2923
|
onClick: (S) => {
|
|
2924
|
-
S.stopPropagation(), h(
|
|
2924
|
+
S.stopPropagation(), h(E);
|
|
2925
2925
|
},
|
|
2926
2926
|
className: "ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",
|
|
2927
2927
|
children: /* @__PURE__ */ a("svg", { className: "h-5 w-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ a(
|
|
@@ -2936,7 +2936,7 @@ const Qt = ({
|
|
|
2936
2936
|
)
|
|
2937
2937
|
]
|
|
2938
2938
|
},
|
|
2939
|
-
|
|
2939
|
+
E
|
|
2940
2940
|
)) }),
|
|
2941
2941
|
t && /* @__PURE__ */ a("p", { className: "mt-1 text-sm text-danger-500", children: t })
|
|
2942
2942
|
] });
|
|
@@ -3161,7 +3161,7 @@ const ir = ({
|
|
|
3161
3161
|
const L = { ...g };
|
|
3162
3162
|
return delete L[D], L;
|
|
3163
3163
|
});
|
|
3164
|
-
}, []),
|
|
3164
|
+
}, []), E = K(() => {
|
|
3165
3165
|
const D = {};
|
|
3166
3166
|
for (const { question: z } of h) {
|
|
3167
3167
|
const g = nr(z, d[z.id] ?? []);
|
|
@@ -3169,11 +3169,11 @@ const ir = ({
|
|
|
3169
3169
|
}
|
|
3170
3170
|
return w((z) => ({ ...z, ...D })), Object.keys(D).length === 0;
|
|
3171
3171
|
}, [h, d]), S = () => {
|
|
3172
|
-
|
|
3173
|
-
},
|
|
3172
|
+
E() && b((D) => D + 1);
|
|
3173
|
+
}, I = () => {
|
|
3174
3174
|
p > 0 ? b((D) => D - 1) : r == null || r();
|
|
3175
3175
|
}, Y = async () => {
|
|
3176
|
-
if (!(!
|
|
3176
|
+
if (!(!E() || !n))
|
|
3177
3177
|
try {
|
|
3178
3178
|
const D = n.questionGroups.flatMap(
|
|
3179
3179
|
(g) => (g.questions ?? []).map((L) => ({
|
|
@@ -3234,7 +3234,7 @@ const ir = ({
|
|
|
3234
3234
|
{
|
|
3235
3235
|
type: "button",
|
|
3236
3236
|
variant: "outline",
|
|
3237
|
-
onClick:
|
|
3237
|
+
onClick: I,
|
|
3238
3238
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
3239
3239
|
children: [
|
|
3240
3240
|
/* @__PURE__ */ a(_e, { size: 14 }),
|
|
@@ -3296,38 +3296,65 @@ const ir = ({
|
|
|
3296
3296
|
required: e.isRequired
|
|
3297
3297
|
}
|
|
3298
3298
|
),
|
|
3299
|
-
i === "radio" && /* @__PURE__ */ o("div", {
|
|
3300
|
-
(e.defaultAnswers ?? []).map((c) => /* @__PURE__ */ o(
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
{
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3299
|
+
i === "radio" && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3300
|
+
(e.defaultAnswers ?? []).map((c) => /* @__PURE__ */ o(
|
|
3301
|
+
"label",
|
|
3302
|
+
{
|
|
3303
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0 },
|
|
3304
|
+
children: [
|
|
3305
|
+
/* @__PURE__ */ a(
|
|
3306
|
+
"input",
|
|
3307
|
+
{
|
|
3308
|
+
type: "radio",
|
|
3309
|
+
checked: t[0] === c,
|
|
3310
|
+
onChange: () => n([c]),
|
|
3311
|
+
style: {
|
|
3312
|
+
width: "16px",
|
|
3313
|
+
height: "16px",
|
|
3314
|
+
flexShrink: 0,
|
|
3315
|
+
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3316
|
+
cursor: "pointer",
|
|
3317
|
+
margin: 0
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
),
|
|
3321
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: c })
|
|
3322
|
+
]
|
|
3323
|
+
},
|
|
3324
|
+
c
|
|
3325
|
+
)),
|
|
3313
3326
|
r && /* @__PURE__ */ a("p", { className: "text-sm text-danger-500", children: r })
|
|
3314
3327
|
] }),
|
|
3315
|
-
(i === "checkbox" || i === "multi-select") && /* @__PURE__ */ o("div", {
|
|
3316
|
-
(e.defaultAnswers ?? []).map((c) => /* @__PURE__ */ o(
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
{
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3328
|
+
(i === "checkbox" || i === "multi-select") && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3329
|
+
(e.defaultAnswers ?? []).map((c) => /* @__PURE__ */ o(
|
|
3330
|
+
"label",
|
|
3331
|
+
{
|
|
3332
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0 },
|
|
3333
|
+
children: [
|
|
3334
|
+
/* @__PURE__ */ a(
|
|
3335
|
+
"input",
|
|
3336
|
+
{
|
|
3337
|
+
type: "checkbox",
|
|
3338
|
+
checked: t.includes(c),
|
|
3339
|
+
onChange: (d) => {
|
|
3340
|
+
d.target.checked ? n([...t, c]) : n(t.filter((u) => u !== c));
|
|
3341
|
+
},
|
|
3342
|
+
style: {
|
|
3343
|
+
width: "16px",
|
|
3344
|
+
height: "16px",
|
|
3345
|
+
flexShrink: 0,
|
|
3346
|
+
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3347
|
+
cursor: "pointer",
|
|
3348
|
+
margin: 0,
|
|
3349
|
+
borderRadius: "3px"
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
),
|
|
3353
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: c })
|
|
3354
|
+
]
|
|
3355
|
+
},
|
|
3356
|
+
c
|
|
3357
|
+
)),
|
|
3331
3358
|
r && /* @__PURE__ */ a("p", { className: "text-sm text-danger-500", children: r })
|
|
3332
3359
|
] }),
|
|
3333
3360
|
r && i === "text" && null
|
|
@@ -3337,7 +3364,7 @@ const ir = ({
|
|
|
3337
3364
|
onComplete: t,
|
|
3338
3365
|
onBack: r
|
|
3339
3366
|
}) => {
|
|
3340
|
-
const { uploadDocument: n, isLoading: s, isSubmitting: i, error: l, submit: c } =
|
|
3367
|
+
const { uploadDocument: n, isLoading: s, isSubmitting: i, error: l, submit: c } = Ht(e), [d, u] = v({}), k = async (w) => {
|
|
3341
3368
|
if (w.preventDefault(), !n) return;
|
|
3342
3369
|
const p = await Promise.all(
|
|
3343
3370
|
n.uploadDocumentFiles.map(async (m) => {
|
|
@@ -3387,7 +3414,7 @@ const ir = ({
|
|
|
3387
3414
|
] })
|
|
3388
3415
|
] }) }) : null;
|
|
3389
3416
|
}, cr = ({ applicantId: e, onComplete: t, onBack: r }) => {
|
|
3390
|
-
const { overview: n, isLoading: s, isSubmitting: i, error: l, passOverview: c } =
|
|
3417
|
+
const { overview: n, isLoading: s, isSubmitting: i, error: l, passOverview: c } = jt(e), d = async () => {
|
|
3391
3418
|
await c(), t == null || t();
|
|
3392
3419
|
};
|
|
3393
3420
|
return s ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ a(ce, { className: "my-8" }) }) }) : l ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
@@ -3471,7 +3498,7 @@ const pr = ({
|
|
|
3471
3498
|
const { criteria: n, isLoading: s, isSubmitting: i, error: l, submit: c } = Yt(e), [d, u] = v({}), [k, w] = v({}), [p, b] = v(0), [m, N] = v(!1), h = Ae(
|
|
3472
3499
|
() => n && n.length > 0 ? ur(n) : [],
|
|
3473
3500
|
[n]
|
|
3474
|
-
), x = p === h.length - 1,
|
|
3501
|
+
), x = p === h.length - 1, E = h[p] ?? [];
|
|
3475
3502
|
ie.useEffect(() => {
|
|
3476
3503
|
!s && n && n.length === 0 && !m && !i && (N(!0), c({ applicantId: e, criteriaValueInputs: [] }).then(() => t == null ? void 0 : t()).catch(console.error));
|
|
3477
3504
|
}, [s, n, m, i, c, e, t]);
|
|
@@ -3480,22 +3507,22 @@ const pr = ({
|
|
|
3480
3507
|
const G = { ...F };
|
|
3481
3508
|
return delete G[g], G;
|
|
3482
3509
|
});
|
|
3483
|
-
}, []),
|
|
3510
|
+
}, []), I = K(() => {
|
|
3484
3511
|
const g = {};
|
|
3485
|
-
for (const { criterion: L } of
|
|
3512
|
+
for (const { criterion: L } of E) {
|
|
3486
3513
|
const F = dr(L, d[L.id] ?? []);
|
|
3487
3514
|
F && (g[L.id] = F);
|
|
3488
3515
|
}
|
|
3489
3516
|
return w((L) => ({ ...L, ...g })), Object.keys(g).length === 0;
|
|
3490
|
-
}, [
|
|
3491
|
-
|
|
3517
|
+
}, [E, d]), Y = () => {
|
|
3518
|
+
I() && b((g) => g + 1);
|
|
3492
3519
|
}, D = () => {
|
|
3493
3520
|
p > 0 ? b((g) => g - 1) : r == null || r();
|
|
3494
3521
|
}, z = async () => {
|
|
3495
|
-
if (!(!
|
|
3522
|
+
if (!(!I() || !n))
|
|
3496
3523
|
try {
|
|
3497
3524
|
const g = n.map((F) => {
|
|
3498
|
-
const G = (d[F.id] ?? []).filter((
|
|
3525
|
+
const G = (d[F.id] ?? []).filter((j) => j && j.trim());
|
|
3499
3526
|
return G.length > 0 ? { riskCriteriaId: F.id, values: G } : null;
|
|
3500
3527
|
}).filter((F) => F !== null);
|
|
3501
3528
|
await c({ applicantId: e, criteriaValueInputs: g }), t == null || t();
|
|
@@ -3537,7 +3564,7 @@ const pr = ({
|
|
|
3537
3564
|
)) })
|
|
3538
3565
|
] })
|
|
3539
3566
|
] }),
|
|
3540
|
-
/* @__PURE__ */ a(T, { className: "space-y-6", children:
|
|
3567
|
+
/* @__PURE__ */ a(T, { className: "space-y-6", children: E.map(({ criterion: g }) => /* @__PURE__ */ a(
|
|
3541
3568
|
hr,
|
|
3542
3569
|
{
|
|
3543
3570
|
criterion: g,
|
|
@@ -3601,38 +3628,65 @@ const pr = ({
|
|
|
3601
3628
|
}
|
|
3602
3629
|
}
|
|
3603
3630
|
),
|
|
3604
|
-
s === "radio" && /* @__PURE__ */ o("div", {
|
|
3605
|
-
(e.defaultValues ?? []).map((l) => /* @__PURE__ */ o(
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
{
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3631
|
+
s === "radio" && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3632
|
+
(e.defaultValues ?? []).map((l) => /* @__PURE__ */ o(
|
|
3633
|
+
"label",
|
|
3634
|
+
{
|
|
3635
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0 },
|
|
3636
|
+
children: [
|
|
3637
|
+
/* @__PURE__ */ a(
|
|
3638
|
+
"input",
|
|
3639
|
+
{
|
|
3640
|
+
type: "radio",
|
|
3641
|
+
checked: t[0] === l,
|
|
3642
|
+
onChange: () => n([l]),
|
|
3643
|
+
style: {
|
|
3644
|
+
width: "16px",
|
|
3645
|
+
height: "16px",
|
|
3646
|
+
flexShrink: 0,
|
|
3647
|
+
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3648
|
+
cursor: "pointer",
|
|
3649
|
+
margin: 0
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
),
|
|
3653
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: l })
|
|
3654
|
+
]
|
|
3655
|
+
},
|
|
3656
|
+
l
|
|
3657
|
+
)),
|
|
3618
3658
|
r && /* @__PURE__ */ a("p", { className: "text-sm text-danger-500", children: r })
|
|
3619
3659
|
] }),
|
|
3620
|
-
s === "checkbox" && /* @__PURE__ */ o("div", {
|
|
3621
|
-
(e.defaultValues ?? []).map((l) => /* @__PURE__ */ o(
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
{
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3660
|
+
s === "checkbox" && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3661
|
+
(e.defaultValues ?? []).map((l) => /* @__PURE__ */ o(
|
|
3662
|
+
"label",
|
|
3663
|
+
{
|
|
3664
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0 },
|
|
3665
|
+
children: [
|
|
3666
|
+
/* @__PURE__ */ a(
|
|
3667
|
+
"input",
|
|
3668
|
+
{
|
|
3669
|
+
type: "checkbox",
|
|
3670
|
+
checked: t.includes(l),
|
|
3671
|
+
onChange: (c) => {
|
|
3672
|
+
c.target.checked ? n([...t, l]) : n(t.filter((d) => d !== l));
|
|
3673
|
+
},
|
|
3674
|
+
style: {
|
|
3675
|
+
width: "16px",
|
|
3676
|
+
height: "16px",
|
|
3677
|
+
flexShrink: 0,
|
|
3678
|
+
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3679
|
+
cursor: "pointer",
|
|
3680
|
+
margin: 0,
|
|
3681
|
+
borderRadius: "3px"
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
),
|
|
3685
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: l })
|
|
3686
|
+
]
|
|
3687
|
+
},
|
|
3688
|
+
l
|
|
3689
|
+
)),
|
|
3636
3690
|
r && /* @__PURE__ */ a("p", { className: "text-sm text-danger-500", children: r })
|
|
3637
3691
|
] }),
|
|
3638
3692
|
s === "country" && /* @__PURE__ */ a(
|
|
@@ -3796,15 +3850,15 @@ const pr = ({
|
|
|
3796
3850
|
onComplete: t,
|
|
3797
3851
|
onBack: r
|
|
3798
3852
|
}) => {
|
|
3799
|
-
const { appropriatenessTestService: n } = se(), [s, i] = v(null), [l, c] = v(!0), [d, u] = v(!1), [k, w] = v(null), [p, b] = v({}), [m, N] = v(0), [h, x] = v(!1), [
|
|
3853
|
+
const { appropriatenessTestService: n } = se(), [s, i] = v(null), [l, c] = v(!0), [d, u] = v(!1), [k, w] = v(null), [p, b] = v({}), [m, N] = v(0), [h, x] = v(!1), [E, S] = v(!1), [I, Y] = v(0);
|
|
3800
3854
|
V(() => {
|
|
3801
3855
|
(async () => {
|
|
3802
3856
|
try {
|
|
3803
3857
|
c(!0), w(null), console.log("Loading appropriateness test for applicant:", e);
|
|
3804
3858
|
const C = await n.getAppropriatenessTest(e);
|
|
3805
3859
|
if (console.log("Appropriateness test data:", C), i(C), C.waitTimeSpanForNextTry && C.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3806
|
-
const
|
|
3807
|
-
|
|
3860
|
+
const q = D(C.waitTimeSpanForNextTry);
|
|
3861
|
+
q > 0 && Y(q);
|
|
3808
3862
|
}
|
|
3809
3863
|
} catch (C) {
|
|
3810
3864
|
console.error("Error loading appropriateness test:", C), w(C.message || "Failed to load appropriateness test");
|
|
@@ -3816,13 +3870,13 @@ const pr = ({
|
|
|
3816
3870
|
const D = (R) => {
|
|
3817
3871
|
const C = R.split(":").map(Number);
|
|
3818
3872
|
if (C.length === 3) {
|
|
3819
|
-
const [
|
|
3820
|
-
return
|
|
3873
|
+
const [q, f, P] = C;
|
|
3874
|
+
return q * 3600 + f * 60 + P;
|
|
3821
3875
|
}
|
|
3822
3876
|
return 0;
|
|
3823
3877
|
}, z = (R) => {
|
|
3824
|
-
const C = Math.floor(R / 60),
|
|
3825
|
-
return `${C.toString().padStart(2, "0")}:${
|
|
3878
|
+
const C = Math.floor(R / 60), q = R % 60;
|
|
3879
|
+
return `${C.toString().padStart(2, "0")}:${q.toString().padStart(2, "0")}`;
|
|
3826
3880
|
};
|
|
3827
3881
|
V(() => {
|
|
3828
3882
|
if (!h || m <= 0) return;
|
|
@@ -3831,24 +3885,24 @@ const pr = ({
|
|
|
3831
3885
|
}, 1e3);
|
|
3832
3886
|
return () => clearInterval(R);
|
|
3833
3887
|
}, [h, m]), V(() => {
|
|
3834
|
-
if (
|
|
3888
|
+
if (I <= 0) return;
|
|
3835
3889
|
const R = setInterval(() => {
|
|
3836
3890
|
Y((C) => C <= 1 ? 0 : C - 1);
|
|
3837
3891
|
}, 1e3);
|
|
3838
3892
|
return () => clearInterval(R);
|
|
3839
|
-
}, [
|
|
3840
|
-
|
|
3841
|
-
}, [
|
|
3893
|
+
}, [I]), V(() => {
|
|
3894
|
+
E && !d && F();
|
|
3895
|
+
}, [E]);
|
|
3842
3896
|
const g = () => {
|
|
3843
3897
|
s && (x(!0), N(s.testDurationSec));
|
|
3844
3898
|
}, L = (R, C) => {
|
|
3845
|
-
b((
|
|
3846
|
-
...
|
|
3899
|
+
b((q) => ({
|
|
3900
|
+
...q,
|
|
3847
3901
|
[R]: C
|
|
3848
3902
|
}));
|
|
3849
3903
|
}, F = async (R) => {
|
|
3850
3904
|
if (R && R.preventDefault(), !!s) {
|
|
3851
|
-
if (!
|
|
3905
|
+
if (!E) {
|
|
3852
3906
|
const C = s.appropriatenessQuestions.length - Object.keys(p).length;
|
|
3853
3907
|
if (C > 0) {
|
|
3854
3908
|
w(`Please answer all questions. ${C} question(s) remaining.`);
|
|
@@ -3863,14 +3917,14 @@ const pr = ({
|
|
|
3863
3917
|
value: p[f.id] || ""
|
|
3864
3918
|
// Empty string if not answered
|
|
3865
3919
|
})
|
|
3866
|
-
),
|
|
3920
|
+
), q = {
|
|
3867
3921
|
applicantId: e,
|
|
3868
3922
|
appropriatenessTestId: s.id,
|
|
3869
3923
|
appropriatenessQuestionResults: C
|
|
3870
3924
|
};
|
|
3871
|
-
console.log("Submitting appropriateness test:",
|
|
3925
|
+
console.log("Submitting appropriateness test:", q);
|
|
3872
3926
|
try {
|
|
3873
|
-
const f = await n.fillAppropriatenessTest(
|
|
3927
|
+
const f = await n.fillAppropriatenessTest(q);
|
|
3874
3928
|
console.log("Appropriateness test result:", f), f.message && (f.message.toLowerCase().includes("pass") || f.message.toLowerCase().includes("success") || f.message.toLowerCase().includes("congratulations")) ? t == null || t() : (w(f.message || "Test completed. Please check the result."), x(!1), S(!1), b({}), setTimeout(() => G(), 1e3));
|
|
3875
3929
|
} catch (f) {
|
|
3876
3930
|
if (f.code === 400 && f.message) {
|
|
@@ -3908,7 +3962,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3908
3962
|
/* @__PURE__ */ a("p", { className: "text-danger-500 text-lg mb-4", children: "No test data available" }),
|
|
3909
3963
|
k && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: k })
|
|
3910
3964
|
] }) });
|
|
3911
|
-
if (
|
|
3965
|
+
if (I > 0)
|
|
3912
3966
|
return /* @__PURE__ */ o(M, { children: [
|
|
3913
3967
|
/* @__PURE__ */ o(te, { children: [
|
|
3914
3968
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
@@ -3916,13 +3970,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3916
3970
|
] }),
|
|
3917
3971
|
/* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3918
3972
|
/* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
3919
|
-
/* @__PURE__ */ a("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: z(
|
|
3973
|
+
/* @__PURE__ */ a("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: z(I) }),
|
|
3920
3974
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait before attempting the test again" })
|
|
3921
3975
|
] }),
|
|
3922
3976
|
k && /* @__PURE__ */ a("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__ */ a("p", { className: "text-red-600 dark:text-red-400 text-sm", children: k }) })
|
|
3923
3977
|
] })
|
|
3924
3978
|
] });
|
|
3925
|
-
const
|
|
3979
|
+
const j = s.testAllowedMaxTry - s.totalFailedTries;
|
|
3926
3980
|
return h ? /* @__PURE__ */ a("form", { onSubmit: F, children: /* @__PURE__ */ o(M, { children: [
|
|
3927
3981
|
/* @__PURE__ */ a(te, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
3928
3982
|
/* @__PURE__ */ o("div", { children: [
|
|
@@ -3948,10 +4002,10 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3948
4002
|
" of ",
|
|
3949
4003
|
s.totalQuestionCount
|
|
3950
4004
|
] }),
|
|
3951
|
-
/* @__PURE__ */ o(pe, { variant:
|
|
3952
|
-
|
|
4005
|
+
/* @__PURE__ */ o(pe, { variant: j > 1 ? "success" : "warning", children: [
|
|
4006
|
+
j,
|
|
3953
4007
|
" attempt",
|
|
3954
|
-
|
|
4008
|
+
j !== 1 ? "s" : "",
|
|
3955
4009
|
" remaining"
|
|
3956
4010
|
] })
|
|
3957
4011
|
] }),
|
|
@@ -3968,12 +4022,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3968
4022
|
R.groupName && /* @__PURE__ */ a("span", { className: "ml-2 text-xs text-gray-500 dark:text-gray-400", children: R.groupName }),
|
|
3969
4023
|
/* @__PURE__ */ a("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children: R.question })
|
|
3970
4024
|
] }),
|
|
3971
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: R.answers.map((
|
|
4025
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: R.answers.map((q, f) => /* @__PURE__ */ o(
|
|
3972
4026
|
"label",
|
|
3973
4027
|
{
|
|
3974
4028
|
className: `
|
|
3975
4029
|
flex items-center p-3 border-2 rounded-lg cursor-pointer transition-all
|
|
3976
|
-
${p[R.id] ===
|
|
4030
|
+
${p[R.id] === q ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}
|
|
3977
4031
|
`,
|
|
3978
4032
|
children: [
|
|
3979
4033
|
/* @__PURE__ */ a(
|
|
@@ -3981,14 +4035,14 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3981
4035
|
{
|
|
3982
4036
|
type: "radio",
|
|
3983
4037
|
name: `question-${R.id}`,
|
|
3984
|
-
value:
|
|
3985
|
-
checked: p[R.id] ===
|
|
4038
|
+
value: q,
|
|
4039
|
+
checked: p[R.id] === q,
|
|
3986
4040
|
onChange: (P) => L(R.id, P.target.value),
|
|
3987
4041
|
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500",
|
|
3988
4042
|
disabled: d
|
|
3989
4043
|
}
|
|
3990
4044
|
),
|
|
3991
|
-
/* @__PURE__ */ a("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children:
|
|
4045
|
+
/* @__PURE__ */ a("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children: q })
|
|
3992
4046
|
]
|
|
3993
4047
|
},
|
|
3994
4048
|
f
|
|
@@ -3997,12 +4051,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3997
4051
|
},
|
|
3998
4052
|
R.id
|
|
3999
4053
|
)),
|
|
4000
|
-
k && !
|
|
4054
|
+
k && !E && /* @__PURE__ */ a("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: [
|
|
4001
4055
|
/* @__PURE__ */ a("strong", { children: "Error:" }),
|
|
4002
4056
|
" ",
|
|
4003
4057
|
k
|
|
4004
4058
|
] }) }),
|
|
4005
|
-
|
|
4059
|
+
E && /* @__PURE__ */ a("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: [
|
|
4006
4060
|
/* @__PURE__ */ a("strong", { children: "Time's up!" }),
|
|
4007
4061
|
" Your answers are being submitted automatically."
|
|
4008
4062
|
] }) })
|
|
@@ -4024,7 +4078,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4024
4078
|
type: "submit",
|
|
4025
4079
|
isLoading: d,
|
|
4026
4080
|
disabled: Object.keys(p).length < s.totalQuestionCount,
|
|
4027
|
-
children:
|
|
4081
|
+
children: E ? "Submitting..." : "Submit Test"
|
|
4028
4082
|
}
|
|
4029
4083
|
)
|
|
4030
4084
|
] })
|
|
@@ -4050,7 +4104,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4050
4104
|
] }),
|
|
4051
4105
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
4052
4106
|
/* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Attempts Remaining:" }),
|
|
4053
|
-
/* @__PURE__ */ a(pe, { variant:
|
|
4107
|
+
/* @__PURE__ */ a(pe, { variant: j > 1 ? "success" : "warning", children: j })
|
|
4054
4108
|
] })
|
|
4055
4109
|
] }),
|
|
4056
4110
|
k && /* @__PURE__ */ a("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: [
|
|
@@ -4058,7 +4112,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4058
4112
|
" ",
|
|
4059
4113
|
k
|
|
4060
4114
|
] }) }),
|
|
4061
|
-
|
|
4115
|
+
j <= 0 && /* @__PURE__ */ a("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ a("p", { className: "text-red-600 dark:text-red-400", children: "You have used all your attempts. Please contact support for assistance." }) })
|
|
4062
4116
|
] }),
|
|
4063
4117
|
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
4064
4118
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
@@ -4067,7 +4121,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4067
4121
|
{
|
|
4068
4122
|
type: "button",
|
|
4069
4123
|
onClick: g,
|
|
4070
|
-
disabled:
|
|
4124
|
+
disabled: j <= 0,
|
|
4071
4125
|
children: "Start Test"
|
|
4072
4126
|
}
|
|
4073
4127
|
)
|
|
@@ -4078,8 +4132,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4078
4132
|
onComplete: t,
|
|
4079
4133
|
onBack: r
|
|
4080
4134
|
}) => {
|
|
4081
|
-
var
|
|
4082
|
-
const { applicantService: n, baseInformationService: s, config: i } = se(), { identityData: l, provider: c, token: d, isLoading: u, error: k, requestIdentity: w, restartIdentity: p } =
|
|
4135
|
+
var q, f, P, $;
|
|
4136
|
+
const { applicantService: n, baseInformationService: s, config: i } = se(), { identityData: l, provider: c, token: d, isLoading: u, error: k, requestIdentity: w, restartIdentity: p } = qt(e), [b, m] = v(null), [N, h] = v(null), [x, E] = v([]), [S, I] = v(!0), [Y, D] = v(!1), [z, g] = v(null), [L, F] = v(!1), G = ie.useRef(!1), j = Ve({
|
|
4083
4137
|
defaultValues: {
|
|
4084
4138
|
street: "",
|
|
4085
4139
|
streetNumber: "",
|
|
@@ -4099,12 +4153,12 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4099
4153
|
]);
|
|
4100
4154
|
h(y);
|
|
4101
4155
|
const Q = /* @__PURE__ */ new Set(), X = B.filter((me) => {
|
|
4102
|
-
const
|
|
4103
|
-
return !
|
|
4156
|
+
const Ee = me.abbreviation3 || me.abbreviation;
|
|
4157
|
+
return !Ee || Q.has(Ee) ? !1 : (Q.add(Ee), !0);
|
|
4104
4158
|
});
|
|
4105
|
-
|
|
4159
|
+
E(X);
|
|
4106
4160
|
const _ = y.applicantRequestData;
|
|
4107
|
-
if (
|
|
4161
|
+
if (j.reset({
|
|
4108
4162
|
street: (_ == null ? void 0 : _.street) || "",
|
|
4109
4163
|
streetNumber: (_ == null ? void 0 : _.streetNumber) || "",
|
|
4110
4164
|
city: (_ == null ? void 0 : _.city) || "",
|
|
@@ -4123,7 +4177,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4123
4177
|
} catch (y) {
|
|
4124
4178
|
console.error("Error loading applicant data:", y);
|
|
4125
4179
|
} finally {
|
|
4126
|
-
|
|
4180
|
+
I(!1);
|
|
4127
4181
|
}
|
|
4128
4182
|
})();
|
|
4129
4183
|
}, [e]), V(() => {
|
|
@@ -4321,9 +4375,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4321
4375
|
var B, Q, X;
|
|
4322
4376
|
console.log("[Identity] Iframe loaded");
|
|
4323
4377
|
try {
|
|
4324
|
-
const _ = y.target,
|
|
4325
|
-
if (
|
|
4326
|
-
const me = ((X = (Q =
|
|
4378
|
+
const _ = y.target, Ie = _.contentDocument || ((B = _.contentWindow) == null ? void 0 : B.document);
|
|
4379
|
+
if (Ie) {
|
|
4380
|
+
const me = ((X = (Q = Ie.body) == null ? void 0 : Q.textContent) == null ? void 0 : X.toLowerCase()) || "";
|
|
4327
4381
|
(me.includes("expired") || me.includes("invalid") || me.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"), F(!0), g("Your verification link has expired."));
|
|
4328
4382
|
}
|
|
4329
4383
|
} catch {
|
|
@@ -4353,7 +4407,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4353
4407
|
r && /* @__PURE__ */ a(ne, { children: /* @__PURE__ */ a(U, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4354
4408
|
] });
|
|
4355
4409
|
}
|
|
4356
|
-
return /* @__PURE__ */ a("form", { onSubmit:
|
|
4410
|
+
return /* @__PURE__ */ a("form", { onSubmit: j.handleSubmit(R), children: /* @__PURE__ */ o(M, { children: [
|
|
4357
4411
|
/* @__PURE__ */ o(te, { children: [
|
|
4358
4412
|
/* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Review Your Information" }),
|
|
4359
4413
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please review and confirm your information before starting identity verification" })
|
|
@@ -4363,7 +4417,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4363
4417
|
/* @__PURE__ */ o("div", { children: [
|
|
4364
4418
|
/* @__PURE__ */ a("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
|
|
4365
4419
|
/* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
|
|
4366
|
-
(
|
|
4420
|
+
(q = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : q.firstName,
|
|
4367
4421
|
" ",
|
|
4368
4422
|
(f = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : f.lastName
|
|
4369
4423
|
] })
|
|
@@ -4383,7 +4437,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4383
4437
|
/* @__PURE__ */ a(
|
|
4384
4438
|
ye,
|
|
4385
4439
|
{
|
|
4386
|
-
control:
|
|
4440
|
+
control: j.control,
|
|
4387
4441
|
name: "country",
|
|
4388
4442
|
render: ({ field: A }) => /* @__PURE__ */ a(
|
|
4389
4443
|
ge,
|
|
@@ -4404,7 +4458,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4404
4458
|
/* @__PURE__ */ a(
|
|
4405
4459
|
ye,
|
|
4406
4460
|
{
|
|
4407
|
-
control:
|
|
4461
|
+
control: j.control,
|
|
4408
4462
|
name: "nationality",
|
|
4409
4463
|
render: ({ field: A }) => /* @__PURE__ */ a(
|
|
4410
4464
|
ge,
|
|
@@ -4427,7 +4481,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4427
4481
|
/* @__PURE__ */ a(
|
|
4428
4482
|
ye,
|
|
4429
4483
|
{
|
|
4430
|
-
control:
|
|
4484
|
+
control: j.control,
|
|
4431
4485
|
name: "street",
|
|
4432
4486
|
render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "Street" })
|
|
4433
4487
|
}
|
|
@@ -4435,7 +4489,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4435
4489
|
/* @__PURE__ */ a(
|
|
4436
4490
|
ye,
|
|
4437
4491
|
{
|
|
4438
|
-
control:
|
|
4492
|
+
control: j.control,
|
|
4439
4493
|
name: "streetNumber",
|
|
4440
4494
|
render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "Street Number" })
|
|
4441
4495
|
}
|
|
@@ -4445,7 +4499,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4445
4499
|
/* @__PURE__ */ a(
|
|
4446
4500
|
ye,
|
|
4447
4501
|
{
|
|
4448
|
-
control:
|
|
4502
|
+
control: j.control,
|
|
4449
4503
|
name: "city",
|
|
4450
4504
|
render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "City" })
|
|
4451
4505
|
}
|
|
@@ -4453,7 +4507,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4453
4507
|
/* @__PURE__ */ a(
|
|
4454
4508
|
ye,
|
|
4455
4509
|
{
|
|
4456
|
-
control:
|
|
4510
|
+
control: j.control,
|
|
4457
4511
|
name: "zip",
|
|
4458
4512
|
render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "ZIP/Postal Code" })
|
|
4459
4513
|
}
|
|
@@ -4462,7 +4516,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4462
4516
|
/* @__PURE__ */ a(
|
|
4463
4517
|
ye,
|
|
4464
4518
|
{
|
|
4465
|
-
control:
|
|
4519
|
+
control: j.control,
|
|
4466
4520
|
name: "phonenumber",
|
|
4467
4521
|
render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "Phone Number", type: "tel" })
|
|
4468
4522
|
}
|
|
@@ -4658,13 +4712,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4658
4712
|
onSuccess: r,
|
|
4659
4713
|
onCancel: n
|
|
4660
4714
|
}) => {
|
|
4661
|
-
var R, C,
|
|
4662
|
-
const { config: s, baseInformationService: i, currentTheme: l } = se(), { createApplicant: c, isLoading: d } = Wt(), [u, k] = v([]), [w, p] = v(!0), [b, m] = v(!1), [N, h] = v(null), x = W(!1),
|
|
4715
|
+
var R, C, q;
|
|
4716
|
+
const { config: s, baseInformationService: i, currentTheme: l } = se(), { createApplicant: c, isLoading: d } = Wt(), [u, k] = v([]), [w, p] = v(!0), [b, m] = v(!1), [N, h] = v(null), x = W(!1), E = W(!1), S = e || ((R = s.applicantForm) == null ? void 0 : R.workflowKey);
|
|
4663
4717
|
if (!S)
|
|
4664
4718
|
throw new Error(
|
|
4665
4719
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
4666
4720
|
);
|
|
4667
|
-
const
|
|
4721
|
+
const I = t || ((C = s.applicantForm) == null ? void 0 : C.externalRefId) || "", Y = ["firstName", "lastName", "email", "phonenumber", "dateOfBirth"], D = ie.useMemo(() => {
|
|
4668
4722
|
const f = new Set(Y), P = l == null ? void 0 : l.applicantFormRequiredFields;
|
|
4669
4723
|
if (P && P.length > 0)
|
|
4670
4724
|
for (const $ of P)
|
|
@@ -4678,7 +4732,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4678
4732
|
for (const A of Y)
|
|
4679
4733
|
P.add(A);
|
|
4680
4734
|
return Array.from(P);
|
|
4681
|
-
}, [(
|
|
4735
|
+
}, [(q = s.applicantForm) == null ? void 0 : q.visibleFields, l == null ? void 0 : l.applicantFormVisibleFields]), [g, L] = v({
|
|
4682
4736
|
workflowKey: S,
|
|
4683
4737
|
firstName: "",
|
|
4684
4738
|
lastName: "",
|
|
@@ -4686,7 +4740,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4686
4740
|
email: "",
|
|
4687
4741
|
dateOfBirth: "",
|
|
4688
4742
|
phonenumber: "",
|
|
4689
|
-
externalRefId:
|
|
4743
|
+
externalRefId: I,
|
|
4690
4744
|
// Set from config or prop
|
|
4691
4745
|
mobileCountryCode: "",
|
|
4692
4746
|
street: "",
|
|
@@ -4707,7 +4761,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4707
4761
|
});
|
|
4708
4762
|
V(() => {
|
|
4709
4763
|
(async () => {
|
|
4710
|
-
if (x.current ||
|
|
4764
|
+
if (x.current || E.current) {
|
|
4711
4765
|
console.log("[CreateApplicant] Countries already loading or loaded, skipping...");
|
|
4712
4766
|
return;
|
|
4713
4767
|
}
|
|
@@ -4717,7 +4771,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4717
4771
|
value: y.abbreviation3 || y.abbreviation,
|
|
4718
4772
|
label: y.name
|
|
4719
4773
|
})).filter((y) => !y.value || $.has(y.value) ? !1 : ($.add(y.value), !0));
|
|
4720
|
-
k(A),
|
|
4774
|
+
k(A), E.current = !0;
|
|
4721
4775
|
} catch (P) {
|
|
4722
4776
|
console.error("Failed to load countries:", P);
|
|
4723
4777
|
} finally {
|
|
@@ -4762,7 +4816,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4762
4816
|
} finally {
|
|
4763
4817
|
m(!1);
|
|
4764
4818
|
}
|
|
4765
|
-
},
|
|
4819
|
+
}, j = (f) => {
|
|
4766
4820
|
var A;
|
|
4767
4821
|
const P = Le[f], $ = D.includes(f);
|
|
4768
4822
|
switch (P.type) {
|
|
@@ -4900,7 +4954,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4900
4954
|
" ",
|
|
4901
4955
|
N
|
|
4902
4956
|
] }) }),
|
|
4903
|
-
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: z.map((f) =>
|
|
4957
|
+
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: z.map((f) => j(f)) })
|
|
4904
4958
|
] }),
|
|
4905
4959
|
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
4906
4960
|
n && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: n, disabled: b || d, children: "Cancel" }),
|
|
@@ -4991,8 +5045,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4991
5045
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
4992
5046
|
/* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: i.status === le.IdentityPending ? "Loading identity verification..." : "Loading current step..." })
|
|
4993
5047
|
] }) }) });
|
|
4994
|
-
const x = (
|
|
4995
|
-
switch (
|
|
5048
|
+
const x = (I) => {
|
|
5049
|
+
switch (I) {
|
|
4996
5050
|
case O.Overview:
|
|
4997
5051
|
return "Overview";
|
|
4998
5052
|
case O.Questionaries:
|
|
@@ -5014,8 +5068,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5014
5068
|
default:
|
|
5015
5069
|
return "";
|
|
5016
5070
|
}
|
|
5017
|
-
},
|
|
5018
|
-
const
|
|
5071
|
+
}, E = () => {
|
|
5072
|
+
const I = c.filter((g) => g.visibility !== !1), Y = I.findIndex((g) => g.order === l.order), D = Y >= 0 ? Y + 1 : 1, z = I.length;
|
|
5019
5073
|
return /* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
5020
5074
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-4", children: [
|
|
5021
5075
|
/* @__PURE__ */ a(Ke, {}),
|
|
@@ -5026,7 +5080,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5026
5080
|
z
|
|
5027
5081
|
] })
|
|
5028
5082
|
] }),
|
|
5029
|
-
/* @__PURE__ */ a("div", { className: "flex items-center", children:
|
|
5083
|
+
/* @__PURE__ */ a("div", { className: "flex items-center", children: I.map((g, L) => {
|
|
5030
5084
|
const F = L < Y, G = g.order === l.order;
|
|
5031
5085
|
return /* @__PURE__ */ o(ie.Fragment, { children: [
|
|
5032
5086
|
/* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
@@ -5048,7 +5102,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5048
5102
|
}
|
|
5049
5103
|
)
|
|
5050
5104
|
] }),
|
|
5051
|
-
L <
|
|
5105
|
+
L < I.length - 1 && /* @__PURE__ */ a(
|
|
5052
5106
|
"div",
|
|
5053
5107
|
{
|
|
5054
5108
|
className: `flex-1 h-0.5 mx-4 ${F ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
|
|
@@ -5058,7 +5112,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5058
5112
|
}) })
|
|
5059
5113
|
] });
|
|
5060
5114
|
}, S = () => {
|
|
5061
|
-
const
|
|
5115
|
+
const I = {
|
|
5062
5116
|
applicantId: e,
|
|
5063
5117
|
onComplete: async () => {
|
|
5064
5118
|
await m();
|
|
@@ -5067,20 +5121,20 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5067
5121
|
};
|
|
5068
5122
|
switch (l.action) {
|
|
5069
5123
|
case O.Questionaries:
|
|
5070
|
-
return /* @__PURE__ */ a(ir, { ...
|
|
5124
|
+
return /* @__PURE__ */ a(ir, { ...I });
|
|
5071
5125
|
case O.UploadDocument:
|
|
5072
|
-
return /* @__PURE__ */ a(lr, { ...
|
|
5126
|
+
return /* @__PURE__ */ a(lr, { ...I });
|
|
5073
5127
|
case O.Overview:
|
|
5074
|
-
return /* @__PURE__ */ a(cr, { ...
|
|
5128
|
+
return /* @__PURE__ */ a(cr, { ...I });
|
|
5075
5129
|
case O.IdentitySdk:
|
|
5076
|
-
return /* @__PURE__ */ a(fr, { ...
|
|
5130
|
+
return /* @__PURE__ */ a(fr, { ...I });
|
|
5077
5131
|
case O.RiskScoring:
|
|
5078
|
-
return /* @__PURE__ */ a(pr, { ...
|
|
5132
|
+
return /* @__PURE__ */ a(pr, { ...I });
|
|
5079
5133
|
case O.AdditionalData:
|
|
5080
5134
|
case O.InvestorCategorization:
|
|
5081
|
-
return /* @__PURE__ */ a(gr, { ...
|
|
5135
|
+
return /* @__PURE__ */ a(gr, { ...I });
|
|
5082
5136
|
case O.AppropriatenessTest:
|
|
5083
|
-
return /* @__PURE__ */ a(yr, { ...
|
|
5137
|
+
return /* @__PURE__ */ a(yr, { ...I });
|
|
5084
5138
|
case O.ManualReview:
|
|
5085
5139
|
return /* @__PURE__ */ a(
|
|
5086
5140
|
Te,
|
|
@@ -5106,7 +5160,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5106
5160
|
}
|
|
5107
5161
|
};
|
|
5108
5162
|
return /* @__PURE__ */ o("div", { className: `metakyc-sdk ${s || ""}`, children: [
|
|
5109
|
-
|
|
5163
|
+
E(),
|
|
5110
5164
|
S()
|
|
5111
5165
|
] });
|
|
5112
5166
|
};
|
|
@@ -5157,10 +5211,10 @@ function Kr(e) {
|
|
|
5157
5211
|
t[n] = vr();
|
|
5158
5212
|
}), ue.object(t);
|
|
5159
5213
|
}
|
|
5160
|
-
const
|
|
5214
|
+
const Hr = ue.any();
|
|
5161
5215
|
export {
|
|
5162
5216
|
Pe as ALLOWED_LANGUAGES,
|
|
5163
|
-
|
|
5217
|
+
Ir as ALL_APPLICANT_FIELDS,
|
|
5164
5218
|
Ge as ApplicantProgressOnHoldReason,
|
|
5165
5219
|
le as ApplicantProgressStatus,
|
|
5166
5220
|
ut as ApplicantService,
|
|
@@ -5181,7 +5235,7 @@ export {
|
|
|
5181
5235
|
rt as DocumentReviewStatus,
|
|
5182
5236
|
ct as EndpointBuilder,
|
|
5183
5237
|
we as ErrorHandler,
|
|
5184
|
-
|
|
5238
|
+
It as EventEmitter,
|
|
5185
5239
|
Le as FIELD_METADATA,
|
|
5186
5240
|
tt as FileType,
|
|
5187
5241
|
Vt as FileUpload,
|
|
@@ -5231,9 +5285,9 @@ export {
|
|
|
5231
5285
|
he as ValueDataType,
|
|
5232
5286
|
Dt as WorkflowOrchestrator,
|
|
5233
5287
|
Se as WorkflowResultType,
|
|
5234
|
-
|
|
5288
|
+
Et as WorkflowState,
|
|
5235
5289
|
O as WorkflowStepAction,
|
|
5236
|
-
|
|
5290
|
+
Hr as appropriatenessTestSchema,
|
|
5237
5291
|
Tr as clearAllStorage,
|
|
5238
5292
|
zt as clearApplicantId,
|
|
5239
5293
|
_t as clearWorkflowState,
|
|
@@ -5253,7 +5307,7 @@ export {
|
|
|
5253
5307
|
ke as getThemePreset,
|
|
5254
5308
|
Mr as getWorkflowState,
|
|
5255
5309
|
kt as healthcareTheme,
|
|
5256
|
-
|
|
5310
|
+
Er as isScriptLoaded,
|
|
5257
5311
|
Be as loadScript,
|
|
5258
5312
|
St as minimalTheme,
|
|
5259
5313
|
Nt as modernTheme,
|
|
@@ -5263,13 +5317,13 @@ export {
|
|
|
5263
5317
|
Ct as themePresets,
|
|
5264
5318
|
Wt as useApplicant,
|
|
5265
5319
|
Br as useAppropriatenessTest,
|
|
5266
|
-
|
|
5320
|
+
qt as useIdentityVerification,
|
|
5267
5321
|
Ut as useKycWorkflow,
|
|
5268
5322
|
se as useMetaKYC,
|
|
5269
|
-
|
|
5323
|
+
jt as useOverview,
|
|
5270
5324
|
Kt as useQuestionnaire,
|
|
5271
5325
|
Yt as useRiskScoring,
|
|
5272
|
-
|
|
5326
|
+
Ht as useUploadDocument,
|
|
5273
5327
|
Fr as validateFileSize,
|
|
5274
5328
|
Pr as validateFileType
|
|
5275
5329
|
};
|