@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.
@@ -5743,6 +5743,10 @@
5743
5743
  margin-bottom: var(--spacing-0, var(--spacing-none, 0px));
5744
5744
  }
5745
5745
 
5746
+ .IncodeEkybForm .IncodeAddressAutocomplete {
5747
+ margin-inline: auto;
5748
+ }
5749
+
5746
5750
  @media (min-width: 768px) {
5747
5751
  .IncodePageContainer.IncodeEkybPage {
5748
5752
  margin-top: var(--spacing-0, var(--spacing-none, 0px));
@@ -0,0 +1,103 @@
1
+ import { b as I, u as e, B as v } from "./button-Ca1tRSTI.js";
2
+ import "./uiConfig-Z6RT23Sl.js";
3
+ import "./vendor-preact-BXf0bkEs.js";
4
+ import { E as b } from "./errorIcon-BL647nVh.js";
5
+ import { S as y } from "./successIcon-BybULRRU.js";
6
+ import { P as m } from "./page-BVHG3h0V.js";
7
+ import { S as F } from "./spinner-Cx3FPUCD.js";
8
+ import { I as E } from "./dropdownComposed-DBm7cotT.js";
9
+ const L = ({
10
+ status: i,
11
+ submittingTitle: t,
12
+ successTitle: n,
13
+ failureTitle: d,
14
+ onRetry: o,
15
+ onSkip: s,
16
+ retryLabel: a,
17
+ skipLabel: f
18
+ }) => {
19
+ const { t: r } = I();
20
+ if (i === "submitting") {
21
+ const c = t ?? r("verification.processing");
22
+ return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
23
+ /* @__PURE__ */ e(F, {}),
24
+ /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
25
+ ] }) });
26
+ }
27
+ if (i === "success") {
28
+ const c = n ?? r("verification.successTitle");
29
+ return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
30
+ /* @__PURE__ */ e(y, { size: 64 }),
31
+ /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: c })
32
+ ] }) });
33
+ }
34
+ const u = d ?? r("verification.failureTitle");
35
+ return /* @__PURE__ */ e(m, { className: "IncodeVerificationResult", children: [
36
+ /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__center", children: [
37
+ /* @__PURE__ */ e(b, { size: 64 }),
38
+ /* @__PURE__ */ e("p", { className: "IncodeVerificationResult__title", children: u })
39
+ ] }),
40
+ /* @__PURE__ */ e("div", { className: "IncodeVerificationResult__actions", children: [
41
+ o && /* @__PURE__ */ e(v, { onClick: o, "data-testid": "verification-retry", children: a ?? r("common.tryAgain") }),
42
+ s && /* @__PURE__ */ e(
43
+ v,
44
+ {
45
+ onClick: s,
46
+ variant: "secondary",
47
+ "data-testid": "verification-skip",
48
+ children: f ?? r("common.skip")
49
+ }
50
+ )
51
+ ] })
52
+ ] });
53
+ };
54
+ function S(i, t) {
55
+ return t?.fieldName && typeof t.fieldName == "string" ? { ...t, fieldName: i(String(t.fieldName)) } : t;
56
+ }
57
+ function k(i, t, n) {
58
+ if (t)
59
+ return i(t, S(i, n));
60
+ }
61
+ const A = ({
62
+ name: i,
63
+ label: t,
64
+ value: n = "",
65
+ error: d,
66
+ errorParams: o,
67
+ type: s = "text",
68
+ placeholder: a,
69
+ placeholderParams: f,
70
+ required: r,
71
+ readonly: u,
72
+ maxLength: c,
73
+ disabled: N,
74
+ optional: _,
75
+ onChange: h
76
+ }) => {
77
+ const { t: l } = I(), p = l(t), V = _ ? `${p} ${l("verification.labels.optional")}` : p;
78
+ return /* @__PURE__ */ e("div", { className: "IncodeFormField", children: /* @__PURE__ */ e(
79
+ E,
80
+ {
81
+ id: i,
82
+ label: V,
83
+ name: i,
84
+ type: s,
85
+ value: n,
86
+ placeholder: a ? l(a, f) : void 0,
87
+ readOnly: u,
88
+ disabled: N,
89
+ maxLength: c,
90
+ error: k(l, d, o),
91
+ onInput: (R) => {
92
+ const g = R.target;
93
+ h(i, g.value);
94
+ },
95
+ "data-testid": `form-field-${i}`
96
+ }
97
+ ) });
98
+ };
99
+ export {
100
+ A as F,
101
+ L as V,
102
+ k as t
103
+ };
@@ -0,0 +1,159 @@
1
+ import { u as n } from "./button-Ca1tRSTI.js";
2
+ import { D as Y, d as S, A as k, T as D, y as q, q as y } from "./vendor-preact-BXf0bkEs.js";
3
+ import { g as u, c as G } from "./countries-C9bhJe4u.js";
4
+ import { D as J, I as K } from "./dropdownComposed-DBm7cotT.js";
5
+ import { E as Q } from "./errorIcon-BL647nVh.js";
6
+ import { S as X } from "./successIcon-BybULRRU.js";
7
+ import { A as E, p as W } from "./AsYouType-CpH-Rmtj.js";
8
+ const Z = Y(
9
+ ({
10
+ id: a,
11
+ label: m,
12
+ countryCode: A = "US",
13
+ value: c,
14
+ placeholder: N = "(123) 123-6789",
15
+ error: r,
16
+ helper: h,
17
+ showErrorIcon: j,
18
+ showHelperIcon: B,
19
+ disabled: P = !1,
20
+ disableCountrySelector: L = !1,
21
+ required: I,
22
+ onChange: f,
23
+ "aria-labelledby": T,
24
+ "data-testid": x,
25
+ ...z
26
+ }, F) => {
27
+ const [d, b] = S(A), [l, C] = S(""), $ = k(!1), H = D(
28
+ () => G.map((o) => ({
29
+ value: o.code,
30
+ label: `${o.emoji} ${o.callingCode} ${o.name}`
31
+ })),
32
+ []
33
+ ), t = D(
34
+ () => u(d) ?? u("US"),
35
+ [d]
36
+ );
37
+ q(() => {
38
+ if ($.current || !c || !t) return;
39
+ $.current = !0;
40
+ const o = c.startsWith("+") ? c : `+${c}`, e = W(o);
41
+ if (e?.isValid() && e.country) {
42
+ e.country !== d && b(e.country);
43
+ const s = new E(e.country);
44
+ C(s.input(e.nationalNumber));
45
+ }
46
+ }, [c, t, d]);
47
+ const p = y(
48
+ (o, e) => {
49
+ const s = `${e.callingCode}${o.replace(/\D/g, "")}`;
50
+ try {
51
+ const w = W(s, e.code);
52
+ f?.(s, w?.isValid() ?? !1);
53
+ } catch {
54
+ f?.(s, !1);
55
+ }
56
+ },
57
+ [f]
58
+ ), M = y(
59
+ (o) => {
60
+ b(o);
61
+ const e = u(o);
62
+ e && l && p(l, e);
63
+ },
64
+ [l, p]
65
+ ), U = y(
66
+ (o) => {
67
+ const e = o.target.value;
68
+ if (!t) {
69
+ C(e);
70
+ return;
71
+ }
72
+ const s = `${t.callingCode}${e}`, R = new E(t.code).input(s).replace(t.callingCode, "").trimStart();
73
+ C(R), p(e, t);
74
+ },
75
+ [t, p]
76
+ ), V = `${a}-country`, i = `${a}-phone`, g = `${i}-helper`, v = `${i}-error`, O = [h ? g : null, r ? v : null].filter(Boolean).join(" ");
77
+ return /* @__PURE__ */ n("div", { class: "IncodePhoneInputComposed", children: [
78
+ m && /* @__PURE__ */ n(
79
+ "label",
80
+ {
81
+ class: "IncodePhoneInputComposedLabel",
82
+ htmlFor: i,
83
+ "data-testid": `${a}-label`,
84
+ children: [
85
+ m,
86
+ I && /* @__PURE__ */ n("span", { class: "IncodePhoneInputComposedRequired", children: " *" })
87
+ ]
88
+ }
89
+ ),
90
+ /* @__PURE__ */ n(
91
+ J,
92
+ {
93
+ id: V,
94
+ options: H,
95
+ value: d,
96
+ onChange: M,
97
+ disabled: P || L,
98
+ required: I,
99
+ searchable: !0,
100
+ searchPlaceholder: "Search countries...",
101
+ suppressMessages: !0,
102
+ "aria-label": "Select country code",
103
+ renderSelectedLabel: (o) => {
104
+ const e = u(o.value);
105
+ return e ? `${e.emoji} ${e.callingCode}` : o.label;
106
+ },
107
+ class: "IncodePhoneInputComposedDropdown",
108
+ siblingElement: /* @__PURE__ */ n(
109
+ K,
110
+ {
111
+ id: i,
112
+ ref: F,
113
+ type: "tel",
114
+ value: l,
115
+ onInput: U,
116
+ placeholder: N,
117
+ error: r,
118
+ disabled: P,
119
+ required: I,
120
+ suppressMessages: !0,
121
+ "aria-label": m ? void 0 : "Phone number",
122
+ "aria-labelledby": T,
123
+ "aria-describedby": O || void 0,
124
+ "aria-invalid": r ? "true" : void 0,
125
+ "data-testid": x,
126
+ ...z
127
+ }
128
+ )
129
+ }
130
+ ),
131
+ r && /* @__PURE__ */ n(
132
+ "div",
133
+ {
134
+ class: "IncodePhoneInputComposedErrorWrapper",
135
+ "data-testid": `${a}-error-wrapper`,
136
+ children: [
137
+ j && /* @__PURE__ */ n("div", { class: "IncodePhoneInputComposedIconWrapper", children: /* @__PURE__ */ n(Q, { size: 16 }) }),
138
+ /* @__PURE__ */ n("p", { id: v, class: "IncodePhoneInputComposedError", children: r })
139
+ ]
140
+ }
141
+ ),
142
+ h && !r && /* @__PURE__ */ n(
143
+ "div",
144
+ {
145
+ class: "IncodePhoneInputComposedHelperWrapper",
146
+ "data-testid": `${a}-helper-wrapper`,
147
+ children: [
148
+ B && /* @__PURE__ */ n("div", { class: "IncodePhoneInputComposedIconWrapper", children: /* @__PURE__ */ n(X, { size: 16 }) }),
149
+ /* @__PURE__ */ n("p", { id: g, class: "IncodePhoneInputComposedHelper", children: h })
150
+ ]
151
+ }
152
+ )
153
+ ] });
154
+ }
155
+ );
156
+ Z.displayName = "PhoneInputComposed";
157
+ export {
158
+ Z as P
159
+ };
@@ -513,19 +513,27 @@ declare type PermissionsProps = {
513
513
  permissionStatus: PermissionStatus_2;
514
514
  };
