@incodetech/web 2.0.0-alpha.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +212 -16
- package/dist/base.css +0 -1239
- package/dist/browser-ponyfill-B6W6hHVY.js +0 -344
- package/dist/email/email.es.js +0 -145
- package/dist/email/styles.css +0 -123
- package/dist/flow/flow.es.js +0 -555
- package/dist/flow/styles.css +0 -1121
- package/dist/incodeModule-Dv8Qllrv.js +0 -254
- package/dist/index.es.js +0 -6
- package/dist/instance-B-q0ZREN.js +0 -2140
- package/dist/otpInput-BtoZe0Wz.js +0 -151
- package/dist/page-CRac8THx.js +0 -234
- package/dist/phone/phone.es.js +0 -3441
- package/dist/phone/styles.css +0 -305
- package/dist/selfie/selfie.es.js +0 -893
- package/dist/selfie/styles.css +0 -592
- package/dist/selfieTutorial-C-u5GufD.js +0 -29
- package/dist/setup-wNL83jmW.js +0 -20
- package/dist/themes/dark.css +0 -652
- package/dist/themes/light.css +0 -543
- package/dist/title-BfO5Dlzk.js +0 -25
- package/dist/types/base.d.ts +0 -1
- package/dist/types/dark.d.ts +0 -1
- package/dist/types/email.d.ts +0 -57
- package/dist/types/flow.d.ts +0 -69
- package/dist/types/index.d.ts +0 -38
- package/dist/types/light.d.ts +0 -1
- package/dist/types/phone.d.ts +0 -58
- package/dist/types/selfie.d.ts +0 -31
- package/dist/types/styles.d.ts +0 -1
- package/dist/types/themes/dark.d.ts +0 -1
- package/dist/types/themes/light.d.ts +0 -1
- package/dist/uiConfig-CQ1W9cUD.js +0 -23
- package/dist/vendor-preact-CK0WeTOR.js +0 -584
package/dist/flow/flow.es.js
DELETED
|
@@ -1,555 +0,0 @@
|
|
|
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
|
-
};
|