@bowlos/reservations 0.41.0 → 0.43.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.
Files changed (48) hide show
  1. package/AGENTS.md +9 -3
  2. package/HEADLESS.md +61 -0
  3. package/README.md +61 -0
  4. package/dist/{account-DEX2Lr78.d.cts → account-B4sZBmPI.d.cts} +866 -14
  5. package/dist/{account-DEX2Lr78.d.ts → account-B4sZBmPI.d.ts} +866 -14
  6. package/dist/booking-change-Dd4PVgd3.d.cts +487 -0
  7. package/dist/booking-change-DzYs9133.d.ts +487 -0
  8. package/dist/{chunk-VJIS56OO.js → chunk-4JMGS4YB.js} +96 -5
  9. package/dist/chunk-4JMGS4YB.js.map +1 -0
  10. package/dist/{chunk-FMFHNBDH.js → chunk-T2E6AEC7.js} +98 -5
  11. package/dist/chunk-T2E6AEC7.js.map +1 -0
  12. package/dist/{chunk-44WKP6MW.js → chunk-V4JRDYW4.js} +31 -3
  13. package/dist/chunk-V4JRDYW4.js.map +1 -0
  14. package/dist/{chunk-BWJHRJN6.js → chunk-YQRTBGXU.js} +3 -3
  15. package/dist/{chunk-BWJHRJN6.js.map → chunk-YQRTBGXU.js.map} +1 -1
  16. package/dist/cli.cjs +5 -0
  17. package/dist/cli.cjs.map +1 -1
  18. package/dist/components.cjs +313 -0
  19. package/dist/components.cjs.map +1 -1
  20. package/dist/components.d.cts +12 -6
  21. package/dist/components.d.ts +12 -6
  22. package/dist/components.js +109 -6
  23. package/dist/components.js.map +1 -1
  24. package/dist/index.cjs +33 -0
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +4 -4
  27. package/dist/index.d.ts +4 -4
  28. package/dist/index.js +2 -2
  29. package/dist/payments.cjs +34 -12
  30. package/dist/payments.cjs.map +1 -1
  31. package/dist/payments.d.cts +10 -2
  32. package/dist/payments.d.ts +10 -2
  33. package/dist/payments.js +5 -78
  34. package/dist/payments.js.map +1 -1
  35. package/dist/{react-CrRciA7I.d.ts → react-C6NWC80d.d.cts} +2 -2
  36. package/dist/{react-QJrsaOnN.d.cts → react-DVdtpw5n.d.ts} +2 -2
  37. package/dist/react.cjs +112 -0
  38. package/dist/react.cjs.map +1 -1
  39. package/dist/react.d.cts +22 -6
  40. package/dist/react.d.ts +22 -6
  41. package/dist/react.js +5 -5
  42. package/package.json +1 -1
  43. package/templates/center-site/package.json +1 -1
  44. package/dist/booking-change-4DGu-B08.d.ts +0 -1282
  45. package/dist/booking-change-aK6P37FZ.d.cts +0 -1282
  46. package/dist/chunk-44WKP6MW.js.map +0 -1
  47. package/dist/chunk-FMFHNBDH.js.map +0 -1
  48. package/dist/chunk-VJIS56OO.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Appearance } from '@stripe/stripe-js';
3
- import { o as ConnectedPaymentInput, ad as SavedCardScope } from './account-DEX2Lr78.js';
3
+ import { ak as ConnectedPaymentInput, b9 as SavedCardScope, ag as CardSetupResult } from './account-B4sZBmPI.js';
4
4
 
5
5
  /** Visible strings — override any subset for copy/i18n. */
