@alfadocs/ui-kit-debug 1.46.0 → 1.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/booking-C4MwImkS.js +3362 -0
- package/dist/_chunks/booking-C4MwImkS.js.map +1 -0
- package/dist/_chunks/calendar-workspace-DDnQmiIL.js +12427 -0
- package/dist/_chunks/calendar-workspace-DDnQmiIL.js.map +1 -0
- package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js → freemium-paywall-BaW5ODc9.js} +2 -2
- package/dist/_chunks/{freemium-paywall-Cz-O9lQD.js.map → freemium-paywall-BaW5ODc9.js.map} +1 -1
- package/dist/_chunks/{patient-details-DUj1htsH.js → patient-details-yrgkSeEY.js} +2 -2
- package/dist/_chunks/{patient-details-DUj1htsH.js.map → patient-details-yrgkSeEY.js.map} +1 -1
- package/dist/_chunks/{patient-field-row-CO0WR7yA.js → patient-field-row-DCMkFGqI.js} +2 -2
- package/dist/_chunks/{patient-field-row-CO0WR7yA.js.map → patient-field-row-DCMkFGqI.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-DNzdYjxE.js → patient-summary-card-CmEFflGS.js} +2 -2
- package/dist/_chunks/{patient-summary-card-DNzdYjxE.js.map → patient-summary-card-CmEFflGS.js.map} +1 -1
- package/dist/_chunks/payment-form-DqJFiplX.js +881 -0
- package/dist/_chunks/payment-form-DqJFiplX.js.map +1 -0
- package/dist/_chunks/{phone-input-BsZIoE36.js → phone-input-IWrGOCwm.js} +40 -39
- package/dist/_chunks/{phone-input-BsZIoE36.js.map → phone-input-IWrGOCwm.js.map} +1 -1
- package/dist/_chunks/{stepper-accordion-DmVykr5F.js → stepper-accordion-jMR8NaOB.js} +2 -1
- package/dist/_chunks/{stepper-accordion-DmVykr5F.js.map → stepper-accordion-jMR8NaOB.js.map} +1 -1
- package/dist/agent-catalog.json +5 -4
- package/dist/agent-i18n/en.json +2 -2
- package/dist/components/booking/booking-types.d.ts +60 -1
- package/dist/components/booking/booking-types.d.ts.map +1 -1
- package/dist/components/booking/booking.agent.d.ts.map +1 -1
- package/dist/components/booking/booking.d.ts +1 -1
- package/dist/components/booking/booking.d.ts.map +1 -1
- package/dist/components/booking/details-form.d.ts +5 -1
- package/dist/components/booking/details-form.d.ts.map +1 -1
- package/dist/components/booking/index.d.ts +1 -1
- package/dist/components/booking/index.d.ts.map +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/booking/payment.d.ts +9 -0
- package/dist/components/booking/payment.d.ts.map +1 -0
- package/dist/components/booking/use-booking-payment.d.ts +14 -0
- package/dist/components/booking/use-booking-payment.d.ts.map +1 -0
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/payment-form/index.d.ts +1 -1
- package/dist/components/payment-form/index.d.ts.map +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/payment-form/payment-form.d.ts +35 -3
- package/dist/components/payment-form/payment-form.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/stepper-accordion/index.js +1 -1
- package/dist/components/stepper-accordion/stepper-accordion.d.ts.map +1 -1
- package/dist/i18n/locales/ar.d.ts +36 -1
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +36 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +36 -1
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +36 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +36 -1
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +36 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +36 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +36 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +36 -1
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +36 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +36 -1
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +36 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +36 -1
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +36 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +36 -1
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +36 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +36 -1
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +36 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +36 -1
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +36 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +36 -1
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +36 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +36 -1
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +36 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +36 -1
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +36 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +36 -1
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +36 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +36 -1
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +36 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +36 -1
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +36 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +36 -1
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +36 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +36 -1
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +36 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/locales/ar.json +36 -1
- package/dist/locales/de.json +36 -1
- package/dist/locales/el.json +36 -1
- package/dist/locales/en.json +36 -1
- package/dist/locales/es.json +36 -1
- package/dist/locales/fr.json +36 -1
- package/dist/locales/hi.json +36 -1
- package/dist/locales/it.json +36 -1
- package/dist/locales/ja.json +36 -1
- package/dist/locales/nl.json +36 -1
- package/dist/locales/pl.json +36 -1
- package/dist/locales/pt.json +36 -1
- package/dist/locales/ro.json +36 -1
- package/dist/locales/ru.json +36 -1
- package/dist/locales/sq.json +36 -1
- package/dist/locales/sv.json +36 -1
- package/dist/locales/tr.json +36 -1
- package/dist/locales/zh.json +36 -1
- package/dist/patterns/calendar/calendar-bookings-panel.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar-editor-fields.d.ts +33 -0
- package/dist/patterns/calendar/calendar-editor-fields.d.ts.map +1 -0
- package/dist/patterns/calendar/calendar-sticky-offset.d.ts +20 -0
- package/dist/patterns/calendar/calendar-sticky-offset.d.ts.map +1 -0
- package/dist/patterns/calendar/calendar-task-editor.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar-workspace.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.data.d.ts +17 -0
- package/dist/patterns/calendar/calendar.data.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.types.d.ts +24 -10
- package/dist/patterns/calendar/calendar.types.d.ts.map +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/booking-B7gA9gFB.js +0 -3017
- package/dist/_chunks/booking-B7gA9gFB.js.map +0 -1
- package/dist/_chunks/calendar-workspace-BB-BZT7W.js +0 -12251
- package/dist/_chunks/calendar-workspace-BB-BZT7W.js.map +0 -1
- package/dist/_chunks/payment-form-BHMDqW9C.js +0 -767
- package/dist/_chunks/payment-form-BHMDqW9C.js.map +0 -1
|
@@ -0,0 +1,881 @@
|
|
|
1
|
+
import { jsx as n, jsxs as v, Fragment as De } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Te, useMemo as pe, useState as _, useEffect as V, useRef as b, useImperativeHandle as Me, useId as Ve, useCallback as me } from "react";
|
|
3
|
+
import { c as re } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as he } from "react-i18next";
|
|
5
|
+
import { S as Pe } from "./spinner-hbwuKwMf.js";
|
|
6
|
+
import { A as xe } from "./alert-CiQ5Pa3Q.js";
|
|
7
|
+
import { loadStripe as Ae } from "@stripe/stripe-js/pure";
|
|
8
|
+
import { Elements as $e, useStripe as je, useElements as Ue, AddressElement as Ee, PaymentElement as qe } from "@stripe/react-stripe-js";
|
|
9
|
+
import { u as Ge } from "./registry-DvAUVLHh.js";
|
|
10
|
+
function Fe() {
|
|
11
|
+
return typeof document < "u" && typeof window < "u";
|
|
12
|
+
}
|
|
13
|
+
function be(r) {
|
|
14
|
+
if (!Fe())
|
|
15
|
+
return { theme: "stripe" };
|
|
16
|
+
const s = r ?? document.documentElement, o = getComputedStyle(s), e = (a) => o.getPropertyValue(a).trim();
|
|
17
|
+
return {
|
|
18
|
+
theme: s.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, s) {
|
|
95
|
+
if (!Fe()) return () => {
|
|
96
|
+
};
|
|
97
|
+
const o = document.documentElement, e = () => r(be(s)), u = new MutationObserver(e);
|
|
98
|
+
u.observe(o, {
|
|
99
|
+
attributes: !0,
|
|
100
|
+
attributeFilter: ["class", "dir", "lang"]
|
|
101
|
+
});
|
|
102
|
+
const a = window.matchMedia("(prefers-color-scheme: dark)"), d = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
103
|
+
return a.addEventListener("change", e), d.addEventListener("change", e), () => {
|
|
104
|
+
u.disconnect(), a.removeEventListener("change", e), d.removeEventListener("change", e);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const We = {
|
|
108
|
+
id: "payment-form",
|
|
109
|
+
capabilities: ["submit"],
|
|
110
|
+
// The kit's only destructive + openWorld action that moves real money,
|
|
111
|
+
// so it is also the one that most needs to be verifiable. `submit`
|
|
112
|
+
// resolves once the charge attempt has settled; these four slots are
|
|
113
|
+
// how an agent then tells success from decline from never-fired, and
|
|
114
|
+
// how it recovers the receipt.
|
|
115
|
+
//
|
|
116
|
+
// A9: the PaymentIntent id and the i18n error KEY only. Never card
|
|
117
|
+
// fields (they live in Stripe's cross-origin iframes and never reach
|
|
118
|
+
// this origin), never the translated Stripe message, never
|
|
119
|
+
// `clientSecret`.
|
|
120
|
+
state: {
|
|
121
|
+
status: {
|
|
122
|
+
type: "'idle' | 'processing' | 'succeeded' | 'failed'",
|
|
123
|
+
descriptionKey: "ui.agent.paymentForm.state.status",
|
|
124
|
+
description: "Lifecycle of the current payment attempt. `succeeded` is only reached once Stripe confirmed the PaymentIntent; `failed` covers validation, decline and processor errors alike. Still `idle` after `submit` means the attempt never fired — Stripe had not mounted.",
|
|
125
|
+
read: (r) => r.getStatus()
|
|
126
|
+
},
|
|
127
|
+
complete: {
|
|
128
|
+
type: "boolean",
|
|
129
|
+
descriptionKey: "ui.agent.paymentForm.state.complete",
|
|
130
|
+
description: "True when Stripe reports the payment fields, and any required billing address, as complete. Read this before `submit` — outside preview mode the submit control is disabled while it is false, so the call will not be accepted.",
|
|
131
|
+
read: (r) => r.isComplete()
|
|
132
|
+
},
|
|
133
|
+
errorKey: {
|
|
134
|
+
type: "string | null",
|
|
135
|
+
descriptionKey: "ui.agent.paymentForm.state.errorKey",
|
|
136
|
+
description: "i18n key of the current error (e.g. `payment.error.cardDeclined`), or null. The key is the structural datum — the translated message is free text and is never exposed.",
|
|
137
|
+
read: (r) => r.getErrorKey()
|
|
138
|
+
},
|
|
139
|
+
paymentIntentId: {
|
|
140
|
+
type: "string | null",
|
|
141
|
+
descriptionKey: "ui.agent.paymentForm.state.paymentIntentId",
|
|
142
|
+
description: "Opaque Stripe PaymentIntent id once a charge succeeded, else null. The receipt — the attribution handle for the money that moved. Never the client secret.",
|
|
143
|
+
read: (r) => r.getPaymentIntentId()
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
actions: {
|
|
147
|
+
submit: {
|
|
148
|
+
safety: "destructive",
|
|
149
|
+
// Charges an external payment processor — irreversible, hits a system
|
|
150
|
+
// outside this UI.
|
|
151
|
+
openWorld: !0,
|
|
152
|
+
returns: "Promise<void>",
|
|
153
|
+
errors: [
|
|
154
|
+
'Validation failed (incomplete or invalid card details) — `status` is "failed", `errorKey` names which.',
|
|
155
|
+
'Payment was declined by the processor — `status` is "failed", `errorKey` is `payment.error.cardDeclined`.',
|
|
156
|
+
'Network or processor error during the charge — `status` is "failed".',
|
|
157
|
+
'Stripe had not mounted, so nothing was attempted — `status` is still "idle".'
|
|
158
|
+
],
|
|
159
|
+
descriptionKey: "ui.agent.paymentForm.actions.submit",
|
|
160
|
+
description: "Submit the payment. Charges the configured payment method — irreversible. Resolves once the attempt has settled; the outcome is never in the resolved value, so read `status`, then `errorKey` on failure or `paymentIntentId` on success.",
|
|
161
|
+
invoke: (r) => r.submit()
|
|
162
|
+
},
|
|
163
|
+
reset: {
|
|
164
|
+
safety: "destructive",
|
|
165
|
+
idempotent: !0,
|
|
166
|
+
descriptionKey: "ui.agent.paymentForm.actions.reset",
|
|
167
|
+
description: 'Clear recoverable errors and return their status to "idle". Stripe fields remain unchanged. Pending or paid attempts cannot be reset and require a new session.',
|
|
168
|
+
invoke: (r) => {
|
|
169
|
+
r.reset();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
domHooks: {
|
|
174
|
+
root: { attr: "data-component", value: "payment-form" },
|
|
175
|
+
instanceId: {
|
|
176
|
+
attr: "data-component-id",
|
|
177
|
+
sourceProp: "id",
|
|
178
|
+
description: "Sourced from the id prop."
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, Oe = /* @__PURE__ */ new Set([
|
|
182
|
+
"BIF",
|
|
183
|
+
"CLP",
|
|
184
|
+
"DJF",
|
|
185
|
+
"GNF",
|
|
186
|
+
"IDR",
|
|
187
|
+
"JPY",
|
|
188
|
+
"KMF",
|
|
189
|
+
"KRW",
|
|
190
|
+
"MGA",
|
|
191
|
+
"PYG",
|
|
192
|
+
"RWF",
|
|
193
|
+
"UGX",
|
|
194
|
+
"VND",
|
|
195
|
+
"VUV",
|
|
196
|
+
"XAF",
|
|
197
|
+
"XOF",
|
|
198
|
+
"XPF"
|
|
199
|
+
]);
|
|
200
|
+
function ve(r, s, o) {
|
|
201
|
+
const e = s.toUpperCase(), u = Oe.has(e) ? r : r / 100;
|
|
202
|
+
try {
|
|
203
|
+
return new Intl.NumberFormat(o, {
|
|
204
|
+
style: "currency",
|
|
205
|
+
currency: e
|
|
206
|
+
}).format(u);
|
|
207
|
+
} catch {
|
|
208
|
+
return new Intl.NumberFormat("en", {
|
|
209
|
+
style: "currency",
|
|
210
|
+
currency: e
|
|
211
|
+
}).format(u);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function Xe(r) {
|
|
215
|
+
if (r === void 0) return null;
|
|
216
|
+
const s = r.trim();
|
|
217
|
+
if (s === "" || typeof window > "u") return null;
|
|
218
|
+
try {
|
|
219
|
+
const o = new URL(s, window.location.href);
|
|
220
|
+
return !(/* @__PURE__ */ new Set(["http:", "https:"])).has(o.protocol) || o.origin !== window.location.origin ? null : o.toString();
|
|
221
|
+
} catch {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function Ze(r) {
|
|
226
|
+
return r && r.replace(/\d{4,}/g, "****");
|
|
227
|
+
}
|
|
228
|
+
function Je(r) {
|
|
229
|
+
switch (r) {
|
|
230
|
+
case "incorrect_number":
|
|
231
|
+
case "invalid_number":
|
|
232
|
+
return "payment.error.cardNumber";
|
|
233
|
+
case "invalid_expiry_month":
|
|
234
|
+
case "invalid_expiry_year":
|
|
235
|
+
case "expired_card":
|
|
236
|
+
return "payment.error.expiry";
|
|
237
|
+
case "invalid_cvc":
|
|
238
|
+
case "incorrect_cvc":
|
|
239
|
+
return "payment.error.cvc";
|
|
240
|
+
case "incorrect_zip":
|
|
241
|
+
case "invalid_zip":
|
|
242
|
+
return "payment.error.postalCode";
|
|
243
|
+
case "card_declined":
|
|
244
|
+
case "do_not_honor":
|
|
245
|
+
case "generic_decline":
|
|
246
|
+
return "payment.error.declined";
|
|
247
|
+
case "network_error":
|
|
248
|
+
case "api_connection_error":
|
|
249
|
+
return "payment.error.network";
|
|
250
|
+
case "billing_address_incomplete":
|
|
251
|
+
return "payment.error.billingAddressIncomplete";
|
|
252
|
+
case "billing_details_save":
|
|
253
|
+
return "payment.error.billingDetailsSave";
|
|
254
|
+
case "billing_details_changed":
|
|
255
|
+
return "payment.error.billingDetailsChanged";
|
|
256
|
+
default:
|
|
257
|
+
return "payment.error.generic";
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const Ye = re(
|
|
261
|
+
[
|
|
262
|
+
"ds:payment-form-alfadocs ds:flex ds:flex-col",
|
|
263
|
+
"ds:gap-[var(--spacing-md)]",
|
|
264
|
+
// Transparent, padding-less container — the consuming surface (a Card, the
|
|
265
|
+
// check-in step, a checkout column) owns the card chrome + padding, so the
|
|
266
|
+
// Stripe method boxes never read as cards nested inside another card.
|
|
267
|
+
"ds:text-[var(--foreground)]",
|
|
268
|
+
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
269
|
+
].join(" ")
|
|
270
|
+
), fe = re(
|
|
271
|
+
["ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"].join(" ")
|
|
272
|
+
), G = re(
|
|
273
|
+
["type-label", "ds:text-[var(--foreground)]"].join(" ")
|
|
274
|
+
), Ke = re(
|
|
275
|
+
[
|
|
276
|
+
"ds:flex ds:items-baseline ds:justify-between",
|
|
277
|
+
"ds:gap-[var(--spacing-sm)]",
|
|
278
|
+
"ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
279
|
+
"ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]",
|
|
280
|
+
"ds:bg-[var(--muted)]",
|
|
281
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
282
|
+
"ds:text-[var(--foreground)]"
|
|
283
|
+
].join(" ")
|
|
284
|
+
), Le = re(
|
|
285
|
+
[
|
|
286
|
+
"ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]",
|
|
287
|
+
"ds:[min-block-size:var(--min-target-size)]",
|
|
288
|
+
"ds:[min-inline-size:var(--min-target-size)]",
|
|
289
|
+
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
290
|
+
"ds:rounded-[var(--radius-sm)]",
|
|
291
|
+
"ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]",
|
|
292
|
+
"ds:text-[length:var(--font-size-base)] ds:font-medium",
|
|
293
|
+
"ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
|
|
294
|
+
"ds:hover:bg-[var(--primary-hover)]",
|
|
295
|
+
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
296
|
+
"ds:focus-visible:outline-solid",
|
|
297
|
+
"ds:focus-visible:outline-[var(--ring)]",
|
|
298
|
+
"ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
|
|
299
|
+
"ds:forced-colors:focus-visible:outline-[CanvasText]",
|
|
300
|
+
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed",
|
|
301
|
+
"ds:aria-busy:cursor-wait"
|
|
302
|
+
].join(" ")
|
|
303
|
+
);
|
|
304
|
+
function Qe(r) {
|
|
305
|
+
const {
|
|
306
|
+
amount: s,
|
|
307
|
+
currency: o,
|
|
308
|
+
locale: e,
|
|
309
|
+
billingAddress: u,
|
|
310
|
+
requireBillingAddress: a,
|
|
311
|
+
defaultBillingDetails: d,
|
|
312
|
+
onBillingDetails: $,
|
|
313
|
+
returnUrl: h,
|
|
314
|
+
clientSecret: p,
|
|
315
|
+
onCreatePaymentIntent: P,
|
|
316
|
+
onPreviewValidated: H,
|
|
317
|
+
onSuccess: W,
|
|
318
|
+
onPaymentStatusChange: O,
|
|
319
|
+
onError: X,
|
|
320
|
+
layout: ye,
|
|
321
|
+
agentBridge: i
|
|
322
|
+
} = r, { t: c } = he(), j = je(), C = Ue(), [U] = _(
|
|
323
|
+
() => d ? {
|
|
324
|
+
name: d.name,
|
|
325
|
+
address: {
|
|
326
|
+
line1: d.address.line1,
|
|
327
|
+
line2: d.address.line2,
|
|
328
|
+
city: d.address.city,
|
|
329
|
+
state: d.address.state,
|
|
330
|
+
postal_code: d.address.postalCode,
|
|
331
|
+
country: d.address.country
|
|
332
|
+
}
|
|
333
|
+
} : void 0
|
|
334
|
+
), te = Ve(), k = pe(
|
|
335
|
+
() => `pay-${te.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
336
|
+
[te]
|
|
337
|
+
), ne = `${k}-payment`, se = `${k}-address`, x = `${k}-error`, [F, K] = _(!1), [L, ae] = _(!1), z = b(!1), l = b(!0), [A, ie] = _(!1), [w, E] = _(!1), Z = b(0), [J, f] = _(null), [N, I] = _("");
|
|
338
|
+
V(() => {
|
|
339
|
+
i.current.complete = A && (!a || w);
|
|
340
|
+
}, [i, A, a, w]);
|
|
341
|
+
const y = me(
|
|
342
|
+
(t) => {
|
|
343
|
+
i.current.status = t;
|
|
344
|
+
},
|
|
345
|
+
[i]
|
|
346
|
+
), R = me(
|
|
347
|
+
(t) => {
|
|
348
|
+
i.current.errorKey = t, f(t);
|
|
349
|
+
},
|
|
350
|
+
[i]
|
|
351
|
+
), ze = me(
|
|
352
|
+
(t) => {
|
|
353
|
+
i.current.complete = t && (!a || w), ie(t);
|
|
354
|
+
},
|
|
355
|
+
[i, a, w]
|
|
356
|
+
), oe = b(W), de = b(O), B = b(X), we = b($), ce = b(H);
|
|
357
|
+
V(() => {
|
|
358
|
+
oe.current = W, de.current = O, B.current = X, we.current = $, ce.current = H;
|
|
359
|
+
}, [
|
|
360
|
+
W,
|
|
361
|
+
O,
|
|
362
|
+
X,
|
|
363
|
+
$,
|
|
364
|
+
H
|
|
365
|
+
]);
|
|
366
|
+
const q = me(
|
|
367
|
+
async (t) => {
|
|
368
|
+
var Se, _e, Ce, ke;
|
|
369
|
+
if (t && t.preventDefault(), !j || !C || z.current || !l.current) return;
|
|
370
|
+
z.current = !0, K(!0), y("processing"), i.current.paymentIntentId = null, R(null), I("");
|
|
371
|
+
const m = (S, Y) => {
|
|
372
|
+
var D;
|
|
373
|
+
const Q = Je(S), ee = Ze(Y ?? "");
|
|
374
|
+
R(Q), I(c(Q)), y("failed"), (D = B.current) == null || D.call(B, {
|
|
375
|
+
code: S,
|
|
376
|
+
translatedMessage: ee || c(Q)
|
|
377
|
+
});
|
|
378
|
+
}, ge = Xe(h);
|
|
379
|
+
if (h !== void 0 && ge === null) {
|
|
380
|
+
R("payment.error.invalidReturnUrl"), I(c("payment.error.invalidReturnUrl")), y("failed"), (Se = B.current) == null || Se.call(B, {
|
|
381
|
+
code: "invalid_return_url",
|
|
382
|
+
translatedMessage: c("payment.error.invalidReturnUrl")
|
|
383
|
+
}), K(!1), z.current = !1;
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
const Be = ge ? { return_url: ge } : {};
|
|
387
|
+
let le = !1;
|
|
388
|
+
const Ie = we.current;
|
|
389
|
+
try {
|
|
390
|
+
let S;
|
|
391
|
+
if (p === void 0) {
|
|
392
|
+
const { error: T } = await C.submit();
|
|
393
|
+
if (!l.current) return;
|
|
394
|
+
if (T) {
|
|
395
|
+
m(T.code ?? "generic", T.message);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
let Y;
|
|
400
|
+
const Q = Z.current, ee = () => a && Q !== Z.current;
|
|
401
|
+
if (a) {
|
|
402
|
+
const T = C.getElement(Ee), ue = await (T == null ? void 0 : T.getValue());
|
|
403
|
+
if (!l.current) return;
|
|
404
|
+
if (ee()) {
|
|
405
|
+
m("billing_details_changed", void 0);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (!(ue != null && ue.complete)) {
|
|
409
|
+
m("billing_address_incomplete", void 0);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const M = ue.value;
|
|
413
|
+
Y = {
|
|
414
|
+
name: M.name,
|
|
415
|
+
address: {
|
|
416
|
+
line1: M.address.line1,
|
|
417
|
+
line2: M.address.line2,
|
|
418
|
+
city: M.address.city,
|
|
419
|
+
state: M.address.state,
|
|
420
|
+
postalCode: M.address.postal_code,
|
|
421
|
+
country: M.address.country
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
if (p === void 0 && !P) {
|
|
426
|
+
await ((_e = ce.current) == null ? void 0 : _e.call(ce));
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
if (Y && Ie) {
|
|
430
|
+
try {
|
|
431
|
+
await Ie(Y);
|
|
432
|
+
} catch {
|
|
433
|
+
l.current && m("billing_details_save", void 0);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (!l.current) return;
|
|
437
|
+
}
|
|
438
|
+
if (ee()) {
|
|
439
|
+
m("billing_details_changed", void 0);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (p === void 0 && P && (S = await P(), !l.current))
|
|
443
|
+
return;
|
|
444
|
+
if (ee()) {
|
|
445
|
+
m("billing_details_changed", void 0);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const D = await j.confirmPayment({
|
|
449
|
+
elements: C,
|
|
450
|
+
...S === void 0 ? {} : { clientSecret: S },
|
|
451
|
+
confirmParams: Be,
|
|
452
|
+
redirect: "if_required"
|
|
453
|
+
});
|
|
454
|
+
if (!l.current) return;
|
|
455
|
+
if (D.error) {
|
|
456
|
+
m(D.error.code ?? "generic", D.error.message);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const g = D.paymentIntent;
|
|
460
|
+
if (le = !0, !g) return;
|
|
461
|
+
g.status === "succeeded" ? (i.current.paymentIntentId = g.id, y("succeeded"), ae(!0), K(!1)) : (g.status === "requires_payment_method" || g.status === "canceled") && (le = !1, m(g.status, void 0));
|
|
462
|
+
try {
|
|
463
|
+
(Ce = de.current) == null || Ce.call(de, g.status, g.id);
|
|
464
|
+
} catch {
|
|
465
|
+
}
|
|
466
|
+
g.status === "succeeded" && ((ke = oe.current) == null || ke.call(oe, g.id));
|
|
467
|
+
} catch (S) {
|
|
468
|
+
l.current && !le && m("unexpected", S instanceof Error ? S.message : "");
|
|
469
|
+
} finally {
|
|
470
|
+
l.current && !le && (z.current = !1, K(!1), i.current.status === "processing" && y("idle"));
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
[
|
|
474
|
+
j,
|
|
475
|
+
C,
|
|
476
|
+
h,
|
|
477
|
+
p,
|
|
478
|
+
P,
|
|
479
|
+
a,
|
|
480
|
+
c,
|
|
481
|
+
i,
|
|
482
|
+
R,
|
|
483
|
+
y
|
|
484
|
+
]
|
|
485
|
+
);
|
|
486
|
+
V(() => {
|
|
487
|
+
const t = document.getElementById(k);
|
|
488
|
+
if (!t) return;
|
|
489
|
+
const m = () => {
|
|
490
|
+
q();
|
|
491
|
+
};
|
|
492
|
+
return t.addEventListener("payment-form:submit", m), () => t.removeEventListener("payment-form:submit", m);
|
|
493
|
+
}, [k, q]), V(() => {
|
|
494
|
+
const t = i.current;
|
|
495
|
+
return t.submit = q, () => {
|
|
496
|
+
t.submit === q && (t.submit = void 0);
|
|
497
|
+
};
|
|
498
|
+
}, [i, q]), V(() => {
|
|
499
|
+
const t = i.current;
|
|
500
|
+
return l.current = !0, t.status = "idle", t.paymentIntentId = null, t.errorKey = null, t.complete = !1, () => {
|
|
501
|
+
l.current = !1, t.complete = !1, t.status = "idle", t.paymentIntentId = null, t.errorKey = null;
|
|
502
|
+
};
|
|
503
|
+
}, [i]);
|
|
504
|
+
const Re = !j || !C || F || L || !(p === void 0 && !P) && (!A || a && !w);
|
|
505
|
+
return /* @__PURE__ */ n(
|
|
506
|
+
"form",
|
|
507
|
+
{
|
|
508
|
+
id: k,
|
|
509
|
+
onSubmit: q,
|
|
510
|
+
onReset: () => {
|
|
511
|
+
z.current || (R(null), I(""), y("idle"), i.current.paymentIntentId = null);
|
|
512
|
+
},
|
|
513
|
+
"aria-label": c("payment.ariaLabel"),
|
|
514
|
+
"aria-busy": F || void 0,
|
|
515
|
+
noValidate: !0,
|
|
516
|
+
children: /* @__PURE__ */ v("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
517
|
+
/* @__PURE__ */ v("div", { className: Ke(), children: [
|
|
518
|
+
/* @__PURE__ */ n("span", { className: G(), children: c("payment.amountLabel") }),
|
|
519
|
+
/* @__PURE__ */ n("span", { className: "type-title-card", "data-testid": "payment-amount", children: ve(s, o, e) })
|
|
520
|
+
] }),
|
|
521
|
+
/* @__PURE__ */ v(
|
|
522
|
+
"label",
|
|
523
|
+
{
|
|
524
|
+
htmlFor: ne,
|
|
525
|
+
className: fe(),
|
|
526
|
+
"data-testid": "payment-field",
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ n("span", { className: G(), children: c("payment.fields.card") }),
|
|
529
|
+
/* @__PURE__ */ n(
|
|
530
|
+
qe,
|
|
531
|
+
{
|
|
532
|
+
id: ne,
|
|
533
|
+
options: {
|
|
534
|
+
// `tabs` = method tiles (Card selected by default); `accordion`
|
|
535
|
+
// = full-width stacked rows for narrow columns where the tab row
|
|
536
|
+
// clips. Stripe owns overflow + tab alignment either way.
|
|
537
|
+
layout: ye === "accordion" ? { type: "accordion", defaultCollapsed: !0 } : { type: "tabs" }
|
|
538
|
+
},
|
|
539
|
+
onChange: (t) => {
|
|
540
|
+
ze(t.complete === !0), t.complete && (R(null), I(""), i.current.status === "failed" && y("idle"));
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
)
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
u ? /* @__PURE__ */ v(
|
|
548
|
+
"label",
|
|
549
|
+
{
|
|
550
|
+
htmlFor: se,
|
|
551
|
+
className: fe(),
|
|
552
|
+
"data-testid": "payment-address",
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ n("span", { className: G(), children: c("payment.billingAddress") }),
|
|
555
|
+
/* @__PURE__ */ n(
|
|
556
|
+
Ee,
|
|
557
|
+
{
|
|
558
|
+
id: se,
|
|
559
|
+
options: {
|
|
560
|
+
mode: "billing",
|
|
561
|
+
...U ? { defaultValues: U } : {}
|
|
562
|
+
},
|
|
563
|
+
onChange: (t) => {
|
|
564
|
+
Z.current += 1, E(t.complete), i.current.complete = A && (!a || t.complete), t.complete && J === "payment.error.billingAddressIncomplete" && (R(null), I(""), y("idle"));
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
)
|
|
568
|
+
]
|
|
569
|
+
}
|
|
570
|
+
) : null,
|
|
571
|
+
J ? /* @__PURE__ */ n(
|
|
572
|
+
xe,
|
|
573
|
+
{
|
|
574
|
+
id: x,
|
|
575
|
+
variant: "error",
|
|
576
|
+
live: "polite",
|
|
577
|
+
"data-testid": "payment-error",
|
|
578
|
+
children: /* @__PURE__ */ n(xe.Description, { children: N })
|
|
579
|
+
}
|
|
580
|
+
) : null,
|
|
581
|
+
/* @__PURE__ */ n(
|
|
582
|
+
"button",
|
|
583
|
+
{
|
|
584
|
+
type: "submit",
|
|
585
|
+
"aria-disabled": Re || void 0,
|
|
586
|
+
"aria-busy": F || void 0,
|
|
587
|
+
"aria-describedby": J ? x : void 0,
|
|
588
|
+
className: Le(),
|
|
589
|
+
"data-testid": "payment-submit",
|
|
590
|
+
children: F ? /* @__PURE__ */ v(De, { children: [
|
|
591
|
+
/* @__PURE__ */ n(
|
|
592
|
+
Pe,
|
|
593
|
+
{
|
|
594
|
+
variant: "pulse",
|
|
595
|
+
size: "sm",
|
|
596
|
+
label: c("payment.processing")
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ n("span", { children: c("payment.processing") })
|
|
600
|
+
] }) : /* @__PURE__ */ n("span", { children: c("payment.submit", {
|
|
601
|
+
amount: ve(s, o, e)
|
|
602
|
+
}) })
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
] })
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
const Ne = /* @__PURE__ */ new Set([
|
|
610
|
+
"auto",
|
|
611
|
+
"ar",
|
|
612
|
+
"bg",
|
|
613
|
+
"cs",
|
|
614
|
+
"da",
|
|
615
|
+
"de",
|
|
616
|
+
"el",
|
|
617
|
+
"en",
|
|
618
|
+
"en-AU",
|
|
619
|
+
"en-CA",
|
|
620
|
+
"en-NZ",
|
|
621
|
+
"en-GB",
|
|
622
|
+
"es",
|
|
623
|
+
"es-ES",
|
|
624
|
+
"es-419",
|
|
625
|
+
"et",
|
|
626
|
+
"fi",
|
|
627
|
+
"fil",
|
|
628
|
+
"fr",
|
|
629
|
+
"fr-CA",
|
|
630
|
+
"fr-FR",
|
|
631
|
+
"he",
|
|
632
|
+
"hu",
|
|
633
|
+
"hr",
|
|
634
|
+
"id",
|
|
635
|
+
"it",
|
|
636
|
+
"it-IT",
|
|
637
|
+
"ja",
|
|
638
|
+
"ko",
|
|
639
|
+
"lt",
|
|
640
|
+
"lv",
|
|
641
|
+
"ms",
|
|
642
|
+
"mt",
|
|
643
|
+
"nb",
|
|
644
|
+
"nl",
|
|
645
|
+
"no",
|
|
646
|
+
"pl",
|
|
647
|
+
"pt",
|
|
648
|
+
"pt-BR",
|
|
649
|
+
"ro",
|
|
650
|
+
"ru",
|
|
651
|
+
"sk",
|
|
652
|
+
"sl",
|
|
653
|
+
"sv",
|
|
654
|
+
"th",
|
|
655
|
+
"tr",
|
|
656
|
+
"vi",
|
|
657
|
+
"zh",
|
|
658
|
+
"zh-HK",
|
|
659
|
+
"zh-TW"
|
|
660
|
+
]);
|
|
661
|
+
function er(r) {
|
|
662
|
+
if (!r) return "auto";
|
|
663
|
+
const s = r === "cn" ? "zh" : r;
|
|
664
|
+
if (Ne.has(s))
|
|
665
|
+
return s;
|
|
666
|
+
const o = s.split("-")[0];
|
|
667
|
+
return Ne.has(o) ? o : "auto";
|
|
668
|
+
}
|
|
669
|
+
const rr = Te(
|
|
670
|
+
({
|
|
671
|
+
id: r,
|
|
672
|
+
clientSecret: s,
|
|
673
|
+
mode: o = "payment",
|
|
674
|
+
cardOnly: e = !1,
|
|
675
|
+
onCreatePaymentIntent: u,
|
|
676
|
+
onPreviewValidated: a,
|
|
677
|
+
publishableKey: d,
|
|
678
|
+
stripeAccount: $,
|
|
679
|
+
currency: h,
|
|
680
|
+
amount: p,
|
|
681
|
+
onSuccess: P,
|
|
682
|
+
onPaymentStatusChange: H,
|
|
683
|
+
onError: W,
|
|
684
|
+
billingAddress: O = !1,
|
|
685
|
+
requireBillingAddress: X = !1,
|
|
686
|
+
defaultBillingDetails: ye,
|
|
687
|
+
onBillingDetails: i,
|
|
688
|
+
locale: c,
|
|
689
|
+
ariaLabel: j,
|
|
690
|
+
returnUrl: C,
|
|
691
|
+
stripePromise: U,
|
|
692
|
+
layout: te = "tabs",
|
|
693
|
+
className: k
|
|
694
|
+
}, ne) => {
|
|
695
|
+
const { i18n: se } = he(), x = er(c ?? se.language ?? "en"), F = X || i !== void 0, K = O || F, L = pe(
|
|
696
|
+
() => ({ injectedStripe: U, publishableKey: d, stripeAccount: $ }),
|
|
697
|
+
[U, d, $]
|
|
698
|
+
), [ae, z] = _(() => ({
|
|
699
|
+
source: L,
|
|
700
|
+
instance: U ?? null
|
|
701
|
+
})), l = ae.source === L ? ae.instance : null;
|
|
702
|
+
V(() => {
|
|
703
|
+
const {
|
|
704
|
+
injectedStripe: f,
|
|
705
|
+
publishableKey: N,
|
|
706
|
+
stripeAccount: I
|
|
707
|
+
} = L, y = f !== void 0 ? f : N ? I ? Ae(N, { stripeAccount: I }) : Ae(N) : null;
|
|
708
|
+
z({ source: L, instance: y });
|
|
709
|
+
}, [L]);
|
|
710
|
+
const [A, ie] = _(
|
|
711
|
+
() => be()
|
|
712
|
+
);
|
|
713
|
+
V(() => (ie(be()), He(ie)), []);
|
|
714
|
+
const w = b(null), E = b({
|
|
715
|
+
status: "idle",
|
|
716
|
+
complete: !1,
|
|
717
|
+
errorKey: null,
|
|
718
|
+
paymentIntentId: null
|
|
719
|
+
}), Z = pe(
|
|
720
|
+
() => ({
|
|
721
|
+
submit: async () => {
|
|
722
|
+
const f = E.current.submit;
|
|
723
|
+
f && await f();
|
|
724
|
+
},
|
|
725
|
+
reset: () => {
|
|
726
|
+
var N;
|
|
727
|
+
const f = (N = w.current) == null ? void 0 : N.querySelector("form");
|
|
728
|
+
f instanceof HTMLFormElement && f.reset();
|
|
729
|
+
},
|
|
730
|
+
getStatus: () => E.current.status,
|
|
731
|
+
isComplete: () => E.current.complete,
|
|
732
|
+
getErrorKey: () => E.current.errorKey,
|
|
733
|
+
getPaymentIntentId: () => E.current.paymentIntentId
|
|
734
|
+
}),
|
|
735
|
+
[]
|
|
736
|
+
);
|
|
737
|
+
Me(ne, () => w.current, []), Ge(We, Z, r);
|
|
738
|
+
const J = pe(
|
|
739
|
+
() => s !== void 0 ? (
|
|
740
|
+
// Immediate mode — the consumer already created the intent.
|
|
741
|
+
{ clientSecret: s, appearance: A, locale: x }
|
|
742
|
+
) : (
|
|
743
|
+
// Deferred-intent mode — no secret yet; Stripe needs the intent
|
|
744
|
+
// shape (mode + amount + currency) to render the Payment Element.
|
|
745
|
+
// Stripe expects a lowercase ISO-4217 currency here.
|
|
746
|
+
{
|
|
747
|
+
mode: o,
|
|
748
|
+
amount: p,
|
|
749
|
+
currency: h.toLowerCase(),
|
|
750
|
+
...e ? { paymentMethodTypes: ["card"] } : {},
|
|
751
|
+
appearance: A,
|
|
752
|
+
locale: x
|
|
753
|
+
}
|
|
754
|
+
),
|
|
755
|
+
[
|
|
756
|
+
s,
|
|
757
|
+
o,
|
|
758
|
+
e,
|
|
759
|
+
p,
|
|
760
|
+
h,
|
|
761
|
+
A,
|
|
762
|
+
x
|
|
763
|
+
]
|
|
764
|
+
);
|
|
765
|
+
return /* @__PURE__ */ n(
|
|
766
|
+
"div",
|
|
767
|
+
{
|
|
768
|
+
ref: w,
|
|
769
|
+
"aria-label": j,
|
|
770
|
+
className: [Ye(), k].filter(Boolean).join(" "),
|
|
771
|
+
"data-component": "payment-form",
|
|
772
|
+
"data-component-id": r,
|
|
773
|
+
"data-testid": "payment-form-root",
|
|
774
|
+
children: l ? (
|
|
775
|
+
// Render the real Payment Element whenever a Stripe instance is
|
|
776
|
+
// available — in immediate mode (clientSecret present) AND in
|
|
777
|
+
// deferred mode (no secret). The skeleton is reserved for the
|
|
778
|
+
// no-Stripe case (missing publishableKey / injected null).
|
|
779
|
+
/* @__PURE__ */ n(
|
|
780
|
+
$e,
|
|
781
|
+
{
|
|
782
|
+
stripe: l,
|
|
783
|
+
options: J,
|
|
784
|
+
children: /* @__PURE__ */ n(
|
|
785
|
+
Qe,
|
|
786
|
+
{
|
|
787
|
+
amount: p,
|
|
788
|
+
currency: h,
|
|
789
|
+
locale: x,
|
|
790
|
+
billingAddress: K,
|
|
791
|
+
requireBillingAddress: F,
|
|
792
|
+
defaultBillingDetails: ye,
|
|
793
|
+
onBillingDetails: i,
|
|
794
|
+
returnUrl: C,
|
|
795
|
+
clientSecret: s,
|
|
796
|
+
onCreatePaymentIntent: u,
|
|
797
|
+
onPreviewValidated: a,
|
|
798
|
+
onSuccess: P,
|
|
799
|
+
onPaymentStatusChange: H,
|
|
800
|
+
onError: W,
|
|
801
|
+
layout: te,
|
|
802
|
+
agentBridge: E
|
|
803
|
+
}
|
|
804
|
+
)
|
|
805
|
+
},
|
|
806
|
+
s ?? `deferred:${o}:${p}:${h}:${e}`
|
|
807
|
+
)
|
|
808
|
+
) : /* @__PURE__ */ n(
|
|
809
|
+
tr,
|
|
810
|
+
{
|
|
811
|
+
amount: p,
|
|
812
|
+
currency: h,
|
|
813
|
+
locale: x,
|
|
814
|
+
billingAddress: K
|
|
815
|
+
}
|
|
816
|
+
)
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
rr.displayName = "PaymentForm";
|
|
822
|
+
function tr(r) {
|
|
823
|
+
const { amount: s, currency: o, locale: e, billingAddress: u } = r, { t: a } = he();
|
|
824
|
+
return /* @__PURE__ */ v(
|
|
825
|
+
"div",
|
|
826
|
+
{
|
|
827
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
828
|
+
"data-testid": "payment-skeleton",
|
|
829
|
+
"aria-busy": "true",
|
|
830
|
+
children: [
|
|
831
|
+
/* @__PURE__ */ v("div", { className: Ke(), children: [
|
|
832
|
+
/* @__PURE__ */ n("span", { className: G(), children: a("payment.amountLabel") }),
|
|
833
|
+
/* @__PURE__ */ n("span", { className: "type-title-card", children: ve(s, o, e) })
|
|
834
|
+
] }),
|
|
835
|
+
/* @__PURE__ */ v("div", { className: fe(), children: [
|
|
836
|
+
/* @__PURE__ */ n("span", { className: G(), children: a("payment.fields.card") }),
|
|
837
|
+
/* @__PURE__ */ n(
|
|
838
|
+
"div",
|
|
839
|
+
{
|
|
840
|
+
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)]",
|
|
841
|
+
"aria-hidden": "true"
|
|
842
|
+
}
|
|
843
|
+
)
|
|
844
|
+
] }),
|
|
845
|
+
u ? /* @__PURE__ */ v("div", { className: fe(), "data-testid": "payment-address", children: [
|
|
846
|
+
/* @__PURE__ */ n("span", { className: G(), children: a("payment.billingAddress") }),
|
|
847
|
+
/* @__PURE__ */ n(
|
|
848
|
+
"div",
|
|
849
|
+
{
|
|
850
|
+
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)]",
|
|
851
|
+
"aria-hidden": "true"
|
|
852
|
+
}
|
|
853
|
+
)
|
|
854
|
+
] }) : null,
|
|
855
|
+
/* @__PURE__ */ v(
|
|
856
|
+
"button",
|
|
857
|
+
{
|
|
858
|
+
type: "button",
|
|
859
|
+
"aria-disabled": "true",
|
|
860
|
+
className: Le(),
|
|
861
|
+
disabled: !0,
|
|
862
|
+
children: [
|
|
863
|
+
/* @__PURE__ */ n(Pe, { variant: "pulse", size: "sm", label: a("payment.processing") }),
|
|
864
|
+
/* @__PURE__ */ n("span", { children: a("payment.processing") })
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
)
|
|
868
|
+
]
|
|
869
|
+
}
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
export {
|
|
873
|
+
rr as P,
|
|
874
|
+
Ye as a,
|
|
875
|
+
Ze as b,
|
|
876
|
+
Je as c,
|
|
877
|
+
ve as f,
|
|
878
|
+
We as p,
|
|
879
|
+
Le as s
|
|
880
|
+
};
|
|
881
|
+
//# sourceMappingURL=payment-form-DqJFiplX.js.map
|