@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.
@@ -0,0 +1,245 @@
1
+ import { u as r, I as D, b as P, a as M, S as V, B as w } from "./button-Ca1tRSTI.js";
2
+ import { createEkycManager as x } from "@incodetech/core/ekyc";
3
+ import { y as E, A as k } from "./vendor-preact-BXf0bkEs.js";
4
+ import "./uiConfig-Z6RT23Sl.js";
5
+ import "@incodetech/core";
6
+ import { u as T, A as B } from "./addressAutocomplete-CL7IcYGQ.js";
7
+ import { V as b, t as H, F as K } from "./formField-B2HDj15w.js";
8
+ import { D as O } from "./dateInputComposed-CvFmQpJ0.js";
9
+ import { D as z } from "./dropdownComposed-DBm7cotT.js";
10
+ import { P as G } from "./page-BVHG3h0V.js";
11
+ import { r as j } from "./incodeModule-aE-LkKwM.js";
12
+ import { P as J } from "./phoneInputComposed-D0oBe-el.js";
13
+ const Q = ({ config: p, onFinish: s, onError: m }) => {
14
+ const { t: h } = P(), [t, i] = M(() => x({ config: p }));
15
+ E(() => {
16
+ (t.status === "finished" || t.status === "closed") && s?.();
17
+ }, [t.status, s]);
18
+ const y = t.status === "error" ? t.errorMessage : void 0;
19
+ return E(() => {
20
+ t.status === "error" && m?.(y);
21
+ }, [t.status, m, y]), t.status === "finished" || t.status === "closed" ? null : t.status === "loading" ? /* @__PURE__ */ r(
22
+ b,
23
+ {
24
+ status: "submitting",
25
+ submittingTitle: h("common.loading")
26
+ }
27
+ ) : t.status === "submitting" ? /* @__PURE__ */ r(b, { status: "submitting" }) : t.status === "success" ? /* @__PURE__ */ r(b, { status: "success" }) : t.status === "error" ? /* @__PURE__ */ r(
28
+ b,
29
+ {
30
+ status: "failure",
31
+ onRetry: () => i.retry(),
32
+ onSkip: () => i.skip()
33
+ }
34
+ ) : t.status === "misconfigured" ? /* @__PURE__ */ r(
35
+ b,
36
+ {
37
+ status: "failure",
38
+ failureTitle: h("verification.noFormFields"),
39
+ onSkip: () => i.close(),
40
+ skipLabel: h("common.close")
41
+ }
42
+ ) : t.status === "form" ? /* @__PURE__ */ r(U, { state: t, manager: i }) : null;
43
+ }, U = ({ state: p, manager: s }) => {
44
+ const {
45
+ fields: m,
46
+ values: h,
47
+ displayErrors: t,
48
+ errorParams: i,
49
+ isValid: y,
50
+ addressSuggestions: N,
51
+ prefilled: R,
52
+ hideEmail: A,
53
+ fieldsCountry: L,
54
+ submitError: C
55
+ } = p, { t: o } = P(), g = k(null), F = k(null), I = k(void 0), $ = T(g, m.length);
56
+ E(() => {
57
+ const e = t.postalCode, n = I.current;
58
+ if (I.current = e, !e || n === e)
59
+ return;
60
+ const u = requestAnimationFrame(() => {
61
+ const c = F.current;
62
+ if (!c) return;
63
+ (c.querySelector("#postalCode-error") ?? c).scrollIntoView({
64
+ behavior: "smooth",
65
+ block: "nearest"
66
+ });
67
+ });
68
+ return () => cancelAnimationFrame(u);
69
+ }, [t.postalCode]);
70
+ const v = (e, n) => H(o, n, i[e]);
71
+ let S;
72
+ return /* @__PURE__ */ r(G, { className: `IncodeEkycPage${$ ? " IncodeEkycPageScrollable" : ""}`, title: o("verification.title"), children: [
73
+ /* @__PURE__ */ r("div", { ref: g, className: "IncodeEkycForm", children: m.map((e) => {
74
+ if (e.name === "email" && A) return null;
75
+ let n = null;
76
+ e.section && e.section !== S && (S = e.section, n = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: o({
77
+ address: "verification.labels.addressDetailsSection",
78
+ driverLicense: "verification.labels.dlDetailsSection"
79
+ }[e.section] ?? e.section) }));
80
+ const u = e.readonly || R[e.name], c = h[e.name] ?? "", d = t[e.name];
81
+ if (e.name === "street" && e.section === "address")
82
+ return /* @__PURE__ */ r("div", { children: [
83
+ n,
84
+ /* @__PURE__ */ r(
85
+ B,
86
+ {
87
+ label: e.label,
88
+ value: c,
89
+ error: d,
90
+ errorParams: i[e.name],
91
+ suggestions: N,
92
+ readonly: u,
93
+ optional: !e.required,
94
+ onChange: (a) => s.setField("street", a),
95
+ onSearch: (a) => s.searchAddress(a),
96
+ onSelect: (a) => s.selectAddress(a)
97
+ }
98
+ )
99
+ ] }, e.name);
100
+ if (e.type === "dropdown") {
101
+ const a = o(e.label);
102
+ return /* @__PURE__ */ r("div", { children: [
103
+ n,
104
+ /* @__PURE__ */ r(
105
+ z,
106
+ {
107
+ id: `ekyc-${e.name}`,
108
+ label: a,
109
+ placeholder: e.placeholder ? o(e.placeholder) : void 0,
110
+ value: c,
111
+ options: (e.options ?? []).map((l) => ({
112
+ ...l,
113
+ label: o(l.label)
114
+ })),
115
+ error: v(e.name, d),
116
+ disabled: u,
117
+ searchable: !0,
118
+ onChange: (l) => s.setField(e.name, l),
119
+ "data-testid": `ekyc-field-${e.name}`
120
+ }
121
+ )
122
+ ] }, e.name);
123
+ }
124
+ if (e.type === "date") {
125
+ const a = o(e.label);
126
+ return /* @__PURE__ */ r("div", { children: [
127
+ n,
128
+ /* @__PURE__ */ r(
129
+ O,
130
+ {
131
+ id: `ekyc-${e.name}`,
132
+ label: a,
133
+ value: c,
134
+ error: v(e.name, d),
135
+ disabled: u,
136
+ onInput: (l) => {
137
+ const q = l.target;
138
+ s.setField(e.name, q.value);
139
+ },
140
+ "data-testid": `ekyc-field-${e.name}`
141
+ }
142
+ )
143
+ ] }, e.name);
144
+ }
145
+ if (e.type === "phone") {
146
+ const a = o(e.label);
147
+ return /* @__PURE__ */ r("div", { children: [
148
+ n,
149
+ /* @__PURE__ */ r(
150
+ J,
151
+ {
152
+ id: `ekyc-${e.name}`,
153
+ label: a,
154
+ countryCode: L,
155
+ value: c,
156
+ placeholder: e.placeholder,
157
+ error: v(e.name, d),
158
+ disabled: u,
159
+ disableCountrySelector: e.disableCountrySelector,
160
+ required: e.required,
161
+ onChange: (l) => s.setField(e.name, l),
162
+ "data-testid": `ekyc-field-${e.name}`
163
+ }
164
+ )
165
+ ] }, e.name);
166
+ }
167
+ return e.type === "radio" ? /* @__PURE__ */ r("div", { children: [
168
+ n,
169
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioGroup", children: [
170
+ /* @__PURE__ */ r("label", { className: "IncodeEkycRadioLabel", children: o(e.label) }),
171
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((a) => /* @__PURE__ */ r(
172
+ "label",
173
+ {
174
+ className: "IncodeEkycRadioOption",
175
+ children: [
176
+ /* @__PURE__ */ r(
177
+ "input",
178
+ {
179
+ type: "radio",
180
+ name: e.name,
181
+ checked: c === a.value,
182
+ value: a.value,
183
+ onChange: () => s.setField(e.name, a.value),
184
+ disabled: u
185
+ }
186
+ ),
187
+ /* @__PURE__ */ r("span", { children: o(a.label) })
188
+ ]
189
+ },
190
+ a.value
191
+ )) }),
192
+ d && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: v(e.name, d) })
193
+ ] })
194
+ ] }, e.name) : /* @__PURE__ */ r(
195
+ "div",
196
+ {
197
+ ref: e.name === "postalCode" ? F : void 0,
198
+ children: [
199
+ n,
200
+ /* @__PURE__ */ r(
201
+ K,
202
+ {
203
+ name: e.name,
204
+ label: e.label,
205
+ value: c,
206
+ error: d,
207
+ errorParams: i[e.name],
208
+ type: e.type,
209
+ placeholder: e.placeholder,
210
+ placeholderParams: e.placeholderParams,
211
+ required: e.required,
212
+ optional: e.optional,
213
+ readonly: u,
214
+ maxLength: e.maxLength,
215
+ onChange: (a, l) => s.setField(a, l)
216
+ }
217
+ )
218
+ ]
219
+ },
220
+ e.name
221
+ );
222
+ }) }),
223
+ /* @__PURE__ */ r("div", { className: "IncodeEkycFooter", children: [
224
+ /* @__PURE__ */ r(V, { size: 32 }),
225
+ C && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: o(C) }),
226
+ /* @__PURE__ */ r(
227
+ w,
228
+ {
229
+ onClick: () => s.submit(),
230
+ disabled: !y,
231
+ "data-testid": "ekyc-submit",
232
+ children: o("common.continue")
233
+ }
234
+ )
235
+ ] })
236
+ ] });
237
+ }, W = ({
238
+ config: p,
239
+ onFinish: s,
240
+ onError: m
241
+ }) => /* @__PURE__ */ r(D, { children: p ? /* @__PURE__ */ r(Q, { config: p, onFinish: s, onError: m }) : null });
242
+ j(W, "incode-ekyc");
243
+ export {
244
+ W as EkycModule
245
+ };
@@ -6,13 +6,13 @@ import { C as ie, F as le, M as de } from "./fileIcon-DOyMcRWU.js";
6
6
  import { S as ue, T as he, a as Ce, b as xe, c as Ie, d as me } from "./spinner-Cx3FPUCD.js";
