@alfadocs/ui-kit-debug 1.112.2 → 1.113.0

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.
Files changed (160) hide show
  1. package/dist/_chunks/{calendar-appointment-editor-dialog-FvdoKZ54.js → calendar-appointment-editor-dialog-CaZm5wGR.js} +2 -2
  2. package/dist/_chunks/{calendar-appointment-editor-dialog-FvdoKZ54.js.map → calendar-appointment-editor-dialog-CaZm5wGR.js.map} +1 -1
  3. package/dist/_chunks/email-input-DxwbREpx.js +156 -0
  4. package/dist/_chunks/email-input-DxwbREpx.js.map +1 -0
  5. package/dist/_chunks/{forgot-password-form-vfCO2-Tt.js → forgot-password-form-YQVzSskq.js} +8 -7
  6. package/dist/_chunks/{forgot-password-form-vfCO2-Tt.js.map → forgot-password-form-YQVzSskq.js.map} +1 -1
  7. package/dist/_chunks/isEmail-BfVspSvV.js +248 -0
  8. package/dist/_chunks/isEmail-BfVspSvV.js.map +1 -0
  9. package/dist/_chunks/{login-dev-card-Cz1Clugq.js → login-dev-card-B6-zCFq3.js} +47 -46
  10. package/dist/_chunks/{login-dev-card-Cz1Clugq.js.map → login-dev-card-B6-zCFq3.js.map} +1 -1
  11. package/dist/_chunks/{patient-details-BwkDIm4D.js → patient-details-RsT3SaYh.js} +2 -2
  12. package/dist/_chunks/{patient-details-BwkDIm4D.js.map → patient-details-RsT3SaYh.js.map} +1 -1
  13. package/dist/_chunks/{patient-field-row-CBba7w9V.js → patient-field-row-D9rb-QJH.js} +2 -2
  14. package/dist/_chunks/{patient-field-row-CBba7w9V.js.map → patient-field-row-D9rb-QJH.js.map} +1 -1
  15. package/dist/_chunks/{patient-summary-card-DtYTo9w_.js → patient-summary-card-BjZErlbt.js} +2 -2
  16. package/dist/_chunks/{patient-summary-card-DtYTo9w_.js.map → patient-summary-card-BjZErlbt.js.map} +1 -1
  17. package/dist/_chunks/{practice-results-BOpaPaav.js → practice-results-BByRCIuR.js} +620 -566
  18. package/dist/_chunks/practice-results-BByRCIuR.js.map +1 -0
  19. package/dist/_chunks/{registration-form-DEyUFysm.js → registration-form-Cq5_OSIL.js} +7 -6
  20. package/dist/_chunks/{registration-form-DEyUFysm.js.map → registration-form-Cq5_OSIL.js.map} +1 -1
  21. package/dist/_chunks/{reserved.agent-W_Zgj564.js → reserved.agent-BMkapgom.js} +2 -2
  22. package/dist/_chunks/{reserved.agent-W_Zgj564.js.map → reserved.agent-BMkapgom.js.map} +1 -1
  23. package/dist/_chunks/{reset-password-form-B0acanDD.js → reset-password-form-BVsL2fOJ.js} +2 -2
  24. package/dist/_chunks/{reset-password-form-B0acanDD.js.map → reset-password-form-BVsL2fOJ.js.map} +1 -1
  25. package/dist/_chunks/{send-registration-link-form-Nn0jf65G.js → send-registration-link-form-OgPomrZN.js} +8 -7
  26. package/dist/_chunks/{send-registration-link-form-Nn0jf65G.js.map → send-registration-link-form-OgPomrZN.js.map} +1 -1
  27. package/dist/_chunks/{use-appointment-details-read-DYyCYI9f.js → use-appointment-details-read-DvK7Looa.js} +2 -2
  28. package/dist/_chunks/{use-appointment-details-read-DYyCYI9f.js.map → use-appointment-details-read-DvK7Looa.js.map} +1 -1
  29. package/dist/_chunks/verify-identity-types-C85EXNzy.js +707 -0
  30. package/dist/_chunks/verify-identity-types-C85EXNzy.js.map +1 -0
  31. package/dist/agent-catalog.json +106 -2
  32. package/dist/agent-i18n/en.json +11 -0
  33. package/dist/components/appointment-details-panel/index.js +1 -1
  34. package/dist/components/booking/index.js +1 -1
  35. package/dist/components/email-input/index.js +1 -1
  36. package/dist/components/index.d.ts +1 -0
  37. package/dist/components/index.d.ts.map +1 -1
  38. package/dist/components/patient-details/index.js +1 -1
  39. package/dist/components/patient-summary-card/index.js +1 -1
  40. package/dist/components/practice-results/index.js +1 -1
  41. package/dist/components/practice-results/practice-results.d.ts +28 -0
  42. package/dist/components/practice-results/practice-results.d.ts.map +1 -1
  43. package/dist/core.css +1 -1
  44. package/dist/i18n/locales/ar.d.ts +67 -0
  45. package/dist/i18n/locales/ar.d.ts.map +1 -1
  46. package/dist/i18n/locales/ar.js +68 -1
  47. package/dist/i18n/locales/ar.js.map +1 -1
  48. package/dist/i18n/locales/de.d.ts +67 -0
  49. package/dist/i18n/locales/de.d.ts.map +1 -1
  50. package/dist/i18n/locales/de.js +68 -1
  51. package/dist/i18n/locales/de.js.map +1 -1
  52. package/dist/i18n/locales/el.d.ts +67 -0
  53. package/dist/i18n/locales/el.d.ts.map +1 -1
  54. package/dist/i18n/locales/el.js +68 -1
  55. package/dist/i18n/locales/el.js.map +1 -1
  56. package/dist/i18n/locales/en.d.ts +67 -0
  57. package/dist/i18n/locales/en.d.ts.map +1 -1
  58. package/dist/i18n/locales/en.js +67 -0
  59. package/dist/i18n/locales/en.js.map +1 -1
  60. package/dist/i18n/locales/es.d.ts +67 -0
  61. package/dist/i18n/locales/es.d.ts.map +1 -1
  62. package/dist/i18n/locales/es.js +68 -1
  63. package/dist/i18n/locales/es.js.map +1 -1
  64. package/dist/i18n/locales/fr.d.ts +67 -0
  65. package/dist/i18n/locales/fr.d.ts.map +1 -1
  66. package/dist/i18n/locales/fr.js +68 -1
  67. package/dist/i18n/locales/fr.js.map +1 -1
  68. package/dist/i18n/locales/hi.d.ts +67 -0
  69. package/dist/i18n/locales/hi.d.ts.map +1 -1
  70. package/dist/i18n/locales/hi.js +68 -1
  71. package/dist/i18n/locales/hi.js.map +1 -1
  72. package/dist/i18n/locales/it.d.ts +67 -0
  73. package/dist/i18n/locales/it.d.ts.map +1 -1
  74. package/dist/i18n/locales/it.js +68 -1
  75. package/dist/i18n/locales/it.js.map +1 -1
  76. package/dist/i18n/locales/ja.d.ts +67 -0
  77. package/dist/i18n/locales/ja.d.ts.map +1 -1
  78. package/dist/i18n/locales/ja.js +68 -1
  79. package/dist/i18n/locales/ja.js.map +1 -1
  80. package/dist/i18n/locales/nl.d.ts +67 -0
  81. package/dist/i18n/locales/nl.d.ts.map +1 -1
  82. package/dist/i18n/locales/nl.js +68 -1
  83. package/dist/i18n/locales/nl.js.map +1 -1
  84. package/dist/i18n/locales/pl.d.ts +67 -0
  85. package/dist/i18n/locales/pl.d.ts.map +1 -1
  86. package/dist/i18n/locales/pl.js +68 -1
  87. package/dist/i18n/locales/pl.js.map +1 -1
  88. package/dist/i18n/locales/pt.d.ts +67 -0
  89. package/dist/i18n/locales/pt.d.ts.map +1 -1
  90. package/dist/i18n/locales/pt.js +68 -1
  91. package/dist/i18n/locales/pt.js.map +1 -1
  92. package/dist/i18n/locales/ro.d.ts +67 -0
  93. package/dist/i18n/locales/ro.d.ts.map +1 -1
  94. package/dist/i18n/locales/ro.js +68 -1
  95. package/dist/i18n/locales/ro.js.map +1 -1
  96. package/dist/i18n/locales/ru.d.ts +67 -0
  97. package/dist/i18n/locales/ru.d.ts.map +1 -1
  98. package/dist/i18n/locales/ru.js +68 -1
  99. package/dist/i18n/locales/ru.js.map +1 -1
  100. package/dist/i18n/locales/sq.d.ts +67 -0
  101. package/dist/i18n/locales/sq.d.ts.map +1 -1
  102. package/dist/i18n/locales/sq.js +68 -1
  103. package/dist/i18n/locales/sq.js.map +1 -1
  104. package/dist/i18n/locales/sv.d.ts +67 -0
  105. package/dist/i18n/locales/sv.d.ts.map +1 -1
  106. package/dist/i18n/locales/sv.js +68 -1
  107. package/dist/i18n/locales/sv.js.map +1 -1
  108. package/dist/i18n/locales/tr.d.ts +67 -0
  109. package/dist/i18n/locales/tr.d.ts.map +1 -1
  110. package/dist/i18n/locales/tr.js +68 -1
  111. package/dist/i18n/locales/tr.js.map +1 -1
  112. package/dist/i18n/locales/zh.d.ts +67 -0
  113. package/dist/i18n/locales/zh.d.ts.map +1 -1
  114. package/dist/i18n/locales/zh.js +68 -1
  115. package/dist/i18n/locales/zh.js.map +1 -1
  116. package/dist/index.js +345 -340
  117. package/dist/index.js.map +1 -1
  118. package/dist/locales/ar.json +68 -1
  119. package/dist/locales/de.json +68 -1
  120. package/dist/locales/el.json +68 -1
  121. package/dist/locales/en.json +67 -0
  122. package/dist/locales/es.json +68 -1
  123. package/dist/locales/fr.json +68 -1
  124. package/dist/locales/hi.json +68 -1
  125. package/dist/locales/it.json +68 -1
  126. package/dist/locales/ja.json +68 -1
  127. package/dist/locales/nl.json +68 -1
  128. package/dist/locales/pl.json +68 -1
  129. package/dist/locales/pt.json +68 -1
  130. package/dist/locales/ro.json +68 -1
  131. package/dist/locales/ru.json +68 -1
  132. package/dist/locales/sq.json +68 -1
  133. package/dist/locales/sv.json +68 -1
  134. package/dist/locales/tr.json +68 -1
  135. package/dist/locales/zh.json +68 -1
  136. package/dist/patterns/calendar/index.js +1 -1
  137. package/dist/patterns/forgot-password-form/index.js +1 -1
  138. package/dist/patterns/login-form/index.js +1 -1
  139. package/dist/patterns/registration-form/index.js +1 -1
  140. package/dist/patterns/reset-password-form/index.js +1 -1
  141. package/dist/patterns/send-registration-link-form/index.js +1 -1
  142. package/dist/patterns/verify-identity/change-email-dialog.d.ts +26 -0
  143. package/dist/patterns/verify-identity/change-email-dialog.d.ts.map +1 -0
  144. package/dist/patterns/verify-identity/index.d.ts +7 -0
  145. package/dist/patterns/verify-identity/index.d.ts.map +1 -0
  146. package/dist/patterns/verify-identity/index.js +8 -0
  147. package/dist/patterns/verify-identity/index.js.map +1 -0
  148. package/dist/patterns/verify-identity/use-countdown.d.ts +12 -0
  149. package/dist/patterns/verify-identity/use-countdown.d.ts.map +1 -0
  150. package/dist/patterns/verify-identity/verify-identity-steps.d.ts +21 -0
  151. package/dist/patterns/verify-identity/verify-identity-steps.d.ts.map +1 -0
  152. package/dist/patterns/verify-identity/verify-identity-types.d.ts +47 -0
  153. package/dist/patterns/verify-identity/verify-identity-types.d.ts.map +1 -0
  154. package/dist/patterns/verify-identity/verify-identity.d.ts +54 -0
  155. package/dist/patterns/verify-identity/verify-identity.d.ts.map +1 -0
  156. package/dist/tokens.css +1 -1
  157. package/package.json +5 -1
  158. package/dist/_chunks/email-input-BEO3vonE.js +0 -399
  159. package/dist/_chunks/email-input-BEO3vonE.js.map +0 -1
  160. package/dist/_chunks/practice-results-BOpaPaav.js.map +0 -1