515
515
 
516
- export declare const PhoneInputComposed: FC<PhoneInputComposedProps>;
516
+ export declare const PhoneInputComposed: FunctionalComponent<PropsWithoutRef<PhoneInputComposedProps> & {
517
+ ref?: Ref<HTMLInputElement> | undefined;
518
+ }>;
517
519
 
518
- declare type PhoneInputComposedProps = {
520
+ declare type PhoneInputComposedProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'onChange' | 'class'> & PhoneInputOwnProps;
521
+
522
+ declare type PhoneInputOwnProps = {
519
523
  id: string;
520
524
  label?: string;
521
525
  countryCode?: string;
522
526
  value?: string;
523
527
  placeholder?: string;
524
528
  error?: string;
529
+ helper?: string;
530
+ showErrorIcon?: boolean;
531
+ showHelperIcon?: boolean;
525
532
  disabled?: boolean;
526
533
  disableCountrySelector?: boolean;
527
534
  required?: boolean;
528
535
  onChange?: (fullNumber: string, isValid: boolean) => void;
536
+ 'aria-labelledby'?: string;
529
537
  'data-testid'?: string;
530
538
  };
531
539
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/web",
3
- "version": "0.0.0-dev-20260313-bc2dab4",
3
+ "version": "0.0.0-dev-20260317-ce5d28b",
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-20260313-bc2dab4"
122
+ "@incodetech/core": "0.0.0-dev-20260317-ce5d28b"
123
123
  },
