@incodetech/web 0.0.0-dev-20260311-e7ef89b → 0.0.0-dev-20260311-358bd51

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.
@@ -115,6 +115,10 @@
115
115
  background-color: var(--color-input-surface-active, var(--input-surface-active));
116
116
  }
117
117
 
118
+ .IncodeDateInputComposedInput[aria-invalid="true"] {
119
+ border-color: var(--color-input-border-negative, var(--input-border-negative));
120
+ }
121
+
118
122
  .IncodeDateInputComposedInput:disabled {
119
123
  cursor: not-allowed;
120
124
  border-color: var(--color-input-border-disabled, var(--input-border-disabled));
@@ -3,7 +3,7 @@ import { SUPPORTED_COUNTRIES as I, DEV_ONLY_COUNTRIES as R, createEkybManager as
3
3
  import { T as w, y as v, A as L, k as A } from "./vendor-preact-DP-hbKuj.js";
4
4
  import "./uiConfig-B8PUPgHY.js";
5
5
  import "@incodetech/core";
6
- import { F as P, V as E, u as O } from "./verificationResult-DNP30nAT.js";
6
+ import { F as P, V as E, u as O } from "./verificationResult-BfLzIvM8.js";
7
7
  import { P as T } from "./page-Bdz8JP3P.js";
8
8
  import { D as f, I as N } from "./dropdownComposed-DgA0fNAh.js";
9
9
  function B(e) {
@@ -145,6 +145,14 @@
145
145
  display: block;
146
146
  }
147
147
 
148
+ .IncodeEkyc__submitError {
149
+ color: var(--input-text-helper-negative, #dc2626);
150
+ text-align: center;
151
+ margin: 0 0 12px;
152
+ font-size: 16px;
153
+ font-weight: 500;
154
+ }
155
+
148
156
  .IncodeAddressAutocomplete {
149
157
  width: 100%;
150
158
  position: relative;
@@ -0,0 +1,466 @@
1
+ import { u as t, b as O, I as H, a as U, S as j, B as Q, r as W } from "./incodeModule-7zNv7YeX.js";
2
+ import { createEkycManager as z } from "@incodetech/core/ekyc";
3
+ import { d as w, A as x, T as R, y as F, q as M } from "./vendor-preact-DP-hbKuj.js";
4
+ import "./uiConfig-B8PUPgHY.js";
5
+ import "@incodetech/core";
6
+ import { V as D, u as G, F as Y } from "./verificationResult-BfLzIvM8.js";
7
+ import { D as J } from "./dateInputComposed-Badm2Tzx.js";
8
+ import { I as B, D as K } from "./dropdownComposed-DgA0fNAh.js";
9
+ import { P as X } from "./page-Bdz8JP3P.js";
10
+ import { c as Z, g as L, p as V, A as T } from "./countries-DDCxQhGs.js";
11
+ import { u as ee } from "./useMediaQuery-Rn91JcLv.js";
12
+ const te = ({
13
+ id: f,
14
+ label: d,
15
+ countryCode: b = "US",
16
+ value: r,
17
+ placeholder: a = "(123) 123-6789",
18
+ error: C,
19
+ disabled: k = !1,
20
+ disableCountrySelector: $ = !1,
21
+ required: N,
22
+ onChange: v,
23
+ "data-testid": P
24
+ }) => {
25
+ const [p, l] = w(b), [I, A] = w(""), E = x(!1), g = R(
26
+ () => Z.map((s) => ({
27
+ value: s.code,
28
+ label: `${s.emoji} ${s.callingCode} ${s.name}`
29
+ })),
30
+ []
31
+ ), i = R(
32
+ () => L(p) ?? L("US"),
33
+ [p]
34
+ );
35
+ F(() => {
36
+ if (E.current || !r || !i) return;
37
+ E.current = !0;
38
+ const s = r.startsWith("+") ? r : `+${r}`, o = V(s);
39
+ if (o?.isValid() && o.country) {
40
+ o.country !== p && l(o.country);
41
+ const c = new T(o.country);
42
+ A(c.input(o.nationalNumber));
43
+ }
44
+ }, [r, i, p]);
45
+ const _ = M(
46
+ (s, o) => {
47
+ const c = `${o.callingCode}${s.replace(/\D/g, "")}`;
48
+ try {
49
+ const S = V(c, o.code);
50
+ v?.(c, S?.isValid() ?? !1);
51
+ } catch {
52
+ v?.(c, !1);
53
+ }
54
+ },
55
+ [v]
56
+ ), e = M(
57
+ (s) => {
58
+ l(s);
59
+ const o = L(s);
60
+ o && I && _(I, o);
61
+ },
62
+ [I, _]
63
+ ), u = M(
64
+ (s) => {
65
+ const o = s.target.value;
66
+ if (!i) {
67
+ A(o);
68
+ return;
69
+ }
70
+ const c = `${i.callingCode}${o}`, n = new T(i.code).input(c).replace(i.callingCode, "").trimStart();
71
+ A(n), _(o, i);
72
+ },
73
+ [i, _]
74
+ ), y = `${f}-country`, h = `${f}-phone`;
75
+ return /* @__PURE__ */ t(
76
+ K,
77
+ {
78
+ id: y,
79
+ label: d,
80
+ options: g,
81
+ value: p,
82
+ onChange: e,
83
+ error: C,
84
+ disabled: k || $,
85
+ required: N,
86
+ searchable: !0,
87
+ searchPlaceholder: "Search countries...",
88
+ renderSelectedLabel: (s) => {
89
+ const o = L(s.value);
90
+ return o ? `${o.emoji} ${o.callingCode}` : s.label;
91
+ },
92
+ class: "IncodePhoneInputComposed",
93
+ siblingElement: /* @__PURE__ */ t(
94
+ B,
95
+ {
96
+ id: h,
97
+ type: "tel",
98
+ value: I,
99
+ onInput: u,
100
+ placeholder: a,
101
+ error: C,
102
+ disabled: k,
103
+ suppressMessages: !0,
104
+ "aria-label": "Phone number",
105
+ "data-testid": P
106
+ }
107
+ )
108
+ }
109
+ );
110
+ }, oe = ({
111
+ label: f,
112
+ value: d,
113
+ error: b,
114
+ suggestions: r,
115
+ readonly: a,
116
+ optional: C,
117
+ onChange: k,
118
+ onSearch: $,
119
+ onSelect: N
120
+ }) => {
121
+ const { t: v } = O(), [P, p] = w(!1), [l, I] = w(!1), [A, E] = w(""), [g, i] = w(-1), _ = x(null), e = "ekyc-address-listbox", u = ee(), y = v(f), h = C ? `${y} (${v("common.optional")})` : y;
122
+ F(() => {
123
+ function n(m) {
124
+ _.current && !_.current.contains(m.target) && p(!1);
125
+ }
126
+ return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
127
+ }, []), F(() => {
128
+ i(-1);
129
+ }, [r]);
130
+ const s = M(
131
+ (n) => {
132
+ N(n), p(!1), I(!1), i(-1);
133
+ },
134
+ [N]
135
+ ), o = (n) => {
136
+ k(n), n.length >= 3 ? u ? (I(!0), E(n)) : ($(n), p(!0)) : p(!1);
137
+ }, c = (n) => {
138
+ !P || r.length === 0 || (n.key === "ArrowDown" ? (n.preventDefault(), i((m) => m < r.length - 1 ? m + 1 : 0)) : n.key === "ArrowUp" ? (n.preventDefault(), i((m) => m > 0 ? m - 1 : r.length - 1)) : n.key === "Enter" && g >= 0 ? (n.preventDefault(), s(r[g])) : n.key === "Escape" && (p(!1), i(-1)));
139
+ }, S = !u && P && r.length > 0, q = S && g >= 0 ? `${e}-option-${g}` : void 0;
140
+ return /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete", ref: _, children: [
141
+ /* @__PURE__ */ t(
142
+ B,
143
+ {
144
+ id: "ekyc-street",
145
+ label: h,
146
+ name: "street",
147
+ value: d,
148
+ readOnly: a,
149
+ error: b ? v(b) : void 0,
150
+ onInput: (n) => o(n.target.value),
151
+ onKeyDown: c,
152
+ role: "combobox",
153
+ "aria-expanded": S,
154
+ "aria-controls": e,
155
+ "aria-activedescendant": q,
156
+ "aria-autocomplete": "list",
157
+ "data-testid": "ekyc-address-input"
158
+ }
159
+ ),
160
+ S && /* @__PURE__ */ t(
161
+ "ul",
162
+ {
163
+ id: e,
164
+ role: "listbox",
165
+ className: "IncodeAddressAutocomplete__suggestions",
166
+ children: r.map((n, m) => /* @__PURE__ */ t(
167
+ "li",
168
+ {
169
+ id: `${e}-option-${m}`,
170
+ role: "option",
171
+ "aria-selected": m === g,
172
+ className: `IncodeAddressAutocomplete__suggestion${m === g ? "IncodeAddressAutocomplete__suggestion--active" : ""}`,
173
+ onClick: () => s(n),
174
+ children: n.label
175
+ },
176
+ n.id
177
+ ))
178
+ }
179
+ ),
180
+ u && l && /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modalOverlay", children: /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modal", children: [
181
+ /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modalHeader", children: [
182
+ /* @__PURE__ */ t("h3", { children: v("verification.addressSearch") }),
183
+ /* @__PURE__ */ t(
184
+ "button",
185
+ {
186
+ className: "IncodeAddressAutocomplete__modalClose",
187
+ onClick: () => I(!1),
188
+ type: "button",
189
+ children: "×"
190
+ }
191
+ )
192
+ ] }),
193
+ /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modalBody", children: [
194
+ /* @__PURE__ */ t(
195
+ "input",
196
+ {
197
+ className: "IncodeAddressAutocomplete__modalInput",
198
+ type: "text",
199
+ value: A,
200
+ placeholder: v("verification.addressPlaceholder"),
201
+ onInput: (n) => {
202
+ const m = n.target.value;
203
+ E(m), m.length >= 3 && $(m);
204
+ },
205
+ autoFocus: !0
206
+ }
207
+ ),
208
+ r.length > 0 && /* @__PURE__ */ t(
209
+ "ul",
210
+ {
211
+ role: "listbox",
212
+ className: "IncodeAddressAutocomplete__modalSuggestions",
213
+ children: r.map((n) => /* @__PURE__ */ t(
214
+ "li",
215
+ {
216
+ role: "option",
217
+ className: "IncodeAddressAutocomplete__modalSuggestion",
218
+ onClick: () => s(n),
219
+ children: n.label
220
+ },
221
+ n.id
222
+ ))
223
+ }
224
+ ),
225
+ /* @__PURE__ */ t(
226
+ "button",
227
+ {
228
+ className: "IncodeAddressAutocomplete__enterManually",
229
+ onClick: () => I(!1),
230
+ type: "button",
231
+ children: v("verification.enterManually")
232
+ }
233
+ )
234
+ ] })
235
+ ] }) })
236
+ ] });
237
+ }, se = ({ config: f, onFinish: d, onError: b }) => {
238
+ const { t: r } = O(), [a, C] = U(() => z({ config: f }));
239
+ F(() => {
240
+ (a.status === "finished" || a.status === "closed") && d?.();
241
+ }, [a.status, d]);
242
+ const k = a.status === "error" ? a.errorMessage : void 0;
243
+ return F(() => {
244
+ a.status === "error" && b?.(k);
245
+ }, [a.status, b, k]), a.status === "finished" || a.status === "closed" ? null : a.status === "loading" ? /* @__PURE__ */ t(
246
+ D,
247
+ {
248
+ status: "submitting",
249
+ submittingTitle: r("common.loading")
250
+ }
251
+ ) : a.status === "submitting" ? /* @__PURE__ */ t(D, { status: "submitting" }) : a.status === "success" ? /* @__PURE__ */ t(D, { status: "success" }) : a.status === "error" ? /* @__PURE__ */ t(
252
+ D,
253
+ {
254
+ status: "failure",
255
+ onRetry: () => C.retry(),
256
+ onSkip: () => C.skip()
257
+ }
258
+ ) : a.status === "misconfigured" ? /* @__PURE__ */ t(
259
+ D,
260
+ {
261
+ status: "failure",
262
+ failureTitle: r("verification.noFormFields"),
263
+ onSkip: () => C.close(),
264
+ skipLabel: r("common.close")
265
+ }
266
+ ) : a.status === "form" ? /* @__PURE__ */ t(ne, { state: a, manager: C }) : null;
267
+ }, ne = ({ state: f, manager: d }) => {
268
+ const {
269
+ fields: b,
270
+ values: r,
271
+ displayErrors: a,
272
+ errorParams: C,
273
+ isValid: k,
274
+ addressSuggestions: $,
275
+ prefilled: N,
276
+ hideEmail: v,
277
+ fieldsCountry: P,
278
+ submitError: p
279
+ } = f, { t: l } = O(), I = x(null), A = x(null), E = x(void 0), g = G(I, b.length);
280
+ F(() => {
281
+ const e = a.postalCode, u = E.current;
282
+ if (E.current = e, !e || u === e)
283
+ return;
284
+ const y = requestAnimationFrame(() => {
285
+ const h = A.current;
286
+ if (!h) return;
287
+ (h.querySelector("#postalCode-error") ?? h).scrollIntoView({
288
+ behavior: "smooth",
289
+ block: "nearest"
290
+ });
291
+ });
292
+ return () => cancelAnimationFrame(y);
293
+ }, [a.postalCode]);
294
+ let i;
295
+ return /* @__PURE__ */ t(X, { className: `IncodeEkycPage${g ? " IncodeEkycPage--scrollable" : ""}`, title: l("verification.title"), children: [
296
+ /* @__PURE__ */ t("div", { ref: I, className: "IncodeEkyc__form", children: b.map((e) => {
297
+ if (e.name === "email" && v) return null;
298
+ let u = null;
299
+ e.section && e.section !== i && (i = e.section, u = /* @__PURE__ */ t("h3", { className: "IncodeEkyc__sectionHeader", children: l({
300
+ address: "verification.labels.addressDetailsSection",
301
+ driverLicense: "verification.labels.dlDetailsSection"
302
+ }[e.section] ?? e.section) }));
303
+ const y = e.readonly || N[e.name], h = r[e.name] ?? "", s = a[e.name];
304
+ if (e.name === "street" && e.section === "address")
305
+ return /* @__PURE__ */ t("div", { children: [
306
+ u,
307
+ /* @__PURE__ */ t(
308
+ oe,
309
+ {
310
+ label: e.label,
311
+ value: h,
312
+ error: s,
313
+ suggestions: $,
314
+ readonly: y,
315
+ onChange: (o) => d.setField("street", o),
316
+ onSearch: (o) => d.searchAddress(o),
317
+ onSelect: (o) => d.selectAddress(o)
318
+ }
319
+ )
320
+ ] }, e.name);
321
+ if (e.type === "dropdown") {
322
+ const o = l(e.label);
323
+ return /* @__PURE__ */ t("div", { children: [
324
+ u,
325
+ /* @__PURE__ */ t(
326
+ K,
327
+ {
328
+ id: `ekyc-${e.name}`,
329
+ label: o,
330
+ placeholder: e.placeholder ? l(e.placeholder) : void 0,
331
+ value: h,
332
+ options: (e.options ?? []).map((c) => ({
333
+ ...c,
334
+ label: l(c.label)
335
+ })),
336
+ error: s ? l(s) : void 0,
337
+ disabled: y,
338
+ searchable: !0,
339
+ onChange: (c) => d.setField(e.name, c),
340
+ "data-testid": `ekyc-field-${e.name}`
341
+ }
342
+ )
343
+ ] }, e.name);
344
+ }
345
+ if (e.type === "date") {
346
+ const o = l(e.label);
347
+ return /* @__PURE__ */ t("div", { children: [
348
+ u,
349
+ /* @__PURE__ */ t(
350
+ J,
351
+ {
352
+ id: `ekyc-${e.name}`,
353
+ label: o,
354
+ value: h,
355
+ error: s ? l(s) : void 0,
356
+ disabled: y,
357
+ onInput: (c) => {
358
+ const S = c.target;
359
+ d.setField(e.name, S.value);
360
+ },
361
+ "data-testid": `ekyc-field-${e.name}`
362
+ }
363
+ )
364
+ ] }, e.name);
365
+ }
366
+ if (e.type === "phone") {
367
+ const o = l(e.label);
368
+ return /* @__PURE__ */ t("div", { children: [
369
+ u,
370
+ /* @__PURE__ */ t(
371
+ te,
372
+ {
373
+ id: `ekyc-${e.name}`,
374
+ label: o,
375
+ countryCode: P,
376
+ value: h,
377
+ placeholder: e.placeholder,
378
+ error: s ? l(s) : void 0,
379
+ disabled: y,
380
+ disableCountrySelector: e.disableCountrySelector,
381
+ required: e.required,
382
+ onChange: (c) => d.setField(e.name, c),
383
+ "data-testid": `ekyc-field-${e.name}`
384
+ }
385
+ )
386
+ ] }, e.name);
387
+ }
388
+ return e.type === "radio" ? /* @__PURE__ */ t("div", { children: [
389
+ u,
390
+ /* @__PURE__ */ t("div", { className: "IncodeEkyc__radioGroup", children: [
391
+ /* @__PURE__ */ t("label", { className: "IncodeEkyc__radioLabel", children: l(e.label) }),
392
+ /* @__PURE__ */ t("div", { className: "IncodeEkyc__radioOptions", children: e.options?.map((o) => /* @__PURE__ */ t(
393
+ "label",
394
+ {
395
+ className: "IncodeEkyc__radioOption",
396
+ children: [
397
+ /* @__PURE__ */ t(
398
+ "input",
399
+ {
400
+ type: "radio",
401
+ name: e.name,
402
+ checked: h === o.value,
403
+ value: o.value,
404
+ onChange: () => d.setField(e.name, o.value),
405
+ disabled: y
406
+ }
407
+ ),
408
+ /* @__PURE__ */ t("span", { children: l(o.label) })
409
+ ]
410
+ },
411
+ o.value
412
+ )) }),
413
+ s && /* @__PURE__ */ t("span", { className: "IncodeEkyc__fieldError", children: l(s) })
414
+ ] })
415
+ ] }, e.name) : /* @__PURE__ */ t(
416
+ "div",
417
+ {
418
+ ref: e.name === "postalCode" ? A : void 0,
419
+ children: [
420
+ u,
421
+ /* @__PURE__ */ t(
422
+ Y,
423
+ {
424
+ name: e.name,
425
+ label: e.label,
426
+ value: h,
427
+ error: s,
428
+ errorParams: C[e.name],
429
+ type: e.type,
430
+ placeholder: e.placeholder,
431
+ placeholderParams: e.placeholderParams,
432
+ required: e.required,
433
+ optional: e.optional,
434
+ readonly: y,
435
+ maxLength: e.maxLength,
436
+ onChange: (o, c) => d.setField(o, c)
437
+ }
438
+ )
439
+ ]
440
+ },
441
+ e.name
442
+ );
443
+ }) }),
444
+ /* @__PURE__ */ t("div", { className: "IncodeEkyc__footer", children: [
445
+ /* @__PURE__ */ t(j, { size: 32 }),
446
+ p && /* @__PURE__ */ t("p", { className: "IncodeEkyc__submitError", children: l(p) }),
447
+ /* @__PURE__ */ t(
448
+ Q,
449
+ {
450
+ onClick: () => d.submit(),
451
+ disabled: !k,
452
+ "data-testid": "ekyc-submit",
453
+ children: l("common.continue")
454
+ }
455
+ )
456
+ ] })
457
+ ] });
458
+ }, ae = ({
459
+ config: f,
460
+ onFinish: d,
461
+ onError: b
462
+ }) => /* @__PURE__ */ t(H, { children: f ? /* @__PURE__ */ t(se, { config: f, onFinish: d, onError: b }) : null });
463
+ W(ae, "incode-ekyc");
464
+ export {
465
+ ae as EkycModule
466
+ };
@@ -147,8 +147,8 @@ const T = () => import("../id/id.es.js").then((e) => e.Id), F = {
147
147
  (e) => e.GovernmentValidation
148
148
  ),