@@ -0,0 +1,707 @@
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
+ import { useState as f, useRef as w, useEffect as H, useCallback as G, forwardRef as ve, useId as se, useMemo as pe } from "react";
3
+ import { useTranslation as Y } from "react-i18next";
4
+ import { i as ge } from "./isEmail-BfVspSvV.js";
5
+ import { A as S } from "./alert-C4WKViaS.js";
6
+ import { B as q } from "./button-DohK_Ak_.js";
7
+ import { D } from "./dialog-BTjSQjdY.js";
8
+ import { F as ee } from "./form-field-CyHfOVKF.js";
9
+ import { T as oe } from "./text-input-B6iAgCr3.js";
10
+ import { c as ce } from "./index-D2ZczOXr.js";
11
+ import { i as he } from "./safe-href-5dbsfbQn.js";
12
+ import { O as Ie } from "./otp-input-gV1446Dw.js";
13
+ import { P as be } from "./password-input-SJGHFdOO.js";
14
+ import { C as xe } from "./circle-check-BN6rz4NV.js";
15
+ function Z() {
16
+ const [t, n] = f(null), [l, i] = f(0), [y, a] = f(!1), d = w(void 0);
17
+ H(() => {
18
+ if (t === null) return;
19
+ const c = () => {
20
+ const r = Math.max(0, Math.ceil((t - Date.now()) / 1e3));
21
+ i(r), r === 0 && (n(null), a(!0));
22
+ };
23
+ return c(), d.current = window.setInterval(c, 1e3), () => window.clearInterval(d.current);
24
+ }, [t]);
25
+ const I = G((c) => {
26
+ const r = Math.max(0, Math.ceil(c));
27
+ if (a(!1), r === 0) {
28
+ n(null), i(0);
29
+ return;
30
+ }
31
+ i(r), n(Date.now() + r * 1e3);
32
+ }, []), p = G(() => {
33
+ n(null), i(0), a(!1);
34
+ }, []);
35
+ return { remaining: l, finished: y, start: I, stop: p };
36
+ }
37
+ function we(t) {
38
+ const n = Math.floor(t / 60), l = t % 60;
39
+ return `${n}:${String(l).padStart(2, "0")}`;
40
+ }
41
+ const fe = (t) => t.status === "error" ? { kind: "error", message: t.message } : { kind: t.status };
42
+ async function re(t, n) {
43
+ if (!t) return n;
44
+ try {
45
+ return await t();
46
+ } catch {
47
+ return n;
48
+ }
49
+ }
50
+ const ae = { status: "error" };
51
+ function ue() {
52
+ const t = w(!0);
53
+ return H(() => (t.current = !0, () => {
54
+ t.current = !1;
55
+ }), []), t;
56
+ }
57
+ function me(t = !1) {
58
+ const { t: n } = Y("ui");
59
+ return (l, i) => {
60
+ if (l) {
61
+ if (l.message) return l.message;
62
+ switch (l.kind) {
63
+ case "invalid":
64
+ return n(t ? "verifyIdentity.password.invalid" : "verifyIdentity.invalidCode");
65
+ case "expired":
66
+ return n("verifyIdentity.expiredCode");
67
+ case "rate-limited":
68
+ return n("verifyIdentity.verifyRateLimited", { seconds: i });
69
+ default:
70
+ return n("verifyIdentity.genericError");
71
+ }
72
+ }
73
+ };
74
+ }
75
+ function Ee({
76
+ verify: t,
77
+ onDone: n,
78
+ onBusyChange: l
79
+ }) {
80
+ const { t: i } = Y("ui"), y = ue(), a = w(null), [d, I] = f(!1), [p, c] = f(null), r = Z(), g = me(!0), M = (p == null ? void 0 : p.kind) === "rate-limited" && r.remaining > 0;
81
+ return H(() => {
82
+ r.finished && c(null);
83
+ }, [r.finished]), /* @__PURE__ */ m(
84
+ "form",
85
+ {
86
+ noValidate: !0,
87
+ onSubmit: async (h) => {
88
+ var k, b, T;
89
+ h.preventDefault();
90
+ const V = ((k = a.current) == null ? void 0 : k.value) ?? "";
91
+ if (d || M) return;
92
+ if (V === "") {
93
+ c({
94
+ kind: "invalid",
95
+ message: i("verifyIdentity.password.required")
96
+ }), (b = a.current) == null || b.focus();
97
+ return;
98
+ }
99
+ I(!0), l(!0), c(null);
100
+ const E = await re(() => t(V), ae);
101
+ if (y.current) {
102
+ if (I(!1), l(!1), E.status === "ok") {
103
+ n();
104
+ return;
105
+ }
106
+ a.current && (a.current.value = ""), E.status === "rate-limited" && r.start(E.waitSeconds), c(fe(E)), (T = a.current) == null || T.focus();
107
+ }
108
+ },
109
+ "aria-busy": d || void 0,
110
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
111
+ children: [
112
+ /* @__PURE__ */ e(
113
+ ee,
114
+ {
115
+ label: i("verifyIdentity.password.label"),
116
+ required: !0,
117
+ error: g(p, r.remaining),
118
+ children: /* @__PURE__ */ e(
119
+ be,
120
+ {
121
+ ref: a,
122
+ name: "password",
123
+ autoComplete: "current-password",
124
+ disabled: d
125
+ }
126
+ )
127
+ }
128
+ ),
129
+ /* @__PURE__ */ e(
130
+ q,
131
+ {
132
+ type: "submit",
133
+ intent: "primary",
134
+ size: "lg",
135
+ loading: d,
136
+ "aria-disabled": M || void 0,
137
+ "data-action": "verify",
138
+ className: "ds:self-start",
139
+ children: i("verifyIdentity.continue")
140
+ }
141
+ )
142
+ ]
143
+ }
144
+ );
145
+ }
146
+ const Ne = 30;
147
+ function ne({
148
+ kind: t,
149
+ codeLength: n,
150
+ send: l,
151
+ verify: i,
152
+ onDone: y,
153
+ onBusyChange: a
154
+ }) {
155
+ const { t: d } = Y("ui"), I = ue(), p = w(null), c = t !== "authenticator", [r, g] = f(c ? "sending" : "ready"), [M, L] = f(), [h, V] = f(!c), [E, k] = f(""), [b, T] = f(!1), [R, F] = f(null), s = Z(), v = Z(), o = Z(), x = me(), N = G(() => {
156
+ var u, A;
157
+ (A = (u = p.current) == null ? void 0 : u.querySelector("input")) == null || A.focus();
158
+ }, []), j = w(0), P = G(async () => {
159
+ j.current += 1, g("sending"), F(null), k(""), a(!0);
160
+ const u = await re(l, ae);
161
+ if (I.current) {
162
+ if (a(!1), u.status === "sent") {
163
+ g("ready"), V(!0), s.start(u.resendAfterSeconds ?? Ne), u.expiresInSeconds ? v.start(u.expiresInSeconds) : v.stop();
164
+ return;
165
+ }
166
+ if (u.status === "rate-limited") {
167
+ g("limited"), s.start(u.waitSeconds);
168
+ return;
169
+ }
170
+ L(u.message), g("failed");
171
+ }
172
+ }, [l, a]), B = w(!1);
173
+ H(() => {
174
+ !c || B.current || (B.current = !0, P());
175
+ }, [c, P]);
176
+ const z = w(r);
177
+ H(() => {
178
+ r === "ready" && z.current === "sending" && h && j.current > 1 && N(), z.current = r;
179
+ }, [r, h, N]);
180
+ const C = (R == null ? void 0 : R.kind) === "rate-limited" && o.remaining > 0;
181
+ H(() => {
182
+ o.finished && F(null);
183
+ }, [o.finished]);
184
+ const te = v.finished && !R, J = R ?? (te ? { kind: "expired" } : null), O = async (u) => {
185
+ if (b || C || u.length !== n) return;
186
+ T(!0), a(!0), F(null);
187
+ const A = await re(() => i(u), ae);
188
+ if (I.current) {
189
+ if (T(!1), a(!1), A.status === "ok") {
190
+ y();
191
+ return;
192
+ }
193
+ A.status === "rate-limited" && o.start(A.waitSeconds), F(fe(A)), k(""), window.setTimeout(N, 0);
194
+ }
195
+ }, $ = s.remaining > 0, _ = h, U = c && r !== "sending";
196
+ return /* @__PURE__ */ m(
197
+ "div",
198
+ {
199
+ ref: p,
200
+ "data-slot": "code-step",
201
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
202
+ children: [
203
+ /* @__PURE__ */ e(
204
+ "div",
205
+ {
206
+ role: "status",
207
+ className: "type-body-sm ds:text-[var(--muted-foreground)]",
208
+ children: r === "sending" ? d("verifyIdentity.sending") : null
209
+ }
210
+ ),
211
+ r === "failed" && /* @__PURE__ */ e(S, { variant: "error", "data-slot": "send-failed", children: /* @__PURE__ */ e(S.Description, { children: M ?? d("verifyIdentity.sendFailed") }) }),
212
+ r === "limited" && /* @__PURE__ */ e(S, { variant: "warning", "data-slot": "send-limited", children: /* @__PURE__ */ e(S.Description, { children: s.remaining > 0 ? d("verifyIdentity.sendRateLimited", {
213
+ seconds: s.remaining
214
+ }) : d("verifyIdentity.sendRateLimitedOver") }) }),
215
+ _ && /* @__PURE__ */ e(
216
+ ee,
217
+ {
218
+ label: d("verifyIdentity.codeLabel"),
219
+ error: x(J, o.remaining),
220
+ children: /* @__PURE__ */ e(
221
+ Ie,
222
+ {
223
+ length: n,
224
+ mode: "numeric",
225
+ webOtp: t === "sms",
226
+ value: E,
227
+ onChange: k,
228
+ onComplete: (u) => void O(u),
229
+ disabled: b
230
+ }
231
+ )
232
+ }
233
+ ),
234
+ _ && v.remaining > 0 && /* @__PURE__ */ e(
235
+ "p",
236
+ {
237
+ className: "type-body-sm ds:text-[var(--muted-foreground)]",
238
+ "data-slot": "expiry",
239
+ children: d("verifyIdentity.expiresIn", {
240
+ time: we(v.remaining)
241
+ })
242
+ }
243
+ ),
244
+ /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
245
+ _ && /* @__PURE__ */ e(
246
+ q,
247
+ {
248
+ type: "button",
249
+ intent: "primary",
250
+ size: "lg",
251
+ loading: b,
252
+ "aria-disabled": E.length !== n || C || void 0,
253
+ "data-action": "verify",
254
+ onClick: () => void O(E),
255
+ children: d("verifyIdentity.verify")
256
+ }
257
+ ),
258
+ U && /* @__PURE__ */ e(
259
+ q,
260
+ {
261
+ type: "button",
262
+ intent: _ ? "outline" : "primary",
263
+ size: "lg",
264
+ disabled: b,
265
+ "aria-disabled": $ || void 0,
266
+ "data-action": r === "failed" ? "retry-send" : "resend-code",
267
+ onClick: () => {
268
+ $ || P();
269
+ },
270
+ children: $ ? d("verifyIdentity.resendIn", { seconds: s.remaining }) : d(r === "failed" ? "verifyIdentity.tryAgain" : "verifyIdentity.resend")
271
+ }
272
+ )
273
+ ] })
274
+ ]
275
+ }
276
+ );
277
+ }
278
+ const Ce = ce(
279
+ "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:text-start ds:text-[var(--foreground)]"
280
+ ), De = ce(
281
+ "type-h4 ds:m-0 ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]"
282
+ ), le = { 2: "h2", 3: "h3", 4: "h4" };
283
+ function ke({
284
+ steps: t,
285
+ title: n,
286
+ description: l,
287
+ headingLevel: i = 2,
288
+ maskedPhone: y,
289
+ maskedEmail: a,
290
+ codeLength: d = 6,
291
+ missingMobile: I = !1,
292
+ onSetUpMobile: p,
293
+ setUpMobileHref: c,
294
+ onVerified: r,
295
+ onCancel: g,
296
+ hideHeader: M = !1,
297
+ onVerifyPassword: L,
298
+ onVerifyAuthenticator: h,
299
+ onSendSmsCode: V,
300
+ onVerifySmsCode: E,
301
+ onSendEmailCode: k,
302
+ onVerifyEmailCode: b,
303
+ className: T,
304
+ forwardedRef: R,
305
+ ...F
306
+ }) {
307
+ const { t: s } = Y("ui"), v = se(), o = se(), [x, N] = f(0), [j, P] = f(!1), B = w(null), z = typeof x == "number" ? x : t.length - 1, C = t[z], te = I ? "missing-factor" : x === "verified" ? "verified" : C ?? "empty", J = w(!0);
308
+ H(() => {
309
+ var X;
310
+ if (J.current) {
311
+ J.current = !1;
312
+ return;
313
+ }
314
+ (X = B.current) == null || X.focus();
315
+ }, [x]);
316
+ const O = G((X) => P(X), []), $ = G(() => {
317
+ P(!1), z + 1 < t.length ? N(z + 1) : (N("verified"), r());
318
+ }, [z, t.length, r]), _ = y, U = a, u = pe(
319
+ () => ({
320
+ password: {
321
+ title: s("verifyIdentity.password.title"),
322
+ description: s("verifyIdentity.password.description")
323
+ },
324
+ authenticator: {
325
+ title: s("verifyIdentity.authenticator.title"),
326
+ description: s("verifyIdentity.authenticator.description")
327
+ },
328
+ sms: {
329
+ title: s("verifyIdentity.sms.title"),
330
+ description: _ ? s("verifyIdentity.sms.description", { phone: _ }) : s("verifyIdentity.sms.descriptionNoPhone")
331
+ },
332
+ email: {
333
+ title: s("verifyIdentity.email.title"),
334
+ description: U ? s("verifyIdentity.email.description", { email: U }) : s("verifyIdentity.email.descriptionNoEmail")
335
+ }
336
+ }),
337
+ [s, _, U]
338
+ ), A = le[i], ye = le[i + 1], ie = c && he(c) ? c : void 0;
339
+ let K = null, Q, W;
340
+ return I ? (Q = s("verifyIdentity.missingMobile.title"), W = s("verifyIdentity.missingMobile.description"), K = /* @__PURE__ */ m(
341
+ "div",
342
+ {
343
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
344
+ "data-slot": "missing-factor",
345
+ children: [
346
+ /* @__PURE__ */ e(S, { variant: "warning", announce: "off", children: /* @__PURE__ */ e(S.Description, { children: s("verifyIdentity.missingMobile.reason") }) }),
347
+ (p || ie) && (ie ? /* @__PURE__ */ e(
348
+ q,
349
+ {
350
+ asChild: !0,
351
+ intent: "primary",
352
+ size: "lg",
353
+ className: "ds:self-start",
354
+ children: /* @__PURE__ */ e("a", { href: ie, "data-action": "set-up-mobile", children: s("verifyIdentity.missingMobile.action") })
355
+ }
356
+ ) : /* @__PURE__ */ e(
357
+ q,
358
+ {
359
+ type: "button",
360
+ intent: "primary",
361
+ size: "lg",
362
+ "data-action": "set-up-mobile",
363
+ className: "ds:self-start",
364
+ onClick: p,
365
+ children: s("verifyIdentity.missingMobile.action")
366
+ }
367
+ ))
368
+ ]
369
+ }
370
+ )) : x === "verified" ? (Q = s("verifyIdentity.verified"), K = /* @__PURE__ */ m("p", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-success ds:m-0", children: [
371
+ /* @__PURE__ */ e(xe, { "aria-hidden": "true", className: "ds:size-4 ds:shrink-0" }),
372
+ /* @__PURE__ */ e("span", { children: s("verifyIdentity.verifiedDescription") })
373
+ ] })) : C && (Q = u[C].title, W = u[C].description, K = /* @__PURE__ */ e("div", { "data-step": C, children: C === "password" ? /* @__PURE__ */ e(
374
+ Ee,
375
+ {
376
+ verify: L,
377
+ onDone: $,
378
+ onBusyChange: O
379
+ }
380
+ ) : C === "authenticator" ? /* @__PURE__ */ e(
381
+ ne,
382
+ {
383
+ kind: "authenticator",
384
+ codeLength: d,
385
+ verify: h,
386
+ onDone: $,
387
+ onBusyChange: O
388
+ }
389
+ ) : C === "sms" ? /* @__PURE__ */ e(
390
+ ne,
391
+ {
392
+ kind: "sms",
393
+ codeLength: d,
394
+ send: V,
395
+ verify: E,
396
+ onDone: $,
397
+ onBusyChange: O
398
+ }
399
+ ) : /* @__PURE__ */ e(
400
+ ne,
401
+ {
402
+ kind: "email",
403
+ codeLength: d,
404
+ send: k,
405
+ verify: b,
406
+ onDone: $,
407
+ onBusyChange: O
408
+ }
409
+ ) }, `${C}-${z}`)), /* @__PURE__ */ m(
410
+ "div",
411
+ {
412
+ ref: R,
413
+ ...F,
414
+ "data-component": "verify-identity",
415
+ "data-state": te,
416
+ "data-step-index": I ? void 0 : z,
417
+ "data-step-count": t.length,
418
+ "data-submitting": j ? "true" : "false",
419
+ className: Ce({ className: T }),
420
+ children: [
421
+ !M && /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
422
+ /* @__PURE__ */ e(A, { id: v, className: "type-h3 ds:m-0", children: n ?? s("verifyIdentity.title") }),
423
+ /* @__PURE__ */ e("p", { className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]", children: l ?? s("verifyIdentity.description") })
424
+ ] }),
425
+ /* @__PURE__ */ m(
426
+ "div",
427
+ {
428
+ role: "group",
429
+ "aria-labelledby": o,
430
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
431
+ children: [
432
+ /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
433
+ t.length > 1 && !I && x !== "verified" && /* @__PURE__ */ e(
434
+ "p",
435
+ {
436
+ className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]",
437
+ "data-slot": "progress",
438
+ children: s("verifyIdentity.progress", {
439
+ current: z + 1,
440
+ total: t.length
441
+ })
442
+ }
443
+ ),
444
+ /* @__PURE__ */ e(
445
+ ye,
446
+ {
447
+ ref: B,
448
+ id: o,
449
+ tabIndex: -1,
450
+ className: De(),
451
+ children: Q
452
+ }
453
+ ),
454
+ W && /* @__PURE__ */ e("p", { className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]", children: W })
455
+ ] }),
456
+ K
457
+ ]
458
+ }
459
+ ),
460
+ g && x !== "verified" && /* @__PURE__ */ e(
461
+ q,
462
+ {
463
+ type: "button",
464
+ intent: "ghost",
465
+ "data-action": "cancel",
466
+ className: "ds:self-start",
467
+ onClick: g,
468
+ children: s("verifyIdentity.cancel")
469
+ }
470
+ )
471
+ ]
472
+ }
473
+ );
474
+ }
475
+ const de = ve(
476
+ (t, n) => (
477
+ // A new list of steps starts the flow again.
478
+ /* @__PURE__ */ e(
479
+ ke,
480
+ {
481
+ ...t,
482
+ forwardedRef: n
483
+ },
484
+ `${t.steps.join(",")}|${t.missingMobile ? "m" : ""}`
485
+ )
486
+ )
487
+ );
488
+ de.displayName = "VerifyIdentity";
489
+ function Oe({
490
+ open: t,
491
+ onOpenChange: n,
492
+ title: l,
493
+ description: i,
494
+ ...y
495
+ }) {
496
+ const { t: a } = Y("ui");
497
+ return /* @__PURE__ */ e(D.Root, { open: t, onOpenChange: n, children: /* @__PURE__ */ m(D.Content, { size: "md", children: [
498
+ /* @__PURE__ */ m(D.Header, { children: [
499
+ /* @__PURE__ */ e(D.Title, { children: l ?? a("verifyIdentity.title") }),
500
+ /* @__PURE__ */ e(D.Description, { children: i ?? a("verifyIdentity.description") })
501
+ ] }),
502
+ /* @__PURE__ */ e(D.Body, { children: /* @__PURE__ */ e(
503
+ de,
504
+ {
505
+ ...y,
506
+ hideHeader: !0,
507
+ onCancel: () => n(!1)
508
+ }
509
+ ) })
510
+ ] }) });
511
+ }
512
+ const Se = "type-h4 ds:m-0 ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]";
513
+ function Te({
514
+ onOpenChange: t,
515
+ onSubmitNewEmail: n,
516
+ ...l
517
+ }) {
518
+ const { t: i } = Y("ui"), [y, a] = f("verify"), [d, I] = f(""), [p, c] = f(""), [r, g] = f({}), [M, L] = f(), [h, V] = f(!1), E = w(null), k = w(null), b = w(null), T = w(null), R = se(), F = w(!0);
519
+ return H(() => (F.current = !0, () => {
520
+ F.current = !1;
521
+ }), []), H(() => {
522
+ var v, o;
523
+ y === "new-email" && ((v = E.current) == null || v.focus()), y === "done" && ((o = k.current) == null || o.focus());
524
+ }, [y]), y === "verify" ? /* @__PURE__ */ e(
525
+ de,
526
+ {
527
+ ...l,
528
+ hideHeader: !0,
529
+ onCancel: () => t(!1),
530
+ onVerified: () => a("new-email")
531
+ }
532
+ ) : y === "done" ? /* @__PURE__ */ m(
533
+ "div",
534
+ {
535
+ "data-component": "change-email-dialog",
536
+ "data-state": "done",
537
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
538
+ children: [
539
+ /* @__PURE__ */ m(
540
+ S,
541
+ {
542
+ ref: k,
543
+ variant: "success",
544
+ tabIndex: -1,
545
+ "aria-labelledby": R,
546
+ children: [
547
+ /* @__PURE__ */ e(S.Title, { as: "h3", id: R, children: i("verifyIdentity.changeEmail.doneTitle") }),
548
+ /* @__PURE__ */ e(S.Description, { children: i("verifyIdentity.changeEmail.doneDescription") })
549
+ ]
550
+ }
551
+ ),
552
+ /* @__PURE__ */ e(
553
+ q,
554
+ {
555
+ type: "button",
556
+ intent: "primary",
557
+ size: "lg",
558
+ "data-action": "close",
559
+ className: "ds:self-start",
560
+ onClick: () => t(!1),
561
+ children: i("verifyIdentity.changeEmail.close")
562
+ }
563
+ )
564
+ ]
565
+ }
566
+ ) : /* @__PURE__ */ m(
567
+ "form",
568
+ {
569
+ noValidate: !0,
570
+ onSubmit: async (v) => {
571
+ var j, P, B;
572
+ if (v.preventDefault(), h) return;
573
+ const o = {}, x = d.trim();
574
+ if (x === "" ? o.email = i("verifyIdentity.changeEmail.required") : ge(x) ? p.trim() !== x && (o.again = i("verifyIdentity.changeEmail.mismatch")) : o.email = i("inputs.email.invalid"), g(o), L(void 0), o.email || o.again) {
575
+ (j = (o.email ? b : T).current) == null || j.focus();
576
+ return;
577
+ }
578
+ V(!0);
579
+ let N;
580
+ try {
581
+ N = await n(x);
582
+ } catch {
583
+ N = { status: "error" };
584
+ }
585
+ if (F.current) {
586
+ if (V(!1), N.status === "ok") {
587
+ a("done");
588
+ return;
589
+ }
590
+ N.status === "already-in-use" ? (g({ email: i("verifyIdentity.changeEmail.alreadyInUse") }), (P = b.current) == null || P.focus()) : N.status === "invalid" ? (g({ email: i("verifyIdentity.changeEmail.invalid") }), (B = b.current) == null || B.focus()) : L(N.message ?? i("verifyIdentity.genericError"));
591
+ }
592
+ },
593
+ "aria-busy": h || void 0,
594
+ "data-component": "change-email-dialog",
595
+ "data-state": "new-email",
596
+ "data-submitting": h ? "true" : "false",
597
+ className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
598
+ children: [
599
+ /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
600
+ /* @__PURE__ */ e("h3", { ref: E, tabIndex: -1, className: Se, children: i("verifyIdentity.changeEmail.newTitle") }),
601
+ /* @__PURE__ */ e("p", { className: "type-body-sm ds:m-0 ds:text-[var(--muted-foreground)]", children: i("verifyIdentity.changeEmail.newDescription") })
602
+ ] }),
603
+ M && /* @__PURE__ */ e(S, { variant: "error", children: /* @__PURE__ */ e(S.Description, { children: M }) }),
604
+ /* @__PURE__ */ e(
605
+ ee,
606
+ {
607
+ label: i("verifyIdentity.changeEmail.newLabel"),
608
+ required: !0,
609
+ error: r.email,
610
+ children: /* @__PURE__ */ e(
611
+ oe,
612
+ {
613
+ ref: b,
614
+ type: "email",
615
+ inputMode: "email",
616
+ name: "newEmail",
617
+ autoComplete: "off",
618
+ value: d,
619
+ disabled: h,
620
+ onChange: (v) => {
621
+ I(v.target.value), g((o) => ({ ...o, email: void 0 }));
622
+ }
623
+ }
624
+ )
625
+ }
626
+ ),
627
+ /* @__PURE__ */ e(
628
+ ee,
629
+ {
630
+ label: i("verifyIdentity.changeEmail.confirmLabel"),
631
+ required: !0,
632
+ error: r.again,
633
+ children: /* @__PURE__ */ e(
634
+ oe,
635
+ {
636
+ ref: T,
637
+ type: "email",
638
+ inputMode: "email",
639
+ name: "newEmailConfirm",
640
+ autoComplete: "off",
641
+ value: p,
642
+ disabled: h,
643
+ onChange: (v) => {
644
+ c(v.target.value), g((o) => ({ ...o, again: void 0 }));
645
+ }
646
+ }
647
+ )
648
+ }
649
+ ),
650
+ /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-sm)]", children: [
651
+ /* @__PURE__ */ e(
652
+ q,
653
+ {
654
+ type: "submit",
655
+ intent: "primary",
656
+ size: "lg",
657
+ loading: h,
658
+ "data-action": "submit",
659
+ children: i("verifyIdentity.changeEmail.submit")
660
+ }
661
+ ),
662
+ /* @__PURE__ */ e(
663
+ q,
664
+ {
665
+ type: "button",
666
+ intent: "ghost",
667
+ size: "lg",
668
+ disabled: h,
669
+ "data-action": "cancel",
670
+ onClick: () => t(!1),
671
+ children: i("verifyIdentity.cancel")
672
+ }
673
+ )
674
+ ] })
675
+ ]
676
+ }
677
+ );
678
+ }
679
+ function Ye({
680
+ open: t,
681
+ onOpenChange: n,
682
+ title: l,
683
+ description: i,
684
+ ...y
685
+ }) {
686
+ const { t: a } = Y("ui");
687
+ return /* @__PURE__ */ e(D.Root, { open: t, onOpenChange: n, children: /* @__PURE__ */ m(D.Content, { size: "md", children: [
688
+ /* @__PURE__ */ m(D.Header, { children: [
689
+ /* @__PURE__ */ e(D.Title, { children: l ?? a("verifyIdentity.changeEmail.title") }),
690
+ /* @__PURE__ */ e(D.Description, { children: i ?? a("verifyIdentity.changeEmail.description") })
691
+ ] }),
692
+ /* @__PURE__ */ e(D.Body, { children: /* @__PURE__ */ e(Te, { onOpenChange: n, ...y }) })
693
+ ] }) });
694
+ }
695
+ const Ge = [
696
+ "password",
697
+ "authenticator",
698
+ "sms",
699
+ "email"
700
+ ];
701
+ export {
702
+ Ye as C,
703
+ Ge as V,
704
+ de as a,
705
+ Oe as b
706
+ };
707
+ //# sourceMappingURL=verify-identity-types-C85EXNzy.js.map