@incodetech/web 0.0.0-dev-20260317-6ffceac → 0.0.0-dev-20260317-737b25e

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,282 @@
1
+ import { u as r, I as O, b as q, a as Y, B as L } from "./button-Ca1tRSTI.js";
2
+ import { computeEkycDisplayErrors as G, createEkycManager as j } from "@incodetech/core/ekyc";
3
+ import { y as $, A as F, d as z, q as v, T as J } from "./vendor-preact-BXf0bkEs.js";
4
+ import "./uiConfig-Z6RT23Sl.js";
5
+ import "@incodetech/core";
6
+ import { u as Q, A as U } from "./addressAutocomplete-DetZGxBZ.js";
7
+ import { V as k, t as W, F as X } from "./formField-FeX9N4c8.js";
8
+ import { D as Z } from "./dateInputComposed-CvFmQpJ0.js";
9
+ import { D as f } from "./dropdownComposed-B5ZuQS8C.js";
10
+ import { P as ee } from "./page-BVHG3h0V.js";
11
+ import { r as re } from "./incodeModule-aE-LkKwM.js";
12
+ import { P as te } from "./phoneInputComposed-CwtJKvGh.js";
13
+ const oe = ({ config: p, onFinish: n }) => {
14
+ const { t: l } = q(), [a, m] = Y(() => j({ config: p }));
15
+ return $(() => {
16
+ (a.status === "finished" || a.status === "closed") && n?.();
17
+ }, [a.status, n]), a.status === "finished" || a.status === "closed" ? null : a.status === "loading" ? /* @__PURE__ */ r(
18
+ k,
19
+ {
20
+ status: "submitting",
21
+ submittingTitle: l("common.loading")
22
+ }
23
+ ) : a.status === "submitting" ? /* @__PURE__ */ r(k, { status: "submitting" }) : a.status === "success" ? /* @__PURE__ */ r(k, { status: "success" }) : a.status === "error" ? /* @__PURE__ */ r(
24
+ k,
25
+ {
26
+ status: "failure",
27
+ onRetry: () => m.retry(),
28
+ onSkip: () => m.skip()
29
+ }
30
+ ) : a.status === "misconfigured" ? /* @__PURE__ */ r(
31
+ k,
32
+ {
33
+ status: "failure",
34
+ failureTitle: l("verification.noFormFields"),
35
+ onSkip: () => m.close(),
36
+ skipLabel: l("common.close")
37
+ }
38
+ ) : a.status === "form" ? /* @__PURE__ */ r(se, { state: a, manager: m }) : null;
39
+ }, ae = [
40
+ "street",
41
+ "city",
42
+ "state",
43
+ "postalCode",
44
+ "houseNo"
45
+ ], se = ({ state: p, manager: n }) => {
46
+ const {
47
+ fields: l,
48
+ values: a,
49
+ errors: m,
50
+ isValid: T,
51
+ addressSuggestions: V,
52
+ prefilled: w,
53
+ hideEmail: K,
54
+ fieldsCountry: C,
55
+ submitError: g,
56
+ submitAttempted: P
57
+ } = p, { t: s } = q(), N = F(null), A = F(null), R = F(void 0), M = Q(N, l.length), [D, x] = z({}), h = v((e) => {
58
+ x((t) => t[e] ? t : { ...t, [e]: !0 });
59
+ }, []), { displayErrors: S, errorParams: I } = J(
60
+ () => G(
61
+ m,
62
+ D,
63
+ P,
64
+ C,
65
+ l
66
+ ),
67
+ [m, D, P, C, l]
68
+ ), y = v(
69
+ (e) => h(e),
70
+ [h]
71
+ ), b = v(
72
+ (e, t) => {
73
+ h(e), n.setField(e, t);
74
+ },
75
+ [n, h]
76
+ ), _ = v(
77
+ (e) => {
78
+ for (const t of ae) h(t);
79
+ n.selectAddress(e);
80
+ },
81
+ [n, h]
82
+ );
83
+ $(() => {
84
+ const e = S.postalCode, t = R.current;
85
+ if (R.current = e, !e || t === e)
86
+ return;
87
+ const i = requestAnimationFrame(() => {
88
+ const c = A.current;
89
+ if (!c) return;
90
+ (c.querySelector("#postalCode-error") ?? c).scrollIntoView({
91
+ behavior: "smooth",
92
+ block: "nearest"
93
+ });
94
+ });
95
+ return () => cancelAnimationFrame(i);
96
+ }, [S.postalCode]);
97
+ const E = (e, t) => W(s, t, I[e]);
98
+ let B;
99
+ return /* @__PURE__ */ r(ee, { className: `IncodeEkycPage${M ? " IncodeEkycPageScrollable" : ""}`, title: s("verification.title"), children: [
100
+ /* @__PURE__ */ r("div", { ref: N, className: "IncodeEkycForm", children: l.map((e) => {
101
+ if (e.name === "email" && K) return null;
102
+ let t = null;
103
+ e.section && e.section !== B && (B = e.section, t = /* @__PURE__ */ r("h3", { className: "IncodeEkycSectionHeader", children: s({
104
+ address: "verification.labels.addressDetailsSection",
105
+ driverLicense: "verification.labels.dlDetailsSection"
106
+ }[e.section] ?? e.section) }));
107
+ const i = e.readonly || w[e.name], c = a[e.name] ?? "", u = S[e.name];
108
+ if (e.name === "street" && e.section === "address")
109
+ return /* @__PURE__ */ r("div", { children: [
110
+ t,
111
+ /* @__PURE__ */ r(
112
+ U,
113
+ {
114
+ label: e.label,
115
+ value: c,
116
+ error: u,
117
+ errorParams: I[e.name],
118
+ suggestions: V,
119
+ readonly: i,
120
+ optional: !e.required,
121
+ onChange: (o) => b("street", o),
122
+ onSearch: (o) => n.searchAddress(o),
123
+ onSelect: _,
124
+ onBlur: () => y("street")
125
+ }
126
+ )
127
+ ] }, e.name);
128
+ if (e.type === "dropdown") {
129
+ const o = s(e.label);
130
+ return /* @__PURE__ */ r("div", { children: [
131
+ t,
132
+ /* @__PURE__ */ r(
133
+ f,
134
+ {
135
+ id: `ekyc-${e.name}`,
136
+ label: o,
137
+ placeholder: e.placeholder ? s(e.placeholder) : void 0,
138
+ value: c,
139
+ options: (e.options ?? []).map((d) => ({
140
+ ...d,
141
+ label: s(d.label)
142
+ })),
143
+ error: E(e.name, u),
144
+ disabled: i,
145
+ searchable: !0,
146
+ onChange: (d) => b(e.name, d),
147
+ onBlur: () => y(e.name),
148
+ "data-testid": `ekyc-field-${e.name}`
149
+ }
150
+ )
151
+ ] }, e.name);
152
+ }
153
+ if (e.type === "date") {
154
+ const o = s(e.label);
155
+ return /* @__PURE__ */ r("div", { children: [
156
+ t,
157
+ /* @__PURE__ */ r(
158
+ Z,
159
+ {
160
+ id: `ekyc-${e.name}`,
161
+ label: o,
162
+ value: c,
163
+ error: E(e.name, u),
164
+ disabled: i,
165
+ onInput: (d) => {
166
+ const H = d.target;
167
+ b(e.name, H.value);
168
+ },
169
+ onBlur: () => y(e.name),
170
+ "data-testid": `ekyc-field-${e.name}`
171
+ }
172
+ )
173
+ ] }, e.name);
174
+ }
175
+ if (e.type === "phone") {
176
+ const o = s(e.label);
177
+ return /* @__PURE__ */ r("div", { children: [
178
+ t,
179
+ /* @__PURE__ */ r(
180
+ te,
181
+ {
182
+ id: `ekyc-${e.name}`,
183
+ label: o,
184
+ countryCode: C,
185
+ value: c,
186
+ placeholder: e.placeholder,
187
+ error: E(e.name, u),
188
+ disabled: i,
189
+ disableCountrySelector: e.disableCountrySelector,
190
+ required: e.required,
191
+ onChange: (d) => b(e.name, d),
192
+ onBlur: () => y(e.name),
193
+ "data-testid": `ekyc-field-${e.name}`
194
+ }
195
+ )
196
+ ] }, e.name);
197
+ }
198
+ return e.type === "radio" ? /* @__PURE__ */ r("div", { children: [
199
+ t,
200
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioGroup", children: [
201
+ /* @__PURE__ */ r("label", { className: "IncodeEkycRadioLabel", children: s(e.label) }),
202
+ /* @__PURE__ */ r("div", { className: "IncodeEkycRadioOptions", children: e.options?.map((o) => /* @__PURE__ */ r(
203
+ "label",
204
+ {
205
+ className: "IncodeEkycRadioOption",
206
+ children: [
207
+ /* @__PURE__ */ r(
208
+ "input",
209
+ {
210
+ type: "radio",
211
+ name: e.name,
212
+ checked: c === o.value,
213
+ value: o.value,
214
+ onChange: () => b(e.name, o.value),
215
+ onBlur: () => y(e.name),
216
+ disabled: i
217
+ }
218
+ ),
219
+ /* @__PURE__ */ r("span", { children: s(o.label) })
220
+ ]
221
+ },
222
+ o.value
223
+ )) }),
224
+ u && /* @__PURE__ */ r("span", { className: "IncodeEkycFieldError", children: E(e.name, u) })
225
+ ] })
226
+ ] }, e.name) : /* @__PURE__ */ r(
227
+ "div",
228
+ {
229
+ ref: e.name === "postalCode" ? A : void 0,
230
+ children: [
231
+ t,
232
+ /* @__PURE__ */ r(
233
+ X,
234
+ {
235
+ name: e.name,
236
+ label: e.label,
237
+ value: c,
238
+ error: u,
239
+ errorParams: I[e.name],
240
+ type: e.type,
241
+ placeholder: e.placeholder,
242
+ placeholderParams: e.placeholderParams,
243
+ required: e.required,
244
+ optional: e.optional,
245
+ readonly: i,
246
+ maxLength: e.maxLength,
247
+ onChange: b,
248
+ onBlur: y
249
+ }
250
+ )
251
+ ]
252
+ },
253
+ e.name
254
+ );
255
+ }) }),
256
+ /* @__PURE__ */ r("div", { className: "IncodeEkycFooter", children: [
257
+ g && /* @__PURE__ */ r("p", { className: "IncodeEkycSubmitError", children: s(g) }),
258
+ /* @__PURE__ */ r(
259
+ L,
260
+ {
261
+ onClick: () => n.submit(),
262
+ disabled: !T,
263
+ "data-testid": "ekyc-submit",
264
+ children: s("common.continue")
265
+ }
266
+ ),
267
+ g === "verification.errors.countryNotSupported" && /* @__PURE__ */ r(
268
+ L,
269
+ {
270
+ variant: "link",
271
+ onClick: () => n.skip(),
272
+ "data-testid": "ekyc-skip",
273
+ children: s("verification.labels.skip")
274
+ }
275
+ )
276
+ ] })
277
+ ] });
278
+ }, ne = ({ config: p, onFinish: n }) => /* @__PURE__ */ r(O, { children: p ? /* @__PURE__ */ r(oe, { config: p, onFinish: n }) : null });
279
+ re(ne, "incode-ekyc");
280
+ export {
281
+ ne as EkycModule
282
+ };
@@ -6,7 +6,7 @@ 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 me, d as Ie } 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-UWsp-7Fj.js";
9
+ import { F as ye, V as we } from "./formField-FeX9N4c8.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 { a as Oe, I as Re } from "./inputComposed-BHi-MSpP.js";
12
12
  import { O as je } from "./otpInput-DdkvlvCS.js";
