@incodetech/web 0.0.0-dev-20260313-bc2dab4 → 0.0.0-dev-20260317-ce5d28b

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,370 +0,0 @@
1
- import { b as L, u as t, I as q, a as O, S as V, B as K } from "./button-Ca1tRSTI.js";
2
- import { createEkycManager as B } from "@incodetech/core/ekyc";
3
- import { d as w, A as x, y as N, q as H } from "./vendor-preact-BXf0bkEs.js";
4
- import "./uiConfig-Z6RT23Sl.js";
5
- import "@incodetech/core";
6
- import { u as T } from "./useFormScrollable-3O3GeT4m.js";
7
- import { D as Q } from "./dateInputComposed-CvFmQpJ0.js";
8
- import { I as z, D as G } from "./dropdownComposed-DBm7cotT.js";
9
- import { V as S, F as U } from "./formField-C91ckby4.js";
10
- import { P as W } from "./page-BVHG3h0V.js";
11
- import { r as j } from "./incodeModule-aE-LkKwM.js";
12
- import { P as J } from "./phoneInputComposed-B1gXoSzr.js";
13
- import { u as X } from "./useMediaQuery-CiSMgDyi.js";
14
- const Y = ({
15
- label: y,
16
- value: n,
17
- error: h,
18
- suggestions: l,
19
- readonly: a,
20
- optional: b,
21
- onChange: E,
22
- onSearch: M,
23
- onSelect: F
24
- }) => {
25
- const { t: v } = L(), [D, I] = w(!1), [r, C] = w(!1), [P, g] = w(""), [k, A] = w(-1), $ = x(null), e = "ekyc-address-listbox", i = X(), p = v(y), u = b ? `${p} (${v("common.optional")})` : p;
26
- N(() => {
27
- function o(d) {
28
- $.current && !$.current.contains(d.target) && I(!1);
29
- }
30
- return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
31
- }, []), N(() => {
32
- A(-1);
33
- }, [l]);
34
- const c = H(
35
- (o) => {
36
- F(o), I(!1), C(!1), A(-1);
37
- },
38
- [F]
39
- ), s = (o) => {
40
- E(o), o.length >= 3 ? i ? (C(!0), g(o)) : (M(o), I(!0)) : I(!1);
41
- }, m = (o) => {
42
- !D || l.length === 0 || (o.key === "ArrowDown" ? (o.preventDefault(), A((d) => d < l.length - 1 ? d + 1 : 0)) : o.key === "ArrowUp" ? (o.preventDefault(), A((d) => d > 0 ? d - 1 : l.length - 1)) : o.key === "Enter" && k >= 0 ? (o.preventDefault(), c(l[k])) : o.key === "Escape" && (I(!1), A(-1)));
43
- }, f = !i && D && l.length > 0, R = f && k >= 0 ? `${e}-option-${k}` : void 0;
44
- return /* @__PURE__ */ t("div", { className: "IncodeAddressAutocomplete", ref: $, children: [
45
- /* @__PURE__ */ t(
46
- z,
47
- {
48
- id: "ekyc-street",
49
- label: u,
50
- name: "street",
51
- value: n,
52
- readOnly: a,
53
- error: h ? v(h) : void 0,
54
- onInput: (o) => s(o.target.value),
55
- onKeyDown: m,
56
- role: "combobox",
57
- "aria-expanded": f,
58
- "aria-controls": e,
59
- "aria-activedescendant": R,
60
- "aria-autocomplete": "list",
61
- "data-testid": "ekyc-address-input"
62
- }
63
- ),
64
- f && /* @__PURE__ */ t(
65
- "ul",
66
- {
67
- id: e,
68
- role: "listbox",
69
- className: "IncodeAddressAutocompleteSuggestions",
70
- children: l.map((o, d) => /* @__PURE__ */ t(
71
- "li",
72
- {
73
- id: `${e}-option-${d}`,
74
- role: "option",
75
- "aria-selected": d === k,
76
- className: `IncodeAddressAutocompleteSuggestion${d === k ? "IncodeAddressAutocompleteSuggestionActive" : ""}`,
77
- onClick: () => c(o),
78
- children: o.label
79
- },
80
- o.id
81
- ))
82
- }
83
- ),
84
- i && r && /* @__PURE__ */ t("div", { className: "IncodeAddressAutocompleteModalOverlay", children: /* @__PURE__ */ t("div", { className: "IncodeAddressAutocompleteModal", children: [
85
- /* @__PURE__ */ t("div", { className: "IncodeAddressAutocompleteModalHeader", children: [
86
- /* @__PURE__ */ t("h3", { children: v("verification.addressSearch") }),
87
- /* @__PURE__ */ t(
88
- "button",
89
- {
90
- className: "IncodeAddressAutocompleteModalClose",
91
- onClick: () => C(!1),
92
- type: "button",
93
- children: "×"
94
- }
95
- )
96
- ] }),
97
- /* @__PURE__ */ t("div", { className: "IncodeAddressAutocompleteModalBody", children: [
98
- /* @__PURE__ */ t(
99
- "input",
100
- {
101
- className: "IncodeAddressAutocompleteModalInput",
102
- type: "text",
103
- value: P,
104
- placeholder: v("verification.addressPlaceholder"),
105
- onInput: (o) => {
106
- const d = o.target.value;
107
- g(d), d.length >= 3 && M(d);
108
- },
109
- autoFocus: !0
110
- }
111
- ),
112
- l.length > 0 && /* @__PURE__ */ t(
113
- "ul",
114
- {
115
- role: "listbox",
116
- className: "IncodeAddressAutocompleteModalSuggestions",
117
- children: l.map((o) => /* @__PURE__ */ t(
118
- "li",
119
- {
120
- role: "option",
121
- className: "IncodeAddressAutocompleteModalSuggestion",
122
- onClick: () => c(o),
123
- children: o.label
124
- },
125
- o.id
126
- ))
127
- }
128
- ),
129
- /* @__PURE__ */ t(
130
- "button",
131
- {
132
- className: "IncodeAddressAutocompleteEnterManually",
133
- onClick: () => C(!1),
134
- type: "button",
135
- children: v("verification.enterManually")
136
- }
137
- )
138
- ] })
139
- ] }) })
140
- ] });
141
- }, Z = ({ config: y, onFinish: n, onError: h }) => {
142
- const { t: l } = L(), [a, b] = O(() => B({ config: y }));
143
- N(() => {
144
- (a.status === "finished" || a.status === "closed") && n?.();
145
- }, [a.status, n]);
146
- const E = a.status === "error" ? a.errorMessage : void 0;
147
- return N(() => {
148
- a.status === "error" && h?.(E);
149
- }, [a.status, h, E]), a.status === "finished" || a.status === "closed" ? null : a.status === "loading" ? /* @__PURE__ */ t(
150
- S,
151
- {
152
- status: "submitting",
153
- submittingTitle: l("common.loading")
154
- }
155
- ) : a.status === "submitting" ? /* @__PURE__ */ t(S, { status: "submitting" }) : a.status === "success" ? /* @__PURE__ */ t(S, { status: "success" }) : a.status === "error" ? /* @__PURE__ */ t(
156
- S,
157
- {
158
- status: "failure",
159
- onRetry: () => b.retry(),
160
- onSkip: () => b.skip()
161
- }
162
- ) : a.status === "misconfigured" ? /* @__PURE__ */ t(
163
- S,
164
- {
165
- status: "failure",
166
- failureTitle: l("verification.noFormFields"),
167
- onSkip: () => b.close(),
168
- skipLabel: l("common.close")
169
- }
170
- ) : a.status === "form" ? /* @__PURE__ */ t(_, { state: a, manager: b }) : null;
171
- }, _ = ({ state: y, manager: n }) => {
172
- const {
173
- fields: h,
174
- values: l,
175
- displayErrors: a,
176
- errorParams: b,
177
- isValid: E,
178
- addressSuggestions: M,
179
- prefilled: F,
180
- hideEmail: v,
181
- fieldsCountry: D,
182
- submitError: I
183
- } = y, { t: r } = L(), C = x(null), P = x(null), g = x(void 0), k = T(C, h.length);
184
- N(() => {
185
- const e = a.postalCode, i = g.current;
186
- if (g.current = e, !e || i === e)
187
- return;
188
- const p = requestAnimationFrame(() => {
189
- const u = P.current;
190
- if (!u) return;
191
- (u.querySelector("#postalCode-error") ?? u).scrollIntoView({
192
- behavior: "smooth",
193
- block: "nearest"
194
- });
195
- });
196
- return () => cancelAnimationFrame(p);
197
- }, [a.postalCode]);
198
- let A;
199
- return /* @__PURE__ */ t(W, { className: `IncodeEkycPage${k ? " IncodeEkycPageScrollable" : ""}`, title: r("verification.title"), children: [
200
- /* @__PURE__ */ t("div", { ref: C, className: "IncodeEkycForm", children: h.map((e) => {
201
- if (e.name === "email" && v) return null;
202
- let i = null;
203
- e.section && e.section !== A && (A = e.section, i = /* @__PURE__ */ t("h3", { className: "IncodeEkycSectionHeader", children: r({
204
- address: "verification.labels.addressDetailsSection",
205
- driverLicense: "verification.labels.dlDetailsSection"
206
- }[e.section] ?? e.section) }));
207
- const p = e.readonly || F[e.name], u = l[e.name] ?? "", c = a[e.name];
208
- if (e.name === "street" && e.section === "address")
209
- return /* @__PURE__ */ t("div", { children: [
210
- i,
211
- /* @__PURE__ */ t(
212
- Y,
213
- {
214
- label: e.label,
215
- value: u,
216
- error: c,
217
- suggestions: M,
218
- readonly: p,
219
- onChange: (s) => n.setField("street", s),
220
- onSearch: (s) => n.searchAddress(s),
221
- onSelect: (s) => n.selectAddress(s)
222
- }
223
- )
224
- ] }, e.name);
225
- if (e.type === "dropdown") {
226
- const s = r(e.label);
227
- return /* @__PURE__ */ t("div", { children: [
228
- i,
229
- /* @__PURE__ */ t(
230
- G,
231
- {
232
- id: `ekyc-${e.name}`,
233
- label: s,
234
- placeholder: e.placeholder ? r(e.placeholder) : void 0,
235
- value: u,
236
- options: (e.options ?? []).map((m) => ({
237
- ...m,
238
- label: r(m.label)
239
- })),
240
- error: c ? r(c) : void 0,
241
- disabled: p,
242
- searchable: !0,
243
- onChange: (m) => n.setField(e.name, m),
244
- "data-testid": `ekyc-field-${e.name}`
245
- }
246
- )
247
- ] }, e.name);
248
- }
249
- if (e.type === "date") {
250
- const s = r(e.label);
251
- return /* @__PURE__ */ t("div", { children: [
252
- i,
253
- /* @__PURE__ */ t(
254
- Q,
255
- {
256
- id: `ekyc-${e.name}`,
257
- label: s,
258
- value: u,
259
- error: c ? r(c) : void 0,
260
- disabled: p,
261
- onInput: (m) => {
262
- const f = m.target;
263
- n.setField(e.name, f.value);
264
- },
265
- "data-testid": `ekyc-field-${e.name}`
266
- }
267
- )
268
- ] }, e.name);
269
- }
270
- if (e.type === "phone") {
271
- const s = r(e.label);
272
- return /* @__PURE__ */ t("div", { children: [
273
- i,
274
- /* @__PURE__ */ t(
275
- J,
276
- {
277
- id: `ekyc-${e.name}`,
278
- label: s,
279
- countryCode: D,
280
- value: u,
281
- placeholder: e.placeholder,
282
- error: c ? r(c) : void 0,
283
- disabled: p,
284
- disableCountrySelector: e.disableCountrySelector,
285
- required: e.required,
286
- onChange: (m) => n.setField(e.name, m),
287
- "data-testid": `ekyc-field-${e.name}`
288
- }
289
- )
290
- ] }, e.name);
291
- }
292
- return e.type === "radio" ? /* @__PURE__ */ t("div", { children: [
293
- i,
294
- /* @__PURE__ */ t("div", { className: "IncodeEkycRadioGroup", children: [
295
- /* @__PURE__ */ t("label", { className: "IncodeEkycRadioLabel", children: r(e.label) }),
296
- /* @__PURE__ */ t("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((s) => /* @__PURE__ */ t(
297
- "label",
298
- {
299
- className: "IncodeEkycRadioOption",
300
- children: [
301
- /* @__PURE__ */ t(
302
- "input",
303
- {
304
- type: "radio",
305
- name: e.name,
306
- checked: u === s.value,
307
- value: s.value,
308
- onChange: () => n.setField(e.name, s.value),
309
- disabled: p
310
- }
311
- ),
312
- /* @__PURE__ */ t("span", { children: r(s.label) })
313
- ]
314
- },
315
- s.value
316
- )) }),
317
- c && /* @__PURE__ */ t("span", { className: "IncodeEkycFieldError", children: r(c) })
318
- ] })
319
- ] }, e.name) : /* @__PURE__ */ t(
320
- "div",
321
- {
322
- ref: e.name === "postalCode" ? P : void 0,
323
- children: [
324
- i,
325
- /* @__PURE__ */ t(
326
- U,
327
- {
328
- name: e.name,
329
- label: e.label,
330
- value: u,
331
- error: c,
332
- errorParams: b[e.name],
333
- type: e.type,
334
- placeholder: e.placeholder,
335
- placeholderParams: e.placeholderParams,
336
- required: e.required,
337
- optional: e.optional,
338
- readonly: p,
339
- maxLength: e.maxLength,
340
- onChange: (s, m) => n.setField(s, m)
341
- }
342
- )
343
- ]
344
- },
345
- e.name
346
- );
347
- }) }),
348
- /* @__PURE__ */ t("div", { className: "IncodeEkycFooter", children: [
349
- /* @__PURE__ */ t(V, { size: 32 }),
350
- I && /* @__PURE__ */ t("p", { className: "IncodeEkycSubmitError", children: r(I) }),
351
- /* @__PURE__ */ t(
352
- K,
353
- {
354
- onClick: () => n.submit(),
355
- disabled: !E,
356
- "data-testid": "ekyc-submit",
357
- children: r("common.continue")
358
- }
359
- )
360
- ] })
361
- ] });
362
- }, ee = ({
363
- config: y,
364
- onFinish: n,
365
- onError: h
366
- }) => /* @__PURE__ */ t(q, { children: y ? /* @__PURE__ */ t(Z, { config: y, onFinish: n, onError: h }) : null });
367
- j(ee, "incode-ekyc");
368
- export {
369
- ee as EkycModule
370
- };
@@ -1,94 +0,0 @@
1
- import { b as v, u as i, B as I } from "./button-Ca1tRSTI.js";
2
- import "./uiConfig-Z6RT23Sl.js";
3
- import "./vendor-preact-BXf0bkEs.js";
4
- import { E as g } from "./errorIcon-BL647nVh.js";
5
- import { S as F } from "./successIcon-BybULRRU.js";
6
- import { P as u } from "./page-BVHG3h0V.js";
7
- import { S as y } from "./spinner-Cx3FPUCD.js";
8
- import { I as k } from "./dropdownComposed-DBm7cotT.js";
9
- const E = ({
10
- status: e,
11
- submittingTitle: l,
12
- successTitle: d,
13
- failureTitle: r,
14
- onRetry: n,
15
- onSkip: s,
16
- retryLabel: o,
17
- skipLabel: m
18
- }) => {
19
- const { t } = v();
20
- if (e === "submitting") {
21
- const c = l ?? t("verification.processing");
22
- return /* @__PURE__ */ i(u, { className: "IncodeVerificationResult", children: /* @__PURE__ */ i("div", { className: "IncodeVerificationResult__center", children: [
23
- /* @__PURE__ */ i(y, {}),
24
- /* @__PURE__ */ i("p", { className: "IncodeVerificationResult__title", children: c })
25
- ] }) });
26
- }
27
- if (e === "success") {
28
- const c = d ?? t("verification.successTitle");
29
- return /* @__PURE__ */ i(u, { className: "IncodeVerificationResult", children: /* @__PURE__ */ i("div", { className: "IncodeVerificationResult__center", children: [
30
- /* @__PURE__ */ i(F, { size: 64 }),
31
- /* @__PURE__ */ i("p", { className: "IncodeVerificationResult__title", children: c })
32
- ] }) });
33
- }
34
- const f = r ?? t("verification.failureTitle");
35
- return /* @__PURE__ */ i(u, { className: "IncodeVerificationResult", children: [
36
- /* @__PURE__ */ i("div", { className: "IncodeVerificationResult__center", children: [
37
- /* @__PURE__ */ i(g, { size: 64 }),
38
- /* @__PURE__ */ i("p", { className: "IncodeVerificationResult__title", children: f })
39
- ] }),
40
- /* @__PURE__ */ i("div", { className: "IncodeVerificationResult__actions", children: [
41
- n && /* @__PURE__ */ i(I, { onClick: n, "data-testid": "verification-retry", children: o ?? t("common.tryAgain") }),
42
- s && /* @__PURE__ */ i(
43
- I,
44
- {
45
- onClick: s,
46
- variant: "secondary",
47
- "data-testid": "verification-skip",
48
- children: m ?? t("common.skip")
49
- }
50
- )
51
- ] })
52
- ] });
53
- }, L = ({
54
- name: e,
55
- label: l,
56
- value: d = "",
57
- error: r,
58
- errorParams: n,
59
- type: s = "text",
60
- placeholder: o,
61
- placeholderParams: m,
62
- required: t,
63
- readonly: f,
64
- maxLength: c,
65
- disabled: _,
66
- optional: h,
67
- onChange: V
68
- }) => {
69
- const { t: a } = v(), p = a(l), N = h ? `${p} ${a("verification.labels.optional")}` : p;
70
- return /* @__PURE__ */ i("div", { className: "IncodeFormField", children: /* @__PURE__ */ i(
71
- k,
72
- {
73
- id: e,
74
- label: N,
75
- name: e,
76
- type: s,
77
- value: d,
78
- placeholder: o ? a(o, m) : void 0,
79
- readOnly: f,
80
- disabled: _,
81
- maxLength: c,
82
- error: r ? a(r, n) : void 0,
83
- onInput: (R) => {
84
- const b = R.target;
85
- V(e, b.value);
86
- },
87
- "data-testid": `form-field-${e}`
88
- }
89
- ) });
90
- };
91
- export {
92
- L as F,
93
- E as V
94
- };
@@ -1,107 +0,0 @@
1
- import { u as $ } from "./button-Ca1tRSTI.js";
2
- import { d as g, A as q, T as I, y as B, q as u } from "./vendor-preact-BXf0bkEs.js";
3
- import { c as E, g as l } from "./countries-C9bhJe4u.js";
4
- import { I as F, D as M } from "./dropdownComposed-DBm7cotT.js";
5
- import { p as P, A as b } from "./AsYouType-CpH-Rmtj.js";
6
- const H = ({
7
- id: p,
8
- label: w,
9
- countryCode: S = "US",
10
- value: r,
11
- placeholder: A = "(123) 123-6789",
12
- error: m,
13
- disabled: f = !1,
14
- disableCountrySelector: D = !1,
15
- required: N,
16
- onChange: d,
17
- "data-testid": T
18
- }) => {
19
- const [s, h] = g(S), [a, i] = g(""), y = q(!1), j = I(
20
- () => E.map((t) => ({
21
- value: t.code,
22
- label: `${t.emoji} ${t.callingCode} ${t.name}`
23
- })),
24
- []
25
- ), o = I(
26
- () => l(s) ?? l("US"),
27
- [s]
28
- );
29
- B(() => {
30
- if (y.current || !r || !o) return;
31
- y.current = !0;
32
- const t = r.startsWith("+") ? r : `+${r}`, e = P(t);
33
- if (e?.isValid() && e.country) {
34
- e.country !== s && h(e.country);
35
- const n = new b(e.country);
36
- i(n.input(e.nationalNumber));
37
- }
38
- }, [r, o, s]);
39
- const c = u(
40
- (t, e) => {
41
- const n = `${e.callingCode}${t.replace(/\D/g, "")}`;
42
- try {
43
- const C = P(n, e.code);
44
- d?.(n, C?.isValid() ?? !1);
45
- } catch {
46
- d?.(n, !1);
47
- }
48
- },
49
- [d]
50
- ), v = u(
51
- (t) => {
52
- h(t);
53
- const e = l(t);
54
- e && a && c(a, e);
55
- },
56
- [a, c]
57
- ), x = u(
58
- (t) => {
59
- const e = t.target.value;
60
- if (!o) {
61
- i(e);
62
- return;
63
- }
64
- const n = `${o.callingCode}${e}`, V = new b(o.code).input(n).replace(o.callingCode, "").trimStart();
65
- i(V), c(e, o);
66
- },
67
- [o, c]
68
- ), L = `${p}-country`, U = `${p}-phone`;
69
- return /* @__PURE__ */ $(
70
- M,
71
- {
72
- id: L,
73
- label: w,
74
- options: j,
75
- value: s,
76
- onChange: v,
77
- error: m,
78
- disabled: f || D,
79
- required: N,
80
- searchable: !0,
81
- searchPlaceholder: "Search countries...",
82
- renderSelectedLabel: (t) => {
83
- const e = l(t.value);
84
- return e ? `${e.emoji} ${e.callingCode}` : t.label;
85
- },
86
- class: "IncodePhoneInputComposed",
87
- siblingElement: /* @__PURE__ */ $(
88
- F,
89
- {
90
- id: U,
91
- type: "tel",
92
- value: a,
93
- onInput: x,
94
- placeholder: A,
95
- error: m,
96
- disabled: f,
97
- suppressMessages: !0,
98
- "aria-label": "Phone number",
99
- "data-testid": T
100
- }
101
- )
102
- }
103
- );
104
- };
105
- export {
106
- H as P
107
- };
@@ -1,15 +0,0 @@
1
- import { d as n, y as i } from "./vendor-preact-BXf0bkEs.js";
2
- function a(r, c) {
3
- const [s, l] = n(!1);
4
- return i(() => {
5
- const e = r.current;
6
- if (!e) return;
7
- const o = () => l(e.scrollHeight > e.clientHeight);
8
- o();
9
- const t = new ResizeObserver(o);
10
- return t.observe(e), () => t.disconnect();
11
- }, [c, r]), s;
12
- }
13
- export {
14
- a as u
15
- };