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