@@ -2000,8 +2000,8 @@ const Pe = () => import("../id/id.es.js").then((e) => e.Id), ke = {
2000
2000
  (e) => e.GovernmentValidation
2001
2001
  ),
2002
2002
  GEOLOCATION: () => import("../geolocation/geolocation.es.js").then((e) => e.Geolocation),
2003
- EXTERNAL_VERIFICATION: () => import("../ekycModule-CWu3ZTNN.js").then((e) => e.EkycModule),
2004
- EKYB: () => import("../ekybModule-BKSouMz6.js").then((e) => e.EkybModule),
2003
+ EXTERNAL_VERIFICATION: () => import("../ekycModule-CFcYtlo_.js").then((e) => e.EkycModule),
2004
+ EKYB: () => import("../ekybModule-FeVB4y3_.js").then((e) => e.EkybModule),
2005
2005
  DOCUMENT_CAPTURE: () => import("../documentCapture-PdKA2frR.js").then(
2006
2006
  (e) => e.DocumentCapture
2007
2007
  ),
@@ -5408,7 +5408,7 @@
5408
5408
  display: flex;
5409
5409
  }
5410
5410
 
5411
- .IncodeEkycForm .IncodeInputComposed, .IncodeEkycForm .IncodeDropdownComposed, .IncodeEkycForm .IncodeDateInputComposed, .IncodeEkycForm .IncodeAddressAutocomplete {
5411
+ .IncodeEkycForm .IncodeInputComposed, .IncodeEkycForm .IncodeDropdownComposed, .IncodeEkycForm .IncodeDateInputComposed, .IncodeEkycForm .IncodePhoneInputComposed, .IncodeEkycForm .IncodeAddressAutocomplete {
5412
5412
  margin-inline: auto;
5413
5413
  }
5414
5414
 
@@ -5416,6 +5416,14 @@
5416
5416
  margin-bottom: var(--spacing-0, var(--spacing-none, 0px));
5417
5417
  }