7
7
  import { P as be } from "./processing-CDgOueI3.js";
8
8
  import { E as ve } from "./errorContent-yUAdbZ5o.js";
9
- import { F as ye, V as we } from "./formField-C91ckby4.js";
9
+ import { F as ye, V as we } from "./formField-B2HDj15w.js";
10
10
  import { a as Be, C as Le, c as Me, b as Se, e as Fe, d as De, H as He, L as Pe, P as Ve } from "./captureFooter-X2qN1773.js";
11
11
  import { D as Oe, a as Re, I as We, S as je } from "./dropdownComposed-DBm7cotT.js";
12
12
  import { O as $e } from "./otpInput-cazUY73p.js";
13
13
  import { D as E, d as O, A as R, y as W, q as j } from "./vendor-preact-BXf0bkEs.js";
14
14
  import { E as U } from "./errorIcon-BL647nVh.js";
15
- import { P as Ae } from "./phoneInputComposed-B1gXoSzr.js";
15
+ import { P as Ae } from "./phoneInputComposed-D0oBe-el.js";
16
16
  import { C as ze, D as Ge } from "./dateInputComposed-CvFmQpJ0.js";
17
17
  import { B as Ke, L as Qe, P as Xe } from "./permissions-DwF2Ez1N.js";
18
18
  import { C as _e } from "./chevronDown-BUaOuf9J.js";