@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.
- package/dist/_chunks/alia-sidebar-CVIPrdc9.js +1125 -0
- package/dist/_chunks/{audio-recorder-C1rhKhSN.js → audio-recorder-DC-v9YFW.js} +81 -91
- package/dist/_chunks/{chat-input-CQe7nR_v.js → chat-input-CFwc7JxL.js} +2 -1
- package/dist/_chunks/{chat-message-ASgGtj-L.js → chat-message-B5JpFj0F.js} +79 -73
- package/dist/_chunks/code-block-HoddNOKJ.js +106 -0
- package/dist/_chunks/download-CDF1sbL9.js +16 -0
- package/dist/_chunks/{editable-currency-cell-renderer-BEBUQl9P.js → editable-currency-cell-renderer-CLil9B29.js} +283 -293
- package/dist/_chunks/{freemium-paywall-BYist2sJ.js → freemium-paywall-DzpD63WY.js} +2 -2
- package/dist/_chunks/mic-B4Gog3Gi.js +16 -0
- package/dist/_chunks/{payment-form-DqEiEJRO.js → payment-form-BNTx4876.js} +225 -196
- package/dist/_chunks/pencil-CfQX-0Qc.js +21 -0
- package/dist/_chunks/{streaming-text-GH07yIYh.js → streaming-text-CfhDqtIT.js} +49 -45
- package/dist/_chunks/{workflow-map-BFNpzTiw.js → workflow-map-Djn1QMJc.js} +135 -150
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/code-block.d.ts +39 -0
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/chat-input/index.js +1 -1
- package/dist/components/chat-message/chat-message.d.ts +6 -0
- package/dist/components/chat-message/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +6 -0
- package/dist/components/streaming-text/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +15 -0
- package/dist/i18n/locales/ar.js +16 -1
- package/dist/i18n/locales/de.d.ts +15 -0
- package/dist/i18n/locales/de.js +16 -1
- package/dist/i18n/locales/el.d.ts +15 -0
- package/dist/i18n/locales/el.js +16 -1
- package/dist/i18n/locales/en.d.ts +15 -0
- package/dist/i18n/locales/en.js +16 -1
- package/dist/i18n/locales/es.d.ts +15 -0
- package/dist/i18n/locales/es.js +16 -1
- package/dist/i18n/locales/fr.d.ts +15 -0
- package/dist/i18n/locales/fr.js +16 -1
- package/dist/i18n/locales/hi.d.ts +15 -0
- package/dist/i18n/locales/hi.js +16 -1
- package/dist/i18n/locales/it.d.ts +15 -0
- package/dist/i18n/locales/it.js +16 -1
- package/dist/i18n/locales/ja.d.ts +15 -0
- package/dist/i18n/locales/ja.js +16 -1
- package/dist/i18n/locales/nl.d.ts +15 -0
- package/dist/i18n/locales/nl.js +16 -1
- package/dist/i18n/locales/pl.d.ts +15 -0
- package/dist/i18n/locales/pl.js +16 -1
- package/dist/i18n/locales/pt.d.ts +15 -0
- package/dist/i18n/locales/pt.js +16 -1
- package/dist/i18n/locales/ro.d.ts +15 -0
- package/dist/i18n/locales/ro.js +16 -1
- package/dist/i18n/locales/ru.d.ts +15 -0
- package/dist/i18n/locales/ru.js +16 -1
- package/dist/i18n/locales/sq.d.ts +15 -0
- package/dist/i18n/locales/sq.js +16 -1
- package/dist/i18n/locales/sv.d.ts +15 -0
- package/dist/i18n/locales/sv.js +16 -1
- package/dist/i18n/locales/tr.d.ts +15 -0
- package/dist/i18n/locales/tr.js +16 -1
- package/dist/i18n/locales/zh.d.ts +15 -0
- package/dist/i18n/locales/zh.js +16 -1
- package/dist/index.js +9 -9
- package/dist/locales/ar.json +16 -1
- package/dist/locales/de.json +16 -1
- package/dist/locales/el.json +16 -1
- package/dist/locales/en.json +16 -1
- package/dist/locales/es.json +16 -1
- package/dist/locales/fr.json +16 -1
- package/dist/locales/hi.json +16 -1
- package/dist/locales/it.json +16 -1
- package/dist/locales/ja.json +16 -1
- package/dist/locales/nl.json +16 -1
- package/dist/locales/pl.json +16 -1
- package/dist/locales/pt.json +16 -1
- package/dist/locales/ro.json +16 -1
- package/dist/locales/ru.json +16 -1
- package/dist/locales/sq.json +16 -1
- package/dist/locales/sv.json +16 -1
- package/dist/locales/tr.json +16 -1
- package/dist/locales/zh.json +16 -1
- package/dist/patterns/alia-assistant/alia-types.d.ts +61 -0
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/alia-sidebar-Be8FhKYd.js +0 -837
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { S as
|
|
6
|
-
import { A as
|
|
7
|
-
import { loadStripe as
|
|
8
|
-
import { Elements as
|
|
9
|
-
import { u as
|
|
10
|
-
function
|
|
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
|
|
14
|
-
if (!
|
|
13
|
+
function O(r) {
|
|
14
|
+
if (!ne())
|
|
15
15
|
return { theme: "stripe" };
|
|
16
|
-
const n = r ?? document.documentElement,
|
|
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
|
|
73
|
-
if (!
|
|
94
|
+
function he(r, n) {
|
|
95
|
+
if (!ne()) return () => {
|
|
74
96
|
};
|
|
75
|
-
const
|
|
76
|
-
o.observe(
|
|
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
|
|
81
|
-
return
|
|
82
|
-
o.disconnect(),
|
|
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
|
|
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
|
-
},
|
|
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
|
|
131
|
-
const e = n.toUpperCase(), o =
|
|
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(
|
|
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
|
|
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
|
|
150
|
-
return !(/* @__PURE__ */ new Set(["http:", "https:"])).has(
|
|
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
|
|
177
|
+
function Ce(r) {
|
|
156
178
|
return r && r.replace(/\d{4,}/g, "****");
|
|
157
179
|
}
|
|
158
|
-
function
|
|
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
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
),
|
|
216
|
+
), B = A(
|
|
194
217
|
["ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"].join(" ")
|
|
195
|
-
),
|
|
218
|
+
), z = A(
|
|
196
219
|
["type-label", "ds:text-[var(--foreground)]"].join(" ")
|
|
197
|
-
),
|
|
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 =
|
|
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
|
|
250
|
+
function Ne(r) {
|
|
228
251
|
const {
|
|
229
252
|
amount: n,
|
|
230
|
-
currency:
|
|
253
|
+
currency: a,
|
|
231
254
|
locale: e,
|
|
232
255
|
billingAddress: o,
|
|
233
|
-
returnUrl:
|
|
256
|
+
returnUrl: s,
|
|
234
257
|
clientSecret: c,
|
|
235
258
|
onCreatePaymentIntent: I,
|
|
236
|
-
onSuccess:
|
|
237
|
-
onError:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
[
|
|
241
|
-
|
|
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 =
|
|
244
|
-
}, [
|
|
245
|
-
const
|
|
246
|
-
async (
|
|
247
|
-
var
|
|
248
|
-
if (
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
var
|
|
252
|
-
const
|
|
253
|
-
S(
|
|
254
|
-
code:
|
|
255
|
-
translatedMessage:
|
|
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
|
-
},
|
|
258
|
-
if (
|
|
259
|
-
S("payment.error.invalidReturnUrl"),
|
|
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
|
-
}),
|
|
286
|
+
}), w(!1);
|
|
263
287
|
return;
|
|
264
288
|
}
|
|
265
|
-
const
|
|
289
|
+
const X = q ? { return_url: q } : {};
|
|
266
290
|
try {
|
|
267
291
|
if (c !== void 0) {
|
|
268
|
-
const
|
|
269
|
-
elements:
|
|
270
|
-
confirmParams:
|
|
292
|
+
const E = await h.confirmPayment({
|
|
293
|
+
elements: l,
|
|
294
|
+
confirmParams: X,
|
|
271
295
|
redirect: "if_required"
|
|
272
296
|
});
|
|
273
|
-
if (
|
|
274
|
-
|
|
297
|
+
if (E.error) {
|
|
298
|
+
C(E.error.code ?? "generic", E.error.message);
|
|
275
299
|
return;
|
|
276
300
|
}
|
|
277
|
-
|
|
301
|
+
E.paymentIntent && ((J = d.current) == null || J.call(d, E.paymentIntent.id));
|
|
278
302
|
return;
|
|
279
303
|
}
|
|
280
|
-
const { error:
|
|
281
|
-
if (
|
|
282
|
-
|
|
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
|
|
288
|
-
elements:
|
|
289
|
-
clientSecret:
|
|
290
|
-
confirmParams:
|
|
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 (
|
|
294
|
-
|
|
317
|
+
if (y.error) {
|
|
318
|
+
C(y.error.code ?? "generic", y.error.message);
|
|
295
319
|
return;
|
|
296
320
|
}
|
|
297
|
-
|
|
298
|
-
} catch (
|
|
299
|
-
const
|
|
300
|
-
|
|
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
|
-
|
|
326
|
+
w(!1);
|
|
303
327
|
}
|
|
304
328
|
},
|
|
305
329
|
[
|
|
306
330
|
h,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
331
|
+
l,
|
|
332
|
+
p,
|
|
333
|
+
s,
|
|
310
334
|
c,
|
|
311
335
|
I,
|
|
312
336
|
i
|
|
313
337
|
]
|
|
314
338
|
);
|
|
315
339
|
D(() => {
|
|
316
|
-
const
|
|
317
|
-
if (!
|
|
318
|
-
const
|
|
319
|
-
|
|
340
|
+
const f = document.getElementById(g);
|
|
341
|
+
if (!f) return;
|
|
342
|
+
const C = () => {
|
|
343
|
+
j();
|
|
320
344
|
};
|
|
321
|
-
return
|
|
322
|
-
}, [
|
|
323
|
-
const
|
|
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:
|
|
328
|
-
onSubmit:
|
|
351
|
+
id: g,
|
|
352
|
+
onSubmit: j,
|
|
329
353
|
"aria-label": i("payment.ariaLabel"),
|
|
330
|
-
"aria-busy":
|
|
354
|
+
"aria-busy": p || void 0,
|
|
331
355
|
noValidate: !0,
|
|
332
|
-
children: /* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */ t("span", { className:
|
|
335
|
-
/* @__PURE__ */ t("span", { className: "type-title-card", "data-testid": "payment-amount", children:
|
|
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__ */
|
|
361
|
+
/* @__PURE__ */ u(
|
|
338
362
|
"label",
|
|
339
363
|
{
|
|
340
364
|
htmlFor: M,
|
|
341
|
-
className:
|
|
365
|
+
className: B(),
|
|
342
366
|
"data-testid": "payment-field",
|
|
343
367
|
children: [
|
|
344
|
-
/* @__PURE__ */ t("span", { className:
|
|
368
|
+
/* @__PURE__ */ t("span", { className: z(), children: i("payment.fields.card") }),
|
|
345
369
|
/* @__PURE__ */ t(
|
|
346
|
-
|
|
370
|
+
ye,
|
|
347
371
|
{
|
|
348
372
|
id: M,
|
|
349
373
|
options: {
|
|
350
|
-
|
|
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: (
|
|
353
|
-
U(
|
|
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__ */
|
|
387
|
+
o ? /* @__PURE__ */ u(
|
|
361
388
|
"label",
|
|
362
389
|
{
|
|
363
390
|
htmlFor: T,
|
|
364
|
-
className:
|
|
391
|
+
className: B(),
|
|
365
392
|
"data-testid": "payment-address",
|
|
366
393
|
children: [
|
|
367
|
-
/* @__PURE__ */ t("span", { className:
|
|
368
|
-
/* @__PURE__ */ t(
|
|
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
|
-
|
|
373
|
-
|
|
399
|
+
x ? /* @__PURE__ */ t(
|
|
400
|
+
ee,
|
|
374
401
|
{
|
|
375
|
-
id:
|
|
402
|
+
id: v,
|
|
376
403
|
variant: "error",
|
|
377
404
|
live: "polite",
|
|
378
405
|
"data-testid": "payment-error",
|
|
379
|
-
children: /* @__PURE__ */ t(
|
|
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":
|
|
387
|
-
"aria-busy":
|
|
388
|
-
"aria-describedby":
|
|
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:
|
|
392
|
-
/* @__PURE__ */ t(
|
|
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:
|
|
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
|
|
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
|
|
482
|
+
function Se(r) {
|
|
456
483
|
if (!r) return "auto";
|
|
457
484
|
const n = r === "cn" ? "zh" : r;
|
|
458
|
-
if (
|
|
485
|
+
if (re.has(n))
|
|
459
486
|
return n;
|
|
460
|
-
const
|
|
461
|
-
return
|
|
487
|
+
const a = n.split("-")[0];
|
|
488
|
+
return re.has(a) ? a : "auto";
|
|
462
489
|
}
|
|
463
|
-
const _e =
|
|
490
|
+
const _e = de(
|
|
464
491
|
({
|
|
465
492
|
id: r,
|
|
466
493
|
clientSecret: n,
|
|
467
|
-
mode:
|
|
494
|
+
mode: a = "payment",
|
|
468
495
|
onCreatePaymentIntent: e,
|
|
469
496
|
publishableKey: o,
|
|
470
|
-
currency:
|
|
497
|
+
currency: s,
|
|
471
498
|
amount: c,
|
|
472
499
|
onSuccess: I,
|
|
473
|
-
onError:
|
|
474
|
-
billingAddress:
|
|
475
|
-
locale:
|
|
476
|
-
ariaLabel:
|
|
477
|
-
returnUrl:
|
|
478
|
-
stripePromise:
|
|
479
|
-
|
|
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 } =
|
|
509
|
+
const { i18n: T } = W(), v = Se(V ?? T.language ?? "en"), [p, w] = _(l ?? null);
|
|
482
510
|
D(() => {
|
|
483
|
-
if (
|
|
484
|
-
|
|
511
|
+
if (l !== void 0) {
|
|
512
|
+
w(l);
|
|
485
513
|
return;
|
|
486
514
|
}
|
|
487
515
|
if (!o) {
|
|
488
|
-
|
|
516
|
+
w(null);
|
|
489
517
|
return;
|
|
490
518
|
}
|
|
491
|
-
|
|
492
|
-
}, [
|
|
493
|
-
const [
|
|
494
|
-
() =>
|
|
519
|
+
w(ue(o));
|
|
520
|
+
}, [l, o]);
|
|
521
|
+
const [P, U] = _(
|
|
522
|
+
() => O()
|
|
495
523
|
);
|
|
496
|
-
D(() => (U(
|
|
497
|
-
const
|
|
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
|
|
502
|
-
|
|
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
|
|
509
|
-
|
|
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
|
-
|
|
515
|
-
const
|
|
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:
|
|
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:
|
|
552
|
+
mode: a,
|
|
525
553
|
amount: c,
|
|
526
|
-
currency:
|
|
527
|
-
appearance:
|
|
528
|
-
locale:
|
|
554
|
+
currency: s.toLowerCase(),
|
|
555
|
+
appearance: P,
|
|
556
|
+
locale: v
|
|
529
557
|
}
|
|
530
558
|
),
|
|
531
|
-
[n,
|
|
559
|
+
[n, a, c, s, P, v]
|
|
532
560
|
);
|
|
533
561
|
return /* @__PURE__ */ t(
|
|
534
562
|
"div",
|
|
535
563
|
{
|
|
536
|
-
ref:
|
|
537
|
-
"aria-label":
|
|
538
|
-
className: [
|
|
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:
|
|
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
|
-
|
|
576
|
+
pe,
|
|
549
577
|
{
|
|
550
|
-
stripe:
|
|
551
|
-
options:
|
|
578
|
+
stripe: p,
|
|
579
|
+
options: $,
|
|
552
580
|
children: /* @__PURE__ */ t(
|
|
553
|
-
|
|
581
|
+
Ne,
|
|
554
582
|
{
|
|
555
583
|
amount: c,
|
|
556
|
-
currency:
|
|
557
|
-
locale:
|
|
558
|
-
billingAddress:
|
|
559
|
-
returnUrl:
|
|
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:
|
|
591
|
+
onError: F,
|
|
592
|
+
layout: R
|
|
564
593
|
}
|
|
565
594
|
)
|
|
566
595
|
},
|
|
567
596
|
n ?? "deferred"
|
|
568
597
|
)
|
|
569
598
|
) : /* @__PURE__ */ t(
|
|
570
|
-
|
|
599
|
+
ze,
|
|
571
600
|
{
|
|
572
601
|
amount: c,
|
|
573
|
-
currency:
|
|
574
|
-
locale:
|
|
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
|
|
584
|
-
const { amount: n, currency:
|
|
585
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
593
|
-
/* @__PURE__ */ t("span", { className:
|
|
594
|
-
/* @__PURE__ */ t("span", { className: "type-title-card", children:
|
|
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__ */
|
|
597
|
-
/* @__PURE__ */ t("span", { className:
|
|
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__ */
|
|
607
|
-
/* @__PURE__ */ t("span", { className:
|
|
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__ */
|
|
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(
|
|
625
|
-
/* @__PURE__ */ t("span", { children:
|
|
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
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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-
|
|
671
|
+
//# sourceMappingURL=payment-form-BNTx4876.js.map
|