149
149
  GEOLOCATION: () => import("../geolocation/geolocation.es.js").then((e) => e.Geolocation),
150
- EXTERNAL_VERIFICATION: () => import("../ekycModule-DlnEKSR8.js").then((e) => e.EkycModule),
151
- EKYB: () => import("../ekybModule-C0QO-CSj.js").then((e) => e.EkybModule),
150
+ EXTERNAL_VERIFICATION: () => import("../ekycModule-D8_or1xq.js").then((e) => e.EkycModule),
151
+ EKYB: () => import("../ekybModule-DexnANPQ.js").then((e) => e.EkybModule),
152
152
  DOCUMENT_CAPTURE: () => import("../documentCapture-ChFrtfzB.js").then(
153
153
  (e) => e.DocumentCapture
154
154
  ),
@@ -4475,6 +4475,10 @@
4475
4475
  background-color: var(--color-input-surface-active, var(--input-surface-active));
4476
4476
  }
4477
4477
 
4478
+ .IncodeDateInputComposedInput[aria-invalid="true"] {
4479
+ border-color: var(--color-input-border-negative, var(--input-border-negative));
4480
+ }
4481
+
4478
4482
  .IncodeDateInputComposedInput:disabled {
4479
4483
  cursor: not-allowed;
4480
4484
  border-color: var(--color-input-border-disabled, var(--input-border-disabled));
@@ -5197,6 +5201,14 @@
5197
5201
  display: block;
5198
5202
  }