5418
5418
 
5419
+ .IncodeEkycFooter {
5420
+ margin-top: var(--spacing-24, var(--spacing-24, 24px));
5421
+ align-items: center;
5422
+ gap: var(--spacing-12, var(--spacing-12, 12px));
5423
+ flex-direction: column;
5424
+ display: flex;
5425
+ }
5426
+
5419
5427
  @media (min-width: 768px) {
5420
5428
  .IncodePageContainer.IncodeEkycPage {
5421
5429
  height: 100dvh;
@@ -5438,7 +5446,6 @@
5438
5446
  .IncodeEkycPage .IncodeEkycForm {
5439
5447
  min-height: var(--spacing-0, var(--spacing-none, 0px));
5440
5448
  padding-bottom: var(--spacing-8, var(--spacing-8, 8px));
5441
- flex: 1;
5442
5449
  overflow-y: auto;
5443
5450
  }
5444
5451
 
@@ -5747,6 +5754,10 @@
5747
5754
  margin-inline: auto;
5748
5755
  }
5749
5756
 
5757
+ .IncodeEkybFooter {
5758
+ margin-top: var(--spacing-24, var(--spacing-24, 24px));
5759
+ }
5760
+
5750
5761
  @media (min-width: 768px) {
5751
5762
  .IncodePageContainer.IncodeEkybPage {
5752
5763
  margin-top: var(--spacing-0, var(--spacing-none, 0px));
@@ -5769,7 +5780,6 @@
5769
5780
  .IncodeEkybPage .IncodeEkybForm {
5770
5781
  min-height: var(--spacing-0, var(--spacing-none, 0px));
5771
5782
  padding-bottom: var(--spacing-8, var(--spacing-8, 8px));
5772
- flex: 1;
5773
5783
  overflow-y: auto;
5774
5784
  }
5775
5785
 
@@ -1,12 +1,12 @@
1
- import { b as I, u as e, B as v } from "./button-Ca1tRSTI.js";
1
+ import { b as N, u as e, B as I } from "./button-Ca1tRSTI.js";
2
2
  import "./uiConfig-Z6RT23Sl.js";
3
3
  import "./vendor-preact-BXf0bkEs.js";
4
- import { E as b } from "./errorIcon-BL647nVh.js";
5
- import { S as y } from "./successIcon-BybULRRU.js";
4
+ import { E as y } from "./errorIcon-BL647nVh.js";
5
+ import { S as F } from "./successIcon-BybULRRU.js";
6
6
  import { P as m } from "./page-BVHG3h0V.js";
7
- import { S as F } from "./spinner-Cx3FPUCD.js";
8
- import { I as E } from "./inputComposed-BHi-MSpP.js";
9
- const L = ({
7
+ import { S as E } from "./spinner-Cx3FPUCD.js";
8
+ import { I as S } from "./inputComposed-BHi-MSpP.js";
9
+ const A = ({
10
10
  status: i,
11
11
  submittingTitle: t,
12
12
  successTitle: n,
@@ -16,31 +16,31 @@ const L = ({
16
16
  retryLabel: a,
17
17
  skipLabel: f
18
18
  }) => {
19
- const { t: r } = I();
19
+ const { t: r } = N();
20
20
  if (i === "submitting") {
21
21
  const c = t ?? r("verification.processing");
22
22
  return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
23
- /* @__PURE__ */ e(F, {}),
23
+ /* @__PURE__ */ e(E, {}),
24
24
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
25
25
  ] }) });
26
26
  }
27
27
  if (i === "success") {
28
28
  const c = n ?? r("verification.successTitle");
29
29
  return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
30
- /* @__PURE__ */ e(y, { size: 64 }),
30
+ /* @__PURE__ */ e(F, { size: 64 }),
31
31
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
32
32
  ] }) });
