Shop and checkout: bundles, gift details, codes, confirm without paying

Bundle cards list what they contain and how long the code is valid. In
the basket a bundle can be marked as a gift (for / message). Checkout
takes a code: covered bookings show "Paid with your code" and cost 0,
with what the code has left; when nothing is left to pay the button is
Confirm booking and no Stripe step happens. The result page and the
confirmation email show bought codes and code-paid bookings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
agent 2026-10-25 21:39:51 +00:00
parent 32984ac01d
commit e824f16e31
12 changed files with 388 additions and 35 deletions

View file

@ -27,3 +27,8 @@ export function formatDuration(minutes: number) {
export function lowestPrice(durations: ItemDuration[]) {
return durations.length ? Math.min(...durations.map((d) => d.price)) : null;
}
/** A stored code `ABCD2345` → `ABCD-2345`, as shown to people (the shop hooks format it the same way). */
export function formatCode(code: string) {
return code.length === 8 ? `${code.slice(0, 4)}-${code.slice(4)}` : code;
}