5199
5203
 
5204
+ .IncodeEkyc__submitError {
5205
+ color: var(--input-text-helper-negative, #dc2626);
5206
+ text-align: center;
5207
+ margin: 0 0 12px;
5208
+ font-size: 16px;
5209
+ font-weight: 500;
5210
+ }
5211
+
5200
5212
  .IncodeAddressAutocomplete {
5201
5213
  width: 100%;
5202
5214
  position: relative;
@@ -1,16 +1,16 @@
1
1
  import { d as g, y as F } from "./vendor-preact-DP-hbKuj.js";
2
- import { b as h, u as e, B as I } from "./incodeModule-7zNv7YeX.js";
2
+ import { b as I, u as e, B as v } from "./incodeModule-7zNv7YeX.js";
3
3
  import "./uiConfig-B8PUPgHY.js";
4
4
  import { I as S } from "./dropdownComposed-DgA0fNAh.js";
5
5
  import { S as y, E as k } from "./successIcon-BPe0Wymn.js";
6
6
  import { P as f } from "./page-Bdz8JP3P.js";
7
7
  import { S as z } from "./spinner-BknkxcID.js";
8
8
  function H(i, o) {
9
- const [a, n] = g(!1);
9
+ const [a, s] = g(!1);
10
10
  return F(() => {
11
11
  const t = i.current;
12
12
  if (!t) return;
13
- const c = () => n(t.scrollHeight > t.clientHeight);
13
+ const c = () => s(t.scrollHeight > t.clientHeight);
14
14
  c();
15
15
  const r = new ResizeObserver(c);
16
16
  return r.observe(t), () => r.disconnect();
@@ -20,35 +20,35 @@ const L = ({
20
20
  name: i,
21
21
  label: o,
22
22
  value: a = "",
23
- error: n,
23
+ error: s,
24
24
  errorParams: t,
25
25
  type: c = "text",
26
26
  placeholder: r,
27
27
  placeholderParams: u,
28
- required: s,
28
+ required: n,
29
29
  readonly: m,
30
30
  maxLength: l,
31
- disabled: v,
31
+ disabled: h,
32
32
  optional: _,
33
33
  onChange: V
34
34
  }) => {
35
- const { t: d } = h(), p = d(o), N = _ ? `${p} (${d("common.optional")})` : p;
35
+ const { t: d } = I(), p = d(o), b = _ ? `${p} ${d("verification.labels.optional")}` : p;
36
36
  return /* @__PURE__ */ e("div", { className: "IncodeFormField", children: /* @__PURE__ */ e(
37
37
  S,
38
38
  {
39
39
  id: i,
40
- label: N,
40
+ label: b,
41
41
  name: i,
42
42
  type: c,
43
43
  value: a,
44
44
  placeholder: r ? d(r, u) : void 0,
45
45
  readOnly: m,
46
- disabled: v,
46
+ disabled: h,
47
47
  maxLength: l,
48
- error: n ? d(n, t) : void 0,
49
- onInput: (R) => {
50
- const b = R.target;
51
- V(i, b.value);
48
+ error: s ? d(s, t) : void 0,
49
+ onInput: (N) => {
50
+ const R = N.target;
51
+ V(i, R.value);
52
52
  },
53
53
  "data-testid": `form-field-${i}`
54
54
  }
@@ -57,42 +57,42 @@ const L = ({
57
57
  status: i,
58
58
  submittingTitle: o,
59
59
  successTitle: a,
60
- failureTitle: n,
60
+ failureTitle: s,
61
61
  onRetry: t,
62
62
  onSkip: c,
63
63
  retryLabel: r,
64
64
  skipLabel: u
65
65
  }) => {
66
- const { t: s } = h();
66
+ const { t: n } = I();
67
67
  if (i === "submitting") {
68
- const l = o ?? s("verification.processing");
68
+ const l = o ?? n("verification.processing");
69
69
  return /* @__PURE__ */ e(f, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
70
70
  /* @__PURE__ */ e(z, {}),
71
71
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: l })
72
72
  ] }) });
73
73
  }
74
74
  if (i === "success") {
75
- const l = a ?? s("verification.successTitle");
75
+ const l = a ?? n("verification.successTitle");
76
76
  return /* @__PURE__ */ e(f, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
77
77
  /* @__PURE__ */ e(y, { size: 64 }),
78
78
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: l })
79
79
  ] }) });
