@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
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
import { jsx as t, jsxs as m, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as se, useState as C, useEffect as R, useRef as V, useMemo as j, useImperativeHandle as ae, useId as oe, useCallback as ie } from "react";
|
|
3
|
-
import { c as z } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as q } from "react-i18next";
|
|
5
|
-
import { S as J } from "./spinner-CCByyvcb.js";
|
|
6
|
-
import { A as W } from "./alert-ywPR59NE.js";
|
|
7
|
-
import { loadStripe as de } from "@stripe/stripe-js";
|
|
8
|
-
import { Elements as ce, useStripe as le, useElements as me, PaymentElement as ue, AddressElement as pe } from "@stripe/react-stripe-js";
|
|
9
|
-
import { u as fe } from "./registry-nPAVE19X.js";
|
|
10
|
-
function Y() {
|
|
11
|
-
return typeof document < "u" && typeof window < "u";
|
|
12
|
-
}
|
|
13
|
-
function B(r) {
|
|
14
|
-
if (!Y())
|
|
15
|
-
return { theme: "stripe" };
|
|
16
|
-
const n = r ?? document.documentElement, s = getComputedStyle(n), e = (a) => s.getPropertyValue(a).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
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function be(r, n) {
|
|
73
|
-
if (!Y()) return () => {
|
|
74
|
-
};
|
|
75
|
-
const s = document.documentElement, e = () => r(B(n)), i = new MutationObserver(e);
|
|
76
|
-
i.observe(s, {
|
|
77
|
-
attributes: !0,
|
|
78
|
-
attributeFilter: ["class", "dir", "lang"]
|
|
79
|
-
});
|
|
80
|
-
const a = window.matchMedia("(prefers-color-scheme: dark)"), f = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
81
|
-
return a.addEventListener("change", e), f.addEventListener("change", e), () => {
|
|
82
|
-
i.disconnect(), a.removeEventListener("change", e), f.removeEventListener("change", e);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
const ye = {
|
|
86
|
-
id: "payment-form",
|
|
87
|
-
capabilities: ["submit"],
|
|
88
|
-
state: {},
|
|
89
|
-
actions: {
|
|
90
|
-
submit: {
|
|
91
|
-
safety: "destructive",
|
|
92
|
-
description: "Submit the payment. Charges the configured payment method — irreversible.",
|
|
93
|
-
invoke: (r) => r.submit()
|
|
94
|
-
},
|
|
95
|
-
reset: {
|
|
96
|
-
safety: "destructive",
|
|
97
|
-
description: "Reset the form to its initial state. Loses any in-progress input.",
|
|
98
|
-
invoke: (r) => {
|
|
99
|
-
r.reset();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
domHooks: {
|
|
104
|
-
root: { attr: "data-component", value: "payment-form" },
|
|
105
|
-
instanceId: {
|
|
106
|
-
attr: "data-component-id",
|
|
107
|
-
sourceProp: "id",
|
|
108
|
-
description: "Sourced from the id prop."
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, ge = /* @__PURE__ */ new Set([
|
|
112
|
-
"BIF",
|
|
113
|
-
"CLP",
|
|
114
|
-
"DJF",
|
|
115
|
-
"GNF",
|
|
116
|
-
"IDR",
|
|
117
|
-
"JPY",
|
|
118
|
-
"KMF",
|
|
119
|
-
"KRW",
|
|
120
|
-
"MGA",
|
|
121
|
-
"PYG",
|
|
122
|
-
"RWF",
|
|
123
|
-
"UGX",
|
|
124
|
-
"VND",
|
|
125
|
-
"VUV",
|
|
126
|
-
"XAF",
|
|
127
|
-
"XOF",
|
|
128
|
-
"XPF"
|
|
129
|
-
]);
|
|
130
|
-
function $(r, n, s) {
|
|
131
|
-
const e = n.toUpperCase(), i = ge.has(e) ? r : r / 100;
|
|
132
|
-
try {
|
|
133
|
-
return new Intl.NumberFormat(s, {
|
|
134
|
-
style: "currency",
|
|
135
|
-
currency: e
|
|
136
|
-
}).format(i);
|
|
137
|
-
} catch {
|
|
138
|
-
return new Intl.NumberFormat("en", {
|
|
139
|
-
style: "currency",
|
|
140
|
-
currency: e
|
|
141
|
-
}).format(i);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function ve(r) {
|
|
145
|
-
if (r === void 0) return null;
|
|
146
|
-
const n = r.trim();
|
|
147
|
-
if (n === "" || typeof window > "u") return null;
|
|
148
|
-
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();
|
|
151
|
-
} catch {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function X(r) {
|
|
156
|
-
return r && r.replace(/\d{4,}/g, "****");
|
|
157
|
-
}
|
|
158
|
-
function he(r) {
|
|
159
|
-
switch (r) {
|
|
160
|
-
case "incorrect_number":
|
|
161
|
-
case "invalid_number":
|
|
162
|
-
return "payment.error.cardNumber";
|
|
163
|
-
case "invalid_expiry_month":
|
|
164
|
-
case "invalid_expiry_year":
|
|
165
|
-
case "expired_card":
|
|
166
|
-
return "payment.error.expiry";
|
|
167
|
-
case "invalid_cvc":
|
|
168
|
-
case "incorrect_cvc":
|
|
169
|
-
return "payment.error.cvc";
|
|
170
|
-
case "incorrect_zip":
|
|
171
|
-
case "invalid_zip":
|
|
172
|
-
return "payment.error.postalCode";
|
|
173
|
-
case "card_declined":
|
|
174
|
-
case "do_not_honor":
|
|
175
|
-
case "generic_decline":
|
|
176
|
-
return "payment.error.declined";
|
|
177
|
-
case "network_error":
|
|
178
|
-
case "api_connection_error":
|
|
179
|
-
return "payment.error.network";
|
|
180
|
-
default:
|
|
181
|
-
return "payment.error.generic";
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const we = z(
|
|
185
|
-
[
|
|
186
|
-
"ds:payment-form-alfadocs ds:flex ds:flex-col",
|
|
187
|
-
"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)]",
|
|
191
|
-
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
192
|
-
].join(" ")
|
|
193
|
-
), T = z(
|
|
194
|
-
["ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"].join(" ")
|
|
195
|
-
), E = z(
|
|
196
|
-
["type-label", "ds:text-[var(--foreground)]"].join(" ")
|
|
197
|
-
), Q = z(
|
|
198
|
-
[
|
|
199
|
-
"ds:flex ds:items-baseline ds:justify-between",
|
|
200
|
-
"ds:gap-[var(--spacing-sm)]",
|
|
201
|
-
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
202
|
-
"ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
|
|
203
|
-
"ds:bg-[var(--muted)]",
|
|
204
|
-
"ds:rounded-[var(--radius-sm)]",
|
|
205
|
-
"ds:text-[var(--foreground)]"
|
|
206
|
-
].join(" ")
|
|
207
|
-
), ee = z(
|
|
208
|
-
[
|
|
209
|
-
"ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]",
|
|
210
|
-
"ds:[min-block-size:var(--min-target-size)]",
|
|
211
|
-
"ds:[min-inline-size:var(--min-target-size)]",
|
|
212
|
-
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
213
|
-
"ds:rounded-[var(--radius-sm)]",
|
|
214
|
-
"ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]",
|
|
215
|
-
"ds:text-[length:var(--font-size-base)] ds:font-medium",
|
|
216
|
-
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
217
|
-
"ds:hover:bg-[var(--primary-hover)]",
|
|
218
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
219
|
-
"ds:focus-visible:outline-solid",
|
|
220
|
-
"ds:focus-visible:outline-[var(--ring)]",
|
|
221
|
-
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
222
|
-
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
223
|
-
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed",
|
|
224
|
-
"ds:aria-busy:cursor-wait"
|
|
225
|
-
].join(" ")
|
|
226
|
-
);
|
|
227
|
-
function xe(r) {
|
|
228
|
-
const {
|
|
229
|
-
amount: n,
|
|
230
|
-
currency: s,
|
|
231
|
-
locale: e,
|
|
232
|
-
billingAddress: i,
|
|
233
|
-
returnUrl: a,
|
|
234
|
-
onSuccess: f,
|
|
235
|
-
onError: N
|
|
236
|
-
} = r, { t: o } = q(), k = le(), S = me(), g = oe(), b = j(
|
|
237
|
-
() => `pay-${g.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
238
|
-
[g]
|
|
239
|
-
), F = `${b}-payment`, L = `${b}-address`, v = `${b}-error`, [u, h] = C(!1), [A, P] = C(!1), [w, x] = C(null), [U, d] = C(""), c = V(f), l = V(N);
|
|
240
|
-
R(() => {
|
|
241
|
-
c.current = f, l.current = N;
|
|
242
|
-
}, [f, N]);
|
|
243
|
-
const D = ie(
|
|
244
|
-
async (p) => {
|
|
245
|
-
var G, H, O, K;
|
|
246
|
-
if (p && p.preventDefault(), !k || !S || u) return;
|
|
247
|
-
h(!0), x(null), d("");
|
|
248
|
-
const _ = ve(a);
|
|
249
|
-
if (a !== void 0 && _ === null) {
|
|
250
|
-
x("payment.error.invalidReturnUrl"), d(o("payment.error.invalidReturnUrl")), (G = l.current) == null || G.call(l, {
|
|
251
|
-
code: "invalid_return_url",
|
|
252
|
-
translatedMessage: o("payment.error.invalidReturnUrl")
|
|
253
|
-
}), h(!1);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
try {
|
|
257
|
-
const y = await k.confirmPayment({
|
|
258
|
-
elements: S,
|
|
259
|
-
confirmParams: _ ? { return_url: _ } : {},
|
|
260
|
-
redirect: "if_required"
|
|
261
|
-
});
|
|
262
|
-
if (y.error) {
|
|
263
|
-
const M = y.error.code ?? "generic", I = he(M), te = X(y.error.message ?? "");
|
|
264
|
-
x(I), d(o(I)), (H = l.current) == null || H.call(l, {
|
|
265
|
-
code: M,
|
|
266
|
-
translatedMessage: te || o(I)
|
|
267
|
-
});
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
y.paymentIntent && ((O = c.current) == null || O.call(c, y.paymentIntent.id));
|
|
271
|
-
} catch (y) {
|
|
272
|
-
const M = y instanceof Error ? y.message : "", I = X(M);
|
|
273
|
-
x("payment.error.generic"), d(o("payment.error.generic")), (K = l.current) == null || K.call(l, {
|
|
274
|
-
code: "unexpected",
|
|
275
|
-
translatedMessage: I || o("payment.error.generic")
|
|
276
|
-
});
|
|
277
|
-
} finally {
|
|
278
|
-
h(!1);
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
[k, S, u, a, o]
|
|
282
|
-
);
|
|
283
|
-
R(() => {
|
|
284
|
-
const p = document.getElementById(b);
|
|
285
|
-
if (!p) return;
|
|
286
|
-
const _ = () => {
|
|
287
|
-
D();
|
|
288
|
-
};
|
|
289
|
-
return p.addEventListener("payment-form:submit", _), () => p.removeEventListener("payment-form:submit", _);
|
|
290
|
-
}, [b, D]);
|
|
291
|
-
const re = !k || !S || !A || u;
|
|
292
|
-
return /* @__PURE__ */ t(
|
|
293
|
-
"form",
|
|
294
|
-
{
|
|
295
|
-
id: b,
|
|
296
|
-
onSubmit: D,
|
|
297
|
-
"aria-label": o("payment.ariaLabel"),
|
|
298
|
-
"aria-busy": u || void 0,
|
|
299
|
-
noValidate: !0,
|
|
300
|
-
children: /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
301
|
-
/* @__PURE__ */ m("div", { className: Q(), children: [
|
|
302
|
-
/* @__PURE__ */ t("span", { className: E(), children: o("payment.amountLabel") }),
|
|
303
|
-
/* @__PURE__ */ t("span", { className: "type-title-card", "data-testid": "payment-amount", children: $(n, s, e) })
|
|
304
|
-
] }),
|
|
305
|
-
/* @__PURE__ */ m(
|
|
306
|
-
"label",
|
|
307
|
-
{
|
|
308
|
-
htmlFor: F,
|
|
309
|
-
className: T(),
|
|
310
|
-
"data-testid": "payment-field",
|
|
311
|
-
children: [
|
|
312
|
-
/* @__PURE__ */ t("span", { className: E(), children: o("payment.fields.card") }),
|
|
313
|
-
/* @__PURE__ */ t(
|
|
314
|
-
ue,
|
|
315
|
-
{
|
|
316
|
-
id: F,
|
|
317
|
-
options: {
|
|
318
|
-
layout: { type: "accordion", defaultCollapsed: !1 }
|
|
319
|
-
},
|
|
320
|
-
onChange: (p) => {
|
|
321
|
-
P(p.complete === !0), p.complete && (x(null), d(""));
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
)
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
),
|
|
328
|
-
i ? /* @__PURE__ */ m(
|
|
329
|
-
"label",
|
|
330
|
-
{
|
|
331
|
-
htmlFor: L,
|
|
332
|
-
className: T(),
|
|
333
|
-
"data-testid": "payment-address",
|
|
334
|
-
children: [
|
|
335
|
-
/* @__PURE__ */ t("span", { className: E(), children: o("payment.billingAddress") }),
|
|
336
|
-
/* @__PURE__ */ t(pe, { id: L, options: { mode: "billing" } })
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
) : null,
|
|
340
|
-
w ? /* @__PURE__ */ t(
|
|
341
|
-
W,
|
|
342
|
-
{
|
|
343
|
-
id: v,
|
|
344
|
-
variant: "error",
|
|
345
|
-
live: "polite",
|
|
346
|
-
"data-testid": "payment-error",
|
|
347
|
-
children: /* @__PURE__ */ t(W.Description, { children: U })
|
|
348
|
-
}
|
|
349
|
-
) : null,
|
|
350
|
-
/* @__PURE__ */ t(
|
|
351
|
-
"button",
|
|
352
|
-
{
|
|
353
|
-
type: "submit",
|
|
354
|
-
"aria-disabled": re || void 0,
|
|
355
|
-
"aria-busy": u || void 0,
|
|
356
|
-
"aria-describedby": w ? v : void 0,
|
|
357
|
-
className: ee(),
|
|
358
|
-
"data-testid": "payment-submit",
|
|
359
|
-
children: u ? /* @__PURE__ */ m(ne, { children: [
|
|
360
|
-
/* @__PURE__ */ t(J, { size: "sm", label: o("payment.processing") }),
|
|
361
|
-
/* @__PURE__ */ t("span", { children: o("payment.processing") })
|
|
362
|
-
] }) : /* @__PURE__ */ t("span", { children: o("payment.submit", {
|
|
363
|
-
amount: $(n, s, e)
|
|
364
|
-
}) })
|
|
365
|
-
}
|
|
366
|
-
)
|
|
367
|
-
] })
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
const Z = /* @__PURE__ */ new Set([
|
|
372
|
-
"auto",
|
|
373
|
-
"ar",
|
|
374
|
-
"bg",
|
|
375
|
-
"cs",
|
|
376
|
-
"da",
|
|
377
|
-
"de",
|
|
378
|
-
"el",
|
|
379
|
-
"en",
|
|
380
|
-
"en-AU",
|
|
381
|
-
"en-CA",
|
|
382
|
-
"en-NZ",
|
|
383
|
-
"en-GB",
|
|
384
|
-
"es",
|
|
385
|
-
"es-ES",
|
|
386
|
-
"es-419",
|
|
387
|
-
"et",
|
|
388
|
-
"fi",
|
|
389
|
-
"fil",
|
|
390
|
-
"fr",
|
|
391
|
-
"fr-CA",
|
|
392
|
-
"fr-FR",
|
|
393
|
-
"he",
|
|
394
|
-
"hu",
|
|
395
|
-
"hr",
|
|
396
|
-
"id",
|
|
397
|
-
"it",
|
|
398
|
-
"it-IT",
|
|
399
|
-
"ja",
|
|
400
|
-
"ko",
|
|
401
|
-
"lt",
|
|
402
|
-
"lv",
|
|
403
|
-
"ms",
|
|
404
|
-
"mt",
|
|
405
|
-
"nb",
|
|
406
|
-
"nl",
|
|
407
|
-
"no",
|
|
408
|
-
"pl",
|
|
409
|
-
"pt",
|
|
410
|
-
"pt-BR",
|
|
411
|
-
"ro",
|
|
412
|
-
"ru",
|
|
413
|
-
"sk",
|
|
414
|
-
"sl",
|
|
415
|
-
"sv",
|
|
416
|
-
"th",
|
|
417
|
-
"tr",
|
|
418
|
-
"vi",
|
|
419
|
-
"zh",
|
|
420
|
-
"zh-HK",
|
|
421
|
-
"zh-TW"
|
|
422
|
-
]);
|
|
423
|
-
function Ne(r) {
|
|
424
|
-
if (!r) return "auto";
|
|
425
|
-
const n = r === "cn" ? "zh" : r;
|
|
426
|
-
if (Z.has(n))
|
|
427
|
-
return n;
|
|
428
|
-
const s = n.split("-")[0];
|
|
429
|
-
return Z.has(s) ? s : "auto";
|
|
430
|
-
}
|
|
431
|
-
const ke = se(
|
|
432
|
-
({
|
|
433
|
-
id: r,
|
|
434
|
-
clientSecret: n,
|
|
435
|
-
publishableKey: s,
|
|
436
|
-
currency: e,
|
|
437
|
-
amount: i,
|
|
438
|
-
onSuccess: a,
|
|
439
|
-
onError: f,
|
|
440
|
-
billingAddress: N = !1,
|
|
441
|
-
locale: o,
|
|
442
|
-
ariaLabel: k,
|
|
443
|
-
returnUrl: S,
|
|
444
|
-
stripePromise: g,
|
|
445
|
-
className: b
|
|
446
|
-
}, F) => {
|
|
447
|
-
const { i18n: L } = q(), v = Ne(o ?? L.language ?? "en"), [u, h] = C(g ?? null);
|
|
448
|
-
R(() => {
|
|
449
|
-
if (g !== void 0) {
|
|
450
|
-
h(g);
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
if (!s) {
|
|
454
|
-
h(null);
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
h(de(s));
|
|
458
|
-
}, [g, s]);
|
|
459
|
-
const [A, P] = C(
|
|
460
|
-
() => B()
|
|
461
|
-
);
|
|
462
|
-
R(() => (P(B()), be(P)), []);
|
|
463
|
-
const w = V(null), x = j(
|
|
464
|
-
() => ({
|
|
465
|
-
submit: async () => {
|
|
466
|
-
var c;
|
|
467
|
-
const d = (c = w.current) == null ? void 0 : c.querySelector("form");
|
|
468
|
-
d && d.dispatchEvent(
|
|
469
|
-
new CustomEvent("payment-form:submit", { bubbles: !0 })
|
|
470
|
-
);
|
|
471
|
-
},
|
|
472
|
-
reset: () => {
|
|
473
|
-
var c;
|
|
474
|
-
const d = (c = w.current) == null ? void 0 : c.querySelector("form");
|
|
475
|
-
d instanceof HTMLFormElement && d.reset();
|
|
476
|
-
}
|
|
477
|
-
}),
|
|
478
|
-
[]
|
|
479
|
-
);
|
|
480
|
-
ae(F, () => w.current, []), fe(ye, x, r);
|
|
481
|
-
const U = j(
|
|
482
|
-
() => ({
|
|
483
|
-
clientSecret: n,
|
|
484
|
-
appearance: A,
|
|
485
|
-
locale: v
|
|
486
|
-
}),
|
|
487
|
-
[n, A, v]
|
|
488
|
-
);
|
|
489
|
-
return /* @__PURE__ */ t(
|
|
490
|
-
"div",
|
|
491
|
-
{
|
|
492
|
-
ref: w,
|
|
493
|
-
"aria-label": k,
|
|
494
|
-
className: [we(), b].filter(Boolean).join(" "),
|
|
495
|
-
"data-component": "payment-form",
|
|
496
|
-
"data-component-id": r,
|
|
497
|
-
"data-testid": "payment-form-root",
|
|
498
|
-
children: u && n ? /* @__PURE__ */ t(
|
|
499
|
-
ce,
|
|
500
|
-
{
|
|
501
|
-
stripe: u,
|
|
502
|
-
options: U,
|
|
503
|
-
children: /* @__PURE__ */ t(
|
|
504
|
-
xe,
|
|
505
|
-
{
|
|
506
|
-
amount: i,
|
|
507
|
-
currency: e,
|
|
508
|
-
locale: v,
|
|
509
|
-
billingAddress: N,
|
|
510
|
-
returnUrl: S,
|
|
511
|
-
onSuccess: a,
|
|
512
|
-
onError: f
|
|
513
|
-
}
|
|
514
|
-
)
|
|
515
|
-
},
|
|
516
|
-
n
|
|
517
|
-
) : /* @__PURE__ */ t(
|
|
518
|
-
Se,
|
|
519
|
-
{
|
|
520
|
-
amount: i,
|
|
521
|
-
currency: e,
|
|
522
|
-
locale: v,
|
|
523
|
-
billingAddress: N
|
|
524
|
-
}
|
|
525
|
-
)
|
|
526
|
-
}
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
);
|
|
530
|
-
ke.displayName = "PaymentForm";
|
|
531
|
-
function Se(r) {
|
|
532
|
-
const { amount: n, currency: s, locale: e, billingAddress: i } = r, { t: a } = q();
|
|
533
|
-
return /* @__PURE__ */ m(
|
|
534
|
-
"div",
|
|
535
|
-
{
|
|
536
|
-
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
537
|
-
"data-testid": "payment-skeleton",
|
|
538
|
-
"aria-busy": "true",
|
|
539
|
-
children: [
|
|
540
|
-
/* @__PURE__ */ m("div", { className: Q(), children: [
|
|
541
|
-
/* @__PURE__ */ t("span", { className: E(), children: a("payment.amountLabel") }),
|
|
542
|
-
/* @__PURE__ */ t("span", { className: "type-title-card", children: $(n, s, e) })
|
|
543
|
-
] }),
|
|
544
|
-
/* @__PURE__ */ m("div", { className: T(), children: [
|
|
545
|
-
/* @__PURE__ */ t("span", { className: E(), children: a("payment.fields.card") }),
|
|
546
|
-
/* @__PURE__ */ t(
|
|
547
|
-
"div",
|
|
548
|
-
{
|
|
549
|
-
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)]",
|
|
550
|
-
"aria-hidden": "true"
|
|
551
|
-
}
|
|
552
|
-
)
|
|
553
|
-
] }),
|
|
554
|
-
i ? /* @__PURE__ */ m("div", { className: T(), "data-testid": "payment-address", children: [
|
|
555
|
-
/* @__PURE__ */ t("span", { className: E(), children: a("payment.billingAddress") }),
|
|
556
|
-
/* @__PURE__ */ t(
|
|
557
|
-
"div",
|
|
558
|
-
{
|
|
559
|
-
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)]",
|
|
560
|
-
"aria-hidden": "true"
|
|
561
|
-
}
|
|
562
|
-
)
|
|
563
|
-
] }) : null,
|
|
564
|
-
/* @__PURE__ */ m(
|
|
565
|
-
"button",
|
|
566
|
-
{
|
|
567
|
-
type: "button",
|
|
568
|
-
"aria-disabled": "true",
|
|
569
|
-
className: ee(),
|
|
570
|
-
disabled: !0,
|
|
571
|
-
children: [
|
|
572
|
-
/* @__PURE__ */ t(J, { size: "sm", label: a("payment.processing") }),
|
|
573
|
-
/* @__PURE__ */ t("span", { children: a("payment.processing") })
|
|
574
|
-
]
|
|
575
|
-
}
|
|
576
|
-
)
|
|
577
|
-
]
|
|
578
|
-
}
|
|
579
|
-
);
|
|
580
|
-
}
|
|
581
|
-
export {
|
|
582
|
-
ke as P,
|
|
583
|
-
we as a,
|
|
584
|
-
X as b,
|
|
585
|
-
he as c,
|
|
586
|
-
$ as f,
|
|
587
|
-
ye as p,
|
|
588
|
-
ee as s
|
|
589
|
-
};
|
|
590
|
-
//# sourceMappingURL=payment-form-BzVsG6Ks.js.map
|