33
33
  }
34
34
  const u = d ?? r("verification.failureTitle");
35
35
  return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: [
36
36
  /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
37
- /* @__PURE__ */ e(b, { size: 64 }),
37
+ /* @__PURE__ */ e(y, { size: 64 }),
38
38
  /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: u })
39
39
  ] }),
40
40
  /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__actions", children: [
41
- o && /* @__PURE__ */ e(v, { onClick: o, "data-testid": "verification-retry", children: a ?? r("common.tryAgain") }),
41
+ o && /* @__PURE__ */ e(I, { onClick: o, "data-testid": "verification-retry", children: a ?? r("common.tryAgain") }),
42
42
  s && /* @__PURE__ */ e(
43
- v,
43
+ I,
44
44
  {
45
45
  onClick: s,
46
46
  variant: "secondary",
@@ -51,14 +51,14 @@ const L = ({
51
51
  ] })
52
52
  ] });
53
53
  };
54
- function S(i, t) {
54
+ function k(i, t) {
55
55
  return t?.fieldName && typeof t.fieldName == "string" ? { ...t, fieldName: i(String(t.fieldName)) } : t;
56
56
  }
57
- function k(i, t, n) {
57
+ function C(i, t, n) {
58
58
  if (t)
59
- return i(t, S(i, n));
59
+ return i(t, k(i, n));
60
60
  }
61
- const A = ({
61
+ const O = ({
62
62
  name: i,
63
63
  label: t,
64
64
  value: n = "",
@@ -70,34 +70,36 @@ const A = ({
70
70
  required: r,
71
71
  readonly: u,
72
72
  maxLength: c,
73
- disabled: N,
74
- optional: _,
75
- onChange: h
73
+ disabled: _,
74
+ optional: h,
75
+ onChange: V,
76
+ onBlur: p
76
77
  }) => {
77
- const { t: l } = I(), p = l(t), V = _ ? `${p} ${l("verification.labels.optional")}` : p;
78
+ const { t: l } = N(), v = l(t), R = h ? `${v} ${l("verification.labels.optional")}` : v;
78
79
  return /* @__PURE__ */ e("div", { className: "IncodeFormField", children: /* @__PURE__ */ e(
79
- E,
80
+ S,
80
81
  {
81
82
  id: i,
82
- label: V,
83
+ label: R,
83
84
  name: i,
84
85
  type: s,
85
86
  value: n,
86
87
  placeholder: a ? l(a, f) : void 0,
87
88
  readOnly: u,
88
- disabled: N,
89
+ disabled: _,
89
90
  maxLength: c,
90
- error: k(l, d, o),
91
- onInput: (R) => {
92
- const g = R.target;
93
- h(i, g.value);
91
+ error: C(l, d, o),
92
+ onInput: (g) => {
93
+ const b = g.target;
94
+ V(i, b.value);
94
95
  },
96
+ onBlur: p ? () => p(i) : void 0,
95
97
  "data-testid": `form-field-${i}`
96
98
  }
97
99
  ) });
98
100
  };
99
101
  export {
100
- A as F,
101
- L as V,
102
- k as t
102
+ O as F,
103
+ A as V,
104
+ C as t
103
105
  };
@@ -314,6 +314,7 @@ declare type FormFieldProps = {
314
314
  disabled?: boolean;
315
315
  optional?: boolean;
316
316
  onChange: (name: string, value: string) => void;
317
+ onBlur?: (name: string) => void;
317
318
  };
318
319
 
319
320
  export declare function getCountryByCallingCode(callingCode: string): CountryData | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260317-6ffceac",
3
+ "version": "0.0.0-dev-20260317-737b25e",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -119,7 +119,7 @@
119
119
  "preact-custom-element": "^4.6.0",
120
120
  "qrcode": "^1.5.4",
121
121
  "tailwindcss": "^4.1.17",
122
- "@incodetech/core": "0.0.0-dev-20260317-6ffceac"
122
+ "@incodetech/core": "0.0.0-dev-20260317-737b25e"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@microsoft/api-extractor": "^7.53.3",