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