6
6
  interface BowlosPaymentFormLabels {
@@ -53,6 +53,14 @@ declare function BowlosPaymentForm({ paymentIntent, publishableKey, testPublisha
53
53
 
54
54
  interface AddCardFormProps extends SavedCardScope {
55
55
  onAdded?: () => void;
56
+ /** Supply a pre-created SetupIntent for flows such as waitlist consent. */
57
+ setupIntent?: CardSetupResult | (Omit<CardSetupResult, "merchantDisplayName"> & {
58
+ customerSessionClientSecret?: string;
59
+ });
60
+ onSetupConfirmed?: (intent: {
61
+ id: string;
62
+ status: string;
63
+ }) => Promise<void>;
56
64
  appearance?: Appearance;
57
65
  labels?: Partial<{
58
66
  title: string;
@@ -63,6 +71,6 @@ interface AddCardFormProps extends SavedCardScope {
63
71
  }>;
64
72
  className?: string;
65
73
  }
66
- declare function AddCardForm({ brandId, centerId, onAdded, appearance, labels, className, }: AddCardFormProps): react_jsx_runtime.JSX.Element;
74
+ declare function AddCardForm({ brandId, centerId, onAdded, setupIntent, onSetupConfirmed, appearance, labels, className, }: AddCardFormProps): react_jsx_runtime.JSX.Element;
67
75
 
68
76
  export { AddCardForm, type AddCardFormProps, BowlosPaymentForm, type BowlosPaymentFormLabels, type BowlosPaymentFormProps };
package/dist/payments.js CHANGED
@@ -1,6 +1,7 @@
1
- import { styles, formatCents, useAccountAction, AccountPanel } from './chunk-FMFHNBDH.js';
2
- import { useCreateCardSetup } from './chunk-BWJHRJN6.js';
3
- import './chunk-44WKP6MW.js';
1
+ import { styles, formatCents } from './chunk-T2E6AEC7.js';
2
+ export { AddCardForm } from './chunk-T2E6AEC7.js';
3
+ import './chunk-YQRTBGXU.js';
4
+ import './chunk-V4JRDYW4.js';
4
5
  import { useMemo, useState } from 'react';
5
6
  import { loadStripe } from '@stripe/stripe-js';
6
7
  import { Elements, useStripe, useElements, PaymentElement } from '@stripe/react-stripe-js';
@@ -90,81 +91,7 @@ function PayForm({
90
91
  message && /* @__PURE__ */ jsx("p", { role: "alert", style: s.error, children: message })
91
92
  ] });
92
93
  }
93
- function AddCardForm({
94
- brandId,
95
- centerId,
96
- onAdded,
97
- appearance,
98
- labels,
99
- className
100
- }) {
101
- const t = {
102
- title: "Add a card",
103
- start: "Add card",
104
- save: "Save card",
105
- saved: "Card saved.",
106
- error: "Unable to save this card.",
107
- ...labels
108
- };
109
- const setup = useCreateCardSetup();
110
- const action = useAccountAction();
111
- const [intent, setIntent] = useState();
112
- const stripe = useMemo(
113
- () => intent ? loadStripe(intent.publishableKey, { stripeAccount: intent.stripeAccount }) : null,
114
- [intent]
115
- );
116
- return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
117
- !intent ? /* @__PURE__ */ jsx(
118
- "button",
119
- {
120
- style: styles().primaryBtn,
121
- disabled: action.busy,
122
- onClick: () => void action.run(async () => setIntent(await setup.run({ brandId, centerId }))),
123
- children: t.start
124
- }
125
- ) : /* @__PURE__ */ jsx(Elements, { stripe, options: { clientSecret: intent.clientSecret, appearance }, children: /* @__PURE__ */ jsx(
126
- SetupForm,
127
- {
128
- labels: t,
129
- onAdded: () => {
130
- setIntent(void 0);
131
- onAdded?.();
132
- }
133
- }
134
- ) }),
135
- action.feedback
136
- ] });
137
- }
138
- function SetupForm({
139
- labels,
140
- onAdded
141
- }) {
142
- const stripe = useStripe();
143
- const elements = useElements();
144
- const action = useAccountAction();
145
- return /* @__PURE__ */ jsxs(
146
- "form",
147
- {
148
- style: styles().stack,
149
- onSubmit: (e) => {
150
- e.preventDefault();
151
- if (!stripe || !elements) return;
152
- void action.run(async () => {
153
- const result = await stripe.confirmSetup({ elements, redirect: "if_required" });
154
- if (result.error) throw new Error(result.error.message ?? labels.error);
155
- if (result.setupIntent?.status !== "succeeded") throw new Error(labels.error);
156
- onAdded();
157
- }, labels.saved);
158
- },
159
- children: [
160
- /* @__PURE__ */ jsx(PaymentElement, {}),
161
- /* @__PURE__ */ jsx("button", { style: styles().primaryBtn, disabled: !stripe || !elements || action.busy, children: labels.save }),
162
- action.feedback
163
- ]
164
- }
165
- );
166
- }
167
94
 
168
- export { AddCardForm, BowlosPaymentForm };
95
+ export { BowlosPaymentForm };
169
96
  //# sourceMappingURL=payments.js.map
