@vpdev2/metakyc-sdk 1.0.36 → 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/index.js CHANGED
@@ -1,13 +1,13 @@
1
- var He = Object.defineProperty;
2
- var je = (e, t, r) => t in e ? He(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var H = (e, t, r) => je(e, typeof t != "symbol" ? t + "" : t, r);
4
- import qe from "axios";
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 ie, { createContext as Ye, useState as v, useMemo as Ae, useEffect as V, useContext as We, useRef as W, useCallback as K, forwardRef as Ne, createElement as De } from "react";
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 O = /* @__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))(O || {}), 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 || {}), re = /* @__PURE__ */ ((e) => (e[e.Individual = 0] = "Individual", e[e.Sophisticated = 1] = "Sophisticated", e[e.HighNetWorth = 2] = "HighNetWorth", e[e.Business = 3] = "Business", e))(re || {}), it = /* @__PURE__ */ ((e) => (e[e.Retail = 0] = "Retail", e[e.Professional = 1] = "Professional", e[e.EligibleCounterparty = 2] = "EligibleCounterparty", e))(it || {});
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
11
  const Le = [
12
12
  { value: "EN", label: "English" },
13
13
  { value: "DE", label: "German" },
@@ -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
- H(this, "response");
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
- H(this, "axiosInstance");
201
- H(this, "endpointBuilder");
202
- H(this, "config");
203
- this.config = { ...lt, ...t }, this.endpointBuilder = new ct(this.config.endpoints), this.axiosInstance = qe.create({
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
- H(this, "listeners", /* @__PURE__ */ new Map());
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
- H(this, "events", new It());
1020
- H(this, "_applicantId", null);
1021
- H(this, "_progress", null);
1022
- H(this, "_error", null);
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
- H(this, "handlers", /* @__PURE__ */ new Map());
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: ${O[t]}`);
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: ${O[t]}`);
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
- H(this, "state");
1201
- H(this, "stepRouter");
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(O.Questionaries, {
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(O.UploadDocument, {
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(O.AppropriatenessTest, {
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(O.Overview, {
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(O.RiskScoring, {
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(O.IdentitySdk, {
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(O.InvestorCategorization, {
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(O.ManualReview, {
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(O.AdditionalData, {
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 Be(e, t) {
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
- H(this, "sdk", null);
1362
- H(this, "config");
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 Be(
1369
+ await Oe(
1370
1370
  "https://cdn.sumsub.com/websdk/v2/production/websdk.js",
1371
1371
  "sumsub-sdk"
1372
1372
  );
@@ -1413,15 +1413,15 @@ class Ft {
1413
1413
  }
1414
1414
  class Lt {
1415
1415
  constructor(t) {
1416
- H(this, "sdk", null);
1417
- H(this, "config");
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 Be(
1424
+ await Oe(
1425
1425
  "https://sdk.onfido.com/v12.0.0/onfido.min.js",
1426
1426
  "onfido-sdk"
1427
1427
  );
@@ -1479,9 +1479,9 @@ class Lt {
1479
1479
  }
1480
1480
  class Pt {
1481
1481
  constructor(t) {
1482
- H(this, "sardineContext", null);
1483
- H(this, "config");
1484
- H(this, "sessionKey");
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
  /**
@@ -1673,9 +1673,9 @@ class xe {
1673
1673
  }
1674
1674
  class Mt {
1675
1675
  constructor(t) {
1676
- H(this, "currentTheme", ee);
1677
- H(this, "customStyleElement", null);
1678
- H(this, "container");
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 Oe = Ye(null), Dr = ({ config: e, children: t }) => {
1800
- const [r, n] = v(null), s = ie.useRef(!1), i = ie.useRef(!1), l = Ae(() => {
1801
- const d = new dt(e), u = new ut(d), k = new mt(d), w = new pt(d), p = new ht(d), b = new gt(d), m = new yt(d), N = new ft(d), h = new bt(d), x = new xt(d), E = new At(d), S = new Mt();
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: k,
1806
- uploadDocumentService: w,
1807
- appropriatenessTestService: p,
1808
- overviewService: b,
1809
- riskScoringService: m,
1805
+ questionnaireService: w,
1806
+ uploadDocumentService: k,
1807
+ appropriatenessTestService: g,
1808
+ overviewService: m,
1809
+ riskScoringService: p,
1810
1810
  identityService: N,
1811
- baseInformationService: h,
1812
- investorCategorizationService: x,
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 V(() => ((async () => {
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(Oe.Provider, { value: c, children: t });
1852
+ }), []), /* @__PURE__ */ a(Be.Provider, { value: c, children: t });
1853
1853
  };
1854
- function se() {
1855
- const e = We(Oe);
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;
@@ -1893,14 +1893,14 @@ const ve = {
1893
1893
  APPLICANT_ID: "metakyc_applicant_id",
1894
1894
  WORKFLOW_STATE: "metakyc_workflow_state"
1895
1895
  };
1896
- function Bt(e) {
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 Ot() {
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 } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(null), d = W(null), u = e || Ot();
1945
- V(() => {
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]), V(() => {
1947
+ }, [t]), G(() => {
1948
1948
  var S;
1949
- r && u && (Bt(u), $t({
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 k = W(!1), w = W(!1), p = K(async () => {
1958
+ const w = Q(!1), k = Q(!1), g = K(async () => {
1959
1959
  if (!(!u || !d.current)) {
1960
- if (k.current) {
1960
+ if (w.current) {
1961
1961
  console.log("[Workflow] Load already in progress, skipping...");
1962
1962
  return;
1963
1963
  }
1964
- k.current = !0, i(!0), c(null);
1964
+ w.current = !0, i(!0), c(null);
1965
1965
  try {
1966
1966
  const S = await d.current.initialize(u);
1967
- n(S), w.current = !0;
1967
+ n(S), k.current = !0;
1968
1968
  } catch (S) {
1969
1969
  c(S);
1970
1970
  } finally {
1971
- i(!1), k.current = !1;
1971
+ i(!1), w.current = !1;
1972
1972
  }
1973
1973
  }
1974
1974
  }, [u]);
1975
- V(() => {
1976
- u && !w.current && p();
1977
- }, [u, p]);
1978
- const b = K(async () => {
1975
+ G(() => {
1976
+ u && !k.current && g();
1977
+ }, [u, g]);
1978
+ const m = K(async () => {
1979
1979
  if (d.current) {
1980
- if (k.current) {
1980
+ if (w.current) {
1981
1981
  console.log("[Workflow] Refresh already in progress, skipping...");
1982
1982
  return;
1983
1983
  }
1984
- k.current = !0, i(!0), c(null);
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), k.current = !1;
1991
+ i(!1), w.current = !1;
1992
1992
  }
1993
1993
  }
1994
- }, []), m = K(async () => {
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
- }, []), h = K(async (S) => {
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 I = await d.current.refreshProgress();
2024
- n(I);
2025
- } catch (I) {
2026
- throw c(I), I;
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
- }, []), x = Fe.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((S, I) => S.order - I.order) : [], [r == null ? void 0 : r.stepInfoList]), E = Fe.useMemo(() => r ? r.nextWorkflowKey && r.nextWorkflowKey !== r.workFlowKey : !1, [r]);
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: x,
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: b,
2047
- moveToNext: m,
2046
+ refreshProgress: m,
2047
+ moveToNext: p,
2048
2048
  moveBack: N,
2049
- submitCurrentStep: h,
2049
+ submitCurrentStep: f,
2050
2050
  orchestrator: d.current
2051
2051
  };
2052
2052
  }
2053
2053
  function Kt(e) {
2054
- const { questionnaireService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), k = W(!1), w = W(null), p = K(async () => {
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 (k.current) {
2057
+ if (m.current) {
2057
2058
  console.log("[Questionnaire] Load already in progress, skipping...");
2058
2059
  return;
2059
2060
  }
2060
- k.current = !0, i(!0), u(null);
2061
+ m.current = !0, d(!0), g(null);
2061
2062
  try {
2062
- const m = await t.getQuestionnaire(e);
2063
- n(m), w.current = e;
2064
- } catch (m) {
2065
- u(m);
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
- i(!1), k.current = !1;
2082
+ d(!1), m.current = !1;
2068
2083
  }
2069
2084
  }
2070
- }, [e, t]);
2071
- V(() => {
2072
- e && w.current !== e && p();
2085
+ }, [e, t, r]);
2086
+ G(() => {
2087
+ e && p.current !== e && N();
2073
2088
  }, [e]);
2074
- const b = K(
2075
- async (m) => {
2076
- c(!0), u(null);
2089
+ const f = K(
2090
+ async (y) => {
2091
+ w(!0), g(null);
2077
2092
  try {
2078
- return await t.fillQuestionnaire(m);
2079
- } catch (N) {
2080
- throw u(N), N;
2093
+ return await t.fillQuestionnaire(y);
2094
+ } catch (E) {
2095
+ throw g(E), E;
2081
2096
  } finally {
2082
- c(!1);
2097
+ w(!1);
2083
2098
  }
2084
2099
  },
2085
2100
  [t]
2086
2101
  );
2087
2102
  return {
2088
- questionnaire: r,
2089
- isLoading: s,
2090
- isSubmitting: l,
2091
- error: d,
2092
- load: p,
2093
- submit: b
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 Ht(e) {
2097
- const { uploadDocumentService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(0), [k, w] = v(null), p = W(!1), b = W(null), m = K(async () => {
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 (p.current) {
2115
+ if (g.current) {
2100
2116
  console.log("[UploadDocument] Load already in progress, skipping...");
2101
2117
  return;
2102
2118
  }
2103
- p.current = !0, i(!0), w(null);
2119
+ g.current = !0, i(!0), k(null);
2104
2120
  try {
2105
- const h = await t.getUploadDocument(e);
2106
- n(h), b.current = e;
2107
- } catch (h) {
2108
- w(h);
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), p.current = !1;
2126
+ i(!1), g.current = !1;
2111
2127
  }
2112
2128
  }
2113
2129
  }, [e, t]);
2114
- V(() => {
2115
- e && b.current !== e && m();
2130
+ G(() => {
2131
+ e && m.current !== e && p();
2116
2132
  }, [e]);
2117
2133
  const N = K(
2118
- async (h) => {
2119
- c(!0), u(0), w(null);
2134
+ async (f) => {
2135
+ c(!0), u(0), k(null);
2120
2136
  try {
2121
- await t.fillUploadDocument(h), u(100);
2122
- } catch (x) {
2123
- throw w(x), x;
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: k,
2136
- load: m,
2151
+ error: w,
2152
+ load: p,
2137
2153
  submit: N
2138
2154
  };
2139
2155
  }
2140
- function Br(e) {
2141
- const { appropriatenessTestService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), [k, w] = v(null), p = W(!1), b = W(null), m = K(async () => {
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 (p.current) {
2159
+ if (g.current) {
2144
2160
  console.log("[AppropriatenessTest] Load already in progress, skipping...");
2145
2161
  return;
2146
2162
  }
2147
- p.current = !0, i(!0), u(null);
2163
+ g.current = !0, i(!0), u(null);
2148
2164
  try {
2149
- const h = await t.getAppropriatenessTest(e);
2150
- n(h), b.current = e;
2151
- } catch (h) {
2152
- u(h);
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), p.current = !1;
2170
+ i(!1), g.current = !1;
2155
2171
  }
2156
2172
  }
2157
2173
  }, [e, t]);
2158
- V(() => {
2159
- e && b.current !== e && m();
2174
+ G(() => {
2175
+ e && m.current !== e && p();
2160
2176
  }, [e]);
2161
2177
  const N = K(
2162
- async (h) => {
2178
+ async (f) => {
2163
2179
  c(!0), u(null);
2164
2180
  try {
2165
- const x = await t.fillAppropriatenessTest(h);
2166
- return w(x), x;
2167
- } catch (x) {
2168
- throw u(x), x;
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: k,
2193
+ result: w,
2178
2194
  isLoading: s,
2179
2195
  isSubmitting: l,
2180
2196
  error: d,
2181
- load: m,
2197
+ load: p,
2182
2198
  submit: N
2183
2199
  };
2184
2200
  }
2185
2201
  function jt(e) {
2186
- const { overviewService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), k = W(!1), w = W(null), p = K(async () => {
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 (k.current) {
2204
+ if (w.current) {
2189
2205
  console.log("[Overview] Load already in progress, skipping...");
2190
2206
  return;
2191
2207
  }
2192
- k.current = !0, i(!0), u(null);
2208
+ w.current = !0, i(!0), u(null);
2193
2209
  try {
2194
- const m = await t.getOverviewData(e);
2195
- n(m), w.current = e;
2196
- } catch (m) {
2197
- u(m);
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), k.current = !1;
2215
+ i(!1), w.current = !1;
2200
2216
  }
2201
2217
  }
2202
2218
  }, [e, t]);
2203
- V(() => {
2204
- e && w.current !== e && p();
2219
+ G(() => {
2220
+ e && k.current !== e && g();
2205
2221
  }, [e]);
2206
- const b = K(async () => {
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 (m) {
2212
- throw u(m), m;
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: p,
2224
- passOverview: b
2239
+ load: g,
2240
+ passOverview: m
2225
2241
  };
2226
2242
  }
2227
- function qt(e) {
2228
- const { identityService: t } = se(), [r, n] = v(
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 = W(!1), u = K(
2231
- async (p, b) => {
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 m = {
2255
+ const p = {
2240
2256
  applicantId: e,
2241
2257
  restart: !1,
2242
- redirectUrl: p || "",
2243
- ttl: b || 604800
2258
+ redirectUrl: g || "",
2259
+ ttl: m || 604800
2244
2260
  // Default: 7 days
2245
2261
  };
2246
- console.log("Identity request input:", m);
2247
- const N = await t.identityRequest(m);
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 (m) {
2250
- throw c(m), m;
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
- ), k = K(
2258
- async (p, b) => {
2273
+ ), w = K(
2274
+ async (g, m) => {
2259
2275
  if (e) {
2260
2276
  i(!0), c(null);
2261
2277
  try {
2262
- const m = {
2278
+ const p = {
2263
2279
  applicantId: e,
2264
2280
  restart: !1,
2265
- redirectUrl: p,
2266
- ttl: b
2267
- }, N = await t.identityCompanyRequest(m);
2281
+ redirectUrl: g,
2282
+ ttl: m
2283
+ }, N = await t.identityCompanyRequest(p);
2268
2284
  return n(N), N;
2269
- } catch (m) {
2270
- throw c(m), m;
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
- ), w = K(async () => {
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 p = {
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:", p);
2293
- const b = await t.identityRequest(p);
2294
- return console.log("Restart identity result:", b), n(b), b;
2295
- } catch (p) {
2296
- throw c(p), p;
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: k,
2310
- restartIdentity: w
2325
+ requestCompanyIdentity: w,
2326
+ restartIdentity: k
2311
2327
  };
2312
2328
  }
2313
2329
  function Yt(e) {
2314
- const { riskScoringService: t } = se(), [r, n] = v(null), [s, i] = v(!1), [l, c] = v(!1), [d, u] = v(null), [k, w] = v(null), p = W(!1), b = W(null), m = K(async () => {
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 (p.current) {
2333
+ if (N.current) {
2317
2334
  console.log("[RiskScoring] Load already in progress, skipping...");
2318
2335
  return;
2319
2336
  }
2320
- p.current = !0, i(!0), u(null);
2337
+ N.current = !0, d(!0), g(null);
2321
2338
  try {
2322
- const h = await t.getRiskCriterias(e);
2323
- n(h), b.current = e;
2324
- } catch (h) {
2325
- u(h);
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
- i(!1), p.current = !1;
2353
+ d(!1), N.current = !1;
2328
2354
  }
2329
2355
  }
2330
- }, [e, t]);
2331
- V(() => {
2332
- e && b.current !== e && m();
2356
+ }, [e, t, r]);
2357
+ G(() => {
2358
+ e && f.current !== e && y();
2333
2359
  }, [e]);
2334
- const N = K(
2335
- async (h) => {
2336
- c(!0), u(null);
2360
+ const E = K(
2361
+ async (S) => {
2362
+ w(!0), g(null);
2337
2363
  try {
2338
- const x = await t.submitRiskScoring(h);
2339
- return w(x), x;
2340
- } catch (x) {
2341
- throw u(x), x;
2364
+ const C = await t.submitRiskScoring(S);
2365
+ return p(C), C;
2366
+ } catch (C) {
2367
+ throw g(C), C;
2342
2368
  } finally {
2343
- c(!1);
2369
+ w(!1);
2344
2370
  }
2345
2371
  },
2346
2372
  [t]
2347
2373
  );
2348
2374
  return {
2349
- criteria: r,
2350
- result: k,
2351
- isLoading: s,
2352
- isSubmitting: l,
2353
- error: d,
2354
- load: m,
2355
- submit: N
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 } = se(), [r, n] = v(!1), [s, i] = v(null), l = W(!1), c = W(!1), d = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(b) {
2360
- const m = Math.random() * 16 | 0;
2361
- return (b === "x" ? m : m & 3 | 8).toString(16);
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 (b) => {
2364
- var m;
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 (b.applicantAdditionalDatas || (b.applicantAdditionalDatas = []), (m = t.identityProviders) != null && m.sardinai) {
2370
- const h = d();
2371
- console.log("[SardinAI] Generated session key:", h), b.applicantAdditionalDatas.push({
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: h
2400
+ value: f
2374
2401
  });
2375
2402
  }
2376
- return await e.createApplicant(b);
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
- ), k = K(
2385
- async (b) => {
2411
+ ), w = K(
2412
+ async (m) => {
2386
2413
  n(!0), i(null);
2387
2414
  try {
2388
- return await e.createCompanyApplicant(b);
2389
- } catch (m) {
2390
- throw i(m), m;
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
- ), w = K(
2397
- async (b) => {
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(b);
2403
- } catch (m) {
2404
- throw i(m), m;
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
- ), p = K(
2411
- async (b) => {
2437
+ ), g = K(
2438
+ async (m) => {
2412
2439
  n(!0), i(null);
2413
2440
  try {
2414
- await e.stopProgress(b);
2415
- } catch (m) {
2416
- throw i(m), m;
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: k,
2428
- getApplicantData: w,
2429
- stopProgress: p
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
- }, ae = Ne(
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
- ae.displayName = "Input";
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
- ), te = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
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 }), ne = ({ children: e, className: t, ...r }) => /* @__PURE__ */ a(
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, k] = v(""), w = W(null);
2660
- V(() => {
2661
- const h = (x) => {
2662
- w.current && !w.current.contains(x.target) && (d(!1), k(""));
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", h), () => document.removeEventListener("mousedown", h);
2691
+ return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
2665
2692
  }, []);
2666
- const p = n.filter(
2667
- (h) => h.label.toLowerCase().includes(u.toLowerCase())
2668
- ), b = (h) => {
2669
- i || (t.includes(h) ? r(t.filter((x) => x !== h)) : r([...t, h]));
2670
- }, m = (h, x) => {
2671
- x.stopPropagation(), i || r(t.filter((E) => E !== h));
2672
- }, N = (h) => {
2673
- var x;
2674
- return ((x = n.find((E) => E.value === h)) == null ? void 0 : x.label) || h;
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: w, children: [
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((h) => /* @__PURE__ */ o(
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(h),
2727
+ N(f),
2701
2728
  !i && /* @__PURE__ */ a(
2702
2729
  "button",
2703
2730
  {
2704
2731
  type: "button",
2705
- onClick: (x) => m(h, x),
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
- h
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: (h) => k(h.target.value),
2775
+ onChange: (f) => w(f.target.value),
2749
2776
  placeholder: "Search...",
2750
2777
  autoFocus: !0,
2751
- onClick: (h) => h.stopPropagation(),
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: p.length === 0 ? /* @__PURE__ */ a("li", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No results" }) : p.map((h) => /* @__PURE__ */ o(
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: () => b(h.value),
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(h.value) && "metakyc-multiselect-option-selected bg-blue-50 dark:bg-blue-900/20"
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(h.value),
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: h.label })
2803
+ /* @__PURE__ */ a("span", { className: "text-gray-900 dark:text-gray-100", children: f.label })
2777
2804
  ]
2778
2805
  },
2779
- h.value
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([]), k("");
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), k = W(null), w = (x) => {
2812
- if (!x) return;
2813
- const E = Array.from(x);
2814
- if (s && E.filter((I) => I.size > s).length > 0) {
2815
- const I = Re(s);
2816
- alert(`Some files exceed the maximum size of ${I}`);
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
- }, p = (x) => {
2821
- x.preventDefault(), u(!0);
2822
- }, b = () => {
2847
+ }, g = (y) => {
2848
+ y.preventDefault(), u(!0);
2849
+ }, m = () => {
2823
2850
  u(!1);
2824
- }, m = (x) => {
2825
- x.preventDefault(), u(!1), w(x.dataTransfer.files);
2851
+ }, p = (y) => {
2852
+ y.preventDefault(), u(!1), k(y.dataTransfer.files);
2826
2853
  }, N = () => {
2827
- var x;
2828
- (x = k.current) == null || x.click();
2829
- }, h = (x) => {
2830
- const E = l.filter((S, I) => I !== x);
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: p,
2844
- onDragLeave: b,
2845
- onDrop: m,
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: k,
2878
+ ref: w,
2852
2879
  type: "file",
2853
2880
  className: "hidden",
2854
2881
  accept: r,
2855
2882
  multiple: n,
2856
- onChange: (x) => w(x.target.files)
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((x, E) => /* @__PURE__ */ o(
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: x.name }),
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(x.size),
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(), h(E);
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
- ae,
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, k]) => De(u, k)),
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 ?? 1;
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, isLoading: s, isSubmitting: i, error: l, submit: c } = Kt(e), [d, u] = v({}), [k, w] = v({}), [p, b] = v(0), m = Ae(
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
- ), N = p === m.length - 1, h = m[p] ?? [], x = K((D, z) => {
3160
- u((g) => ({ ...g, [D]: z })), w((g) => {
3161
- const P = { ...g };
3162
- return delete P[D], P;
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
- }, []), E = K(() => {
3165
- const D = {};
3166
- for (const { question: z } of h) {
3167
- const g = nr(z, d[z.id] ?? []);
3168
- g && (D[z.id] = g);
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 w((z) => ({ ...z, ...D })), Object.keys(D).length === 0;
3171
- }, [h, d]), S = () => {
3172
- E() && b((D) => D + 1);
3173
- }, I = () => {
3174
- p > 0 ? b((D) => D - 1) : r == null || r();
3175
- }, Y = async () => {
3176
- if (!(!E() || !n))
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 D = n.questionGroups.flatMap(
3179
- (g) => (g.questions ?? []).map((P) => ({
3180
- questionId: P.id,
3181
- values: d[P.id] ?? []
3209
+ const F = n.questionGroups.flatMap(
3210
+ (A) => (A.questions ?? []).map((I) => ({
3211
+ questionId: I.id,
3212
+ values: u[I.id] ?? []
3182
3213
  }))
3183
- ), z = {
3214
+ ), h = {
3184
3215
  applicantId: e,
3185
3216
  questionnarieId: n.id,
3186
- questionResults: D
3217
+ questionResults: F
3187
3218
  };
3188
- await c(z), t == null || t();
3189
- } catch (D) {
3190
- console.error("Questionnaire submit error:", D);
3219
+ await d(h), t == null || t();
3220
+ } catch (F) {
3221
+ console.error("Questionnaire submit error:", F);
3191
3222
  }
3192
3223
  };
3193
- 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: [
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
- l.message
3226
+ c.message
3196
3227
  ] }) }) }) : n ? /* @__PURE__ */ o(M, { children: [
3197
- /* @__PURE__ */ o(te, { children: [
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
- m.length > 1 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between mt-3", children: [
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
- p + 1,
3234
+ m + 1,
3204
3235
  " of ",
3205
- m.length
3236
+ N.length
3206
3237
  ] }),
3207
- /* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: m.map((D, z) => /* @__PURE__ */ a(
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: z === p ? "20px" : "6px",
3214
- backgroundColor: z <= p ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
3244
+ width: h === m ? "20px" : "6px",
3245
+ backgroundColor: h <= m ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
3215
3246
  }
3216
3247
  },
3217
- z
3248
+ h
3218
3249
  )) })
3219
3250
  ] })
3220
3251
  ] }),
3221
- /* @__PURE__ */ a(T, { className: "space-y-6", children: h.map(({ question: D }) => /* @__PURE__ */ a(
3252
+ /* @__PURE__ */ a(T, { className: "space-y-6", children: y.map(({ question: F }) => /* @__PURE__ */ a(
3222
3253
  or,
3223
3254
  {
3224
- question: D,
3225
- value: d[D.id] ?? [],
3226
- error: k[D.id],
3227
- onChange: (z) => x(D.id, z)
3255
+ question: F,
3256
+ value: u[F.id] ?? [],
3257
+ error: k[F.id],
3258
+ onChange: (h) => E(F.id, h)
3228
3259
  },
3229
- D.id
3260
+ F.id
3230
3261
  )) }),
3231
- /* @__PURE__ */ o(ne, { className: "flex items-center justify-between", children: [
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: I,
3268
+ onClick: O,
3238
3269
  style: { display: "flex", alignItems: "center", gap: "4px" },
3239
3270
  children: [
3240
3271
  /* @__PURE__ */ a(_e, { size: 14 }),
3241
- p > 0 ? "Previous" : "Back"
3272
+ m > 0 ? "Previous" : "Back"
3242
3273
  ]
3243
3274
  }
3244
3275
  ),
3245
- N ? /* @__PURE__ */ a(
3276
+ f ? /* @__PURE__ */ a(
3246
3277
  U,
3247
3278
  {
3248
3279
  type: "button",
3249
- isLoading: i,
3250
- onClick: Y,
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: S,
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
- l && /* @__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: l.message }) })
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
- ae,
3310
+ ne,
3280
3311
  {
3281
3312
  value: t[0] ?? "",
3282
3313
  onChange: (c) => n([c.target.value]),
@@ -3377,51 +3408,51 @@ const ir = ({
3377
3408
  onComplete: t,
3378
3409
  onBack: r
3379
3410
  }) => {
3380
- const { uploadDocument: n, isLoading: s, isSubmitting: i, error: l, submit: c } = Ht(e), [d, u] = v({}), k = async (w) => {
3381
- if (w.preventDefault(), !n) return;
3382
- const p = await Promise.all(
3383
- n.uploadDocumentFiles.map(async (m) => {
3384
- const N = d[m.id] || [], h = await Promise.all(
3385
- N.map(async (x) => ({
3386
- fileName: x.name,
3387
- fileData: await Tt(x)
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)
3388
3419
  }))
3389
3420
  );
3390
3421
  return {
3391
- uploadDocumentFileId: m.id,
3392
- valueList: h
3422
+ uploadDocumentFileId: p.id,
3423
+ valueList: f
3393
3424
  };
3394
3425
  })
3395
- ), b = {
3426
+ ), m = {
3396
3427
  applicantId: e,
3397
3428
  uploadDocumentId: n.id,
3398
- uploadDocumentResults: p
3429
+ uploadDocumentResults: g
3399
3430
  };
3400
- await c(b), t == null || t();
3431
+ await c(m), t == null || t();
3401
3432
  };
3402
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: [
3403
3434
  "Error loading document requirements: ",
3404
3435
  l.message
3405
- ] }) }) }) : n ? /* @__PURE__ */ a("form", { onSubmit: k, children: /* @__PURE__ */ o(M, { children: [
3406
- /* @__PURE__ */ o(te, { children: [
3436
+ ] }) }) }) : n ? /* @__PURE__ */ a("form", { onSubmit: w, children: /* @__PURE__ */ o(M, { children: [
3437
+ /* @__PURE__ */ o(re, { children: [
3407
3438
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: n.displayName }),
3408
3439
  n.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: n.subtitle })
3409
3440
  ] }),
3410
- /* @__PURE__ */ a(T, { className: "space-y-6", children: n.uploadDocumentFiles.map((w) => /* @__PURE__ */ a(
3441
+ /* @__PURE__ */ a(T, { className: "space-y-6", children: n.uploadDocumentFiles.map((k) => /* @__PURE__ */ a(
3411
3442
  Vt,
3412
3443
  {
3413
- label: w.displayName,
3414
- accept: w.allowedTypes,
3415
- multiple: w.multipleFile,
3416
- maxSize: w.maxEachFileSizeByte,
3417
- value: d[w.id] || [],
3418
- onChange: (p) => {
3419
- u((b) => ({ ...b, [w.id]: p }));
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 }));
3420
3451
  }
3421
3452
  },
3422
- w.id
3453
+ k.id
3423
3454
  )) }),
3424
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
3455
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
3425
3456
  r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
3426
3457
  /* @__PURE__ */ a(U, { type: "submit", isLoading: i, children: "Continue" })
3427
3458
  ] })
@@ -3434,11 +3465,11 @@ const ir = ({
3434
3465
  "Error loading overview: ",
3435
3466
  l.message
3436
3467
  ] }) }) }) : n ? /* @__PURE__ */ o(M, { children: [
3437
- /* @__PURE__ */ o(te, { children: [
3468
+ /* @__PURE__ */ o(re, { children: [
3438
3469
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: n.title || "Overview" }),
3439
3470
  n.description && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: n.description })
3440
3471
  ] }),
3441
- /* @__PURE__ */ a(T, { className: "space-y-8", children: n.steps && n.steps.length > 0 ? n.steps.sort((u, k) => u.order - k.order).map((u) => /* @__PURE__ */ o("div", { className: "metakyc-overview-step-item flex items-center space-x-3", children: [
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: [
3442
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 }) }),
3443
3474
  /* @__PURE__ */ o(
3444
3475
  "div",
@@ -3457,7 +3488,7 @@ const ir = ({
3457
3488
  }
3458
3489
  )
3459
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..." }) }) }),
3460
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
3491
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
3461
3492
  r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
3462
3493
  /* @__PURE__ */ a(U, { onClick: d, isLoading: i, children: "Continue" })
3463
3494
  ] })
@@ -3496,7 +3527,7 @@ function dr(e, t) {
3496
3527
  function ur(e) {
3497
3528
  const t = /* @__PURE__ */ new Map();
3498
3529
  return e.forEach((r, n) => {
3499
- const s = r.pageNumber ?? 1;
3530
+ const s = r.pageNumber != null && r.pageNumber > 0 ? r.pageNumber : 1;
3500
3531
  t.has(s) || t.set(s, []), t.get(s).push({ criterion: r, idx: n });
3501
3532
  }), Array.from(t.entries()).sort(([r], [n]) => r - n).map(([, r]) => r);
3502
3533
  }
@@ -3508,104 +3539,108 @@ const pr = ({
3508
3539
  onComplete: t,
3509
3540
  onBack: r
3510
3541
  }) => {
3511
- const { criteria: n, isLoading: s, isSubmitting: i, error: l, submit: c } = Yt(e), [d, u] = v({}), [k, w] = v({}), [p, b] = v(0), [m, N] = v(!1), h = Ae(
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(
3512
3547
  () => n && n.length > 0 ? ur(n) : [],
3513
3548
  [n]
3514
- ), x = p === h.length - 1, E = h[p] ?? [];
3515
- ie.useEffect(() => {
3516
- !s && n && n.length === 0 && !m && !i && (N(!0), c({ applicantId: e, criteriaValueInputs: [] }).then(() => t == null ? void 0 : t()).catch(console.error));
3517
- }, [s, n, m, i, c, e, t]);
3518
- const S = K((g, P) => {
3519
- u((F) => ({ ...F, [g]: P })), w((F) => {
3520
- const G = { ...F };
3521
- return delete G[g], G;
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;
3522
3557
  });
3523
- }, []), I = K(() => {
3524
- const g = {};
3525
- for (const { criterion: P } of E) {
3526
- const F = dr(P, d[P.id] ?? []);
3527
- F && (g[P.id] = F);
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);
3528
3563
  }
3529
- return w((P) => ({ ...P, ...g })), Object.keys(g).length === 0;
3530
- }, [E, d]), Y = () => {
3531
- I() && b((g) => g + 1);
3532
- }, D = () => {
3533
- p > 0 ? b((g) => g - 1) : r == null || r();
3534
- }, z = async () => {
3535
- if (!(!I() || !n))
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))
3536
3571
  try {
3537
- const g = n.map((F) => {
3538
- const G = (d[F.id] ?? []).filter((j) => j && j.trim());
3539
- return G.length > 0 ? { riskCriteriaId: F.id, values: G } : null;
3540
- }).filter((F) => F !== null);
3541
- await c({ applicantId: e, criteriaValueInputs: g }), t == null || t();
3542
- } catch (g) {
3543
- console.error("Risk scoring submit error:", g);
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);
3544
3579
  }
3545
3580
  };
3546
- return s ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
3581
+ return i ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
3547
3582
  /* @__PURE__ */ a(ce, { className: "my-8" }),
3548
3583
  /* @__PURE__ */ a("p", { className: "text-center text-sm mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: "Loading risk scoring criteria…" })
3549
- ] }) }) : !s && n && n.length === 0 ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
3584
+ ] }) }) : !i && n && n.length === 0 ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
3550
3585
  /* @__PURE__ */ a(ce, { className: "my-8" }),
3551
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…" })
3552
- ] }) }) : l ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
3587
+ ] }) }) : c ? /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
3553
3588
  "Error loading criteria: ",
3554
- l.message
3589
+ c.message
3555
3590
  ] }) }) }) : n ? /* @__PURE__ */ o(M, { children: [
3556
- /* @__PURE__ */ o(te, { children: [
3591
+ /* @__PURE__ */ o(re, { children: [
3557
3592
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold", children: "Risk Assessment" }),
3558
3593
  /* @__PURE__ */ a("p", { className: "text-sm", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: "Please answer the following questions for risk evaluation" }),
3559
- h.length > 1 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between mt-3", children: [
3594
+ y.length > 1 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between mt-3", children: [
3560
3595
  /* @__PURE__ */ o("span", { className: "text-xs", style: { color: "var(--metakyc-text-muted, #9ca3af)" }, children: [
3561
3596
  "Page ",
3562
- p + 1,
3597
+ m + 1,
3563
3598
  " of ",
3564
- h.length
3599
+ y.length
3565
3600
  ] }),
3566
- /* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: h.map((g, P) => /* @__PURE__ */ a(
3601
+ /* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", children: y.map((A, I) => /* @__PURE__ */ a(
3567
3602
  "div",
3568
3603
  {
3569
3604
  className: "rounded-full transition-all duration-200",
3570
3605
  style: {
3571
3606
  height: "6px",
3572
- width: P === p ? "20px" : "6px",
3573
- backgroundColor: P <= p ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
3607
+ width: I === m ? "20px" : "6px",
3608
+ backgroundColor: I <= m ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
3574
3609
  }
3575
3610
  },
3576
- P
3611
+ I
3577
3612
  )) })
3578
3613
  ] })
3579
3614
  ] }),
3580
- /* @__PURE__ */ a(T, { className: "space-y-6", children: E.map(({ criterion: g }) => /* @__PURE__ */ a(
3615
+ /* @__PURE__ */ a(T, { className: "space-y-6", children: S.map(({ criterion: A }) => /* @__PURE__ */ a(
3581
3616
  hr,
3582
3617
  {
3583
- criterion: g,
3584
- value: d[g.id] ?? [],
3585
- error: k[g.id],
3586
- onChange: (P) => S(g.id, P)
3618
+ criterion: A,
3619
+ value: u[A.id] ?? [],
3620
+ error: k[A.id],
3621
+ onChange: (I) => C(A.id, I)
3587
3622
  },
3588
- g.id
3623
+ A.id
3589
3624
  )) }),
3590
- /* @__PURE__ */ o(ne, { className: "flex items-center justify-between", children: [
3625
+ /* @__PURE__ */ o(se, { className: "flex items-center justify-between", children: [
3591
3626
  /* @__PURE__ */ o(
3592
3627
  U,
3593
3628
  {
3594
3629
  type: "button",
3595
3630
  variant: "outline",
3596
- onClick: D,
3631
+ onClick: F,
3597
3632
  style: { display: "flex", alignItems: "center", gap: "4px" },
3598
3633
  children: [
3599
3634
  /* @__PURE__ */ a(_e, { size: 14 }),
3600
- p > 0 ? "Previous" : "Back"
3635
+ m > 0 ? "Previous" : "Back"
3601
3636
  ]
3602
3637
  }
3603
3638
  ),
3604
- x ? /* @__PURE__ */ a(U, { type: "button", isLoading: i, onClick: z, children: "Continue" }) : /* @__PURE__ */ o(
3639
+ E ? /* @__PURE__ */ a(U, { type: "button", isLoading: l, onClick: h, children: "Continue" }) : /* @__PURE__ */ o(
3605
3640
  U,
3606
3641
  {
3607
3642
  type: "button",
3608
- onClick: Y,
3643
+ onClick: W,
3609
3644
  style: { display: "flex", alignItems: "center", gap: "4px" },
3610
3645
  children: [
3611
3646
  "Next",
@@ -3614,7 +3649,7 @@ const pr = ({
3614
3649
  }
3615
3650
  )
3616
3651
  ] }),
3617
- l && /* @__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: l.message }) })
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 }) })
3618
3653
  ] }) : null;
3619
3654
  }, hr = ({ criterion: e, value: t, error: r, onChange: n }) => {
3620
3655
  const s = mr(e), i = e.valueDataType === he.Integer || e.valueDataType === he.Decimal || e.valueDataType === he.DigitOnly;
@@ -3626,7 +3661,7 @@ const pr = ({
3626
3661
  e.description && /* @__PURE__ */ a("p", { className: "text-xs", style: { color: "var(--metakyc-text-secondary, #6b7280)" }, children: e.description }),
3627
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}` }),
3628
3663
  s === "text" && /* @__PURE__ */ a(
3629
- ae,
3664
+ ne,
3630
3665
  {
3631
3666
  value: t[0] ?? "",
3632
3667
  onChange: (l) => n([l.target.value]),
@@ -3738,28 +3773,28 @@ const pr = ({
3738
3773
  onComplete: t,
3739
3774
  onBack: r
3740
3775
  }) => {
3741
- const { investorCategorizationService: n } = se(), [s, i] = v(null), [l, c] = v(!1), [d, u] = v(null);
3742
- return /* @__PURE__ */ a("form", { onSubmit: async (w) => {
3743
- if (w.preventDefault(), s === null) {
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) {
3744
3779
  u("Please select an investor type");
3745
3780
  return;
3746
3781
  }
3747
3782
  c(!0), u(null);
3748
3783
  try {
3749
- const p = {
3784
+ const g = {
3750
3785
  applicantId: e,
3751
3786
  investorType: s
3752
3787
  };
3753
- console.log("Submitting investor categorization:", p);
3754
- const b = await n.setInvestorCategorization(p);
3755
- console.log("Investor categorization result:", b), t == null || t();
3756
- } catch (p) {
3757
- console.error("Error submitting investor categorization:", p), u(p.message || "Failed to submit 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");
3758
3793
  } finally {
3759
3794
  c(!1);
3760
3795
  }
3761
3796
  }, children: /* @__PURE__ */ o(M, { children: [
3762
- /* @__PURE__ */ o(te, { children: [
3797
+ /* @__PURE__ */ o(re, { children: [
3763
3798
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: "Which statement best describes you?" }),
3764
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" })
3765
3800
  ] }),
@@ -3770,7 +3805,7 @@ const pr = ({
3770
3805
  {
3771
3806
  className: `
3772
3807
  block p-4 border-2 rounded-lg cursor-pointer transition-all
3773
- ${s === re.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"}
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"}
3774
3809
  `,
3775
3810
  children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
3776
3811
  /* @__PURE__ */ a(
@@ -3778,9 +3813,9 @@ const pr = ({
3778
3813
  {
3779
3814
  type: "radio",
3780
3815
  name: "investorType",
3781
- value: re.Individual,
3782
- checked: s === re.Individual,
3783
- onChange: () => i(re.Individual),
3816
+ value: ae.Individual,
3817
+ checked: s === ae.Individual,
3818
+ onChange: () => i(ae.Individual),
3784
3819
  className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
3785
3820
  }
3786
3821
  ),
@@ -3796,7 +3831,7 @@ const pr = ({
3796
3831
  {
3797
3832
  className: `
3798
3833
  block p-4 border-2 rounded-lg cursor-pointer transition-all
3799
- ${s === re.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"}
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"}
3800
3835
  `,
3801
3836
  children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
3802
3837
  /* @__PURE__ */ a(
@@ -3804,9 +3839,9 @@ const pr = ({
3804
3839
  {
3805
3840
  type: "radio",
3806
3841
  name: "investorType",
3807
- value: re.Sophisticated,
3808
- checked: s === re.Sophisticated,
3809
- onChange: () => i(re.Sophisticated),
3842
+ value: ae.Sophisticated,
3843
+ checked: s === ae.Sophisticated,
3844
+ onChange: () => i(ae.Sophisticated),
3810
3845
  className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
3811
3846
  }
3812
3847
  ),
@@ -3827,7 +3862,7 @@ const pr = ({
3827
3862
  {
3828
3863
  className: `
3829
3864
  block p-4 border-2 rounded-lg cursor-pointer transition-all
3830
- ${s === re.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"}
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"}
3831
3866
  `,
3832
3867
  children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
3833
3868
  /* @__PURE__ */ a(
@@ -3835,9 +3870,9 @@ const pr = ({
3835
3870
  {
3836
3871
  type: "radio",
3837
3872
  name: "investorType",
3838
- value: re.HighNetWorth,
3839
- checked: s === re.HighNetWorth,
3840
- onChange: () => i(re.HighNetWorth),
3873
+ value: ae.HighNetWorth,
3874
+ checked: s === ae.HighNetWorth,
3875
+ onChange: () => i(ae.HighNetWorth),
3841
3876
  className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
3842
3877
  }
3843
3878
  ),
@@ -3858,7 +3893,7 @@ const pr = ({
3858
3893
  d
3859
3894
  ] }) })
3860
3895
  ] }),
3861
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
3896
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
3862
3897
  r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
3863
3898
  /* @__PURE__ */ a(
3864
3899
  U,
@@ -3876,104 +3911,104 @@ const pr = ({
3876
3911
  onComplete: t,
3877
3912
  onBack: r
3878
3913
  }) => {
3879
- const { appropriatenessTestService: n } = se(), [s, i] = v(null), [l, c] = v(!0), [d, u] = v(!1), [k, w] = v(null), [p, b] = v({}), [m, N] = v(0), [h, x] = v(!1), [E, S] = v(!1), [I, Y] = v(0);
3880
- V(() => {
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(() => {
3881
3916
  (async () => {
3882
3917
  try {
3883
- c(!0), w(null), console.log("Loading appropriateness test for applicant:", e);
3884
- const C = await n.getAppropriatenessTest(e);
3885
- if (console.log("Appropriateness test data:", C), i(C), C.waitTimeSpanForNextTry && C.waitTimeSpanForNextTry !== "00:00:00") {
3886
- const q = D(C.waitTimeSpanForNextTry);
3887
- q > 0 && Y(q);
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);
3888
3923
  }
3889
- } catch (C) {
3890
- console.error("Error loading appropriateness test:", C), w(C.message || "Failed to load appropriateness test");
3924
+ } catch (R) {
3925
+ console.error("Error loading appropriateness test:", R), k(R.message || "Failed to load appropriateness test");
3891
3926
  } finally {
3892
3927
  c(!1);
3893
3928
  }
3894
3929
  })();
3895
3930
  }, [e, n]);
3896
- const D = (R) => {
3897
- const C = R.split(":").map(Number);
3898
- if (C.length === 3) {
3899
- const [q, f, L] = C;
3900
- return q * 3600 + f * 60 + L;
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;
3901
3936
  }
3902
3937
  return 0;
3903
- }, z = (R) => {
3904
- const C = Math.floor(R / 60), q = R % 60;
3905
- return `${C.toString().padStart(2, "0")}:${q.toString().padStart(2, "0")}`;
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")}`;
3906
3941
  };
3907
- V(() => {
3908
- if (!h || m <= 0) return;
3909
- const R = setInterval(() => {
3910
- N((C) => C <= 1 ? (S(!0), 0) : C - 1);
3942
+ G(() => {
3943
+ if (!f || p <= 0) return;
3944
+ const L = setInterval(() => {
3945
+ N((R) => R <= 1 ? (S(!0), 0) : R - 1);
3911
3946
  }, 1e3);
3912
- return () => clearInterval(R);
3913
- }, [h, m]), V(() => {
3914
- if (I <= 0) return;
3915
- const R = setInterval(() => {
3916
- Y((C) => C <= 1 ? 0 : C - 1);
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);
3917
3952
  }, 1e3);
3918
- return () => clearInterval(R);
3919
- }, [I]), V(() => {
3920
- E && !d && F();
3953
+ return () => clearInterval(L);
3954
+ }, [C]), G(() => {
3955
+ E && !d && I();
3921
3956
  }, [E]);
3922
- const g = () => {
3923
- s && (x(!0), N(s.testDurationSec));
3924
- }, P = (R, C) => {
3925
- b((q) => ({
3926
- ...q,
3927
- [R]: C
3957
+ const h = () => {
3958
+ s && (y(!0), N(s.testDurationSec));
3959
+ }, A = (L, R) => {
3960
+ m((Y) => ({
3961
+ ...Y,
3962
+ [L]: R
3928
3963
  }));
3929
- }, F = async (R) => {
3930
- if (R && R.preventDefault(), !!s) {
3964
+ }, I = async (L) => {
3965
+ if (L && L.preventDefault(), !!s) {
3931
3966
  if (!E) {
3932
- const C = s.appropriatenessQuestions.length - Object.keys(p).length;
3933
- if (C > 0) {
3934
- w(`Please answer all questions. ${C} question(s) remaining.`);
3967
+ const R = s.appropriatenessQuestions.length - Object.keys(g).length;
3968
+ if (R > 0) {
3969
+ k(`Please answer all questions. ${R} question(s) remaining.`);
3935
3970
  return;
3936
3971
  }
3937
3972
  }
3938
- u(!0), w(null);
3973
+ u(!0), k(null);
3939
3974
  try {
3940
- const C = s.appropriatenessQuestions.map(
3941
- (f) => ({
3942
- appropriatenessQuestionId: f.id,
3943
- value: p[f.id] || ""
3975
+ const R = s.appropriatenessQuestions.map(
3976
+ (x) => ({
3977
+ appropriatenessQuestionId: x.id,
3978
+ value: g[x.id] || ""
3944
3979
  // Empty string if not answered
3945
3980
  })
3946
- ), q = {
3981
+ ), Y = {
3947
3982
  applicantId: e,
3948
3983
  appropriatenessTestId: s.id,
3949
- appropriatenessQuestionResults: C
3984
+ appropriatenessQuestionResults: R
3950
3985
  };
3951
- console.log("Submitting appropriateness test:", q);
3986
+ console.log("Submitting appropriateness test:", Y);
3952
3987
  try {
3953
- const f = await n.fillAppropriatenessTest(q);
3954
- console.log("Appropriateness test result:", f), f.message && (f.message.toLowerCase().includes("pass") || f.message.toLowerCase().includes("success") || f.message.toLowerCase().includes("congratulations")) ? t == null || t() : (w(f.message || "Test completed. Please check the result."), x(!1), S(!1), b({}), setTimeout(() => G(), 1e3));
3955
- } catch (f) {
3956
- if (f.code === 400 && f.message) {
3957
- const L = f.message;
3958
- console.log("Test failed:", L), w(L), x(!1), S(!1), b({}), setTimeout(() => G(), 1500);
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);
3959
3994
  } else
3960
- throw f;
3995
+ throw x;
3961
3996
  }
3962
- } catch (C) {
3963
- console.error("Error submitting appropriateness test:", C), w(C.message || "Failed to submit test. Please try again."), x(!1), S(!1), b({});
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({});
3964
3999
  } finally {
3965
4000
  u(!1);
3966
4001
  }
3967
4002
  }
3968
- }, G = async () => {
4003
+ }, H = async () => {
3969
4004
  try {
3970
- const R = await n.getAppropriatenessTest(e);
3971
- if (console.log("Reloaded test data:", R), i(R), R.waitTimeSpanForNextTry && R.waitTimeSpanForNextTry !== "00:00:00") {
3972
- const C = D(R.waitTimeSpanForNextTry);
3973
- C > 0 && Y(C);
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);
3974
4009
  }
3975
- } catch (R) {
3976
- console.error("Error reloading test data:", R), w((C) => C + `
4010
+ } catch (L) {
4011
+ console.error("Error reloading test data:", L), k((R) => R + `
3977
4012
 
3978
4013
  Failed to reload test data. Please refresh the page.`);
3979
4014
  }
@@ -3986,25 +4021,25 @@ Failed to reload test data. Please refresh the page.`);
3986
4021
  if (!s)
3987
4022
  return /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
3988
4023
  /* @__PURE__ */ a("p", { className: "text-danger-500 text-lg mb-4", children: "No test data available" }),
3989
- k && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: k })
4024
+ w && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: w })
3990
4025
  ] }) });
3991
- if (I > 0)
4026
+ if (C > 0)
3992
4027
  return /* @__PURE__ */ o(M, { children: [
3993
- /* @__PURE__ */ o(te, { children: [
4028
+ /* @__PURE__ */ o(re, { children: [
3994
4029
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
3995
4030
  s.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: s.subtitle })
3996
4031
  ] }),
3997
4032
  /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
3998
4033
  /* @__PURE__ */ o("div", { className: "mb-6", children: [
3999
- /* @__PURE__ */ a("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: z(I) }),
4034
+ /* @__PURE__ */ a("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: F(C) }),
4000
4035
  /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait before attempting the test again" })
4001
4036
  ] }),
4002
- k && /* @__PURE__ */ a("div", { className: "mt-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ a("p", { className: "text-red-600 dark:text-red-400 text-sm", children: k }) })
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 }) })
4003
4038
  ] })
4004
4039
  ] });
4005
- const j = s.testAllowedMaxTry - s.totalFailedTries;
4006
- return h ? /* @__PURE__ */ a("form", { onSubmit: F, children: /* @__PURE__ */ o(M, { children: [
4007
- /* @__PURE__ */ a(te, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
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: [
4008
4043
  /* @__PURE__ */ o("div", { children: [
4009
4044
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
4010
4045
  s.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
@@ -4013,8 +4048,8 @@ Failed to reload test data. Please refresh the page.`);
4013
4048
  /* @__PURE__ */ a(
4014
4049
  "div",
4015
4050
  {
4016
- className: `text-3xl font-bold ${m <= 60 ? "text-danger-500" : "text-primary-500"}`,
4017
- children: z(m)
4051
+ className: `text-3xl font-bold ${p <= 60 ? "text-danger-500" : "text-primary-500"}`,
4052
+ children: F(p)
4018
4053
  }
4019
4054
  ),
4020
4055
  /* @__PURE__ */ a("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Time Remaining" })
@@ -4024,18 +4059,18 @@ Failed to reload test data. Please refresh the page.`);
4024
4059
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
4025
4060
  /* @__PURE__ */ o(pe, { variant: "info", children: [
4026
4061
  "Question ",
4027
- Object.keys(p).length,
4062
+ Object.keys(g).length,
4028
4063
  " of ",
4029
4064
  s.totalQuestionCount
4030
4065
  ] }),
4031
- /* @__PURE__ */ o(pe, { variant: j > 1 ? "success" : "warning", children: [
4032
- j,
4066
+ /* @__PURE__ */ o(pe, { variant: q > 1 ? "success" : "warning", children: [
4067
+ q,
4033
4068
  " attempt",
4034
- j !== 1 ? "s" : "",
4069
+ q !== 1 ? "s" : "",
4035
4070
  " remaining"
4036
4071
  ] })
4037
4072
  ] }),
4038
- s.appropriatenessQuestions.map((R, C) => /* @__PURE__ */ o(
4073
+ s.appropriatenessQuestions.map((L, R) => /* @__PURE__ */ o(
4039
4074
  "div",
4040
4075
  {
4041
4076
  className: "p-4 border border-gray-200 dark:border-gray-700 rounded-lg",
@@ -4043,51 +4078,51 @@ Failed to reload test data. Please refresh the page.`);
4043
4078
  /* @__PURE__ */ o("div", { className: "mb-4", children: [
4044
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: [
4045
4080
  "Question ",
4046
- C + 1
4081
+ R + 1
4047
4082
  ] }),
4048
- R.groupName && /* @__PURE__ */ a("span", { className: "ml-2 text-xs text-gray-500 dark:text-gray-400", children: R.groupName }),
4049
- /* @__PURE__ */ a("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children: R.question })
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 })
4050
4085
  ] }),
4051
- /* @__PURE__ */ a("div", { className: "space-y-2", children: R.answers.map((q, f) => /* @__PURE__ */ o(
4086
+ /* @__PURE__ */ a("div", { className: "space-y-2", children: L.answers.map((Y, x) => /* @__PURE__ */ o(
4052
4087
  "label",
4053
4088
  {
4054
4089
  className: `
4055
4090
  flex items-center p-3 border-2 rounded-lg cursor-pointer transition-all
4056
- ${p[R.id] === q ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}
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"}
4057
4092
  `,
4058
4093
  children: [
4059
4094
  /* @__PURE__ */ a(
4060
4095
  "input",
4061
4096
  {
4062
4097
  type: "radio",
4063
- name: `question-${R.id}`,
4064
- value: q,
4065
- checked: p[R.id] === q,
4066
- onChange: (L) => P(R.id, L.target.value),
4098
+ name: `question-${L.id}`,
4099
+ value: Y,
4100
+ checked: g[L.id] === Y,
4101
+ onChange: (P) => A(L.id, P.target.value),
4067
4102
  className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500",
4068
4103
  disabled: d
4069
4104
  }
4070
4105
  ),
4071
- /* @__PURE__ */ a("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children: q })
4106
+ /* @__PURE__ */ a("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children: Y })
4072
4107
  ]
4073
4108
  },
4074
- f
4109
+ x
4075
4110
  )) })
4076
4111
  ]
4077
4112
  },
4078
- R.id
4113
+ L.id
4079
4114
  )),
4080
- k && !E && /* @__PURE__ */ a("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
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: [
4081
4116
  /* @__PURE__ */ a("strong", { children: "Error:" }),
4082
4117
  " ",
4083
- k
4118
+ w
4084
4119
  ] }) }),
4085
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: [
4086
4121
  /* @__PURE__ */ a("strong", { children: "Time's up!" }),
4087
4122
  " Your answers are being submitted automatically."
4088
4123
  ] }) })
4089
4124
  ] }),
4090
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
4125
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
4091
4126
  /* @__PURE__ */ a(
4092
4127
  U,
4093
4128
  {
@@ -4103,13 +4138,13 @@ Failed to reload test data. Please refresh the page.`);
4103
4138
  {
4104
4139
  type: "submit",
4105
4140
  isLoading: d,
4106
- disabled: Object.keys(p).length < s.totalQuestionCount,
4141
+ disabled: Object.keys(g).length < s.totalQuestionCount,
4107
4142
  children: E ? "Submitting..." : "Submit Test"
4108
4143
  }
4109
4144
  )
4110
4145
  ] })
4111
4146
  ] }) }) : /* @__PURE__ */ o(M, { children: [
4112
- /* @__PURE__ */ o(te, { children: [
4147
+ /* @__PURE__ */ o(re, { children: [
4113
4148
  /* @__PURE__ */ a("h2", { className: "text-lg font-bold text-gray-900 dark:text-white", children: s.displayName }),
4114
4149
  s.subtitle && /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: s.subtitle })
4115
4150
  ] }),
@@ -4122,7 +4157,7 @@ Failed to reload test data. Please refresh the page.`);
4122
4157
  ] }),
4123
4158
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
4124
4159
  /* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Time Limit:" }),
4125
- /* @__PURE__ */ a(pe, { variant: "info", children: z(s.testDurationSec) })
4160
+ /* @__PURE__ */ a(pe, { variant: "info", children: F(s.testDurationSec) })
4126
4161
  ] }),
4127
4162
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
4128
4163
  /* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Correct Answers Required:" }),
@@ -4130,24 +4165,24 @@ Failed to reload test data. Please refresh the page.`);
4130
4165
  ] }),
4131
4166
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
4132
4167
  /* @__PURE__ */ a("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Attempts Remaining:" }),
4133
- /* @__PURE__ */ a(pe, { variant: j > 1 ? "success" : "warning", children: j })
4168
+ /* @__PURE__ */ a(pe, { variant: q > 1 ? "success" : "warning", children: q })
4134
4169
  ] })
4135
4170
  ] }),
4136
- k && /* @__PURE__ */ a("div", { className: "mb-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
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: [
4137
4172
  /* @__PURE__ */ a("strong", { children: "Previous Attempt:" }),
4138
4173
  " ",
4139
- k
4174
+ w
4140
4175
  ] }) }),
4141
- j <= 0 && /* @__PURE__ */ a("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ a("p", { className: "text-red-600 dark:text-red-400", children: "You have used all your attempts. Please contact support for assistance." }) })
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." }) })
4142
4177
  ] }),
4143
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
4178
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
4144
4179
  r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
4145
4180
  /* @__PURE__ */ a(
4146
4181
  U,
4147
4182
  {
4148
4183
  type: "button",
4149
- onClick: g,
4150
- disabled: j <= 0,
4184
+ onClick: h,
4185
+ disabled: q <= 0,
4151
4186
  children: "Start Test"
4152
4187
  }
4153
4188
  )
@@ -4158,8 +4193,8 @@ Failed to reload test data. Please refresh the page.`);
4158
4193
  onComplete: t,
4159
4194
  onBack: r
4160
4195
  }) => {
4161
- var q, f, L, $;
4162
- const { applicantService: n, baseInformationService: s, config: i } = se(), { identityData: l, provider: c, token: d, isLoading: u, error: k, requestIdentity: w, restartIdentity: p } = qt(e), [b, m] = v(null), [N, h] = v(null), [x, E] = v([]), [S, I] = v(!0), [Y, D] = v(!1), [z, g] = v(null), [P, F] = v(!1), G = ie.useRef(!1), j = Ve({
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({
4163
4198
  defaultValues: {
4164
4199
  street: "",
4165
4200
  streetNumber: "",
@@ -4170,21 +4205,21 @@ Failed to reload test data. Please refresh the page.`);
4170
4205
  phonenumber: ""
4171
4206
  }
4172
4207
  });
4173
- V(() => {
4208
+ G(() => {
4174
4209
  (async () => {
4175
4210
  try {
4176
- const [y, B] = await Promise.all([
4211
+ const [b, B] = await Promise.all([
4177
4212
  n.getApplicantData(e),
4178
4213
  s.getCountries("", "en")
4179
4214
  ]);
4180
- h(y);
4181
- const Q = /* @__PURE__ */ new Set(), X = B.filter((me) => {
4215
+ f(b);
4216
+ const V = /* @__PURE__ */ new Set(), X = B.filter((me) => {
4182
4217
  const Ee = me.abbreviation3 || me.abbreviation;
4183
- return !Ee || Q.has(Ee) ? !1 : (Q.add(Ee), !0);
4218
+ return !Ee || V.has(Ee) ? !1 : (V.add(Ee), !0);
4184
4219
  });
4185
4220
  E(X);
4186
- const _ = y.applicantRequestData;
4187
- if (j.reset({
4221
+ const _ = b.applicantRequestData;
4222
+ if (q.reset({
4188
4223
  street: (_ == null ? void 0 : _.street) || "",
4189
4224
  streetNumber: (_ == null ? void 0 : _.streetNumber) || "",
4190
4225
  city: (_ == null ? void 0 : _.city) || "",
@@ -4192,125 +4227,125 @@ Failed to reload test data. Please refresh the page.`);
4192
4227
  country: (_ == null ? void 0 : _.country) || "",
4193
4228
  nationality: (_ == null ? void 0 : _.nationality) || "",
4194
4229
  phonenumber: (_ == null ? void 0 : _.phonenumber) || ""
4195
- }), y.kycRecords && y.kycRecords.length > 0 && y.kycRecords[0].providerTokenObject !== null && !G.current) {
4196
- console.log("[Identity] Found existing identity verification, auto-requesting..."), G.current = !0;
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;
4197
4232
  try {
4198
- await w(), D(!0);
4233
+ await k(), W(!0);
4199
4234
  } catch (me) {
4200
4235
  console.error("[Identity] Auto-request failed:", me);
4201
4236
  }
4202
4237
  }
4203
- } catch (y) {
4204
- console.error("Error loading applicant data:", y);
4238
+ } catch (b) {
4239
+ console.error("Error loading applicant data:", b);
4205
4240
  } finally {
4206
- I(!1);
4241
+ C(!1);
4207
4242
  }
4208
4243
  })();
4209
- }, [e]), V(() => {
4210
- l && !Y && (console.log("[Identity] Identity data already loaded, showing provider"), D(!0));
4211
- }, [l, Y]), V(() => {
4244
+ }, [e]), G(() => {
4245
+ l && !O && (console.log("[Identity] Identity data already loaded, showing provider"), W(!0));
4246
+ }, [l, O]), G(() => {
4212
4247
  if (d) {
4213
4248
  if (d.expiresAt) {
4214
- const A = new Date(d.expiresAt).getTime();
4215
- if (Date.now() >= A) {
4216
- console.warn("[Identity] Token has expired (expiresAt)"), F(!0), g("Your verification session has expired. Please restart.");
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.");
4217
4252
  return;
4218
4253
  }
4219
4254
  }
4220
4255
  if (d.url)
4221
4256
  try {
4222
- const y = new URL(d.url).toString().toLowerCase();
4223
- if (y.includes("expired") || y.includes("invalid") || y.includes("error")) {
4224
- console.warn("[Identity] Token URL indicates expiration"), F(!0), g("Your verification link has expired. Please restart.");
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.");
4225
4260
  return;
4226
4261
  }
4227
4262
  } catch {
4228
4263
  console.error("[Identity] Invalid token URL");
4229
4264
  }
4230
4265
  if (d.status === "expired" || d.error === "expired" || d.expired === !0) {
4231
- console.warn("[Identity] Token object indicates expiration"), F(!0), g("Your verification session has expired. Please restart.");
4266
+ console.warn("[Identity] Token object indicates expiration"), I(!0), h("Your verification session has expired. Please restart.");
4232
4267
  return;
4233
4268
  }
4234
4269
  }
4235
- }, [d]), V(() => {
4236
- if (c !== null && d && !b && Y && !P) {
4237
- const A = c;
4270
+ }, [d]), G(() => {
4271
+ if (c !== null && d && !m && O && !A) {
4272
+ const D = c;
4238
4273
  if (d.url) {
4239
- console.log("[Identity] Loading provider URL for user verification:", d.url), g(null);
4274
+ console.log("[Identity] Loading provider URL for user verification:", d.url), h(null);
4240
4275
  try {
4241
- if (new URL(d.url), A === oe.SardinAI) {
4276
+ if (new URL(d.url), D === oe.SardinAI) {
4242
4277
  console.log("[SardinAI] Initializing Risk SDK in background...");
4243
4278
  try {
4244
- const y = xe.parseProviderConfig(c, d, i);
4245
- xe.createProvider(c, y).initialize().then(() => {
4279
+ const b = xe.parseProviderConfig(c, d, i);
4280
+ xe.createProvider(c, b).initialize().then(() => {
4246
4281
  console.log("[SardinAI] Risk SDK initialized successfully in background");
4247
- }).catch((Q) => {
4248
- console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):", Q);
4282
+ }).catch((V) => {
4283
+ console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):", V);
4249
4284
  });
4250
- } catch (y) {
4251
- console.warn("[SardinAI] Risk SDK setup failed (non-blocking):", y);
4285
+ } catch (b) {
4286
+ console.warn("[SardinAI] Risk SDK setup failed (non-blocking):", b);
4252
4287
  }
4253
4288
  }
4254
- m({ type: "url", url: d.url });
4255
- } catch (y) {
4256
- console.error("[Identity] Invalid URL:", y), g("Invalid verification URL. Please restart."), F(!0);
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);
4257
4292
  }
4258
4293
  return;
4259
4294
  }
4260
- if (A === oe.SardinAI) {
4261
- console.log("[SardinAI] No URL provided - initializing Risk SDK only..."), g(null);
4295
+ if (D === oe.SardinAI) {
4296
+ console.log("[SardinAI] No URL provided - initializing Risk SDK only..."), h(null);
4262
4297
  try {
4263
- const y = xe.parseProviderConfig(c, d, i), B = xe.createProvider(c, y);
4298
+ const b = xe.parseProviderConfig(c, d, i), B = xe.createProvider(c, b);
4264
4299
  B.initialize().then(() => {
4265
- console.log("[SardinAI] Risk SDK initialized successfully"), m(B), setTimeout(() => {
4300
+ console.log("[SardinAI] Risk SDK initialized successfully"), p(B), setTimeout(() => {
4266
4301
  t == null || t();
4267
4302
  }, 2e3);
4268
- }).catch((Q) => {
4303
+ }).catch((V) => {
4269
4304
  var _;
4270
- console.error("[SardinAI] Failed to initialize:", Q);
4271
- const X = ((_ = Q.message) == null ? void 0 : _.toLowerCase()) || "";
4272
- X.includes("expired") || X.includes("invalid") || X.includes("401") || X.includes("400") ? (F(!0), g("Session expired or invalid. Please restart verification.")) : g(`Failed to initialize: ${Q.message}`);
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}`);
4273
4308
  });
4274
- } catch (y) {
4275
- console.error("[SardinAI] Error creating provider:", y), g(`Configuration error: ${y.message}`);
4309
+ } catch (b) {
4310
+ console.error("[SardinAI] Error creating provider:", b), h(`Configuration error: ${b.message}`);
4276
4311
  }
4277
4312
  return;
4278
4313
  }
4279
4314
  try {
4280
- g(null);
4281
- const y = xe.parseProviderConfig(c, d, i), B = xe.createProvider(c, y);
4282
- A === oe.Sumsub ? (B.initialize("identity-container").catch((Q) => {
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) => {
4283
4318
  var X;
4284
- console.error("[Sumsub] Initialization error:", Q), g(`Failed to initialize: ${Q.message}`), (X = Q.message) != null && X.toLowerCase().includes("expired") && F(!0);
4319
+ console.error("[Sumsub] Initialization error:", V), h(`Failed to initialize: ${V.message}`), (X = V.message) != null && X.toLowerCase().includes("expired") && I(!0);
4285
4320
  }), B.onComplete && B.onComplete(() => {
4286
4321
  t == null || t();
4287
- })) : A === oe.Onfido && B.initialize("identity-container").catch((Q) => {
4288
- console.error("[Onfido] Initialization error:", Q), g(`Failed to initialize: ${Q.message}`);
4289
- }), m(B);
4290
- } catch (y) {
4291
- console.error("[Identity] Provider setup error:", y), g(`Setup error: ${y.message}`);
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}`);
4292
4327
  }
4293
4328
  }
4294
4329
  return () => {
4295
- if (b && b.destroy)
4330
+ if (m && m.destroy)
4296
4331
  try {
4297
- b.destroy();
4298
- } catch (A) {
4299
- console.error("[Identity] Error destroying provider:", A);
4332
+ m.destroy();
4333
+ } catch (D) {
4334
+ console.error("[Identity] Error destroying provider:", D);
4300
4335
  }
4301
4336
  };
4302
- }, [c, d, b, Y, t, P]);
4303
- const R = async () => {
4337
+ }, [c, d, m, O, t, A]);
4338
+ const L = async () => {
4304
4339
  try {
4305
- g(null), F(!1), await w(), D(!0);
4306
- } catch (A) {
4307
- console.error("Error starting identity verification:", A);
4340
+ h(null), I(!1), await k(), W(!0);
4341
+ } catch (D) {
4342
+ console.error("Error starting identity verification:", D);
4308
4343
  }
4309
- }, C = async () => {
4344
+ }, R = async () => {
4310
4345
  try {
4311
- g(null), F(!1), m(null), console.log("[Identity] Restarting verification..."), await p(), D(!0);
4312
- } catch (A) {
4313
- console.error("Error restarting identity verification:", A), g(A.message || "Failed to restart 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");
4314
4349
  }
4315
4350
  };
4316
4351
  if (S || u)
@@ -4318,14 +4353,14 @@ Failed to reload test data. Please refresh the page.`);
4318
4353
  /* @__PURE__ */ a(ce, { className: "my-8" }),
4319
4354
  /* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading identity verification..." })
4320
4355
  ] }) });
4321
- if (k)
4356
+ if (w)
4322
4357
  return /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
4323
4358
  "Error: ",
4324
- k.message
4359
+ w.message
4325
4360
  ] }) }) });
4326
- if (Y && (z || P))
4361
+ if (O && (F || A))
4327
4362
  return /* @__PURE__ */ o(M, { children: [
4328
- /* @__PURE__ */ a(te, { children: /* @__PURE__ */ a("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
4363
+ /* @__PURE__ */ a(re, { children: /* @__PURE__ */ a("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
4329
4364
  /* @__PURE__ */ o(T, { children: [
4330
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: [
4331
4366
  /* @__PURE__ */ a(
@@ -4347,8 +4382,8 @@ Failed to reload test data. Please refresh the page.`);
4347
4382
  }
4348
4383
  ),
4349
4384
  /* @__PURE__ */ o("div", { children: [
4350
- /* @__PURE__ */ a("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-1", children: P ? "Session Expired" : "Verification Error" }),
4351
- /* @__PURE__ */ a("p", { className: "text-red-800 dark:text-red-200 text-sm", children: z || "Your verification session has expired and needs to be restarted." })
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." })
4352
4387
  ] })
4353
4388
  ] }) }),
4354
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: [
@@ -4360,15 +4395,15 @@ Failed to reload test data. Please refresh the page.`);
4360
4395
  ] })
4361
4396
  ] })
4362
4397
  ] }),
4363
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
4398
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
4364
4399
  r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
4365
- /* @__PURE__ */ a(U, { type: "button", onClick: C, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
4400
+ /* @__PURE__ */ a(U, { type: "button", onClick: R, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
4366
4401
  ] })
4367
4402
  ] });
4368
- if (Y && l) {
4369
- const A = c;
4403
+ if (O && l) {
4404
+ const D = c;
4370
4405
  return d != null && d.url ? /* @__PURE__ */ o(M, { children: [
4371
- /* @__PURE__ */ a(te, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
4406
+ /* @__PURE__ */ a(re, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
4372
4407
  /* @__PURE__ */ o("div", { children: [
4373
4408
  /* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
4374
4409
  /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
@@ -4379,7 +4414,7 @@ Failed to reload test data. Please refresh the page.`);
4379
4414
  type: "button",
4380
4415
  variant: "outline",
4381
4416
  size: "sm",
4382
- onClick: C,
4417
+ onClick: R,
4383
4418
  disabled: u,
4384
4419
  children: "Restart"
4385
4420
  }
@@ -4397,14 +4432,14 @@ Failed to reload test data. Please refresh the page.`);
4397
4432
  className: "w-full h-full border-0 rounded-lg",
4398
4433
  allow: "camera; microphone; geolocation",
4399
4434
  title: "Identity Verification",
4400
- onLoad: (y) => {
4401
- var B, Q, X;
4435
+ onLoad: (b) => {
4436
+ var B, V, X;
4402
4437
  console.log("[Identity] Iframe loaded");
4403
4438
  try {
4404
- const _ = y.target, Ie = _.contentDocument || ((B = _.contentWindow) == null ? void 0 : B.document);
4439
+ const _ = b.target, Ie = _.contentDocument || ((B = _.contentWindow) == null ? void 0 : B.document);
4405
4440
  if (Ie) {
4406
- const me = ((X = (Q = Ie.body) == null ? void 0 : Q.textContent) == null ? void 0 : X.toLowerCase()) || "";
4407
- (me.includes("expired") || me.includes("invalid") || me.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"), F(!0), g("Your verification link has expired."));
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."));
4408
4443
  }
4409
4444
  } catch {
4410
4445
  console.log("[Identity] Cannot check iframe content (CORS)");
@@ -4413,9 +4448,9 @@ Failed to reload test data. Please refresh the page.`);
4413
4448
  }
4414
4449
  ) })
4415
4450
  ] }),
4416
- r && /* @__PURE__ */ a(ne, { children: /* @__PURE__ */ a(U, { variant: "outline", onClick: r, children: "Back" }) })
4417
- ] }) : A === oe.SardinAI ? /* @__PURE__ */ o(M, { children: [
4418
- /* @__PURE__ */ o(te, { children: [
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: [
4419
4454
  /* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Device Risk Assessment" }),
4420
4455
  /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Analyzing device security and behavioral patterns..." })
4421
4456
  ] }),
@@ -4425,16 +4460,16 @@ Failed to reload test data. Please refresh the page.`);
4425
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" })
4426
4461
  ] }) })
4427
4462
  ] }) : /* @__PURE__ */ o(M, { children: [
4428
- /* @__PURE__ */ o(te, { children: [
4463
+ /* @__PURE__ */ o(re, { children: [
4429
4464
  /* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
4430
4465
  /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
4431
4466
  ] }),
4432
4467
  /* @__PURE__ */ a(T, { children: /* @__PURE__ */ a("div", { id: "identity-container", className: "min-h-[400px]" }) }),
4433
- r && /* @__PURE__ */ a(ne, { children: /* @__PURE__ */ a(U, { variant: "outline", onClick: r, children: "Back" }) })
4468
+ r && /* @__PURE__ */ a(se, { children: /* @__PURE__ */ a(U, { variant: "outline", onClick: r, children: "Back" }) })
4434
4469
  ] });
4435
4470
  }
4436
- return /* @__PURE__ */ a("form", { onSubmit: j.handleSubmit(R), children: /* @__PURE__ */ o(M, { children: [
4437
- /* @__PURE__ */ o(te, { children: [
4471
+ return /* @__PURE__ */ a("form", { onSubmit: q.handleSubmit(L), children: /* @__PURE__ */ o(M, { children: [
4472
+ /* @__PURE__ */ o(re, { children: [
4438
4473
  /* @__PURE__ */ a("h2", { className: "text-2xl font-bold", children: "Review Your Information" }),
4439
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" })
4440
4475
  ] }),
@@ -4443,14 +4478,14 @@ Failed to reload test data. Please refresh the page.`);
4443
4478
  /* @__PURE__ */ o("div", { children: [
4444
4479
  /* @__PURE__ */ a("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
4445
4480
  /* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
4446
- (q = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : q.firstName,
4481
+ (Y = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : Y.firstName,
4447
4482
  " ",
4448
- (f = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : f.lastName
4483
+ (x = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : x.lastName
4449
4484
  ] })
4450
4485
  ] }),
4451
4486
  /* @__PURE__ */ o("div", { children: [
4452
4487
  /* @__PURE__ */ a("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Email" }),
4453
- /* @__PURE__ */ a("p", { className: "mt-1 text-base", children: (L = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : L.email })
4488
+ /* @__PURE__ */ a("p", { className: "mt-1 text-base", children: (P = N == null ? void 0 : N.applicantRequestData) == null ? void 0 : P.email })
4454
4489
  ] }),
4455
4490
  /* @__PURE__ */ o("div", { children: [
4456
4491
  /* @__PURE__ */ a("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Date of Birth" }),
@@ -4463,18 +4498,18 @@ Failed to reload test data. Please refresh the page.`);
4463
4498
  /* @__PURE__ */ a(
4464
4499
  ye,
4465
4500
  {
4466
- control: j.control,
4501
+ control: q.control,
4467
4502
  name: "country",
4468
- render: ({ field: A }) => /* @__PURE__ */ a(
4503
+ render: ({ field: D }) => /* @__PURE__ */ a(
4469
4504
  ge,
4470
4505
  {
4471
- ...A,
4506
+ ...D,
4472
4507
  label: "Country",
4473
4508
  options: [
4474
4509
  { value: "", label: "Select country..." },
4475
- ...x.map((y) => ({
4476
- value: y.abbreviation3 || y.abbreviation,
4477
- label: y.name
4510
+ ...y.map((b) => ({
4511
+ value: b.abbreviation3 || b.abbreviation,
4512
+ label: b.name
4478
4513
  }))
4479
4514
  ]
4480
4515
  }
@@ -4484,18 +4519,18 @@ Failed to reload test data. Please refresh the page.`);
4484
4519
  /* @__PURE__ */ a(
4485
4520
  ye,
4486
4521
  {
4487
- control: j.control,
4522
+ control: q.control,
4488
4523
  name: "nationality",
4489
- render: ({ field: A }) => /* @__PURE__ */ a(
4524
+ render: ({ field: D }) => /* @__PURE__ */ a(
4490
4525
  ge,
4491
4526
  {
4492
- ...A,
4527
+ ...D,
4493
4528
  label: "Nationality",
4494
4529
  options: [
4495
4530
  { value: "", label: "Select nationality..." },
4496
- ...x.map((y) => ({
4497
- value: y.abbreviation3 || y.abbreviation,
4498
- label: y.name
4531
+ ...y.map((b) => ({
4532
+ value: b.abbreviation3 || b.abbreviation,
4533
+ label: b.name
4499
4534
  }))
4500
4535
  ]
4501
4536
  }
@@ -4507,17 +4542,17 @@ Failed to reload test data. Please refresh the page.`);
4507
4542
  /* @__PURE__ */ a(
4508
4543
  ye,
4509
4544
  {
4510
- control: j.control,
4545
+ control: q.control,
4511
4546
  name: "street",
4512
- render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "Street" })
4547
+ render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "Street" })
4513
4548
  }
4514
4549
  ),
4515
4550
  /* @__PURE__ */ a(
4516
4551
  ye,
4517
4552
  {
4518
- control: j.control,
4553
+ control: q.control,
4519
4554
  name: "streetNumber",
4520
- render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "Street Number" })
4555
+ render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "Street Number" })
4521
4556
  }
4522
4557
  )
4523
4558
  ] }),
@@ -4525,31 +4560,31 @@ Failed to reload test data. Please refresh the page.`);
4525
4560
  /* @__PURE__ */ a(
4526
4561
  ye,
4527
4562
  {
4528
- control: j.control,
4563
+ control: q.control,
4529
4564
  name: "city",
4530
- render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "City" })
4565
+ render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "City" })
4531
4566
  }
4532
4567
  ),
4533
4568
  /* @__PURE__ */ a(
4534
4569
  ye,
4535
4570
  {
4536
- control: j.control,
4571
+ control: q.control,
4537
4572
  name: "zip",
4538
- render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "ZIP/Postal Code" })
4573
+ render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "ZIP/Postal Code" })
4539
4574
  }
4540
4575
  )
4541
4576
  ] }),
4542
4577
  /* @__PURE__ */ a(
4543
4578
  ye,
4544
4579
  {
4545
- control: j.control,
4580
+ control: q.control,
4546
4581
  name: "phonenumber",
4547
- render: ({ field: A }) => /* @__PURE__ */ a(ae, { ...A, label: "Phone Number", type: "tel" })
4582
+ render: ({ field: D }) => /* @__PURE__ */ a(ne, { ...D, label: "Phone Number", type: "tel" })
4548
4583
  }
4549
4584
  )
4550
4585
  ] })
4551
4586
  ] }),
4552
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
4587
+ /* @__PURE__ */ o(se, { className: "flex justify-between", children: [
4553
4588
  r && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: r, children: "Back" }),
4554
4589
  /* @__PURE__ */ a(U, { type: "submit", isLoading: u, children: "Confirm and Start Verification" })
4555
4590
  ] })
@@ -4687,7 +4722,7 @@ Failed to reload test data. Please refresh the page.`);
4687
4722
  ] })
4688
4723
  ] }) })
4689
4724
  ] }),
4690
- /* @__PURE__ */ o(ne, { className: "flex justify-center gap-4", children: [
4725
+ /* @__PURE__ */ o(se, { className: "flex justify-center gap-4", children: [
4691
4726
  c.type === "success" && s && /* @__PURE__ */ a(U, { onClick: s, size: "lg", children: "Continue" }),
4692
4727
  c.type === "error" && /* @__PURE__ */ o(Qe, { children: [
4693
4728
  i && /* @__PURE__ */ a(U, { variant: "outline", onClick: i, children: "Contact Support" }),
@@ -4716,7 +4751,7 @@ Failed to reload test data. Please refresh the page.`);
4716
4751
  subtitle: t,
4717
4752
  className: r = ""
4718
4753
  }) => {
4719
- const { currentTheme: n } = se(), s = e || (n == null ? void 0 : n.title) || "", i = !!(n != null && n.logo && n.logo.visible && n.logo.url), l = !!s;
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;
4720
4755
  return !i && !l ? null : /* @__PURE__ */ o("div", { className: `metakyc-header ${r}`, children: [
4721
4756
  /* @__PURE__ */ o("div", { className: "metakyc-header-title flex items-center text-xl font-bold text-gray-900 dark:text-white", children: [
4722
4757
  i && /* @__PURE__ */ a(br, { config: n.logo }),
@@ -4732,33 +4767,33 @@ Failed to reload test data. Please refresh the page.`);
4732
4767
  ] }),
4733
4768
  t && /* @__PURE__ */ a("p", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: t })
4734
4769
  ] });
4735
- }, Or = ({
4770
+ }, Br = ({
4736
4771
  workflowKey: e,
4737
4772
  externalRefId: t,
4738
4773
  onSuccess: r,
4739
4774
  onCancel: n
4740
4775
  }) => {
4741
- var R, C, q;
4742
- const { config: s, baseInformationService: i, currentTheme: l } = se(), { createApplicant: c, isLoading: d } = Wt(), [u, k] = v([]), [w, p] = v(!0), [b, m] = v(!1), [N, h] = v(null), x = W(!1), E = W(!1), S = e || ((R = s.applicantForm) == null ? void 0 : R.workflowKey);
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);
4743
4778
  if (!S)
4744
4779
  throw new Error(
4745
4780
  "workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
4746
4781
  );
4747
- const I = t || ((C = s.applicantForm) == null ? void 0 : C.externalRefId) || "", Y = ["firstName", "lastName", "email", "phonenumber", "dateOfBirth"], D = ie.useMemo(() => {
4748
- const f = new Set(Y), L = l == null ? void 0 : l.applicantFormRequiredFields;
4749
- if (L && L.length > 0)
4750
- for (const $ of L)
4751
- f.add($);
4752
- return Array.from(f);
4753
- }, [l == null ? void 0 : l.applicantFormRequiredFields]), z = ie.useMemo(() => {
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;
4784
+ if (P && P.length > 0)
4785
+ for (const $ of P)
4786
+ x.add($);
4787
+ return Array.from(x);
4788
+ }, [l == null ? void 0 : l.applicantFormRequiredFields]), F = te.useMemo(() => {
4754
4789
  var $;
4755
- let f;
4756
- ($ = s.applicantForm) != null && $.visibleFields ? f = s.applicantForm.visibleFields : l != null && l.applicantFormVisibleFields && l.applicantFormVisibleFields.length > 0 ? f = l.applicantFormVisibleFields : f = ot;
4757
- const L = new Set(f);
4758
- for (const A of Y)
4759
- L.add(A);
4760
- return Array.from(L);
4761
- }, [(q = s.applicantForm) == null ? void 0 : q.visibleFields, l == null ? void 0 : l.applicantFormVisibleFields]), [g, P] = v({
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);
4795
+ return Array.from(P);
4796
+ }, [(Y = s.applicantForm) == null ? void 0 : Y.visibleFields, l == null ? void 0 : l.applicantFormVisibleFields]), [h, A] = v({
4762
4797
  workflowKey: S,
4763
4798
  firstName: "",
4764
4799
  lastName: "",
@@ -4766,7 +4801,7 @@ Failed to reload test data. Please refresh the page.`);
4766
4801
  email: "",
4767
4802
  dateOfBirth: "",
4768
4803
  phonenumber: "",
4769
- externalRefId: I,
4804
+ externalRefId: C,
4770
4805
  // Set from config or prop
4771
4806
  mobileCountryCode: "",
4772
4807
  street: "",
@@ -4785,91 +4820,91 @@ Failed to reload test data. Please refresh the page.`);
4785
4820
  occupation: "",
4786
4821
  taxNumber: ""
4787
4822
  });
4788
- V(() => {
4823
+ G(() => {
4789
4824
  (async () => {
4790
- if (x.current || E.current) {
4825
+ if (y.current || E.current) {
4791
4826
  console.log("[CreateApplicant] Countries already loading or loaded, skipping...");
4792
4827
  return;
4793
4828
  }
4794
- x.current = !0, p(!0);
4829
+ y.current = !0, g(!0);
4795
4830
  try {
4796
- const L = await i.getCountries("", s.locale || "en"), $ = /* @__PURE__ */ new Set(), A = L.map((y) => ({
4797
- value: y.abbreviation3 || y.abbreviation,
4798
- label: y.name
4799
- })).filter((y) => !y.value || $.has(y.value) ? !1 : ($.add(y.value), !0));
4800
- k(A), E.current = !0;
4801
- } catch (L) {
4802
- console.error("Failed to load countries:", L);
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;
4836
+ } catch (P) {
4837
+ console.error("Failed to load countries:", P);
4803
4838
  } finally {
4804
- p(!1), x.current = !1;
4839
+ g(!1), y.current = !1;
4805
4840
  }
4806
4841
  })();
4807
4842
  }, []);
4808
- const F = (f, L) => {
4809
- P(($) => ({ ...$, [f]: L }));
4810
- }, G = async (f) => {
4811
- var L;
4812
- f.preventDefault(), m(!0), h(null);
4843
+ const I = (x, P) => {
4844
+ A(($) => ({ ...$, [x]: P }));
4845
+ }, H = async (x) => {
4846
+ var P;
4847
+ x.preventDefault(), p(!0), f(null);
4813
4848
  try {
4814
- if (!g.externalRefId || g.externalRefId.trim() === "") {
4815
- h("External Reference ID is required. Please pass it via config.applicantForm.externalRefId."), m(!1);
4849
+ if (!h.externalRefId || h.externalRefId.trim() === "") {
4850
+ f("External Reference ID is required. Please pass it via config.applicantForm.externalRefId."), p(!1);
4816
4851
  return;
4817
4852
  }
4818
- for (const y of D) {
4819
- const B = g[y];
4853
+ for (const b of W) {
4854
+ const B = h[b];
4820
4855
  if (B == null || B === "" || Array.isArray(B) && B.length === 0) {
4821
- const X = ((L = Pe[y]) == null ? void 0 : L.label) || y;
4822
- h(`${X} is required.`), m(!1);
4856
+ const X = ((P = Pe[b]) == null ? void 0 : P.label) || b;
4857
+ f(`${X} is required.`), p(!1);
4823
4858
  return;
4824
4859
  }
4825
4860
  }
4826
4861
  const $ = {
4827
- workflowKey: g.workflowKey,
4828
- externalRefId: g.externalRefId.trim()
4862
+ workflowKey: h.workflowKey,
4863
+ externalRefId: h.externalRefId.trim()
4829
4864
  // Always include, never empty
4830
4865
  };
4831
- z.forEach((y) => {
4832
- if (y === "externalRefId") return;
4833
- const B = g[y];
4834
- B != null && B !== "" && !(Array.isArray(B) && B.length === 0) && ($[y] = B);
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);
4835
4870
  }), console.log("Creating applicant with data:", $);
4836
- const A = await c(
4871
+ const D = await c(
4837
4872
  $
4838
4873
  );
4839
- console.log("Applicant created:", A), r(A.applicantId);
4874
+ console.log("Applicant created:", D), r(D.applicantId);
4840
4875
  } catch ($) {
4841
- console.error("Error creating applicant:", $), h($.message || "Failed to create applicant");
4876
+ console.error("Error creating applicant:", $), f($.message || "Failed to create applicant");
4842
4877
  } finally {
4843
- m(!1);
4878
+ p(!1);
4844
4879
  }
4845
- }, j = (f) => {
4846
- var A;
4847
- const L = Pe[f], $ = D.includes(f);
4848
- switch (L.type) {
4880
+ }, q = (x) => {
4881
+ var D;
4882
+ const P = Pe[x], $ = W.includes(x);
4883
+ switch (P.type) {
4849
4884
  case "select":
4850
- if (f === "country" || f === "nationality" || f === "taxCountry" || f === "countryOfBirth")
4885
+ if (x === "country" || x === "nationality" || x === "taxCountry" || x === "countryOfBirth")
4851
4886
  return /* @__PURE__ */ a(
4852
4887
  ge,
4853
4888
  {
4854
- label: L.label,
4855
- value: g[f] || "",
4856
- onChange: (y) => F(f, y.target.value),
4889
+ label: P.label,
4890
+ value: h[x] || "",
4891
+ onChange: (b) => I(x, b.target.value),
4857
4892
  options: [
4858
- { value: "", label: `Select ${L.label.toLowerCase()}...` },
4893
+ { value: "", label: `Select ${P.label.toLowerCase()}...` },
4859
4894
  ...u
4860
4895
  ],
4861
- disabled: w,
4896
+ disabled: k,
4862
4897
  required: $
4863
4898
  },
4864
- f
4899
+ x
4865
4900
  );
4866
- if (f === "salutation")
4901
+ if (x === "salutation")
4867
4902
  return /* @__PURE__ */ a(
4868
4903
  ge,
4869
4904
  {
4870
- label: L.label,
4871
- value: ((A = g[f]) == null ? void 0 : A.toString()) || "",
4872
- onChange: (y) => F(f, y.target.value ? Number(y.target.value) : null),
4905
+ label: P.label,
4906
+ value: ((D = h[x]) == null ? void 0 : D.toString()) || "",
4907
+ onChange: (b) => I(x, b.target.value ? Number(b.target.value) : null),
4873
4908
  options: [
4874
4909
  { value: "", label: "Select salutation..." },
4875
4910
  { value: Ce.Male.toString(), label: "Male" },
@@ -4878,96 +4913,96 @@ Failed to reload test data. Please refresh the page.`);
4878
4913
  ],
4879
4914
  required: $
4880
4915
  },
4881
- f
4916
+ x
4882
4917
  );
4883
- if (f === "defaultLanguage") {
4884
- const y = l != null && l.allowedLanguages && l.allowedLanguages.length > 0 ? Le.filter((B) => l.allowedLanguages.includes(B.value)) : Le;
4918
+ if (x === "defaultLanguage") {
4919
+ const b = l != null && l.allowedLanguages && l.allowedLanguages.length > 0 ? Le.filter((B) => l.allowedLanguages.includes(B.value)) : Le;
4885
4920
  return /* @__PURE__ */ a(
4886
4921
  ge,
4887
4922
  {
4888
- label: L.label,
4889
- value: g[f] || "",
4890
- onChange: (B) => F(f, B.target.value),
4923
+ label: P.label,
4924
+ value: h[x] || "",
4925
+ onChange: (B) => I(x, B.target.value),
4891
4926
  options: [
4892
4927
  { value: "", label: "Select language..." },
4893
- ...y
4928
+ ...b
4894
4929
  ],
4895
4930
  required: $
4896
4931
  },
4897
- f
4932
+ x
4898
4933
  );
4899
4934
  }
4900
4935
  return null;
4901
4936
  case "multiselect":
4902
- return f === "otherNationality" ? /* @__PURE__ */ a(
4937
+ return x === "otherNationality" ? /* @__PURE__ */ a(
4903
4938
  Qt,
4904
4939
  {
4905
- label: L.label,
4906
- value: g[f] || [],
4907
- onChange: (y) => F(f, y),
4940
+ label: P.label,
4941
+ value: h[x] || [],
4942
+ onChange: (b) => I(x, b),
4908
4943
  options: u,
4909
4944
  placeholder: "Select other nationalities...",
4910
- disabled: w,
4945
+ disabled: k,
4911
4946
  required: $
4912
4947
  },
4913
- f
4948
+ x
4914
4949
  ) : null;
4915
4950
  case "date":
4916
4951
  return /* @__PURE__ */ a(
4917
- ae,
4952
+ ne,
4918
4953
  {
4919
4954
  type: "date",
4920
- label: L.label,
4921
- value: g[f] || "",
4922
- onChange: (y) => F(f, y.target.value),
4955
+ label: P.label,
4956
+ value: h[x] || "",
4957
+ onChange: (b) => I(x, b.target.value),
4923
4958
  required: $
4924
4959
  },
4925
- f
4960
+ x
4926
4961
  );
4927
4962
  case "email":
4928
4963
  return /* @__PURE__ */ a(
4929
- ae,
4964
+ ne,
4930
4965
  {
4931
4966
  type: "email",
4932
- label: L.label,
4933
- value: g[f] || "",
4934
- onChange: (y) => F(f, y.target.value),
4967
+ label: P.label,
4968
+ value: h[x] || "",
4969
+ onChange: (b) => I(x, b.target.value),
4935
4970
  required: $
4936
4971
  },
4937
- f
4972
+ x
4938
4973
  );
4939
4974
  case "tel":
4940
4975
  return /* @__PURE__ */ a(
4941
- ae,
4976
+ ne,
4942
4977
  {
4943
4978
  type: "tel",
4944
- label: L.label,
4945
- value: g[f] || "",
4946
- onChange: (y) => F(f, y.target.value),
4979
+ label: P.label,
4980
+ value: h[x] || "",
4981
+ onChange: (b) => I(x, b.target.value),
4947
4982
  required: $
4948
4983
  },
4949
- f
4984
+ x
4950
4985
  );
4951
4986
  case "text":
4952
4987
  default:
4953
4988
  return /* @__PURE__ */ a(
4954
- ae,
4989
+ ne,
4955
4990
  {
4956
4991
  type: "text",
4957
- label: L.label,
4958
- value: g[f] || "",
4959
- onChange: (y) => F(f, y.target.value),
4992
+ label: P.label,
4993
+ value: h[x] || "",
4994
+ onChange: (b) => I(x, b.target.value),
4960
4995
  required: $
4961
4996
  },
4962
- f
4997
+ x
4963
4998
  );
4964
4999
  }
4965
5000
  };
4966
- return w ? /* @__PURE__ */ a("div", { className: "metakyc-sdk", children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
5001
+ return k ? /* @__PURE__ */ a("div", { className: "metakyc-sdk", children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
4967
5002
  /* @__PURE__ */ a(ce, { className: "my-8" }),
4968
5003
  /* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading form..." })
4969
- ] }) }) }) : /* @__PURE__ */ a("div", { className: "metakyc-sdk", children: /* @__PURE__ */ a("form", { onSubmit: G, children: /* @__PURE__ */ o(M, { children: [
4970
- /* @__PURE__ */ a(te, { children: /* @__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(
4971
5006
  Ke,
4972
5007
  {
4973
5008
  title: "Create Applicant",
@@ -4980,11 +5015,11 @@ Failed to reload test data. Please refresh the page.`);
4980
5015
  " ",
4981
5016
  N
4982
5017
  ] }) }),
4983
- /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: z.map((f) => j(f)) })
5018
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: F.map((x) => q(x)) })
4984
5019
  ] }),
4985
- /* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
4986
- n && /* @__PURE__ */ a(U, { type: "button", variant: "outline", onClick: n, disabled: b || d, children: "Cancel" }),
4987
- /* @__PURE__ */ a(U, { type: "submit", isLoading: b || d, children: "Create Applicant" })
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" })
4988
5023
  ] })
4989
5024
  ] }) }) });
4990
5025
  }, zr = ({
@@ -5000,31 +5035,31 @@ Failed to reload test data. Please refresh the page.`);
5000
5035
  steps: c,
5001
5036
  workflowKey: d,
5002
5037
  nextWorkflowKey: u,
5003
- hasWorkflowChanged: k,
5004
- isLoading: w,
5005
- error: p,
5006
- moveBack: b,
5007
- refreshProgress: m
5008
- } = Ut(e), [N, h] = ie.useState(!1);
5009
- if (ie.useEffect(() => {
5010
- p && r && r(p);
5011
- }, [p, r]), ie.useEffect(() => {
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(() => {
5012
5047
  i != null && i.workflowResult && t && t(i.workflowResult);
5013
- }, [i == null ? void 0 : i.workflowResult, t]), ie.useEffect(() => {
5048
+ }, [i == null ? void 0 : i.workflowResult, t]), te.useEffect(() => {
5014
5049
  n === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
5015
- }, [n]), ie.useEffect(() => {
5016
- k && h(!1);
5017
- }, [k]), w || !i)
5050
+ }, [n]), te.useEffect(() => {
5051
+ w && f(!1);
5052
+ }, [w]), k || !i)
5018
5053
  return /* @__PURE__ */ a("div", { className: s, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ o(T, { children: [
5019
5054
  /* @__PURE__ */ a(ce, { className: "my-8" }),
5020
5055
  /* @__PURE__ */ a("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading workflow..." })
5021
5056
  ] }) }) });
5022
- if (p)
5057
+ if (g)
5023
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: [
5024
5059
  /* @__PURE__ */ a("p", { className: "text-danger-500 text-lg mb-4", children: "An error occurred" }),
5025
- /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: p.message })
5060
+ /* @__PURE__ */ a("p", { className: "text-gray-600 dark:text-gray-400", children: g.message })
5026
5061
  ] }) }) }) });
5027
- if (k && !N)
5062
+ if (w && !N)
5028
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: [
5029
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" }) }) }) }),
5030
5065
  /* @__PURE__ */ a("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white mb-2", children: "Workflow Transition" }),
@@ -5046,7 +5081,7 @@ Failed to reload test data. Please refresh the page.`);
5046
5081
  /* @__PURE__ */ a(
5047
5082
  "button",
5048
5083
  {
5049
- onClick: () => h(!0),
5084
+ onClick: () => f(!0),
5050
5085
  className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",
5051
5086
  children: "Continue with New Workflow"
5052
5087
  }
@@ -5071,97 +5106,97 @@ Failed to reload test data. Please refresh the page.`);
5071
5106
  /* @__PURE__ */ a(ce, { className: "my-8" }),
5072
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..." })
5073
5108
  ] }) }) });
5074
- const x = (I) => {
5075
- switch (I) {
5076
- case O.Overview:
5109
+ const y = (C) => {
5110
+ switch (C) {
5111
+ case z.Overview:
5077
5112
  return "Overview";
5078
- case O.Questionaries:
5113
+ case z.Questionaries:
5079
5114
  return "Questionnaire";
5080
- case O.UploadDocument:
5115
+ case z.UploadDocument:
5081
5116
  return "Documents";
5082
- case O.IdentitySdk:
5117
+ case z.IdentitySdk:
5083
5118
  return "Identity";
5084
- case O.RiskScoring:
5119
+ case z.RiskScoring:
5085
5120
  return "Risk Assessment";
5086
- case O.InvestorCategorization:
5121
+ case z.InvestorCategorization:
5087
5122
  return "Investor Categorization";
5088
- case O.AppropriatenessTest:
5123
+ case z.AppropriatenessTest:
5089
5124
  return "Appropriateness Test";
5090
- case O.AdditionalData:
5125
+ case z.AdditionalData:
5091
5126
  return "Additional Data";
5092
- case O.ManualReview:
5127
+ case z.ManualReview:
5093
5128
  return "Review";
5094
5129
  default:
5095
5130
  return "";
5096
5131
  }
5097
5132
  }, E = () => {
5098
- const I = c.filter((g) => g.visibility !== !1), Y = I.findIndex((g) => g.order === l.order), D = Y >= 0 ? Y + 1 : 1, z = I.length;
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;
5099
5134
  return /* @__PURE__ */ o("div", { className: "mb-6", children: [
5100
5135
  /* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-4", children: [
5101
5136
  /* @__PURE__ */ a(Ke, {}),
5102
5137
  /* @__PURE__ */ o(pe, { variant: i.status === 1 ? "info" : "success", children: [
5103
5138
  "Step ",
5104
- D,
5139
+ W,
5105
5140
  " of ",
5106
- z
5141
+ F
5107
5142
  ] })
5108
5143
  ] }),
5109
- /* @__PURE__ */ a("div", { className: "flex items-center", children: I.map((g, P) => {
5110
- const F = P < Y, G = g.order === l.order;
5111
- return /* @__PURE__ */ o(ie.Fragment, { children: [
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: [
5112
5147
  /* @__PURE__ */ o("div", { className: "flex items-center", children: [
5113
5148
  /* @__PURE__ */ a(
5114
5149
  "div",
5115
5150
  {
5116
5151
  className: `
5117
5152
  w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium
5118
- ${F || G ? "bg-primary-500 text-white" : "bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-400"}
5153
+ ${I || H ? "bg-primary-500 text-white" : "bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-400"}
5119
5154
  `,
5120
- children: P + 1
5155
+ children: A + 1
5121
5156
  }
5122
5157
  ),
5123
5158
  /* @__PURE__ */ a(
5124
5159
  "span",
5125
5160
  {
5126
- className: `ml-2 text-sm ${G ? "font-semibold text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"}`,
5127
- children: g.displayName || g.name || x(g.action) || `Step ${P + 1}`
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}`
5128
5163
  }
5129
5164
  )
5130
5165
  ] }),
5131
- P < I.length - 1 && /* @__PURE__ */ a(
5166
+ A < C.length - 1 && /* @__PURE__ */ a(
5132
5167
  "div",
5133
5168
  {
5134
- className: `flex-1 h-0.5 mx-4 ${F ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
5169
+ className: `flex-1 h-0.5 mx-4 ${I ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
5135
5170
  }
5136
5171
  )
5137
- ] }, g.order);
5172
+ ] }, h.order);
5138
5173
  }) })
5139
5174
  ] });
5140
5175
  }, S = () => {
5141
- const I = {
5176
+ const C = {
5142
5177
  applicantId: e,
5143
5178
  onComplete: async () => {
5144
- await m();
5179
+ await p();
5145
5180
  },
5146
- onBack: l.order > 0 ? b : void 0
5181
+ onBack: l.order > 0 ? m : void 0
5147
5182
  };
5148
5183
  switch (l.action) {
5149
- case O.Questionaries:
5150
- return /* @__PURE__ */ a(ir, { ...I });
5151
- case O.UploadDocument:
5152
- return /* @__PURE__ */ a(lr, { ...I });
5153
- case O.Overview:
5154
- return /* @__PURE__ */ a(cr, { ...I });
5155
- case O.IdentitySdk:
5156
- return /* @__PURE__ */ a(fr, { ...I });
5157
- case O.RiskScoring:
5158
- return /* @__PURE__ */ a(pr, { ...I });
5159
- case O.AdditionalData:
5160
- case O.InvestorCategorization:
5161
- return /* @__PURE__ */ a(gr, { ...I });
5162
- case O.AppropriatenessTest:
5163
- return /* @__PURE__ */ a(yr, { ...I });
5164
- case O.ManualReview:
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:
5165
5200
  return /* @__PURE__ */ a(
5166
5201
  Te,
5167
5202
  {
@@ -5180,7 +5215,7 @@ Failed to reload test data. Please refresh the page.`);
5180
5215
  ] }),
5181
5216
  /* @__PURE__ */ o("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
5182
5217
  "Action type: ",
5183
- O[l.action]
5218
+ z[l.action]
5184
5219
  ] })
5185
5220
  ] }) });
5186
5221
  }
@@ -5237,7 +5272,7 @@ function Kr(e) {
5237
5272
  t[n] = vr();
5238
5273
  }), ue.object(t);
5239
5274
  }
5240
- const Hr = ue.any();
5275
+ const qr = ue.any();
5241
5276
  export {
5242
5277
  Le as ALLOWED_LANGUAGES,
5243
5278
  Ir as ALL_APPLICANT_FIELDS,
@@ -5253,9 +5288,9 @@ export {
5253
5288
  U as Button,
5254
5289
  M as Card,
5255
5290
  T as CardContent,
5256
- ne as CardFooter,
5257
- te as CardHeader,
5258
- Or as CreateApplicantForm,
5291
+ se as CardFooter,
5292
+ re as CardHeader,
5293
+ Br as CreateApplicantForm,
5259
5294
  st as CriteriaBuiltInType,
5260
5295
  ot as DEFAULT_VISIBLE_FIELDS,
5261
5296
  rt as DocumentReviewStatus,
@@ -5272,17 +5307,17 @@ export {
5272
5307
  ft as IdentityService,
5273
5308
  oe as IdentityVerificationProvider,
5274
5309
  fr as IdentityVerificationStep,
5275
- ae as Input,
5310
+ ne as Input,
5276
5311
  xt as InvestorCategorizationService,
5277
5312
  gr as InvestorCategorizationStep,
5278
- re as InvestorCategorizationType,
5313
+ ae as InvestorCategorizationType,
5279
5314
  it as InvestorCategoryType,
5280
5315
  Xe as KycProcessStatus,
5281
5316
  fe as KycStatus,
5282
5317
  Te as KycStatusDisplay,
5283
5318
  zr as KycWorkflow,
5284
5319
  br as Logo,
5285
- Oe as MetaKYCContext,
5320
+ Be as MetaKYCContext,
5286
5321
  de as MetaKYCError,
5287
5322
  Dr as MetaKYCProvider,
5288
5323
  Qt as MultiSelect,
@@ -5312,8 +5347,8 @@ export {
5312
5347
  Dt as WorkflowOrchestrator,
5313
5348
  Se as WorkflowResultType,
5314
5349
  Et as WorkflowState,
5315
- O as WorkflowStepAction,
5316
- Hr as appropriatenessTestSchema,
5350
+ z as WorkflowStepAction,
5351
+ qr as appropriatenessTestSchema,
5317
5352
  Tr as clearAllStorage,
5318
5353
  zt as clearApplicantId,
5319
5354
  _t as clearWorkflowState,
@@ -5329,27 +5364,27 @@ export {
5329
5364
  Ur as generateRiskScoringSchema,
5330
5365
  _r as generateUploadDocumentSchema,
5331
5366
  Pr as getAcceptString,
5332
- Ot as getApplicantId,
5367
+ Bt as getApplicantId,
5333
5368
  ke as getThemePreset,
5334
5369
  Mr as getWorkflowState,
5335
5370
  kt as healthcareTheme,
5336
5371
  Er as isScriptLoaded,
5337
- Be as loadScript,
5372
+ Oe as loadScript,
5338
5373
  St as minimalTheme,
5339
5374
  Nt as modernTheme,
5340
5375
  Rr as removeScript,
5341
- Bt as saveApplicantId,
5376
+ Ot as saveApplicantId,
5342
5377
  $t as saveWorkflowState,
5343
5378
  Ct as themePresets,
5344
5379
  Wt as useApplicant,
5345
- Br as useAppropriatenessTest,
5346
- qt as useIdentityVerification,
5380
+ Or as useAppropriatenessTest,
5381
+ Ht as useIdentityVerification,
5347
5382
  Ut as useKycWorkflow,
5348
- se as useMetaKYC,
5383
+ ie as useMetaKYC,
5349
5384
  jt as useOverview,
5350
5385
  Kt as useQuestionnaire,
5351
5386
  Yt as useRiskScoring,
5352
- Ht as useUploadDocument,
5387
+ qt as useUploadDocument,
5353
5388
  Fr as validateFileSize,
5354
5389
  Lr as validateFileType
5355
5390
  };