@alfadocs/ui-kit 0.45.0 → 0.47.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 (85) hide show
  1. package/dist/_chunks/alia-sidebar-CVIPrdc9.js +1125 -0
  2. package/dist/_chunks/{audio-recorder-C1rhKhSN.js → audio-recorder-DC-v9YFW.js} +81 -91
  3. package/dist/_chunks/{chat-input-CQe7nR_v.js → chat-input-CFwc7JxL.js} +2 -1
  4. package/dist/_chunks/{chat-message-ASgGtj-L.js → chat-message-B5JpFj0F.js} +79 -73
  5. package/dist/_chunks/code-block-HoddNOKJ.js +106 -0
  6. package/dist/_chunks/download-CDF1sbL9.js +16 -0
  7. package/dist/_chunks/{editable-currency-cell-renderer-BEBUQl9P.js → editable-currency-cell-renderer-CLil9B29.js} +283 -293
  8. package/dist/_chunks/{freemium-paywall-BYist2sJ.js → freemium-paywall-DzpD63WY.js} +2 -2
  9. package/dist/_chunks/mic-B4Gog3Gi.js +16 -0
  10. package/dist/_chunks/{payment-form-DqEiEJRO.js → payment-form-BNTx4876.js} +225 -196
  11. package/dist/_chunks/pencil-CfQX-0Qc.js +21 -0
  12. package/dist/_chunks/{streaming-text-GH07yIYh.js → streaming-text-CfhDqtIT.js} +49 -45
  13. package/dist/_chunks/{workflow-map-BFNpzTiw.js → workflow-map-Djn1QMJc.js} +135 -150
  14. package/dist/agent-catalog.json +1 -1
  15. package/dist/components/_shared/code-block.d.ts +39 -0
  16. package/dist/components/audio-recorder/index.js +1 -1
  17. package/dist/components/chat-input/index.js +1 -1
  18. package/dist/components/chat-message/chat-message.d.ts +6 -0
  19. package/dist/components/chat-message/index.js +1 -1
  20. package/dist/components/data-table/index.js +1 -1
  21. package/dist/components/freemium-paywall/index.js +1 -1
  22. package/dist/components/payment-form/index.js +1 -1
  23. package/dist/components/payment-form/payment-form.d.ts +6 -0
  24. package/dist/components/streaming-text/index.js +1 -1
  25. package/dist/components/workflow/index.js +1 -1
  26. package/dist/i18n/locales/ar.d.ts +15 -0
  27. package/dist/i18n/locales/ar.js +16 -1
  28. package/dist/i18n/locales/de.d.ts +15 -0
  29. package/dist/i18n/locales/de.js +16 -1
  30. package/dist/i18n/locales/el.d.ts +15 -0
  31. package/dist/i18n/locales/el.js +16 -1
  32. package/dist/i18n/locales/en.d.ts +15 -0
  33. package/dist/i18n/locales/en.js +16 -1
  34. package/dist/i18n/locales/es.d.ts +15 -0
  35. package/dist/i18n/locales/es.js +16 -1
  36. package/dist/i18n/locales/fr.d.ts +15 -0
  37. package/dist/i18n/locales/fr.js +16 -1
  38. package/dist/i18n/locales/hi.d.ts +15 -0
  39. package/dist/i18n/locales/hi.js +16 -1
  40. package/dist/i18n/locales/it.d.ts +15 -0
  41. package/dist/i18n/locales/it.js +16 -1
  42. package/dist/i18n/locales/ja.d.ts +15 -0
  43. package/dist/i18n/locales/ja.js +16 -1
  44. package/dist/i18n/locales/nl.d.ts +15 -0
  45. package/dist/i18n/locales/nl.js +16 -1
  46. package/dist/i18n/locales/pl.d.ts +15 -0
  47. package/dist/i18n/locales/pl.js +16 -1
  48. package/dist/i18n/locales/pt.d.ts +15 -0
  49. package/dist/i18n/locales/pt.js +16 -1
  50. package/dist/i18n/locales/ro.d.ts +15 -0
  51. package/dist/i18n/locales/ro.js +16 -1
  52. package/dist/i18n/locales/ru.d.ts +15 -0
  53. package/dist/i18n/locales/ru.js +16 -1
  54. package/dist/i18n/locales/sq.d.ts +15 -0
  55. package/dist/i18n/locales/sq.js +16 -1
  56. package/dist/i18n/locales/sv.d.ts +15 -0
  57. package/dist/i18n/locales/sv.js +16 -1
  58. package/dist/i18n/locales/tr.d.ts +15 -0
  59. package/dist/i18n/locales/tr.js +16 -1
  60. package/dist/i18n/locales/zh.d.ts +15 -0
  61. package/dist/i18n/locales/zh.js +16 -1
  62. package/dist/index.js +9 -9
  63. package/dist/locales/ar.json +16 -1
  64. package/dist/locales/de.json +16 -1
  65. package/dist/locales/el.json +16 -1
  66. package/dist/locales/en.json +16 -1
  67. package/dist/locales/es.json +16 -1
  68. package/dist/locales/fr.json +16 -1
  69. package/dist/locales/hi.json +16 -1
  70. package/dist/locales/it.json +16 -1
  71. package/dist/locales/ja.json +16 -1
  72. package/dist/locales/nl.json +16 -1
  73. package/dist/locales/pl.json +16 -1
  74. package/dist/locales/pt.json +16 -1
  75. package/dist/locales/ro.json +16 -1
  76. package/dist/locales/ru.json +16 -1
  77. package/dist/locales/sq.json +16 -1
  78. package/dist/locales/sv.json +16 -1
  79. package/dist/locales/tr.json +16 -1
  80. package/dist/locales/zh.json +16 -1
  81. package/dist/patterns/alia-assistant/alia-types.d.ts +61 -0
  82. package/dist/patterns/alia-assistant/index.js +1 -1
  83. package/dist/tokens.css +1 -1
  84. package/package.json +1 -1
  85. package/dist/_chunks/alia-sidebar-Be8FhKYd.js +0 -837