170
97
  //# sourceMappingURL=payments.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/payment-form.tsx","../src/components/add-card-form.tsx"],"names":["useState","useMemo","loadStripe","jsxs","jsx","Elements","useStripe","useElements","PaymentElement"],"mappings":";;;;;;;;AAuCA,IAAM,cAAA,GAA0C;AAAA,EAC9C,GAAA,EAAK,cAAA;AAAA,EACL,MAAA,EAAQ,cAAA;AAAA,EACR,YAAA,EAAc;AAChB,CAAA;AA2CO,SAAS,iBAAA,CAAkB;AAAA,EAChC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,kBAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA,GAAW,IAAA;AAAA,EACX,UAAA;AAAA,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AA,EAAe,CAAA;AAAA,wBAChBJ,GAAAA,CAAC,QAAA,EAAA,EAAO,KAAA,EAAO,QAAO,CAAE,UAAA,EAAY,QAAA,EAAU,CAAC,UAAU,CAAC,QAAA,IAAY,MAAA,CAAO,IAAA,EAC1E,iBAAO,IAAA,EACV,CAAA;AAAA,QACC,MAAA,CAAO;AAAA;AAAA;AAAA,GACV;AAEJ","file":"payments.js","sourcesContent":["\"use client\";\n/**\n * `<BowlosPaymentForm>` — the drop-in Stripe Connect checkout for `<BookingFlow>`.\n *\n * This is the ONE part of the SDK that loads Stripe.js, so it lives in its own\n * entry (`@bowlos/reservations/payments`) and Stripe is an OPTIONAL peer — the\n * core + components bundles never pull it. Wire it into `<BookingFlow>`'s\n * `renderPayment` slot and you never hand-build a Stripe Elements form per site:\n *\n * ```tsx\n * import { BowlosPaymentForm } from \"@bowlos/reservations/payments\";\n *\n * <BookingFlow\n * renderPayment={(ctx) => (\n * <BowlosPaymentForm {...ctx} publishableKey={process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!} />\n * )}\n * />\n * ```\n *\n * It initializes Stripe.js with the PLATFORM publishable key scoped to the\n * operator's CONNECTED account (`stripeAccount: connectedAccountId`), so the\n * charge lands directly on the operator's Stripe account (their name on the\n * statement/receipt — the white-label requirement). Saved cards + \"save for\n * future\" are enabled by default via the booking's customer session.\n */\nimport { useMemo, useState, type FormEvent } from \"react\";\nimport { loadStripe, type Appearance } from \"@stripe/stripe-js\";\nimport { Elements, PaymentElement, useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport type { ConnectedPaymentInput } from \"../data\";\nimport { formatCents, styles } from \"./shared\";\n\n/** Visible strings — override any subset for copy/i18n. */\nexport interface BowlosPaymentFormLabels {\n /** Button when idle. `{amount}` (if present) is replaced with the formatted total. */\n pay: string;\n paying: string;\n genericError: string;\n}\n\nconst DEFAULT_LABELS: BowlosPaymentFormLabels = {\n pay: \"Pay {amount}\",\n paying: \"Paying…\",\n genericError: \"Payment failed — please try again.\",\n};\n\nexport interface BowlosPaymentFormProps {\n /** The Connect payment to confirm — a booking's `PaymentIntentInfo`, a buy\n * flow's intent, or a subscription's first-invoice client secret. Any value\n * with `{ clientSecret, connectedAccountId, customerSessionClientSecret? }`. */\n paymentIntent: ConnectedPaymentInput;\n /** Your PLATFORM publishable key (browser-safe; e.g. `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`).\n * Used for live PaymentIntents (and as the sole key when `testPublishableKey`\n * is omitted — fully back-compatible with one-key sites). */\n publishableKey: string;\n /** Full Test Mode (2026-06-23): your platform TEST publishable key\n * (`pk_test_…`). When the PaymentIntent's `stripeMode` is \"test\" (an admin\n * Test-Account customer, or a Center in Full Test Mode), the form loads THIS\n * key instead of `publishableKey` — so a live site can confirm test PIs\n * concurrently. Omit it and the form always uses `publishableKey`. */\n testPublishableKey?: string;\n /** Called once the PaymentIntent confirms — start polling for the reservation. */\n onPaid: () => void;\n /** Called with a human-readable message when confirmation fails. */\n onError?: (message: string) => void;\n /** Total, for the button label (\"Pay $45.00\"). Omit to show a plain \"Pay\". */\n amountCents?: number;\n /**\n * Enable saved cards + a \"save for future\" option via the booking's customer\n * session (when the gateway provided one). Default `true`. Set `false` for a\n * one-off charge with no card on file.\n */\n saveCard?: boolean;\n /**\n * Stripe Elements appearance — theme the Payment Element to match your site\n * (e.g. `{ theme: \"night\", variables: { colorPrimary: \"#FFD500\" } }`). Without\n * it Stripe renders its default light theme, which looks off on a dark site.\n */\n appearance?: Appearance;\n labels?: Partial<BowlosPaymentFormLabels>;\n className?: string;\n}\n\n/**\n * The Stripe Connect payment form. Renders the Payment Element scoped to the\n * operator's connected account and confirms the PaymentIntent on submit.\n */\nexport function BowlosPaymentForm({\n paymentIntent,\n publishableKey,\n testPublishableKey,\n onPaid,\n onError,\n amountCents,\n saveCard = true,\n appearance,\n labels,\n className,\n}: BowlosPaymentFormProps) {\n // Pick the publishable key matching the PaymentIntent's Stripe environment: a\n // test PI (Full Test Mode / Test-Account customer) confirms only with the test\n // key, a live PI only with the live key. Falls back to `publishableKey` when no\n // test key is supplied (one-key sites — unchanged behavior).\n const pk =\n paymentIntent.stripeMode === \"test\" && testPublishableKey\n ? testPublishableKey\n : publishableKey;\n // Platform key, scoped to the operator's connected account → the charge is\n // created directly on their Stripe account (white-label receipt/statement).\n const stripePromise = useMemo(\n () => loadStripe(pk, { stripeAccount: paymentIntent.connectedAccountId }),\n [pk, paymentIntent.connectedAccountId],\n );\n\n // Pass the customer session only when present + opted-in, so the Payment\n // Element can offer saved cards / \"save for future\" for this operator.\n const customerSessionClientSecret =\n saveCard && paymentIntent.customerSessionClientSecret\n ? paymentIntent.customerSessionClientSecret\n : undefined;\n\n return (\n <Elements\n stripe={stripePromise}\n options={{ clientSecret: paymentIntent.clientSecret, customerSessionClientSecret, appearance }}\n >\n <PayForm\n onPaid={onPaid}\n onError={onError}\n amountCents={amountCents}\n labels={labels}\n className={className}\n />\n </Elements>\n );\n}\n\nfunction PayForm({\n onPaid,\n onError,\n amountCents,\n labels,\n className,\n}: {\n onPaid: () => void;\n onError?: (message: string) => void;\n amountCents?: number;\n labels?: Partial<BowlosPaymentFormLabels>;\n className?: string;\n}) {\n const t = { ...DEFAULT_LABELS, ...labels };\n const stripe = useStripe();\n const elements = useElements();\n const [submitting, setSubmitting] = useState(false);\n const [message, setMessage] = useState<string | null>(null);\n const s = styles();\n\n async function handleSubmit(e: FormEvent) {\n e.preventDefault();\n if (!stripe || !elements) return;\n setSubmitting(true);\n setMessage(null);\n\n // `redirect: \"if_required\"` keeps card payments on-page; wallets that need\n // a redirect still work.\n const { error } = await stripe.confirmPayment({ elements, redirect: \"if_required\" });\n\n if (error) {\n const m = error.message ?? t.genericError;\n setMessage(m);\n onError?.(m);\n setSubmitting(false);\n return;\n }\n\n // Paid. The gateway's Stripe webhook materializes the reservation\n // asynchronously, so hand control back so the flow can poll for it.\n onPaid();\n }\n\n const payLabel = t.pay.replace(\"{amount}\", amountCents != null ? formatCents(amountCents) : \"\").trim();\n\n return (\n <form onSubmit={handleSubmit} className={className} style={s.stack}>\n <PaymentElement />\n {/* v0.22.1: include !elements — the submit handler bails on a not-yet-\n mounted PaymentElement, so a click during mount was a silent no-op\n (the \"first click does nothing\" race a center site reproduced). */}\n <button\n type=\"submit\"\n style={s.primaryBtn}\n disabled={!stripe || !elements || submitting}\n >\n {submitting ? t.paying : payLabel}\n </button>\n {message && (\n <p role=\"alert\" style={s.error}>\n {message}\n </p>\n )}\n </form>\n );\n}\n","\"use client\";\nimport { useMemo, useState } from \"react\";\nimport { loadStripe, type Appearance } from \"@stripe/stripe-js\";\nimport { Elements, PaymentElement, useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport { useCreateCardSetup } from \"../hooks\";\nimport type { CardSetupResult, SavedCardScope } from \"../account\";\nimport { AccountPanel, useAccountAction } from \"./account-shared\";\nimport { styles } from \"./shared\";\nexport interface AddCardFormProps extends SavedCardScope {\n onAdded?: () => void;\n appearance?: Appearance;\n labels?: Partial<{ title: string; start: string; save: string; saved: string; error: string }>;\n className?: string;\n}\nexport function AddCardForm({\n brandId,\n centerId,\n onAdded,\n appearance,\n labels,\n className,\n}: AddCardFormProps) {\n const t = {\n title: \"Add a card\",\n start: \"Add card\",\n save: \"Save card\",\n saved: \"Card saved.\",\n error: \"Unable to save this card.\",\n ...labels,\n };\n const setup = useCreateCardSetup();\n const action = useAccountAction();\n const [intent, setIntent] = useState<CardSetupResult>();\n const stripe = useMemo(\n () =>\n intent ? loadStripe(intent.publishableKey, { stripeAccount: intent.stripeAccount }) : null,\n [intent],\n );\n return (\n <AccountPanel title={t.title} className={className}>\n {!intent ? (\n <button\n style={styles().primaryBtn}\n disabled={action.busy}\n onClick={() =>\n void action.run(async () => setIntent(await setup.run({ brandId, centerId })))\n }\n >\n {t.start}\n </button>\n ) : (\n <Elements stripe={stripe} options={{ clientSecret: intent.clientSecret, appearance }}>\n <SetupForm\n labels={t}\n onAdded={() => {\n setIntent(undefined);\n onAdded?.();\n }}\n />\n </Elements>\n )}\n {action.feedback}\n </AccountPanel>\n );\n}\nfunction SetupForm({\n labels,\n onAdded,\n}: {\n labels: { save: string; saved: string; error: string };\n onAdded: () => void;\n}) {\n const stripe = useStripe();\n const elements = useElements();\n const action = useAccountAction();\n return (\n <form\n style={styles().stack}\n onSubmit={(e) => {\n e.preventDefault();\n if (!stripe || !elements) return;\n void action.run(async () => {\n const result = await stripe.confirmSetup({ elements, redirect: \"if_required\" });\n if (result.error) throw new Error(result.error.message ?? labels.error);\n if (result.setupIntent?.status !== \"succeeded\") throw new Error(labels.error);\n onAdded();\n }, labels.saved);\n }}\n >\n <PaymentElement />\n <button style={styles().primaryBtn} disabled={!stripe || !elements || action.busy}>\n {labels.save}\n </button>\n {action.feedback}\n </form>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/payment-form.tsx"],"names":[],"mappings":";;;;;;;;;AAuCA,IAAM,cAAA,GAA0C;AAAA,EAC9C,GAAA,EAAK,cAAA;AAAA,EACL,MAAA,EAAQ,cAAA;AAAA,EACR,YAAA,EAAc;AAChB,CAAA;AA2CO,SAAS,iBAAA,CAAkB;AAAA,EAChC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,kBAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA,GAAW,IAAA;AAAA,EACX,UAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAA2B;AAKzB,EAAA,MAAM,EAAA,GACJ,aAAA,CAAc,UAAA,KAAe,MAAA,IAAU,qBACnC,kBAAA,GACA,cAAA;AAGN,EAAA,MAAM,aAAA,GAAgB,OAAA;AAAA,IACpB,MAAM,UAAA,CAAW,EAAA,EAAI,EAAE,aAAA,EAAe,aAAA,CAAc,oBAAoB,CAAA;AAAA,IACxE,CAAC,EAAA,EAAI,aAAA,CAAc,kBAAkB;AAAA,GACvC;AAIA,EAAA,MAAM,2BAAA,GACJ,QAAA,IAAY,aAAA,CAAc,2BAAA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AAA;AAC7B,MAAA,UAAA,CAAW,CAAC,CAAA;AACZ,MAAA,OAAA,GAAU,CAAC,CAAA;AACX,MAAA,aAAA,CAAc,KAAK,CAAA;AACnB,MAAA;AAAA,IACF;AAIA,IAAA,MAAA,EAAO;AAAA,EACT;AAEA,EAAA,MAAM,QAAA,GAAW,CAAA,CAAE,GAAA,CAAI,OAAA,CAAQ,UAAA,EAAY,WAAA,IAAe,IAAA,GAAO,WAAA,CAAY,WAAW,CAAA,GAAI,EAAE,CAAA,CAAE,IAAA,EAAK;AAErG,EAAA,4BACG,MAAA,EAAA,EAAK,QAAA,EAAU,cAAc,SAAA,EAAsB,KAAA,EAAO,EAAE,KAAA,EAC3D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,CAAA;AAAA,oBAIhB,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,QAAA;AAAA,QACL,OAAO,CAAA,CAAE,UAAA;AAAA,QACT,QAAA,EAAU,CAAC,MAAA,IAAU,CAAC,QAAA,IAAY,UAAA;AAAA,QAEjC,QAAA,EAAA,UAAA,GAAa,EAAE,MAAA,GAAS;AAAA;AAAA,KAC3B;AAAA,IACC,OAAA,wBACE,GAAA,EAAA,EAAE,IAAA,EAAK,SAAQ,KAAA,EAAO,CAAA,CAAE,OACtB,QAAA,EAAA,OAAA,EACH;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"payments.js","sourcesContent":["\"use client\";\n/**\n * `<BowlosPaymentForm>` — the drop-in Stripe Connect checkout for `<BookingFlow>`.\n *\n * This is the ONE part of the SDK that loads Stripe.js, so it lives in its own\n * entry (`@bowlos/reservations/payments`) and Stripe is an OPTIONAL peer — the\n * core + components bundles never pull it. Wire it into `<BookingFlow>`'s\n * `renderPayment` slot and you never hand-build a Stripe Elements form per site:\n *\n * ```tsx\n * import { BowlosPaymentForm } from \"@bowlos/reservations/payments\";\n *\n * <BookingFlow\n * renderPayment={(ctx) => (\n * <BowlosPaymentForm {...ctx} publishableKey={process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!} />\n * )}\n * />\n * ```\n *\n * It initializes Stripe.js with the PLATFORM publishable key scoped to the\n * operator's CONNECTED account (`stripeAccount: connectedAccountId`), so the\n * charge lands directly on the operator's Stripe account (their name on the\n * statement/receipt — the white-label requirement). Saved cards + \"save for\n * future\" are enabled by default via the booking's customer session.\n */\nimport { useMemo, useState, type FormEvent } from \"react\";\nimport { loadStripe, type Appearance } from \"@stripe/stripe-js\";\nimport { Elements, PaymentElement, useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport type { ConnectedPaymentInput } from \"../data\";\nimport { formatCents, styles } from \"./shared\";\n\n/** Visible strings — override any subset for copy/i18n. */\nexport interface BowlosPaymentFormLabels {\n /** Button when idle. `{amount}` (if present) is replaced with the formatted total. */\n pay: string;\n paying: string;\n genericError: string;\n}\n\nconst DEFAULT_LABELS: BowlosPaymentFormLabels = {\n pay: \"Pay {amount}\",\n paying: \"Paying…\",\n genericError: \"Payment failed — please try again.\",\n};\n\nexport interface BowlosPaymentFormProps {\n /** The Connect payment to confirm — a booking's `PaymentIntentInfo`, a buy\n * flow's intent, or a subscription's first-invoice client secret. Any value\n * with `{ clientSecret, connectedAccountId, customerSessionClientSecret? }`. */\n paymentIntent: ConnectedPaymentInput;\n /** Your PLATFORM publishable key (browser-safe; e.g. `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`).\n * Used for live PaymentIntents (and as the sole key when `testPublishableKey`\n * is omitted — fully back-compatible with one-key sites). */\n publishableKey: string;\n /** Full Test Mode (2026-06-23): your platform TEST publishable key\n * (`pk_test_…`). When the PaymentIntent's `stripeMode` is \"test\" (an admin\n * Test-Account customer, or a Center in Full Test Mode), the form loads THIS\n * key instead of `publishableKey` — so a live site can confirm test PIs\n * concurrently. Omit it and the form always uses `publishableKey`. */\n testPublishableKey?: string;\n /** Called once the PaymentIntent confirms — start polling for the reservation. */\n onPaid: () => void;\n /** Called with a human-readable message when confirmation fails. */\n onError?: (message: string) => void;\n /** Total, for the button label (\"Pay $45.00\"). Omit to show a plain \"Pay\". */\n amountCents?: number;\n /**\n * Enable saved cards + a \"save for future\" option via the booking's customer\n * session (when the gateway provided one). Default `true`. Set `false` for a\n * one-off charge with no card on file.\n */\n saveCard?: boolean;\n /**\n * Stripe Elements appearance — theme the Payment Element to match your site\n * (e.g. `{ theme: \"night\", variables: { colorPrimary: \"#FFD500\" } }`). Without\n * it Stripe renders its default light theme, which looks off on a dark site.\n */\n appearance?: Appearance;\n labels?: Partial<BowlosPaymentFormLabels>;\n className?: string;\n}\n\n/**\n * The Stripe Connect payment form. Renders the Payment Element scoped to the\n * operator's connected account and confirms the PaymentIntent on submit.\n */\nexport function BowlosPaymentForm({\n paymentIntent,\n publishableKey,\n testPublishableKey,\n onPaid,\n onError,\n amountCents,\n saveCard = true,\n appearance,\n labels,\n className,\n}: BowlosPaymentFormProps) {\n // Pick the publishable key matching the PaymentIntent's Stripe environment: a\n // test PI (Full Test Mode / Test-Account customer) confirms only with the test\n // key, a live PI only with the live key. Falls back to `publishableKey` when no\n // test key is supplied (one-key sites — unchanged behavior).\n const pk =\n paymentIntent.stripeMode === \"test\" && testPublishableKey\n ? testPublishableKey\n : publishableKey;\n // Platform key, scoped to the operator's connected account → the charge is\n // created directly on their Stripe account (white-label receipt/statement).\n const stripePromise = useMemo(\n () => loadStripe(pk, { stripeAccount: paymentIntent.connectedAccountId }),\n [pk, paymentIntent.connectedAccountId],\n );\n\n // Pass the customer session only when present + opted-in, so the Payment\n // Element can offer saved cards / \"save for future\" for this operator.\n const customerSessionClientSecret =\n saveCard && paymentIntent.customerSessionClientSecret\n ? paymentIntent.customerSessionClientSecret\n : undefined;\n\n return (\n <Elements\n stripe={stripePromise}\n options={{ clientSecret: paymentIntent.clientSecret, customerSessionClientSecret, appearance }}\n >\n <PayForm\n onPaid={onPaid}\n onError={onError}\n amountCents={amountCents}\n labels={labels}\n className={className}\n />\n </Elements>\n );\n}\n\nfunction PayForm({\n onPaid,\n onError,\n amountCents,\n labels,\n className,\n}: {\n onPaid: () => void;\n onError?: (message: string) => void;\n amountCents?: number;\n labels?: Partial<BowlosPaymentFormLabels>;\n className?: string;\n}) {\n const t = { ...DEFAULT_LABELS, ...labels };\n const stripe = useStripe();\n const elements = useElements();\n const [submitting, setSubmitting] = useState(false);\n const [message, setMessage] = useState<string | null>(null);\n const s = styles();\n\n async function handleSubmit(e: FormEvent) {\n e.preventDefault();\n if (!stripe || !elements) return;\n setSubmitting(true);\n setMessage(null);\n\n // `redirect: \"if_required\"` keeps card payments on-page; wallets that need\n // a redirect still work.\n const { error } = await stripe.confirmPayment({ elements, redirect: \"if_required\" });\n\n if (error) {\n const m = error.message ?? t.genericError;\n setMessage(m);\n onError?.(m);\n setSubmitting(false);\n return;\n }\n\n // Paid. The gateway's Stripe webhook materializes the reservation\n // asynchronously, so hand control back so the flow can poll for it.\n onPaid();\n }\n\n const payLabel = t.pay.replace(\"{amount}\", amountCents != null ? formatCents(amountCents) : \"\").trim();\n\n return (\n <form onSubmit={handleSubmit} className={className} style={s.stack}>\n <PaymentElement />\n {/* v0.22.1: include !elements — the submit handler bails on a not-yet-\n mounted PaymentElement, so a click during mount was a silent no-op\n (the \"first click does nothing\" race a center site reproduced). */}\n <button\n type=\"submit\"\n style={s.primaryBtn}\n disabled={!stripe || !elements || submitting}\n >\n {submitting ? t.paying : payLabel}\n </button>\n {message && (\n <p role=\"alert\" style={s.error}>\n {message}\n </p>\n )}\n </form>\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { A as AuthState, B as BowlosClient, h as BowlosClientConfig, r as Customer, O as LinkProfile } from './account-DEX2Lr78.js';
