@alfadocs/ui-kit 0.44.0 → 0.46.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-BpX4z_af.js → alia-sidebar-Be8FhKYd.js} +332 -237
- package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
- package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
- package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
- package/dist/_chunks/{cycle-calculator-ChHBcjet.js → cycle-calculator-KxA8dqDf.js} +31 -20
- package/dist/_chunks/{due-date-calculator-CYXKLoof.js → due-date-calculator-mFxpHLml.js} +51 -39
- package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
- package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-DzpD63WY.js} +2 -2
- package/dist/_chunks/{gestational-age-calculator-sRmoqgVr.js → gestational-age-calculator-gWI_uRA1.js} +52 -39
- package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
- package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
- package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
- package/dist/_chunks/payment-form-BNTx4876.js +671 -0
- package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
- package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-C5YhfYnL.js → pregnancy-weight-gain-BtEHaSqy.js} +26 -13
- package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
- package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
- package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
- package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
- package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
- package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
- package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
- package/dist/_chunks/{unit-converter-Ds9jalbN.js → unit-converter-u3CwNDpP.js} +63 -52
- package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/banded-gauge.d.ts +193 -0
- package/dist/components/_shared/insert-result.d.ts +81 -8
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +2 -2
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +2 -2
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +2 -2
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +2 -2
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +30 -2
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +2 -2
- package/dist/components/search-bar/index.js +1 -1
- package/dist/components/search-input/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
- package/dist/components/social-sign-in-button/index.js +1 -1
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/spinner/spinner.d.ts +2 -2
- package/dist/components/transcript-panel/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +2 -2
- package/dist/components/wallet-pay-button/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/de.js +1 -1
- package/dist/i18n/locales/el.d.ts +1 -1
- package/dist/i18n/locales/el.js +1 -1
- package/dist/i18n/locales/en.d.ts +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/fr.js +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -1
- package/dist/i18n/locales/hi.js +1 -1
- package/dist/i18n/locales/it.d.ts +1 -1
- package/dist/i18n/locales/it.js +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -1
- package/dist/i18n/locales/ja.js +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -1
- package/dist/i18n/locales/nl.js +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -1
- package/dist/i18n/locales/pl.js +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -1
- package/dist/i18n/locales/pt.js +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -1
- package/dist/i18n/locales/ro.js +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -1
- package/dist/i18n/locales/ru.js +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -1
- package/dist/i18n/locales/sq.js +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -1
- package/dist/i18n/locales/sv.js +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -1
- package/dist/i18n/locales/tr.js +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -1
- package/dist/i18n/locales/zh.js +1 -1
- package/dist/index.js +25 -25
- package/dist/locales/ar.json +1 -1
- package/dist/locales/de.json +1 -1
- package/dist/locales/el.json +1 -1
- package/dist/locales/en.json +1 -1
- package/dist/locales/es.json +1 -1
- package/dist/locales/fr.json +1 -1
- package/dist/locales/hi.json +1 -1
- package/dist/locales/it.json +1 -1
- package/dist/locales/ja.json +1 -1
- package/dist/locales/nl.json +1 -1
- package/dist/locales/pl.json +1 -1
- package/dist/locales/pt.json +1 -1
- package/dist/locales/ro.json +1 -1
- package/dist/locales/ru.json +1 -1
- package/dist/locales/sq.json +1 -1
- package/dist/locales/sv.json +1 -1
- package/dist/locales/tr.json +1 -1
- package/dist/locales/zh.json +1 -1
- package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +0 -273
- package/dist/_chunks/insert-result-CoC1oo6R.js +0 -334
- package/dist/_chunks/payment-form-BzVsG6Ks.js +0 -590
package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js}
RENAMED
|
@@ -10,7 +10,7 @@ import { D as i } from "./dropdown-menu-CUEXqKis.js";
|
|
|
10
10
|
import { T as F } from "./tab-bar-Xetknddo.js";
|
|
11
11
|
import { a as S, H as q, g as G, f as w, e as J, c as K, d as Q } from "./header-Ce1Br27u.js";
|
|
12
12
|
import { H as U } from "./header-settings-Bx0Biimh.js";
|
|
13
|
-
import { S as X } from "./sign-in-with-alfadocs-button-
|
|
13
|
+
import { S as X } from "./sign-in-with-alfadocs-button-CuYn_kKP.js";
|
|
14
14
|
import { S as Y, a as Z, j as _, k as ee, i as ae, h as A } from "./sidebar-_vJXI9rB.js";
|
|
15
15
|
import { T as se } from "./theme-root-BOO73p5t.js";
|
|
16
16
|
import { a as te } from "./tooltip-DvmfrNvB.js";
|
|
@@ -425,4 +425,4 @@ export {
|
|
|
425
425
|
pe as M,
|
|
426
426
|
h as P
|
|
427
427
|
};
|
|
428
|
-
//# sourceMappingURL=marketplace-app-shell-
|
|
428
|
+
//# sourceMappingURL=marketplace-app-shell-Gfsf78ge.js.map
|
|
@@ -2,7 +2,7 @@ import { jsx as a, jsxs as y } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as de, useRef as N, useEffect as V, useMemo as X, useImperativeHandle as ce, useState as W, useCallback as z, useId as le } from "react";
|
|
3
3
|
import { c as T } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as j } from "react-i18next";
|
|
5
|
-
import { A as se } from "./autocomplete-
|
|
5
|
+
import { A as se } from "./autocomplete-CDqxB68B.js";
|
|
6
6
|
import { B as ue } from "./button-DD_0Xdmr.js";
|
|
7
7
|
import { C as M } from "./card-DPmk26CL.js";
|
|
8
8
|
import { S as fe } from "./slider-BHWzXdjt.js";
|
|
@@ -1155,4 +1155,4 @@ export {
|
|
|
1155
1155
|
Oe as P,
|
|
1156
1156
|
ye as p
|
|
1157
1157
|
};
|
|
1158
|
-
//# sourceMappingURL=patient-search-
|
|
1158
|
+
//# sourceMappingURL=patient-search-CocVcGJ3.js.map
|
|
@@ -0,0 +1,671 @@
|
|
|
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
|
+
return typeof document < "u" && typeof window < "u";
|
|
12
|
+
}
|
|
13
|
+
function O(r) {
|
|
14
|
+
if (!ne())
|
|
15
|
+
return { theme: "stripe" };
|
|
16
|
+
const n = r ?? document.documentElement, a = getComputedStyle(n), e = (s) => a.getPropertyValue(s).trim();
|
|
17
|
+
return {
|
|
18
|
+
theme: n.classList.contains("theme-dark") ? "night" : "stripe",
|
|
19
|
+
variables: {
|
|
20
|
+
colorPrimary: e("--primary"),
|
|
21
|
+
colorBackground: e("--background"),
|
|
22
|
+
colorText: e("--foreground"),
|
|
23
|
+
colorDanger: e("--destructive"),
|
|
24
|
+
colorTextSecondary: e("--muted-foreground"),
|
|
25
|
+
colorTextPlaceholder: e("--muted-foreground"),
|
|
26
|
+
borderRadius: e("--radius-md"),
|
|
27
|
+
fontFamily: e("--font-sans"),
|
|
28
|
+
fontSizeBase: e("--font-size-base"),
|
|
29
|
+
// Stripe multiplies spacingUnit throughout every Element; --spacing-sm
|
|
30
|
+
// gives readable density. Keep this in sync with the JSDoc above.
|
|
31
|
+
spacingUnit: e("--spacing-sm")
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
".Input": {
|
|
35
|
+
backgroundColor: e("--background"),
|
|
36
|
+
border: `1px solid ${e("--border")}`,
|
|
37
|
+
color: e("--foreground"),
|
|
38
|
+
padding: e("--spacing-sm"),
|
|
39
|
+
transition: `border-color ${e("--animation-duration")} ease-out`
|
|
40
|
+
},
|
|
41
|
+
".Input:focus": {
|
|
42
|
+
borderColor: e("--primary"),
|
|
43
|
+
boxShadow: `0 0 0 ${e("--focus-ring-width")} ${e("--ring")}`,
|
|
44
|
+
outline: "none"
|
|
45
|
+
},
|
|
46
|
+
".Input--invalid": {
|
|
47
|
+
borderColor: e("--destructive"),
|
|
48
|
+
color: e("--foreground")
|
|
49
|
+
},
|
|
50
|
+
".Label": {
|
|
51
|
+
color: e("--foreground"),
|
|
52
|
+
fontWeight: e("--font-weight-medium"),
|
|
53
|
+
fontSize: e("--font-size-sm")
|
|
54
|
+
},
|
|
55
|
+
".Error": {
|
|
56
|
+
color: e("--destructive"),
|
|
57
|
+
fontSize: e("--font-size-sm")
|
|
58
|
+
},
|
|
59
|
+
".Tab": {
|
|
60
|
+
border: `1px solid ${e("--border")}`,
|
|
61
|
+
backgroundColor: e("--background"),
|
|
62
|
+
color: e("--foreground")
|
|
63
|
+
},
|
|
64
|
+
".Tab--selected": {
|
|
65
|
+
borderColor: e("--primary"),
|
|
66
|
+
backgroundColor: e("--background"),
|
|
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"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function he(r, n) {
|
|
95
|
+
if (!ne()) return () => {
|
|
96
|
+
};
|
|
97
|
+
const a = document.documentElement, e = () => r(O(n)), o = new MutationObserver(e);
|
|
98
|
+
o.observe(a, {
|
|
99
|
+
attributes: !0,
|
|
100
|
+
attributeFilter: ["class", "dir", "lang"]
|
|
101
|
+
});
|
|
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);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const we = {
|
|
108
|
+
id: "payment-form",
|
|
109
|
+
capabilities: ["submit"],
|
|
110
|
+
state: {},
|
|
111
|
+
actions: {
|
|
112
|
+
submit: {
|
|
113
|
+
safety: "destructive",
|
|
114
|
+
description: "Submit the payment. Charges the configured payment method — irreversible.",
|
|
115
|
+
invoke: (r) => r.submit()
|
|
116
|
+
},
|
|
117
|
+
reset: {
|
|
118
|
+
safety: "destructive",
|
|
119
|
+
description: "Reset the form to its initial state. Loses any in-progress input.",
|
|
120
|
+
invoke: (r) => {
|
|
121
|
+
r.reset();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
domHooks: {
|
|
126
|
+
root: { attr: "data-component", value: "payment-form" },
|
|
127
|
+
instanceId: {
|
|
128
|
+
attr: "data-component-id",
|
|
129
|
+
sourceProp: "id",
|
|
130
|
+
description: "Sourced from the id prop."
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, xe = /* @__PURE__ */ new Set([
|
|
134
|
+
"BIF",
|
|
135
|
+
"CLP",
|
|
136
|
+
"DJF",
|
|
137
|
+
"GNF",
|
|
138
|
+
"IDR",
|
|
139
|
+
"JPY",
|
|
140
|
+
"KMF",
|
|
141
|
+
"KRW",
|
|
142
|
+
"MGA",
|
|
143
|
+
"PYG",
|
|
144
|
+
"RWF",
|
|
145
|
+
"UGX",
|
|
146
|
+
"VND",
|
|
147
|
+
"VUV",
|
|
148
|
+
"XAF",
|
|
149
|
+
"XOF",
|
|
150
|
+
"XPF"
|
|
151
|
+
]);
|
|
152
|
+
function K(r, n, a) {
|
|
153
|
+
const e = n.toUpperCase(), o = xe.has(e) ? r : r / 100;
|
|
154
|
+
try {
|
|
155
|
+
return new Intl.NumberFormat(a, {
|
|
156
|
+
style: "currency",
|
|
157
|
+
currency: e
|
|
158
|
+
}).format(o);
|
|
159
|
+
} catch {
|
|
160
|
+
return new Intl.NumberFormat("en", {
|
|
161
|
+
style: "currency",
|
|
162
|
+
currency: e
|
|
163
|
+
}).format(o);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function ke(r) {
|
|
167
|
+
if (r === void 0) return null;
|
|
168
|
+
const n = r.trim();
|
|
169
|
+
if (n === "" || typeof window > "u") return null;
|
|
170
|
+
try {
|
|
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();
|
|
173
|
+
} catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function Ce(r) {
|
|
178
|
+
return r && r.replace(/\d{4,}/g, "****");
|
|
179
|
+
}
|
|
180
|
+
function Ee(r) {
|
|
181
|
+
switch (r) {
|
|
182
|
+
case "incorrect_number":
|
|
183
|
+
case "invalid_number":
|
|
184
|
+
return "payment.error.cardNumber";
|
|
185
|
+
case "invalid_expiry_month":
|
|
186
|
+
case "invalid_expiry_year":
|
|
187
|
+
case "expired_card":
|
|
188
|
+
return "payment.error.expiry";
|
|
189
|
+
case "invalid_cvc":
|
|
190
|
+
case "incorrect_cvc":
|
|
191
|
+
return "payment.error.cvc";
|
|
192
|
+
case "incorrect_zip":
|
|
193
|
+
case "invalid_zip":
|
|
194
|
+
return "payment.error.postalCode";
|
|
195
|
+
case "card_declined":
|
|
196
|
+
case "do_not_honor":
|
|
197
|
+
case "generic_decline":
|
|
198
|
+
return "payment.error.declined";
|
|
199
|
+
case "network_error":
|
|
200
|
+
case "api_connection_error":
|
|
201
|
+
return "payment.error.network";
|
|
202
|
+
default:
|
|
203
|
+
return "payment.error.generic";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const Ie = A(
|
|
207
|
+
[
|
|
208
|
+
"ds:payment-form-alfadocs ds:flex ds:flex-col",
|
|
209
|
+
"ds:gap-[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)]",
|
|
214
|
+
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
215
|
+
].join(" ")
|
|
216
|
+
), B = A(
|
|
217
|
+
["ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"].join(" ")
|
|
218
|
+
), z = A(
|
|
219
|
+
["type-label", "ds:text-[var(--foreground)]"].join(" ")
|
|
220
|
+
), ae = A(
|
|
221
|
+
[
|
|
222
|
+
"ds:flex ds:items-baseline ds:justify-between",
|
|
223
|
+
"ds:gap-[var(--spacing-sm)]",
|
|
224
|
+
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
225
|
+
"ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
|
|
226
|
+
"ds:bg-[var(--muted)]",
|
|
227
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
228
|
+
"ds:text-[var(--foreground)]"
|
|
229
|
+
].join(" ")
|
|
230
|
+
), se = A(
|
|
231
|
+
[
|
|
232
|
+
"ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]",
|
|
233
|
+
"ds:[min-block-size:var(--min-target-size)]",
|
|
234
|
+
"ds:[min-inline-size:var(--min-target-size)]",
|
|
235
|
+
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
236
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
237
|
+
"ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]",
|
|
238
|
+
"ds:text-[length:var(--font-size-base)] ds:font-medium",
|
|
239
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
240
|
+
"ds:hover:bg-[var(--primary-hover)]",
|
|
241
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
242
|
+
"ds:focus-visible:outline-solid",
|
|
243
|
+
"ds:focus-visible:outline-[var(--ring)]",
|
|
244
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
245
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
246
|
+
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed",
|
|
247
|
+
"ds:aria-busy:cursor-wait"
|
|
248
|
+
].join(" ")
|
|
249
|
+
);
|
|
250
|
+
function Ne(r) {
|
|
251
|
+
const {
|
|
252
|
+
amount: n,
|
|
253
|
+
currency: a,
|
|
254
|
+
locale: e,
|
|
255
|
+
billingAddress: o,
|
|
256
|
+
returnUrl: s,
|
|
257
|
+
clientSecret: c,
|
|
258
|
+
onCreatePaymentIntent: I,
|
|
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);
|
|
266
|
+
D(() => {
|
|
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)
|
|
280
|
+
});
|
|
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, {
|
|
284
|
+
code: "invalid_return_url",
|
|
285
|
+
translatedMessage: i("payment.error.invalidReturnUrl")
|
|
286
|
+
}), w(!1);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const X = q ? { return_url: q } : {};
|
|
290
|
+
try {
|
|
291
|
+
if (c !== void 0) {
|
|
292
|
+
const E = await h.confirmPayment({
|
|
293
|
+
elements: l,
|
|
294
|
+
confirmParams: X,
|
|
295
|
+
redirect: "if_required"
|
|
296
|
+
});
|
|
297
|
+
if (E.error) {
|
|
298
|
+
C(E.error.code ?? "generic", E.error.message);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
E.paymentIntent && ((J = d.current) == null || J.call(d, E.paymentIntent.id));
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const { error: b } = await l.submit();
|
|
305
|
+
if (b) {
|
|
306
|
+
C(b.code ?? "generic", b.message);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (!I)
|
|
310
|
+
return;
|
|
311
|
+
const L = await I(), y = await h.confirmPayment({
|
|
312
|
+
elements: l,
|
|
313
|
+
clientSecret: L,
|
|
314
|
+
confirmParams: X,
|
|
315
|
+
redirect: "if_required"
|
|
316
|
+
});
|
|
317
|
+
if (y.error) {
|
|
318
|
+
C(y.error.code ?? "generic", y.error.message);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
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);
|
|
325
|
+
} finally {
|
|
326
|
+
w(!1);
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
[
|
|
330
|
+
h,
|
|
331
|
+
l,
|
|
332
|
+
p,
|
|
333
|
+
s,
|
|
334
|
+
c,
|
|
335
|
+
I,
|
|
336
|
+
i
|
|
337
|
+
]
|
|
338
|
+
);
|
|
339
|
+
D(() => {
|
|
340
|
+
const f = document.getElementById(g);
|
|
341
|
+
if (!f) return;
|
|
342
|
+
const C = () => {
|
|
343
|
+
j();
|
|
344
|
+
};
|
|
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;
|
|
348
|
+
return /* @__PURE__ */ t(
|
|
349
|
+
"form",
|
|
350
|
+
{
|
|
351
|
+
id: g,
|
|
352
|
+
onSubmit: j,
|
|
353
|
+
"aria-label": i("payment.ariaLabel"),
|
|
354
|
+
"aria-busy": p || void 0,
|
|
355
|
+
noValidate: !0,
|
|
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) })
|
|
360
|
+
] }),
|
|
361
|
+
/* @__PURE__ */ u(
|
|
362
|
+
"label",
|
|
363
|
+
{
|
|
364
|
+
htmlFor: M,
|
|
365
|
+
className: B(),
|
|
366
|
+
"data-testid": "payment-field",
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ t("span", { className: z(), children: i("payment.fields.card") }),
|
|
369
|
+
/* @__PURE__ */ t(
|
|
370
|
+
ye,
|
|
371
|
+
{
|
|
372
|
+
id: M,
|
|
373
|
+
options: {
|
|
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" }
|
|
378
|
+
},
|
|
379
|
+
onChange: (f) => {
|
|
380
|
+
U(f.complete === !0), f.complete && (S(null), m(""));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
o ? /* @__PURE__ */ u(
|
|
388
|
+
"label",
|
|
389
|
+
{
|
|
390
|
+
htmlFor: T,
|
|
391
|
+
className: B(),
|
|
392
|
+
"data-testid": "payment-address",
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ t("span", { className: z(), children: i("payment.billingAddress") }),
|
|
395
|
+
/* @__PURE__ */ t(ge, { id: T, options: { mode: "billing" } })
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
) : null,
|
|
399
|
+
x ? /* @__PURE__ */ t(
|
|
400
|
+
ee,
|
|
401
|
+
{
|
|
402
|
+
id: v,
|
|
403
|
+
variant: "error",
|
|
404
|
+
live: "polite",
|
|
405
|
+
"data-testid": "payment-error",
|
|
406
|
+
children: /* @__PURE__ */ t(ee.Description, { children: $ })
|
|
407
|
+
}
|
|
408
|
+
) : null,
|
|
409
|
+
/* @__PURE__ */ t(
|
|
410
|
+
"button",
|
|
411
|
+
{
|
|
412
|
+
type: "submit",
|
|
413
|
+
"aria-disabled": oe || void 0,
|
|
414
|
+
"aria-busy": p || void 0,
|
|
415
|
+
"aria-describedby": x ? v : void 0,
|
|
416
|
+
className: se(),
|
|
417
|
+
"data-testid": "payment-submit",
|
|
418
|
+
children: p ? /* @__PURE__ */ u(ie, { children: [
|
|
419
|
+
/* @__PURE__ */ t(te, { size: "sm", label: i("payment.processing") }),
|
|
420
|
+
/* @__PURE__ */ t("span", { children: i("payment.processing") })
|
|
421
|
+
] }) : /* @__PURE__ */ t("span", { children: i("payment.submit", {
|
|
422
|
+
amount: K(n, a, e)
|
|
423
|
+
}) })
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
] })
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
const re = /* @__PURE__ */ new Set([
|
|
431
|
+
"auto",
|
|
432
|
+
"ar",
|
|
433
|
+
"bg",
|
|
434
|
+
"cs",
|
|
435
|
+
"da",
|
|
436
|
+
"de",
|
|
437
|
+
"el",
|
|
438
|
+
"en",
|
|
439
|
+
"en-AU",
|
|
440
|
+
"en-CA",
|
|
441
|
+
"en-NZ",
|
|
442
|
+
"en-GB",
|
|
443
|
+
"es",
|
|
444
|
+
"es-ES",
|
|
445
|
+
"es-419",
|
|
446
|
+
"et",
|
|
447
|
+
"fi",
|
|
448
|
+
"fil",
|
|
449
|
+
"fr",
|
|
450
|
+
"fr-CA",
|
|
451
|
+
"fr-FR",
|
|
452
|
+
"he",
|
|
453
|
+
"hu",
|
|
454
|
+
"hr",
|
|
455
|
+
"id",
|
|
456
|
+
"it",
|
|
457
|
+
"it-IT",
|
|
458
|
+
"ja",
|
|
459
|
+
"ko",
|
|
460
|
+
"lt",
|
|
461
|
+
"lv",
|
|
462
|
+
"ms",
|
|
463
|
+
"mt",
|
|
464
|
+
"nb",
|
|
465
|
+
"nl",
|
|
466
|
+
"no",
|
|
467
|
+
"pl",
|
|
468
|
+
"pt",
|
|
469
|
+
"pt-BR",
|
|
470
|
+
"ro",
|
|
471
|
+
"ru",
|
|
472
|
+
"sk",
|
|
473
|
+
"sl",
|
|
474
|
+
"sv",
|
|
475
|
+
"th",
|
|
476
|
+
"tr",
|
|
477
|
+
"vi",
|
|
478
|
+
"zh",
|
|
479
|
+
"zh-HK",
|
|
480
|
+
"zh-TW"
|
|
481
|
+
]);
|
|
482
|
+
function Se(r) {
|
|
483
|
+
if (!r) return "auto";
|
|
484
|
+
const n = r === "cn" ? "zh" : r;
|
|
485
|
+
if (re.has(n))
|
|
486
|
+
return n;
|
|
487
|
+
const a = n.split("-")[0];
|
|
488
|
+
return re.has(a) ? a : "auto";
|
|
489
|
+
}
|
|
490
|
+
const _e = de(
|
|
491
|
+
({
|
|
492
|
+
id: r,
|
|
493
|
+
clientSecret: n,
|
|
494
|
+
mode: a = "payment",
|
|
495
|
+
onCreatePaymentIntent: e,
|
|
496
|
+
publishableKey: o,
|
|
497
|
+
currency: s,
|
|
498
|
+
amount: c,
|
|
499
|
+
onSuccess: I,
|
|
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
|
|
508
|
+
}, M) => {
|
|
509
|
+
const { i18n: T } = W(), v = Se(V ?? T.language ?? "en"), [p, w] = _(l ?? null);
|
|
510
|
+
D(() => {
|
|
511
|
+
if (l !== void 0) {
|
|
512
|
+
w(l);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (!o) {
|
|
516
|
+
w(null);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
w(ue(o));
|
|
520
|
+
}, [l, o]);
|
|
521
|
+
const [P, U] = _(
|
|
522
|
+
() => O()
|
|
523
|
+
);
|
|
524
|
+
D(() => (U(O()), he(U)), []);
|
|
525
|
+
const x = G(null), S = H(
|
|
526
|
+
() => ({
|
|
527
|
+
submit: async () => {
|
|
528
|
+
var d;
|
|
529
|
+
const m = (d = x.current) == null ? void 0 : d.querySelector("form");
|
|
530
|
+
m && m.dispatchEvent(
|
|
531
|
+
new CustomEvent("payment-form:submit", { bubbles: !0 })
|
|
532
|
+
);
|
|
533
|
+
},
|
|
534
|
+
reset: () => {
|
|
535
|
+
var d;
|
|
536
|
+
const m = (d = x.current) == null ? void 0 : d.querySelector("form");
|
|
537
|
+
m instanceof HTMLFormElement && m.reset();
|
|
538
|
+
}
|
|
539
|
+
}),
|
|
540
|
+
[]
|
|
541
|
+
);
|
|
542
|
+
ce(M, () => x.current, []), ve(we, S, r);
|
|
543
|
+
const $ = H(
|
|
544
|
+
() => n !== void 0 ? (
|
|
545
|
+
// Immediate mode — the consumer already created the intent.
|
|
546
|
+
{ clientSecret: n, appearance: P, locale: v }
|
|
547
|
+
) : (
|
|
548
|
+
// Deferred-intent mode — no secret yet; Stripe needs the intent
|
|
549
|
+
// shape (mode + amount + currency) to render the Payment Element.
|
|
550
|
+
// Stripe expects a lowercase ISO-4217 currency here.
|
|
551
|
+
{
|
|
552
|
+
mode: a,
|
|
553
|
+
amount: c,
|
|
554
|
+
currency: s.toLowerCase(),
|
|
555
|
+
appearance: P,
|
|
556
|
+
locale: v
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
[n, a, c, s, P, v]
|
|
560
|
+
);
|
|
561
|
+
return /* @__PURE__ */ t(
|
|
562
|
+
"div",
|
|
563
|
+
{
|
|
564
|
+
ref: x,
|
|
565
|
+
"aria-label": i,
|
|
566
|
+
className: [Ie(), g].filter(Boolean).join(" "),
|
|
567
|
+
"data-component": "payment-form",
|
|
568
|
+
"data-component-id": r,
|
|
569
|
+
"data-testid": "payment-form-root",
|
|
570
|
+
children: p ? (
|
|
571
|
+
// Render the real Payment Element whenever a Stripe instance is
|
|
572
|
+
// available — in immediate mode (clientSecret present) AND in
|
|
573
|
+
// deferred mode (no secret). The skeleton is reserved for the
|
|
574
|
+
// no-Stripe case (missing publishableKey / injected null).
|
|
575
|
+
/* @__PURE__ */ t(
|
|
576
|
+
pe,
|
|
577
|
+
{
|
|
578
|
+
stripe: p,
|
|
579
|
+
options: $,
|
|
580
|
+
children: /* @__PURE__ */ t(
|
|
581
|
+
Ne,
|
|
582
|
+
{
|
|
583
|
+
amount: c,
|
|
584
|
+
currency: s,
|
|
585
|
+
locale: v,
|
|
586
|
+
billingAddress: N,
|
|
587
|
+
returnUrl: h,
|
|
588
|
+
clientSecret: n,
|
|
589
|
+
onCreatePaymentIntent: e,
|
|
590
|
+
onSuccess: I,
|
|
591
|
+
onError: F,
|
|
592
|
+
layout: R
|
|
593
|
+
}
|
|
594
|
+
)
|
|
595
|
+
},
|
|
596
|
+
n ?? "deferred"
|
|
597
|
+
)
|
|
598
|
+
) : /* @__PURE__ */ t(
|
|
599
|
+
ze,
|
|
600
|
+
{
|
|
601
|
+
amount: c,
|
|
602
|
+
currency: s,
|
|
603
|
+
locale: v,
|
|
604
|
+
billingAddress: N
|
|
605
|
+
}
|
|
606
|
+
)
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
_e.displayName = "PaymentForm";
|
|
612
|
+
function ze(r) {
|
|
613
|
+
const { amount: n, currency: a, locale: e, billingAddress: o } = r, { t: s } = W();
|
|
614
|
+
return /* @__PURE__ */ u(
|
|
615
|
+
"div",
|
|
616
|
+
{
|
|
617
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
618
|
+
"data-testid": "payment-skeleton",
|
|
619
|
+
"aria-busy": "true",
|
|
620
|
+
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) })
|
|
624
|
+
] }),
|
|
625
|
+
/* @__PURE__ */ u("div", { className: B(), children: [
|
|
626
|
+
/* @__PURE__ */ t("span", { className: z(), children: s("payment.fields.card") }),
|
|
627
|
+
/* @__PURE__ */ t(
|
|
628
|
+
"div",
|
|
629
|
+
{
|
|
630
|
+
className: "ds:[min-block-size:var(--min-target-size)] ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ds:bg-[var(--muted)]",
|
|
631
|
+
"aria-hidden": "true"
|
|
632
|
+
}
|
|
633
|
+
)
|
|
634
|
+
] }),
|
|
635
|
+
o ? /* @__PURE__ */ u("div", { className: B(), "data-testid": "payment-address", children: [
|
|
636
|
+
/* @__PURE__ */ t("span", { className: z(), children: s("payment.billingAddress") }),
|
|
637
|
+
/* @__PURE__ */ t(
|
|
638
|
+
"div",
|
|
639
|
+
{
|
|
640
|
+
className: "ds:[min-block-size:calc(var(--min-target-size)*2)] ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ds:bg-[var(--muted)]",
|
|
641
|
+
"aria-hidden": "true"
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
] }) : null,
|
|
645
|
+
/* @__PURE__ */ u(
|
|
646
|
+
"button",
|
|
647
|
+
{
|
|
648
|
+
type: "button",
|
|
649
|
+
"aria-disabled": "true",
|
|
650
|
+
className: se(),
|
|
651
|
+
disabled: !0,
|
|
652
|
+
children: [
|
|
653
|
+
/* @__PURE__ */ t(te, { size: "sm", label: s("payment.processing") }),
|
|
654
|
+
/* @__PURE__ */ t("span", { children: s("payment.processing") })
|
|
655
|
+
]
|
|
656
|
+
}
|
|
657
|
+
)
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
export {
|
|
663
|
+
_e as P,
|
|
664
|
+
Ie as a,
|
|
665
|
+
Ce as b,
|
|
666
|
+
Ee as c,
|
|
667
|
+
K as f,
|
|
668
|
+
we as p,
|
|
669
|
+
se as s
|
|
670
|
+
};
|
|
671
|
+
//# sourceMappingURL=payment-form-BNTx4876.js.map
|