@incodetech/web 2.0.0-alpha.1 → 2.0.0-alpha.11
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/base.css +1071 -0
- package/dist/browser-ponyfill-B6W6hHVY.js +344 -0
- package/dist/email/email.es.js +145 -0
- package/dist/email/styles.css +123 -0
- package/dist/flow/flow.es.js +555 -0
- package/dist/flow/styles.css +1119 -0
- package/dist/incodeModule-Dv8Qllrv.js +254 -0
- package/dist/index.es.js +6 -0
- package/dist/instance-B-q0ZREN.js +2140 -0
- package/dist/otpInput-BtoZe0Wz.js +151 -0
- package/dist/page-Dh_Zw2ik.js +234 -0
- package/dist/phone/phone.es.js +3441 -0
- package/dist/phone/styles.css +305 -0
- package/dist/selfie/selfie.es.js +893 -0
- package/dist/selfie/styles.css +590 -0
- package/dist/selfieTutorial-C-u5GufD.js +29 -0
- package/dist/setup-wNL83jmW.js +20 -0
- package/dist/themes/dark.css +652 -0
- package/dist/themes/light.css +543 -0
- package/dist/title-BfO5Dlzk.js +25 -0
- package/dist/types/base.d.ts +1 -0
- package/dist/types/dark.d.ts +1 -0
- package/dist/types/email.d.ts +57 -0
- package/dist/types/flow.d.ts +69 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/types/light.d.ts +1 -0
- package/dist/types/phone.d.ts +58 -0
- package/dist/types/selfie.d.ts +31 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/themes/dark.d.ts +1 -0
- package/dist/types/themes/light.d.ts +1 -0
- package/dist/uiConfig-CQ1W9cUD.js +23 -0
- package/dist/vendor-preact-CK0WeTOR.js +584 -0
- package/package.json +32 -26
- package/dev/README.md +0 -163
- package/dev/getToken.ts +0 -36
- package/dev/headless.html +0 -875
- package/dev/index.html +0 -366
- package/dev/main-headless.tsx +0 -1332
- package/dev/main-orchestrated-flow.tsx +0 -1158
- package/dev/main-preact.tsx +0 -323
- package/dev/main-simplified.tsx +0 -123
- package/dev/main-web-component.tsx +0 -256
- package/dev/main.tsx +0 -332
- package/dev/manual.html +0 -27
- package/dev/orchestrated-flow.html +0 -64
- package/dev/simplified.html +0 -64
- package/dev/tiktok-logo.svg +0 -7
- package/src/defineCustomElement.tsx +0 -30
- package/src/email/email.test.tsx +0 -368
- package/src/email/email.tsx +0 -255
- package/src/email/emailInput.test.tsx +0 -264
- package/src/email/emailInput.tsx +0 -85
- package/src/email/styles.css +0 -59
- package/src/flow/flow.test.tsx +0 -796
- package/src/flow/flow.tsx +0 -292
- package/src/flow/flowCompleted.css +0 -30
- package/src/flow/flowCompleted.test.tsx +0 -331
- package/src/flow/flowCompleted.tsx +0 -121
- package/src/flow/flowInit.test.ts +0 -264
- package/src/flow/flowInit.ts +0 -94
- package/src/flow/flowStart.css +0 -58
- package/src/flow/flowStart.test.tsx +0 -49
- package/src/flow/flowStart.tsx +0 -41
- package/src/flow/incode-logo.svg +0 -8
- package/src/flow/index.ts +0 -7
- package/src/flow/preloadFlow.test.ts +0 -421
- package/src/flow/preloadFlow.ts +0 -171
- package/src/flow/styles.css +0 -9
- package/src/flow/unsupportedModule.css +0 -21
- package/src/flow/unsupportedModule.tsx +0 -39
- package/src/flow/useFlowInitialization.test.tsx +0 -292
- package/src/flow/useFlowInitialization.ts +0 -128
- package/src/flow/useModuleLoader.test.tsx +0 -212
- package/src/flow/useModuleLoader.ts +0 -92
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useManager.test.ts +0 -91
- package/src/hooks/useManager.ts +0 -40
- package/src/i18n/index.ts +0 -3
- package/src/i18n/instance.ts +0 -16
- package/src/i18n/setup.ts +0 -184
- package/src/i18n/useTranslation.ts +0 -42
- package/src/index.ts +0 -27
- package/src/permissions/assets/android-dots-icon.svg +0 -7
- package/src/permissions/assets/android-settings-icon.svg +0 -16
- package/src/permissions/assets/android-toggle-icon.svg +0 -20
- package/src/permissions/assets/bank-card-icon.svg +0 -14
- package/src/permissions/assets/camera-icon.svg +0 -12
- package/src/permissions/assets/camera-ios.svg +0 -53
- package/src/permissions/assets/check-icon.svg +0 -8
- package/src/permissions/assets/chrome-icon.svg +0 -43
- package/src/permissions/assets/password-icon.svg +0 -11
- package/src/permissions/assets/permissions-img.svg +0 -51
- package/src/permissions/assets/safari-icon.svg +0 -37
- package/src/permissions/assets/settings-icon.svg +0 -33
- package/src/permissions/assets/toggle-icon.svg +0 -19
- package/src/permissions/assets/warning-icon.svg +0 -6
- package/src/permissions/boldWithArrow.css +0 -9
- package/src/permissions/boldWithArrow.tsx +0 -41
- package/src/permissions/denied.css +0 -37
- package/src/permissions/denied.tsx +0 -29
- package/src/permissions/deniedAndroid.tsx +0 -56
- package/src/permissions/deniedDesktop.css +0 -9
- package/src/permissions/deniedDesktop.tsx +0 -64
- package/src/permissions/deniedIOS.tsx +0 -73
- package/src/permissions/deniedInstructions.tsx +0 -19
- package/src/permissions/iconWrapper.css +0 -9
- package/src/permissions/iconWrapper.tsx +0 -15
- package/src/permissions/learnMore.css +0 -37
- package/src/permissions/learnMore.tsx +0 -85
- package/src/permissions/numberedStep.css +0 -13
- package/src/permissions/numberedStep.tsx +0 -14
- package/src/permissions/permissions.css +0 -13
- package/src/permissions/permissions.tsx +0 -68
- package/src/phone/phone.tsx +0 -246
- package/src/phone/phoneInput.test.tsx +0 -275
- package/src/phone/phoneInput.tsx +0 -249
- package/src/phone/styles.css +0 -158
- package/src/selfie/cameraButton.css +0 -13
- package/src/selfie/cameraButton.tsx +0 -35
- package/src/selfie/capture.css +0 -57
- package/src/selfie/capture.tsx +0 -232
- package/src/selfie/errorModal.tsx +0 -218
- package/src/selfie/errorModalContent.css +0 -33
- package/src/selfie/errorModalContent.tsx +0 -44
- package/src/selfie/faceOutline.css +0 -5
- package/src/selfie/faceOutline.tsx +0 -22
- package/src/selfie/loadingBorder.css +0 -12
- package/src/selfie/loadingBorder.tsx +0 -77
- package/src/selfie/manualCaptureButton.css +0 -13
- package/src/selfie/manualCaptureButton.tsx +0 -35
- package/src/selfie/noMoreAttemptsModal.tsx +0 -44
- package/src/selfie/notification.css +0 -9
- package/src/selfie/notification.tsx +0 -36
- package/src/selfie/retryErrorModal.tsx +0 -56
- package/src/selfie/selfie.test.tsx +0 -458
- package/src/selfie/selfie.tsx +0 -83
- package/src/selfie/selfieTutorial.json +0 -2626
- package/src/selfie/styles.css +0 -1
- package/src/selfie/tutorial.test.tsx +0 -200
- package/src/selfie/tutorial.tsx +0 -43
- package/src/setup.ts +0 -33
- package/src/shared/baseTutorial/baseTutorial.css +0 -21
- package/src/shared/baseTutorial/baseTutorial.test.tsx +0 -184
- package/src/shared/baseTutorial/baseTutorial.tsx +0 -55
- package/src/shared/baseTutorial/replaceBaseTutorial.test.ts +0 -267
- package/src/shared/baseTutorial/replaceBaseTutorial.ts +0 -68
- package/src/shared/button/button.css +0 -55
- package/src/shared/button/button.test.tsx +0 -101
- package/src/shared/button/button.tsx +0 -47
- package/src/shared/componentRoot/incodeComponent.tsx +0 -12
- package/src/shared/countries/countries.test.ts +0 -75
- package/src/shared/countries/countries.ts +0 -139
- package/src/shared/countries/index.ts +0 -6
- package/src/shared/icons/chevronDown.tsx +0 -22
- package/src/shared/icons/index.ts +0 -2
- package/src/shared/icons/successIcon.css +0 -5
- package/src/shared/icons/successIcon.test.tsx +0 -40
- package/src/shared/icons/successIcon.tsx +0 -26
- package/src/shared/loader/loadingIcon.css +0 -28
- package/src/shared/loader/loadingIcon.tsx +0 -67
- package/src/shared/lottie/lottie.tsx +0 -108
- package/src/shared/otpInput/otpInput.css +0 -85
- package/src/shared/otpInput/otpInput.test.tsx +0 -356
- package/src/shared/otpInput/otpInput.tsx +0 -241
- package/src/shared/page/incode-logo.svg +0 -3
- package/src/shared/page/page.css +0 -47
- package/src/shared/page/page.test.tsx +0 -97
- package/src/shared/page/page.tsx +0 -91
- package/src/shared/page/pageUiConfig.test.ts +0 -112
- package/src/shared/page/pageUiConfig.ts +0 -64
- package/src/shared/page/verifiedByIncode.css +0 -5
- package/src/shared/page/verifiedByIncode.tsx +0 -75
- package/src/shared/spacer/spacer.css +0 -149
- package/src/shared/spacer/spacer.test.tsx +0 -143
- package/src/shared/spacer/spacer.tsx +0 -88
- package/src/shared/spinner/index.ts +0 -2
- package/src/shared/spinner/spinner.css +0 -28
- package/src/shared/spinner/spinner.test.tsx +0 -82
- package/src/shared/spinner/spinner.tsx +0 -65
- package/src/shared/title/title.css +0 -7
- package/src/shared/title/title.tsx +0 -12
- package/src/shared/uiConfig/uiConfig.ts +0 -36
- package/src/shared/webComponent/incodeModule.ts +0 -29
- package/src/shared/webComponent/registerIncodeElement.ts +0 -15
- package/src/styles/__mocks__/fetchTheme.ts +0 -19
- package/src/styles/applyTheme.ts +0 -37
- package/src/styles/cn.test.tsx +0 -57
- package/src/styles/cn.tsx +0 -21
- package/src/styles/core.css +0 -12
- package/src/styles/fetchTheme.test.ts +0 -390
- package/src/styles/fetchTheme.ts +0 -88
- package/src/styles/generatePalette.ts +0 -111
- package/src/styles/reset.css +0 -65
- package/src/styles/resolveCssVariableToHex.ts +0 -28
- package/src/styles/tailwind.css +0 -291
- package/src/styles/themeTypes.ts +0 -18
- package/src/styles/tokens/colors.css +0 -190
- package/src/styles/tokens/components.css +0 -174
- package/src/styles/tokens/index.css +0 -4
- package/src/styles/tokens/primitives.css +0 -129
- package/src/styles/tokens/semantic.css +0 -51
- package/src/svg.d.ts +0 -4
- package/src/types/assets.d.ts +0 -1
- package/src/types/custom-elements.d.ts +0 -104
- package/tsconfig.json +0 -22
- package/vite.config.ts +0 -260
- package/vitest.config.ts +0 -40
- package/vitest.setup.ts +0 -16
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import { c as D, u as i, L as W, S as E, B as j, r as H, a as B } from "../incodeModule-Dv8Qllrv.js";
|
|
2
|
+
import { createOrchestratedFlowManager as O, getRequiredWasmPipelines as R } from "@incodetech/core/flow";
|
|
3
|
+
import { k as F, A as I, d as x, y as M } from "../vendor-preact-CK0WeTOR.js";
|
|
4
|
+
import "../instance-B-q0ZREN.js";
|
|
5
|
+
import { T as K, u as $ } from "../title-BfO5Dlzk.js";
|
|
6
|
+
import { api as z, warmupWasm as q } from "@incodetech/core";
|
|
7
|
+
import { emailMachine as _ } from "@incodetech/core/email";
|
|
8
|
+
import { phoneMachine as V } from "@incodetech/core/phone";
|
|
9
|
+
import { selfieMachine as Y } from "@incodetech/core/selfie";
|
|
10
|
+
import { s as Z } from "../setup-wNL83jmW.js";
|
|
11
|
+
import { s as y } from "../uiConfig-CQ1W9cUD.js";
|
|
12
|
+
const G = {
|
|
13
|
+
small: 24,
|
|
14
|
+
medium: 48,
|
|
15
|
+
large: 64
|
|
16
|
+
}, b = ({
|
|
17
|
+
title: e,
|
|
18
|
+
subtitle: t,
|
|
19
|
+
size: n = "medium",
|
|
20
|
+
fullScreen: s = !0,
|
|
21
|
+
className: a
|
|
22
|
+
}) => {
|
|
23
|
+
const r = G[n], o = D(
|
|
24
|
+
"IncodeSpinner",
|
|
25
|
+
s && "IncodeSpinnerFullScreen",
|
|
26
|
+
a
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ i(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
class: o,
|
|
32
|
+
"data-testid": "spinner",
|
|
33
|
+
"data-title": e,
|
|
34
|
+
"data-subtitle": t,
|
|
35
|
+
"data-size": n,
|
|
36
|
+
children: /* @__PURE__ */ i("div", { class: "IncodeSpinnerContent", children: [
|
|
37
|
+
/* @__PURE__ */ i(W, { size: r }),
|
|
38
|
+
(e || t) && /* @__PURE__ */ i(F, { children: [
|
|
39
|
+
/* @__PURE__ */ i(E, { size: 16 }),
|
|
40
|
+
/* @__PURE__ */ i("div", { class: "IncodeSpinnerText", children: [
|
|
41
|
+
e && /* @__PURE__ */ i(K, { className: "IncodeSpinnerTitle", children: e }),
|
|
42
|
+
t && /* @__PURE__ */ i(F, { children: [
|
|
43
|
+
e && /* @__PURE__ */ i(E, { size: 12 }),
|
|
44
|
+
/* @__PURE__ */ i("p", { class: "IncodeSpinnerSubtitle", children: t })
|
|
45
|
+
] })
|
|
46
|
+
] })
|
|
47
|
+
] })
|
|
48
|
+
] })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
function J(e) {
|
|
53
|
+
let t = e.replace("#", "");
|
|
54
|
+
t.length === 3 && (t = t.split("").map((d) => d + d).join(""));
|
|
55
|
+
const n = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
|
|
56
|
+
if (!n) return null;
|
|
57
|
+
const s = Number.parseInt(n[1], 16) / 255, a = Number.parseInt(n[2], 16) / 255, r = Number.parseInt(n[3], 16) / 255, o = Math.max(s, a, r), c = Math.min(s, a, r);
|
|
58
|
+
let l = 0, p = 0;
|
|
59
|
+
const u = (o + c) / 2;
|
|
60
|
+
if (o !== c) {
|
|
61
|
+
const d = o - c;
|
|
62
|
+
switch (p = u > 0.5 ? d / (2 - o - c) : d / (o + c), o) {
|
|
63
|
+
case s:
|
|
64
|
+
l = ((a - r) / d + (a < r ? 6 : 0)) / 6;
|
|
65
|
+
break;
|
|
66
|
+
case a:
|
|
67
|
+
l = ((r - s) / d + 2) / 6;
|
|
68
|
+
break;
|
|
69
|
+
case r:
|
|
70
|
+
l = ((s - a) / d + 4) / 6;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { h: l * 360, s: p * 100, l: u * 100 };
|
|
75
|
+
}
|
|
76
|
+
function w(e, t, n) {
|
|
77
|
+
const s = e / 360, a = t / 100, r = n / 100;
|
|
78
|
+
let o, c, l;
|
|
79
|
+
if (a === 0)
|
|
80
|
+
o = c = l = r;
|
|
81
|
+
else {
|
|
82
|
+
const u = (h, C, m) => (m < 0 && (m += 1), m > 1 && (m -= 1), m < 0.16666666666666666 ? h + (C - h) * 6 * m : m < 0.5 ? C : m < 0.6666666666666666 ? h + (C - h) * (0.6666666666666666 - m) * 6 : h), d = r < 0.5 ? r * (1 + a) : r + a - r * a, f = 2 * r - d;
|
|
83
|
+
o = u(f, d, s + 1 / 3), c = u(f, d, s), l = u(f, d, s - 1 / 3);
|
|
84
|
+
}
|
|
85
|
+
const p = (u) => {
|
|
86
|
+
const d = Math.round(u * 255).toString(16);
|
|
87
|
+
return d.length === 1 ? `0${d}` : d;
|
|
88
|
+
};
|
|
89
|
+
return `#${p(o)}${p(c)}${p(l)}`;
|
|
90
|
+
}
|
|
91
|
+
function Q(e) {
|
|
92
|
+
const t = J(e);
|
|
93
|
+
if (!t)
|
|
94
|
+
throw new Error(`Invalid color format: ${e}`);
|
|
95
|
+
return {
|
|
96
|
+
50: w(t.h, t.s, 95),
|
|
97
|
+
200: w(t.h, t.s, 80),
|
|
98
|
+
300: w(t.h, t.s, 65),
|
|
99
|
+
400: w(t.h, t.s, Math.min(100, t.l + 10)),
|
|
100
|
+
500: e,
|
|
101
|
+
600: w(t.h, t.s, Math.max(0, t.l - 10)),
|
|
102
|
+
900: w(t.h, t.s, 20)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function X(e, t) {
|
|
106
|
+
if (typeof document > "u")
|
|
107
|
+
return;
|
|
108
|
+
const n = Q(e);
|
|
109
|
+
let s = document.getElementById(
|
|
110
|
+
"incode-theme"
|
|
111
|
+
);
|
|
112
|
+
s || (s = document.createElement("style"), s.id = "incode-theme", document.head.appendChild(s));
|
|
113
|
+
const a = t || "#ffffff", r = `
|
|
114
|
+
:root,
|
|
115
|
+
:host {
|
|
116
|
+
--primitive-color-brand-50: ${n[50]};
|
|
117
|
+
--primitive-color-brand-200: ${n[200]};
|
|
118
|
+
--primitive-color-brand-300: ${n[300]};
|
|
119
|
+
--primitive-color-brand-400: ${n[400]};
|
|
120
|
+
--primitive-color-brand-500: ${n[500]};
|
|
121
|
+
--primitive-color-brand-600: ${n[600]};
|
|
122
|
+
--primitive-color-brand-900: ${n[900]};
|
|
123
|
+
--button-primary-text-default: ${a};
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
s.textContent = r;
|
|
127
|
+
}
|
|
128
|
+
async function ee() {
|
|
129
|
+
return (await z.get("/omni/asset/fetch-all")).data;
|
|
130
|
+
}
|
|
131
|
+
const L = /* @__PURE__ */ new Map();
|
|
132
|
+
async function te(e) {
|
|
133
|
+
if (e.startsWith("data:"))
|
|
134
|
+
return e;
|
|
135
|
+
const t = L.get(e);
|
|
136
|
+
if (t)
|
|
137
|
+
return t;
|
|
138
|
+
const s = await (await fetch(e)).blob(), a = await new Promise((r, o) => {
|
|
139
|
+
const c = new FileReader();
|
|
140
|
+
c.onloadend = () => r(c.result), c.onerror = o, c.readAsDataURL(s);
|
|
141
|
+
});
|
|
142
|
+
return L.set(e, a), a;
|
|
143
|
+
}
|
|
144
|
+
async function re() {
|
|
145
|
+
const e = await ee();
|
|
146
|
+
if (!e.theme)
|
|
147
|
+
throw new Error("Theme URL not found in assets response");
|
|
148
|
+
const t = e.theme, n = t.startsWith("http://") || t.startsWith("https://");
|
|
149
|
+
let s;
|
|
150
|
+
if (n) {
|
|
151
|
+
const o = await fetch(t);
|
|
152
|
+
if (!o.ok)
|
|
153
|
+
throw new Error(`Failed to fetch theme: ${o.statusText}`);
|
|
154
|
+
s = await o.json();
|
|
155
|
+
} else
|
|
156
|
+
s = (await z.get(t)).data;
|
|
157
|
+
const a = e["logo.png"] || e["logo.svg"] || e["logo.jpg"] || e["logo.jpeg"] || e["logo.webp"] || s.logo;
|
|
158
|
+
let r = a;
|
|
159
|
+
return a && (r = await te(a)), {
|
|
160
|
+
...s,
|
|
161
|
+
logo: r
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
async function ne() {
|
|
165
|
+
const e = await re();
|
|
166
|
+
return e.main && X(e.main, e.buttonColor), e;
|
|
167
|
+
}
|
|
168
|
+
const S = {
|
|
169
|
+
PHONE: () => import("../phone/phone.es.js").then((e) => e.Phone),
|
|
170
|
+
EMAIL: () => import("../email/email.es.js").then((e) => e.Email),
|
|
171
|
+
SELFIE: () => import("../selfie/selfie.es.js").then((e) => e.Selfie)
|
|
172
|
+
};
|
|
173
|
+
function T() {
|
|
174
|
+
return O({
|
|
175
|
+
modules: {
|
|
176
|
+
PHONE: V,
|
|
177
|
+
EMAIL: _,
|
|
178
|
+
SELFIE: Y
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async function N(e) {
|
|
183
|
+
await Z({
|
|
184
|
+
apiURL: e.apiURL,
|
|
185
|
+
token: e.token,
|
|
186
|
+
i18n: { lang: e.lang ?? "en" }
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
async function k() {
|
|
190
|
+
try {
|
|
191
|
+
const e = await ne(), t = {
|
|
192
|
+
logoSrc: e.logo,
|
|
193
|
+
hideFooterBranding: e.hideFooterBranding
|
|
194
|
+
};
|
|
195
|
+
return y(t), { theme: e, uiConfig: t };
|
|
196
|
+
} catch (e) {
|
|
197
|
+
return console.warn("Failed to fetch dashboard theme:", e), {};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function A(e, t) {
|
|
201
|
+
const n = R(e.flow);
|
|
202
|
+
n.length > 0 && q({
|
|
203
|
+
...t,
|
|
204
|
+
pipelines: n
|
|
205
|
+
}).catch((s) => {
|
|
206
|
+
console.error("WASM warmup failed:", s);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function oe(e) {
|
|
210
|
+
const t = e.currentStep;
|
|
211
|
+
if (t) {
|
|
212
|
+
const n = S[t];
|
|
213
|
+
n && n().catch(() => {
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const se = ({
|
|
218
|
+
moduleKey: e,
|
|
219
|
+
onNext: t
|
|
220
|
+
}) => {
|
|
221
|
+
const { t: n } = $();
|
|
222
|
+
return /* @__PURE__ */ i("section", { class: "IncodeUnsupportedModule", "aria-live": "polite", children: /* @__PURE__ */ i("div", { class: "IncodeUnsupportedModuleContent", children: [
|
|
223
|
+
/* @__PURE__ */ i("h2", { class: "IncodeUnsupportedModuleTitle", children: n("unsupportedModule.title", "Module not available") }),
|
|
224
|
+
/* @__PURE__ */ i("p", { class: "IncodeUnsupportedModuleMessage", children: n(
|
|
225
|
+
"unsupportedModule.message",
|
|
226
|
+
`The "${e}" module is not yet supported in this version.`
|
|
227
|
+
) }),
|
|
228
|
+
/* @__PURE__ */ i(
|
|
229
|
+
j,
|
|
230
|
+
{
|
|
231
|
+
onClick: t,
|
|
232
|
+
class: "IncodeUnsupportedModuleButton",
|
|
233
|
+
"data-testid": "unsupported-module-next-button",
|
|
234
|
+
children: n("unsupportedModule.next", "Next")
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
] }) });
|
|
238
|
+
}, g = /* @__PURE__ */ new Map();
|
|
239
|
+
function U(e) {
|
|
240
|
+
const t = g.get(e);
|
|
241
|
+
if (!t)
|
|
242
|
+
throw new Error("Preload state not found");
|
|
243
|
+
return {
|
|
244
|
+
get isReady() {
|
|
245
|
+
return t.status === "ready";
|
|
246
|
+
},
|
|
247
|
+
get error() {
|
|
248
|
+
return t.status === "error" ? t.error ?? null : null;
|
|
249
|
+
},
|
|
250
|
+
async waitUntilReady() {
|
|
251
|
+
if (t.status !== "ready") {
|
|
252
|
+
if (t.status === "error")
|
|
253
|
+
throw new Error(t.error ?? "Preload failed");
|
|
254
|
+
return t.readyPromise;
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
cancel() {
|
|
258
|
+
t.status === "loading" && (t.unsubscribe && t.unsubscribe(), t.flowManager.stop(), t.readyReject(new Error("Preload cancelled")), g.delete(e));
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function Ie(e) {
|
|
263
|
+
const { token: t } = e;
|
|
264
|
+
if (g.has(t))
|
|
265
|
+
return U(t);
|
|
266
|
+
let n, s;
|
|
267
|
+
const a = new Promise((l, p) => {
|
|
268
|
+
n = l, s = p;
|
|
269
|
+
}), r = T(), o = {
|
|
270
|
+
status: "loading",
|
|
271
|
+
flowManager: r,
|
|
272
|
+
config: e,
|
|
273
|
+
readyPromise: a,
|
|
274
|
+
readyResolve: n,
|
|
275
|
+
readyReject: s
|
|
276
|
+
};
|
|
277
|
+
return g.set(t, o), (async () => {
|
|
278
|
+
try {
|
|
279
|
+
await N({
|
|
280
|
+
apiURL: e.apiURL,
|
|
281
|
+
token: e.token,
|
|
282
|
+
lang: e.lang
|
|
283
|
+
});
|
|
284
|
+
const l = e.disableDashboardTheme ? Promise.resolve({}) : k().then((u) => {
|
|
285
|
+
o.theme = u.theme, o.uiConfig = u.uiConfig;
|
|
286
|
+
}), p = r.subscribe((u) => {
|
|
287
|
+
if (u.status === "ready") {
|
|
288
|
+
const d = u;
|
|
289
|
+
e.wasmConfig && A(d, e.wasmConfig), oe(d), o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "ready", o.readyResolve();
|
|
290
|
+
} else u.status === "error" && (o.unsubscribe?.(), o.unsubscribe = void 0, o.status = "error", o.error = u.error, o.readyReject(new Error(u.error)));
|
|
291
|
+
});
|
|
292
|
+
o.unsubscribe = p, r.load(), await l;
|
|
293
|
+
} catch (l) {
|
|
294
|
+
o.status = "error", o.error = l instanceof Error ? l.message : "Failed to preload", o.readyReject(
|
|
295
|
+
l instanceof Error ? l : new Error("Failed to preload")
|
|
296
|
+
), g.delete(t);
|
|
297
|
+
}
|
|
298
|
+
})(), U(t);
|
|
299
|
+
}
|
|
300
|
+
function v(e) {
|
|
301
|
+
return g.get(e) ?? null;
|
|
302
|
+
}
|
|
303
|
+
function P(e) {
|
|
304
|
+
const t = v(e);
|
|
305
|
+
return t && g.delete(e), t;
|
|
306
|
+
}
|
|
307
|
+
function ie(e) {
|
|
308
|
+
const { apiURL: t, token: n, lang: s, disableDashboardTheme: a, onError: r } = e, o = I(null), [c, l] = x(() => {
|
|
309
|
+
const u = v(n);
|
|
310
|
+
if (u?.status === "ready") {
|
|
311
|
+
const f = P(n);
|
|
312
|
+
if (f)
|
|
313
|
+
return o.current = f.flowManager, f.uiConfig && y(f.uiConfig), { status: "ready", flowManager: f.flowManager };
|
|
314
|
+
}
|
|
315
|
+
const d = T();
|
|
316
|
+
return o.current = d, u?.status === "error" ? {
|
|
317
|
+
status: "error",
|
|
318
|
+
error: u.error ?? "Preload failed",
|
|
319
|
+
flowManager: d
|
|
320
|
+
} : { status: "initializing", flowManager: d };
|
|
321
|
+
}), p = I(!1);
|
|
322
|
+
return M(() => {
|
|
323
|
+
if (c.status !== "initializing")
|
|
324
|
+
return;
|
|
325
|
+
const u = v(n);
|
|
326
|
+
if (u?.status === "loading") {
|
|
327
|
+
u.readyPromise.then(() => {
|
|
328
|
+
const f = P(n);
|
|
329
|
+
f && (o.current = f.flowManager, f.uiConfig && y(f.uiConfig), l({ status: "ready", flowManager: f.flowManager }));
|
|
330
|
+
}).catch((f) => {
|
|
331
|
+
const h = f instanceof Error ? f.message : "Preload failed";
|
|
332
|
+
l({
|
|
333
|
+
status: "error",
|
|
334
|
+
error: h,
|
|
335
|
+
flowManager: c.flowManager
|
|
336
|
+
}), r?.(h);
|
|
337
|
+
});
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (p.current)
|
|
341
|
+
return;
|
|
342
|
+
p.current = !0, (async () => {
|
|
343
|
+
try {
|
|
344
|
+
await N({ apiURL: t, token: n, lang: s });
|
|
345
|
+
const f = a ? Promise.resolve() : k().then((h) => {
|
|
346
|
+
h.uiConfig && y(h.uiConfig);
|
|
347
|
+
});
|
|
348
|
+
c.flowManager.load(), await f, l({ status: "ready", flowManager: c.flowManager });
|
|
349
|
+
} catch (f) {
|
|
350
|
+
const h = f instanceof Error ? f.message : "Failed to initialize SDK";
|
|
351
|
+
l({
|
|
352
|
+
status: "error",
|
|
353
|
+
error: h,
|
|
354
|
+
flowManager: c.flowManager
|
|
355
|
+
}), r?.(h);
|
|
356
|
+
}
|
|
357
|
+
})();
|
|
358
|
+
}, [t, n, s, a, r, c]), c;
|
|
359
|
+
}
|
|
360
|
+
function ae(e) {
|
|
361
|
+
const { moduleKey: t, onModuleLoading: n, onModuleLoaded: s, onError: a } = e, [r, o] = x({ status: "idle" });
|
|
362
|
+
return M(() => {
|
|
363
|
+
if (!t) {
|
|
364
|
+
o({ status: "idle" });
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const c = S[t];
|
|
368
|
+
if (!c) {
|
|
369
|
+
o({ status: "unsupported", moduleKey: t });
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
o({ status: "loading", moduleKey: t }), n?.(t);
|
|
373
|
+
let l = !1;
|
|
374
|
+
return c().then((p) => {
|
|
375
|
+
l || (o({ status: "loaded", moduleKey: t, Component: p }), s?.(t));
|
|
376
|
+
}).catch((p) => {
|
|
377
|
+
if (!l) {
|
|
378
|
+
const u = p instanceof Error ? p.message : "Failed to load module";
|
|
379
|
+
o({ status: "error", moduleKey: t, error: u }), a?.(`Failed to load ${t}: ${u}`);
|
|
380
|
+
}
|
|
381
|
+
}), () => {
|
|
382
|
+
l = !0;
|
|
383
|
+
};
|
|
384
|
+
}, [t, n, s, a]), r;
|
|
385
|
+
}
|
|
386
|
+
function le(e, t) {
|
|
387
|
+
const n = I(/* @__PURE__ */ new Set());
|
|
388
|
+
M(() => {
|
|
389
|
+
if (t < e.length - 1) {
|
|
390
|
+
const s = e[t + 1];
|
|
391
|
+
if (s && !n.current.has(s)) {
|
|
392
|
+
n.current.add(s);
|
|
393
|
+
const a = S[s];
|
|
394
|
+
a && a().catch(() => {
|
|
395
|
+
n.current.delete(s);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}, [e, t]);
|
|
400
|
+
}
|
|
401
|
+
const de = ({
|
|
402
|
+
config: e,
|
|
403
|
+
onFinish: t,
|
|
404
|
+
onError: n
|
|
405
|
+
}) => {
|
|
406
|
+
const { t: s } = $(), a = ie({
|
|
407
|
+
apiURL: e.apiURL,
|
|
408
|
+
token: e.token,
|
|
409
|
+
lang: e.lang,
|
|
410
|
+
disableDashboardTheme: e.disableDashboardTheme,
|
|
411
|
+
onError: n
|
|
412
|
+
}), [r, o] = B(() => a.flowManager, {
|
|
413
|
+
autoLoad: !1
|
|
414
|
+
}), c = ae({
|
|
415
|
+
moduleKey: r?.status === "ready" ? r.currentStep : void 0,
|
|
416
|
+
onModuleLoading: e.onModuleLoading,
|
|
417
|
+
onModuleLoaded: e.onModuleLoaded,
|
|
418
|
+
onError: n
|
|
419
|
+
});
|
|
420
|
+
if (le(
|
|
421
|
+
r?.status === "ready" ? r.steps : [],
|
|
422
|
+
r?.status === "ready" ? r.currentStepIndex : -1
|
|
423
|
+
), M(() => {
|
|
424
|
+
if (r?.status === "ready" && e.wasmConfig) {
|
|
425
|
+
const l = r, p = R(l.flow);
|
|
426
|
+
p.length > 0 && (e.onWasmWarmup?.(p), A(l, e.wasmConfig));
|
|
427
|
+
}
|
|
428
|
+
}, [r, e]), M(() => {
|
|
429
|
+
r?.status === "finished" && t(r.finishStatus);
|
|
430
|
+
}, [r?.status, t, r]), M(() => {
|
|
431
|
+
r?.status === "error" && n && n(r.error);
|
|
432
|
+
}, [r?.status, n, r]), a.status === "error")
|
|
433
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i("div", { children: [
|
|
434
|
+
"Error: ",
|
|
435
|
+
a.error
|
|
436
|
+
] }) });
|
|
437
|
+
if (a.status === "initializing")
|
|
438
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
439
|
+
b,
|
|
440
|
+
{
|
|
441
|
+
title: e.spinnerConfig?.title ?? s("home.settingUp"),
|
|
442
|
+
subtitle: e.spinnerConfig?.subtitle,
|
|
443
|
+
size: e.spinnerConfig?.size,
|
|
444
|
+
fullScreen: !0
|
|
445
|
+
}
|
|
446
|
+
) });
|
|
447
|
+
if (!r || r.status === "idle" || r.status === "loading")
|
|
448
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
449
|
+
b,
|
|
450
|
+
{
|
|
451
|
+
title: e.spinnerConfig?.title ?? s("home.settingUp"),
|
|
452
|
+
subtitle: e.spinnerConfig?.subtitle,
|
|
453
|
+
size: e.spinnerConfig?.size,
|
|
454
|
+
fullScreen: !0
|
|
455
|
+
}
|
|
456
|
+
) });
|
|
457
|
+
if (r.status === "error")
|
|
458
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i("div", { children: [
|
|
459
|
+
"Error: ",
|
|
460
|
+
r.error
|
|
461
|
+
] }) });
|
|
462
|
+
if (r.status === "finished")
|
|
463
|
+
return null;
|
|
464
|
+
if (r.status === "ready") {
|
|
465
|
+
const { currentStep: l, config: p } = r;
|
|
466
|
+
if (!l || !p)
|
|
467
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
468
|
+
b,
|
|
469
|
+
{
|
|
470
|
+
title: e.spinnerConfig?.title ?? s("loadingCircle.hangOn"),
|
|
471
|
+
subtitle: e.spinnerConfig?.subtitle ?? s("loadingCircle.validating"),
|
|
472
|
+
size: e.spinnerConfig?.size,
|
|
473
|
+
fullScreen: !0
|
|
474
|
+
}
|
|
475
|
+
) });
|
|
476
|
+
if (c.status === "unsupported")
|
|
477
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
478
|
+
se,
|
|
479
|
+
{
|
|
480
|
+
moduleKey: l,
|
|
481
|
+
onNext: () => o.completeModule()
|
|
482
|
+
}
|
|
483
|
+
) });
|
|
484
|
+
if (c.status === "idle" || c.status === "loading" || c.status === "error")
|
|
485
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
486
|
+
b,
|
|
487
|
+
{
|
|
488
|
+
title: e.spinnerConfig?.title ?? s("loadingCircle.hangOn"),
|
|
489
|
+
subtitle: e.spinnerConfig?.subtitle ?? s("loadingCircle.validating"),
|
|
490
|
+
size: e.spinnerConfig?.size,
|
|
491
|
+
fullScreen: !0
|
|
492
|
+
}
|
|
493
|
+
) });
|
|
494
|
+
const { Component: u } = c;
|
|
495
|
+
if (l === "SELFIE")
|
|
496
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
497
|
+
u,
|
|
498
|
+
{
|
|
499
|
+
config: p,
|
|
500
|
+
onFinish: () => o.completeModule(),
|
|
501
|
+
onError: (f) => {
|
|
502
|
+
n?.(f ?? "Selfie verification error");
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
`selfie-${r.currentStepIndex}`
|
|
506
|
+
) });
|
|
507
|
+
if (l === "PHONE")
|
|
508
|
+
return /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
509
|
+
u,
|
|
510
|
+
{
|
|
511
|
+
config: p,
|
|
512
|
+
onFinish: () => o.completeModule(),
|
|
513
|
+
onError: (f) => {
|
|
514
|
+
n?.(f ?? "Phone verification error");
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
`phone-${r.currentStepIndex}`
|
|
518
|
+
) });
|
|
519
|
+
if (l === "EMAIL") {
|
|
520
|
+
const d = p;
|
|
521
|
+
return !d || typeof d.otpVerification != "boolean" || typeof d.otpExpirationInMinutes != "number" ? /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i("div", { children: "Error: Invalid email configuration" }) }) : /* @__PURE__ */ i("div", { class: "IncodeFlow", children: /* @__PURE__ */ i(
|
|
522
|
+
u,
|
|
523
|
+
{
|
|
524
|
+
config: {
|
|
525
|
+
...d,
|
|
526
|
+
prefill: d.prefill ?? !1
|
|
527
|
+
},
|
|
528
|
+
onFinish: () => o.completeModule(),
|
|
529
|
+
onError: (f) => {
|
|
530
|
+
n?.(f ?? "Email verification error");
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
`email-${r.currentStepIndex}`
|
|
534
|
+
) });
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return null;
|
|
538
|
+
}, ce = ({
|
|
539
|
+
config: e,
|
|
540
|
+
onFinish: t = () => {
|
|
541
|
+
},
|
|
542
|
+
onError: n
|
|
543
|
+
}) => /* @__PURE__ */ i("div", { class: "IncodeComponent", children: e ? /* @__PURE__ */ i(
|
|
544
|
+
de,
|
|
545
|
+
{
|
|
546
|
+
config: e,
|
|
547
|
+
onFinish: t,
|
|
548
|
+
onError: n
|
|
549
|
+
}
|
|
550
|
+
) : null });
|
|
551
|
+
H(ce, "incode-flow");
|
|
552
|
+
export {
|
|
553
|
+
ce as IncodeFlow,
|
|
554
|
+
Ie as preloadIncodeFlow
|
|
555
|
+
};
|