@incodetech/web 2.0.0-alpha.10 → 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.
- package/dist/aligndevicelottie-DlQCRPfM.js +29 -0
- package/dist/backdevicelottie-B4NgyWmX.js +29 -0
- package/dist/base.css +572 -14
- package/dist/baseTutorial-Be85FuyO.js +383 -0
- package/dist/blurdevicelottie-_BZRug1c.js +29 -0
- package/dist/email/email.es.js +4 -4
- package/dist/flip-animation-COR596wy.js +29 -0
- package/dist/flow/flow.es.js +248 -263
- package/dist/flow/styles.css +2088 -8
- package/dist/frontdevicelottie-KhKxT5n9.js +29 -0
- package/dist/glaredevicelottie-DLuIStvb.js +29 -0
- package/dist/id/id.es.js +1496 -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-Dv8Qllrv.js → incodeModule-DR92HDjR.js} +11 -8
- package/dist/index.es.js +2 -2
- package/dist/{otpInput-BtoZe0Wz.js → otpInput-Dm1LhnDm.js} +2 -2
- package/dist/page-CITAo3qf.js +189 -0
- package/dist/passport-tutorial-CaYBFTqt.js +29 -0
- package/dist/phone/phone.es.js +4 -4
- package/dist/selfie/selfie.es.js +245 -533
- package/dist/selfie/styles.css +43 -0
- package/dist/selfieTutorial-Dm_p0ke9.js +29 -0
- package/dist/{setup-wNL83jmW.js → setup-BhetRn4n.js} +2 -2
- package/dist/spinner-CQtj_FFo.js +65 -0
- package/dist/themes/dark.css +145 -0
- package/dist/themes/light.css +145 -0
- package/dist/types/id.d.ts +34 -0
- package/dist/{uiConfig-CQ1W9cUD.js → uiConfig-DEqynrWx.js} +1 -1
- package/dist/{vendor-preact-CK0WeTOR.js → vendor-preact-CjD4WiuC.js} +124 -115
- package/package.json +11 -2
- package/dist/page-Dh_Zw2ik.js +0 -234
- package/dist/selfieTutorial-C-u5GufD.js +0 -29
- package/dist/title-BfO5Dlzk.js +0 -25
package/dist/flow/flow.es.js
CHANGED
|
@@ -1,111 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createOrchestratedFlowManager as
|
|
3
|
-
import {
|
|
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 {
|
|
6
|
-
import { api as
|
|
7
|
-
import { emailMachine as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { s as
|
|
12
|
-
|
|
13
|
-
|
|
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((
|
|
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),
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
if (o !==
|
|
61
|
-
const
|
|
62
|
-
switch (p =
|
|
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
|
-
|
|
25
|
+
i = ((a - r) / l + (a < r ? 6 : 0)) / 6;
|
|
65
26
|
break;
|
|
66
27
|
case a:
|
|
67
|
-
|
|
28
|
+
i = ((r - s) / l + 2) / 6;
|
|
68
29
|
break;
|
|
69
30
|
case r:
|
|
70
|
-
|
|
31
|
+
i = ((s - a) / l + 4) / 6;
|
|
71
32
|
break;
|
|
72
33
|
}
|
|
73
34
|
}
|
|
74
|
-
return { h:
|
|
35
|
+
return { h: i * 360, s: p * 100, l: c * 100 };
|
|
75
36
|
}
|
|
76
|
-
function
|
|
37
|
+
function I(e, t, n) {
|
|
77
38
|
const s = e / 360, a = t / 100, r = n / 100;
|
|
78
|
-
let o,
|
|
39
|
+
let o, d, i;
|
|
79
40
|
if (a === 0)
|
|
80
|
-
o =
|
|
41
|
+
o = d = i = r;
|
|
81
42
|
else {
|
|
82
|
-
const
|
|
83
|
-
o = u
|
|
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 = (
|
|
86
|
-
const
|
|
87
|
-
return
|
|
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(
|
|
50
|
+
return `#${p(o)}${p(d)}${p(i)}`;
|
|
90
51
|
}
|
|
91
|
-
function
|
|
92
|
-
const t =
|
|
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:
|
|
97
|
-
200:
|
|
98
|
-
300:
|
|
99
|
-
400:
|
|
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:
|
|
102
|
-
900:
|
|
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
|
|
66
|
+
function G(e, t) {
|
|
106
67
|
if (typeof document > "u")
|
|
107
68
|
return;
|
|
108
|
-
const n =
|
|
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
|
|
129
|
-
return (await
|
|
89
|
+
async function J() {
|
|
90
|
+
return (await P.get("/omni/asset/fetch-all")).data;
|
|
130
91
|
}
|
|
131
|
-
const
|
|
132
|
-
async function
|
|
92
|
+
const D = /* @__PURE__ */ new Map();
|
|
93
|
+
async function Q(e) {
|
|
133
94
|
if (e.startsWith("data:"))
|
|
134
95
|
return e;
|
|
135
|
-
const t =
|
|
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
|
|
140
|
-
|
|
100
|
+
const d = new FileReader();
|
|
101
|
+
d.onloadend = () => r(d.result), d.onerror = o, d.readAsDataURL(s);
|
|
141
102
|
});
|
|
142
|
-
return
|
|
103
|
+
return D.set(e, a), a;
|
|
143
104
|
}
|
|
144
|
-
async function
|
|
145
|
-
const e = await
|
|
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
|
|
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
|
|
120
|
+
return a && (r = await Q(a)), {
|
|
160
121
|
...s,
|
|
161
122
|
logo: r
|
|
162
123
|
};
|
|
163
124
|
}
|
|
164
|
-
async function
|
|
165
|
-
const e = await
|
|
166
|
-
return e.main &&
|
|
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
|
|
174
|
-
return
|
|
138
|
+
function x() {
|
|
139
|
+
return k({
|
|
175
140
|
modules: {
|
|
176
|
-
PHONE:
|
|
177
|
-
EMAIL:
|
|
178
|
-
SELFIE:
|
|
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
|
|
183
|
-
await
|
|
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
|
|
158
|
+
async function z() {
|
|
190
159
|
try {
|
|
191
|
-
const e = await
|
|
160
|
+
const e = await ee(), t = {
|
|
192
161
|
logoSrc: e.logo,
|
|
193
162
|
hideFooterBranding: e.hideFooterBranding
|
|
194
163
|
};
|
|
195
|
-
return
|
|
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 =
|
|
202
|
-
n.length > 0 &&
|
|
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
|
|
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
|
|
186
|
+
const re = ({
|
|
218
187
|
moduleKey: e,
|
|
219
188
|
onNext: t
|
|
220
|
-
}) => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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")),
|
|
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
|
|
229
|
+
function be(e) {
|
|
263
230
|
const { token: t } = e;
|
|
264
|
-
if (
|
|
265
|
-
return
|
|
231
|
+
if (w.has(t))
|
|
232
|
+
return R(t);
|
|
266
233
|
let n, s;
|
|
267
|
-
const a = new Promise((
|
|
268
|
-
n =
|
|
269
|
-
}), r =
|
|
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
|
|
244
|
+
return w.set(t, o), (async () => {
|
|
278
245
|
try {
|
|
279
|
-
await
|
|
246
|
+
await $({
|
|
280
247
|
apiURL: e.apiURL,
|
|
281
248
|
token: e.token,
|
|
282
249
|
lang: e.lang
|
|
283
250
|
});
|
|
284
|
-
const
|
|
285
|
-
o.theme =
|
|
286
|
-
}), p = r.subscribe((
|
|
287
|
-
if (
|
|
288
|
-
const
|
|
289
|
-
e.wasmConfig && A(
|
|
290
|
-
} else
|
|
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
|
|
293
|
-
} catch (
|
|
294
|
-
o.status = "error", o.error =
|
|
295
|
-
|
|
296
|
-
),
|
|
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
|
-
})(),
|
|
265
|
+
})(), R(t);
|
|
299
266
|
}
|
|
300
|
-
function
|
|
301
|
-
return
|
|
267
|
+
function F(e) {
|
|
268
|
+
return w.get(e) ?? null;
|
|
302
269
|
}
|
|
303
|
-
function
|
|
304
|
-
const t =
|
|
305
|
-
return t &&
|
|
270
|
+
function L(e) {
|
|
271
|
+
const t = F(e);
|
|
272
|
+
return t && w.delete(e), t;
|
|
306
273
|
}
|
|
307
|
-
function
|
|
308
|
-
const { apiURL: t, token: n, lang: s, disableDashboardTheme: a, onError: r } = e, o =
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
313
|
-
return o.current =
|
|
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
|
|
316
|
-
return o.current =
|
|
282
|
+
const l = x();
|
|
283
|
+
return o.current = l, c?.status === "error" ? {
|
|
317
284
|
status: "error",
|
|
318
|
-
error:
|
|
319
|
-
flowManager:
|
|
320
|
-
} : { status: "initializing", flowManager:
|
|
321
|
-
}), p =
|
|
322
|
-
return
|
|
323
|
-
if (
|
|
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
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
}).catch((
|
|
331
|
-
const h =
|
|
332
|
-
|
|
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:
|
|
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
|
|
345
|
-
const
|
|
346
|
-
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
|
-
|
|
349
|
-
} catch (
|
|
350
|
-
const h =
|
|
351
|
-
|
|
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:
|
|
321
|
+
flowManager: d.flowManager
|
|
355
322
|
}), r?.(h);
|
|
356
323
|
}
|
|
357
324
|
})();
|
|
358
|
-
}, [t, n, s, a, r,
|
|
325
|
+
}, [t, n, s, a, r, d]), d;
|
|
359
326
|
}
|
|
360
|
-
function
|
|
361
|
-
const { moduleKey: t, onModuleLoading: n, onModuleLoaded: s, onError: a } = e, [r, o] =
|
|
362
|
-
return
|
|
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
|
|
368
|
-
if (!
|
|
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
|
|
374
|
-
return
|
|
375
|
-
|
|
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 (!
|
|
378
|
-
const
|
|
379
|
-
o({ status: "error", moduleKey: t, error:
|
|
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
|
-
|
|
349
|
+
i = !0;
|
|
383
350
|
};
|
|
384
351
|
}, [t, n, s, a]), r;
|
|
385
352
|
}
|
|
386
|
-
function
|
|
387
|
-
const n =
|
|
388
|
-
|
|
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
|
|
368
|
+
const ie = ({
|
|
402
369
|
config: e,
|
|
403
370
|
onFinish: t,
|
|
404
371
|
onError: n
|
|
405
372
|
}) => {
|
|
406
|
-
const { t: s } =
|
|
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] =
|
|
379
|
+
}), [r, o] = _(() => a.flowManager, {
|
|
413
380
|
autoLoad: !1
|
|
414
|
-
}),
|
|
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 (
|
|
387
|
+
if (se(
|
|
421
388
|
r?.status === "ready" ? r.steps : [],
|
|
422
389
|
r?.status === "ready" ? r.currentStepIndex : -1
|
|
423
|
-
),
|
|
390
|
+
), g(() => {
|
|
424
391
|
if (r?.status === "ready" && e.wasmConfig) {
|
|
425
|
-
const
|
|
426
|
-
p.length > 0 && (e.onWasmWarmup?.(p), A(
|
|
392
|
+
const i = r, p = U(i.flow);
|
|
393
|
+
p.length > 0 && (e.onWasmWarmup?.(p), A(i, e.wasmConfig));
|
|
427
394
|
}
|
|
428
|
-
}, [r, e]),
|
|
395
|
+
}, [r, e]), g(() => {
|
|
429
396
|
r?.status === "finished" && t(r.finishStatus);
|
|
430
|
-
}, [r?.status, t, r]),
|
|
397
|
+
}, [r?.status, t, r]), g(() => {
|
|
431
398
|
r?.status === "error" && n && n(r.error);
|
|
432
|
-
}, [r?.status, n, r]),
|
|
433
|
-
|
|
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__ */
|
|
439
|
-
|
|
407
|
+
return /* @__PURE__ */ f("div", { class: "IncodeFlow", children: /* @__PURE__ */ f(
|
|
408
|
+
M,
|
|
440
409
|
{
|
|
441
|
-
title: e.spinnerConfig?.title
|
|
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__ */
|
|
449
|
-
|
|
417
|
+
return /* @__PURE__ */ f("div", { class: "IncodeFlow", children: /* @__PURE__ */ f(
|
|
418
|
+
M,
|
|
450
419
|
{
|
|
451
|
-
title: e.spinnerConfig?.title
|
|
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__ */
|
|
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:
|
|
466
|
-
if (!
|
|
467
|
-
return /* @__PURE__ */
|
|
468
|
-
|
|
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 (
|
|
477
|
-
return /* @__PURE__ */
|
|
478
|
-
|
|
445
|
+
if (d.status === "unsupported")
|
|
446
|
+
return /* @__PURE__ */ f("div", { class: "IncodeFlow", children: /* @__PURE__ */ f(
|
|
447
|
+
re,
|
|
479
448
|
{
|
|
480
|
-
moduleKey:
|
|
449
|
+
moduleKey: i,
|
|
481
450
|
onNext: () => o.completeModule()
|
|
482
451
|
}
|
|
483
452
|
) });
|
|
484
|
-
if (
|
|
485
|
-
return /* @__PURE__ */
|
|
486
|
-
|
|
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:
|
|
495
|
-
if (
|
|
496
|
-
return /* @__PURE__ */
|
|
497
|
-
|
|
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: (
|
|
502
|
-
n?.(
|
|
470
|
+
onError: (u) => {
|
|
471
|
+
n?.(u ?? "Selfie verification error");
|
|
503
472
|
}
|
|
504
473
|
},
|
|
505
474
|
`selfie-${r.currentStepIndex}`
|
|
506
475
|
) });
|
|
507
|
-
if (
|
|
508
|
-
return /* @__PURE__ */
|
|
509
|
-
|
|
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: (
|
|
514
|
-
n?.(
|
|
482
|
+
onError: (u) => {
|
|
483
|
+
n?.(u ?? "Phone verification error");
|
|
515
484
|
}
|
|
516
485
|
},
|
|
517
486
|
`phone-${r.currentStepIndex}`
|
|
518
487
|
) });
|
|
519
|
-
if (
|
|
520
|
-
const
|
|
521
|
-
return !
|
|
522
|
-
|
|
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
|
-
...
|
|
526
|
-
prefill:
|
|
494
|
+
...l,
|
|
495
|
+
prefill: l.prefill ?? !1
|
|
527
496
|
},
|
|
528
497
|
onFinish: () => o.completeModule(),
|
|
529
|
-
onError: (
|
|
530
|
-
n?.(
|
|
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
|
-
},
|
|
523
|
+
}, ae = ({
|
|
539
524
|
config: e,
|
|
540
525
|
onFinish: t = () => {
|
|
541
526
|
},
|
|
542
527
|
onError: n
|
|
543
|
-
}) => /* @__PURE__ */
|
|
544
|
-
|
|
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
|
-
|
|
536
|
+
O(ae, "incode-flow");
|
|
552
537
|
export {
|
|
553
|
-
|
|
554
|
-
|
|
538
|
+
ae as IncodeFlow,
|
|
539
|
+
be as preloadIncodeFlow
|
|
555
540
|
};
|