4
- import { as as BowlosApiError } from './booking-change-4DGu-B08.js';
3
+ import { a4 as AuthState, B as BowlosClient, ac as BowlosClientConfig, an as Customer, aI as LinkProfile } from './account-B4sZBmPI.cjs';
4
+ import { s as BowlosApiError } from './booking-change-Dd4PVgd3.cjs';
5
5
 
6
6
  interface BowlosProviderProps {
7
7
  /** A prebuilt client, or pass `config` to have one created and memoized. */
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { A as AuthState, B as BowlosClient, h as BowlosClientConfig, r as Customer, O as LinkProfile } from './account-DEX2Lr78.cjs';
4
- import { as as BowlosApiError } from './booking-change-aK6P37FZ.cjs';
3
+ import { a4 as AuthState, B as BowlosClient, ac as BowlosClientConfig, an as Customer, aI as LinkProfile } from './account-B4sZBmPI.js';
4
+ import { s as BowlosApiError } from './booking-change-DzYs9133.js';
5
5
 
6
6
  interface BowlosProviderProps {
7
7
  /** A prebuilt client, or pass `config` to have one created and memoized. */
package/dist/react.cjs CHANGED
@@ -40,6 +40,11 @@ var BowlosApiError = class _BowlosApiError extends Error {
40
40
  this.retryAfterSeconds = options.retryAfterSeconds;
41
41
  Object.setPrototypeOf(this, _BowlosApiError.prototype);
42
42
  }
43
+ /** Typed additive createAnonymousBooking slot-full details, when present. */
44
+ get slotFullDetails() {
45
+ const d = this.details;
46
+ return this.code === "VALIDATION_FAILED" && d?.reason === "slot_full" && typeof d.waitlistAvailable === "boolean" && typeof d.requested === "number" && typeof d.available === "number" ? d : void 0;
47
+ }
43
48
  /** Too many requests — caller should back off `retryAfterSeconds`. */
44
49
  get isRateLimited() {
45
50
  return this.code === BOWLOS_ERROR_CODES.RATE_LIMITED;
@@ -583,6 +588,21 @@ function getCheckoutStatus(client, refToken) {
583
588
  function abandonCheckout(client, refToken) {
584
589
  return client.call("abandonCheckout", { refToken }, { auth: true });
585
590
  }
591
+ function joinWaitlist(client, args) {
592
+ return client.call("joinWaitlist", args, {
593
+ auth: true
594
+ });
595
+ }
596
+ function createWaitlistSetupIntent(client, args) {
597
+ return client.call(
598
+ "createWaitlistSetupIntent",
599
+ args,
600
+ { auth: true }
601
+ );
602
+ }
603
+ function confirmWaitlistCard(client, args) {
604
+ return client.call("confirmWaitlistCard", args, { auth: true });
605
+ }
586
606
 
587
607
  // src/idempotent-mutation.ts
588
608
  function useIdempotentMutation(name, options = {}) {
@@ -1841,6 +1861,97 @@ function useBookingChange(scope) {
1841
1861
  reset
1842
1862
  };
1843
1863
  }
1864
+ function useWaitlistJoin() {
1865
+ const client = useBowlosClient();
1866
+ const [status, setStatus] = react.useState("idle");
1867
+ const [entry, setEntry] = react.useState();
1868
+ const [setupIntent, setSetupIntent] = react.useState();
1869
+ const [error, setError] = react.useState();
1870
+ const generation = react.useRef(0);
1871
+ const busy = react.useRef(false);
1872
+ react.useEffect(
1873
+ () => () => {
1874
+ generation.current++;
1875
+ },
1876
+ [client]
1877
+ );
1878
+ function reset() {
1879
+ generation.current++;
1880
+ busy.current = false;
1881
+ setStatus("idle");
1882
+ setEntry(void 0);
1883
+ setSetupIntent(void 0);
1884
+ setError(void 0);
1885
+ }
1886
+ async function join(args) {
1887
+ if (busy.current) return;
1888
+ busy.current = true;
1889
+ const current = ++generation.current;
1890
+ setStatus("quoting");
1891
+ setError(void 0);
1892
+ setEntry(void 0);
1893
+ setSetupIntent(void 0);
1894
+ try {
1895
+ const value = await joinWaitlist(client, args);
1896
+ if (current === generation.current) {
1897
+ setEntry(value);
1898
+ setStatus("card");
1899
+ }
1900
+ return value;
1901
+ } catch (e) {
1902
+ if (current === generation.current) {
1903
+ setError(e);
1904
+ setStatus("error");
1905
+ }
1906
+ throw e;
1907
+ } finally {
1908
+ if (current === generation.current) busy.current = false;
1909
+ }
1910
+ }
1911
+ async function createCardSetup() {
1912
+ if (!entry || busy.current || status !== "card") return;
1913
+ busy.current = true;
1914
+ const current = generation.current;
1915
+ try {
1916
+ const value = await createWaitlistSetupIntent(client, { entryId: entry.entryId });
1917
+ if (current === generation.current) setSetupIntent(value);
1918
+ return value;
1919
+ } catch (e) {
1920
+ if (current === generation.current) {
1921
+ setError(e);
1922
+ setStatus("error");
1923
+ }
1924
+ throw e;
1925
+ } finally {
1926
+ if (current === generation.current) busy.current = false;
1927
+ }
1928
+ }
1929
+ async function cardConfirmed(intent) {
1930
+ if (!entry || busy.current || status !== "card") return;
1931
+ if (intent.status !== "succeeded") return;
1932
+ busy.current = true;
1933
+ const current = generation.current;
1934
+ setStatus("confirming");
1935
+ setError(void 0);
1936
+ try {
1937
+ const result = await confirmWaitlistCard(client, {
1938
+ entryId: entry.entryId,
1939
+ setupIntentId: intent.id
1940
+ });
1941
+ if (result.status !== "waiting") throw new Error("Waitlist card confirmation incomplete.");
1942
+ if (current === generation.current) setStatus("joined");
1943
+ } catch (e) {
1944
+ if (current === generation.current) {
1945
+ setError(e);
1946
+ setStatus("error");
1947
+ }
1948
+ throw e;
1949
+ } finally {
1950
+ if (current === generation.current) busy.current = false;
1951
+ }
1952
+ }
1953
+ return { status, entry, setupIntent, error, join, createCardSetup, cardConfirmed, reset };
1954
+ }
1844
1955
 
1845
1956
  exports.BowlosProvider = BowlosProvider;
1846
1957
  exports.useAccount = useAccount;
@@ -1947,6 +2058,7 @@ exports.useStartTimes = useStartTimes;
1947
2058
  exports.useSubmitSupportRequest = useSubmitSupportRequest;
1948
2059
  exports.useTestMode = useTestMode;
1949
2060
  exports.useUpdateMyProfile = useUpdateMyProfile;
2061
+ exports.useWaitlistJoin = useWaitlistJoin;
1950
2062
  exports.useWalletPassUrl = useWalletPassUrl;
1951
2063
  //# sourceMappingURL=react.cjs.map
1952
2064
  //# sourceMappingURL=react.cjs.map