@incodetech/web 2.0.0-alpha.11 → 2.0.0-alpha.12

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