@vpdev2/metakyc-sdk 1.0.35 → 1.0.37
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/steps/QuestionnaireStep.d.ts.map +1 -1
- package/dist/components/steps/RiskScoringStep.d.ts.map +1 -1
- package/dist/hooks/useQuestionnaire.d.ts +3 -0
- package/dist/hooks/useQuestionnaire.d.ts.map +1 -1
- package/dist/hooks/useRiskScoring.d.ts +3 -0
- package/dist/hooks/useRiskScoring.d.ts.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +942 -881
- package/dist/index.js.map +1 -1
- package/dist/types/applicant.d.ts +26 -2
- package/dist/types/applicant.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var je = (e, t, r) => t in e ?
|
|
3
|
-
var
|
|
4
|
-
import
|
|
1
|
+
var qe = Object.defineProperty;
|
|
2
|
+
var je = (e, t, r) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var j = (e, t, r) => je(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import He from "axios";
|
|
5
5
|
import * as Fe from "react";
|
|
6
|
-
import
|
|
6
|
+
import te, { createContext as Ye, useState as v, useMemo as Ae, useEffect as G, useContext as We, useRef as Q, 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";
|
|
8
8
|
import { useForm as Ve, Controller as ye } from "react-hook-form";
|
|
9
9
|
import { z as ue } from "zod";
|
|
10
|
-
var
|
|
11
|
-
const
|
|
10
|
+
var z = /* @__PURE__ */ ((e) => (e[e.IdentitySdk = 0] = "IdentitySdk", e[e.RiskScoring = 1] = "RiskScoring", e[e.Questionaries = 2] = "Questionaries", e[e.AdditionalData = 3] = "AdditionalData", e[e.AppropriatenessTest = 4] = "AppropriatenessTest", e[e.UploadDocument = 5] = "UploadDocument", e[e.ManualReview = 6] = "ManualReview", e[e.Overview = 7] = "Overview", e[e.InvestorCategorization = 8] = "InvestorCategorization", e))(z || {}), Se = /* @__PURE__ */ ((e) => (e[e.NotStarted = 0] = "NotStarted", e[e.InProgress = 1] = "InProgress", e[e.Success = 2] = "Success", e[e.PartialSuccess = 3] = "PartialSuccess", e[e.Failed = 4] = "Failed", e[e.Skipped = 5] = "Skipped", e[e.AdminReview = 6] = "AdminReview", e[e.SkippedAndAdminReview = 7] = "SkippedAndAdminReview", e))(Se || {}), le = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.InProgress = 1] = "InProgress", e[e.Finished = 2] = "Finished", e[e.OnHold = 3] = "OnHold", e[e.IdentityPending = 4] = "IdentityPending", e))(le || {}), Ge = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.RepresentativeKYC = 1] = "RepresentativeKYC", e[e.ManualRiskCriteria = 2] = "ManualRiskCriteria", e[e.UploadDocumentReview = 3] = "UploadDocumentReview", e[e.AdminReview = 4] = "AdminReview", e))(Ge || {}), Ze = /* @__PURE__ */ ((e) => (e[e.LowRisk = 0] = "LowRisk", e[e.MediumRisk = 1] = "MediumRisk", e[e.HighRisk = 2] = "HighRisk", e[e.Alert = 3] = "Alert", e))(Ze || {}), fe = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.Pending = 1] = "Pending", e[e.Approved = 2] = "Approved", e[e.Rejected = 3] = "Rejected", e[e.ResendRequested = 4] = "ResendRequested", e[e.Unknown = 5] = "Unknown", e[e.InProgress = 6] = "InProgress", e))(fe || {}), be = /* @__PURE__ */ ((e) => (e[e.Approved = 0] = "Approved", e[e.Reject = 1] = "Reject", e[e.UnderReview = 2] = "UnderReview", e[e.Closed = 3] = "Closed", e[e.AdminReview = 4] = "AdminReview", e[e.New = 5] = "New", e[e.InProgress = 6] = "InProgress", e))(be || {}), Je = /* @__PURE__ */ ((e) => (e[e.ProviderResultPending = 0] = "ProviderResultPending", e[e.ProviderResultReceived = 1] = "ProviderResultReceived", e[e.Canceled = 2] = "Canceled", e[e.ExtendedToNewApplicant = 3] = "ExtendedToNewApplicant", e))(Je || {}), Xe = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.ProviderResultPending = 1] = "ProviderResultPending", e[e.ProviderResultReceived = 2] = "ProviderResultReceived", e[e.Canceled = 3] = "Canceled", e))(Xe || {}), oe = /* @__PURE__ */ ((e) => (e[e.Onfido = 0] = "Onfido", e[e.Sumsub = 2] = "Sumsub", e[e.SardinAI = 3] = "SardinAI", e))(oe || {}), et = /* @__PURE__ */ ((e) => (e[e.Individual = 0] = "Individual", e[e.Company = 1] = "Company", e))(et || {}), Ce = /* @__PURE__ */ ((e) => (e[e.Male = 0] = "Male", e[e.Female = 1] = "Female", e[e.Other = 2] = "Other", e))(Ce || {}), tt = /* @__PURE__ */ ((e) => (e[e.Image = 0] = "Image", e[e.Video = 1] = "Video", e[e.PDF = 2] = "PDF", e[e.OfficePDF = 3] = "OfficePDF", e[e.Custom = 4] = "Custom", e))(tt || {}), rt = /* @__PURE__ */ ((e) => (e[e.Pending = 0] = "Pending", e[e.Approved = 1] = "Approved", e[e.Rejected = 2] = "Rejected", e[e.RequiresRevision = 3] = "RequiresRevision", e))(rt || {}), at = /* @__PURE__ */ ((e) => (e[e.SingleChoice = 0] = "SingleChoice", e[e.MultipleChoice = 1] = "MultipleChoice", e[e.Text = 2] = "Text", e))(at || {}), he = /* @__PURE__ */ ((e) => (e[e.String = 0] = "String", e[e.Integer = 1] = "Integer", e[e.Decimal = 2] = "Decimal", e[e.Boolean = 3] = "Boolean", e[e.Date = 4] = "Date", e[e.Country = 5] = "Country", e[e.DigitOnly = 6] = "DigitOnly", e))(he || {}), nt = /* @__PURE__ */ ((e) => (e[e.Text = 0] = "Text", e[e.Radio = 1] = "Radio", e[e.Checkbox = 2] = "Checkbox", e[e.Dropdown = 3] = "Dropdown", e[e.Country = 4] = "Country", e))(nt || {}), st = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.Country = 1] = "Country", e))(st || {}), ae = /* @__PURE__ */ ((e) => (e[e.Individual = 0] = "Individual", e[e.Sophisticated = 1] = "Sophisticated", e[e.HighNetWorth = 2] = "HighNetWorth", e[e.Business = 3] = "Business", e))(ae || {}), it = /* @__PURE__ */ ((e) => (e[e.Retail = 0] = "Retail", e[e.Professional = 1] = "Professional", e[e.EligibleCounterparty = 2] = "EligibleCounterparty", e))(it || {});
|
|
11
|
+
const Le = [
|
|
12
12
|
{ value: "EN", label: "English" },
|
|
13
13
|
{ value: "DE", label: "German" },
|
|
14
14
|
{ value: "FR", label: "French" },
|
|
@@ -64,7 +64,7 @@ const Pe = [
|
|
|
64
64
|
"occupation",
|
|
65
65
|
"taxNumber",
|
|
66
66
|
"externalRefId"
|
|
67
|
-
],
|
|
67
|
+
], Pe = {
|
|
68
68
|
firstName: { label: "First Name", type: "text" },
|
|
69
69
|
lastName: { label: "Last Name", type: "text" },
|
|
70
70
|
title: { label: "Title", type: "text" },
|
|
@@ -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
|
+
j(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
|
+
j(this, "axiosInstance");
|
|
201
|
+
j(this, "endpointBuilder");
|
|
202
|
+
j(this, "config");
|
|
203
|
+
this.config = { ...lt, ...t }, this.endpointBuilder = new ct(this.config.endpoints), this.axiosInstance = He.create({
|
|
204
204
|
baseURL: this.config.baseUrl,
|
|
205
205
|
timeout: this.config.timeout,
|
|
206
206
|
headers: {
|
|
@@ -971,7 +971,7 @@ class At {
|
|
|
971
971
|
}
|
|
972
972
|
class It {
|
|
973
973
|
constructor() {
|
|
974
|
-
|
|
974
|
+
j(this, "listeners", /* @__PURE__ */ new Map());
|
|
975
975
|
}
|
|
976
976
|
/**
|
|
977
977
|
* Subscribe to an event
|
|
@@ -1016,10 +1016,10 @@ class It {
|
|
|
1016
1016
|
}
|
|
1017
1017
|
class Et {
|
|
1018
1018
|
constructor() {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1019
|
+
j(this, "events", new It());
|
|
1020
|
+
j(this, "_applicantId", null);
|
|
1021
|
+
j(this, "_progress", null);
|
|
1022
|
+
j(this, "_error", null);
|
|
1023
1023
|
}
|
|
1024
1024
|
/**
|
|
1025
1025
|
* Get current applicant ID
|
|
@@ -1156,7 +1156,7 @@ class Et {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
class Rt {
|
|
1158
1158
|
constructor() {
|
|
1159
|
-
|
|
1159
|
+
j(this, "handlers", /* @__PURE__ */ new Map());
|
|
1160
1160
|
}
|
|
1161
1161
|
/**
|
|
1162
1162
|
* Register a step handler
|
|
@@ -1182,7 +1182,7 @@ class Rt {
|
|
|
1182
1182
|
async loadStepData(t, r) {
|
|
1183
1183
|
const n = this.getHandler(t);
|
|
1184
1184
|
if (!n)
|
|
1185
|
-
throw new Error(`No handler registered for step action: ${
|
|
1185
|
+
throw new Error(`No handler registered for step action: ${z[t]}`);
|
|
1186
1186
|
return n.loadData(r);
|
|
1187
1187
|
}
|
|
1188
1188
|
/**
|
|
@@ -1191,61 +1191,61 @@ class Rt {
|
|
|
1191
1191
|
async submitStepData(t, r) {
|
|
1192
1192
|
const n = this.getHandler(t);
|
|
1193
1193
|
if (!n)
|
|
1194
|
-
throw new Error(`No handler registered for step action: ${
|
|
1194
|
+
throw new Error(`No handler registered for step action: ${z[t]}`);
|
|
1195
1195
|
return n.submitData(r);
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
1198
|
class Dt {
|
|
1199
1199
|
constructor(t, r, n, s, i, l, c, d) {
|
|
1200
|
-
|
|
1201
|
-
|
|
1200
|
+
j(this, "state");
|
|
1201
|
+
j(this, "stepRouter");
|
|
1202
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
|
|
1206
1206
|
*/
|
|
1207
1207
|
registerStepHandlers() {
|
|
1208
|
-
this.stepRouter.registerHandler(
|
|
1208
|
+
this.stepRouter.registerHandler(z.Questionaries, {
|
|
1209
1209
|
loadData: (t) => this.questionnaireService.getQuestionnaire(t),
|
|
1210
1210
|
submitData: async (t) => {
|
|
1211
1211
|
await this.questionnaireService.fillQuestionnaire(t);
|
|
1212
1212
|
}
|
|
1213
|
-
}), this.stepRouter.registerHandler(
|
|
1213
|
+
}), this.stepRouter.registerHandler(z.UploadDocument, {
|
|
1214
1214
|
loadData: (t) => this.uploadDocumentService.getUploadDocument(t),
|
|
1215
1215
|
submitData: (t) => this.uploadDocumentService.fillUploadDocument(t)
|
|
1216
|
-
}), this.stepRouter.registerHandler(
|
|
1216
|
+
}), this.stepRouter.registerHandler(z.AppropriatenessTest, {
|
|
1217
1217
|
loadData: (t) => this.appropriatenessTestService.getAppropriatenessTest(t),
|
|
1218
1218
|
submitData: async (t) => {
|
|
1219
1219
|
await this.appropriatenessTestService.fillAppropriatenessTest(t);
|
|
1220
1220
|
}
|
|
1221
|
-
}), this.stepRouter.registerHandler(
|
|
1221
|
+
}), this.stepRouter.registerHandler(z.Overview, {
|
|
1222
1222
|
loadData: (t) => this.overviewService.getOverviewData(t),
|
|
1223
1223
|
submitData: (t) => this.overviewService.passOverview(t.applicantId)
|
|
1224
|
-
}), this.stepRouter.registerHandler(
|
|
1224
|
+
}), this.stepRouter.registerHandler(z.RiskScoring, {
|
|
1225
1225
|
loadData: (t) => this.riskScoringService.getRiskCriterias(t),
|
|
1226
1226
|
submitData: async (t) => {
|
|
1227
1227
|
await this.riskScoringService.submitRiskScoring(t);
|
|
1228
1228
|
}
|
|
1229
|
-
}), this.stepRouter.registerHandler(
|
|
1229
|
+
}), this.stepRouter.registerHandler(z.IdentitySdk, {
|
|
1230
1230
|
loadData: async (t) => ({
|
|
1231
1231
|
applicantId: t,
|
|
1232
1232
|
message: "Identity verification required"
|
|
1233
1233
|
}),
|
|
1234
1234
|
submitData: async () => {
|
|
1235
1235
|
}
|
|
1236
|
-
}), this.stepRouter.registerHandler(
|
|
1236
|
+
}), this.stepRouter.registerHandler(z.InvestorCategorization, {
|
|
1237
1237
|
loadData: (t) => this.investorCategorizationService.getInvestorCategorization(t),
|
|
1238
1238
|
submitData: async (t) => {
|
|
1239
1239
|
await this.investorCategorizationService.setInvestorCategorization(t);
|
|
1240
1240
|
}
|
|
1241
|
-
}), this.stepRouter.registerHandler(
|
|
1241
|
+
}), this.stepRouter.registerHandler(z.ManualReview, {
|
|
1242
1242
|
loadData: async (t) => ({
|
|
1243
1243
|
applicantId: t,
|
|
1244
1244
|
message: "Your application is under manual review"
|
|
1245
1245
|
}),
|
|
1246
1246
|
submitData: async () => {
|
|
1247
1247
|
}
|
|
1248
|
-
}), this.stepRouter.registerHandler(
|
|
1248
|
+
}), this.stepRouter.registerHandler(z.AdditionalData, {
|
|
1249
1249
|
loadData: async (t) => ({
|
|
1250
1250
|
applicantId: t,
|
|
1251
1251
|
message: "Additional data required"
|
|
@@ -1339,7 +1339,7 @@ class Dt {
|
|
|
1339
1339
|
return this.stepRouter;
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function Oe(e, t) {
|
|
1343
1343
|
return new Promise((r, n) => {
|
|
1344
1344
|
if (t && document.getElementById(t)) {
|
|
1345
1345
|
r();
|
|
@@ -1358,15 +1358,15 @@ function Rr(e) {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
class Ft {
|
|
1360
1360
|
constructor(t) {
|
|
1361
|
-
|
|
1362
|
-
|
|
1361
|
+
j(this, "sdk", null);
|
|
1362
|
+
j(this, "config");
|
|
1363
1363
|
this.config = t;
|
|
1364
1364
|
}
|
|
1365
1365
|
/**
|
|
1366
1366
|
* Load Sumsub SDK
|
|
1367
1367
|
*/
|
|
1368
1368
|
async loadSDK() {
|
|
1369
|
-
await
|
|
1369
|
+
await Oe(
|
|
1370
1370
|
"https://cdn.sumsub.com/websdk/v2/production/websdk.js",
|
|
1371
1371
|
"sumsub-sdk"
|
|
1372
1372
|
);
|
|
@@ -1411,17 +1411,17 @@ class Ft {
|
|
|
1411
1411
|
this.sdk && this.sdk.on("idCheck.onError", t);
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
|
-
class
|
|
1414
|
+
class Lt {
|
|
1415
1415
|
constructor(t) {
|
|
1416
|
-
|
|
1417
|
-
|
|
1416
|
+
j(this, "sdk", null);
|
|
1417
|
+
j(this, "config");
|
|
1418
1418
|
this.config = t;
|
|
1419
1419
|
}
|
|
1420
1420
|
/**
|
|
1421
1421
|
* Load Onfido SDK
|
|
1422
1422
|
*/
|
|
1423
1423
|
async loadSDK() {
|
|
1424
|
-
await
|
|
1424
|
+
await Oe(
|
|
1425
1425
|
"https://sdk.onfido.com/v12.0.0/onfido.min.js",
|
|
1426
1426
|
"onfido-sdk"
|
|
1427
1427
|
);
|
|
@@ -1477,11 +1477,11 @@ class Pt {
|
|
|
1477
1477
|
this.sdk && (this.sdk.tearDown(), this.sdk = null);
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
|
-
class
|
|
1480
|
+
class Pt {
|
|
1481
1481
|
constructor(t) {
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1482
|
+
j(this, "sardineContext", null);
|
|
1483
|
+
j(this, "config");
|
|
1484
|
+
j(this, "sessionKey");
|
|
1485
1485
|
this.config = t, this.sessionKey = t.sessionKey || this.generateSessionKey();
|
|
1486
1486
|
}
|
|
1487
1487
|
/**
|
|
@@ -1630,9 +1630,9 @@ class xe {
|
|
|
1630
1630
|
case oe.Sumsub:
|
|
1631
1631
|
return new Ft(r);
|
|
1632
1632
|
case oe.Onfido:
|
|
1633
|
-
return new Pt(r);
|
|
1634
|
-
case oe.SardinAI:
|
|
1635
1633
|
return new Lt(r);
|
|
1634
|
+
case oe.SardinAI:
|
|
1635
|
+
return new Pt(r);
|
|
1636
1636
|
default:
|
|
1637
1637
|
throw new Error(`Unsupported identity provider: ${t}`);
|
|
1638
1638
|
}
|
|
@@ -1673,9 +1673,9 @@ class xe {
|
|
|
1673
1673
|
}
|
|
1674
1674
|
class Mt {
|
|
1675
1675
|
constructor(t) {
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1676
|
+
j(this, "currentTheme", ee);
|
|
1677
|
+
j(this, "customStyleElement", null);
|
|
1678
|
+
j(this, "container");
|
|
1679
1679
|
this.container = t || document.documentElement;
|
|
1680
1680
|
}
|
|
1681
1681
|
/**
|
|
@@ -1796,20 +1796,20 @@ class Mt {
|
|
|
1796
1796
|
return t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
|
-
const
|
|
1800
|
-
const [r, n] = v(null), s =
|
|
1801
|
-
const d = new dt(e), u = new ut(d),
|
|
1799
|
+
const Be = Ye(null), Dr = ({ config: e, children: t }) => {
|
|
1800
|
+
const [r, n] = v(null), s = te.useRef(!1), i = te.useRef(!1), l = Ae(() => {
|
|
1801
|
+
const d = new dt(e), u = new ut(d), w = new mt(d), k = new pt(d), g = new ht(d), m = new gt(d), p = new yt(d), N = new ft(d), f = new bt(d), y = new xt(d), E = new At(d), S = new Mt();
|
|
1802
1802
|
return {
|
|
1803
1803
|
httpClient: d,
|
|
1804
1804
|
applicantService: u,
|
|
1805
|
-
questionnaireService:
|
|
1806
|
-
uploadDocumentService:
|
|
1807
|
-
appropriatenessTestService:
|
|
1808
|
-
overviewService:
|
|
1809
|
-
riskScoringService:
|
|
1805
|
+
questionnaireService: w,
|
|
1806
|
+
uploadDocumentService: k,
|
|
1807
|
+
appropriatenessTestService: g,
|
|
1808
|
+
overviewService: m,
|
|
1809
|
+
riskScoringService: p,
|
|
1810
1810
|
identityService: N,
|
|
1811
|
-
baseInformationService:
|
|
1812
|
-
investorCategorizationService:
|
|
1811
|
+
baseInformationService: f,
|
|
1812
|
+
investorCategorizationService: y,
|
|
1813
1813
|
themeService: E,
|
|
1814
1814
|
themeManager: S
|
|
1815
1815
|
};
|
|
@@ -1828,7 +1828,7 @@ const Oe = Ye(null), Dr = ({ config: e, children: t }) => {
|
|
|
1828
1828
|
l.investorCategorizationService
|
|
1829
1829
|
)
|
|
1830
1830
|
}), [e, l, r]);
|
|
1831
|
-
return
|
|
1831
|
+
return G(() => ((async () => {
|
|
1832
1832
|
if (s.current || i.current) {
|
|
1833
1833
|
console.log("[MetaKYC] Theme already loading or loaded, skipping...");
|
|
1834
1834
|
return;
|
|
@@ -1849,10 +1849,10 @@ const Oe = Ye(null), Dr = ({ config: e, children: t }) => {
|
|
|
1849
1849
|
}
|
|
1850
1850
|
})(), () => {
|
|
1851
1851
|
l.themeManager.cleanup();
|
|
1852
|
-
}), []), /* @__PURE__ */ a(
|
|
1852
|
+
}), []), /* @__PURE__ */ a(Be.Provider, { value: c, children: t });
|
|
1853
1853
|
};
|
|
1854
|
-
function
|
|
1855
|
-
const e = We(
|
|
1854
|
+
function ie() {
|
|
1855
|
+
const e = We(Be);
|
|
1856
1856
|
if (!e)
|
|
1857
1857
|
throw new Error("useMetaKYC must be used within a MetaKYCProvider");
|
|
1858
1858
|
return e;
|
|
@@ -1869,7 +1869,7 @@ async function Tt(e) {
|
|
|
1869
1869
|
function Fr(e, t) {
|
|
1870
1870
|
return e.size <= t;
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1872
|
+
function Lr(e, t) {
|
|
1873
1873
|
return t.split(",").map((n) => n.trim()).some((n) => {
|
|
1874
1874
|
if (n.endsWith("/*")) {
|
|
1875
1875
|
const s = n.slice(0, -2);
|
|
@@ -1883,7 +1883,7 @@ function Re(e) {
|
|
|
1883
1883
|
const t = 1024, r = ["Bytes", "KB", "MB", "GB"], n = Math.floor(Math.log(e) / Math.log(t));
|
|
1884
1884
|
return Math.round(e / Math.pow(t, n) * 100) / 100 + " " + r[n];
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function Pr(e) {
|
|
1887
1887
|
return e;
|
|
1888
1888
|
}
|
|
1889
1889
|
function J(...e) {
|
|
@@ -1893,14 +1893,14 @@ const ve = {
|
|
|
1893
1893
|
APPLICANT_ID: "metakyc_applicant_id",
|
|
1894
1894
|
WORKFLOW_STATE: "metakyc_workflow_state"
|
|
1895
1895
|
};
|
|
1896
|
-
function
|
|
1896
|
+
function Ot(e) {
|
|
1897
1897
|
try {
|
|
1898
1898
|
localStorage.setItem(ve.APPLICANT_ID, e.toString());
|
|
1899
1899
|
} catch (t) {
|
|
1900
1900
|
console.warn("Failed to save applicant ID to storage:", t);
|
|
1901
1901
|
}
|
|
1902
1902
|
}
|
|
1903
|
-
function
|
|
1903
|
+
function Bt() {
|
|
1904
1904
|
try {
|
|
1905
1905
|
const e = localStorage.getItem(ve.APPLICANT_ID);
|
|
1906
1906
|
return e ? parseInt(e, 10) : null;
|
|
@@ -1941,12 +1941,12 @@ function Tr() {
|
|
|
1941
1941
|
zt(), _t();
|
|
1942
1942
|
}
|
|
1943
1943
|
function Ut(e) {
|
|
1944
|
-
const { createOrchestrator: t } =
|
|
1945
|
-
|
|
1944
|
+
const { createOrchestrator: t } = ie(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(null), d = Q(null), u = e || Bt();
|
|
1945
|
+
G(() => {
|
|
1946
1946
|
d.current || (d.current = t());
|
|
1947
|
-
}, [t]),
|
|
1947
|
+
}, [t]), G(() => {
|
|
1948
1948
|
var S;
|
|
1949
|
-
r && u && (
|
|
1949
|
+
r && u && (Ot(u), $t({
|
|
1950
1950
|
applicantId: u,
|
|
1951
1951
|
currentStepOrder: (S = r.currentStep) == null ? void 0 : S.order,
|
|
1952
1952
|
status: r.status,
|
|
@@ -1955,43 +1955,43 @@ function Ut(e) {
|
|
|
1955
1955
|
nextWorkflowKey: r.nextWorkflowKey
|
|
1956
1956
|
}));
|
|
1957
1957
|
}, [r, u]);
|
|
1958
|
-
const
|
|
1958
|
+
const w = Q(!1), k = Q(!1), g = K(async () => {
|
|
1959
1959
|
if (!(!u || !d.current)) {
|
|
1960
|
-
if (
|
|
1960
|
+
if (w.current) {
|
|
1961
1961
|
console.log("[Workflow] Load already in progress, skipping...");
|
|
1962
1962
|
return;
|
|
1963
1963
|
}
|
|
1964
|
-
|
|
1964
|
+
w.current = !0, i(!0), c(null);
|
|
1965
1965
|
try {
|
|
1966
1966
|
const S = await d.current.initialize(u);
|
|
1967
|
-
n(S),
|
|
1967
|
+
n(S), k.current = !0;
|
|
1968
1968
|
} catch (S) {
|
|
1969
1969
|
c(S);
|
|
1970
1970
|
} finally {
|
|
1971
|
-
i(!1),
|
|
1971
|
+
i(!1), w.current = !1;
|
|
1972
1972
|
}
|
|
1973
1973
|
}
|
|
1974
1974
|
}, [u]);
|
|
1975
|
-
|
|
1976
|
-
u && !
|
|
1977
|
-
}, [u,
|
|
1978
|
-
const
|
|
1975
|
+
G(() => {
|
|
1976
|
+
u && !k.current && g();
|
|
1977
|
+
}, [u, g]);
|
|
1978
|
+
const m = K(async () => {
|
|
1979
1979
|
if (d.current) {
|
|
1980
|
-
if (
|
|
1980
|
+
if (w.current) {
|
|
1981
1981
|
console.log("[Workflow] Refresh already in progress, skipping...");
|
|
1982
1982
|
return;
|
|
1983
1983
|
}
|
|
1984
|
-
|
|
1984
|
+
w.current = !0, i(!0), c(null);
|
|
1985
1985
|
try {
|
|
1986
1986
|
const S = await d.current.refreshProgress();
|
|
1987
1987
|
n(S);
|
|
1988
1988
|
} catch (S) {
|
|
1989
1989
|
c(S);
|
|
1990
1990
|
} finally {
|
|
1991
|
-
i(!1),
|
|
1991
|
+
i(!1), w.current = !1;
|
|
1992
1992
|
}
|
|
1993
1993
|
}
|
|
1994
|
-
}, []),
|
|
1994
|
+
}, []), p = K(async () => {
|
|
1995
1995
|
if (d.current) {
|
|
1996
1996
|
i(!0), c(null);
|
|
1997
1997
|
try {
|
|
@@ -2015,25 +2015,25 @@ function Ut(e) {
|
|
|
2015
2015
|
i(!1);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
|
-
}, []),
|
|
2018
|
+
}, []), f = K(async (S) => {
|
|
2019
2019
|
if (d.current) {
|
|
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 C = await d.current.refreshProgress();
|
|
2024
|
+
n(C);
|
|
2025
|
+
} catch (C) {
|
|
2026
|
+
throw c(C), C;
|
|
2027
2027
|
} finally {
|
|
2028
2028
|
i(!1);
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
|
-
}, []),
|
|
2031
|
+
}, []), y = Fe.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((S, C) => S.order - C.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,
|
|
2035
2035
|
currentStep: (r == null ? void 0 : r.currentStep) || null,
|
|
2036
|
-
steps:
|
|
2036
|
+
steps: y,
|
|
2037
2037
|
status: (r == null ? void 0 : r.status) || le.None,
|
|
2038
2038
|
workflowResult: (r == null ? void 0 : r.workflowResult) || null,
|
|
2039
2039
|
workflowKey: r == null ? void 0 : r.workFlowKey,
|
|
@@ -2043,84 +2043,100 @@ function Ut(e) {
|
|
|
2043
2043
|
error: l,
|
|
2044
2044
|
isComplete: (r == null ? void 0 : r.status) === le.Finished,
|
|
2045
2045
|
isOnHold: (r == null ? void 0 : r.status) === le.OnHold,
|
|
2046
|
-
refreshProgress:
|
|
2047
|
-
moveToNext:
|
|
2046
|
+
refreshProgress: m,
|
|
2047
|
+
moveToNext: p,
|
|
2048
2048
|
moveBack: N,
|
|
2049
|
-
submitCurrentStep:
|
|
2049
|
+
submitCurrentStep: f,
|
|
2050
2050
|
orchestrator: d.current
|
|
2051
2051
|
};
|
|
2052
2052
|
}
|
|
2053
2053
|
function Kt(e) {
|
|
2054
|
-
const { questionnaireService: t } =
|
|
2054
|
+
const { questionnaireService: t, applicantService: r } = ie(), [n, s] = v(null), [i, l] = v({}), [c, d] = v(!1), [u, w] = v(!1), [k, g] = v(null), m = Q(!1), p = Q(null), N = K(async () => {
|
|
2055
|
+
var y, E;
|
|
2055
2056
|
if (e) {
|
|
2056
|
-
if (
|
|
2057
|
+
if (m.current) {
|
|
2057
2058
|
console.log("[Questionnaire] Load already in progress, skipping...");
|
|
2058
2059
|
return;
|
|
2059
2060
|
}
|
|
2060
|
-
|
|
2061
|
+
m.current = !0, d(!0), g(null);
|
|
2061
2062
|
try {
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2063
|
+
const [S, C] = await Promise.all([
|
|
2064
|
+
t.getQuestionnaire(e),
|
|
2065
|
+
r.getApplicantData(e).catch(() => null)
|
|
2066
|
+
]);
|
|
2067
|
+
if (s(S), (y = C == null ? void 0 : C.questionnaireResults) != null && y.length && S) {
|
|
2068
|
+
const O = /* @__PURE__ */ new Map();
|
|
2069
|
+
for (const h of C.questionnaireResults)
|
|
2070
|
+
h.question && ((E = h.answers) != null && E.length) && O.set(h.question.trim().toLowerCase(), h.answers);
|
|
2071
|
+
const W = {}, F = S.questionGroups.flatMap((h) => h.questions ?? []);
|
|
2072
|
+
for (const h of F) {
|
|
2073
|
+
const A = h.text.trim().toLowerCase();
|
|
2074
|
+
O.has(A) && (W[h.id] = O.get(A));
|
|
2075
|
+
}
|
|
2076
|
+
l(W);
|
|
2077
|
+
}
|
|
2078
|
+
p.current = e;
|
|
2079
|
+
} catch (S) {
|
|
2080
|
+
g(S);
|
|
2066
2081
|
} finally {
|
|
2067
|
-
|
|
2082
|
+
d(!1), m.current = !1;
|
|
2068
2083
|
}
|
|
2069
2084
|
}
|
|
2070
|
-
}, [e, t]);
|
|
2071
|
-
|
|
2072
|
-
e &&
|
|
2085
|
+
}, [e, t, r]);
|
|
2086
|
+
G(() => {
|
|
2087
|
+
e && p.current !== e && N();
|
|
2073
2088
|
}, [e]);
|
|
2074
|
-
const
|
|
2075
|
-
async (
|
|
2076
|
-
|
|
2089
|
+
const f = K(
|
|
2090
|
+
async (y) => {
|
|
2091
|
+
w(!0), g(null);
|
|
2077
2092
|
try {
|
|
2078
|
-
return await t.fillQuestionnaire(
|
|
2079
|
-
} catch (
|
|
2080
|
-
throw
|
|
2093
|
+
return await t.fillQuestionnaire(y);
|
|
2094
|
+
} catch (E) {
|
|
2095
|
+
throw g(E), E;
|
|
2081
2096
|
} finally {
|
|
2082
|
-
|
|
2097
|
+
w(!1);
|
|
2083
2098
|
}
|
|
2084
2099
|
},
|
|
2085
2100
|
[t]
|
|
2086
2101
|
);
|
|
2087
2102
|
return {
|
|
2088
|
-
questionnaire:
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2103
|
+
questionnaire: n,
|
|
2104
|
+
initialAnswers: i,
|
|
2105
|
+
isLoading: c,
|
|
2106
|
+
isSubmitting: u,
|
|
2107
|
+
error: k,
|
|
2108
|
+
load: N,
|
|
2109
|
+
submit: f
|
|
2094
2110
|
};
|
|
2095
2111
|
}
|
|
2096
|
-
function
|
|
2097
|
-
const { uploadDocumentService: t } =
|
|
2112
|
+
function qt(e) {
|
|
2113
|
+
const { uploadDocumentService: t } = ie(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(0), [w, k] = v(null), g = Q(!1), m = Q(null), p = K(async () => {
|
|
2098
2114
|
if (e) {
|
|
2099
|
-
if (
|
|
2115
|
+
if (g.current) {
|
|
2100
2116
|
console.log("[UploadDocument] Load already in progress, skipping...");
|
|
2101
2117
|
return;
|
|
2102
2118
|
}
|
|
2103
|
-
|
|
2119
|
+
g.current = !0, i(!0), k(null);
|
|
2104
2120
|
try {
|
|
2105
|
-
const
|
|
2106
|
-
n(
|
|
2107
|
-
} catch (
|
|
2108
|
-
|
|
2121
|
+
const f = await t.getUploadDocument(e);
|
|
2122
|
+
n(f), m.current = e;
|
|
2123
|
+
} catch (f) {
|
|
2124
|
+
k(f);
|
|
2109
2125
|
} finally {
|
|
2110
|
-
i(!1),
|
|
2126
|
+
i(!1), g.current = !1;
|
|
2111
2127
|
}
|
|
2112
2128
|
}
|
|
2113
2129
|
}, [e, t]);
|
|
2114
|
-
|
|
2115
|
-
e &&
|
|
2130
|
+
G(() => {
|
|
2131
|
+
e && m.current !== e && p();
|
|
2116
2132
|
}, [e]);
|
|
2117
2133
|
const N = K(
|
|
2118
|
-
async (
|
|
2119
|
-
c(!0), u(0),
|
|
2134
|
+
async (f) => {
|
|
2135
|
+
c(!0), u(0), k(null);
|
|
2120
2136
|
try {
|
|
2121
|
-
await t.fillUploadDocument(
|
|
2122
|
-
} catch (
|
|
2123
|
-
throw
|
|
2137
|
+
await t.fillUploadDocument(f), u(100);
|
|
2138
|
+
} catch (y) {
|
|
2139
|
+
throw k(y), y;
|
|
2124
2140
|
} finally {
|
|
2125
2141
|
c(!1);
|
|
2126
2142
|
}
|
|
@@ -2132,40 +2148,40 @@ function Ht(e) {
|
|
|
2132
2148
|
isLoading: s,
|
|
2133
2149
|
isSubmitting: l,
|
|
2134
2150
|
uploadProgress: d,
|
|
2135
|
-
error:
|
|
2136
|
-
load:
|
|
2151
|
+
error: w,
|
|
2152
|
+
load: p,
|
|
2137
2153
|
submit: N
|
|
2138
2154
|
};
|
|
2139
2155
|
}
|
|
2140
|
-
function
|
|
2141
|
-
const { appropriatenessTestService: t } =
|
|
2156
|
+
function Or(e) {
|
|
2157
|
+
const { appropriatenessTestService: t } = ie(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), [w, k] = v(null), g = Q(!1), m = Q(null), p = K(async () => {
|
|
2142
2158
|
if (e) {
|
|
2143
|
-
if (
|
|
2159
|
+
if (g.current) {
|
|
2144
2160
|
console.log("[AppropriatenessTest] Load already in progress, skipping...");
|
|
2145
2161
|
return;
|
|
2146
2162
|
}
|
|
2147
|
-
|
|
2163
|
+
g.current = !0, i(!0), u(null);
|
|
2148
2164
|
try {
|
|
2149
|
-
const
|
|
2150
|
-
n(
|
|
2151
|
-
} catch (
|
|
2152
|
-
u(
|
|
2165
|
+
const f = await t.getAppropriatenessTest(e);
|
|
2166
|
+
n(f), m.current = e;
|
|
2167
|
+
} catch (f) {
|
|
2168
|
+
u(f);
|
|
2153
2169
|
} finally {
|
|
2154
|
-
i(!1),
|
|
2170
|
+
i(!1), g.current = !1;
|
|
2155
2171
|
}
|
|
2156
2172
|
}
|
|
2157
2173
|
}, [e, t]);
|
|
2158
|
-
|
|
2159
|
-
e &&
|
|
2174
|
+
G(() => {
|
|
2175
|
+
e && m.current !== e && p();
|
|
2160
2176
|
}, [e]);
|
|
2161
2177
|
const N = K(
|
|
2162
|
-
async (
|
|
2178
|
+
async (f) => {
|
|
2163
2179
|
c(!0), u(null);
|
|
2164
2180
|
try {
|
|
2165
|
-
const
|
|
2166
|
-
return
|
|
2167
|
-
} catch (
|
|
2168
|
-
throw u(
|
|
2181
|
+
const y = await t.fillAppropriatenessTest(f);
|
|
2182
|
+
return k(y), y;
|
|
2183
|
+
} catch (y) {
|
|
2184
|
+
throw u(y), y;
|
|
2169
2185
|
} finally {
|
|
2170
2186
|
c(!1);
|
|
2171
2187
|
}
|
|
@@ -2174,42 +2190,42 @@ function Br(e) {
|
|
|
2174
2190
|
);
|
|
2175
2191
|
return {
|
|
2176
2192
|
test: r,
|
|
2177
|
-
result:
|
|
2193
|
+
result: w,
|
|
2178
2194
|
isLoading: s,
|
|
2179
2195
|
isSubmitting: l,
|
|
2180
2196
|
error: d,
|
|
2181
|
-
load:
|
|
2197
|
+
load: p,
|
|
2182
2198
|
submit: N
|
|
2183
2199
|
};
|
|
2184
2200
|
}
|
|
2185
2201
|
function jt(e) {
|
|
2186
|
-
const { overviewService: t } =
|
|
2202
|
+
const { overviewService: t } = ie(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), w = Q(!1), k = Q(null), g = K(async () => {
|
|
2187
2203
|
if (e) {
|
|
2188
|
-
if (
|
|
2204
|
+
if (w.current) {
|
|
2189
2205
|
console.log("[Overview] Load already in progress, skipping...");
|
|
2190
2206
|
return;
|
|
2191
2207
|
}
|
|
2192
|
-
|
|
2208
|
+
w.current = !0, i(!0), u(null);
|
|
2193
2209
|
try {
|
|
2194
|
-
const
|
|
2195
|
-
n(
|
|
2196
|
-
} catch (
|
|
2197
|
-
u(
|
|
2210
|
+
const p = await t.getOverviewData(e);
|
|
2211
|
+
n(p), k.current = e;
|
|
2212
|
+
} catch (p) {
|
|
2213
|
+
u(p);
|
|
2198
2214
|
} finally {
|
|
2199
|
-
i(!1),
|
|
2215
|
+
i(!1), w.current = !1;
|
|
2200
2216
|
}
|
|
2201
2217
|
}
|
|
2202
2218
|
}, [e, t]);
|
|
2203
|
-
|
|
2204
|
-
e &&
|
|
2219
|
+
G(() => {
|
|
2220
|
+
e && k.current !== e && g();
|
|
2205
2221
|
}, [e]);
|
|
2206
|
-
const
|
|
2222
|
+
const m = K(async () => {
|
|
2207
2223
|
if (e) {
|
|
2208
2224
|
c(!0), u(null);
|
|
2209
2225
|
try {
|
|
2210
2226
|
await t.passOverview(e);
|
|
2211
|
-
} catch (
|
|
2212
|
-
throw u(
|
|
2227
|
+
} catch (p) {
|
|
2228
|
+
throw u(p), p;
|
|
2213
2229
|
} finally {
|
|
2214
2230
|
c(!1);
|
|
2215
2231
|
}
|
|
@@ -2220,15 +2236,15 @@ function jt(e) {
|
|
|
2220
2236
|
isLoading: s,
|
|
2221
2237
|
isSubmitting: l,
|
|
2222
2238
|
error: d,
|
|
2223
|
-
load:
|
|
2224
|
-
passOverview:
|
|
2239
|
+
load: g,
|
|
2240
|
+
passOverview: m
|
|
2225
2241
|
};
|
|
2226
2242
|
}
|
|
2227
|
-
function
|
|
2228
|
-
const { identityService: t } =
|
|
2243
|
+
function Ht(e) {
|
|
2244
|
+
const { identityService: t } = ie(), [r, n] = v(
|
|
2229
2245
|
null
|
|
2230
|
-
), [s, i] = v(!1), [l, c] = v(null), d =
|
|
2231
|
-
async (
|
|
2246
|
+
), [s, i] = v(!1), [l, c] = v(null), d = Q(!1), u = K(
|
|
2247
|
+
async (g, m) => {
|
|
2232
2248
|
if (e) {
|
|
2233
2249
|
if (d.current) {
|
|
2234
2250
|
console.log("[Identity] Request already in progress, skipping...");
|
|
@@ -2236,45 +2252,45 @@ function qt(e) {
|
|
|
2236
2252
|
}
|
|
2237
2253
|
d.current = !0, i(!0), c(null);
|
|
2238
2254
|
try {
|
|
2239
|
-
const
|
|
2255
|
+
const p = {
|
|
2240
2256
|
applicantId: e,
|
|
2241
2257
|
restart: !1,
|
|
2242
|
-
redirectUrl:
|
|
2243
|
-
ttl:
|
|
2258
|
+
redirectUrl: g || "",
|
|
2259
|
+
ttl: m || 604800
|
|
2244
2260
|
// Default: 7 days
|
|
2245
2261
|
};
|
|
2246
|
-
console.log("Identity request input:",
|
|
2247
|
-
const N = await t.identityRequest(
|
|
2262
|
+
console.log("Identity request input:", p);
|
|
2263
|
+
const N = await t.identityRequest(p);
|
|
2248
2264
|
return console.log("Identity request result:", N), n(N), N;
|
|
2249
|
-
} catch (
|
|
2250
|
-
throw c(
|
|
2265
|
+
} catch (p) {
|
|
2266
|
+
throw c(p), p;
|
|
2251
2267
|
} finally {
|
|
2252
2268
|
i(!1), d.current = !1;
|
|
2253
2269
|
}
|
|
2254
2270
|
}
|
|
2255
2271
|
},
|
|
2256
2272
|
[e, t]
|
|
2257
|
-
),
|
|
2258
|
-
async (
|
|
2273
|
+
), w = K(
|
|
2274
|
+
async (g, m) => {
|
|
2259
2275
|
if (e) {
|
|
2260
2276
|
i(!0), c(null);
|
|
2261
2277
|
try {
|
|
2262
|
-
const
|
|
2278
|
+
const p = {
|
|
2263
2279
|
applicantId: e,
|
|
2264
2280
|
restart: !1,
|
|
2265
|
-
redirectUrl:
|
|
2266
|
-
ttl:
|
|
2267
|
-
}, N = await t.identityCompanyRequest(
|
|
2281
|
+
redirectUrl: g,
|
|
2282
|
+
ttl: m
|
|
2283
|
+
}, N = await t.identityCompanyRequest(p);
|
|
2268
2284
|
return n(N), N;
|
|
2269
|
-
} catch (
|
|
2270
|
-
throw c(
|
|
2285
|
+
} catch (p) {
|
|
2286
|
+
throw c(p), p;
|
|
2271
2287
|
} finally {
|
|
2272
2288
|
i(!1);
|
|
2273
2289
|
}
|
|
2274
2290
|
}
|
|
2275
2291
|
},
|
|
2276
2292
|
[e, t]
|
|
2277
|
-
),
|
|
2293
|
+
), k = K(async () => {
|
|
2278
2294
|
if (e) {
|
|
2279
2295
|
if (d.current) {
|
|
2280
2296
|
console.log("[Identity] Restart already in progress, skipping...");
|
|
@@ -2282,18 +2298,18 @@ function qt(e) {
|
|
|
2282
2298
|
}
|
|
2283
2299
|
d.current = !0, i(!0), c(null);
|
|
2284
2300
|
try {
|
|
2285
|
-
const
|
|
2301
|
+
const g = {
|
|
2286
2302
|
applicantId: e,
|
|
2287
2303
|
restart: !0,
|
|
2288
2304
|
redirectUrl: "",
|
|
2289
2305
|
ttl: 604800
|
|
2290
2306
|
// 7 days
|
|
2291
2307
|
};
|
|
2292
|
-
console.log("Restarting identity with input:",
|
|
2293
|
-
const
|
|
2294
|
-
return console.log("Restart identity result:",
|
|
2295
|
-
} catch (
|
|
2296
|
-
throw c(
|
|
2308
|
+
console.log("Restarting identity with input:", g);
|
|
2309
|
+
const m = await t.identityRequest(g);
|
|
2310
|
+
return console.log("Restart identity result:", m), n(m), m;
|
|
2311
|
+
} catch (g) {
|
|
2312
|
+
throw c(g), g;
|
|
2297
2313
|
} finally {
|
|
2298
2314
|
i(!1), d.current = !1;
|
|
2299
2315
|
}
|
|
@@ -2306,74 +2322,85 @@ function qt(e) {
|
|
|
2306
2322
|
isLoading: s,
|
|
2307
2323
|
error: l,
|
|
2308
2324
|
requestIdentity: u,
|
|
2309
|
-
requestCompanyIdentity:
|
|
2310
|
-
restartIdentity:
|
|
2325
|
+
requestCompanyIdentity: w,
|
|
2326
|
+
restartIdentity: k
|
|
2311
2327
|
};
|
|
2312
2328
|
}
|
|
2313
2329
|
function Yt(e) {
|
|
2314
|
-
const { riskScoringService: t } =
|
|
2330
|
+
const { riskScoringService: t, applicantService: r } = ie(), [n, s] = v(null), [i, l] = v({}), [c, d] = v(!1), [u, w] = v(!1), [k, g] = v(null), [m, p] = v(null), N = Q(!1), f = Q(null), y = K(async () => {
|
|
2331
|
+
var S;
|
|
2315
2332
|
if (e) {
|
|
2316
|
-
if (
|
|
2333
|
+
if (N.current) {
|
|
2317
2334
|
console.log("[RiskScoring] Load already in progress, skipping...");
|
|
2318
2335
|
return;
|
|
2319
2336
|
}
|
|
2320
|
-
|
|
2337
|
+
N.current = !0, d(!0), g(null);
|
|
2321
2338
|
try {
|
|
2322
|
-
const
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2339
|
+
const [C, O] = await Promise.all([
|
|
2340
|
+
t.getRiskCriterias(e),
|
|
2341
|
+
r.getApplicantData(e).catch(() => null)
|
|
2342
|
+
]);
|
|
2343
|
+
if (s(C), (S = O == null ? void 0 : O.riskScoringResults) != null && S.length) {
|
|
2344
|
+
const W = O.riskScoringResults[0], F = {};
|
|
2345
|
+
for (const h of W.riskCriteriaResults ?? [])
|
|
2346
|
+
h.riskCriteriaId != null && h.answer != null && h.answer !== "" && (F[h.riskCriteriaId] = [h.answer]);
|
|
2347
|
+
l(F);
|
|
2348
|
+
}
|
|
2349
|
+
f.current = e;
|
|
2350
|
+
} catch (C) {
|
|
2351
|
+
g(C);
|
|
2326
2352
|
} finally {
|
|
2327
|
-
|
|
2353
|
+
d(!1), N.current = !1;
|
|
2328
2354
|
}
|
|
2329
2355
|
}
|
|
2330
|
-
}, [e, t]);
|
|
2331
|
-
|
|
2332
|
-
e &&
|
|
2356
|
+
}, [e, t, r]);
|
|
2357
|
+
G(() => {
|
|
2358
|
+
e && f.current !== e && y();
|
|
2333
2359
|
}, [e]);
|
|
2334
|
-
const
|
|
2335
|
-
async (
|
|
2336
|
-
|
|
2360
|
+
const E = K(
|
|
2361
|
+
async (S) => {
|
|
2362
|
+
w(!0), g(null);
|
|
2337
2363
|
try {
|
|
2338
|
-
const
|
|
2339
|
-
return
|
|
2340
|
-
} catch (
|
|
2341
|
-
throw
|
|
2364
|
+
const C = await t.submitRiskScoring(S);
|
|
2365
|
+
return p(C), C;
|
|
2366
|
+
} catch (C) {
|
|
2367
|
+
throw g(C), C;
|
|
2342
2368
|
} finally {
|
|
2343
|
-
|
|
2369
|
+
w(!1);
|
|
2344
2370
|
}
|
|
2345
2371
|
},
|
|
2346
2372
|
[t]
|
|
2347
2373
|
);
|
|
2348
2374
|
return {
|
|
2349
|
-
criteria:
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2375
|
+
criteria: n,
|
|
2376
|
+
initialAnswers: i,
|
|
2377
|
+
result: m,
|
|
2378
|
+
isLoading: c,
|
|
2379
|
+
isSubmitting: u,
|
|
2380
|
+
error: k,
|
|
2381
|
+
load: y,
|
|
2382
|
+
submit: E
|
|
2356
2383
|
};
|
|
2357
2384
|
}
|
|
2358
2385
|
function Wt() {
|
|
2359
|
-
const { applicantService: e, config: t } =
|
|
2360
|
-
const
|
|
2361
|
-
return (
|
|
2386
|
+
const { applicantService: e, config: t } = ie(), [r, n] = v(!1), [s, i] = v(null), l = Q(!1), c = Q(!1), d = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(m) {
|
|
2387
|
+
const p = Math.random() * 16 | 0;
|
|
2388
|
+
return (m === "x" ? p : p & 3 | 8).toString(16);
|
|
2362
2389
|
}), u = K(
|
|
2363
|
-
async (
|
|
2364
|
-
var
|
|
2390
|
+
async (m) => {
|
|
2391
|
+
var p;
|
|
2365
2392
|
if (l.current)
|
|
2366
2393
|
throw console.log("[Applicant] Create already in progress, skipping..."), new Error("Creation already in progress");
|
|
2367
2394
|
l.current = !0, n(!0), i(null);
|
|
2368
2395
|
try {
|
|
2369
|
-
if (
|
|
2370
|
-
const
|
|
2371
|
-
console.log("[SardinAI] Generated session key:",
|
|
2396
|
+
if (m.applicantAdditionalDatas || (m.applicantAdditionalDatas = []), (p = t.identityProviders) != null && p.sardinai) {
|
|
2397
|
+
const f = d();
|
|
2398
|
+
console.log("[SardinAI] Generated session key:", f), m.applicantAdditionalDatas.push({
|
|
2372
2399
|
paramName: "sessionKey",
|
|
2373
|
-
value:
|
|
2400
|
+
value: f
|
|
2374
2401
|
});
|
|
2375
2402
|
}
|
|
2376
|
-
return await e.createApplicant(
|
|
2403
|
+
return await e.createApplicant(m);
|
|
2377
2404
|
} catch (N) {
|
|
2378
2405
|
throw i(N), N;
|
|
2379
2406
|
} finally {
|
|
@@ -2381,39 +2408,39 @@ function Wt() {
|
|
|
2381
2408
|
}
|
|
2382
2409
|
},
|
|
2383
2410
|
[e, t]
|
|
2384
|
-
),
|
|
2385
|
-
async (
|
|
2411
|
+
), w = K(
|
|
2412
|
+
async (m) => {
|
|
2386
2413
|
n(!0), i(null);
|
|
2387
2414
|
try {
|
|
2388
|
-
return await e.createCompanyApplicant(
|
|
2389
|
-
} catch (
|
|
2390
|
-
throw i(
|
|
2415
|
+
return await e.createCompanyApplicant(m);
|
|
2416
|
+
} catch (p) {
|
|
2417
|
+
throw i(p), p;
|
|
2391
2418
|
} finally {
|
|
2392
2419
|
n(!1);
|
|
2393
2420
|
}
|
|
2394
2421
|
},
|
|
2395
2422
|
[e]
|
|
2396
|
-
),
|
|
2397
|
-
async (
|
|
2423
|
+
), k = K(
|
|
2424
|
+
async (m) => {
|
|
2398
2425
|
if (c.current)
|
|
2399
2426
|
throw console.log("[Applicant] Data load already in progress, skipping..."), new Error("Data load already in progress");
|
|
2400
2427
|
c.current = !0, n(!0), i(null);
|
|
2401
2428
|
try {
|
|
2402
|
-
return await e.getApplicantData(
|
|
2403
|
-
} catch (
|
|
2404
|
-
throw i(
|
|
2429
|
+
return await e.getApplicantData(m);
|
|
2430
|
+
} catch (p) {
|
|
2431
|
+
throw i(p), p;
|
|
2405
2432
|
} finally {
|
|
2406
2433
|
n(!1), c.current = !1;
|
|
2407
2434
|
}
|
|
2408
2435
|
},
|
|
2409
2436
|
[e]
|
|
2410
|
-
),
|
|
2411
|
-
async (
|
|
2437
|
+
), g = K(
|
|
2438
|
+
async (m) => {
|
|
2412
2439
|
n(!0), i(null);
|
|
2413
2440
|
try {
|
|
2414
|
-
await e.stopProgress(
|
|
2415
|
-
} catch (
|
|
2416
|
-
throw i(
|
|
2441
|
+
await e.stopProgress(m);
|
|
2442
|
+
} catch (p) {
|
|
2443
|
+
throw i(p), p;
|
|
2417
2444
|
} finally {
|
|
2418
2445
|
n(!1);
|
|
2419
2446
|
}
|
|
@@ -2424,9 +2451,9 @@ function Wt() {
|
|
|
2424
2451
|
isLoading: r,
|
|
2425
2452
|
error: s,
|
|
2426
2453
|
createApplicant: u,
|
|
2427
|
-
createCompanyApplicant:
|
|
2428
|
-
getApplicantData:
|
|
2429
|
-
stopProgress:
|
|
2454
|
+
createCompanyApplicant: w,
|
|
2455
|
+
getApplicantData: k,
|
|
2456
|
+
stopProgress: g
|
|
2430
2457
|
};
|
|
2431
2458
|
}
|
|
2432
2459
|
const U = ({
|
|
@@ -2490,7 +2517,7 @@ const U = ({
|
|
|
2490
2517
|
]
|
|
2491
2518
|
}
|
|
2492
2519
|
);
|
|
2493
|
-
},
|
|
2520
|
+
}, ne = Ne(
|
|
2494
2521
|
({ label: e, error: t, helperText: r, leftIcon: n, rightIcon: s, className: i, ...l }, c) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2495
2522
|
e && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2496
2523
|
e,
|
|
@@ -2521,7 +2548,7 @@ const U = ({
|
|
|
2521
2548
|
!t && r && /* @__PURE__ */ a("p", { className: "mt-1 text-sm text-gray-500", children: r })
|
|
2522
2549
|
] })
|
|
2523
2550
|
);
|
|
2524
|
-
|
|
2551
|
+
ne.displayName = "Input";
|
|
2525
2552
|
const M = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
|
|
2526
2553
|
"div",
|
|
2527
2554
|
{
|
|
@@ -2536,7 +2563,7 @@ const M = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
|
|
|
2536
2563
|
...r,
|
|
2537
2564
|
children: e
|
|
2538
2565
|
}
|
|
2539
|
-
),
|
|
2566
|
+
), re = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
|
|
2540
2567
|
"div",
|
|
2541
2568
|
{
|
|
2542
2569
|
className: J("px-6 py-4 border-b", t),
|
|
@@ -2546,7 +2573,7 @@ const M = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
|
|
|
2546
2573
|
...r,
|
|
2547
2574
|
children: e
|
|
2548
2575
|
}
|
|
2549
|
-
), T = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a("div", { className: J("px-6 py-4", t), ...r, children: e }),
|
|
2576
|
+
), T = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a("div", { className: J("px-6 py-4", t), ...r, children: e }), se = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
|
|
2550
2577
|
"div",
|
|
2551
2578
|
{
|
|
2552
2579
|
className: J("px-6 py-4 border-t", t),
|
|
@@ -2656,24 +2683,24 @@ const Qt = ({
|
|
|
2656
2683
|
disabled: i = !1,
|
|
2657
2684
|
required: l = !1
|
|
2658
2685
|
}) => {
|
|
2659
|
-
const [c, d] = v(!1), [u,
|
|
2660
|
-
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2686
|
+
const [c, d] = v(!1), [u, w] = v(""), k = Q(null);
|
|
2687
|
+
G(() => {
|
|
2688
|
+
const f = (y) => {
|
|
2689
|
+
k.current && !k.current.contains(y.target) && (d(!1), w(""));
|
|
2663
2690
|
};
|
|
2664
|
-
return document.addEventListener("mousedown",
|
|
2691
|
+
return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
|
|
2665
2692
|
}, []);
|
|
2666
|
-
const
|
|
2667
|
-
(
|
|
2668
|
-
),
|
|
2669
|
-
i || (t.includes(
|
|
2670
|
-
},
|
|
2671
|
-
|
|
2672
|
-
}, N = (
|
|
2673
|
-
var
|
|
2674
|
-
return ((
|
|
2693
|
+
const g = n.filter(
|
|
2694
|
+
(f) => f.label.toLowerCase().includes(u.toLowerCase())
|
|
2695
|
+
), m = (f) => {
|
|
2696
|
+
i || (t.includes(f) ? r(t.filter((y) => y !== f)) : r([...t, f]));
|
|
2697
|
+
}, p = (f, y) => {
|
|
2698
|
+
y.stopPropagation(), i || r(t.filter((E) => E !== f));
|
|
2699
|
+
}, N = (f) => {
|
|
2700
|
+
var y;
|
|
2701
|
+
return ((y = n.find((E) => E.value === f)) == null ? void 0 : y.label) || f;
|
|
2675
2702
|
};
|
|
2676
|
-
return /* @__PURE__ */ o("div", { className: "w-full metakyc-multiselect", ref:
|
|
2703
|
+
return /* @__PURE__ */ o("div", { className: "w-full metakyc-multiselect", ref: k, children: [
|
|
2677
2704
|
e && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2678
2705
|
e,
|
|
2679
2706
|
l && /* @__PURE__ */ a("span", { className: "text-red-500 ml-1", children: "*" })
|
|
@@ -2692,17 +2719,17 @@ const Qt = ({
|
|
|
2692
2719
|
i ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
2693
2720
|
),
|
|
2694
2721
|
children: [
|
|
2695
|
-
t.length === 0 ? /* @__PURE__ */ a("span", { className: "metakyc-multiselect-placeholder text-gray-400 dark:text-gray-500 leading-6", children: s }) : /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-1 pr-6", children: t.map((
|
|
2722
|
+
t.length === 0 ? /* @__PURE__ */ a("span", { className: "metakyc-multiselect-placeholder text-gray-400 dark:text-gray-500 leading-6", children: s }) : /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-1 pr-6", children: t.map((f) => /* @__PURE__ */ o(
|
|
2696
2723
|
"span",
|
|
2697
2724
|
{
|
|
2698
2725
|
className: "metakyc-multiselect-chip inline-flex items-center gap-1 px-2 py-0.5 rounded bg-blue-100 dark:bg-blue-900/40 text-blue-800 dark:text-blue-300 text-xs font-medium",
|
|
2699
2726
|
children: [
|
|
2700
|
-
N(
|
|
2727
|
+
N(f),
|
|
2701
2728
|
!i && /* @__PURE__ */ a(
|
|
2702
2729
|
"button",
|
|
2703
2730
|
{
|
|
2704
2731
|
type: "button",
|
|
2705
|
-
onClick: (
|
|
2732
|
+
onClick: (y) => p(f, y),
|
|
2706
2733
|
className: "metakyc-multiselect-chip-remove",
|
|
2707
2734
|
style: {
|
|
2708
2735
|
background: "transparent",
|
|
@@ -2728,7 +2755,7 @@ const Qt = ({
|
|
|
2728
2755
|
)
|
|
2729
2756
|
]
|
|
2730
2757
|
},
|
|
2731
|
-
|
|
2758
|
+
f
|
|
2732
2759
|
)) }),
|
|
2733
2760
|
/* @__PURE__ */ a("span", { className: "metakyc-multiselect-arrow absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 pointer-events-none text-xs", children: c ? "▲" : "▼" })
|
|
2734
2761
|
]
|
|
@@ -2745,45 +2772,45 @@ const Qt = ({
|
|
|
2745
2772
|
{
|
|
2746
2773
|
type: "text",
|
|
2747
2774
|
value: u,
|
|
2748
|
-
onChange: (
|
|
2775
|
+
onChange: (f) => w(f.target.value),
|
|
2749
2776
|
placeholder: "Search...",
|
|
2750
2777
|
autoFocus: !0,
|
|
2751
|
-
onClick: (
|
|
2778
|
+
onClick: (f) => f.stopPropagation(),
|
|
2752
2779
|
className: "metakyc-multiselect-search w-full px-2 py-1.5 text-sm rounded focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
2753
2780
|
style: { border: "1px solid #d1d5db" }
|
|
2754
2781
|
}
|
|
2755
2782
|
) }),
|
|
2756
|
-
/* @__PURE__ */ a("ul", { className: "max-h-48 overflow-y-auto py-1", children:
|
|
2783
|
+
/* @__PURE__ */ a("ul", { className: "max-h-48 overflow-y-auto py-1", children: g.length === 0 ? /* @__PURE__ */ a("li", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No results" }) : g.map((f) => /* @__PURE__ */ o(
|
|
2757
2784
|
"li",
|
|
2758
2785
|
{
|
|
2759
|
-
onClick: () =>
|
|
2786
|
+
onClick: () => m(f.value),
|
|
2760
2787
|
className: J(
|
|
2761
2788
|
"metakyc-multiselect-option",
|
|
2762
2789
|
"flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",
|
|
2763
2790
|
"hover:bg-gray-50 dark:hover:bg-gray-700",
|
|
2764
|
-
t.includes(
|
|
2791
|
+
t.includes(f.value) && "metakyc-multiselect-option-selected bg-blue-50 dark:bg-blue-900/20"
|
|
2765
2792
|
),
|
|
2766
2793
|
children: [
|
|
2767
2794
|
/* @__PURE__ */ a(
|
|
2768
2795
|
"input",
|
|
2769
2796
|
{
|
|
2770
2797
|
type: "checkbox",
|
|
2771
|
-
checked: t.includes(
|
|
2798
|
+
checked: t.includes(f.value),
|
|
2772
2799
|
readOnly: !0,
|
|
2773
2800
|
className: "rounded border-gray-300 text-blue-600 pointer-events-none"
|
|
2774
2801
|
}
|
|
2775
2802
|
),
|
|
2776
|
-
/* @__PURE__ */ a("span", { className: "text-gray-900 dark:text-gray-100", children:
|
|
2803
|
+
/* @__PURE__ */ a("span", { className: "text-gray-900 dark:text-gray-100", children: f.label })
|
|
2777
2804
|
]
|
|
2778
2805
|
},
|
|
2779
|
-
|
|
2806
|
+
f.value
|
|
2780
2807
|
)) }),
|
|
2781
2808
|
t.length > 0 && /* @__PURE__ */ a("div", { className: "metakyc-multiselect-clear p-2 border-t border-gray-100 dark:border-gray-700", children: /* @__PURE__ */ o(
|
|
2782
2809
|
"button",
|
|
2783
2810
|
{
|
|
2784
2811
|
type: "button",
|
|
2785
2812
|
onClick: () => {
|
|
2786
|
-
r([]),
|
|
2813
|
+
r([]), w("");
|
|
2787
2814
|
},
|
|
2788
2815
|
className: "text-xs text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",
|
|
2789
2816
|
children: [
|
|
@@ -2808,26 +2835,26 @@ const Qt = ({
|
|
|
2808
2835
|
value: l = [],
|
|
2809
2836
|
className: c
|
|
2810
2837
|
}) => {
|
|
2811
|
-
const [d, u] = v(!1),
|
|
2812
|
-
if (!
|
|
2813
|
-
const E = Array.from(
|
|
2814
|
-
if (s && E.filter((
|
|
2815
|
-
const
|
|
2816
|
-
alert(`Some files exceed the maximum size of ${
|
|
2838
|
+
const [d, u] = v(!1), w = Q(null), k = (y) => {
|
|
2839
|
+
if (!y) return;
|
|
2840
|
+
const E = Array.from(y);
|
|
2841
|
+
if (s && E.filter((C) => C.size > s).length > 0) {
|
|
2842
|
+
const C = Re(s);
|
|
2843
|
+
alert(`Some files exceed the maximum size of ${C}`);
|
|
2817
2844
|
return;
|
|
2818
2845
|
}
|
|
2819
2846
|
i == null || i(n ? [...l, ...E] : [E[0]]);
|
|
2820
|
-
},
|
|
2821
|
-
|
|
2822
|
-
},
|
|
2847
|
+
}, g = (y) => {
|
|
2848
|
+
y.preventDefault(), u(!0);
|
|
2849
|
+
}, m = () => {
|
|
2823
2850
|
u(!1);
|
|
2824
|
-
},
|
|
2825
|
-
|
|
2851
|
+
}, p = (y) => {
|
|
2852
|
+
y.preventDefault(), u(!1), k(y.dataTransfer.files);
|
|
2826
2853
|
}, N = () => {
|
|
2827
|
-
var
|
|
2828
|
-
(
|
|
2829
|
-
},
|
|
2830
|
-
const E = l.filter((S,
|
|
2854
|
+
var y;
|
|
2855
|
+
(y = w.current) == null || y.click();
|
|
2856
|
+
}, f = (y) => {
|
|
2857
|
+
const E = l.filter((S, C) => C !== y);
|
|
2831
2858
|
i == null || i(E);
|
|
2832
2859
|
};
|
|
2833
2860
|
return /* @__PURE__ */ o("div", { className: J("w-full", c), children: [
|
|
@@ -2840,20 +2867,20 @@ const Qt = ({
|
|
|
2840
2867
|
d ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-300 dark:border-gray-600 hover:border-primary-500",
|
|
2841
2868
|
t && "border-danger-500"
|
|
2842
2869
|
),
|
|
2843
|
-
onDragOver:
|
|
2844
|
-
onDragLeave:
|
|
2845
|
-
onDrop:
|
|
2870
|
+
onDragOver: g,
|
|
2871
|
+
onDragLeave: m,
|
|
2872
|
+
onDrop: p,
|
|
2846
2873
|
onClick: N,
|
|
2847
2874
|
children: [
|
|
2848
2875
|
/* @__PURE__ */ a(
|
|
2849
2876
|
"input",
|
|
2850
2877
|
{
|
|
2851
|
-
ref:
|
|
2878
|
+
ref: w,
|
|
2852
2879
|
type: "file",
|
|
2853
2880
|
className: "hidden",
|
|
2854
2881
|
accept: r,
|
|
2855
2882
|
multiple: n,
|
|
2856
|
-
onChange: (
|
|
2883
|
+
onChange: (y) => k(y.target.files)
|
|
2857
2884
|
}
|
|
2858
2885
|
),
|
|
2859
2886
|
/* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
@@ -2887,7 +2914,7 @@ const Qt = ({
|
|
|
2887
2914
|
]
|
|
2888
2915
|
}
|
|
2889
2916
|
),
|
|
2890
|
-
l.length > 0 && /* @__PURE__ */ a("div", { className: "mt-3 space-y-2", children: l.map((
|
|
2917
|
+
l.length > 0 && /* @__PURE__ */ a("div", { className: "mt-3 space-y-2", children: l.map((y, E) => /* @__PURE__ */ o(
|
|
2891
2918
|
"div",
|
|
2892
2919
|
{
|
|
2893
2920
|
className: "flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",
|
|
@@ -2909,10 +2936,10 @@ const Qt = ({
|
|
|
2909
2936
|
)
|
|
2910
2937
|
}
|
|
2911
2938
|
),
|
|
2912
|
-
/* @__PURE__ */ a("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children:
|
|
2939
|
+
/* @__PURE__ */ a("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children: y.name }),
|
|
2913
2940
|
/* @__PURE__ */ o("span", { className: "text-xs text-gray-500", children: [
|
|
2914
2941
|
"(",
|
|
2915
|
-
Re(
|
|
2942
|
+
Re(y.size),
|
|
2916
2943
|
")"
|
|
2917
2944
|
] })
|
|
2918
2945
|
] }),
|
|
@@ -2921,7 +2948,7 @@ const Qt = ({
|
|
|
2921
2948
|
{
|
|
2922
2949
|
type: "button",
|
|
2923
2950
|
onClick: (S) => {
|
|
2924
|
-
S.stopPropagation(),
|
|
2951
|
+
S.stopPropagation(), f(E);
|
|
2925
2952
|
},
|
|
2926
2953
|
className: "ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",
|
|
2927
2954
|
children: /* @__PURE__ */ a("svg", { className: "h-5 w-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ a(
|
|
@@ -2962,7 +2989,7 @@ const Qt = ({
|
|
|
2962
2989
|
}
|
|
2963
2990
|
),
|
|
2964
2991
|
/* @__PURE__ */ a(
|
|
2965
|
-
|
|
2992
|
+
ne,
|
|
2966
2993
|
{
|
|
2967
2994
|
ref: s,
|
|
2968
2995
|
type: "tel",
|
|
@@ -3069,7 +3096,7 @@ const tr = Ne(
|
|
|
3069
3096
|
...c
|
|
3070
3097
|
},
|
|
3071
3098
|
[
|
|
3072
|
-
...l.map(([u,
|
|
3099
|
+
...l.map(([u, w]) => De(u, w)),
|
|
3073
3100
|
...Array.isArray(i) ? i : [i]
|
|
3074
3101
|
]
|
|
3075
3102
|
)
|
|
@@ -3143,7 +3170,7 @@ function sr(e) {
|
|
|
3143
3170
|
(n, s) => (n.questions ?? []).map((i, l) => ({ question: i, groupIndex: s, qIdx: l }))
|
|
3144
3171
|
), r = /* @__PURE__ */ new Map();
|
|
3145
3172
|
for (const n of t) {
|
|
3146
|
-
const s = n.question.pageNumber
|
|
3173
|
+
const s = n.question.pageNumber != null && n.question.pageNumber > 0 ? n.question.pageNumber : 1;
|
|
3147
3174
|
r.has(s) || r.set(s, []), r.get(s).push(n);
|
|
3148
3175
|
}
|
|
3149
3176
|
return Array.from(r.entries()).sort(([n], [s]) => n - s).map(([, n]) => n);
|
|
@@ -3153,108 +3180,112 @@ const ir = ({
|
|
|
3153
3180
|
onComplete: t,
|
|
3154
3181
|
onBack: r
|
|
3155
3182
|
}) => {
|
|
3156
|
-
const { questionnaire: n,
|
|
3183
|
+
const { questionnaire: n, initialAnswers: s, isLoading: i, isSubmitting: l, error: c, submit: d } = Kt(e), [u, w] = v({}), [k, g] = v({}), [m, p] = v(0);
|
|
3184
|
+
te.useEffect(() => {
|
|
3185
|
+
s && Object.keys(s).length > 0 && Object.keys(u).length === 0 && w(s);
|
|
3186
|
+
}, [s]);
|
|
3187
|
+
const N = Ae(
|
|
3157
3188
|
() => n ? sr(n.questionGroups) : [],
|
|
3158
3189
|
[n]
|
|
3159
|
-
),
|
|
3160
|
-
|
|
3161
|
-
const
|
|
3162
|
-
return delete
|
|
3190
|
+
), f = m === N.length - 1, y = N[m] ?? [], E = K((F, h) => {
|
|
3191
|
+
w((A) => ({ ...A, [F]: h })), g((A) => {
|
|
3192
|
+
const I = { ...A };
|
|
3193
|
+
return delete I[F], I;
|
|
3163
3194
|
});
|
|
3164
|
-
}, []),
|
|
3165
|
-
const
|
|
3166
|
-
for (const { question:
|
|
3167
|
-
const
|
|
3168
|
-
|
|
3195
|
+
}, []), S = K(() => {
|
|
3196
|
+
const F = {};
|
|
3197
|
+
for (const { question: h } of y) {
|
|
3198
|
+
const A = nr(h, u[h.id] ?? []);
|
|
3199
|
+
A && (F[h.id] = A);
|
|
3169
3200
|
}
|
|
3170
|
-
return
|
|
3171
|
-
}, [
|
|
3172
|
-
|
|
3173
|
-
},
|
|
3174
|
-
|
|
3175
|
-
},
|
|
3176
|
-
if (!(!
|
|
3201
|
+
return g((h) => ({ ...h, ...F })), Object.keys(F).length === 0;
|
|
3202
|
+
}, [y, u]), C = () => {
|
|
3203
|
+
S() && p((F) => F + 1);
|
|
3204
|
+
}, O = () => {
|
|
3205
|
+
m > 0 ? p((F) => F - 1) : r == null || r();
|
|
3206
|
+
}, W = async () => {
|
|
3207
|
+
if (!(!S() || !n))
|
|
3177
3208
|
try {
|
|
3178
|
-
const
|
|
3179
|
-
(
|
|
3180
|
-
questionId:
|
|
3181
|
-
values:
|
|
3209
|
+
const F = n.questionGroups.flatMap(
|
|
3210
|
+
(A) => (A.questions ?? []).map((I) => ({
|
|
3211
|
+
questionId: I.id,
|
|
3212
|
+
values: u[I.id] ?? []
|
|
3182
3213
|
}))
|
|
3183
|
-
),
|
|
3214
|
+
), h = {
|
|
3184
3215
|
applicantId: e,
|
|
3185
3216
|
questionnarieId: n.id,
|
|
3186
|
-
questionResults:
|
|
3217
|
+
questionResults: F
|
|
3187
3218
|
};
|
|
3188
|
-
await
|
|
3189
|
-
} catch (
|
|
3190
|
-
console.error("Questionnaire submit error:",
|
|
3219
|
+
await d(h), t == null || t();
|
|
3220
|
+
} catch (F) {
|
|
3221
|
+
console.error("Questionnaire submit error:", F);
|
|
3191
3222
|
}
|
|
3192
3223
|
};
|
|
3193
|
-
return
|
|
3224
|
+
return i ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ a(ce, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3194
3225
|
"Error loading questionnaire: ",
|
|
3195
|
-
|
|
3226
|
+
c.message
|
|
3196
3227
|
] }) }) }) : n ? /* @__PURE__ */ o(M, { children: [
|
|
3197
|
-
/* @__PURE__ */ o(
|
|
3228
|
+
/* @__PURE__ */ o(re, { children: [
|
|
3198
3229
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: n.displayName }),
|
|
3199
3230
|
n.subtitle && /* @__PURE__ */ a("p", { className: "text-sm", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: n.subtitle }),
|
|
3200
|
-
|
|
3231
|
+
N.length > 1 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between mt-3", children: [
|
|
3201
3232
|
/* @__PURE__ */ o("span", { className: "text-xs", style: { color: "var(--metakyc-text-muted, #9ca3af)" }, children: [
|
|
3202
3233
|
"Page ",
|
|
3203
|
-
|
|
3234
|
+
m + 1,
|
|
3204
3235
|
" of ",
|
|
3205
|
-
|
|
3236
|
+
N.length
|
|
3206
3237
|
] }),
|
|
3207
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children:
|
|
3238
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: N.map((F, h) => /* @__PURE__ */ a(
|
|
3208
3239
|
"div",
|
|
3209
3240
|
{
|
|
3210
3241
|
className: "rounded-full transition-all duration-200",
|
|
3211
3242
|
style: {
|
|
3212
3243
|
height: "6px",
|
|
3213
|
-
width:
|
|
3214
|
-
backgroundColor:
|
|
3244
|
+
width: h === m ? "20px" : "6px",
|
|
3245
|
+
backgroundColor: h <= m ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
|
|
3215
3246
|
}
|
|
3216
3247
|
},
|
|
3217
|
-
|
|
3248
|
+
h
|
|
3218
3249
|
)) })
|
|
3219
3250
|
] })
|
|
3220
3251
|
] }),
|
|
3221
|
-
/* @__PURE__ */ a(T, { className: "space-y-6", children:
|
|
3252
|
+
/* @__PURE__ */ a(T, { className: "space-y-6", children: y.map(({ question: F }) => /* @__PURE__ */ a(
|
|
3222
3253
|
or,
|
|
3223
3254
|
{
|
|
3224
|
-
question:
|
|
3225
|
-
value:
|
|
3226
|
-
error: k[
|
|
3227
|
-
onChange: (
|
|
3255
|
+
question: F,
|
|
3256
|
+
value: u[F.id] ?? [],
|
|
3257
|
+
error: k[F.id],
|
|
3258
|
+
onChange: (h) => E(F.id, h)
|
|
3228
3259
|
},
|
|
3229
|
-
|
|
3260
|
+
F.id
|
|
3230
3261
|
)) }),
|
|
3231
|
-
/* @__PURE__ */ o(
|
|
3262
|
+
/* @__PURE__ */ o(se, { className: "flex items-center justify-between", children: [
|
|
3232
3263
|
/* @__PURE__ */ o(
|
|
3233
3264
|
U,
|
|
3234
3265
|
{
|
|
3235
3266
|
type: "button",
|
|
3236
3267
|
variant: "outline",
|
|
3237
|
-
onClick:
|
|
3268
|
+
onClick: O,
|
|
3238
3269
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
3239
3270
|
children: [
|
|
3240
3271
|
/* @__PURE__ */ a(_e, { size: 14 }),
|
|
3241
|
-
|
|
3272
|
+
m > 0 ? "Previous" : "Back"
|
|
3242
3273
|
]
|
|
3243
3274
|
}
|
|
3244
3275
|
),
|
|
3245
|
-
|
|
3276
|
+
f ? /* @__PURE__ */ a(
|
|
3246
3277
|
U,
|
|
3247
3278
|
{
|
|
3248
3279
|
type: "button",
|
|
3249
|
-
isLoading:
|
|
3250
|
-
onClick:
|
|
3280
|
+
isLoading: l,
|
|
3281
|
+
onClick: W,
|
|
3251
3282
|
children: "Continue"
|
|
3252
3283
|
}
|
|
3253
3284
|
) : /* @__PURE__ */ o(
|
|
3254
3285
|
U,
|
|
3255
3286
|
{
|
|
3256
3287
|
type: "button",
|
|
3257
|
-
onClick:
|
|
3288
|
+
onClick: C,
|
|
3258
3289
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
3259
3290
|
children: [
|
|
3260
3291
|
"Next",
|
|
@@ -3263,7 +3294,7 @@ const ir = ({
|
|
|
3263
3294
|
}
|
|
3264
3295
|
)
|
|
3265
3296
|
] }),
|
|
3266
|
-
|
|
3297
|
+
c && /* @__PURE__ */ a("div", { className: "mx-6 mb-4 p-3 bg-red-50 border border-red-200 rounded", children: /* @__PURE__ */ a("p", { className: "text-red-600 text-sm", children: c.message }) })
|
|
3267
3298
|
] }) : null;
|
|
3268
3299
|
}, or = ({ question: e, value: t, error: r, onChange: n }) => {
|
|
3269
3300
|
var l;
|
|
@@ -3276,7 +3307,7 @@ const ir = ({
|
|
|
3276
3307
|
e.subtitle && /* @__PURE__ */ a("p", { className: "text-xs", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: e.subtitle }),
|
|
3277
3308
|
e.description && /* @__PURE__ */ a("p", { className: "text-xs", style: { color: "var(--metakyc-text-muted, #9ca3af)" }, children: e.description }),
|
|
3278
3309
|
i === "text" && /* @__PURE__ */ a(
|
|
3279
|
-
|
|
3310
|
+
ne,
|
|
3280
3311
|
{
|
|
3281
3312
|
value: t[0] ?? "",
|
|
3282
3313
|
onChange: (c) => n([c.target.value]),
|
|
@@ -3296,11 +3327,12 @@ const ir = ({
|
|
|
3296
3327
|
required: e.isRequired
|
|
3297
3328
|
}
|
|
3298
3329
|
),
|
|
3299
|
-
i === "radio" && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3330
|
+
i === "radio" && /* @__PURE__ */ o("div", { className: "metakyc-options-group", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3300
3331
|
(e.defaultAnswers ?? []).map((c) => /* @__PURE__ */ o(
|
|
3301
3332
|
"label",
|
|
3302
3333
|
{
|
|
3303
|
-
|
|
3334
|
+
className: "metakyc-option-label",
|
|
3335
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0, padding: 0 },
|
|
3304
3336
|
children: [
|
|
3305
3337
|
/* @__PURE__ */ a(
|
|
3306
3338
|
"input",
|
|
@@ -3308,28 +3340,35 @@ const ir = ({
|
|
|
3308
3340
|
type: "radio",
|
|
3309
3341
|
checked: t[0] === c,
|
|
3310
3342
|
onChange: () => n([c]),
|
|
3343
|
+
className: "metakyc-option-input",
|
|
3311
3344
|
style: {
|
|
3312
3345
|
width: "16px",
|
|
3313
3346
|
height: "16px",
|
|
3347
|
+
minWidth: "16px",
|
|
3314
3348
|
flexShrink: 0,
|
|
3349
|
+
flexGrow: 0,
|
|
3315
3350
|
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3316
3351
|
cursor: "pointer",
|
|
3317
|
-
margin: 0
|
|
3352
|
+
margin: 0,
|
|
3353
|
+
padding: 0,
|
|
3354
|
+
display: "inline-block",
|
|
3355
|
+
verticalAlign: "middle"
|
|
3318
3356
|
}
|
|
3319
3357
|
}
|
|
3320
3358
|
),
|
|
3321
|
-
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: c })
|
|
3359
|
+
/* @__PURE__ */ a("span", { className: "metakyc-option-text", style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4", marginLeft: 0 }, children: c })
|
|
3322
3360
|
]
|
|
3323
3361
|
},
|
|
3324
3362
|
c
|
|
3325
3363
|
)),
|
|
3326
3364
|
r && /* @__PURE__ */ a("p", { className: "text-sm text-danger-500", children: r })
|
|
3327
3365
|
] }),
|
|
3328
|
-
(i === "checkbox" || i === "multi-select") && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3366
|
+
(i === "checkbox" || i === "multi-select") && /* @__PURE__ */ o("div", { className: "metakyc-options-group", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3329
3367
|
(e.defaultAnswers ?? []).map((c) => /* @__PURE__ */ o(
|
|
3330
3368
|
"label",
|
|
3331
3369
|
{
|
|
3332
|
-
|
|
3370
|
+
className: "metakyc-option-label",
|
|
3371
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0, padding: 0 },
|
|
3333
3372
|
children: [
|
|
3334
3373
|
/* @__PURE__ */ a(
|
|
3335
3374
|
"input",
|
|
@@ -3339,18 +3378,23 @@ const ir = ({
|
|
|
3339
3378
|
onChange: (d) => {
|
|
3340
3379
|
d.target.checked ? n([...t, c]) : n(t.filter((u) => u !== c));
|
|
3341
3380
|
},
|
|
3381
|
+
className: "metakyc-option-input",
|
|
3342
3382
|
style: {
|
|
3343
3383
|
width: "16px",
|
|
3344
3384
|
height: "16px",
|
|
3385
|
+
minWidth: "16px",
|
|
3345
3386
|
flexShrink: 0,
|
|
3387
|
+
flexGrow: 0,
|
|
3346
3388
|
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3347
3389
|
cursor: "pointer",
|
|
3348
3390
|
margin: 0,
|
|
3349
|
-
|
|
3391
|
+
padding: 0,
|
|
3392
|
+
display: "inline-block",
|
|
3393
|
+
verticalAlign: "middle"
|
|
3350
3394
|
}
|
|
3351
3395
|
}
|
|
3352
3396
|
),
|
|
3353
|
-
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: c })
|
|
3397
|
+
/* @__PURE__ */ a("span", { className: "metakyc-option-text", style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4", marginLeft: 0 }, children: c })
|
|
3354
3398
|
]
|
|
3355
3399
|
},
|
|
3356
3400
|
c
|
|
@@ -3364,51 +3408,51 @@ const ir = ({
|
|
|
3364
3408
|
onComplete: t,
|
|
3365
3409
|
onBack: r
|
|
3366
3410
|
}) => {
|
|
3367
|
-
const { uploadDocument: n, isLoading: s, isSubmitting: i, error: l, submit: c } =
|
|
3368
|
-
if (
|
|
3369
|
-
const
|
|
3370
|
-
n.uploadDocumentFiles.map(async (
|
|
3371
|
-
const N = d[
|
|
3372
|
-
N.map(async (
|
|
3373
|
-
fileName:
|
|
3374
|
-
fileData: await Tt(
|
|
3411
|
+
const { uploadDocument: n, isLoading: s, isSubmitting: i, error: l, submit: c } = qt(e), [d, u] = v({}), w = async (k) => {
|
|
3412
|
+
if (k.preventDefault(), !n) return;
|
|
3413
|
+
const g = await Promise.all(
|
|
3414
|
+
n.uploadDocumentFiles.map(async (p) => {
|
|
3415
|
+
const N = d[p.id] || [], f = await Promise.all(
|
|
3416
|
+
N.map(async (y) => ({
|
|
3417
|
+
fileName: y.name,
|
|
3418
|
+
fileData: await Tt(y)
|
|
3375
3419
|
}))
|
|
3376
3420
|
);
|
|
3377
3421
|
return {
|
|
3378
|
-
uploadDocumentFileId:
|
|
3379
|
-
valueList:
|
|
3422
|
+
uploadDocumentFileId: p.id,
|
|
3423
|
+
valueList: f
|
|
3380
3424
|
};
|
|
3381
3425
|
})
|
|
3382
|
-
),
|
|
3426
|
+
), m = {
|
|
3383
3427
|
applicantId: e,
|
|
3384
3428
|
uploadDocumentId: n.id,
|
|
3385
|
-
uploadDocumentResults:
|
|
3429
|
+
uploadDocumentResults: g
|
|
3386
3430
|
};
|
|
3387
|
-
await c(
|
|
3431
|
+
await c(m), t == null || t();
|
|
3388
3432
|
};
|
|
3389
3433
|
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: [
|
|
3390
3434
|
"Error loading document requirements: ",
|
|
3391
3435
|
l.message
|
|
3392
|
-
] }) }) }) : n ? /* @__PURE__ */ a("form", { onSubmit:
|
|
3393
|
-
/* @__PURE__ */ o(
|
|
3436
|
+
] }) }) }) : n ? /* @__PURE__ */ a("form", { onSubmit: w, children: /* @__PURE__ */ o(M, { children: [
|
|
3437
|
+
/* @__PURE__ */ o(re, { children: [
|
|
3394
3438
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: n.displayName }),
|
|
3395
3439
|
n.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: n.subtitle })
|
|
3396
3440
|
] }),
|
|
3397
|
-
/* @__PURE__ */ a(T, { className: "space-y-6", children: n.uploadDocumentFiles.map((
|
|
3441
|
+
/* @__PURE__ */ a(T, { className: "space-y-6", children: n.uploadDocumentFiles.map((k) => /* @__PURE__ */ a(
|
|
3398
3442
|
Vt,
|
|
3399
3443
|
{
|
|
3400
|
-
label:
|
|
3401
|
-
accept:
|
|
3402
|
-
multiple:
|
|
3403
|
-
maxSize:
|
|
3404
|
-
value: d[
|
|
3405
|
-
onChange: (
|
|
3406
|
-
u((
|
|
3444
|
+
label: k.displayName,
|
|
3445
|
+
accept: k.allowedTypes,
|
|
3446
|
+
multiple: k.multipleFile,
|
|
3447
|
+
maxSize: k.maxEachFileSizeByte,
|
|
3448
|
+
value: d[k.id] || [],
|
|
3449
|
+
onChange: (g) => {
|
|
3450
|
+
u((m) => ({ ...m, [k.id]: g }));
|
|
3407
3451
|
}
|
|
3408
3452
|
},
|
|
3409
|
-
|
|
3453
|
+
k.id
|
|
3410
3454
|
)) }),
|
|
3411
|
-
/* @__PURE__ */ o(
|
|
3455
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
3412
3456
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3413
3457
|
/* @__PURE__ */ a(U, { type: "submit", isLoading: i, children: "Continue" })
|
|
3414
3458
|
] })
|
|
@@ -3421,11 +3465,11 @@ const ir = ({
|
|
|
3421
3465
|
"Error loading overview: ",
|
|
3422
3466
|
l.message
|
|
3423
3467
|
] }) }) }) : n ? /* @__PURE__ */ o(M, { children: [
|
|
3424
|
-
/* @__PURE__ */ o(
|
|
3468
|
+
/* @__PURE__ */ o(re, { children: [
|
|
3425
3469
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: n.title || "Overview" }),
|
|
3426
3470
|
n.description && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: n.description })
|
|
3427
3471
|
] }),
|
|
3428
|
-
/* @__PURE__ */ a(T, { className: "space-y-8", children: n.steps && n.steps.length > 0 ? n.steps.sort((u,
|
|
3472
|
+
/* @__PURE__ */ a(T, { className: "space-y-8", children: n.steps && n.steps.length > 0 ? n.steps.sort((u, w) => u.order - w.order).map((u) => /* @__PURE__ */ o("div", { className: "metakyc-overview-step-item flex items-center space-x-3", children: [
|
|
3429
3473
|
/* @__PURE__ */ a("div", { className: "metakyc-step-icon flex-shrink-0", children: /* @__PURE__ */ a("div", { className: "w-8 h-8 rounded-full bg-primary-500 text-white flex items-center justify-center font-medium text-sm", children: u.order + 1 }) }),
|
|
3430
3474
|
/* @__PURE__ */ o(
|
|
3431
3475
|
"div",
|
|
@@ -3444,7 +3488,7 @@ const ir = ({
|
|
|
3444
3488
|
}
|
|
3445
3489
|
)
|
|
3446
3490
|
] }, u.order)) : /* @__PURE__ */ a("div", { className: "text-center py-8", children: /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: "Loading overview data..." }) }) }),
|
|
3447
|
-
/* @__PURE__ */ o(
|
|
3491
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
3448
3492
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3449
3493
|
/* @__PURE__ */ a(U, { onClick: d, isLoading: i, children: "Continue" })
|
|
3450
3494
|
] })
|
|
@@ -3483,7 +3527,7 @@ function dr(e, t) {
|
|
|
3483
3527
|
function ur(e) {
|
|
3484
3528
|
const t = /* @__PURE__ */ new Map();
|
|
3485
3529
|
return e.forEach((r, n) => {
|
|
3486
|
-
const s = r.pageNumber
|
|
3530
|
+
const s = r.pageNumber != null && r.pageNumber > 0 ? r.pageNumber : 1;
|
|
3487
3531
|
t.has(s) || t.set(s, []), t.get(s).push({ criterion: r, idx: n });
|
|
3488
3532
|
}), Array.from(t.entries()).sort(([r], [n]) => r - n).map(([, r]) => r);
|
|
3489
3533
|
}
|
|
@@ -3495,104 +3539,108 @@ const pr = ({
|
|
|
3495
3539
|
onComplete: t,
|
|
3496
3540
|
onBack: r
|
|
3497
3541
|
}) => {
|
|
3498
|
-
const { criteria: n,
|
|
3542
|
+
const { criteria: n, initialAnswers: s, isLoading: i, isSubmitting: l, error: c, submit: d } = Yt(e), [u, w] = v({}), [k, g] = v({}), [m, p] = v(0), [N, f] = v(!1);
|
|
3543
|
+
te.useEffect(() => {
|
|
3544
|
+
s && Object.keys(s).length > 0 && Object.keys(u).length === 0 && w(s);
|
|
3545
|
+
}, [s]);
|
|
3546
|
+
const y = Ae(
|
|
3499
3547
|
() => n && n.length > 0 ? ur(n) : [],
|
|
3500
3548
|
[n]
|
|
3501
|
-
),
|
|
3502
|
-
|
|
3503
|
-
!
|
|
3504
|
-
}, [
|
|
3505
|
-
const
|
|
3506
|
-
|
|
3507
|
-
const
|
|
3508
|
-
return delete
|
|
3549
|
+
), E = m === y.length - 1, S = y[m] ?? [];
|
|
3550
|
+
te.useEffect(() => {
|
|
3551
|
+
!i && n && n.length === 0 && !N && !l && (f(!0), d({ applicantId: e, criteriaValueInputs: [] }).then(() => t == null ? void 0 : t()).catch(console.error));
|
|
3552
|
+
}, [i, n, N, l, d, e, t]);
|
|
3553
|
+
const C = K((A, I) => {
|
|
3554
|
+
w((H) => ({ ...H, [A]: I })), g((H) => {
|
|
3555
|
+
const q = { ...H };
|
|
3556
|
+
return delete q[A], q;
|
|
3509
3557
|
});
|
|
3510
|
-
}, []),
|
|
3511
|
-
const
|
|
3512
|
-
for (const { criterion:
|
|
3513
|
-
const
|
|
3514
|
-
|
|
3558
|
+
}, []), O = K(() => {
|
|
3559
|
+
const A = {};
|
|
3560
|
+
for (const { criterion: I } of S) {
|
|
3561
|
+
const H = dr(I, u[I.id] ?? []);
|
|
3562
|
+
H && (A[I.id] = H);
|
|
3515
3563
|
}
|
|
3516
|
-
return
|
|
3517
|
-
}, [
|
|
3518
|
-
|
|
3519
|
-
},
|
|
3520
|
-
|
|
3521
|
-
},
|
|
3522
|
-
if (!(!
|
|
3564
|
+
return g((I) => ({ ...I, ...A })), Object.keys(A).length === 0;
|
|
3565
|
+
}, [S, u]), W = () => {
|
|
3566
|
+
O() && p((A) => A + 1);
|
|
3567
|
+
}, F = () => {
|
|
3568
|
+
m > 0 ? p((A) => A - 1) : r == null || r();
|
|
3569
|
+
}, h = async () => {
|
|
3570
|
+
if (!(!O() || !n))
|
|
3523
3571
|
try {
|
|
3524
|
-
const
|
|
3525
|
-
const
|
|
3526
|
-
return
|
|
3527
|
-
}).filter((
|
|
3528
|
-
await
|
|
3529
|
-
} catch (
|
|
3530
|
-
console.error("Risk scoring submit error:",
|
|
3572
|
+
const A = n.map((H) => {
|
|
3573
|
+
const q = (u[H.id] ?? []).filter((L) => L && L.trim());
|
|
3574
|
+
return q.length > 0 ? { riskCriteriaId: H.id, values: q } : null;
|
|
3575
|
+
}).filter((H) => H !== null);
|
|
3576
|
+
await d({ applicantId: e, criteriaValueInputs: A }), t == null || t();
|
|
3577
|
+
} catch (A) {
|
|
3578
|
+
console.error("Risk scoring submit error:", A);
|
|
3531
3579
|
}
|
|
3532
3580
|
};
|
|
3533
|
-
return
|
|
3581
|
+
return i ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
|
|
3534
3582
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
3535
3583
|
/* @__PURE__ */ a("p", { className: "text-center text-sm mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: "Loading risk scoring criteria…" })
|
|
3536
|
-
] }) }) : !
|
|
3584
|
+
] }) }) : !i && n && n.length === 0 ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
|
|
3537
3585
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
3538
3586
|
/* @__PURE__ */ a("p", { className: "text-center text-sm mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: "No criteria required. Moving to next step…" })
|
|
3539
|
-
] }) }) :
|
|
3587
|
+
] }) }) : c ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3540
3588
|
"Error loading criteria: ",
|
|
3541
|
-
|
|
3589
|
+
c.message
|
|
3542
3590
|
] }) }) }) : n ? /* @__PURE__ */ o(M, { children: [
|
|
3543
|
-
/* @__PURE__ */ o(
|
|
3591
|
+
/* @__PURE__ */ o(re, { children: [
|
|
3544
3592
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: "Risk Assessment" }),
|
|
3545
3593
|
/* @__PURE__ */ a("p", { className: "text-sm", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: "Please answer the following questions for risk evaluation" }),
|
|
3546
|
-
|
|
3594
|
+
y.length > 1 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between mt-3", children: [
|
|
3547
3595
|
/* @__PURE__ */ o("span", { className: "text-xs", style: { color: "var(--metakyc-text-muted, #9ca3af)" }, children: [
|
|
3548
3596
|
"Page ",
|
|
3549
|
-
|
|
3597
|
+
m + 1,
|
|
3550
3598
|
" of ",
|
|
3551
|
-
|
|
3599
|
+
y.length
|
|
3552
3600
|
] }),
|
|
3553
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children:
|
|
3601
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: y.map((A, I) => /* @__PURE__ */ a(
|
|
3554
3602
|
"div",
|
|
3555
3603
|
{
|
|
3556
3604
|
className: "rounded-full transition-all duration-200",
|
|
3557
3605
|
style: {
|
|
3558
3606
|
height: "6px",
|
|
3559
|
-
width:
|
|
3560
|
-
backgroundColor:
|
|
3607
|
+
width: I === m ? "20px" : "6px",
|
|
3608
|
+
backgroundColor: I <= m ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
|
|
3561
3609
|
}
|
|
3562
3610
|
},
|
|
3563
|
-
|
|
3611
|
+
I
|
|
3564
3612
|
)) })
|
|
3565
3613
|
] })
|
|
3566
3614
|
] }),
|
|
3567
|
-
/* @__PURE__ */ a(T, { className: "space-y-6", children:
|
|
3615
|
+
/* @__PURE__ */ a(T, { className: "space-y-6", children: S.map(({ criterion: A }) => /* @__PURE__ */ a(
|
|
3568
3616
|
hr,
|
|
3569
3617
|
{
|
|
3570
|
-
criterion:
|
|
3571
|
-
value:
|
|
3572
|
-
error: k[
|
|
3573
|
-
onChange: (
|
|
3618
|
+
criterion: A,
|
|
3619
|
+
value: u[A.id] ?? [],
|
|
3620
|
+
error: k[A.id],
|
|
3621
|
+
onChange: (I) => C(A.id, I)
|
|
3574
3622
|
},
|
|
3575
|
-
|
|
3623
|
+
A.id
|
|
3576
3624
|
)) }),
|
|
3577
|
-
/* @__PURE__ */ o(
|
|
3625
|
+
/* @__PURE__ */ o(se, { className: "flex items-center justify-between", children: [
|
|
3578
3626
|
/* @__PURE__ */ o(
|
|
3579
3627
|
U,
|
|
3580
3628
|
{
|
|
3581
3629
|
type: "button",
|
|
3582
3630
|
variant: "outline",
|
|
3583
|
-
onClick:
|
|
3631
|
+
onClick: F,
|
|
3584
3632
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
3585
3633
|
children: [
|
|
3586
3634
|
/* @__PURE__ */ a(_e, { size: 14 }),
|
|
3587
|
-
|
|
3635
|
+
m > 0 ? "Previous" : "Back"
|
|
3588
3636
|
]
|
|
3589
3637
|
}
|
|
3590
3638
|
),
|
|
3591
|
-
|
|
3639
|
+
E ? /* @__PURE__ */ a(U, { type: "button", isLoading: l, onClick: h, children: "Continue" }) : /* @__PURE__ */ o(
|
|
3592
3640
|
U,
|
|
3593
3641
|
{
|
|
3594
3642
|
type: "button",
|
|
3595
|
-
onClick:
|
|
3643
|
+
onClick: W,
|
|
3596
3644
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
3597
3645
|
children: [
|
|
3598
3646
|
"Next",
|
|
@@ -3601,7 +3649,7 @@ const pr = ({
|
|
|
3601
3649
|
}
|
|
3602
3650
|
)
|
|
3603
3651
|
] }),
|
|
3604
|
-
|
|
3652
|
+
c && /* @__PURE__ */ a("div", { className: "mx-6 mb-4 p-3 bg-red-50 border border-red-200 rounded", children: /* @__PURE__ */ a("p", { className: "text-red-600 text-sm", children: c.message }) })
|
|
3605
3653
|
] }) : null;
|
|
3606
3654
|
}, hr = ({ criterion: e, value: t, error: r, onChange: n }) => {
|
|
3607
3655
|
const s = mr(e), i = e.valueDataType === he.Integer || e.valueDataType === he.Decimal || e.valueDataType === he.DigitOnly;
|
|
@@ -3613,7 +3661,7 @@ const pr = ({
|
|
|
3613
3661
|
e.description && /* @__PURE__ */ a("p", { className: "text-xs", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: e.description }),
|
|
3614
3662
|
i && (e.min !== void 0 || e.max !== void 0) && /* @__PURE__ */ a("p", { className: "text-xs", style: { color: "var(--metakyc-text-muted, #9ca3af)" }, children: e.min !== void 0 && e.max !== void 0 ? `Range: ${e.min} – ${e.max}` : e.min !== void 0 ? `Minimum: ${e.min}` : `Maximum: ${e.max}` }),
|
|
3615
3663
|
s === "text" && /* @__PURE__ */ a(
|
|
3616
|
-
|
|
3664
|
+
ne,
|
|
3617
3665
|
{
|
|
3618
3666
|
value: t[0] ?? "",
|
|
3619
3667
|
onChange: (l) => n([l.target.value]),
|
|
@@ -3628,11 +3676,12 @@ const pr = ({
|
|
|
3628
3676
|
}
|
|
3629
3677
|
}
|
|
3630
3678
|
),
|
|
3631
|
-
s === "radio" && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3679
|
+
s === "radio" && /* @__PURE__ */ o("div", { className: "metakyc-options-group", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3632
3680
|
(e.defaultValues ?? []).map((l) => /* @__PURE__ */ o(
|
|
3633
3681
|
"label",
|
|
3634
3682
|
{
|
|
3635
|
-
|
|
3683
|
+
className: "metakyc-option-label",
|
|
3684
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0, padding: 0 },
|
|
3636
3685
|
children: [
|
|
3637
3686
|
/* @__PURE__ */ a(
|
|
3638
3687
|
"input",
|
|
@@ -3640,28 +3689,35 @@ const pr = ({
|
|
|
3640
3689
|
type: "radio",
|
|
3641
3690
|
checked: t[0] === l,
|
|
3642
3691
|
onChange: () => n([l]),
|
|
3692
|
+
className: "metakyc-option-input",
|
|
3643
3693
|
style: {
|
|
3644
3694
|
width: "16px",
|
|
3645
3695
|
height: "16px",
|
|
3696
|
+
minWidth: "16px",
|
|
3646
3697
|
flexShrink: 0,
|
|
3698
|
+
flexGrow: 0,
|
|
3647
3699
|
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3648
3700
|
cursor: "pointer",
|
|
3649
|
-
margin: 0
|
|
3701
|
+
margin: 0,
|
|
3702
|
+
padding: 0,
|
|
3703
|
+
display: "inline-block",
|
|
3704
|
+
verticalAlign: "middle"
|
|
3650
3705
|
}
|
|
3651
3706
|
}
|
|
3652
3707
|
),
|
|
3653
|
-
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: l })
|
|
3708
|
+
/* @__PURE__ */ a("span", { className: "metakyc-option-text", style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4", marginLeft: 0 }, children: l })
|
|
3654
3709
|
]
|
|
3655
3710
|
},
|
|
3656
3711
|
l
|
|
3657
3712
|
)),
|
|
3658
3713
|
r && /* @__PURE__ */ a("p", { className: "text-sm text-danger-500", children: r })
|
|
3659
3714
|
] }),
|
|
3660
|
-
s === "checkbox" && /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3715
|
+
s === "checkbox" && /* @__PURE__ */ o("div", { className: "metakyc-options-group", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
3661
3716
|
(e.defaultValues ?? []).map((l) => /* @__PURE__ */ o(
|
|
3662
3717
|
"label",
|
|
3663
3718
|
{
|
|
3664
|
-
|
|
3719
|
+
className: "metakyc-option-label",
|
|
3720
|
+
style: { display: "flex", alignItems: "center", gap: "10px", cursor: "pointer", margin: 0, padding: 0 },
|
|
3665
3721
|
children: [
|
|
3666
3722
|
/* @__PURE__ */ a(
|
|
3667
3723
|
"input",
|
|
@@ -3671,18 +3727,23 @@ const pr = ({
|
|
|
3671
3727
|
onChange: (c) => {
|
|
3672
3728
|
c.target.checked ? n([...t, l]) : n(t.filter((d) => d !== l));
|
|
3673
3729
|
},
|
|
3730
|
+
className: "metakyc-option-input",
|
|
3674
3731
|
style: {
|
|
3675
3732
|
width: "16px",
|
|
3676
3733
|
height: "16px",
|
|
3734
|
+
minWidth: "16px",
|
|
3677
3735
|
flexShrink: 0,
|
|
3736
|
+
flexGrow: 0,
|
|
3678
3737
|
accentColor: "var(--metakyc-primary, #2563eb)",
|
|
3679
3738
|
cursor: "pointer",
|
|
3680
3739
|
margin: 0,
|
|
3681
|
-
|
|
3740
|
+
padding: 0,
|
|
3741
|
+
display: "inline-block",
|
|
3742
|
+
verticalAlign: "middle"
|
|
3682
3743
|
}
|
|
3683
3744
|
}
|
|
3684
3745
|
),
|
|
3685
|
-
/* @__PURE__ */ a("span", { style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4" }, children: l })
|
|
3746
|
+
/* @__PURE__ */ a("span", { className: "metakyc-option-text", style: { fontSize: "14px", color: "var(--metakyc-text-primary, #111827)", lineHeight: "1.4", marginLeft: 0 }, children: l })
|
|
3686
3747
|
]
|
|
3687
3748
|
},
|
|
3688
3749
|
l
|
|
@@ -3712,28 +3773,28 @@ const pr = ({
|
|
|
3712
3773
|
onComplete: t,
|
|
3713
3774
|
onBack: r
|
|
3714
3775
|
}) => {
|
|
3715
|
-
const { investorCategorizationService: n } =
|
|
3716
|
-
return /* @__PURE__ */ a("form", { onSubmit: async (
|
|
3717
|
-
if (
|
|
3776
|
+
const { investorCategorizationService: n } = ie(), [s, i] = v(null), [l, c] = v(!1), [d, u] = v(null);
|
|
3777
|
+
return /* @__PURE__ */ a("form", { onSubmit: async (k) => {
|
|
3778
|
+
if (k.preventDefault(), s === null) {
|
|
3718
3779
|
u("Please select an investor type");
|
|
3719
3780
|
return;
|
|
3720
3781
|
}
|
|
3721
3782
|
c(!0), u(null);
|
|
3722
3783
|
try {
|
|
3723
|
-
const
|
|
3784
|
+
const g = {
|
|
3724
3785
|
applicantId: e,
|
|
3725
3786
|
investorType: s
|
|
3726
3787
|
};
|
|
3727
|
-
console.log("Submitting investor categorization:",
|
|
3728
|
-
const
|
|
3729
|
-
console.log("Investor categorization result:",
|
|
3730
|
-
} catch (
|
|
3731
|
-
console.error("Error submitting investor categorization:",
|
|
3788
|
+
console.log("Submitting investor categorization:", g);
|
|
3789
|
+
const m = await n.setInvestorCategorization(g);
|
|
3790
|
+
console.log("Investor categorization result:", m), t == null || t();
|
|
3791
|
+
} catch (g) {
|
|
3792
|
+
console.error("Error submitting investor categorization:", g), u(g.message || "Failed to submit investor categorization");
|
|
3732
3793
|
} finally {
|
|
3733
3794
|
c(!1);
|
|
3734
3795
|
}
|
|
3735
3796
|
}, children: /* @__PURE__ */ o(M, { children: [
|
|
3736
|
-
/* @__PURE__ */ o(
|
|
3797
|
+
/* @__PURE__ */ o(re, { children: [
|
|
3737
3798
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: "Which statement best describes you?" }),
|
|
3738
3799
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: "All Tokenise clients are treated as Retail Investors under EU regulation, which gives you the highest level of investor protection. For our internal purposes, we ask you to select the description that best matches your situation" })
|
|
3739
3800
|
] }),
|
|
@@ -3744,7 +3805,7 @@ const pr = ({
|
|
|
3744
3805
|
{
|
|
3745
3806
|
className: `
|
|
3746
3807
|
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3747
|
-
${s ===
|
|
3808
|
+
${s === ae.Individual ? "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"}
|
|
3748
3809
|
`,
|
|
3749
3810
|
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3750
3811
|
/* @__PURE__ */ a(
|
|
@@ -3752,9 +3813,9 @@ const pr = ({
|
|
|
3752
3813
|
{
|
|
3753
3814
|
type: "radio",
|
|
3754
3815
|
name: "investorType",
|
|
3755
|
-
value:
|
|
3756
|
-
checked: s ===
|
|
3757
|
-
onChange: () => i(
|
|
3816
|
+
value: ae.Individual,
|
|
3817
|
+
checked: s === ae.Individual,
|
|
3818
|
+
onChange: () => i(ae.Individual),
|
|
3758
3819
|
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3759
3820
|
}
|
|
3760
3821
|
),
|
|
@@ -3770,7 +3831,7 @@ const pr = ({
|
|
|
3770
3831
|
{
|
|
3771
3832
|
className: `
|
|
3772
3833
|
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3773
|
-
${s ===
|
|
3834
|
+
${s === ae.Sophisticated ? "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"}
|
|
3774
3835
|
`,
|
|
3775
3836
|
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3776
3837
|
/* @__PURE__ */ a(
|
|
@@ -3778,9 +3839,9 @@ const pr = ({
|
|
|
3778
3839
|
{
|
|
3779
3840
|
type: "radio",
|
|
3780
3841
|
name: "investorType",
|
|
3781
|
-
value:
|
|
3782
|
-
checked: s ===
|
|
3783
|
-
onChange: () => i(
|
|
3842
|
+
value: ae.Sophisticated,
|
|
3843
|
+
checked: s === ae.Sophisticated,
|
|
3844
|
+
onChange: () => i(ae.Sophisticated),
|
|
3784
3845
|
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3785
3846
|
}
|
|
3786
3847
|
),
|
|
@@ -3801,7 +3862,7 @@ const pr = ({
|
|
|
3801
3862
|
{
|
|
3802
3863
|
className: `
|
|
3803
3864
|
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3804
|
-
${s ===
|
|
3865
|
+
${s === ae.HighNetWorth ? "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"}
|
|
3805
3866
|
`,
|
|
3806
3867
|
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3807
3868
|
/* @__PURE__ */ a(
|
|
@@ -3809,9 +3870,9 @@ const pr = ({
|
|
|
3809
3870
|
{
|
|
3810
3871
|
type: "radio",
|
|
3811
3872
|
name: "investorType",
|
|
3812
|
-
value:
|
|
3813
|
-
checked: s ===
|
|
3814
|
-
onChange: () => i(
|
|
3873
|
+
value: ae.HighNetWorth,
|
|
3874
|
+
checked: s === ae.HighNetWorth,
|
|
3875
|
+
onChange: () => i(ae.HighNetWorth),
|
|
3815
3876
|
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3816
3877
|
}
|
|
3817
3878
|
),
|
|
@@ -3832,7 +3893,7 @@ const pr = ({
|
|
|
3832
3893
|
d
|
|
3833
3894
|
] }) })
|
|
3834
3895
|
] }),
|
|
3835
|
-
/* @__PURE__ */ o(
|
|
3896
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
3836
3897
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3837
3898
|
/* @__PURE__ */ a(
|
|
3838
3899
|
U,
|
|
@@ -3850,104 +3911,104 @@ const pr = ({
|
|
|
3850
3911
|
onComplete: t,
|
|
3851
3912
|
onBack: r
|
|
3852
3913
|
}) => {
|
|
3853
|
-
const { appropriatenessTestService: n } =
|
|
3854
|
-
|
|
3914
|
+
const { appropriatenessTestService: n } = ie(), [s, i] = v(null), [l, c] = v(!0), [d, u] = v(!1), [w, k] = v(null), [g, m] = v({}), [p, N] = v(0), [f, y] = v(!1), [E, S] = v(!1), [C, O] = v(0);
|
|
3915
|
+
G(() => {
|
|
3855
3916
|
(async () => {
|
|
3856
3917
|
try {
|
|
3857
|
-
c(!0),
|
|
3858
|
-
const
|
|
3859
|
-
if (console.log("Appropriateness test data:",
|
|
3860
|
-
const
|
|
3861
|
-
|
|
3918
|
+
c(!0), k(null), console.log("Loading appropriateness test for applicant:", e);
|
|
3919
|
+
const R = await n.getAppropriatenessTest(e);
|
|
3920
|
+
if (console.log("Appropriateness test data:", R), i(R), R.waitTimeSpanForNextTry && R.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3921
|
+
const Y = W(R.waitTimeSpanForNextTry);
|
|
3922
|
+
Y > 0 && O(Y);
|
|
3862
3923
|
}
|
|
3863
|
-
} catch (
|
|
3864
|
-
console.error("Error loading appropriateness test:",
|
|
3924
|
+
} catch (R) {
|
|
3925
|
+
console.error("Error loading appropriateness test:", R), k(R.message || "Failed to load appropriateness test");
|
|
3865
3926
|
} finally {
|
|
3866
3927
|
c(!1);
|
|
3867
3928
|
}
|
|
3868
3929
|
})();
|
|
3869
3930
|
}, [e, n]);
|
|
3870
|
-
const
|
|
3871
|
-
const
|
|
3872
|
-
if (
|
|
3873
|
-
const [
|
|
3874
|
-
return
|
|
3931
|
+
const W = (L) => {
|
|
3932
|
+
const R = L.split(":").map(Number);
|
|
3933
|
+
if (R.length === 3) {
|
|
3934
|
+
const [Y, x, P] = R;
|
|
3935
|
+
return Y * 3600 + x * 60 + P;
|
|
3875
3936
|
}
|
|
3876
3937
|
return 0;
|
|
3877
|
-
},
|
|
3878
|
-
const
|
|
3879
|
-
return `${
|
|
3938
|
+
}, F = (L) => {
|
|
3939
|
+
const R = Math.floor(L / 60), Y = L % 60;
|
|
3940
|
+
return `${R.toString().padStart(2, "0")}:${Y.toString().padStart(2, "0")}`;
|
|
3880
3941
|
};
|
|
3881
|
-
|
|
3882
|
-
if (!
|
|
3883
|
-
const
|
|
3884
|
-
N((
|
|
3942
|
+
G(() => {
|
|
3943
|
+
if (!f || p <= 0) return;
|
|
3944
|
+
const L = setInterval(() => {
|
|
3945
|
+
N((R) => R <= 1 ? (S(!0), 0) : R - 1);
|
|
3885
3946
|
}, 1e3);
|
|
3886
|
-
return () => clearInterval(
|
|
3887
|
-
}, [
|
|
3888
|
-
if (
|
|
3889
|
-
const
|
|
3890
|
-
|
|
3947
|
+
return () => clearInterval(L);
|
|
3948
|
+
}, [f, p]), G(() => {
|
|
3949
|
+
if (C <= 0) return;
|
|
3950
|
+
const L = setInterval(() => {
|
|
3951
|
+
O((R) => R <= 1 ? 0 : R - 1);
|
|
3891
3952
|
}, 1e3);
|
|
3892
|
-
return () => clearInterval(
|
|
3893
|
-
}, [
|
|
3894
|
-
E && !d &&
|
|
3953
|
+
return () => clearInterval(L);
|
|
3954
|
+
}, [C]), G(() => {
|
|
3955
|
+
E && !d && I();
|
|
3895
3956
|
}, [E]);
|
|
3896
|
-
const
|
|
3897
|
-
s && (
|
|
3898
|
-
},
|
|
3899
|
-
|
|
3900
|
-
...
|
|
3901
|
-
[
|
|
3957
|
+
const h = () => {
|
|
3958
|
+
s && (y(!0), N(s.testDurationSec));
|
|
3959
|
+
}, A = (L, R) => {
|
|
3960
|
+
m((Y) => ({
|
|
3961
|
+
...Y,
|
|
3962
|
+
[L]: R
|
|
3902
3963
|
}));
|
|
3903
|
-
},
|
|
3904
|
-
if (
|
|
3964
|
+
}, I = async (L) => {
|
|
3965
|
+
if (L && L.preventDefault(), !!s) {
|
|
3905
3966
|
if (!E) {
|
|
3906
|
-
const
|
|
3907
|
-
if (
|
|
3908
|
-
|
|
3967
|
+
const R = s.appropriatenessQuestions.length - Object.keys(g).length;
|
|
3968
|
+
if (R > 0) {
|
|
3969
|
+
k(`Please answer all questions. ${R} question(s) remaining.`);
|
|
3909
3970
|
return;
|
|
3910
3971
|
}
|
|
3911
3972
|
}
|
|
3912
|
-
u(!0),
|
|
3973
|
+
u(!0), k(null);
|
|
3913
3974
|
try {
|
|
3914
|
-
const
|
|
3915
|
-
(
|
|
3916
|
-
appropriatenessQuestionId:
|
|
3917
|
-
value:
|
|
3975
|
+
const R = s.appropriatenessQuestions.map(
|
|
3976
|
+
(x) => ({
|
|
3977
|
+
appropriatenessQuestionId: x.id,
|
|
3978
|
+
value: g[x.id] || ""
|
|
3918
3979
|
// Empty string if not answered
|
|
3919
3980
|
})
|
|
3920
|
-
),
|
|
3981
|
+
), Y = {
|
|
3921
3982
|
applicantId: e,
|
|
3922
3983
|
appropriatenessTestId: s.id,
|
|
3923
|
-
appropriatenessQuestionResults:
|
|
3984
|
+
appropriatenessQuestionResults: R
|
|
3924
3985
|
};
|
|
3925
|
-
console.log("Submitting appropriateness test:",
|
|
3986
|
+
console.log("Submitting appropriateness test:", Y);
|
|
3926
3987
|
try {
|
|
3927
|
-
const
|
|
3928
|
-
console.log("Appropriateness test result:",
|
|
3929
|
-
} catch (
|
|
3930
|
-
if (
|
|
3931
|
-
const P =
|
|
3932
|
-
console.log("Test failed:", P),
|
|
3988
|
+
const x = await n.fillAppropriatenessTest(Y);
|
|
3989
|
+
console.log("Appropriateness test result:", x), x.message && (x.message.toLowerCase().includes("pass") || x.message.toLowerCase().includes("success") || x.message.toLowerCase().includes("congratulations")) ? t == null || t() : (k(x.message || "Test completed. Please check the result."), y(!1), S(!1), m({}), setTimeout(() => H(), 1e3));
|
|
3990
|
+
} catch (x) {
|
|
3991
|
+
if (x.code === 400 && x.message) {
|
|
3992
|
+
const P = x.message;
|
|
3993
|
+
console.log("Test failed:", P), k(P), y(!1), S(!1), m({}), setTimeout(() => H(), 1500);
|
|
3933
3994
|
} else
|
|
3934
|
-
throw
|
|
3995
|
+
throw x;
|
|
3935
3996
|
}
|
|
3936
|
-
} catch (
|
|
3937
|
-
console.error("Error submitting appropriateness test:",
|
|
3997
|
+
} catch (R) {
|
|
3998
|
+
console.error("Error submitting appropriateness test:", R), k(R.message || "Failed to submit test. Please try again."), y(!1), S(!1), m({});
|
|
3938
3999
|
} finally {
|
|
3939
4000
|
u(!1);
|
|
3940
4001
|
}
|
|
3941
4002
|
}
|
|
3942
|
-
},
|
|
4003
|
+
}, H = async () => {
|
|
3943
4004
|
try {
|
|
3944
|
-
const
|
|
3945
|
-
if (console.log("Reloaded test data:",
|
|
3946
|
-
const
|
|
3947
|
-
|
|
4005
|
+
const L = await n.getAppropriatenessTest(e);
|
|
4006
|
+
if (console.log("Reloaded test data:", L), i(L), L.waitTimeSpanForNextTry && L.waitTimeSpanForNextTry !== "00:00:00") {
|
|
4007
|
+
const R = W(L.waitTimeSpanForNextTry);
|
|
4008
|
+
R > 0 && O(R);
|
|
3948
4009
|
}
|
|
3949
|
-
} catch (
|
|
3950
|
-
console.error("Error reloading test data:",
|
|
4010
|
+
} catch (L) {
|
|
4011
|
+
console.error("Error reloading test data:", L), k((R) => R + `
|
|
3951
4012
|
|
|
3952
4013
|
Failed to reload test data. Please refresh the page.`);
|
|
3953
4014
|
}
|
|
@@ -3960,25 +4021,25 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3960
4021
|
if (!s)
|
|
3961
4022
|
return /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3962
4023
|
/* @__PURE__ */ a("p", { className: "text-danger-500 text-lg mb-4", children: "No test data available" }),
|
|
3963
|
-
|
|
4024
|
+
w && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: w })
|
|
3964
4025
|
] }) });
|
|
3965
|
-
if (
|
|
4026
|
+
if (C > 0)
|
|
3966
4027
|
return /* @__PURE__ */ o(M, { children: [
|
|
3967
|
-
/* @__PURE__ */ o(
|
|
4028
|
+
/* @__PURE__ */ o(re, { children: [
|
|
3968
4029
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
3969
4030
|
s.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: s.subtitle })
|
|
3970
4031
|
] }),
|
|
3971
4032
|
/* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3972
4033
|
/* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
3973
|
-
/* @__PURE__ */ a("div", { className: "text-6xl font-bold text-primary-500 mb-2", children:
|
|
4034
|
+
/* @__PURE__ */ a("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: F(C) }),
|
|
3974
4035
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait before attempting the test again" })
|
|
3975
4036
|
] }),
|
|
3976
|
-
|
|
4037
|
+
w && /* @__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: w }) })
|
|
3977
4038
|
] })
|
|
3978
4039
|
] });
|
|
3979
|
-
const
|
|
3980
|
-
return
|
|
3981
|
-
/* @__PURE__ */ a(
|
|
4040
|
+
const q = s.testAllowedMaxTry - s.totalFailedTries;
|
|
4041
|
+
return f ? /* @__PURE__ */ a("form", { onSubmit: I, children: /* @__PURE__ */ o(M, { children: [
|
|
4042
|
+
/* @__PURE__ */ a(re, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
3982
4043
|
/* @__PURE__ */ o("div", { children: [
|
|
3983
4044
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
3984
4045
|
s.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
|
|
@@ -3987,8 +4048,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3987
4048
|
/* @__PURE__ */ a(
|
|
3988
4049
|
"div",
|
|
3989
4050
|
{
|
|
3990
|
-
className: `text-3xl font-bold ${
|
|
3991
|
-
children:
|
|
4051
|
+
className: `text-3xl font-bold ${p <= 60 ? "text-danger-500" : "text-primary-500"}`,
|
|
4052
|
+
children: F(p)
|
|
3992
4053
|
}
|
|
3993
4054
|
),
|
|
3994
4055
|
/* @__PURE__ */ a("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Time Remaining" })
|
|
@@ -3998,18 +4059,18 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3998
4059
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
|
|
3999
4060
|
/* @__PURE__ */ o(pe, { variant: "info", children: [
|
|
4000
4061
|
"Question ",
|
|
4001
|
-
Object.keys(
|
|
4062
|
+
Object.keys(g).length,
|
|
4002
4063
|
" of ",
|
|
4003
4064
|
s.totalQuestionCount
|
|
4004
4065
|
] }),
|
|
4005
|
-
/* @__PURE__ */ o(pe, { variant:
|
|
4006
|
-
|
|
4066
|
+
/* @__PURE__ */ o(pe, { variant: q > 1 ? "success" : "warning", children: [
|
|
4067
|
+
q,
|
|
4007
4068
|
" attempt",
|
|
4008
|
-
|
|
4069
|
+
q !== 1 ? "s" : "",
|
|
4009
4070
|
" remaining"
|
|
4010
4071
|
] })
|
|
4011
4072
|
] }),
|
|
4012
|
-
s.appropriatenessQuestions.map((
|
|
4073
|
+
s.appropriatenessQuestions.map((L, R) => /* @__PURE__ */ o(
|
|
4013
4074
|
"div",
|
|
4014
4075
|
{
|
|
4015
4076
|
className: "p-4 border border-gray-200 dark:border-gray-700 rounded-lg",
|
|
@@ -4017,51 +4078,51 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4017
4078
|
/* @__PURE__ */ o("div", { className: "mb-4", children: [
|
|
4018
4079
|
/* @__PURE__ */ o("span", { className: "inline-block px-2 py-1 text-xs font-semibold text-primary-700 bg-primary-100 dark:text-primary-300 dark:bg-primary-900/30 rounded mb-2", children: [
|
|
4019
4080
|
"Question ",
|
|
4020
|
-
|
|
4081
|
+
R + 1
|
|
4021
4082
|
] }),
|
|
4022
|
-
|
|
4023
|
-
/* @__PURE__ */ a("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children:
|
|
4083
|
+
L.groupName && /* @__PURE__ */ a("span", { className: "ml-2 text-xs text-gray-500 dark:text-gray-400", children: L.groupName }),
|
|
4084
|
+
/* @__PURE__ */ a("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children: L.question })
|
|
4024
4085
|
] }),
|
|
4025
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children:
|
|
4086
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: L.answers.map((Y, x) => /* @__PURE__ */ o(
|
|
4026
4087
|
"label",
|
|
4027
4088
|
{
|
|
4028
4089
|
className: `
|
|
4029
4090
|
flex items-center p-3 border-2 rounded-lg cursor-pointer transition-all
|
|
4030
|
-
${
|
|
4091
|
+
${g[L.id] === Y ? "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"}
|
|
4031
4092
|
`,
|
|
4032
4093
|
children: [
|
|
4033
4094
|
/* @__PURE__ */ a(
|
|
4034
4095
|
"input",
|
|
4035
4096
|
{
|
|
4036
4097
|
type: "radio",
|
|
4037
|
-
name: `question-${
|
|
4038
|
-
value:
|
|
4039
|
-
checked:
|
|
4040
|
-
onChange: (P) => L
|
|
4098
|
+
name: `question-${L.id}`,
|
|
4099
|
+
value: Y,
|
|
4100
|
+
checked: g[L.id] === Y,
|
|
4101
|
+
onChange: (P) => A(L.id, P.target.value),
|
|
4041
4102
|
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500",
|
|
4042
4103
|
disabled: d
|
|
4043
4104
|
}
|
|
4044
4105
|
),
|
|
4045
|
-
/* @__PURE__ */ a("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children:
|
|
4106
|
+
/* @__PURE__ */ a("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children: Y })
|
|
4046
4107
|
]
|
|
4047
4108
|
},
|
|
4048
|
-
|
|
4109
|
+
x
|
|
4049
4110
|
)) })
|
|
4050
4111
|
]
|
|
4051
4112
|
},
|
|
4052
|
-
|
|
4113
|
+
L.id
|
|
4053
4114
|
)),
|
|
4054
|
-
|
|
4115
|
+
w && !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: [
|
|
4055
4116
|
/* @__PURE__ */ a("strong", { children: "Error:" }),
|
|
4056
4117
|
" ",
|
|
4057
|
-
|
|
4118
|
+
w
|
|
4058
4119
|
] }) }),
|
|
4059
4120
|
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: [
|
|
4060
4121
|
/* @__PURE__ */ a("strong", { children: "Time's up!" }),
|
|
4061
4122
|
" Your answers are being submitted automatically."
|
|
4062
4123
|
] }) })
|
|
4063
4124
|
] }),
|
|
4064
|
-
/* @__PURE__ */ o(
|
|
4125
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
4065
4126
|
/* @__PURE__ */ a(
|
|
4066
4127
|
U,
|
|
4067
4128
|
{
|
|
@@ -4077,13 +4138,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4077
4138
|
{
|
|
4078
4139
|
type: "submit",
|
|
4079
4140
|
isLoading: d,
|
|
4080
|
-
disabled: Object.keys(
|
|
4141
|
+
disabled: Object.keys(g).length < s.totalQuestionCount,
|
|
4081
4142
|
children: E ? "Submitting..." : "Submit Test"
|
|
4082
4143
|
}
|
|
4083
4144
|
)
|
|
4084
4145
|
] })
|
|
4085
4146
|
] }) }) : /* @__PURE__ */ o(M, { children: [
|
|
4086
|
-
/* @__PURE__ */ o(
|
|
4147
|
+
/* @__PURE__ */ o(re, { children: [
|
|
4087
4148
|
/* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
4088
4149
|
s.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: s.subtitle })
|
|
4089
4150
|
] }),
|
|
@@ -4096,7 +4157,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4096
4157
|
] }),
|
|
4097
4158
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
4098
4159
|
/* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Time Limit:" }),
|
|
4099
|
-
/* @__PURE__ */ a(pe, { variant: "info", children:
|
|
4160
|
+
/* @__PURE__ */ a(pe, { variant: "info", children: F(s.testDurationSec) })
|
|
4100
4161
|
] }),
|
|
4101
4162
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
4102
4163
|
/* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Correct Answers Required:" }),
|
|
@@ -4104,24 +4165,24 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4104
4165
|
] }),
|
|
4105
4166
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
4106
4167
|
/* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Attempts Remaining:" }),
|
|
4107
|
-
/* @__PURE__ */ a(pe, { variant:
|
|
4168
|
+
/* @__PURE__ */ a(pe, { variant: q > 1 ? "success" : "warning", children: q })
|
|
4108
4169
|
] })
|
|
4109
4170
|
] }),
|
|
4110
|
-
|
|
4171
|
+
w && /* @__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: [
|
|
4111
4172
|
/* @__PURE__ */ a("strong", { children: "Previous Attempt:" }),
|
|
4112
4173
|
" ",
|
|
4113
|
-
|
|
4174
|
+
w
|
|
4114
4175
|
] }) }),
|
|
4115
|
-
|
|
4176
|
+
q <= 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." }) })
|
|
4116
4177
|
] }),
|
|
4117
|
-
/* @__PURE__ */ o(
|
|
4178
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
4118
4179
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4119
4180
|
/* @__PURE__ */ a(
|
|
4120
4181
|
U,
|
|
4121
4182
|
{
|
|
4122
4183
|
type: "button",
|
|
4123
|
-
onClick:
|
|
4124
|
-
disabled:
|
|
4184
|
+
onClick: h,
|
|
4185
|
+
disabled: q <= 0,
|
|
4125
4186
|
children: "Start Test"
|
|
4126
4187
|
}
|
|
4127
4188
|
)
|
|
@@ -4132,8 +4193,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4132
4193
|
onComplete: t,
|
|
4133
4194
|
onBack: r
|
|
4134
4195
|
}) => {
|
|
4135
|
-
var
|
|
4136
|
-
const { applicantService: n, baseInformationService: s, config: i } =
|
|
4196
|
+
var Y, x, P, $;
|
|
4197
|
+
const { applicantService: n, baseInformationService: s, config: i } = ie(), { identityData: l, provider: c, token: d, isLoading: u, error: w, requestIdentity: k, restartIdentity: g } = Ht(e), [m, p] = v(null), [N, f] = v(null), [y, E] = v([]), [S, C] = v(!0), [O, W] = v(!1), [F, h] = v(null), [A, I] = v(!1), H = te.useRef(!1), q = Ve({
|
|
4137
4198
|
defaultValues: {
|
|
4138
4199
|
street: "",
|
|
4139
4200
|
streetNumber: "",
|
|
@@ -4144,21 +4205,21 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4144
4205
|
phonenumber: ""
|
|
4145
4206
|
}
|
|
4146
4207
|
});
|
|
4147
|
-
|
|
4208
|
+
G(() => {
|
|
4148
4209
|
(async () => {
|
|
4149
4210
|
try {
|
|
4150
|
-
const [
|
|
4211
|
+
const [b, B] = await Promise.all([
|
|
4151
4212
|
n.getApplicantData(e),
|
|
4152
4213
|
s.getCountries("", "en")
|
|
4153
4214
|
]);
|
|
4154
|
-
|
|
4155
|
-
const
|
|
4215
|
+
f(b);
|
|
4216
|
+
const V = /* @__PURE__ */ new Set(), X = B.filter((me) => {
|
|
4156
4217
|
const Ee = me.abbreviation3 || me.abbreviation;
|
|
4157
|
-
return !Ee ||
|
|
4218
|
+
return !Ee || V.has(Ee) ? !1 : (V.add(Ee), !0);
|
|
4158
4219
|
});
|
|
4159
4220
|
E(X);
|
|
4160
|
-
const _ =
|
|
4161
|
-
if (
|
|
4221
|
+
const _ = b.applicantRequestData;
|
|
4222
|
+
if (q.reset({
|
|
4162
4223
|
street: (_ == null ? void 0 : _.street) || "",
|
|
4163
4224
|
streetNumber: (_ == null ? void 0 : _.streetNumber) || "",
|
|
4164
4225
|
city: (_ == null ? void 0 : _.city) || "",
|
|
@@ -4166,125 +4227,125 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4166
4227
|
country: (_ == null ? void 0 : _.country) || "",
|
|
4167
4228
|
nationality: (_ == null ? void 0 : _.nationality) || "",
|
|
4168
4229
|
phonenumber: (_ == null ? void 0 : _.phonenumber) || ""
|
|
4169
|
-
}),
|
|
4170
|
-
console.log("[Identity] Found existing identity verification, auto-requesting..."),
|
|
4230
|
+
}), b.kycRecords && b.kycRecords.length > 0 && b.kycRecords[0].providerTokenObject !== null && !H.current) {
|
|
4231
|
+
console.log("[Identity] Found existing identity verification, auto-requesting..."), H.current = !0;
|
|
4171
4232
|
try {
|
|
4172
|
-
await
|
|
4233
|
+
await k(), W(!0);
|
|
4173
4234
|
} catch (me) {
|
|
4174
4235
|
console.error("[Identity] Auto-request failed:", me);
|
|
4175
4236
|
}
|
|
4176
4237
|
}
|
|
4177
|
-
} catch (
|
|
4178
|
-
console.error("Error loading applicant data:",
|
|
4238
|
+
} catch (b) {
|
|
4239
|
+
console.error("Error loading applicant data:", b);
|
|
4179
4240
|
} finally {
|
|
4180
|
-
|
|
4241
|
+
C(!1);
|
|
4181
4242
|
}
|
|
4182
4243
|
})();
|
|
4183
|
-
}, [e]),
|
|
4184
|
-
l && !
|
|
4185
|
-
}, [l,
|
|
4244
|
+
}, [e]), G(() => {
|
|
4245
|
+
l && !O && (console.log("[Identity] Identity data already loaded, showing provider"), W(!0));
|
|
4246
|
+
}, [l, O]), G(() => {
|
|
4186
4247
|
if (d) {
|
|
4187
4248
|
if (d.expiresAt) {
|
|
4188
|
-
const
|
|
4189
|
-
if (Date.now() >=
|
|
4190
|
-
console.warn("[Identity] Token has expired (expiresAt)"),
|
|
4249
|
+
const D = new Date(d.expiresAt).getTime();
|
|
4250
|
+
if (Date.now() >= D) {
|
|
4251
|
+
console.warn("[Identity] Token has expired (expiresAt)"), I(!0), h("Your verification session has expired. Please restart.");
|
|
4191
4252
|
return;
|
|
4192
4253
|
}
|
|
4193
4254
|
}
|
|
4194
4255
|
if (d.url)
|
|
4195
4256
|
try {
|
|
4196
|
-
const
|
|
4197
|
-
if (
|
|
4198
|
-
console.warn("[Identity] Token URL indicates expiration"),
|
|
4257
|
+
const b = new URL(d.url).toString().toLowerCase();
|
|
4258
|
+
if (b.includes("expired") || b.includes("invalid") || b.includes("error")) {
|
|
4259
|
+
console.warn("[Identity] Token URL indicates expiration"), I(!0), h("Your verification link has expired. Please restart.");
|
|
4199
4260
|
return;
|
|
4200
4261
|
}
|
|
4201
4262
|
} catch {
|
|
4202
4263
|
console.error("[Identity] Invalid token URL");
|
|
4203
4264
|
}
|
|
4204
4265
|
if (d.status === "expired" || d.error === "expired" || d.expired === !0) {
|
|
4205
|
-
console.warn("[Identity] Token object indicates expiration"),
|
|
4266
|
+
console.warn("[Identity] Token object indicates expiration"), I(!0), h("Your verification session has expired. Please restart.");
|
|
4206
4267
|
return;
|
|
4207
4268
|
}
|
|
4208
4269
|
}
|
|
4209
|
-
}, [d]),
|
|
4210
|
-
if (c !== null && d && !
|
|
4211
|
-
const
|
|
4270
|
+
}, [d]), G(() => {
|
|
4271
|
+
if (c !== null && d && !m && O && !A) {
|
|
4272
|
+
const D = c;
|
|
4212
4273
|
if (d.url) {
|
|
4213
|
-
console.log("[Identity] Loading provider URL for user verification:", d.url),
|
|
4274
|
+
console.log("[Identity] Loading provider URL for user verification:", d.url), h(null);
|
|
4214
4275
|
try {
|
|
4215
|
-
if (new URL(d.url),
|
|
4276
|
+
if (new URL(d.url), D === oe.SardinAI) {
|
|
4216
4277
|
console.log("[SardinAI] Initializing Risk SDK in background...");
|
|
4217
4278
|
try {
|
|
4218
|
-
const
|
|
4219
|
-
xe.createProvider(c,
|
|
4279
|
+
const b = xe.parseProviderConfig(c, d, i);
|
|
4280
|
+
xe.createProvider(c, b).initialize().then(() => {
|
|
4220
4281
|
console.log("[SardinAI] Risk SDK initialized successfully in background");
|
|
4221
|
-
}).catch((
|
|
4222
|
-
console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):",
|
|
4282
|
+
}).catch((V) => {
|
|
4283
|
+
console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):", V);
|
|
4223
4284
|
});
|
|
4224
|
-
} catch (
|
|
4225
|
-
console.warn("[SardinAI] Risk SDK setup failed (non-blocking):",
|
|
4285
|
+
} catch (b) {
|
|
4286
|
+
console.warn("[SardinAI] Risk SDK setup failed (non-blocking):", b);
|
|
4226
4287
|
}
|
|
4227
4288
|
}
|
|
4228
|
-
|
|
4229
|
-
} catch (
|
|
4230
|
-
console.error("[Identity] Invalid URL:",
|
|
4289
|
+
p({ type: "url", url: d.url });
|
|
4290
|
+
} catch (b) {
|
|
4291
|
+
console.error("[Identity] Invalid URL:", b), h("Invalid verification URL. Please restart."), I(!0);
|
|
4231
4292
|
}
|
|
4232
4293
|
return;
|
|
4233
4294
|
}
|
|
4234
|
-
if (
|
|
4235
|
-
console.log("[SardinAI] No URL provided - initializing Risk SDK only..."),
|
|
4295
|
+
if (D === oe.SardinAI) {
|
|
4296
|
+
console.log("[SardinAI] No URL provided - initializing Risk SDK only..."), h(null);
|
|
4236
4297
|
try {
|
|
4237
|
-
const
|
|
4298
|
+
const b = xe.parseProviderConfig(c, d, i), B = xe.createProvider(c, b);
|
|
4238
4299
|
B.initialize().then(() => {
|
|
4239
|
-
console.log("[SardinAI] Risk SDK initialized successfully"),
|
|
4300
|
+
console.log("[SardinAI] Risk SDK initialized successfully"), p(B), setTimeout(() => {
|
|
4240
4301
|
t == null || t();
|
|
4241
4302
|
}, 2e3);
|
|
4242
|
-
}).catch((
|
|
4303
|
+
}).catch((V) => {
|
|
4243
4304
|
var _;
|
|
4244
|
-
console.error("[SardinAI] Failed to initialize:",
|
|
4245
|
-
const X = ((_ =
|
|
4246
|
-
X.includes("expired") || X.includes("invalid") || X.includes("401") || X.includes("400") ? (
|
|
4305
|
+
console.error("[SardinAI] Failed to initialize:", V);
|
|
4306
|
+
const X = ((_ = V.message) == null ? void 0 : _.toLowerCase()) || "";
|
|
4307
|
+
X.includes("expired") || X.includes("invalid") || X.includes("401") || X.includes("400") ? (I(!0), h("Session expired or invalid. Please restart verification.")) : h(`Failed to initialize: ${V.message}`);
|
|
4247
4308
|
});
|
|
4248
|
-
} catch (
|
|
4249
|
-
console.error("[SardinAI] Error creating provider:",
|
|
4309
|
+
} catch (b) {
|
|
4310
|
+
console.error("[SardinAI] Error creating provider:", b), h(`Configuration error: ${b.message}`);
|
|
4250
4311
|
}
|
|
4251
4312
|
return;
|
|
4252
4313
|
}
|
|
4253
4314
|
try {
|
|
4254
|
-
|
|
4255
|
-
const
|
|
4256
|
-
|
|
4315
|
+
h(null);
|
|
4316
|
+
const b = xe.parseProviderConfig(c, d, i), B = xe.createProvider(c, b);
|
|
4317
|
+
D === oe.Sumsub ? (B.initialize("identity-container").catch((V) => {
|
|
4257
4318
|
var X;
|
|
4258
|
-
console.error("[Sumsub] Initialization error:",
|
|
4319
|
+
console.error("[Sumsub] Initialization error:", V), h(`Failed to initialize: ${V.message}`), (X = V.message) != null && X.toLowerCase().includes("expired") && I(!0);
|
|
4259
4320
|
}), B.onComplete && B.onComplete(() => {
|
|
4260
4321
|
t == null || t();
|
|
4261
|
-
})) :
|
|
4262
|
-
console.error("[Onfido] Initialization error:",
|
|
4263
|
-
}),
|
|
4264
|
-
} catch (
|
|
4265
|
-
console.error("[Identity] Provider setup error:",
|
|
4322
|
+
})) : D === oe.Onfido && B.initialize("identity-container").catch((V) => {
|
|
4323
|
+
console.error("[Onfido] Initialization error:", V), h(`Failed to initialize: ${V.message}`);
|
|
4324
|
+
}), p(B);
|
|
4325
|
+
} catch (b) {
|
|
4326
|
+
console.error("[Identity] Provider setup error:", b), h(`Setup error: ${b.message}`);
|
|
4266
4327
|
}
|
|
4267
4328
|
}
|
|
4268
4329
|
return () => {
|
|
4269
|
-
if (
|
|
4330
|
+
if (m && m.destroy)
|
|
4270
4331
|
try {
|
|
4271
|
-
|
|
4272
|
-
} catch (
|
|
4273
|
-
console.error("[Identity] Error destroying provider:",
|
|
4332
|
+
m.destroy();
|
|
4333
|
+
} catch (D) {
|
|
4334
|
+
console.error("[Identity] Error destroying provider:", D);
|
|
4274
4335
|
}
|
|
4275
4336
|
};
|
|
4276
|
-
}, [c, d,
|
|
4277
|
-
const
|
|
4337
|
+
}, [c, d, m, O, t, A]);
|
|
4338
|
+
const L = async () => {
|
|
4278
4339
|
try {
|
|
4279
|
-
|
|
4280
|
-
} catch (
|
|
4281
|
-
console.error("Error starting identity verification:",
|
|
4340
|
+
h(null), I(!1), await k(), W(!0);
|
|
4341
|
+
} catch (D) {
|
|
4342
|
+
console.error("Error starting identity verification:", D);
|
|
4282
4343
|
}
|
|
4283
|
-
},
|
|
4344
|
+
}, R = async () => {
|
|
4284
4345
|
try {
|
|
4285
|
-
|
|
4286
|
-
} catch (
|
|
4287
|
-
console.error("Error restarting identity verification:",
|
|
4346
|
+
h(null), I(!1), p(null), console.log("[Identity] Restarting verification..."), await g(), W(!0);
|
|
4347
|
+
} catch (D) {
|
|
4348
|
+
console.error("Error restarting identity verification:", D), h(D.message || "Failed to restart verification");
|
|
4288
4349
|
}
|
|
4289
4350
|
};
|
|
4290
4351
|
if (S || u)
|
|
@@ -4292,14 +4353,14 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4292
4353
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
4293
4354
|
/* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading identity verification..." })
|
|
4294
4355
|
] }) });
|
|
4295
|
-
if (
|
|
4356
|
+
if (w)
|
|
4296
4357
|
return /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
4297
4358
|
"Error: ",
|
|
4298
|
-
|
|
4359
|
+
w.message
|
|
4299
4360
|
] }) }) });
|
|
4300
|
-
if (
|
|
4361
|
+
if (O && (F || A))
|
|
4301
4362
|
return /* @__PURE__ */ o(M, { children: [
|
|
4302
|
-
/* @__PURE__ */ a(
|
|
4363
|
+
/* @__PURE__ */ a(re, { children: /* @__PURE__ */ a("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
|
|
4303
4364
|
/* @__PURE__ */ o(T, { children: [
|
|
4304
4365
|
/* @__PURE__ */ a("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg mb-6", children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
4305
4366
|
/* @__PURE__ */ a(
|
|
@@ -4321,8 +4382,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4321
4382
|
}
|
|
4322
4383
|
),
|
|
4323
4384
|
/* @__PURE__ */ o("div", { children: [
|
|
4324
|
-
/* @__PURE__ */ a("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-1", children:
|
|
4325
|
-
/* @__PURE__ */ a("p", { className: "text-red-800 dark:text-red-200 text-sm", children:
|
|
4385
|
+
/* @__PURE__ */ a("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-1", children: A ? "Session Expired" : "Verification Error" }),
|
|
4386
|
+
/* @__PURE__ */ a("p", { className: "text-red-800 dark:text-red-200 text-sm", children: F || "Your verification session has expired and needs to be restarted." })
|
|
4326
4387
|
] })
|
|
4327
4388
|
] }) }),
|
|
4328
4389
|
/* @__PURE__ */ o("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4", children: [
|
|
@@ -4334,15 +4395,15 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4334
4395
|
] })
|
|
4335
4396
|
] })
|
|
4336
4397
|
] }),
|
|
4337
|
-
/* @__PURE__ */ o(
|
|
4398
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
4338
4399
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4339
|
-
/* @__PURE__ */ a(U, { type: "button", onClick:
|
|
4400
|
+
/* @__PURE__ */ a(U, { type: "button", onClick: R, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
|
|
4340
4401
|
] })
|
|
4341
4402
|
] });
|
|
4342
|
-
if (
|
|
4343
|
-
const
|
|
4403
|
+
if (O && l) {
|
|
4404
|
+
const D = c;
|
|
4344
4405
|
return d != null && d.url ? /* @__PURE__ */ o(M, { children: [
|
|
4345
|
-
/* @__PURE__ */ a(
|
|
4406
|
+
/* @__PURE__ */ a(re, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
4346
4407
|
/* @__PURE__ */ o("div", { children: [
|
|
4347
4408
|
/* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
|
|
4348
4409
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
|
|
@@ -4353,7 +4414,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4353
4414
|
type: "button",
|
|
4354
4415
|
variant: "outline",
|
|
4355
4416
|
size: "sm",
|
|
4356
|
-
onClick:
|
|
4417
|
+
onClick: R,
|
|
4357
4418
|
disabled: u,
|
|
4358
4419
|
children: "Restart"
|
|
4359
4420
|
}
|
|
@@ -4371,14 +4432,14 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4371
4432
|
className: "w-full h-full border-0 rounded-lg",
|
|
4372
4433
|
allow: "camera; microphone; geolocation",
|
|
4373
4434
|
title: "Identity Verification",
|
|
4374
|
-
onLoad: (
|
|
4375
|
-
var B,
|
|
4435
|
+
onLoad: (b) => {
|
|
4436
|
+
var B, V, X;
|
|
4376
4437
|
console.log("[Identity] Iframe loaded");
|
|
4377
4438
|
try {
|
|
4378
|
-
const _ =
|
|
4439
|
+
const _ = b.target, Ie = _.contentDocument || ((B = _.contentWindow) == null ? void 0 : B.document);
|
|
4379
4440
|
if (Ie) {
|
|
4380
|
-
const me = ((X = (
|
|
4381
|
-
(me.includes("expired") || me.includes("invalid") || me.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"),
|
|
4441
|
+
const me = ((X = (V = Ie.body) == null ? void 0 : V.textContent) == null ? void 0 : X.toLowerCase()) || "";
|
|
4442
|
+
(me.includes("expired") || me.includes("invalid") || me.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"), I(!0), h("Your verification link has expired."));
|
|
4382
4443
|
}
|
|
4383
4444
|
} catch {
|
|
4384
4445
|
console.log("[Identity] Cannot check iframe content (CORS)");
|
|
@@ -4387,9 +4448,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4387
4448
|
}
|
|
4388
4449
|
) })
|
|
4389
4450
|
] }),
|
|
4390
|
-
r && /* @__PURE__ */ a(
|
|
4391
|
-
] }) :
|
|
4392
|
-
/* @__PURE__ */ o(
|
|
4451
|
+
r && /* @__PURE__ */ a(se, { children: /* @__PURE__ */ a(U, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4452
|
+
] }) : D === oe.SardinAI ? /* @__PURE__ */ o(M, { children: [
|
|
4453
|
+
/* @__PURE__ */ o(re, { children: [
|
|
4393
4454
|
/* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Device Risk Assessment" }),
|
|
4394
4455
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Analyzing device security and behavioral patterns..." })
|
|
4395
4456
|
] }),
|
|
@@ -4399,16 +4460,16 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4399
4460
|
/* @__PURE__ */ a("p", { className: "text-sm text-gray-500 dark:text-gray-500 mt-2", children: "This process is automatic and will complete in a few seconds" })
|
|
4400
4461
|
] }) })
|
|
4401
4462
|
] }) : /* @__PURE__ */ o(M, { children: [
|
|
4402
|
-
/* @__PURE__ */ o(
|
|
4463
|
+
/* @__PURE__ */ o(re, { children: [
|
|
4403
4464
|
/* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
|
|
4404
4465
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
|
|
4405
4466
|
] }),
|
|
4406
4467
|
/* @__PURE__ */ a(T, { children: /* @__PURE__ */ a("div", { id: "identity-container", className: "min-h-[400px]" }) }),
|
|
4407
|
-
r && /* @__PURE__ */ a(
|
|
4468
|
+
r && /* @__PURE__ */ a(se, { children: /* @__PURE__ */ a(U, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4408
4469
|
] });
|
|
4409
4470
|
}
|
|
4410
|
-
return /* @__PURE__ */ a("form", { onSubmit:
|
|
4411
|
-
/* @__PURE__ */ o(
|
|
4471
|
+
return /* @__PURE__ */ a("form", { onSubmit: q.handleSubmit(L), children: /* @__PURE__ */ o(M, { children: [
|
|
4472
|
+
/* @__PURE__ */ o(re, { children: [
|
|
4412
4473
|
/* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Review Your Information" }),
|
|
4413
4474
|
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please review and confirm your information before starting identity verification" })
|
|
4414
4475
|
] }),
|
|
@@ -4417,9 +4478,9 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4417
4478
|
/* @__PURE__ */ o("div", { children: [
|
|
4418
4479
|
/* @__PURE__ */ a("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
|
|
4419
4480
|
/* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
|
|
4420
|
-
(
|
|
4481
|
+
(Y = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : Y.firstName,
|
|
4421
4482
|
" ",
|
|
4422
|
-
(
|
|
4483
|
+
(x = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : x.lastName
|
|
4423
4484
|
] })
|
|
4424
4485
|
] }),
|
|
4425
4486
|
/* @__PURE__ */ o("div", { children: [
|
|
@@ -4437,18 +4498,18 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4437
4498
|
/* @__PURE__ */ a(
|
|
4438
4499
|
ye,
|
|
4439
4500
|
{
|
|
4440
|
-
control:
|
|
4501
|
+
control: q.control,
|
|
4441
4502
|
name: "country",
|
|
4442
|
-
render: ({ field:
|
|
4503
|
+
render: ({ field: D }) => /* @__PURE__ */ a(
|
|
4443
4504
|
ge,
|
|
4444
4505
|
{
|
|
4445
|
-
...
|
|
4506
|
+
...D,
|
|
4446
4507
|
label: "Country",
|
|
4447
4508
|
options: [
|
|
4448
4509
|
{ value: "", label: "Select country..." },
|
|
4449
|
-
...
|
|
4450
|
-
value:
|
|
4451
|
-
label:
|
|
4510
|
+
...y.map((b) => ({
|
|
4511
|
+
value: b.abbreviation3 || b.abbreviation,
|
|
4512
|
+
label: b.name
|
|
4452
4513
|
}))
|
|
4453
4514
|
]
|
|
4454
4515
|
}
|
|
@@ -4458,18 +4519,18 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4458
4519
|
/* @__PURE__ */ a(
|
|
4459
4520
|
ye,
|
|
4460
4521
|
{
|
|
4461
|
-
control:
|
|
4522
|
+
control: q.control,
|
|
4462
4523
|
name: "nationality",
|
|
4463
|
-
render: ({ field:
|
|
4524
|
+
render: ({ field: D }) => /* @__PURE__ */ a(
|
|
4464
4525
|
ge,
|
|
4465
4526
|
{
|
|
4466
|
-
...
|
|
4527
|
+
...D,
|
|
4467
4528
|
label: "Nationality",
|
|
4468
4529
|
options: [
|
|
4469
4530
|
{ value: "", label: "Select nationality..." },
|
|
4470
|
-
...
|
|
4471
|
-
value:
|
|
4472
|
-
label:
|
|
4531
|
+
...y.map((b) => ({
|
|
4532
|
+
value: b.abbreviation3 || b.abbreviation,
|
|
4533
|
+
label: b.name
|
|
4473
4534
|
}))
|
|
4474
4535
|
]
|
|
4475
4536
|
}
|
|
@@ -4481,17 +4542,17 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4481
4542
|
/* @__PURE__ */ a(
|
|
4482
4543
|
ye,
|
|
4483
4544
|
{
|
|
4484
|
-
control:
|
|
4545
|
+
control: q.control,
|
|
4485
4546
|
name: "street",
|
|
4486
|
-
render: ({ field:
|
|
4547
|
+
render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "Street" })
|
|
4487
4548
|
}
|
|
4488
4549
|
),
|
|
4489
4550
|
/* @__PURE__ */ a(
|
|
4490
4551
|
ye,
|
|
4491
4552
|
{
|
|
4492
|
-
control:
|
|
4553
|
+
control: q.control,
|
|
4493
4554
|
name: "streetNumber",
|
|
4494
|
-
render: ({ field:
|
|
4555
|
+
render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "Street Number" })
|
|
4495
4556
|
}
|
|
4496
4557
|
)
|
|
4497
4558
|
] }),
|
|
@@ -4499,31 +4560,31 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4499
4560
|
/* @__PURE__ */ a(
|
|
4500
4561
|
ye,
|
|
4501
4562
|
{
|
|
4502
|
-
control:
|
|
4563
|
+
control: q.control,
|
|
4503
4564
|
name: "city",
|
|
4504
|
-
render: ({ field:
|
|
4565
|
+
render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "City" })
|
|
4505
4566
|
}
|
|
4506
4567
|
),
|
|
4507
4568
|
/* @__PURE__ */ a(
|
|
4508
4569
|
ye,
|
|
4509
4570
|
{
|
|
4510
|
-
control:
|
|
4571
|
+
control: q.control,
|
|
4511
4572
|
name: "zip",
|
|
4512
|
-
render: ({ field:
|
|
4573
|
+
render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "ZIP/Postal Code" })
|
|
4513
4574
|
}
|
|
4514
4575
|
)
|
|
4515
4576
|
] }),
|
|
4516
4577
|
/* @__PURE__ */ a(
|
|
4517
4578
|
ye,
|
|
4518
4579
|
{
|
|
4519
|
-
control:
|
|
4580
|
+
control: q.control,
|
|
4520
4581
|
name: "phonenumber",
|
|
4521
|
-
render: ({ field:
|
|
4582
|
+
render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "Phone Number", type: "tel" })
|
|
4522
4583
|
}
|
|
4523
4584
|
)
|
|
4524
4585
|
] })
|
|
4525
4586
|
] }),
|
|
4526
|
-
/* @__PURE__ */ o(
|
|
4587
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
4527
4588
|
r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4528
4589
|
/* @__PURE__ */ a(U, { type: "submit", isLoading: u, children: "Confirm and Start Verification" })
|
|
4529
4590
|
] })
|
|
@@ -4661,7 +4722,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4661
4722
|
] })
|
|
4662
4723
|
] }) })
|
|
4663
4724
|
] }),
|
|
4664
|
-
/* @__PURE__ */ o(
|
|
4725
|
+
/* @__PURE__ */ o(se, { className: "flex justify-center gap-4", children: [
|
|
4665
4726
|
c.type === "success" && s && /* @__PURE__ */ a(U, { onClick: s, size: "lg", children: "Continue" }),
|
|
4666
4727
|
c.type === "error" && /* @__PURE__ */ o(Qe, { children: [
|
|
4667
4728
|
i && /* @__PURE__ */ a(U, { variant: "outline", onClick: i, children: "Contact Support" }),
|
|
@@ -4690,7 +4751,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4690
4751
|
subtitle: t,
|
|
4691
4752
|
className: r = ""
|
|
4692
4753
|
}) => {
|
|
4693
|
-
const { currentTheme: n } =
|
|
4754
|
+
const { currentTheme: n } = ie(), s = e || (n == null ? void 0 : n.title) || "", i = !!(n != null && n.logo && n.logo.visible && n.logo.url), l = !!s;
|
|
4694
4755
|
return !i && !l ? null : /* @__PURE__ */ o("div", { className: `metakyc-header ${r}`, children: [
|
|
4695
4756
|
/* @__PURE__ */ o("div", { className: "metakyc-header-title flex items-center text-xl font-bold text-gray-900 dark:text-white", children: [
|
|
4696
4757
|
i && /* @__PURE__ */ a(br, { config: n.logo }),
|
|
@@ -4706,33 +4767,33 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4706
4767
|
] }),
|
|
4707
4768
|
t && /* @__PURE__ */ a("p", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: t })
|
|
4708
4769
|
] });
|
|
4709
|
-
},
|
|
4770
|
+
}, Br = ({
|
|
4710
4771
|
workflowKey: e,
|
|
4711
4772
|
externalRefId: t,
|
|
4712
4773
|
onSuccess: r,
|
|
4713
4774
|
onCancel: n
|
|
4714
4775
|
}) => {
|
|
4715
|
-
var
|
|
4716
|
-
const { config: s, baseInformationService: i, currentTheme: l } =
|
|
4776
|
+
var L, R, Y;
|
|
4777
|
+
const { config: s, baseInformationService: i, currentTheme: l } = ie(), { createApplicant: c, isLoading: d } = Wt(), [u, w] = v([]), [k, g] = v(!0), [m, p] = v(!1), [N, f] = v(null), y = Q(!1), E = Q(!1), S = e || ((L = s.applicantForm) == null ? void 0 : L.workflowKey);
|
|
4717
4778
|
if (!S)
|
|
4718
4779
|
throw new Error(
|
|
4719
4780
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
4720
4781
|
);
|
|
4721
|
-
const
|
|
4722
|
-
const
|
|
4782
|
+
const C = t || ((R = s.applicantForm) == null ? void 0 : R.externalRefId) || "", O = ["firstName", "lastName", "email", "phonenumber", "dateOfBirth"], W = te.useMemo(() => {
|
|
4783
|
+
const x = new Set(O), P = l == null ? void 0 : l.applicantFormRequiredFields;
|
|
4723
4784
|
if (P && P.length > 0)
|
|
4724
4785
|
for (const $ of P)
|
|
4725
|
-
|
|
4726
|
-
return Array.from(
|
|
4727
|
-
}, [l == null ? void 0 : l.applicantFormRequiredFields]),
|
|
4786
|
+
x.add($);
|
|
4787
|
+
return Array.from(x);
|
|
4788
|
+
}, [l == null ? void 0 : l.applicantFormRequiredFields]), F = te.useMemo(() => {
|
|
4728
4789
|
var $;
|
|
4729
|
-
let
|
|
4730
|
-
($ = s.applicantForm) != null && $.visibleFields ?
|
|
4731
|
-
const P = new Set(
|
|
4732
|
-
for (const
|
|
4733
|
-
P.add(
|
|
4790
|
+
let x;
|
|
4791
|
+
($ = s.applicantForm) != null && $.visibleFields ? x = s.applicantForm.visibleFields : l != null && l.applicantFormVisibleFields && l.applicantFormVisibleFields.length > 0 ? x = l.applicantFormVisibleFields : x = ot;
|
|
4792
|
+
const P = new Set(x);
|
|
4793
|
+
for (const D of O)
|
|
4794
|
+
P.add(D);
|
|
4734
4795
|
return Array.from(P);
|
|
4735
|
-
}, [(
|
|
4796
|
+
}, [(Y = s.applicantForm) == null ? void 0 : Y.visibleFields, l == null ? void 0 : l.applicantFormVisibleFields]), [h, A] = v({
|
|
4736
4797
|
workflowKey: S,
|
|
4737
4798
|
firstName: "",
|
|
4738
4799
|
lastName: "",
|
|
@@ -4740,7 +4801,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4740
4801
|
email: "",
|
|
4741
4802
|
dateOfBirth: "",
|
|
4742
4803
|
phonenumber: "",
|
|
4743
|
-
externalRefId:
|
|
4804
|
+
externalRefId: C,
|
|
4744
4805
|
// Set from config or prop
|
|
4745
4806
|
mobileCountryCode: "",
|
|
4746
4807
|
street: "",
|
|
@@ -4759,91 +4820,91 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4759
4820
|
occupation: "",
|
|
4760
4821
|
taxNumber: ""
|
|
4761
4822
|
});
|
|
4762
|
-
|
|
4823
|
+
G(() => {
|
|
4763
4824
|
(async () => {
|
|
4764
|
-
if (
|
|
4825
|
+
if (y.current || E.current) {
|
|
4765
4826
|
console.log("[CreateApplicant] Countries already loading or loaded, skipping...");
|
|
4766
4827
|
return;
|
|
4767
4828
|
}
|
|
4768
|
-
|
|
4829
|
+
y.current = !0, g(!0);
|
|
4769
4830
|
try {
|
|
4770
|
-
const P = await i.getCountries("", s.locale || "en"), $ = /* @__PURE__ */ new Set(),
|
|
4771
|
-
value:
|
|
4772
|
-
label:
|
|
4773
|
-
})).filter((
|
|
4774
|
-
|
|
4831
|
+
const P = await i.getCountries("", s.locale || "en"), $ = /* @__PURE__ */ new Set(), D = P.map((b) => ({
|
|
4832
|
+
value: b.abbreviation3 || b.abbreviation,
|
|
4833
|
+
label: b.name
|
|
4834
|
+
})).filter((b) => !b.value || $.has(b.value) ? !1 : ($.add(b.value), !0));
|
|
4835
|
+
w(D), E.current = !0;
|
|
4775
4836
|
} catch (P) {
|
|
4776
4837
|
console.error("Failed to load countries:", P);
|
|
4777
4838
|
} finally {
|
|
4778
|
-
|
|
4839
|
+
g(!1), y.current = !1;
|
|
4779
4840
|
}
|
|
4780
4841
|
})();
|
|
4781
4842
|
}, []);
|
|
4782
|
-
const
|
|
4783
|
-
|
|
4784
|
-
},
|
|
4843
|
+
const I = (x, P) => {
|
|
4844
|
+
A(($) => ({ ...$, [x]: P }));
|
|
4845
|
+
}, H = async (x) => {
|
|
4785
4846
|
var P;
|
|
4786
|
-
|
|
4847
|
+
x.preventDefault(), p(!0), f(null);
|
|
4787
4848
|
try {
|
|
4788
|
-
if (!
|
|
4789
|
-
|
|
4849
|
+
if (!h.externalRefId || h.externalRefId.trim() === "") {
|
|
4850
|
+
f("External Reference ID is required. Please pass it via config.applicantForm.externalRefId."), p(!1);
|
|
4790
4851
|
return;
|
|
4791
4852
|
}
|
|
4792
|
-
for (const
|
|
4793
|
-
const B =
|
|
4853
|
+
for (const b of W) {
|
|
4854
|
+
const B = h[b];
|
|
4794
4855
|
if (B == null || B === "" || Array.isArray(B) && B.length === 0) {
|
|
4795
|
-
const X = ((P =
|
|
4796
|
-
|
|
4856
|
+
const X = ((P = Pe[b]) == null ? void 0 : P.label) || b;
|
|
4857
|
+
f(`${X} is required.`), p(!1);
|
|
4797
4858
|
return;
|
|
4798
4859
|
}
|
|
4799
4860
|
}
|
|
4800
4861
|
const $ = {
|
|
4801
|
-
workflowKey:
|
|
4802
|
-
externalRefId:
|
|
4862
|
+
workflowKey: h.workflowKey,
|
|
4863
|
+
externalRefId: h.externalRefId.trim()
|
|
4803
4864
|
// Always include, never empty
|
|
4804
4865
|
};
|
|
4805
|
-
|
|
4806
|
-
if (
|
|
4807
|
-
const B =
|
|
4808
|
-
B != null && B !== "" && !(Array.isArray(B) && B.length === 0) && ($[
|
|
4866
|
+
F.forEach((b) => {
|
|
4867
|
+
if (b === "externalRefId") return;
|
|
4868
|
+
const B = h[b];
|
|
4869
|
+
B != null && B !== "" && !(Array.isArray(B) && B.length === 0) && ($[b] = B);
|
|
4809
4870
|
}), console.log("Creating applicant with data:", $);
|
|
4810
|
-
const
|
|
4871
|
+
const D = await c(
|
|
4811
4872
|
$
|
|
4812
4873
|
);
|
|
4813
|
-
console.log("Applicant created:",
|
|
4874
|
+
console.log("Applicant created:", D), r(D.applicantId);
|
|
4814
4875
|
} catch ($) {
|
|
4815
|
-
console.error("Error creating applicant:", $),
|
|
4876
|
+
console.error("Error creating applicant:", $), f($.message || "Failed to create applicant");
|
|
4816
4877
|
} finally {
|
|
4817
|
-
|
|
4878
|
+
p(!1);
|
|
4818
4879
|
}
|
|
4819
|
-
},
|
|
4820
|
-
var
|
|
4821
|
-
const P =
|
|
4880
|
+
}, q = (x) => {
|
|
4881
|
+
var D;
|
|
4882
|
+
const P = Pe[x], $ = W.includes(x);
|
|
4822
4883
|
switch (P.type) {
|
|
4823
4884
|
case "select":
|
|
4824
|
-
if (
|
|
4885
|
+
if (x === "country" || x === "nationality" || x === "taxCountry" || x === "countryOfBirth")
|
|
4825
4886
|
return /* @__PURE__ */ a(
|
|
4826
4887
|
ge,
|
|
4827
4888
|
{
|
|
4828
4889
|
label: P.label,
|
|
4829
|
-
value:
|
|
4830
|
-
onChange: (
|
|
4890
|
+
value: h[x] || "",
|
|
4891
|
+
onChange: (b) => I(x, b.target.value),
|
|
4831
4892
|
options: [
|
|
4832
4893
|
{ value: "", label: `Select ${P.label.toLowerCase()}...` },
|
|
4833
4894
|
...u
|
|
4834
4895
|
],
|
|
4835
|
-
disabled:
|
|
4896
|
+
disabled: k,
|
|
4836
4897
|
required: $
|
|
4837
4898
|
},
|
|
4838
|
-
|
|
4899
|
+
x
|
|
4839
4900
|
);
|
|
4840
|
-
if (
|
|
4901
|
+
if (x === "salutation")
|
|
4841
4902
|
return /* @__PURE__ */ a(
|
|
4842
4903
|
ge,
|
|
4843
4904
|
{
|
|
4844
4905
|
label: P.label,
|
|
4845
|
-
value: ((
|
|
4846
|
-
onChange: (
|
|
4906
|
+
value: ((D = h[x]) == null ? void 0 : D.toString()) || "",
|
|
4907
|
+
onChange: (b) => I(x, b.target.value ? Number(b.target.value) : null),
|
|
4847
4908
|
options: [
|
|
4848
4909
|
{ value: "", label: "Select salutation..." },
|
|
4849
4910
|
{ value: Ce.Male.toString(), label: "Male" },
|
|
@@ -4852,96 +4913,96 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4852
4913
|
],
|
|
4853
4914
|
required: $
|
|
4854
4915
|
},
|
|
4855
|
-
|
|
4916
|
+
x
|
|
4856
4917
|
);
|
|
4857
|
-
if (
|
|
4858
|
-
const
|
|
4918
|
+
if (x === "defaultLanguage") {
|
|
4919
|
+
const b = l != null && l.allowedLanguages && l.allowedLanguages.length > 0 ? Le.filter((B) => l.allowedLanguages.includes(B.value)) : Le;
|
|
4859
4920
|
return /* @__PURE__ */ a(
|
|
4860
4921
|
ge,
|
|
4861
4922
|
{
|
|
4862
4923
|
label: P.label,
|
|
4863
|
-
value:
|
|
4864
|
-
onChange: (B) =>
|
|
4924
|
+
value: h[x] || "",
|
|
4925
|
+
onChange: (B) => I(x, B.target.value),
|
|
4865
4926
|
options: [
|
|
4866
4927
|
{ value: "", label: "Select language..." },
|
|
4867
|
-
...
|
|
4928
|
+
...b
|
|
4868
4929
|
],
|
|
4869
4930
|
required: $
|
|
4870
4931
|
},
|
|
4871
|
-
|
|
4932
|
+
x
|
|
4872
4933
|
);
|
|
4873
4934
|
}
|
|
4874
4935
|
return null;
|
|
4875
4936
|
case "multiselect":
|
|
4876
|
-
return
|
|
4937
|
+
return x === "otherNationality" ? /* @__PURE__ */ a(
|
|
4877
4938
|
Qt,
|
|
4878
4939
|
{
|
|
4879
4940
|
label: P.label,
|
|
4880
|
-
value:
|
|
4881
|
-
onChange: (
|
|
4941
|
+
value: h[x] || [],
|
|
4942
|
+
onChange: (b) => I(x, b),
|
|
4882
4943
|
options: u,
|
|
4883
4944
|
placeholder: "Select other nationalities...",
|
|
4884
|
-
disabled:
|
|
4945
|
+
disabled: k,
|
|
4885
4946
|
required: $
|
|
4886
4947
|
},
|
|
4887
|
-
|
|
4948
|
+
x
|
|
4888
4949
|
) : null;
|
|
4889
4950
|
case "date":
|
|
4890
4951
|
return /* @__PURE__ */ a(
|
|
4891
|
-
|
|
4952
|
+
ne,
|
|
4892
4953
|
{
|
|
4893
4954
|
type: "date",
|
|
4894
4955
|
label: P.label,
|
|
4895
|
-
value:
|
|
4896
|
-
onChange: (
|
|
4956
|
+
value: h[x] || "",
|
|
4957
|
+
onChange: (b) => I(x, b.target.value),
|
|
4897
4958
|
required: $
|
|
4898
4959
|
},
|
|
4899
|
-
|
|
4960
|
+
x
|
|
4900
4961
|
);
|
|
4901
4962
|
case "email":
|
|
4902
4963
|
return /* @__PURE__ */ a(
|
|
4903
|
-
|
|
4964
|
+
ne,
|
|
4904
4965
|
{
|
|
4905
4966
|
type: "email",
|
|
4906
4967
|
label: P.label,
|
|
4907
|
-
value:
|
|
4908
|
-
onChange: (
|
|
4968
|
+
value: h[x] || "",
|
|
4969
|
+
onChange: (b) => I(x, b.target.value),
|
|
4909
4970
|
required: $
|
|
4910
4971
|
},
|
|
4911
|
-
|
|
4972
|
+
x
|
|
4912
4973
|
);
|
|
4913
4974
|
case "tel":
|
|
4914
4975
|
return /* @__PURE__ */ a(
|
|
4915
|
-
|
|
4976
|
+
ne,
|
|
4916
4977
|
{
|
|
4917
4978
|
type: "tel",
|
|
4918
4979
|
label: P.label,
|
|
4919
|
-
value:
|
|
4920
|
-
onChange: (
|
|
4980
|
+
value: h[x] || "",
|
|
4981
|
+
onChange: (b) => I(x, b.target.value),
|
|
4921
4982
|
required: $
|
|
4922
4983
|
},
|
|
4923
|
-
|
|
4984
|
+
x
|
|
4924
4985
|
);
|
|
4925
4986
|
case "text":
|
|
4926
4987
|
default:
|
|
4927
4988
|
return /* @__PURE__ */ a(
|
|
4928
|
-
|
|
4989
|
+
ne,
|
|
4929
4990
|
{
|
|
4930
4991
|
type: "text",
|
|
4931
4992
|
label: P.label,
|
|
4932
|
-
value:
|
|
4933
|
-
onChange: (
|
|
4993
|
+
value: h[x] || "",
|
|
4994
|
+
onChange: (b) => I(x, b.target.value),
|
|
4934
4995
|
required: $
|
|
4935
4996
|
},
|
|
4936
|
-
|
|
4997
|
+
x
|
|
4937
4998
|
);
|
|
4938
4999
|
}
|
|
4939
5000
|
};
|
|
4940
|
-
return
|
|
5001
|
+
return k ? /* @__PURE__ */ a("div", { className: "metakyc-sdk", children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
|
|
4941
5002
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
4942
5003
|
/* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading form..." })
|
|
4943
|
-
] }) }) }) : /* @__PURE__ */ a("div", { className: "metakyc-sdk", children: /* @__PURE__ */ a("form", { onSubmit:
|
|
4944
|
-
/* @__PURE__ */ a(
|
|
5004
|
+
] }) }) }) : /* @__PURE__ */ a("div", { className: "metakyc-sdk", children: /* @__PURE__ */ a("form", { onSubmit: H, children: /* @__PURE__ */ o(M, { children: [
|
|
5005
|
+
/* @__PURE__ */ a(re, { children: /* @__PURE__ */ a(
|
|
4945
5006
|
Ke,
|
|
4946
5007
|
{
|
|
4947
5008
|
title: "Create Applicant",
|
|
@@ -4954,11 +5015,11 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4954
5015
|
" ",
|
|
4955
5016
|
N
|
|
4956
5017
|
] }) }),
|
|
4957
|
-
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
5018
|
+
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: F.map((x) => q(x)) })
|
|
4958
5019
|
] }),
|
|
4959
|
-
/* @__PURE__ */ o(
|
|
4960
|
-
n && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: n, disabled:
|
|
4961
|
-
/* @__PURE__ */ a(U, { type: "submit", isLoading:
|
|
5020
|
+
/* @__PURE__ */ o(se, { className: "flex justify-between", children: [
|
|
5021
|
+
n && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: n, disabled: m || d, children: "Cancel" }),
|
|
5022
|
+
/* @__PURE__ */ a(U, { type: "submit", isLoading: m || d, children: "Create Applicant" })
|
|
4962
5023
|
] })
|
|
4963
5024
|
] }) }) });
|
|
4964
5025
|
}, zr = ({
|
|
@@ -4974,31 +5035,31 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4974
5035
|
steps: c,
|
|
4975
5036
|
workflowKey: d,
|
|
4976
5037
|
nextWorkflowKey: u,
|
|
4977
|
-
hasWorkflowChanged:
|
|
4978
|
-
isLoading:
|
|
4979
|
-
error:
|
|
4980
|
-
moveBack:
|
|
4981
|
-
refreshProgress:
|
|
4982
|
-
} = Ut(e), [N,
|
|
4983
|
-
if (
|
|
4984
|
-
|
|
4985
|
-
}, [
|
|
5038
|
+
hasWorkflowChanged: w,
|
|
5039
|
+
isLoading: k,
|
|
5040
|
+
error: g,
|
|
5041
|
+
moveBack: m,
|
|
5042
|
+
refreshProgress: p
|
|
5043
|
+
} = Ut(e), [N, f] = te.useState(!1);
|
|
5044
|
+
if (te.useEffect(() => {
|
|
5045
|
+
g && r && r(g);
|
|
5046
|
+
}, [g, r]), te.useEffect(() => {
|
|
4986
5047
|
i != null && i.workflowResult && t && t(i.workflowResult);
|
|
4987
|
-
}, [i == null ? void 0 : i.workflowResult, t]),
|
|
5048
|
+
}, [i == null ? void 0 : i.workflowResult, t]), te.useEffect(() => {
|
|
4988
5049
|
n === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
4989
|
-
}, [n]),
|
|
4990
|
-
|
|
4991
|
-
}, [
|
|
5050
|
+
}, [n]), te.useEffect(() => {
|
|
5051
|
+
w && f(!1);
|
|
5052
|
+
}, [w]), k || !i)
|
|
4992
5053
|
return /* @__PURE__ */ a("div", { className: s, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
|
|
4993
5054
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
4994
5055
|
/* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading workflow..." })
|
|
4995
5056
|
] }) }) });
|
|
4996
|
-
if (
|
|
5057
|
+
if (g)
|
|
4997
5058
|
return /* @__PURE__ */ a("div", { className: s, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
4998
5059
|
/* @__PURE__ */ a("p", { className: "text-danger-500 text-lg mb-4", children: "An error occurred" }),
|
|
4999
|
-
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children:
|
|
5060
|
+
/* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: g.message })
|
|
5000
5061
|
] }) }) }) });
|
|
5001
|
-
if (
|
|
5062
|
+
if (w && !N)
|
|
5002
5063
|
return /* @__PURE__ */ a("div", { className: `metakyc-sdk ${s || ""}`, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
5003
5064
|
/* @__PURE__ */ a("div", { className: "mb-6", children: /* @__PURE__ */ a("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__ */ a("svg", { className: "w-8 h-8 text-blue-600 dark:text-blue-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("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" }) }) }) }),
|
|
5004
5065
|
/* @__PURE__ */ a("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white mb-2", children: "Workflow Transition" }),
|
|
@@ -5020,7 +5081,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5020
5081
|
/* @__PURE__ */ a(
|
|
5021
5082
|
"button",
|
|
5022
5083
|
{
|
|
5023
|
-
onClick: () =>
|
|
5084
|
+
onClick: () => f(!0),
|
|
5024
5085
|
className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",
|
|
5025
5086
|
children: "Continue with New Workflow"
|
|
5026
5087
|
}
|
|
@@ -5045,97 +5106,97 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5045
5106
|
/* @__PURE__ */ a(ce, { className: "my-8" }),
|
|
5046
5107
|
/* @__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..." })
|
|
5047
5108
|
] }) }) });
|
|
5048
|
-
const
|
|
5049
|
-
switch (
|
|
5050
|
-
case
|
|
5109
|
+
const y = (C) => {
|
|
5110
|
+
switch (C) {
|
|
5111
|
+
case z.Overview:
|
|
5051
5112
|
return "Overview";
|
|
5052
|
-
case
|
|
5113
|
+
case z.Questionaries:
|
|
5053
5114
|
return "Questionnaire";
|
|
5054
|
-
case
|
|
5115
|
+
case z.UploadDocument:
|
|
5055
5116
|
return "Documents";
|
|
5056
|
-
case
|
|
5117
|
+
case z.IdentitySdk:
|
|
5057
5118
|
return "Identity";
|
|
5058
|
-
case
|
|
5119
|
+
case z.RiskScoring:
|
|
5059
5120
|
return "Risk Assessment";
|
|
5060
|
-
case
|
|
5121
|
+
case z.InvestorCategorization:
|
|
5061
5122
|
return "Investor Categorization";
|
|
5062
|
-
case
|
|
5123
|
+
case z.AppropriatenessTest:
|
|
5063
5124
|
return "Appropriateness Test";
|
|
5064
|
-
case
|
|
5125
|
+
case z.AdditionalData:
|
|
5065
5126
|
return "Additional Data";
|
|
5066
|
-
case
|
|
5127
|
+
case z.ManualReview:
|
|
5067
5128
|
return "Review";
|
|
5068
5129
|
default:
|
|
5069
5130
|
return "";
|
|
5070
5131
|
}
|
|
5071
5132
|
}, E = () => {
|
|
5072
|
-
const
|
|
5133
|
+
const C = c.filter((h) => h.visibility !== !1), O = C.findIndex((h) => h.order === l.order), W = O >= 0 ? O + 1 : 1, F = C.length;
|
|
5073
5134
|
return /* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
5074
5135
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-4", children: [
|
|
5075
5136
|
/* @__PURE__ */ a(Ke, {}),
|
|
5076
5137
|
/* @__PURE__ */ o(pe, { variant: i.status === 1 ? "info" : "success", children: [
|
|
5077
5138
|
"Step ",
|
|
5078
|
-
|
|
5139
|
+
W,
|
|
5079
5140
|
" of ",
|
|
5080
|
-
|
|
5141
|
+
F
|
|
5081
5142
|
] })
|
|
5082
5143
|
] }),
|
|
5083
|
-
/* @__PURE__ */ a("div", { className: "flex items-center", children:
|
|
5084
|
-
const
|
|
5085
|
-
return /* @__PURE__ */ o(
|
|
5144
|
+
/* @__PURE__ */ a("div", { className: "flex items-center", children: C.map((h, A) => {
|
|
5145
|
+
const I = A < O, H = h.order === l.order;
|
|
5146
|
+
return /* @__PURE__ */ o(te.Fragment, { children: [
|
|
5086
5147
|
/* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
5087
5148
|
/* @__PURE__ */ a(
|
|
5088
5149
|
"div",
|
|
5089
5150
|
{
|
|
5090
5151
|
className: `
|
|
5091
5152
|
w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium
|
|
5092
|
-
${
|
|
5153
|
+
${I || H ? "bg-primary-500 text-white" : "bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-400"}
|
|
5093
5154
|
`,
|
|
5094
|
-
children:
|
|
5155
|
+
children: A + 1
|
|
5095
5156
|
}
|
|
5096
5157
|
),
|
|
5097
5158
|
/* @__PURE__ */ a(
|
|
5098
5159
|
"span",
|
|
5099
5160
|
{
|
|
5100
|
-
className: `ml-2 text-sm ${
|
|
5101
|
-
children:
|
|
5161
|
+
className: `ml-2 text-sm ${H ? "font-semibold text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"}`,
|
|
5162
|
+
children: h.displayName || h.name || y(h.action) || `Step ${A + 1}`
|
|
5102
5163
|
}
|
|
5103
5164
|
)
|
|
5104
5165
|
] }),
|
|
5105
|
-
|
|
5166
|
+
A < C.length - 1 && /* @__PURE__ */ a(
|
|
5106
5167
|
"div",
|
|
5107
5168
|
{
|
|
5108
|
-
className: `flex-1 h-0.5 mx-4 ${
|
|
5169
|
+
className: `flex-1 h-0.5 mx-4 ${I ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
|
|
5109
5170
|
}
|
|
5110
5171
|
)
|
|
5111
|
-
] },
|
|
5172
|
+
] }, h.order);
|
|
5112
5173
|
}) })
|
|
5113
5174
|
] });
|
|
5114
5175
|
}, S = () => {
|
|
5115
|
-
const
|
|
5176
|
+
const C = {
|
|
5116
5177
|
applicantId: e,
|
|
5117
5178
|
onComplete: async () => {
|
|
5118
|
-
await
|
|
5179
|
+
await p();
|
|
5119
5180
|
},
|
|
5120
|
-
onBack: l.order > 0 ?
|
|
5181
|
+
onBack: l.order > 0 ? m : void 0
|
|
5121
5182
|
};
|
|
5122
5183
|
switch (l.action) {
|
|
5123
|
-
case
|
|
5124
|
-
return /* @__PURE__ */ a(ir, { ...
|
|
5125
|
-
case
|
|
5126
|
-
return /* @__PURE__ */ a(lr, { ...
|
|
5127
|
-
case
|
|
5128
|
-
return /* @__PURE__ */ a(cr, { ...
|
|
5129
|
-
case
|
|
5130
|
-
return /* @__PURE__ */ a(fr, { ...
|
|
5131
|
-
case
|
|
5132
|
-
return /* @__PURE__ */ a(pr, { ...
|
|
5133
|
-
case
|
|
5134
|
-
case
|
|
5135
|
-
return /* @__PURE__ */ a(gr, { ...
|
|
5136
|
-
case
|
|
5137
|
-
return /* @__PURE__ */ a(yr, { ...
|
|
5138
|
-
case
|
|
5184
|
+
case z.Questionaries:
|
|
5185
|
+
return /* @__PURE__ */ a(ir, { ...C });
|
|
5186
|
+
case z.UploadDocument:
|
|
5187
|
+
return /* @__PURE__ */ a(lr, { ...C });
|
|
5188
|
+
case z.Overview:
|
|
5189
|
+
return /* @__PURE__ */ a(cr, { ...C });
|
|
5190
|
+
case z.IdentitySdk:
|
|
5191
|
+
return /* @__PURE__ */ a(fr, { ...C });
|
|
5192
|
+
case z.RiskScoring:
|
|
5193
|
+
return /* @__PURE__ */ a(pr, { ...C });
|
|
5194
|
+
case z.AdditionalData:
|
|
5195
|
+
case z.InvestorCategorization:
|
|
5196
|
+
return /* @__PURE__ */ a(gr, { ...C });
|
|
5197
|
+
case z.AppropriatenessTest:
|
|
5198
|
+
return /* @__PURE__ */ a(yr, { ...C });
|
|
5199
|
+
case z.ManualReview:
|
|
5139
5200
|
return /* @__PURE__ */ a(
|
|
5140
5201
|
Te,
|
|
5141
5202
|
{
|
|
@@ -5154,7 +5215,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
5154
5215
|
] }),
|
|
5155
5216
|
/* @__PURE__ */ o("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
5156
5217
|
"Action type: ",
|
|
5157
|
-
|
|
5218
|
+
z[l.action]
|
|
5158
5219
|
] })
|
|
5159
5220
|
] }) });
|
|
5160
5221
|
}
|
|
@@ -5211,9 +5272,9 @@ function Kr(e) {
|
|
|
5211
5272
|
t[n] = vr();
|
|
5212
5273
|
}), ue.object(t);
|
|
5213
5274
|
}
|
|
5214
|
-
const
|
|
5275
|
+
const qr = ue.any();
|
|
5215
5276
|
export {
|
|
5216
|
-
|
|
5277
|
+
Le as ALLOWED_LANGUAGES,
|
|
5217
5278
|
Ir as ALL_APPLICANT_FIELDS,
|
|
5218
5279
|
Ge as ApplicantProgressOnHoldReason,
|
|
5219
5280
|
le as ApplicantProgressStatus,
|
|
@@ -5227,16 +5288,16 @@ export {
|
|
|
5227
5288
|
U as Button,
|
|
5228
5289
|
M as Card,
|
|
5229
5290
|
T as CardContent,
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5291
|
+
se as CardFooter,
|
|
5292
|
+
re as CardHeader,
|
|
5293
|
+
Br as CreateApplicantForm,
|
|
5233
5294
|
st as CriteriaBuiltInType,
|
|
5234
5295
|
ot as DEFAULT_VISIBLE_FIELDS,
|
|
5235
5296
|
rt as DocumentReviewStatus,
|
|
5236
5297
|
ct as EndpointBuilder,
|
|
5237
5298
|
we as ErrorHandler,
|
|
5238
5299
|
It as EventEmitter,
|
|
5239
|
-
|
|
5300
|
+
Pe as FIELD_METADATA,
|
|
5240
5301
|
tt as FileType,
|
|
5241
5302
|
Vt as FileUpload,
|
|
5242
5303
|
Ce as GenderType,
|
|
@@ -5246,21 +5307,21 @@ export {
|
|
|
5246
5307
|
ft as IdentityService,
|
|
5247
5308
|
oe as IdentityVerificationProvider,
|
|
5248
5309
|
fr as IdentityVerificationStep,
|
|
5249
|
-
|
|
5310
|
+
ne as Input,
|
|
5250
5311
|
xt as InvestorCategorizationService,
|
|
5251
5312
|
gr as InvestorCategorizationStep,
|
|
5252
|
-
|
|
5313
|
+
ae as InvestorCategorizationType,
|
|
5253
5314
|
it as InvestorCategoryType,
|
|
5254
5315
|
Xe as KycProcessStatus,
|
|
5255
5316
|
fe as KycStatus,
|
|
5256
5317
|
Te as KycStatusDisplay,
|
|
5257
5318
|
zr as KycWorkflow,
|
|
5258
5319
|
br as Logo,
|
|
5259
|
-
|
|
5320
|
+
Be as MetaKYCContext,
|
|
5260
5321
|
de as MetaKYCError,
|
|
5261
5322
|
Dr as MetaKYCProvider,
|
|
5262
5323
|
Qt as MultiSelect,
|
|
5263
|
-
|
|
5324
|
+
Lt as OnfidoProvider,
|
|
5264
5325
|
gt as OverviewService,
|
|
5265
5326
|
cr as OverviewStep,
|
|
5266
5327
|
Gt as PhoneInput,
|
|
@@ -5271,7 +5332,7 @@ export {
|
|
|
5271
5332
|
Ze as RiskLevel,
|
|
5272
5333
|
yt as RiskScoringService,
|
|
5273
5334
|
pr as RiskScoringStep,
|
|
5274
|
-
|
|
5335
|
+
Pt as SardinAIProvider,
|
|
5275
5336
|
ge as Select,
|
|
5276
5337
|
ce as Spinner,
|
|
5277
5338
|
Rt as StepRouter,
|
|
@@ -5286,8 +5347,8 @@ export {
|
|
|
5286
5347
|
Dt as WorkflowOrchestrator,
|
|
5287
5348
|
Se as WorkflowResultType,
|
|
5288
5349
|
Et as WorkflowState,
|
|
5289
|
-
|
|
5290
|
-
|
|
5350
|
+
z as WorkflowStepAction,
|
|
5351
|
+
qr as appropriatenessTestSchema,
|
|
5291
5352
|
Tr as clearAllStorage,
|
|
5292
5353
|
zt as clearApplicantId,
|
|
5293
5354
|
_t as clearWorkflowState,
|
|
@@ -5302,29 +5363,29 @@ export {
|
|
|
5302
5363
|
$r as generateQuestionnaireSchema,
|
|
5303
5364
|
Ur as generateRiskScoringSchema,
|
|
5304
5365
|
_r as generateUploadDocumentSchema,
|
|
5305
|
-
|
|
5306
|
-
|
|
5366
|
+
Pr as getAcceptString,
|
|
5367
|
+
Bt as getApplicantId,
|
|
5307
5368
|
ke as getThemePreset,
|
|
5308
5369
|
Mr as getWorkflowState,
|
|
5309
5370
|
kt as healthcareTheme,
|
|
5310
5371
|
Er as isScriptLoaded,
|
|
5311
|
-
|
|
5372
|
+
Oe as loadScript,
|
|
5312
5373
|
St as minimalTheme,
|
|
5313
5374
|
Nt as modernTheme,
|
|
5314
5375
|
Rr as removeScript,
|
|
5315
|
-
|
|
5376
|
+
Ot as saveApplicantId,
|
|
5316
5377
|
$t as saveWorkflowState,
|
|
5317
5378
|
Ct as themePresets,
|
|
5318
5379
|
Wt as useApplicant,
|
|
5319
|
-
|
|
5320
|
-
|
|
5380
|
+
Or as useAppropriatenessTest,
|
|
5381
|
+
Ht as useIdentityVerification,
|
|
5321
5382
|
Ut as useKycWorkflow,
|
|
5322
|
-
|
|
5383
|
+
ie as useMetaKYC,
|
|
5323
5384
|
jt as useOverview,
|
|
5324
5385
|
Kt as useQuestionnaire,
|
|
5325
5386
|
Yt as useRiskScoring,
|
|
5326
|
-
|
|
5387
|
+
qt as useUploadDocument,
|
|
5327
5388
|
Fr as validateFileSize,
|
|
5328
|
-
|
|
5389
|
+
Lr as validateFileType
|
|
5329
5390
|
};
|
|
5330
5391
|
//# sourceMappingURL=index.js.map
|