@bowlos/reservations 0.6.0 → 0.12.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/README.md +96 -9
- package/dist/catalog-kd07kri0.d.ts +74 -0
- package/dist/catalog-kdDjgvT1.d.cts +74 -0
- package/dist/{chunk-YICHFUAY.js → chunk-2X7MFQWY.js} +9 -3
- package/dist/chunk-2X7MFQWY.js.map +1 -0
- package/dist/{chunk-H42X4FRR.js → chunk-FPUWLOW3.js} +25 -4
- package/dist/chunk-FPUWLOW3.js.map +1 -0
- package/dist/chunk-Y3YSDO3H.js +221 -0
- package/dist/chunk-Y3YSDO3H.js.map +1 -0
- package/dist/components.cjs +366 -164
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +79 -4
- package/dist/components.d.ts +79 -4
- package/dist/components.js +340 -371
- package/dist/components.js.map +1 -1
- package/dist/{data-DrM0D6Pi.d.cts → data-lC-l-haz.d.cts} +33 -54
- package/dist/{data-DrM0D6Pi.d.ts → data-lC-l-haz.d.ts} +33 -54
- package/dist/errors-IIK7xibp.d.cts +54 -0
- package/dist/errors-IIK7xibp.d.ts +54 -0
- package/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/payments.cjs +245 -0
- package/dist/payments.cjs.map +1 -0
- package/dist/payments.d.cts +37 -0
- package/dist/payments.d.ts +37 -0
- package/dist/payments.js +83 -0
- package/dist/payments.js.map +1 -0
- package/dist/{react-7ruEsubp.d.cts → react-B3dlcklN.d.ts} +2 -1
- package/dist/{react-Cb_NZCXa.d.ts → react-aZplAyHS.d.cts} +2 -1
- package/dist/react.cjs +28 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +22 -5
- package/dist/react.d.ts +22 -5
- package/dist/react.js +2 -2
- package/package.json +20 -2
- package/templates/center-site/README.md +8 -7
- package/templates/center-site/app/book/page.tsx +33 -25
- package/templates/center-site/app/buy/page.tsx +36 -0
- package/templates/center-site/app/catalog/page.tsx +35 -0
- package/templates/center-site/app/site-header.tsx +1 -1
- package/templates/center-site/package.json +1 -1
- package/dist/account-BRapzoNI.d.cts +0 -46
- package/dist/account-VO6BzPNK.d.ts +0 -46
- package/dist/chunk-H42X4FRR.js.map +0 -1
- package/dist/chunk-YICHFUAY.js.map +0 -1
- package/templates/center-site/app/book/checkout-form.tsx +0 -85
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var stripeJs = require('@stripe/stripe-js');
|
|
5
|
+
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/components/payment-form.tsx
|
|
9
|
+
var VAR = {
|
|
10
|
+
colorPrimary: "--bowlos-color-primary",
|
|
11
|
+
colorPrimaryContrast: "--bowlos-color-primary-contrast",
|
|
12
|
+
colorText: "--bowlos-color-text",
|
|
13
|
+
colorMuted: "--bowlos-color-muted",
|
|
14
|
+
colorBg: "--bowlos-color-bg",
|
|
15
|
+
colorSurface: "--bowlos-color-surface",
|
|
16
|
+
colorBorder: "--bowlos-color-border",
|
|
17
|
+
colorError: "--bowlos-color-error",
|
|
18
|
+
colorSuccess: "--bowlos-color-success",
|
|
19
|
+
radius: "--bowlos-radius",
|
|
20
|
+
fontFamily: "--bowlos-font"
|
|
21
|
+
};
|
|
22
|
+
var BOWLOS_DEFAULT_THEME = {
|
|
23
|
+
colorPrimary: "#1f2937",
|
|
24
|
+
colorPrimaryContrast: "#ffffff",
|
|
25
|
+
colorText: "#111827",
|
|
26
|
+
colorMuted: "#6b7280",
|
|
27
|
+
colorBg: "#ffffff",
|
|
28
|
+
colorSurface: "#f9fafb",
|
|
29
|
+
colorBorder: "#e5e7eb",
|
|
30
|
+
colorError: "#dc2626",
|
|
31
|
+
colorSuccess: "#16a34a",
|
|
32
|
+
radius: "10px",
|
|
33
|
+
fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"
|
|
34
|
+
};
|
|
35
|
+
function token(key) {
|
|
36
|
+
return `var(${VAR[key]}, ${BOWLOS_DEFAULT_THEME[key]})`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/components/shared.tsx
|
|
40
|
+
function styles() {
|
|
41
|
+
return {
|
|
42
|
+
// containers
|
|
43
|
+
card: {
|
|
44
|
+
fontFamily: token("fontFamily"),
|
|
45
|
+
color: token("colorText"),
|
|
46
|
+
background: token("colorBg"),
|
|
47
|
+
border: `1px solid ${token("colorBorder")}`,
|
|
48
|
+
borderRadius: token("radius"),
|
|
49
|
+
padding: "1.25rem",
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: "column",
|
|
52
|
+
gap: "0.75rem",
|
|
53
|
+
maxWidth: 380
|
|
54
|
+
},
|
|
55
|
+
panel: {
|
|
56
|
+
fontFamily: token("fontFamily"),
|
|
57
|
+
color: token("colorText"),
|
|
58
|
+
background: token("colorBg"),
|
|
59
|
+
border: `1px solid ${token("colorBorder")}`,
|
|
60
|
+
borderRadius: token("radius"),
|
|
61
|
+
padding: "1rem 1.25rem",
|
|
62
|
+
display: "flex",
|
|
63
|
+
flexDirection: "column",
|
|
64
|
+
gap: "0.625rem"
|
|
65
|
+
},
|
|
66
|
+
// text
|
|
67
|
+
heading: { margin: "0 0 0.25rem", fontSize: "1.25rem" },
|
|
68
|
+
sectionTitle: {
|
|
69
|
+
margin: "0 0 0.5rem",
|
|
70
|
+
fontSize: "0.8rem",
|
|
71
|
+
fontWeight: 700,
|
|
72
|
+
letterSpacing: "0.04em",
|
|
73
|
+
textTransform: "uppercase",
|
|
74
|
+
color: token("colorMuted")
|
|
75
|
+
},
|
|
76
|
+
body: { margin: 0, color: token("colorText") },
|
|
77
|
+
meta: { margin: 0, fontSize: "0.9rem", color: token("colorMuted"), minHeight: "1.2em" },
|
|
78
|
+
muted: { margin: 0, fontSize: "0.9rem", color: token("colorMuted") },
|
|
79
|
+
error: { margin: 0, color: token("colorError"), fontSize: "0.9rem" },
|
|
80
|
+
// form
|
|
81
|
+
label: {
|
|
82
|
+
display: "flex",
|
|
83
|
+
flexDirection: "column",
|
|
84
|
+
gap: "0.25rem",
|
|
85
|
+
fontSize: "0.85rem",
|
|
86
|
+
color: token("colorMuted")
|
|
87
|
+
},
|
|
88
|
+
input: {
|
|
89
|
+
padding: "0.5rem 0.625rem",
|
|
90
|
+
fontSize: "1rem",
|
|
91
|
+
color: token("colorText"),
|
|
92
|
+
background: token("colorSurface"),
|
|
93
|
+
border: `1px solid ${token("colorBorder")}`,
|
|
94
|
+
borderRadius: token("radius")
|
|
95
|
+
},
|
|
96
|
+
// layout
|
|
97
|
+
row: { display: "flex", gap: "0.5rem", flexWrap: "wrap", alignItems: "center" },
|
|
98
|
+
rowBetween: { display: "flex", gap: "0.5rem", justifyContent: "space-between", alignItems: "center" },
|
|
99
|
+
stack: { display: "flex", flexDirection: "column", gap: "0.75rem" },
|
|
100
|
+
// buttons
|
|
101
|
+
primaryBtn: {
|
|
102
|
+
padding: "0.625rem 1rem",
|
|
103
|
+
fontSize: "1rem",
|
|
104
|
+
fontWeight: 600,
|
|
105
|
+
color: token("colorPrimaryContrast"),
|
|
106
|
+
background: token("colorPrimary"),
|
|
107
|
+
border: "none",
|
|
108
|
+
borderRadius: token("radius"),
|
|
109
|
+
cursor: "pointer"
|
|
110
|
+
},
|
|
111
|
+
ghostBtn: {
|
|
112
|
+
padding: "0.625rem 1rem",
|
|
113
|
+
fontSize: "1rem",
|
|
114
|
+
color: token("colorText"),
|
|
115
|
+
background: "transparent",
|
|
116
|
+
border: `1px solid ${token("colorBorder")}`,
|
|
117
|
+
borderRadius: token("radius"),
|
|
118
|
+
cursor: "pointer"
|
|
119
|
+
},
|
|
120
|
+
linkBtn: {
|
|
121
|
+
padding: 0,
|
|
122
|
+
fontSize: "0.9rem",
|
|
123
|
+
color: token("colorPrimary"),
|
|
124
|
+
background: "transparent",
|
|
125
|
+
border: "none",
|
|
126
|
+
cursor: "pointer",
|
|
127
|
+
textDecoration: "underline"
|
|
128
|
+
},
|
|
129
|
+
// list rows (reservations, memberships, ledger, passes, flash items)
|
|
130
|
+
listItem: {
|
|
131
|
+
display: "flex",
|
|
132
|
+
justifyContent: "space-between",
|
|
133
|
+
alignItems: "baseline",
|
|
134
|
+
gap: "0.75rem",
|
|
135
|
+
padding: "0.625rem 0",
|
|
136
|
+
borderTop: `1px solid ${token("colorBorder")}`
|
|
137
|
+
},
|
|
138
|
+
listTitle: { margin: 0, fontSize: "1rem", fontWeight: 600 },
|
|
139
|
+
listMeta: { margin: 0, fontSize: "0.85rem", color: token("colorMuted") },
|
|
140
|
+
// badges + prices
|
|
141
|
+
badge: {
|
|
142
|
+
display: "inline-block",
|
|
143
|
+
padding: "0.125rem 0.5rem",
|
|
144
|
+
fontSize: "0.75rem",
|
|
145
|
+
fontWeight: 600,
|
|
146
|
+
color: token("colorMuted"),
|
|
147
|
+
background: token("colorSurface"),
|
|
148
|
+
border: `1px solid ${token("colorBorder")}`,
|
|
149
|
+
borderRadius: "999px",
|
|
150
|
+
whiteSpace: "nowrap"
|
|
151
|
+
},
|
|
152
|
+
priceSale: { fontSize: "1.05rem", fontWeight: 700, color: token("colorText") },
|
|
153
|
+
priceStrike: { fontSize: "0.9rem", color: token("colorMuted"), textDecoration: "line-through" },
|
|
154
|
+
// flash hero
|
|
155
|
+
banner: {
|
|
156
|
+
width: "100%",
|
|
157
|
+
height: 140,
|
|
158
|
+
objectFit: "cover",
|
|
159
|
+
borderTopLeftRadius: token("radius"),
|
|
160
|
+
borderTopRightRadius: token("radius"),
|
|
161
|
+
display: "block"
|
|
162
|
+
},
|
|
163
|
+
countdown: { margin: 0, fontSize: "0.95rem", fontWeight: 600, color: token("colorPrimary") }
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function formatCents(cents) {
|
|
167
|
+
return (cents / 100).toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
168
|
+
}
|
|
169
|
+
var DEFAULT_LABELS = {
|
|
170
|
+
pay: "Pay {amount}",
|
|
171
|
+
paying: "Paying\u2026",
|
|
172
|
+
genericError: "Payment failed \u2014 please try again."
|
|
173
|
+
};
|
|
174
|
+
function BowlosPaymentForm({
|
|
175
|
+
paymentIntent,
|
|
176
|
+
publishableKey,
|
|
177
|
+
onPaid,
|
|
178
|
+
onError,
|
|
179
|
+
amountCents,
|
|
180
|
+
saveCard = true,
|
|
181
|
+
labels,
|
|
182
|
+
className
|
|
183
|
+
}) {
|
|
184
|
+
const stripePromise = react.useMemo(
|
|
185
|
+
() => stripeJs.loadStripe(publishableKey, { stripeAccount: paymentIntent.connectedAccountId }),
|
|
186
|
+
[publishableKey, paymentIntent.connectedAccountId]
|
|
187
|
+
);
|
|
188
|
+
const customerSessionClientSecret = saveCard && paymentIntent.customerSessionClientSecret ? paymentIntent.customerSessionClientSecret : void 0;
|
|
189
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
reactStripeJs.Elements,
|
|
191
|
+
{
|
|
192
|
+
stripe: stripePromise,
|
|
193
|
+
options: { clientSecret: paymentIntent.clientSecret, customerSessionClientSecret },
|
|
194
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
195
|
+
PayForm,
|
|
196
|
+
{
|
|
197
|
+
onPaid,
|
|
198
|
+
onError,
|
|
199
|
+
amountCents,
|
|
200
|
+
labels,
|
|
201
|
+
className
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
function PayForm({
|
|
208
|
+
onPaid,
|
|
209
|
+
onError,
|
|
210
|
+
amountCents,
|
|
211
|
+
labels,
|
|
212
|
+
className
|
|
213
|
+
}) {
|
|
214
|
+
const t = { ...DEFAULT_LABELS, ...labels };
|
|
215
|
+
const stripe = reactStripeJs.useStripe();
|
|
216
|
+
const elements = reactStripeJs.useElements();
|
|
217
|
+
const [submitting, setSubmitting] = react.useState(false);
|
|
218
|
+
const [message, setMessage] = react.useState(null);
|
|
219
|
+
const s = styles();
|
|
220
|
+
async function handleSubmit(e) {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
if (!stripe || !elements) return;
|
|
223
|
+
setSubmitting(true);
|
|
224
|
+
setMessage(null);
|
|
225
|
+
const { error } = await stripe.confirmPayment({ elements, redirect: "if_required" });
|
|
226
|
+
if (error) {
|
|
227
|
+
const m = error.message ?? t.genericError;
|
|
228
|
+
setMessage(m);
|
|
229
|
+
onError?.(m);
|
|
230
|
+
setSubmitting(false);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
onPaid();
|
|
234
|
+
}
|
|
235
|
+
const payLabel = t.pay.replace("{amount}", amountCents != null ? formatCents(amountCents) : "").trim();
|
|
236
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className, style: s.stack, children: [
|
|
237
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactStripeJs.PaymentElement, {}),
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", style: s.primaryBtn, disabled: !stripe || submitting, children: submitting ? t.paying : payLabel }),
|
|
239
|
+
message && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", style: s.error, children: message })
|
|
240
|
+
] });
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
exports.BowlosPaymentForm = BowlosPaymentForm;
|
|
244
|
+
//# sourceMappingURL=payments.cjs.map
|
|
245
|
+
//# sourceMappingURL=payments.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/theme.tsx","../src/components/shared.tsx","../src/components/payment-form.tsx"],"names":["useMemo","loadStripe","jsx","Elements","useStripe","useElements","useState","PaymentElement"],"mappings":";;;;;;;;AA6BA,IAAM,GAAA,GAA+C;AAAA,EACnD,YAAA,EAA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AAI,CAAA;AAIf,IAAA,MAAM,EAAE,KAAA,EAAM,GAAI,MAAM,MAAA,CAAO,eAAe,EAAE,QAAA,EAAU,QAAA,EAAU,aAAA,EAAe,CAAA;AAEnF,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,MAAM,CAAA,GAAI,KAAA,CAAM,OAAA,IAAW,CAAA,CAAE,YAAA;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,uCACG,MAAA,EAAA,EAAK,QAAA,EAAU,cAAc,SAAA,EAAsB,KAAA,EAAO,EAAE,KAAA,EAC3D,QAAA,EAAA;AAAA,oBAAAJ,eAACK,4BAAA,EAAA,EAAe,CAAA;AAAA,oBAChBL,cAAAA,CAAC,QAAA,EAAA,EAAO,IAAA,EAAK,UAAS,KAAA,EAAO,CAAA,CAAE,UAAA,EAAY,QAAA,EAAU,CAAC,MAAA,IAAU,UAAA,EAC7D,QAAA,EAAA,UAAA,GAAa,CAAA,CAAE,SAAS,QAAA,EAC3B,CAAA;AAAA,IACC,OAAA,oBACCA,cAAAA,CAAC,GAAA,EAAA,EAAE,MAAK,OAAA,EAAQ,KAAA,EAAO,CAAA,CAAE,KAAA,EACtB,QAAA,EAAA,OAAA,EACH;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"payments.cjs","sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\n\n/**\n * Themeable design tokens for the `@bowlos/reservations/components` layer.\n *\n * Override any subset; the rest fall back to neutral, **white-label** defaults\n * (deliberately no BowlOS branding — these render on a center's own site).\n * Tokens are applied as CSS custom properties, so you can theme either with\n * `<BowlosTheme theme={...}>` or by setting the `--bowlos-*` variables yourself\n * in CSS.\n */\nexport interface BowlosThemeTokens {\n /** Accent color — buttons, highlights. */\n colorPrimary?: string;\n /** Text/icon color on top of `colorPrimary`. */\n colorPrimaryContrast?: string;\n colorText?: string;\n colorMuted?: string;\n colorBg?: string;\n colorSurface?: string;\n colorBorder?: string;\n colorError?: string;\n colorSuccess?: string;\n /** Corner radius (e.g. \"10px\", \"0.5rem\"). */\n radius?: string;\n /** Font family stack. */\n fontFamily?: string;\n}\n\nconst VAR: Record<keyof BowlosThemeTokens, string> = {\n colorPrimary: \"--bowlos-color-primary\",\n colorPrimaryContrast: \"--bowlos-color-primary-contrast\",\n colorText: \"--bowlos-color-text\",\n colorMuted: \"--bowlos-color-muted\",\n colorBg: \"--bowlos-color-bg\",\n colorSurface: \"--bowlos-color-surface\",\n colorBorder: \"--bowlos-color-border\",\n colorError: \"--bowlos-color-error\",\n colorSuccess: \"--bowlos-color-success\",\n radius: \"--bowlos-radius\",\n fontFamily: \"--bowlos-font\",\n};\n\n/** Neutral, white-label defaults — used as the CSS-var fallbacks, so components\n * look right even with no `<BowlosTheme>` wrapper. */\nexport const BOWLOS_DEFAULT_THEME: Required<BowlosThemeTokens> = {\n colorPrimary: \"#1f2937\",\n colorPrimaryContrast: \"#ffffff\",\n colorText: \"#111827\",\n colorMuted: \"#6b7280\",\n colorBg: \"#ffffff\",\n colorSurface: \"#f9fafb\",\n colorBorder: \"#e5e7eb\",\n colorError: \"#dc2626\",\n colorSuccess: \"#16a34a\",\n radius: \"10px\",\n fontFamily: \"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif\",\n};\n\nfunction themeToVars(theme: BowlosThemeTokens): CSSProperties {\n const out: Record<string, string> = {};\n for (const key of Object.keys(VAR) as (keyof BowlosThemeTokens)[]) {\n const value = theme[key];\n if (value) out[VAR[key]] = value;\n }\n return out as CSSProperties;\n}\n\n/**\n * Applies a theme by setting the `--bowlos-*` CSS variables on a wrapper, which\n * the components read. Children inherit them; nest another `<BowlosTheme>` to\n * override per-section. Optional — components fall back to neutral defaults\n * without it.\n */\nexport function BowlosTheme({\n theme = {},\n className,\n style,\n children,\n}: {\n theme?: BowlosThemeTokens;\n className?: string;\n style?: CSSProperties;\n children: ReactNode;\n}) {\n return (\n <div className={className} style={{ ...themeToVars(theme), ...style }}>\n {children}\n </div>\n );\n}\n\n/** A CSS-var reference for a token, with the neutral default baked in as the\n * fallback — components use this in inline styles. */\nexport function token(key: keyof BowlosThemeTokens): string {\n return `var(${VAR[key]}, ${BOWLOS_DEFAULT_THEME[key]})`;\n}\n","\"use client\";\n/**\n * Shared primitives for the `@bowlos/reservations/components` layer.\n *\n * One canonical set of themed style atoms + formatters, consumed by every\n * component (booking, account, flash) so there's a single source of truth for\n * the look — no per-surface copies. All visuals read the `--bowlos-*` CSS vars\n * via `token()`, so a `<BowlosTheme>` (or raw CSS) restyles every component at\n * once. White-label by design — neutral defaults, no BowlOS branding.\n */\nimport { useEffect, useState, type CSSProperties } from \"react\";\nimport { token } from \"./theme\";\n\n/** The canonical themed style atoms. Components pick the atoms they need. */\nexport function styles(): Record<string, CSSProperties> {\n return {\n // containers\n card: {\n fontFamily: token(\"fontFamily\"),\n color: token(\"colorText\"),\n background: token(\"colorBg\"),\n border: `1px solid ${token(\"colorBorder\")}`,\n borderRadius: token(\"radius\"),\n padding: \"1.25rem\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"0.75rem\",\n maxWidth: 380,\n },\n panel: {\n fontFamily: token(\"fontFamily\"),\n color: token(\"colorText\"),\n background: token(\"colorBg\"),\n border: `1px solid ${token(\"colorBorder\")}`,\n borderRadius: token(\"radius\"),\n padding: \"1rem 1.25rem\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"0.625rem\",\n },\n // text\n heading: { margin: \"0 0 0.25rem\", fontSize: \"1.25rem\" },\n sectionTitle: {\n margin: \"0 0 0.5rem\",\n fontSize: \"0.8rem\",\n fontWeight: 700,\n letterSpacing: \"0.04em\",\n textTransform: \"uppercase\",\n color: token(\"colorMuted\"),\n },\n body: { margin: 0, color: token(\"colorText\") },\n meta: { margin: 0, fontSize: \"0.9rem\", color: token(\"colorMuted\"), minHeight: \"1.2em\" },\n muted: { margin: 0, fontSize: \"0.9rem\", color: token(\"colorMuted\") },\n error: { margin: 0, color: token(\"colorError\"), fontSize: \"0.9rem\" },\n // form\n label: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"0.25rem\",\n fontSize: \"0.85rem\",\n color: token(\"colorMuted\"),\n },\n input: {\n padding: \"0.5rem 0.625rem\",\n fontSize: \"1rem\",\n color: token(\"colorText\"),\n background: token(\"colorSurface\"),\n border: `1px solid ${token(\"colorBorder\")}`,\n borderRadius: token(\"radius\"),\n },\n // layout\n row: { display: \"flex\", gap: \"0.5rem\", flexWrap: \"wrap\", alignItems: \"center\" },\n rowBetween: { display: \"flex\", gap: \"0.5rem\", justifyContent: \"space-between\", alignItems: \"center\" },\n stack: { display: \"flex\", flexDirection: \"column\", gap: \"0.75rem\" },\n // buttons\n primaryBtn: {\n padding: \"0.625rem 1rem\",\n fontSize: \"1rem\",\n fontWeight: 600,\n color: token(\"colorPrimaryContrast\"),\n background: token(\"colorPrimary\"),\n border: \"none\",\n borderRadius: token(\"radius\"),\n cursor: \"pointer\",\n },\n ghostBtn: {\n padding: \"0.625rem 1rem\",\n fontSize: \"1rem\",\n color: token(\"colorText\"),\n background: \"transparent\",\n border: `1px solid ${token(\"colorBorder\")}`,\n borderRadius: token(\"radius\"),\n cursor: \"pointer\",\n },\n linkBtn: {\n padding: 0,\n fontSize: \"0.9rem\",\n color: token(\"colorPrimary\"),\n background: \"transparent\",\n border: \"none\",\n cursor: \"pointer\",\n textDecoration: \"underline\",\n },\n // list rows (reservations, memberships, ledger, passes, flash items)\n listItem: {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"baseline\",\n gap: \"0.75rem\",\n padding: \"0.625rem 0\",\n borderTop: `1px solid ${token(\"colorBorder\")}`,\n },\n listTitle: { margin: 0, fontSize: \"1rem\", fontWeight: 600 },\n listMeta: { margin: 0, fontSize: \"0.85rem\", color: token(\"colorMuted\") },\n // badges + prices\n badge: {\n display: \"inline-block\",\n padding: \"0.125rem 0.5rem\",\n fontSize: \"0.75rem\",\n fontWeight: 600,\n color: token(\"colorMuted\"),\n background: token(\"colorSurface\"),\n border: `1px solid ${token(\"colorBorder\")}`,\n borderRadius: \"999px\",\n whiteSpace: \"nowrap\",\n },\n priceSale: { fontSize: \"1.05rem\", fontWeight: 700, color: token(\"colorText\") },\n priceStrike: { fontSize: \"0.9rem\", color: token(\"colorMuted\"), textDecoration: \"line-through\" },\n // flash hero\n banner: {\n width: \"100%\",\n height: 140,\n objectFit: \"cover\",\n borderTopLeftRadius: token(\"radius\"),\n borderTopRightRadius: token(\"radius\"),\n display: \"block\",\n },\n countdown: { margin: 0, fontSize: \"0.95rem\", fontWeight: 600, color: token(\"colorPrimary\") },\n };\n}\n\n/** Format integer cents as USD. */\nexport function formatCents(cents: number): string {\n return (cents / 100).toLocaleString(undefined, { style: \"currency\", currency: \"USD\" });\n}\n\n/** A min–max money range, collapsing to one value when they're equal. */\nexport function formatCentsRange(minCents: number, maxCents: number): string {\n return maxCents > minCents ? `${formatCents(minCents)} – ${formatCents(maxCents)}` : formatCents(minCents);\n}\n\n/** Minute-of-day → \"HH:MM\" (24h, for `<input type=\"time\">`). */\nexport function minutesToTime(min: number): string {\n const h = Math.floor(min / 60)\n .toString()\n .padStart(2, \"0\");\n const m = (min % 60).toString().padStart(2, \"0\");\n return `${h}:${m}`;\n}\n\n/** \"HH:MM\" → minute-of-day. */\nexport function timeToMinutes(t: string): number {\n const [h, m] = t.split(\":\").map(Number);\n return (h ?? 0) * 60 + (m ?? 0);\n}\n\n/** Minute-of-day → friendly 12-hour label (\"6:00 PM\"), for time dropdowns. */\nexport function formatMinuteLabel(min: number): string {\n const h24 = Math.floor(min / 60) % 24;\n const m = min % 60;\n const period = h24 < 12 ? \"AM\" : \"PM\";\n const h12 = h24 % 12 === 0 ? 12 : h24 % 12;\n return `${h12}:${m.toString().padStart(2, \"0\")} ${period}`;\n}\n\n/**\n * A live countdown to `targetMs`, recomputed every second on the client.\n *\n * Returns `null` on the server / first client render (so SSR markup and the\n * first hydration pass match — no mismatch), then ticks once mounted. `ended`\n * flips true at/after the target. We derive this off a ticking timer rather\n * than a server-computed boolean so it stays live without a refetch.\n */\nexport function useCountdown(targetMs: number | null): { ended: boolean; label: string } | null {\n const [now, setNow] = useState<number | null>(null);\n useEffect(() => {\n if (targetMs === null) return;\n setNow(Date.now());\n const id = setInterval(() => setNow(Date.now()), 1000);\n return () => clearInterval(id);\n }, [targetMs]);\n\n if (now === null || targetMs === null) return null;\n const remaining = targetMs - now;\n if (remaining <= 0) return { ended: true, label: \"\" };\n return { ended: false, label: humanizeRemaining(remaining) };\n}\n\nfunction humanizeRemaining(ms: number): string {\n const totalSec = Math.floor(ms / 1000);\n const d = Math.floor(totalSec / 86400);\n const h = Math.floor((totalSec % 86400) / 3600);\n const m = Math.floor((totalSec % 3600) / 60);\n const s = totalSec % 60;\n if (d > 0) return `${d}d ${h}h ${m}m`;\n if (h > 0) return `${h}h ${m}m ${s}s`;\n if (m > 0) return `${m}m ${s}s`;\n return `${s}s`;\n}\n","\"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 } from \"@stripe/stripe-js\";\nimport { Elements, PaymentElement, useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport type { PaymentIntentInfo } 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 PaymentIntent from `useBookingFlow`/`<BookingFlow>`. */\n paymentIntent: PaymentIntentInfo;\n /** Your PLATFORM publishable key (browser-safe; e.g. `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`). */\n publishableKey: 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 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 onPaid,\n onError,\n amountCents,\n saveCard = true,\n labels,\n className,\n}: BowlosPaymentFormProps) {\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(publishableKey, { stripeAccount: paymentIntent.connectedAccountId }),\n [publishableKey, 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 }}\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 <button type=\"submit\" style={s.primaryBtn} disabled={!stripe || submitting}>\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"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { P as PaymentIntentInfo } from './data-lC-l-haz.cjs';
|
|
3
|
+
|
|
4
|
+
/** Visible strings — override any subset for copy/i18n. */
|
|
5
|
+
interface BowlosPaymentFormLabels {
|
|
6
|
+
/** Button when idle. `{amount}` (if present) is replaced with the formatted total. */
|
|
7
|
+
pay: string;
|
|
8
|
+
paying: string;
|
|
9
|
+
genericError: string;
|
|
10
|
+
}
|
|
11
|
+
interface BowlosPaymentFormProps {
|
|
12
|
+
/** The Connect PaymentIntent from `useBookingFlow`/`<BookingFlow>`. */
|
|
13
|
+
paymentIntent: PaymentIntentInfo;
|
|
14
|
+
/** Your PLATFORM publishable key (browser-safe; e.g. `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`). */
|
|
15
|
+
publishableKey: string;
|
|
16
|
+
/** Called once the PaymentIntent confirms — start polling for the reservation. */
|
|
17
|
+
onPaid: () => void;
|
|
18
|
+
/** Called with a human-readable message when confirmation fails. */
|
|
19
|
+
onError?: (message: string) => void;
|
|
20
|
+
/** Total, for the button label ("Pay $45.00"). Omit to show a plain "Pay". */
|
|
21
|
+
amountCents?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Enable saved cards + a "save for future" option via the booking's customer
|
|
24
|
+
* session (when the gateway provided one). Default `true`. Set `false` for a
|
|
25
|
+
* one-off charge with no card on file.
|
|
26
|
+
*/
|
|
27
|
+
saveCard?: boolean;
|
|
28
|
+
labels?: Partial<BowlosPaymentFormLabels>;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The Stripe Connect payment form. Renders the Payment Element scoped to the
|
|
33
|
+
* operator's connected account and confirms the PaymentIntent on submit.
|
|
34
|
+
*/
|
|
35
|
+
declare function BowlosPaymentForm({ paymentIntent, publishableKey, onPaid, onError, amountCents, saveCard, labels, className, }: BowlosPaymentFormProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
export { BowlosPaymentForm, type BowlosPaymentFormLabels, type BowlosPaymentFormProps };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { P as PaymentIntentInfo } from './data-lC-l-haz.js';
|
|
3
|
+
|
|
4
|
+
/** Visible strings — override any subset for copy/i18n. */
|
|
5
|
+
interface BowlosPaymentFormLabels {
|
|
6
|
+
/** Button when idle. `{amount}` (if present) is replaced with the formatted total. */
|
|
7
|
+
pay: string;
|
|
8
|
+
paying: string;
|
|
9
|
+
genericError: string;
|
|
10
|
+
}
|
|
11
|
+
interface BowlosPaymentFormProps {
|
|
12
|
+
/** The Connect PaymentIntent from `useBookingFlow`/`<BookingFlow>`. */
|
|
13
|
+
paymentIntent: PaymentIntentInfo;
|
|
14
|
+
/** Your PLATFORM publishable key (browser-safe; e.g. `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`). */
|
|
15
|
+
publishableKey: string;
|
|
16
|
+
/** Called once the PaymentIntent confirms — start polling for the reservation. */
|
|
17
|
+
onPaid: () => void;
|
|
18
|
+
/** Called with a human-readable message when confirmation fails. */
|
|
19
|
+
onError?: (message: string) => void;
|
|
20
|
+
/** Total, for the button label ("Pay $45.00"). Omit to show a plain "Pay". */
|
|
21
|
+
amountCents?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Enable saved cards + a "save for future" option via the booking's customer
|
|
24
|
+
* session (when the gateway provided one). Default `true`. Set `false` for a
|
|
25
|
+
* one-off charge with no card on file.
|
|
26
|
+
*/
|
|
27
|
+
saveCard?: boolean;
|
|
28
|
+
labels?: Partial<BowlosPaymentFormLabels>;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The Stripe Connect payment form. Renders the Payment Element scoped to the
|
|
33
|
+
* operator's connected account and confirms the PaymentIntent on submit.
|
|
34
|
+
*/
|
|
35
|
+
declare function BowlosPaymentForm({ paymentIntent, publishableKey, onPaid, onError, amountCents, saveCard, labels, className, }: BowlosPaymentFormProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
export { BowlosPaymentForm, type BowlosPaymentFormLabels, type BowlosPaymentFormProps };
|
package/dist/payments.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { styles, formatCents } from './chunk-Y3YSDO3H.js';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { loadStripe } from '@stripe/stripe-js';
|
|
4
|
+
import { Elements, useStripe, useElements, PaymentElement } from '@stripe/react-stripe-js';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var DEFAULT_LABELS = {
|
|
8
|
+
pay: "Pay {amount}",
|
|
9
|
+
paying: "Paying\u2026",
|
|
10
|
+
genericError: "Payment failed \u2014 please try again."
|
|
11
|
+
};
|
|
12
|
+
function BowlosPaymentForm({
|
|
13
|
+
paymentIntent,
|
|
14
|
+
publishableKey,
|
|
15
|
+
onPaid,
|
|
16
|
+
onError,
|
|
17
|
+
amountCents,
|
|
18
|
+
saveCard = true,
|
|
19
|
+
labels,
|
|
20
|
+
className
|
|
21
|
+
}) {
|
|
22
|
+
const stripePromise = useMemo(
|
|
23
|
+
() => loadStripe(publishableKey, { stripeAccount: paymentIntent.connectedAccountId }),
|
|
24
|
+
[publishableKey, paymentIntent.connectedAccountId]
|
|
25
|
+
);
|
|
26
|
+
const customerSessionClientSecret = saveCard && paymentIntent.customerSessionClientSecret ? paymentIntent.customerSessionClientSecret : void 0;
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
Elements,
|
|
29
|
+
{
|
|
30
|
+
stripe: stripePromise,
|
|
31
|
+
options: { clientSecret: paymentIntent.clientSecret, customerSessionClientSecret },
|
|
32
|
+
children: /* @__PURE__ */ jsx(
|
|
33
|
+
PayForm,
|
|
34
|
+
{
|
|
35
|
+
onPaid,
|
|
36
|
+
onError,
|
|
37
|
+
amountCents,
|
|
38
|
+
labels,
|
|
39
|
+
className
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function PayForm({
|
|
46
|
+
onPaid,
|
|
47
|
+
onError,
|
|
48
|
+
amountCents,
|
|
49
|
+
labels,
|
|
50
|
+
className
|
|
51
|
+
}) {
|
|
52
|
+
const t = { ...DEFAULT_LABELS, ...labels };
|
|
53
|
+
const stripe = useStripe();
|
|
54
|
+
const elements = useElements();
|
|
55
|
+
const [submitting, setSubmitting] = useState(false);
|
|
56
|
+
const [message, setMessage] = useState(null);
|
|
57
|
+
const s = styles();
|
|
58
|
+
async function handleSubmit(e) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
if (!stripe || !elements) return;
|
|
61
|
+
setSubmitting(true);
|
|
62
|
+
setMessage(null);
|
|
63
|
+
const { error } = await stripe.confirmPayment({ elements, redirect: "if_required" });
|
|
64
|
+
if (error) {
|
|
65
|
+
const m = error.message ?? t.genericError;
|
|
66
|
+
setMessage(m);
|
|
67
|
+
onError?.(m);
|
|
68
|
+
setSubmitting(false);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
onPaid();
|
|
72
|
+
}
|
|
73
|
+
const payLabel = t.pay.replace("{amount}", amountCents != null ? formatCents(amountCents) : "").trim();
|
|
74
|
+
return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className, style: s.stack, children: [
|
|
75
|
+
/* @__PURE__ */ jsx(PaymentElement, {}),
|
|
76
|
+
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: !stripe || submitting, children: submitting ? t.paying : payLabel }),
|
|
77
|
+
message && /* @__PURE__ */ jsx("p", { role: "alert", style: s.error, children: message })
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { BowlosPaymentForm };
|
|
82
|
+
//# sourceMappingURL=payments.js.map
|
|
83
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;AA2BO,SAAS,iBAAA,CAAkB;AAAA,EAChC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA,GAAW,IAAA;AAAA,EACX,MAAA;AAAA,EACA;AACF,CAAA,EAA2B;AAGzB,EAAA,MAAM,aAAA,GAAgB,OAAA;AAAA,IACpB,MAAM,UAAA,CAAW,cAAA,EAAgB,EAAE,aAAA,EAAe,aAAA,CAAc,oBAAoB,CAAA;AAAA,IACpF,CAAC,cAAA,EAAgB,aAAA,CAAc,kBAAkB;AAAA,GACnD;AAIA,EAAA,MAAM,2BAAA,GACJ,QAAA,IAAY,aAAA,CAAc,2BAAA,GACtB,cAAc,2BAAA,GACd,MAAA;AAEN,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,aAAA;AAAA,MACR,OAAA,EAAS,EAAE,YAAA,EAAc,aAAA,CAAc,cAAc,2BAAA,EAA4B;AAAA,MAEjF,QAAA,kBAAA,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,MAAA;AAAA,UACA,OAAA;AAAA,UACA,WAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;AAEA,SAAS,OAAA,CAAQ;AAAA,EACf,MAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,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AA,EAAe,CAAA;AAAA,oBAChB,GAAA,CAAC,QAAA,EAAA,EAAO,IAAA,EAAK,QAAA,EAAS,OAAO,CAAA,CAAE,UAAA,EAAY,QAAA,EAAU,CAAC,MAAA,IAAU,UAAA,EAC7D,QAAA,EAAA,UAAA,GAAa,CAAA,CAAE,SAAS,QAAA,EAC3B,CAAA;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 } from \"@stripe/stripe-js\";\nimport { Elements, PaymentElement, useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport type { PaymentIntentInfo } 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 PaymentIntent from `useBookingFlow`/`<BookingFlow>`. */\n paymentIntent: PaymentIntentInfo;\n /** Your PLATFORM publishable key (browser-safe; e.g. `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY`). */\n publishableKey: 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 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 onPaid,\n onError,\n amountCents,\n saveCard = true,\n labels,\n className,\n}: BowlosPaymentFormProps) {\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(publishableKey, { stripeAccount: paymentIntent.connectedAccountId }),\n [publishableKey, 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 }}\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 <button type=\"submit\" style={s.primaryBtn} disabled={!stripe || submitting}>\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,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { A as AuthState,
|
|
3
|
+
import { A as AuthState, g as BowlosClient, h as BowlosClientConfig, k as Customer, L as LinkProfile } from './data-lC-l-haz.js';
|
|
4
|
+
import { a as BowlosApiError } from './errors-IIK7xibp.js';
|
|
4
5
|
|
|
5
6
|
interface BowlosProviderProps {
|
|
6
7
|
/** A prebuilt client, or pass `config` to have one created and memoized. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { A as AuthState,
|
|
3
|
+
import { A as AuthState, g as BowlosClient, h as BowlosClientConfig, k as Customer, L as LinkProfile } from './data-lC-l-haz.cjs';
|
|
4
|
+
import { a as BowlosApiError } from './errors-IIK7xibp.cjs';
|
|
4
5
|
|
|
5
6
|
interface BowlosProviderProps {
|
|
6
7
|
/** A prebuilt client, or pass `config` to have one created and memoized. */
|
package/dist/react.cjs
CHANGED
|
@@ -368,6 +368,12 @@ function useAvailability(args, options) {
|
|
|
368
368
|
function useBookingPreview(args, options) {
|
|
369
369
|
return useBowlosQuery("bookingPreview", args, options);
|
|
370
370
|
}
|
|
371
|
+
function useAddons(args, options) {
|
|
372
|
+
return useBowlosQuery("listPublicAddons", args, options);
|
|
373
|
+
}
|
|
374
|
+
function useStartTimes(args, options) {
|
|
375
|
+
return useBowlosQuery("availableStartTimes", args, options);
|
|
376
|
+
}
|
|
371
377
|
function useMyReservations(args, options) {
|
|
372
378
|
return useBowlosQuery("listMyReservations", args, { ...options, auth: true });
|
|
373
379
|
}
|
|
@@ -398,6 +404,21 @@ function useFlashSales(args, options) {
|
|
|
398
404
|
function useFlashSaleBookingOptions(args, options) {
|
|
399
405
|
return useBowlosQuery("getFlashSaleBookingOptions", args, { ...options, auth: true });
|
|
400
406
|
}
|
|
407
|
+
function useProducts(args, options) {
|
|
408
|
+
return useBowlosQuery("listPublicProducts", args, options);
|
|
409
|
+
}
|
|
410
|
+
function useEvents(args, options) {
|
|
411
|
+
return useBowlosQuery("listPublicEvents", args, options);
|
|
412
|
+
}
|
|
413
|
+
function usePackages(args, options) {
|
|
414
|
+
return useBowlosQuery("listPublicPackages", args, options);
|
|
415
|
+
}
|
|
416
|
+
function usePublicMemberships(args, options) {
|
|
417
|
+
return useBowlosQuery("listPublicMemberships", args, options);
|
|
418
|
+
}
|
|
419
|
+
function useGameCards(args, options) {
|
|
420
|
+
return useBowlosQuery("listPublicGameCards", args, options);
|
|
421
|
+
}
|
|
401
422
|
|
|
402
423
|
// src/data.ts
|
|
403
424
|
function generateIdempotencyKey() {
|
|
@@ -596,14 +617,17 @@ function useBookingFlow() {
|
|
|
596
617
|
|
|
597
618
|
exports.BowlosProvider = BowlosProvider;
|
|
598
619
|
exports.useAccount = useAccount;
|
|
620
|
+
exports.useAddons = useAddons;
|
|
599
621
|
exports.useAvailability = useAvailability;
|
|
600
622
|
exports.useBookingFlow = useBookingFlow;
|
|
601
623
|
exports.useBookingPreview = useBookingPreview;
|
|
602
624
|
exports.useBowlosClient = useBowlosClient;
|
|
603
625
|
exports.useBowlosQuery = useBowlosQuery;
|
|
626
|
+
exports.useEvents = useEvents;
|
|
604
627
|
exports.useFlashSale = useFlashSale;
|
|
605
628
|
exports.useFlashSaleBookingOptions = useFlashSaleBookingOptions;
|
|
606
629
|
exports.useFlashSales = useFlashSales;
|
|
630
|
+
exports.useGameCards = useGameCards;
|
|
607
631
|
exports.useMyCredits = useMyCredits;
|
|
608
632
|
exports.useMyLoyalty = useMyLoyalty;
|
|
609
633
|
exports.useMyMembershipDetail = useMyMembershipDetail;
|
|
@@ -611,5 +635,9 @@ exports.useMyMemberships = useMyMemberships;
|
|
|
611
635
|
exports.useMyPasses = useMyPasses;
|
|
612
636
|
exports.useMyReservationDetail = useMyReservationDetail;
|
|
613
637
|
exports.useMyReservations = useMyReservations;
|
|
638
|
+
exports.usePackages = usePackages;
|
|
639
|
+
exports.useProducts = useProducts;
|
|
640
|
+
exports.usePublicMemberships = usePublicMemberships;
|
|
641
|
+
exports.useStartTimes = useStartTimes;
|
|
614
642
|
//# sourceMappingURL=react.cjs.map
|
|
615
643
|
//# sourceMappingURL=react.cjs.map
|