@incodetech/web 0.0.0-dev-20260309-4e885f1 → 0.0.0-dev-20260309-dec7ce7

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