@vpdev2/metakyc-sdk 1.0.0
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/README.md +104 -0
- package/dist/client/config.d.ts +84 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/endpoint-builder.d.ts +21 -0
- package/dist/client/endpoint-builder.d.ts.map +1 -0
- package/dist/client/error-handler.d.ts +36 -0
- package/dist/client/error-handler.d.ts.map +1 -0
- package/dist/client/http-client.d.ts +43 -0
- package/dist/client/http-client.d.ts.map +1 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/components/CreateApplicantForm.d.ts +16 -0
- package/dist/components/CreateApplicantForm.d.ts.map +1 -0
- package/dist/components/KycWorkflow.d.ts +17 -0
- package/dist/components/KycWorkflow.d.ts.map +1 -0
- package/dist/components/Logo.d.ts +13 -0
- package/dist/components/Logo.d.ts.map +1 -0
- package/dist/components/core/Badge.d.ts +11 -0
- package/dist/components/core/Badge.d.ts.map +1 -0
- package/dist/components/core/Button.d.ts +12 -0
- package/dist/components/core/Button.d.ts.map +1 -0
- package/dist/components/core/Card.d.ts +22 -0
- package/dist/components/core/Card.d.ts.map +1 -0
- package/dist/components/core/FileUpload.d.ts +17 -0
- package/dist/components/core/FileUpload.d.ts.map +1 -0
- package/dist/components/core/Input.d.ts +14 -0
- package/dist/components/core/Input.d.ts.map +1 -0
- package/dist/components/core/PhoneInput.d.ts +11 -0
- package/dist/components/core/PhoneInput.d.ts.map +1 -0
- package/dist/components/core/Select.d.ts +19 -0
- package/dist/components/core/Select.d.ts.map +1 -0
- package/dist/components/core/Spinner.d.ts +10 -0
- package/dist/components/core/Spinner.d.ts.map +1 -0
- package/dist/components/core/index.d.ts +9 -0
- package/dist/components/core/index.d.ts.map +1 -0
- package/dist/components/identity/IdentityVerificationStep.d.ts +13 -0
- package/dist/components/identity/IdentityVerificationStep.d.ts.map +1 -0
- package/dist/components/identity/index.d.ts +2 -0
- package/dist/components/identity/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/status/KycStatusDisplay.d.ts +17 -0
- package/dist/components/status/KycStatusDisplay.d.ts.map +1 -0
- package/dist/components/status/index.d.ts +2 -0
- package/dist/components/status/index.d.ts.map +1 -0
- package/dist/components/steps/AppropriatenessTestStep.d.ts +13 -0
- package/dist/components/steps/AppropriatenessTestStep.d.ts.map +1 -0
- package/dist/components/steps/InvestorCategorizationStep.d.ts +13 -0
- package/dist/components/steps/InvestorCategorizationStep.d.ts.map +1 -0
- package/dist/components/steps/OverviewStep.d.ts +12 -0
- package/dist/components/steps/OverviewStep.d.ts.map +1 -0
- package/dist/components/steps/QuestionnaireStep.d.ts +12 -0
- package/dist/components/steps/QuestionnaireStep.d.ts.map +1 -0
- package/dist/components/steps/RiskScoringStep.d.ts +13 -0
- package/dist/components/steps/RiskScoringStep.d.ts.map +1 -0
- package/dist/components/steps/UploadDocumentStep.d.ts +12 -0
- package/dist/components/steps/UploadDocumentStep.d.ts.map +1 -0
- package/dist/components/steps/index.d.ts +7 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/context/MetaKYCContext.d.ts +30 -0
- package/dist/context/MetaKYCContext.d.ts.map +1 -0
- package/dist/context/MetaKYCProvider.d.ts +16 -0
- package/dist/context/MetaKYCProvider.d.ts.map +1 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/useMetaKYC.d.ts +8 -0
- package/dist/context/useMetaKYC.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useApplicant.d.ts +14 -0
- package/dist/hooks/useApplicant.d.ts.map +1 -0
- package/dist/hooks/useAppropriatenessTest.d.ts +15 -0
- package/dist/hooks/useAppropriatenessTest.d.ts.map +1 -0
- package/dist/hooks/useIdentityVerification.d.ts +16 -0
- package/dist/hooks/useIdentityVerification.d.ts.map +1 -0
- package/dist/hooks/useKycWorkflow.d.ts +27 -0
- package/dist/hooks/useKycWorkflow.d.ts.map +1 -0
- package/dist/hooks/useOverview.d.ts +14 -0
- package/dist/hooks/useOverview.d.ts.map +1 -0
- package/dist/hooks/useQuestionnaire.d.ts +14 -0
- package/dist/hooks/useQuestionnaire.d.ts.map +1 -0
- package/dist/hooks/useRiskScoring.d.ts +15 -0
- package/dist/hooks/useRiskScoring.d.ts.map +1 -0
- package/dist/hooks/useUploadDocument.d.ts +15 -0
- package/dist/hooks/useUploadDocument.d.ts.map +1 -0
- package/dist/identity/index.d.ts +6 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/load-script.d.ts +13 -0
- package/dist/identity/load-script.d.ts.map +1 -0
- package/dist/identity/provider-manager.d.ts +20 -0
- package/dist/identity/provider-manager.d.ts.map +1 -0
- package/dist/identity/providers/onfido.d.ts +28 -0
- package/dist/identity/providers/onfido.d.ts.map +1 -0
- package/dist/identity/providers/sardin-ai.d.ts +56 -0
- package/dist/identity/providers/sardin-ai.d.ts.map +1 -0
- package/dist/identity/providers/sumsub.d.ts +36 -0
- package/dist/identity/providers/sumsub.d.ts.map +1 -0
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4882 -0
- package/dist/index.js.map +1 -0
- package/dist/services/applicant.service.d.ts +64 -0
- package/dist/services/applicant.service.d.ts.map +1 -0
- package/dist/services/appropriateness-test.service.d.ts +20 -0
- package/dist/services/appropriateness-test.service.d.ts.map +1 -0
- package/dist/services/base-information.service.d.ts +27 -0
- package/dist/services/base-information.service.d.ts.map +1 -0
- package/dist/services/identity.service.d.ts +30 -0
- package/dist/services/identity.service.d.ts.map +1 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/investor-categorization.service.d.ts +20 -0
- package/dist/services/investor-categorization.service.d.ts.map +1 -0
- package/dist/services/overview.service.d.ts +20 -0
- package/dist/services/overview.service.d.ts.map +1 -0
- package/dist/services/questionnaire.service.d.ts +20 -0
- package/dist/services/questionnaire.service.d.ts.map +1 -0
- package/dist/services/risk-scoring.service.d.ts +25 -0
- package/dist/services/risk-scoring.service.d.ts.map +1 -0
- package/dist/services/theme.service.d.ts +31 -0
- package/dist/services/theme.service.d.ts.map +1 -0
- package/dist/services/upload-document.service.d.ts +24 -0
- package/dist/services/upload-document.service.d.ts.map +1 -0
- package/dist/state/event-emitter.d.ts +27 -0
- package/dist/state/event-emitter.d.ts.map +1 -0
- package/dist/state/index.d.ts +5 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/step-router.d.ts +45 -0
- package/dist/state/step-router.d.ts.map +1 -0
- package/dist/state/workflow-orchestrator.d.ts +58 -0
- package/dist/state/workflow-orchestrator.d.ts.map +1 -0
- package/dist/state/workflow-state.d.ts +108 -0
- package/dist/state/workflow-state.d.ts.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/presets.d.ts +35 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/theme-manager.d.ts +57 -0
- package/dist/theme/theme-manager.d.ts.map +1 -0
- package/dist/types/applicant.d.ts +135 -0
- package/dist/types/applicant.d.ts.map +1 -0
- package/dist/types/appropriateness-test.d.ts +70 -0
- package/dist/types/appropriateness-test.d.ts.map +1 -0
- package/dist/types/common.d.ts +76 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/enums.d.ts +118 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/form-config.d.ts +18 -0
- package/dist/types/form-config.d.ts.map +1 -0
- package/dist/types/identity.d.ts +63 -0
- package/dist/types/identity.d.ts.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/investor-categorization.d.ts +34 -0
- package/dist/types/investor-categorization.d.ts.map +1 -0
- package/dist/types/overview.d.ts +26 -0
- package/dist/types/overview.d.ts.map +1 -0
- package/dist/types/questionnaire.d.ts +83 -0
- package/dist/types/questionnaire.d.ts.map +1 -0
- package/dist/types/risk-scoring.d.ts +104 -0
- package/dist/types/risk-scoring.d.ts.map +1 -0
- package/dist/types/theme.d.ts +110 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/upload-document.d.ts +77 -0
- package/dist/types/upload-document.d.ts.map +1 -0
- package/dist/types/workflow.d.ts +71 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +6 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/file.d.ts +21 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/storage.d.ts +43 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/validation/appropriateness-schema.d.ts +13 -0
- package/dist/validation/appropriateness-schema.d.ts.map +1 -0
- package/dist/validation/index.d.ts +5 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/questionnaire-schema.d.ts +17 -0
- package/dist/validation/questionnaire-schema.d.ts.map +1 -0
- package/dist/validation/risk-scoring-schema.d.ts +12 -0
- package/dist/validation/risk-scoring-schema.d.ts.map +1 -0
- package/dist/validation/upload-document-schema.d.ts +12 -0
- package/dist/validation/upload-document-schema.d.ts.map +1 -0
- package/package.json +87 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4882 @@
|
|
|
1
|
+
var Qe = Object.defineProperty;
|
|
2
|
+
var Ge = (t, e, r) => e in t ? Qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var U = (t, e, r) => Ge(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import Ze from "axios";
|
|
5
|
+
import * as Pe from "react";
|
|
6
|
+
import ce, { createContext as Je, useMemo as Oe, useEffect as V, useContext as Xe, useState as v, useRef as ze, useCallback as q, forwardRef as Re } from "react";
|
|
7
|
+
import { jsx as n, jsxs as o, Fragment as et } from "react/jsx-runtime";
|
|
8
|
+
import { get as Ae, set as Se, appendErrors as _e, useForm as De, Controller as Q } from "react-hook-form";
|
|
9
|
+
import { z as de } from "zod";
|
|
10
|
+
var K = /* @__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))(K || {}), ke = /* @__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))(ke || {}), ae = /* @__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))(ae || {}), tt = /* @__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))(tt || {}), rt = /* @__PURE__ */ ((t) => (t[t.LowRisk = 0] = "LowRisk", t[t.MediumRisk = 1] = "MediumRisk", t[t.HighRisk = 2] = "HighRisk", t[t.Alert = 3] = "Alert", t))(rt || {}), 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 || {}), nt = /* @__PURE__ */ ((t) => (t[t.ProviderResultPending = 0] = "ProviderResultPending", t[t.ProviderResultReceived = 1] = "ProviderResultReceived", t[t.Canceled = 2] = "Canceled", t[t.ExtendedToNewApplicant = 3] = "ExtendedToNewApplicant", t))(nt || {}), at = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.ProviderResultPending = 1] = "ProviderResultPending", t[t.ProviderResultReceived = 2] = "ProviderResultReceived", t[t.Canceled = 3] = "Canceled", t))(at || {}), ne = /* @__PURE__ */ ((t) => (t[t.Onfido = 0] = "Onfido", t[t.Sumsub = 2] = "Sumsub", t[t.SardinAI = 3] = "SardinAI", t))(ne || {}), st = /* @__PURE__ */ ((t) => (t[t.Individual = 0] = "Individual", t[t.Company = 1] = "Company", t))(st || {}), Ne = /* @__PURE__ */ ((t) => (t[t.Male = 0] = "Male", t[t.Female = 1] = "Female", t[t.Other = 2] = "Other", t))(Ne || {}), it = /* @__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))(it || {}), ot = /* @__PURE__ */ ((t) => (t[t.Pending = 0] = "Pending", t[t.Approved = 1] = "Approved", t[t.Rejected = 2] = "Rejected", t[t.RequiresRevision = 3] = "RequiresRevision", t))(ot || {}), lt = /* @__PURE__ */ ((t) => (t[t.SingleChoice = 0] = "SingleChoice", t[t.MultipleChoice = 1] = "MultipleChoice", t[t.Text = 2] = "Text", t))(lt || {}), Ee = /* @__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))(Ee || {}), ct = /* @__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))(ct || {}), dt = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Country = 1] = "Country", t))(dt || {}), X = /* @__PURE__ */ ((t) => (t[t.Individual = 0] = "Individual", t[t.Sophisticated = 1] = "Sophisticated", t[t.HighNetWorth = 2] = "HighNetWorth", t[t.Business = 3] = "Business", t))(X || {}), ut = /* @__PURE__ */ ((t) => (t[t.Retail = 0] = "Retail", t[t.Professional = 1] = "Professional", t[t.EligibleCounterparty = 2] = "EligibleCounterparty", t))(ut || {});
|
|
11
|
+
const mt = [
|
|
12
|
+
"firstName",
|
|
13
|
+
"lastName",
|
|
14
|
+
"email",
|
|
15
|
+
"phonenumber",
|
|
16
|
+
"dateOfBirth",
|
|
17
|
+
"street",
|
|
18
|
+
"streetNumber",
|
|
19
|
+
"zip",
|
|
20
|
+
"city",
|
|
21
|
+
"country",
|
|
22
|
+
"nationality",
|
|
23
|
+
"taxCountry",
|
|
24
|
+
"taxNumber"
|
|
25
|
+
], Dr = [
|
|
26
|
+
"firstName",
|
|
27
|
+
"lastName",
|
|
28
|
+
"title",
|
|
29
|
+
"email",
|
|
30
|
+
"dateOfBirth",
|
|
31
|
+
"phonenumber",
|
|
32
|
+
"mobileCountryCode",
|
|
33
|
+
"street",
|
|
34
|
+
"streetNumber",
|
|
35
|
+
"zip",
|
|
36
|
+
"city",
|
|
37
|
+
"country",
|
|
38
|
+
"nationality",
|
|
39
|
+
"otherNationality",
|
|
40
|
+
"defaultLanguage",
|
|
41
|
+
"taxCountry",
|
|
42
|
+
"placeOfBirth",
|
|
43
|
+
"countryOfBirth",
|
|
44
|
+
"salutation",
|
|
45
|
+
"educationLevel",
|
|
46
|
+
"occupation",
|
|
47
|
+
"taxNumber",
|
|
48
|
+
"externalRefId"
|
|
49
|
+
], ht = {
|
|
50
|
+
firstName: { label: "First Name", type: "text" },
|
|
51
|
+
lastName: { label: "Last Name", type: "text" },
|
|
52
|
+
title: { label: "Title", type: "text" },
|
|
53
|
+
email: { label: "Email", type: "email" },
|
|
54
|
+
dateOfBirth: { label: "Date of Birth", type: "date" },
|
|
55
|
+
phonenumber: { label: "Phone Number", type: "tel" },
|
|
56
|
+
mobileCountryCode: { label: "Mobile Country Code", type: "text" },
|
|
57
|
+
street: { label: "Street", type: "text" },
|
|
58
|
+
streetNumber: { label: "Street Number", type: "text" },
|
|
59
|
+
zip: { label: "ZIP/Postal Code", type: "text" },
|
|
60
|
+
city: { label: "City", type: "text" },
|
|
61
|
+
country: { label: "Country", type: "select" },
|
|
62
|
+
nationality: { label: "Nationality", type: "select" },
|
|
63
|
+
otherNationality: { label: "Other Nationalities", type: "multiselect" },
|
|
64
|
+
defaultLanguage: { label: "Default Language", type: "text" },
|
|
65
|
+
taxCountry: { label: "Tax Country", type: "select" },
|
|
66
|
+
placeOfBirth: { label: "Place of Birth", type: "text" },
|
|
67
|
+
countryOfBirth: { label: "Country of Birth", type: "select" },
|
|
68
|
+
salutation: { label: "Salutation", type: "select" },
|
|
69
|
+
educationLevel: { label: "Education Level", type: "text" },
|
|
70
|
+
occupation: { label: "Occupation", type: "text" },
|
|
71
|
+
taxNumber: { label: "Tax Number", type: "text" },
|
|
72
|
+
externalRefId: { label: "External Reference ID", type: "text" }
|
|
73
|
+
};
|
|
74
|
+
var Y = /* @__PURE__ */ ((t) => (t.Default = "default", t.Corporate = "corporate", t.Fintech = "fintech", t.Healthcare = "healthcare", t.Modern = "modern", t.Minimal = "minimal", t))(Y || {});
|
|
75
|
+
const pt = {
|
|
76
|
+
timeout: 3e4,
|
|
77
|
+
retries: 3,
|
|
78
|
+
locale: "en",
|
|
79
|
+
endpoints: {
|
|
80
|
+
pattern: "host-controller"
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
class gt {
|
|
84
|
+
constructor(e) {
|
|
85
|
+
this.config = e;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Build an endpoint URL
|
|
89
|
+
* @param controller - Controller name (e.g., 'Applicant')
|
|
90
|
+
* @param action - Action/method name (e.g., 'GetApplicantProgress')
|
|
91
|
+
* @returns The full endpoint path
|
|
92
|
+
*/
|
|
93
|
+
build(e, r) {
|
|
94
|
+
const a = `${e}.${r}`;
|
|
95
|
+
if (this.config.customPaths && this.config.customPaths[a])
|
|
96
|
+
return this.config.customPaths[a];
|
|
97
|
+
switch (this.config.pattern) {
|
|
98
|
+
case "host-controller":
|
|
99
|
+
return `/api/${e}/${r}`;
|
|
100
|
+
case "application-service":
|
|
101
|
+
return `/services/app/${this.getServiceName(e)}/${r}`;
|
|
102
|
+
case "custom":
|
|
103
|
+
throw new Error(
|
|
104
|
+
`Custom endpoint path not found for ${a}. Please provide it in customPaths.`
|
|
105
|
+
);
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unknown endpoint pattern: ${this.config.pattern}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Convert controller name to service name for application-service pattern
|
|
112
|
+
*/
|
|
113
|
+
getServiceName(e) {
|
|
114
|
+
return {
|
|
115
|
+
Applicant: "MetaKYCVerification",
|
|
116
|
+
Questionnaire: "MetaKYCVerification",
|
|
117
|
+
UploadDocument: "MetaKYCVerification",
|
|
118
|
+
AppropriatenessTest: "MetaKYCVerification",
|
|
119
|
+
BaseInformation: "MetaKYCVerification"
|
|
120
|
+
}[e] || e;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
class le extends Error {
|
|
124
|
+
constructor(r, a, s, i, c) {
|
|
125
|
+
super(r);
|
|
126
|
+
U(this, "response");
|
|
127
|
+
this.code = a, this.details = s, this.validationErrors = i, this.name = "MetaKYCError", this.response = c, Object.setPrototypeOf(this, le.prototype);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
class xe {
|
|
131
|
+
/**
|
|
132
|
+
* Process an error from the API response
|
|
133
|
+
*/
|
|
134
|
+
static handleApiError(e) {
|
|
135
|
+
return new le(
|
|
136
|
+
e.message || "An unknown error occurred",
|
|
137
|
+
e.code,
|
|
138
|
+
e.details || void 0,
|
|
139
|
+
e.validationErrors || void 0
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Process an Axios error
|
|
144
|
+
*/
|
|
145
|
+
static handleAxiosError(e) {
|
|
146
|
+
if (e.response) {
|
|
147
|
+
const r = e.response.data;
|
|
148
|
+
return r && r.error ? new le(
|
|
149
|
+
r.error.message || "An unknown error occurred",
|
|
150
|
+
r.error.code,
|
|
151
|
+
r.error.details || void 0,
|
|
152
|
+
r.error.validationErrors || void 0,
|
|
153
|
+
e.response
|
|
154
|
+
) : r && r.result && r.result.message ? new le(
|
|
155
|
+
r.result.message,
|
|
156
|
+
e.response.status,
|
|
157
|
+
`HTTP ${e.response.status}: ${e.response.statusText}`,
|
|
158
|
+
void 0,
|
|
159
|
+
e.response
|
|
160
|
+
) : new le(
|
|
161
|
+
(r == null ? void 0 : r.message) || e.message || "Request failed",
|
|
162
|
+
e.response.status,
|
|
163
|
+
`HTTP ${e.response.status}: ${e.response.statusText}`,
|
|
164
|
+
void 0,
|
|
165
|
+
e.response
|
|
166
|
+
);
|
|
167
|
+
} else return e.request ? new le(
|
|
168
|
+
"No response from server",
|
|
169
|
+
0,
|
|
170
|
+
"The request was made but no response was received. Please check your network connection."
|
|
171
|
+
) : new le(e.message || "An unexpected error occurred", 0, e.toString());
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if an error is a MetaKYCError
|
|
175
|
+
*/
|
|
176
|
+
static isMetaKYCError(e) {
|
|
177
|
+
return e instanceof le;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
class yt {
|
|
181
|
+
constructor(e) {
|
|
182
|
+
U(this, "axiosInstance");
|
|
183
|
+
U(this, "endpointBuilder");
|
|
184
|
+
U(this, "config");
|
|
185
|
+
this.config = { ...pt, ...e }, this.endpointBuilder = new gt(this.config.endpoints), this.axiosInstance = Ze.create({
|
|
186
|
+
baseURL: this.config.baseUrl,
|
|
187
|
+
timeout: this.config.timeout,
|
|
188
|
+
headers: {
|
|
189
|
+
"Content-Type": "application/json"
|
|
190
|
+
}
|
|
191
|
+
}), this.axiosInstance.interceptors.request.use(
|
|
192
|
+
(r) => (r.headers["Abp-TenantId"] = this.config.tenantId.toString(), r.headers.ApiKey = this.config.apiKey, r.headers["X-API-KEY"] = this.config.apiKey, this.config.locale && (r.headers["Accept-Language"] = this.config.locale), r),
|
|
193
|
+
(r) => Promise.reject(r)
|
|
194
|
+
), this.axiosInstance.interceptors.response.use(
|
|
195
|
+
(r) => r,
|
|
196
|
+
async (r) => {
|
|
197
|
+
var s;
|
|
198
|
+
const a = r.config;
|
|
199
|
+
return ((s = r.response) == null ? void 0 : s.status) >= 500 && !a._retry && (a._retry = !0, a._retryCount = (a._retryCount || 0) + 1, a._retryCount < (this.config.retries || 3)) ? (await new Promise(
|
|
200
|
+
(i) => setTimeout(i, 1e3 * a._retryCount)
|
|
201
|
+
), this.axiosInstance(a)) : Promise.reject(r);
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Build endpoint URL
|
|
207
|
+
*/
|
|
208
|
+
buildEndpoint(e, r) {
|
|
209
|
+
return this.endpointBuilder.build(e, r);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Make a GET request
|
|
213
|
+
*/
|
|
214
|
+
async get(e, r, a) {
|
|
215
|
+
try {
|
|
216
|
+
const s = this.buildEndpoint(e, r), i = await this.axiosInstance.get(s, {
|
|
217
|
+
params: a
|
|
218
|
+
});
|
|
219
|
+
return this.handleResponse(i);
|
|
220
|
+
} catch (s) {
|
|
221
|
+
throw xe.handleAxiosError(s);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Make a POST request
|
|
226
|
+
*/
|
|
227
|
+
async post(e, r, a) {
|
|
228
|
+
try {
|
|
229
|
+
const s = this.buildEndpoint(e, r), i = await this.axiosInstance.post(s, a);
|
|
230
|
+
return this.handleResponse(i);
|
|
231
|
+
} catch (s) {
|
|
232
|
+
throw xe.handleAxiosError(s);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Make a PUT request
|
|
237
|
+
*/
|
|
238
|
+
async put(e, r, a) {
|
|
239
|
+
try {
|
|
240
|
+
const s = this.buildEndpoint(e, r), i = await this.axiosInstance.put(s, a);
|
|
241
|
+
return this.handleResponse(i);
|
|
242
|
+
} catch (s) {
|
|
243
|
+
throw xe.handleAxiosError(s);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Make a DELETE request
|
|
248
|
+
*/
|
|
249
|
+
async delete(e, r, a) {
|
|
250
|
+
try {
|
|
251
|
+
const s = this.buildEndpoint(e, r), i = await this.axiosInstance.delete(s, {
|
|
252
|
+
params: a
|
|
253
|
+
});
|
|
254
|
+
return this.handleResponse(i);
|
|
255
|
+
} catch (s) {
|
|
256
|
+
throw xe.handleAxiosError(s);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Handle API response
|
|
261
|
+
*/
|
|
262
|
+
handleResponse(e) {
|
|
263
|
+
const r = e.data;
|
|
264
|
+
if (!r.success && r.error)
|
|
265
|
+
throw xe.handleApiError(r.error);
|
|
266
|
+
return r;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get the underlying axios instance for advanced usage
|
|
270
|
+
*/
|
|
271
|
+
getAxiosInstance() {
|
|
272
|
+
return this.axiosInstance;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
class ft {
|
|
276
|
+
constructor(e) {
|
|
277
|
+
this.httpClient = e;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Create a new individual applicant
|
|
281
|
+
*/
|
|
282
|
+
async createApplicant(e) {
|
|
283
|
+
return (await this.httpClient.post(
|
|
284
|
+
"Applicant",
|
|
285
|
+
"ApplicantRegistrationRequest",
|
|
286
|
+
e
|
|
287
|
+
)).result;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Create a new company applicant
|
|
291
|
+
*/
|
|
292
|
+
async createCompanyApplicant(e) {
|
|
293
|
+
return (await this.httpClient.post(
|
|
294
|
+
"Applicant",
|
|
295
|
+
"ApplicantCompanyRegistrationRequest",
|
|
296
|
+
e
|
|
297
|
+
)).result;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Duplicate an existing applicant with a new workflow
|
|
301
|
+
*/
|
|
302
|
+
async duplicateApplicant(e) {
|
|
303
|
+
return (await this.httpClient.post(
|
|
304
|
+
"Applicant",
|
|
305
|
+
"DuplicateApplicantRegistrationRequest",
|
|
306
|
+
e
|
|
307
|
+
)).result;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get applicant progress
|
|
311
|
+
*/
|
|
312
|
+
async getProgress(e) {
|
|
313
|
+
return (await this.httpClient.get(
|
|
314
|
+
"Applicant",
|
|
315
|
+
"GetApplicantProgress",
|
|
316
|
+
{ applicantId: e }
|
|
317
|
+
)).result;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Get applicant progress status (simplified)
|
|
321
|
+
*/
|
|
322
|
+
async getProgressStatus(e) {
|
|
323
|
+
return (await this.httpClient.get(
|
|
324
|
+
"Applicant",
|
|
325
|
+
"GetApplicantProgressStaus",
|
|
326
|
+
// Note: typo in API endpoint name
|
|
327
|
+
{ applicantId: e }
|
|
328
|
+
)).result;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Get applicant data
|
|
332
|
+
*/
|
|
333
|
+
async getApplicantData(e) {
|
|
334
|
+
return (await this.httpClient.get(
|
|
335
|
+
"Applicant",
|
|
336
|
+
"GetApplicantData",
|
|
337
|
+
{ applicantId: e }
|
|
338
|
+
)).result;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Get applicant status
|
|
342
|
+
*/
|
|
343
|
+
async getApplicantStatus(e) {
|
|
344
|
+
return (await this.httpClient.get(
|
|
345
|
+
"Applicant",
|
|
346
|
+
"GetApplicantStatus",
|
|
347
|
+
{ applicantId: e }
|
|
348
|
+
)).result;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Stop applicant progress
|
|
352
|
+
*/
|
|
353
|
+
async stopProgress(e) {
|
|
354
|
+
await this.httpClient.get("Applicant", "StopProgress", { applicantId: e });
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Move back one step in the workflow
|
|
358
|
+
*/
|
|
359
|
+
async progressStepBack(e) {
|
|
360
|
+
await this.httpClient.get("Applicant", "ProgressStepBack", { applicantId: e });
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Set applicant language
|
|
364
|
+
*/
|
|
365
|
+
async setLanguage(e, r) {
|
|
366
|
+
await this.httpClient.post("Applicant", "SetApplicantLng", {
|
|
367
|
+
applicantId: e,
|
|
368
|
+
language: r
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Activate applicant
|
|
373
|
+
*/
|
|
374
|
+
async activateApplicant(e) {
|
|
375
|
+
await this.httpClient.get("Applicant", "ActivateApplicant", { applicantId: e });
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Delete applicant
|
|
379
|
+
*/
|
|
380
|
+
async deleteApplicant(e) {
|
|
381
|
+
await this.httpClient.delete("Applicant", "DeleteApplicant", { applicantId: e });
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Check if applicant exists by external reference ID
|
|
385
|
+
*/
|
|
386
|
+
async checkApplicantExists(e) {
|
|
387
|
+
return (await this.httpClient.get(
|
|
388
|
+
"Applicant",
|
|
389
|
+
"CheckApplicantIfExists",
|
|
390
|
+
{ externalRefId: e }
|
|
391
|
+
)).result;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
class bt {
|
|
395
|
+
constructor(e) {
|
|
396
|
+
this.httpClient = e;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Get questionnaire for an applicant
|
|
400
|
+
*/
|
|
401
|
+
async getQuestionnaire(e) {
|
|
402
|
+
return (await this.httpClient.get(
|
|
403
|
+
"Questionnaire",
|
|
404
|
+
"GetQuestionnaire",
|
|
405
|
+
{ applicantid: e }
|
|
406
|
+
// Note: lowercase 'id' in API
|
|
407
|
+
)).result;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Submit questionnaire answers
|
|
411
|
+
*/
|
|
412
|
+
async fillQuestionnaire(e) {
|
|
413
|
+
return (await this.httpClient.post(
|
|
414
|
+
"Applicant",
|
|
415
|
+
"FillQuestionnarie",
|
|
416
|
+
// Note: typo in API endpoint name
|
|
417
|
+
e
|
|
418
|
+
)).result;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
class xt {
|
|
422
|
+
constructor(e) {
|
|
423
|
+
this.httpClient = e;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Get upload document requirements for an applicant
|
|
427
|
+
*/
|
|
428
|
+
async getUploadDocument(e) {
|
|
429
|
+
return (await this.httpClient.get(
|
|
430
|
+
"UploadDocument",
|
|
431
|
+
"GetUploadDocument",
|
|
432
|
+
{ applicantid: e }
|
|
433
|
+
// Note: lowercase 'id' in API
|
|
434
|
+
)).result;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Submit uploaded documents
|
|
438
|
+
*/
|
|
439
|
+
async fillUploadDocument(e) {
|
|
440
|
+
await this.httpClient.post("Applicant", "FillUploadDocument", e);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Review uploaded documents (admin function)
|
|
444
|
+
*/
|
|
445
|
+
async reviewUploadDocument(e) {
|
|
446
|
+
await this.httpClient.post("UploadDocument", "ReviewUploadDocument", e);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
class vt {
|
|
450
|
+
constructor(e) {
|
|
451
|
+
this.httpClient = e;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Get appropriateness test for an applicant
|
|
455
|
+
*/
|
|
456
|
+
async getAppropriatenessTest(e) {
|
|
457
|
+
return (await this.httpClient.get(
|
|
458
|
+
"AppropriatenessTest",
|
|
459
|
+
"GetAppropriatenessTest",
|
|
460
|
+
{ applicantid: e }
|
|
461
|
+
// Note: lowercase 'id' in API
|
|
462
|
+
)).result;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Submit appropriateness test answers
|
|
466
|
+
*/
|
|
467
|
+
async fillAppropriatenessTest(e) {
|
|
468
|
+
return (await this.httpClient.post(
|
|
469
|
+
"Applicant",
|
|
470
|
+
"FillAppropriatenessTest",
|
|
471
|
+
e
|
|
472
|
+
)).result;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
class wt {
|
|
476
|
+
constructor(e) {
|
|
477
|
+
this.httpClient = e;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Get overview data for an applicant
|
|
481
|
+
*/
|
|
482
|
+
async getOverviewData(e) {
|
|
483
|
+
return (await this.httpClient.get(
|
|
484
|
+
"Applicant",
|
|
485
|
+
"GetOverviewData",
|
|
486
|
+
{ ApplicantId: e }
|
|
487
|
+
// Note: capital 'A' in API
|
|
488
|
+
)).result;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Pass the overview step
|
|
492
|
+
*/
|
|
493
|
+
async passOverview(e) {
|
|
494
|
+
await this.httpClient.get("Applicant", "PassOverview", { applicantId: e });
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
class kt {
|
|
498
|
+
constructor(e) {
|
|
499
|
+
this.httpClient = e;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Get risk scoring plan information
|
|
503
|
+
*/
|
|
504
|
+
async getRiskScoringPlan() {
|
|
505
|
+
return (await this.httpClient.get(
|
|
506
|
+
"Applicant",
|
|
507
|
+
"GetRiskScoringPlanInfo"
|
|
508
|
+
)).result;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Get risk criteria for scoring
|
|
512
|
+
* Note: Requires applicantId as query parameter
|
|
513
|
+
*/
|
|
514
|
+
async getRiskCriterias(e) {
|
|
515
|
+
return (await this.httpClient.get(
|
|
516
|
+
"Risk",
|
|
517
|
+
"GetCriterias",
|
|
518
|
+
{ applicantId: e }
|
|
519
|
+
)).result;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Submit risk scoring calculation
|
|
523
|
+
*/
|
|
524
|
+
async submitRiskScoring(e) {
|
|
525
|
+
return (await this.httpClient.post(
|
|
526
|
+
"Applicant",
|
|
527
|
+
"RiskScoringRequest",
|
|
528
|
+
e
|
|
529
|
+
)).result;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
class Nt {
|
|
533
|
+
constructor(e) {
|
|
534
|
+
this.httpClient = e;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Request identity verification for individual applicant
|
|
538
|
+
*/
|
|
539
|
+
async identityRequest(e) {
|
|
540
|
+
console.log("[IdentityService] Calling IdentityRequest with input:", e);
|
|
541
|
+
const r = await this.httpClient.post(
|
|
542
|
+
"Applicant",
|
|
543
|
+
"IdentityRequest",
|
|
544
|
+
e
|
|
545
|
+
);
|
|
546
|
+
return console.log("[IdentityService] IdentityRequest response:", r), r.result;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Request identity verification for company applicant
|
|
550
|
+
*/
|
|
551
|
+
async identityCompanyRequest(e) {
|
|
552
|
+
return (await this.httpClient.post(
|
|
553
|
+
"Applicant",
|
|
554
|
+
"IdentityCompanyRequest",
|
|
555
|
+
e
|
|
556
|
+
)).result;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Restart identity verification (individual)
|
|
560
|
+
* Uses IdentityRequest with restart flag
|
|
561
|
+
*/
|
|
562
|
+
async restartIdentityRequest(e) {
|
|
563
|
+
const r = {
|
|
564
|
+
applicantId: e,
|
|
565
|
+
restart: !0,
|
|
566
|
+
redirectUrl: "",
|
|
567
|
+
ttl: 604800
|
|
568
|
+
// 7 days
|
|
569
|
+
};
|
|
570
|
+
return console.log("[IdentityService] Restarting identity with restart=true:", r), this.identityRequest(r);
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Restart identity verification (company)
|
|
574
|
+
* Uses IdentityCompanyRequest with restart flag
|
|
575
|
+
*/
|
|
576
|
+
async restartIdentityCompanyRequest(e) {
|
|
577
|
+
const r = {
|
|
578
|
+
applicantId: e,
|
|
579
|
+
restart: !0,
|
|
580
|
+
redirectUrl: "",
|
|
581
|
+
ttl: 604800
|
|
582
|
+
// 7 days
|
|
583
|
+
};
|
|
584
|
+
return this.identityCompanyRequest(r);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
class St {
|
|
588
|
+
constructor(e) {
|
|
589
|
+
this.httpClient = e;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Get all countries
|
|
593
|
+
* @param filter - Optional filter string
|
|
594
|
+
* @param lng - Language code (e.g., 'en', 'de')
|
|
595
|
+
* @param type - Optional country type filter
|
|
596
|
+
*/
|
|
597
|
+
async getCountries(e, r, a) {
|
|
598
|
+
return (await this.httpClient.get(
|
|
599
|
+
"BaseInformation",
|
|
600
|
+
"GetAllCountries",
|
|
601
|
+
{ filter: e || "", lng: r || "en", type: a }
|
|
602
|
+
)).result;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Get all branches
|
|
606
|
+
*/
|
|
607
|
+
async getBranches() {
|
|
608
|
+
return (await this.httpClient.get(
|
|
609
|
+
"BaseInformation",
|
|
610
|
+
"GetBranches"
|
|
611
|
+
)).result;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Get all legal entities
|
|
615
|
+
*/
|
|
616
|
+
async getLegalEntities() {
|
|
617
|
+
return (await this.httpClient.get(
|
|
618
|
+
"BaseInformation",
|
|
619
|
+
"GetLegalEntities"
|
|
620
|
+
)).result;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
class Ct {
|
|
624
|
+
constructor(e) {
|
|
625
|
+
this.httpClient = e;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Set investor categorization
|
|
629
|
+
*/
|
|
630
|
+
async setInvestorCategorization(e) {
|
|
631
|
+
return (await this.httpClient.post(
|
|
632
|
+
"Applicant",
|
|
633
|
+
"SetInvestorCategorization",
|
|
634
|
+
e
|
|
635
|
+
)).result;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Get investor categorization
|
|
639
|
+
*/
|
|
640
|
+
async getInvestorCategorization(e) {
|
|
641
|
+
return (await this.httpClient.get(
|
|
642
|
+
"Applicant",
|
|
643
|
+
"GetInvestorCategorisation",
|
|
644
|
+
// Note: British spelling in API
|
|
645
|
+
{ applicantId: e }
|
|
646
|
+
)).result;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const ee = {
|
|
650
|
+
name: "Default",
|
|
651
|
+
logo: {
|
|
652
|
+
url: "",
|
|
653
|
+
height: "40px",
|
|
654
|
+
visible: !0
|
|
655
|
+
},
|
|
656
|
+
colors: {
|
|
657
|
+
primary: "#2563eb",
|
|
658
|
+
primaryHover: "#1d4ed8",
|
|
659
|
+
primaryLight: "#dbeafe",
|
|
660
|
+
primaryDark: "#1e40af",
|
|
661
|
+
secondary: "#64748b",
|
|
662
|
+
secondaryHover: "#475569",
|
|
663
|
+
success: "#10b981",
|
|
664
|
+
warning: "#f59e0b",
|
|
665
|
+
danger: "#ef4444",
|
|
666
|
+
info: "#3b82f6",
|
|
667
|
+
background: "#ffffff",
|
|
668
|
+
surface: "#f9fafb",
|
|
669
|
+
border: "#e5e7eb",
|
|
670
|
+
textPrimary: "#111827",
|
|
671
|
+
textSecondary: "#6b7280",
|
|
672
|
+
textMuted: "#9ca3af"
|
|
673
|
+
},
|
|
674
|
+
typography: {
|
|
675
|
+
fontFamily: "Inter, system-ui, -apple-system, sans-serif",
|
|
676
|
+
fontSize: {
|
|
677
|
+
xs: "0.75rem",
|
|
678
|
+
sm: "0.875rem",
|
|
679
|
+
base: "1rem",
|
|
680
|
+
lg: "1.125rem",
|
|
681
|
+
xl: "1.25rem",
|
|
682
|
+
"2xl": "1.5rem",
|
|
683
|
+
"3xl": "1.875rem"
|
|
684
|
+
},
|
|
685
|
+
fontWeight: {
|
|
686
|
+
normal: 400,
|
|
687
|
+
medium: 500,
|
|
688
|
+
semibold: 600,
|
|
689
|
+
bold: 700
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
spacing: {
|
|
693
|
+
borderRadius: "0.5rem",
|
|
694
|
+
cardPadding: "1.5rem",
|
|
695
|
+
inputHeight: "2.5rem"
|
|
696
|
+
},
|
|
697
|
+
darkMode: {
|
|
698
|
+
colors: {
|
|
699
|
+
background: "#111827",
|
|
700
|
+
surface: "#1f2937",
|
|
701
|
+
border: "#374151",
|
|
702
|
+
textPrimary: "#f9fafb",
|
|
703
|
+
textSecondary: "#d1d5db",
|
|
704
|
+
textMuted: "#9ca3af"
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}, At = {
|
|
708
|
+
name: "Corporate",
|
|
709
|
+
logo: {
|
|
710
|
+
url: "",
|
|
711
|
+
height: "40px",
|
|
712
|
+
visible: !0
|
|
713
|
+
},
|
|
714
|
+
colors: {
|
|
715
|
+
primary: "#0052CC",
|
|
716
|
+
primaryHover: "#0747A6",
|
|
717
|
+
primaryLight: "#DEEBFF",
|
|
718
|
+
primaryDark: "#0747A6",
|
|
719
|
+
secondary: "#6B778C",
|
|
720
|
+
secondaryHover: "#5E6C84",
|
|
721
|
+
success: "#00875A",
|
|
722
|
+
warning: "#FF991F",
|
|
723
|
+
danger: "#DE350B",
|
|
724
|
+
info: "#0065FF",
|
|
725
|
+
background: "#ffffff",
|
|
726
|
+
surface: "#F4F5F7",
|
|
727
|
+
border: "#DFE1E6",
|
|
728
|
+
textPrimary: "#172B4D",
|
|
729
|
+
textSecondary: "#5E6C84",
|
|
730
|
+
textMuted: "#97A0AF"
|
|
731
|
+
},
|
|
732
|
+
typography: {
|
|
733
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
734
|
+
},
|
|
735
|
+
spacing: {
|
|
736
|
+
borderRadius: "0.25rem",
|
|
737
|
+
cardPadding: "1.5rem",
|
|
738
|
+
inputHeight: "2.5rem"
|
|
739
|
+
}
|
|
740
|
+
}, Et = {
|
|
741
|
+
name: "Fintech",
|
|
742
|
+
logo: {
|
|
743
|
+
url: "",
|
|
744
|
+
height: "36px",
|
|
745
|
+
visible: !0
|
|
746
|
+
},
|
|
747
|
+
colors: {
|
|
748
|
+
primary: "#00B386",
|
|
749
|
+
primaryHover: "#009973",
|
|
750
|
+
primaryLight: "#D1FAE5",
|
|
751
|
+
primaryDark: "#047857",
|
|
752
|
+
secondary: "#7C3AED",
|
|
753
|
+
secondaryHover: "#6D28D9",
|
|
754
|
+
success: "#10B981",
|
|
755
|
+
warning: "#F59E0B",
|
|
756
|
+
danger: "#EF4444",
|
|
757
|
+
info: "#3B82F6",
|
|
758
|
+
background: "#ffffff",
|
|
759
|
+
surface: "#F9FAFB",
|
|
760
|
+
border: "#E5E7EB",
|
|
761
|
+
textPrimary: "#111827",
|
|
762
|
+
textSecondary: "#6B7280",
|
|
763
|
+
textMuted: "#9CA3AF"
|
|
764
|
+
},
|
|
765
|
+
typography: {
|
|
766
|
+
fontFamily: "Montserrat, system-ui, sans-serif"
|
|
767
|
+
},
|
|
768
|
+
spacing: {
|
|
769
|
+
borderRadius: "0.75rem",
|
|
770
|
+
cardPadding: "2rem",
|
|
771
|
+
inputHeight: "3rem"
|
|
772
|
+
}
|
|
773
|
+
}, It = {
|
|
774
|
+
name: "Healthcare",
|
|
775
|
+
logo: {
|
|
776
|
+
url: "",
|
|
777
|
+
height: "44px",
|
|
778
|
+
visible: !0
|
|
779
|
+
},
|
|
780
|
+
colors: {
|
|
781
|
+
primary: "#06B6D4",
|
|
782
|
+
primaryHover: "#0891B2",
|
|
783
|
+
primaryLight: "#CFFAFE",
|
|
784
|
+
primaryDark: "#0E7490",
|
|
785
|
+
secondary: "#8B5CF6",
|
|
786
|
+
secondaryHover: "#7C3AED",
|
|
787
|
+
success: "#059669",
|
|
788
|
+
warning: "#D97706",
|
|
789
|
+
danger: "#DC2626",
|
|
790
|
+
info: "#0284C7",
|
|
791
|
+
background: "#ffffff",
|
|
792
|
+
surface: "#F0F9FF",
|
|
793
|
+
border: "#E0F2FE",
|
|
794
|
+
textPrimary: "#0F172A",
|
|
795
|
+
textSecondary: "#475569",
|
|
796
|
+
textMuted: "#94A3B8"
|
|
797
|
+
},
|
|
798
|
+
typography: {
|
|
799
|
+
fontFamily: "Lato, system-ui, sans-serif"
|
|
800
|
+
},
|
|
801
|
+
spacing: {
|
|
802
|
+
borderRadius: "0.5rem",
|
|
803
|
+
cardPadding: "1.75rem",
|
|
804
|
+
inputHeight: "2.75rem"
|
|
805
|
+
},
|
|
806
|
+
darkMode: {
|
|
807
|
+
colors: {
|
|
808
|
+
background: "#0F172A",
|
|
809
|
+
surface: "#1E293B",
|
|
810
|
+
border: "#334155",
|
|
811
|
+
textPrimary: "#F1F5F9",
|
|
812
|
+
textSecondary: "#CBD5E1"
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}, Rt = {
|
|
816
|
+
name: "Modern",
|
|
817
|
+
logo: {
|
|
818
|
+
url: "",
|
|
819
|
+
height: "38px",
|
|
820
|
+
visible: !0
|
|
821
|
+
},
|
|
822
|
+
colors: {
|
|
823
|
+
primary: "#8B5CF6",
|
|
824
|
+
primaryHover: "#7C3AED",
|
|
825
|
+
primaryLight: "#EDE9FE",
|
|
826
|
+
primaryDark: "#6D28D9",
|
|
827
|
+
secondary: "#EC4899",
|
|
828
|
+
secondaryHover: "#DB2777",
|
|
829
|
+
success: "#10B981",
|
|
830
|
+
warning: "#F59E0B",
|
|
831
|
+
danger: "#EF4444",
|
|
832
|
+
info: "#3B82F6",
|
|
833
|
+
background: "#ffffff",
|
|
834
|
+
surface: "#FAFAFA",
|
|
835
|
+
border: "#E5E5E5",
|
|
836
|
+
textPrimary: "#171717",
|
|
837
|
+
textSecondary: "#737373",
|
|
838
|
+
textMuted: "#A3A3A3"
|
|
839
|
+
},
|
|
840
|
+
typography: {
|
|
841
|
+
fontFamily: "Poppins, system-ui, sans-serif"
|
|
842
|
+
},
|
|
843
|
+
spacing: {
|
|
844
|
+
borderRadius: "1rem",
|
|
845
|
+
cardPadding: "2rem",
|
|
846
|
+
inputHeight: "3rem"
|
|
847
|
+
}
|
|
848
|
+
}, Dt = {
|
|
849
|
+
name: "Minimal",
|
|
850
|
+
logo: {
|
|
851
|
+
url: "",
|
|
852
|
+
height: "32px",
|
|
853
|
+
visible: !0
|
|
854
|
+
},
|
|
855
|
+
colors: {
|
|
856
|
+
primary: "#000000",
|
|
857
|
+
primaryHover: "#18181B",
|
|
858
|
+
primaryLight: "#F4F4F5",
|
|
859
|
+
primaryDark: "#000000",
|
|
860
|
+
secondary: "#71717A",
|
|
861
|
+
secondaryHover: "#52525B",
|
|
862
|
+
success: "#22C55E",
|
|
863
|
+
warning: "#EAB308",
|
|
864
|
+
danger: "#EF4444",
|
|
865
|
+
info: "#3B82F6",
|
|
866
|
+
background: "#ffffff",
|
|
867
|
+
surface: "#FAFAFA",
|
|
868
|
+
border: "#E4E4E7",
|
|
869
|
+
textPrimary: "#09090B",
|
|
870
|
+
textSecondary: "#71717A",
|
|
871
|
+
textMuted: "#A1A1AA"
|
|
872
|
+
},
|
|
873
|
+
typography: {
|
|
874
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
875
|
+
},
|
|
876
|
+
spacing: {
|
|
877
|
+
borderRadius: "0.25rem",
|
|
878
|
+
cardPadding: "1.25rem",
|
|
879
|
+
inputHeight: "2.25rem"
|
|
880
|
+
}
|
|
881
|
+
}, Pt = {
|
|
882
|
+
[Y.Default]: ee,
|
|
883
|
+
[Y.Corporate]: At,
|
|
884
|
+
[Y.Fintech]: Et,
|
|
885
|
+
[Y.Healthcare]: It,
|
|
886
|
+
[Y.Modern]: Rt,
|
|
887
|
+
[Y.Minimal]: Dt
|
|
888
|
+
};
|
|
889
|
+
function ve(t) {
|
|
890
|
+
return Pt[t] || ee;
|
|
891
|
+
}
|
|
892
|
+
class Ft {
|
|
893
|
+
constructor(e) {
|
|
894
|
+
this.httpClient = e;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Get theme configuration from backend
|
|
898
|
+
*/
|
|
899
|
+
async getThemeConfiguration() {
|
|
900
|
+
var e;
|
|
901
|
+
try {
|
|
902
|
+
const r = await this.httpClient.get(
|
|
903
|
+
"Tenant",
|
|
904
|
+
"GetThemeConfiguration"
|
|
905
|
+
);
|
|
906
|
+
if (!r.result.isEnabled)
|
|
907
|
+
return ve(Y.Default);
|
|
908
|
+
let a = r.result.preset ? ve(r.result.preset) : ve(Y.Default);
|
|
909
|
+
return r.result.logo && (a.logo = { ...a.logo, ...r.result.logo }), r.result.colors && (a.colors = { ...a.colors, ...r.result.colors }), r.result.typography && (a.typography = { ...a.typography, ...r.result.typography }), r.result.spacing && (a.spacing = { ...a.spacing, ...r.result.spacing }), r.result.customCSS && (a.customCSS = r.result.customCSS), r.result.darkMode && (a.darkMode = {
|
|
910
|
+
colors: {
|
|
911
|
+
...(e = a.darkMode) == null ? void 0 : e.colors,
|
|
912
|
+
...r.result.darkMode.colors
|
|
913
|
+
}
|
|
914
|
+
}), a;
|
|
915
|
+
} catch (r) {
|
|
916
|
+
return console.warn("[ThemeService] Failed to fetch theme configuration:", r), ve(Y.Default);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Save theme configuration (for Panel use)
|
|
921
|
+
*/
|
|
922
|
+
async saveThemeConfiguration(e) {
|
|
923
|
+
await this.httpClient.post("Tenant", "SaveThemeConfiguration", e);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Get available theme presets
|
|
927
|
+
*/
|
|
928
|
+
getAvailablePresets() {
|
|
929
|
+
return [
|
|
930
|
+
{ id: Y.Default, name: "Default" },
|
|
931
|
+
{ id: Y.Corporate, name: "Corporate" },
|
|
932
|
+
{ id: Y.Fintech, name: "Fintech" },
|
|
933
|
+
{ id: Y.Healthcare, name: "Healthcare" },
|
|
934
|
+
{ id: Y.Modern, name: "Modern" },
|
|
935
|
+
{ id: Y.Minimal, name: "Minimal" }
|
|
936
|
+
];
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Preview theme (doesn't save)
|
|
940
|
+
*/
|
|
941
|
+
getPreviewTheme(e, r) {
|
|
942
|
+
const a = ve(e);
|
|
943
|
+
return r ? {
|
|
944
|
+
...a,
|
|
945
|
+
...r,
|
|
946
|
+
logo: { ...a.logo, ...r.logo },
|
|
947
|
+
colors: { ...a.colors, ...r.colors },
|
|
948
|
+
typography: r.typography ? { ...a.typography, ...r.typography } : a.typography,
|
|
949
|
+
spacing: r.spacing ? { ...a.spacing, ...r.spacing } : a.spacing
|
|
950
|
+
} : a;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
class Lt {
|
|
954
|
+
constructor() {
|
|
955
|
+
U(this, "listeners", /* @__PURE__ */ new Map());
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Subscribe to an event
|
|
959
|
+
*/
|
|
960
|
+
on(e, r) {
|
|
961
|
+
return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(r), () => {
|
|
962
|
+
this.off(e, r);
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Unsubscribe from an event
|
|
967
|
+
*/
|
|
968
|
+
off(e, r) {
|
|
969
|
+
const a = this.listeners.get(e);
|
|
970
|
+
a && a.delete(r);
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Emit an event
|
|
974
|
+
*/
|
|
975
|
+
emit(e, r) {
|
|
976
|
+
const a = this.listeners.get(e);
|
|
977
|
+
a && a.forEach((s) => {
|
|
978
|
+
try {
|
|
979
|
+
s(r);
|
|
980
|
+
} catch (i) {
|
|
981
|
+
console.error(`Error in event listener for "${e}":`, i);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Remove all listeners
|
|
987
|
+
*/
|
|
988
|
+
clear() {
|
|
989
|
+
this.listeners.clear();
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Remove all listeners for a specific event
|
|
993
|
+
*/
|
|
994
|
+
clearEvent(e) {
|
|
995
|
+
this.listeners.delete(e);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
class Tt {
|
|
999
|
+
constructor() {
|
|
1000
|
+
U(this, "events", new Lt());
|
|
1001
|
+
U(this, "_applicantId", null);
|
|
1002
|
+
U(this, "_progress", null);
|
|
1003
|
+
U(this, "_error", null);
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Get current applicant ID
|
|
1007
|
+
*/
|
|
1008
|
+
get applicantId() {
|
|
1009
|
+
return this._applicantId;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Get current progress
|
|
1013
|
+
*/
|
|
1014
|
+
get progress() {
|
|
1015
|
+
return this._progress;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Get current step
|
|
1019
|
+
*/
|
|
1020
|
+
get currentStep() {
|
|
1021
|
+
var e;
|
|
1022
|
+
return ((e = this._progress) == null ? void 0 : e.currentStep) || null;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Get all workflow steps
|
|
1026
|
+
*/
|
|
1027
|
+
get steps() {
|
|
1028
|
+
var e;
|
|
1029
|
+
return ((e = this._progress) == null ? void 0 : e.stepInfoList) || [];
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Get current status
|
|
1033
|
+
*/
|
|
1034
|
+
get status() {
|
|
1035
|
+
var e;
|
|
1036
|
+
return ((e = this._progress) == null ? void 0 : e.status) || ae.None;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Get workflow result
|
|
1040
|
+
*/
|
|
1041
|
+
get workflowResult() {
|
|
1042
|
+
var e;
|
|
1043
|
+
return ((e = this._progress) == null ? void 0 : e.workflowResult) || null;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Get current error
|
|
1047
|
+
*/
|
|
1048
|
+
get error() {
|
|
1049
|
+
return this._error;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Check if workflow is complete
|
|
1053
|
+
*/
|
|
1054
|
+
get isComplete() {
|
|
1055
|
+
return this.status === ae.Finished;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Check if workflow is on hold
|
|
1059
|
+
*/
|
|
1060
|
+
get isOnHold() {
|
|
1061
|
+
return this.status === ae.OnHold;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Check if workflow is in progress
|
|
1065
|
+
*/
|
|
1066
|
+
get isInProgress() {
|
|
1067
|
+
return this.status === ae.InProgress;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Set applicant ID
|
|
1071
|
+
*/
|
|
1072
|
+
setApplicantId(e) {
|
|
1073
|
+
this._applicantId = e;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Update progress
|
|
1077
|
+
*/
|
|
1078
|
+
updateProgress(e) {
|
|
1079
|
+
var a, s;
|
|
1080
|
+
const r = (a = this._progress) == null ? void 0 : a.currentStep;
|
|
1081
|
+
this._progress = e, this._applicantId = e.applicantId, this._error = null, this.events.emit("progressUpdated", e), (r == null ? void 0 : r.order) !== ((s = e.currentStep) == null ? void 0 : s.order) && this.events.emit("stepChanged", e.currentStep), this.events.emit("statusChanged", e.status), e.status === ae.Finished && e.workflowResult && this.events.emit("completed", e.workflowResult);
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Set error
|
|
1085
|
+
*/
|
|
1086
|
+
setError(e) {
|
|
1087
|
+
this._error = e, this.events.emit("error", e);
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Clear error
|
|
1091
|
+
*/
|
|
1092
|
+
clearError() {
|
|
1093
|
+
this._error = null;
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Reset state
|
|
1097
|
+
*/
|
|
1098
|
+
reset() {
|
|
1099
|
+
this._applicantId = null, this._progress = null, this._error = null;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Subscribe to progress updates
|
|
1103
|
+
*/
|
|
1104
|
+
onProgressUpdated(e) {
|
|
1105
|
+
return this.events.on("progressUpdated", e);
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Subscribe to step changes
|
|
1109
|
+
*/
|
|
1110
|
+
onStepChanged(e) {
|
|
1111
|
+
return this.events.on("stepChanged", e);
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Subscribe to status changes
|
|
1115
|
+
*/
|
|
1116
|
+
onStatusChanged(e) {
|
|
1117
|
+
return this.events.on("statusChanged", e);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Subscribe to errors
|
|
1121
|
+
*/
|
|
1122
|
+
onError(e) {
|
|
1123
|
+
return this.events.on("error", e);
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Subscribe to completion
|
|
1127
|
+
*/
|
|
1128
|
+
onCompleted(e) {
|
|
1129
|
+
return this.events.on("completed", e);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Clear all event listeners
|
|
1133
|
+
*/
|
|
1134
|
+
clearListeners() {
|
|
1135
|
+
this.events.clear();
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
class Mt {
|
|
1139
|
+
constructor() {
|
|
1140
|
+
U(this, "handlers", /* @__PURE__ */ new Map());
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Register a step handler
|
|
1144
|
+
*/
|
|
1145
|
+
registerHandler(e, r) {
|
|
1146
|
+
this.handlers.set(e, r);
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Get handler for a step action
|
|
1150
|
+
*/
|
|
1151
|
+
getHandler(e) {
|
|
1152
|
+
return this.handlers.get(e);
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Check if a step has a handler
|
|
1156
|
+
*/
|
|
1157
|
+
hasHandler(e) {
|
|
1158
|
+
return this.handlers.has(e);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Load data for a step
|
|
1162
|
+
*/
|
|
1163
|
+
async loadStepData(e, r) {
|
|
1164
|
+
const a = this.getHandler(e);
|
|
1165
|
+
if (!a)
|
|
1166
|
+
throw new Error(`No handler registered for step action: ${K[e]}`);
|
|
1167
|
+
return a.loadData(r);
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Submit data for a step
|
|
1171
|
+
*/
|
|
1172
|
+
async submitStepData(e, r) {
|
|
1173
|
+
const a = this.getHandler(e);
|
|
1174
|
+
if (!a)
|
|
1175
|
+
throw new Error(`No handler registered for step action: ${K[e]}`);
|
|
1176
|
+
return a.submitData(r);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
class Bt {
|
|
1180
|
+
constructor(e, r, a, s, i, c, l, d) {
|
|
1181
|
+
U(this, "state");
|
|
1182
|
+
U(this, "stepRouter");
|
|
1183
|
+
this.applicantService = e, this.questionnaireService = r, this.uploadDocumentService = a, this.appropriatenessTestService = s, this.overviewService = i, this.riskScoringService = c, this.investorCategorizationService = d, this.state = new Tt(), this.stepRouter = new Mt(), this.registerStepHandlers();
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Register all step handlers
|
|
1187
|
+
*/
|
|
1188
|
+
registerStepHandlers() {
|
|
1189
|
+
this.stepRouter.registerHandler(K.Questionaries, {
|
|
1190
|
+
loadData: (e) => this.questionnaireService.getQuestionnaire(e),
|
|
1191
|
+
submitData: async (e) => {
|
|
1192
|
+
await this.questionnaireService.fillQuestionnaire(e);
|
|
1193
|
+
}
|
|
1194
|
+
}), this.stepRouter.registerHandler(K.UploadDocument, {
|
|
1195
|
+
loadData: (e) => this.uploadDocumentService.getUploadDocument(e),
|
|
1196
|
+
submitData: (e) => this.uploadDocumentService.fillUploadDocument(e)
|
|
1197
|
+
}), this.stepRouter.registerHandler(K.AppropriatenessTest, {
|
|
1198
|
+
loadData: (e) => this.appropriatenessTestService.getAppropriatenessTest(e),
|
|
1199
|
+
submitData: async (e) => {
|
|
1200
|
+
await this.appropriatenessTestService.fillAppropriatenessTest(e);
|
|
1201
|
+
}
|
|
1202
|
+
}), this.stepRouter.registerHandler(K.Overview, {
|
|
1203
|
+
loadData: (e) => this.overviewService.getOverviewData(e),
|
|
1204
|
+
submitData: (e) => this.overviewService.passOverview(e.applicantId)
|
|
1205
|
+
}), this.stepRouter.registerHandler(K.RiskScoring, {
|
|
1206
|
+
loadData: (e) => this.riskScoringService.getRiskCriterias(e),
|
|
1207
|
+
submitData: async (e) => {
|
|
1208
|
+
await this.riskScoringService.submitRiskScoring(e);
|
|
1209
|
+
}
|
|
1210
|
+
}), this.stepRouter.registerHandler(K.IdentitySdk, {
|
|
1211
|
+
loadData: async (e) => ({
|
|
1212
|
+
applicantId: e,
|
|
1213
|
+
message: "Identity verification required"
|
|
1214
|
+
}),
|
|
1215
|
+
submitData: async () => {
|
|
1216
|
+
}
|
|
1217
|
+
}), this.stepRouter.registerHandler(K.InvestorCategorization, {
|
|
1218
|
+
loadData: (e) => this.investorCategorizationService.getInvestorCategorization(e),
|
|
1219
|
+
submitData: async (e) => {
|
|
1220
|
+
await this.investorCategorizationService.setInvestorCategorization(e);
|
|
1221
|
+
}
|
|
1222
|
+
}), this.stepRouter.registerHandler(K.ManualReview, {
|
|
1223
|
+
loadData: async (e) => ({
|
|
1224
|
+
applicantId: e,
|
|
1225
|
+
message: "Your application is under manual review"
|
|
1226
|
+
}),
|
|
1227
|
+
submitData: async () => {
|
|
1228
|
+
}
|
|
1229
|
+
}), this.stepRouter.registerHandler(K.AdditionalData, {
|
|
1230
|
+
loadData: async (e) => ({
|
|
1231
|
+
applicantId: e,
|
|
1232
|
+
message: "Additional data required"
|
|
1233
|
+
}),
|
|
1234
|
+
submitData: async () => {
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Initialize workflow with applicant ID
|
|
1240
|
+
*/
|
|
1241
|
+
async initialize(e) {
|
|
1242
|
+
try {
|
|
1243
|
+
this.state.setApplicantId(e);
|
|
1244
|
+
const r = await this.applicantService.getProgress(e);
|
|
1245
|
+
return this.state.updateProgress(r), r;
|
|
1246
|
+
} catch (r) {
|
|
1247
|
+
throw this.state.setError(r), r;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Refresh applicant progress
|
|
1252
|
+
*/
|
|
1253
|
+
async refreshProgress() {
|
|
1254
|
+
if (!this.state.applicantId)
|
|
1255
|
+
throw new Error("Workflow not initialized. Call initialize() first.");
|
|
1256
|
+
try {
|
|
1257
|
+
const e = await this.applicantService.getProgress(this.state.applicantId);
|
|
1258
|
+
return this.state.updateProgress(e), e;
|
|
1259
|
+
} catch (e) {
|
|
1260
|
+
throw this.state.setError(e), e;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Get data for current step
|
|
1265
|
+
*/
|
|
1266
|
+
async getCurrentStepData() {
|
|
1267
|
+
if (!this.state.currentStep)
|
|
1268
|
+
throw new Error("No current step available");
|
|
1269
|
+
if (!this.state.applicantId)
|
|
1270
|
+
throw new Error("Workflow not initialized");
|
|
1271
|
+
try {
|
|
1272
|
+
return await this.stepRouter.loadStepData(
|
|
1273
|
+
this.state.currentStep.action,
|
|
1274
|
+
this.state.applicantId
|
|
1275
|
+
);
|
|
1276
|
+
} catch (e) {
|
|
1277
|
+
throw this.state.setError(e), e;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Submit data for current step
|
|
1282
|
+
*/
|
|
1283
|
+
async submitCurrentStep(e) {
|
|
1284
|
+
if (!this.state.currentStep)
|
|
1285
|
+
throw new Error("No current step available");
|
|
1286
|
+
try {
|
|
1287
|
+
await this.stepRouter.submitStepData(this.state.currentStep.action, e), await this.refreshProgress();
|
|
1288
|
+
} catch (r) {
|
|
1289
|
+
throw this.state.setError(r), r;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Move to next step (if possible)
|
|
1294
|
+
*/
|
|
1295
|
+
async moveToNextStep() {
|
|
1296
|
+
return this.refreshProgress();
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Move back to previous step
|
|
1300
|
+
*/
|
|
1301
|
+
async moveToPreviousStep() {
|
|
1302
|
+
if (!this.state.applicantId)
|
|
1303
|
+
throw new Error("Workflow not initialized");
|
|
1304
|
+
try {
|
|
1305
|
+
return await this.applicantService.progressStepBack(this.state.applicantId), await this.refreshProgress();
|
|
1306
|
+
} catch (e) {
|
|
1307
|
+
throw this.state.setError(e), e;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Get workflow state
|
|
1312
|
+
*/
|
|
1313
|
+
getState() {
|
|
1314
|
+
return this.state;
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Get step router
|
|
1318
|
+
*/
|
|
1319
|
+
getStepRouter() {
|
|
1320
|
+
return this.stepRouter;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
function je(t, e) {
|
|
1324
|
+
return new Promise((r, a) => {
|
|
1325
|
+
if (e && document.getElementById(e)) {
|
|
1326
|
+
r();
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
const s = document.createElement("script");
|
|
1330
|
+
s.src = t, e && (s.id = e), s.async = !0, s.onload = () => r(), s.onerror = () => a(new Error(`Failed to load script: ${t}`)), document.head.appendChild(s);
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
function Pr(t) {
|
|
1334
|
+
return !!document.getElementById(t);
|
|
1335
|
+
}
|
|
1336
|
+
function Fr(t) {
|
|
1337
|
+
const e = document.getElementById(t);
|
|
1338
|
+
e && e.remove();
|
|
1339
|
+
}
|
|
1340
|
+
class Ot {
|
|
1341
|
+
constructor(e) {
|
|
1342
|
+
U(this, "sdk", null);
|
|
1343
|
+
U(this, "config");
|
|
1344
|
+
this.config = e;
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Load Sumsub SDK
|
|
1348
|
+
*/
|
|
1349
|
+
async loadSDK() {
|
|
1350
|
+
await je(
|
|
1351
|
+
"https://cdn.sumsub.com/websdk/v2/production/websdk.js",
|
|
1352
|
+
"sumsub-sdk"
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Initialize Sumsub SDK
|
|
1357
|
+
*/
|
|
1358
|
+
async initialize(e) {
|
|
1359
|
+
if (window.snsWebSdk || await this.loadSDK(), !window.snsWebSdk)
|
|
1360
|
+
throw new Error("Sumsub SDK failed to load");
|
|
1361
|
+
this.sdk = window.snsWebSdk.init(this.config.accessToken, () => this.config.accessToken).withConf({
|
|
1362
|
+
lang: this.config.lang || "en",
|
|
1363
|
+
email: this.config.applicantEmail,
|
|
1364
|
+
phone: this.config.applicantPhone,
|
|
1365
|
+
i18n: {
|
|
1366
|
+
// Customization options
|
|
1367
|
+
}
|
|
1368
|
+
}).on("idCheck.onStepCompleted", (r) => {
|
|
1369
|
+
console.log("Sumsub step completed:", r);
|
|
1370
|
+
}).on("idCheck.onError", (r) => {
|
|
1371
|
+
console.error("Sumsub error:", r);
|
|
1372
|
+
}).build(), this.sdk.launch(`#${e}`);
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Destroy Sumsub SDK
|
|
1376
|
+
*/
|
|
1377
|
+
destroy() {
|
|
1378
|
+
this.sdk && (this.sdk.destroy(), this.sdk = null);
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Subscribe to completion event
|
|
1382
|
+
*/
|
|
1383
|
+
onComplete(e) {
|
|
1384
|
+
this.sdk && this.sdk.on("idCheck.applicantStatus", (r) => {
|
|
1385
|
+
r.applicantStatus === "completed" && e(r);
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Subscribe to error event
|
|
1390
|
+
*/
|
|
1391
|
+
onError(e) {
|
|
1392
|
+
this.sdk && this.sdk.on("idCheck.onError", e);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
class zt {
|
|
1396
|
+
constructor(e) {
|
|
1397
|
+
U(this, "sdk", null);
|
|
1398
|
+
U(this, "config");
|
|
1399
|
+
this.config = e;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Load Onfido SDK
|
|
1403
|
+
*/
|
|
1404
|
+
async loadSDK() {
|
|
1405
|
+
await je(
|
|
1406
|
+
"https://sdk.onfido.com/v12.0.0/onfido.min.js",
|
|
1407
|
+
"onfido-sdk"
|
|
1408
|
+
);
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Initialize Onfido SDK
|
|
1412
|
+
*/
|
|
1413
|
+
async initialize(e) {
|
|
1414
|
+
if (window.Onfido || await this.loadSDK(), !window.Onfido)
|
|
1415
|
+
throw new Error("Onfido SDK failed to load");
|
|
1416
|
+
this.sdk = window.Onfido.init({
|
|
1417
|
+
token: this.config.token,
|
|
1418
|
+
containerId: e,
|
|
1419
|
+
steps: this.config.steps || [
|
|
1420
|
+
{
|
|
1421
|
+
type: "welcome",
|
|
1422
|
+
options: {
|
|
1423
|
+
title: "Identity Verification"
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
type: "document",
|
|
1428
|
+
options: {
|
|
1429
|
+
documentTypes: {
|
|
1430
|
+
passport: !0,
|
|
1431
|
+
driving_licence: !0,
|
|
1432
|
+
national_identity_card: !0
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
type: "face",
|
|
1438
|
+
options: {
|
|
1439
|
+
requestedVariant: "standard"
|
|
1440
|
+
}
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
type: "complete"
|
|
1444
|
+
}
|
|
1445
|
+
],
|
|
1446
|
+
onComplete: () => {
|
|
1447
|
+
this.config.onComplete && this.config.onComplete();
|
|
1448
|
+
},
|
|
1449
|
+
onError: (r) => {
|
|
1450
|
+
this.config.onError && this.config.onError(r);
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Destroy Onfido SDK
|
|
1456
|
+
*/
|
|
1457
|
+
destroy() {
|
|
1458
|
+
this.sdk && (this.sdk.tearDown(), this.sdk = null);
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
class _t {
|
|
1462
|
+
constructor(e) {
|
|
1463
|
+
U(this, "sardineContext", null);
|
|
1464
|
+
U(this, "config");
|
|
1465
|
+
U(this, "sessionKey");
|
|
1466
|
+
this.config = e, this.sessionKey = e.sessionKey || this.generateSessionKey();
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Generate a UUID for session key
|
|
1470
|
+
*/
|
|
1471
|
+
generateSessionKey() {
|
|
1472
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
1473
|
+
const r = Math.random() * 16 | 0;
|
|
1474
|
+
return (e === "x" ? r : r & 3 | 8).toString(16);
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Get Sardine host based on environment and region
|
|
1479
|
+
*/
|
|
1480
|
+
getSardineHost() {
|
|
1481
|
+
const { environment: e, region: r } = this.config;
|
|
1482
|
+
if (e === "sandbox")
|
|
1483
|
+
return "api.sandbox.sardine.ai";
|
|
1484
|
+
switch (r) {
|
|
1485
|
+
case "eu":
|
|
1486
|
+
return "api.eu.sardine.ai";
|
|
1487
|
+
case "ca":
|
|
1488
|
+
return "api.ca.sardine.ai";
|
|
1489
|
+
case "au":
|
|
1490
|
+
return "api.au.sardine.ai";
|
|
1491
|
+
default:
|
|
1492
|
+
return "api.sardine.ai";
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Load SardinAI Risk SDK script
|
|
1497
|
+
*/
|
|
1498
|
+
async loadSDK() {
|
|
1499
|
+
return new Promise((e, r) => {
|
|
1500
|
+
if (window._Sardine) {
|
|
1501
|
+
e();
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
const a = this.getSardineHost(), s = document.createElement("script");
|
|
1505
|
+
s.type = "text/javascript", s.async = !0, s.src = `https://${a}/assets/loader.min.js`, s.onload = () => {
|
|
1506
|
+
console.log("[SardinAI] SDK loaded successfully"), e();
|
|
1507
|
+
}, s.onerror = () => {
|
|
1508
|
+
r(new Error("Failed to load SardinAI SDK"));
|
|
1509
|
+
};
|
|
1510
|
+
const i = document.getElementsByTagName("script")[0];
|
|
1511
|
+
i && i.parentNode ? i.parentNode.insertBefore(s, i) : document.head.appendChild(s);
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Initialize SardinAI Risk SDK
|
|
1516
|
+
*/
|
|
1517
|
+
async initialize() {
|
|
1518
|
+
try {
|
|
1519
|
+
if (await this.loadSDK(), !window._Sardine)
|
|
1520
|
+
throw new Error("SardinAI SDK not available after loading");
|
|
1521
|
+
const e = this.getSardineHost(), { clientId: r, environment: a, flow: s, enableBiometrics: i, enablePortScanning: c } = this.config;
|
|
1522
|
+
this.sardineContext = window._Sardine.createContext({
|
|
1523
|
+
clientId: r,
|
|
1524
|
+
sessionKey: this.sessionKey,
|
|
1525
|
+
userIdHash: void 0,
|
|
1526
|
+
// Will be set later via updateConfig
|
|
1527
|
+
flow: s || window.location.pathname,
|
|
1528
|
+
environment: a || "production",
|
|
1529
|
+
parentElement: document.body,
|
|
1530
|
+
enableBiometrics: i !== !1,
|
|
1531
|
+
// Default true
|
|
1532
|
+
enablePortScanning: c === !0,
|
|
1533
|
+
// Default false
|
|
1534
|
+
region: this.config.region,
|
|
1535
|
+
// Callback for device response (deprecated but kept for compatibility)
|
|
1536
|
+
onDeviceResponse: (l) => {
|
|
1537
|
+
console.log(`[SardinAI] Device ID: ${l.deviceId}`);
|
|
1538
|
+
},
|
|
1539
|
+
// New callback for session updates
|
|
1540
|
+
onConfigUpdate: (l, d, u) => {
|
|
1541
|
+
switch (l) {
|
|
1542
|
+
case "SESSION_UPDATE_FAILED":
|
|
1543
|
+
console.error("[SardinAI] Session update failed:", u);
|
|
1544
|
+
break;
|
|
1545
|
+
case "SESSION_UPDATED":
|
|
1546
|
+
console.log("[SardinAI] Session updated:", d);
|
|
1547
|
+
break;
|
|
1548
|
+
case "SESSION_NO_UPDATE":
|
|
1549
|
+
console.log("[SardinAI] No session update");
|
|
1550
|
+
break;
|
|
1551
|
+
default:
|
|
1552
|
+
console.warn("[SardinAI] Unknown event:", l);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}), this.addNoScriptFallback(e), console.log("[SardinAI] SDK initialized with sessionKey:", this.sessionKey);
|
|
1556
|
+
} catch (e) {
|
|
1557
|
+
throw console.error("[SardinAI] Initialization failed:", e), e;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Add noscript fallback for cases where JS is disabled
|
|
1562
|
+
*/
|
|
1563
|
+
addNoScriptFallback(e) {
|
|
1564
|
+
const r = document.createElement("noscript"), a = document.createElement("img"), { clientId: s, flow: i } = this.config;
|
|
1565
|
+
a.src = `https://${e}/v1/a.png?clientId=${s}&sessionKey=${this.sessionKey}&flow=${i || "kyc"}&ns=1`, a.style.display = "none", r.appendChild(a), document.body.appendChild(r);
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Update configuration (e.g., set userIdHash after login)
|
|
1569
|
+
*/
|
|
1570
|
+
updateConfig(e) {
|
|
1571
|
+
if (!this.sardineContext) {
|
|
1572
|
+
console.warn("[SardinAI] Cannot update config - SDK not initialized");
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
e.sessionKey && (this.sessionKey = e.sessionKey), this.sardineContext.updateConfig({
|
|
1576
|
+
...e,
|
|
1577
|
+
onConfigUpdate: (r, a, s) => {
|
|
1578
|
+
switch (r) {
|
|
1579
|
+
case "SESSION_UPDATE_FAILED":
|
|
1580
|
+
console.error("[SardinAI] Config update failed:", s);
|
|
1581
|
+
break;
|
|
1582
|
+
case "SESSION_UPDATED":
|
|
1583
|
+
console.log("[SardinAI] Config updated:", a);
|
|
1584
|
+
break;
|
|
1585
|
+
case "SESSION_NO_UPDATE":
|
|
1586
|
+
console.log("[SardinAI] No config update needed");
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Get current session key
|
|
1594
|
+
*/
|
|
1595
|
+
getSessionKey() {
|
|
1596
|
+
return this.sessionKey;
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Destroy SardinAI SDK instance
|
|
1600
|
+
*/
|
|
1601
|
+
destroy() {
|
|
1602
|
+
this.sardineContext && (this.sardineContext = null);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
class fe {
|
|
1606
|
+
/**
|
|
1607
|
+
* Create a provider instance
|
|
1608
|
+
*/
|
|
1609
|
+
static createProvider(e, r) {
|
|
1610
|
+
switch (e) {
|
|
1611
|
+
case ne.Sumsub:
|
|
1612
|
+
return new Ot(r);
|
|
1613
|
+
case ne.Onfido:
|
|
1614
|
+
return new zt(r);
|
|
1615
|
+
case ne.SardinAI:
|
|
1616
|
+
return new _t(r);
|
|
1617
|
+
default:
|
|
1618
|
+
throw new Error(`Unsupported identity provider: ${e}`);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Get provider configuration from API token object
|
|
1623
|
+
*/
|
|
1624
|
+
static parseProviderConfig(e, r, a) {
|
|
1625
|
+
var s;
|
|
1626
|
+
switch (e) {
|
|
1627
|
+
case ne.Sumsub:
|
|
1628
|
+
return {
|
|
1629
|
+
accessToken: r.accessToken || r.token,
|
|
1630
|
+
applicantEmail: r.email,
|
|
1631
|
+
applicantPhone: r.phone,
|
|
1632
|
+
externalUserId: r.externalUserId,
|
|
1633
|
+
lang: r.lang || "en"
|
|
1634
|
+
};
|
|
1635
|
+
case ne.Onfido:
|
|
1636
|
+
return {
|
|
1637
|
+
token: r.token || r.sdkToken
|
|
1638
|
+
};
|
|
1639
|
+
case ne.SardinAI:
|
|
1640
|
+
const i = ((s = a == null ? void 0 : a.identityProviders) == null ? void 0 : s.sardinai) || {};
|
|
1641
|
+
return {
|
|
1642
|
+
clientId: i.clientId || r.clientId,
|
|
1643
|
+
sessionKey: i.sessionKey || r.sessionKey,
|
|
1644
|
+
environment: i.environment || r.environment || "production",
|
|
1645
|
+
flow: i.flow || r.flow,
|
|
1646
|
+
region: i.region,
|
|
1647
|
+
enableBiometrics: i.enableBiometrics,
|
|
1648
|
+
enablePortScanning: i.enablePortScanning
|
|
1649
|
+
};
|
|
1650
|
+
default:
|
|
1651
|
+
throw new Error(`Unsupported identity provider: ${e}`);
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
class jt {
|
|
1656
|
+
constructor(e) {
|
|
1657
|
+
U(this, "currentTheme", ee);
|
|
1658
|
+
U(this, "customStyleElement", null);
|
|
1659
|
+
U(this, "container");
|
|
1660
|
+
this.container = e || document.documentElement;
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Apply theme configuration
|
|
1664
|
+
*/
|
|
1665
|
+
applyTheme(e) {
|
|
1666
|
+
this.currentTheme = this.mergeWithDefault(e), this.applyColors(this.currentTheme.colors), this.currentTheme.typography && this.applyTypography(this.currentTheme.typography), this.currentTheme.spacing && this.applySpacing(this.currentTheme.spacing), this.currentTheme.customCSS && this.injectCustomCSS(this.currentTheme.customCSS), console.log("[ThemeManager] Theme applied:", this.currentTheme.name || "Custom");
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Apply color palette as CSS variables
|
|
1670
|
+
*/
|
|
1671
|
+
applyColors(e) {
|
|
1672
|
+
var a;
|
|
1673
|
+
const r = {
|
|
1674
|
+
primary: e.primary,
|
|
1675
|
+
"primary-hover": e.primaryHover,
|
|
1676
|
+
"primary-light": e.primaryLight,
|
|
1677
|
+
"primary-dark": e.primaryDark,
|
|
1678
|
+
secondary: e.secondary,
|
|
1679
|
+
"secondary-hover": e.secondaryHover,
|
|
1680
|
+
success: e.success,
|
|
1681
|
+
warning: e.warning,
|
|
1682
|
+
danger: e.danger,
|
|
1683
|
+
info: e.info,
|
|
1684
|
+
background: e.background,
|
|
1685
|
+
surface: e.surface,
|
|
1686
|
+
border: e.border,
|
|
1687
|
+
"text-primary": e.textPrimary,
|
|
1688
|
+
"text-secondary": e.textSecondary,
|
|
1689
|
+
"text-muted": e.textMuted
|
|
1690
|
+
};
|
|
1691
|
+
Object.entries(r).forEach(([s, i]) => {
|
|
1692
|
+
this.container.style.setProperty(`--metakyc-${s}`, i);
|
|
1693
|
+
}), (a = this.currentTheme.darkMode) != null && a.colors && this.applyDarkModeColors(this.currentTheme.darkMode.colors);
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Apply dark mode color overrides
|
|
1697
|
+
*/
|
|
1698
|
+
applyDarkModeColors(e) {
|
|
1699
|
+
Object.entries(e).forEach(([r, a]) => {
|
|
1700
|
+
if (a) {
|
|
1701
|
+
const s = `--metakyc-dark-${this.kebabCase(r)}`;
|
|
1702
|
+
this.container.style.setProperty(s, a);
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* Apply typography settings
|
|
1708
|
+
*/
|
|
1709
|
+
applyTypography(e) {
|
|
1710
|
+
e && (e.fontFamily && this.container.style.setProperty("--metakyc-font-family", e.fontFamily), e.headingFont && this.container.style.setProperty("--metakyc-heading-font", e.headingFont), e.fontSize && Object.entries(e.fontSize).forEach(([r, a]) => {
|
|
1711
|
+
this.container.style.setProperty(`--metakyc-font-size-${r}`, a);
|
|
1712
|
+
}), e.fontWeight && Object.entries(e.fontWeight).forEach(([r, a]) => {
|
|
1713
|
+
this.container.style.setProperty(`--metakyc-font-weight-${r}`, a.toString());
|
|
1714
|
+
}));
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Apply spacing settings
|
|
1718
|
+
*/
|
|
1719
|
+
applySpacing(e) {
|
|
1720
|
+
e && Object.entries(e).forEach(([r, a]) => {
|
|
1721
|
+
const s = `--metakyc-${this.kebabCase(r)}`;
|
|
1722
|
+
this.container.style.setProperty(s, a);
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Inject custom CSS into document
|
|
1727
|
+
*/
|
|
1728
|
+
injectCustomCSS(e) {
|
|
1729
|
+
this.customStyleElement && this.customStyleElement.remove(), this.customStyleElement = document.createElement("style"), this.customStyleElement.id = "metakyc-custom-css", this.customStyleElement.textContent = e, document.head.appendChild(this.customStyleElement);
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Merge partial theme with default theme
|
|
1733
|
+
*/
|
|
1734
|
+
mergeWithDefault(e) {
|
|
1735
|
+
var r;
|
|
1736
|
+
return {
|
|
1737
|
+
name: e.name || ee.name,
|
|
1738
|
+
logo: { ...ee.logo, ...e.logo },
|
|
1739
|
+
colors: { ...ee.colors, ...e.colors },
|
|
1740
|
+
typography: e.typography ? { ...ee.typography, ...e.typography } : ee.typography,
|
|
1741
|
+
spacing: e.spacing ? { ...ee.spacing, ...e.spacing } : ee.spacing,
|
|
1742
|
+
customCSS: e.customCSS,
|
|
1743
|
+
darkMode: e.darkMode ? {
|
|
1744
|
+
colors: {
|
|
1745
|
+
...(r = ee.darkMode) == null ? void 0 : r.colors,
|
|
1746
|
+
...e.darkMode.colors
|
|
1747
|
+
}
|
|
1748
|
+
} : ee.darkMode
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Get current theme configuration
|
|
1753
|
+
*/
|
|
1754
|
+
getCurrentTheme() {
|
|
1755
|
+
return this.currentTheme;
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Reset to default theme
|
|
1759
|
+
*/
|
|
1760
|
+
resetTheme() {
|
|
1761
|
+
this.applyTheme(ee);
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Remove all custom styles
|
|
1765
|
+
*/
|
|
1766
|
+
cleanup() {
|
|
1767
|
+
this.customStyleElement && (this.customStyleElement.remove(), this.customStyleElement = null);
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Convert camelCase to kebab-case
|
|
1771
|
+
*/
|
|
1772
|
+
kebabCase(e) {
|
|
1773
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
const $e = Je(null), Lr = ({ config: t, children: e }) => {
|
|
1777
|
+
const r = Oe(() => {
|
|
1778
|
+
const a = new yt(t), s = new ft(a), i = new bt(a), c = new xt(a), l = new vt(a), d = new wt(a), u = new kt(a), g = new Nt(a), p = new St(a), m = new Ct(a), b = new Ft(a), y = new jt();
|
|
1779
|
+
return {
|
|
1780
|
+
config: t,
|
|
1781
|
+
httpClient: a,
|
|
1782
|
+
applicantService: s,
|
|
1783
|
+
questionnaireService: i,
|
|
1784
|
+
uploadDocumentService: c,
|
|
1785
|
+
appropriatenessTestService: l,
|
|
1786
|
+
overviewService: d,
|
|
1787
|
+
riskScoringService: u,
|
|
1788
|
+
identityService: g,
|
|
1789
|
+
baseInformationService: p,
|
|
1790
|
+
investorCategorizationService: m,
|
|
1791
|
+
themeService: b,
|
|
1792
|
+
themeManager: y,
|
|
1793
|
+
createOrchestrator: () => new Bt(
|
|
1794
|
+
s,
|
|
1795
|
+
i,
|
|
1796
|
+
c,
|
|
1797
|
+
l,
|
|
1798
|
+
d,
|
|
1799
|
+
u,
|
|
1800
|
+
g,
|
|
1801
|
+
m
|
|
1802
|
+
)
|
|
1803
|
+
};
|
|
1804
|
+
}, [t]);
|
|
1805
|
+
return V(() => ((async () => {
|
|
1806
|
+
try {
|
|
1807
|
+
if (t.theme) {
|
|
1808
|
+
console.log("[MetaKYC] Applying static theme from config"), r.themeManager.applyTheme(t.theme);
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
console.log("[MetaKYC] Fetching theme from backend...");
|
|
1812
|
+
const s = await r.themeService.getThemeConfiguration();
|
|
1813
|
+
r.themeManager.applyTheme(s), console.log("[MetaKYC] Theme loaded and applied");
|
|
1814
|
+
} catch (s) {
|
|
1815
|
+
console.warn("[MetaKYC] Failed to load theme, using default:", s);
|
|
1816
|
+
}
|
|
1817
|
+
})(), () => {
|
|
1818
|
+
r.themeManager.cleanup();
|
|
1819
|
+
}), [t.theme, r.themeService, r.themeManager]), /* @__PURE__ */ n($e.Provider, { value: r, children: e });
|
|
1820
|
+
};
|
|
1821
|
+
function ie() {
|
|
1822
|
+
const t = Xe($e);
|
|
1823
|
+
if (!t)
|
|
1824
|
+
throw new Error("useMetaKYC must be used within a MetaKYCProvider");
|
|
1825
|
+
return t;
|
|
1826
|
+
}
|
|
1827
|
+
async function $t(t) {
|
|
1828
|
+
return new Promise((e, r) => {
|
|
1829
|
+
const a = new FileReader();
|
|
1830
|
+
a.readAsDataURL(t), a.onload = () => {
|
|
1831
|
+
const i = a.result.split(",")[1];
|
|
1832
|
+
e(i);
|
|
1833
|
+
}, a.onerror = (s) => r(s);
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
function Tr(t, e) {
|
|
1837
|
+
return t.size <= e;
|
|
1838
|
+
}
|
|
1839
|
+
function Mr(t, e) {
|
|
1840
|
+
return e.split(",").map((a) => a.trim()).some((a) => {
|
|
1841
|
+
if (a.endsWith("/*")) {
|
|
1842
|
+
const s = a.slice(0, -2);
|
|
1843
|
+
return t.type.startsWith(s);
|
|
1844
|
+
}
|
|
1845
|
+
return t.type === a;
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
function Ce(t) {
|
|
1849
|
+
if (t === 0) return "0 Bytes";
|
|
1850
|
+
const e = 1024, r = ["Bytes", "KB", "MB", "GB"], a = Math.floor(Math.log(t) / Math.log(e));
|
|
1851
|
+
return Math.round(t / Math.pow(e, a) * 100) / 100 + " " + r[a];
|
|
1852
|
+
}
|
|
1853
|
+
function Br(t) {
|
|
1854
|
+
return t;
|
|
1855
|
+
}
|
|
1856
|
+
function J(...t) {
|
|
1857
|
+
return t.filter(Boolean).join(" ");
|
|
1858
|
+
}
|
|
1859
|
+
const be = {
|
|
1860
|
+
APPLICANT_ID: "metakyc_applicant_id",
|
|
1861
|
+
WORKFLOW_STATE: "metakyc_workflow_state"
|
|
1862
|
+
};
|
|
1863
|
+
function Ut(t) {
|
|
1864
|
+
try {
|
|
1865
|
+
localStorage.setItem(be.APPLICANT_ID, t.toString());
|
|
1866
|
+
} catch (e) {
|
|
1867
|
+
console.warn("Failed to save applicant ID to storage:", e);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
function Kt() {
|
|
1871
|
+
try {
|
|
1872
|
+
const t = localStorage.getItem(be.APPLICANT_ID);
|
|
1873
|
+
return t ? parseInt(t, 10) : null;
|
|
1874
|
+
} catch (t) {
|
|
1875
|
+
return console.warn("Failed to retrieve applicant ID from storage:", t), null;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
function qt() {
|
|
1879
|
+
try {
|
|
1880
|
+
localStorage.removeItem(be.APPLICANT_ID);
|
|
1881
|
+
} catch (t) {
|
|
1882
|
+
console.warn("Failed to clear applicant ID from storage:", t);
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
function Ht(t) {
|
|
1886
|
+
try {
|
|
1887
|
+
localStorage.setItem(be.WORKFLOW_STATE, JSON.stringify(t));
|
|
1888
|
+
} catch (e) {
|
|
1889
|
+
console.warn("Failed to save workflow state to storage:", e);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
function Or() {
|
|
1893
|
+
try {
|
|
1894
|
+
const t = localStorage.getItem(be.WORKFLOW_STATE);
|
|
1895
|
+
return t ? JSON.parse(t) : null;
|
|
1896
|
+
} catch (t) {
|
|
1897
|
+
return console.warn("Failed to retrieve workflow state from storage:", t), null;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
function Vt() {
|
|
1901
|
+
try {
|
|
1902
|
+
localStorage.removeItem(be.WORKFLOW_STATE);
|
|
1903
|
+
} catch (t) {
|
|
1904
|
+
console.warn("Failed to clear workflow state from storage:", t);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
function zr() {
|
|
1908
|
+
qt(), Vt();
|
|
1909
|
+
}
|
|
1910
|
+
function Yt(t) {
|
|
1911
|
+
const { createOrchestrator: e } = ie(), [r, a] = v(null), [s, i] = v(!1), [c, l] = v(null), d = ze(null), u = t || Kt();
|
|
1912
|
+
V(() => {
|
|
1913
|
+
d.current || (d.current = e());
|
|
1914
|
+
}, [e]), V(() => {
|
|
1915
|
+
var h;
|
|
1916
|
+
r && u && (Ut(u), Ht({
|
|
1917
|
+
applicantId: u,
|
|
1918
|
+
currentStepOrder: (h = r.currentStep) == null ? void 0 : h.order,
|
|
1919
|
+
status: r.status,
|
|
1920
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1921
|
+
workflowKey: r.workFlowKey,
|
|
1922
|
+
nextWorkflowKey: r.nextWorkflowKey
|
|
1923
|
+
}));
|
|
1924
|
+
}, [r, u]);
|
|
1925
|
+
const g = q(async () => {
|
|
1926
|
+
if (!(!u || !d.current)) {
|
|
1927
|
+
i(!0), l(null);
|
|
1928
|
+
try {
|
|
1929
|
+
const h = await d.current.initialize(u);
|
|
1930
|
+
a(h);
|
|
1931
|
+
} catch (h) {
|
|
1932
|
+
l(h);
|
|
1933
|
+
} finally {
|
|
1934
|
+
i(!1);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}, [u]);
|
|
1938
|
+
V(() => {
|
|
1939
|
+
u && g();
|
|
1940
|
+
}, [u, g]);
|
|
1941
|
+
const p = q(async () => {
|
|
1942
|
+
if (d.current) {
|
|
1943
|
+
i(!0), l(null);
|
|
1944
|
+
try {
|
|
1945
|
+
const h = await d.current.refreshProgress();
|
|
1946
|
+
a(h);
|
|
1947
|
+
} catch (h) {
|
|
1948
|
+
l(h);
|
|
1949
|
+
} finally {
|
|
1950
|
+
i(!1);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
}, []), m = q(async () => {
|
|
1954
|
+
if (d.current) {
|
|
1955
|
+
i(!0), l(null);
|
|
1956
|
+
try {
|
|
1957
|
+
const h = await d.current.moveToNextStep();
|
|
1958
|
+
a(h);
|
|
1959
|
+
} catch (h) {
|
|
1960
|
+
l(h);
|
|
1961
|
+
} finally {
|
|
1962
|
+
i(!1);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}, []), b = q(async () => {
|
|
1966
|
+
if (d.current) {
|
|
1967
|
+
i(!0), l(null);
|
|
1968
|
+
try {
|
|
1969
|
+
const h = await d.current.moveToPreviousStep();
|
|
1970
|
+
a(h);
|
|
1971
|
+
} catch (h) {
|
|
1972
|
+
l(h);
|
|
1973
|
+
} finally {
|
|
1974
|
+
i(!1);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}, []), y = q(async (h) => {
|
|
1978
|
+
if (d.current) {
|
|
1979
|
+
i(!0), l(null);
|
|
1980
|
+
try {
|
|
1981
|
+
await d.current.submitCurrentStep(h);
|
|
1982
|
+
const N = await d.current.refreshProgress();
|
|
1983
|
+
a(N);
|
|
1984
|
+
} catch (N) {
|
|
1985
|
+
throw l(N), N;
|
|
1986
|
+
} finally {
|
|
1987
|
+
i(!1);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
}, []), x = Pe.useMemo(() => r != null && r.stepInfoList ? [...r.stepInfoList].sort((h, N) => h.order - N.order) : [], [r == null ? void 0 : r.stepInfoList]), R = Pe.useMemo(() => r ? r.nextWorkflowKey && r.nextWorkflowKey !== r.workFlowKey : !1, [r]);
|
|
1991
|
+
return {
|
|
1992
|
+
progress: r,
|
|
1993
|
+
applicantId: u,
|
|
1994
|
+
currentStep: (r == null ? void 0 : r.currentStep) || null,
|
|
1995
|
+
steps: x,
|
|
1996
|
+
status: (r == null ? void 0 : r.status) || ae.None,
|
|
1997
|
+
workflowResult: (r == null ? void 0 : r.workflowResult) || null,
|
|
1998
|
+
workflowKey: r == null ? void 0 : r.workFlowKey,
|
|
1999
|
+
nextWorkflowKey: r == null ? void 0 : r.nextWorkflowKey,
|
|
2000
|
+
hasWorkflowChanged: R,
|
|
2001
|
+
isLoading: s,
|
|
2002
|
+
error: c,
|
|
2003
|
+
isComplete: (r == null ? void 0 : r.status) === ae.Finished,
|
|
2004
|
+
isOnHold: (r == null ? void 0 : r.status) === ae.OnHold,
|
|
2005
|
+
refreshProgress: p,
|
|
2006
|
+
moveToNext: m,
|
|
2007
|
+
moveBack: b,
|
|
2008
|
+
submitCurrentStep: y,
|
|
2009
|
+
orchestrator: d.current
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
function Wt(t) {
|
|
2013
|
+
const { questionnaireService: e } = ie(), [r, a] = v(null), [s, i] = v(!1), [c, l] = v(!1), [d, u] = v(null), g = q(async () => {
|
|
2014
|
+
if (t) {
|
|
2015
|
+
i(!0), u(null);
|
|
2016
|
+
try {
|
|
2017
|
+
const m = await e.getQuestionnaire(t);
|
|
2018
|
+
a(m);
|
|
2019
|
+
} catch (m) {
|
|
2020
|
+
u(m);
|
|
2021
|
+
} finally {
|
|
2022
|
+
i(!1);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}, [t, e]);
|
|
2026
|
+
V(() => {
|
|
2027
|
+
t && g();
|
|
2028
|
+
}, [t, g]);
|
|
2029
|
+
const p = q(
|
|
2030
|
+
async (m) => {
|
|
2031
|
+
l(!0), u(null);
|
|
2032
|
+
try {
|
|
2033
|
+
return await e.fillQuestionnaire(m);
|
|
2034
|
+
} catch (b) {
|
|
2035
|
+
throw u(b), b;
|
|
2036
|
+
} finally {
|
|
2037
|
+
l(!1);
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2040
|
+
[e]
|
|
2041
|
+
);
|
|
2042
|
+
return {
|
|
2043
|
+
questionnaire: r,
|
|
2044
|
+
isLoading: s,
|
|
2045
|
+
isSubmitting: c,
|
|
2046
|
+
error: d,
|
|
2047
|
+
load: g,
|
|
2048
|
+
submit: p
|
|
2049
|
+
};
|
|
2050
|
+
}
|
|
2051
|
+
function Qt(t) {
|
|
2052
|
+
const { uploadDocumentService: e } = ie(), [r, a] = v(null), [s, i] = v(!1), [c, l] = v(!1), [d, u] = v(0), [g, p] = v(null), m = q(async () => {
|
|
2053
|
+
if (t) {
|
|
2054
|
+
i(!0), p(null);
|
|
2055
|
+
try {
|
|
2056
|
+
const y = await e.getUploadDocument(t);
|
|
2057
|
+
a(y);
|
|
2058
|
+
} catch (y) {
|
|
2059
|
+
p(y);
|
|
2060
|
+
} finally {
|
|
2061
|
+
i(!1);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}, [t, e]);
|
|
2065
|
+
V(() => {
|
|
2066
|
+
t && m();
|
|
2067
|
+
}, [t, m]);
|
|
2068
|
+
const b = q(
|
|
2069
|
+
async (y) => {
|
|
2070
|
+
l(!0), u(0), p(null);
|
|
2071
|
+
try {
|
|
2072
|
+
await e.fillUploadDocument(y), u(100);
|
|
2073
|
+
} catch (x) {
|
|
2074
|
+
throw p(x), x;
|
|
2075
|
+
} finally {
|
|
2076
|
+
l(!1);
|
|
2077
|
+
}
|
|
2078
|
+
},
|
|
2079
|
+
[e]
|
|
2080
|
+
);
|
|
2081
|
+
return {
|
|
2082
|
+
uploadDocument: r,
|
|
2083
|
+
isLoading: s,
|
|
2084
|
+
isSubmitting: c,
|
|
2085
|
+
uploadProgress: d,
|
|
2086
|
+
error: g,
|
|
2087
|
+
load: m,
|
|
2088
|
+
submit: b
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
function _r(t) {
|
|
2092
|
+
const { appropriatenessTestService: e } = ie(), [r, a] = v(null), [s, i] = v(!1), [c, l] = v(!1), [d, u] = v(null), [g, p] = v(null), m = q(async () => {
|
|
2093
|
+
if (t) {
|
|
2094
|
+
i(!0), u(null);
|
|
2095
|
+
try {
|
|
2096
|
+
const y = await e.getAppropriatenessTest(t);
|
|
2097
|
+
a(y);
|
|
2098
|
+
} catch (y) {
|
|
2099
|
+
u(y);
|
|
2100
|
+
} finally {
|
|
2101
|
+
i(!1);
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}, [t, e]);
|
|
2105
|
+
V(() => {
|
|
2106
|
+
t && m();
|
|
2107
|
+
}, [t, m]);
|
|
2108
|
+
const b = q(
|
|
2109
|
+
async (y) => {
|
|
2110
|
+
l(!0), u(null);
|
|
2111
|
+
try {
|
|
2112
|
+
const x = await e.fillAppropriatenessTest(y);
|
|
2113
|
+
return p(x), x;
|
|
2114
|
+
} catch (x) {
|
|
2115
|
+
throw u(x), x;
|
|
2116
|
+
} finally {
|
|
2117
|
+
l(!1);
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
[e]
|
|
2121
|
+
);
|
|
2122
|
+
return {
|
|
2123
|
+
test: r,
|
|
2124
|
+
result: g,
|
|
2125
|
+
isLoading: s,
|
|
2126
|
+
isSubmitting: c,
|
|
2127
|
+
error: d,
|
|
2128
|
+
load: m,
|
|
2129
|
+
submit: b
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
function Gt(t) {
|
|
2133
|
+
const { overviewService: e } = ie(), [r, a] = v(null), [s, i] = v(!1), [c, l] = v(!1), [d, u] = v(null), g = q(async () => {
|
|
2134
|
+
if (t) {
|
|
2135
|
+
i(!0), u(null);
|
|
2136
|
+
try {
|
|
2137
|
+
const m = await e.getOverviewData(t);
|
|
2138
|
+
a(m);
|
|
2139
|
+
} catch (m) {
|
|
2140
|
+
u(m);
|
|
2141
|
+
} finally {
|
|
2142
|
+
i(!1);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}, [t, e]);
|
|
2146
|
+
V(() => {
|
|
2147
|
+
t && g();
|
|
2148
|
+
}, [t, g]);
|
|
2149
|
+
const p = q(async () => {
|
|
2150
|
+
if (t) {
|
|
2151
|
+
l(!0), u(null);
|
|
2152
|
+
try {
|
|
2153
|
+
await e.passOverview(t);
|
|
2154
|
+
} catch (m) {
|
|
2155
|
+
throw u(m), m;
|
|
2156
|
+
} finally {
|
|
2157
|
+
l(!1);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
}, [t, e]);
|
|
2161
|
+
return {
|
|
2162
|
+
overview: r,
|
|
2163
|
+
isLoading: s,
|
|
2164
|
+
isSubmitting: c,
|
|
2165
|
+
error: d,
|
|
2166
|
+
load: g,
|
|
2167
|
+
passOverview: p
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
function Zt(t) {
|
|
2171
|
+
const { identityService: e } = ie(), [r, a] = v(
|
|
2172
|
+
null
|
|
2173
|
+
), [s, i] = v(!1), [c, l] = v(null), d = q(
|
|
2174
|
+
async (p, m) => {
|
|
2175
|
+
if (t) {
|
|
2176
|
+
i(!0), l(null);
|
|
2177
|
+
try {
|
|
2178
|
+
const b = {
|
|
2179
|
+
applicantId: t,
|
|
2180
|
+
restart: !1,
|
|
2181
|
+
redirectUrl: p || "",
|
|
2182
|
+
ttl: m || 604800
|
|
2183
|
+
// Default: 7 days
|
|
2184
|
+
};
|
|
2185
|
+
console.log("Identity request input:", b);
|
|
2186
|
+
const y = await e.identityRequest(b);
|
|
2187
|
+
return console.log("Identity request result:", y), a(y), y;
|
|
2188
|
+
} catch (b) {
|
|
2189
|
+
throw l(b), b;
|
|
2190
|
+
} finally {
|
|
2191
|
+
i(!1);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
[t, e]
|
|
2196
|
+
), u = q(
|
|
2197
|
+
async (p, m) => {
|
|
2198
|
+
if (t) {
|
|
2199
|
+
i(!0), l(null);
|
|
2200
|
+
try {
|
|
2201
|
+
const b = {
|
|
2202
|
+
applicantId: t,
|
|
2203
|
+
restart: !1,
|
|
2204
|
+
redirectUrl: p,
|
|
2205
|
+
ttl: m
|
|
2206
|
+
}, y = await e.identityCompanyRequest(b);
|
|
2207
|
+
return a(y), y;
|
|
2208
|
+
} catch (b) {
|
|
2209
|
+
throw l(b), b;
|
|
2210
|
+
} finally {
|
|
2211
|
+
i(!1);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
},
|
|
2215
|
+
[t, e]
|
|
2216
|
+
), g = q(async () => {
|
|
2217
|
+
if (t) {
|
|
2218
|
+
i(!0), l(null);
|
|
2219
|
+
try {
|
|
2220
|
+
const p = {
|
|
2221
|
+
applicantId: t,
|
|
2222
|
+
restart: !0,
|
|
2223
|
+
redirectUrl: "",
|
|
2224
|
+
ttl: 604800
|
|
2225
|
+
// 7 days
|
|
2226
|
+
};
|
|
2227
|
+
console.log("Restarting identity with input:", p);
|
|
2228
|
+
const m = await e.identityRequest(p);
|
|
2229
|
+
return console.log("Restart identity result:", m), a(m), m;
|
|
2230
|
+
} catch (p) {
|
|
2231
|
+
throw l(p), p;
|
|
2232
|
+
} finally {
|
|
2233
|
+
i(!1);
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
}, [t, e]);
|
|
2237
|
+
return {
|
|
2238
|
+
identityData: r,
|
|
2239
|
+
provider: (r == null ? void 0 : r.provider) || null,
|
|
2240
|
+
token: (r == null ? void 0 : r.publicProviderTokenObject) || null,
|
|
2241
|
+
isLoading: s,
|
|
2242
|
+
error: c,
|
|
2243
|
+
requestIdentity: d,
|
|
2244
|
+
requestCompanyIdentity: u,
|
|
2245
|
+
restartIdentity: g
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
function Jt(t) {
|
|
2249
|
+
const { riskScoringService: e } = ie(), [r, a] = v(null), [s, i] = v(!1), [c, l] = v(!1), [d, u] = v(null), [g, p] = v(null), m = q(async () => {
|
|
2250
|
+
if (t) {
|
|
2251
|
+
i(!0), u(null);
|
|
2252
|
+
try {
|
|
2253
|
+
const y = await e.getRiskCriterias(t);
|
|
2254
|
+
a(y);
|
|
2255
|
+
} catch (y) {
|
|
2256
|
+
u(y);
|
|
2257
|
+
} finally {
|
|
2258
|
+
i(!1);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
}, [t, e]);
|
|
2262
|
+
V(() => {
|
|
2263
|
+
t && m();
|
|
2264
|
+
}, [t, m]);
|
|
2265
|
+
const b = q(
|
|
2266
|
+
async (y) => {
|
|
2267
|
+
l(!0), u(null);
|
|
2268
|
+
try {
|
|
2269
|
+
const x = await e.submitRiskScoring(y);
|
|
2270
|
+
return p(x), x;
|
|
2271
|
+
} catch (x) {
|
|
2272
|
+
throw u(x), x;
|
|
2273
|
+
} finally {
|
|
2274
|
+
l(!1);
|
|
2275
|
+
}
|
|
2276
|
+
},
|
|
2277
|
+
[e]
|
|
2278
|
+
);
|
|
2279
|
+
return {
|
|
2280
|
+
criteria: r,
|
|
2281
|
+
result: g,
|
|
2282
|
+
isLoading: s,
|
|
2283
|
+
isSubmitting: c,
|
|
2284
|
+
error: d,
|
|
2285
|
+
load: m,
|
|
2286
|
+
submit: b
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
function Xt() {
|
|
2290
|
+
const { applicantService: t, config: e } = ie(), [r, a] = v(!1), [s, i] = v(null), c = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(p) {
|
|
2291
|
+
const m = Math.random() * 16 | 0;
|
|
2292
|
+
return (p === "x" ? m : m & 3 | 8).toString(16);
|
|
2293
|
+
}), l = q(
|
|
2294
|
+
async (p) => {
|
|
2295
|
+
var m;
|
|
2296
|
+
a(!0), i(null);
|
|
2297
|
+
try {
|
|
2298
|
+
if (p.applicantAdditionalDatas || (p.applicantAdditionalDatas = []), (m = e.identityProviders) != null && m.sardinai) {
|
|
2299
|
+
const y = c();
|
|
2300
|
+
console.log("[SardinAI] Generated session key:", y), p.applicantAdditionalDatas.push({
|
|
2301
|
+
paramName: "sessionKey",
|
|
2302
|
+
value: y
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
return await t.createApplicant(p);
|
|
2306
|
+
} catch (b) {
|
|
2307
|
+
throw i(b), b;
|
|
2308
|
+
} finally {
|
|
2309
|
+
a(!1);
|
|
2310
|
+
}
|
|
2311
|
+
},
|
|
2312
|
+
[t, e]
|
|
2313
|
+
), d = q(
|
|
2314
|
+
async (p) => {
|
|
2315
|
+
a(!0), i(null);
|
|
2316
|
+
try {
|
|
2317
|
+
return await t.createCompanyApplicant(p);
|
|
2318
|
+
} catch (m) {
|
|
2319
|
+
throw i(m), m;
|
|
2320
|
+
} finally {
|
|
2321
|
+
a(!1);
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
[t]
|
|
2325
|
+
), u = q(
|
|
2326
|
+
async (p) => {
|
|
2327
|
+
a(!0), i(null);
|
|
2328
|
+
try {
|
|
2329
|
+
return await t.getApplicantData(p);
|
|
2330
|
+
} catch (m) {
|
|
2331
|
+
throw i(m), m;
|
|
2332
|
+
} finally {
|
|
2333
|
+
a(!1);
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
[t]
|
|
2337
|
+
), g = q(
|
|
2338
|
+
async (p) => {
|
|
2339
|
+
a(!0), i(null);
|
|
2340
|
+
try {
|
|
2341
|
+
await t.stopProgress(p);
|
|
2342
|
+
} catch (m) {
|
|
2343
|
+
throw i(m), m;
|
|
2344
|
+
} finally {
|
|
2345
|
+
a(!1);
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
[t]
|
|
2349
|
+
);
|
|
2350
|
+
return {
|
|
2351
|
+
isLoading: r,
|
|
2352
|
+
error: s,
|
|
2353
|
+
createApplicant: l,
|
|
2354
|
+
createCompanyApplicant: d,
|
|
2355
|
+
getApplicantData: u,
|
|
2356
|
+
stopProgress: g
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
const j = ({
|
|
2360
|
+
children: t,
|
|
2361
|
+
variant: e = "primary",
|
|
2362
|
+
size: r = "md",
|
|
2363
|
+
isLoading: a = !1,
|
|
2364
|
+
disabled: s,
|
|
2365
|
+
className: i,
|
|
2366
|
+
...c
|
|
2367
|
+
}) => {
|
|
2368
|
+
const l = "inline-flex items-center justify-center rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed", d = {
|
|
2369
|
+
primary: "bg-primary-500 text-white hover:bg-primary-600 focus:ring-primary-500",
|
|
2370
|
+
secondary: "bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-400",
|
|
2371
|
+
outline: "border-2 border-primary-500 text-primary-500 hover:bg-primary-50 focus:ring-primary-500",
|
|
2372
|
+
danger: "bg-danger-500 text-white hover:bg-danger-600 focus:ring-danger-500",
|
|
2373
|
+
ghost: "text-gray-700 hover:bg-gray-100 focus:ring-gray-400"
|
|
2374
|
+
}, u = {
|
|
2375
|
+
sm: "px-3 py-1.5 text-sm",
|
|
2376
|
+
md: "px-4 py-2 text-base",
|
|
2377
|
+
lg: "px-6 py-3 text-lg"
|
|
2378
|
+
};
|
|
2379
|
+
return /* @__PURE__ */ o(
|
|
2380
|
+
"button",
|
|
2381
|
+
{
|
|
2382
|
+
className: J(l, d[e], u[r], i),
|
|
2383
|
+
disabled: s || a,
|
|
2384
|
+
...c,
|
|
2385
|
+
children: [
|
|
2386
|
+
a && /* @__PURE__ */ o(
|
|
2387
|
+
"svg",
|
|
2388
|
+
{
|
|
2389
|
+
className: "animate-spin -ml-1 mr-2 h-4 w-4",
|
|
2390
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2391
|
+
fill: "none",
|
|
2392
|
+
viewBox: "0 0 24 24",
|
|
2393
|
+
children: [
|
|
2394
|
+
/* @__PURE__ */ n(
|
|
2395
|
+
"circle",
|
|
2396
|
+
{
|
|
2397
|
+
className: "opacity-25",
|
|
2398
|
+
cx: "12",
|
|
2399
|
+
cy: "12",
|
|
2400
|
+
r: "10",
|
|
2401
|
+
stroke: "currentColor",
|
|
2402
|
+
strokeWidth: "4"
|
|
2403
|
+
}
|
|
2404
|
+
),
|
|
2405
|
+
/* @__PURE__ */ n(
|
|
2406
|
+
"path",
|
|
2407
|
+
{
|
|
2408
|
+
className: "opacity-75",
|
|
2409
|
+
fill: "currentColor",
|
|
2410
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
2411
|
+
}
|
|
2412
|
+
)
|
|
2413
|
+
]
|
|
2414
|
+
}
|
|
2415
|
+
),
|
|
2416
|
+
t
|
|
2417
|
+
]
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
}, G = Re(
|
|
2421
|
+
({ label: t, error: e, helperText: r, leftIcon: a, rightIcon: s, className: i, ...c }, l) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2422
|
+
t && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2423
|
+
t,
|
|
2424
|
+
c.required && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
2425
|
+
] }),
|
|
2426
|
+
/* @__PURE__ */ o("div", { className: "relative", children: [
|
|
2427
|
+
a && /* @__PURE__ */ n("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: a }),
|
|
2428
|
+
/* @__PURE__ */ n(
|
|
2429
|
+
"input",
|
|
2430
|
+
{
|
|
2431
|
+
ref: l,
|
|
2432
|
+
className: J(
|
|
2433
|
+
"block w-full rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
2434
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
2435
|
+
"disabled:bg-gray-100 disabled:cursor-not-allowed",
|
|
2436
|
+
e ? "border-danger-500 focus:ring-danger-500" : "border-gray-300 dark:border-gray-600",
|
|
2437
|
+
"dark:bg-gray-800 dark:text-white",
|
|
2438
|
+
a ? "pl-10" : "",
|
|
2439
|
+
s ? "pr-10" : "",
|
|
2440
|
+
i
|
|
2441
|
+
),
|
|
2442
|
+
...c
|
|
2443
|
+
}
|
|
2444
|
+
),
|
|
2445
|
+
s && /* @__PURE__ */ n("div", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none", children: s })
|
|
2446
|
+
] }),
|
|
2447
|
+
e && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-danger-500", children: e }),
|
|
2448
|
+
!e && r && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-gray-500", children: r })
|
|
2449
|
+
] })
|
|
2450
|
+
);
|
|
2451
|
+
G.displayName = "Input";
|
|
2452
|
+
const L = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n(
|
|
2453
|
+
"div",
|
|
2454
|
+
{
|
|
2455
|
+
className: J(
|
|
2456
|
+
"bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700",
|
|
2457
|
+
e
|
|
2458
|
+
),
|
|
2459
|
+
...r,
|
|
2460
|
+
children: t
|
|
2461
|
+
}
|
|
2462
|
+
), Z = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n("div", { className: J("px-6 py-4 border-b border-gray-200 dark:border-gray-700", e), ...r, children: t }), T = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n("div", { className: J("px-6 py-4", e), ...r, children: t }), te = ({ children: t, className: e, ...r }) => /* @__PURE__ */ n("div", { className: J("px-6 py-4 border-t border-gray-200 dark:border-gray-700", e), ...r, children: t }), ue = ({ children: t, variant: e = "default", className: r, ...a }) => /* @__PURE__ */ n(
|
|
2463
|
+
"span",
|
|
2464
|
+
{
|
|
2465
|
+
className: J(
|
|
2466
|
+
"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
|
|
2467
|
+
{
|
|
2468
|
+
default: "bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300",
|
|
2469
|
+
success: "bg-success-100 text-success-800 dark:bg-success-900 dark:text-success-300",
|
|
2470
|
+
danger: "bg-danger-100 text-danger-800 dark:bg-danger-900 dark:text-danger-300",
|
|
2471
|
+
warning: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300",
|
|
2472
|
+
info: "bg-primary-100 text-primary-800 dark:bg-primary-900 dark:text-primary-300"
|
|
2473
|
+
}[e],
|
|
2474
|
+
r
|
|
2475
|
+
),
|
|
2476
|
+
...a,
|
|
2477
|
+
children: t
|
|
2478
|
+
}
|
|
2479
|
+
), se = ({ size: t = "md", className: e, ...r }) => {
|
|
2480
|
+
const a = {
|
|
2481
|
+
sm: "h-4 w-4",
|
|
2482
|
+
md: "h-8 w-8",
|
|
2483
|
+
lg: "h-12 w-12"
|
|
2484
|
+
};
|
|
2485
|
+
return /* @__PURE__ */ n("div", { className: J("flex items-center justify-center", e), ...r, children: /* @__PURE__ */ o(
|
|
2486
|
+
"svg",
|
|
2487
|
+
{
|
|
2488
|
+
className: J("animate-spin text-primary-500", a[t]),
|
|
2489
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2490
|
+
fill: "none",
|
|
2491
|
+
viewBox: "0 0 24 24",
|
|
2492
|
+
children: [
|
|
2493
|
+
/* @__PURE__ */ n(
|
|
2494
|
+
"circle",
|
|
2495
|
+
{
|
|
2496
|
+
className: "opacity-25",
|
|
2497
|
+
cx: "12",
|
|
2498
|
+
cy: "12",
|
|
2499
|
+
r: "10",
|
|
2500
|
+
stroke: "currentColor",
|
|
2501
|
+
strokeWidth: "4"
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
/* @__PURE__ */ n(
|
|
2505
|
+
"path",
|
|
2506
|
+
{
|
|
2507
|
+
className: "opacity-75",
|
|
2508
|
+
fill: "currentColor",
|
|
2509
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
2510
|
+
}
|
|
2511
|
+
)
|
|
2512
|
+
]
|
|
2513
|
+
}
|
|
2514
|
+
) });
|
|
2515
|
+
}, ye = Re(
|
|
2516
|
+
({ label: t, error: e, helperText: r, options: a, placeholder: s, className: i, ...c }, l) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2517
|
+
t && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2518
|
+
t,
|
|
2519
|
+
c.required && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
2520
|
+
] }),
|
|
2521
|
+
/* @__PURE__ */ o(
|
|
2522
|
+
"select",
|
|
2523
|
+
{
|
|
2524
|
+
ref: l,
|
|
2525
|
+
className: J(
|
|
2526
|
+
"block w-full rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
2527
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
2528
|
+
"disabled:bg-gray-100 disabled:cursor-not-allowed",
|
|
2529
|
+
e ? "border-danger-500 focus:ring-danger-500" : "border-gray-300 dark:border-gray-600",
|
|
2530
|
+
"dark:bg-gray-800 dark:text-white",
|
|
2531
|
+
i
|
|
2532
|
+
),
|
|
2533
|
+
...c,
|
|
2534
|
+
children: [
|
|
2535
|
+
s && /* @__PURE__ */ n("option", { value: "", disabled: !0, children: s }, "__placeholder__"),
|
|
2536
|
+
a.map((d, u) => /* @__PURE__ */ n(
|
|
2537
|
+
"option",
|
|
2538
|
+
{
|
|
2539
|
+
value: d.value,
|
|
2540
|
+
disabled: d.disabled,
|
|
2541
|
+
children: d.label
|
|
2542
|
+
},
|
|
2543
|
+
d.value || `option-${u}`
|
|
2544
|
+
))
|
|
2545
|
+
]
|
|
2546
|
+
}
|
|
2547
|
+
),
|
|
2548
|
+
e && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-danger-500", children: e }),
|
|
2549
|
+
!e && r && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-gray-500", children: r })
|
|
2550
|
+
] })
|
|
2551
|
+
);
|
|
2552
|
+
ye.displayName = "Select";
|
|
2553
|
+
const er = ({
|
|
2554
|
+
label: t,
|
|
2555
|
+
error: e,
|
|
2556
|
+
accept: r,
|
|
2557
|
+
multiple: a = !1,
|
|
2558
|
+
maxSize: s,
|
|
2559
|
+
onChange: i,
|
|
2560
|
+
value: c = [],
|
|
2561
|
+
className: l
|
|
2562
|
+
}) => {
|
|
2563
|
+
const [d, u] = v(!1), g = ze(null), p = (h) => {
|
|
2564
|
+
if (!h) return;
|
|
2565
|
+
const N = Array.from(h);
|
|
2566
|
+
if (s && N.filter((E) => E.size > s).length > 0) {
|
|
2567
|
+
const E = Ce(s);
|
|
2568
|
+
alert(`Some files exceed the maximum size of ${E}`);
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2571
|
+
i == null || i(a ? [...c, ...N] : [N[0]]);
|
|
2572
|
+
}, m = (h) => {
|
|
2573
|
+
h.preventDefault(), u(!0);
|
|
2574
|
+
}, b = () => {
|
|
2575
|
+
u(!1);
|
|
2576
|
+
}, y = (h) => {
|
|
2577
|
+
h.preventDefault(), u(!1), p(h.dataTransfer.files);
|
|
2578
|
+
}, x = () => {
|
|
2579
|
+
var h;
|
|
2580
|
+
(h = g.current) == null || h.click();
|
|
2581
|
+
}, R = (h) => {
|
|
2582
|
+
const N = c.filter((w, E) => E !== h);
|
|
2583
|
+
i == null || i(N);
|
|
2584
|
+
};
|
|
2585
|
+
return /* @__PURE__ */ o("div", { className: J("w-full", l), children: [
|
|
2586
|
+
t && /* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: t }),
|
|
2587
|
+
/* @__PURE__ */ o(
|
|
2588
|
+
"div",
|
|
2589
|
+
{
|
|
2590
|
+
className: J(
|
|
2591
|
+
"border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors",
|
|
2592
|
+
d ? "border-primary-500 bg-primary-50 dark:bg-primary-900/20" : "border-gray-300 dark:border-gray-600 hover:border-primary-500",
|
|
2593
|
+
e && "border-danger-500"
|
|
2594
|
+
),
|
|
2595
|
+
onDragOver: m,
|
|
2596
|
+
onDragLeave: b,
|
|
2597
|
+
onDrop: y,
|
|
2598
|
+
onClick: x,
|
|
2599
|
+
children: [
|
|
2600
|
+
/* @__PURE__ */ n(
|
|
2601
|
+
"input",
|
|
2602
|
+
{
|
|
2603
|
+
ref: g,
|
|
2604
|
+
type: "file",
|
|
2605
|
+
className: "hidden",
|
|
2606
|
+
accept: r,
|
|
2607
|
+
multiple: a,
|
|
2608
|
+
onChange: (h) => p(h.target.files)
|
|
2609
|
+
}
|
|
2610
|
+
),
|
|
2611
|
+
/* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
2612
|
+
/* @__PURE__ */ n(
|
|
2613
|
+
"svg",
|
|
2614
|
+
{
|
|
2615
|
+
className: "mx-auto h-12 w-12 text-gray-400",
|
|
2616
|
+
stroke: "currentColor",
|
|
2617
|
+
fill: "none",
|
|
2618
|
+
viewBox: "0 0 48 48",
|
|
2619
|
+
children: /* @__PURE__ */ n(
|
|
2620
|
+
"path",
|
|
2621
|
+
{
|
|
2622
|
+
d: "M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",
|
|
2623
|
+
strokeWidth: 2,
|
|
2624
|
+
strokeLinecap: "round",
|
|
2625
|
+
strokeLinejoin: "round"
|
|
2626
|
+
}
|
|
2627
|
+
)
|
|
2628
|
+
}
|
|
2629
|
+
),
|
|
2630
|
+
/* @__PURE__ */ o("div", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
|
|
2631
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-primary-500", children: "Click to upload" }),
|
|
2632
|
+
" or drag and drop"
|
|
2633
|
+
] }),
|
|
2634
|
+
s && /* @__PURE__ */ o("p", { className: "text-xs text-gray-500", children: [
|
|
2635
|
+
"Maximum file size: ",
|
|
2636
|
+
Ce(s)
|
|
2637
|
+
] })
|
|
2638
|
+
] })
|
|
2639
|
+
]
|
|
2640
|
+
}
|
|
2641
|
+
),
|
|
2642
|
+
c.length > 0 && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2", children: c.map((h, N) => /* @__PURE__ */ o(
|
|
2643
|
+
"div",
|
|
2644
|
+
{
|
|
2645
|
+
className: "flex items-center justify-between px-3 py-2 bg-gray-50 dark:bg-gray-700 rounded-lg",
|
|
2646
|
+
children: [
|
|
2647
|
+
/* @__PURE__ */ o("div", { className: "flex items-center space-x-2 flex-1 min-w-0", children: [
|
|
2648
|
+
/* @__PURE__ */ n(
|
|
2649
|
+
"svg",
|
|
2650
|
+
{
|
|
2651
|
+
className: "h-5 w-5 text-gray-400 flex-shrink-0",
|
|
2652
|
+
fill: "currentColor",
|
|
2653
|
+
viewBox: "0 0 20 20",
|
|
2654
|
+
children: /* @__PURE__ */ n(
|
|
2655
|
+
"path",
|
|
2656
|
+
{
|
|
2657
|
+
fillRule: "evenodd",
|
|
2658
|
+
d: "M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4z",
|
|
2659
|
+
clipRule: "evenodd"
|
|
2660
|
+
}
|
|
2661
|
+
)
|
|
2662
|
+
}
|
|
2663
|
+
),
|
|
2664
|
+
/* @__PURE__ */ n("span", { className: "text-sm text-gray-700 dark:text-gray-300 truncate", children: h.name }),
|
|
2665
|
+
/* @__PURE__ */ o("span", { className: "text-xs text-gray-500", children: [
|
|
2666
|
+
"(",
|
|
2667
|
+
Ce(h.size),
|
|
2668
|
+
")"
|
|
2669
|
+
] })
|
|
2670
|
+
] }),
|
|
2671
|
+
/* @__PURE__ */ n(
|
|
2672
|
+
"button",
|
|
2673
|
+
{
|
|
2674
|
+
type: "button",
|
|
2675
|
+
onClick: (w) => {
|
|
2676
|
+
w.stopPropagation(), R(N);
|
|
2677
|
+
},
|
|
2678
|
+
className: "ml-2 text-danger-500 hover:text-danger-700 focus:outline-none",
|
|
2679
|
+
children: /* @__PURE__ */ n("svg", { className: "h-5 w-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ n(
|
|
2680
|
+
"path",
|
|
2681
|
+
{
|
|
2682
|
+
fillRule: "evenodd",
|
|
2683
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
2684
|
+
clipRule: "evenodd"
|
|
2685
|
+
}
|
|
2686
|
+
) })
|
|
2687
|
+
}
|
|
2688
|
+
)
|
|
2689
|
+
]
|
|
2690
|
+
},
|
|
2691
|
+
N
|
|
2692
|
+
)) }),
|
|
2693
|
+
e && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-danger-500", children: e })
|
|
2694
|
+
] });
|
|
2695
|
+
}, tr = Re(
|
|
2696
|
+
({ countryCode: t = "+1", onCountryCodeChange: e, className: r, ...a }, s) => /* @__PURE__ */ o("div", { className: "w-full", children: [
|
|
2697
|
+
a.label && /* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
2698
|
+
a.label,
|
|
2699
|
+
a.required && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
2700
|
+
] }),
|
|
2701
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: [
|
|
2702
|
+
/* @__PURE__ */ n(
|
|
2703
|
+
"input",
|
|
2704
|
+
{
|
|
2705
|
+
type: "text",
|
|
2706
|
+
value: t,
|
|
2707
|
+
onChange: (i) => e == null ? void 0 : e(i.target.value),
|
|
2708
|
+
className: J(
|
|
2709
|
+
"w-20 rounded-lg border px-3 py-2 text-sm",
|
|
2710
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",
|
|
2711
|
+
"border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-white"
|
|
2712
|
+
),
|
|
2713
|
+
placeholder: "+1"
|
|
2714
|
+
}
|
|
2715
|
+
),
|
|
2716
|
+
/* @__PURE__ */ n(
|
|
2717
|
+
G,
|
|
2718
|
+
{
|
|
2719
|
+
ref: s,
|
|
2720
|
+
type: "tel",
|
|
2721
|
+
className: J("flex-1", r),
|
|
2722
|
+
...a,
|
|
2723
|
+
label: ""
|
|
2724
|
+
}
|
|
2725
|
+
)
|
|
2726
|
+
] }),
|
|
2727
|
+
a.error && /* @__PURE__ */ n("p", { className: "mt-1 text-sm text-danger-500", children: a.error })
|
|
2728
|
+
] })
|
|
2729
|
+
);
|
|
2730
|
+
tr.displayName = "PhoneInput";
|
|
2731
|
+
const Fe = (t, e, r) => {
|
|
2732
|
+
if (t && "reportValidity" in t) {
|
|
2733
|
+
const a = Ae(r, e);
|
|
2734
|
+
t.setCustomValidity(a && a.message || ""), t.reportValidity();
|
|
2735
|
+
}
|
|
2736
|
+
}, Ie = (t, e) => {
|
|
2737
|
+
for (const r in e.fields) {
|
|
2738
|
+
const a = e.fields[r];
|
|
2739
|
+
a && a.ref && "reportValidity" in a.ref ? Fe(a.ref, r, t) : a && a.refs && a.refs.forEach((s) => Fe(s, r, t));
|
|
2740
|
+
}
|
|
2741
|
+
}, Le = (t, e) => {
|
|
2742
|
+
e.shouldUseNativeValidation && Ie(t, e);
|
|
2743
|
+
const r = {};
|
|
2744
|
+
for (const a in t) {
|
|
2745
|
+
const s = Ae(e.fields, a), i = Object.assign(t[a] || {}, { ref: s && s.ref });
|
|
2746
|
+
if (rr(e.names || Object.keys(t), a)) {
|
|
2747
|
+
const c = Object.assign({}, Ae(r, a));
|
|
2748
|
+
Se(c, "root", i), Se(r, a, c);
|
|
2749
|
+
} else Se(r, a, i);
|
|
2750
|
+
}
|
|
2751
|
+
return r;
|
|
2752
|
+
}, rr = (t, e) => {
|
|
2753
|
+
const r = Te(e);
|
|
2754
|
+
return t.some((a) => Te(a).match(`^${r}\\.\\d+`));
|
|
2755
|
+
};
|
|
2756
|
+
function Te(t) {
|
|
2757
|
+
return t.replace(/\]|\[/g, "");
|
|
2758
|
+
}
|
|
2759
|
+
function Ue(t, e, r) {
|
|
2760
|
+
function a(l, d) {
|
|
2761
|
+
var u;
|
|
2762
|
+
Object.defineProperty(l, "_zod", {
|
|
2763
|
+
value: l._zod ?? {},
|
|
2764
|
+
enumerable: !1
|
|
2765
|
+
}), (u = l._zod).traits ?? (u.traits = /* @__PURE__ */ new Set()), l._zod.traits.add(t), e(l, d);
|
|
2766
|
+
for (const g in c.prototype)
|
|
2767
|
+
g in l || Object.defineProperty(l, g, { value: c.prototype[g].bind(l) });
|
|
2768
|
+
l._zod.constr = c, l._zod.def = d;
|
|
2769
|
+
}
|
|
2770
|
+
const s = (r == null ? void 0 : r.Parent) ?? Object;
|
|
2771
|
+
class i extends s {
|
|
2772
|
+
}
|
|
2773
|
+
Object.defineProperty(i, "name", { value: t });
|
|
2774
|
+
function c(l) {
|
|
2775
|
+
var d;
|
|
2776
|
+
const u = r != null && r.Parent ? new i() : this;
|
|
2777
|
+
a(u, l), (d = u._zod).deferred ?? (d.deferred = []);
|
|
2778
|
+
for (const g of u._zod.deferred)
|
|
2779
|
+
g();
|
|
2780
|
+
return u;
|
|
2781
|
+
}
|
|
2782
|
+
return Object.defineProperty(c, "init", { value: a }), Object.defineProperty(c, Symbol.hasInstance, {
|
|
2783
|
+
value: (l) => {
|
|
2784
|
+
var d, u;
|
|
2785
|
+
return r != null && r.Parent && l instanceof r.Parent ? !0 : (u = (d = l == null ? void 0 : l._zod) == null ? void 0 : d.traits) == null ? void 0 : u.has(t);
|
|
2786
|
+
}
|
|
2787
|
+
}), Object.defineProperty(c, "name", { value: t }), c;
|
|
2788
|
+
}
|
|
2789
|
+
class nr extends Error {
|
|
2790
|
+
constructor() {
|
|
2791
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
const ar = {};
|
|
2795
|
+
function Ke(t) {
|
|
2796
|
+
return ar;
|
|
2797
|
+
}
|
|
2798
|
+
function sr(t, e) {
|
|
2799
|
+
return typeof e == "bigint" ? e.toString() : e;
|
|
2800
|
+
}
|
|
2801
|
+
const qe = Error.captureStackTrace ? Error.captureStackTrace : (...t) => {
|
|
2802
|
+
};
|
|
2803
|
+
function we(t) {
|
|
2804
|
+
return typeof t == "string" ? t : t == null ? void 0 : t.message;
|
|
2805
|
+
}
|
|
2806
|
+
function He(t, e, r) {
|
|
2807
|
+
var s, i, c, l, d, u;
|
|
2808
|
+
const a = { ...t, path: t.path ?? [] };
|
|
2809
|
+
if (!t.message) {
|
|
2810
|
+
const g = we((c = (i = (s = t.inst) == null ? void 0 : s._zod.def) == null ? void 0 : i.error) == null ? void 0 : c.call(i, t)) ?? we((l = e == null ? void 0 : e.error) == null ? void 0 : l.call(e, t)) ?? we((d = r.customError) == null ? void 0 : d.call(r, t)) ?? we((u = r.localeError) == null ? void 0 : u.call(r, t)) ?? "Invalid input";
|
|
2811
|
+
a.message = g;
|
|
2812
|
+
}
|
|
2813
|
+
return delete a.inst, delete a.continue, e != null && e.reportInput || delete a.input, a;
|
|
2814
|
+
}
|
|
2815
|
+
const Ve = (t, e) => {
|
|
2816
|
+
t.name = "$ZodError", Object.defineProperty(t, "_zod", {
|
|
2817
|
+
value: t._zod,
|
|
2818
|
+
enumerable: !1
|
|
2819
|
+
}), Object.defineProperty(t, "issues", {
|
|
2820
|
+
value: e,
|
|
2821
|
+
enumerable: !1
|
|
2822
|
+
}), Object.defineProperty(t, "message", {
|
|
2823
|
+
get() {
|
|
2824
|
+
return JSON.stringify(e, sr, 2);
|
|
2825
|
+
},
|
|
2826
|
+
enumerable: !0
|
|
2827
|
+
// configurable: false,
|
|
2828
|
+
}), Object.defineProperty(t, "toString", {
|
|
2829
|
+
value: () => t.message,
|
|
2830
|
+
enumerable: !1
|
|
2831
|
+
});
|
|
2832
|
+
}, ir = Ue("$ZodError", Ve), Ye = Ue("$ZodError", Ve, { Parent: Error }), or = (t) => (e, r, a, s) => {
|
|
2833
|
+
const i = a ? Object.assign(a, { async: !1 }) : { async: !1 }, c = e._zod.run({ value: r, issues: [] }, i);
|
|
2834
|
+
if (c instanceof Promise)
|
|
2835
|
+
throw new nr();
|
|
2836
|
+
if (c.issues.length) {
|
|
2837
|
+
const l = new ((s == null ? void 0 : s.Err) ?? t)(c.issues.map((d) => He(d, i, Ke())));
|
|
2838
|
+
throw qe(l, s == null ? void 0 : s.callee), l;
|
|
2839
|
+
}
|
|
2840
|
+
return c.value;
|
|
2841
|
+
}, lr = /* @__PURE__ */ or(Ye), cr = (t) => async (e, r, a, s) => {
|
|
2842
|
+
const i = a ? Object.assign(a, { async: !0 }) : { async: !0 };
|
|
2843
|
+
let c = e._zod.run({ value: r, issues: [] }, i);
|
|
2844
|
+
if (c instanceof Promise && (c = await c), c.issues.length) {
|
|
2845
|
+
const l = new ((s == null ? void 0 : s.Err) ?? t)(c.issues.map((d) => He(d, i, Ke())));
|
|
2846
|
+
throw qe(l, s == null ? void 0 : s.callee), l;
|
|
2847
|
+
}
|
|
2848
|
+
return c.value;
|
|
2849
|
+
}, dr = /* @__PURE__ */ cr(Ye);
|
|
2850
|
+
function Me(t, e) {
|
|
2851
|
+
try {
|
|
2852
|
+
var r = t();
|
|
2853
|
+
} catch (a) {
|
|
2854
|
+
return e(a);
|
|
2855
|
+
}
|
|
2856
|
+
return r && r.then ? r.then(void 0, e) : r;
|
|
2857
|
+
}
|
|
2858
|
+
function ur(t, e) {
|
|
2859
|
+
for (var r = {}; t.length; ) {
|
|
2860
|
+
var a = t[0], s = a.code, i = a.message, c = a.path.join(".");
|
|
2861
|
+
if (!r[c]) if ("unionErrors" in a) {
|
|
2862
|
+
var l = a.unionErrors[0].errors[0];
|
|
2863
|
+
r[c] = { message: l.message, type: l.code };
|
|
2864
|
+
} else r[c] = { message: i, type: s };
|
|
2865
|
+
if ("unionErrors" in a && a.unionErrors.forEach(function(g) {
|
|
2866
|
+
return g.errors.forEach(function(p) {
|
|
2867
|
+
return t.push(p);
|
|
2868
|
+
});
|
|
2869
|
+
}), e) {
|
|
2870
|
+
var d = r[c].types, u = d && d[a.code];
|
|
2871
|
+
r[c] = _e(c, e, r, s, u ? [].concat(u, a.message) : a.message);
|
|
2872
|
+
}
|
|
2873
|
+
t.shift();
|
|
2874
|
+
}
|
|
2875
|
+
return r;
|
|
2876
|
+
}
|
|
2877
|
+
function mr(t, e) {
|
|
2878
|
+
for (var r = {}; t.length; ) {
|
|
2879
|
+
var a = t[0], s = a.code, i = a.message, c = a.path.join(".");
|
|
2880
|
+
if (!r[c]) if (a.code === "invalid_union" && a.errors.length > 0) {
|
|
2881
|
+
var l = a.errors[0][0];
|
|
2882
|
+
r[c] = { message: l.message, type: l.code };
|
|
2883
|
+
} else r[c] = { message: i, type: s };
|
|
2884
|
+
if (a.code === "invalid_union" && a.errors.forEach(function(g) {
|
|
2885
|
+
return g.forEach(function(p) {
|
|
2886
|
+
return t.push(p);
|
|
2887
|
+
});
|
|
2888
|
+
}), e) {
|
|
2889
|
+
var d = r[c].types, u = d && d[a.code];
|
|
2890
|
+
r[c] = _e(c, e, r, s, u ? [].concat(u, a.message) : a.message);
|
|
2891
|
+
}
|
|
2892
|
+
t.shift();
|
|
2893
|
+
}
|
|
2894
|
+
return r;
|
|
2895
|
+
}
|
|
2896
|
+
function We(t, e, r) {
|
|
2897
|
+
if (r === void 0 && (r = {}), function(a) {
|
|
2898
|
+
return "_def" in a && typeof a._def == "object" && "typeName" in a._def;
|
|
2899
|
+
}(t)) return function(a, s, i) {
|
|
2900
|
+
try {
|
|
2901
|
+
return Promise.resolve(Me(function() {
|
|
2902
|
+
return Promise.resolve(t[r.mode === "sync" ? "parse" : "parseAsync"](a, e)).then(function(c) {
|
|
2903
|
+
return i.shouldUseNativeValidation && Ie({}, i), { errors: {}, values: r.raw ? Object.assign({}, a) : c };
|
|
2904
|
+
});
|
|
2905
|
+
}, function(c) {
|
|
2906
|
+
if (function(l) {
|
|
2907
|
+
return Array.isArray(l == null ? void 0 : l.issues);
|
|
2908
|
+
}(c)) return { values: {}, errors: Le(ur(c.errors, !i.shouldUseNativeValidation && i.criteriaMode === "all"), i) };
|
|
2909
|
+
throw c;
|
|
2910
|
+
}));
|
|
2911
|
+
} catch (c) {
|
|
2912
|
+
return Promise.reject(c);
|
|
2913
|
+
}
|
|
2914
|
+
};
|
|
2915
|
+
if (function(a) {
|
|
2916
|
+
return "_zod" in a && typeof a._zod == "object";
|
|
2917
|
+
}(t)) return function(a, s, i) {
|
|
2918
|
+
try {
|
|
2919
|
+
return Promise.resolve(Me(function() {
|
|
2920
|
+
return Promise.resolve((r.mode === "sync" ? lr : dr)(t, a, e)).then(function(c) {
|
|
2921
|
+
return i.shouldUseNativeValidation && Ie({}, i), { errors: {}, values: r.raw ? Object.assign({}, a) : c };
|
|
2922
|
+
});
|
|
2923
|
+
}, function(c) {
|
|
2924
|
+
if (function(l) {
|
|
2925
|
+
return l instanceof ir;
|
|
2926
|
+
}(c)) return { values: {}, errors: Le(mr(c.issues, !i.shouldUseNativeValidation && i.criteriaMode === "all"), i) };
|
|
2927
|
+
throw c;
|
|
2928
|
+
}));
|
|
2929
|
+
} catch (c) {
|
|
2930
|
+
return Promise.reject(c);
|
|
2931
|
+
}
|
|
2932
|
+
};
|
|
2933
|
+
throw new Error("Invalid input: not a Zod schema");
|
|
2934
|
+
}
|
|
2935
|
+
function hr(t) {
|
|
2936
|
+
return de.object({
|
|
2937
|
+
questionResults: de.any()
|
|
2938
|
+
}).passthrough();
|
|
2939
|
+
}
|
|
2940
|
+
function pr(t) {
|
|
2941
|
+
let e = de.array(de.instanceof(File));
|
|
2942
|
+
if (t.isRequired ? e = e.min(
|
|
2943
|
+
1,
|
|
2944
|
+
`${t.displayName} is required`
|
|
2945
|
+
) : e = e.optional(), t.multipleFile || (e = e.refine(
|
|
2946
|
+
(r) => !r || r.length <= 1,
|
|
2947
|
+
{ message: "Only one file is allowed" }
|
|
2948
|
+
)), t.maxEachFileSizeByte > 0 && (e = e.refine(
|
|
2949
|
+
(r) => !r || r.every((a) => a.size <= t.maxEachFileSizeByte),
|
|
2950
|
+
{ message: `File size must not exceed ${Math.round(t.maxEachFileSizeByte / 1024 / 1024)}MB` }
|
|
2951
|
+
)), t.allowedTypes) {
|
|
2952
|
+
const r = t.allowedTypes.split(",").map((a) => a.trim());
|
|
2953
|
+
e = e.refine(
|
|
2954
|
+
(a) => a ? a.every(
|
|
2955
|
+
(s) => r.some((i) => i.endsWith("/*") ? s.type.startsWith(i.slice(0, -2)) : s.type === i)
|
|
2956
|
+
) : !0,
|
|
2957
|
+
{ message: "Invalid file type" }
|
|
2958
|
+
);
|
|
2959
|
+
}
|
|
2960
|
+
return e;
|
|
2961
|
+
}
|
|
2962
|
+
function jr(t) {
|
|
2963
|
+
const e = {};
|
|
2964
|
+
return t.uploadDocumentFiles.forEach((r) => {
|
|
2965
|
+
const a = `file_${r.id}`;
|
|
2966
|
+
e[a] = pr(r);
|
|
2967
|
+
}), de.object(e);
|
|
2968
|
+
}
|
|
2969
|
+
function gr(t) {
|
|
2970
|
+
return de.any();
|
|
2971
|
+
}
|
|
2972
|
+
function yr(t) {
|
|
2973
|
+
return de.string().min(1, "This question is required");
|
|
2974
|
+
}
|
|
2975
|
+
function $r(t) {
|
|
2976
|
+
const e = {};
|
|
2977
|
+
return t.appropriatenessQuestions.forEach((r) => {
|
|
2978
|
+
const a = `question_${r.id}`;
|
|
2979
|
+
e[a] = yr();
|
|
2980
|
+
}), de.object(e);
|
|
2981
|
+
}
|
|
2982
|
+
const Ur = de.any(), fr = ({
|
|
2983
|
+
applicantId: t,
|
|
2984
|
+
onComplete: e,
|
|
2985
|
+
onBack: r
|
|
2986
|
+
}) => {
|
|
2987
|
+
const { questionnaire: a, isLoading: s, isSubmitting: i, error: c, submit: l } = Wt(t), d = Oe(() => a ? { questionResults: a.questionGroups.map(
|
|
2988
|
+
(x) => x.questions.map((R) => ({
|
|
2989
|
+
questionId: R.id,
|
|
2990
|
+
values: []
|
|
2991
|
+
}))
|
|
2992
|
+
) } : { questionResults: [] }, [a]), u = a ? hr() : null, {
|
|
2993
|
+
control: g,
|
|
2994
|
+
handleSubmit: p,
|
|
2995
|
+
formState: { errors: m }
|
|
2996
|
+
} = De({
|
|
2997
|
+
resolver: u ? We(u) : void 0,
|
|
2998
|
+
defaultValues: d
|
|
2999
|
+
}), b = async (y) => {
|
|
3000
|
+
if (a)
|
|
3001
|
+
try {
|
|
3002
|
+
console.log("Form submitted with data:", y);
|
|
3003
|
+
const x = a.questionGroups.flatMap(
|
|
3004
|
+
(h, N) => h.questions.map((w, E) => {
|
|
3005
|
+
var F, M, I;
|
|
3006
|
+
return {
|
|
3007
|
+
questionId: w.id,
|
|
3008
|
+
values: ((I = (M = (F = y.questionResults) == null ? void 0 : F[N]) == null ? void 0 : M[E]) == null ? void 0 : I.values) || []
|
|
3009
|
+
};
|
|
3010
|
+
})
|
|
3011
|
+
);
|
|
3012
|
+
console.log("Question results to submit:", x);
|
|
3013
|
+
const R = {
|
|
3014
|
+
applicantId: t,
|
|
3015
|
+
questionnarieId: a.id,
|
|
3016
|
+
questionResults: x
|
|
3017
|
+
};
|
|
3018
|
+
console.log("Final input:", R), await l(R), e == null || e();
|
|
3019
|
+
} catch (x) {
|
|
3020
|
+
console.error("Error submitting questionnaire:", x);
|
|
3021
|
+
}
|
|
3022
|
+
};
|
|
3023
|
+
return s ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(se, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3024
|
+
"Error loading questionnaire: ",
|
|
3025
|
+
c.message
|
|
3026
|
+
] }) }) }) : a ? /* @__PURE__ */ n("form", { onSubmit: p(b), children: /* @__PURE__ */ o(L, { children: [
|
|
3027
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3028
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: a.displayName }),
|
|
3029
|
+
a.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: a.subtitle })
|
|
3030
|
+
] }),
|
|
3031
|
+
/* @__PURE__ */ n(T, { className: "space-y-8", children: a.questionGroups.flatMap(
|
|
3032
|
+
(y, x) => y.questions.map((R, h) => {
|
|
3033
|
+
const w = R.defaultAnswers && R.defaultAnswers.length > 0 ? R.showAsDropdown ? R.canMultipleAnswer ? "multi-select" : "single-select" : R.canMultipleAnswer ? "checkbox" : "radio" : "text";
|
|
3034
|
+
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3035
|
+
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3036
|
+
R.text,
|
|
3037
|
+
R.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3038
|
+
] }),
|
|
3039
|
+
w === "text" && /* @__PURE__ */ n(
|
|
3040
|
+
Q,
|
|
3041
|
+
{
|
|
3042
|
+
control: g,
|
|
3043
|
+
name: `questionResults.${x}.${h}.values.0`,
|
|
3044
|
+
render: ({ field: E }) => {
|
|
3045
|
+
var F, M, I, A;
|
|
3046
|
+
return /* @__PURE__ */ n(
|
|
3047
|
+
G,
|
|
3048
|
+
{
|
|
3049
|
+
value: E.value || "",
|
|
3050
|
+
onChange: E.onChange,
|
|
3051
|
+
onBlur: E.onBlur,
|
|
3052
|
+
name: E.name,
|
|
3053
|
+
placeholder: "Enter your answer...",
|
|
3054
|
+
error: (A = (I = (M = (F = m.questionResults) == null ? void 0 : F[x]) == null ? void 0 : M[h]) == null ? void 0 : I.values) == null ? void 0 : A.message
|
|
3055
|
+
}
|
|
3056
|
+
);
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
),
|
|
3060
|
+
(w === "single-select" || w === "radio") && /* @__PURE__ */ n(
|
|
3061
|
+
Q,
|
|
3062
|
+
{
|
|
3063
|
+
control: g,
|
|
3064
|
+
name: `questionResults.${x}.${h}.values.0`,
|
|
3065
|
+
render: ({ field: E }) => {
|
|
3066
|
+
var F, M, I, A;
|
|
3067
|
+
return /* @__PURE__ */ n(
|
|
3068
|
+
ye,
|
|
3069
|
+
{
|
|
3070
|
+
value: E.value || "",
|
|
3071
|
+
onChange: E.onChange,
|
|
3072
|
+
onBlur: E.onBlur,
|
|
3073
|
+
name: E.name,
|
|
3074
|
+
options: R.defaultAnswers.map((B) => ({
|
|
3075
|
+
value: B,
|
|
3076
|
+
label: B
|
|
3077
|
+
})),
|
|
3078
|
+
placeholder: "Select an option...",
|
|
3079
|
+
error: (A = (I = (M = (F = m.questionResults) == null ? void 0 : F[x]) == null ? void 0 : M[h]) == null ? void 0 : I.values) == null ? void 0 : A.message
|
|
3080
|
+
}
|
|
3081
|
+
);
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
),
|
|
3085
|
+
(w === "checkbox" || w === "multi-select") && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3086
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-2", children: "Choose one or more options" }),
|
|
3087
|
+
/* @__PURE__ */ n(
|
|
3088
|
+
Q,
|
|
3089
|
+
{
|
|
3090
|
+
control: g,
|
|
3091
|
+
name: `questionResults.${x}.${h}.values`,
|
|
3092
|
+
render: ({ field: { value: E = [], onChange: F } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: R.defaultAnswers.map((M, I) => /* @__PURE__ */ o(
|
|
3093
|
+
"label",
|
|
3094
|
+
{
|
|
3095
|
+
className: "flex items-center space-x-2 cursor-pointer",
|
|
3096
|
+
children: [
|
|
3097
|
+
/* @__PURE__ */ n(
|
|
3098
|
+
"input",
|
|
3099
|
+
{
|
|
3100
|
+
type: "checkbox",
|
|
3101
|
+
checked: Array.isArray(E) && E.includes(M),
|
|
3102
|
+
onChange: (A) => {
|
|
3103
|
+
const B = Array.isArray(E) ? E : [], z = A.target.checked ? [...B, M] : B.filter((f) => f !== M);
|
|
3104
|
+
F(z);
|
|
3105
|
+
},
|
|
3106
|
+
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3107
|
+
}
|
|
3108
|
+
),
|
|
3109
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: M })
|
|
3110
|
+
]
|
|
3111
|
+
},
|
|
3112
|
+
`answer-${x}-${h}-${I}`
|
|
3113
|
+
)) })
|
|
3114
|
+
}
|
|
3115
|
+
)
|
|
3116
|
+
] })
|
|
3117
|
+
] }, R.id);
|
|
3118
|
+
})
|
|
3119
|
+
) }),
|
|
3120
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3121
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3122
|
+
/* @__PURE__ */ n(
|
|
3123
|
+
j,
|
|
3124
|
+
{
|
|
3125
|
+
type: "submit",
|
|
3126
|
+
isLoading: i,
|
|
3127
|
+
onClick: () => {
|
|
3128
|
+
console.log("Continue button clicked"), console.log("Form errors:", m);
|
|
3129
|
+
},
|
|
3130
|
+
children: "Continue"
|
|
3131
|
+
}
|
|
3132
|
+
)
|
|
3133
|
+
] }),
|
|
3134
|
+
c && /* @__PURE__ */ n("div", { className: "mt-4 p-4 bg-red-50 border border-red-200 rounded", children: /* @__PURE__ */ o("p", { className: "text-red-600 text-sm", children: [
|
|
3135
|
+
"Error: ",
|
|
3136
|
+
c.message
|
|
3137
|
+
] }) })
|
|
3138
|
+
] }) }) : null;
|
|
3139
|
+
}, br = ({
|
|
3140
|
+
applicantId: t,
|
|
3141
|
+
onComplete: e,
|
|
3142
|
+
onBack: r
|
|
3143
|
+
}) => {
|
|
3144
|
+
const { uploadDocument: a, isLoading: s, isSubmitting: i, error: c, submit: l } = Qt(t), [d, u] = v({}), g = async (p) => {
|
|
3145
|
+
if (p.preventDefault(), !a) return;
|
|
3146
|
+
const m = await Promise.all(
|
|
3147
|
+
a.uploadDocumentFiles.map(async (y) => {
|
|
3148
|
+
const x = d[y.id] || [], R = await Promise.all(
|
|
3149
|
+
x.map(async (h) => ({
|
|
3150
|
+
fileName: h.name,
|
|
3151
|
+
fileData: await $t(h)
|
|
3152
|
+
}))
|
|
3153
|
+
);
|
|
3154
|
+
return {
|
|
3155
|
+
uploadDocumentFileId: y.id,
|
|
3156
|
+
valueList: R
|
|
3157
|
+
};
|
|
3158
|
+
})
|
|
3159
|
+
), b = {
|
|
3160
|
+
applicantId: t,
|
|
3161
|
+
uploadDocumentId: a.id,
|
|
3162
|
+
uploadDocumentResults: m
|
|
3163
|
+
};
|
|
3164
|
+
await l(b), e == null || e();
|
|
3165
|
+
};
|
|
3166
|
+
return s ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(se, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3167
|
+
"Error loading document requirements: ",
|
|
3168
|
+
c.message
|
|
3169
|
+
] }) }) }) : a ? /* @__PURE__ */ n("form", { onSubmit: g, children: /* @__PURE__ */ o(L, { children: [
|
|
3170
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3171
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: a.displayName }),
|
|
3172
|
+
a.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: a.subtitle })
|
|
3173
|
+
] }),
|
|
3174
|
+
/* @__PURE__ */ n(T, { className: "space-y-6", children: a.uploadDocumentFiles.map((p) => /* @__PURE__ */ n(
|
|
3175
|
+
er,
|
|
3176
|
+
{
|
|
3177
|
+
label: p.displayName,
|
|
3178
|
+
accept: p.allowedTypes,
|
|
3179
|
+
multiple: p.multipleFile,
|
|
3180
|
+
maxSize: p.maxEachFileSizeByte,
|
|
3181
|
+
value: d[p.id] || [],
|
|
3182
|
+
onChange: (m) => {
|
|
3183
|
+
u((b) => ({ ...b, [p.id]: m }));
|
|
3184
|
+
}
|
|
3185
|
+
},
|
|
3186
|
+
p.id
|
|
3187
|
+
)) }),
|
|
3188
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3189
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3190
|
+
/* @__PURE__ */ n(j, { type: "submit", isLoading: i, children: "Continue" })
|
|
3191
|
+
] })
|
|
3192
|
+
] }) }) : null;
|
|
3193
|
+
}, xr = ({ applicantId: t, onComplete: e, onBack: r }) => {
|
|
3194
|
+
const { overview: a, isLoading: s, isSubmitting: i, error: c, passOverview: l } = Gt(t), d = async () => {
|
|
3195
|
+
await l(), e == null || e();
|
|
3196
|
+
};
|
|
3197
|
+
return s ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ n(se, { className: "my-8" }) }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3198
|
+
"Error loading overview: ",
|
|
3199
|
+
c.message
|
|
3200
|
+
] }) }) }) : a ? /* @__PURE__ */ o(L, { children: [
|
|
3201
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3202
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: a.title || "Overview" }),
|
|
3203
|
+
a.description && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: a.description })
|
|
3204
|
+
] }),
|
|
3205
|
+
/* @__PURE__ */ o(T, { className: "space-y-6", children: [
|
|
3206
|
+
a.steps && a.steps.length > 0 ? /* @__PURE__ */ n("div", { className: "space-y-4", children: a.steps.sort((u, g) => u.order - g.order).map((u) => /* @__PURE__ */ n(
|
|
3207
|
+
"div",
|
|
3208
|
+
{
|
|
3209
|
+
className: "border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gray-50 dark:bg-gray-800",
|
|
3210
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3211
|
+
/* @__PURE__ */ n("div", { className: "flex-shrink-0", children: /* @__PURE__ */ n("div", { className: "w-8 h-8 rounded-full bg-green-500 text-white flex items-center justify-center font-medium", children: "✓" }) }),
|
|
3212
|
+
/* @__PURE__ */ o("div", { className: "ml-4 flex-1", children: [
|
|
3213
|
+
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: u.title }),
|
|
3214
|
+
u.description && /* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: u.description })
|
|
3215
|
+
] })
|
|
3216
|
+
] })
|
|
3217
|
+
},
|
|
3218
|
+
u.order
|
|
3219
|
+
)) }) : /* @__PURE__ */ n("div", { className: "text-center py-8", children: /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: "Loading overview data..." }) }),
|
|
3220
|
+
a.steps && a.steps.length > 0 && /* @__PURE__ */ n("div", { className: "mt-6 p-4 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg", children: /* @__PURE__ */ o("p", { className: "text-green-800 dark:text-green-300 text-sm", children: [
|
|
3221
|
+
/* @__PURE__ */ n("strong", { children: "✓ All steps completed!" }),
|
|
3222
|
+
" Review the information above and confirm to proceed."
|
|
3223
|
+
] }) })
|
|
3224
|
+
] }),
|
|
3225
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3226
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3227
|
+
/* @__PURE__ */ n(j, { onClick: d, isLoading: i, children: "Confirm and Continue" })
|
|
3228
|
+
] })
|
|
3229
|
+
] }) : null;
|
|
3230
|
+
}, vr = ({
|
|
3231
|
+
applicantId: t,
|
|
3232
|
+
onComplete: e,
|
|
3233
|
+
onBack: r
|
|
3234
|
+
}) => {
|
|
3235
|
+
const { criteria: a, isLoading: s, isSubmitting: i, error: c, submit: l } = Jt(t), [d, u] = ce.useState(!1), g = ce.useMemo(() => !a || a.length === 0 ? { criteriaValueInputs: [] } : {
|
|
3236
|
+
criteriaValueInputs: a.map((h) => ({
|
|
3237
|
+
riskCriteriaId: h.id,
|
|
3238
|
+
values: [""]
|
|
3239
|
+
// Initialize with empty string to prevent uncontrolled input warning
|
|
3240
|
+
}))
|
|
3241
|
+
}, [a]), p = a && a.length > 0 ? gr() : null, {
|
|
3242
|
+
control: m,
|
|
3243
|
+
handleSubmit: b,
|
|
3244
|
+
formState: { errors: y }
|
|
3245
|
+
} = De({
|
|
3246
|
+
resolver: p ? We(p) : void 0,
|
|
3247
|
+
defaultValues: g
|
|
3248
|
+
});
|
|
3249
|
+
ce.useEffect(() => {
|
|
3250
|
+
!s && a && a.length === 0 && !d && !i && (u(!0), l({ applicantId: t, criteriaValueInputs: [] }).then(() => e == null ? void 0 : e()).catch(console.error));
|
|
3251
|
+
}, [s, a, d, i, l, t, e]);
|
|
3252
|
+
const x = async (h) => {
|
|
3253
|
+
if (a)
|
|
3254
|
+
try {
|
|
3255
|
+
console.log("Risk scoring form submitted:", h), console.log("Criteria metadata:", a);
|
|
3256
|
+
const N = h.criteriaValueInputs.map((E, F) => {
|
|
3257
|
+
const M = E.values || [], I = Array.isArray(M) ? M.filter((A) => A && A.trim()) : M && M.toString().trim() ? [M.toString()] : [];
|
|
3258
|
+
return I.length === 0 ? null : {
|
|
3259
|
+
riskCriteriaId: a[F].id,
|
|
3260
|
+
values: I
|
|
3261
|
+
};
|
|
3262
|
+
}).filter((E) => E !== null);
|
|
3263
|
+
console.log("Risk scoring criteriaValueInputs to submit:", N);
|
|
3264
|
+
const w = {
|
|
3265
|
+
applicantId: t,
|
|
3266
|
+
criteriaValueInputs: N
|
|
3267
|
+
};
|
|
3268
|
+
console.log("Final risk scoring input:", w), await l(w), console.log("Risk scoring submitted successfully!"), e == null || e();
|
|
3269
|
+
} catch (N) {
|
|
3270
|
+
throw console.error("Error submitting risk scoring:", N), N;
|
|
3271
|
+
}
|
|
3272
|
+
}, R = (h) => h.builtInType === 1 ? "country" : !h.defaultValues || h.defaultValues.length === 0 ? "text" : h.multipleValue ? "checkbox" : "radio";
|
|
3273
|
+
return s ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3274
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
3275
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading risk scoring criteria..." })
|
|
3276
|
+
] }) }) : c ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3277
|
+
"Error loading criteria: ",
|
|
3278
|
+
c.message
|
|
3279
|
+
] }) }) }) : !s && a && a.length === 0 ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3280
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
3281
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400", children: "No risk scoring criteria required. Moving to next step..." })
|
|
3282
|
+
] }) }) : a ? /* @__PURE__ */ n("form", { onSubmit: b(x), children: /* @__PURE__ */ o(L, { children: [
|
|
3283
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3284
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Risk Assessment" }),
|
|
3285
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please answer the following questions for risk evaluation" })
|
|
3286
|
+
] }),
|
|
3287
|
+
/* @__PURE__ */ n(T, { className: "space-y-8", children: a.map((h, N) => {
|
|
3288
|
+
var E, F, M;
|
|
3289
|
+
const w = R(h);
|
|
3290
|
+
return /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3291
|
+
/* @__PURE__ */ o("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
3292
|
+
h.displayName,
|
|
3293
|
+
h.isRequired && /* @__PURE__ */ n("span", { className: "text-danger-500 ml-1", children: "*" })
|
|
3294
|
+
] }),
|
|
3295
|
+
h.description && /* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: h.description }),
|
|
3296
|
+
w === "text" && /* @__PURE__ */ n(
|
|
3297
|
+
Q,
|
|
3298
|
+
{
|
|
3299
|
+
control: m,
|
|
3300
|
+
name: `criteriaValueInputs.${N}.values.0`,
|
|
3301
|
+
render: ({ field: I }) => {
|
|
3302
|
+
var A, B, z;
|
|
3303
|
+
return /* @__PURE__ */ n(
|
|
3304
|
+
G,
|
|
3305
|
+
{
|
|
3306
|
+
...I,
|
|
3307
|
+
value: I.value || "",
|
|
3308
|
+
type: h.valueDataType === Ee.DigitOnly ? "number" : "text",
|
|
3309
|
+
placeholder: "Enter your answer...",
|
|
3310
|
+
error: (z = (B = (A = y.criteriaValueInputs) == null ? void 0 : A[N]) == null ? void 0 : B.values) == null ? void 0 : z.message,
|
|
3311
|
+
onKeyDown: (f) => {
|
|
3312
|
+
h.valueDataType === Ee.DigitOnly && ["e", "E", "+", "-", "."].includes(f.key) && f.preventDefault();
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
);
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
),
|
|
3319
|
+
w === "radio" && h.defaultValues && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3320
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Choose one option" }),
|
|
3321
|
+
/* @__PURE__ */ n(
|
|
3322
|
+
Q,
|
|
3323
|
+
{
|
|
3324
|
+
control: m,
|
|
3325
|
+
name: `criteriaValueInputs.${N}.values.0`,
|
|
3326
|
+
render: ({ field: { value: I, onChange: A } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: h.defaultValues.map((B, z) => /* @__PURE__ */ o("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
3327
|
+
/* @__PURE__ */ n(
|
|
3328
|
+
"input",
|
|
3329
|
+
{
|
|
3330
|
+
type: "radio",
|
|
3331
|
+
checked: I === B,
|
|
3332
|
+
onChange: () => A(B),
|
|
3333
|
+
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3334
|
+
}
|
|
3335
|
+
),
|
|
3336
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: B })
|
|
3337
|
+
] }, `${N}-${z}`)) })
|
|
3338
|
+
}
|
|
3339
|
+
)
|
|
3340
|
+
] }),
|
|
3341
|
+
w === "checkbox" && h.defaultValues && /* @__PURE__ */ o("div", { className: "space-y-2", children: [
|
|
3342
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: "Choose one or more options" }),
|
|
3343
|
+
/* @__PURE__ */ n(
|
|
3344
|
+
Q,
|
|
3345
|
+
{
|
|
3346
|
+
control: m,
|
|
3347
|
+
name: `criteriaValueInputs.${N}.values`,
|
|
3348
|
+
render: ({ field: { value: I = [], onChange: A } }) => /* @__PURE__ */ n("div", { className: "space-y-2", children: h.defaultValues.map((B, z) => /* @__PURE__ */ o("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
3349
|
+
/* @__PURE__ */ n(
|
|
3350
|
+
"input",
|
|
3351
|
+
{
|
|
3352
|
+
type: "checkbox",
|
|
3353
|
+
checked: Array.isArray(I) && I.includes(B),
|
|
3354
|
+
onChange: (f) => {
|
|
3355
|
+
const D = Array.isArray(I) ? I : [], C = f.target.checked ? [...D, B] : D.filter((k) => k !== B);
|
|
3356
|
+
A(C);
|
|
3357
|
+
},
|
|
3358
|
+
className: "h-4 w-4 text-primary-500 rounded border-gray-300 focus:ring-primary-500"
|
|
3359
|
+
}
|
|
3360
|
+
),
|
|
3361
|
+
/* @__PURE__ */ n("span", { className: "text-sm", children: B })
|
|
3362
|
+
] }, `${N}-${z}`)) })
|
|
3363
|
+
}
|
|
3364
|
+
)
|
|
3365
|
+
] }),
|
|
3366
|
+
w === "country" && /* @__PURE__ */ n(
|
|
3367
|
+
Q,
|
|
3368
|
+
{
|
|
3369
|
+
control: m,
|
|
3370
|
+
name: `criteriaValueInputs.${N}.values.0`,
|
|
3371
|
+
render: ({ field: I }) => {
|
|
3372
|
+
var A, B, z;
|
|
3373
|
+
return /* @__PURE__ */ n(
|
|
3374
|
+
ye,
|
|
3375
|
+
{
|
|
3376
|
+
...I,
|
|
3377
|
+
options: [
|
|
3378
|
+
{ value: "US", label: "United States" },
|
|
3379
|
+
{ value: "GB", label: "United Kingdom" },
|
|
3380
|
+
{ value: "DE", label: "Germany" }
|
|
3381
|
+
// TODO: Load from base information service
|
|
3382
|
+
],
|
|
3383
|
+
placeholder: "Select a country...",
|
|
3384
|
+
error: (z = (B = (A = y.criteriaValueInputs) == null ? void 0 : A[N]) == null ? void 0 : B.values) == null ? void 0 : z.message
|
|
3385
|
+
}
|
|
3386
|
+
);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
),
|
|
3390
|
+
((M = (F = (E = y.criteriaValueInputs) == null ? void 0 : E[N]) == null ? void 0 : F.values) == null ? void 0 : M.message) && /* @__PURE__ */ n("p", { className: "text-sm text-danger-500 mt-1", children: y.criteriaValueInputs[N].values.message })
|
|
3391
|
+
] }, h.id);
|
|
3392
|
+
}) }),
|
|
3393
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3394
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3395
|
+
/* @__PURE__ */ n(
|
|
3396
|
+
j,
|
|
3397
|
+
{
|
|
3398
|
+
type: "submit",
|
|
3399
|
+
isLoading: i,
|
|
3400
|
+
onClick: () => {
|
|
3401
|
+
console.log("Risk scoring submit button clicked"), console.log("Form errors:", y);
|
|
3402
|
+
},
|
|
3403
|
+
children: "Continue"
|
|
3404
|
+
}
|
|
3405
|
+
)
|
|
3406
|
+
] }),
|
|
3407
|
+
c && /* @__PURE__ */ n("div", { className: "mt-4 p-4 bg-red-50 border border-red-200 rounded", children: /* @__PURE__ */ o("p", { className: "text-red-600 text-sm", children: [
|
|
3408
|
+
"Error: ",
|
|
3409
|
+
c.message
|
|
3410
|
+
] }) })
|
|
3411
|
+
] }) }) : null;
|
|
3412
|
+
}, wr = ({
|
|
3413
|
+
applicantId: t,
|
|
3414
|
+
onComplete: e,
|
|
3415
|
+
onBack: r
|
|
3416
|
+
}) => {
|
|
3417
|
+
const { investorCategorizationService: a } = ie(), [s, i] = v(null), [c, l] = v(!1), [d, u] = v(null);
|
|
3418
|
+
return /* @__PURE__ */ n("form", { onSubmit: async (p) => {
|
|
3419
|
+
if (p.preventDefault(), s === null) {
|
|
3420
|
+
u("Please select an investor type");
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3423
|
+
l(!0), u(null);
|
|
3424
|
+
try {
|
|
3425
|
+
const m = {
|
|
3426
|
+
applicantId: t,
|
|
3427
|
+
investorType: s
|
|
3428
|
+
};
|
|
3429
|
+
console.log("Submitting investor categorization:", m);
|
|
3430
|
+
const b = await a.setInvestorCategorization(m);
|
|
3431
|
+
console.log("Investor categorization result:", b), e == null || e();
|
|
3432
|
+
} catch (m) {
|
|
3433
|
+
console.error("Error submitting investor categorization:", m), u(m.message || "Failed to submit investor categorization");
|
|
3434
|
+
} finally {
|
|
3435
|
+
l(!1);
|
|
3436
|
+
}
|
|
3437
|
+
}, children: /* @__PURE__ */ o(L, { children: [
|
|
3438
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3439
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Which statement best describes you?" }),
|
|
3440
|
+
/* @__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" })
|
|
3441
|
+
] }),
|
|
3442
|
+
/* @__PURE__ */ o(T, { className: "space-y-4", children: [
|
|
3443
|
+
/* @__PURE__ */ n("p", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 mb-3", children: "Choose one" }),
|
|
3444
|
+
/* @__PURE__ */ n(
|
|
3445
|
+
"label",
|
|
3446
|
+
{
|
|
3447
|
+
className: `
|
|
3448
|
+
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3449
|
+
${s === X.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"}
|
|
3450
|
+
`,
|
|
3451
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3452
|
+
/* @__PURE__ */ n(
|
|
3453
|
+
"input",
|
|
3454
|
+
{
|
|
3455
|
+
type: "radio",
|
|
3456
|
+
name: "investorType",
|
|
3457
|
+
value: X.Individual,
|
|
3458
|
+
checked: s === X.Individual,
|
|
3459
|
+
onChange: () => i(X.Individual),
|
|
3460
|
+
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3461
|
+
}
|
|
3462
|
+
),
|
|
3463
|
+
/* @__PURE__ */ o("div", { className: "ml-3", children: [
|
|
3464
|
+
/* @__PURE__ */ n("div", { className: "text-base font-semibold text-gray-900 dark:text-white", children: "Individual investor" }),
|
|
3465
|
+
/* @__PURE__ */ n("div", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: "(Recommended) Most of our clients choose this option. Provides the strongest protection and aligns with our mission to make investing accessible to everyone." })
|
|
3466
|
+
] })
|
|
3467
|
+
] })
|
|
3468
|
+
}
|
|
3469
|
+
),
|
|
3470
|
+
/* @__PURE__ */ n(
|
|
3471
|
+
"label",
|
|
3472
|
+
{
|
|
3473
|
+
className: `
|
|
3474
|
+
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3475
|
+
${s === X.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"}
|
|
3476
|
+
`,
|
|
3477
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3478
|
+
/* @__PURE__ */ n(
|
|
3479
|
+
"input",
|
|
3480
|
+
{
|
|
3481
|
+
type: "radio",
|
|
3482
|
+
name: "investorType",
|
|
3483
|
+
value: X.Sophisticated,
|
|
3484
|
+
checked: s === X.Sophisticated,
|
|
3485
|
+
onChange: () => i(X.Sophisticated),
|
|
3486
|
+
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3487
|
+
}
|
|
3488
|
+
),
|
|
3489
|
+
/* @__PURE__ */ o("div", { className: "ml-3", children: [
|
|
3490
|
+
/* @__PURE__ */ n("div", { className: "text-base font-semibold text-gray-900 dark:text-white", children: "Sophisticated investor" }),
|
|
3491
|
+
/* @__PURE__ */ n("div", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: "In the last 2 years, I have done one or more of the following:" }),
|
|
3492
|
+
/* @__PURE__ */ o("ul", { className: "text-sm text-gray-600 dark:text-gray-400 mt-2 space-y-1 list-none", children: [
|
|
3493
|
+
/* @__PURE__ */ n("li", { children: "Worked in private equity or provided capital to small and medium enterprises, and/or" }),
|
|
3494
|
+
/* @__PURE__ */ n("li", { children: "Been the director of a company with an annual turnover of at least (USD) $2m million, and/or" }),
|
|
3495
|
+
/* @__PURE__ */ n("li", { children: "Invested directly in at least 2 private (not listed) companies." })
|
|
3496
|
+
] })
|
|
3497
|
+
] })
|
|
3498
|
+
] })
|
|
3499
|
+
}
|
|
3500
|
+
),
|
|
3501
|
+
/* @__PURE__ */ n(
|
|
3502
|
+
"label",
|
|
3503
|
+
{
|
|
3504
|
+
className: `
|
|
3505
|
+
block p-4 border-2 rounded-lg cursor-pointer transition-all
|
|
3506
|
+
${s === X.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"}
|
|
3507
|
+
`,
|
|
3508
|
+
children: /* @__PURE__ */ o("div", { className: "flex items-start", children: [
|
|
3509
|
+
/* @__PURE__ */ n(
|
|
3510
|
+
"input",
|
|
3511
|
+
{
|
|
3512
|
+
type: "radio",
|
|
3513
|
+
name: "investorType",
|
|
3514
|
+
value: X.HighNetWorth,
|
|
3515
|
+
checked: s === X.HighNetWorth,
|
|
3516
|
+
onChange: () => i(X.HighNetWorth),
|
|
3517
|
+
className: "mt-1 h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500"
|
|
3518
|
+
}
|
|
3519
|
+
),
|
|
3520
|
+
/* @__PURE__ */ o("div", { className: "ml-3", children: [
|
|
3521
|
+
/* @__PURE__ */ n("div", { className: "text-base font-semibold text-gray-900 dark:text-white", children: "High networth investor" }),
|
|
3522
|
+
/* @__PURE__ */ o("div", { className: "text-sm text-gray-600 dark:text-gray-400 mt-1", children: [
|
|
3523
|
+
"I earn more than (USD/EUR) $150,000 per year, and/or",
|
|
3524
|
+
/* @__PURE__ */ n("br", {}),
|
|
3525
|
+
"I have net assets (excluding my main property) of at least $/EUR 300,000"
|
|
3526
|
+
] })
|
|
3527
|
+
] })
|
|
3528
|
+
] })
|
|
3529
|
+
}
|
|
3530
|
+
),
|
|
3531
|
+
d && /* @__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: [
|
|
3532
|
+
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
3533
|
+
" ",
|
|
3534
|
+
d
|
|
3535
|
+
] }) })
|
|
3536
|
+
] }),
|
|
3537
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3538
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3539
|
+
/* @__PURE__ */ n(
|
|
3540
|
+
j,
|
|
3541
|
+
{
|
|
3542
|
+
type: "submit",
|
|
3543
|
+
isLoading: c,
|
|
3544
|
+
disabled: s === null,
|
|
3545
|
+
children: "Submit"
|
|
3546
|
+
}
|
|
3547
|
+
)
|
|
3548
|
+
] })
|
|
3549
|
+
] }) });
|
|
3550
|
+
}, kr = ({
|
|
3551
|
+
applicantId: t,
|
|
3552
|
+
onComplete: e,
|
|
3553
|
+
onBack: r
|
|
3554
|
+
}) => {
|
|
3555
|
+
const { appropriatenessTestService: a } = ie(), [s, i] = v(null), [c, l] = v(!0), [d, u] = v(!1), [g, p] = v(null), [m, b] = v({}), [y, x] = v(0), [R, h] = v(!1), [N, w] = v(!1), [E, F] = v(0);
|
|
3556
|
+
V(() => {
|
|
3557
|
+
(async () => {
|
|
3558
|
+
try {
|
|
3559
|
+
l(!0), p(null), console.log("Loading appropriateness test for applicant:", t);
|
|
3560
|
+
const k = await a.getAppropriatenessTest(t);
|
|
3561
|
+
if (console.log("Appropriateness test data:", k), i(k), k.waitTimeSpanForNextTry && k.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3562
|
+
const S = M(k.waitTimeSpanForNextTry);
|
|
3563
|
+
S > 0 && F(S);
|
|
3564
|
+
}
|
|
3565
|
+
} catch (k) {
|
|
3566
|
+
console.error("Error loading appropriateness test:", k), p(k.message || "Failed to load appropriateness test");
|
|
3567
|
+
} finally {
|
|
3568
|
+
l(!1);
|
|
3569
|
+
}
|
|
3570
|
+
})();
|
|
3571
|
+
}, [t, a]);
|
|
3572
|
+
const M = (C) => {
|
|
3573
|
+
const k = C.split(":").map(Number);
|
|
3574
|
+
if (k.length === 3) {
|
|
3575
|
+
const [S, $, oe] = k;
|
|
3576
|
+
return S * 3600 + $ * 60 + oe;
|
|
3577
|
+
}
|
|
3578
|
+
return 0;
|
|
3579
|
+
}, I = (C) => {
|
|
3580
|
+
const k = Math.floor(C / 60), S = C % 60;
|
|
3581
|
+
return `${k.toString().padStart(2, "0")}:${S.toString().padStart(2, "0")}`;
|
|
3582
|
+
};
|
|
3583
|
+
V(() => {
|
|
3584
|
+
if (!R || y <= 0) return;
|
|
3585
|
+
const C = setInterval(() => {
|
|
3586
|
+
x((k) => k <= 1 ? (w(!0), 0) : k - 1);
|
|
3587
|
+
}, 1e3);
|
|
3588
|
+
return () => clearInterval(C);
|
|
3589
|
+
}, [R, y]), V(() => {
|
|
3590
|
+
if (E <= 0) return;
|
|
3591
|
+
const C = setInterval(() => {
|
|
3592
|
+
F((k) => k <= 1 ? 0 : k - 1);
|
|
3593
|
+
}, 1e3);
|
|
3594
|
+
return () => clearInterval(C);
|
|
3595
|
+
}, [E]), V(() => {
|
|
3596
|
+
N && !d && z();
|
|
3597
|
+
}, [N]);
|
|
3598
|
+
const A = () => {
|
|
3599
|
+
s && (h(!0), x(s.testDurationSec));
|
|
3600
|
+
}, B = (C, k) => {
|
|
3601
|
+
b((S) => ({
|
|
3602
|
+
...S,
|
|
3603
|
+
[C]: k
|
|
3604
|
+
}));
|
|
3605
|
+
}, z = async (C) => {
|
|
3606
|
+
if (C && C.preventDefault(), !!s) {
|
|
3607
|
+
if (!N) {
|
|
3608
|
+
const k = s.appropriatenessQuestions.length - Object.keys(m).length;
|
|
3609
|
+
if (k > 0) {
|
|
3610
|
+
p(`Please answer all questions. ${k} question(s) remaining.`);
|
|
3611
|
+
return;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
u(!0), p(null);
|
|
3615
|
+
try {
|
|
3616
|
+
const k = s.appropriatenessQuestions.map(
|
|
3617
|
+
($) => ({
|
|
3618
|
+
appropriatenessQuestionId: $.id,
|
|
3619
|
+
value: m[$.id] || ""
|
|
3620
|
+
// Empty string if not answered
|
|
3621
|
+
})
|
|
3622
|
+
), S = {
|
|
3623
|
+
applicantId: t,
|
|
3624
|
+
appropriatenessTestId: s.id,
|
|
3625
|
+
appropriatenessQuestionResults: k
|
|
3626
|
+
};
|
|
3627
|
+
console.log("Submitting appropriateness test:", S);
|
|
3628
|
+
try {
|
|
3629
|
+
const $ = await a.fillAppropriatenessTest(S);
|
|
3630
|
+
console.log("Appropriateness test result:", $), $.message && ($.message.toLowerCase().includes("pass") || $.message.toLowerCase().includes("success") || $.message.toLowerCase().includes("congratulations")) ? e == null || e() : (p($.message || "Test completed. Please check the result."), h(!1), w(!1), b({}), setTimeout(() => f(), 1e3));
|
|
3631
|
+
} catch ($) {
|
|
3632
|
+
if ($.code === 400 && $.message) {
|
|
3633
|
+
const oe = $.message;
|
|
3634
|
+
console.log("Test failed:", oe), p(oe), h(!1), w(!1), b({}), setTimeout(() => f(), 1500);
|
|
3635
|
+
} else
|
|
3636
|
+
throw $;
|
|
3637
|
+
}
|
|
3638
|
+
} catch (k) {
|
|
3639
|
+
console.error("Error submitting appropriateness test:", k), p(k.message || "Failed to submit test. Please try again."), h(!1), w(!1), b({});
|
|
3640
|
+
} finally {
|
|
3641
|
+
u(!1);
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
}, f = async () => {
|
|
3645
|
+
try {
|
|
3646
|
+
const C = await a.getAppropriatenessTest(t);
|
|
3647
|
+
if (console.log("Reloaded test data:", C), i(C), C.waitTimeSpanForNextTry && C.waitTimeSpanForNextTry !== "00:00:00") {
|
|
3648
|
+
const k = M(C.waitTimeSpanForNextTry);
|
|
3649
|
+
k > 0 && F(k);
|
|
3650
|
+
}
|
|
3651
|
+
} catch (C) {
|
|
3652
|
+
console.error("Error reloading test data:", C), p((k) => k + `
|
|
3653
|
+
|
|
3654
|
+
Failed to reload test data. Please refresh the page.`);
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3657
|
+
if (c)
|
|
3658
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3659
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
3660
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading appropriateness test..." })
|
|
3661
|
+
] }) });
|
|
3662
|
+
if (!s)
|
|
3663
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3664
|
+
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "No test data available" }),
|
|
3665
|
+
g && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: g })
|
|
3666
|
+
] }) });
|
|
3667
|
+
if (E > 0)
|
|
3668
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
3669
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3670
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
3671
|
+
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: s.subtitle })
|
|
3672
|
+
] }),
|
|
3673
|
+
/* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
3674
|
+
/* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
3675
|
+
/* @__PURE__ */ n("div", { className: "text-6xl font-bold text-primary-500 mb-2", children: I(E) }),
|
|
3676
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait before attempting the test again" })
|
|
3677
|
+
] }),
|
|
3678
|
+
g && /* @__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: g }) })
|
|
3679
|
+
] })
|
|
3680
|
+
] });
|
|
3681
|
+
const D = s.testAllowedMaxTry - s.totalFailedTries;
|
|
3682
|
+
return R ? /* @__PURE__ */ n("form", { onSubmit: z, children: /* @__PURE__ */ o(L, { children: [
|
|
3683
|
+
/* @__PURE__ */ n(Z, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
3684
|
+
/* @__PURE__ */ o("div", { children: [
|
|
3685
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
3686
|
+
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: s.subtitle })
|
|
3687
|
+
] }),
|
|
3688
|
+
/* @__PURE__ */ o("div", { className: "text-right", children: [
|
|
3689
|
+
/* @__PURE__ */ n(
|
|
3690
|
+
"div",
|
|
3691
|
+
{
|
|
3692
|
+
className: `text-3xl font-bold ${y <= 60 ? "text-danger-500" : "text-primary-500"}`,
|
|
3693
|
+
children: I(y)
|
|
3694
|
+
}
|
|
3695
|
+
),
|
|
3696
|
+
/* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Time Remaining" })
|
|
3697
|
+
] })
|
|
3698
|
+
] }) }),
|
|
3699
|
+
/* @__PURE__ */ o(T, { className: "space-y-6", children: [
|
|
3700
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
|
|
3701
|
+
/* @__PURE__ */ o(ue, { variant: "info", children: [
|
|
3702
|
+
"Question ",
|
|
3703
|
+
Object.keys(m).length,
|
|
3704
|
+
" of ",
|
|
3705
|
+
s.totalQuestionCount
|
|
3706
|
+
] }),
|
|
3707
|
+
/* @__PURE__ */ o(ue, { variant: D > 1 ? "success" : "warning", children: [
|
|
3708
|
+
D,
|
|
3709
|
+
" attempt",
|
|
3710
|
+
D !== 1 ? "s" : "",
|
|
3711
|
+
" remaining"
|
|
3712
|
+
] })
|
|
3713
|
+
] }),
|
|
3714
|
+
s.appropriatenessQuestions.map((C, k) => /* @__PURE__ */ o(
|
|
3715
|
+
"div",
|
|
3716
|
+
{
|
|
3717
|
+
className: "p-4 border border-gray-200 dark:border-gray-700 rounded-lg",
|
|
3718
|
+
children: [
|
|
3719
|
+
/* @__PURE__ */ o("div", { className: "mb-4", children: [
|
|
3720
|
+
/* @__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: [
|
|
3721
|
+
"Question ",
|
|
3722
|
+
k + 1
|
|
3723
|
+
] }),
|
|
3724
|
+
C.groupName && /* @__PURE__ */ n("span", { className: "ml-2 text-xs text-gray-500 dark:text-gray-400", children: C.groupName }),
|
|
3725
|
+
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mt-2", children: C.question })
|
|
3726
|
+
] }),
|
|
3727
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: C.answers.map((S, $) => /* @__PURE__ */ o(
|
|
3728
|
+
"label",
|
|
3729
|
+
{
|
|
3730
|
+
className: `
|
|
3731
|
+
flex items-center p-3 border-2 rounded-lg cursor-pointer transition-all
|
|
3732
|
+
${m[C.id] === S ? "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"}
|
|
3733
|
+
`,
|
|
3734
|
+
children: [
|
|
3735
|
+
/* @__PURE__ */ n(
|
|
3736
|
+
"input",
|
|
3737
|
+
{
|
|
3738
|
+
type: "radio",
|
|
3739
|
+
name: `question-${C.id}`,
|
|
3740
|
+
value: S,
|
|
3741
|
+
checked: m[C.id] === S,
|
|
3742
|
+
onChange: (oe) => B(C.id, oe.target.value),
|
|
3743
|
+
className: "h-4 w-4 text-primary-500 border-gray-300 focus:ring-primary-500",
|
|
3744
|
+
disabled: d
|
|
3745
|
+
}
|
|
3746
|
+
),
|
|
3747
|
+
/* @__PURE__ */ n("span", { className: "ml-3 text-gray-700 dark:text-gray-300", children: S })
|
|
3748
|
+
]
|
|
3749
|
+
},
|
|
3750
|
+
$
|
|
3751
|
+
)) })
|
|
3752
|
+
]
|
|
3753
|
+
},
|
|
3754
|
+
C.id
|
|
3755
|
+
)),
|
|
3756
|
+
g && !N && /* @__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: [
|
|
3757
|
+
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
3758
|
+
" ",
|
|
3759
|
+
g
|
|
3760
|
+
] }) }),
|
|
3761
|
+
N && /* @__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: [
|
|
3762
|
+
/* @__PURE__ */ n("strong", { children: "Time's up!" }),
|
|
3763
|
+
" Your answers are being submitted automatically."
|
|
3764
|
+
] }) })
|
|
3765
|
+
] }),
|
|
3766
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3767
|
+
/* @__PURE__ */ n(
|
|
3768
|
+
j,
|
|
3769
|
+
{
|
|
3770
|
+
type: "button",
|
|
3771
|
+
variant: "outline",
|
|
3772
|
+
onClick: r,
|
|
3773
|
+
disabled: d,
|
|
3774
|
+
children: "Cancel"
|
|
3775
|
+
}
|
|
3776
|
+
),
|
|
3777
|
+
/* @__PURE__ */ n(
|
|
3778
|
+
j,
|
|
3779
|
+
{
|
|
3780
|
+
type: "submit",
|
|
3781
|
+
isLoading: d,
|
|
3782
|
+
disabled: Object.keys(m).length < s.totalQuestionCount,
|
|
3783
|
+
children: N ? "Submitting..." : "Submit Test"
|
|
3784
|
+
}
|
|
3785
|
+
)
|
|
3786
|
+
] })
|
|
3787
|
+
] }) }) : /* @__PURE__ */ o(L, { children: [
|
|
3788
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
3789
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: s.displayName }),
|
|
3790
|
+
s.subtitle && /* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: s.subtitle })
|
|
3791
|
+
] }),
|
|
3792
|
+
/* @__PURE__ */ o(T, { children: [
|
|
3793
|
+
s.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: s.description }) }),
|
|
3794
|
+
/* @__PURE__ */ o("div", { className: "space-y-4 mb-6", children: [
|
|
3795
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3796
|
+
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Total Questions:" }),
|
|
3797
|
+
/* @__PURE__ */ n(ue, { variant: "info", children: s.totalQuestionCount })
|
|
3798
|
+
] }),
|
|
3799
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3800
|
+
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Time Limit:" }),
|
|
3801
|
+
/* @__PURE__ */ n(ue, { variant: "info", children: I(s.testDurationSec) })
|
|
3802
|
+
] }),
|
|
3803
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3804
|
+
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Correct Answers Required:" }),
|
|
3805
|
+
/* @__PURE__ */ n(ue, { variant: "info", children: s.testCorrectAnswerPassLimit })
|
|
3806
|
+
] }),
|
|
3807
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg", children: [
|
|
3808
|
+
/* @__PURE__ */ n("span", { className: "text-gray-700 dark:text-gray-300 font-medium", children: "Attempts Remaining:" }),
|
|
3809
|
+
/* @__PURE__ */ n(ue, { variant: D > 1 ? "success" : "warning", children: D })
|
|
3810
|
+
] })
|
|
3811
|
+
] }),
|
|
3812
|
+
g && /* @__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: [
|
|
3813
|
+
/* @__PURE__ */ n("strong", { children: "Previous Attempt:" }),
|
|
3814
|
+
" ",
|
|
3815
|
+
g
|
|
3816
|
+
] }) }),
|
|
3817
|
+
D <= 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." }) })
|
|
3818
|
+
] }),
|
|
3819
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
3820
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
3821
|
+
/* @__PURE__ */ n(
|
|
3822
|
+
j,
|
|
3823
|
+
{
|
|
3824
|
+
type: "button",
|
|
3825
|
+
onClick: A,
|
|
3826
|
+
disabled: D <= 0,
|
|
3827
|
+
children: "Start Test"
|
|
3828
|
+
}
|
|
3829
|
+
)
|
|
3830
|
+
] })
|
|
3831
|
+
] });
|
|
3832
|
+
}, Nr = ({
|
|
3833
|
+
applicantId: t,
|
|
3834
|
+
onComplete: e,
|
|
3835
|
+
onBack: r
|
|
3836
|
+
}) => {
|
|
3837
|
+
var k, S, $, oe;
|
|
3838
|
+
const { applicantService: a, baseInformationService: s, config: i } = ie(), { identityData: c, provider: l, token: d, isLoading: u, error: g, requestIdentity: p, restartIdentity: m } = Zt(t), [b, y] = v(null), [x, R] = v(null), [h, N] = v([]), [w, E] = v(!0), [F, M] = v(!1), [I, A] = v(null), [B, z] = v(!1), f = De({
|
|
3839
|
+
defaultValues: {
|
|
3840
|
+
street: "",
|
|
3841
|
+
streetNumber: "",
|
|
3842
|
+
city: "",
|
|
3843
|
+
zip: "",
|
|
3844
|
+
country: "",
|
|
3845
|
+
nationality: "",
|
|
3846
|
+
phonenumber: ""
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3849
|
+
V(() => {
|
|
3850
|
+
(async () => {
|
|
3851
|
+
try {
|
|
3852
|
+
const [P, W] = await Promise.all([
|
|
3853
|
+
a.getApplicantData(t),
|
|
3854
|
+
s.getCountries("", "en")
|
|
3855
|
+
]);
|
|
3856
|
+
R(P);
|
|
3857
|
+
const H = /* @__PURE__ */ new Set(), re = W.filter((me) => {
|
|
3858
|
+
const he = me.abbreviation3 || me.abbreviation;
|
|
3859
|
+
return !he || H.has(he) ? !1 : (H.add(he), !0);
|
|
3860
|
+
});
|
|
3861
|
+
N(re);
|
|
3862
|
+
const _ = P.applicantRequestData;
|
|
3863
|
+
if (f.reset({
|
|
3864
|
+
street: (_ == null ? void 0 : _.street) || "",
|
|
3865
|
+
streetNumber: (_ == null ? void 0 : _.streetNumber) || "",
|
|
3866
|
+
city: (_ == null ? void 0 : _.city) || "",
|
|
3867
|
+
zip: (_ == null ? void 0 : _.zip) || "",
|
|
3868
|
+
country: (_ == null ? void 0 : _.country) || "",
|
|
3869
|
+
nationality: (_ == null ? void 0 : _.nationality) || "",
|
|
3870
|
+
phonenumber: (_ == null ? void 0 : _.phonenumber) || ""
|
|
3871
|
+
}), !c && !u) {
|
|
3872
|
+
console.log("[Identity] Auto-requesting identity verification for IdentityPending status");
|
|
3873
|
+
try {
|
|
3874
|
+
await p(), M(!0);
|
|
3875
|
+
} catch (me) {
|
|
3876
|
+
console.error("[Identity] Auto-request failed:", me);
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
} catch (P) {
|
|
3880
|
+
console.error("Error loading applicant data:", P);
|
|
3881
|
+
} finally {
|
|
3882
|
+
E(!1);
|
|
3883
|
+
}
|
|
3884
|
+
})();
|
|
3885
|
+
}, [t, a, s, f, c, u]), V(() => {
|
|
3886
|
+
if (d) {
|
|
3887
|
+
if (d.expiresAt) {
|
|
3888
|
+
const O = new Date(d.expiresAt).getTime();
|
|
3889
|
+
if (Date.now() >= O) {
|
|
3890
|
+
console.warn("[Identity] Token has expired (expiresAt)"), z(!0), A("Your verification session has expired. Please restart.");
|
|
3891
|
+
return;
|
|
3892
|
+
}
|
|
3893
|
+
}
|
|
3894
|
+
if (d.url)
|
|
3895
|
+
try {
|
|
3896
|
+
const P = new URL(d.url).toString().toLowerCase();
|
|
3897
|
+
if (P.includes("expired") || P.includes("invalid") || P.includes("error")) {
|
|
3898
|
+
console.warn("[Identity] Token URL indicates expiration"), z(!0), A("Your verification link has expired. Please restart.");
|
|
3899
|
+
return;
|
|
3900
|
+
}
|
|
3901
|
+
} catch {
|
|
3902
|
+
console.error("[Identity] Invalid token URL");
|
|
3903
|
+
}
|
|
3904
|
+
if (d.status === "expired" || d.error === "expired" || d.expired === !0) {
|
|
3905
|
+
console.warn("[Identity] Token object indicates expiration"), z(!0), A("Your verification session has expired. Please restart.");
|
|
3906
|
+
return;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
}, [d]), V(() => {
|
|
3910
|
+
if (l !== null && d && !b && F && !B) {
|
|
3911
|
+
const O = l;
|
|
3912
|
+
if (d.url) {
|
|
3913
|
+
console.log("[Identity] Loading provider URL for user verification:", d.url), A(null);
|
|
3914
|
+
try {
|
|
3915
|
+
if (new URL(d.url), O === ne.SardinAI) {
|
|
3916
|
+
console.log("[SardinAI] Initializing Risk SDK in background...");
|
|
3917
|
+
try {
|
|
3918
|
+
const P = fe.parseProviderConfig(l, d, i);
|
|
3919
|
+
fe.createProvider(l, P).initialize().then(() => {
|
|
3920
|
+
console.log("[SardinAI] Risk SDK initialized successfully in background");
|
|
3921
|
+
}).catch((H) => {
|
|
3922
|
+
console.warn("[SardinAI] Risk SDK initialization failed (non-blocking):", H);
|
|
3923
|
+
});
|
|
3924
|
+
} catch (P) {
|
|
3925
|
+
console.warn("[SardinAI] Risk SDK setup failed (non-blocking):", P);
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
y({ type: "url", url: d.url });
|
|
3929
|
+
} catch (P) {
|
|
3930
|
+
console.error("[Identity] Invalid URL:", P), A("Invalid verification URL. Please restart."), z(!0);
|
|
3931
|
+
}
|
|
3932
|
+
return;
|
|
3933
|
+
}
|
|
3934
|
+
if (O === ne.SardinAI) {
|
|
3935
|
+
console.log("[SardinAI] No URL provided - initializing Risk SDK only..."), A(null);
|
|
3936
|
+
try {
|
|
3937
|
+
const P = fe.parseProviderConfig(l, d, i), W = fe.createProvider(l, P);
|
|
3938
|
+
W.initialize().then(() => {
|
|
3939
|
+
console.log("[SardinAI] Risk SDK initialized successfully"), y(W), setTimeout(() => {
|
|
3940
|
+
e == null || e();
|
|
3941
|
+
}, 2e3);
|
|
3942
|
+
}).catch((H) => {
|
|
3943
|
+
var _;
|
|
3944
|
+
console.error("[SardinAI] Failed to initialize:", H);
|
|
3945
|
+
const re = ((_ = H.message) == null ? void 0 : _.toLowerCase()) || "";
|
|
3946
|
+
re.includes("expired") || re.includes("invalid") || re.includes("401") || re.includes("400") ? (z(!0), A("Session expired or invalid. Please restart verification.")) : A(`Failed to initialize: ${H.message}`);
|
|
3947
|
+
});
|
|
3948
|
+
} catch (P) {
|
|
3949
|
+
console.error("[SardinAI] Error creating provider:", P), A(`Configuration error: ${P.message}`);
|
|
3950
|
+
}
|
|
3951
|
+
return;
|
|
3952
|
+
}
|
|
3953
|
+
try {
|
|
3954
|
+
A(null);
|
|
3955
|
+
const P = fe.parseProviderConfig(l, d, i), W = fe.createProvider(l, P);
|
|
3956
|
+
O === ne.Sumsub ? (W.initialize("identity-container").catch((H) => {
|
|
3957
|
+
var re;
|
|
3958
|
+
console.error("[Sumsub] Initialization error:", H), A(`Failed to initialize: ${H.message}`), (re = H.message) != null && re.toLowerCase().includes("expired") && z(!0);
|
|
3959
|
+
}), W.onComplete && W.onComplete(() => {
|
|
3960
|
+
e == null || e();
|
|
3961
|
+
})) : O === ne.Onfido && W.initialize("identity-container").catch((H) => {
|
|
3962
|
+
console.error("[Onfido] Initialization error:", H), A(`Failed to initialize: ${H.message}`);
|
|
3963
|
+
}), y(W);
|
|
3964
|
+
} catch (P) {
|
|
3965
|
+
console.error("[Identity] Provider setup error:", P), A(`Setup error: ${P.message}`);
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3968
|
+
return () => {
|
|
3969
|
+
if (b && b.destroy)
|
|
3970
|
+
try {
|
|
3971
|
+
b.destroy();
|
|
3972
|
+
} catch (O) {
|
|
3973
|
+
console.error("[Identity] Error destroying provider:", O);
|
|
3974
|
+
}
|
|
3975
|
+
};
|
|
3976
|
+
}, [l, d, b, F, e, B]);
|
|
3977
|
+
const D = async () => {
|
|
3978
|
+
try {
|
|
3979
|
+
A(null), z(!1), await p(), M(!0);
|
|
3980
|
+
} catch (O) {
|
|
3981
|
+
console.error("Error starting identity verification:", O);
|
|
3982
|
+
}
|
|
3983
|
+
}, C = async () => {
|
|
3984
|
+
try {
|
|
3985
|
+
A(null), z(!1), y(null), console.log("[Identity] Restarting verification..."), await m(), M(!0);
|
|
3986
|
+
} catch (O) {
|
|
3987
|
+
console.error("Error restarting identity verification:", O), A(O.message || "Failed to restart verification");
|
|
3988
|
+
}
|
|
3989
|
+
};
|
|
3990
|
+
if (w || u)
|
|
3991
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
3992
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
3993
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading identity verification..." })
|
|
3994
|
+
] }) });
|
|
3995
|
+
if (g)
|
|
3996
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("p", { className: "text-danger-500", children: [
|
|
3997
|
+
"Error: ",
|
|
3998
|
+
g.message
|
|
3999
|
+
] }) }) });
|
|
4000
|
+
if (F && (I || B))
|
|
4001
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
4002
|
+
/* @__PURE__ */ n(Z, { children: /* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Verification Session Issue" }) }),
|
|
4003
|
+
/* @__PURE__ */ o(T, { children: [
|
|
4004
|
+
/* @__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: [
|
|
4005
|
+
/* @__PURE__ */ n(
|
|
4006
|
+
"svg",
|
|
4007
|
+
{
|
|
4008
|
+
className: "h-6 w-6 text-red-600 dark:text-red-400 mr-3 mt-0.5",
|
|
4009
|
+
fill: "none",
|
|
4010
|
+
viewBox: "0 0 24 24",
|
|
4011
|
+
stroke: "currentColor",
|
|
4012
|
+
children: /* @__PURE__ */ n(
|
|
4013
|
+
"path",
|
|
4014
|
+
{
|
|
4015
|
+
strokeLinecap: "round",
|
|
4016
|
+
strokeLinejoin: "round",
|
|
4017
|
+
strokeWidth: 2,
|
|
4018
|
+
d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
4019
|
+
}
|
|
4020
|
+
)
|
|
4021
|
+
}
|
|
4022
|
+
),
|
|
4023
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4024
|
+
/* @__PURE__ */ n("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-1", children: B ? "Session Expired" : "Verification Error" }),
|
|
4025
|
+
/* @__PURE__ */ n("p", { className: "text-red-800 dark:text-red-200 text-sm", children: I || "Your verification session has expired and needs to be restarted." })
|
|
4026
|
+
] })
|
|
4027
|
+
] }) }),
|
|
4028
|
+
/* @__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: [
|
|
4029
|
+
/* @__PURE__ */ n("h3", { className: "font-semibold text-blue-900 dark:text-blue-100 mb-2", children: "What to do next:" }),
|
|
4030
|
+
/* @__PURE__ */ o("ul", { className: "text-blue-800 dark:text-blue-200 text-sm space-y-1 list-disc list-inside", children: [
|
|
4031
|
+
/* @__PURE__ */ n("li", { children: 'Click "Restart Verification" below to generate a new session' }),
|
|
4032
|
+
/* @__PURE__ */ n("li", { children: "Complete the verification process without delays" }),
|
|
4033
|
+
/* @__PURE__ */ n("li", { children: "If issues persist, contact support" })
|
|
4034
|
+
] })
|
|
4035
|
+
] })
|
|
4036
|
+
] }),
|
|
4037
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
4038
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4039
|
+
/* @__PURE__ */ n(j, { type: "button", onClick: C, disabled: u, children: u ? "Restarting..." : "Restart Verification" })
|
|
4040
|
+
] })
|
|
4041
|
+
] });
|
|
4042
|
+
if (F && c) {
|
|
4043
|
+
const O = l;
|
|
4044
|
+
return d != null && d.url ? /* @__PURE__ */ o(L, { children: [
|
|
4045
|
+
/* @__PURE__ */ n(Z, { children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
4046
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4047
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
|
|
4048
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
|
|
4049
|
+
] }),
|
|
4050
|
+
/* @__PURE__ */ n(
|
|
4051
|
+
j,
|
|
4052
|
+
{
|
|
4053
|
+
type: "button",
|
|
4054
|
+
variant: "outline",
|
|
4055
|
+
size: "sm",
|
|
4056
|
+
onClick: C,
|
|
4057
|
+
disabled: u,
|
|
4058
|
+
children: "Restart"
|
|
4059
|
+
}
|
|
4060
|
+
)
|
|
4061
|
+
] }) }),
|
|
4062
|
+
/* @__PURE__ */ o(T, { children: [
|
|
4063
|
+
/* @__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: [
|
|
4064
|
+
/* @__PURE__ */ n("strong", { children: "Important:" }),
|
|
4065
|
+
' If you see an "expired" or "invalid link" message below, click the "Restart" button above to generate a new verification session.'
|
|
4066
|
+
] }) }),
|
|
4067
|
+
/* @__PURE__ */ n("div", { className: "w-full", style: { height: "600px" }, children: /* @__PURE__ */ n(
|
|
4068
|
+
"iframe",
|
|
4069
|
+
{
|
|
4070
|
+
src: d.url,
|
|
4071
|
+
className: "w-full h-full border-0 rounded-lg",
|
|
4072
|
+
allow: "camera; microphone; geolocation",
|
|
4073
|
+
title: "Identity Verification",
|
|
4074
|
+
onLoad: (P) => {
|
|
4075
|
+
var W, H, re;
|
|
4076
|
+
console.log("[Identity] Iframe loaded");
|
|
4077
|
+
try {
|
|
4078
|
+
const _ = P.target, me = _.contentDocument || ((W = _.contentWindow) == null ? void 0 : W.document);
|
|
4079
|
+
if (me) {
|
|
4080
|
+
const he = ((re = (H = me.body) == null ? void 0 : H.textContent) == null ? void 0 : re.toLowerCase()) || "";
|
|
4081
|
+
(he.includes("expired") || he.includes("invalid") || he.includes("error")) && (console.warn("[Identity] Iframe shows expiration message"), z(!0), A("Your verification link has expired."));
|
|
4082
|
+
}
|
|
4083
|
+
} catch {
|
|
4084
|
+
console.log("[Identity] Cannot check iframe content (CORS)");
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
) })
|
|
4089
|
+
] }),
|
|
4090
|
+
r && /* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(j, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4091
|
+
] }) : O === ne.SardinAI ? /* @__PURE__ */ o(L, { children: [
|
|
4092
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
4093
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Device Risk Assessment" }),
|
|
4094
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Analyzing device security and behavioral patterns..." })
|
|
4095
|
+
] }),
|
|
4096
|
+
/* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-12", children: [
|
|
4097
|
+
/* @__PURE__ */ n(se, { className: "mb-4" }),
|
|
4098
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: "Please wait while we verify your device security" }),
|
|
4099
|
+
/* @__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" })
|
|
4100
|
+
] }) })
|
|
4101
|
+
] }) : /* @__PURE__ */ o(L, { children: [
|
|
4102
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
4103
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Identity Verification" }),
|
|
4104
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please complete the identity verification process" })
|
|
4105
|
+
] }),
|
|
4106
|
+
/* @__PURE__ */ n(T, { children: /* @__PURE__ */ n("div", { id: "identity-container", className: "min-h-[400px]" }) }),
|
|
4107
|
+
r && /* @__PURE__ */ n(te, { children: /* @__PURE__ */ n(j, { variant: "outline", onClick: r, children: "Back" }) })
|
|
4108
|
+
] });
|
|
4109
|
+
}
|
|
4110
|
+
return /* @__PURE__ */ n("form", { onSubmit: f.handleSubmit(D), children: /* @__PURE__ */ o(L, { children: [
|
|
4111
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
4112
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold", children: "Review Your Information" }),
|
|
4113
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-1", children: "Please review and confirm your information before starting identity verification" })
|
|
4114
|
+
] }),
|
|
4115
|
+
/* @__PURE__ */ o(T, { className: "space-y-6", children: [
|
|
4116
|
+
/* @__PURE__ */ o("div", { className: "space-y-4 pb-4 border-b border-gray-200 dark:border-gray-700", children: [
|
|
4117
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4118
|
+
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Name" }),
|
|
4119
|
+
/* @__PURE__ */ o("p", { className: "mt-1 text-base", children: [
|
|
4120
|
+
(k = x == null ? void 0 : x.applicantRequestData) == null ? void 0 : k.firstName,
|
|
4121
|
+
" ",
|
|
4122
|
+
(S = x == null ? void 0 : x.applicantRequestData) == null ? void 0 : S.lastName
|
|
4123
|
+
] })
|
|
4124
|
+
] }),
|
|
4125
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4126
|
+
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Email" }),
|
|
4127
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ($ = x == null ? void 0 : x.applicantRequestData) == null ? void 0 : $.email })
|
|
4128
|
+
] }),
|
|
4129
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4130
|
+
/* @__PURE__ */ n("label", { className: "block text-sm font-medium text-gray-500 dark:text-gray-400", children: "Date of Birth" }),
|
|
4131
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-base", children: ((oe = x == null ? void 0 : x.applicantRequestData) == null ? void 0 : oe.dateOfBirth) || "Not provided" })
|
|
4132
|
+
] })
|
|
4133
|
+
] }),
|
|
4134
|
+
/* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
4135
|
+
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold", children: "Address Information" }),
|
|
4136
|
+
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4137
|
+
/* @__PURE__ */ n(
|
|
4138
|
+
Q,
|
|
4139
|
+
{
|
|
4140
|
+
control: f.control,
|
|
4141
|
+
name: "country",
|
|
4142
|
+
render: ({ field: O }) => /* @__PURE__ */ n(
|
|
4143
|
+
ye,
|
|
4144
|
+
{
|
|
4145
|
+
...O,
|
|
4146
|
+
label: "Country",
|
|
4147
|
+
options: [
|
|
4148
|
+
{ value: "", label: "Select country..." },
|
|
4149
|
+
...h.map((P) => ({
|
|
4150
|
+
value: P.abbreviation3 || P.abbreviation,
|
|
4151
|
+
label: P.name
|
|
4152
|
+
}))
|
|
4153
|
+
]
|
|
4154
|
+
}
|
|
4155
|
+
)
|
|
4156
|
+
}
|
|
4157
|
+
),
|
|
4158
|
+
/* @__PURE__ */ n(
|
|
4159
|
+
Q,
|
|
4160
|
+
{
|
|
4161
|
+
control: f.control,
|
|
4162
|
+
name: "nationality",
|
|
4163
|
+
render: ({ field: O }) => /* @__PURE__ */ n(
|
|
4164
|
+
ye,
|
|
4165
|
+
{
|
|
4166
|
+
...O,
|
|
4167
|
+
label: "Nationality",
|
|
4168
|
+
options: [
|
|
4169
|
+
{ value: "", label: "Select nationality..." },
|
|
4170
|
+
...h.map((P) => ({
|
|
4171
|
+
value: P.abbreviation3 || P.abbreviation,
|
|
4172
|
+
label: P.name
|
|
4173
|
+
}))
|
|
4174
|
+
]
|
|
4175
|
+
}
|
|
4176
|
+
)
|
|
4177
|
+
}
|
|
4178
|
+
)
|
|
4179
|
+
] }),
|
|
4180
|
+
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4181
|
+
/* @__PURE__ */ n(
|
|
4182
|
+
Q,
|
|
4183
|
+
{
|
|
4184
|
+
control: f.control,
|
|
4185
|
+
name: "street",
|
|
4186
|
+
render: ({ field: O }) => /* @__PURE__ */ n(G, { ...O, label: "Street" })
|
|
4187
|
+
}
|
|
4188
|
+
),
|
|
4189
|
+
/* @__PURE__ */ n(
|
|
4190
|
+
Q,
|
|
4191
|
+
{
|
|
4192
|
+
control: f.control,
|
|
4193
|
+
name: "streetNumber",
|
|
4194
|
+
render: ({ field: O }) => /* @__PURE__ */ n(G, { ...O, label: "Street Number" })
|
|
4195
|
+
}
|
|
4196
|
+
)
|
|
4197
|
+
] }),
|
|
4198
|
+
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4199
|
+
/* @__PURE__ */ n(
|
|
4200
|
+
Q,
|
|
4201
|
+
{
|
|
4202
|
+
control: f.control,
|
|
4203
|
+
name: "city",
|
|
4204
|
+
render: ({ field: O }) => /* @__PURE__ */ n(G, { ...O, label: "City" })
|
|
4205
|
+
}
|
|
4206
|
+
),
|
|
4207
|
+
/* @__PURE__ */ n(
|
|
4208
|
+
Q,
|
|
4209
|
+
{
|
|
4210
|
+
control: f.control,
|
|
4211
|
+
name: "zip",
|
|
4212
|
+
render: ({ field: O }) => /* @__PURE__ */ n(G, { ...O, label: "ZIP/Postal Code" })
|
|
4213
|
+
}
|
|
4214
|
+
)
|
|
4215
|
+
] }),
|
|
4216
|
+
/* @__PURE__ */ n(
|
|
4217
|
+
Q,
|
|
4218
|
+
{
|
|
4219
|
+
control: f.control,
|
|
4220
|
+
name: "phonenumber",
|
|
4221
|
+
render: ({ field: O }) => /* @__PURE__ */ n(G, { ...O, label: "Phone Number", type: "tel" })
|
|
4222
|
+
}
|
|
4223
|
+
)
|
|
4224
|
+
] })
|
|
4225
|
+
] }),
|
|
4226
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
4227
|
+
r && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: r, children: "Back" }),
|
|
4228
|
+
/* @__PURE__ */ n(j, { type: "submit", isLoading: u, children: "Confirm and Start Verification" })
|
|
4229
|
+
] })
|
|
4230
|
+
] }) });
|
|
4231
|
+
}, Be = ({
|
|
4232
|
+
kycStatus: t,
|
|
4233
|
+
reviewStatus: e,
|
|
4234
|
+
workflowResult: r,
|
|
4235
|
+
customMessage: a,
|
|
4236
|
+
onContinue: s,
|
|
4237
|
+
onContactSupport: i
|
|
4238
|
+
}) => {
|
|
4239
|
+
const l = t === pe.Approved ? {
|
|
4240
|
+
type: "success",
|
|
4241
|
+
title: "Verification Approved",
|
|
4242
|
+
icon: "✓",
|
|
4243
|
+
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4244
|
+
iconColor: "text-green-600 dark:text-green-400",
|
|
4245
|
+
message: "Your identity verification has been successfully approved."
|
|
4246
|
+
} : t === pe.Rejected ? {
|
|
4247
|
+
type: "error",
|
|
4248
|
+
title: "Verification Rejected",
|
|
4249
|
+
icon: "✕",
|
|
4250
|
+
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4251
|
+
iconColor: "text-red-600 dark:text-red-400",
|
|
4252
|
+
message: "Unfortunately, your identity verification was not approved."
|
|
4253
|
+
} : t === pe.Pending || t === pe.InProgress ? {
|
|
4254
|
+
type: "pending",
|
|
4255
|
+
title: "Verification Pending",
|
|
4256
|
+
icon: "⏱",
|
|
4257
|
+
iconBg: "bg-blue-100 dark:bg-blue-900/30",
|
|
4258
|
+
iconColor: "text-blue-600 dark:text-blue-400",
|
|
4259
|
+
message: "Your identity verification is currently being processed."
|
|
4260
|
+
} : e === ge.Approved ? {
|
|
4261
|
+
type: "success",
|
|
4262
|
+
title: "Application Approved",
|
|
4263
|
+
icon: "✓",
|
|
4264
|
+
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4265
|
+
iconColor: "text-green-600 dark:text-green-400",
|
|
4266
|
+
message: "Your application has been approved."
|
|
4267
|
+
} : e === ge.Reject ? {
|
|
4268
|
+
type: "error",
|
|
4269
|
+
title: "Application Rejected",
|
|
4270
|
+
icon: "✕",
|
|
4271
|
+
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4272
|
+
iconColor: "text-red-600 dark:text-red-400",
|
|
4273
|
+
message: "Your application has been rejected."
|
|
4274
|
+
} : e === ge.UnderReview || e === ge.AdminReview ? {
|
|
4275
|
+
type: "pending",
|
|
4276
|
+
title: "Under Review",
|
|
4277
|
+
icon: "📋",
|
|
4278
|
+
iconBg: "bg-yellow-100 dark:bg-yellow-900/30",
|
|
4279
|
+
iconColor: "text-yellow-700 dark:text-yellow-400",
|
|
4280
|
+
message: "Your application is currently under manual review."
|
|
4281
|
+
} : r === ke.Success ? {
|
|
4282
|
+
type: "success",
|
|
4283
|
+
title: "Process Complete",
|
|
4284
|
+
icon: "✓",
|
|
4285
|
+
iconBg: "bg-green-100 dark:bg-green-900/30",
|
|
4286
|
+
iconColor: "text-green-600 dark:text-green-400",
|
|
4287
|
+
message: "Your verification process has been completed successfully."
|
|
4288
|
+
} : r === ke.Failed ? {
|
|
4289
|
+
type: "error",
|
|
4290
|
+
title: "Process Failed",
|
|
4291
|
+
icon: "✕",
|
|
4292
|
+
iconBg: "bg-red-100 dark:bg-red-900/30",
|
|
4293
|
+
iconColor: "text-red-600 dark:text-red-400",
|
|
4294
|
+
message: "The verification process could not be completed."
|
|
4295
|
+
} : r === ke.AdminReview ? {
|
|
4296
|
+
type: "pending",
|
|
4297
|
+
title: "Admin Review Required",
|
|
4298
|
+
icon: "📋",
|
|
4299
|
+
iconBg: "bg-yellow-100 dark:bg-yellow-900/30",
|
|
4300
|
+
iconColor: "text-yellow-700 dark:text-yellow-400",
|
|
4301
|
+
message: "Your application requires administrator review."
|
|
4302
|
+
} : {
|
|
4303
|
+
type: "pending",
|
|
4304
|
+
title: "Processing",
|
|
4305
|
+
icon: "⏱",
|
|
4306
|
+
iconBg: "bg-blue-100 dark:bg-blue-900/30",
|
|
4307
|
+
iconColor: "text-blue-600 dark:text-blue-400",
|
|
4308
|
+
message: "Your application is being reviewed."
|
|
4309
|
+
};
|
|
4310
|
+
return /* @__PURE__ */ o(L, { children: [
|
|
4311
|
+
/* @__PURE__ */ o(T, { className: "py-12", children: [
|
|
4312
|
+
/* @__PURE__ */ n("div", { className: "flex justify-center mb-6", children: /* @__PURE__ */ n(
|
|
4313
|
+
"div",
|
|
4314
|
+
{
|
|
4315
|
+
className: `w-24 h-24 rounded-full flex items-center justify-center ${l.iconBg}`,
|
|
4316
|
+
children: /* @__PURE__ */ n("span", { className: `text-5xl ${l.iconColor}`, children: l.icon })
|
|
4317
|
+
}
|
|
4318
|
+
) }),
|
|
4319
|
+
/* @__PURE__ */ n("h2", { className: "text-3xl font-bold text-center text-gray-900 dark:text-white mb-4", children: l.title }),
|
|
4320
|
+
/* @__PURE__ */ n("div", { className: "flex justify-center mb-6", children: /* @__PURE__ */ n(
|
|
4321
|
+
ue,
|
|
4322
|
+
{
|
|
4323
|
+
variant: l.type === "success" ? "success" : l.type === "error" ? "danger" : l.type === "pending" ? "warning" : "info",
|
|
4324
|
+
children: t != null ? pe[t] : ge[e]
|
|
4325
|
+
}
|
|
4326
|
+
) }),
|
|
4327
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mb-6 max-w-md mx-auto", children: a || l.message }),
|
|
4328
|
+
l.type === "success" && /* @__PURE__ */ o("div", { className: "bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4 mb-6", children: [
|
|
4329
|
+
/* @__PURE__ */ n("h3", { className: "font-semibold text-green-900 dark:text-green-100 mb-2", children: "What's Next?" }),
|
|
4330
|
+
/* @__PURE__ */ o("ul", { className: "text-sm text-green-800 dark:text-green-200 space-y-1", children: [
|
|
4331
|
+
/* @__PURE__ */ n("li", { children: "✓ Your identity has been verified" }),
|
|
4332
|
+
/* @__PURE__ */ n("li", { children: "✓ You can now proceed with your application" }),
|
|
4333
|
+
/* @__PURE__ */ n("li", { children: "✓ All features are now accessible" })
|
|
4334
|
+
] })
|
|
4335
|
+
] }),
|
|
4336
|
+
l.type === "error" && /* @__PURE__ */ o("div", { className: "bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 mb-6", children: [
|
|
4337
|
+
/* @__PURE__ */ n("h3", { className: "font-semibold text-red-900 dark:text-red-100 mb-2", children: "What Can You Do?" }),
|
|
4338
|
+
/* @__PURE__ */ o("ul", { className: "text-sm text-red-800 dark:text-red-200 space-y-2", children: [
|
|
4339
|
+
/* @__PURE__ */ n("li", { children: "• Review the requirements and ensure all information is correct" }),
|
|
4340
|
+
/* @__PURE__ */ n("li", { children: "• Contact our support team for assistance" }),
|
|
4341
|
+
/* @__PURE__ */ n("li", { children: "• You may be able to resubmit your application" })
|
|
4342
|
+
] })
|
|
4343
|
+
] }),
|
|
4344
|
+
l.type === "pending" && /* @__PURE__ */ o("div", { className: "bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-6", children: [
|
|
4345
|
+
/* @__PURE__ */ n("h3", { className: "font-semibold text-blue-900 dark:text-blue-100 mb-2", children: "What Happens Next?" }),
|
|
4346
|
+
/* @__PURE__ */ o("ul", { className: "text-sm text-blue-800 dark:text-blue-200 space-y-2", children: [
|
|
4347
|
+
/* @__PURE__ */ n("li", { children: "• Our team is reviewing your information" }),
|
|
4348
|
+
/* @__PURE__ */ n("li", { children: "• You will be notified via email once the review is complete" }),
|
|
4349
|
+
/* @__PURE__ */ n("li", { children: "• This typically takes 24-48 hours" }),
|
|
4350
|
+
/* @__PURE__ */ n("li", { children: "• No action is required from you at this time" })
|
|
4351
|
+
] })
|
|
4352
|
+
] }),
|
|
4353
|
+
/* @__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: [
|
|
4354
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4355
|
+
/* @__PURE__ */ n("span", { className: "text-gray-500 dark:text-gray-400", children: "KYC Status:" }),
|
|
4356
|
+
/* @__PURE__ */ n("div", { className: "font-medium text-gray-900 dark:text-white mt-1", children: t != null ? pe[t] : "Not Available" })
|
|
4357
|
+
] }),
|
|
4358
|
+
/* @__PURE__ */ o("div", { children: [
|
|
4359
|
+
/* @__PURE__ */ n("span", { className: "text-gray-500 dark:text-gray-400", children: "Review Status:" }),
|
|
4360
|
+
/* @__PURE__ */ n("div", { className: "font-medium text-gray-900 dark:text-white mt-1", children: ge[e] })
|
|
4361
|
+
] })
|
|
4362
|
+
] }) })
|
|
4363
|
+
] }),
|
|
4364
|
+
/* @__PURE__ */ o(te, { className: "flex justify-center gap-4", children: [
|
|
4365
|
+
l.type === "success" && s && /* @__PURE__ */ n(j, { onClick: s, size: "lg", children: "Continue" }),
|
|
4366
|
+
l.type === "error" && /* @__PURE__ */ o(et, { children: [
|
|
4367
|
+
i && /* @__PURE__ */ n(j, { variant: "outline", onClick: i, children: "Contact Support" }),
|
|
4368
|
+
s && /* @__PURE__ */ n(j, { onClick: s, children: "Try Again" })
|
|
4369
|
+
] }),
|
|
4370
|
+
l.type === "pending" && /* @__PURE__ */ n("div", { className: "text-center", children: /* @__PURE__ */ n("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "Please check back later or wait for our email notification" }) })
|
|
4371
|
+
] })
|
|
4372
|
+
] });
|
|
4373
|
+
}, Kr = ({ config: t, className: e = "" }) => !(t != null && t.visible) || !(t != null && t.url) ? null : /* @__PURE__ */ n("div", { className: `metakyc-logo ${e}`, children: /* @__PURE__ */ n(
|
|
4374
|
+
"img",
|
|
4375
|
+
{
|
|
4376
|
+
src: t.url,
|
|
4377
|
+
alt: t.alt || "Company Logo",
|
|
4378
|
+
style: {
|
|
4379
|
+
width: t.width || "auto",
|
|
4380
|
+
height: t.height || "40px",
|
|
4381
|
+
maxWidth: "100%",
|
|
4382
|
+
objectFit: "contain"
|
|
4383
|
+
},
|
|
4384
|
+
onError: (r) => {
|
|
4385
|
+
console.warn("[Logo] Failed to load logo:", t.url), r.target.style.display = "none";
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4388
|
+
) }), qr = ({
|
|
4389
|
+
workflowKey: t,
|
|
4390
|
+
externalRefId: e,
|
|
4391
|
+
onSuccess: r,
|
|
4392
|
+
onCancel: a
|
|
4393
|
+
}) => {
|
|
4394
|
+
var A, B, z;
|
|
4395
|
+
const { config: s, baseInformationService: i } = ie(), { createApplicant: c, isLoading: l } = Xt(), [d, u] = v([]), [g, p] = v(!0), [m, b] = v(!1), [y, x] = v(null), R = t || ((A = s.applicantForm) == null ? void 0 : A.workflowKey);
|
|
4396
|
+
if (!R)
|
|
4397
|
+
throw new Error(
|
|
4398
|
+
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
4399
|
+
);
|
|
4400
|
+
const h = e || ((B = s.applicantForm) == null ? void 0 : B.externalRefId) || "", N = ((z = s.applicantForm) == null ? void 0 : z.visibleFields) || mt, [w, E] = v({
|
|
4401
|
+
workflowKey: R,
|
|
4402
|
+
firstName: "",
|
|
4403
|
+
lastName: "",
|
|
4404
|
+
title: "",
|
|
4405
|
+
email: "",
|
|
4406
|
+
dateOfBirth: "",
|
|
4407
|
+
phonenumber: "",
|
|
4408
|
+
externalRefId: h,
|
|
4409
|
+
// Set from config or prop
|
|
4410
|
+
mobileCountryCode: "",
|
|
4411
|
+
street: "",
|
|
4412
|
+
streetNumber: "",
|
|
4413
|
+
zip: "",
|
|
4414
|
+
city: "",
|
|
4415
|
+
country: "",
|
|
4416
|
+
nationality: "",
|
|
4417
|
+
otherNationality: [],
|
|
4418
|
+
defaultLanguage: "EN",
|
|
4419
|
+
taxCountry: "",
|
|
4420
|
+
placeOfBirth: "",
|
|
4421
|
+
countryOfBirth: "",
|
|
4422
|
+
salutation: null,
|
|
4423
|
+
educationLevel: "",
|
|
4424
|
+
occupation: "",
|
|
4425
|
+
taxNumber: ""
|
|
4426
|
+
});
|
|
4427
|
+
V(() => {
|
|
4428
|
+
(async () => {
|
|
4429
|
+
try {
|
|
4430
|
+
p(!0);
|
|
4431
|
+
const D = await i.getCountries("", s.locale || "en"), C = /* @__PURE__ */ new Set(), k = D.map((S) => ({
|
|
4432
|
+
value: S.abbreviation3 || S.abbreviation,
|
|
4433
|
+
label: S.name
|
|
4434
|
+
})).filter((S) => !S.value || C.has(S.value) ? !1 : (C.add(S.value), !0));
|
|
4435
|
+
u(k);
|
|
4436
|
+
} catch (D) {
|
|
4437
|
+
console.error("Failed to load countries:", D);
|
|
4438
|
+
} finally {
|
|
4439
|
+
p(!1);
|
|
4440
|
+
}
|
|
4441
|
+
})();
|
|
4442
|
+
}, [i, s.locale]);
|
|
4443
|
+
const F = (f, D) => {
|
|
4444
|
+
E((C) => ({ ...C, [f]: D }));
|
|
4445
|
+
}, M = async (f) => {
|
|
4446
|
+
f.preventDefault(), b(!0), x(null);
|
|
4447
|
+
try {
|
|
4448
|
+
if (!w.externalRefId || w.externalRefId.trim() === "") {
|
|
4449
|
+
x("External Reference ID is required and cannot be empty"), b(!1);
|
|
4450
|
+
return;
|
|
4451
|
+
}
|
|
4452
|
+
const D = {
|
|
4453
|
+
workflowKey: w.workflowKey,
|
|
4454
|
+
externalRefId: w.externalRefId.trim()
|
|
4455
|
+
// Always include, never empty
|
|
4456
|
+
};
|
|
4457
|
+
N.forEach((k) => {
|
|
4458
|
+
if (k === "externalRefId") return;
|
|
4459
|
+
const S = w[k];
|
|
4460
|
+
S != null && S !== "" && !(Array.isArray(S) && S.length === 0) && (D[k] = S);
|
|
4461
|
+
}), console.log("Creating applicant with data:", D);
|
|
4462
|
+
const C = await c(
|
|
4463
|
+
D
|
|
4464
|
+
);
|
|
4465
|
+
console.log("Applicant created:", C), r(C.applicantId);
|
|
4466
|
+
} catch (D) {
|
|
4467
|
+
console.error("Error creating applicant:", D), x(D.message || "Failed to create applicant");
|
|
4468
|
+
} finally {
|
|
4469
|
+
b(!1);
|
|
4470
|
+
}
|
|
4471
|
+
}, I = (f) => {
|
|
4472
|
+
var C, k;
|
|
4473
|
+
const D = ht[f];
|
|
4474
|
+
switch (D.type) {
|
|
4475
|
+
case "select":
|
|
4476
|
+
return f === "country" || f === "nationality" || f === "taxCountry" || f === "countryOfBirth" ? /* @__PURE__ */ n(
|
|
4477
|
+
ye,
|
|
4478
|
+
{
|
|
4479
|
+
label: D.label,
|
|
4480
|
+
value: w[f] || "",
|
|
4481
|
+
onChange: (S) => F(f, S.target.value),
|
|
4482
|
+
options: [
|
|
4483
|
+
{ value: "", label: `Select ${D.label.toLowerCase()}...` },
|
|
4484
|
+
...d
|
|
4485
|
+
],
|
|
4486
|
+
disabled: g
|
|
4487
|
+
},
|
|
4488
|
+
f
|
|
4489
|
+
) : f === "salutation" ? /* @__PURE__ */ n(
|
|
4490
|
+
ye,
|
|
4491
|
+
{
|
|
4492
|
+
label: D.label,
|
|
4493
|
+
value: ((C = w[f]) == null ? void 0 : C.toString()) || "",
|
|
4494
|
+
onChange: (S) => F(f, S.target.value ? Number(S.target.value) : null),
|
|
4495
|
+
options: [
|
|
4496
|
+
{ value: "", label: "Select salutation..." },
|
|
4497
|
+
{ value: Ne.Male.toString(), label: "Male" },
|
|
4498
|
+
{ value: Ne.Female.toString(), label: "Female" },
|
|
4499
|
+
{ value: Ne.Other.toString(), label: "Other" }
|
|
4500
|
+
]
|
|
4501
|
+
},
|
|
4502
|
+
f
|
|
4503
|
+
) : null;
|
|
4504
|
+
case "multiselect":
|
|
4505
|
+
return f === "otherNationality" ? /* @__PURE__ */ n(
|
|
4506
|
+
G,
|
|
4507
|
+
{
|
|
4508
|
+
type: "text",
|
|
4509
|
+
label: D.label,
|
|
4510
|
+
value: ((k = w[f]) == null ? void 0 : k.join(", ")) || "",
|
|
4511
|
+
onChange: (S) => {
|
|
4512
|
+
const $ = S.target.value.split(",").map((oe) => oe.trim()).filter(Boolean);
|
|
4513
|
+
F(f, $);
|
|
4514
|
+
},
|
|
4515
|
+
placeholder: "Enter countries separated by commas"
|
|
4516
|
+
},
|
|
4517
|
+
f
|
|
4518
|
+
) : null;
|
|
4519
|
+
case "date":
|
|
4520
|
+
return /* @__PURE__ */ n(
|
|
4521
|
+
G,
|
|
4522
|
+
{
|
|
4523
|
+
type: "date",
|
|
4524
|
+
label: D.label,
|
|
4525
|
+
value: w[f] || "",
|
|
4526
|
+
onChange: (S) => F(f, S.target.value)
|
|
4527
|
+
},
|
|
4528
|
+
f
|
|
4529
|
+
);
|
|
4530
|
+
case "email":
|
|
4531
|
+
return /* @__PURE__ */ n(
|
|
4532
|
+
G,
|
|
4533
|
+
{
|
|
4534
|
+
type: "email",
|
|
4535
|
+
label: D.label,
|
|
4536
|
+
value: w[f] || "",
|
|
4537
|
+
onChange: (S) => F(f, S.target.value),
|
|
4538
|
+
required: f === "email"
|
|
4539
|
+
},
|
|
4540
|
+
f
|
|
4541
|
+
);
|
|
4542
|
+
case "tel":
|
|
4543
|
+
return /* @__PURE__ */ n(
|
|
4544
|
+
G,
|
|
4545
|
+
{
|
|
4546
|
+
type: "tel",
|
|
4547
|
+
label: D.label,
|
|
4548
|
+
value: w[f] || "",
|
|
4549
|
+
onChange: (S) => F(f, S.target.value),
|
|
4550
|
+
required: f === "phonenumber"
|
|
4551
|
+
},
|
|
4552
|
+
f
|
|
4553
|
+
);
|
|
4554
|
+
case "text":
|
|
4555
|
+
default:
|
|
4556
|
+
return /* @__PURE__ */ n(
|
|
4557
|
+
G,
|
|
4558
|
+
{
|
|
4559
|
+
type: "text",
|
|
4560
|
+
label: D.label,
|
|
4561
|
+
value: w[f] || "",
|
|
4562
|
+
onChange: (S) => F(f, S.target.value),
|
|
4563
|
+
required: f === "firstName" || f === "lastName" || f === "externalRefId"
|
|
4564
|
+
},
|
|
4565
|
+
f
|
|
4566
|
+
);
|
|
4567
|
+
}
|
|
4568
|
+
};
|
|
4569
|
+
return g ? /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4570
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
4571
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading form..." })
|
|
4572
|
+
] }) }) : /* @__PURE__ */ n("form", { onSubmit: M, children: /* @__PURE__ */ o(L, { children: [
|
|
4573
|
+
/* @__PURE__ */ o(Z, { children: [
|
|
4574
|
+
/* @__PURE__ */ n("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: "Create Applicant" }),
|
|
4575
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: "Please fill in the required information to begin the KYC verification process." })
|
|
4576
|
+
] }),
|
|
4577
|
+
/* @__PURE__ */ o(T, { children: [
|
|
4578
|
+
y && /* @__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: [
|
|
4579
|
+
/* @__PURE__ */ n("strong", { children: "Error:" }),
|
|
4580
|
+
" ",
|
|
4581
|
+
y
|
|
4582
|
+
] }) }),
|
|
4583
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: N.map((f) => I(f)) })
|
|
4584
|
+
] }),
|
|
4585
|
+
/* @__PURE__ */ o(te, { className: "flex justify-between", children: [
|
|
4586
|
+
a && /* @__PURE__ */ n(j, { type: "button", variant: "outline", onClick: a, disabled: m || l, children: "Cancel" }),
|
|
4587
|
+
/* @__PURE__ */ n(j, { type: "submit", isLoading: m || l, children: "Create Applicant" })
|
|
4588
|
+
] })
|
|
4589
|
+
] }) });
|
|
4590
|
+
}, Hr = ({
|
|
4591
|
+
applicantId: t,
|
|
4592
|
+
onComplete: e,
|
|
4593
|
+
onError: r,
|
|
4594
|
+
theme: a = "light",
|
|
4595
|
+
className: s
|
|
4596
|
+
}) => {
|
|
4597
|
+
const {
|
|
4598
|
+
progress: i,
|
|
4599
|
+
currentStep: c,
|
|
4600
|
+
steps: l,
|
|
4601
|
+
workflowKey: d,
|
|
4602
|
+
nextWorkflowKey: u,
|
|
4603
|
+
hasWorkflowChanged: g,
|
|
4604
|
+
isLoading: p,
|
|
4605
|
+
error: m,
|
|
4606
|
+
moveBack: b,
|
|
4607
|
+
refreshProgress: y
|
|
4608
|
+
} = Yt(t), [x, R] = ce.useState(!1);
|
|
4609
|
+
if (ce.useEffect(() => {
|
|
4610
|
+
m && r && r(m);
|
|
4611
|
+
}, [m, r]), ce.useEffect(() => {
|
|
4612
|
+
i != null && i.workflowResult && e && e(i.workflowResult);
|
|
4613
|
+
}, [i == null ? void 0 : i.workflowResult, e]), ce.useEffect(() => {
|
|
4614
|
+
a === "dark" ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
|
|
4615
|
+
}, [a]), ce.useEffect(() => {
|
|
4616
|
+
g && R(!1);
|
|
4617
|
+
}, [g]), p || !i)
|
|
4618
|
+
return /* @__PURE__ */ n("div", { className: s, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4619
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
4620
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: "Loading workflow..." })
|
|
4621
|
+
] }) }) });
|
|
4622
|
+
if (m)
|
|
4623
|
+
return /* @__PURE__ */ n("div", { className: s, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
4624
|
+
/* @__PURE__ */ n("p", { className: "text-danger-500 text-lg mb-4", children: "An error occurred" }),
|
|
4625
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400", children: m.message })
|
|
4626
|
+
] }) }) }) });
|
|
4627
|
+
if (g && !x)
|
|
4628
|
+
return /* @__PURE__ */ n("div", { className: s, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(T, { children: /* @__PURE__ */ o("div", { className: "text-center py-8", children: [
|
|
4629
|
+
/* @__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" }) }) }) }),
|
|
4630
|
+
/* @__PURE__ */ n("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white mb-2", children: "Workflow Transition" }),
|
|
4631
|
+
/* @__PURE__ */ n("p", { className: "text-gray-600 dark:text-gray-400 mb-6", children: "Your application workflow has been updated based on your progress." }),
|
|
4632
|
+
/* @__PURE__ */ o("div", { className: "bg-gray-50 dark:bg-gray-800 rounded-lg p-4 mb-6 max-w-md mx-auto", children: [
|
|
4633
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between text-sm", children: [
|
|
4634
|
+
/* @__PURE__ */ o("div", { className: "text-left", children: [
|
|
4635
|
+
/* @__PURE__ */ n("p", { className: "text-gray-500 dark:text-gray-400 mb-1", children: "Previous Workflow" }),
|
|
4636
|
+
/* @__PURE__ */ n("p", { className: "font-medium text-gray-900 dark:text-white", children: d })
|
|
4637
|
+
] }),
|
|
4638
|
+
/* @__PURE__ */ n("svg", { className: "w-6 h-6 text-gray-400 mx-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 7l5 5m0 0l-5 5m5-5H6" }) }),
|
|
4639
|
+
/* @__PURE__ */ o("div", { className: "text-right", children: [
|
|
4640
|
+
/* @__PURE__ */ n("p", { className: "text-gray-500 dark:text-gray-400 mb-1", children: "New Workflow" }),
|
|
4641
|
+
/* @__PURE__ */ n("p", { className: "font-medium text-blue-600 dark:text-blue-400", children: u })
|
|
4642
|
+
] })
|
|
4643
|
+
] }),
|
|
4644
|
+
i.nextWorkflowName && /* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-2 text-xs", children: i.nextWorkflowName })
|
|
4645
|
+
] }),
|
|
4646
|
+
/* @__PURE__ */ n(
|
|
4647
|
+
"button",
|
|
4648
|
+
{
|
|
4649
|
+
onClick: () => R(!0),
|
|
4650
|
+
className: "px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",
|
|
4651
|
+
children: "Continue with New Workflow"
|
|
4652
|
+
}
|
|
4653
|
+
)
|
|
4654
|
+
] }) }) }) });
|
|
4655
|
+
if (i.status === ae.Finished || i.status === ae.OnHold)
|
|
4656
|
+
return /* @__PURE__ */ n("div", { className: s, children: /* @__PURE__ */ n(
|
|
4657
|
+
Be,
|
|
4658
|
+
{
|
|
4659
|
+
kycStatus: i.kycStatus,
|
|
4660
|
+
reviewStatus: i.reviewStatus,
|
|
4661
|
+
workflowResult: i.workflowResult,
|
|
4662
|
+
customMessage: i.customMessage,
|
|
4663
|
+
onContinue: e && i.workflowResult ? () => e(i.workflowResult) : void 0,
|
|
4664
|
+
onContactSupport: () => {
|
|
4665
|
+
typeof window < "u" && (window.location.href = "mailto:support@example.com");
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
) });
|
|
4669
|
+
if (!c)
|
|
4670
|
+
return /* @__PURE__ */ n("div", { className: s, children: /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { children: [
|
|
4671
|
+
/* @__PURE__ */ n(se, { className: "my-8" }),
|
|
4672
|
+
/* @__PURE__ */ n("p", { className: "text-center text-gray-600 dark:text-gray-400 mt-4", children: i.status === ae.IdentityPending ? "Loading identity verification..." : "Loading current step..." })
|
|
4673
|
+
] }) }) });
|
|
4674
|
+
const h = () => {
|
|
4675
|
+
const w = l.filter((I) => I.visibility !== !1), E = w.findIndex((I) => I.order === c.order), F = E >= 0 ? E + 1 : 1, M = w.length;
|
|
4676
|
+
return /* @__PURE__ */ o("div", { className: "mb-6", children: [
|
|
4677
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-4", children: [
|
|
4678
|
+
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold", children: "KYC Verification" }),
|
|
4679
|
+
/* @__PURE__ */ o(ue, { variant: i.status === 1 ? "info" : "success", children: [
|
|
4680
|
+
"Step ",
|
|
4681
|
+
F,
|
|
4682
|
+
" of ",
|
|
4683
|
+
M
|
|
4684
|
+
] })
|
|
4685
|
+
] }),
|
|
4686
|
+
/* @__PURE__ */ n("div", { className: "flex items-center", children: w.map((I, A) => {
|
|
4687
|
+
const B = A < E, z = I.order === c.order;
|
|
4688
|
+
return /* @__PURE__ */ o(ce.Fragment, { children: [
|
|
4689
|
+
/* @__PURE__ */ o("div", { className: "flex items-center", children: [
|
|
4690
|
+
/* @__PURE__ */ n(
|
|
4691
|
+
"div",
|
|
4692
|
+
{
|
|
4693
|
+
className: `
|
|
4694
|
+
w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium
|
|
4695
|
+
${B || z ? "bg-primary-500 text-white" : "bg-gray-200 text-gray-600 dark:bg-gray-700 dark:text-gray-400"}
|
|
4696
|
+
`,
|
|
4697
|
+
children: A + 1
|
|
4698
|
+
}
|
|
4699
|
+
),
|
|
4700
|
+
/* @__PURE__ */ n(
|
|
4701
|
+
"span",
|
|
4702
|
+
{
|
|
4703
|
+
className: `ml-2 text-sm ${z ? "font-semibold text-gray-900 dark:text-white" : "text-gray-600 dark:text-gray-400"}`,
|
|
4704
|
+
children: I.displayName
|
|
4705
|
+
}
|
|
4706
|
+
)
|
|
4707
|
+
] }),
|
|
4708
|
+
A < w.length - 1 && /* @__PURE__ */ n(
|
|
4709
|
+
"div",
|
|
4710
|
+
{
|
|
4711
|
+
className: `flex-1 h-0.5 mx-4 ${B ? "bg-primary-500" : "bg-gray-200 dark:bg-gray-700"}`
|
|
4712
|
+
}
|
|
4713
|
+
)
|
|
4714
|
+
] }, I.order);
|
|
4715
|
+
}) })
|
|
4716
|
+
] });
|
|
4717
|
+
}, N = () => {
|
|
4718
|
+
const w = {
|
|
4719
|
+
applicantId: t,
|
|
4720
|
+
onComplete: async () => {
|
|
4721
|
+
await y();
|
|
4722
|
+
},
|
|
4723
|
+
onBack: c.order > 0 ? b : void 0
|
|
4724
|
+
};
|
|
4725
|
+
switch (c.action) {
|
|
4726
|
+
case K.Questionaries:
|
|
4727
|
+
return /* @__PURE__ */ n(fr, { ...w });
|
|
4728
|
+
case K.UploadDocument:
|
|
4729
|
+
return /* @__PURE__ */ n(br, { ...w });
|
|
4730
|
+
case K.Overview:
|
|
4731
|
+
return /* @__PURE__ */ n(xr, { ...w });
|
|
4732
|
+
case K.IdentitySdk:
|
|
4733
|
+
return /* @__PURE__ */ n(Nr, { ...w });
|
|
4734
|
+
case K.RiskScoring:
|
|
4735
|
+
return /* @__PURE__ */ n(vr, { ...w });
|
|
4736
|
+
case K.AdditionalData:
|
|
4737
|
+
case K.InvestorCategorization:
|
|
4738
|
+
return /* @__PURE__ */ n(wr, { ...w });
|
|
4739
|
+
case K.AppropriatenessTest:
|
|
4740
|
+
return /* @__PURE__ */ n(kr, { ...w });
|
|
4741
|
+
case K.ManualReview:
|
|
4742
|
+
return /* @__PURE__ */ n(
|
|
4743
|
+
Be,
|
|
4744
|
+
{
|
|
4745
|
+
kycStatus: i.kycStatus,
|
|
4746
|
+
reviewStatus: i.reviewStatus,
|
|
4747
|
+
workflowResult: i.workflowResult,
|
|
4748
|
+
customMessage: i.customMessage
|
|
4749
|
+
}
|
|
4750
|
+
);
|
|
4751
|
+
default:
|
|
4752
|
+
return /* @__PURE__ */ n(L, { children: /* @__PURE__ */ o(T, { className: "py-12 text-center", children: [
|
|
4753
|
+
/* @__PURE__ */ n("div", { className: "mb-4", children: /* @__PURE__ */ n(se, {}) }),
|
|
4754
|
+
/* @__PURE__ */ o("p", { className: "text-gray-600 dark:text-gray-400 mb-2", children: [
|
|
4755
|
+
"Processing step: ",
|
|
4756
|
+
c.title || c.name
|
|
4757
|
+
] }),
|
|
4758
|
+
/* @__PURE__ */ o("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: [
|
|
4759
|
+
"Action type: ",
|
|
4760
|
+
K[c.action]
|
|
4761
|
+
] })
|
|
4762
|
+
] }) });
|
|
4763
|
+
}
|
|
4764
|
+
};
|
|
4765
|
+
return /* @__PURE__ */ o("div", { className: s, children: [
|
|
4766
|
+
h(),
|
|
4767
|
+
N()
|
|
4768
|
+
] });
|
|
4769
|
+
};
|
|
4770
|
+
export {
|
|
4771
|
+
Dr as ALL_APPLICANT_FIELDS,
|
|
4772
|
+
tt as ApplicantProgressOnHoldReason,
|
|
4773
|
+
ae as ApplicantProgressStatus,
|
|
4774
|
+
ft as ApplicantService,
|
|
4775
|
+
nt as ApplicantStatus,
|
|
4776
|
+
lt as AppropriatenessQuestionType,
|
|
4777
|
+
vt as AppropriatenessTestService,
|
|
4778
|
+
kr as AppropriatenessTestStep,
|
|
4779
|
+
ue as Badge,
|
|
4780
|
+
St as BaseInformationService,
|
|
4781
|
+
j as Button,
|
|
4782
|
+
L as Card,
|
|
4783
|
+
T as CardContent,
|
|
4784
|
+
te as CardFooter,
|
|
4785
|
+
Z as CardHeader,
|
|
4786
|
+
qr as CreateApplicantForm,
|
|
4787
|
+
dt as CriteriaBuiltInType,
|
|
4788
|
+
mt as DEFAULT_VISIBLE_FIELDS,
|
|
4789
|
+
ot as DocumentReviewStatus,
|
|
4790
|
+
gt as EndpointBuilder,
|
|
4791
|
+
xe as ErrorHandler,
|
|
4792
|
+
Lt as EventEmitter,
|
|
4793
|
+
ht as FIELD_METADATA,
|
|
4794
|
+
it as FileType,
|
|
4795
|
+
er as FileUpload,
|
|
4796
|
+
Ne as GenderType,
|
|
4797
|
+
yt as HttpClient,
|
|
4798
|
+
fe as IdentityProviderManager,
|
|
4799
|
+
Nt as IdentityService,
|
|
4800
|
+
ne as IdentityVerificationProvider,
|
|
4801
|
+
Nr as IdentityVerificationStep,
|
|
4802
|
+
G as Input,
|
|
4803
|
+
Ct as InvestorCategorizationService,
|
|
4804
|
+
wr as InvestorCategorizationStep,
|
|
4805
|
+
X as InvestorCategorizationType,
|
|
4806
|
+
ut as InvestorCategoryType,
|
|
4807
|
+
at as KycProcessStatus,
|
|
4808
|
+
pe as KycStatus,
|
|
4809
|
+
Be as KycStatusDisplay,
|
|
4810
|
+
Hr as KycWorkflow,
|
|
4811
|
+
Kr as Logo,
|
|
4812
|
+
$e as MetaKYCContext,
|
|
4813
|
+
le as MetaKYCError,
|
|
4814
|
+
Lr as MetaKYCProvider,
|
|
4815
|
+
zt as OnfidoProvider,
|
|
4816
|
+
wt as OverviewService,
|
|
4817
|
+
xr as OverviewStep,
|
|
4818
|
+
tr as PhoneInput,
|
|
4819
|
+
bt as QuestionnaireService,
|
|
4820
|
+
fr as QuestionnaireStep,
|
|
4821
|
+
ge as ReviewStatus,
|
|
4822
|
+
ct as RiskCriteriaType,
|
|
4823
|
+
rt as RiskLevel,
|
|
4824
|
+
kt as RiskScoringService,
|
|
4825
|
+
vr as RiskScoringStep,
|
|
4826
|
+
_t as SardinAIProvider,
|
|
4827
|
+
ye as Select,
|
|
4828
|
+
se as Spinner,
|
|
4829
|
+
Mt as StepRouter,
|
|
4830
|
+
Ot as SumsubProvider,
|
|
4831
|
+
jt as ThemeManager,
|
|
4832
|
+
Y as ThemePreset,
|
|
4833
|
+
Ft as ThemeService,
|
|
4834
|
+
xt as UploadDocumentService,
|
|
4835
|
+
br as UploadDocumentStep,
|
|
4836
|
+
st as UserType,
|
|
4837
|
+
Ee as ValueDataType,
|
|
4838
|
+
Bt as WorkflowOrchestrator,
|
|
4839
|
+
ke as WorkflowResultType,
|
|
4840
|
+
Tt as WorkflowState,
|
|
4841
|
+
K as WorkflowStepAction,
|
|
4842
|
+
Ur as appropriatenessTestSchema,
|
|
4843
|
+
zr as clearAllStorage,
|
|
4844
|
+
qt as clearApplicantId,
|
|
4845
|
+
Vt as clearWorkflowState,
|
|
4846
|
+
J as cn,
|
|
4847
|
+
At as corporateTheme,
|
|
4848
|
+
pt as defaultConfig,
|
|
4849
|
+
ee as defaultTheme,
|
|
4850
|
+
$t as fileToBase64,
|
|
4851
|
+
Et as fintechTheme,
|
|
4852
|
+
Ce as formatFileSize,
|
|
4853
|
+
$r as generateAppropriatenessSchema,
|
|
4854
|
+
hr as generateQuestionnaireSchema,
|
|
4855
|
+
gr as generateRiskScoringSchema,
|
|
4856
|
+
jr as generateUploadDocumentSchema,
|
|
4857
|
+
Br as getAcceptString,
|
|
4858
|
+
Kt as getApplicantId,
|
|
4859
|
+
ve as getThemePreset,
|
|
4860
|
+
Or as getWorkflowState,
|
|
4861
|
+
It as healthcareTheme,
|
|
4862
|
+
Pr as isScriptLoaded,
|
|
4863
|
+
je as loadScript,
|
|
4864
|
+
Dt as minimalTheme,
|
|
4865
|
+
Rt as modernTheme,
|
|
4866
|
+
Fr as removeScript,
|
|
4867
|
+
Ut as saveApplicantId,
|
|
4868
|
+
Ht as saveWorkflowState,
|
|
4869
|
+
Pt as themePresets,
|
|
4870
|
+
Xt as useApplicant,
|
|
4871
|
+
_r as useAppropriatenessTest,
|
|
4872
|
+
Zt as useIdentityVerification,
|
|
4873
|
+
Yt as useKycWorkflow,
|
|
4874
|
+
ie as useMetaKYC,
|
|
4875
|
+
Gt as useOverview,
|
|
4876
|
+
Wt as useQuestionnaire,
|
|
4877
|
+
Jt as useRiskScoring,
|
|
4878
|
+
Qt as useUploadDocument,
|
|
4879
|
+
Tr as validateFileSize,
|
|
4880
|
+
Mr as validateFileType
|
|
4881
|
+
};
|
|
4882
|
+
//# sourceMappingURL=index.js.map
|