80
80
  }
81
- const m = n ?? s("verification.failureTitle");
81
+ const m = s ?? n("verification.failureTitle");
82
82
  return /* @__PURE__ */ e(f, { className: "IncodeVerificationResult", children: [
83
83
  /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
84
84
  /* @__PURE__ */ e(k, { size: 64 }),
85
85
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: m })
86
86
  ] }),
87
87
  /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__actions", children: [
88
- t && /* @__PURE__ */ e(I, { onClick: t, "data-testid": "verification-retry", children: r ?? s("common.tryAgain") }),
88
+ t && /* @__PURE__ */ e(v, { onClick: t, "data-testid": "verification-retry", children: r ?? n("common.tryAgain") }),
89
89
  c && /* @__PURE__ */ e(
90
- I,
90
+ v,
91
91
  {
92
92
  onClick: c,
93
93
  variant: "secondary",
94
94
  "data-testid": "verification-skip",
95
- children: u ?? s("common.skip")
95
+ children: u ?? n("common.skip")
96
96
  }
97
97
  )
98
98
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260311-e7ef89b",
3
+ "version": "0.0.0-dev-20260311-358bd51",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -107,7 +107,7 @@
107
107
  "libphonenumber-js": "^1.11.0",
108
108
  "preact-custom-element": "^4.6.0",