@@ -1,19 +1,19 @@
1
- import { jsx as t, jsxs as m, Fragment as oe } from "react/jsx-runtime";
2
- import { forwardRef as ie, useState as z, useEffect as D, useRef as q, useMemo as G, useImperativeHandle as de, useId as ce, useCallback as le } from "react";
3
- import { c as R } from "./index-D2ZczOXr.js";
4
- import { useTranslation as K } from "react-i18next";
5
- import { S as re } from "./spinner-OjQNn8oN.js";
6
- import { A as Q } from "./alert-ywPR59NE.js";
7
- import { loadStripe as me } from "@stripe/stripe-js";
8
- import { Elements as ue, useStripe as pe, useElements as fe, PaymentElement as be, AddressElement as ve } from "@stripe/react-stripe-js";
9
- import { u as ye } from "./registry-nPAVE19X.js";
10
- function te() {
1
+ import { jsx as t, jsxs as u, Fragment as ie } from "react/jsx-runtime";
2
+ import { forwardRef as de, useState as _, useEffect as D, useRef as G, useMemo as H, useImperativeHandle as ce, useId as le, useCallback as me } from "react";
3
+ import { c as A } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as W } from "react-i18next";
5
+ import { S as te } from "./spinner-OjQNn8oN.js";
6
+ import { A as ee } from "./alert-ywPR59NE.js";
7
+ import { loadStripe as ue } from "@stripe/stripe-js";
8
+ import { Elements as pe, useStripe as fe, useElements as be, PaymentElement as ye, AddressElement as ge } from "@stripe/react-stripe-js";
9
+ import { u as ve } from "./registry-nPAVE19X.js";
10
+ function ne() {
11
11
  return typeof document < "u" && typeof window < "u";
12
12
  }
