@vpdev2/metakyc-sdk 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CreateApplicantForm.d.ts.map +1 -1
- package/dist/hooks/useApplicant.d.ts.map +1 -1
- package/dist/hooks/useAppropriatenessTest.d.ts.map +1 -1
- package/dist/hooks/useOverview.d.ts.map +1 -1
- package/dist/hooks/useQuestionnaire.d.ts.map +1 -1
- package/dist/hooks/useRiskScoring.d.ts.map +1 -1
- package/dist/hooks/useUploadDocument.d.ts.map +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1023 -995
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ var Xe = (t, e, r) => e in t ? Je(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var K = (t, e, r) => Xe(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import et from "axios";
|
|
5
5
|
import * as Te from "react";
|
|
6
|
-
import
|
|
6
|
+
import ce, { createContext as tt, useState as N, useMemo as je, useEffect as Y, useContext as rt, useRef as H, useCallback as q, forwardRef as Fe } from "react";
|
|
7
7
|
import { jsx as n, jsxs as o, Fragment as nt } from "react/jsx-runtime";
|
|
8
|
-
import { get as
|
|
9
|
-
import { z as
|
|
10
|
-
var U = /* @__PURE__ */ ((t) => (t[t.IdentitySdk = 0] = "IdentitySdk", t[t.RiskScoring = 1] = "RiskScoring", t[t.Questionaries = 2] = "Questionaries", t[t.AdditionalData = 3] = "AdditionalData", t[t.AppropriatenessTest = 4] = "AppropriatenessTest", t[t.UploadDocument = 5] = "UploadDocument", t[t.ManualReview = 6] = "ManualReview", t[t.Overview = 7] = "Overview", t[t.InvestorCategorization = 8] = "InvestorCategorization", t))(U || {}),
|
|
8
|
+
import { get as Re, set as Ee, appendErrors as _e, useForm as Le, Controller as J } from "react-hook-form";
|
|
9
|
+
import { z as ue } from "zod";
|
|
10
|
+
var U = /* @__PURE__ */ ((t) => (t[t.IdentitySdk = 0] = "IdentitySdk", t[t.RiskScoring = 1] = "RiskScoring", t[t.Questionaries = 2] = "Questionaries", t[t.AdditionalData = 3] = "AdditionalData", t[t.AppropriatenessTest = 4] = "AppropriatenessTest", t[t.UploadDocument = 5] = "UploadDocument", t[t.ManualReview = 6] = "ManualReview", t[t.Overview = 7] = "Overview", t[t.InvestorCategorization = 8] = "InvestorCategorization", t))(U || {}), Ne = /* @__PURE__ */ ((t) => (t[t.NotStarted = 0] = "NotStarted", t[t.InProgress = 1] = "InProgress", t[t.Success = 2] = "Success", t[t.PartialSuccess = 3] = "PartialSuccess", t[t.Failed = 4] = "Failed", t[t.Skipped = 5] = "Skipped", t[t.AdminReview = 6] = "AdminReview", t[t.SkippedAndAdminReview = 7] = "SkippedAndAdminReview", t))(Ne || {}), oe = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.InProgress = 1] = "InProgress", t[t.Finished = 2] = "Finished", t[t.OnHold = 3] = "OnHold", t[t.IdentityPending = 4] = "IdentityPending", t))(oe || {}), st = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.RepresentativeKYC = 1] = "RepresentativeKYC", t[t.ManualRiskCriteria = 2] = "ManualRiskCriteria", t[t.UploadDocumentReview = 3] = "UploadDocumentReview", t[t.AdminReview = 4] = "AdminReview", t))(st || {}), at = /* @__PURE__ */ ((t) => (t[t.LowRisk = 0] = "LowRisk", t[t.MediumRisk = 1] = "MediumRisk", t[t.HighRisk = 2] = "HighRisk", t[t.Alert = 3] = "Alert", t))(at || {}), pe = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Pending = 1] = "Pending", t[t.Approved = 2] = "Approved", t[t.Rejected = 3] = "Rejected", t[t.ResendRequested = 4] = "ResendRequested", t[t.Unknown = 5] = "Unknown", t[t.InProgress = 6] = "InProgress", t))(pe || {}), ge = /* @__PURE__ */ ((t) => (t[t.Approved = 0] = "Approved", t[t.Reject = 1] = "Reject", t[t.UnderReview = 2] = "UnderReview", t[t.Closed = 3] = "Closed", t[t.AdminReview = 4] = "AdminReview", t[t.New = 5] = "New", t[t.InProgress = 6] = "InProgress", t))(ge || {}), it = /* @__PURE__ */ ((t) => (t[t.ProviderResultPending = 0] = "ProviderResultPending", t[t.ProviderResultReceived = 1] = "ProviderResultReceived", t[t.Canceled = 2] = "Canceled", t[t.ExtendedToNewApplicant = 3] = "ExtendedToNewApplicant", t))(it || {}), ot = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.ProviderResultPending = 1] = "ProviderResultPending", t[t.ProviderResultReceived = 2] = "ProviderResultReceived", t[t.Canceled = 3] = "Canceled", t))(ot || {}), ie = /* @__PURE__ */ ((t) => (t[t.Onfido = 0] = "Onfido", t[t.Sumsub = 2] = "Sumsub", t[t.SardinAI = 3] = "SardinAI", t))(ie || {}), lt = /* @__PURE__ */ ((t) => (t[t.Individual = 0] = "Individual", t[t.Company = 1] = "Company", t))(lt || {}), Se = /* @__PURE__ */ ((t) => (t[t.Male = 0] = "Male", t[t.Female = 1] = "Female", t[t.Other = 2] = "Other", t))(Se || {}), ct = /* @__PURE__ */ ((t) => (t[t.Image = 0] = "Image", t[t.Video = 1] = "Video", t[t.PDF = 2] = "PDF", t[t.OfficePDF = 3] = "OfficePDF", t[t.Custom = 4] = "Custom", t))(ct || {}), dt = /* @__PURE__ */ ((t) => (t[t.Pending = 0] = "Pending", t[t.Approved = 1] = "Approved", t[t.Rejected = 2] = "Rejected", t[t.RequiresRevision = 3] = "RequiresRevision", t))(dt || {}), ut = /* @__PURE__ */ ((t) => (t[t.SingleChoice = 0] = "SingleChoice", t[t.MultipleChoice = 1] = "MultipleChoice", t[t.Text = 2] = "Text", t))(ut || {}), De = /* @__PURE__ */ ((t) => (t[t.String = 0] = "String", t[t.Integer = 1] = "Integer", t[t.Decimal = 2] = "Decimal", t[t.Boolean = 3] = "Boolean", t[t.Date = 4] = "Date", t[t.Country = 5] = "Country", t[t.DigitOnly = 6] = "DigitOnly", t))(De || {}), mt = /* @__PURE__ */ ((t) => (t[t.Text = 0] = "Text", t[t.Radio = 1] = "Radio", t[t.Checkbox = 2] = "Checkbox", t[t.Dropdown = 3] = "Dropdown", t[t.Country = 4] = "Country", t))(mt || {}), ht = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Country = 1] = "Country", t))(ht || {}), re = /* @__PURE__ */ ((t) => (t[t.Individual = 0] = "Individual", t[t.Sophisticated = 1] = "Sophisticated", t[t.HighNetWorth = 2] = "HighNetWorth", t[t.Business = 3] = "Business", t))(re || {}), pt = /* @__PURE__ */ ((t) => (t[t.Retail = 0] = "Retail", t[t.Professional = 1] = "Professional", t[t.EligibleCounterparty = 2] = "EligibleCounterparty", t))(pt || {});
|
|
11
11
|
const gt = [
|
|
12
12
|
"firstName",
|
|
13
13
|
"lastName",
|
|
@@ -71,7 +71,7 @@ const gt = [
|
|
|
71
71
|
taxNumber: { label: "Tax Number", type: "text" },
|
|
72
72
|
externalRefId: { label: "External Reference ID", type: "text" }
|
|
73
73
|
};
|
|
74
|
-
var
|
|
74
|
+
var W = /* @__PURE__ */ ((t) => (t.Default = "default", t.Corporate = "corporate", t.Fintech = "fintech", t.Healthcare = "healthcare", t.Modern = "modern", t.Minimal = "minimal", t))(W || {});
|
|
75
75
|
const ft = {
|
|
76
76
|
timeout: 3e4,
|
|
77
77
|
retries: 3,
|
|
@@ -120,19 +120,19 @@ class bt {
|
|
|
120
120
|
}[e] || e;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
123
|
+
class de extends Error {
|
|
124
124
|
constructor(r, s, a, i, c) {
|
|
125
125
|
super(r);
|
|
126
126
|
K(this, "response");
|
|
127
|
-
this.code = s, this.details = a, this.validationErrors = i, this.name = "MetaKYCError", this.response = c, Object.setPrototypeOf(this,
|
|
127
|
+
this.code = s, this.details = a, this.validationErrors = i, this.name = "MetaKYCError", this.response = c, Object.setPrototypeOf(this, de.prototype);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
class
|
|
130
|
+
class xe {
|
|
131
131
|
/**
|
|
132
132
|
* Process an error from the API response
|
|
133
133
|
*/
|
|
134
134
|
static handleApiError(e) {
|
|
135
|
-
return new
|
|
135
|
+
return new de(
|
|
136
136
|
e.message || "An unknown error occurred",
|
|
137
137
|
e.code,
|
|
138
138
|
e.details || void 0,
|
|
@@ -145,36 +145,36 @@ class be {
|
|
|
145
145
|
static handleAxiosError(e) {
|
|
146
146
|
if (e.response) {
|
|
147
147
|
const r = e.response.data;
|
|
148
|
-
return r && r.error ? new
|
|
148
|
+
return r && r.error ? new de(
|
|
149
149
|
r.error.message || "An unknown error occurred",
|
|
150
150
|
r.error.code,
|
|
151
151
|
r.error.details || void 0,
|
|
152
152
|
r.error.validationErrors || void 0,
|
|
153
153
|
e.response
|
|
154
|
-
) : r && r.result && r.result.message ? new
|
|
154
|
+
) : r && r.result && r.result.message ? new de(
|
|
155
155
|
r.result.message,
|
|
156
156
|
e.response.status,
|
|
157
157
|
`HTTP ${e.response.status}: ${e.response.statusText}`,
|
|
158
158
|
void 0,
|
|
159
159
|
e.response
|
|
160
|
-
) : new
|
|
160
|
+
) : new de(
|
|
161
161
|
(r == null ? void 0 : r.message) || e.message || "Request failed",
|
|
162
162
|
e.response.status,
|
|
163
163
|
`HTTP ${e.response.status}: ${e.response.statusText}`,
|
|
164
164
|
void 0,
|
|
165
165
|
e.response
|
|
166
166
|
);
|
|
167
|
-
} else return e.request ? new
|
|
167
|
+
} else return e.request ? new de(
|
|
168
168
|
"No response from server",
|
|
169
169
|
0,
|
|
170
170
|
"The request was made but no response was received. Please check your network connection."
|
|
171
|
-
) : new
|
|
171
|
+
) : new de(e.message || "An unexpected error occurred", 0, e.toString());
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* Check if an error is a MetaKYCError
|
|
175
175
|
*/
|
|
176
176
|
static isMetaKYCError(e) {
|
|
177
|
-
return e instanceof
|
|
177
|
+
return e instanceof de;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
class xt {
|
|
@@ -218,7 +218,7 @@ class xt {
|
|
|
218
218
|
});
|
|
219
219
|
return this.handleResponse(i);
|
|
220
220
|
} catch (a) {
|
|
221
|
-
throw
|
|
221
|
+
throw xe.handleAxiosError(a);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
@@ -229,7 +229,7 @@ class xt {
|
|
|
229
229
|
const a = this.buildEndpoint(e, r), i = await this.axiosInstance.post(a, s);
|
|
230
230
|
return this.handleResponse(i);
|
|
231
231
|
} catch (a) {
|
|
232
|
-
throw
|
|
232
|
+
throw xe.handleAxiosError(a);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
@@ -240,7 +240,7 @@ class xt {
|
|
|
240
240
|
const a = this.buildEndpoint(e, r), i = await this.axiosInstance.put(a, s);
|
|
241
241
|
return this.handleResponse(i);
|
|
242
242
|
} catch (a) {
|
|
243
|
-
throw
|
|
243
|
+
throw xe.handleAxiosError(a);
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
@@ -253,7 +253,7 @@ class xt {
|
|
|
253
253
|
});
|
|
254
254
|
return this.handleResponse(i);
|
|
255
255
|
} catch (a) {
|
|
256
|
-
throw
|
|
256
|
+
throw xe.handleAxiosError(a);
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
@@ -262,7 +262,7 @@ class xt {
|
|
|
262
262
|
handleResponse(e) {
|
|
263
263
|
const r = e.data;
|
|
264
264
|
if (!r.success && r.error)
|
|
265
|
-
throw
|
|
265
|
+
throw xe.handleApiError(r.error);
|
|
266
266
|
return r;
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
@@ -646,7 +646,7 @@ class It {
|
|
|
646
646
|
)).result;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
const
|
|
649
|
+
const Z = {
|
|
650
650
|
name: "Default",
|
|
651
651
|
title: "KYC Verification",
|
|
652
652
|
logo: {
|
|
@@ -880,15 +880,15 @@ const Q = {
|
|
|
880
880
|
inputHeight: "2.25rem"
|
|
881
881
|
}
|
|
882
882
|
}, Tt = {
|
|
883
|
-
[
|
|
884
|
-
[
|
|
885
|
-
[
|
|
886
|
-
[
|
|
887
|
-
[
|
|
888
|
-
[
|
|
883
|
+
[W.Default]: Z,
|
|
884
|
+
[W.Corporate]: Rt,
|
|
885
|
+
[W.Fintech]: Dt,
|
|
886
|
+
[W.Healthcare]: Pt,
|
|
887
|
+
[W.Modern]: Ft,
|
|
888
|
+
[W.Minimal]: Lt
|
|
889
889
|
};
|
|
890
|
-
function
|
|
891
|
-
return Tt[t] ||
|
|
890
|
+
function ve(t) {
|
|
891
|
+
return Tt[t] || Z;
|
|
892
892
|
}
|
|
893
893
|
class Mt {
|
|
894
894
|
constructor(e) {
|
|
@@ -905,8 +905,8 @@ class Mt {
|
|
|
905
905
|
"GetThemeConfiguration"
|
|
906
906
|
);
|
|
907
907
|
if (!r.result.isEnabled)
|
|
908
|
-
return
|
|
909
|
-
let s = r.result.preset ?
|
|
908
|
+
return ve(W.Default);
|
|
909
|
+
let s = r.result.preset ? ve(r.result.preset) : ve(W.Default);
|
|
910
910
|
return r.result.title && (s.title = r.result.title), r.result.logo && (s.logo = { ...s.logo, ...r.result.logo }), r.result.colors && (s.colors = { ...s.colors, ...r.result.colors }), r.result.typography && (s.typography = { ...s.typography, ...r.result.typography }), r.result.spacing && (s.spacing = { ...s.spacing, ...r.result.spacing }), r.result.customCSS && (s.customCSS = r.result.customCSS), r.result.darkMode && (s.darkMode = {
|
|
911
911
|
colors: {
|
|
912
912
|
...(e = s.darkMode) == null ? void 0 : e.colors,
|
|
@@ -914,7 +914,7 @@ class Mt {
|
|
|
914
914
|
}
|
|
915
915
|
}), s;
|
|
916
916
|
} catch (r) {
|
|
917
|
-
return console.warn("[ThemeService] Failed to fetch theme configuration:", r),
|
|
917
|
+
return console.warn("[ThemeService] Failed to fetch theme configuration:", r), ve(W.Default);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
/**
|
|
@@ -928,19 +928,19 @@ class Mt {
|
|
|
928
928
|
*/
|
|
929
929
|
getAvailablePresets() {
|
|
930
930
|
return [
|
|
931
|
-
{ id:
|
|
932
|
-
{ id:
|
|
933
|
-
{ id:
|
|
934
|
-
{ id:
|
|
935
|
-
{ id:
|
|
936
|
-
{ id:
|
|
931
|
+
{ id: W.Default, name: "Default" },
|
|
932
|
+
{ id: W.Corporate, name: "Corporate" },
|
|
933
|
+
{ id: W.Fintech, name: "Fintech" },
|
|
934
|
+
{ id: W.Healthcare, name: "Healthcare" },
|
|
935
|
+
{ id: W.Modern, name: "Modern" },
|
|
936
|
+
{ id: W.Minimal, name: "Minimal" }
|
|
937
937
|
];
|
|
938
938
|
}
|
|
939
939
|
/**
|
|
940
940
|
* Preview theme (doesn't save)
|
|
941
941
|
*/
|
|
942
942
|
getPreviewTheme(e, r) {
|
|
943
|
-
const s =
|
|
943
|
+
const s = ve(e);
|
|
944
944
|
return r ? {
|
|
945
945
|
...s,
|
|
946
946
|
...r,
|
|
@@ -1034,7 +1034,7 @@ class Ot {
|
|
|
1034
1034
|
*/
|
|
1035
1035
|
get status() {
|
|
1036
1036
|
var e;
|
|
1037
|
-
return ((e = this._progress) == null ? void 0 : e.status) ||
|
|
1037
|
+
return ((e = this._progress) == null ? void 0 : e.status) || oe.None;
|
|
1038
1038
|
}
|
|
1039
1039
|
/**
|
|
1040
1040
|
* Get workflow result
|
|
@@ -1053,19 +1053,19 @@ class Ot {
|
|
|
1053
1053
|
* Check if workflow is complete
|
|
1054
1054
|
*/
|
|
1055
1055
|
get isComplete() {
|
|
1056
|
-
return this.status ===
|
|
1056
|
+
return this.status === oe.Finished;
|
|
1057
1057
|
}
|
|
1058
1058
|
/**
|
|
1059
1059
|
* Check if workflow is on hold
|
|
1060
1060
|
*/
|
|
1061
1061
|
get isOnHold() {
|
|
1062
|
-
return this.status ===
|
|
1062
|
+
return this.status === oe.OnHold;
|
|
1063
1063
|
}
|
|
1064
1064
|
/**
|
|
1065
1065
|
* Check if workflow is in progress
|
|
1066
1066
|
*/
|
|
1067
1067
|
get isInProgress() {
|
|
1068
|
-
return this.status ===
|
|
1068
|
+
return this.status === oe.InProgress;
|
|
1069
1069
|
}
|
|
1070
1070
|
/**
|
|
1071
1071
|
* Set applicant ID
|
|
@@ -1079,7 +1079,7 @@ class Ot {
|
|
|
1079
1079
|
updateProgress(e) {
|
|
1080
1080
|
var s, a;
|
|
1081
1081
|
const r = (s = this._progress) == null ? void 0 : s.currentStep;
|
|
1082
|
-
this._progress = e, this._applicantId = e.applicantId, this._error = null, this.events.emit("progressUpdated", e), (r == null ? void 0 : r.order) !== ((a = e.currentStep) == null ? void 0 : a.order) && this.events.emit("stepChanged", e.currentStep), this.events.emit("statusChanged", e.status), e.status ===
|
|
1082
|
+
this._progress = e, this._applicantId = e.applicantId, this._error = null, this.events.emit("progressUpdated", e), (r == null ? void 0 : r.order) !== ((a = e.currentStep) == null ? void 0 : a.order) && this.events.emit("stepChanged", e.currentStep), this.events.emit("statusChanged", e.status), e.status === oe.Finished && e.workflowResult && this.events.emit("completed", e.workflowResult);
|
|
1083
1083
|
}
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Set error
|
|
@@ -1603,17 +1603,17 @@ class Kt {
|
|
|
1603
1603
|
this.sardineContext && (this.sardineContext = null);
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class fe {
|
|
1607
1607
|
/**
|
|
1608
1608
|
* Create a provider instance
|
|
1609
1609
|
*/
|
|
1610
1610
|
static createProvider(e, r) {
|
|
1611
1611
|
switch (e) {
|
|
1612
|
-
case
|
|
1612
|
+
case ie.Sumsub:
|
|
1613
1613
|
return new jt(r);
|
|
1614
|
-
case
|
|
1614
|
+
case ie.Onfido:
|
|
1615
1615
|
return new _t(r);
|
|
1616
|
-
case
|
|
1616
|
+
case ie.SardinAI:
|
|
1617
1617
|
return new Kt(r);
|
|
1618
1618
|
default:
|
|
1619
1619
|
throw new Error(`Unsupported identity provider: ${e}`);
|
|
@@ -1625,7 +1625,7 @@ class ye {
|
|
|
1625
1625
|
static parseProviderConfig(e, r, s) {
|
|
1626
1626
|
var a;
|
|
1627
1627
|
switch (e) {
|
|
1628
|
-
case
|
|
1628
|
+
case ie.Sumsub:
|
|
1629
1629
|
return {
|
|
1630
1630
|
accessToken: r.accessToken || r.token,
|
|
1631
1631
|
applicantEmail: r.email,
|
|
@@ -1633,11 +1633,11 @@ class ye {
|
|
|
1633
1633
|
externalUserId: r.externalUserId,
|
|
1634
1634
|
lang: r.lang || "en"
|
|
1635
1635
|
};
|
|
1636
|
-
case
|
|
1636
|
+
case ie.Onfido:
|
|
1637
1637
|
return {
|
|
1638
1638
|
token: r.token || r.sdkToken
|
|
1639
1639
|
};
|
|
1640
|
-
case
|
|
1640
|
+
case ie.SardinAI:
|
|
1641
1641
|
const i = ((a = s == null ? void 0 : s.identityProviders) == null ? void 0 : a.sardinai) || {};
|
|
1642
1642
|
return {
|
|
1643
1643
|
clientId: i.clientId || r.clientId,
|
|
@@ -1655,7 +1655,7 @@ class ye {
|
|
|
1655
1655
|
}
|
|
1656
1656
|
class Ut {
|
|
1657
1657
|
constructor(e) {
|
|
1658
|
-
K(this, "currentTheme",
|
|
1658
|
+
K(this, "currentTheme", Z);
|
|
1659
1659
|
K(this, "customStyleElement", null);
|
|
1660
1660
|
K(this, "container");
|
|
1661
1661
|
this.container = e || document.documentElement;
|
|
@@ -1735,19 +1735,19 @@ class Ut {
|
|
|
1735
1735
|
mergeWithDefault(e) {
|
|
1736
1736
|
var r;
|
|
1737
1737
|
return {
|
|
1738
|
-
name: e.name ||
|
|
1739
|
-
title: e.title ||
|
|
1740
|
-
logo: { ...
|
|
1741
|
-
colors: { ...
|
|
1742
|
-
typography: e.typography ? { ...
|
|
1743
|
-
spacing: e.spacing ? { ...
|
|
1738
|
+
name: e.name || Z.name,
|
|
1739
|
+
title: e.title || Z.title,
|
|
1740
|
+
logo: { ...Z.logo, ...e.logo },
|
|
1741
|
+
colors: { ...Z.colors, ...e.colors },
|
|
1742
|
+
typography: e.typography ? { ...Z.typography, ...e.typography } : Z.typography,
|
|
1743
|
+
spacing: e.spacing ? { ...Z.spacing, ...e.spacing } : Z.spacing,
|
|
1744
1744
|
customCSS: e.customCSS,
|
|
1745
1745
|
darkMode: e.darkMode ? {
|
|
1746
1746
|
colors: {
|
|
1747
|
-
...(r =
|
|
1747
|
+
...(r = Z.darkMode) == null ? void 0 : r.colors,
|
|
1748
1748
|
...e.darkMode.colors
|
|
1749
1749
|
}
|
|
1750
|
-
} :
|
|
1750
|
+
} : Z.darkMode
|
|
1751
1751
|
};
|
|
1752
1752
|
}
|
|
1753
1753
|
/**
|
|
@@ -1760,7 +1760,7 @@ class Ut {
|
|
|
1760
1760
|
* Reset to default theme
|
|
1761
1761
|
*/
|
|
1762
1762
|
resetTheme() {
|
|
1763
|
-
this.applyTheme(
|
|
1763
|
+
this.applyTheme(Z);
|
|
1764
1764
|
}
|
|
1765
1765
|
/**
|
|
1766
1766
|
* Remove all custom styles
|
|
@@ -1776,36 +1776,36 @@ class Ut {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
const Ue = tt(null), Or = ({ config: t, children: e }) => {
|
|
1779
|
-
const [r, s] =
|
|
1780
|
-
const c = new xt(t), l = new vt(c), d = new wt(c), u = new kt(c),
|
|
1779
|
+
const [r, s] = N(null), a = ce.useRef(!1), i = je(() => {
|
|
1780
|
+
const c = new xt(t), l = new vt(c), d = new wt(c), u = new kt(c), y = new Nt(c), x = new St(c), g = new Ct(c), b = new At(c), m = new Et(c), f = new It(c), k = new Mt(c), h = new Ut();
|
|
1781
1781
|
return {
|
|
1782
1782
|
config: t,
|
|
1783
1783
|
httpClient: c,
|
|
1784
1784
|
applicantService: l,
|
|
1785
1785
|
questionnaireService: d,
|
|
1786
1786
|
uploadDocumentService: u,
|
|
1787
|
-
appropriatenessTestService:
|
|
1788
|
-
overviewService:
|
|
1789
|
-
riskScoringService:
|
|
1790
|
-
identityService:
|
|
1791
|
-
baseInformationService:
|
|
1792
|
-
investorCategorizationService:
|
|
1793
|
-
themeService:
|
|
1794
|
-
themeManager:
|
|
1787
|
+
appropriatenessTestService: y,
|
|
1788
|
+
overviewService: x,
|
|
1789
|
+
riskScoringService: g,
|
|
1790
|
+
identityService: b,
|
|
1791
|
+
baseInformationService: m,
|
|
1792
|
+
investorCategorizationService: f,
|
|
1793
|
+
themeService: k,
|
|
1794
|
+
themeManager: h,
|
|
1795
1795
|
currentTheme: r,
|
|
1796
1796
|
createOrchestrator: () => new $t(
|
|
1797
1797
|
l,
|
|
1798
1798
|
d,
|
|
1799
1799
|
u,
|
|
1800
|
+
y,
|
|
1801
|
+
x,
|
|
1800
1802
|
g,
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
v,
|
|
1804
|
-
y
|
|
1803
|
+
b,
|
|
1804
|
+
f
|
|
1805
1805
|
)
|
|
1806
1806
|
};
|
|
1807
1807
|
}, [t, r]);
|
|
1808
|
-
return
|
|
1808
|
+
return Y(() => ((async () => {
|
|
1809
1809
|
if (a.current) {
|
|
1810
1810
|
console.log("[MetaKYC] Theme load already in progress, skipping...");
|
|
1811
1811
|
return;
|
|
@@ -1828,7 +1828,7 @@ const Ue = tt(null), Or = ({ config: t, children: e }) => {
|
|
|
1828
1828
|
i.themeManager.cleanup();
|
|
1829
1829
|
}), [t.theme, i.themeService, i.themeManager]), /* @__PURE__ */ n(Ue.Provider, { value: i, children: e });
|
|
1830
1830
|
};
|
|
1831
|
-
function
|
|
1831
|
+
function se() {
|
|
1832
1832
|
const t = rt(Ue);
|
|
1833
1833
|
if (!t)
|
|
1834
1834
|
throw new Error("useMetaKYC must be used within a MetaKYCProvider");
|
|
@@ -1855,7 +1855,7 @@ function $r(t, e) {
|
|
|
1855
1855
|
return t.type === s;
|
|
1856
1856
|
});
|
|
1857
1857
|
}
|
|
1858
|
-
function
|
|
1858
|
+
function Ie(t) {
|
|
1859
1859
|
if (t === 0) return "0 Bytes";
|
|
1860
1860
|
const e = 1024, r = ["Bytes", "KB", "MB", "GB"], s = Math.floor(Math.log(t) / Math.log(e));
|
|
1861
1861
|
return Math.round(t / Math.pow(e, s) * 100) / 100 + " " + r[s];
|
|
@@ -1863,23 +1863,23 @@ function Ee(t) {
|
|
|
1863
1863
|
function jr(t) {
|
|
1864
1864
|
return t;
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1866
|
+
function te(...t) {
|
|
1867
1867
|
return t.filter(Boolean).join(" ");
|
|
1868
1868
|
}
|
|
1869
|
-
const
|
|
1869
|
+
const be = {
|
|
1870
1870
|
APPLICANT_ID: "metakyc_applicant_id",
|
|
1871
1871
|
WORKFLOW_STATE: "metakyc_workflow_state"
|
|
1872
1872
|
};
|
|
1873
1873
|
function Ht(t) {
|
|
1874
1874
|
try {
|
|
1875
|
-
localStorage.setItem(
|
|
1875
|
+
localStorage.setItem(be.APPLICANT_ID, t.toString());
|
|
1876
1876
|
} catch (e) {
|
|
1877
1877
|
console.warn("Failed to save applicant ID to storage:", e);
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
1880
1880
|
function Vt() {
|
|
1881
1881
|
try {
|
|
1882
|
-
const t = localStorage.getItem(
|
|
1882
|
+
const t = localStorage.getItem(be.APPLICANT_ID);
|
|
1883
1883
|
return t ? parseInt(t, 10) : null;
|
|
1884
1884
|
} catch (t) {
|
|
1885
1885
|
return console.warn("Failed to retrieve applicant ID from storage:", t), null;
|
|
@@ -1887,21 +1887,21 @@ function Vt() {
|
|
|
1887
1887
|
}
|
|
1888
1888
|
function Yt() {
|
|
1889
1889
|
try {
|
|
1890
|
-
localStorage.removeItem(
|
|
1890
|
+
localStorage.removeItem(be.APPLICANT_ID);
|
|
1891
1891
|
} catch (t) {
|
|
1892
1892
|
console.warn("Failed to clear applicant ID from storage:", t);
|
|
1893
1893
|
}
|
|
1894
1894
|
}
|
|
1895
1895
|
function Wt(t) {
|
|
1896
1896
|
try {
|
|
1897
|
-
localStorage.setItem(
|
|
1897
|
+
localStorage.setItem(be.WORKFLOW_STATE, JSON.stringify(t));
|
|
1898
1898
|
} catch (e) {
|
|
1899
1899
|
console.warn("Failed to save workflow state to storage:", e);
|
|
1900
1900
|
}
|
|
1901
1901
|
}
|
|
1902
1902
|
function _r() {
|
|
1903
1903
|
try {
|
|
1904
|
-
const t = localStorage.getItem(
|
|
1904
|
+
const t = localStorage.getItem(be.WORKFLOW_STATE);
|
|
1905
1905
|
return t ? JSON.parse(t) : null;
|
|
1906
1906
|
} catch (t) {
|
|
1907
1907
|
return console.warn("Failed to retrieve workflow state from storage:", t), null;
|
|
@@ -1909,7 +1909,7 @@ function _r() {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
function Qt() {
|
|
1911
1911
|
try {
|
|
1912
|
-
localStorage.removeItem(
|
|
1912
|
+
localStorage.removeItem(be.WORKFLOW_STATE);
|
|
1913
1913
|
} catch (t) {
|
|
1914
1914
|
console.warn("Failed to clear workflow state from storage:", t);
|
|
1915
1915
|
}
|
|
@@ -1918,139 +1918,143 @@ function Kr() {
|
|
|
1918
1918
|
Yt(), Qt();
|
|
1919
1919
|
}
|
|
1920
1920
|
function Gt(t) {
|
|
1921
|
-
const { createOrchestrator: e } =
|
|
1922
|
-
|
|
1921
|
+
const { createOrchestrator: e } = se(), [r, s] = N(null), [a, i] = N(!1), [c, l] = N(null), d = H(null), u = t || Vt();
|
|
1922
|
+
Y(() => {
|
|
1923
1923
|
d.current || (d.current = e());
|
|
1924
|
-
}, [e]),
|
|
1925
|
-
var
|
|
1924
|
+
}, [e]), Y(() => {
|
|
1925
|
+
var v;
|
|
1926
1926
|
r && u && (Ht(u), Wt({
|
|
1927
1927
|
applicantId: u,
|
|
1928
|
-
currentStepOrder: (
|
|
1928
|
+
currentStepOrder: (v = r.currentStep) == null ? void 0 : v.order,
|
|
1929
1929
|
status: r.status,
|
|
1930
1930
|
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1931
1931
|
workflowKey: r.workFlowKey,
|
|
1932
1932
|
nextWorkflowKey: r.nextWorkflowKey
|
|
1933
1933
|
}));
|
|
1934
1934
|
}, [r, u]);
|
|
1935
|
-
const
|
|
1935
|
+
const y = H(!1), x = H(!1), g = q(async () => {
|
|
1936
1936
|
if (!(!u || !d.current)) {
|
|
1937
|
-
if (
|
|
1937
|
+
if (y.current) {
|
|
1938
1938
|
console.log("[Workflow] Load already in progress, skipping...");
|
|
1939
1939
|
return;
|
|
1940
1940
|
}
|
|
1941
|
-
|
|
1941
|
+
y.current = !0, i(!0), l(null);
|
|
1942
1942
|
try {
|
|
1943
|
-
const
|
|
1944
|
-
s(
|
|
1945
|
-
} catch (
|
|
1946
|
-
l(
|
|
1943
|
+
const v = await d.current.initialize(u);
|
|
1944
|
+
s(v), x.current = !0;
|
|
1945
|
+
} catch (v) {
|
|
1946
|
+
l(v);
|
|
1947
1947
|
} finally {
|
|
1948
|
-
i(!1),
|
|
1948
|
+
i(!1), y.current = !1;
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
1951
1951
|
}, [u]);
|
|
1952
|
-
|
|
1953
|
-
u && !
|
|
1954
|
-
}, [u,
|
|
1955
|
-
const
|
|
1952
|
+
Y(() => {
|
|
1953
|
+
u && !x.current && g();
|
|
1954
|
+
}, [u, g]);
|
|
1955
|
+
const b = q(async () => {
|
|
1956
1956
|
if (d.current) {
|
|
1957
|
-
if (
|
|
1957
|
+
if (y.current) {
|
|
1958
1958
|
console.log("[Workflow] Refresh already in progress, skipping...");
|
|
1959
1959
|
return;
|
|
1960
1960
|
}
|
|
1961
|
-
|
|
1961
|
+
y.current = !0, i(!0), l(null);
|
|
1962
1962
|
try {
|
|
1963
|
-
const
|
|
1964
|
-
s(
|
|
1965
|
-
} catch (
|
|
1966
|
-
l(
|
|
1963
|
+
const v = await d.current.refreshProgress();
|
|
1964
|
+
s(v);
|
|
1965
|
+
} catch (v) {
|
|
1966
|
+
l(v);
|
|
1967
1967
|
} finally {
|
|
1968
|
-
i(!1),
|
|
1968
|
+
i(!1), y.current = !1;
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
1971
|
-
}, []),
|
|
1971
|
+
}, []), m = q(async () => {
|
|
1972
1972
|
if (d.current) {
|
|
1973
1973
|
i(!0), l(null);
|
|
1974
1974
|
try {
|
|
1975
|
-
const
|
|
1976
|
-
s(
|
|
1977
|
-
} catch (
|
|
1978
|
-
l(
|
|
1975
|
+
const v = await d.current.moveToNextStep();
|
|
1976
|
+
s(v);
|
|
1977
|
+
} catch (v) {
|
|
1978
|
+
l(v);
|
|
1979
1979
|
} finally {
|
|
1980
1980
|
i(!1);
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
|
-
}, []),
|
|
1983
|
+
}, []), f = q(async () => {
|
|
1984
1984
|
if (d.current) {
|
|
1985
1985
|
i(!0), l(null);
|
|
1986
1986
|
try {
|
|
1987
|
-
const
|
|
1988
|
-
s(
|
|
1989
|
-
} catch (
|
|
1990
|
-
l(
|
|
1987
|
+
const v = await d.current.moveToPreviousStep();
|
|
1988
|
+
s(v);
|
|
1989
|
+
} catch (v) {
|
|
1990
|
+
l(v);
|
|
1991
1991
|
} finally {
|
|
1992
1992
|
i(!1);
|
|
1993
1993
|
}
|
|
1994
1994
|
}
|
|
1995
|
-
}, []),
|
|
1995
|
+
}, []), k = q(async (v) => {
|
|
1996
1996
|
if (d.current) {
|
|
1997
1997
|
i(!0), l(null);
|
|
1998
1998
|
try {
|
|
1999
|
-
await d.current.submitCurrentStep(
|
|
2000
|
-
const
|
|
2001
|
-
s(
|
|
2002
|
-
} catch (
|
|
2003
|
-
throw l(
|
|
1999
|
+
await d.current.submitCurrentStep(v);
|
|
2000
|
+
const S = await d.current.refreshProgress();
|
|
2001
|
+
s(S);
|
|
2002
|
+
} catch (S) {
|
|
2003
|
+
throw l(S), S;
|
|
2004
2004
|
} finally {
|
|
2005
2005
|
i(!1);
|
|
2006
2006
|
}
|
|
2007
2007
|
}
|
|
2008
|
-
}, []),
|
|
2008
|
+
}, []), h = Te.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((v, S) => v.order - S.order) : [], [r == null ? void 0 : r.stepInfoList]), E = Te.useMemo(() => r ? r.nextWorkflowKey && r.nextWorkflowKey !== r.workFlowKey : !1, [r]);
|
|
2009
2009
|
return {
|
|
2010
2010
|
progress: r,
|
|
2011
2011
|
applicantId: u,
|
|
2012
2012
|
currentStep: (r == null ? void 0 : r.currentStep) || null,
|
|
2013
|
-
steps:
|
|
2014
|
-
status: (r == null ? void 0 : r.status) ||
|
|
2013
|
+
steps: h,
|
|
2014
|
+
status: (r == null ? void 0 : r.status) || oe.None,
|
|
2015
2015
|
workflowResult: (r == null ? void 0 : r.workflowResult) || null,
|
|
2016
2016
|
workflowKey: r == null ? void 0 : r.workFlowKey,
|
|
2017
2017
|
nextWorkflowKey: r == null ? void 0 : r.nextWorkflowKey,
|
|
2018
2018
|
hasWorkflowChanged: E,
|
|
2019
2019
|
isLoading: a,
|
|
2020
2020
|
error: c,
|
|
2021
|
-
isComplete: (r == null ? void 0 : r.status) ===
|
|
2022
|
-
isOnHold: (r == null ? void 0 : r.status) ===
|
|
2023
|
-
refreshProgress:
|
|
2024
|
-
moveToNext:
|
|
2025
|
-
moveBack:
|
|
2026
|
-
submitCurrentStep:
|
|
2021
|
+
isComplete: (r == null ? void 0 : r.status) === oe.Finished,
|
|
2022
|
+
isOnHold: (r == null ? void 0 : r.status) === oe.OnHold,
|
|
2023
|
+
refreshProgress: b,
|
|
2024
|
+
moveToNext: m,
|
|
2025
|
+
moveBack: f,
|
|
2026
|
+
submitCurrentStep: k,
|
|
2027
2027
|
orchestrator: d.current
|
|
2028
2028
|
};
|
|
2029
2029
|
}
|
|
2030
2030
|
function Zt(t) {
|
|
2031
|
-
const { questionnaireService: e } =
|
|
2031
|
+
const { questionnaireService: e } = se(), [r, s] = N(null), [a, i] = N(!1), [c, l] = N(!1), [d, u] = N(null), y = H(!1), x = H(null), g = q(async () => {
|
|
2032
2032
|
if (t) {
|
|
2033
|
-
|
|
2033
|
+
if (y.current) {
|
|
2034
|
+
console.log("[Questionnaire] Load already in progress, skipping...");
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
y.current = !0, i(!0), u(null);
|
|
2034
2038
|
try {
|
|
2035
2039
|
const m = await e.getQuestionnaire(t);
|
|
2036
|
-
s(m);
|
|
2040
|
+
s(m), x.current = t;
|
|
2037
2041
|
} catch (m) {
|
|
2038
2042
|
u(m);
|
|
2039
2043
|
} finally {
|
|
2040
|
-
i(!1);
|
|
2044
|
+
i(!1), y.current = !1;
|
|
2041
2045
|
}
|
|
2042
2046
|
}
|
|
2043
2047
|
}, [t, e]);
|
|
2044
|
-
|
|
2045
|
-
t && g();
|
|
2046
|
-
}, [t
|
|
2047
|
-
const
|
|
2048
|
+
Y(() => {
|
|
2049
|
+
t && x.current !== t && g();
|
|
2050
|
+
}, [t]);
|
|
2051
|
+
const b = q(
|
|
2048
2052
|
async (m) => {
|
|
2049
2053
|
l(!0), u(null);
|
|
2050
2054
|
try {
|
|
2051
2055
|
return await e.fillQuestionnaire(m);
|
|
2052
|
-
} catch (
|
|
2053
|
-
throw u(
|
|
2056
|
+
} catch (f) {
|
|
2057
|
+
throw u(f), f;
|
|
2054
2058
|
} finally {
|
|
2055
2059
|
l(!1);
|
|
2056
2060
|
}
|
|
@@ -2063,33 +2067,37 @@ function Zt(t) {
|
|
|
2063
2067
|
isSubmitting: c,
|
|
2064
2068
|
error: d,
|
|
2065
2069
|
load: g,
|
|
2066
|
-
submit:
|
|
2070
|
+
submit: b
|
|
2067
2071
|
};
|
|
2068
2072
|
}
|
|
2069
2073
|
function Jt(t) {
|
|
2070
|
-
const { uploadDocumentService: e } =
|
|
2074
|
+
const { uploadDocumentService: e } = se(), [r, s] = N(null), [a, i] = N(!1), [c, l] = N(!1), [d, u] = N(0), [y, x] = N(null), g = H(!1), b = H(null), m = q(async () => {
|
|
2071
2075
|
if (t) {
|
|
2072
|
-
|
|
2076
|
+
if (g.current) {
|
|
2077
|
+
console.log("[UploadDocument] Load already in progress, skipping...");
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
g.current = !0, i(!0), x(null);
|
|
2073
2081
|
try {
|
|
2074
|
-
const
|
|
2075
|
-
s(b
|
|
2076
|
-
} catch (
|
|
2077
|
-
|
|
2082
|
+
const k = await e.getUploadDocument(t);
|
|
2083
|
+
s(k), b.current = t;
|
|
2084
|
+
} catch (k) {
|
|
2085
|
+
x(k);
|
|
2078
2086
|
} finally {
|
|
2079
|
-
i(!1);
|
|
2087
|
+
i(!1), g.current = !1;
|
|
2080
2088
|
}
|
|
2081
2089
|
}
|
|
2082
2090
|
}, [t, e]);
|
|
2083
|
-
|
|
2084
|
-
t && m();
|
|
2085
|
-
}, [t
|
|
2086
|
-
const
|
|
2087
|
-
async (
|
|
2088
|
-
l(!0), u(0),
|
|
2091
|
+
Y(() => {
|
|
2092
|
+
t && b.current !== t && m();
|
|
2093
|
+
}, [t]);
|
|
2094
|
+
const f = q(
|
|
2095
|
+
async (k) => {
|
|
2096
|
+
l(!0), u(0), x(null);
|
|
2089
2097
|
try {
|
|
2090
|
-
await e.fillUploadDocument(
|
|
2091
|
-
} catch (
|
|
2092
|
-
throw
|
|
2098
|
+
await e.fillUploadDocument(k), u(100);
|
|
2099
|
+
} catch (h) {
|
|
2100
|
+
throw x(h), h;
|
|
2093
2101
|
} finally {
|
|
2094
2102
|
l(!1);
|
|
2095
2103
|
}
|
|
@@ -2101,36 +2109,40 @@ function Jt(t) {
|
|
|
2101
2109
|
isLoading: a,
|
|
2102
2110
|
isSubmitting: c,
|
|
2103
2111
|
uploadProgress: d,
|
|
2104
|
-
error:
|
|
2112
|
+
error: y,
|
|
2105
2113
|
load: m,
|
|
2106
|
-
submit:
|
|
2114
|
+
submit: f
|
|
2107
2115
|
};
|
|
2108
2116
|
}
|
|
2109
2117
|
function Ur(t) {
|
|
2110
|
-
const { appropriatenessTestService: e } =
|
|
2118
|
+
const { appropriatenessTestService: e } = se(), [r, s] = N(null), [a, i] = N(!1), [c, l] = N(!1), [d, u] = N(null), [y, x] = N(null), g = H(!1), b = H(null), m = q(async () => {
|
|
2111
2119
|
if (t) {
|
|
2112
|
-
|
|
2120
|
+
if (g.current) {
|
|
2121
|
+
console.log("[AppropriatenessTest] Load already in progress, skipping...");
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2124
|
+
g.current = !0, i(!0), u(null);
|
|
2113
2125
|
try {
|
|
2114
|
-
const
|
|
2115
|
-
s(b
|
|
2116
|
-
} catch (
|
|
2117
|
-
u(
|
|
2126
|
+
const k = await e.getAppropriatenessTest(t);
|
|
2127
|
+
s(k), b.current = t;
|
|
2128
|
+
} catch (k) {
|
|
2129
|
+
u(k);
|
|
2118
2130
|
} finally {
|
|
2119
|
-
i(!1);
|
|
2131
|
+
i(!1), g.current = !1;
|
|
2120
2132
|
}
|
|
2121
2133
|
}
|
|
2122
2134
|
}, [t, e]);
|
|
2123
|
-
|
|
2124
|
-
t && m();
|
|
2125
|
-
}, [t
|
|
2126
|
-
const
|
|
2127
|
-
async (
|
|
2135
|
+
Y(() => {
|
|
2136
|
+
t && b.current !== t && m();
|
|
2137
|
+
}, [t]);
|
|
2138
|
+
const f = q(
|
|
2139
|
+
async (k) => {
|
|
2128
2140
|
l(!0), u(null);
|
|
2129
2141
|
try {
|
|
2130
|
-
const
|
|
2131
|
-
return
|
|
2132
|
-
} catch (
|
|
2133
|
-
throw u(
|
|
2142
|
+
const h = await e.fillAppropriatenessTest(k);
|
|
2143
|
+
return x(h), h;
|
|
2144
|
+
} catch (h) {
|
|
2145
|
+
throw u(h), h;
|
|
2134
2146
|
} finally {
|
|
2135
2147
|
l(!1);
|
|
2136
2148
|
}
|
|
@@ -2139,32 +2151,36 @@ function Ur(t) {
|
|
|
2139
2151
|
);
|
|
2140
2152
|
return {
|
|
2141
2153
|
test: r,
|
|
2142
|
-
result:
|
|
2154
|
+
result: y,
|
|
2143
2155
|
isLoading: a,
|
|
2144
2156
|
isSubmitting: c,
|
|
2145
2157
|
error: d,
|
|
2146
2158
|
load: m,
|
|
2147
|
-
submit:
|
|
2159
|
+
submit: f
|
|
2148
2160
|
};
|
|
2149
2161
|
}
|
|
2150
2162
|
function Xt(t) {
|
|
2151
|
-
const { overviewService: e } =
|
|
2163
|
+
const { overviewService: e } = se(), [r, s] = N(null), [a, i] = N(!1), [c, l] = N(!1), [d, u] = N(null), y = H(!1), x = H(null), g = q(async () => {
|
|
2152
2164
|
if (t) {
|
|
2153
|
-
|
|
2165
|
+
if (y.current) {
|
|
2166
|
+
console.log("[Overview] Load already in progress, skipping...");
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
y.current = !0, i(!0), u(null);
|
|
2154
2170
|
try {
|
|
2155
2171
|
const m = await e.getOverviewData(t);
|
|
2156
|
-
s(m);
|
|
2172
|
+
s(m), x.current = t;
|
|
2157
2173
|
} catch (m) {
|
|
2158
2174
|
u(m);
|
|
2159
2175
|
} finally {
|
|
2160
|
-
i(!1);
|
|
2176
|
+
i(!1), y.current = !1;
|
|
2161
2177
|
}
|
|
2162
2178
|
}
|
|
2163
2179
|
}, [t, e]);
|
|
2164
|
-
|
|
2165
|
-
t && g();
|
|
2166
|
-
}, [t
|
|
2167
|
-
const
|
|
2180
|
+
Y(() => {
|
|
2181
|
+
t && x.current !== t && g();
|
|
2182
|
+
}, [t]);
|
|
2183
|
+
const b = q(async () => {
|
|
2168
2184
|
if (t) {
|
|
2169
2185
|
l(!0), u(null);
|
|
2170
2186
|
try {
|
|
@@ -2182,14 +2198,14 @@ function Xt(t) {
|
|
|
2182
2198
|
isSubmitting: c,
|
|
2183
2199
|
error: d,
|
|
2184
2200
|
load: g,
|
|
2185
|
-
passOverview:
|
|
2201
|
+
passOverview: b
|
|
2186
2202
|
};
|
|
2187
2203
|
}
|
|
2188
2204
|
function er(t) {
|
|
2189
|
-
const { identityService: e } =
|
|
2205
|
+
const { identityService: e } = se(), [r, s] = N(
|
|
2190
2206
|
null
|
|
2191
|
-
), [a, i] =
|
|
2192
|
-
async (
|
|
2207
|
+
), [a, i] = N(!1), [c, l] = N(null), d = H(!1), u = q(
|
|
2208
|
+
async (g, b) => {
|
|
2193
2209
|
if (t) {
|
|
2194
2210
|
if (d.current) {
|
|
2195
2211
|
console.log("[Identity] Request already in progress, skipping...");
|
|
@@ -2197,45 +2213,45 @@ function er(t) {
|
|
|
2197
2213
|
}
|
|
2198
2214
|
d.current = !0, i(!0), l(null);
|
|
2199
2215
|
try {
|
|
2200
|
-
const
|
|
2216
|
+
const m = {
|
|
2201
2217
|
applicantId: t,
|
|
2202
2218
|
restart: !1,
|
|
2203
|
-
redirectUrl:
|
|
2204
|
-
ttl:
|
|
2219
|
+
redirectUrl: g || "",
|
|
2220
|
+
ttl: b || 604800
|
|
2205
2221
|
// Default: 7 days
|
|
2206
2222
|
};
|
|
2207
|
-
console.log("Identity request input:",
|
|
2208
|
-
const
|
|
2209
|
-
return console.log("Identity request result:",
|
|
2210
|
-
} catch (
|
|
2211
|
-
throw l(
|
|
2223
|
+
console.log("Identity request input:", m);
|
|
2224
|
+
const f = await e.identityRequest(m);
|
|
2225
|
+
return console.log("Identity request result:", f), s(f), f;
|
|
2226
|
+
} catch (m) {
|
|
2227
|
+
throw l(m), m;
|
|
2212
2228
|
} finally {
|
|
2213
2229
|
i(!1), d.current = !1;
|
|
2214
2230
|
}
|
|
2215
2231
|
}
|
|
2216
2232
|
},
|
|
2217
2233
|
[t, e]
|
|
2218
|
-
),
|
|
2219
|
-
async (
|
|
2234
|
+
), y = q(
|
|
2235
|
+
async (g, b) => {
|
|
2220
2236
|
if (t) {
|
|
2221
2237
|
i(!0), l(null);
|
|
2222
2238
|
try {
|
|
2223
|
-
const
|
|
2239
|
+
const m = {
|
|
2224
2240
|
applicantId: t,
|
|
2225
2241
|
restart: !1,
|
|
2226
|
-
redirectUrl:
|
|
2227
|
-
ttl:
|
|
2228
|
-
},
|
|
2229
|
-
return s(
|
|
2230
|
-
} catch (
|
|
2231
|
-
throw l(
|
|
2242
|
+
redirectUrl: g,
|
|
2243
|
+
ttl: b
|
|
2244
|
+
}, f = await e.identityCompanyRequest(m);
|
|
2245
|
+
return s(f), f;
|
|
2246
|
+
} catch (m) {
|
|
2247
|
+
throw l(m), m;
|
|
2232
2248
|
} finally {
|
|
2233
2249
|
i(!1);
|
|
2234
2250
|
}
|
|
2235
2251
|
}
|
|
2236
2252
|
},
|
|
2237
2253
|
[t, e]
|
|
2238
|
-
),
|
|
2254
|
+
), x = q(async () => {
|
|
2239
2255
|
if (t) {
|
|
2240
2256
|
if (d.current) {
|
|
2241
2257
|
console.log("[Identity] Restart already in progress, skipping...");
|
|
@@ -2243,18 +2259,18 @@ function er(t) {
|
|
|
2243
2259
|
}
|
|
2244
2260
|
d.current = !0, i(!0), l(null);
|
|
2245
2261
|
try {
|
|
2246
|
-
const
|
|
2262
|
+
const g = {
|
|
2247
2263
|
applicantId: t,
|
|
2248
2264
|
restart: !0,
|
|
2249
2265
|
redirectUrl: "",
|
|
2250
2266
|
ttl: 604800
|
|
2251
2267
|
// 7 days
|
|
2252
2268
|
};
|
|
2253
|
-
console.log("Restarting identity with input:",
|
|
2254
|
-
const
|
|
2255
|
-
return console.log("Restart identity result:",
|
|
2256
|
-
} catch (
|
|
2257
|
-
throw l(
|
|
2269
|
+
console.log("Restarting identity with input:", g);
|
|
2270
|
+
const b = await e.identityRequest(g);
|
|
2271
|
+
return console.log("Restart identity result:", b), s(b), b;
|
|
2272
|
+
} catch (g) {
|
|
2273
|
+
throw l(g), g;
|
|
2258
2274
|
} finally {
|
|
2259
2275
|
i(!1), d.current = !1;
|
|
2260
2276
|
}
|
|
@@ -2267,35 +2283,39 @@ function er(t) {
|
|
|
2267
2283
|
isLoading: a,
|
|
2268
2284
|
error: c,
|
|
2269
2285
|
requestIdentity: u,
|
|
2270
|
-
requestCompanyIdentity:
|
|
2271
|
-
restartIdentity:
|
|
2286
|
+
requestCompanyIdentity: y,
|
|
2287
|
+
restartIdentity: x
|
|
2272
2288
|
};
|
|
2273
2289
|
}
|
|
2274
2290
|
function tr(t) {
|
|
2275
|
-
const { riskScoringService: e } =
|
|
2291
|
+
const { riskScoringService: e } = se(), [r, s] = N(null), [a, i] = N(!1), [c, l] = N(!1), [d, u] = N(null), [y, x] = N(null), g = H(!1), b = H(null), m = q(async () => {
|
|
2276
2292
|
if (t) {
|
|
2277
|
-
|
|
2293
|
+
if (g.current) {
|
|
2294
|
+
console.log("[RiskScoring] Load already in progress, skipping...");
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
g.current = !0, i(!0), u(null);
|
|
2278
2298
|
try {
|
|
2279
|
-
const
|
|
2280
|
-
s(b
|
|
2281
|
-
} catch (
|
|
2282
|
-
u(
|
|
2299
|
+
const k = await e.getRiskCriterias(t);
|
|
2300
|
+
s(k), b.current = t;
|
|
2301
|
+
} catch (k) {
|
|
2302
|
+
u(k);
|
|
2283
2303
|
} finally {
|
|
2284
|
-
i(!1);
|
|
2304
|
+
i(!1), g.current = !1;
|
|
2285
2305
|
}
|
|
2286
2306
|
}
|
|
2287
2307
|
}, [t, e]);
|
|
2288
|
-
|
|
2289
|
-
t && m();
|
|
2290
|
-
}, [t
|
|
2291
|
-
const
|
|
2292
|
-
async (
|
|
2308
|
+
Y(() => {
|
|
2309
|
+
t && b.current !== t && m();
|
|
2310
|
+
}, [t]);
|
|
2311
|
+
const f = q(
|
|
2312
|
+
async (k) => {
|
|
2293
2313
|
l(!0), u(null);
|
|
2294
2314
|
try {
|
|
2295
|
-
const
|
|
2296
|
-
return
|
|
2297
|
-
} catch (
|
|
2298
|
-
throw u(
|
|
2315
|
+
const h = await e.submitRiskScoring(k);
|
|
2316
|
+
return x(h), h;
|
|
2317
|
+
} catch (h) {
|
|
2318
|
+
throw u(h), h;
|
|
2299
2319
|
} finally {
|
|
2300
2320
|
l(!1);
|
|
2301
2321
|
}
|
|
@@ -2304,43 +2324,45 @@ function tr(t) {
|
|
|
2304
2324
|
);
|
|
2305
2325
|
return {
|
|
2306
2326
|
criteria: r,
|
|
2307
|
-
result:
|
|
2327
|
+
result: y,
|
|
2308
2328
|
isLoading: a,
|
|
2309
2329
|
isSubmitting: c,
|
|
2310
2330
|
error: d,
|
|
2311
2331
|
load: m,
|
|
2312
|
-
submit:
|
|
2332
|
+
submit: f
|
|
2313
2333
|
};
|
|
2314
2334
|
}
|
|
2315
2335
|
function rr() {
|
|
2316
|
-
const { applicantService: t, config: e } =
|
|
2336
|
+
const { applicantService: t, config: e } = se(), [r, s] = N(!1), [a, i] = N(null), c = H(!1), l = H(!1), d = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(b) {
|
|
2317
2337
|
const m = Math.random() * 16 | 0;
|
|
2318
|
-
return (
|
|
2319
|
-
}),
|
|
2320
|
-
async (
|
|
2338
|
+
return (b === "x" ? m : m & 3 | 8).toString(16);
|
|
2339
|
+
}), u = q(
|
|
2340
|
+
async (b) => {
|
|
2321
2341
|
var m;
|
|
2322
|
-
|
|
2342
|
+
if (c.current)
|
|
2343
|
+
throw console.log("[Applicant] Create already in progress, skipping..."), new Error("Creation already in progress");
|
|
2344
|
+
c.current = !0, s(!0), i(null);
|
|
2323
2345
|
try {
|
|
2324
|
-
if (
|
|
2325
|
-
const
|
|
2326
|
-
console.log("[SardinAI] Generated session key:",
|
|
2346
|
+
if (b.applicantAdditionalDatas || (b.applicantAdditionalDatas = []), (m = e.identityProviders) != null && m.sardinai) {
|
|
2347
|
+
const k = d();
|
|
2348
|
+
console.log("[SardinAI] Generated session key:", k), b.applicantAdditionalDatas.push({
|
|
2327
2349
|
paramName: "sessionKey",
|
|
2328
|
-
value:
|
|
2350
|
+
value: k
|
|
2329
2351
|
});
|
|
2330
2352
|
}
|
|
2331
|
-
return await t.createApplicant(
|
|
2332
|
-
} catch (
|
|
2333
|
-
throw i(
|
|
2353
|
+
return await t.createApplicant(b);
|
|
2354
|
+
} catch (f) {
|
|
2355
|
+
throw i(f), f;
|
|
2334
2356
|
} finally {
|
|
2335
|
-
s(!1);
|
|
2357
|
+
s(!1), c.current = !1;
|
|
2336
2358
|
}
|
|
2337
2359
|
},
|
|
2338
2360
|
[t, e]
|
|
2339
|
-
),
|
|
2340
|
-
async (
|
|
2361
|
+
), y = q(
|
|
2362
|
+
async (b) => {
|
|
2341
2363
|
s(!0), i(null);
|
|
2342
2364
|
try {
|
|
2343
|
-
return await t.createCompanyApplicant(
|
|
2365
|
+
return await t.createCompanyApplicant(b);
|
|
2344
2366
|
} catch (m) {
|
|
2345
2367
|
throw i(m), m;
|
|
2346
2368
|
} finally {
|
|
@@ -2348,23 +2370,25 @@ function rr() {
|
|
|
2348
2370
|
}
|
|
2349
2371
|
},
|
|
2350
2372
|
[t]
|
|
2351
|
-
),
|
|
2352
|
-
async (
|
|
2353
|
-
|
|
2373
|
+
), x = q(
|
|
2374
|
+
async (b) => {
|
|
2375
|
+
if (l.current)
|
|
2376
|
+
throw console.log("[Applicant] Data load already in progress, skipping..."), new Error("Data load already in progress");
|
|
2377
|
+
l.current = !0, s(!0), i(null);
|
|
2354
2378
|
try {
|
|
2355
|
-
return await t.getApplicantData(
|
|
2379
|
+
return await t.getApplicantData(b);
|
|
2356
2380
|
} catch (m) {
|
|
2357
2381
|
throw i(m), m;
|
|
2358
2382
|
} finally {
|
|
2359
|
-
s(!1);
|
|
2383
|
+
s(!1), l.current = !1;
|
|
2360
2384
|
}
|
|
2361
2385
|
},
|
|
2362
2386
|
[t]
|
|
2363
2387
|
), g = q(
|
|
2364
|
-
async (
|
|
2388
|
+
async (b) => {
|
|
2365
2389
|
s(!0), i(null);
|
|
2366
2390
|
try {
|
|
2367
|
-
await t.stopProgress(
|
|
2391
|
+
await t.stopProgress(b);
|
|
2368
2392
|
} catch (m) {
|
|
2369
2393
|
throw i(m), m;
|
|
2370
2394
|
} finally {
|
|
@@ -2376,9 +2400,9 @@ function rr() {
|
|
|
2376
2400
|
return {
|
|
2377
2401
|
isLoading: r,
|
|
2378
2402
|
error: a,
|
|
2379
|
-
createApplicant:
|
|
2380
|
-
createCompanyApplicant:
|
|
2381
|
-
getApplicantData:
|
|
2403
|
+
createApplicant: u,
|
|
2404
|
+
createCompanyApplicant: y,
|
|
2405
|
+
getApplicantData: x,
|
|
2382
2406
|
stopProgress: g
|
|
2383
2407
|
};
|
|
2384
2408
|
}
|
|
@@ -2405,7 +2429,7 @@ const j = ({
|
|
|
2405
2429
|
return /* @__PURE__ */ o(
|
|
2406
2430
|
"button",
|
|
2407
2431
|
{
|
|
2408
|
-
className:
|
|
2432
|
+
className: te(l, d[e], u[r], i),
|
|
2409
2433
|
disabled: a || s,
|
|
2410
2434
|
...c,
|
|
2411
2435
|
children: [
|
|
@@ -2443,7 +2467,7 @@ const j = ({
|
|
|
2443
2467
|
]
|
|
2444
2468
|
}
|
|
2445
2469
|
);
|
|
2446
|
-
},
|
|
2470
|
+
}, X = Fe(
|
|
2447
2471
|
({ label: t, error: e, helperText: r, leftIcon: s, rightIcon: a, className: i, ...c }, l) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2448
2472
|
t && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2449
2473
|
t,
|
|
@@ -2455,7 +2479,7 @@ const j = ({
|
|
|
2455
2479
|
"input",
|
|
2456
2480
|
{
|
|
2457
2481
|
ref: l,
|
|
2458
|
-
className:
|
|
2482
|
+
className: te(
|
|
2459
2483
|
"block w-full rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
2460
2484
|
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
2461
2485
|
"disabled:bg-gray-100 disabled:cursor-not-allowed",
|
|
@@ -2474,11 +2498,11 @@ const j = ({
|
|
|
2474
2498
|
!e && r && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-gray-500", children: r })
|
|
2475
2499
|
] })
|
|
2476
2500
|
);
|
|
2477
|
-
|
|
2478
|
-
const
|
|
2501
|
+
X.displayName = "Input";
|
|
2502
|
+
const L = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
2479
2503
|
"div",
|
|
2480
2504
|
{
|
|
2481
|
-
className:
|
|
2505
|
+
className: te(
|
|
2482
2506
|
"rounded-xl shadow-sm border",
|
|
2483
2507
|
e
|
|
2484
2508
|
),
|
|
@@ -2489,30 +2513,30 @@ const T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
|
2489
2513
|
...r,
|
|
2490
2514
|
children: t
|
|
2491
2515
|
}
|
|
2492
|
-
),
|
|
2516
|
+
), ee = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
2493
2517
|
"div",
|
|
2494
2518
|
{
|
|
2495
|
-
className:
|
|
2519
|
+
className: te("px-6 py-4 border-b", e),
|
|
2496
2520
|
style: {
|
|
2497
2521
|
borderColor: "var(--metakyc-border, #e5e7eb)"
|
|
2498
2522
|
},
|
|
2499
2523
|
...r,
|
|
2500
2524
|
children: t
|
|
2501
2525
|
}
|
|
2502
|
-
),
|
|
2526
|
+
), T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n("div", { className: te("px-6 py-4", e), ...r, children: t }), ne = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
2503
2527
|
"div",
|
|
2504
2528
|
{
|
|
2505
|
-
className:
|
|
2529
|
+
className: te("px-6 py-4 border-t", e),
|
|
2506
2530
|
style: {
|
|
2507
2531
|
borderColor: "var(--metakyc-border, #e5e7eb)"
|
|
2508
2532
|
},
|
|
2509
2533
|
...r,
|
|
2510
2534
|
children: t
|
|
2511
2535
|
}
|
|
2512
|
-
),
|
|
2536
|
+
), he = ({ children: t, variant: e = "default", className: r, ...s }) => /* @__PURE__ */ n(
|
|
2513
2537
|
"span",
|
|
2514
2538
|
{
|
|
2515
|
-
className:
|
|
2539
|
+
className: te(
|
|
2516
2540
|
"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
|
|
2517
2541
|
{
|
|
2518
2542
|
default: "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",
|
|
@@ -2526,16 +2550,16 @@ const T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
|
2526
2550
|
...s,
|
|
2527
2551
|
children: t
|
|
2528
2552
|
}
|
|
2529
|
-
),
|
|
2553
|
+
), le = ({ size: t = "md", className: e, ...r }) => {
|
|
2530
2554
|
const s = {
|
|
2531
2555
|
sm: "h-4 w-4",
|
|
2532
2556
|
md: "h-8 w-8",
|
|
2533
2557
|
lg: "h-12 w-12"
|
|
2534
2558
|
};
|
|
2535
|
-
return /* @__PURE__ */ n("div", { className:
|
|
2559
|
+
return /* @__PURE__ */ n("div", { className: te("flex items-center justify-center", e), ...r, children: /* @__PURE__ */ o(
|
|
2536
2560
|
"svg",
|
|
2537
2561
|
{
|
|
2538
|
-
className:
|
|
2562
|
+
className: te("animate-spin text-primary-500", s[t]),
|
|
2539
2563
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2540
2564
|
fill: "none",
|
|
2541
2565
|
viewBox: "0 0 24 24",
|
|
@@ -2562,7 +2586,7 @@ const T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
|
2562
2586
|
]
|
|
2563
2587
|
}
|
|
2564
2588
|
) });
|
|
2565
|
-
},
|
|
2589
|
+
}, ye = Fe(
|
|
2566
2590
|
({ label: t, error: e, helperText: r, options: s, placeholder: a, className: i, ...c }, l) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2567
2591
|
t && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2568
2592
|
t,
|
|
@@ -2572,7 +2596,7 @@ const T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
|
2572
2596
|
"select",
|
|
2573
2597
|
{
|
|
2574
2598
|
ref: l,
|
|
2575
|
-
className:
|
|
2599
|
+
className: te(
|
|
2576
2600
|
"block w-full rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
2577
2601
|
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
2578
2602
|
"disabled:bg-gray-100 disabled:cursor-not-allowed",
|
|
@@ -2599,7 +2623,7 @@ const T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
|
2599
2623
|
!e && r && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-gray-500", children: r })
|
|
2600
2624
|
] })
|
|
2601
2625
|
);
|
|
2602
|
-
|
|
2626
|
+
ye.displayName = "Select";
|
|
2603
2627
|
const nr = ({
|
|
2604
2628
|
label: t,
|
|
2605
2629
|
error: e,
|
|
@@ -2610,52 +2634,52 @@ const nr = ({
|
|
|
2610
2634
|
value: c = [],
|
|
2611
2635
|
className: l
|
|
2612
2636
|
}) => {
|
|
2613
|
-
const [d, u] =
|
|
2614
|
-
if (!
|
|
2615
|
-
const E = Array.from(
|
|
2616
|
-
if (a && E.filter((
|
|
2617
|
-
const
|
|
2618
|
-
alert(`Some files exceed the maximum size of ${
|
|
2637
|
+
const [d, u] = N(!1), y = H(null), x = (h) => {
|
|
2638
|
+
if (!h) return;
|
|
2639
|
+
const E = Array.from(h);
|
|
2640
|
+
if (a && E.filter((S) => S.size > a).length > 0) {
|
|
2641
|
+
const S = Ie(a);
|
|
2642
|
+
alert(`Some files exceed the maximum size of ${S}`);
|
|
2619
2643
|
return;
|
|
2620
2644
|
}
|
|
2621
2645
|
i == null || i(s ? [...c, ...E] : [E[0]]);
|
|
2622
|
-
},
|
|
2623
|
-
|
|
2624
|
-
},
|
|
2646
|
+
}, g = (h) => {
|
|
2647
|
+
h.preventDefault(), u(!0);
|
|
2648
|
+
}, b = () => {
|
|
2625
2649
|
u(!1);
|
|
2626
|
-
},
|
|
2627
|
-
|
|
2628
|
-
},
|
|
2629
|
-
var
|
|
2630
|
-
(
|
|
2631
|
-
},
|
|
2632
|
-
const E = c.filter((
|
|
2650
|
+
}, m = (h) => {
|
|
2651
|
+
h.preventDefault(), u(!1), x(h.dataTransfer.files);
|
|
2652
|
+
}, f = () => {
|
|
2653
|
+
var h;
|
|
2654
|
+
(h = y.current) == null || h.click();
|
|
2655
|
+
}, k = (h) => {
|
|
2656
|
+
const E = c.filter((v, S) => S !== h);
|
|
2633
2657
|
i == null || i(E);
|
|
2634
2658
|
};
|
|
2635
|
-
return /* @__PURE__ */ o("div", { className:
|
|
2659
|
+
return /* @__PURE__ */ o("div", { className: te("w-full", l), children: [
|
|
2636
2660
|
t && /* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: t }),
|
|
2637
2661
|
/* @__PURE__ */ o(
|
|
2638
2662
|
"div",
|
|
2639
2663
|
{
|
|
2640
|
-
className:
|
|
2664
|
+
className: te(
|
|
2641
2665
|
"border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors",
|
|
2642
2666
|
d ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-300 dark:border-gray-600 hover:border-primary-500",
|
|
2643
2667
|
e && "border-danger-500"
|
|
2644
2668
|
),
|
|
2645
|
-
onDragOver:
|
|
2646
|
-
onDragLeave:
|
|
2647
|
-
onDrop:
|
|
2648
|
-
onClick:
|
|
2669
|
+
onDragOver: g,
|
|
2670
|
+
onDragLeave: b,
|
|
2671
|
+
onDrop: m,
|
|
2672
|
+
onClick: f,
|
|
2649
2673
|
children: [
|
|
2650
2674
|
/* @__PURE__ */ n(
|
|
2651
2675
|
"input",
|
|
2652
2676
|
{
|
|
2653
|
-
ref:
|
|
2677
|
+
ref: y,
|
|
2654
2678
|
type: "file",
|
|
2655
2679
|
className: "hidden",
|
|
2656
2680
|
accept: r,
|
|
2657
2681
|
multiple: s,
|
|
2658
|
-
onChange: (
|
|
2682
|
+
onChange: (h) => x(h.target.files)
|
|
2659
2683
|
}
|
|
2660
2684
|
),
|
|
2661
2685
|
/* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
@@ -2683,13 +2707,13 @@ const nr = ({
|
|
|
2683
2707
|
] }),
|
|
2684
2708
|
a && /* @__PURE__ */ o("p", { className: "text-xs text-gray-500", children: [
|
|
2685
2709
|
"Maximum file size: ",
|
|
2686
|
-
|
|
2710
|
+
Ie(a)
|
|
2687
2711
|
] })
|
|
2688
2712
|
] })
|
|
2689
2713
|
]
|
|
2690
2714
|
}
|
|
2691
2715
|
),
|
|
2692
|
-
c.length > 0 && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2", children: c.map((
|
|
2716
|
+
c.length > 0 && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2", children: c.map((h, E) => /* @__PURE__ */ o(
|
|
2693
2717
|
"div",
|
|
2694
2718
|
{
|
|
2695
2719
|
className: "flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",
|
|
@@ -2711,10 +2735,10 @@ const nr = ({
|
|
|
2711
2735
|
)
|
|
2712
2736
|
}
|
|
2713
2737
|
),
|
|
2714
|
-
/* @__PURE__ */ n("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children:
|
|
2738
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children: h.name }),
|
|
2715
2739
|
/* @__PURE__ */ o("span", { className: "text-xs text-gray-500", children: [
|
|
2716
2740
|
"(",
|
|
2717
|
-
|
|
2741
|
+
Ie(h.size),
|
|
2718
2742
|
")"
|
|
2719
2743
|
] })
|
|
2720
2744
|
] }),
|
|
@@ -2722,8 +2746,8 @@ const nr = ({
|
|
|
2722
2746
|
"button",
|
|
2723
2747
|
{
|
|
2724
2748
|
type: "button",
|
|
2725
|
-
onClick: (
|
|
2726
|
-
|
|
2749
|
+
onClick: (v) => {
|
|
2750
|
+
v.stopPropagation(), k(E);
|
|
2727
2751
|
},
|
|
2728
2752
|
className: "ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",
|
|
2729
2753
|
children: /* @__PURE__ */ n("svg", { className: "h-5 w-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ n(
|
|
@@ -2742,7 +2766,7 @@ const nr = ({
|
|
|
2742
2766
|
)) }),
|
|
2743
2767
|
e && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-danger-500", children: e })
|
|
2744
2768
|
] });
|
|
2745
|
-
}, sr =
|
|
2769
|
+
}, sr = Fe(
|
|
2746
2770
|
({ countryCode: t = "+1", onCountryCodeChange: e, className: r, ...s }, a) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2747
2771
|
s.label && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2748
2772
|
s.label,
|
|
@@ -2755,7 +2779,7 @@ const nr = ({
|
|
|
2755
2779
|
type: "text",
|
|
2756
2780
|
value: t,
|
|
2757
2781
|
onChange: (i) => e == null ? void 0 : e(i.target.value),
|
|
2758
|
-
className:
|
|
2782
|
+
className: te(
|
|
2759
2783
|
"w-20 rounded-lg border px-3 py-2 text-sm",
|
|
2760
2784
|
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
2761
2785
|
"border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white"
|
|
@@ -2764,11 +2788,11 @@ const nr = ({
|
|
|
2764
2788
|
}
|
|
2765
2789
|
),
|
|
2766
2790
|
/* @__PURE__ */ n(
|
|
2767
|
-
|
|
2791
|
+
X,
|
|
2768
2792
|
{
|
|
2769
2793
|
ref: a,
|
|
2770
2794
|
type: "tel",
|
|
2771
|
-
className:
|
|
2795
|
+
className: te("flex-1", r),
|
|
2772
2796
|
...s,
|
|
2773
2797
|
label: ""
|
|
2774
2798
|
}
|
|
@@ -2780,23 +2804,23 @@ const nr = ({
|
|
|
2780
2804
|
sr.displayName = "PhoneInput";
|
|
2781
2805
|
const Me = (t, e, r) => {
|
|
2782
2806
|
if (t && "reportValidity" in t) {
|
|
2783
|
-
const s =
|
|
2807
|
+
const s = Re(r, e);
|
|
2784
2808
|
t.setCustomValidity(s && s.message || ""), t.reportValidity();
|
|
2785
2809
|
}
|
|
2786
|
-
},
|
|
2810
|
+
}, Pe = (t, e) => {
|
|
2787
2811
|
for (const r in e.fields) {
|
|
2788
2812
|
const s = e.fields[r];
|
|
2789
2813
|
s && s.ref && "reportValidity" in s.ref ? Me(s.ref, r, t) : s && s.refs && s.refs.forEach((a) => Me(a, r, t));
|
|
2790
2814
|
}
|
|
2791
2815
|
}, Be = (t, e) => {
|
|
2792
|
-
e.shouldUseNativeValidation &&
|
|
2816
|
+
e.shouldUseNativeValidation && Pe(t, e);
|
|
2793
2817
|
const r = {};
|
|
2794
2818
|
for (const s in t) {
|
|
2795
|
-
const a =
|
|
2819
|
+
const a = Re(e.fields, s), i = Object.assign(t[s] || {}, { ref: a && a.ref });
|
|
2796
2820
|
if (ar(e.names || Object.keys(t), s)) {
|
|
2797
|
-
const c = Object.assign({},
|
|
2798
|
-
|
|
2799
|
-
} else
|
|
2821
|
+
const c = Object.assign({}, Re(r, s));
|
|
2822
|
+
Ee(c, "root", i), Ee(r, s, c);
|
|
2823
|
+
} else Ee(r, s, i);
|
|
2800
2824
|
}
|
|
2801
2825
|
return r;
|
|
2802
2826
|
}, ar = (t, e) => {
|
|
@@ -2813,8 +2837,8 @@ function qe(t, e, r) {
|
|
|
2813
2837
|
value: l._zod ?? {},
|
|
2814
2838
|
enumerable: !1
|
|
2815
2839
|
}), (u = l._zod).traits ?? (u.traits = /* @__PURE__ */ new Set()), l._zod.traits.add(t), e(l, d);
|
|
2816
|
-
for (const
|
|
2817
|
-
|
|
2840
|
+
for (const y in c.prototype)
|
|
2841
|
+
y in l || Object.defineProperty(l, y, { value: c.prototype[y].bind(l) });
|
|
2818
2842
|
l._zod.constr = c, l._zod.def = d;
|
|
2819
2843
|
}
|
|
2820
2844
|
const a = (r == null ? void 0 : r.Parent) ?? Object;
|
|
@@ -2825,8 +2849,8 @@ function qe(t, e, r) {
|
|
|
2825
2849
|
var d;
|
|
2826
2850
|
const u = r != null && r.Parent ? new i() : this;
|
|
2827
2851
|
s(u, l), (d = u._zod).deferred ?? (d.deferred = []);
|
|
2828
|
-
for (const
|
|
2829
|
-
|
|
2852
|
+
for (const y of u._zod.deferred)
|
|
2853
|
+
y();
|
|
2830
2854
|
return u;
|
|
2831
2855
|
}
|
|
2832
2856
|
return Object.defineProperty(c, "init", { value: s }), Object.defineProperty(c, Symbol.hasInstance, {
|
|
@@ -2850,15 +2874,15 @@ function lr(t, e) {
|
|
|
2850
2874
|
}
|
|
2851
2875
|
const Ve = Error.captureStackTrace ? Error.captureStackTrace : (...t) => {
|
|
2852
2876
|
};
|
|
2853
|
-
function
|
|
2877
|
+
function ke(t) {
|
|
2854
2878
|
return typeof t == "string" ? t : t == null ? void 0 : t.message;
|
|
2855
2879
|
}
|
|
2856
2880
|
function Ye(t, e, r) {
|
|
2857
2881
|
var a, i, c, l, d, u;
|
|
2858
2882
|
const s = { ...t, path: t.path ?? [] };
|
|
2859
2883
|
if (!t.message) {
|
|
2860
|
-
const
|
|
2861
|
-
s.message =
|
|
2884
|
+
const y = ke((c = (i = (a = t.inst) == null ? void 0 : a._zod.def) == null ? void 0 : i.error) == null ? void 0 : c.call(i, t)) ?? ke((l = e == null ? void 0 : e.error) == null ? void 0 : l.call(e, t)) ?? ke((d = r.customError) == null ? void 0 : d.call(r, t)) ?? ke((u = r.localeError) == null ? void 0 : u.call(r, t)) ?? "Invalid input";
|
|
2885
|
+
s.message = y;
|
|
2862
2886
|
}
|
|
2863
2887
|
return delete s.inst, delete s.continue, e != null && e.reportInput || delete s.input, s;
|
|
2864
2888
|
}
|
|
@@ -2912,9 +2936,9 @@ function pr(t, e) {
|
|
|
2912
2936
|
var l = s.unionErrors[0].errors[0];
|
|
2913
2937
|
r[c] = { message: l.message, type: l.code };
|
|
2914
2938
|
} else r[c] = { message: i, type: a };
|
|
2915
|
-
if ("unionErrors" in s && s.unionErrors.forEach(function(
|
|
2916
|
-
return
|
|
2917
|
-
return t.push(
|
|
2939
|
+
if ("unionErrors" in s && s.unionErrors.forEach(function(y) {
|
|
2940
|
+
return y.errors.forEach(function(x) {
|
|
2941
|
+
return t.push(x);
|
|
2918
2942
|
});
|
|
2919
2943
|
}), e) {
|
|
2920
2944
|
var d = r[c].types, u = d && d[s.code];
|
|
@@ -2931,9 +2955,9 @@ function gr(t, e) {
|
|
|
2931
2955
|
var l = s.errors[0][0];
|
|
2932
2956
|
r[c] = { message: l.message, type: l.code };
|
|
2933
2957
|
} else r[c] = { message: i, type: a };
|
|
2934
|
-
if (s.code === "invalid_union" && s.errors.forEach(function(
|
|
2935
|
-
return
|
|
2936
|
-
return t.push(
|
|
2958
|
+
if (s.code === "invalid_union" && s.errors.forEach(function(y) {
|
|
2959
|
+
return y.forEach(function(x) {
|
|
2960
|
+
return t.push(x);
|
|
2937
2961
|
});
|
|
2938
2962
|
}), e) {
|
|
2939
2963
|
var d = r[c].types, u = d && d[s.code];
|
|
@@ -2950,7 +2974,7 @@ function Ge(t, e, r) {
|
|
|
2950
2974
|
try {
|
|
2951
2975
|
return Promise.resolve(ze(function() {
|
|
2952
2976
|
return Promise.resolve(t[r.mode === "sync" ? "parse" : "parseAsync"](s, e)).then(function(c) {
|
|
2953
|
-
return i.shouldUseNativeValidation &&
|
|
2977
|
+
return i.shouldUseNativeValidation && Pe({}, i), { errors: {}, values: r.raw ? Object.assign({}, s) : c };
|
|
2954
2978
|
});
|
|
2955
2979
|
}, function(c) {
|
|
2956
2980
|
if (function(l) {
|
|
@@ -2968,7 +2992,7 @@ function Ge(t, e, r) {
|
|
|
2968
2992
|
try {
|
|
2969
2993
|
return Promise.resolve(ze(function() {
|
|
2970
2994
|
return Promise.resolve((r.mode === "sync" ? ur : hr)(t, s, e)).then(function(c) {
|
|
2971
|
-
return i.shouldUseNativeValidation &&
|
|
2995
|
+
return i.shouldUseNativeValidation && Pe({}, i), { errors: {}, values: r.raw ? Object.assign({}, s) : c };
|
|
2972
2996
|
});
|
|
2973
2997
|
}, function(c) {
|
|
2974
2998
|
if (function(l) {
|
|
@@ -2983,12 +3007,12 @@ function Ge(t, e, r) {
|
|
|
2983
3007
|
throw new Error("Invalid input: not a Zod schema");
|
|
2984
3008
|
}
|
|
2985
3009
|
function yr(t) {
|
|
2986
|
-
return
|
|
2987
|
-
questionResults:
|
|
3010
|
+
return ue.object({
|
|
3011
|
+
questionResults: ue.any()
|
|
2988
3012
|
}).passthrough();
|
|
2989
3013
|
}
|
|
2990
3014
|
function fr(t) {
|
|
2991
|
-
let e =
|
|
3015
|
+
let e = ue.array(ue.instanceof(File));
|
|
2992
3016
|
if (t.isRequired ? e = e.min(
|
|
2993
3017
|
1,
|
|
2994
3018
|
`${t.displayName} is required`
|
|
@@ -3014,132 +3038,132 @@ function qr(t) {
|
|
|
3014
3038
|
return t.uploadDocumentFiles.forEach((r) => {
|
|
3015
3039
|
const s = `file_${r.id}`;
|
|
3016
3040
|
e[s] = fr(r);
|
|
3017
|
-
}),
|
|
3041
|
+
}), ue.object(e);
|
|
3018
3042
|
}
|
|
3019
3043
|
function br(t) {
|
|
3020
|
-
return
|
|
3044
|
+
return ue.any();
|
|
3021
3045
|
}
|
|
3022
3046
|
function xr(t) {
|
|
3023
|
-
return
|
|
3047
|
+
return ue.string().min(1, "This question is required");
|
|
3024
3048
|
}
|
|
3025
3049
|
function Hr(t) {
|
|
3026
3050
|
const e = {};
|
|
3027
3051
|
return t.appropriatenessQuestions.forEach((r) => {
|
|
3028
3052
|
const s = `question_${r.id}`;
|
|
3029
3053
|
e[s] = xr();
|
|
3030
|
-
}),
|
|
3054
|
+
}), ue.object(e);
|
|
3031
3055
|
}
|
|
3032
|
-
const Vr =
|
|
3056
|
+
const Vr = ue.any(), vr = ({
|
|
3033
3057
|
applicantId: t,
|
|
3034
3058
|
onComplete: e,
|
|
3035
3059
|
onBack: r
|
|
3036
3060
|
}) => {
|
|
3037
3061
|
const { questionnaire: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Zt(t), d = je(() => s ? { questionResults: s.questionGroups.map(
|
|
3038
|
-
(
|
|
3039
|
-
questionId:
|
|
3062
|
+
(f) => f.questions.map((k) => ({
|
|
3063
|
+
questionId: k.id,
|
|
3040
3064
|
values: []
|
|
3041
3065
|
}))
|
|
3042
3066
|
) } : { questionResults: [] }, [s]), u = s ? yr() : null, {
|
|
3043
|
-
control:
|
|
3044
|
-
handleSubmit:
|
|
3045
|
-
formState: { errors:
|
|
3046
|
-
} =
|
|
3067
|
+
control: y,
|
|
3068
|
+
handleSubmit: x,
|
|
3069
|
+
formState: { errors: g }
|
|
3070
|
+
} = Le({
|
|
3047
3071
|
resolver: u ? Ge(u) : void 0,
|
|
3048
3072
|
defaultValues: d
|
|
3049
|
-
}),
|
|
3073
|
+
}), b = async (m) => {
|
|
3050
3074
|
if (s)
|
|
3051
3075
|
try {
|
|
3052
|
-
console.log("Form submitted with data:",
|
|
3053
|
-
const
|
|
3054
|
-
(
|
|
3055
|
-
var
|
|
3076
|
+
console.log("Form submitted with data:", m);
|
|
3077
|
+
const f = s.questionGroups.flatMap(
|
|
3078
|
+
(h, E) => h.questions.map((v, S) => {
|
|
3079
|
+
var I, P, C;
|
|
3056
3080
|
return {
|
|
3057
|
-
questionId:
|
|
3058
|
-
values: ((
|
|
3081
|
+
questionId: v.id,
|
|
3082
|
+
values: ((C = (P = (I = m.questionResults) == null ? void 0 : I[E]) == null ? void 0 : P[S]) == null ? void 0 : C.values) || []
|
|
3059
3083
|
};
|
|
3060
3084
|
})
|
|
3061
3085
|
);
|
|
3062
|
-
console.log("Question results to submit:",
|
|
3063
|
-
const
|
|
3086
|
+
console.log("Question results to submit:", f);
|
|
3087
|
+
const k = {
|
|
3064
3088
|
applicantId: t,
|
|
3065
3089
|
questionnarieId: s.id,
|
|
3066
|
-
questionResults:
|
|
3090
|
+
questionResults: f
|
|
3067
3091
|
};
|
|
3068
|
-
console.log("Final input:",
|
|
3069
|
-
} catch (
|
|
3070
|
-
console.error("Error submitting questionnaire:",
|
|
3092
|
+
console.log("Final input:", k), await l(k), e == null || e();
|
|
3093
|
+
} catch (f) {
|
|
3094
|
+
console.error("Error submitting questionnaire:", f);
|
|
3071
3095
|
}
|
|
3072
3096
|
};
|
|
3073
|
-
return a ? /* @__PURE__ */ n(
|
|
3097
|
+
return a ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(le, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3074
3098
|
"Error loading questionnaire: ",
|
|
3075
3099
|
c.message
|
|
3076
|
-
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit:
|
|
3077
|
-
/* @__PURE__ */ o(
|
|
3100
|
+
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: x(b), children: /* @__PURE__ */ o(L, { children: [
|
|
3101
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3078
3102
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: s.displayName }),
|
|
3079
3103
|
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
|
|
3080
3104
|
] }),
|
|
3081
|
-
/* @__PURE__ */ n(
|
|
3082
|
-
(
|
|
3083
|
-
const
|
|
3105
|
+
/* @__PURE__ */ n(T, { className: "space-y-8", children: s.questionGroups.flatMap(
|
|
3106
|
+
(m, f) => m.questions.map((k, h) => {
|
|
3107
|
+
const v = k.defaultAnswers && k.defaultAnswers.length > 0 ? k.showAsDropdown ? k.canMultipleAnswer ? "multi-select" : "single-select" : k.canMultipleAnswer ? "checkbox" : "radio" : "text";
|
|
3084
3108
|
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3085
3109
|
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3086
|
-
|
|
3087
|
-
|
|
3110
|
+
k.text,
|
|
3111
|
+
k.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3088
3112
|
] }),
|
|
3089
|
-
|
|
3090
|
-
|
|
3113
|
+
v === "text" && /* @__PURE__ */ n(
|
|
3114
|
+
J,
|
|
3091
3115
|
{
|
|
3092
|
-
control:
|
|
3093
|
-
name: `questionResults.${
|
|
3094
|
-
render: ({ field:
|
|
3095
|
-
var
|
|
3116
|
+
control: y,
|
|
3117
|
+
name: `questionResults.${f}.${h}.values.0`,
|
|
3118
|
+
render: ({ field: S }) => {
|
|
3119
|
+
var I, P, C, A;
|
|
3096
3120
|
return /* @__PURE__ */ n(
|
|
3097
|
-
|
|
3121
|
+
X,
|
|
3098
3122
|
{
|
|
3099
|
-
value:
|
|
3100
|
-
onChange:
|
|
3101
|
-
onBlur:
|
|
3102
|
-
name:
|
|
3123
|
+
value: S.value || "",
|
|
3124
|
+
onChange: S.onChange,
|
|
3125
|
+
onBlur: S.onBlur,
|
|
3126
|
+
name: S.name,
|
|
3103
3127
|
placeholder: "Enter your answer...",
|
|
3104
|
-
error: (
|
|
3128
|
+
error: (A = (C = (P = (I = g.questionResults) == null ? void 0 : I[f]) == null ? void 0 : P[h]) == null ? void 0 : C.values) == null ? void 0 : A.message
|
|
3105
3129
|
}
|
|
3106
3130
|
);
|
|
3107
3131
|
}
|
|
3108
3132
|
}
|
|
3109
3133
|
),
|
|
3110
|
-
(
|
|
3111
|
-
|
|
3134
|
+
(v === "single-select" || v === "radio") && /* @__PURE__ */ n(
|
|
3135
|
+
J,
|
|
3112
3136
|
{
|
|
3113
|
-
control:
|
|
3114
|
-
name: `questionResults.${
|
|
3115
|
-
render: ({ field:
|
|
3116
|
-
var
|
|
3137
|
+
control: y,
|
|
3138
|
+
name: `questionResults.${f}.${h}.values.0`,
|
|
3139
|
+
render: ({ field: S }) => {
|
|
3140
|
+
var I, P, C, A;
|
|
3117
3141
|
return /* @__PURE__ */ n(
|
|
3118
|
-
|
|
3142
|
+
ye,
|
|
3119
3143
|
{
|
|
3120
|
-
value:
|
|
3121
|
-
onChange:
|
|
3122
|
-
onBlur:
|
|
3123
|
-
name:
|
|
3124
|
-
options:
|
|
3125
|
-
value:
|
|
3126
|
-
label:
|
|
3144
|
+
value: S.value || "",
|
|
3145
|
+
onChange: S.onChange,
|
|
3146
|
+
onBlur: S.onBlur,
|
|
3147
|
+
name: S.name,
|
|
3148
|
+
options: k.defaultAnswers.map((M) => ({
|
|
3149
|
+
value: M,
|
|
3150
|
+
label: M
|
|
3127
3151
|
})),
|
|
3128
3152
|
placeholder: "Select an option...",
|
|
3129
|
-
error: (
|
|
3153
|
+
error: (A = (C = (P = (I = g.questionResults) == null ? void 0 : I[f]) == null ? void 0 : P[h]) == null ? void 0 : C.values) == null ? void 0 : A.message
|
|
3130
3154
|
}
|
|
3131
3155
|
);
|
|
3132
3156
|
}
|
|
3133
3157
|
}
|
|
3134
3158
|
),
|
|
3135
|
-
(
|
|
3159
|
+
(v === "checkbox" || v === "multi-select") && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3136
3160
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-2", children: "Choose one or more options" }),
|
|
3137
3161
|
/* @__PURE__ */ n(
|
|
3138
|
-
|
|
3162
|
+
J,
|
|
3139
3163
|
{
|
|
3140
|
-
control:
|
|
3141
|
-
name: `questionResults.${
|
|
3142
|
-
render: ({ field: { value:
|
|
3164
|
+
control: y,
|
|
3165
|
+
name: `questionResults.${f}.${h}.values`,
|
|
3166
|
+
render: ({ field: { value: S = [], onChange: I } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: k.defaultAnswers.map((P, C) => /* @__PURE__ */ o(
|
|
3143
3167
|
"label",
|
|
3144
3168
|
{
|
|
3145
3169
|
className: "flex items-center space-x-2 cursor-pointer",
|
|
@@ -3148,26 +3172,26 @@ const Vr = de.any(), vr = ({
|
|
|
3148
3172
|
"input",
|
|
3149
3173
|
{
|
|
3150
3174
|
type: "checkbox",
|
|
3151
|
-
checked: Array.isArray(
|
|
3152
|
-
onChange: (
|
|
3153
|
-
const
|
|
3154
|
-
|
|
3175
|
+
checked: Array.isArray(S) && S.includes(P),
|
|
3176
|
+
onChange: (A) => {
|
|
3177
|
+
const M = Array.isArray(S) ? S : [], B = A.target.checked ? [...M, P] : M.filter((Q) => Q !== P);
|
|
3178
|
+
I(B);
|
|
3155
3179
|
},
|
|
3156
3180
|
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3157
3181
|
}
|
|
3158
3182
|
),
|
|
3159
|
-
/* @__PURE__ */ n("span", { className: "text-sm", children:
|
|
3183
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: P })
|
|
3160
3184
|
]
|
|
3161
3185
|
},
|
|
3162
|
-
`answer-${
|
|
3186
|
+
`answer-${f}-${h}-${C}`
|
|
3163
3187
|
)) })
|
|
3164
3188
|
}
|
|
3165
3189
|
)
|
|
3166
3190
|
] })
|
|
3167
|
-
] },
|
|
3191
|
+
] }, k.id);
|
|
3168
3192
|
})
|
|
3169
3193
|
) }),
|
|
3170
|
-
/* @__PURE__ */ o(
|
|
3194
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3171
3195
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3172
3196
|
/* @__PURE__ */ n(
|
|
3173
3197
|
j,
|
|
@@ -3175,7 +3199,7 @@ const Vr = de.any(), vr = ({
|
|
|
3175
3199
|
type: "submit",
|
|
3176
3200
|
isLoading: i,
|
|
3177
3201
|
onClick: () => {
|
|
3178
|
-
console.log("Continue button clicked"), console.log("Form errors:",
|
|
3202
|
+
console.log("Continue button clicked"), console.log("Form errors:", g);
|
|
3179
3203
|
},
|
|
3180
3204
|
children: "Continue"
|
|
3181
3205
|
}
|
|
@@ -3191,51 +3215,51 @@ const Vr = de.any(), vr = ({
|
|
|
3191
3215
|
onComplete: e,
|
|
3192
3216
|
onBack: r
|
|
3193
3217
|
}) => {
|
|
3194
|
-
const { uploadDocument: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Jt(t), [d, u] =
|
|
3195
|
-
if (
|
|
3196
|
-
const
|
|
3197
|
-
s.uploadDocumentFiles.map(async (
|
|
3198
|
-
const
|
|
3199
|
-
|
|
3200
|
-
fileName:
|
|
3201
|
-
fileData: await qt(
|
|
3218
|
+
const { uploadDocument: s, isLoading: a, isSubmitting: i, error: c, submit: l } = Jt(t), [d, u] = N({}), y = async (x) => {
|
|
3219
|
+
if (x.preventDefault(), !s) return;
|
|
3220
|
+
const g = await Promise.all(
|
|
3221
|
+
s.uploadDocumentFiles.map(async (m) => {
|
|
3222
|
+
const f = d[m.id] || [], k = await Promise.all(
|
|
3223
|
+
f.map(async (h) => ({
|
|
3224
|
+
fileName: h.name,
|
|
3225
|
+
fileData: await qt(h)
|
|
3202
3226
|
}))
|
|
3203
3227
|
);
|
|
3204
3228
|
return {
|
|
3205
|
-
uploadDocumentFileId:
|
|
3206
|
-
valueList:
|
|
3229
|
+
uploadDocumentFileId: m.id,
|
|
3230
|
+
valueList: k
|
|
3207
3231
|
};
|
|
3208
3232
|
})
|
|
3209
|
-
),
|
|
3233
|
+
), b = {
|
|
3210
3234
|
applicantId: t,
|
|
3211
3235
|
uploadDocumentId: s.id,
|
|
3212
|
-
uploadDocumentResults:
|
|
3236
|
+
uploadDocumentResults: g
|
|
3213
3237
|
};
|
|
3214
|
-
await l(
|
|
3238
|
+
await l(b), e == null || e();
|
|
3215
3239
|
};
|
|
3216
|
-
return a ? /* @__PURE__ */ n(
|
|
3240
|
+
return a ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(le, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3217
3241
|
"Error loading document requirements: ",
|
|
3218
3242
|
c.message
|
|
3219
|
-
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit:
|
|
3220
|
-
/* @__PURE__ */ o(
|
|
3243
|
+
] }) }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: y, children: /* @__PURE__ */ o(L, { children: [
|
|
3244
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3221
3245
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: s.displayName }),
|
|
3222
3246
|
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
|
|
3223
3247
|
] }),
|
|
3224
|
-
/* @__PURE__ */ n(
|
|
3248
|
+
/* @__PURE__ */ n(T, { className: "space-y-6", children: s.uploadDocumentFiles.map((x) => /* @__PURE__ */ n(
|
|
3225
3249
|
nr,
|
|
3226
3250
|
{
|
|
3227
|
-
label:
|
|
3228
|
-
accept:
|
|
3229
|
-
multiple:
|
|
3230
|
-
maxSize:
|
|
3231
|
-
value: d[
|
|
3232
|
-
onChange: (
|
|
3233
|
-
u((
|
|
3251
|
+
label: x.displayName,
|
|
3252
|
+
accept: x.allowedTypes,
|
|
3253
|
+
multiple: x.multipleFile,
|
|
3254
|
+
maxSize: x.maxEachFileSizeByte,
|
|
3255
|
+
value: d[x.id] || [],
|
|
3256
|
+
onChange: (g) => {
|
|
3257
|
+
u((b) => ({ ...b, [x.id]: g }));
|
|
3234
3258
|
}
|
|
3235
3259
|
},
|
|
3236
|
-
|
|
3260
|
+
x.id
|
|
3237
3261
|
)) }),
|
|
3238
|
-
/* @__PURE__ */ o(
|
|
3262
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3239
3263
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3240
3264
|
/* @__PURE__ */ n(j, { type: "submit", isLoading: i, children: "Continue" })
|
|
3241
3265
|
] })
|
|
@@ -3244,16 +3268,16 @@ const Vr = de.any(), vr = ({
|
|
|
3244
3268
|
const { overview: s, isLoading: a, isSubmitting: i, error: c, passOverview: l } = Xt(t), d = async () => {
|
|
3245
3269
|
await l(), e == null || e();
|
|
3246
3270
|
};
|
|
3247
|
-
return a ? /* @__PURE__ */ n(
|
|
3271
|
+
return a ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(le, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3248
3272
|
"Error loading overview: ",
|
|
3249
3273
|
c.message
|
|
3250
|
-
] }) }) }) : s ? /* @__PURE__ */ o(
|
|
3251
|
-
/* @__PURE__ */ o(
|
|
3274
|
+
] }) }) }) : s ? /* @__PURE__ */ o(L, { children: [
|
|
3275
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3252
3276
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: s.title || "Overview" }),
|
|
3253
3277
|
s.description && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.description })
|
|
3254
3278
|
] }),
|
|
3255
|
-
/* @__PURE__ */ o(
|
|
3256
|
-
s.steps && s.steps.length > 0 ? /* @__PURE__ */ n("div", { className: "space-y-4", children: s.steps.sort((u,
|
|
3279
|
+
/* @__PURE__ */ o(T, { className: "space-y-6", children: [
|
|
3280
|
+
s.steps && s.steps.length > 0 ? /* @__PURE__ */ n("div", { className: "space-y-4", children: s.steps.sort((u, y) => u.order - y.order).map((u) => /* @__PURE__ */ n(
|
|
3257
3281
|
"div",
|
|
3258
3282
|
{
|
|
3259
3283
|
className: "border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-800",
|
|
@@ -3272,7 +3296,7 @@ const Vr = de.any(), vr = ({
|
|
|
3272
3296
|
" Review the information above and confirm to proceed."
|
|
3273
3297
|
] }) })
|
|
3274
3298
|
] }),
|
|
3275
|
-
/* @__PURE__ */ o(
|
|
3299
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3276
3300
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3277
3301
|
/* @__PURE__ */ n(j, { onClick: d, isLoading: i, children: "Confirm and Continue" })
|
|
3278
3302
|
] })
|
|
@@ -3282,148 +3306,148 @@ const Vr = de.any(), vr = ({
|
|
|
3282
3306
|
onComplete: e,
|
|
3283
3307
|
onBack: r
|
|
3284
3308
|
}) => {
|
|
3285
|
-
const { criteria: s, isLoading: a, isSubmitting: i, error: c, submit: l } = tr(t), [d, u] =
|
|
3286
|
-
criteriaValueInputs: s.map((
|
|
3287
|
-
riskCriteriaId:
|
|
3309
|
+
const { criteria: s, isLoading: a, isSubmitting: i, error: c, submit: l } = tr(t), [d, u] = ce.useState(!1), y = ce.useMemo(() => !s || s.length === 0 ? { criteriaValueInputs: [] } : {
|
|
3310
|
+
criteriaValueInputs: s.map((h) => ({
|
|
3311
|
+
riskCriteriaId: h.id,
|
|
3288
3312
|
values: [""]
|
|
3289
3313
|
// Initialize with empty string to prevent uncontrolled input warning
|
|
3290
3314
|
}))
|
|
3291
|
-
}, [s]),
|
|
3292
|
-
control:
|
|
3293
|
-
handleSubmit:
|
|
3294
|
-
formState: { errors:
|
|
3295
|
-
} =
|
|
3296
|
-
resolver:
|
|
3297
|
-
defaultValues:
|
|
3315
|
+
}, [s]), x = s && s.length > 0 ? br() : null, {
|
|
3316
|
+
control: g,
|
|
3317
|
+
handleSubmit: b,
|
|
3318
|
+
formState: { errors: m }
|
|
3319
|
+
} = Le({
|
|
3320
|
+
resolver: x ? Ge(x) : void 0,
|
|
3321
|
+
defaultValues: y
|
|
3298
3322
|
});
|
|
3299
|
-
|
|
3323
|
+
ce.useEffect(() => {
|
|
3300
3324
|
!a && s && s.length === 0 && !d && !i && (u(!0), l({ applicantId: t, criteriaValueInputs: [] }).then(() => e == null ? void 0 : e()).catch(console.error));
|
|
3301
3325
|
}, [a, s, d, i, l, t, e]);
|
|
3302
|
-
const
|
|
3326
|
+
const f = async (h) => {
|
|
3303
3327
|
if (s)
|
|
3304
3328
|
try {
|
|
3305
|
-
console.log("Risk scoring form submitted:",
|
|
3306
|
-
const E =
|
|
3307
|
-
const
|
|
3308
|
-
return
|
|
3309
|
-
riskCriteriaId: s[
|
|
3310
|
-
values:
|
|
3329
|
+
console.log("Risk scoring form submitted:", h), console.log("Criteria metadata:", s);
|
|
3330
|
+
const E = h.criteriaValueInputs.map((S, I) => {
|
|
3331
|
+
const P = S.values || [], C = Array.isArray(P) ? P.filter((A) => A && A.trim()) : P && P.toString().trim() ? [P.toString()] : [];
|
|
3332
|
+
return C.length === 0 ? null : {
|
|
3333
|
+
riskCriteriaId: s[I].id,
|
|
3334
|
+
values: C
|
|
3311
3335
|
};
|
|
3312
|
-
}).filter((
|
|
3336
|
+
}).filter((S) => S !== null);
|
|
3313
3337
|
console.log("Risk scoring criteriaValueInputs to submit:", E);
|
|
3314
|
-
const
|
|
3338
|
+
const v = {
|
|
3315
3339
|
applicantId: t,
|
|
3316
3340
|
criteriaValueInputs: E
|
|
3317
3341
|
};
|
|
3318
|
-
console.log("Final risk scoring input:",
|
|
3342
|
+
console.log("Final risk scoring input:", v), await l(v), console.log("Risk scoring submitted successfully!"), e == null || e();
|
|
3319
3343
|
} catch (E) {
|
|
3320
3344
|
throw console.error("Error submitting risk scoring:", E), E;
|
|
3321
3345
|
}
|
|
3322
|
-
},
|
|
3323
|
-
return a ? /* @__PURE__ */ n(
|
|
3324
|
-
/* @__PURE__ */ n(
|
|
3346
|
+
}, k = (h) => h.builtInType === 1 ? "country" : !h.defaultValues || h.defaultValues.length === 0 ? "text" : h.multipleValue ? "checkbox" : "radio";
|
|
3347
|
+
return a ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3348
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
3325
3349
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading risk scoring criteria..." })
|
|
3326
|
-
] }) }) : c ? /* @__PURE__ */ n(
|
|
3350
|
+
] }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3327
3351
|
"Error loading criteria: ",
|
|
3328
3352
|
c.message
|
|
3329
|
-
] }) }) }) : !a && s && s.length === 0 ? /* @__PURE__ */ n(
|
|
3330
|
-
/* @__PURE__ */ n(
|
|
3353
|
+
] }) }) }) : !a && s && s.length === 0 ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3354
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
3331
3355
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400", children: "No risk scoring criteria required. Moving to next step..." })
|
|
3332
|
-
] }) }) : s ? /* @__PURE__ */ n("form", { onSubmit:
|
|
3333
|
-
/* @__PURE__ */ o(
|
|
3356
|
+
] }) }) : s ? /* @__PURE__ */ n("form", { onSubmit: b(f), children: /* @__PURE__ */ o(L, { children: [
|
|
3357
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3334
3358
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Risk Assessment" }),
|
|
3335
3359
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please answer the following questions for risk evaluation" })
|
|
3336
3360
|
] }),
|
|
3337
|
-
/* @__PURE__ */ n(
|
|
3338
|
-
var
|
|
3339
|
-
const
|
|
3361
|
+
/* @__PURE__ */ n(T, { className: "space-y-8", children: s.map((h, E) => {
|
|
3362
|
+
var S, I, P;
|
|
3363
|
+
const v = k(h);
|
|
3340
3364
|
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3341
3365
|
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3342
|
-
|
|
3343
|
-
|
|
3366
|
+
h.displayName,
|
|
3367
|
+
h.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3344
3368
|
] }),
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3369
|
+
h.description && /* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: h.description }),
|
|
3370
|
+
v === "text" && /* @__PURE__ */ n(
|
|
3371
|
+
J,
|
|
3348
3372
|
{
|
|
3349
|
-
control:
|
|
3373
|
+
control: g,
|
|
3350
3374
|
name: `criteriaValueInputs.${E}.values.0`,
|
|
3351
|
-
render: ({ field:
|
|
3352
|
-
var
|
|
3375
|
+
render: ({ field: C }) => {
|
|
3376
|
+
var A, M, B;
|
|
3353
3377
|
return /* @__PURE__ */ n(
|
|
3354
|
-
|
|
3378
|
+
X,
|
|
3355
3379
|
{
|
|
3356
|
-
...
|
|
3357
|
-
value:
|
|
3358
|
-
type:
|
|
3380
|
+
...C,
|
|
3381
|
+
value: C.value || "",
|
|
3382
|
+
type: h.valueDataType === De.DigitOnly ? "number" : "text",
|
|
3359
3383
|
placeholder: "Enter your answer...",
|
|
3360
|
-
error: (
|
|
3361
|
-
onKeyDown: (
|
|
3362
|
-
|
|
3384
|
+
error: (B = (M = (A = m.criteriaValueInputs) == null ? void 0 : A[E]) == null ? void 0 : M.values) == null ? void 0 : B.message,
|
|
3385
|
+
onKeyDown: (Q) => {
|
|
3386
|
+
h.valueDataType === De.DigitOnly && ["e", "E", "+", "-", "."].includes(Q.key) && Q.preventDefault();
|
|
3363
3387
|
}
|
|
3364
3388
|
}
|
|
3365
3389
|
);
|
|
3366
3390
|
}
|
|
3367
3391
|
}
|
|
3368
3392
|
),
|
|
3369
|
-
|
|
3393
|
+
v === "radio" && h.defaultValues && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3370
3394
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Choose one option" }),
|
|
3371
3395
|
/* @__PURE__ */ n(
|
|
3372
|
-
|
|
3396
|
+
J,
|
|
3373
3397
|
{
|
|
3374
|
-
control:
|
|
3398
|
+
control: g,
|
|
3375
3399
|
name: `criteriaValueInputs.${E}.values.0`,
|
|
3376
|
-
render: ({ field: { value:
|
|
3400
|
+
render: ({ field: { value: C, onChange: A } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: h.defaultValues.map((M, B) => /* @__PURE__ */ o("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
3377
3401
|
/* @__PURE__ */ n(
|
|
3378
3402
|
"input",
|
|
3379
3403
|
{
|
|
3380
3404
|
type: "radio",
|
|
3381
|
-
checked:
|
|
3382
|
-
onChange: () =>
|
|
3405
|
+
checked: C === M,
|
|
3406
|
+
onChange: () => A(M),
|
|
3383
3407
|
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3384
3408
|
}
|
|
3385
3409
|
),
|
|
3386
|
-
/* @__PURE__ */ n("span", { className: "text-sm", children:
|
|
3387
|
-
] }, `${E}-${
|
|
3410
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: M })
|
|
3411
|
+
] }, `${E}-${B}`)) })
|
|
3388
3412
|
}
|
|
3389
3413
|
)
|
|
3390
3414
|
] }),
|
|
3391
|
-
|
|
3415
|
+
v === "checkbox" && h.defaultValues && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3392
3416
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Choose one or more options" }),
|
|
3393
3417
|
/* @__PURE__ */ n(
|
|
3394
|
-
|
|
3418
|
+
J,
|
|
3395
3419
|
{
|
|
3396
|
-
control:
|
|
3420
|
+
control: g,
|
|
3397
3421
|
name: `criteriaValueInputs.${E}.values`,
|
|
3398
|
-
render: ({ field: { value:
|
|
3422
|
+
render: ({ field: { value: C = [], onChange: A } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: h.defaultValues.map((M, B) => /* @__PURE__ */ o("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
3399
3423
|
/* @__PURE__ */ n(
|
|
3400
3424
|
"input",
|
|
3401
3425
|
{
|
|
3402
3426
|
type: "checkbox",
|
|
3403
|
-
checked: Array.isArray(
|
|
3404
|
-
onChange: (
|
|
3405
|
-
const
|
|
3406
|
-
|
|
3427
|
+
checked: Array.isArray(C) && C.includes(M),
|
|
3428
|
+
onChange: (Q) => {
|
|
3429
|
+
const _ = Array.isArray(C) ? C : [], p = Q.target.checked ? [..._, M] : _.filter((w) => w !== M);
|
|
3430
|
+
A(p);
|
|
3407
3431
|
},
|
|
3408
3432
|
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3409
3433
|
}
|
|
3410
3434
|
),
|
|
3411
|
-
/* @__PURE__ */ n("span", { className: "text-sm", children:
|
|
3412
|
-
] }, `${E}-${
|
|
3435
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: M })
|
|
3436
|
+
] }, `${E}-${B}`)) })
|
|
3413
3437
|
}
|
|
3414
3438
|
)
|
|
3415
3439
|
] }),
|
|
3416
|
-
|
|
3417
|
-
|
|
3440
|
+
v === "country" && /* @__PURE__ */ n(
|
|
3441
|
+
J,
|
|
3418
3442
|
{
|
|
3419
|
-
control:
|
|
3443
|
+
control: g,
|
|
3420
3444
|
name: `criteriaValueInputs.${E}.values.0`,
|
|
3421
|
-
render: ({ field:
|
|
3422
|
-
var
|
|
3445
|
+
render: ({ field: C }) => {
|
|
3446
|
+
var A, M, B;
|
|
3423
3447
|
return /* @__PURE__ */ n(
|
|
3424
|
-
|
|
3448
|
+
ye,
|
|
3425
3449
|
{
|
|
3426
|
-
...
|
|
3450
|
+
...C,
|
|
3427
3451
|
options: [
|
|
3428
3452
|
{ value: "US", label: "United States" },
|
|
3429
3453
|
{ value: "GB", label: "United Kingdom" },
|
|
@@ -3431,16 +3455,16 @@ const Vr = de.any(), vr = ({
|
|
|
3431
3455
|
// TODO: Load from base information service
|
|
3432
3456
|
],
|
|
3433
3457
|
placeholder: "Select a country...",
|
|
3434
|
-
error: (
|
|
3458
|
+
error: (B = (M = (A = m.criteriaValueInputs) == null ? void 0 : A[E]) == null ? void 0 : M.values) == null ? void 0 : B.message
|
|
3435
3459
|
}
|
|
3436
3460
|
);
|
|
3437
3461
|
}
|
|
3438
3462
|
}
|
|
3439
3463
|
),
|
|
3440
|
-
((
|
|
3441
|
-
] },
|
|
3464
|
+
((P = (I = (S = m.criteriaValueInputs) == null ? void 0 : S[E]) == null ? void 0 : I.values) == null ? void 0 : P.message) && /* @__PURE__ */ n("p", { className: "text-sm text-danger-500 mt-1", children: m.criteriaValueInputs[E].values.message })
|
|
3465
|
+
] }, h.id);
|
|
3442
3466
|
}) }),
|
|
3443
|
-
/* @__PURE__ */ o(
|
|
3467
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3444
3468
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3445
3469
|
/* @__PURE__ */ n(
|
|
3446
3470
|
j,
|
|
@@ -3448,7 +3472,7 @@ const Vr = de.any(), vr = ({
|
|
|
3448
3472
|
type: "submit",
|
|
3449
3473
|
isLoading: i,
|
|
3450
3474
|
onClick: () => {
|
|
3451
|
-
console.log("Risk scoring submit button clicked"), console.log("Form errors:",
|
|
3475
|
+
console.log("Risk scoring submit button clicked"), console.log("Form errors:", m);
|
|
3452
3476
|
},
|
|
3453
3477
|
children: "Continue"
|
|
3454
3478
|
}
|
|
@@ -3464,39 +3488,39 @@ const Vr = de.any(), vr = ({
|
|
|
3464
3488
|
onComplete: e,
|
|
3465
3489
|
onBack: r
|
|
3466
3490
|
}) => {
|
|
3467
|
-
const { investorCategorizationService: s } =
|
|
3468
|
-
return /* @__PURE__ */ n("form", { onSubmit: async (
|
|
3469
|
-
if (
|
|
3491
|
+
const { investorCategorizationService: s } = se(), [a, i] = N(null), [c, l] = N(!1), [d, u] = N(null);
|
|
3492
|
+
return /* @__PURE__ */ n("form", { onSubmit: async (x) => {
|
|
3493
|
+
if (x.preventDefault(), a === null) {
|
|
3470
3494
|
u("Please select an investor type");
|
|
3471
3495
|
return;
|
|
3472
3496
|
}
|
|
3473
3497
|
l(!0), u(null);
|
|
3474
3498
|
try {
|
|
3475
|
-
const
|
|
3499
|
+
const g = {
|
|
3476
3500
|
applicantId: t,
|
|
3477
3501
|
investorType: a
|
|
3478
3502
|
};
|
|
3479
|
-
console.log("Submitting investor categorization:",
|
|
3480
|
-
const
|
|
3481
|
-
console.log("Investor categorization result:",
|
|
3482
|
-
} catch (
|
|
3483
|
-
console.error("Error submitting investor categorization:",
|
|
3503
|
+
console.log("Submitting investor categorization:", g);
|
|
3504
|
+
const b = await s.setInvestorCategorization(g);
|
|
3505
|
+
console.log("Investor categorization result:", b), e == null || e();
|
|
3506
|
+
} catch (g) {
|
|
3507
|
+
console.error("Error submitting investor categorization:", g), u(g.message || "Failed to submit investor categorization");
|
|
3484
3508
|
} finally {
|
|
3485
3509
|
l(!1);
|
|
3486
3510
|
}
|
|
3487
|
-
}, children: /* @__PURE__ */ o(
|
|
3488
|
-
/* @__PURE__ */ o(
|
|
3511
|
+
}, children: /* @__PURE__ */ o(L, { children: [
|
|
3512
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3489
3513
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Which statement best describes you?" }),
|
|
3490
3514
|
/* @__PURE__ */ n("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" })
|
|
3491
3515
|
] }),
|
|
3492
|
-
/* @__PURE__ */ o(
|
|
3516
|
+
/* @__PURE__ */ o(T, { className: "space-y-4", children: [
|
|
3493
3517
|
/* @__PURE__ */ n("p", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-3", children: "Choose one" }),
|
|
3494
3518
|
/* @__PURE__ */ n(
|
|
3495
3519
|
"label",
|
|
3496
3520
|
{
|
|
3497
3521
|
className: `
|
|
3498
3522
|
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3499
|
-
${a ===
|
|
3523
|
+
${a === 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"}
|
|
3500
3524
|
`,
|
|
3501
3525
|
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3502
3526
|
/* @__PURE__ */ n(
|
|
@@ -3504,9 +3528,9 @@ const Vr = de.any(), vr = ({
|
|
|
3504
3528
|
{
|
|
3505
3529
|
type: "radio",
|
|
3506
3530
|
name: "investorType",
|
|
3507
|
-
value:
|
|
3508
|
-
checked: a ===
|
|
3509
|
-
onChange: () => i(
|
|
3531
|
+
value: re.Individual,
|
|
3532
|
+
checked: a === re.Individual,
|
|
3533
|
+
onChange: () => i(re.Individual),
|
|
3510
3534
|
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3511
3535
|
}
|
|
3512
3536
|
),
|
|
@@ -3522,7 +3546,7 @@ const Vr = de.any(), vr = ({
|
|
|
3522
3546
|
{
|
|
3523
3547
|
className: `
|
|
3524
3548
|
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3525
|
-
${a ===
|
|
3549
|
+
${a === 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"}
|
|
3526
3550
|
`,
|
|
3527
3551
|
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3528
3552
|
/* @__PURE__ */ n(
|
|
@@ -3530,9 +3554,9 @@ const Vr = de.any(), vr = ({
|
|
|
3530
3554
|
{
|
|
3531
3555
|
type: "radio",
|
|
3532
3556
|
name: "investorType",
|
|
3533
|
-
value:
|
|
3534
|
-
checked: a ===
|
|
3535
|
-
onChange: () => i(
|
|
3557
|
+
value: re.Sophisticated,
|
|
3558
|
+
checked: a === re.Sophisticated,
|
|
3559
|
+
onChange: () => i(re.Sophisticated),
|
|
3536
3560
|
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3537
3561
|
}
|
|
3538
3562
|
),
|
|
@@ -3553,7 +3577,7 @@ const Vr = de.any(), vr = ({
|
|
|
3553
3577
|
{
|
|
3554
3578
|
className: `
|
|
3555
3579
|
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3556
|
-
${a ===
|
|
3580
|
+
${a === 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"}
|
|
3557
3581
|
`,
|
|
3558
3582
|
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3559
3583
|
/* @__PURE__ */ n(
|
|
@@ -3561,9 +3585,9 @@ const Vr = de.any(), vr = ({
|
|
|
3561
3585
|
{
|
|
3562
3586
|
type: "radio",
|
|
3563
3587
|
name: "investorType",
|
|
3564
|
-
value:
|
|
3565
|
-
checked: a ===
|
|
3566
|
-
onChange: () => i(
|
|
3588
|
+
value: re.HighNetWorth,
|
|
3589
|
+
checked: a === re.HighNetWorth,
|
|
3590
|
+
onChange: () => i(re.HighNetWorth),
|
|
3567
3591
|
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3568
3592
|
}
|
|
3569
3593
|
),
|
|
@@ -3584,7 +3608,7 @@ const Vr = de.any(), vr = ({
|
|
|
3584
3608
|
d
|
|
3585
3609
|
] }) })
|
|
3586
3610
|
] }),
|
|
3587
|
-
/* @__PURE__ */ o(
|
|
3611
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3588
3612
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3589
3613
|
/* @__PURE__ */ n(
|
|
3590
3614
|
j,
|
|
@@ -3602,135 +3626,135 @@ const Vr = de.any(), vr = ({
|
|
|
3602
3626
|
onComplete: e,
|
|
3603
3627
|
onBack: r
|
|
3604
3628
|
}) => {
|
|
3605
|
-
const { appropriatenessTestService: s } =
|
|
3606
|
-
|
|
3629
|
+
const { appropriatenessTestService: s } = se(), [a, i] = N(null), [c, l] = N(!0), [d, u] = N(!1), [y, x] = N(null), [g, b] = N({}), [m, f] = N(0), [k, h] = N(!1), [E, v] = N(!1), [S, I] = N(0);
|
|
3630
|
+
Y(() => {
|
|
3607
3631
|
(async () => {
|
|
3608
3632
|
try {
|
|
3609
|
-
l(!0),
|
|
3610
|
-
const
|
|
3611
|
-
if (console.log("Appropriateness test data:",
|
|
3612
|
-
const
|
|
3613
|
-
|
|
3633
|
+
l(!0), x(null), console.log("Loading appropriateness test for applicant:", t);
|
|
3634
|
+
const w = await s.getAppropriatenessTest(t);
|
|
3635
|
+
if (console.log("Appropriateness test data:", w), i(w), w.waitTimeSpanForNextTry && w.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3636
|
+
const O = P(w.waitTimeSpanForNextTry);
|
|
3637
|
+
O > 0 && I(O);
|
|
3614
3638
|
}
|
|
3615
|
-
} catch (
|
|
3616
|
-
console.error("Error loading appropriateness test:",
|
|
3639
|
+
} catch (w) {
|
|
3640
|
+
console.error("Error loading appropriateness test:", w), x(w.message || "Failed to load appropriateness test");
|
|
3617
3641
|
} finally {
|
|
3618
3642
|
l(!1);
|
|
3619
3643
|
}
|
|
3620
3644
|
})();
|
|
3621
3645
|
}, [t, s]);
|
|
3622
|
-
const
|
|
3623
|
-
const
|
|
3624
|
-
if (
|
|
3625
|
-
const [
|
|
3626
|
-
return
|
|
3646
|
+
const P = (p) => {
|
|
3647
|
+
const w = p.split(":").map(Number);
|
|
3648
|
+
if (w.length === 3) {
|
|
3649
|
+
const [O, z, R] = w;
|
|
3650
|
+
return O * 3600 + z * 60 + R;
|
|
3627
3651
|
}
|
|
3628
3652
|
return 0;
|
|
3629
|
-
},
|
|
3630
|
-
const
|
|
3631
|
-
return `${
|
|
3653
|
+
}, C = (p) => {
|
|
3654
|
+
const w = Math.floor(p / 60), O = p % 60;
|
|
3655
|
+
return `${w.toString().padStart(2, "0")}:${O.toString().padStart(2, "0")}`;
|
|
3632
3656
|
};
|
|
3633
|
-
|
|
3634
|
-
if (!
|
|
3635
|
-
const
|
|
3636
|
-
|
|
3657
|
+
Y(() => {
|
|
3658
|
+
if (!k || m <= 0) return;
|
|
3659
|
+
const p = setInterval(() => {
|
|
3660
|
+
f((w) => w <= 1 ? (v(!0), 0) : w - 1);
|
|
3637
3661
|
}, 1e3);
|
|
3638
|
-
return () => clearInterval(
|
|
3639
|
-
}, [
|
|
3640
|
-
if (
|
|
3641
|
-
const
|
|
3642
|
-
|
|
3662
|
+
return () => clearInterval(p);
|
|
3663
|
+
}, [k, m]), Y(() => {
|
|
3664
|
+
if (S <= 0) return;
|
|
3665
|
+
const p = setInterval(() => {
|
|
3666
|
+
I((w) => w <= 1 ? 0 : w - 1);
|
|
3643
3667
|
}, 1e3);
|
|
3644
|
-
return () => clearInterval(
|
|
3645
|
-
}, [
|
|
3646
|
-
E && !d &&
|
|
3668
|
+
return () => clearInterval(p);
|
|
3669
|
+
}, [S]), Y(() => {
|
|
3670
|
+
E && !d && B();
|
|
3647
3671
|
}, [E]);
|
|
3648
|
-
const
|
|
3649
|
-
a && (
|
|
3650
|
-
},
|
|
3651
|
-
|
|
3652
|
-
...
|
|
3653
|
-
[
|
|
3672
|
+
const A = () => {
|
|
3673
|
+
a && (h(!0), f(a.testDurationSec));
|
|
3674
|
+
}, M = (p, w) => {
|
|
3675
|
+
b((O) => ({
|
|
3676
|
+
...O,
|
|
3677
|
+
[p]: w
|
|
3654
3678
|
}));
|
|
3655
|
-
},
|
|
3656
|
-
if (
|
|
3679
|
+
}, B = async (p) => {
|
|
3680
|
+
if (p && p.preventDefault(), !!a) {
|
|
3657
3681
|
if (!E) {
|
|
3658
|
-
const
|
|
3659
|
-
if (
|
|
3660
|
-
|
|
3682
|
+
const w = a.appropriatenessQuestions.length - Object.keys(g).length;
|
|
3683
|
+
if (w > 0) {
|
|
3684
|
+
x(`Please answer all questions. ${w} question(s) remaining.`);
|
|
3661
3685
|
return;
|
|
3662
3686
|
}
|
|
3663
3687
|
}
|
|
3664
|
-
u(!0),
|
|
3688
|
+
u(!0), x(null);
|
|
3665
3689
|
try {
|
|
3666
|
-
const
|
|
3667
|
-
(
|
|
3668
|
-
appropriatenessQuestionId:
|
|
3669
|
-
value:
|
|
3690
|
+
const w = a.appropriatenessQuestions.map(
|
|
3691
|
+
(z) => ({
|
|
3692
|
+
appropriatenessQuestionId: z.id,
|
|
3693
|
+
value: g[z.id] || ""
|
|
3670
3694
|
// Empty string if not answered
|
|
3671
3695
|
})
|
|
3672
|
-
),
|
|
3696
|
+
), O = {
|
|
3673
3697
|
applicantId: t,
|
|
3674
3698
|
appropriatenessTestId: a.id,
|
|
3675
|
-
appropriatenessQuestionResults:
|
|
3699
|
+
appropriatenessQuestionResults: w
|
|
3676
3700
|
};
|
|
3677
|
-
console.log("Submitting appropriateness test:",
|
|
3701
|
+
console.log("Submitting appropriateness test:", O);
|
|
3678
3702
|
try {
|
|
3679
|
-
const
|
|
3680
|
-
console.log("Appropriateness test result:",
|
|
3681
|
-
} catch (
|
|
3682
|
-
if (
|
|
3683
|
-
const
|
|
3684
|
-
console.log("Test failed:",
|
|
3703
|
+
const z = await s.fillAppropriatenessTest(O);
|
|
3704
|
+
console.log("Appropriateness test result:", z), z.message && (z.message.toLowerCase().includes("pass") || z.message.toLowerCase().includes("success") || z.message.toLowerCase().includes("congratulations")) ? e == null || e() : (x(z.message || "Test completed. Please check the result."), h(!1), v(!1), b({}), setTimeout(() => Q(), 1e3));
|
|
3705
|
+
} catch (z) {
|
|
3706
|
+
if (z.code === 400 && z.message) {
|
|
3707
|
+
const R = z.message;
|
|
3708
|
+
console.log("Test failed:", R), x(R), h(!1), v(!1), b({}), setTimeout(() => Q(), 1500);
|
|
3685
3709
|
} else
|
|
3686
|
-
throw
|
|
3710
|
+
throw z;
|
|
3687
3711
|
}
|
|
3688
|
-
} catch (
|
|
3689
|
-
console.error("Error submitting appropriateness test:",
|
|
3712
|
+
} catch (w) {
|
|
3713
|
+
console.error("Error submitting appropriateness test:", w), x(w.message || "Failed to submit test. Please try again."), h(!1), v(!1), b({});
|
|
3690
3714
|
} finally {
|
|
3691
3715
|
u(!1);
|
|
3692
3716
|
}
|
|
3693
3717
|
}
|
|
3694
|
-
},
|
|
3718
|
+
}, Q = async () => {
|
|
3695
3719
|
try {
|
|
3696
|
-
const
|
|
3697
|
-
if (console.log("Reloaded test data:",
|
|
3698
|
-
const
|
|
3699
|
-
|
|
3720
|
+
const p = await s.getAppropriatenessTest(t);
|
|
3721
|
+
if (console.log("Reloaded test data:", p), i(p), p.waitTimeSpanForNextTry && p.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3722
|
+
const w = P(p.waitTimeSpanForNextTry);
|
|
3723
|
+
w > 0 && I(w);
|
|
3700
3724
|
}
|
|
3701
|
-
} catch (
|
|
3702
|
-
console.error("Error reloading test data:",
|
|
3725
|
+
} catch (p) {
|
|
3726
|
+
console.error("Error reloading test data:", p), x((w) => w + `
|
|
3703
3727
|
|
|
3704
3728
|
Failed to reload test data. Please refresh the page.`);
|
|
3705
3729
|
}
|
|
3706
3730
|
};
|
|
3707
3731
|
if (c)
|
|
3708
|
-
return /* @__PURE__ */ n(
|
|
3709
|
-
/* @__PURE__ */ n(
|
|
3732
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3733
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
3710
3734
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading appropriateness test..." })
|
|
3711
3735
|
] }) });
|
|
3712
3736
|
if (!a)
|
|
3713
|
-
return /* @__PURE__ */ n(
|
|
3737
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3714
3738
|
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "No test data available" }),
|
|
3715
|
-
|
|
3739
|
+
y && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: y })
|
|
3716
3740
|
] }) });
|
|
3717
|
-
if (
|
|
3718
|
-
return /* @__PURE__ */ o(
|
|
3719
|
-
/* @__PURE__ */ o(
|
|
3741
|
+
if (S > 0)
|
|
3742
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
3743
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3720
3744
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a.displayName }),
|
|
3721
3745
|
a.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: a.subtitle })
|
|
3722
3746
|
] }),
|
|
3723
|
-
/* @__PURE__ */ o(
|
|
3747
|
+
/* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3724
3748
|
/* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
3725
|
-
/* @__PURE__ */ n("div", { className: "text-6xl font-bold text-primary-500 mb-2", children:
|
|
3749
|
+
/* @__PURE__ */ n("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: C(S) }),
|
|
3726
3750
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait before attempting the test again" })
|
|
3727
3751
|
] }),
|
|
3728
|
-
|
|
3752
|
+
y && /* @__PURE__ */ n("div", { className: "mt-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ n("p", { className: "text-red-600 dark:text-red-400 text-sm", children: y }) })
|
|
3729
3753
|
] })
|
|
3730
3754
|
] });
|
|
3731
|
-
const
|
|
3732
|
-
return
|
|
3733
|
-
/* @__PURE__ */ n(
|
|
3755
|
+
const _ = a.testAllowedMaxTry - a.totalFailedTries;
|
|
3756
|
+
return k ? /* @__PURE__ */ n("form", { onSubmit: B, children: /* @__PURE__ */ o(L, { children: [
|
|
3757
|
+
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
3734
3758
|
/* @__PURE__ */ o("div", { children: [
|
|
3735
3759
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a.displayName }),
|
|
3736
3760
|
a.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: a.subtitle })
|
|
@@ -3739,29 +3763,29 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3739
3763
|
/* @__PURE__ */ n(
|
|
3740
3764
|
"div",
|
|
3741
3765
|
{
|
|
3742
|
-
className: `text-3xl font-bold ${
|
|
3743
|
-
children:
|
|
3766
|
+
className: `text-3xl font-bold ${m <= 60 ? "text-danger-500" : "text-primary-500"}`,
|
|
3767
|
+
children: C(m)
|
|
3744
3768
|
}
|
|
3745
3769
|
),
|
|
3746
3770
|
/* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Time Remaining" })
|
|
3747
3771
|
] })
|
|
3748
3772
|
] }) }),
|
|
3749
|
-
/* @__PURE__ */ o(
|
|
3773
|
+
/* @__PURE__ */ o(T, { className: "space-y-6", children: [
|
|
3750
3774
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
|
|
3751
|
-
/* @__PURE__ */ o(
|
|
3775
|
+
/* @__PURE__ */ o(he, { variant: "info", children: [
|
|
3752
3776
|
"Question ",
|
|
3753
|
-
Object.keys(
|
|
3777
|
+
Object.keys(g).length,
|
|
3754
3778
|
" of ",
|
|
3755
3779
|
a.totalQuestionCount
|
|
3756
3780
|
] }),
|
|
3757
|
-
/* @__PURE__ */ o(
|
|
3758
|
-
|
|
3781
|
+
/* @__PURE__ */ o(he, { variant: _ > 1 ? "success" : "warning", children: [
|
|
3782
|
+
_,
|
|
3759
3783
|
" attempt",
|
|
3760
|
-
|
|
3784
|
+
_ !== 1 ? "s" : "",
|
|
3761
3785
|
" remaining"
|
|
3762
3786
|
] })
|
|
3763
3787
|
] }),
|
|
3764
|
-
a.appropriatenessQuestions.map((
|
|
3788
|
+
a.appropriatenessQuestions.map((p, w) => /* @__PURE__ */ o(
|
|
3765
3789
|
"div",
|
|
3766
3790
|
{
|
|
3767
3791
|
className: "p-4 border border-gray-200 dark:border-gray-700 rounded-lg",
|
|
@@ -3769,51 +3793,51 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3769
3793
|
/* @__PURE__ */ o("div", { className: "mb-4", children: [
|
|
3770
3794
|
/* @__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: [
|
|
3771
3795
|
"Question ",
|
|
3772
|
-
|
|
3796
|
+
w + 1
|
|
3773
3797
|
] }),
|
|
3774
|
-
|
|
3775
|
-
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children:
|
|
3798
|
+
p.groupName && /* @__PURE__ */ n("span", { className: "ml-2 text-xs text-gray-500 dark:text-gray-400", children: p.groupName }),
|
|
3799
|
+
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children: p.question })
|
|
3776
3800
|
] }),
|
|
3777
|
-
/* @__PURE__ */ n("div", { className: "space-y-2", children:
|
|
3801
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: p.answers.map((O, z) => /* @__PURE__ */ o(
|
|
3778
3802
|
"label",
|
|
3779
3803
|
{
|
|
3780
3804
|
className: `
|
|
3781
3805
|
flex items-center p-3 border-2 rounded-lg cursor-pointer transition-all
|
|
3782
|
-
${
|
|
3806
|
+
${g[p.id] === O ? "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"}
|
|
3783
3807
|
`,
|
|
3784
3808
|
children: [
|
|
3785
3809
|
/* @__PURE__ */ n(
|
|
3786
3810
|
"input",
|
|
3787
3811
|
{
|
|
3788
3812
|
type: "radio",
|
|
3789
|
-
name: `question-${
|
|
3790
|
-
value:
|
|
3791
|
-
checked:
|
|
3792
|
-
onChange: (
|
|
3813
|
+
name: `question-${p.id}`,
|
|
3814
|
+
value: O,
|
|
3815
|
+
checked: g[p.id] === O,
|
|
3816
|
+
onChange: (R) => M(p.id, R.target.value),
|
|
3793
3817
|
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500",
|
|
3794
3818
|
disabled: d
|
|
3795
3819
|
}
|
|
3796
3820
|
),
|
|
3797
|
-
/* @__PURE__ */ n("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children:
|
|
3821
|
+
/* @__PURE__ */ n("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children: O })
|
|
3798
3822
|
]
|
|
3799
3823
|
},
|
|
3800
|
-
|
|
3824
|
+
z
|
|
3801
3825
|
)) })
|
|
3802
3826
|
]
|
|
3803
3827
|
},
|
|
3804
|
-
|
|
3828
|
+
p.id
|
|
3805
3829
|
)),
|
|
3806
|
-
|
|
3830
|
+
y && !E && /* @__PURE__ */ n("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
|
|
3807
3831
|
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
3808
3832
|
" ",
|
|
3809
|
-
|
|
3833
|
+
y
|
|
3810
3834
|
] }) }),
|
|
3811
3835
|
E && /* @__PURE__ */ n("div", { className: "p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-yellow-700 dark:text-yellow-400 text-sm", children: [
|
|
3812
3836
|
/* @__PURE__ */ n("strong", { children: "Time's up!" }),
|
|
3813
3837
|
" Your answers are being submitted automatically."
|
|
3814
3838
|
] }) })
|
|
3815
3839
|
] }),
|
|
3816
|
-
/* @__PURE__ */ o(
|
|
3840
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3817
3841
|
/* @__PURE__ */ n(
|
|
3818
3842
|
j,
|
|
3819
3843
|
{
|
|
@@ -3829,51 +3853,51 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3829
3853
|
{
|
|
3830
3854
|
type: "submit",
|
|
3831
3855
|
isLoading: d,
|
|
3832
|
-
disabled: Object.keys(
|
|
3856
|
+
disabled: Object.keys(g).length < a.totalQuestionCount,
|
|
3833
3857
|
children: E ? "Submitting..." : "Submit Test"
|
|
3834
3858
|
}
|
|
3835
3859
|
)
|
|
3836
3860
|
] })
|
|
3837
|
-
] }) }) : /* @__PURE__ */ o(
|
|
3838
|
-
/* @__PURE__ */ o(
|
|
3861
|
+
] }) }) : /* @__PURE__ */ o(L, { children: [
|
|
3862
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
3839
3863
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: a.displayName }),
|
|
3840
3864
|
a.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: a.subtitle })
|
|
3841
3865
|
] }),
|
|
3842
|
-
/* @__PURE__ */ o(
|
|
3866
|
+
/* @__PURE__ */ o(T, { children: [
|
|
3843
3867
|
a.description && /* @__PURE__ */ n("div", { className: "mb-6 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg", children: /* @__PURE__ */ n("p", { className: "text-gray-700 dark:text-gray-300", children: a.description }) }),
|
|
3844
3868
|
/* @__PURE__ */ o("div", { className: "space-y-4 mb-6", children: [
|
|
3845
3869
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3846
3870
|
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Total Questions:" }),
|
|
3847
|
-
/* @__PURE__ */ n(
|
|
3871
|
+
/* @__PURE__ */ n(he, { variant: "info", children: a.totalQuestionCount })
|
|
3848
3872
|
] }),
|
|
3849
3873
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3850
3874
|
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Time Limit:" }),
|
|
3851
|
-
/* @__PURE__ */ n(
|
|
3875
|
+
/* @__PURE__ */ n(he, { variant: "info", children: C(a.testDurationSec) })
|
|
3852
3876
|
] }),
|
|
3853
3877
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3854
3878
|
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Correct Answers Required:" }),
|
|
3855
|
-
/* @__PURE__ */ n(
|
|
3879
|
+
/* @__PURE__ */ n(he, { variant: "info", children: a.testCorrectAnswerPassLimit })
|
|
3856
3880
|
] }),
|
|
3857
3881
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3858
3882
|
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Attempts Remaining:" }),
|
|
3859
|
-
/* @__PURE__ */ n(
|
|
3883
|
+
/* @__PURE__ */ n(he, { variant: _ > 1 ? "success" : "warning", children: _ })
|
|
3860
3884
|
] })
|
|
3861
3885
|
] }),
|
|
3862
|
-
|
|
3886
|
+
y && /* @__PURE__ */ n("div", { className: "mb-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
|
|
3863
3887
|
/* @__PURE__ */ n("strong", { children: "Previous Attempt:" }),
|
|
3864
3888
|
" ",
|
|
3865
|
-
|
|
3889
|
+
y
|
|
3866
3890
|
] }) }),
|
|
3867
|
-
|
|
3891
|
+
_ <= 0 && /* @__PURE__ */ n("div", { className: "p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ n("p", { className: "text-red-600 dark:text-red-400", children: "You have used all your attempts. Please contact support for assistance." }) })
|
|
3868
3892
|
] }),
|
|
3869
|
-
/* @__PURE__ */ o(
|
|
3893
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
3870
3894
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3871
3895
|
/* @__PURE__ */ n(
|
|
3872
3896
|
j,
|
|
3873
3897
|
{
|
|
3874
3898
|
type: "button",
|
|
3875
|
-
onClick:
|
|
3876
|
-
disabled:
|
|
3899
|
+
onClick: A,
|
|
3900
|
+
disabled: _ <= 0,
|
|
3877
3901
|
children: "Start Test"
|
|
3878
3902
|
}
|
|
3879
3903
|
)
|
|
@@ -3884,8 +3908,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3884
3908
|
onComplete: e,
|
|
3885
3909
|
onBack: r
|
|
3886
3910
|
}) => {
|
|
3887
|
-
var
|
|
3888
|
-
const { applicantService: s, baseInformationService: a, config: i } =
|
|
3911
|
+
var O, z, R, we;
|
|
3912
|
+
const { applicantService: s, baseInformationService: a, config: i } = se(), { identityData: c, provider: l, token: d, isLoading: u, error: y, requestIdentity: x, restartIdentity: g } = er(t), [b, m] = N(null), [f, k] = N(null), [h, E] = N([]), [v, S] = N(!0), [I, P] = N(!1), [C, A] = N(null), [M, B] = N(!1), Q = ce.useRef(!1), _ = Le({
|
|
3889
3913
|
defaultValues: {
|
|
3890
3914
|
street: "",
|
|
3891
3915
|
streetNumber: "",
|
|
@@ -3896,21 +3920,21 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3896
3920
|
phonenumber: ""
|
|
3897
3921
|
}
|
|
3898
3922
|
});
|
|
3899
|
-
|
|
3923
|
+
Y(() => {
|
|
3900
3924
|
(async () => {
|
|
3901
3925
|
try {
|
|
3902
|
-
const [D,
|
|
3926
|
+
const [D, G] = await Promise.all([
|
|
3903
3927
|
s.getApplicantData(t),
|
|
3904
3928
|
a.getCountries("", "en")
|
|
3905
3929
|
]);
|
|
3906
|
-
|
|
3907
|
-
const
|
|
3908
|
-
const
|
|
3909
|
-
return !
|
|
3930
|
+
k(D);
|
|
3931
|
+
const V = /* @__PURE__ */ new Set(), ae = G.filter((me) => {
|
|
3932
|
+
const Ae = me.abbreviation3 || me.abbreviation;
|
|
3933
|
+
return !Ae || V.has(Ae) ? !1 : (V.add(Ae), !0);
|
|
3910
3934
|
});
|
|
3911
|
-
E(
|
|
3935
|
+
E(ae);
|
|
3912
3936
|
const $ = D.applicantRequestData;
|
|
3913
|
-
if (
|
|
3937
|
+
if (_.reset({
|
|
3914
3938
|
street: ($ == null ? void 0 : $.street) || "",
|
|
3915
3939
|
streetNumber: ($ == null ? void 0 : $.streetNumber) || "",
|
|
3916
3940
|
city: ($ == null ? void 0 : $.city) || "",
|
|
@@ -3918,28 +3942,28 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3918
3942
|
country: ($ == null ? void 0 : $.country) || "",
|
|
3919
3943
|
nationality: ($ == null ? void 0 : $.nationality) || "",
|
|
3920
3944
|
phonenumber: ($ == null ? void 0 : $.phonenumber) || ""
|
|
3921
|
-
}), D.kycRecords && D.kycRecords.length > 0 && D.kycRecords[0].providerTokenObject !== null && !
|
|
3922
|
-
console.log("[Identity] Found existing identity verification, auto-requesting..."),
|
|
3945
|
+
}), D.kycRecords && D.kycRecords.length > 0 && D.kycRecords[0].providerTokenObject !== null && !Q.current) {
|
|
3946
|
+
console.log("[Identity] Found existing identity verification, auto-requesting..."), Q.current = !0;
|
|
3923
3947
|
try {
|
|
3924
|
-
await
|
|
3925
|
-
} catch (
|
|
3926
|
-
console.error("[Identity] Auto-request failed:",
|
|
3948
|
+
await x(), P(!0);
|
|
3949
|
+
} catch (me) {
|
|
3950
|
+
console.error("[Identity] Auto-request failed:", me);
|
|
3927
3951
|
}
|
|
3928
3952
|
}
|
|
3929
3953
|
} catch (D) {
|
|
3930
3954
|
console.error("Error loading applicant data:", D);
|
|
3931
3955
|
} finally {
|
|
3932
|
-
|
|
3956
|
+
S(!1);
|
|
3933
3957
|
}
|
|
3934
3958
|
})();
|
|
3935
|
-
}, [t]),
|
|
3936
|
-
c && !
|
|
3937
|
-
}, [c,
|
|
3959
|
+
}, [t]), Y(() => {
|
|
3960
|
+
c && !I && (console.log("[Identity] Identity data already loaded, showing provider"), P(!0));
|
|
3961
|
+
}, [c, I]), Y(() => {
|
|
3938
3962
|
if (d) {
|
|
3939
3963
|
if (d.expiresAt) {
|
|
3940
|
-
const
|
|
3941
|
-
if (Date.now() >=
|
|
3942
|
-
console.warn("[Identity] Token has expired (expiresAt)"),
|
|
3964
|
+
const F = new Date(d.expiresAt).getTime();
|
|
3965
|
+
if (Date.now() >= F) {
|
|
3966
|
+
console.warn("[Identity] Token has expired (expiresAt)"), B(!0), A("Your verification session has expired. Please restart.");
|
|
3943
3967
|
return;
|
|
3944
3968
|
}
|
|
3945
3969
|
}
|
|
@@ -3947,112 +3971,112 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
3947
3971
|
try {
|
|
3948
3972
|
const D = new URL(d.url).toString().toLowerCase();
|
|
3949
3973
|
if (D.includes("expired") || D.includes("invalid") || D.includes("error")) {
|
|
3950
|
-
console.warn("[Identity] Token URL indicates expiration"),
|
|
3974
|
+
console.warn("[Identity] Token URL indicates expiration"), B(!0), A("Your verification link has expired. Please restart.");
|
|
3951
3975
|
return;
|
|
3952
3976
|
}
|
|
3953
3977
|
} catch {
|
|
3954
3978
|
console.error("[Identity] Invalid token URL");
|
|
3955
3979
|
}
|
|
3956
3980
|
if (d.status === "expired" || d.error === "expired" || d.expired === !0) {
|
|
3957
|
-
console.warn("[Identity] Token object indicates expiration"),
|
|
3981
|
+
console.warn("[Identity] Token object indicates expiration"), B(!0), A("Your verification session has expired. Please restart.");
|
|
3958
3982
|
return;
|
|
3959
3983
|
}
|
|
3960
3984
|
}
|
|
3961
|
-
}, [d]),
|
|
3962
|
-
if (l !== null && d && !
|
|
3963
|
-
const
|
|
3985
|
+
}, [d]), Y(() => {
|
|
3986
|
+
if (l !== null && d && !b && I && !M) {
|
|
3987
|
+
const F = l;
|
|
3964
3988
|
if (d.url) {
|
|
3965
|
-
console.log("[Identity] Loading provider URL for user verification:", d.url),
|
|
3989
|
+
console.log("[Identity] Loading provider URL for user verification:", d.url), A(null);
|
|
3966
3990
|
try {
|
|
3967
|
-
if (new URL(d.url),
|
|
3991
|
+
if (new URL(d.url), F === ie.SardinAI) {
|
|
3968
3992
|
console.log("[SardinAI] Initializing Risk SDK in background...");
|
|
3969
3993
|
try {
|
|
3970
|
-
const D =
|
|
3971
|
-
|
|
3994
|
+
const D = fe.parseProviderConfig(l, d, i);
|
|
3995
|
+
fe.createProvider(l, D).initialize().then(() => {
|
|
3972
3996
|
console.log("[SardinAI] Risk SDK initialized successfully in background");
|
|
3973
|
-
}).catch((
|
|
3974
|
-
console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):",
|
|
3997
|
+
}).catch((V) => {
|
|
3998
|
+
console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):", V);
|
|
3975
3999
|
});
|
|
3976
4000
|
} catch (D) {
|
|
3977
4001
|
console.warn("[SardinAI] Risk SDK setup failed (non-blocking):", D);
|
|
3978
4002
|
}
|
|
3979
4003
|
}
|
|
3980
|
-
|
|
4004
|
+
m({ type: "url", url: d.url });
|
|
3981
4005
|
} catch (D) {
|
|
3982
|
-
console.error("[Identity] Invalid URL:", D),
|
|
4006
|
+
console.error("[Identity] Invalid URL:", D), A("Invalid verification URL. Please restart."), B(!0);
|
|
3983
4007
|
}
|
|
3984
4008
|
return;
|
|
3985
4009
|
}
|
|
3986
|
-
if (
|
|
3987
|
-
console.log("[SardinAI] No URL provided - initializing Risk SDK only..."),
|
|
4010
|
+
if (F === ie.SardinAI) {
|
|
4011
|
+
console.log("[SardinAI] No URL provided - initializing Risk SDK only..."), A(null);
|
|
3988
4012
|
try {
|
|
3989
|
-
const D =
|
|
3990
|
-
|
|
3991
|
-
console.log("[SardinAI] Risk SDK initialized successfully"),
|
|
4013
|
+
const D = fe.parseProviderConfig(l, d, i), G = fe.createProvider(l, D);
|
|
4014
|
+
G.initialize().then(() => {
|
|
4015
|
+
console.log("[SardinAI] Risk SDK initialized successfully"), m(G), setTimeout(() => {
|
|
3992
4016
|
e == null || e();
|
|
3993
4017
|
}, 2e3);
|
|
3994
|
-
}).catch((
|
|
4018
|
+
}).catch((V) => {
|
|
3995
4019
|
var $;
|
|
3996
|
-
console.error("[SardinAI] Failed to initialize:",
|
|
3997
|
-
const
|
|
3998
|
-
|
|
4020
|
+
console.error("[SardinAI] Failed to initialize:", V);
|
|
4021
|
+
const ae = (($ = V.message) == null ? void 0 : $.toLowerCase()) || "";
|
|
4022
|
+
ae.includes("expired") || ae.includes("invalid") || ae.includes("401") || ae.includes("400") ? (B(!0), A("Session expired or invalid. Please restart verification.")) : A(`Failed to initialize: ${V.message}`);
|
|
3999
4023
|
});
|
|
4000
4024
|
} catch (D) {
|
|
4001
|
-
console.error("[SardinAI] Error creating provider:", D),
|
|
4025
|
+
console.error("[SardinAI] Error creating provider:", D), A(`Configuration error: ${D.message}`);
|
|
4002
4026
|
}
|
|
4003
4027
|
return;
|
|
4004
4028
|
}
|
|
4005
4029
|
try {
|
|
4006
|
-
|
|
4007
|
-
const D =
|
|
4008
|
-
|
|
4009
|
-
var
|
|
4010
|
-
console.error("[Sumsub] Initialization error:",
|
|
4011
|
-
}),
|
|
4030
|
+
A(null);
|
|
4031
|
+
const D = fe.parseProviderConfig(l, d, i), G = fe.createProvider(l, D);
|
|
4032
|
+
F === ie.Sumsub ? (G.initialize("identity-container").catch((V) => {
|
|
4033
|
+
var ae;
|
|
4034
|
+
console.error("[Sumsub] Initialization error:", V), A(`Failed to initialize: ${V.message}`), (ae = V.message) != null && ae.toLowerCase().includes("expired") && B(!0);
|
|
4035
|
+
}), G.onComplete && G.onComplete(() => {
|
|
4012
4036
|
e == null || e();
|
|
4013
|
-
})) :
|
|
4014
|
-
console.error("[Onfido] Initialization error:",
|
|
4015
|
-
}),
|
|
4037
|
+
})) : F === ie.Onfido && G.initialize("identity-container").catch((V) => {
|
|
4038
|
+
console.error("[Onfido] Initialization error:", V), A(`Failed to initialize: ${V.message}`);
|
|
4039
|
+
}), m(G);
|
|
4016
4040
|
} catch (D) {
|
|
4017
|
-
console.error("[Identity] Provider setup error:", D),
|
|
4041
|
+
console.error("[Identity] Provider setup error:", D), A(`Setup error: ${D.message}`);
|
|
4018
4042
|
}
|
|
4019
4043
|
}
|
|
4020
4044
|
return () => {
|
|
4021
|
-
if (
|
|
4045
|
+
if (b && b.destroy)
|
|
4022
4046
|
try {
|
|
4023
|
-
|
|
4024
|
-
} catch (
|
|
4025
|
-
console.error("[Identity] Error destroying provider:",
|
|
4047
|
+
b.destroy();
|
|
4048
|
+
} catch (F) {
|
|
4049
|
+
console.error("[Identity] Error destroying provider:", F);
|
|
4026
4050
|
}
|
|
4027
4051
|
};
|
|
4028
|
-
}, [l, d,
|
|
4029
|
-
const
|
|
4052
|
+
}, [l, d, b, I, e, M]);
|
|
4053
|
+
const p = async () => {
|
|
4030
4054
|
try {
|
|
4031
|
-
|
|
4032
|
-
} catch (
|
|
4033
|
-
console.error("Error starting identity verification:",
|
|
4055
|
+
A(null), B(!1), await x(), P(!0);
|
|
4056
|
+
} catch (F) {
|
|
4057
|
+
console.error("Error starting identity verification:", F);
|
|
4034
4058
|
}
|
|
4035
|
-
},
|
|
4059
|
+
}, w = async () => {
|
|
4036
4060
|
try {
|
|
4037
|
-
|
|
4038
|
-
} catch (
|
|
4039
|
-
console.error("Error restarting identity verification:",
|
|
4061
|
+
A(null), B(!1), m(null), console.log("[Identity] Restarting verification..."), await g(), P(!0);
|
|
4062
|
+
} catch (F) {
|
|
4063
|
+
console.error("Error restarting identity verification:", F), A(F.message || "Failed to restart verification");
|
|
4040
4064
|
}
|
|
4041
4065
|
};
|
|
4042
|
-
if (
|
|
4043
|
-
return /* @__PURE__ */ n(
|
|
4044
|
-
/* @__PURE__ */ n(
|
|
4066
|
+
if (v || u)
|
|
4067
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4068
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
4045
4069
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading identity verification..." })
|
|
4046
4070
|
] }) });
|
|
4047
|
-
if (
|
|
4048
|
-
return /* @__PURE__ */ n(
|
|
4071
|
+
if (y)
|
|
4072
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
4049
4073
|
"Error: ",
|
|
4050
|
-
|
|
4074
|
+
y.message
|
|
4051
4075
|
] }) }) });
|
|
4052
|
-
if (
|
|
4053
|
-
return /* @__PURE__ */ o(
|
|
4054
|
-
/* @__PURE__ */ n(
|
|
4055
|
-
/* @__PURE__ */ o(
|
|
4076
|
+
if (I && (C || M))
|
|
4077
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
4078
|
+
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
|
|
4079
|
+
/* @__PURE__ */ o(T, { children: [
|
|
4056
4080
|
/* @__PURE__ */ n("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: [
|
|
4057
4081
|
/* @__PURE__ */ n(
|
|
4058
4082
|
"svg",
|
|
@@ -4073,8 +4097,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4073
4097
|
}
|
|
4074
4098
|
),
|
|
4075
4099
|
/* @__PURE__ */ o("div", { children: [
|
|
4076
|
-
/* @__PURE__ */ n("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-1", children:
|
|
4077
|
-
/* @__PURE__ */ n("p", { className: "text-red-800 dark:text-red-200 text-sm", children:
|
|
4100
|
+
/* @__PURE__ */ n("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-1", children: M ? "Session Expired" : "Verification Error" }),
|
|
4101
|
+
/* @__PURE__ */ n("p", { className: "text-red-800 dark:text-red-200 text-sm", children: C || "Your verification session has expired and needs to be restarted." })
|
|
4078
4102
|
] })
|
|
4079
4103
|
] }) }),
|
|
4080
4104
|
/* @__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: [
|
|
@@ -4086,15 +4110,15 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4086
4110
|
] })
|
|
4087
4111
|
] })
|
|
4088
4112
|
] }),
|
|
4089
|
-
/* @__PURE__ */ o(
|
|
4113
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
4090
4114
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4091
|
-
/* @__PURE__ */ n(j, { type: "button", onClick:
|
|
4115
|
+
/* @__PURE__ */ n(j, { type: "button", onClick: w, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
|
|
4092
4116
|
] })
|
|
4093
4117
|
] });
|
|
4094
|
-
if (
|
|
4095
|
-
const
|
|
4096
|
-
return d != null && d.url ? /* @__PURE__ */ o(
|
|
4097
|
-
/* @__PURE__ */ n(
|
|
4118
|
+
if (I && c) {
|
|
4119
|
+
const F = l;
|
|
4120
|
+
return d != null && d.url ? /* @__PURE__ */ o(L, { children: [
|
|
4121
|
+
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
4098
4122
|
/* @__PURE__ */ o("div", { children: [
|
|
4099
4123
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
|
|
4100
4124
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
|
|
@@ -4105,13 +4129,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4105
4129
|
type: "button",
|
|
4106
4130
|
variant: "outline",
|
|
4107
4131
|
size: "sm",
|
|
4108
|
-
onClick:
|
|
4132
|
+
onClick: w,
|
|
4109
4133
|
disabled: u,
|
|
4110
4134
|
children: "Restart"
|
|
4111
4135
|
}
|
|
4112
4136
|
)
|
|
4113
4137
|
] }) }),
|
|
4114
|
-
/* @__PURE__ */ o(
|
|
4138
|
+
/* @__PURE__ */ o(T, { children: [
|
|
4115
4139
|
/* @__PURE__ */ n("div", { className: "mb-4 p-3 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-800 dark:text-yellow-200 text-sm", children: [
|
|
4116
4140
|
/* @__PURE__ */ n("strong", { children: "Important:" }),
|
|
4117
4141
|
' If you see an "expired" or "invalid link" message below, click the "Restart" button above to generate a new verification session.'
|
|
@@ -4124,13 +4148,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4124
4148
|
allow: "camera; microphone; geolocation",
|
|
4125
4149
|
title: "Identity Verification",
|
|
4126
4150
|
onLoad: (D) => {
|
|
4127
|
-
var
|
|
4151
|
+
var G, V, ae;
|
|
4128
4152
|
console.log("[Identity] Iframe loaded");
|
|
4129
4153
|
try {
|
|
4130
|
-
const $ = D.target,
|
|
4131
|
-
if (
|
|
4132
|
-
const
|
|
4133
|
-
(
|
|
4154
|
+
const $ = D.target, Ce = $.contentDocument || ((G = $.contentWindow) == null ? void 0 : G.document);
|
|
4155
|
+
if (Ce) {
|
|
4156
|
+
const me = ((ae = (V = Ce.body) == null ? void 0 : V.textContent) == null ? void 0 : ae.toLowerCase()) || "";
|
|
4157
|
+
(me.includes("expired") || me.includes("invalid") || me.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"), B(!0), A("Your verification link has expired."));
|
|
4134
4158
|
}
|
|
4135
4159
|
} catch {
|
|
4136
4160
|
console.log("[Identity] Cannot check iframe content (CORS)");
|
|
@@ -4139,66 +4163,66 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4139
4163
|
}
|
|
4140
4164
|
) })
|
|
4141
4165
|
] }),
|
|
4142
|
-
r && /* @__PURE__ */ n(
|
|
4143
|
-
] }) :
|
|
4144
|
-
/* @__PURE__ */ o(
|
|
4166
|
+
r && /* @__PURE__ */ n(ne, { children: /* @__PURE__ */ n(j, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4167
|
+
] }) : F === ie.SardinAI ? /* @__PURE__ */ o(L, { children: [
|
|
4168
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
4145
4169
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Device Risk Assessment" }),
|
|
4146
4170
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Analyzing device security and behavioral patterns..." })
|
|
4147
4171
|
] }),
|
|
4148
|
-
/* @__PURE__ */ n(
|
|
4149
|
-
/* @__PURE__ */ n(
|
|
4172
|
+
/* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-12", children: [
|
|
4173
|
+
/* @__PURE__ */ n(le, { className: "mb-4" }),
|
|
4150
4174
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait while we verify your device security" }),
|
|
4151
4175
|
/* @__PURE__ */ n("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" })
|
|
4152
4176
|
] }) })
|
|
4153
|
-
] }) : /* @__PURE__ */ o(
|
|
4154
|
-
/* @__PURE__ */ o(
|
|
4177
|
+
] }) : /* @__PURE__ */ o(L, { children: [
|
|
4178
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
4155
4179
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
|
|
4156
4180
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
|
|
4157
4181
|
] }),
|
|
4158
|
-
/* @__PURE__ */ n(
|
|
4159
|
-
r && /* @__PURE__ */ n(
|
|
4182
|
+
/* @__PURE__ */ n(T, { children: /* @__PURE__ */ n("div", { id: "identity-container", className: "min-h-[400px]" }) }),
|
|
4183
|
+
r && /* @__PURE__ */ n(ne, { children: /* @__PURE__ */ n(j, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4160
4184
|
] });
|
|
4161
4185
|
}
|
|
4162
|
-
return /* @__PURE__ */ n("form", { onSubmit:
|
|
4163
|
-
/* @__PURE__ */ o(
|
|
4186
|
+
return /* @__PURE__ */ n("form", { onSubmit: _.handleSubmit(p), children: /* @__PURE__ */ o(L, { children: [
|
|
4187
|
+
/* @__PURE__ */ o(ee, { children: [
|
|
4164
4188
|
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Review Your Information" }),
|
|
4165
4189
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please review and confirm your information before starting identity verification" })
|
|
4166
4190
|
] }),
|
|
4167
|
-
/* @__PURE__ */ o(
|
|
4191
|
+
/* @__PURE__ */ o(T, { className: "space-y-6", children: [
|
|
4168
4192
|
/* @__PURE__ */ o("div", { className: "space-y-4 pb-4 border-b border-gray-200 dark:border-gray-700", children: [
|
|
4169
4193
|
/* @__PURE__ */ o("div", { children: [
|
|
4170
4194
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
|
|
4171
4195
|
/* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
|
|
4172
|
-
(
|
|
4196
|
+
(O = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : O.firstName,
|
|
4173
4197
|
" ",
|
|
4174
|
-
(
|
|
4198
|
+
(z = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : z.lastName
|
|
4175
4199
|
] })
|
|
4176
4200
|
] }),
|
|
4177
4201
|
/* @__PURE__ */ o("div", { children: [
|
|
4178
4202
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Email" }),
|
|
4179
|
-
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: (
|
|
4203
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: (R = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : R.email })
|
|
4180
4204
|
] }),
|
|
4181
4205
|
/* @__PURE__ */ o("div", { children: [
|
|
4182
4206
|
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Date of Birth" }),
|
|
4183
|
-
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ((
|
|
4207
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ((we = f == null ? void 0 : f.applicantRequestData) == null ? void 0 : we.dateOfBirth) || "Not provided" })
|
|
4184
4208
|
] })
|
|
4185
4209
|
] }),
|
|
4186
4210
|
/* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
4187
4211
|
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold", children: "Address Information" }),
|
|
4188
4212
|
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4189
4213
|
/* @__PURE__ */ n(
|
|
4190
|
-
|
|
4214
|
+
J,
|
|
4191
4215
|
{
|
|
4192
|
-
control:
|
|
4216
|
+
control: _.control,
|
|
4193
4217
|
name: "country",
|
|
4194
|
-
render: ({ field:
|
|
4195
|
-
|
|
4218
|
+
render: ({ field: F }) => /* @__PURE__ */ n(
|
|
4219
|
+
ye,
|
|
4196
4220
|
{
|
|
4197
|
-
...
|
|
4221
|
+
...F,
|
|
4198
4222
|
label: "Country",
|
|
4199
4223
|
options: [
|
|
4200
4224
|
{ value: "", label: "Select country..." },
|
|
4201
|
-
...
|
|
4225
|
+
...h.map((D) => ({
|
|
4202
4226
|
value: D.abbreviation3 || D.abbreviation,
|
|
4203
4227
|
label: D.name
|
|
4204
4228
|
}))
|
|
@@ -4208,18 +4232,18 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4208
4232
|
}
|
|
4209
4233
|
),
|
|
4210
4234
|
/* @__PURE__ */ n(
|
|
4211
|
-
|
|
4235
|
+
J,
|
|
4212
4236
|
{
|
|
4213
|
-
control:
|
|
4237
|
+
control: _.control,
|
|
4214
4238
|
name: "nationality",
|
|
4215
|
-
render: ({ field:
|
|
4216
|
-
|
|
4239
|
+
render: ({ field: F }) => /* @__PURE__ */ n(
|
|
4240
|
+
ye,
|
|
4217
4241
|
{
|
|
4218
|
-
...
|
|
4242
|
+
...F,
|
|
4219
4243
|
label: "Nationality",
|
|
4220
4244
|
options: [
|
|
4221
4245
|
{ value: "", label: "Select nationality..." },
|
|
4222
|
-
...
|
|
4246
|
+
...h.map((D) => ({
|
|
4223
4247
|
value: D.abbreviation3 || D.abbreviation,
|
|
4224
4248
|
label: D.name
|
|
4225
4249
|
}))
|
|
@@ -4231,51 +4255,51 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4231
4255
|
] }),
|
|
4232
4256
|
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4233
4257
|
/* @__PURE__ */ n(
|
|
4234
|
-
|
|
4258
|
+
J,
|
|
4235
4259
|
{
|
|
4236
|
-
control:
|
|
4260
|
+
control: _.control,
|
|
4237
4261
|
name: "street",
|
|
4238
|
-
render: ({ field:
|
|
4262
|
+
render: ({ field: F }) => /* @__PURE__ */ n(X, { ...F, label: "Street" })
|
|
4239
4263
|
}
|
|
4240
4264
|
),
|
|
4241
4265
|
/* @__PURE__ */ n(
|
|
4242
|
-
|
|
4266
|
+
J,
|
|
4243
4267
|
{
|
|
4244
|
-
control:
|
|
4268
|
+
control: _.control,
|
|
4245
4269
|
name: "streetNumber",
|
|
4246
|
-
render: ({ field:
|
|
4270
|
+
render: ({ field: F }) => /* @__PURE__ */ n(X, { ...F, label: "Street Number" })
|
|
4247
4271
|
}
|
|
4248
4272
|
)
|
|
4249
4273
|
] }),
|
|
4250
4274
|
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4251
4275
|
/* @__PURE__ */ n(
|
|
4252
|
-
|
|
4276
|
+
J,
|
|
4253
4277
|
{
|
|
4254
|
-
control:
|
|
4278
|
+
control: _.control,
|
|
4255
4279
|
name: "city",
|
|
4256
|
-
render: ({ field:
|
|
4280
|
+
render: ({ field: F }) => /* @__PURE__ */ n(X, { ...F, label: "City" })
|
|
4257
4281
|
}
|
|
4258
4282
|
),
|
|
4259
4283
|
/* @__PURE__ */ n(
|
|
4260
|
-
|
|
4284
|
+
J,
|
|
4261
4285
|
{
|
|
4262
|
-
control:
|
|
4286
|
+
control: _.control,
|
|
4263
4287
|
name: "zip",
|
|
4264
|
-
render: ({ field:
|
|
4288
|
+
render: ({ field: F }) => /* @__PURE__ */ n(X, { ...F, label: "ZIP/Postal Code" })
|
|
4265
4289
|
}
|
|
4266
4290
|
)
|
|
4267
4291
|
] }),
|
|
4268
4292
|
/* @__PURE__ */ n(
|
|
4269
|
-
|
|
4293
|
+
J,
|
|
4270
4294
|
{
|
|
4271
|
-
control:
|
|
4295
|
+
control: _.control,
|
|
4272
4296
|
name: "phonenumber",
|
|
4273
|
-
render: ({ field:
|
|
4297
|
+
render: ({ field: F }) => /* @__PURE__ */ n(X, { ...F, label: "Phone Number", type: "tel" })
|
|
4274
4298
|
}
|
|
4275
4299
|
)
|
|
4276
4300
|
] })
|
|
4277
4301
|
] }),
|
|
4278
|
-
/* @__PURE__ */ o(
|
|
4302
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
4279
4303
|
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4280
4304
|
/* @__PURE__ */ n(j, { type: "submit", isLoading: u, children: "Confirm and Start Verification" })
|
|
4281
4305
|
] })
|
|
@@ -4288,63 +4312,63 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4288
4312
|
onContinue: a,
|
|
4289
4313
|
onContactSupport: i
|
|
4290
4314
|
}) => {
|
|
4291
|
-
const l = t ===
|
|
4315
|
+
const l = t === pe.Approved ? {
|
|
4292
4316
|
type: "success",
|
|
4293
4317
|
title: "Verification Approved",
|
|
4294
4318
|
icon: "✓",
|
|
4295
4319
|
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4296
4320
|
iconColor: "text-green-600 dark:text-green-400",
|
|
4297
4321
|
message: "Your identity verification has been successfully approved."
|
|
4298
|
-
} : t ===
|
|
4322
|
+
} : t === pe.Rejected ? {
|
|
4299
4323
|
type: "error",
|
|
4300
4324
|
title: "Verification Rejected",
|
|
4301
4325
|
icon: "✕",
|
|
4302
4326
|
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4303
4327
|
iconColor: "text-red-600 dark:text-red-400",
|
|
4304
4328
|
message: "Unfortunately, your identity verification was not approved."
|
|
4305
|
-
} : t ===
|
|
4329
|
+
} : t === pe.Pending || t === pe.InProgress ? {
|
|
4306
4330
|
type: "pending",
|
|
4307
4331
|
title: "Verification Pending",
|
|
4308
4332
|
icon: "⏱",
|
|
4309
4333
|
iconBg: "bg-blue-100 dark:bg-blue-900/30",
|
|
4310
4334
|
iconColor: "text-blue-600 dark:text-blue-400",
|
|
4311
4335
|
message: "Your identity verification is currently being processed."
|
|
4312
|
-
} : e ===
|
|
4336
|
+
} : e === ge.Approved ? {
|
|
4313
4337
|
type: "success",
|
|
4314
4338
|
title: "Application Approved",
|
|
4315
4339
|
icon: "✓",
|
|
4316
4340
|
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4317
4341
|
iconColor: "text-green-600 dark:text-green-400",
|
|
4318
4342
|
message: "Your application has been approved."
|
|
4319
|
-
} : e ===
|
|
4343
|
+
} : e === ge.Reject ? {
|
|
4320
4344
|
type: "error",
|
|
4321
4345
|
title: "Application Rejected",
|
|
4322
4346
|
icon: "✕",
|
|
4323
4347
|
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4324
4348
|
iconColor: "text-red-600 dark:text-red-400",
|
|
4325
4349
|
message: "Your application has been rejected."
|
|
4326
|
-
} : e ===
|
|
4350
|
+
} : e === ge.UnderReview || e === ge.AdminReview ? {
|
|
4327
4351
|
type: "pending",
|
|
4328
4352
|
title: "Under Review",
|
|
4329
4353
|
icon: "📋",
|
|
4330
4354
|
iconBg: "bg-yellow-100 dark:bg-yellow-900/30",
|
|
4331
4355
|
iconColor: "text-yellow-700 dark:text-yellow-400",
|
|
4332
4356
|
message: "Your application is currently under manual review."
|
|
4333
|
-
} : r ===
|
|
4357
|
+
} : r === Ne.Success ? {
|
|
4334
4358
|
type: "success",
|
|
4335
4359
|
title: "Process Complete",
|
|
4336
4360
|
icon: "✓",
|
|
4337
4361
|
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4338
4362
|
iconColor: "text-green-600 dark:text-green-400",
|
|
4339
4363
|
message: "Your verification process has been completed successfully."
|
|
4340
|
-
} : r ===
|
|
4364
|
+
} : r === Ne.Failed ? {
|
|
4341
4365
|
type: "error",
|
|
4342
4366
|
title: "Process Failed",
|
|
4343
4367
|
icon: "✕",
|
|
4344
4368
|
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4345
4369
|
iconColor: "text-red-600 dark:text-red-400",
|
|
4346
4370
|
message: "The verification process could not be completed."
|
|
4347
|
-
} : r ===
|
|
4371
|
+
} : r === Ne.AdminReview ? {
|
|
4348
4372
|
type: "pending",
|
|
4349
4373
|
title: "Admin Review Required",
|
|
4350
4374
|
icon: "📋",
|
|
@@ -4359,8 +4383,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4359
4383
|
iconColor: "text-blue-600 dark:text-blue-400",
|
|
4360
4384
|
message: "Your application is being reviewed."
|
|
4361
4385
|
};
|
|
4362
|
-
return /* @__PURE__ */ o(
|
|
4363
|
-
/* @__PURE__ */ o(
|
|
4386
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
4387
|
+
/* @__PURE__ */ o(T, { className: "py-12", children: [
|
|
4364
4388
|
/* @__PURE__ */ n("div", { className: "flex justify-center mb-6", children: /* @__PURE__ */ n(
|
|
4365
4389
|
"div",
|
|
4366
4390
|
{
|
|
@@ -4370,10 +4394,10 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4370
4394
|
) }),
|
|
4371
4395
|
/* @__PURE__ */ n("h2", { className: "text-3xl font-bold text-center text-gray-900 dark:text-white mb-4", children: l.title }),
|
|
4372
4396
|
/* @__PURE__ */ n("div", { className: "flex justify-center mb-6", children: /* @__PURE__ */ n(
|
|
4373
|
-
|
|
4397
|
+
he,
|
|
4374
4398
|
{
|
|
4375
4399
|
variant: l.type === "success" ? "success" : l.type === "error" ? "danger" : l.type === "pending" ? "warning" : "info",
|
|
4376
|
-
children: t != null ?
|
|
4400
|
+
children: t != null ? pe[t] : ge[e]
|
|
4377
4401
|
}
|
|
4378
4402
|
) }),
|
|
4379
4403
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mb-6 max-w-md mx-auto", children: s || l.message }),
|
|
@@ -4405,15 +4429,15 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4405
4429
|
/* @__PURE__ */ n("div", { className: "mt-6 pt-6 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ o("div", { className: "grid grid-cols-2 gap-4 text-sm", children: [
|
|
4406
4430
|
/* @__PURE__ */ o("div", { children: [
|
|
4407
4431
|
/* @__PURE__ */ n("span", { className: "text-gray-500 dark:text-gray-400", children: "KYC Status:" }),
|
|
4408
|
-
/* @__PURE__ */ n("div", { className: "font-medium text-gray-900 dark:text-white mt-1", children: t != null ?
|
|
4432
|
+
/* @__PURE__ */ n("div", { className: "font-medium text-gray-900 dark:text-white mt-1", children: t != null ? pe[t] : "Not Available" })
|
|
4409
4433
|
] }),
|
|
4410
4434
|
/* @__PURE__ */ o("div", { children: [
|
|
4411
4435
|
/* @__PURE__ */ n("span", { className: "text-gray-500 dark:text-gray-400", children: "Review Status:" }),
|
|
4412
|
-
/* @__PURE__ */ n("div", { className: "font-medium text-gray-900 dark:text-white mt-1", children:
|
|
4436
|
+
/* @__PURE__ */ n("div", { className: "font-medium text-gray-900 dark:text-white mt-1", children: ge[e] })
|
|
4413
4437
|
] })
|
|
4414
4438
|
] }) })
|
|
4415
4439
|
] }),
|
|
4416
|
-
/* @__PURE__ */ o(
|
|
4440
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-center gap-4", children: [
|
|
4417
4441
|
l.type === "success" && a && /* @__PURE__ */ n(j, { onClick: a, size: "lg", children: "Continue" }),
|
|
4418
4442
|
l.type === "error" && /* @__PURE__ */ o(nt, { children: [
|
|
4419
4443
|
i && /* @__PURE__ */ n(j, { variant: "outline", onClick: i, children: "Contact Support" }),
|
|
@@ -4442,7 +4466,7 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4442
4466
|
subtitle: e,
|
|
4443
4467
|
className: r = ""
|
|
4444
4468
|
}) => {
|
|
4445
|
-
const { currentTheme: s } =
|
|
4469
|
+
const { currentTheme: s } = se(), a = t || (s == null ? void 0 : s.title) || "KYC Verification";
|
|
4446
4470
|
return /* @__PURE__ */ o("div", { className: `metakyc-header ${r}`, children: [
|
|
4447
4471
|
(s == null ? void 0 : s.logo) && s.logo.visible && /* @__PURE__ */ n("div", { className: "mb-3", children: /* @__PURE__ */ n(Er, { config: s.logo }) }),
|
|
4448
4472
|
/* @__PURE__ */ o("div", { children: [
|
|
@@ -4456,21 +4480,21 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4456
4480
|
onSuccess: r,
|
|
4457
4481
|
onCancel: s
|
|
4458
4482
|
}) => {
|
|
4459
|
-
var
|
|
4460
|
-
const { config: a, baseInformationService: i } =
|
|
4461
|
-
if (!
|
|
4483
|
+
var B, Q, _;
|
|
4484
|
+
const { config: a, baseInformationService: i } = se(), { createApplicant: c, isLoading: l } = rr(), [d, u] = N([]), [y, x] = N(!0), [g, b] = N(!1), [m, f] = N(null), k = H(!1), h = H(!1), E = t || ((B = a.applicantForm) == null ? void 0 : B.workflowKey);
|
|
4485
|
+
if (!E)
|
|
4462
4486
|
throw new Error(
|
|
4463
4487
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
4464
4488
|
);
|
|
4465
|
-
const
|
|
4466
|
-
workflowKey:
|
|
4489
|
+
const v = e || ((Q = a.applicantForm) == null ? void 0 : Q.externalRefId) || "", S = ((_ = a.applicantForm) == null ? void 0 : _.visibleFields) || gt, [I, P] = N({
|
|
4490
|
+
workflowKey: E,
|
|
4467
4491
|
firstName: "",
|
|
4468
4492
|
lastName: "",
|
|
4469
4493
|
title: "",
|
|
4470
4494
|
email: "",
|
|
4471
4495
|
dateOfBirth: "",
|
|
4472
4496
|
phonenumber: "",
|
|
4473
|
-
externalRefId:
|
|
4497
|
+
externalRefId: v,
|
|
4474
4498
|
// Set from config or prop
|
|
4475
4499
|
mobileCountryCode: "",
|
|
4476
4500
|
street: "",
|
|
@@ -4489,170 +4513,174 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4489
4513
|
occupation: "",
|
|
4490
4514
|
taxNumber: ""
|
|
4491
4515
|
});
|
|
4492
|
-
|
|
4516
|
+
Y(() => {
|
|
4493
4517
|
(async () => {
|
|
4518
|
+
if (k.current || h.current) {
|
|
4519
|
+
console.log("[CreateApplicant] Countries already loading or loaded, skipping...");
|
|
4520
|
+
return;
|
|
4521
|
+
}
|
|
4522
|
+
k.current = !0, x(!0);
|
|
4494
4523
|
try {
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
console.error("Failed to load countries:", I);
|
|
4524
|
+
const w = await i.getCountries("", a.locale || "en"), O = /* @__PURE__ */ new Set(), z = w.map((R) => ({
|
|
4525
|
+
value: R.abbreviation3 || R.abbreviation,
|
|
4526
|
+
label: R.name
|
|
4527
|
+
})).filter((R) => !R.value || O.has(R.value) ? !1 : (O.add(R.value), !0));
|
|
4528
|
+
u(z), h.current = !0;
|
|
4529
|
+
} catch (w) {
|
|
4530
|
+
console.error("Failed to load countries:", w);
|
|
4503
4531
|
} finally {
|
|
4504
|
-
|
|
4532
|
+
x(!1), k.current = !1;
|
|
4505
4533
|
}
|
|
4506
4534
|
})();
|
|
4507
|
-
}, [
|
|
4508
|
-
const
|
|
4509
|
-
|
|
4510
|
-
},
|
|
4511
|
-
|
|
4535
|
+
}, []);
|
|
4536
|
+
const C = (p, w) => {
|
|
4537
|
+
P((O) => ({ ...O, [p]: w }));
|
|
4538
|
+
}, A = async (p) => {
|
|
4539
|
+
p.preventDefault(), b(!0), f(null);
|
|
4512
4540
|
try {
|
|
4513
|
-
if (!
|
|
4514
|
-
|
|
4541
|
+
if (!I.externalRefId || I.externalRefId.trim() === "") {
|
|
4542
|
+
f("External Reference ID is required and cannot be empty"), b(!1);
|
|
4515
4543
|
return;
|
|
4516
4544
|
}
|
|
4517
|
-
const
|
|
4518
|
-
workflowKey:
|
|
4519
|
-
externalRefId:
|
|
4545
|
+
const w = {
|
|
4546
|
+
workflowKey: I.workflowKey,
|
|
4547
|
+
externalRefId: I.externalRefId.trim()
|
|
4520
4548
|
// Always include, never empty
|
|
4521
4549
|
};
|
|
4522
|
-
|
|
4523
|
-
if (
|
|
4524
|
-
const
|
|
4525
|
-
|
|
4526
|
-
}), console.log("Creating applicant with data:",
|
|
4527
|
-
const
|
|
4528
|
-
|
|
4550
|
+
S.forEach((z) => {
|
|
4551
|
+
if (z === "externalRefId") return;
|
|
4552
|
+
const R = I[z];
|
|
4553
|
+
R != null && R !== "" && !(Array.isArray(R) && R.length === 0) && (w[z] = R);
|
|
4554
|
+
}), console.log("Creating applicant with data:", w);
|
|
4555
|
+
const O = await c(
|
|
4556
|
+
w
|
|
4529
4557
|
);
|
|
4530
|
-
console.log("Applicant created:",
|
|
4531
|
-
} catch (
|
|
4532
|
-
console.error("Error creating applicant:",
|
|
4558
|
+
console.log("Applicant created:", O), r(O.applicantId);
|
|
4559
|
+
} catch (w) {
|
|
4560
|
+
console.error("Error creating applicant:", w), f(w.message || "Failed to create applicant");
|
|
4533
4561
|
} finally {
|
|
4534
|
-
|
|
4562
|
+
b(!1);
|
|
4535
4563
|
}
|
|
4536
|
-
},
|
|
4537
|
-
var
|
|
4538
|
-
const
|
|
4539
|
-
switch (
|
|
4564
|
+
}, M = (p) => {
|
|
4565
|
+
var O, z;
|
|
4566
|
+
const w = yt[p];
|
|
4567
|
+
switch (w.type) {
|
|
4540
4568
|
case "select":
|
|
4541
|
-
return
|
|
4542
|
-
|
|
4569
|
+
return p === "country" || p === "nationality" || p === "taxCountry" || p === "countryOfBirth" ? /* @__PURE__ */ n(
|
|
4570
|
+
ye,
|
|
4543
4571
|
{
|
|
4544
|
-
label:
|
|
4545
|
-
value:
|
|
4546
|
-
onChange: (
|
|
4572
|
+
label: w.label,
|
|
4573
|
+
value: I[p] || "",
|
|
4574
|
+
onChange: (R) => C(p, R.target.value),
|
|
4547
4575
|
options: [
|
|
4548
|
-
{ value: "", label: `Select ${
|
|
4576
|
+
{ value: "", label: `Select ${w.label.toLowerCase()}...` },
|
|
4549
4577
|
...d
|
|
4550
4578
|
],
|
|
4551
|
-
disabled:
|
|
4579
|
+
disabled: y
|
|
4552
4580
|
},
|
|
4553
|
-
|
|
4554
|
-
) :
|
|
4555
|
-
|
|
4581
|
+
p
|
|
4582
|
+
) : p === "salutation" ? /* @__PURE__ */ n(
|
|
4583
|
+
ye,
|
|
4556
4584
|
{
|
|
4557
|
-
label:
|
|
4558
|
-
value: ((
|
|
4559
|
-
onChange: (
|
|
4585
|
+
label: w.label,
|
|
4586
|
+
value: ((O = I[p]) == null ? void 0 : O.toString()) || "",
|
|
4587
|
+
onChange: (R) => C(p, R.target.value ? Number(R.target.value) : null),
|
|
4560
4588
|
options: [
|
|
4561
4589
|
{ value: "", label: "Select salutation..." },
|
|
4562
|
-
{ value:
|
|
4563
|
-
{ value:
|
|
4564
|
-
{ value:
|
|
4590
|
+
{ value: Se.Male.toString(), label: "Male" },
|
|
4591
|
+
{ value: Se.Female.toString(), label: "Female" },
|
|
4592
|
+
{ value: Se.Other.toString(), label: "Other" }
|
|
4565
4593
|
]
|
|
4566
4594
|
},
|
|
4567
|
-
|
|
4595
|
+
p
|
|
4568
4596
|
) : null;
|
|
4569
4597
|
case "multiselect":
|
|
4570
|
-
return
|
|
4571
|
-
|
|
4598
|
+
return p === "otherNationality" ? /* @__PURE__ */ n(
|
|
4599
|
+
X,
|
|
4572
4600
|
{
|
|
4573
4601
|
type: "text",
|
|
4574
|
-
label:
|
|
4575
|
-
value: ((
|
|
4576
|
-
onChange: (
|
|
4577
|
-
const
|
|
4578
|
-
|
|
4602
|
+
label: w.label,
|
|
4603
|
+
value: ((z = I[p]) == null ? void 0 : z.join(", ")) || "",
|
|
4604
|
+
onChange: (R) => {
|
|
4605
|
+
const we = R.target.value.split(",").map((F) => F.trim()).filter(Boolean);
|
|
4606
|
+
C(p, we);
|
|
4579
4607
|
},
|
|
4580
4608
|
placeholder: "Enter countries separated by commas"
|
|
4581
4609
|
},
|
|
4582
|
-
|
|
4610
|
+
p
|
|
4583
4611
|
) : null;
|
|
4584
4612
|
case "date":
|
|
4585
4613
|
return /* @__PURE__ */ n(
|
|
4586
|
-
|
|
4614
|
+
X,
|
|
4587
4615
|
{
|
|
4588
4616
|
type: "date",
|
|
4589
|
-
label:
|
|
4590
|
-
value:
|
|
4591
|
-
onChange: (
|
|
4617
|
+
label: w.label,
|
|
4618
|
+
value: I[p] || "",
|
|
4619
|
+
onChange: (R) => C(p, R.target.value)
|
|
4592
4620
|
},
|
|
4593
|
-
|
|
4621
|
+
p
|
|
4594
4622
|
);
|
|
4595
4623
|
case "email":
|
|
4596
4624
|
return /* @__PURE__ */ n(
|
|
4597
|
-
|
|
4625
|
+
X,
|
|
4598
4626
|
{
|
|
4599
4627
|
type: "email",
|
|
4600
|
-
label:
|
|
4601
|
-
value:
|
|
4602
|
-
onChange: (
|
|
4603
|
-
required:
|
|
4628
|
+
label: w.label,
|
|
4629
|
+
value: I[p] || "",
|
|
4630
|
+
onChange: (R) => C(p, R.target.value),
|
|
4631
|
+
required: p === "email"
|
|
4604
4632
|
},
|
|
4605
|
-
|
|
4633
|
+
p
|
|
4606
4634
|
);
|
|
4607
4635
|
case "tel":
|
|
4608
4636
|
return /* @__PURE__ */ n(
|
|
4609
|
-
|
|
4637
|
+
X,
|
|
4610
4638
|
{
|
|
4611
4639
|
type: "tel",
|
|
4612
|
-
label:
|
|
4613
|
-
value:
|
|
4614
|
-
onChange: (
|
|
4615
|
-
required:
|
|
4640
|
+
label: w.label,
|
|
4641
|
+
value: I[p] || "",
|
|
4642
|
+
onChange: (R) => C(p, R.target.value),
|
|
4643
|
+
required: p === "phonenumber"
|
|
4616
4644
|
},
|
|
4617
|
-
|
|
4645
|
+
p
|
|
4618
4646
|
);
|
|
4619
4647
|
case "text":
|
|
4620
4648
|
default:
|
|
4621
4649
|
return /* @__PURE__ */ n(
|
|
4622
|
-
|
|
4650
|
+
X,
|
|
4623
4651
|
{
|
|
4624
4652
|
type: "text",
|
|
4625
|
-
label:
|
|
4626
|
-
value:
|
|
4627
|
-
onChange: (
|
|
4628
|
-
required:
|
|
4653
|
+
label: w.label,
|
|
4654
|
+
value: I[p] || "",
|
|
4655
|
+
onChange: (R) => C(p, R.target.value),
|
|
4656
|
+
required: p === "firstName" || p === "lastName" || p === "externalRefId"
|
|
4629
4657
|
},
|
|
4630
|
-
|
|
4658
|
+
p
|
|
4631
4659
|
);
|
|
4632
4660
|
}
|
|
4633
4661
|
};
|
|
4634
|
-
return
|
|
4635
|
-
/* @__PURE__ */ n(
|
|
4662
|
+
return y ? /* @__PURE__ */ n("div", { className: "metakyc-sdk", children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4663
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
4636
4664
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading form..." })
|
|
4637
|
-
] }) }) }) : /* @__PURE__ */ n("div", { className: "metakyc-sdk", children: /* @__PURE__ */ n("form", { onSubmit:
|
|
4638
|
-
/* @__PURE__ */ n(
|
|
4665
|
+
] }) }) }) : /* @__PURE__ */ n("div", { className: "metakyc-sdk", children: /* @__PURE__ */ n("form", { onSubmit: A, children: /* @__PURE__ */ o(L, { children: [
|
|
4666
|
+
/* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(
|
|
4639
4667
|
Ze,
|
|
4640
4668
|
{
|
|
4641
4669
|
title: "Create Applicant",
|
|
4642
4670
|
subtitle: "Please fill in the required information to begin the KYC verification process."
|
|
4643
4671
|
}
|
|
4644
4672
|
) }),
|
|
4645
|
-
/* @__PURE__ */ o(
|
|
4646
|
-
|
|
4673
|
+
/* @__PURE__ */ o(T, { children: [
|
|
4674
|
+
m && /* @__PURE__ */ n("div", { className: "mb-6 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-red-600 dark:text-red-400 text-sm", children: [
|
|
4647
4675
|
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
4648
4676
|
" ",
|
|
4649
|
-
|
|
4677
|
+
m
|
|
4650
4678
|
] }) }),
|
|
4651
|
-
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
4679
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: S.map((p) => M(p)) })
|
|
4652
4680
|
] }),
|
|
4653
|
-
/* @__PURE__ */ o(
|
|
4654
|
-
s && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: s, disabled:
|
|
4655
|
-
/* @__PURE__ */ n(j, { type: "submit", isLoading:
|
|
4681
|
+
/* @__PURE__ */ o(ne, { className: "flex justify-between", children: [
|
|
4682
|
+
s && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: s, disabled: g || l, children: "Cancel" }),
|
|
4683
|
+
/* @__PURE__ */ n(j, { type: "submit", isLoading: g || l, children: "Create Applicant" })
|
|
4656
4684
|
] })
|
|
4657
4685
|
] }) }) });
|
|
4658
4686
|
}, Wr = ({
|
|
@@ -4668,32 +4696,32 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4668
4696
|
steps: l,
|
|
4669
4697
|
workflowKey: d,
|
|
4670
4698
|
nextWorkflowKey: u,
|
|
4671
|
-
hasWorkflowChanged:
|
|
4672
|
-
isLoading:
|
|
4673
|
-
error:
|
|
4674
|
-
moveBack:
|
|
4675
|
-
refreshProgress:
|
|
4676
|
-
} = Gt(t), [
|
|
4677
|
-
if (
|
|
4678
|
-
|
|
4679
|
-
}, [
|
|
4699
|
+
hasWorkflowChanged: y,
|
|
4700
|
+
isLoading: x,
|
|
4701
|
+
error: g,
|
|
4702
|
+
moveBack: b,
|
|
4703
|
+
refreshProgress: m
|
|
4704
|
+
} = Gt(t), [f, k] = ce.useState(!1);
|
|
4705
|
+
if (ce.useEffect(() => {
|
|
4706
|
+
g && r && r(g);
|
|
4707
|
+
}, [g, r]), ce.useEffect(() => {
|
|
4680
4708
|
i != null && i.workflowResult && e && e(i.workflowResult);
|
|
4681
|
-
}, [i == null ? void 0 : i.workflowResult, e]),
|
|
4709
|
+
}, [i == null ? void 0 : i.workflowResult, e]), ce.useEffect(() => {
|
|
4682
4710
|
s === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
4683
|
-
}, [s]),
|
|
4684
|
-
|
|
4685
|
-
}, [
|
|
4686
|
-
return /* @__PURE__ */ n("div", { className: a, children: /* @__PURE__ */ n(
|
|
4687
|
-
/* @__PURE__ */ n(
|
|
4711
|
+
}, [s]), ce.useEffect(() => {
|
|
4712
|
+
y && k(!1);
|
|
4713
|
+
}, [y]), x || !i)
|
|
4714
|
+
return /* @__PURE__ */ n("div", { className: a, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4715
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
4688
4716
|
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading workflow..." })
|
|
4689
4717
|
] }) }) });
|
|
4690
|
-
if (
|
|
4691
|
-
return /* @__PURE__ */ n("div", { className: a, children: /* @__PURE__ */ n(
|
|
4718
|
+
if (g)
|
|
4719
|
+
return /* @__PURE__ */ n("div", { className: a, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
4692
4720
|
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "An error occurred" }),
|
|
4693
|
-
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children:
|
|
4721
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: g.message })
|
|
4694
4722
|
] }) }) }) });
|
|
4695
|
-
if (
|
|
4696
|
-
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(
|
|
4723
|
+
if (y && !f)
|
|
4724
|
+
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
4697
4725
|
/* @__PURE__ */ n("div", { className: "mb-6", children: /* @__PURE__ */ n("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900 mb-4", children: /* @__PURE__ */ n("svg", { className: "w-8 h-8 text-blue-600 dark:text-blue-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) }) }),
|
|
4698
4726
|
/* @__PURE__ */ n("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white mb-2", children: "Workflow Transition" }),
|
|
4699
4727
|
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mb-6", children: "Your application workflow has been updated based on your progress." }),
|
|
@@ -4714,13 +4742,13 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4714
4742
|
/* @__PURE__ */ n(
|
|
4715
4743
|
"button",
|
|
4716
4744
|
{
|
|
4717
|
-
onClick: () =>
|
|
4745
|
+
onClick: () => k(!0),
|
|
4718
4746
|
className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",
|
|
4719
4747
|
children: "Continue with New Workflow"
|
|
4720
4748
|
}
|
|
4721
4749
|
)
|
|
4722
4750
|
] }) }) }) });
|
|
4723
|
-
if (i.status ===
|
|
4751
|
+
if (i.status === oe.Finished || i.status === oe.OnHold)
|
|
4724
4752
|
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(
|
|
4725
4753
|
$e,
|
|
4726
4754
|
{
|
|
@@ -4735,77 +4763,77 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4735
4763
|
}
|
|
4736
4764
|
) });
|
|
4737
4765
|
if (!c)
|
|
4738
|
-
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(
|
|
4739
|
-
/* @__PURE__ */ n(
|
|
4740
|
-
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: i.status ===
|
|
4766
|
+
return /* @__PURE__ */ n("div", { className: `metakyc-sdk ${a || ""}`, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4767
|
+
/* @__PURE__ */ n(le, { className: "my-8" }),
|
|
4768
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: i.status === oe.IdentityPending ? "Loading identity verification..." : "Loading current step..." })
|
|
4741
4769
|
] }) }) });
|
|
4742
|
-
const
|
|
4743
|
-
const
|
|
4770
|
+
const h = () => {
|
|
4771
|
+
const v = l.filter((C) => C.visibility !== !1), S = v.findIndex((C) => C.order === c.order), I = S >= 0 ? S + 1 : 1, P = v.length;
|
|
4744
4772
|
return /* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
4745
4773
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between mb-4", children: [
|
|
4746
4774
|
/* @__PURE__ */ n(Ze, {}),
|
|
4747
|
-
/* @__PURE__ */ o(
|
|
4775
|
+
/* @__PURE__ */ o(he, { variant: i.status === 1 ? "info" : "success", children: [
|
|
4748
4776
|
"Step ",
|
|
4749
|
-
|
|
4777
|
+
I,
|
|
4750
4778
|
" of ",
|
|
4751
|
-
|
|
4779
|
+
P
|
|
4752
4780
|
] })
|
|
4753
4781
|
] }),
|
|
4754
|
-
/* @__PURE__ */ n("div", { className: "flex items-center", children:
|
|
4755
|
-
const
|
|
4756
|
-
return /* @__PURE__ */ o(
|
|
4782
|
+
/* @__PURE__ */ n("div", { className: "flex items-center", children: v.map((C, A) => {
|
|
4783
|
+
const M = A < S, B = C.order === c.order;
|
|
4784
|
+
return /* @__PURE__ */ o(ce.Fragment, { children: [
|
|
4757
4785
|
/* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
4758
4786
|
/* @__PURE__ */ n(
|
|
4759
4787
|
"div",
|
|
4760
4788
|
{
|
|
4761
4789
|
className: `
|
|
4762
4790
|
w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium
|
|
4763
|
-
${
|
|
4791
|
+
${M || B ? "bg-primary-500 text-white" : "bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-400"}
|
|
4764
4792
|
`,
|
|
4765
|
-
children:
|
|
4793
|
+
children: A + 1
|
|
4766
4794
|
}
|
|
4767
4795
|
),
|
|
4768
4796
|
/* @__PURE__ */ n(
|
|
4769
4797
|
"span",
|
|
4770
4798
|
{
|
|
4771
|
-
className: `ml-2 text-sm ${
|
|
4772
|
-
children:
|
|
4799
|
+
className: `ml-2 text-sm ${B ? "font-semibold text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"}`,
|
|
4800
|
+
children: C.displayName
|
|
4773
4801
|
}
|
|
4774
4802
|
)
|
|
4775
4803
|
] }),
|
|
4776
|
-
|
|
4804
|
+
A < v.length - 1 && /* @__PURE__ */ n(
|
|
4777
4805
|
"div",
|
|
4778
4806
|
{
|
|
4779
|
-
className: `flex-1 h-0.5 mx-4 ${
|
|
4807
|
+
className: `flex-1 h-0.5 mx-4 ${M ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
|
|
4780
4808
|
}
|
|
4781
4809
|
)
|
|
4782
|
-
] },
|
|
4810
|
+
] }, C.order);
|
|
4783
4811
|
}) })
|
|
4784
4812
|
] });
|
|
4785
4813
|
}, E = () => {
|
|
4786
|
-
const
|
|
4814
|
+
const v = {
|
|
4787
4815
|
applicantId: t,
|
|
4788
4816
|
onComplete: async () => {
|
|
4789
|
-
await
|
|
4817
|
+
await m();
|
|
4790
4818
|
},
|
|
4791
|
-
onBack: c.order > 0 ?
|
|
4819
|
+
onBack: c.order > 0 ? b : void 0
|
|
4792
4820
|
};
|
|
4793
4821
|
switch (c.action) {
|
|
4794
4822
|
case U.Questionaries:
|
|
4795
|
-
return /* @__PURE__ */ n(vr, { ...
|
|
4823
|
+
return /* @__PURE__ */ n(vr, { ...v });
|
|
4796
4824
|
case U.UploadDocument:
|
|
4797
|
-
return /* @__PURE__ */ n(wr, { ...
|
|
4825
|
+
return /* @__PURE__ */ n(wr, { ...v });
|
|
4798
4826
|
case U.Overview:
|
|
4799
|
-
return /* @__PURE__ */ n(kr, { ...
|
|
4827
|
+
return /* @__PURE__ */ n(kr, { ...v });
|
|
4800
4828
|
case U.IdentitySdk:
|
|
4801
|
-
return /* @__PURE__ */ n(Ar, { ...
|
|
4829
|
+
return /* @__PURE__ */ n(Ar, { ...v });
|
|
4802
4830
|
case U.RiskScoring:
|
|
4803
|
-
return /* @__PURE__ */ n(Nr, { ...
|
|
4831
|
+
return /* @__PURE__ */ n(Nr, { ...v });
|
|
4804
4832
|
case U.AdditionalData:
|
|
4805
4833
|
case U.InvestorCategorization:
|
|
4806
|
-
return /* @__PURE__ */ n(Sr, { ...
|
|
4834
|
+
return /* @__PURE__ */ n(Sr, { ...v });
|
|
4807
4835
|
case U.AppropriatenessTest:
|
|
4808
|
-
return /* @__PURE__ */ n(Cr, { ...
|
|
4836
|
+
return /* @__PURE__ */ n(Cr, { ...v });
|
|
4809
4837
|
case U.ManualReview:
|
|
4810
4838
|
return /* @__PURE__ */ n(
|
|
4811
4839
|
$e,
|
|
@@ -4817,8 +4845,8 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4817
4845
|
}
|
|
4818
4846
|
);
|
|
4819
4847
|
default:
|
|
4820
|
-
return /* @__PURE__ */ n(
|
|
4821
|
-
/* @__PURE__ */ n("div", { className: "mb-4", children: /* @__PURE__ */ n(
|
|
4848
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
4849
|
+
/* @__PURE__ */ n("div", { className: "mb-4", children: /* @__PURE__ */ n(le, {}) }),
|
|
4822
4850
|
/* @__PURE__ */ o("p", { className: "text-gray-600 dark:text-gray-400 mb-2", children: [
|
|
4823
4851
|
"Processing step: ",
|
|
4824
4852
|
c.title || c.name
|
|
@@ -4831,55 +4859,55 @@ Failed to reload test data. Please refresh the page.`);
|
|
|
4831
4859
|
}
|
|
4832
4860
|
};
|
|
4833
4861
|
return /* @__PURE__ */ o("div", { className: `metakyc-sdk ${a || ""}`, children: [
|
|
4834
|
-
|
|
4862
|
+
h(),
|
|
4835
4863
|
E()
|
|
4836
4864
|
] });
|
|
4837
4865
|
};
|
|
4838
4866
|
export {
|
|
4839
4867
|
Tr as ALL_APPLICANT_FIELDS,
|
|
4840
4868
|
st as ApplicantProgressOnHoldReason,
|
|
4841
|
-
|
|
4869
|
+
oe as ApplicantProgressStatus,
|
|
4842
4870
|
vt as ApplicantService,
|
|
4843
4871
|
it as ApplicantStatus,
|
|
4844
4872
|
ut as AppropriatenessQuestionType,
|
|
4845
4873
|
Nt as AppropriatenessTestService,
|
|
4846
4874
|
Cr as AppropriatenessTestStep,
|
|
4847
|
-
|
|
4875
|
+
he as Badge,
|
|
4848
4876
|
Et as BaseInformationService,
|
|
4849
4877
|
j as Button,
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4878
|
+
L as Card,
|
|
4879
|
+
T as CardContent,
|
|
4880
|
+
ne as CardFooter,
|
|
4881
|
+
ee as CardHeader,
|
|
4854
4882
|
Yr as CreateApplicantForm,
|
|
4855
4883
|
ht as CriteriaBuiltInType,
|
|
4856
4884
|
gt as DEFAULT_VISIBLE_FIELDS,
|
|
4857
4885
|
dt as DocumentReviewStatus,
|
|
4858
4886
|
bt as EndpointBuilder,
|
|
4859
|
-
|
|
4887
|
+
xe as ErrorHandler,
|
|
4860
4888
|
Bt as EventEmitter,
|
|
4861
4889
|
yt as FIELD_METADATA,
|
|
4862
4890
|
ct as FileType,
|
|
4863
4891
|
nr as FileUpload,
|
|
4864
|
-
|
|
4892
|
+
Se as GenderType,
|
|
4865
4893
|
Ze as Header,
|
|
4866
4894
|
xt as HttpClient,
|
|
4867
|
-
|
|
4895
|
+
fe as IdentityProviderManager,
|
|
4868
4896
|
At as IdentityService,
|
|
4869
|
-
|
|
4897
|
+
ie as IdentityVerificationProvider,
|
|
4870
4898
|
Ar as IdentityVerificationStep,
|
|
4871
|
-
|
|
4899
|
+
X as Input,
|
|
4872
4900
|
It as InvestorCategorizationService,
|
|
4873
4901
|
Sr as InvestorCategorizationStep,
|
|
4874
|
-
|
|
4902
|
+
re as InvestorCategorizationType,
|
|
4875
4903
|
pt as InvestorCategoryType,
|
|
4876
4904
|
ot as KycProcessStatus,
|
|
4877
|
-
|
|
4905
|
+
pe as KycStatus,
|
|
4878
4906
|
$e as KycStatusDisplay,
|
|
4879
4907
|
Wr as KycWorkflow,
|
|
4880
4908
|
Er as Logo,
|
|
4881
4909
|
Ue as MetaKYCContext,
|
|
4882
|
-
|
|
4910
|
+
de as MetaKYCError,
|
|
4883
4911
|
Or as MetaKYCProvider,
|
|
4884
4912
|
_t as OnfidoProvider,
|
|
4885
4913
|
St as OverviewService,
|
|
@@ -4887,45 +4915,45 @@ export {
|
|
|
4887
4915
|
sr as PhoneInput,
|
|
4888
4916
|
wt as QuestionnaireService,
|
|
4889
4917
|
vr as QuestionnaireStep,
|
|
4890
|
-
|
|
4918
|
+
ge as ReviewStatus,
|
|
4891
4919
|
mt as RiskCriteriaType,
|
|
4892
4920
|
at as RiskLevel,
|
|
4893
4921
|
Ct as RiskScoringService,
|
|
4894
4922
|
Nr as RiskScoringStep,
|
|
4895
4923
|
Kt as SardinAIProvider,
|
|
4896
|
-
|
|
4897
|
-
|
|
4924
|
+
ye as Select,
|
|
4925
|
+
le as Spinner,
|
|
4898
4926
|
zt as StepRouter,
|
|
4899
4927
|
jt as SumsubProvider,
|
|
4900
4928
|
Ut as ThemeManager,
|
|
4901
|
-
|
|
4929
|
+
W as ThemePreset,
|
|
4902
4930
|
Mt as ThemeService,
|
|
4903
4931
|
kt as UploadDocumentService,
|
|
4904
4932
|
wr as UploadDocumentStep,
|
|
4905
4933
|
lt as UserType,
|
|
4906
|
-
|
|
4934
|
+
De as ValueDataType,
|
|
4907
4935
|
$t as WorkflowOrchestrator,
|
|
4908
|
-
|
|
4936
|
+
Ne as WorkflowResultType,
|
|
4909
4937
|
Ot as WorkflowState,
|
|
4910
4938
|
U as WorkflowStepAction,
|
|
4911
4939
|
Vr as appropriatenessTestSchema,
|
|
4912
4940
|
Kr as clearAllStorage,
|
|
4913
4941
|
Yt as clearApplicantId,
|
|
4914
4942
|
Qt as clearWorkflowState,
|
|
4915
|
-
|
|
4943
|
+
te as cn,
|
|
4916
4944
|
Rt as corporateTheme,
|
|
4917
4945
|
ft as defaultConfig,
|
|
4918
|
-
|
|
4946
|
+
Z as defaultTheme,
|
|
4919
4947
|
qt as fileToBase64,
|
|
4920
4948
|
Dt as fintechTheme,
|
|
4921
|
-
|
|
4949
|
+
Ie as formatFileSize,
|
|
4922
4950
|
Hr as generateAppropriatenessSchema,
|
|
4923
4951
|
yr as generateQuestionnaireSchema,
|
|
4924
4952
|
br as generateRiskScoringSchema,
|
|
4925
4953
|
qr as generateUploadDocumentSchema,
|
|
4926
4954
|
jr as getAcceptString,
|
|
4927
4955
|
Vt as getApplicantId,
|
|
4928
|
-
|
|
4956
|
+
ve as getThemePreset,
|
|
4929
4957
|
_r as getWorkflowState,
|
|
4930
4958
|
Pt as healthcareTheme,
|
|
4931
4959
|
Mr as isScriptLoaded,
|
|
@@ -4940,7 +4968,7 @@ export {
|
|
|
4940
4968
|
Ur as useAppropriatenessTest,
|
|
4941
4969
|
er as useIdentityVerification,
|
|
4942
4970
|
Gt as useKycWorkflow,
|
|
4943
|
-
|
|
4971
|
+
se as useMetaKYC,
|
|
4944
4972
|
Xt as useOverview,
|
|
4945
4973
|
Zt as useQuestionnaire,
|
|
4946
4974
|
tr as useRiskScoring,
|