124
124
  "devDependencies": {
125
125
  "@microsoft/api-extractor": "^7.53.3",
@@ -1,244 +0,0 @@
1
- import { b as k, u as t, I as U, a as F, S as $, B as R } from "./button-Ca1tRSTI.js";
2
- import { SUPPORTED_COUNTRIES as I, DEV_ONLY_COUNTRIES as M, createEkybManager as D } from "@incodetech/core/ekyb";
3
- import { T as w, y as v, A, k as L } from "./vendor-preact-BXf0bkEs.js";
4
- import "./uiConfig-Z6RT23Sl.js";
5
- import "@incodetech/core";
6
- import { u as P } from "./useFormScrollable-3O3GeT4m.js";
7
- import { P as O } from "./page-BVHG3h0V.js";
8
- import { F as T, V as E } from "./formField-C91ckby4.js";
9
- import { r as _ } from "./incodeModule-aE-LkKwM.js";
10
- import { D as g, I as S } from "./dropdownComposed-DBm7cotT.js";
11
- function B(e) {
12
- return [...e.toUpperCase()].map((o) => String.fromCodePoint(127462 + o.charCodeAt(0) - 65)).join("");
13
- }
14
- const V = {
15
- BR: "Brazil",
16
- CM: "Cameroon",
17
- CN: "China",
18
- FR: "France",
19
- DE: "Germany",
20
- IL: "Israel",
21
- IT: "Italy",
22
- KE: "Kenya",
23
- MX: "Mexico",
24
- NG: "Nigeria",
25
- ES: "Spain",
26
- GB: "United Kingdom",
27
- US: "United States"
28
- };
29
- function q(e) {
30
- const o = V[e] ?? e;
31
- return { value: e, label: `${B(e)} ${o}` };
32
- }
33
- function G() {
34
- if (typeof window > "u") return !1;
35
- const { hostname: e } = window.location;
36
- return e === "localhost" || e.includes("stage") || e.includes("demo");
37
- }
38
- const K = ({
39
- value: e,
40
- onChange: o
41
- }) => {
42
- const { t: r } = k(), n = w(() => (G() ? [...I, ...M] : [...I]).map(q).sort((u, l) => u.label.localeCompare(l.label)), []);
43
- return /* @__PURE__ */ t("div", { className: "IncodeEkybCountrySelector", children: /* @__PURE__ */ t(
44
- g,
45
- {
46
- id: "ekyb-country",
47
- label: r("ekyb.country"),
48
- value: e,
49
- options: n,
50
- onChange: o,
51
- "data-testid": "ekyb-country-selector"
52
- }
53
- ) });
54
- }, N = ({
55
- field: e,
56
- value: o,
57
- error: r,
58
- country: n,
59
- onChange: c
60
- }) => {
61
- const { t: u } = k(), l = !e.required, m = u(e.label);
62
- if (e.type === "dropdown") {
63
- const a = l ? `${m} (${u("common.optional")})` : m, b = e.name === "state" ? u("ekyb.selectState") : void 0;
64
- return /* @__PURE__ */ t(
65
- g,
66
- {
67
- id: `ekyb-${e.name}`,
68
- label: a,
69
- placeholder: b,
70
- value: o,
71
- options: (e.options ?? []).map((i) => ({
72
- ...i,
73
- label: u(i.label)
74
- })),
75
- error: r ? u(r) : void 0,
76
- searchable: !0,
77
- onChange: (i) => c(e.name, i),
78
- "data-testid": `ekyb-field-${e.name}`
79
- }
80
- );
81
- }
82
- return /* @__PURE__ */ t(
83
- T,
84
- {
85
- name: e.name,
86
- label: e.label,
87
- value: o,
88
- error: r,
89
- required: e.required,
90
- optional: l,
91
- onChange: c
92
- }
93
- );
94
- }, z = ({
95
- ubos: e,
96
- errors: o,
97
- canAddUbo: r,
98
- onSetField: n,
99
- onAdd: c,
100
- onRemove: u
101
- }) => {
102
- const { t: l } = k();
103
- return e.length === 0 ? null : /* @__PURE__ */ t("div", { className: "IncodeEkybUbos", children: [
104
- e.map((m, a) => {
105
- const b = a === 0 ? l("ekyb.uboName") : l("ekyb.uboNameWithNumber", { number: a + 1 }), i = a === 0 ? l("ekyb.uboSurname") : l("ekyb.uboSurnameWithNumber", { number: a + 1 }), h = a === 0;
106
- return /* @__PURE__ */ t("div", { className: "IncodeEkybUboEntry", children: [
107
- /* @__PURE__ */ t(
108
- S,
109
- {
110
- id: `ubo-${a}-name`,
111
- label: b,
112
- name: `ubo-${a}-name`,
113
- value: m.name,
114
- error: o[`ubo-${a}-name`] ? l(o[`ubo-${a}-name`]) : void 0,
115
- onInput: (d) => n(a, "name", d.target.value),
116
- "data-testid": `ekyb-ubo-${a}-name`
117
- }
118
- ),
119
- /* @__PURE__ */ t(
120
- S,
121
- {
122
- id: `ubo-${a}-surname`,
123
- label: i,
124
- name: `ubo-${a}-surname`,
125
- value: m.surname,
126
- error: o[`ubo-${a}-surname`] ? l(o[`ubo-${a}-surname`]) : void 0,
127
- onInput: (d) => n(
128
- a,
129
- "surname",
130
- d.target.value
131
- ),
132
- "data-testid": `ekyb-ubo-${a}-surname`
133
- }
134
- ),
135
- !h && /* @__PURE__ */ t(
136
- "button",
137
- {
138
- className: "IncodeEkybRemoveUbo",
139
- onClick: () => u(a),
140
- type: "button",
141
- children: l("common.remove")
142
- }
143
- )
144
- ] }, m.id);
145
- }),
146
- r && /* @__PURE__ */ t(
147
- "button",
148
- {
149
- className: "IncodeEkybAddUbo",
150
- onClick: c,
151
- type: "button",
152
- "data-testid": "ekyb-add-ubo",
153
- children: l("ekyb.addAnotherUbo")
154
- }
155
- )
156
- ] });
157
- }, W = ({ config: e, onFinish: o, onError: r }) => {
158
- const [n, c] = F(() => D({ config: e }), {
159
- autoLoad: !1
160
- });
161
- v(() => {
162
- (n.status === "finished" || n.status === "closed") && o?.();
163
- }, [n.status, o]);
164
- const u = n.status === "error" ? n.errorMessage : void 0;
165
- return v(() => {
166
- n.status === "error" && r?.(u);
167
- }, [n.status, r, u]), n.status === "finished" || n.status === "closed" ? null : n.status === "submitting" ? /* @__PURE__ */ t(E, { status: "submitting" }) : n.status === "success" ? /* @__PURE__ */ t(E, { status: "success" }) : n.status === "error" ? /* @__PURE__ */ t(E, { status: "failure", onRetry: () => c.retry() }) : n.status === "form" ? /* @__PURE__ */ t(Y, { state: n, manager: c }) : null;
168
- }, f = /* @__PURE__ */ new Set([
169
- "street",
170
- "houseNo",
171
- "addressLine2",
172
- "city",
173
- "state",
174
- "postalCode"
175
- ]), Y = ({ state: e, manager: o }) => {
176
- const { country: r, fields: n, values: c, displayErrors: u, isValid: l, ubos: m, canAddUbo: a } = e, { t: b } = k(), i = A(null), h = P(i, n.length), d = n.filter((s) => !f.has(s.name)), C = n.filter((s) => f.has(s.name));
177
- return /* @__PURE__ */ t(O, { className: `IncodeEkybPage${h ? " IncodeEkybPageScrollable" : ""}`, title: b("ekyb.title"), children: [
178
- /* @__PURE__ */ t("div", { ref: i, className: "IncodeEkybForm", children: [
179
- /* @__PURE__ */ t(
180
- K,
181
- {
182
- value: r,
183
- onChange: (s) => o.setCountry(s)
184
- }
185
- ),
186
- d.map((s) => /* @__PURE__ */ t(
187
- N,
188
- {
189
- field: s,
190
- value: c[s.name] ?? "",
191
- error: u[s.name],
192
- country: r,
193
- onChange: (y, p) => o.setField(y, p)
194
- },
195
- s.name
196
- )),
197
- C.length > 0 && /* @__PURE__ */ t(L, { children: [
198
- /* @__PURE__ */ t("h3", { className: "IncodeEkybSectionHeader", children: b("ekyb.addressDetails") }),
199
- C.map((s) => /* @__PURE__ */ t(
200
- N,
201
- {
202
- field: s,
203
- value: c[s.name] ?? "",
204
- error: u[s.name],
205
- country: r,
206
- onChange: (y, p) => o.setField(y, p)
207
- },
208
- s.name
209
- ))
210
- ] }),
211
- /* @__PURE__ */ t(
212
- z,
213
- {
214
- ubos: m,
215
- errors: u,
216
- canAddUbo: a,
217
- onSetField: (s, y, p) => o.setUboField(s, y, p),
218
- onAdd: () => o.addUbo(),
219
- onRemove: (s) => o.removeUbo(s)
220
- }
221
- )
222
- ] }),
223
- /* @__PURE__ */ t("div", { className: "IncodeEkybFooter", children: [
224
- /* @__PURE__ */ t($, { size: 32 }),
225
- /* @__PURE__ */ t(
226
- R,
227
- {
228
- onClick: () => o.submit(),
229
- disabled: !l,
230
- "data-testid": "ekyb-submit",
231
- children: b("ekyb.continue")
232
- }
233
- )
234
- ] })
235
- ] });
236
- }, j = ({
237
- config: e,
238
- onFinish: o,
239
- onError: r
240
- }) => /* @__PURE__ */ t(U, { children: e ? /* @__PURE__ */ t(W, { config: e, onFinish: o, onError: r }) : null });
241
- _(j, "incode-ekyb");
242
- export {
243
- j as EkybModule
244
- };