@alfadocs/ui-kit-debug 0.44.0 → 0.45.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/alia-sidebar-Be8FhKYd.js.map +1 -0
- package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
- package/dist/_chunks/{autocomplete-DIgdhCGJ.js.map → autocomplete-CDqxB68B.js.map} +1 -1
- package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
- package/dist/_chunks/bmi-calculator-CQqXTVNL.js.map +1 -0
- package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
- package/dist/_chunks/{booking-CtLwaxkK.js.map → booking-DlDVuWMd.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-ChHBcjet.js → cycle-calculator-KxA8dqDf.js} +31 -20
- package/dist/_chunks/cycle-calculator-KxA8dqDf.js.map +1 -0
- package/dist/_chunks/{due-date-calculator-CYXKLoof.js → due-date-calculator-mFxpHLml.js} +51 -39
- package/dist/_chunks/due-date-calculator-mFxpHLml.js.map +1 -0
- package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
- package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js.map → editable-currency-cell-renderer-BEBUQl9P.js.map} +1 -1
- package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-BYist2sJ.js} +2 -2
- package/dist/_chunks/{freemium-paywall-BLXESpH4.js.map → freemium-paywall-BYist2sJ.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-sRmoqgVr.js → gestational-age-calculator-gWI_uRA1.js} +52 -39
- package/dist/_chunks/gestational-age-calculator-gWI_uRA1.js.map +1 -0
- package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
- package/dist/_chunks/insert-result-C5ABnzDl.js.map +1 -0
- package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js.map → marketplace-app-shell-Gfsf78ge.js.map} +1 -1
- package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
- package/dist/_chunks/{patient-search-DPe2ZYEL.js.map → patient-search-CocVcGJ3.js.map} +1 -1
- package/dist/_chunks/{payment-form-BzVsG6Ks.js → payment-form-DqEiEJRO.js} +247 -195
- package/dist/_chunks/payment-form-DqEiEJRO.js.map +1 -0
- package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
- package/dist/_chunks/{pdf-viewer-B6MC6VTx.js.map → pdf-viewer-CWEXTlwq.js.map} +1 -1
- package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
- package/dist/_chunks/{practice-results-CrLpEiiW.js.map → practice-results-DDi-kvaD.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-C5YhfYnL.js → pregnancy-weight-gain-BtEHaSqy.js} +26 -13
- package/dist/_chunks/pregnancy-weight-gain-BtEHaSqy.js.map +1 -0
- package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
- package/dist/_chunks/{search-bar-CP6wUJFY.js.map → search-bar-CvN_S0jW.js.map} +1 -1
- package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
- package/dist/_chunks/{search-input-C1C3jQpD.js.map → search-input-D3aMvi4l.js.map} +1 -1
- package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
- package/dist/_chunks/{sign-document-B-3k_0LO.js.map → sign-document-BCyLpFHJ.js.map} +1 -1
- package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
- package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js.map → sign-in-with-alfadocs-button-CuYn_kKP.js.map} +1 -1
- package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
- package/dist/_chunks/{social-sign-in-button-X54ySJr1.js.map → social-sign-in-button-uJYLM366.js.map} +1 -1
- package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
- package/dist/_chunks/spinner-OjQNn8oN.js.map +1 -0
- package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
- package/dist/_chunks/{transcript-panel-CR7VY1uw.js.map → transcript-panel-B4HiC7ed.js.map} +1 -1
- package/dist/_chunks/{unit-converter-Ds9jalbN.js → unit-converter-u3CwNDpP.js} +63 -52
- package/dist/_chunks/unit-converter-u3CwNDpP.js.map +1 -0
- package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
- package/dist/_chunks/{wallet-pay-button-DK4ESYge.js.map → wallet-pay-button-DuDPBlCO.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/banded-gauge.d.ts +193 -0
- package/dist/components/_shared/banded-gauge.d.ts.map +1 -0
- package/dist/components/_shared/insert-result.d.ts +81 -8
- package/dist/components/_shared/insert-result.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +2 -2
- package/dist/components/bmi-calculator/bmi-calculator.d.ts.map +1 -1
- 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/cycle-calculator.d.ts.map +1 -1
- 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/due-date-calculator.d.ts.map +1 -1
- 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/gestational-age-calculator.d.ts.map +1 -1
- 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 +24 -2
- package/dist/components/payment-form/payment-form.d.ts.map +1 -1
- 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/pregnancy-weight-gain/pregnancy-weight-gain.d.ts.map +1 -1
- 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/spinner/spinner.d.ts.map +1 -1
- 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/unit-converter/unit-converter.d.ts.map +1 -1
- 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/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -1
- package/dist/i18n/locales/de.js +1 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -1
- package/dist/i18n/locales/el.js +1 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -1
- package/dist/i18n/locales/en.js +1 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -1
- package/dist/i18n/locales/fr.js +1 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -1
- package/dist/i18n/locales/hi.js +1 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -1
- package/dist/i18n/locales/it.js +1 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -1
- package/dist/i18n/locales/ja.js +1 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -1
- package/dist/i18n/locales/nl.js +1 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -1
- package/dist/i18n/locales/pl.js +1 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -1
- package/dist/i18n/locales/pt.js +1 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -1
- package/dist/i18n/locales/ro.js +1 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -1
- package/dist/i18n/locales/ru.js +1 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -1
- package/dist/i18n/locales/sq.js +1 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -1
- package/dist/i18n/locales/sv.js +1 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -1
- package/dist/i18n/locales/tr.js +1 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -1
- package/dist/i18n/locales/zh.js +1 -1
- package/dist/i18n/locales/zh.js.map +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-chat-surface.d.ts.map +1 -1
- package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
- package/dist/patterns/alia-assistant/alia-types.d.ts.map +1 -1
- 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/alia-sidebar-BpX4z_af.js.map +0 -1
- package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +0 -273
- package/dist/_chunks/bmi-calculator-DFPWL2OJ.js.map +0 -1
- package/dist/_chunks/cycle-calculator-ChHBcjet.js.map +0 -1
- package/dist/_chunks/due-date-calculator-CYXKLoof.js.map +0 -1
- package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js.map +0 -1
- package/dist/_chunks/insert-result-CoC1oo6R.js +0 -334
- package/dist/_chunks/insert-result-CoC1oo6R.js.map +0 -1
- package/dist/_chunks/payment-form-BzVsG6Ks.js.map +0 -1
- package/dist/_chunks/pregnancy-weight-gain-C5YhfYnL.js.map +0 -1
- package/dist/_chunks/spinner-CCByyvcb.js.map +0 -1
- package/dist/_chunks/unit-converter-Ds9jalbN.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as t, jsxs as m, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { S as
|
|
6
|
-
import { A as
|
|
7
|
-
import { loadStripe as
|
|
8
|
-
import { Elements as
|
|
9
|
-
import { u as
|
|
10
|
-
function
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ie, useState as z, useEffect as D, useRef as q, useMemo as G, useImperativeHandle as de, useId as ce, useCallback as le } from "react";
|
|
3
|
+
import { c as R } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as K } from "react-i18next";
|
|
5
|
+
import { S as re } from "./spinner-OjQNn8oN.js";
|
|
6
|
+
import { A as Q } from "./alert-ywPR59NE.js";
|
|
7
|
+
import { loadStripe as me } from "@stripe/stripe-js";
|
|
8
|
+
import { Elements as ue, useStripe as pe, useElements as fe, PaymentElement as be, AddressElement as ve } from "@stripe/react-stripe-js";
|
|
9
|
+
import { u as ye } from "./registry-nPAVE19X.js";
|
|
10
|
+
function te() {
|
|
11
11
|
return typeof document < "u" && typeof window < "u";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
if (!
|
|
13
|
+
function H(r) {
|
|
14
|
+
if (!te())
|
|
15
15
|
return { theme: "stripe" };
|
|
16
16
|
const n = r ?? document.documentElement, s = getComputedStyle(n), e = (a) => s.getPropertyValue(a).trim();
|
|
17
17
|
return {
|
|
@@ -69,20 +69,20 @@ function B(r) {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
if (!
|
|
72
|
+
function ge(r, n) {
|
|
73
|
+
if (!te()) return () => {
|
|
74
74
|
};
|
|
75
|
-
const s = document.documentElement, e = () => r(
|
|
76
|
-
|
|
75
|
+
const s = document.documentElement, e = () => r(H(n)), o = new MutationObserver(e);
|
|
76
|
+
o.observe(s, {
|
|
77
77
|
attributes: !0,
|
|
78
78
|
attributeFilter: ["class", "dir", "lang"]
|
|
79
79
|
});
|
|
80
|
-
const a = window.matchMedia("(prefers-color-scheme: dark)"),
|
|
81
|
-
return a.addEventListener("change", e),
|
|
82
|
-
|
|
80
|
+
const a = window.matchMedia("(prefers-color-scheme: dark)"), c = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
81
|
+
return a.addEventListener("change", e), c.addEventListener("change", e), () => {
|
|
82
|
+
o.disconnect(), a.removeEventListener("change", e), c.removeEventListener("change", e);
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const he = {
|
|
86
86
|
id: "payment-form",
|
|
87
87
|
capabilities: ["submit"],
|
|
88
88
|
state: {},
|
|
@@ -108,7 +108,7 @@ const ye = {
|
|
|
108
108
|
description: "Sourced from the id prop."
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
},
|
|
111
|
+
}, we = /* @__PURE__ */ new Set([
|
|
112
112
|
"BIF",
|
|
113
113
|
"CLP",
|
|
114
114
|
"DJF",
|
|
@@ -127,21 +127,21 @@ const ye = {
|
|
|
127
127
|
"XOF",
|
|
128
128
|
"XPF"
|
|
129
129
|
]);
|
|
130
|
-
function
|
|
131
|
-
const e = n.toUpperCase(),
|
|
130
|
+
function O(r, n, s) {
|
|
131
|
+
const e = n.toUpperCase(), o = we.has(e) ? r : r / 100;
|
|
132
132
|
try {
|
|
133
133
|
return new Intl.NumberFormat(s, {
|
|
134
134
|
style: "currency",
|
|
135
135
|
currency: e
|
|
136
|
-
}).format(
|
|
136
|
+
}).format(o);
|
|
137
137
|
} catch {
|
|
138
138
|
return new Intl.NumberFormat("en", {
|
|
139
139
|
style: "currency",
|
|
140
140
|
currency: e
|
|
141
|
-
}).format(
|
|
141
|
+
}).format(o);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function xe(r) {
|
|
145
145
|
if (r === void 0) return null;
|
|
146
146
|
const n = r.trim();
|
|
147
147
|
if (n === "" || typeof window > "u") return null;
|
|
@@ -152,10 +152,10 @@ function ve(r) {
|
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Ee(r) {
|
|
156
156
|
return r && r.replace(/\d{4,}/g, "****");
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Ne(r) {
|
|
159
159
|
switch (r) {
|
|
160
160
|
case "incorrect_number":
|
|
161
161
|
case "invalid_number":
|
|
@@ -181,7 +181,7 @@ function he(r) {
|
|
|
181
181
|
return "payment.error.generic";
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const ke = R(
|
|
185
185
|
[
|
|
186
186
|
"ds:payment-form-alfadocs ds:flex ds:flex-col",
|
|
187
187
|
"ds:gap-[var(--spacing-md)]",
|
|
@@ -190,11 +190,11 @@ const we = z(
|
|
|
190
190
|
"ds:p-[var(--spacing-md)]",
|
|
191
191
|
"ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
|
|
192
192
|
].join(" ")
|
|
193
|
-
),
|
|
193
|
+
), V = R(
|
|
194
194
|
["ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"].join(" ")
|
|
195
|
-
),
|
|
195
|
+
), F = R(
|
|
196
196
|
["type-label", "ds:text-[var(--foreground)]"].join(" ")
|
|
197
|
-
),
|
|
197
|
+
), ne = R(
|
|
198
198
|
[
|
|
199
199
|
"ds:flex ds:items-baseline ds:justify-between",
|
|
200
200
|
"ds:gap-[var(--spacing-sm)]",
|
|
@@ -204,7 +204,7 @@ const we = z(
|
|
|
204
204
|
"ds:rounded-[var(--radius-sm)]",
|
|
205
205
|
"ds:text-[var(--foreground)]"
|
|
206
206
|
].join(" ")
|
|
207
|
-
),
|
|
207
|
+
), se = R(
|
|
208
208
|
[
|
|
209
209
|
"ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)]",
|
|
210
210
|
"ds:[min-block-size:var(--min-target-size)]",
|
|
@@ -224,143 +224,175 @@ const we = z(
|
|
|
224
224
|
"ds:aria-busy:cursor-wait"
|
|
225
225
|
].join(" ")
|
|
226
226
|
);
|
|
227
|
-
function
|
|
227
|
+
function Ce(r) {
|
|
228
228
|
const {
|
|
229
229
|
amount: n,
|
|
230
230
|
currency: s,
|
|
231
231
|
locale: e,
|
|
232
|
-
billingAddress:
|
|
232
|
+
billingAddress: o,
|
|
233
233
|
returnUrl: a,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
clientSecret: c,
|
|
235
|
+
onCreatePaymentIntent: I,
|
|
236
|
+
onSuccess: P,
|
|
237
|
+
onError: _
|
|
238
|
+
} = r, { t: i } = K(), h = pe(), v = fe(), w = ce(), y = G(
|
|
239
|
+
() => `pay-${w.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
240
|
+
[w]
|
|
241
|
+
), M = `${y}-payment`, T = `${y}-address`, g = `${y}-error`, [u, x] = z(!1), [L, U] = z(!1), [E, S] = z(null), [j, l] = z(""), d = q(P), N = q(_);
|
|
242
|
+
D(() => {
|
|
243
|
+
d.current = P, N.current = _;
|
|
244
|
+
}, [P, _]);
|
|
245
|
+
const B = le(
|
|
244
246
|
async (p) => {
|
|
245
|
-
var
|
|
246
|
-
if (p && p.preventDefault(), !
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
247
|
+
var X, Z, J;
|
|
248
|
+
if (p && p.preventDefault(), !h || !v || u) return;
|
|
249
|
+
x(!0), S(null), l("");
|
|
250
|
+
const k = (f, A) => {
|
|
251
|
+
var Y;
|
|
252
|
+
const b = Ne(f), C = Ee(A ?? "");
|
|
253
|
+
S(b), l(i(b)), (Y = N.current) == null || Y.call(N, {
|
|
254
|
+
code: f,
|
|
255
|
+
translatedMessage: C || i(b)
|
|
256
|
+
});
|
|
257
|
+
}, $ = xe(a);
|
|
258
|
+
if (a !== void 0 && $ === null) {
|
|
259
|
+
S("payment.error.invalidReturnUrl"), l(i("payment.error.invalidReturnUrl")), (X = N.current) == null || X.call(N, {
|
|
251
260
|
code: "invalid_return_url",
|
|
252
|
-
translatedMessage:
|
|
253
|
-
}),
|
|
261
|
+
translatedMessage: i("payment.error.invalidReturnUrl")
|
|
262
|
+
}), x(!1);
|
|
254
263
|
return;
|
|
255
264
|
}
|
|
265
|
+
const W = $ ? { return_url: $ } : {};
|
|
256
266
|
try {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
+
if (c !== void 0) {
|
|
268
|
+
const C = await h.confirmPayment({
|
|
269
|
+
elements: v,
|
|
270
|
+
confirmParams: W,
|
|
271
|
+
redirect: "if_required"
|
|
267
272
|
});
|
|
273
|
+
if (C.error) {
|
|
274
|
+
k(C.error.code ?? "generic", C.error.message);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
C.paymentIntent && ((Z = d.current) == null || Z.call(d, C.paymentIntent.id));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const { error: f } = await v.submit();
|
|
281
|
+
if (f) {
|
|
282
|
+
k(f.code ?? "generic", f.message);
|
|
268
283
|
return;
|
|
269
284
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
285
|
+
if (!I)
|
|
286
|
+
return;
|
|
287
|
+
const A = await I(), b = await h.confirmPayment({
|
|
288
|
+
elements: v,
|
|
289
|
+
clientSecret: A,
|
|
290
|
+
confirmParams: W,
|
|
291
|
+
redirect: "if_required"
|
|
276
292
|
});
|
|
293
|
+
if (b.error) {
|
|
294
|
+
k(b.error.code ?? "generic", b.error.message);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
b.paymentIntent && ((J = d.current) == null || J.call(d, b.paymentIntent.id));
|
|
298
|
+
} catch (f) {
|
|
299
|
+
const A = f instanceof Error ? f.message : "";
|
|
300
|
+
k("unexpected", A);
|
|
277
301
|
} finally {
|
|
278
|
-
|
|
302
|
+
x(!1);
|
|
279
303
|
}
|
|
280
304
|
},
|
|
281
|
-
[
|
|
305
|
+
[
|
|
306
|
+
h,
|
|
307
|
+
v,
|
|
308
|
+
u,
|
|
309
|
+
a,
|
|
310
|
+
c,
|
|
311
|
+
I,
|
|
312
|
+
i
|
|
313
|
+
]
|
|
282
314
|
);
|
|
283
|
-
|
|
284
|
-
const p = document.getElementById(
|
|
315
|
+
D(() => {
|
|
316
|
+
const p = document.getElementById(y);
|
|
285
317
|
if (!p) return;
|
|
286
|
-
const
|
|
287
|
-
|
|
318
|
+
const k = () => {
|
|
319
|
+
B();
|
|
288
320
|
};
|
|
289
|
-
return p.addEventListener("payment-form:submit",
|
|
290
|
-
}, [
|
|
291
|
-
const
|
|
321
|
+
return p.addEventListener("payment-form:submit", k), () => p.removeEventListener("payment-form:submit", k);
|
|
322
|
+
}, [y, B]);
|
|
323
|
+
const ae = !h || !v || u || !(c === void 0 && !I) && !L;
|
|
292
324
|
return /* @__PURE__ */ t(
|
|
293
325
|
"form",
|
|
294
326
|
{
|
|
295
|
-
id:
|
|
296
|
-
onSubmit:
|
|
297
|
-
"aria-label":
|
|
327
|
+
id: y,
|
|
328
|
+
onSubmit: B,
|
|
329
|
+
"aria-label": i("payment.ariaLabel"),
|
|
298
330
|
"aria-busy": u || void 0,
|
|
299
331
|
noValidate: !0,
|
|
300
332
|
children: /* @__PURE__ */ m("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
301
|
-
/* @__PURE__ */ m("div", { className:
|
|
302
|
-
/* @__PURE__ */ t("span", { className:
|
|
303
|
-
/* @__PURE__ */ t("span", { className: "type-title-card", "data-testid": "payment-amount", children:
|
|
333
|
+
/* @__PURE__ */ m("div", { className: ne(), children: [
|
|
334
|
+
/* @__PURE__ */ t("span", { className: F(), children: i("payment.amountLabel") }),
|
|
335
|
+
/* @__PURE__ */ t("span", { className: "type-title-card", "data-testid": "payment-amount", children: O(n, s, e) })
|
|
304
336
|
] }),
|
|
305
337
|
/* @__PURE__ */ m(
|
|
306
338
|
"label",
|
|
307
339
|
{
|
|
308
|
-
htmlFor:
|
|
309
|
-
className:
|
|
340
|
+
htmlFor: M,
|
|
341
|
+
className: V(),
|
|
310
342
|
"data-testid": "payment-field",
|
|
311
343
|
children: [
|
|
312
|
-
/* @__PURE__ */ t("span", { className:
|
|
344
|
+
/* @__PURE__ */ t("span", { className: F(), children: i("payment.fields.card") }),
|
|
313
345
|
/* @__PURE__ */ t(
|
|
314
|
-
|
|
346
|
+
be,
|
|
315
347
|
{
|
|
316
|
-
id:
|
|
348
|
+
id: M,
|
|
317
349
|
options: {
|
|
318
350
|
layout: { type: "accordion", defaultCollapsed: !1 }
|
|
319
351
|
},
|
|
320
352
|
onChange: (p) => {
|
|
321
|
-
|
|
353
|
+
U(p.complete === !0), p.complete && (S(null), l(""));
|
|
322
354
|
}
|
|
323
355
|
}
|
|
324
356
|
)
|
|
325
357
|
]
|
|
326
358
|
}
|
|
327
359
|
),
|
|
328
|
-
|
|
360
|
+
o ? /* @__PURE__ */ m(
|
|
329
361
|
"label",
|
|
330
362
|
{
|
|
331
|
-
htmlFor:
|
|
332
|
-
className:
|
|
363
|
+
htmlFor: T,
|
|
364
|
+
className: V(),
|
|
333
365
|
"data-testid": "payment-address",
|
|
334
366
|
children: [
|
|
335
|
-
/* @__PURE__ */ t("span", { className:
|
|
336
|
-
/* @__PURE__ */ t(
|
|
367
|
+
/* @__PURE__ */ t("span", { className: F(), children: i("payment.billingAddress") }),
|
|
368
|
+
/* @__PURE__ */ t(ve, { id: T, options: { mode: "billing" } })
|
|
337
369
|
]
|
|
338
370
|
}
|
|
339
371
|
) : null,
|
|
340
|
-
|
|
341
|
-
|
|
372
|
+
E ? /* @__PURE__ */ t(
|
|
373
|
+
Q,
|
|
342
374
|
{
|
|
343
|
-
id:
|
|
375
|
+
id: g,
|
|
344
376
|
variant: "error",
|
|
345
377
|
live: "polite",
|
|
346
378
|
"data-testid": "payment-error",
|
|
347
|
-
children: /* @__PURE__ */ t(
|
|
379
|
+
children: /* @__PURE__ */ t(Q.Description, { children: j })
|
|
348
380
|
}
|
|
349
381
|
) : null,
|
|
350
382
|
/* @__PURE__ */ t(
|
|
351
383
|
"button",
|
|
352
384
|
{
|
|
353
385
|
type: "submit",
|
|
354
|
-
"aria-disabled":
|
|
386
|
+
"aria-disabled": ae || void 0,
|
|
355
387
|
"aria-busy": u || void 0,
|
|
356
|
-
"aria-describedby":
|
|
357
|
-
className:
|
|
388
|
+
"aria-describedby": E ? g : void 0,
|
|
389
|
+
className: se(),
|
|
358
390
|
"data-testid": "payment-submit",
|
|
359
|
-
children: u ? /* @__PURE__ */ m(
|
|
360
|
-
/* @__PURE__ */ t(
|
|
361
|
-
/* @__PURE__ */ t("span", { children:
|
|
362
|
-
] }) : /* @__PURE__ */ t("span", { children:
|
|
363
|
-
amount:
|
|
391
|
+
children: u ? /* @__PURE__ */ m(oe, { children: [
|
|
392
|
+
/* @__PURE__ */ t(re, { size: "sm", label: i("payment.processing") }),
|
|
393
|
+
/* @__PURE__ */ t("span", { children: i("payment.processing") })
|
|
394
|
+
] }) : /* @__PURE__ */ t("span", { children: i("payment.submit", {
|
|
395
|
+
amount: O(n, s, e)
|
|
364
396
|
}) })
|
|
365
397
|
}
|
|
366
398
|
)
|
|
@@ -368,7 +400,7 @@ function xe(r) {
|
|
|
368
400
|
}
|
|
369
401
|
);
|
|
370
402
|
}
|
|
371
|
-
const
|
|
403
|
+
const ee = /* @__PURE__ */ new Set([
|
|
372
404
|
"auto",
|
|
373
405
|
"ar",
|
|
374
406
|
"bg",
|
|
@@ -420,116 +452,136 @@ const Z = /* @__PURE__ */ new Set([
|
|
|
420
452
|
"zh-HK",
|
|
421
453
|
"zh-TW"
|
|
422
454
|
]);
|
|
423
|
-
function
|
|
455
|
+
function Ie(r) {
|
|
424
456
|
if (!r) return "auto";
|
|
425
457
|
const n = r === "cn" ? "zh" : r;
|
|
426
|
-
if (
|
|
458
|
+
if (ee.has(n))
|
|
427
459
|
return n;
|
|
428
460
|
const s = n.split("-")[0];
|
|
429
|
-
return
|
|
461
|
+
return ee.has(s) ? s : "auto";
|
|
430
462
|
}
|
|
431
|
-
const
|
|
463
|
+
const _e = ie(
|
|
432
464
|
({
|
|
433
465
|
id: r,
|
|
434
466
|
clientSecret: n,
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
467
|
+
mode: s = "payment",
|
|
468
|
+
onCreatePaymentIntent: e,
|
|
469
|
+
publishableKey: o,
|
|
470
|
+
currency: a,
|
|
471
|
+
amount: c,
|
|
472
|
+
onSuccess: I,
|
|
473
|
+
onError: P,
|
|
474
|
+
billingAddress: _ = !1,
|
|
475
|
+
locale: i,
|
|
476
|
+
ariaLabel: h,
|
|
477
|
+
returnUrl: v,
|
|
478
|
+
stripePromise: w,
|
|
479
|
+
className: y
|
|
480
|
+
}, M) => {
|
|
481
|
+
const { i18n: T } = K(), g = Ie(i ?? T.language ?? "en"), [u, x] = z(w ?? null);
|
|
482
|
+
D(() => {
|
|
483
|
+
if (w !== void 0) {
|
|
484
|
+
x(w);
|
|
451
485
|
return;
|
|
452
486
|
}
|
|
453
|
-
if (!
|
|
454
|
-
|
|
487
|
+
if (!o) {
|
|
488
|
+
x(null);
|
|
455
489
|
return;
|
|
456
490
|
}
|
|
457
|
-
|
|
458
|
-
}, [
|
|
459
|
-
const [
|
|
460
|
-
() =>
|
|
491
|
+
x(me(o));
|
|
492
|
+
}, [w, o]);
|
|
493
|
+
const [L, U] = z(
|
|
494
|
+
() => H()
|
|
461
495
|
);
|
|
462
|
-
|
|
463
|
-
const
|
|
496
|
+
D(() => (U(H()), ge(U)), []);
|
|
497
|
+
const E = q(null), S = G(
|
|
464
498
|
() => ({
|
|
465
499
|
submit: async () => {
|
|
466
|
-
var
|
|
467
|
-
const
|
|
468
|
-
|
|
500
|
+
var d;
|
|
501
|
+
const l = (d = E.current) == null ? void 0 : d.querySelector("form");
|
|
502
|
+
l && l.dispatchEvent(
|
|
469
503
|
new CustomEvent("payment-form:submit", { bubbles: !0 })
|
|
470
504
|
);
|
|
471
505
|
},
|
|
472
506
|
reset: () => {
|
|
473
|
-
var
|
|
474
|
-
const
|
|
475
|
-
|
|
507
|
+
var d;
|
|
508
|
+
const l = (d = E.current) == null ? void 0 : d.querySelector("form");
|
|
509
|
+
l instanceof HTMLFormElement && l.reset();
|
|
476
510
|
}
|
|
477
511
|
}),
|
|
478
512
|
[]
|
|
479
513
|
);
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
() => (
|
|
483
|
-
|
|
484
|
-
appearance:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
514
|
+
de(M, () => E.current, []), ye(he, S, r);
|
|
515
|
+
const j = G(
|
|
516
|
+
() => n !== void 0 ? (
|
|
517
|
+
// Immediate mode — the consumer already created the intent.
|
|
518
|
+
{ clientSecret: n, appearance: L, locale: g }
|
|
519
|
+
) : (
|
|
520
|
+
// Deferred-intent mode — no secret yet; Stripe needs the intent
|
|
521
|
+
// shape (mode + amount + currency) to render the Payment Element.
|
|
522
|
+
// Stripe expects a lowercase ISO-4217 currency here.
|
|
523
|
+
{
|
|
524
|
+
mode: s,
|
|
525
|
+
amount: c,
|
|
526
|
+
currency: a.toLowerCase(),
|
|
527
|
+
appearance: L,
|
|
528
|
+
locale: g
|
|
529
|
+
}
|
|
530
|
+
),
|
|
531
|
+
[n, s, c, a, L, g]
|
|
488
532
|
);
|
|
489
533
|
return /* @__PURE__ */ t(
|
|
490
534
|
"div",
|
|
491
535
|
{
|
|
492
|
-
ref:
|
|
493
|
-
"aria-label":
|
|
494
|
-
className: [
|
|
536
|
+
ref: E,
|
|
537
|
+
"aria-label": h,
|
|
538
|
+
className: [ke(), y].filter(Boolean).join(" "),
|
|
495
539
|
"data-component": "payment-form",
|
|
496
540
|
"data-component-id": r,
|
|
497
541
|
"data-testid": "payment-form-root",
|
|
498
|
-
children: u
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
542
|
+
children: u ? (
|
|
543
|
+
// Render the real Payment Element whenever a Stripe instance is
|
|
544
|
+
// available — in immediate mode (clientSecret present) AND in
|
|
545
|
+
// deferred mode (no secret). The skeleton is reserved for the
|
|
546
|
+
// no-Stripe case (missing publishableKey / injected null).
|
|
547
|
+
/* @__PURE__ */ t(
|
|
548
|
+
ue,
|
|
549
|
+
{
|
|
550
|
+
stripe: u,
|
|
551
|
+
options: j,
|
|
552
|
+
children: /* @__PURE__ */ t(
|
|
553
|
+
Ce,
|
|
554
|
+
{
|
|
555
|
+
amount: c,
|
|
556
|
+
currency: a,
|
|
557
|
+
locale: g,
|
|
558
|
+
billingAddress: _,
|
|
559
|
+
returnUrl: v,
|
|
560
|
+
clientSecret: n,
|
|
561
|
+
onCreatePaymentIntent: e,
|
|
562
|
+
onSuccess: I,
|
|
563
|
+
onError: P
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
},
|
|
567
|
+
n ?? "deferred"
|
|
568
|
+
)
|
|
517
569
|
) : /* @__PURE__ */ t(
|
|
518
570
|
Se,
|
|
519
571
|
{
|
|
520
|
-
amount:
|
|
521
|
-
currency:
|
|
522
|
-
locale:
|
|
523
|
-
billingAddress:
|
|
572
|
+
amount: c,
|
|
573
|
+
currency: a,
|
|
574
|
+
locale: g,
|
|
575
|
+
billingAddress: _
|
|
524
576
|
}
|
|
525
577
|
)
|
|
526
578
|
}
|
|
527
579
|
);
|
|
528
580
|
}
|
|
529
581
|
);
|
|
530
|
-
|
|
582
|
+
_e.displayName = "PaymentForm";
|
|
531
583
|
function Se(r) {
|
|
532
|
-
const { amount: n, currency: s, locale: e, billingAddress:
|
|
584
|
+
const { amount: n, currency: s, locale: e, billingAddress: o } = r, { t: a } = K();
|
|
533
585
|
return /* @__PURE__ */ m(
|
|
534
586
|
"div",
|
|
535
587
|
{
|
|
@@ -537,12 +589,12 @@ function Se(r) {
|
|
|
537
589
|
"data-testid": "payment-skeleton",
|
|
538
590
|
"aria-busy": "true",
|
|
539
591
|
children: [
|
|
540
|
-
/* @__PURE__ */ m("div", { className:
|
|
541
|
-
/* @__PURE__ */ t("span", { className:
|
|
542
|
-
/* @__PURE__ */ t("span", { className: "type-title-card", children:
|
|
592
|
+
/* @__PURE__ */ m("div", { className: ne(), children: [
|
|
593
|
+
/* @__PURE__ */ t("span", { className: F(), children: a("payment.amountLabel") }),
|
|
594
|
+
/* @__PURE__ */ t("span", { className: "type-title-card", children: O(n, s, e) })
|
|
543
595
|
] }),
|
|
544
|
-
/* @__PURE__ */ m("div", { className:
|
|
545
|
-
/* @__PURE__ */ t("span", { className:
|
|
596
|
+
/* @__PURE__ */ m("div", { className: V(), children: [
|
|
597
|
+
/* @__PURE__ */ t("span", { className: F(), children: a("payment.fields.card") }),
|
|
546
598
|
/* @__PURE__ */ t(
|
|
547
599
|
"div",
|
|
548
600
|
{
|
|
@@ -551,8 +603,8 @@ function Se(r) {
|
|
|
551
603
|
}
|
|
552
604
|
)
|
|
553
605
|
] }),
|
|
554
|
-
|
|
555
|
-
/* @__PURE__ */ t("span", { className:
|
|
606
|
+
o ? /* @__PURE__ */ m("div", { className: V(), "data-testid": "payment-address", children: [
|
|
607
|
+
/* @__PURE__ */ t("span", { className: F(), children: a("payment.billingAddress") }),
|
|
556
608
|
/* @__PURE__ */ t(
|
|
557
609
|
"div",
|
|
558
610
|
{
|
|
@@ -566,10 +618,10 @@ function Se(r) {
|
|
|
566
618
|
{
|
|
567
619
|
type: "button",
|
|
568
620
|
"aria-disabled": "true",
|
|
569
|
-
className:
|
|
621
|
+
className: se(),
|
|
570
622
|
disabled: !0,
|
|
571
623
|
children: [
|
|
572
|
-
/* @__PURE__ */ t(
|
|
624
|
+
/* @__PURE__ */ t(re, { size: "sm", label: a("payment.processing") }),
|
|
573
625
|
/* @__PURE__ */ t("span", { children: a("payment.processing") })
|
|
574
626
|
]
|
|
575
627
|
}
|
|
@@ -579,12 +631,12 @@ function Se(r) {
|
|
|
579
631
|
);
|
|
580
632
|
}
|
|
581
633
|
export {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
634
|
+
_e as P,
|
|
635
|
+
ke as a,
|
|
636
|
+
Ee as b,
|
|
637
|
+
Ne as c,
|
|
638
|
+
O as f,
|
|
639
|
+
he as p,
|
|
640
|
+
se as s
|
|
589
641
|
};
|
|
590
|
-
//# sourceMappingURL=payment-form-
|
|
642
|
+
//# sourceMappingURL=payment-form-DqEiEJRO.js.map
|