@vpdev2/metakyc 1.0.56 → 1.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/session.d.ts +12 -15
- package/dist/client/session.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +140 -131
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var xe = (e, t, a) => ki(e, typeof t != "symbol" ? t + "" : t, a);
|
|
|
4
4
|
import ti from "axios";
|
|
5
5
|
import { jsx as i, jsxs as s, Fragment as kt } from "react/jsx-runtime";
|
|
6
6
|
import * as Vt from "react";
|
|
7
|
-
import Re, { createContext as ii, useMemo as
|
|
7
|
+
import Re, { createContext as ii, useMemo as Ue, useState as w, useEffect as he, useContext as ri, useCallback as oe, useRef as ge, forwardRef as xt, createElement as Et } from "react";
|
|
8
8
|
import hi, { createPortal as Mt } from "react-dom";
|
|
9
9
|
import { useForm as vi, Controller as ut } from "react-hook-form";
|
|
10
10
|
import { z as rt } from "zod";
|
|
@@ -300,8 +300,17 @@ class Oa {
|
|
|
300
300
|
const { baseUrl: a, apiKey: r, secretKey: n, tenantId: o, clientId: l, externalRefId: d, workflowKey: u, isCompany: m, applicant: f } = t;
|
|
301
301
|
if (!o && !l)
|
|
302
302
|
throw new Error("Either tenantId or clientId must be provided.");
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
if (!d)
|
|
304
|
+
throw new Error("externalRefId is required. Pass your user's unique ID.");
|
|
305
|
+
if (!u)
|
|
306
|
+
throw new Error("workflowKey is required. Pass the workflow key for this KYC session.");
|
|
307
|
+
const p = {
|
|
308
|
+
apiKey: r,
|
|
309
|
+
secretKey: n,
|
|
310
|
+
externalRefId: d,
|
|
311
|
+
workflowKey: u
|
|
312
|
+
};
|
|
313
|
+
o != null && (p.tenantId = o), l && (p.clientId = l), m != null && (p.isCompany = m), f && (p.applicant = f);
|
|
305
314
|
const C = (await ti.post(
|
|
306
315
|
`${a.replace(/\/+$/, "")}/api/SdkSession/CreateToken`,
|
|
307
316
|
p,
|
|
@@ -580,7 +589,7 @@ class qi {
|
|
|
580
589
|
)).result;
|
|
581
590
|
}
|
|
582
591
|
}
|
|
583
|
-
class
|
|
592
|
+
class Ki {
|
|
584
593
|
constructor(t) {
|
|
585
594
|
this.httpClient = t;
|
|
586
595
|
}
|
|
@@ -648,7 +657,7 @@ class Ui {
|
|
|
648
657
|
return console.log("[IdentityService] Sumsub token refresh result:", a), a.result.accessToken;
|
|
649
658
|
}
|
|
650
659
|
}
|
|
651
|
-
class
|
|
660
|
+
class Ui {
|
|
652
661
|
constructor(t) {
|
|
653
662
|
this.httpClient = t;
|
|
654
663
|
}
|
|
@@ -6788,7 +6797,7 @@ function Tr(e, t) {
|
|
|
6788
6797
|
return n != null ? String(n) : `{{${r}}}`;
|
|
6789
6798
|
}) : e;
|
|
6790
6799
|
}
|
|
6791
|
-
function
|
|
6800
|
+
function Kt(e, t) {
|
|
6792
6801
|
const a = { ...e };
|
|
6793
6802
|
for (const r of Object.keys(t)) {
|
|
6794
6803
|
const n = t[r];
|
|
@@ -6800,7 +6809,7 @@ function Dt(e) {
|
|
|
6800
6809
|
const t = e.toLowerCase().split(/[-_]/)[0];
|
|
6801
6810
|
return Pt[t] || Pt.en;
|
|
6802
6811
|
}
|
|
6803
|
-
function
|
|
6812
|
+
function Ut(e, t) {
|
|
6804
6813
|
for (const a of Object.keys(e)) {
|
|
6805
6814
|
const r = e[a];
|
|
6806
6815
|
if (r && typeof r == "object" && typeof r[t] == "string")
|
|
@@ -6810,7 +6819,7 @@ function Kt(e, t) {
|
|
|
6810
6819
|
function oi(e) {
|
|
6811
6820
|
const t = Pt.en;
|
|
6812
6821
|
return (a, r) => {
|
|
6813
|
-
const n = !a.includes("."), o = qt(e, a) ?? (n ?
|
|
6822
|
+
const n = !a.includes("."), o = qt(e, a) ?? (n ? Ut(e, a) : void 0) ?? qt(t, a) ?? (n ? Ut(t, a) : void 0) ?? a;
|
|
6814
6823
|
return Tr(o, r);
|
|
6815
6824
|
};
|
|
6816
6825
|
}
|
|
@@ -6823,17 +6832,17 @@ function Q(e, t) {
|
|
|
6823
6832
|
const r = Rr.exec(a);
|
|
6824
6833
|
return r ? t(r[1]) : e;
|
|
6825
6834
|
}
|
|
6826
|
-
const si = "1.0.
|
|
6835
|
+
const si = "1.0.57", li = ii(null), Yt = `metakyc-translations-${si}-`, Ir = ({
|
|
6827
6836
|
locale: e,
|
|
6828
6837
|
fetchTranslations: t,
|
|
6829
6838
|
children: a
|
|
6830
6839
|
}) => {
|
|
6831
|
-
const r = e.toLowerCase().split(/[-_]/)[0], n =
|
|
6840
|
+
const r = e.toLowerCase().split(/[-_]/)[0], n = Ue(() => {
|
|
6832
6841
|
const u = Dt(r);
|
|
6833
6842
|
if (typeof window > "u") return u;
|
|
6834
6843
|
try {
|
|
6835
6844
|
const m = localStorage.getItem(Yt + r);
|
|
6836
|
-
if (m) return
|
|
6845
|
+
if (m) return Kt(u, JSON.parse(m));
|
|
6837
6846
|
} catch {
|
|
6838
6847
|
}
|
|
6839
6848
|
return u;
|
|
@@ -6848,7 +6857,7 @@ const si = "1.0.56", li = ii(null), Yt = `metakyc-translations-${si}-`, Ir = ({
|
|
|
6848
6857
|
return;
|
|
6849
6858
|
}
|
|
6850
6859
|
console.debug("[MetaKYC i18n] Remote overrides loaded for locale:", r, m);
|
|
6851
|
-
const f = Dt(r), p =
|
|
6860
|
+
const f = Dt(r), p = Kt(f, m);
|
|
6852
6861
|
l(p);
|
|
6853
6862
|
try {
|
|
6854
6863
|
localStorage.setItem(Yt + r, JSON.stringify(m));
|
|
@@ -6860,7 +6869,7 @@ const si = "1.0.56", li = ii(null), Yt = `metakyc-translations-${si}-`, Ir = ({
|
|
|
6860
6869
|
u = !0;
|
|
6861
6870
|
};
|
|
6862
6871
|
}, [r, t]);
|
|
6863
|
-
const d =
|
|
6872
|
+
const d = Ue(() => ({
|
|
6864
6873
|
t: oi(o),
|
|
6865
6874
|
locale: r,
|
|
6866
6875
|
dictionary: o
|
|
@@ -6888,8 +6897,8 @@ function Ar() {
|
|
|
6888
6897
|
}
|
|
6889
6898
|
const $t = "metakyc-theme-cache", qa = ({ config: e, children: t }) => {
|
|
6890
6899
|
Ar();
|
|
6891
|
-
const [a, r] = w(null), n = Re.useRef(!1), o = Re.useRef(!1), l =
|
|
6892
|
-
const m = new Mi(e), f = new ji(m), p = new Fi(m), N = new Oi(m), C = new Vi(m), b = new Bi(m), O = new qi(m), T = new
|
|
6900
|
+
const [a, r] = w(null), n = Re.useRef(!1), o = Re.useRef(!1), l = Ue(() => {
|
|
6901
|
+
const m = new Mi(e), f = new ji(m), p = new Fi(m), N = new Oi(m), C = new Vi(m), b = new Bi(m), O = new qi(m), T = new Ki(m), H = new Ui(m), B = new Wi(m), F = new Xi(m), L = new Zi(m), q = new lr();
|
|
6893
6902
|
if (typeof document < "u")
|
|
6894
6903
|
if (e.theme)
|
|
6895
6904
|
q.applyTheme(e.theme);
|
|
@@ -6915,7 +6924,7 @@ const $t = "metakyc-theme-cache", qa = ({ config: e, children: t }) => {
|
|
|
6915
6924
|
translationService: L,
|
|
6916
6925
|
themeManager: q
|
|
6917
6926
|
};
|
|
6918
|
-
}, [e]), d =
|
|
6927
|
+
}, [e]), d = Ue(() => ({
|
|
6919
6928
|
config: e,
|
|
6920
6929
|
...l,
|
|
6921
6930
|
currentTheme: a,
|
|
@@ -7007,10 +7016,10 @@ async function Lr(e) {
|
|
|
7007
7016
|
}, r.onerror = (n) => a(n);
|
|
7008
7017
|
});
|
|
7009
7018
|
}
|
|
7010
|
-
function
|
|
7019
|
+
function Ka(e, t) {
|
|
7011
7020
|
return e.size <= t;
|
|
7012
7021
|
}
|
|
7013
|
-
function
|
|
7022
|
+
function Ua(e, t) {
|
|
7014
7023
|
return t.split(",").map((r) => r.trim()).some((r) => {
|
|
7015
7024
|
if (r.endsWith("/*")) {
|
|
7016
7025
|
const n = r.slice(0, -2);
|
|
@@ -7027,7 +7036,7 @@ function It(e) {
|
|
|
7027
7036
|
function Wa(e) {
|
|
7028
7037
|
return e;
|
|
7029
7038
|
}
|
|
7030
|
-
function
|
|
7039
|
+
function Ke(...e) {
|
|
7031
7040
|
return e.filter(Boolean).join(" ");
|
|
7032
7041
|
}
|
|
7033
7042
|
const Tt = {
|
|
@@ -7505,7 +7514,7 @@ function qr(e) {
|
|
|
7505
7514
|
for (const S of J.riskCriteriaResults ?? [])
|
|
7506
7515
|
if (S.riskCriteriaId != null && S.answer != null && S.answer !== "") {
|
|
7507
7516
|
const z = [...new Set(
|
|
7508
|
-
S.answer.split(",").map((
|
|
7517
|
+
S.answer.split(",").map((K) => K.trim()).filter((K) => K !== "")
|
|
7509
7518
|
)];
|
|
7510
7519
|
z.length > 0 && (ie[S.riskCriteriaId] = z);
|
|
7511
7520
|
}
|
|
@@ -7619,7 +7628,7 @@ function di() {
|
|
|
7619
7628
|
stopProgress: N
|
|
7620
7629
|
};
|
|
7621
7630
|
}
|
|
7622
|
-
const
|
|
7631
|
+
const Kr = {
|
|
7623
7632
|
primary: {
|
|
7624
7633
|
backgroundColor: "var(--metakyc-primary, #2563eb)",
|
|
7625
7634
|
color: "#ffffff",
|
|
@@ -7667,7 +7676,7 @@ const Ur = {
|
|
|
7667
7676
|
return /* @__PURE__ */ s(
|
|
7668
7677
|
"button",
|
|
7669
7678
|
{
|
|
7670
|
-
className:
|
|
7679
|
+
className: Ke(u, m[a], o),
|
|
7671
7680
|
style: {
|
|
7672
7681
|
display: "inline-flex",
|
|
7673
7682
|
alignItems: "center",
|
|
@@ -7680,7 +7689,7 @@ const Ur = {
|
|
|
7680
7689
|
opacity: n || r ? 0.5 : 1,
|
|
7681
7690
|
lineHeight: "1.25rem",
|
|
7682
7691
|
...f[a],
|
|
7683
|
-
...
|
|
7692
|
+
...Kr[t],
|
|
7684
7693
|
...l
|
|
7685
7694
|
},
|
|
7686
7695
|
disabled: n || r,
|
|
@@ -7739,7 +7748,7 @@ const Ur = {
|
|
|
7739
7748
|
"input",
|
|
7740
7749
|
{
|
|
7741
7750
|
ref: u,
|
|
7742
|
-
className:
|
|
7751
|
+
className: Ke(
|
|
7743
7752
|
"block w-full rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
7744
7753
|
"focus:outline-none focus:ring-2 focus:ring-offset-0",
|
|
7745
7754
|
"disabled:opacity-60 disabled:cursor-not-allowed",
|
|
@@ -7768,7 +7777,7 @@ Ne.displayName = "Input";
|
|
|
7768
7777
|
const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
7769
7778
|
"div",
|
|
7770
7779
|
{
|
|
7771
|
-
className:
|
|
7780
|
+
className: Ke("metakyc-card rounded-xl shadow-sm border", t),
|
|
7772
7781
|
style: {
|
|
7773
7782
|
backgroundColor: "var(--metakyc-surface, #ffffff)",
|
|
7774
7783
|
borderColor: "var(--metakyc-border, #e5e7eb)",
|
|
@@ -7784,7 +7793,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7784
7793
|
), Ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
7785
7794
|
"div",
|
|
7786
7795
|
{
|
|
7787
|
-
className:
|
|
7796
|
+
className: Ke("metakyc-card-header px-6 py-4 border-b", t),
|
|
7788
7797
|
style: {
|
|
7789
7798
|
padding: "1rem 1.5rem",
|
|
7790
7799
|
borderBottomWidth: "1px",
|
|
@@ -7798,7 +7807,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7798
7807
|
), ne = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
7799
7808
|
"div",
|
|
7800
7809
|
{
|
|
7801
|
-
className:
|
|
7810
|
+
className: Ke("metakyc-card-content px-6 py-4", t),
|
|
7802
7811
|
style: { padding: "1rem 1.5rem", ...a },
|
|
7803
7812
|
...r,
|
|
7804
7813
|
children: e
|
|
@@ -7806,7 +7815,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7806
7815
|
), Le = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
7807
7816
|
"div",
|
|
7808
7817
|
{
|
|
7809
|
-
className:
|
|
7818
|
+
className: Ke("metakyc-card-footer px-6 py-4 border-t", t),
|
|
7810
7819
|
style: {
|
|
7811
7820
|
padding: "1rem 1.5rem",
|
|
7812
7821
|
borderTopWidth: "1px",
|
|
@@ -7817,7 +7826,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7817
7826
|
...r,
|
|
7818
7827
|
children: e
|
|
7819
7828
|
}
|
|
7820
|
-
),
|
|
7829
|
+
), Ur = {
|
|
7821
7830
|
display: "inline-flex",
|
|
7822
7831
|
alignItems: "center",
|
|
7823
7832
|
justifyContent: "center",
|
|
@@ -7853,7 +7862,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7853
7862
|
(d.key === " " || d.key === "Enter") && (d.preventDefault(), a || t(!e));
|
|
7854
7863
|
},
|
|
7855
7864
|
style: {
|
|
7856
|
-
...
|
|
7865
|
+
...Ur,
|
|
7857
7866
|
backgroundColor: e ? l : o,
|
|
7858
7867
|
borderColor: e ? l : n,
|
|
7859
7868
|
opacity: a ? 0.5 : 1,
|
|
@@ -7909,7 +7918,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7909
7918
|
}, mi = ({ children: e, variant: t = "default", className: a, style: r, ...n }) => /* @__PURE__ */ i(
|
|
7910
7919
|
"span",
|
|
7911
7920
|
{
|
|
7912
|
-
className:
|
|
7921
|
+
className: Ke(
|
|
7913
7922
|
"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
|
|
7914
7923
|
a
|
|
7915
7924
|
),
|
|
@@ -7923,10 +7932,10 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7923
7932
|
md: "h-8 w-8",
|
|
7924
7933
|
lg: "h-12 w-12"
|
|
7925
7934
|
};
|
|
7926
|
-
return /* @__PURE__ */ i("div", { className:
|
|
7935
|
+
return /* @__PURE__ */ i("div", { className: Ke("flex items-center justify-center", t), ...a, children: /* @__PURE__ */ s(
|
|
7927
7936
|
"svg",
|
|
7928
7937
|
{
|
|
7929
|
-
className:
|
|
7938
|
+
className: Ke("animate-spin text-primary-500", r[e]),
|
|
7930
7939
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7931
7940
|
fill: "none",
|
|
7932
7941
|
viewBox: "0 0 24 24",
|
|
@@ -7970,7 +7979,7 @@ const ae = ({ children: e, className: t, style: a, ...r }) => /* @__PURE__ */ i(
|
|
|
7970
7979
|
"select",
|
|
7971
7980
|
{
|
|
7972
7981
|
ref: u,
|
|
7973
|
-
className:
|
|
7982
|
+
className: Ke(
|
|
7974
7983
|
"block w-full rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
7975
7984
|
"focus:outline-none focus:ring-2 focus:ring-offset-0",
|
|
7976
7985
|
"disabled:opacity-60 disabled:cursor-not-allowed",
|
|
@@ -8079,7 +8088,7 @@ const _t = 280, Yr = ({
|
|
|
8079
8088
|
window.removeEventListener("scroll", M, !0), window.removeEventListener("resize", M);
|
|
8080
8089
|
};
|
|
8081
8090
|
}, [p, J]);
|
|
8082
|
-
const
|
|
8091
|
+
const K = r.filter(
|
|
8083
8092
|
(M) => M.label.toLowerCase().includes(C.toLowerCase())
|
|
8084
8093
|
), ee = (M) => {
|
|
8085
8094
|
f || a(t.includes(M) ? t.filter((E) => E !== M) : [...t, M]);
|
|
@@ -8138,7 +8147,7 @@ const _t = 280, Yr = ({
|
|
|
8138
8147
|
}
|
|
8139
8148
|
}
|
|
8140
8149
|
) }),
|
|
8141
|
-
/* @__PURE__ */ i("ul", { style: { listStyle: "none", margin: 0, padding: "4px 0", maxHeight: "192px", overflowY: "auto" }, children:
|
|
8150
|
+
/* @__PURE__ */ i("ul", { style: { listStyle: "none", margin: 0, padding: "4px 0", maxHeight: "192px", overflowY: "auto" }, children: K.length === 0 ? /* @__PURE__ */ i("li", { style: { padding: "8px 12px", fontSize: "13px", color: je }, children: u("common.noResults") }) : K.map((M) => {
|
|
8142
8151
|
const E = t.includes(M.value);
|
|
8143
8152
|
return /* @__PURE__ */ s(
|
|
8144
8153
|
"li",
|
|
@@ -8213,7 +8222,7 @@ const _t = 280, Yr = ({
|
|
|
8213
8222
|
{
|
|
8214
8223
|
ref: L,
|
|
8215
8224
|
onClick: () => p ? z() : S(),
|
|
8216
|
-
className:
|
|
8225
|
+
className: Ke(
|
|
8217
8226
|
"metakyc-multiselect-trigger",
|
|
8218
8227
|
"w-full px-3 py-2 rounded-lg border text-sm transition-colors relative",
|
|
8219
8228
|
f ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
@@ -8321,7 +8330,7 @@ const _t = 280, Yr = ({
|
|
|
8321
8330
|
primaryLight: _("--metakyc-primary-light", "#eff6ff"),
|
|
8322
8331
|
hoverBg: _("--metakyc-surface", ve)
|
|
8323
8332
|
});
|
|
8324
|
-
}, []), ie = ge(null), S = ge(null), z = ge(null),
|
|
8333
|
+
}, []), ie = ge(null), S = ge(null), z = ge(null), K = ge(null), ee = oe(() => {
|
|
8325
8334
|
if (!S.current) return null;
|
|
8326
8335
|
const j = S.current.getBoundingClientRect(), ve = window.innerHeight - j.bottom < Gt && j.top > Gt;
|
|
8327
8336
|
return {
|
|
@@ -8356,9 +8365,9 @@ const _t = 280, Yr = ({
|
|
|
8356
8365
|
window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j);
|
|
8357
8366
|
};
|
|
8358
8367
|
}, [b, ee]), he(() => {
|
|
8359
|
-
b &&
|
|
8368
|
+
b && K.current && setTimeout(() => {
|
|
8360
8369
|
var j;
|
|
8361
|
-
return (j =
|
|
8370
|
+
return (j = K.current) == null ? void 0 : j.focus();
|
|
8362
8371
|
}, 0);
|
|
8363
8372
|
}, [b]);
|
|
8364
8373
|
const de = r.filter(
|
|
@@ -8387,7 +8396,7 @@ const _t = 280, Yr = ({
|
|
|
8387
8396
|
/* @__PURE__ */ i("div", { style: { padding: "8px", borderBottom: `1px solid ${Ce}` }, children: /* @__PURE__ */ i(
|
|
8388
8397
|
"input",
|
|
8389
8398
|
{
|
|
8390
|
-
ref:
|
|
8399
|
+
ref: K,
|
|
8391
8400
|
type: "text",
|
|
8392
8401
|
value: T,
|
|
8393
8402
|
onChange: (j) => H(j.target.value),
|
|
@@ -8460,7 +8469,7 @@ const _t = 280, Yr = ({
|
|
|
8460
8469
|
return /* @__PURE__ */ s(
|
|
8461
8470
|
"div",
|
|
8462
8471
|
{
|
|
8463
|
-
className:
|
|
8472
|
+
className: Ke("w-full metakyc-searchable-select", f),
|
|
8464
8473
|
ref: ie,
|
|
8465
8474
|
children: [
|
|
8466
8475
|
e && /* @__PURE__ */ s(
|
|
@@ -8484,7 +8493,7 @@ const _t = 280, Yr = ({
|
|
|
8484
8493
|
onKeyDown: (j) => {
|
|
8485
8494
|
(j.key === "Enter" || j.key === " ") && (j.preventDefault(), te()), j.key === "Escape" && W();
|
|
8486
8495
|
},
|
|
8487
|
-
className:
|
|
8496
|
+
className: Ke(
|
|
8488
8497
|
"metakyc-searchable-select-trigger",
|
|
8489
8498
|
"w-full px-3 py-2 rounded-lg border text-sm transition-colors text-left",
|
|
8490
8499
|
"flex items-center justify-between gap-2",
|
|
@@ -8556,10 +8565,10 @@ const $r = ({
|
|
|
8556
8565
|
(S = O.current) == null || S.click();
|
|
8557
8566
|
}, q = (S) => {
|
|
8558
8567
|
b(null);
|
|
8559
|
-
const z = u.filter((
|
|
8568
|
+
const z = u.filter((K, ee) => ee !== S);
|
|
8560
8569
|
d == null || d(z);
|
|
8561
8570
|
}, J = a || C, ie = u.length > 0;
|
|
8562
|
-
return /* @__PURE__ */ s("div", { className:
|
|
8571
|
+
return /* @__PURE__ */ s("div", { className: Ke("metakyc-file-upload", m), style: { width: "100%" }, children: [
|
|
8563
8572
|
e && /* @__PURE__ */ s("div", { style: { marginBottom: "8px" }, children: [
|
|
8564
8573
|
/* @__PURE__ */ s(
|
|
8565
8574
|
"label",
|
|
@@ -8661,7 +8670,7 @@ const $r = ({
|
|
|
8661
8670
|
}
|
|
8662
8671
|
),
|
|
8663
8672
|
ie && /* @__PURE__ */ i("div", { style: { marginTop: "12px", display: "flex", flexDirection: "column", gap: "8px" }, children: u.map((S, z) => {
|
|
8664
|
-
const
|
|
8673
|
+
const K = Hr(S), ee = K === "image", X = ee ? URL.createObjectURL(S) : null;
|
|
8665
8674
|
return /* @__PURE__ */ s(
|
|
8666
8675
|
"div",
|
|
8667
8676
|
{
|
|
@@ -8698,7 +8707,7 @@ const $r = ({
|
|
|
8698
8707
|
alt: S.name,
|
|
8699
8708
|
style: { width: "100%", height: "100%", objectFit: "cover", borderRadius: "8px" }
|
|
8700
8709
|
}
|
|
8701
|
-
) :
|
|
8710
|
+
) : K === "pdf" ? /* @__PURE__ */ s("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "var(--metakyc-danger, #ef4444)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
8702
8711
|
/* @__PURE__ */ i("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
8703
8712
|
/* @__PURE__ */ i("polyline", { points: "14 2 14 8 20 8" }),
|
|
8704
8713
|
/* @__PURE__ */ i("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
@@ -8783,7 +8792,7 @@ const $r = ({
|
|
|
8783
8792
|
type: "text",
|
|
8784
8793
|
value: e,
|
|
8785
8794
|
onChange: (o) => t == null ? void 0 : t(o.target.value),
|
|
8786
|
-
className:
|
|
8795
|
+
className: Ke(
|
|
8787
8796
|
"w-20 rounded-lg border px-3 py-2 text-sm",
|
|
8788
8797
|
"focus:outline-none focus:ring-2 focus:ring-offset-0"
|
|
8789
8798
|
),
|
|
@@ -8801,7 +8810,7 @@ const $r = ({
|
|
|
8801
8810
|
{
|
|
8802
8811
|
ref: n,
|
|
8803
8812
|
type: "tel",
|
|
8804
|
-
className:
|
|
8813
|
+
className: Ke("flex-1", a),
|
|
8805
8814
|
...r,
|
|
8806
8815
|
label: ""
|
|
8807
8816
|
}
|
|
@@ -8992,19 +9001,19 @@ const aa = ({
|
|
|
8992
9001
|
Re.useEffect(() => {
|
|
8993
9002
|
o && Object.keys(o).length > 0 && Object.keys(f).length === 0 && p(o);
|
|
8994
9003
|
}, [o]);
|
|
8995
|
-
const T =
|
|
9004
|
+
const T = Ue(
|
|
8996
9005
|
() => n ? ra(n.questionGroups) : [],
|
|
8997
9006
|
[n]
|
|
8998
9007
|
), H = b === T.length - 1, B = T[b] ?? [], F = oe((S, z) => {
|
|
8999
|
-
p((
|
|
9000
|
-
const ee = { ...
|
|
9008
|
+
p((K) => ({ ...K, [S]: z })), C((K) => {
|
|
9009
|
+
const ee = { ...K };
|
|
9001
9010
|
return delete ee[S], ee;
|
|
9002
9011
|
});
|
|
9003
9012
|
}, []), L = oe(() => {
|
|
9004
9013
|
const S = {};
|
|
9005
9014
|
for (const { question: z } of B) {
|
|
9006
|
-
const
|
|
9007
|
-
|
|
9015
|
+
const K = ia(z, f[z.id] ?? []);
|
|
9016
|
+
K && (S[z.id] = K);
|
|
9008
9017
|
}
|
|
9009
9018
|
return C((z) => ({ ...z, ...S })), Object.keys(S).length === 0;
|
|
9010
9019
|
}, [B, f]), q = () => {
|
|
@@ -9015,7 +9024,7 @@ const aa = ({
|
|
|
9015
9024
|
if (!(!L() || !n))
|
|
9016
9025
|
try {
|
|
9017
9026
|
const S = n.questionGroups.flatMap(
|
|
9018
|
-
(
|
|
9027
|
+
(K) => (K.questions ?? []).map((ee) => ({
|
|
9019
9028
|
questionId: ee.id,
|
|
9020
9029
|
values: f[ee.id] ?? []
|
|
9021
9030
|
}))
|
|
@@ -9209,13 +9218,13 @@ const sa = ({
|
|
|
9209
9218
|
onComplete: t,
|
|
9210
9219
|
onBack: a
|
|
9211
9220
|
}) => {
|
|
9212
|
-
const { t: r } = Ie(), { uploadDocument: n, isLoading: o, isSubmitting: l, error: d, submit: u } = Or(e), [m, f] = w({}), [p, N] = w(null), [C, b] = w(0), [O, T] = w({}), H =
|
|
9221
|
+
const { t: r } = Ie(), { uploadDocument: n, isLoading: o, isSubmitting: l, error: d, submit: u } = Or(e), [m, f] = w({}), [p, N] = w(null), [C, b] = w(0), [O, T] = w({}), H = Ue(
|
|
9213
9222
|
() => n ? oa(n.uploadDocumentFiles) : [],
|
|
9214
9223
|
[n]
|
|
9215
9224
|
), B = H[C] ?? [], F = C === H.length - 1, L = H.length, q = oe(() => {
|
|
9216
9225
|
const z = {};
|
|
9217
|
-
for (const
|
|
9218
|
-
|
|
9226
|
+
for (const K of B)
|
|
9227
|
+
K.isRequired && (m[K.id] || []).length === 0 && (z[K.id] = `${K.displayName} is required`);
|
|
9219
9228
|
return T(z), Object.keys(z).length === 0;
|
|
9220
9229
|
}, [B, m]), J = () => {
|
|
9221
9230
|
q() && (b((z) => z + 1), T({}));
|
|
@@ -9238,12 +9247,12 @@ const sa = ({
|
|
|
9238
9247
|
valueList: W
|
|
9239
9248
|
};
|
|
9240
9249
|
})
|
|
9241
|
-
),
|
|
9250
|
+
), K = {
|
|
9242
9251
|
applicantId: e,
|
|
9243
9252
|
uploadDocumentId: n.id,
|
|
9244
9253
|
uploadDocumentResults: z
|
|
9245
9254
|
};
|
|
9246
|
-
await u(
|
|
9255
|
+
await u(K), t == null || t();
|
|
9247
9256
|
} catch (z) {
|
|
9248
9257
|
N((z == null ? void 0 : z.message) || r("uploadDocument.failedToSubmit"));
|
|
9249
9258
|
}
|
|
@@ -9295,18 +9304,18 @@ const sa = ({
|
|
|
9295
9304
|
marginTop: "12px"
|
|
9296
9305
|
}, children: [
|
|
9297
9306
|
/* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "var(--metakyc-text-muted, #9ca3af)" }, children: r("common.pageXofY", { current: C + 1, total: L }) }),
|
|
9298
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: H.map((z,
|
|
9307
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: H.map((z, K) => /* @__PURE__ */ i(
|
|
9299
9308
|
"div",
|
|
9300
9309
|
{
|
|
9301
9310
|
style: {
|
|
9302
9311
|
height: "6px",
|
|
9303
|
-
width:
|
|
9312
|
+
width: K === C ? "20px" : "6px",
|
|
9304
9313
|
borderRadius: "999px",
|
|
9305
9314
|
transition: "all 0.2s ease",
|
|
9306
|
-
backgroundColor:
|
|
9315
|
+
backgroundColor: K <= C ? "var(--metakyc-primary, #2563eb)" : "var(--metakyc-border, #e5e7eb)"
|
|
9307
9316
|
}
|
|
9308
9317
|
},
|
|
9309
|
-
|
|
9318
|
+
K
|
|
9310
9319
|
)) })
|
|
9311
9320
|
] })
|
|
9312
9321
|
] }),
|
|
@@ -9357,11 +9366,11 @@ const sa = ({
|
|
|
9357
9366
|
required: z.isRequired,
|
|
9358
9367
|
error: O[z.id],
|
|
9359
9368
|
value: m[z.id] || [],
|
|
9360
|
-
onChange: (
|
|
9369
|
+
onChange: (K) => {
|
|
9361
9370
|
N(null), T((ee) => {
|
|
9362
9371
|
const X = { ...ee };
|
|
9363
9372
|
return delete X[z.id], X;
|
|
9364
|
-
}), f((ee) => ({ ...ee, [z.id]:
|
|
9373
|
+
}), f((ee) => ({ ...ee, [z.id]: K }));
|
|
9365
9374
|
}
|
|
9366
9375
|
},
|
|
9367
9376
|
z.id
|
|
@@ -9531,7 +9540,7 @@ const ya = ({
|
|
|
9531
9540
|
Re.useEffect(() => {
|
|
9532
9541
|
d && Object.keys(d).length > 0 && Object.keys(N).length === 0 && C(d);
|
|
9533
9542
|
}, [d]);
|
|
9534
|
-
const L =
|
|
9543
|
+
const L = Ue(
|
|
9535
9544
|
() => l && l.length > 0 ? pa(l) : [],
|
|
9536
9545
|
[l]
|
|
9537
9546
|
), q = T === L.length - 1, J = L[T] ?? [];
|
|
@@ -9552,7 +9561,7 @@ const ya = ({
|
|
|
9552
9561
|
return O((W) => ({ ...W, ...X })), Object.keys(X).length === 0;
|
|
9553
9562
|
}, [J, N]), z = () => {
|
|
9554
9563
|
S() && H((X) => X + 1);
|
|
9555
|
-
},
|
|
9564
|
+
}, K = () => {
|
|
9556
9565
|
T > 0 ? H((X) => X - 1) : a == null || a();
|
|
9557
9566
|
}, ee = async () => {
|
|
9558
9567
|
if (!(!S() || !l))
|
|
@@ -9613,7 +9622,7 @@ const ya = ({
|
|
|
9613
9622
|
{
|
|
9614
9623
|
type: "button",
|
|
9615
9624
|
variant: "outline",
|
|
9616
|
-
onClick:
|
|
9625
|
+
onClick: K,
|
|
9617
9626
|
style: { display: "flex", alignItems: "center", gap: "4px" },
|
|
9618
9627
|
children: [
|
|
9619
9628
|
/* @__PURE__ */ i(gi, { size: 14 }),
|
|
@@ -9887,7 +9896,7 @@ const ha = ({
|
|
|
9887
9896
|
onComplete: t,
|
|
9888
9897
|
onBack: a
|
|
9889
9898
|
}) => {
|
|
9890
|
-
const { t: r } = Ie(), { appropriatenessTestService: n } = Me(), [o, l] = w(null), [d, u] = w(!0), [m, f] = w(!1), [p, N] = w(null), [C, b] = w({}), [O, T] = w(0), [H, B] = w(!1), [F, L] = w(!1), [q, J] = w(0), [ie, S] = w(0), [z,
|
|
9899
|
+
const { t: r } = Ie(), { appropriatenessTestService: n } = Me(), [o, l] = w(null), [d, u] = w(!0), [m, f] = w(!1), [p, N] = w(null), [C, b] = w({}), [O, T] = w(0), [H, B] = w(!1), [F, L] = w(!1), [q, J] = w(0), [ie, S] = w(0), [z, K] = w(null);
|
|
9891
9900
|
he(() => {
|
|
9892
9901
|
(async () => {
|
|
9893
9902
|
try {
|
|
@@ -9951,10 +9960,10 @@ const ha = ({
|
|
|
9951
9960
|
};
|
|
9952
9961
|
try {
|
|
9953
9962
|
const ue = await n.fillAppropriatenessTest(fe);
|
|
9954
|
-
ue.isSuccess ?
|
|
9963
|
+
ue.isSuccess ? K({ success: !0, message: ue.message || r("appropriatenessTest.passedMessage") }) : (K({ success: !1, message: ue.message || r("appropriatenessTest.failedMessage") }), setTimeout(() => W(), 1e3));
|
|
9955
9964
|
} catch (ue) {
|
|
9956
9965
|
if (ue.code === 400 && ue.message)
|
|
9957
|
-
|
|
9966
|
+
K({ success: !1, message: ue.message }), setTimeout(() => W(), 1500);
|
|
9958
9967
|
else
|
|
9959
9968
|
throw ue;
|
|
9960
9969
|
}
|
|
@@ -10010,7 +10019,7 @@ const ha = ({
|
|
|
10010
10019
|
] });
|
|
10011
10020
|
if (z) {
|
|
10012
10021
|
const E = () => {
|
|
10013
|
-
|
|
10022
|
+
K(null), de(), N(null);
|
|
10014
10023
|
};
|
|
10015
10024
|
return /* @__PURE__ */ s(ae, { children: [
|
|
10016
10025
|
/* @__PURE__ */ i(ne, { children: /* @__PURE__ */ s("div", { style: {
|
|
@@ -10458,7 +10467,7 @@ const ha = ({
|
|
|
10458
10467
|
onBack: a
|
|
10459
10468
|
}) => {
|
|
10460
10469
|
var at, Qe, dt, nt;
|
|
10461
|
-
const { t: r } = Ie(), { applicantService: n, baseInformationService: o, identityService: l, config: d, currentTheme: u } = Me(), { identityData: m, provider: f, token: p, isLoading: N, error: C, requestIdentity: b, restartIdentity: O } = Br(e), [T, H] = w(null), [B, F] = w(null), [L, q] = w([]), [J, ie] = w([]), [S, z] = w(!0), [
|
|
10470
|
+
const { t: r } = Ie(), { applicantService: n, baseInformationService: o, identityService: l, config: d, currentTheme: u } = Me(), { identityData: m, provider: f, token: p, isLoading: N, error: C, requestIdentity: b, restartIdentity: O } = Br(e), [T, H] = w(null), [B, F] = w(null), [L, q] = w([]), [J, ie] = w([]), [S, z] = w(!0), [K, ee] = w(!1), [X, W] = w(null), [te, de] = w(!1), le = Re.useRef(!1), [je, re] = w({}), [Ce, Se] = w({}), ye = u != null && u.reviewPageFields && u.reviewPageFields.length > 0 ? u.reviewPageFields[0] : null, M = !!(u != null && u.reviewPageDisabled), E = ge(!1);
|
|
10462
10471
|
E.current = M;
|
|
10463
10472
|
const V = vi({
|
|
10464
10473
|
defaultValues: {
|
|
@@ -10535,8 +10544,8 @@ const ha = ({
|
|
|
10535
10544
|
}
|
|
10536
10545
|
})();
|
|
10537
10546
|
}, [e]), he(() => {
|
|
10538
|
-
m && !
|
|
10539
|
-
}, [m,
|
|
10547
|
+
m && !K && E.current && (console.log("[Identity] Review page disabled — showing cached provider"), ee(!0));
|
|
10548
|
+
}, [m, K]), he(() => {
|
|
10540
10549
|
if (p) {
|
|
10541
10550
|
if (p.expiresAt) {
|
|
10542
10551
|
const k = new Date(p.expiresAt).getTime();
|
|
@@ -10563,7 +10572,7 @@ const ha = ({
|
|
|
10563
10572
|
}, [p]);
|
|
10564
10573
|
const fe = f !== null && f === He.Sumsub;
|
|
10565
10574
|
he(() => {
|
|
10566
|
-
if (f !== null && p && !T &&
|
|
10575
|
+
if (f !== null && p && !T && K && !te) {
|
|
10567
10576
|
const k = f;
|
|
10568
10577
|
if (fe) {
|
|
10569
10578
|
console.log("[Sumsub] Fetching access token for Web SDK…"), W(null), (async () => {
|
|
@@ -10635,7 +10644,7 @@ const ha = ({
|
|
|
10635
10644
|
console.error("[Identity] Error destroying provider:", k);
|
|
10636
10645
|
}
|
|
10637
10646
|
};
|
|
10638
|
-
}, [f, p, T,
|
|
10647
|
+
}, [f, p, T, K, t, te, fe, e, d, l]);
|
|
10639
10648
|
const ue = async () => {
|
|
10640
10649
|
try {
|
|
10641
10650
|
W(null), de(!1), await b(), ee(!0);
|
|
@@ -10660,7 +10669,7 @@ const ha = ({
|
|
|
10660
10669
|
C.message
|
|
10661
10670
|
] }) }) });
|
|
10662
10671
|
const _ = M ? a : () => ee(!1);
|
|
10663
|
-
if (
|
|
10672
|
+
if (K && (X || te))
|
|
10664
10673
|
return /* @__PURE__ */ s(ae, { children: [
|
|
10665
10674
|
/* @__PURE__ */ i(Ae, { children: /* @__PURE__ */ i("h2", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: r("identity.sessionIssueTitle") }) }),
|
|
10666
10675
|
/* @__PURE__ */ s(ne, { children: [
|
|
@@ -10709,7 +10718,7 @@ const ha = ({
|
|
|
10709
10718
|
/* @__PURE__ */ i(Z, { type: "button", onClick: j, disabled: N, children: r(N ? "identity.restarting" : "identity.restartVerification") })
|
|
10710
10719
|
] })
|
|
10711
10720
|
] });
|
|
10712
|
-
if (
|
|
10721
|
+
if (K && m) {
|
|
10713
10722
|
const k = f;
|
|
10714
10723
|
return fe ? /* @__PURE__ */ s("div", { style: {
|
|
10715
10724
|
background: "var(--metakyc-background, #ffffff)",
|
|
@@ -11008,7 +11017,7 @@ const ha = ({
|
|
|
11008
11017
|
const y = Array.isArray(se) ? se : se ? [se] : [], I = (x) => {
|
|
11009
11018
|
k.singleSelect ? Se((g) => ({ ...g, [$]: y[0] === x ? [] : [x] })) : Se((g) => ({
|
|
11010
11019
|
...g,
|
|
11011
|
-
[$]: y.includes(x) ? y.filter((
|
|
11020
|
+
[$]: y.includes(x) ? y.filter((U) => U !== x) : [...y, x]
|
|
11012
11021
|
}));
|
|
11013
11022
|
};
|
|
11014
11023
|
return /* @__PURE__ */ i("div", { style: ke(k.colSpan), children: Te(
|
|
@@ -11068,7 +11077,7 @@ const ha = ({
|
|
|
11068
11077
|
{
|
|
11069
11078
|
label: se,
|
|
11070
11079
|
value: String(y),
|
|
11071
|
-
onChange: (g) => re((
|
|
11080
|
+
onChange: (g) => re((U) => ({ ...U, [G]: g })),
|
|
11072
11081
|
options: [{ value: "", label: r("placeholders.selectCountryCode") }, ...J]
|
|
11073
11082
|
}
|
|
11074
11083
|
),
|
|
@@ -11079,7 +11088,7 @@ const ha = ({
|
|
|
11079
11088
|
{
|
|
11080
11089
|
label: se,
|
|
11081
11090
|
value: String(y),
|
|
11082
|
-
onChange: (g) => re((
|
|
11091
|
+
onChange: (g) => re((U) => ({ ...U, [G]: g })),
|
|
11083
11092
|
options: [{ value: "", label: r("common.select") }, ...L]
|
|
11084
11093
|
}
|
|
11085
11094
|
),
|
|
@@ -11091,7 +11100,7 @@ const ha = ({
|
|
|
11091
11100
|
label: se,
|
|
11092
11101
|
type: ($ == null ? void 0 : $.type) === "date" ? "date" : ($ == null ? void 0 : $.type) === "email" ? "email" : "text",
|
|
11093
11102
|
value: String(y),
|
|
11094
|
-
onChange: (g) => re((
|
|
11103
|
+
onChange: (g) => re((U) => ({ ...U, [G]: g.target.value }))
|
|
11095
11104
|
}
|
|
11096
11105
|
),
|
|
11097
11106
|
k.helpText
|
|
@@ -11495,16 +11504,16 @@ const Ca = {
|
|
|
11495
11504
|
onSuccess: r,
|
|
11496
11505
|
onCancel: n
|
|
11497
11506
|
}) => {
|
|
11498
|
-
var I, x, g,
|
|
11507
|
+
var I, x, g, U, Y, ce, Ee;
|
|
11499
11508
|
const { config: o, baseInformationService: l, currentTheme: d } = Me(), { createApplicant: u, getApplicantData: m, isLoading: f } = di(), { t: p } = Ie(), N = e || ((I = o.applicantForm) == null ? void 0 : I.workflowKey);
|
|
11500
11509
|
if (!N)
|
|
11501
11510
|
throw new Error(
|
|
11502
11511
|
"workflowKey is required. Provide it either as a prop to CreateApplicantForm or set it in config.applicantForm.workflowKey"
|
|
11503
11512
|
);
|
|
11504
|
-
const C = t || ((x = o.applicantForm) == null ? void 0 : x.externalRefId) || "", b = ((g = o.applicantForm) == null ? void 0 : g.email) || "", O = ((
|
|
11513
|
+
const C = t || ((x = o.applicantForm) == null ? void 0 : x.externalRefId) || "", b = ((g = o.applicantForm) == null ? void 0 : g.email) || "", O = ((U = o.applicantForm) == null ? void 0 : U.hiddenValues) || {}, T = ((Y = o.applicantForm) == null ? void 0 : Y.initialValues) || {}, B = (((ce = o.applicantForm) == null ? void 0 : ce.fieldLabelMode) || (d == null ? void 0 : d.fieldLabelMode) || "label") !== "placeholder", F = Ue(
|
|
11505
11514
|
() => d != null && d.applicantFormPages && d.applicantFormPages.length > 0 ? d.applicantFormPages : null,
|
|
11506
11515
|
[d == null ? void 0 : d.applicantFormPages]
|
|
11507
|
-
), L =
|
|
11516
|
+
), L = Ue(() => {
|
|
11508
11517
|
const c = new Set(St), P = d == null ? void 0 : d.applicantFormRequiredFields;
|
|
11509
11518
|
if (P) for (const A of P) c.add(A);
|
|
11510
11519
|
if (F)
|
|
@@ -11512,7 +11521,7 @@ const Ca = {
|
|
|
11512
11521
|
for (const h of A.fields)
|
|
11513
11522
|
!h.isCustom && h.name && h.required && c.add(h.name);
|
|
11514
11523
|
return Array.from(c);
|
|
11515
|
-
}, [d == null ? void 0 : d.applicantFormRequiredFields, F]), q =
|
|
11524
|
+
}, [d == null ? void 0 : d.applicantFormRequiredFields, F]), q = Ue(() => {
|
|
11516
11525
|
var A;
|
|
11517
11526
|
if (F) {
|
|
11518
11527
|
const h = F.flatMap((R) => R.fields).filter((R) => !R.isCustom && R.name).map((R) => R.name), v = new Set(h);
|
|
@@ -11531,7 +11540,7 @@ const Ca = {
|
|
|
11531
11540
|
"countryOfBirth",
|
|
11532
11541
|
"mobileCountryCode",
|
|
11533
11542
|
"otherNationality"
|
|
11534
|
-
]), ie =
|
|
11543
|
+
]), ie = Ue(() => {
|
|
11535
11544
|
var P, A;
|
|
11536
11545
|
const c = /* @__PURE__ */ new Set();
|
|
11537
11546
|
if (F)
|
|
@@ -11542,7 +11551,7 @@ const Ca = {
|
|
|
11542
11551
|
for (const h of q)
|
|
11543
11552
|
J.has(h) && c.add((A = gt[h]) == null ? void 0 : A.countriesType);
|
|
11544
11553
|
return c.size === 0 && c.add(void 0), Array.from(c);
|
|
11545
|
-
}, [q, F]), [S, z] = w({}), [
|
|
11554
|
+
}, [q, F]), [S, z] = w({}), [K, ee] = w(!0), X = ge(/* @__PURE__ */ new Set()), W = ge(/* @__PURE__ */ new Set());
|
|
11546
11555
|
he(() => {
|
|
11547
11556
|
if (!d) return;
|
|
11548
11557
|
const c = ie.filter((h) => {
|
|
@@ -11822,7 +11831,7 @@ const Ca = {
|
|
|
11822
11831
|
value: re[c] || "",
|
|
11823
11832
|
onChange: (mt) => Te(c, mt),
|
|
11824
11833
|
options: [{ value: "", label: Ze ? p("placeholders.selectCountry") : Pe }, ...Oe],
|
|
11825
|
-
disabled:
|
|
11834
|
+
disabled: K,
|
|
11826
11835
|
readOnly: De,
|
|
11827
11836
|
error: we
|
|
11828
11837
|
},
|
|
@@ -11877,7 +11886,7 @@ const Ca = {
|
|
|
11877
11886
|
onChange: (mt) => Te(c, mt),
|
|
11878
11887
|
options: Oe,
|
|
11879
11888
|
placeholder: Ze ? p("placeholders.selectOtherNationalities") : Pe,
|
|
11880
|
-
disabled:
|
|
11889
|
+
disabled: K,
|
|
11881
11890
|
readOnly: De
|
|
11882
11891
|
},
|
|
11883
11892
|
be
|
|
@@ -12225,7 +12234,7 @@ const Ca = {
|
|
|
12225
12234
|
}) })
|
|
12226
12235
|
] });
|
|
12227
12236
|
};
|
|
12228
|
-
if (!d ||
|
|
12237
|
+
if (!d || K || E)
|
|
12229
12238
|
return /* @__PURE__ */ i("div", { className: "metakyc-sdk", children: /* @__PURE__ */ i(ae, { children: /* @__PURE__ */ s(ne, { children: [
|
|
12230
12239
|
/* @__PURE__ */ i(Ye, { className: "my-8" }),
|
|
12231
12240
|
/* @__PURE__ */ i("p", { className: "text-center mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)", fontSize: "0.875rem" }, children: p("common.loadingForm") })
|
|
@@ -12357,10 +12366,10 @@ const Ta = ({
|
|
|
12357
12366
|
throw new Error(
|
|
12358
12367
|
"workflowKey is required. Provide it either as a prop to CreateCompanyApplicantForm or set it in config.applicantForm.workflowKey"
|
|
12359
12368
|
);
|
|
12360
|
-
const p = t || ((k = n.applicantForm) == null ? void 0 : k.externalRefId) || "", N = ((D = n.applicantForm) == null ? void 0 : D.email) || "", C = ((G = n.applicantForm) == null ? void 0 : G.initialValues) || {}, O = ((($ = n.applicantForm) == null ? void 0 : $.fieldLabelMode) || (l == null ? void 0 : l.fieldLabelMode) || "label") !== "placeholder", T =
|
|
12369
|
+
const p = t || ((k = n.applicantForm) == null ? void 0 : k.externalRefId) || "", N = ((D = n.applicantForm) == null ? void 0 : D.email) || "", C = ((G = n.applicantForm) == null ? void 0 : G.initialValues) || {}, O = ((($ = n.applicantForm) == null ? void 0 : $.fieldLabelMode) || (l == null ? void 0 : l.fieldLabelMode) || "label") !== "placeholder", T = Ue(
|
|
12361
12370
|
() => l != null && l.companyFormPages && l.companyFormPages.length > 0 ? l.companyFormPages : null,
|
|
12362
12371
|
[l == null ? void 0 : l.companyFormPages]
|
|
12363
|
-
), H =
|
|
12372
|
+
), H = Ue(() => {
|
|
12364
12373
|
const y = new Set(ei), I = l == null ? void 0 : l.companyFormRequiredFields;
|
|
12365
12374
|
if (I) for (const x of I) y.add(x);
|
|
12366
12375
|
if (T)
|
|
@@ -12368,7 +12377,7 @@ const Ta = ({
|
|
|
12368
12377
|
for (const g of x.fields)
|
|
12369
12378
|
!g.isCustom && g.name && g.required && y.add(g.name);
|
|
12370
12379
|
return Array.from(y);
|
|
12371
|
-
}, [l == null ? void 0 : l.companyFormRequiredFields, T]), B =
|
|
12380
|
+
}, [l == null ? void 0 : l.companyFormRequiredFields, T]), B = Ue(() => {
|
|
12372
12381
|
var y;
|
|
12373
12382
|
if (T) {
|
|
12374
12383
|
const I = T.flatMap((g) => g.fields).filter((g) => !g.isCustom && g.name).map((g) => g.name), x = new Set(I);
|
|
@@ -12376,26 +12385,26 @@ const Ta = ({
|
|
|
12376
12385
|
return Array.from(x);
|
|
12377
12386
|
}
|
|
12378
12387
|
return (y = n.applicantForm) != null && y.visibleFields ? n.applicantForm.visibleFields : l != null && l.companyFormVisibleFields && l.companyFormVisibleFields.length > 0 ? l.companyFormVisibleFields : Li;
|
|
12379
|
-
}, [(se = n.applicantForm) == null ? void 0 : se.visibleFields, l == null ? void 0 : l.companyFormVisibleFields, T]), F = /* @__PURE__ */ new Set(["countryResidence", "addressCountry"]), L =
|
|
12388
|
+
}, [(se = n.applicantForm) == null ? void 0 : se.visibleFields, l == null ? void 0 : l.companyFormVisibleFields, T]), F = /* @__PURE__ */ new Set(["countryResidence", "addressCountry"]), L = Ue(() => {
|
|
12380
12389
|
var I, x;
|
|
12381
12390
|
const y = /* @__PURE__ */ new Set();
|
|
12382
12391
|
if (T)
|
|
12383
12392
|
for (const g of T)
|
|
12384
|
-
for (const
|
|
12385
|
-
!
|
|
12393
|
+
for (const U of g.fields)
|
|
12394
|
+
!U.isCustom && U.name && F.has(U.name) && y.add(U.countriesType ?? ((I = yt[U.name]) == null ? void 0 : I.countriesType));
|
|
12386
12395
|
else
|
|
12387
12396
|
for (const g of B)
|
|
12388
12397
|
F.has(g) && y.add((x = yt[g]) == null ? void 0 : x.countriesType);
|
|
12389
12398
|
return y.size === 0 && y.add(void 0), Array.from(y);
|
|
12390
|
-
}, [B, T]), [q, J] = w({}), [ie, S] = w(!0), z = ge(/* @__PURE__ */ new Set()),
|
|
12399
|
+
}, [B, T]), [q, J] = w({}), [ie, S] = w(!0), z = ge(/* @__PURE__ */ new Set()), K = ge(/* @__PURE__ */ new Set());
|
|
12391
12400
|
he(() => {
|
|
12392
12401
|
if (!l) return;
|
|
12393
12402
|
const y = L.filter((g) => {
|
|
12394
|
-
const
|
|
12395
|
-
return !
|
|
12403
|
+
const U = g != null ? String(g) : "all";
|
|
12404
|
+
return !K.current.has(U) && !z.current.has(U);
|
|
12396
12405
|
});
|
|
12397
12406
|
if (y.length === 0) {
|
|
12398
|
-
L.every((
|
|
12407
|
+
L.every((U) => K.current.has(U != null ? String(U) : "all")) && S(!1);
|
|
12399
12408
|
return;
|
|
12400
12409
|
}
|
|
12401
12410
|
S(!0);
|
|
@@ -12403,22 +12412,22 @@ const Ta = ({
|
|
|
12403
12412
|
I.forEach((g) => z.current.add(g)), (async () => {
|
|
12404
12413
|
try {
|
|
12405
12414
|
const g = await Promise.all(
|
|
12406
|
-
y.map(async (
|
|
12407
|
-
const Y =
|
|
12408
|
-
return
|
|
12415
|
+
y.map(async (U) => {
|
|
12416
|
+
const Y = U != null ? String(U) : "all", ce = await o.getCountries("", n.locale || "en", U), Ee = /* @__PURE__ */ new Set(), c = ce.map((P) => ({ value: P.abbreviation3 || P.abbreviation, label: P.name })).filter((P) => !P.value || Ee.has(P.value) ? !1 : (Ee.add(P.value), !0));
|
|
12417
|
+
return K.current.add(Y), z.current.delete(Y), [Y, c];
|
|
12409
12418
|
})
|
|
12410
12419
|
);
|
|
12411
|
-
J((
|
|
12420
|
+
J((U) => ({ ...U, ...Object.fromEntries(g) }));
|
|
12412
12421
|
} catch (g) {
|
|
12413
|
-
I.forEach((
|
|
12422
|
+
I.forEach((U) => z.current.delete(U)), console.error("Failed to load countries:", g);
|
|
12414
12423
|
} finally {
|
|
12415
|
-
L.every((
|
|
12424
|
+
L.every((U) => K.current.has(U != null ? String(U) : "all")) && S(!1);
|
|
12416
12425
|
}
|
|
12417
12426
|
})();
|
|
12418
12427
|
}, [L, l]);
|
|
12419
12428
|
const ee = (y, I) => {
|
|
12420
|
-
var
|
|
12421
|
-
const x = I ?? ((
|
|
12429
|
+
var U;
|
|
12430
|
+
const x = I ?? ((U = yt[y]) == null ? void 0 : U.countriesType), g = x != null ? String(x) : "all";
|
|
12422
12431
|
return q[g] || [];
|
|
12423
12432
|
}, X = {
|
|
12424
12433
|
companyName: 1,
|
|
@@ -12482,13 +12491,13 @@ const Ta = ({
|
|
|
12482
12491
|
if (x.isCustom) {
|
|
12483
12492
|
if (x.customType === "paragraph" || x.customType === "html" || x.customType === "br" || x.customType === "link") continue;
|
|
12484
12493
|
if (x.required && x.paramName) {
|
|
12485
|
-
const g = le[x.paramName],
|
|
12486
|
-
x.customType === "checkbox" || x.customType === "link_checkbox" ? g !== "true" && (I[x.paramName] = m("validation.fieldRequired", { field:
|
|
12494
|
+
const g = le[x.paramName], U = Q(x.displayText, m) || Q(x.label, m) || x.paramName;
|
|
12495
|
+
x.customType === "checkbox" || x.customType === "link_checkbox" ? g !== "true" && (I[x.paramName] = m("validation.fieldRequired", { field: U })) : (!g || g.trim() === "") && (I[x.paramName] = m("validation.fieldRequired", { field: U }));
|
|
12487
12496
|
}
|
|
12488
12497
|
} else if (x.name) {
|
|
12489
12498
|
const g = x.name;
|
|
12490
12499
|
if (H.includes(g) && Lt(te[g])) {
|
|
12491
|
-
const
|
|
12500
|
+
const U = yt[g], Y = Q(x.displayText, m) || (U != null && U.translationKey ? m(`fields.${U.translationKey}`) : void 0) || (U == null ? void 0 : U.label) || g;
|
|
12492
12501
|
I[g] = m("validation.fieldRequired", { field: Y });
|
|
12493
12502
|
}
|
|
12494
12503
|
}
|
|
@@ -12572,8 +12581,8 @@ const Ta = ({
|
|
|
12572
12581
|
}
|
|
12573
12582
|
}
|
|
12574
12583
|
g.length > 0 && (I.applicantAdditionalDatas = g);
|
|
12575
|
-
const
|
|
12576
|
-
a(
|
|
12584
|
+
const U = await d(I);
|
|
12585
|
+
a(U.applicantId);
|
|
12577
12586
|
} catch (I) {
|
|
12578
12587
|
console.error("Error creating company applicant:", I), E(I.message || m("createCompany.failedToCreate"));
|
|
12579
12588
|
} finally {
|
|
@@ -12588,10 +12597,10 @@ const Ta = ({
|
|
|
12588
12597
|
return;
|
|
12589
12598
|
}
|
|
12590
12599
|
await ze();
|
|
12591
|
-
}, at = (y, I, x, g,
|
|
12600
|
+
}, at = (y, I, x, g, U) => {
|
|
12592
12601
|
const Y = yt[y];
|
|
12593
12602
|
if (!Y) return null;
|
|
12594
|
-
const ce = H.includes(y), Ee = Se[y], c = Q(x, m) || (Y.translationKey ? m(`fields.${Y.translationKey}`) : void 0) || Y.label, P = y in W, A = I ?? y, h =
|
|
12603
|
+
const ce = H.includes(y), Ee = Se[y], c = Q(x, m) || (Y.translationKey ? m(`fields.${Y.translationKey}`) : void 0) || Y.label, P = y in W, A = I ?? y, h = U ? U !== "placeholder" : O, v = h ? c : void 0;
|
|
12595
12604
|
switch (Y.type) {
|
|
12596
12605
|
case "select":
|
|
12597
12606
|
if (y === "countryResidence" || y === "addressCountry") {
|
|
@@ -12699,7 +12708,7 @@ const Ta = ({
|
|
|
12699
12708
|
}
|
|
12700
12709
|
) }, `custom-${I}`);
|
|
12701
12710
|
if (!y.paramName) return null;
|
|
12702
|
-
const x = Se[y.paramName], g = Q(y.displayText, m) || Q(y.label, m) || y.paramName,
|
|
12711
|
+
const x = Se[y.paramName], g = Q(y.displayText, m) || Q(y.label, m) || y.paramName, U = y.labelMode ? y.labelMode !== "placeholder" : O;
|
|
12703
12712
|
if (y.customType === "checkbox") {
|
|
12704
12713
|
const Y = le[y.paramName] === "true";
|
|
12705
12714
|
return /* @__PURE__ */ s("div", { className: "flex flex-col gap-1", children: [
|
|
@@ -12732,8 +12741,8 @@ const Ta = ({
|
|
|
12732
12741
|
Ne,
|
|
12733
12742
|
{
|
|
12734
12743
|
type: "text",
|
|
12735
|
-
label:
|
|
12736
|
-
placeholder:
|
|
12744
|
+
label: U ? `${g}${y.required ? " *" : ""}` : void 0,
|
|
12745
|
+
placeholder: U ? void 0 : g,
|
|
12737
12746
|
value: le[y.paramName] || "",
|
|
12738
12747
|
onChange: (Y) => j(y.paramName, Y.target.value),
|
|
12739
12748
|
required: y.required,
|
|
@@ -12764,8 +12773,8 @@ const Ta = ({
|
|
|
12764
12773
|
}
|
|
12765
12774
|
),
|
|
12766
12775
|
I && /* @__PURE__ */ i("div", { className: "metakyc-form-grid", children: y.fields.map((x, g) => {
|
|
12767
|
-
const
|
|
12768
|
-
return /* @__PURE__ */ i("div", { style: { gridColumn: `span ${
|
|
12776
|
+
const U = Math.min(4, Math.max(1, Number(x.colSpan) || 4)), Y = x.isCustom ? `custom-${g}-${x.paramName}` : `builtin-${x.name}-${g}`;
|
|
12777
|
+
return /* @__PURE__ */ i("div", { style: { gridColumn: `span ${U} / span ${U}` }, children: x.isCustom ? Qe(x, g) : at(x.name, Y, x.displayText, x.countriesType, x.labelMode) }, Y);
|
|
12769
12778
|
}) })
|
|
12770
12779
|
] });
|
|
12771
12780
|
};
|
|
@@ -12775,9 +12784,9 @@ const Ta = ({
|
|
|
12775
12784
|
/* @__PURE__ */ i("p", { className: "text-center mt-4", style: { color: "var(--metakyc-text-secondary, #6b7280)", fontSize: "0.875rem" }, children: m("common.loadingForm") })
|
|
12776
12785
|
] }) }) });
|
|
12777
12786
|
if (T) {
|
|
12778
|
-
const y = T[re] ?? T[0], I = Fe === -1, x = ke === -1, g = T.length,
|
|
12787
|
+
const y = T[re] ?? T[0], I = Fe === -1, x = ke === -1, g = T.length, U = _(y), Y = ve(y), ce = Object.values(Se), Ee = !U && !!y.conditionalOn && y.conditionalMode === "block", c = V || u || Ee || Y;
|
|
12779
12788
|
let P;
|
|
12780
|
-
return Ee || Y ? P = m("common.blocked") : x ? P = y.conditionalOn && !
|
|
12789
|
+
return Ee || Y ? P = m("common.blocked") : x ? P = y.conditionalOn && !U ? m("common.skipAndSubmit") : m("common.submit") : P = y.conditionalOn && !U ? m("common.skip") : m("common.next"), /* @__PURE__ */ i("div", { className: "metakyc-sdk", children: /* @__PURE__ */ s(ae, { children: [
|
|
12781
12790
|
/* @__PURE__ */ i(Ae, { children: /* @__PURE__ */ i(bt, { title: (l == null ? void 0 : l.title) || m("createCompany.title") }) }),
|
|
12782
12791
|
/* @__PURE__ */ s(ne, { children: [
|
|
12783
12792
|
(y.title || y.subtitle) && /* @__PURE__ */ s("div", { className: "mb-4", children: [
|
|
@@ -12960,7 +12969,7 @@ const Ta = ({
|
|
|
12960
12969
|
return "";
|
|
12961
12970
|
}
|
|
12962
12971
|
}, F = () => {
|
|
12963
|
-
const q = d.filter((
|
|
12972
|
+
const q = d.filter((K) => K.visibility !== !1), J = q.findIndex((K) => K.order === l.order), ie = J >= 0 ? J + 1 : 1, S = q.length, z = S > 1 ? (J + 1) / S * 100 : 100;
|
|
12964
12973
|
return /* @__PURE__ */ s("div", { className: "metakyc-progress-wrapper", style: {
|
|
12965
12974
|
marginBottom: "24px",
|
|
12966
12975
|
backgroundColor: "var(--metakyc-surface, var(--metakyc-background, #ffffff))",
|
|
@@ -13255,7 +13264,7 @@ export {
|
|
|
13255
13264
|
Vi as AppropriatenessTestService,
|
|
13256
13265
|
ha as AppropriatenessTestStep,
|
|
13257
13266
|
mi as Badge,
|
|
13258
|
-
|
|
13267
|
+
Ui as BaseInformationService,
|
|
13259
13268
|
Z as Button,
|
|
13260
13269
|
yt as COMPANY_FIELD_METADATA,
|
|
13261
13270
|
ae as Card,
|
|
@@ -13280,7 +13289,7 @@ export {
|
|
|
13280
13289
|
bt as Header,
|
|
13281
13290
|
Mi as HttpClient,
|
|
13282
13291
|
st as IdentityProviderManager,
|
|
13283
|
-
|
|
13292
|
+
Ki as IdentityService,
|
|
13284
13293
|
He as IdentityVerificationProvider,
|
|
13285
13294
|
xa as IdentityVerificationStep,
|
|
13286
13295
|
Ne as Input,
|
|
@@ -13334,7 +13343,7 @@ export {
|
|
|
13334
13343
|
_a as clearAllStorage,
|
|
13335
13344
|
Er as clearApplicantId,
|
|
13336
13345
|
Dr as clearWorkflowState,
|
|
13337
|
-
|
|
13346
|
+
Ke as cn,
|
|
13338
13347
|
Yi as corporateTheme,
|
|
13339
13348
|
Pi as defaultConfig,
|
|
13340
13349
|
Be as defaultTheme,
|
|
@@ -13370,7 +13379,7 @@ export {
|
|
|
13370
13379
|
qr as useRiskScoring,
|
|
13371
13380
|
Ie as useTranslation,
|
|
13372
13381
|
Or as useUploadDocument,
|
|
13373
|
-
|
|
13374
|
-
|
|
13382
|
+
Ka as validateFileSize,
|
|
13383
|
+
Ua as validateFileType
|
|
13375
13384
|
};
|
|
13376
13385
|
//# sourceMappingURL=index.js.map
|