13
- function H(r) {
14
- if (!te())
13
+ function O(r) {
14
+ if (!ne())
15
15
  return { theme: "stripe" };
16
- const n = r ?? document.documentElement, s = getComputedStyle(n), e = (a) => s.getPropertyValue(a).trim();
16
+ const n = r ?? document.documentElement, a = getComputedStyle(n), e = (s) => a.getPropertyValue(s).trim();
17
17
  return {
18
18
  theme: n.classList.contains("theme-dark") ? "night" : "stripe",
19
19
  variables: {
@@ -65,24 +65,46 @@ function H(r) {
65
65
  borderColor: e("--primary"),
66
66
  backgroundColor: e("--background"),
67
67
  color: e("--primary")
68
+ },
69
+ // Accordion method rows (the `accordion` layout): keep Stripe's native
70
+ // per-method card structure, restyled with our tokens — our border +
71
+ // radius, our background, `--primary` on the selected row, no extra shadow.
72
+ ".AccordionItem": {
73
+ backgroundColor: e("--background"),
74
+ border: `1px solid ${e("--border")}`,
75
+ borderRadius: e("--radius-md"),
76
+ boxShadow: "none"
77
+ },
78
+ ".AccordionItem--selected": {
79
+ borderColor: e("--primary"),
80
+ backgroundColor: e("--background")
81
+ },
82
+ // Stripe's in-method notice blocks (e.g. PayPal's "you'll be redirected")
83
+ // otherwise render in their own bordered box — a card nested inside the
84
+ // selected method card. Flatten to inline icon + text, no inner box.
85
+ ".Block": {
86
+ border: "none",
87
+ borderRadius: "0",
88
+ boxShadow: "none",
89
+ backgroundColor: "transparent"
68
90
  }
69
91
  }
70
92
  };
71
93
  }
72
- function ge(r, n) {
73
- if (!te()) return () => {
94
+ function he(r, n) {
95
+ if (!ne()) return () => {
74
96
  };
75
- const s = document.documentElement, e = () => r(H(n)), o = new MutationObserver(e);
76
- o.observe(s, {
97
+ const a = document.documentElement, e = () => r(O(n)), o = new MutationObserver(e);
98
+ o.observe(a, {
77
99
  attributes: !0,
78
100
  attributeFilter: ["class", "dir", "lang"]
79
101
  });
80
- const a = window.matchMedia("(prefers-color-scheme: dark)"), c = window.matchMedia("(prefers-reduced-motion: reduce)");
81
- return a.addEventListener("change", e), c.addEventListener("change", e), () => {
82
- o.disconnect(), a.removeEventListener("change", e), c.removeEventListener("change", e);
102
+ const s = window.matchMedia("(prefers-color-scheme: dark)"), c = window.matchMedia("(prefers-reduced-motion: reduce)");
103
+ return s.addEventListener("change", e), c.addEventListener("change", e), () => {
104
+ o.disconnect(), s.removeEventListener("change", e), c.removeEventListener("change", e);
83
105
  };
84
106
  }
85
- const he = {
107
+ const we = {
86
108
  id: "payment-form",
87
109
  capabilities: ["submit"],
88
110
  state: {},
@@ -108,7 +130,7 @@ const he = {
108
130
  description: "Sourced from the id prop."
109
131
  }
110
132
  }
111
- }, we = /* @__PURE__ */ new Set([
133
+ }, xe = /* @__PURE__ */ new Set([
112
134
  "BIF",
113
135
  "CLP",
114
136
  "DJF",
@@ -127,10 +149,10 @@ const he = {
127
149
  "XOF",
128
150
  "XPF"
129
151
  ]);
130
- function O(r, n, s) {
131
- const e = n.toUpperCase(), o = we.has(e) ? r : r / 100;
152
+ function K(r, n, a) {
153
+ const e = n.toUpperCase(), o = xe.has(e) ? r : r / 100;
132
154
  try {
133
- return new Intl.NumberFormat(s, {
155
+ return new Intl.NumberFormat(a, {
134
156
  style: "currency",
135
157
  currency: e
136
158
  }).format(o);
@@ -141,21 +163,21 @@ function O(r, n, s) {
141
163
  }).format(o);
142
164
  }
143
165
  }
144
- function xe(r) {
166
+ function ke(r) {
145
167
  if (r === void 0) return null;
146
168
  const n = r.trim();
147
169
  if (n === "" || typeof window > "u") return null;
148
170
  try {
149
- const s = new URL(n, window.location.href);
150
- return !(/* @__PURE__ */ new Set(["http:", "https:"])).has(s.protocol) || s.origin !== window.location.origin ? null : s.toString();
171
+ const a = new URL(n, window.location.href);
172
+ return !(/* @__PURE__ */ new Set(["http:", "https:"])).has(a.protocol) || a.origin !== window.location.origin ? null : a.toString();
151
173
  } catch {
152
174
  return null;
153
175
  }
154
176
  }
155
- function Ee(r) {
177
+ function Ce(r) {
156
178
  return r && r.replace(/\d{4,}/g, "****");
157
179
  }
158
- function Ne(r) {
180
+ function Ee(r) {
159
181
  switch (r) {
160
182
  case "incorrect_number":
161
183
  case "invalid_number":
@@ -181,20 +203,21 @@ function Ne(r) {
181
203
  return "payment.error.generic";
182
204
  }
183
205
  }
184
- const ke = R(
206
+ const Ie = A(
185
207
  [
186
208
  "ds:payment-form-alfadocs ds:flex ds:flex-col",
187
209
  "ds:gap-[var(--spacing-md)]",
188
- "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
189
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)] ds:shadow-[var(--shadow-card)] ds:[.theme-accessible_&]:border-2",
190
- "ds:p-[var(--spacing-md)]",
210
+ // Transparent, padding-less container — the consuming surface (a Card, the
211
+ // check-in step, a checkout column) owns the card chrome + padding, so the
212
+ // Stripe method boxes never read as cards nested inside another card.
213
+ "ds:text-[var(--foreground)]",
191
214
  "ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
192
215
  ].join(" ")
193
- ), V = R(
216
+ ), B = A(
194
217
  ["ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"].join(" ")
195
- ), F = R(
218
+ ), z = A(
196
219
  ["type-label", "ds:text-[var(--foreground)]"].join(" ")
197
- ), ne = R(
220
+ ), ae = A(
198
221
  [
199
222
  "ds:flex ds:items-baseline ds:justify-between",
200
223
  "ds:gap-[var(--spacing-sm)]",
@@ -204,7 +227,7 @@ const ke = R(
204
227
  "ds:rounded-[var(--radius-sm)]",
205
228
  "ds:text-[var(--foreground)]"
206
229
  ].join(" ")
207
- ), se = R(
230
+ ), se = A(
208
231
  [
209
232
  "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]",
210
233
  "ds:[min-block-size:var(--min-target-size)]",
@@ -224,175 +247,179 @@ const ke = R(
224
247
  "ds:aria-busy:cursor-wait"
225
248
  ].join(" ")
226
249
  );
227
- function Ce(r) {
250
+ function Ne(r) {
228
251
  const {
229
252
  amount: n,
230
- currency: s,
253
+ currency: a,
231
254
  locale: e,
232
255
  billingAddress: o,
233
- returnUrl: a,
256
+ returnUrl: s,
234
257
  clientSecret: c,
235
258
  onCreatePaymentIntent: I,
236
- onSuccess: P,
237
- onError: _
238
- } = r, { t: i } = K(), h = pe(), v = fe(), w = ce(), y = G(
239
- () => `pay-${w.replace(/[^a-zA-Z0-9-_]/g, "")}`,
240
- [w]
241
- ), M = `${y}-payment`, T = `${y}-address`, g = `${y}-error`, [u, x] = z(!1), [L, U] = z(!1), [E, S] = z(null), [j, l] = z(""), d = q(P), N = q(_);
259
+ onSuccess: F,
260
+ onError: N,
261
+ layout: V
262
+ } = r, { t: i } = W(), h = fe(), l = be(), R = le(), g = H(
263
+ () => `pay-${R.replace(/[^a-zA-Z0-9-_]/g, "")}`,
264
+ [R]
265
+ ), M = `${g}-payment`, T = `${g}-address`, v = `${g}-error`, [p, w] = _(!1), [P, U] = _(!1), [x, S] = _(null), [$, m] = _(""), d = G(F), k = G(N);
242
266
  D(() => {
243
- d.current = P, N.current = _;
244
- }, [P, _]);
245
- const B = le(
246
- async (p) => {
247
- var X, Z, J;
248
- if (p && p.preventDefault(), !h || !v || u) return;
249
- x(!0), S(null), l("");
250
- const k = (f, A) => {
251
- var Y;
252
- const b = Ne(f), C = Ee(A ?? "");
253
- S(b), l(i(b)), (Y = N.current) == null || Y.call(N, {
254
- code: f,
255
- translatedMessage: C || i(b)
267
+ d.current = F, k.current = N;
268
+ }, [F, N]);
269
+ const j = me(
270
+ async (f) => {
271
+ var Z, J, Y;
272
+ if (f && f.preventDefault(), !h || !l || p) return;
273
+ w(!0), S(null), m("");
274
+ const C = (b, L) => {
275
+ var Q;
276
+ const y = Ee(b), E = Ce(L ?? "");
277
+ S(y), m(i(y)), (Q = k.current) == null || Q.call(k, {
278
+ code: b,
279
+ translatedMessage: E || i(y)
256
280
  });
257
- }, $ = xe(a);
258
- if (a !== void 0 && $ === null) {
259
- S("payment.error.invalidReturnUrl"), l(i("payment.error.invalidReturnUrl")), (X = N.current) == null || X.call(N, {
281
+ }, q = ke(s);
282
+ if (s !== void 0 && q === null) {
283
+ S("payment.error.invalidReturnUrl"), m(i("payment.error.invalidReturnUrl")), (Z = k.current) == null || Z.call(k, {
260
284
  code: "invalid_return_url",
261
285
  translatedMessage: i("payment.error.invalidReturnUrl")
262
- }), x(!1);
286
+ }), w(!1);
263
287
  return;
264
288
  }
265
- const W = $ ? { return_url: $ } : {};
289
+ const X = q ? { return_url: q } : {};
266
290
  try {
267
291
  if (c !== void 0) {
268
- const C = await h.confirmPayment({
269
- elements: v,
270
- confirmParams: W,
292
+ const E = await h.confirmPayment({
293
+ elements: l,
294
+ confirmParams: X,
271
295
  redirect: "if_required"
272
296
  });
273
- if (C.error) {
274
- k(C.error.code ?? "generic", C.error.message);
297
+ if (E.error) {
298
+ C(E.error.code ?? "generic", E.error.message);
275
299
  return;
276
300
  }
277
- C.paymentIntent && ((Z = d.current) == null || Z.call(d, C.paymentIntent.id));
301
+ E.paymentIntent && ((J = d.current) == null || J.call(d, E.paymentIntent.id));
278
302
  return;
279
303
  }
280
- const { error: f } = await v.submit();
281
- if (f) {
282
- k(f.code ?? "generic", f.message);
304
+ const { error: b } = await l.submit();
305
+ if (b) {
306
+ C(b.code ?? "generic", b.message);
283
307
  return;
284
308
  }
285
309
  if (!I)
286
310
  return;
287
- const A = await I(), b = await h.confirmPayment({
288
- elements: v,
289
- clientSecret: A,
290
- confirmParams: W,
311
+ const L = await I(), y = await h.confirmPayment({
312
+ elements: l,
313
+ clientSecret: L,
314
+ confirmParams: X,
291
315
  redirect: "if_required"
292
316
  });
293
- if (b.error) {
294
- k(b.error.code ?? "generic", b.error.message);
317
+ if (y.error) {
318
+ C(y.error.code ?? "generic", y.error.message);
295
319
  return;
296
320
  }
297
- b.paymentIntent && ((J = d.current) == null || J.call(d, b.paymentIntent.id));
298
- } catch (f) {
299
- const A = f instanceof Error ? f.message : "";
300
- k("unexpected", A);
321
+ y.paymentIntent && ((Y = d.current) == null || Y.call(d, y.paymentIntent.id));
322
+ } catch (b) {
323
+ const L = b instanceof Error ? b.message : "";
324
+ C("unexpected", L);
301
325
  } finally {
302
- x(!1);
326
+ w(!1);
303
327
  }
304
328
  },
305
329
  [
306
330
  h,
307
- v,
308
- u,
309
- a,
331
+ l,
332
+ p,
333
+ s,
310
334
  c,
311
335
  I,
312
336
  i
313
337
  ]
314
338
  );
315
339
  D(() => {
316
- const p = document.getElementById(y);
317
- if (!p) return;
318
- const k = () => {
319
- B();
340
+ const f = document.getElementById(g);
341
+ if (!f) return;
342
+ const C = () => {
343
+ j();
320
344
  };
321
- return p.addEventListener("payment-form:submit", k), () => p.removeEventListener("payment-form:submit", k);
322
- }, [y, B]);
323
- const ae = !h || !v || u || !(c === void 0 && !I) && !L;
345
+ return f.addEventListener("payment-form:submit", C), () => f.removeEventListener("payment-form:submit", C);
346
+ }, [g, j]);
347
+ const oe = !h || !l || p || !(c === void 0 && !I) && !P;
324
348
  return /* @__PURE__ */ t(
325
349
  "form",
326
350
  {
327
- id: y,
328
- onSubmit: B,
351
+ id: g,
352
+ onSubmit: j,
329
353
  "aria-label": i("payment.ariaLabel"),
330
- "aria-busy": u || void 0,
354
+ "aria-busy": p || void 0,
331
355
  noValidate: !0,
332
- children: /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
333
- /* @__PURE__ */ m("div", { className: ne(), children: [
334
- /* @__PURE__ */ t("span", { className: F(), children: i("payment.amountLabel") }),
335
- /* @__PURE__ */ t("span", { className: "type-title-card", "data-testid": "payment-amount", children: O(n, s, e) })
356
+ children: /* @__PURE__ */ u("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
357
+ /* @__PURE__ */ u("div", { className: ae(), children: [
358
+ /* @__PURE__ */ t("span", { className: z(), children: i("payment.amountLabel") }),
359
+ /* @__PURE__ */ t("span", { className: "type-title-card", "data-testid": "payment-amount", children: K(n, a, e) })
336
360
  ] }),
337
- /* @__PURE__ */ m(
361
+ /* @__PURE__ */ u(
338
362
  "label",
339
363
  {
340
364
  htmlFor: M,
341
- className: V(),
365
+ className: B(),
342
366
  "data-testid": "payment-field",
343
367
  children: [
344
- /* @__PURE__ */ t("span", { className: F(), children: i("payment.fields.card") }),
368
+ /* @__PURE__ */ t("span", { className: z(), children: i("payment.fields.card") }),
345
369
  /* @__PURE__ */ t(
346
- be,
370
+ ye,
347
371
  {
348
372
  id: M,
349
373
  options: {
350
- layout: { type: "accordion", defaultCollapsed: !1 }
374
+ // `tabs` = method tiles (Card selected by default); `accordion`
375
+ // = full-width stacked rows for narrow columns where the tab row
376
+ // clips. Stripe owns overflow + tab alignment either way.
377
+ layout: V === "accordion" ? { type: "accordion", defaultCollapsed: !0 } : { type: "tabs" }
351
378
  },
352
- onChange: (p) => {
353
- U(p.complete === !0), p.complete && (S(null), l(""));
379
+ onChange: (f) => {
380
+ U(f.complete === !0), f.complete && (S(null), m(""));
354
381
  }
355
382
  }
356
383
  )
357
384
  ]
358
385
  }
359
386
  ),
360
- o ? /* @__PURE__ */ m(
387
+ o ? /* @__PURE__ */ u(
361
388
  "label",
362
389
  {
363
390
  htmlFor: T,
364
- className: V(),
391
+ className: B(),
365
392
  "data-testid": "payment-address",
366
393
  children: [
367
- /* @__PURE__ */ t("span", { className: F(), children: i("payment.billingAddress") }),
368
- /* @__PURE__ */ t(ve, { id: T, options: { mode: "billing" } })
394
+ /* @__PURE__ */ t("span", { className: z(), children: i("payment.billingAddress") }),
395
+ /* @__PURE__ */ t(ge, { id: T, options: { mode: "billing" } })
369
396
  ]
370
397
  }
371
398
  ) : null,
372
- E ? /* @__PURE__ */ t(
373
- Q,
399
+ x ? /* @__PURE__ */ t(
400
+ ee,
374
401
  {
375
- id: g,
402
+ id: v,
376
403
  variant: "error",
377
404
  live: "polite",
378
405
  "data-testid": "payment-error",
379
- children: /* @__PURE__ */ t(Q.Description, { children: j })
406
+ children: /* @__PURE__ */ t(ee.Description, { children: $ })
380
407
  }
381
408
  ) : null,
382
409
  /* @__PURE__ */ t(
383
410
  "button",
384
411
  {
385
412
  type: "submit",
386
- "aria-disabled": ae || void 0,
387
- "aria-busy": u || void 0,
388
- "aria-describedby": E ? g : void 0,
413
+ "aria-disabled": oe || void 0,
414
+ "aria-busy": p || void 0,
415
+ "aria-describedby": x ? v : void 0,
389
416
  className: se(),
390
417
  "data-testid": "payment-submit",
391
- children: u ? /* @__PURE__ */ m(oe, { children: [
392
- /* @__PURE__ */ t(re, { size: "sm", label: i("payment.processing") }),
418
+ children: p ? /* @__PURE__ */ u(ie, { children: [
419
+ /* @__PURE__ */ t(te, { size: "sm", label: i("payment.processing") }),
393
420
  /* @__PURE__ */ t("span", { children: i("payment.processing") })
394
421
  ] }) : /* @__PURE__ */ t("span", { children: i("payment.submit", {
395
- amount: O(n, s, e)
422
+ amount: K(n, a, e)
396
423
  }) })
397
424
  }
398
425
  )
@@ -400,7 +427,7 @@ function Ce(r) {
400
427
  }
401
428
  );
402
429
  }
403
- const ee = /* @__PURE__ */ new Set([
430
+ const re = /* @__PURE__ */ new Set([
404
431
  "auto",
405
432
  "ar",
406
433
  "bg",
@@ -452,127 +479,129 @@ const ee = /* @__PURE__ */ new Set([
452
479
  "zh-HK",
453
480
  "zh-TW"
454
481
  ]);
455
- function Ie(r) {
482
+ function Se(r) {
456
483
  if (!r) return "auto";
457
484
  const n = r === "cn" ? "zh" : r;
458
- if (ee.has(n))
485
+ if (re.has(n))
459
486
  return n;
460
- const s = n.split("-")[0];
461
- return ee.has(s) ? s : "auto";
487
+ const a = n.split("-")[0];
488
+ return re.has(a) ? a : "auto";
462
489
  }
463
- const _e = ie(
490
+ const _e = de(
464
491
  ({
465
492
  id: r,
466
493
  clientSecret: n,
467
- mode: s = "payment",
494
+ mode: a = "payment",
468
495
  onCreatePaymentIntent: e,
469
496
  publishableKey: o,
470
- currency: a,
497
+ currency: s,
471
498
  amount: c,
472
499
  onSuccess: I,
473
- onError: P,
474
- billingAddress: _ = !1,
475
- locale: i,
476
- ariaLabel: h,
477
- returnUrl: v,
478
- stripePromise: w,
479
- className: y
500
+ onError: F,
501
+ billingAddress: N = !1,
502
+ locale: V,
503
+ ariaLabel: i,
504
+ returnUrl: h,
505
+ stripePromise: l,
506
+ layout: R = "tabs",
507
+ className: g
480
508
  }, M) => {
481
- const { i18n: T } = K(), g = Ie(i ?? T.language ?? "en"), [u, x] = z(w ?? null);
509
+ const { i18n: T } = W(), v = Se(V ?? T.language ?? "en"), [p, w] = _(l ?? null);
482
510
  D(() => {
483
- if (w !== void 0) {
484
- x(w);
511
+ if (l !== void 0) {
512
+ w(l);
485
513
  return;
486
514
  }
487
515
  if (!o) {
488
- x(null);
516
+ w(null);
489
517
  return;
490
518
  }
491
- x(me(o));
492
- }, [w, o]);
493
- const [L, U] = z(
494
- () => H()
519
+ w(ue(o));
520
+ }, [l, o]);
521
+ const [P, U] = _(
522
+ () => O()
495
523
  );
496
- D(() => (U(H()), ge(U)), []);
497
- const E = q(null), S = G(
524
+ D(() => (U(O()), he(U)), []);
525
+ const x = G(null), S = H(
498
526
  () => ({
499
527
  submit: async () => {
500
528
  var d;
501
- const l = (d = E.current) == null ? void 0 : d.querySelector("form");
502
- l && l.dispatchEvent(
529
+ const m = (d = x.current) == null ? void 0 : d.querySelector("form");
530
+ m && m.dispatchEvent(
503
531
  new CustomEvent("payment-form:submit", { bubbles: !0 })
504
532
  );
505
533
  },
506
534
  reset: () => {
507
535
  var d;
508
- const l = (d = E.current) == null ? void 0 : d.querySelector("form");
509
- l instanceof HTMLFormElement && l.reset();
536
+ const m = (d = x.current) == null ? void 0 : d.querySelector("form");
537
+ m instanceof HTMLFormElement && m.reset();
510
538
  }
511
539
  }),
512
540
  []
513
541
  );
514
- de(M, () => E.current, []), ye(he, S, r);
515
- const j = G(
542
+ ce(M, () => x.current, []), ve(we, S, r);
543
+ const $ = H(
516
544
  () => n !== void 0 ? (
517
545
  // Immediate mode — the consumer already created the intent.
518
- { clientSecret: n, appearance: L, locale: g }
546
+ { clientSecret: n, appearance: P, locale: v }
519
547
  ) : (
520
548
  // Deferred-intent mode — no secret yet; Stripe needs the intent
521
549
  // shape (mode + amount + currency) to render the Payment Element.
522
550
  // Stripe expects a lowercase ISO-4217 currency here.
523
551
  {
524
- mode: s,
552
+ mode: a,
525
553
  amount: c,
526
- currency: a.toLowerCase(),
527
- appearance: L,
528
- locale: g
554
+ currency: s.toLowerCase(),
555
+ appearance: P,
556
+ locale: v
529
557
  }
530
558
  ),
531
- [n, s, c, a, L, g]
559
+ [n, a, c, s, P, v]
532
560
  );
533
561
  return /* @__PURE__ */ t(
534
562
  "div",
535
563
  {
536
- ref: E,
537
- "aria-label": h,
538
- className: [ke(), y].filter(Boolean).join(" "),
564
+ ref: x,
565
+ "aria-label": i,
566
+ className: [Ie(), g].filter(Boolean).join(" "),
539
567
  "data-component": "payment-form",
540
568
  "data-component-id": r,
541
569
  "data-testid": "payment-form-root",
542
- children: u ? (
570
+ children: p ? (
543
571
  // Render the real Payment Element whenever a Stripe instance is
544
572
  // available — in immediate mode (clientSecret present) AND in
545
573
  // deferred mode (no secret). The skeleton is reserved for the
546
574
  // no-Stripe case (missing publishableKey / injected null).
547
575
  /* @__PURE__ */ t(
548
- ue,
576
+ pe,
549
577
  {
550
- stripe: u,
551
- options: j,
578
+ stripe: p,
579
+ options: $,
552
580
  children: /* @__PURE__ */ t(
553
- Ce,
581
+ Ne,
554
582
  {
555
583
  amount: c,
556
- currency: a,
557
- locale: g,
558
- billingAddress: _,
559
- returnUrl: v,
584
+ currency: s,
585
+ locale: v,
586
+ billingAddress: N,
587
+ returnUrl: h,
560
588
  clientSecret: n,
561
589
  onCreatePaymentIntent: e,
562
590
  onSuccess: I,
563
- onError: P
591
+ onError: F,
592
+ layout: R
564
593
  }
565
594
  )
566
595
  },
567
596
  n ?? "deferred"
568
597
  )
569
598
  ) : /* @__PURE__ */ t(
570
- Se,
599
+ ze,
571
600
  {
572
601
  amount: c,
573
- currency: a,
574
- locale: g,
575
- billingAddress: _
602
+ currency: s,
603
+ locale: v,
604
+ billingAddress: N
576
605
  }
577
606
  )
578
607
  }
@@ -580,21 +609,21 @@ const _e = ie(
580
609
  }
581
610
  );
582
611
  _e.displayName = "PaymentForm";
583
- function Se(r) {
584
- const { amount: n, currency: s, locale: e, billingAddress: o } = r, { t: a } = K();
585
- return /* @__PURE__ */ m(
612
+ function ze(r) {
613
+ const { amount: n, currency: a, locale: e, billingAddress: o } = r, { t: s } = W();
614
+ return /* @__PURE__ */ u(
586
615
  "div",
587
616
  {
588
617
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
589
618
  "data-testid": "payment-skeleton",
590
619
  "aria-busy": "true",
591
620
  children: [
592
- /* @__PURE__ */ m("div", { className: ne(), children: [
593
- /* @__PURE__ */ t("span", { className: F(), children: a("payment.amountLabel") }),
594
- /* @__PURE__ */ t("span", { className: "type-title-card", children: O(n, s, e) })
621
+ /* @__PURE__ */ u("div", { className: ae(), children: [
622
+ /* @__PURE__ */ t("span", { className: z(), children: s("payment.amountLabel") }),
623
+ /* @__PURE__ */ t("span", { className: "type-title-card", children: K(n, a, e) })
595
624
  ] }),
596
- /* @__PURE__ */ m("div", { className: V(), children: [
597
- /* @__PURE__ */ t("span", { className: F(), children: a("payment.fields.card") }),
625
+ /* @__PURE__ */ u("div", { className: B(), children: [
626
+ /* @__PURE__ */ t("span", { className: z(), children: s("payment.fields.card") }),
598
627
  /* @__PURE__ */ t(
599
628
  "div",
600
629
  {
@@ -603,8 +632,8 @@ function Se(r) {
603
632
  }
604
633
  )
605
634
  ] }),
606
- o ? /* @__PURE__ */ m("div", { className: V(), "data-testid": "payment-address", children: [
607
- /* @__PURE__ */ t("span", { className: F(), children: a("payment.billingAddress") }),
635
+ o ? /* @__PURE__ */ u("div", { className: B(), "data-testid": "payment-address", children: [
636
+ /* @__PURE__ */ t("span", { className: z(), children: s("payment.billingAddress") }),
608
637
  /* @__PURE__ */ t(
609
638
  "div",
610
639
  {
@@ -613,7 +642,7 @@ function Se(r) {
613
642
  }
614
643
  )
615
644
  ] }) : null,
616
- /* @__PURE__ */ m(
645
+ /* @__PURE__ */ u(
617
646
  "button",
618
647
  {
619
648
  type: "button",
@@ -621,8 +650,8 @@ function Se(r) {
621
650
  className: se(),
622
651
  disabled: !0,
623
652
  children: [
624
- /* @__PURE__ */ t(re, { size: "sm", label: a("payment.processing") }),
625
- /* @__PURE__ */ t("span", { children: a("payment.processing") })
653
+ /* @__PURE__ */ t(te, { size: "sm", label: s("payment.processing") }),
654
+ /* @__PURE__ */ t("span", { children: s("payment.processing") })
626
655
  ]
627
656
  }
628
657
  )
@@ -632,11 +661,11 @@ function Se(r) {
632
661
  }
633
662
  export {
634
663
  _e as P,
635
- ke as a,
636
- Ee as b,
637
- Ne as c,
638
- O as f,
639
- he as p,
664
+ Ie as a,
665
+ Ce as b,
666
+ Ee as c,
667
+ K as f,
668
+ we as p,
640
669
  se as s
641
670
  };
642
- //# sourceMappingURL=payment-form-DqEiEJRO.js.map
671
+ //# sourceMappingURL=payment-form-BNTx4876.js.map