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