@incodetech/web 0.0.0-dev-20260402-7cf9db4 → 0.0.0-dev-20260402-0dc2fb9

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.
@@ -1,399 +0,0 @@
1
- import { u as t, c as T, b as D, S as W } from "./button-DXIWeie9.js";
2
- import { D as w, y as h, d as B, A as C, q as $, k as R, P as _, z as A, T as E } from "./vendor-preact-BoMmvSgn.js";
3
- import { E as M } from "./errorIcon-DOuc6ONw.js";
4
- import { S as G } from "./successIcon-BZphSsQr.js";
5
- import "./uiConfig-DmIn-g8M.js";
6
- import { b as L, a as S, c as V, C as j } from "./captureFooter-CKqO4KY2.js";
7
- import { L as q } from "./manualCaptureButton-CPZ2xxEI.js";
8
- const K = w(
9
- (r, a) => {
10
- const { class: e, rows: i = 4, ...n } = r;
11
- return /* @__PURE__ */ t(
12
- "textarea",
13
- {
14
- ...n,
15
- ref: a,
16
- rows: i,
17
- class: T("IncodeTextArea", e)
18
- }
19
- );
20
- }
21
- ), U = w(
22
- ({
23
- id: r,
24
- label: a,
25
- "aria-label": e,
26
- error: i,
27
- showErrorIcon: n,
28
- helper: o,
29
- showHelperIcon: l,
30
- required: u,
31
- rows: p = 4,
32
- class: f,
33
- ...b
34
- }, c) => {
35
- const v = `${r}-helper`, m = `${r}-error`, g = [o ? v : null, i ? m : null].filter(Boolean).join(" ");
36
- return /* @__PURE__ */ t("div", { class: T("IncodeTextAreaComposed", f), children: [
37
- a && /* @__PURE__ */ t(
38
- "label",
39
- {
40
- class: "IncodeTextAreaComposedLabel",
41
- htmlFor: r,
42
- "data-testid": `${r}-label`,
43
- children: [
44
- a,
45
- u && /* @__PURE__ */ t("span", { class: "IncodeTextAreaComposedRequired", children: " *" })
46
- ]
47
- }
48
- ),
49
- /* @__PURE__ */ t("div", { class: "IncodeTextAreaComposedWrapper", children: /* @__PURE__ */ t(
50
- K,
51
- {
52
- id: r,
53
- rows: p,
54
- ...b,
55
- ref: c,
56
- required: u,
57
- ...!a && e ? { "aria-label": e } : {},
58
- "aria-describedby": g || void 0,
59
- "aria-required": u ? "true" : void 0,
60
- "aria-invalid": i ? "true" : void 0
61
- }
62
- ) }),
63
- i && /* @__PURE__ */ t(
64
- "div",
65
- {
66
- class: "IncodeTextAreaComposedErrorWrapper",
67
- "data-testid": `${r}-error-wrapper`,
68
- children: [
69
- n && /* @__PURE__ */ t("div", { class: "IncodeTextAreaComposedIconWrapper", children: /* @__PURE__ */ t(M, { size: 17 }) }),
70
- /* @__PURE__ */ t("p", { id: m, class: "IncodeTextAreaComposedError", children: i })
71
- ]
72
- }
73
- ),
74
- o && !i && /* @__PURE__ */ t(
75
- "div",
76
- {
77
- class: "IncodeTextAreaComposedHelperWrapper",
78
- "data-testid": `${r}-helper-wrapper`,
79
- children: [
80
- l && /* @__PURE__ */ t("div", { class: "IncodeTextAreaComposedIconWrapper", children: /* @__PURE__ */ t(G, { size: 17 }) }),
81
- /* @__PURE__ */ t("p", { id: v, class: "IncodeTextAreaComposedHelper", children: o })
82
- ]
83
- }
84
- )
85
- ] });
86
- }
87
- );
88
- U.displayName = "TextAreaComposed";
89
- const I = /* @__PURE__ */ new Map();
90
- let P = !1;
91
- const y = {
92
- blur: () => import("./blurdevicelottie-_BZRug1c.js"),
93
- glare: () => import("./glaredevicelottie-DLuIStvb.js"),
94
- align: () => import("./aligndevicelottie-DlQCRPfM.js"),
95
- front: () => import("./frontdevicelottie-KhKxT5n9.js"),
96
- back: () => import("./backdevicelottie-B4NgyWmX.js")
97
- };
98
- function O(r) {
99
- P || (P = !0, Promise.all([
100
- y.blur(),
101
- y.glare(),
102
- y.align(),
103
- y.front(),
104
- y.back()
105
- ]).then(([a, e, i, n, o]) => {
106
- I.set("blur", a.default), I.set("glare", e.default), I.set("align", i.default), I.set("front", n.default), I.set("back", o.default), r?.();
107
- }).catch(() => {
108
- }));
109
- }
110
- function J() {
111
- O();
112
- }
113
- function Q() {
114
- h(() => {
115
- J();
116
- }, []);
117
- }
118
- function X(r, a) {
119
- const { t: e } = D(), [, i] = B(0);
120
- if (h(() => {
121
- O(() => i((n) => n + 1));
122
- }, []), r === "blur")
123
- return {
124
- title: e("idv2.capture.notifications.blur.title"),
125
- description: e("idv2.capture.notifications.blur.description"),
126
- animationData: I.get("blur") ?? null
127
- };
128
- if (r === "glare")
129
- return {
130
- title: e("idv2.capture.notifications.glare.title"),
131
- description: e("idv2.capture.notifications.glare.description"),
132
- animationData: I.get("glare") ?? null
133
- };
134
- if (r === "farAway")
135
- return {
136
- title: e("idv2.capture.notifications.notAligned.title"),
137
- description: e("idv2.capture.notifications.notAligned.description"),
138
- animationData: I.get("align") ?? null
139
- };
140
- if (r === "wrongSide") {
141
- const n = a === "back";
142
- return {
143
- title: e(n ? "idv2.capture.notifications.showBack.title" : "idv2.capture.notifications.showFront.title"),
144
- description: e(n ? "idv2.capture.notifications.showBack.description" : "idv2.capture.notifications.showFront.description"),
145
- animationData: I.get(n ? "back" : "front") ?? null
146
- };
147
- }
148
- return null;
149
- }
150
- const Y = ({
151
- detectionStatus: r,
152
- mode: a,
153
- isCapturing: e
154
- }) => {
155
- const { t: i } = D(), n = X(r, a), o = C(null), l = C({
156
- message: "",
157
- at: 0
158
- }), u = C(r), p = C(!1), f = C(), b = C(), c = r === "detecting" || r === "idNotDetected" || r === "manualCapture", v = r === "manualCapture", m = r === "wrongSide", g = r === "farAway", k = r === "glare", H = r === "blur", s = $((d) => {
159
- const x = Date.now(), N = l.current;
160
- if (d === N.message && x - N.at < 200) return;
161
- l.current = { message: d, at: x };
162
- const z = o.current;
163
- z && (clearTimeout(f.current), z.textContent = "", b.current = setTimeout(() => {
164
- z.textContent = d, f.current = setTimeout(() => {
165
- z.textContent = "";
166
- }, 3e3);
167
- }, 50));
168
- }, []), F = $(() => i(a === "passport" ? "idv2.capture.fillFramePassport" : a === "back" ? "idv2.capture.v2.fillFrameBack" : "idv2.capture.v2.fillFrameFront"), [a, i]);
169
- return h(() => {
170
- if (v) {
171
- p.current = !1;
172
- return;
173
- }
174
- if (p.current || !c) return;
175
- const d = setTimeout(() => {
176
- p.current = !0, s(F());
177
- }, 500);
178
- return () => clearTimeout(d);
179
- }, [c, v, s, F]), h(() => {
180
- const d = u.current;
181
- u.current = r, d !== "manualCapture" && v && s(i("idv2.capture.manualCapture.modeSwitchAriaAnnouncement"));
182
- }, [s, r, v, i]), h(() => {
183
- if (!e) {
184
- if (m) {
185
- const x = a === "front" || a === "passport" ? "idv2.capture.notifications.showFront" : "idv2.capture.notifications.showBack";
186
- s(`${i(`${x}.title`)}. ${i(`${x}.description`)}`);
187
- return;
188
- }
189
- if (g) {
190
- s(`${i("idv2.capture.notifications.notAligned.title")}.`);
191
- return;
192
- }
193
- if (k) {
194
- s(`${i("idv2.capture.notifications.glare.title")}.`);
195
- return;
196
- }
197
- if (H) {
198
- s(`${i("idv2.capture.notifications.blur.title")}.`);
199
- return;
200
- }
201
- c && p.current && s(F());
202
- }
203
- }, [
204
- s,
205
- H,
206
- e,
207
- g,
208
- k,
209
- c,
210
- m,
211
- a,
212
- i,
213
- F
214
- ]), h(() => () => {
215
- clearTimeout(b.current), clearTimeout(f.current);
216
- }, []), /* @__PURE__ */ t(R, { children: [
217
- /* @__PURE__ */ t(
218
- "div",
219
- {
220
- ref: o,
221
- class: "IncodeSrOnly",
222
- "aria-live": "assertive",
223
- "aria-atomic": "true"
224
- }
225
- ),
226
- n ? /* @__PURE__ */ t("div", { class: T("IncodeIdCaptureNotification"), "aria-hidden": "true", children: /* @__PURE__ */ t("div", { class: "IncodeIdCaptureNotificationContent", children: [
227
- /* @__PURE__ */ t("div", { class: T("IncodeIdCaptureNotificationText"), children: [
228
- /* @__PURE__ */ t("div", { class: "IncodeIdCaptureNotificationTitle", children: n.title }),
229
- n.description && /* @__PURE__ */ t("div", { class: "IncodeIdCaptureNotificationDescription", children: n.description })
230
- ] }),
231
- /* @__PURE__ */ t(W, { size: 16, direction: "horizontal" }),
232
- n.animationData && /* @__PURE__ */ t("div", { class: "IncodeIdCaptureNotificationAnimation", children: /* @__PURE__ */ t(q, { animationData: n.animationData, loop: !0 }) })
233
- ] }) }) : null
234
- ] });
235
- }, Z = A(
236
- () => import("./front-horizontal-hint-lRLKd7vY.js")
237
- ), tt = A(
238
- () => import("./front-vertical-hint-qQoJXRE3.js")
239
- ), rt = A(
240
- () => import("./back-horizontal-hint-CSlf9KI1.js")
241
- ), et = A(
242
- () => import("./back-vertical-hint-CNieqiCr.js")
243
- ), it = A(
244
- () => import("./passport-horizontal-hint-BCtpMp1Y.js")
245
- ), nt = A(
246
- () => import("./passport-vertical-hint-GaLnzqHP.js")
247
- ), at = {
248
- "front-horizontal": 348,
249
- "back-horizontal": 348,
250
- "passport-horizontal": 342
251
- }, ot = {
252
- "front-vertical": 446,
253
- "back-vertical": 446,
254
- "passport-vertical": 342
255
- };
256
- function ct(r, a, e, i) {
257
- const n = `${r}-${a}`, o = at[n];
258
- if (o) return e / o;
259
- const l = ot[n];
260
- return l ? i / l : 1;
261
- }
262
- const lt = ({ mode: r, orientation: a }) => {
263
- const e = C(null), [i, n] = B(1);
264
- h(() => {
265
- const l = e.current;
266
- if (!l) return;
267
- const u = () => {
268
- n(
269
- ct(r, a, l.clientWidth, l.clientHeight)
270
- );
271
- };
272
- u();
273
- const p = new ResizeObserver(u);
274
- return p.observe(l), () => p.disconnect();
275
- }, [r, a]);
276
- const o = () => r === "front" ? a === "horizontal" ? /* @__PURE__ */ t(Z, {}) : /* @__PURE__ */ t(tt, {}) : r === "back" ? a === "horizontal" ? /* @__PURE__ */ t(rt, {}) : /* @__PURE__ */ t(et, {}) : r === "passport" ? a === "horizontal" ? /* @__PURE__ */ t(it, {}) : /* @__PURE__ */ t(nt, {}) : null;
277
- return /* @__PURE__ */ t(
278
- "div",
279
- {
280
- ref: e,
281
- class: "IncodeIdHint",
282
- "aria-hidden": "true",
283
- role: "presentation",
284
- children: /* @__PURE__ */ t("div", { class: "IncodeIdHintAnimated", children: /* @__PURE__ */ t(_, { fallback: null, children: /* @__PURE__ */ t("div", { class: "IncodeIdHintSvg", style: { transform: `scale(${i})` }, children: o() }) }) })
285
- }
286
- );
287
- }, It = w(
288
- ({
289
- mode: r,
290
- orientation: a,
291
- detectionStatus: e,
292
- counterValue: i,
293
- isCapturing: n,
294
- showManualCapture: o,
295
- onCapture: l,
296
- onOpenHelp: u,
297
- helpButtonRef: p,
298
- captureButtonRef: f
299
- }, b) => {
300
- const { t: c } = D();
301
- Q(), h(() => {
302
- o && f && f.current?.focus();
303
- }, [o, f]);
304
- const v = () => n || e === "capturing" ? "capturing" : e === "blur" || e === "glare" || e === "wrongSide" || e === "farAway" ? "error" : "idle", m = E(() => {
305
- if (n || e === "capturing")
306
- return {
307
- title: c("idv2.capture.takingPhoto"),
308
- subtitle: c("idv2.capture.dontMove")
309
- };
310
- if (e === "detecting" || e === "idNotDetected" || e === "manualCapture") {
311
- const d = e === "manualCapture";
312
- return r === "passport" ? {
313
- title: c("idv2.capture.fillFramePassport"),
314
- subtitle: d ? "" : c("idv2.capture.v2.autoCapture")
315
- } : r === "back" ? {
316
- title: c("idv2.capture.v2.fillFrameBack"),
317
- subtitle: d ? "" : c("idv2.capture.v2.autoCapture")
318
- } : {
319
- title: c("idv2.capture.v2.fillFrameFront"),
320
- subtitle: d ? "" : c("idv2.capture.v2.autoCapture")
321
- };
322
- }
323
- return null;
324
- }, [n, e, r, c]), g = v(), k = r === "passport", H = a !== "vertical" || k, s = H ? "horizontal" : "vertical";
325
- return /* @__PURE__ */ t(
326
- j,
327
- {
328
- className: T(
329
- "IncodeCaptureOverlayId",
330
- !H && "IncodeCaptureOverlayVertical"
331
- ),
332
- children: [
333
- /* @__PURE__ */ t("div", { class: "IncodeCaptureTopSection", children: [
334
- /* @__PURE__ */ t(
335
- Y,
336
- {
337
- detectionStatus: e,
338
- mode: r,
339
- isCapturing: n
340
- }
341
- ),
342
- /* @__PURE__ */ t(
343
- L,
344
- {
345
- title: m?.title ?? "",
346
- subtitle: m?.subtitle,
347
- visible: m !== null,
348
- titleId: "id-capture-heading"
349
- }
350
- )
351
- ] }),
352
- /* @__PURE__ */ t(
353
- S,
354
- {
355
- ref: b,
356
- variant: "locked",
357
- orientation: s,
358
- frameState: g,
359
- className: T(k && "IncodeCaptureFramePassport"),
360
- children: [
361
- n && i > 0 && /* @__PURE__ */ t("div", { class: "IncodeCaptureCounter", children: i }),
362
- e === "idNotDetected" && /* @__PURE__ */ t(lt, { mode: r, orientation: a ?? "horizontal" })
363
- ]
364
- }
365
- ),
366
- /* @__PURE__ */ t("div", { class: "IncodeSrOnly", "aria-live": "polite", "aria-atomic": "true", children: n && i > 0 ? i : "" }),
367
- /* @__PURE__ */ t(
368
- V,
369
- {
370
- onOpenHelp: u,
371
- onCapture: l,
372
- isManualCapture: o,
373
- helpButtonRef: p,
374
- captureButtonRef: f,
375
- captureAriaDescribedBy: o ? "manual-capture-tooltip" : void 0,
376
- children: o ? /* @__PURE__ */ t("div", { class: "IncodeIdManualCaptureTooltipContainer", children: /* @__PURE__ */ t(
377
- "div",
378
- {
379
- id: "manual-capture-tooltip",
380
- role: "tooltip",
381
- class: "IncodeIdManualCaptureTooltip",
382
- children: /* @__PURE__ */ t("ol", { class: "IncodeIdManualCaptureTooltipList", children: [
383
- /* @__PURE__ */ t("li", { children: c("idv2.commonIssues.firstStep") }),
384
- /* @__PURE__ */ t("li", { children: c("idv2.commonIssues.secondStep") })
385
- ] })
386
- }
387
- ) }) : null
388
- }
389
- )
390
- ]
391
- }
392
- );
393
- }
394
- );
395
- export {
396
- It as C,
397
- K as T,
398
- U as a
399
- };