109
109
  "tailwindcss": "^4.1.17",
110
- "@incodetech/core": "0.0.0-dev-20260311-e7ef89b"
110
+ "@incodetech/core": "0.0.0-dev-20260311-358bd51"
111
111
  },
112
112
  "devDependencies": {
113
113
  "@microsoft/api-extractor": "^7.53.3",
@@ -1,463 +0,0 @@
1
- import { u as t, b as O, I as H, a as U, S as j, B as Q, r as W } from "./incodeModule-7zNv7YeX.js";
2
- import { createEkycManager as z } from "@incodetech/core/ekyc";
3
- import { d as w, A as x, T as R, y as F, q as M } from "./vendor-preact-DP-hbKuj.js";
4
- import "./uiConfig-B8PUPgHY.js";
5
- import "@incodetech/core";
6
- import { V as D, u as G, F as Y } from "./verificationResult-DNP30nAT.js";
7
- import { D as J } from "./dateInputComposed-Badm2Tzx.js";
8
- import { I as B, D as K } from "./dropdownComposed-DgA0fNAh.js";
9
- import { P as X } from "./page-Bdz8JP3P.js";
10
- import { c as Z, g as L, p as V, A as T } from "./countries-DDCxQhGs.js";
11
- import { u as ee } from "./useMediaQuery-Rn91JcLv.js";
12
- const te = ({
13
- id: f,
14
- label: c,
15
- countryCode: y = "US",
16
- value: l,
17
- placeholder: r = "(123) 123-6789",
18
- error: I,
19
- disabled: k = !1,
20
- disableCountrySelector: S = !1,
21
- required: $,
22
- onChange: b,
23
- "data-testid": N
24
- }) => {
25
- const [a, A] = w(y), [v, _] = w(""), E = x(!1), C = R(
26
- () => Z.map((o) => ({
27
- value: o.code,
28
- label: `${o.emoji} ${o.callingCode} ${o.name}`
29
- })),
30
- []
31
- ), i = R(
32
- () => L(a) ?? L("US"),
33
- [a]
34
- );
35
- F(() => {
36
- if (E.current || !l || !i) return;
37
- E.current = !0;
38
- const o = l.startsWith("+") ? l : `+${l}`, s = V(o);
39
- if (s?.isValid() && s.country) {
40
- s.country !== a && A(s.country);
41
- const g = new T(s.country);
42
- _(g.input(s.nationalNumber));
43
- }
44
- }, [l, i, a]);
45
- const e = M(
46
- (o, s) => {
47
- const g = `${s.callingCode}${o.replace(/\D/g, "")}`;
48
- try {
49
- const P = V(g, s.code);
50
- b?.(g, P?.isValid() ?? !1);
51
- } catch {
52
- b?.(g, !1);
53
- }
54
- },
55
- [b]
56
- ), d = M(
57
- (o) => {
58
- A(o);
59
- const s = L(o);
60
- s && v && e(v, s);
61
- },
62
- [v, e]
63
- ), h = M(
64
- (o) => {
65
- const s = o.target.value;
66
- if (!i) {
67
- _(s);
68
- return;
69
- }
70
- const g = `${i.callingCode}${s}`, n = new T(i.code).input(g).replace(i.callingCode, "").trimStart();
71
- _(n), e(s, i);
72
- },
73
- [i, e]
74
- ), u = `${f}-country`, m = `${f}-phone`;
75
- return /* @__PURE__ */ t(
76
- K,
77
- {
78
- id: u,
79
- label: c,
80
- options: C,
81
- value: a,
82
- onChange: d,
83
- error: I,
84
- disabled: k || S,
85
- required: $,
86
- searchable: !0,
87
- searchPlaceholder: "Search countries...",
88
- renderSelectedLabel: (o) => {
89
- const s = L(o.value);
90
- return s ? `${s.emoji} ${s.callingCode}` : o.label;
91
- },
92
- class: "IncodePhoneInputComposed",
93
- siblingElement: /* @__PURE__ */ t(
94
- B,
95
- {
96
- id: m,
97
- type: "tel",
98
- value: v,
99
- onInput: h,
100
- placeholder: r,
101
- error: I,
102
- disabled: k,
103
- suppressMessages: !0,
104
- "aria-label": "Phone number",
105
- "data-testid": N
106
- }
107
- )
108
- }
109
- );
110
- }, oe = ({
111
- label: f,
112
- value: c,
113
- error: y,
114
- suggestions: l,
115
- readonly: r,
116
- optional: I,
117
- onChange: k,
118
- onSearch: S,
119
- onSelect: $
120
- }) => {
121
- const { t: b } = O(), [N, a] = w(!1), [A, v] = w(!1), [_, E] = w(""), [C, i] = w(-1), e = x(null), d = "ekyc-address-listbox", h = ee(), u = b(f), m = I ? `${u} (${b("common.optional")})` : u;
122
- F(() => {
123
- function n(p) {
124
- e.current && !e.current.contains(p.target) && a(!1);
125
- }
126
- return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
127
- }, []), F(() => {
128
- i(-1);
129
- }, [l]);
130
- const o = M(
131
- (n) => {
132
- $(n), a(!1), v(!1), i(-1);
133
- },
134
- [$]
135
- ), s = (n) => {
136
- k(n), n.length >= 3 ? h ? (v(!0), E(n)) : (S(n), a(!0)) : a(!1);
137
- }, g = (n) => {
138
- !N || l.length === 0 || (n.key === "ArrowDown" ? (n.preventDefault(), i((p) => p < l.length - 1 ? p + 1 : 0)) : n.key === "ArrowUp" ? (n.preventDefault(), i((p) => p > 0 ? p - 1 : l.length - 1)) : n.key === "Enter" && C >= 0 ? (n.preventDefault(), o(l[C])) : n.key === "Escape" && (a(!1), i(-1)));
139
- }, P = !h && N && l.length > 0, q = P && C >= 0 ? `${d}-option-${C}` : void 0;
140
- return /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete", ref: e, children: [
141
- /* @__PURE__ */ t(
142
- B,
143
- {
144
- id: "ekyc-street",
145
- label: m,
146
- name: "street",
147
- value: c,
148
- readOnly: r,
149
- error: y ? b(y) : void 0,
150
- onInput: (n) => s(n.target.value),
151
- onKeyDown: g,
152
- role: "combobox",
153
- "aria-expanded": P,
154
- "aria-controls": d,
155
- "aria-activedescendant": q,
156
- "aria-autocomplete": "list",
157
- "data-testid": "ekyc-address-input"
158
- }
159
- ),
160
- P && /* @__PURE__ */ t(
161
- "ul",
162
- {
163
- id: d,
164
- role: "listbox",
165
- className: "IncodeAddressAutocomplete__suggestions",
166
- children: l.map((n, p) => /* @__PURE__ */ t(
167
- "li",
168
- {
169
- id: `${d}-option-${p}`,
170
- role: "option",
171
- "aria-selected": p === C,
172
- className: `IncodeAddressAutocomplete__suggestion${p === C ? "IncodeAddressAutocomplete__suggestion--active" : ""}`,
173
- onClick: () => o(n),
174
- children: n.label
175
- },
176
- n.id
177
- ))
178
- }
179
- ),
180
- h && A && /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modalOverlay", children: /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modal", children: [
181
- /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modalHeader", children: [
182
- /* @__PURE__ */ t("h3", { children: b("verification.addressSearch") }),
183
- /* @__PURE__ */ t(
184
- "button",
185
- {
186
- className: "IncodeAddressAutocomplete__modalClose",
187
- onClick: () => v(!1),
188
- type: "button",
189
- children: "×"
190
- }
191
- )
192
- ] }),
193
- /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete__modalBody", children: [
194
- /* @__PURE__ */ t(
195
- "input",
196
- {
197
- className: "IncodeAddressAutocomplete__modalInput",
198
- type: "text",
199
- value: _,
200
- placeholder: b("verification.addressPlaceholder"),
201
- onInput: (n) => {
202
- const p = n.target.value;
203
- E(p), p.length >= 3 && S(p);
204
- },
205
- autoFocus: !0
206
- }
207
- ),
208
- l.length > 0 && /* @__PURE__ */ t(
209
- "ul",
210
- {
211
- role: "listbox",
212
- className: "IncodeAddressAutocomplete__modalSuggestions",
213
- children: l.map((n) => /* @__PURE__ */ t(
214
- "li",
215
- {
216
- role: "option",
217
- className: "IncodeAddressAutocomplete__modalSuggestion",
218
- onClick: () => o(n),
219
- children: n.label
220
- },
221
- n.id
222
- ))
223
- }
224
- ),
225
- /* @__PURE__ */ t(
226
- "button",
227
- {
228
- className: "IncodeAddressAutocomplete__enterManually",
229
- onClick: () => v(!1),
230
- type: "button",
231
- children: b("verification.enterManually")
232
- }
233
- )
234
- ] })
235
- ] }) })
236
- ] });
237
- }, se = ({ config: f, onFinish: c, onError: y }) => {
238
- const { t: l } = O(), [r, I] = U(() => z({ config: f }));
239
- F(() => {
240
- (r.status === "finished" || r.status === "closed") && c?.();
241
- }, [r.status, c]);
242
- const k = r.status === "error" ? r.errorMessage : void 0;
243
- return F(() => {
244
- r.status === "error" && y?.(k);
245
- }, [r.status, y, k]), r.status === "finished" || r.status === "closed" ? null : r.status === "loading" ? /* @__PURE__ */ t(
246
- D,
247
- {
248
- status: "submitting",
249
- submittingTitle: l("common.loading")
250
- }
251
- ) : r.status === "submitting" ? /* @__PURE__ */ t(D, { status: "submitting" }) : r.status === "success" ? /* @__PURE__ */ t(D, { status: "success" }) : r.status === "error" ? /* @__PURE__ */ t(
252
- D,
253
- {
254
- status: "failure",
255
- onRetry: () => I.retry(),
256
- onSkip: () => I.skip()
257
- }
258
- ) : r.status === "misconfigured" ? /* @__PURE__ */ t(
259
- D,
260
- {
261
- status: "failure",
262
- failureTitle: l("verification.noFormFields"),
263
- onSkip: () => I.close(),
264
- skipLabel: l("common.close")
265
- }
266
- ) : r.status === "form" ? /* @__PURE__ */ t(ne, { state: r, manager: I }) : null;
267
- }, ne = ({ state: f, manager: c }) => {
268
- const {
269
- fields: y,
270
- values: l,
271
- displayErrors: r,
272
- errorParams: I,
273
- isValid: k,
274
- addressSuggestions: S,
275
- prefilled: $,
276
- hideEmail: b,
277
- fieldsCountry: N
278
- } = f, { t: a } = O(), A = x(null), v = x(null), _ = x(void 0), E = G(A, y.length);
279
- F(() => {
280
- const e = r.postalCode, d = _.current;
281
- if (_.current = e, !e || d === e)
282
- return;
283
- const h = requestAnimationFrame(() => {
284
- const u = v.current;
285
- if (!u) return;
286
- (u.querySelector("#postalCode-error") ?? u).scrollIntoView({
287
- behavior: "smooth",
288
- block: "nearest"
289
- });
290
- });
291
- return () => cancelAnimationFrame(h);
292
- }, [r.postalCode]);
293
- let C;
294
- return /* @__PURE__ */ t(X, { className: `IncodeEkycPage${E ? " IncodeEkycPage--scrollable" : ""}`, title: a("verification.title"), children: [
295
- /* @__PURE__ */ t("div", { ref: A, className: "IncodeEkyc__form", children: y.map((e) => {
296
- if (e.name === "email" && b) return null;
297
- let d = null;
298
- e.section && e.section !== C && (C = e.section, d = /* @__PURE__ */ t("h3", { className: "IncodeEkyc__sectionHeader", children: a({
299
- address: "verification.labels.addressDetailsSection",
300
- driverLicense: "verification.labels.dlDetailsSection"
301
- }[e.section] ?? e.section) }));
302
- const h = e.readonly || $[e.name], u = l[e.name] ?? "", m = r[e.name];
303
- if (e.name === "street" && e.section === "address")
304
- return /* @__PURE__ */ t("div", { children: [
305
- d,
306
- /* @__PURE__ */ t(
307
- oe,
308
- {
309
- label: e.label,
310
- value: u,
311
- error: m,
312
- suggestions: S,
313
- readonly: h,
314
- onChange: (o) => c.setField("street", o),
315
- onSearch: (o) => c.searchAddress(o),
316
- onSelect: (o) => c.selectAddress(o)
317
- }
318
- )
319
- ] }, e.name);
320
- if (e.type === "dropdown") {
321
- const o = a(e.label);
322
- return /* @__PURE__ */ t("div", { children: [
323
- d,
324
- /* @__PURE__ */ t(
325
- K,
326
- {
327
- id: `ekyc-${e.name}`,
328
- label: o,
329
- placeholder: e.placeholder ? a(e.placeholder) : void 0,
330
- value: u,
331
- options: (e.options ?? []).map((s) => ({
332
- ...s,
333
- label: a(s.label)
334
- })),
335
- error: m ? a(m) : void 0,
336
- disabled: h,
337
- searchable: !0,
338
- onChange: (s) => c.setField(e.name, s),
339
- "data-testid": `ekyc-field-${e.name}`
340
- }
341
- )
342
- ] }, e.name);
343
- }
344
- if (e.type === "date") {
345
- const o = a(e.label);
346
- return /* @__PURE__ */ t("div", { children: [
347
- d,
348
- /* @__PURE__ */ t(
349
- J,
350
- {
351
- id: `ekyc-${e.name}`,
352
- label: o,
353
- value: u,
354
- error: m ? a(m) : void 0,
355
- disabled: h,
356
- onInput: (s) => {
357
- const g = s.target;
358
- c.setField(e.name, g.value);
359
- },
360
- "data-testid": `ekyc-field-${e.name}`
361
- }
362
- )
363
- ] }, e.name);
364
- }
365
- if (e.type === "phone") {
366
- const o = a(e.label);
367
- return /* @__PURE__ */ t("div", { children: [
368
- d,
369
- /* @__PURE__ */ t(
370
- te,
371
- {
372
- id: `ekyc-${e.name}`,
373
- label: o,
374
- countryCode: N,
375
- value: u,
376
- placeholder: e.placeholder,
377
- error: m ? a(m) : void 0,
378
- disabled: h,
379
- disableCountrySelector: e.disableCountrySelector,
380
- required: e.required,
381
- onChange: (s) => c.setField(e.name, s),
382
- "data-testid": `ekyc-field-${e.name}`
383
- }
384
- )
385
- ] }, e.name);
386
- }
387
- return e.type === "radio" ? /* @__PURE__ */ t("div", { children: [
388
- d,
389
- /* @__PURE__ */ t("div", { className: "IncodeEkyc__radioGroup", children: [
390
- /* @__PURE__ */ t("label", { className: "IncodeEkyc__radioLabel", children: a(e.label) }),
391
- /* @__PURE__ */ t("div", { className: "IncodeEkyc__radioOptions", children: e.options?.map((o) => /* @__PURE__ */ t(
392
- "label",
393
- {
394
- className: "IncodeEkyc__radioOption",
395
- children: [
396
- /* @__PURE__ */ t(
397
- "input",
398
- {
399
- type: "radio",
400
- name: e.name,
401
- value: o.value,
402
- checked: u === o.value,
403
- onChange: () => c.setField(e.name, o.value),
404
- disabled: h
405
- }
406
- ),
407
- /* @__PURE__ */ t("span", { children: a(o.label) })
408
- ]
409
- },
410
- o.value
411
- )) }),
412
- m && /* @__PURE__ */ t("span", { className: "IncodeEkyc__fieldError", children: a(m) })
413
- ] })
414
- ] }, e.name) : /* @__PURE__ */ t(
415
- "div",
416
- {
417
- ref: e.name === "postalCode" ? v : void 0,
418
- children: [
419
- d,
420
- /* @__PURE__ */ t(
421
- Y,
422
- {
423
- name: e.name,
424
- label: e.label,
425
- value: u,
426
- error: m,
427
- errorParams: I[e.name],
428
- type: e.type,
429
- placeholder: e.placeholder,
430
- placeholderParams: e.placeholderParams,
431
- required: e.required,
432
- readonly: h,
433
- maxLength: e.maxLength,
434
- onChange: (o, s) => c.setField(o, s)
435
- }
436
- )
437
- ]
438
- },
439
- e.name
440
- );
441
- }) }),
442
- /* @__PURE__ */ t("div", { className: "IncodeEkyc__footer", children: [
443
- /* @__PURE__ */ t(j, { size: 32 }),
444
- /* @__PURE__ */ t(
445
- Q,
446
- {
447
- onClick: () => c.submit(),
448
- disabled: !k,
449
- "data-testid": "ekyc-submit",
450
- children: a("common.continue")
451
- }
452
- )
453
- ] })
454
- ] });
455
- }, ae = ({
456
- config: f,
457
- onFinish: c,
458
- onError: y
459
- }) => /* @__PURE__ */ t(H, { children: f ? /* @__PURE__ */ t(se, { config: f, onFinish: c, onError: y }) : null });
460
- W(ae, "incode-ekyc");
461
- export {
462
- ae as EkycModule
463
- };