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