@getmicdrop/venue-calendar 4.0.162 → 4.0.163
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/{CartView-BkxWGs3B.js → CartView-BkRTBDXZ.js} +9 -9
- package/dist/{CartView-BkxWGs3B.js.map → CartView-BkRTBDXZ.js.map} +1 -1
- package/dist/{Checkout-0dBHuHQz.js → Checkout-C8kEhq77.js} +9 -9
- package/dist/{Checkout-0dBHuHQz.js.map → Checkout-C8kEhq77.js.map} +1 -1
- package/dist/{Checkout-DTKUhAVt.js → Checkout-rSZjE7ZX.js} +7 -7
- package/dist/{Checkout-DTKUhAVt.js.map → Checkout-rSZjE7ZX.js.map} +1 -1
- package/dist/{CheckoutTimer-2FF-N9nb.js → CheckoutTimer-CCoBtfvN.js} +5 -5
- package/dist/{CheckoutTimer-2FF-N9nb.js.map → CheckoutTimer-CCoBtfvN.js.map} +1 -1
- package/dist/{ClockIcon-BpZHy4Vd.js → ClockIcon-TC9h_DgF.js} +2 -2
- package/dist/{ClockIcon-BpZHy4Vd.js.map → ClockIcon-TC9h_DgF.js.map} +1 -1
- package/dist/{CollectionView-Dh6lqACi.js → CollectionView-8095UIbe.js} +5 -5
- package/dist/{CollectionView-Dh6lqACi.js.map → CollectionView-8095UIbe.js.map} +1 -1
- package/dist/{Event-CtOfAwmO.js → Event-D5qSa4qP.js} +9 -9
- package/dist/{Event-CtOfAwmO.js.map → Event-D5qSa4qP.js.map} +1 -1
- package/dist/{EventPage-BWvpTPZR.js → EventPage-B0i9SYgi.js} +8 -8
- package/dist/{EventPage-BWvpTPZR.js.map → EventPage-B0i9SYgi.js.map} +1 -1
- package/dist/{Heading-CzEUqRnh.js → Heading-BFbWZKav.js} +2 -2
- package/dist/{Heading-CzEUqRnh.js.map → Heading-BFbWZKav.js.map} +1 -1
- package/dist/{ScarcityBadge-QHDudOVY.js → ScarcityBadge-B1jjs4xL.js} +2 -2
- package/dist/{ScarcityBadge-QHDudOVY.js.map → ScarcityBadge-B1jjs4xL.js.map} +1 -1
- package/dist/{SeriesPage-DJ02fgGa.js → SeriesPage-Q9vQLIEZ.js} +5 -5
- package/dist/{SeriesPage-DJ02fgGa.js.map → SeriesPage-Q9vQLIEZ.js.map} +1 -1
- package/dist/{Spinner-BSDhmVR4.js → Spinner-tiRQ2I2B.js} +2 -2
- package/dist/{Spinner-BSDhmVR4.js.map → Spinner-tiRQ2I2B.js.map} +1 -1
- package/dist/{Success-D1S1Cqan.js → Success-CsIw4bxU.js} +9 -9
- package/dist/{Success-D1S1Cqan.js.map → Success-CsIw4bxU.js.map} +1 -1
- package/dist/{Text-BKnaVzIz.js → Text-KbMXo7g6.js} +2 -2
- package/dist/{Text-BKnaVzIz.js.map → Text-KbMXo7g6.js.map} +1 -1
- package/dist/{VenueCalendar-DCg5mqLL.js → VenueCalendar-Czx0Kn4d.js} +13 -13
- package/dist/{VenueCalendar-DCg5mqLL.js.map → VenueCalendar-Czx0Kn4d.js.map} +1 -1
- package/dist/{ViewTicketsEmbed-Bm4QAk1s.js → ViewTicketsEmbed-Bew7UA7B.js} +5 -5
- package/dist/{ViewTicketsEmbed-Bm4QAk1s.js.map → ViewTicketsEmbed-Bew7UA7B.js.map} +1 -1
- package/dist/{index-DHLkkgh1.js → index-HngV5Tmp.js} +3 -3
- package/dist/{index-DHLkkgh1.js.map → index-HngV5Tmp.js.map} +1 -1
- package/dist/{modalManager.svelte-Rus0mNVp.js → modalManager.svelte-JZXVYH3m.js} +2 -2
- package/dist/{modalManager.svelte-Rus0mNVp.js.map → modalManager.svelte-JZXVYH3m.js.map} +1 -1
- package/dist/{promo-CE0IzU2E.js → promo-dsT5Iw68.js} +2 -2
- package/dist/{promo-CE0IzU2E.js.map → promo-dsT5Iw68.js.map} +1 -1
- package/dist/{serverTotals-BSzfjjka.js → serverTotals-D5dQ_beP.js} +2 -2
- package/dist/{serverTotals-BSzfjjka.js.map → serverTotals-D5dQ_beP.js.map} +1 -1
- package/dist/{shareCopyFeedback.svelte-wmkowJcl.js → shareCopyFeedback.svelte-CvE7h_Wn.js} +2 -2
- package/dist/{shareCopyFeedback.svelte-wmkowJcl.js.map → shareCopyFeedback.svelte-CvE7h_Wn.js.map} +1 -1
- package/dist/{showcase-state-options-C8pz6Rau.js → showcase-state-options-DmmK-lzB.js} +2 -2
- package/dist/{showcase-state-options-C8pz6Rau.js.map → showcase-state-options-DmmK-lzB.js.map} +1 -1
- package/dist/{transform-30FKP3jW.js → transform-CpUt4pIr.js} +2 -2
- package/dist/{transform-30FKP3jW.js.map → transform-CpUt4pIr.js.map} +1 -1
- package/dist/{utm-DlulHGNy.js → utm-CfowKK2u.js} +2 -2
- package/dist/{utm-DlulHGNy.js.map → utm-CfowKK2u.js.map} +1 -1
- package/dist/venue-calendar.es.js +1 -1
- package/dist/venue-calendar.iife.js +1 -1
- package/dist/venue-calendar.umd.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkout-0dBHuHQz.js","sources":["../node_modules/@getmicdrop/svelte-components/dist/primitives/Icons/phosphor/ChevronLeftIcon.svelte","../node_modules/@getmicdrop/svelte-components/dist/cookies/cookies.js","../node_modules/@getmicdrop/svelte-components/dist/primitives/Checkbox/Checkbox.svelte","../node_modules/@getmicdrop/svelte-components/dist/utils/storage/registry.js","../node_modules/@getmicdrop/svelte-components/dist/utils/storage/themeStorage.js","../__SKIP_ENVIRONMENT__","../node_modules/@getmicdrop/svelte-components/dist/stripe/useStripeTheme.svelte.js","../src/lib/public-calendar-flow/CheckoutForm.svelte","../src/lib/public-calendar-flow/CheckoutSidebar.svelte","../src/lib/public-calendar-flow/CheckoutMobileFooter.svelte","../src/lib/public-calendar-flow/Checkout.svelte"],"sourcesContent":["<script lang=\"ts\">\r\n /**\r\n * ChevronLeft — Phosphor icon (canonical Micdrop icon family).\r\n * Outline by default; pass `weight=\"fill\"` for solid, or let a stateful parent\r\n * (NavItem / Tabs / BottomNav / status badge) drive it via icon-weight context.\r\n */\r\n import { useIconWeight, type IconWeight } from './iconWeight.js';\r\n\r\n interface Props {\r\n /** Pixel size (width + height). */\r\n size?: string;\r\n /** Icon color; defaults to `currentColor` (inherits text color). */\r\n color?: string;\r\n /** Extra classes. */\r\n class?: string;\r\n /** `regular` (outline) or `fill` (solid). Overrides ambient state weight. */\r\n weight?: IconWeight;\r\n }\r\n\r\n let { size = '24', color = 'currentColor', class: className = '', weight }: Props = $props();\r\n\r\n const ctx = useIconWeight();\r\n let resolved: IconWeight = $derived(weight ?? ctx?.weight ?? 'regular');\r\n</script>\r\n\r\n<svg\r\n class={className}\r\n aria-hidden=\"true\"\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 256 256\"\r\n fill=\"currentColor\"\r\n style:color={color === 'currentColor' ? undefined : color}\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n>\r\n {#if resolved === 'fill'}<path d=\"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61Z\"/>{:else}<polyline points=\"160 208 80 128 160 48\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"16\"/>{/if}\r\n</svg>\r\n","/**\n * Cookies canonical — the ONE sanctioned surface for browser cookie access\n * across all four Micdrop apps. Lifts micdrop-frontend's typed cookies layer\n * (registry + per-event builders + HttpOnly diagnostic) onto svelte-components'\n * battle-tested `document.cookie` implementation.\n *\n * CANONICAL DESIGN DECISION (Atlas convergence — utility-cookies):\n * The runtime behaviour is **byte-identical to SC's pre-audit-09\n * `cookieHelpers.ts`** — `getCookie` returns `string | null` (not js-cookie's\n * `undefined`), `setCookie` takes the `{ maxAge, path }` options shape and\n * writes `document.cookie` with the `.get-micdrop.com` production-domain check\n * and hardcoded `samesite=lax`, `deleteCookie` sets `max-age=0`,\n * `setAuthCookies` / `clearAuthCookies` are unchanged. MF's *typing* layer\n * (the `COOKIE_NAMES` registry, the per-event templated name builders, the\n * HttpOnly write diagnostic, and the `getCookieStrict` variant) is folded in\n * around that behaviour. SC's exported function names keep resolving so no\n * consumer breaks. (Rubric: prevent bugs > no user-facing harm > consistency.)\n *\n * Reads NEVER throw on a missing cookie — `getCookie` returns `null`, matching\n * SC's historical contract. Use `getCookieStrict` when absence is a programmer\n * error (it throws `CookieError` with code `NOT_SET`).\n *\n * Names: prefer `COOKIE_NAMES.X` and the builder helpers over string literals\n * so renames stay atomic and typos surface at compile time — the read/write\n * surface is typed to `CookieName`, which only the registry + builders +\n * `toCookieName` mint.\n *\n * EVENT-SCOPED COOKIES ARE BUILDERS, NEVER REGISTRY ENTRIES. If a cookie holds\n * state a buyer built up on one event's checkout, its name carries the event id\n * and it lives below in the per-event builders, not in `COOKIE_NAMES`. The\n * registry is for app-wide singletons only. A per-event cookie registered as a\n * global key is how `checkout-promo-discount` leaked one event's discount onto\n * another event's total.\n *\n * @global-promo-cookie-escape: this file is the canonical that DEFINES the\n * per-event promo builders, and `clearLegacyGlobalPromoCookies` must name the\n * two pre-split global cookies in order to delete them. Every other file in\n * every repo is caught by `micdrop/no-global-promo-cookie` (R-STORAGE-10).\n */\nimport { CookieError } from '../errors/classes/CookieError.js';\nimport { asCookieName, toCookieName } from '../types/brands.js';\nimport { createLogger } from '../utils/logger.js';\nconst logger = createLogger('cookies');\n// ── Name registry ──────────────────────────────────────────────────────────\n/**\n * Registry of cookie names Micdrop apps read/write from JS.\n *\n * Covers the union of MF's `cookies.ts` registry and SC's pre-audit-09\n * `cookieHelpers.ts` literals. Prefer `COOKIE_NAMES.X` over raw strings so\n * renames are atomic and typos surface at compile time. Each entry is a\n * branded `CookieName` (minted via `asCookieName`), so values flow straight\n * into the read/write surface below without re-branding. For per-event\n * templated names (`checkout-promocode-${eventID}` etc.), use the builder\n * helpers below.\n */\nexport const COOKIE_NAMES = {\n // ── Operator (admin) auth — server-managed, HttpOnly ──\n // The server sets these on Set-Cookie; JS can read a presence shadow but\n // cannot write or delete them. Listed for type-safety in the client paths\n // that reference them.\n OPERATOR_TOKEN: asCookieName('operator_token'),\n REFRESH_TOKEN: asCookieName('refresh_token'),\n // ── Operator auth state (non-HttpOnly) ──\n TOKEN_EXPIRY: asCookieName('token_expiry'),\n ACTIVE_CONTEXT_ID: asCookieName('active_context_id'),\n // ── Performer (portal) auth — SC's cookieHelpers / performers-portal ──\n PERFORMER_TOKEN: asCookieName('performer_token'),\n PERFORMER_REFRESH_TOKEN: asCookieName('performer_refresh_token'),\n PERFORMER_TOKEN_EXPIRY: asCookieName('performer_token_expiry'),\n USER_DETAILS: asCookieName('userDetails'),\n SUPPRESSED_ALERTS: asCookieName('suppressedAlerts'),\n // ── Cart / checkout (non-templated) ──\n // NOTE: every *promo* cookie is per-event and lives behind a builder below.\n // There are deliberately no `CHECKOUT_PROMOCODE` / `CHECKOUT_PROMO_DISCOUNT`\n // entries here — see the per-event promo family for why a global discount\n // amount was a money bug.\n SESSION_ID: asCookieName('session_id'),\n CHECKOUT_CARTID: asCookieName('checkout-cartid'),\n // ── Browser-resolved IANA timezone, set by hooks.client on app init ──\n USER_TZ: asCookieName('user_tz'),\n // ── Shared cross-domain auth-expiry marker (unified login) ──\n // Written at `.get-micdrop.com` by the unified login so every Micdrop\n // subdomain (admin / portal / calendar) reads the same session expiry.\n // Cleared on logout via `clearCrossDomainCookie` — a host-only max-age=0\n // would leave the parent-domain copy alive.\n EXP: asCookieName('exp'),\n};\n/**\n * Cookies the server sets with HttpOnly. JS writes targeting these names are\n * effectively no-ops (the browser ignores `document.cookie =` writes that try\n * to overwrite an HttpOnly cookie). `setCookie` / `deleteCookie` emit a\n * dev-mode warning when one is targeted client-side — the historical bug was a\n * fake-delete of `operator_token` that silently did nothing. The fix is a\n * server endpoint that calls `cookies.delete()`.\n */\nconst HTTP_ONLY_COOKIES = new Set([\n COOKIE_NAMES.OPERATOR_TOKEN,\n COOKIE_NAMES.REFRESH_TOKEN,\n]);\nfunction warnIfHttpOnly(name, op, caller = `${op}Cookie`) {\n if (!HTTP_ONLY_COOKIES.has(name))\n return;\n logger.warn(`${caller}('${name}'): this cookie is HttpOnly; browsers ignore JS writes. ` +\n `Use a server endpoint (e.g. /api/auth/logout) that calls cookies.${op === 'set' ? 'set' : 'delete'}() instead.`);\n}\n// ── Per-event templated name builders ────────────────────────────────────────\n// Keep these as builders rather than raw template strings at call sites so\n// renames remain atomic. Each returns a branded `CookieName`.\n//\n// These are PURE NAME functions on purpose — they mint a string, they do not\n// read or write. That keeps them adoptable by every app regardless of its\n// cookie backend (venue-calendar drives js-cookie with `SameSite=None; Secure`\n// so promo cookies survive third-party iframe embeds; SC's own `setCookie`\n// hardcodes `samesite=lax`). The name is the canon; the write is the app's.\n/**\n * Reject a blank event id before it can mint a name.\n *\n * A per-event cookie built from an empty id collapses to a global cookie\n * (`checkout-promo-discount-` → shared by every event). That is precisely the\n * bug this family exists to prevent, so the builder throws rather than\n * silently returning a name that leaks state across events.\n */\nfunction requireEventID(eventID, builder) {\n if (typeof eventID !== 'string' || eventID.trim().length === 0) {\n throw CookieError.missingEventId(builder);\n }\n // Return the trimmed id, not the raw one: a padded `\" evt \"` would otherwise\n // mint a cookie name with spaces, and two callers passing `\"evt\"` vs `\" evt \"`\n // would land on different cookies for the same event.\n return eventID.trim();\n}\n/** `checkout-quantities-${eventID}` */\nexport const checkoutQuantitiesCookie = (eventID) => toCookieName(`checkout-quantities-${requireEventID(eventID, 'checkoutQuantitiesCookie')}`);\n/** `checkout-promocode-${eventID}` */\nexport const checkoutPromocodeCookie = (eventID) => toCookieName(`checkout-promocode-${requireEventID(eventID, 'checkoutPromocodeCookie')}`);\n/** `checkout-tickets-${eventID}` */\nexport const checkoutCartCookie = (eventID) => toCookieName(`checkout-tickets-${requireEventID(eventID, 'checkoutCartCookie')}`);\n/**\n * @deprecated Alias of {@link checkoutCartCookie} — MF named this builder\n * `checkoutTicketsCookie`. Kept so the lift is name-stable for MF consumers;\n * the canonical name is `checkoutCartCookie` (matches the proposal).\n */\nexport const checkoutTicketsCookie = checkoutCartCookie;\n// ── Per-event promo family ───────────────────────────────────────────────────\n// The applied-promo state a buyer builds up on ONE event's checkout. Every\n// member is scoped to that event.\n//\n// `checkout-promo-discount` used to be a single GLOBAL cookie while all four of\n// its siblings were per-event. A buyer who applied a promo on event A and then\n// opened event B's checkout read A's discount amount on B — the wrong total,\n// on a money path. There is no global variant here and no registry entry that\n// could mint one: the discount amount cannot be named without an event id.\n/** `checkout-promo-discount-${eventID}` — the applied discount amount. */\nexport const checkoutPromoDiscountCookie = (eventID) => toCookieName(`checkout-promo-discount-${requireEventID(eventID, 'checkoutPromoDiscountCookie')}`);\n/** `checkout-promo-discount-type-${eventID}` — e.g. `percentage` / `fixed`. */\nexport const checkoutPromoDiscountTypeCookie = (eventID) => toCookieName(`checkout-promo-discount-type-${requireEventID(eventID, 'checkoutPromoDiscountTypeCookie')}`);\n/** `checkout-promo-reveal-${eventID}` — whether the promo unhides hidden tickets. */\nexport const checkoutPromoRevealCookie = (eventID) => toCookieName(`checkout-promo-reveal-${requireEventID(eventID, 'checkoutPromoRevealCookie')}`);\n/** `checkout-promo-reveal-ids-${eventID}` — which ticket ids the promo unhides. */\nexport const checkoutPromoRevealIdsCookie = (eventID) => toCookieName(`checkout-promo-reveal-ids-${requireEventID(eventID, 'checkoutPromoRevealIdsCookie')}`);\n/**\n * Delete the pre-per-event global promo cookies — `checkout-promo-discount`\n * and `checkout-promocode`.\n *\n * Browsers that visited checkout before the per-event split still carry them.\n * Nothing reads them any more, so they are inert — but a stale money value\n * sitting in a cookie jar must not come back if an old bundle is ever served\n * from cache. Call once on checkout mount; it is idempotent and leaves every\n * `checkout-promo-*-${eventID}` cookie untouched.\n *\n * A pre-split browser may hold each name host-only (venue-calendar wrote them\n * via js-cookie with no domain) OR at the shared parent domain. Both shapes are\n * expired: a host-only `max-age=0` leaves a parent-domain copy alive and\n * vice-versa, so clearing one shape is not enough. SSR-safe (no-op with no\n * `document`).\n *\n * Delete this helper once no live browser can still hold those two cookies.\n */\nexport function clearLegacyGlobalPromoCookies() {\n if (typeof document === 'undefined')\n return;\n for (const name of ['checkout-promo-discount', 'checkout-promocode']) {\n const cookieName = toCookieName(name);\n // Host-only expiry (no domain) — clears the js-cookie-written copy in every\n // environment, including prod where `deleteCookie` would force a domain.\n document.cookie = `${cookieName}=; path=/; max-age=0`;\n // Parent-domain expiry (`.get-micdrop.com`) — clears the shared copy.\n clearCrossDomainCookie(cookieName);\n }\n}\n// ── Read / parse ──────────────────────────────────────────────────────────────\n/**\n * Parse all cookies into an object. SSR-safe (returns `{}` when `document` is\n * undefined). Behaviour is byte-identical to SC's pre-audit-09 `parseCookies`.\n */\nexport function parseCookies() {\n if (typeof document === 'undefined')\n return {};\n return document.cookie\n .split('; ')\n .reduce((acc, cookie) => {\n if (!cookie)\n return acc;\n const [name, ...valueParts] = cookie.split('=');\n acc[name] = decodeURIComponent(valueParts.join('='));\n return acc;\n }, {});\n}\n/**\n * Get a specific cookie value by name. Returns `null` for a missing value\n * (SC's historical contract — NOT js-cookie's `undefined`). Never throws.\n */\n// eslint-disable-next-line no-restricted-syntax -- this file IS the canonical getCookie; the rule points other call sites here\nexport function getCookie(name) {\n const cookies = parseCookies();\n return cookies[name] || null;\n}\n/**\n * Get a cookie value or throw if it is not set. Use when a missing cookie is a\n * programmer error rather than an expected state. Throws `CookieError` with\n * code `NOT_SET`.\n */\nexport function getCookieStrict(name) {\n const value = getCookie(name);\n if (value === null) {\n throw CookieError.notSet(name);\n }\n return value;\n}\n// ── Write / delete ────────────────────────────────────────────────────────────\n/**\n * Set a cookie. Behaviour is byte-identical to SC's pre-audit-09 `setCookie`:\n * encodes the value, derives the `.get-micdrop.com` production domain + `secure`\n * flag from `window.location`, hardcodes `samesite=lax`, defaults `path` to `/`.\n * Adds MF's HttpOnly-write diagnostic (a dev warning, no behaviour change).\n */\n// eslint-disable-next-line no-restricted-syntax -- this file IS the canonical setCookie; the rule points other call sites here\nexport function setCookie(name, value, options = {}) {\n warnIfHttpOnly(name, 'set');\n const isProd = typeof window !== 'undefined' &&\n window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n const secureAttr = typeof window !== 'undefined' && window.location.protocol === 'https:'\n ? 'secure;'\n : '';\n const maxAge = options.maxAge ? `max-age=${options.maxAge};` : '';\n const path = options.path || '/';\n document.cookie = `${name}=${encodeURIComponent(value)}; path=${path}; ${maxAge} ${domainAttr} ${secureAttr} samesite=lax`;\n}\n/**\n * Delete a cookie by name. Behaviour is byte-identical to SC's pre-audit-09\n * `deleteCookie`: SSR-safe no-op, sets `max-age=0` with the same domain/path\n * used by `setCookie` so the deletion takes effect on prod + dev. Adds MF's\n * HttpOnly-write diagnostic.\n */\nexport function deleteCookie(name, options = {}) {\n if (typeof document === 'undefined')\n return;\n warnIfHttpOnly(name, 'delete');\n const isProd = typeof window !== 'undefined' &&\n window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n const path = options.path || '/';\n document.cookie = `${name}=; path=${path}; max-age=0; ${domainAttr}`;\n}\n/**\n * Clear a cookie across the shared parent domain (cross-domain logout).\n *\n * Micdrop's auth cookies are written at the shared parent domain\n * `.get-micdrop.com` so one sign-out covers the admin / portal / calendar\n * subdomains. Expiring one needs a matching `domain=` on the `max-age=0` write:\n * a host-only clear leaves the parent-domain copy alive and the user\n * half-logged-out on the next subdomain. This is the canonical cross-domain\n * expiry — it writes exactly `<name>=; path=/; max-age=0; domain=<domain>;`,\n * the pattern the four apps hand-rolled at logout.\n *\n * Distinct from `deleteCookie`, which derives the domain from the prod hostname\n * and so writes NO domain in dev. Here the `domain` is written\n * UNCONDITIONALLY, defaulting to the shared parent `.get-micdrop.com`; pass an\n * explicit domain for a cookie scoped elsewhere. On a host the domain doesn't\n * match, the browser silently drops the write — non-destructive in dev. SSR-safe\n * (no-op when `document` is undefined) and never throws: a missing cookie is not\n * an error at logout.\n */\nexport function clearCrossDomainCookie(name, domain = '.get-micdrop.com') {\n if (typeof document === 'undefined')\n return;\n warnIfHttpOnly(name, 'delete', 'clearCrossDomainCookie');\n document.cookie = `${name}=; path=/; max-age=0; domain=${domain};`;\n}\n// ── Performer-token / details / alert helpers (SC pre-audit-09) ──────────────\n/** Get the performer token from cookies. */\nexport function getPerformerToken() {\n return getCookie(COOKIE_NAMES.PERFORMER_TOKEN);\n}\n/**\n * @deprecated R-STORAGE-07: the `userDetails` PII cookie has been removed.\n * Identity comes from `GET /api/auth/me` / the SSR profile, never from\n * `document.cookie`. Always returns null; retained only for API compatibility.\n */\nexport function getUserDetails() {\n return null;\n}\n/** Get suppressed alert IDs from cookies. Returns [] on miss / bad JSON. */\nexport function getSuppressedAlerts() {\n const alerts = getCookie(COOKIE_NAMES.SUPPRESSED_ALERTS);\n if (!alerts)\n return [];\n try {\n return JSON.parse(alerts);\n }\n catch {\n return [];\n }\n}\n/** Save suppressed alert IDs to cookies (1 year expiry). */\nexport function saveSuppressedAlerts(alertIds) {\n setCookie(COOKIE_NAMES.SUPPRESSED_ALERTS, JSON.stringify(alertIds), {\n maxAge: 31536000,\n });\n}\n// ── Auth cookie helpers (SC pre-audit-09 — LOAD-BEARING, byte-identical) ─────\n// SC's index.js exports `setAuthCookies` / `clearAuthCookies`; consumers rely\n// on the exact `document.cookie` writes below. Do NOT reroute these through\n// setCookie/deleteCookie — the raw writes (performer_token, userDetails,\n// performer_refresh_token, the 30-day max-age, the domain/secure derivation)\n// must stay identical.\n/**\n * Set authentication cookies with proper domain and security settings.\n *\n * SECURITY (R-STORAGE-07): this NO LONGER writes the `userDetails` PII cookie.\n * A `{firstName,lastName,email}` blob in a JS-readable cookie is XSS-extractable;\n * identity now comes from the cookie-authed `GET /api/auth/me` endpoint (or the\n * SSR profile), never from `document.cookie`. The `userDetails` param is retained\n * for signature compatibility but is intentionally ignored. The token cookies\n * (performer_token / performer_refresh_token) are unchanged.\n */\nexport function setAuthCookies(token, _userDetails, rememberMe = true, refreshToken = null) {\n void _userDetails; // R-STORAGE-07: never persist identity PII to document.cookie\n const isProd = window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n const secureAttr = window.location.protocol === 'https:' ? 'secure;' : '';\n const maxAge = rememberMe ? 'max-age=2592000;' : ''; // 30 days or session\n document.cookie = `performer_token=${token}; path=/; ${maxAge} ${domainAttr} ${secureAttr} samesite=lax`;\n if (refreshToken) {\n document.cookie = `performer_refresh_token=${refreshToken}; path=/; ${maxAge} ${domainAttr} ${secureAttr} samesite=lax`;\n }\n}\n/**\n * Clear authentication cookies.\n * Byte-identical to SC's pre-audit-09 `clearAuthCookies`.\n */\nexport function clearAuthCookies() {\n const isProd = window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n document.cookie = `userDetails=; path=/; max-age=0; ${domainAttr}`;\n document.cookie = `performer_token=; path=/; max-age=0; ${domainAttr}`;\n document.cookie = `performer_refresh_token=; path=/; max-age=0; ${domainAttr}`;\n}\n","<script lang=\"ts\">\r\n import type { Snippet } from 'svelte';\r\n\r\n interface Props {\r\n checked?: boolean;\r\n indeterminate?: boolean;\r\n value?: string;\r\n name?: string;\r\n disabled?: boolean;\r\n color?: 'blue' | 'red' | 'green' | 'purple' | 'orange' | 'yellow';\r\n class?: string;\r\n id?: string;\r\n 'aria-label'?: string;\r\n 'aria-labelledby'?: string;\r\n 'aria-describedby'?: string;\r\n // eslint-disable-next-line no-unused-vars -- intentionally retained (prop/slot/forward-compat or Svelte-5 reactive binding eslint cannot see)\r\n onchange?: (detail: { checked: boolean; value: string }) => void;\r\n onclick?: () => void;\r\n onfocus?: () => void;\r\n onblur?: () => void;\r\n // eslint-disable-next-line no-unused-vars -- intentionally retained (prop/slot/forward-compat or Svelte-5 reactive binding eslint cannot see)\r\n onkeydown?: (e: KeyboardEvent) => void;\r\n // eslint-disable-next-line no-unused-vars -- intentionally retained (prop/slot/forward-compat or Svelte-5 reactive binding eslint cannot see)\r\n onkeyup?: (e: KeyboardEvent) => void;\r\n children?: Snippet;\r\n }\r\n\r\n let {\r\n checked = $bindable(false),\r\n indeterminate = false,\r\n value = \"\",\r\n name = \"\",\r\n disabled = false,\r\n color = \"blue\",\r\n class: className = \"\",\r\n id,\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n 'aria-describedby': ariaDescribedBy,\r\n onchange,\r\n onclick,\r\n onfocus,\r\n onblur,\r\n onkeydown,\r\n onkeyup,\r\n children,\r\n }: Props = $props();\r\n\r\n let inputEl = $state<HTMLInputElement>();\r\n // `indeterminate` is a DOM property, not a reflected HTML attribute,\r\n // so it has to be set imperatively after mount/update.\r\n $effect(() => {\r\n if (inputEl) inputEl.indeterminate = indeterminate;\r\n });\r\n\r\n function handleChange() {\r\n // Note: checked is already updated by bind:checked before this handler runs\r\n // We just need to call the onchange callback with the current values\r\n onchange?.({ checked, value });\r\n }\r\n\r\n const colorClasses = {\r\n blue: \"text-brand-primary\",\r\n red: \"text-accent-danger\",\r\n green: \"text-accent-success\",\r\n purple: \"text-brand-primary\",\r\n orange: \"text-accent-warning\",\r\n yellow: \"text-accent-warning\"\r\n };\r\n\r\n let colorClass = $derived(colorClasses[color] || colorClasses.blue);\r\n\r\n let inputClasses = $derived([\r\n \"w-4 h-4 shrink-0 rounded\",\r\n \"border-stroke-primary\",\r\n \"focus:outline-none focus:ring-0 focus:ring-offset-0 focus:shadow-none focus-visible:outline-none\",\r\n colorClass,\r\n disabled ? \"cursor-not-allowed opacity-50\" : \"cursor-pointer\"\r\n ].join(\" \"));\r\n</script>\r\n\r\n<!-- wrapping-pattern label: the <input> is nested inside this <label>, which\r\n associates them implicitly per the HTML spec. R-A11Y-16 can't see the wrap\r\n mechanically, so @label-no-for-escape: sanctions this specific label (the\r\n marker is line-scoped — it exempts only the <label> directly below it). -->\r\n<label\r\n class=\"inline-flex items-start gap-2 {disabled ? 'cursor-not-allowed' : 'cursor-pointer'} select-none {className}\"\r\n {id}\r\n>\r\n <input\r\n bind:this={inputEl}\r\n type=\"checkbox\"\r\n {name}\r\n {value}\r\n {disabled}\r\n bind:checked\r\n onchange={handleChange}\r\n {onclick}\r\n {onfocus}\r\n {onblur}\r\n {onkeydown}\r\n {onkeyup}\r\n aria-label={ariaLabel}\r\n aria-labelledby={ariaLabelledBy}\r\n aria-describedby={ariaDescribedBy}\r\n class={inputClasses}\r\n />\r\n {#if children}\r\n <span class=\"type-label tone-primary\">\r\n {@render children()}\r\n </span>\r\n {/if}\r\n</label>\r\n","/**\n * Storage key registry + canonical namespace (R-STORAGE-01/02/08).\n *\n * Every persisted key is colon-namespaced `micdrop:<feature>:<detail>` and\n * registered with its lifecycle flags so a single `clearAppStorageOnLogout()`\n * can walk the registry instead of every logout flow hand-clearing keys.\n */\nimport { ValueGuardError } from '../../errors/classes/ValueGuardError.js';\nimport { createStorageAccessor, } from './storage.js';\nconst NAMESPACE_RE = /^micdrop:[a-z0-9]+(:[a-z0-9-]+)+$/;\n/**\n * Build a canonical colon-namespaced storage key `micdrop:<feature>:<detail...>`\n * (R-STORAGE-02). Lowercases tokens and throws on empty / malformed segments so\n * a bad key fails at the builder, not silently at runtime.\n *\n * The guards throw `ValueGuardError` — the AppError branch for a primitive that\n * failed a fail-fast invariant at a data-trust boundary, the same branch\n * `DateTimeError` and the currency guards fold under. A caller catches one type\n * and branches on `code`, instead of scraping a bare Error's message.\n *\n * @example buildStorageKey('checkout', 'state', eventId) // micdrop:checkout:state:<id>\n * @throws {ValueGuardError} `STORAGE_KEY_INCOMPLETE` — fewer than two segments.\n * @throws {ValueGuardError} `STORAGE_KEY_NON_CANONICAL` — segments outside the namespace charset.\n */\nexport function buildStorageKey(feature, ...detail) {\n const segments = [feature, ...detail.map(String)]\n .map((s) => s.trim().toLowerCase())\n .filter((s) => s.length > 0);\n if (segments.length < 2) {\n throw new ValueGuardError(`buildStorageKey requires a feature and at least one detail segment (got: ${JSON.stringify([feature, ...detail])})`, 'STORAGE_KEY_INCOMPLETE', { details: { feature, detail } });\n }\n const key = `micdrop:${segments.join(':')}`;\n if (!NAMESPACE_RE.test(key)) {\n throw new ValueGuardError(`buildStorageKey produced a non-canonical key: \"${key}\"`, 'STORAGE_KEY_NON_CANONICAL', { details: { key } });\n }\n return key;\n}\n/** Whether a key matches the canonical `micdrop:<feature>:<detail>` namespace. */\nexport function isCanonicalStorageKey(key) {\n return NAMESPACE_RE.test(key);\n}\n/*\n * Two DIFFERENT injected backends can register the same (kind, key) — a fake in\n * one test, the real thing in another, or two live shims sharing a logical key.\n * Flattening them to one entry would let clearAppStorageOnLogout() wipe only the\n * last one registered and leave the other's data behind — a clearOnLogout flag\n * that silently lies. So each distinct injected backend earns a stable id and\n * gets its own entry.\n *\n * The registry is a nested map — `kind:key` → (`backendId` → descriptor) — NOT a\n * flat `kind:key:backendId` string. A flat string would let an arbitrary key\n * collide with a `(key, backendId)` concatenation: injected key `x` on backend\n * `#1` and window key `x#1` would hash to the same slot. `registerStorageKey`\n * does not enforce the canonical namespace (rememberedUser's key is legacy), so\n * that collision is reachable. Two map levels keep an arbitrary key from ever\n * touching a backend id. `kind` is a fixed two-value enum, so `kind:key` is\n * itself unambiguous.\n */\nconst registry = new Map();\nlet backendSeq = 0;\nconst backendIds = new WeakMap();\n/** Stable id for a backend: '' for the window backend, '#n' per injected shim. */\nfunction backendId(storage) {\n if (!storage)\n return '';\n let id = backendIds.get(storage);\n if (id === undefined) {\n backendSeq += 1;\n id = `#${backendSeq}`;\n backendIds.set(storage, id);\n }\n return id;\n}\n/**\n * Register a storage key + its lifecycle flags. Idempotent per (kind, key,\n * backend). Returns the key so a caller can `const K = registerStorageKey({...})`.\n *\n * Lifecycle/security flags ratchet up, never down: a re-registration of the same\n * (kind, key, backend) that omits `clearOnLogout` / `containsPII` must not strip\n * protection an earlier registration declared.\n */\nexport function registerStorageKey(descriptor) {\n const outer = `${descriptor.kind}:${descriptor.key}`;\n const inner = backendId(descriptor.storage);\n let byBackend = registry.get(outer);\n if (!byBackend) {\n byBackend = new Map();\n registry.set(outer, byBackend);\n }\n const existing = byBackend.get(inner);\n byBackend.set(inner, existing\n ? {\n ...descriptor,\n clearOnLogout: existing.clearOnLogout || descriptor.clearOnLogout,\n containsPII: existing.containsPII || descriptor.containsPII,\n }\n : descriptor);\n return descriptor.key;\n}\n/** Read-only snapshot of all registered descriptors. */\nexport function getStorageRegistry() {\n const descriptors = [];\n for (const byBackend of registry.values()) {\n for (const descriptor of byBackend.values())\n descriptors.push(descriptor);\n }\n return descriptors;\n}\n/**\n * Clear every registered key flagged `clearOnLogout` (R-STORAGE-08). The single\n * canonical logout cleanup — logout flows call this instead of inline clears,\n * so a new persisted key is wiped on logout the moment it declares the flag.\n */\nexport function clearAppStorageOnLogout(options = {}) {\n for (const byBackend of registry.values()) {\n for (const descriptor of byBackend.values()) {\n if (!descriptor.clearOnLogout)\n continue;\n if (options.onlyKey && descriptor.key !== options.onlyKey)\n continue;\n // Clear the key where it actually lives: an injected backend if one was\n // registered, otherwise the `window` backend named by `kind`.\n createStorageAccessor(descriptor.storage ?? descriptor.kind).remove(descriptor.key);\n }\n }\n}\n","/**\n * Theme persistence onto the storage canonical (`micdrop:ui:theme`).\n *\n * The theme override is TRINARY: an explicit `'light'` / `'dark'` choice, or its\n * ABSENCE meaning \"auto — follow the system preference\". Absence is load-bearing:\n * removing the key is how `DarkModeToggle` expresses auto mode, so this layer\n * stores ONLY explicit choices and treats a missing key as auto. It never\n * writes a sentinel for auto.\n *\n * Encoding: the storage canonical JSON-codes every value, so the explicit\n * override is persisted JSON-coded (`\"dark\"`) under the canonical key and read\n * back through `getLocalStorage` like any other canonical value.\n *\n * Legacy migration (the codex trap): before the canonical existed, all three\n * theme consumers read/wrote a bare un-namespaced `\"theme\"` key holding a PLAIN\n * string (`dark` / `light`), NOT JSON. That legacy value is unreadable through\n * `getLocalStorage` because `JSON.parse('dark')` throws and falls back to null.\n * `readThemeOverride()` therefore one-time-adopts a legacy bare value into the\n * canonical key (JSON-coded) and deletes the legacy key, so existing users keep\n * their exact theme with zero visual change. The read goes through the shared\n * helper, so whichever of the three consumers mounts first performs the adoption.\n */\nimport { getLocalStorage, setLocalStorage, removeLocalStorage, } from './storage.js';\nimport { registerStorageKey } from './registry.js';\n/**\n * Canonical key for the persisted theme override. Registered (not\n * clearOnLogout — a theme preference outlives the session, matching the\n * pre-canonical behavior where the bare `theme` key was never logout-cleared).\n */\nexport const THEME_STORAGE_KEY = registerStorageKey({\n key: 'micdrop:ui:theme',\n kind: 'local',\n});\n/** Pre-canonical bare key. Held a PLAIN string (`dark` / `light`), not JSON. */\nconst LEGACY_THEME_KEY = 'theme';\n/** Read the legacy bare `theme` value (plain string), SSR/private-mode safe. */\nfunction readLegacyTheme() {\n if (typeof window === 'undefined')\n return null;\n let raw;\n try {\n raw = window.localStorage.getItem(LEGACY_THEME_KEY);\n }\n catch {\n return null;\n }\n return raw === 'dark' || raw === 'light' ? raw : null;\n}\n/** Best-effort removal of the legacy bare key after adoption. */\nfunction removeLegacyTheme() {\n if (typeof window === 'undefined')\n return;\n try {\n window.localStorage.removeItem(LEGACY_THEME_KEY);\n }\n catch {\n // best-effort — removal must never throw\n }\n}\n/**\n * Read the explicit theme override, or `null` for \"auto / follow system\".\n *\n * One-time-migrates a legacy bare `theme` value into the canonical key and\n * deletes the legacy key. Idempotent: once migrated, subsequent calls just read\n * the canonical key. Canonical value always wins over a stale legacy key.\n */\nexport function readThemeOverride() {\n const canonical = getLocalStorage(THEME_STORAGE_KEY);\n const legacy = readLegacyTheme();\n if (canonical === 'dark' || canonical === 'light') {\n // Canonical wins; retire any stale legacy bare key still hanging around.\n if (legacy)\n removeLegacyTheme();\n return canonical;\n }\n if (legacy) {\n // Adopt the legacy choice into the canonical key, then drop the bare key.\n setLocalStorage(THEME_STORAGE_KEY, legacy);\n removeLegacyTheme();\n return legacy;\n }\n return null;\n}\n/** Persist an explicit theme override (`'light'` / `'dark'`). */\nexport function writeThemeOverride(theme) {\n setLocalStorage(THEME_STORAGE_KEY, theme);\n}\n/** Clear the override — back to auto / follow system. Also drops the legacy key. */\nexport function clearThemeOverride() {\n removeLocalStorage(THEME_STORAGE_KEY);\n removeLegacyTheme();\n}\n","\n export const browser = typeof window !== 'undefined';\n export const dev = false;\n export const building = false;\n export const version = '';\n ","/**\n * Stripe Theme Utility\n *\n * Provides reactive dark mode detection for Stripe Elements.\n * Automatically watches for theme changes via MutationObserver.\n *\n * @example\n * ```svelte\n * <script>\n * import { useStripeTheme } from '@getmicdrop/svelte-components/stripe';\n *\n * const stripeTheme = useStripeTheme();\n * // stripeTheme.current is 'stripe' | 'night'\n * // Automatically updates when theme changes\n * </script>\n *\n * <Elements theme={stripeTheme.current} {stripe} clientSecret={paymentIntent}>\n * <PaymentElement />\n * </Elements>\n * ```\n */\nimport { onMount, onDestroy } from 'svelte';\nimport { readThemeOverride } from '../utils/storage/index.js';\n/**\n * Detects if dark mode is active.\n *\n * Checks in order:\n * 1. localStorage 'theme' value\n * 2. Container element classes (.dark, [data-theme=\"dark\"])\n * 3. System preference (prefers-color-scheme)\n */\nexport function detectDarkMode(containerSelector) {\n if (typeof window === 'undefined')\n return false;\n try {\n // Check the persisted theme override first (auto/system → null).\n const saved = readThemeOverride();\n if (saved === 'dark')\n return true;\n if (saved === 'light')\n return false;\n // Check for data-theme on common containers\n const selector = containerSelector || '[data-theme=\"dark\"], [data-theme=\"light\"], .micdrop, [data-theme]';\n const containers = document.querySelectorAll(selector);\n for (const container of containers) {\n if (container.getAttribute('data-theme') === 'dark')\n return true;\n }\n // Check document root\n if (document.documentElement.getAttribute('data-theme') === 'dark')\n return true;\n // Fallback to system preference\n return window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;\n }\n catch {\n return false;\n }\n}\n/**\n * Maps dark mode state to Stripe theme.\n */\nexport function getStripeTheme(isDark) {\n return isDark ? 'night' : 'stripe';\n}\n/**\n * Creates a reactive Stripe theme that watches for dark mode changes.\n *\n * Returns an object with a `current` property that is reactive and\n * automatically updates when the theme changes.\n *\n * @example\n * ```svelte\n * <script>\n * import { useStripeTheme } from '@getmicdrop/svelte-components/stripe';\n * const stripeTheme = useStripeTheme();\n * </script>\n *\n * <Elements theme={stripeTheme.current} ...>\n * ```\n */\nexport function useStripeTheme(options = {}) {\n const { containerSelector = '[data-theme=\"dark\"], [data-theme=\"light\"], .micdrop, [data-theme]', watchChanges = true, fallback = 'stripe', } = options;\n let current = $state(fallback);\n let observer = null;\n let mediaQuery = null;\n function updateTheme() {\n current = getStripeTheme(detectDarkMode(containerSelector));\n }\n onMount(() => {\n // Initial detection\n updateTheme();\n if (watchChanges && typeof MutationObserver !== 'undefined') {\n // Watch for class changes on potential theme containers\n const containers = document.querySelectorAll(containerSelector);\n const root = document.documentElement;\n observer = new MutationObserver(() => {\n updateTheme();\n });\n // Observe document root\n observer.observe(root, {\n attributes: true,\n attributeFilter: ['class', 'data-theme'],\n });\n // Observe other containers\n containers.forEach(container => {\n observer?.observe(container, {\n attributes: true,\n attributeFilter: ['class', 'data-theme'],\n });\n });\n // Also listen for system preference changes. Kept on the closure scope\n // so onDestroy can remove it — otherwise the listener (and the closure it\n // holds, including this instance's $state) leaks on every unmount.\n mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n mediaQuery.addEventListener('change', updateTheme);\n }\n });\n onDestroy(() => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n if (mediaQuery) {\n mediaQuery.removeEventListener('change', updateTheme);\n mediaQuery = null;\n }\n });\n return {\n get current() {\n return current;\n },\n /** Force refresh the theme detection */\n refresh: updateTheme,\n };\n}\n/**\n * Simple synchronous dark mode detection without reactivity.\n * Use this when you only need a one-time check.\n */\nexport function getInitialStripeTheme(containerSelector) {\n return getStripeTheme(detectDarkMode(containerSelector));\n}\n","<script lang=\"ts\">\r\n import { defaultLabels } from '$lib/public-calendar-flow/i18n/labels.js';\r\n import { onDestroy, untrack } from 'svelte';\r\n import { browser } from '$app/environment';\r\n import {\r\n ChevronLeftIcon,\r\n WarningTriIcon,\r\n } from '@getmicdrop/svelte-components/primitives/Icons/phosphor/index.js';\r\n import {\r\n Button,\r\n Heading,\r\n Text,\r\n Input,\r\n Checkbox,\r\n isEmailAddress,\r\n } from '@getmicdrop/svelte-components';\r\n import { useStripeTheme } from '@getmicdrop/svelte-components/stripe';\r\n import type {\r\n EventData,\r\n OrderTotals,\r\n CheckoutFormData,\r\n } from '$lib/public-calendar-flow/types';\r\n import CheckoutTimer from './CheckoutTimer.svelte';\r\n\r\n interface Props {\r\n event: EventData;\r\n orderTotals: OrderTotals;\r\n timerSeconds: number;\r\n isExpired: boolean;\r\n isRegistration: boolean;\r\n isFreeOrder: boolean;\r\n promoApplied: boolean;\r\n promoDiscount: number;\r\n onBack: () => void;\r\n onPlaceOrder: (_formData: CheckoutFormData) => void;\r\n processing: boolean;\r\n /** Incremented by parent to trigger form validation + submit from external buttons (sidebar, mobile footer) */\r\n submitRequested: number;\r\n /** Stripe instance for production mode (absence = showcase mock inputs) */\r\n stripe?: any;\r\n /** Stripe client secret for PaymentElement */\r\n paymentIntent?: string;\r\n /** Bindable Stripe elements reference for the wrapper to use during payment confirmation */\r\n elements?: any;\r\n /** Payment error message from the wrapper */\r\n paymentError?: string;\r\n labels?: Record<string, string>;\r\n }\r\n\r\n let {\r\n event: _event,\r\n orderTotals,\r\n timerSeconds,\r\n isExpired: _isExpired,\r\n isRegistration,\r\n isFreeOrder,\r\n promoApplied: _promoApplied,\r\n promoDiscount: _promoDiscount,\r\n onBack,\r\n onPlaceOrder,\r\n processing: _processing,\r\n submitRequested,\r\n stripe = undefined,\r\n paymentIntent = undefined,\r\n elements = $bindable(undefined),\r\n paymentError = '',\r\n labels = defaultLabels,\r\n }: Props = $props();\r\n\r\n // Use direct Stripe.js API instead of svelte-stripe (Svelte 5 compatibility bug).\r\n const stripeTheme = browser\r\n ? useStripeTheme()\r\n : { current: 'stripe' as const };\r\n let paymentMountDiv = $state<HTMLElement | null>(null);\r\n let paymentElement: any = null;\r\n // Track which client secret the mounted element is bound to. Re-mounting only\r\n // the Stripe element (not the whole CheckoutForm) when the PaymentIntent changes\r\n // lets a partial gift card swap in a reduced-amount PI WITHOUT wiping the\r\n // buyer's typed name/email/attendee fields (the {#key} approach remounted the\r\n // entire form and blanked them).\r\n let mountedSecret = $state<string | null>(null);\r\n\r\n function mountStripePayment() {\r\n if (!browser || !stripe || !paymentIntent || !paymentMountDiv) return;\r\n // Tear down any element bound to a stale secret before re-creating.\r\n if (paymentElement) {\r\n try {\r\n paymentElement.destroy();\r\n } catch (_) {\r\n // ignore\r\n }\r\n paymentElement = null;\r\n }\r\n elements = stripe.elements({\r\n clientSecret: paymentIntent,\r\n appearance: { theme: stripeTheme.current },\r\n });\r\n paymentElement = elements.create('payment');\r\n paymentElement.mount(paymentMountDiv);\r\n mountedSecret = paymentIntent;\r\n }\r\n\r\n function destroyStripePayment() {\r\n if (paymentElement) {\r\n try {\r\n paymentElement.destroy();\r\n } catch (_) {\r\n // ignore\r\n }\r\n paymentElement = null;\r\n }\r\n mountedSecret = null;\r\n }\r\n\r\n $effect(() => {\r\n // (Re)mount whenever the PaymentIntent secret changes — initial mount, or a\r\n // new reduced-amount PI after a partial gift card is applied.\r\n if (\r\n stripe &&\r\n paymentIntent &&\r\n paymentMountDiv &&\r\n paymentIntent !== mountedSecret\r\n ) {\r\n mountStripePayment();\r\n } else if ((!stripe || !paymentIntent) && mountedSecret) {\r\n // No longer needs Stripe (e.g. a gift card now fully covers the order, so\r\n // the wrapper cleared stripe/paymentIntent and the payment section is\r\n // hidden) — tear down the mounted element instead of orphaning the iframe.\r\n destroyStripePayment();\r\n }\r\n });\r\n\r\n // Re-skin Stripe Elements when the theme changes (data-theme toggle).\r\n $effect(() => {\r\n if (mountedSecret && elements && stripeTheme.current) {\r\n try {\r\n elements.update({ appearance: { theme: stripeTheme.current } });\r\n } catch (_) {\r\n // Stripe Elements is finicky about post-mount updates; ignore.\r\n }\r\n }\r\n });\r\n\r\n onDestroy(() => {\r\n if (paymentElement) {\r\n paymentElement.destroy();\r\n paymentElement = null;\r\n }\r\n mountedSecret = null;\r\n });\r\n\r\n // --- Form state ---\r\n let firstName = $state('');\r\n let lastName = $state('');\r\n let email = $state('');\r\n let keepUpdated = $state(false);\r\n let agreeTerms = $state(false);\r\n\r\n // Payment fields (mock)\r\n let cardNumber = $state('');\r\n let cardExpiry = $state('');\r\n let cardCvc = $state('');\r\n\r\n // Per-ticket attendee fields (for registration events)\r\n let attendees = $state<\r\n Array<{\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n sameAsPurchaser: boolean;\r\n }>\r\n >([]);\r\n\r\n // No Stripe charge is needed when the order is free OR fully covered by a gift\r\n // card (total 0 but subtotal > 0, so isFreeOrder alone is false). In both cases\r\n // we must NOT render/validate the showcase mock-card inputs — otherwise a\r\n // fully-gift-card-covered order can't be submitted (the wrapper routes it to\r\n // executeGiftCardOnlyPurchase once onPlaceOrder fires).\r\n let noPaymentRequired = $derived(isFreeOrder || orderTotals.total === 0);\r\n\r\n // Validation state\r\n let submitted = $state(false);\r\n let errors = $derived(\r\n (() => {\r\n if (!submitted) return {};\r\n const e: Record<string, string> = {};\r\n if (!firstName.trim())\r\n e.firstName = labels.firstNameRequired || 'First name is required';\r\n if (!lastName.trim())\r\n e.lastName = labels.lastNameRequired || 'Last name is required';\r\n if (!email.trim()) e.email = labels.emailRequired || 'Email is required';\r\n else if (!isEmailAddress(email))\r\n e.email = labels.emailInvalid || 'Enter a valid email address';\r\n if (!noPaymentRequired && !stripe && !paymentError) {\r\n // Only validate mock card fields in showcase mode (Stripe absent AND a\r\n // real balance is due — not free / not fully gift-card covered). When\r\n // paymentError is set the mock form isn't rendered (a real config\r\n // failure), so don't demand card fields that aren't on screen — the\r\n // handleSubmit guard below blocks the order instead.\r\n if (!cardNumber.trim())\r\n e.cardNumber = labels.cardNumberRequired || 'Card number is required';\r\n if (!cardExpiry.trim())\r\n e.cardExpiry = labels.expiryRequired || 'Expiry date is required';\r\n if (!cardCvc.trim())\r\n e.cardCvc = labels.cvcRequired || 'CVC is required';\r\n }\r\n if (!agreeTerms)\r\n e.agreeTerms = labels.mustAgreeTerms || 'You must agree to the terms';\r\n\r\n // Validate attendee fields for registration events\r\n if (isRegistration) {\r\n for (let i = 0; i < attendees.length; i++) {\r\n const att = attendees[i];\r\n if (!att.sameAsPurchaser) {\r\n if (!att.firstName.trim())\r\n e[`attendee_${i}_firstName`] = 'First name is required';\r\n if (!att.lastName.trim())\r\n e[`attendee_${i}_lastName`] = 'Last name is required';\r\n if (!att.email.trim())\r\n e[`attendee_${i}_email`] =\r\n labels.emailRequired || 'Email is required';\r\n else if (!isEmailAddress(att.email))\r\n e[`attendee_${i}_email`] =\r\n labels.emailInvalidShort || 'Enter a valid email';\r\n }\r\n }\r\n }\r\n\r\n return e;\r\n })()\r\n );\r\n\r\n let hasErrors = $derived(Object.keys(errors).length > 0);\r\n\r\n let isTimerUrgent = $derived(timerSeconds > 0 && timerSeconds <= 120);\r\n\r\n // Initialize attendee list based on order lines\r\n $effect(() => {\r\n if (isRegistration) {\r\n const totalTickets = orderTotals.lines.reduce(\r\n (sum, l) => sum + l.quantity,\r\n 0\r\n );\r\n if (attendees.length !== totalTickets) {\r\n attendees = Array.from({ length: totalTickets }, (_, i) => ({\r\n firstName: '',\r\n lastName: '',\r\n email: '',\r\n sameAsPurchaser: i === 0,\r\n }));\r\n }\r\n }\r\n });\r\n\r\n // Watch for external submit requests (from sidebar/mobile footer buttons).\r\n // Seed the high-water mark from the CURRENT parent counter, not 0: parent's\r\n // `submitRequested` is monotonic and never reset (it must not be — resetting it\r\n // independently of this mark is the VC#345 swallowed-retry desync). If this form\r\n // ever remounts while the parent counter is already > 0 (a future {#key}, route\r\n // shell swap, or recovery path), a 0-seed would make `submitRequested > 0` true\r\n // on mount and fire a submit with no buyer click. Seeding from the live value\r\n // means only a NEW increment — a real click — ever triggers handleSubmit.\r\n let lastSubmitRequest = $state(untrack(() => submitRequested));\r\n $effect(() => {\r\n if (submitRequested > lastSubmitRequest) {\r\n lastSubmitRequest = submitRequested;\r\n handleSubmit();\r\n }\r\n });\r\n\r\n function handleSameAsPurchaser(index: number, checked: boolean) {\r\n attendees = attendees.map((att, i) => {\r\n if (i !== index) return att;\r\n return {\r\n ...att,\r\n sameAsPurchaser: checked,\r\n firstName: checked ? firstName : att.firstName,\r\n lastName: checked ? lastName : att.lastName,\r\n email: checked ? email : att.email,\r\n };\r\n });\r\n }\r\n\r\n function handleSubmit() {\r\n submitted = true;\r\n if (hasErrors) return;\r\n // A real balance is due but Stripe could not initialize (no publishable key\r\n // / payment config broken) — refuse to submit rather than post an order that\r\n // can never be charged. The payment section already shows paymentError.\r\n if (paymentError && !noPaymentRequired) return;\r\n onPlaceOrder({\r\n firstName,\r\n lastName,\r\n email,\r\n keepMeUpdated: keepUpdated,\r\n attendees: isRegistration\r\n ? attendees.map(a => ({\r\n firstName: a.sameAsPurchaser ? firstName : a.firstName,\r\n lastName: a.sameAsPurchaser ? lastName : a.lastName,\r\n email: a.sameAsPurchaser ? email : a.email,\r\n sameAsPurchaser: a.sameAsPurchaser,\r\n }))\r\n : undefined,\r\n });\r\n }\r\n</script>\r\n\r\n<!-- Form sits on a Boxes (surface-secondary) panel, not the page Background, so\r\n form controls — especially the bare Checkbox boxes — keep a consistent,\r\n readable surface on any themed scheme (matches the order-summary sidebar\r\n Card). The timer-header was already built to be this panel's flush header\r\n (it bleeds to the edges and rounds only its top). -->\r\n<div class=\"checkout-form-panel space-y-6 bg-surface-secondary border-default\">\r\n <!-- Timer header bar -->\r\n <div class=\"timer-header border-default bg-surface-secondary\">\r\n <Button\r\n variant=\"icon\"\r\n size=\"icon-sm\"\r\n onclick={onBack}\r\n aria-label={labels.goBack || 'Go back'}\r\n >\r\n <ChevronLeftIcon size=\"20\" />\r\n </Button>\r\n <CheckoutTimer seconds={timerSeconds} isUrgent={isTimerUrgent} {labels} />\r\n </div>\r\n\r\n <!-- Personal details -->\r\n <section class=\"space-y-4\">\r\n <Heading level={2} size=\"lg\" weight=\"semibold\">\r\n {labels.yourDetails || 'Your details'}\r\n </Heading>\r\n\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\r\n <Input\r\n label={labels.firstName || 'First name'}\r\n placeholder={labels.firstName || 'First name'}\r\n required\r\n bind:value={firstName}\r\n errorText={errors.firstName ?? ''}\r\n color={errors.firstName ? 'red' : 'base'}\r\n />\r\n <Input\r\n label={labels.lastName || 'Last name'}\r\n placeholder={labels.lastName || 'Last name'}\r\n required\r\n bind:value={lastName}\r\n errorText={errors.lastName ?? ''}\r\n color={errors.lastName ? 'red' : 'base'}\r\n />\r\n </div>\r\n\r\n <Input\r\n label={labels.emailAddress || 'Email address'}\r\n type=\"email\"\r\n placeholder={labels.emailPlaceholder || 'you@example.com'}\r\n required\r\n bind:value={email}\r\n errorText={errors.email ?? ''}\r\n color={errors.email ? 'red' : 'base'}\r\n />\r\n\r\n <Checkbox bind:checked={keepUpdated}>\r\n {labels.keepMeUpdated ||\r\n 'Keep me updated about this event and similar events'}\r\n </Checkbox>\r\n </section>\r\n\r\n <!-- Per-ticket attendee details (registration events) -->\r\n {#if isRegistration && attendees.length > 0}\r\n <section class=\"space-y-5\">\r\n <Heading level={2} size=\"lg\" weight=\"semibold\">\r\n {labels.attendeeDetails || 'Attendee details'}\r\n </Heading>\r\n\r\n {#each attendees as attendee, i (i)}\r\n <div class=\"attendee-card border-default bg-surface-secondary\">\r\n <div class=\"flex items-center justify-between mb-3\">\r\n <Text size=\"sm\" weight=\"semibold\">\r\n {labels.attendee || 'Attendee'}\r\n {i + 1}\r\n </Text>\r\n <Checkbox\r\n checked={attendee.sameAsPurchaser}\r\n onchange={({ checked }) => handleSameAsPurchaser(i, checked)}\r\n >\r\n {labels.sameAsPurchaser || 'Same as purchaser'}\r\n </Checkbox>\r\n </div>\r\n\r\n <div class=\"space-y-3\">\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\r\n <Input\r\n label={labels.firstName || 'First name'}\r\n placeholder={labels.firstName || 'First name'}\r\n required\r\n disabled={attendee.sameAsPurchaser}\r\n bind:value={attendee.firstName}\r\n errorText={!attendee.sameAsPurchaser\r\n ? (errors[`attendee_${i}_firstName`] ?? '')\r\n : ''}\r\n color={!attendee.sameAsPurchaser &&\r\n errors[`attendee_${i}_firstName`]\r\n ? 'red'\r\n : 'base'}\r\n />\r\n <Input\r\n label={labels.lastName || 'Last name'}\r\n placeholder={labels.lastName || 'Last name'}\r\n required\r\n disabled={attendee.sameAsPurchaser}\r\n bind:value={attendee.lastName}\r\n errorText={!attendee.sameAsPurchaser\r\n ? (errors[`attendee_${i}_lastName`] ?? '')\r\n : ''}\r\n color={!attendee.sameAsPurchaser &&\r\n errors[`attendee_${i}_lastName`]\r\n ? 'red'\r\n : 'base'}\r\n />\r\n </div>\r\n <Input\r\n label={labels.email || 'Email'}\r\n type=\"email\"\r\n placeholder={labels.attendeeEmailPlaceholder ||\r\n 'attendee@example.com'}\r\n required\r\n disabled={attendee.sameAsPurchaser}\r\n bind:value={attendee.email}\r\n errorText={!attendee.sameAsPurchaser\r\n ? (errors[`attendee_${i}_email`] ?? '')\r\n : ''}\r\n color={!attendee.sameAsPurchaser && errors[`attendee_${i}_email`]\r\n ? 'red'\r\n : 'base'}\r\n />\r\n </div>\r\n </div>\r\n {/each}\r\n </section>\r\n {/if}\r\n\r\n <!-- Payment section -->\r\n <section class=\"space-y-4\">\r\n {#if noPaymentRequired}\r\n <div class=\"free-order-notice border-default bg-surface-secondary\">\r\n <Text size=\"sm\" color=\"secondary\" weight=\"medium\" class=\"block\">\r\n {labels.noPaymentRequired || 'No payment required'}\r\n </Text>\r\n <div class=\"mt-1\">\r\n <Text size=\"xs\" color=\"muted\" class=\"block\">\r\n {labels.freeEventMessage ||\r\n 'This is a free event. Complete the form above to reserve your spot'}\r\n </Text>\r\n </div>\r\n </div>\r\n {:else if stripe && paymentIntent}\r\n <!-- Production: Real Stripe PaymentElement -->\r\n <Heading level={2} size=\"lg\" weight=\"semibold\"\r\n >{labels.payment || 'Payment'}</Heading\r\n >\r\n {#if browser}\r\n <div bind:this={paymentMountDiv}></div>\r\n {#if !mountedSecret}\r\n <p class=\"type-body text-color-muted py-2\">\r\n {labels.loadingPaymentForm || 'Loading secure payment form...'}\r\n </p>\r\n {/if}\r\n {:else}\r\n <p class=\"type-body text-color-muted py-2\">\r\n {labels.loadingPaymentForm || 'Loading secure payment form...'}\r\n </p>\r\n {/if}\r\n {#if paymentError}\r\n <p class=\"type-body text-accent-danger mt-2\">{paymentError}</p>\r\n {/if}\r\n {:else if paymentError}\r\n <!-- Real checkout where Stripe could not initialize — most often the venue\r\n has no publishable key configured. Show the error and NO card form:\r\n the mock inputs in the next branch are a dev-showcase affordance that\r\n cannot take a real payment, so presenting them here would mislead the\r\n buyer into thinking they can pay (handleSubmit also refuses to submit). -->\r\n <Heading level={2} size=\"lg\" weight=\"semibold\"\r\n >{labels.payment || 'Payment'}</Heading\r\n >\r\n <p class=\"type-body text-accent-danger mt-2\">{paymentError}</p>\r\n {:else}\r\n <!-- Showcase/dev only (Stripe absent BY DESIGN, with no payment-config\r\n error). Not reached in a real checkout: a missing publishable key sets\r\n paymentError and routes to the branch above. -->\r\n <Heading level={2} size=\"lg\" weight=\"semibold\"\r\n >{labels.payment || 'Payment'}</Heading\r\n >\r\n\r\n <Input\r\n label={labels.cardNumber || 'Card number'}\r\n placeholder={labels.cardPlaceholder || '4242 4242 4242 4242'}\r\n type=\"creditCardNumber\"\r\n required\r\n bind:value={cardNumber}\r\n errorText={errors.cardNumber ?? ''}\r\n color={errors.cardNumber ? 'red' : 'base'}\r\n />\r\n\r\n <div class=\"grid grid-cols-2 gap-4\">\r\n <Input\r\n label={labels.expiryDate || 'Expiry date'}\r\n placeholder={labels.expiryPlaceholder || 'MM / YY'}\r\n required\r\n bind:value={cardExpiry}\r\n errorText={errors.cardExpiry ?? ''}\r\n color={errors.cardExpiry ? 'red' : 'base'}\r\n />\r\n <Input\r\n label={labels.cvc || 'CVC'}\r\n placeholder={labels.cvcPlaceholder || '123'}\r\n required\r\n maxlength={4}\r\n bind:value={cardCvc}\r\n errorText={errors.cardCvc ?? ''}\r\n color={errors.cardCvc ? 'red' : 'base'}\r\n />\r\n </div>\r\n {/if}\r\n </section>\r\n\r\n <!-- Terms -->\r\n <section class=\"space-y-2\">\r\n <Checkbox bind:checked={agreeTerms}>\r\n {labels.agreeToTerms || 'I agree to the'}\r\n <!-- Checkbox renders children inside its <label>, so this anchor sits\r\n inside the label. That is safe WITHOUT a click guard: HTML exempts\r\n interactive-content descendants (<a href> is one) from label\r\n activation, so opening the terms does not tick the box. Pinned in\r\n CheckoutForm.terms-link.test.ts — if this ever stops being an anchor,\r\n the exemption goes with it. -->\r\n <a\r\n href=\"https://get-micdrop.com/tos\"\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n class=\"link underline\"\r\n >{labels.termsAndConditionsLink || 'terms and conditions'}<span\r\n class=\"sr-only\"> (opens in new tab)</span\r\n ></a\r\n >\r\n </Checkbox>\r\n {#if errors.agreeTerms}\r\n <div class=\"flex items-center gap-1.5\">\r\n <WarningTriIcon size=\"16\" class=\"text-accent-danger shrink-0\" />\r\n <Text size=\"xs\" class=\"text-accent-danger\">{errors.agreeTerms}</Text>\r\n </div>\r\n {/if}\r\n </section>\r\n\r\n <!-- Mobile submit is handled by CheckoutMobileFooter -->\r\n</div>\r\n\r\n<style>\r\n /* Boxes-coloured panel the whole form sits on. 1rem padding pairs with the\r\n timer-header's -1rem bleed so the header spans the panel's full width and\r\n caps its top. rounded/border match the order-summary sidebar Card. */\r\n .checkout-form-panel {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n overflow: hidden;\r\n }\r\n\r\n .timer-header {\r\n display: flex;\r\n align-items: center;\r\n gap: 0.75rem;\r\n padding: 0.75rem 1rem;\r\n margin-top: -1rem;\r\n margin-left: -1rem;\r\n margin-right: -1rem;\r\n border-bottom-width: 1px;\r\n border-bottom-style: solid;\r\n border-radius: 0.5rem 0.5rem 0 0;\r\n }\r\n\r\n .attendee-card {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n }\r\n\r\n .free-order-notice {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n }\r\n</style>\r\n","<script lang=\"ts\">\r\n import { defaultLabels } from '$lib/public-calendar-flow/i18n/labels.js';\r\n import { CalendarIcon } from '@getmicdrop/svelte-components/primitives/Icons/phosphor/index.js';\r\n import {\r\n Button,\r\n Card,\r\n Image,\r\n Text,\r\n formatCurrency,\r\n toUSD,\r\n } from '@getmicdrop/svelte-components';\r\n import type { EventData, OrderTotals } from '$lib/public-calendar-flow/types';\r\n import {\r\n formatBrowseDate,\r\n formatEventTime,\r\n } from '$lib/public-calendar-flow/defaults';\r\n import { PLACEHOLDER_IMAGE } from '$lib/utils/constants.js';\r\n import OrderSummary from './OrderSummary.svelte';\r\n\r\n interface Props {\r\n event: EventData;\r\n orderTotals: OrderTotals;\r\n isFreeOrder: boolean;\r\n onPlaceOrder: () => void;\r\n processing: boolean;\r\n /** Event canceled/postponed mid-checkout — disable the buy button. */\r\n saleClosed?: boolean;\r\n /** Price couldn't be loaded — show a plain line under the blocked button. */\r\n priceUnavailable?: boolean;\r\n labels?: Record<string, string>;\r\n /** BCP-47 locale tag (e.g. 'es', 'es-MX'). Undefined → en-US. */\r\n locale?: string;\r\n }\r\n\r\n let {\r\n event,\r\n orderTotals,\r\n isFreeOrder,\r\n onPlaceOrder,\r\n processing,\r\n saleClosed = false,\r\n priceUnavailable = false,\r\n labels = defaultLabels,\r\n locale = undefined,\r\n }: Props = $props();\r\n</script>\r\n\r\n<!--\r\n\tCap the sidebar card to the viewport so the Place Order button never\r\n\tfalls below the fold when many ticket types + fees + taxes + gift-card\r\n\tlines stack up. Three sections, top-to-bottom:\r\n\t 1. Event info — pinned at top so the buyer always sees what they're\r\n\t paying for.\r\n\t 2. Ticket-line list — scrolls when capacity exceeds viewport.\r\n\t 3. Totals + Place Order button — pinned at bottom so summary + CTA\r\n\t are always visible.\r\n-->\r\n<Card\r\n border\r\n padding={false}\r\n class=\"flex flex-col max-h-[calc(100vh-1.5rem)] rounded-xl shadow-lg overflow-hidden bg-surface-secondary\"\r\n>\r\n <!-- Pinned: event info -->\r\n <div class=\"p-5 shrink-0\">\r\n <div class=\"flex gap-3\">\r\n <div\r\n class=\"shrink-0 w-20 h-14 rounded-lg overflow-hidden bg-surface-tertiary\"\r\n >\r\n <Image\r\n src={event.imageUrl}\r\n alt={event.title}\r\n fallback={PLACEHOLDER_IMAGE}\r\n fit=\"cover\"\r\n class=\"w-full h-full\"\r\n />\r\n </div>\r\n <div class=\"flex-1 min-w-0\">\r\n <Text\r\n size=\"sm\"\r\n weight=\"semibold\"\r\n leading=\"tight\"\r\n class=\"block line-clamp-2\"\r\n >\r\n {event.title}\r\n </Text>\r\n <div class=\"flex items-center gap-1.5 mt-1\">\r\n <CalendarIcon size=\"16\" class=\"shrink-0 icon-muted\" />\r\n <Text size=\"xs\" color=\"muted\">\r\n {formatBrowseDate(event.startDateTime, event.timezone, locale)}\r\n {#if event.displayStartTime !== false}\r\n · {formatEventTime(\r\n event.startDateTime,\r\n event.timezone,\r\n locale\r\n )}\r\n {/if}\r\n </Text>\r\n </div>\r\n <div class=\"mt-0.5\">\r\n <Text size=\"xs\" color=\"muted\" class=\"block\">\r\n {event.venue.name}\r\n </Text>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Scrollable: ticket-line items only -->\r\n <div\r\n class=\"px-5 pb-3 flex-1 overflow-y-auto min-h-0 border-t border-default pt-3\"\r\n >\r\n <OrderSummary {orderTotals} mode=\"lines\" {labels} />\r\n </div>\r\n\r\n <!-- Pinned: totals + Place Order button -->\r\n <div class=\"px-5 pt-3 pb-5 shrink-0 border-t border-default space-y-3\">\r\n <OrderSummary {orderTotals} mode=\"totals\" {labels} />\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n disabled={processing || saleClosed || priceUnavailable}\r\n loading={processing && !saleClosed && !priceUnavailable}\r\n onclick={onPlaceOrder}\r\n >\r\n {#if saleClosed}\r\n {labels.salesClosed || 'Sales closed'}\r\n {:else if priceUnavailable}\r\n {labels.placeOrder || 'Place order'}\r\n {:else if processing}\r\n {labels.placingOrder || 'Placing order...'}\r\n {:else if isFreeOrder}\r\n {labels.completeOrder || 'Complete order'} · {labels.free ||\r\n 'Free'}\r\n {:else}\r\n {labels.placeOrder || 'Place order'} · {orderTotals.total == null\r\n ? '—'\r\n : formatCurrency(toUSD(orderTotals.total))}\r\n {/if}\r\n </Button>\r\n {#if priceUnavailable}\r\n <Text size=\"sm\" color=\"muted\">\r\n {labels.priceUnavailable ||\r\n \"We couldn't load the price for this order — refresh the page or contact the venue\"}\r\n </Text>\r\n {/if}\r\n </div>\r\n</Card>\r\n","<!-- @style-escape: widget-intentional. -->\r\n<script lang=\"ts\">\r\n import { defaultLabels } from '$lib/public-calendar-flow/i18n/labels.js';\r\n import {\r\n Button,\r\n Text,\r\n formatCurrency,\r\n layers,\r\n toUSD,\r\n } from '@getmicdrop/svelte-components';\r\n import type { OrderTotals } from '$lib/public-calendar-flow/types';\r\n\r\n interface Props {\r\n orderTotals: OrderTotals;\r\n isFreeOrder: boolean;\r\n onPlaceOrder: () => void;\r\n processing: boolean;\r\n /** Event canceled/postponed mid-checkout — disable the buy button. */\r\n saleClosed?: boolean;\r\n /** Price couldn't be loaded — show a plain line under the blocked button. */\r\n priceUnavailable?: boolean;\r\n labels?: Record<string, string>;\r\n }\r\n\r\n let {\r\n orderTotals,\r\n isFreeOrder,\r\n onPlaceOrder,\r\n processing,\r\n saleClosed = false,\r\n priceUnavailable = false,\r\n labels = defaultLabels,\r\n }: Props = $props();\r\n\r\n let totalTicketCount = $derived(\r\n orderTotals.lines.reduce((sum, l) => sum + l.quantity, 0)\r\n );\r\n</script>\r\n\r\n<div\r\n class=\"fixed bottom-0 left-0 right-0 md:hidden bg-surface-primary border-t border-default shadow-lg\"\r\n style:z-index={layers.overlay}\r\n style=\"padding-bottom: env(safe-area-inset-bottom, 0);\"\r\n>\r\n <div class=\"flex items-center justify-between gap-3 px-4 py-3\">\r\n <!-- Left: total info -->\r\n <div class=\"flex-1 min-w-0\">\r\n <Text size=\"sm\" weight=\"semibold\" class=\"tabular-nums block\">\r\n {#if isFreeOrder}\r\n {totalTicketCount}\r\n {totalTicketCount === 1\r\n ? labels.ticket || 'ticket'\r\n : labels.tickets || 'tickets'} · Free\r\n {:else if orderTotals.total == null}\r\n —\r\n {:else}\r\n {formatCurrency(toUSD(orderTotals.total))}\r\n {/if}\r\n </Text>\r\n </div>\r\n\r\n <!-- Right: Place order button -->\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n disabled={processing || saleClosed || priceUnavailable}\r\n loading={processing && !saleClosed && !priceUnavailable}\r\n onclick={onPlaceOrder}\r\n class=\"shrink-0 min-w-36\"\r\n >\r\n {#if saleClosed}\r\n {labels.salesClosed || 'Sales closed'}\r\n {:else if priceUnavailable}\r\n {labels.placeOrder || 'Place order'}\r\n {:else if processing}\r\n {labels.placingOrder || 'Placing order...'}\r\n {:else if isFreeOrder}\r\n {labels.completeOrder || 'Complete order'}\r\n {:else}\r\n {labels.placeOrder || 'Place order'}\r\n {/if}\r\n </Button>\r\n </div>\r\n {#if priceUnavailable}\r\n <div class=\"px-4 pb-3 -mt-1\">\r\n <Text size=\"sm\" color=\"muted\">\r\n {labels.priceUnavailable ||\r\n \"We couldn't load the price for this order — refresh the page or contact the venue\"}\r\n </Text>\r\n </div>\r\n {/if}\r\n</div>\r\n","<!--\r\n @form-handling-escape: `processing` is a Stripe payment-confirmation\r\n reentrancy guard (`if (processing) return; processing = true` around\r\n confirmPayment), NOT form-submission/validation state. createFormStore\r\n cannot express a payment-intent confirmation flow, and forcing it here\r\n would risk double-charge regressions for zero user-visible benefit.\r\n Same call as PP#193. Per Atlas behavior-form-handling convergence record.\r\n-->\r\n<script module>\r\n import { createLogger } from '@getmicdrop/svelte-components';\r\n import { toInstant } from '@getmicdrop/svelte-components/datetime';\r\n const logger = createLogger('CheckoutMain');\r\n</script>\r\n\r\n<script lang=\"ts\">\r\n import { untrack } from 'svelte';\r\n import {\r\n WarningTriIcon,\r\n ClockIcon,\r\n CalendarIcon,\r\n } from '@getmicdrop/svelte-components/primitives/Icons/phosphor/index.js';\r\n import { ApiError } from '@getmicdrop/svelte-components/errors';\r\n import {\r\n Button,\r\n Image,\r\n LiveRegion,\r\n Modal,\r\n Text,\r\n toTicketId,\r\n roundCurrency,\r\n getCookie,\r\n COOKIE_NAMES,\r\n createModalState,\r\n } from '@getmicdrop/svelte-components';\r\n import { typography } from '@getmicdrop/svelte-components';\r\n import { browserNow } from '@getmicdrop/svelte-components/datetime';\r\n // Shared with CartView — one derivation of \"has this event ended\", one answer.\r\n import { isEventEnded as isEventEndedShared } from '$lib/utils/event-ended';\r\n import { PLACEHOLDER_IMAGE } from '$lib/utils/constants.js';\r\n import { getSessionStatus } from '$lib/api';\r\n import {\r\n formatBrowseDate,\r\n formatEventTime,\r\n } from '$lib/public-calendar-flow/defaults';\r\n import type {\r\n OrderTotals,\r\n CheckoutConfig,\r\n CheckoutFormData,\r\n } from '$lib/public-calendar-flow/types';\r\n import {\r\n mockEvent,\r\n mockFreeEvent,\r\n mockDonationEvent,\r\n mockRegistrationEvent,\r\n } from '$lib/public-calendar-flow/mock-data';\r\n import { calculateTax } from '$lib/public-calendar-flow/defaults';\r\n import { dataToggleStore } from '$lib/public-calendar-flow/data-toggle-store.svelte';\r\n import { getShowcaseCheckoutStates } from '$lib/public-calendar-flow/showcase-state-options';\r\n\r\n import CheckoutForm from './CheckoutForm.svelte';\r\n import CheckoutSidebar from './CheckoutSidebar.svelte';\r\n import CheckoutMobileFooter from './CheckoutMobileFooter.svelte';\r\n import OrderSummary from './OrderSummary.svelte';\r\n import { getLabelsForLocale } from '$lib/public-calendar-flow/i18n/index.js';\r\n\r\n // mergedLabels initialized after props destructuring below\r\n\r\n // --- DataToggle types ---\r\n type CheckoutVariant =\r\n | 'default'\r\n | 'free'\r\n | 'donation'\r\n | 'registration'\r\n | 'timer_warning'\r\n | 'expired'\r\n | 'promo';\r\n\r\n const checkoutStateOptions = getShowcaseCheckoutStates();\r\n\r\n let dataVariant = $derived(dataToggleStore.current as CheckoutVariant);\r\n\r\n // --- Props (dual-mode: showcase vs production) ---\r\n interface Props {\r\n /** Pre-built checkout config for production mode. Absence = showcase. */\r\n config?: CheckoutConfig;\r\n /** Production order submission handler. Receives form data for the wrapper to submit. */\r\n onPlaceOrder?: (_formData: CheckoutFormData) => Promise<void>;\r\n /** Production back navigation handler. */\r\n onBack?: () => void;\r\n /** Production retry handler for expired sessions. */\r\n onRetryExpired?: () => void;\r\n /** Production session extension handler. Returns extension result with newExpiryTime and remainingExtensions. */\r\n onExtendSession?: () => Promise<{\r\n newExpiryTime?: string;\r\n remainingExtensions?: number;\r\n } | null | void>;\r\n /** Stripe instance passed through to CheckoutForm */\r\n stripe?: any;\r\n /** Stripe client secret passed through to CheckoutForm */\r\n paymentIntent?: string;\r\n /** Bindable Stripe elements for wrapper to access */\r\n elements?: any;\r\n /** Payment error message to display */\r\n paymentError?: string;\r\n /**\r\n * Bindable read-out of the ended-event derivation. This component owns the\r\n * clock that answers it, and the wrapper renders payment affordances as its\r\n * SIBLINGS (the gift-card input) which must go away at the same instant.\r\n * Surfacing the answer keeps one clock and one derivation rather than a\r\n * second copy in the wrapper. Read-only in practice — writes are ignored.\r\n */\r\n eventEnded?: boolean;\r\n /**\r\n * The server refused to price this order — a paid order whose payment-intent\r\n * carried no charged amount (mf#2383 / vc#619). The buy button hard-blocks,\r\n * so the checkout shows a plain line under it telling the buyer why.\r\n */\r\n serverTotalsUnavailable?: boolean;\r\n labels?: Record<string, string>;\r\n /** BCP-47 locale tag (e.g. 'es', 'es-MX'). Undefined → browser locale → en. */\r\n locale?: string;\r\n }\r\n\r\n let {\r\n config: configProp = undefined,\r\n onPlaceOrder: onPlaceOrderProp = undefined,\r\n onBack: onBackProp = undefined,\r\n onRetryExpired: onRetryExpiredProp = undefined,\r\n onExtendSession: onExtendSessionProp = undefined,\r\n stripe = undefined,\r\n paymentIntent = undefined,\r\n elements = $bindable(undefined),\r\n paymentError = '',\r\n eventEnded = $bindable(false),\r\n serverTotalsUnavailable = false,\r\n labels = {},\r\n locale = undefined,\r\n }: Props = $props();\r\n\r\n const mergedLabels = $derived(getLabelsForLocale(locale, labels));\r\n let isShowcaseMode = $derived(!configProp);\r\n\r\n $effect(() => {\r\n if (!isShowcaseMode) return;\r\n dataToggleStore.options = checkoutStateOptions;\r\n dataToggleStore.current = 'default';\r\n dataToggleStore.isActive = true;\r\n return () => {\r\n dataToggleStore.isActive = false;\r\n dataToggleStore.options = [];\r\n };\r\n });\r\n\r\n // --- Mock order configurations per variant ---\r\n function buildConfig(variant: CheckoutVariant): CheckoutConfig {\r\n switch (variant) {\r\n case 'free':\r\n return {\r\n event: mockFreeEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(201),\r\n ticketName: 'Free Entry',\r\n quantity: 2,\r\n unitPrice: 0,\r\n fee: 0,\r\n subtotal: 0,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'donation':\r\n return {\r\n event: mockDonationEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(401),\r\n ticketName: 'Donation',\r\n quantity: 1,\r\n unitPrice: 25,\r\n fee: 0,\r\n subtotal: 25,\r\n },\r\n {\r\n ticketId: toTicketId(402),\r\n ticketName: 'Standard Admission',\r\n quantity: 1,\r\n unitPrice: 30,\r\n fee: 3,\r\n subtotal: 30,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'registration':\r\n return {\r\n event: mockRegistrationEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(301),\r\n ticketName: 'Workshop Seat',\r\n quantity: 1,\r\n unitPrice: 75,\r\n fee: 7.5,\r\n subtotal: 75,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'timer_warning':\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 33, // Just over 30s — warning modal triggers at 30s\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'expired':\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 0,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: true,\r\n };\r\n\r\n case 'promo':\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: true,\r\n promoDiscount: 10,\r\n forceExpired: false,\r\n };\r\n\r\n default:\r\n // Standard checkout\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n }\r\n }\r\n\r\n // --- State ---\r\n let config: CheckoutConfig = $derived(\r\n isShowcaseMode ? buildConfig(dataVariant) : configProp!\r\n );\r\n // Deadline-based timer model.\r\n //\r\n // We track an absolute deadline timestamp (ms since epoch) and compute\r\n // the displayed seconds from `deadlineMs - Date.now()` on each tick.\r\n // This is immune to backgrounded-tab throttling: when the browser\r\n // suspends our setInterval, the displayed value falls behind, but the\r\n // very next tick (or the visibilitychange handler) recomputes from\r\n // wall-clock time and the display jumps to truth. Previously we\r\n // decremented `timerSeconds -= 1`, which drifted arbitrarily far from\r\n // reality whenever the tab was backgrounded (Chrome throttles 1Hz\r\n // intervals to ~1/min after a few minutes, then pauses them entirely).\r\n //\r\n // `timerSeconds` remains an explicit state var (rather than `$derived`)\r\n // because legacy code paths still write to it (legacy demo modes); the\r\n // canonical writer is now the deadline-driven tick effect below.\r\n let deadlineMs = $state<number | null>(null);\r\n let timerSeconds = $state(900);\r\n let isExpired = $state(false);\r\n let processing = $state(false);\r\n let submitRequested = $state(0);\r\n\r\n // Cart expiration warning/expired modal states\r\n const warningModal = createModalState();\r\n const expiredModal = createModalState();\r\n let warningShown = $state(false);\r\n let isExtendingSession = $state(false);\r\n let remainingExtensions = $state(3);\r\n let canExtend = $state(true);\r\n\r\n // Event-status flip: set when the heartbeat reports the event was\r\n // canceled/postponed mid-checkout. Disables the buy button + surfaces a banner\r\n // modal. The backend finalize gate (§2.13) is the no-charge guarantee; this is\r\n // the courtesy \"don't even let them try\".\r\n //\r\n // Operator-driven only — an event that simply reaches its end time flips\r\n // NOTHING here. That is what `isEventEnded` below adds; the two fold together\r\n // into `eventDead`, which is what every guard in this file reads.\r\n let eventStatusDead = $state<null | 'canceled' | 'postponed'>(null);\r\n const eventUnavailableModal = createModalState();\r\n\r\n // Clock for the ended-event derivation. The buyer can be sitting on this page\r\n // when the event's end time passes, so \"has it ended\" cannot be answered once\r\n // at mount — it has to be re-asked as the clock advances. Its own 1 Hz\r\n // interval rather than the hold-timer tick below, because that tick stops at\r\n // cart expiry and this question outlives it.\r\n let now = $state(browserNow());\r\n $effect(() => {\r\n const clock = setInterval(() => {\r\n now = browserNow();\r\n }, 1000);\r\n return () => clearInterval(clock);\r\n });\r\n\r\n // Same derivation CartView uses (extracted to $lib/utils/event-ended), fed the\r\n // ticking clock so it flips mid-checkout.\r\n let isEventEnded = $derived(isEventEndedShared(config.event, now));\r\n\r\n // Publish it to the wrapper, whose gift-card input sits beside this component\r\n // and would otherwise keep offering to pay for a finished event.\r\n $effect(() => {\r\n eventEnded = isEventEnded;\r\n });\r\n\r\n // The union every guard reads. Widened from operator status alone to include\r\n // time-based expiry, so `saleClosed={!!eventDead}` and the two pre-submit\r\n // `if (eventDead) return;` blocks cover an ended event with exactly the rigor\r\n // they already gave a canceled or postponed one.\r\n let eventDead = $derived<null | 'canceled' | 'postponed' | 'ended'>(\r\n eventStatusDead ?? (isEventEnded ? 'ended' : null)\r\n );\r\n\r\n const WARNING_THRESHOLD = 30; // Show warning modal at 30 seconds remaining\r\n\r\n // Formatted timer display for the modal\r\n let timerDisplay = $derived(\r\n (() => {\r\n const m = Math.floor(timerSeconds / 60);\r\n const s = timerSeconds % 60;\r\n return `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;\r\n })()\r\n );\r\n\r\n // Order totals — the server's payment-intent response is the source\r\n // of truth (it's what Stripe will actually charge). Fall back to a\r\n // local estimate only when the server hasn't responded yet (showcase\r\n // mode, or while the initial /payment-intent is in flight) so the\r\n // skeleton has something to render.\r\n let orderTotals: OrderTotals = $derived(\r\n (() => {\r\n const lines = config.lines;\r\n // A selected ticket with no (or malformed) client-side price makes the\r\n // ORDER unpriced — dash the subtotal + amount-due, hide the fee/tax rows,\r\n // and hard-block the buy button. This runs BEFORE the server-totals branch\r\n // on purpose: even if the server returned a number we can't reconcile to\r\n // that \"—\" line, we make the buyer refresh rather than let them submit a\r\n // charge over an unpriced line (mf#2383 / vc#619).\r\n if (lines.some(l => l.subtotal == null)) {\r\n return {\r\n lines,\r\n subtotal: null,\r\n fees: 0,\r\n taxes: 0,\r\n total: null,\r\n promoDiscount: 0,\r\n giftCardAmount: 0,\r\n };\r\n }\r\n if (config.serverTotals) {\r\n return {\r\n lines,\r\n subtotal: config.serverTotals.subtotal,\r\n fees: config.serverTotals.fees,\r\n taxes: config.serverTotals.taxes,\r\n total: config.serverTotals.total,\r\n promoDiscount: config.serverTotals.promoDiscount,\r\n giftCardAmount: config.serverTotals.giftCardAmount,\r\n };\r\n }\r\n const subtotal = roundCurrency(\r\n lines.reduce((sum, l) => sum + (l.subtotal == null ? 0 : l.subtotal), 0)\r\n );\r\n const fees = roundCurrency(\r\n lines.reduce((sum, l) => sum + l.fee * l.quantity, 0)\r\n );\r\n const promoDiscount = config.promoApplied ? config.promoDiscount : 0;\r\n const adjustedSubtotal = roundCurrency(\r\n Math.max(0, subtotal - promoDiscount)\r\n );\r\n const taxes = calculateTax(\r\n adjustedSubtotal + fees,\r\n config.event.venue.taxPercentage\r\n );\r\n return {\r\n lines,\r\n subtotal,\r\n fees,\r\n taxes,\r\n total: roundCurrency(adjustedSubtotal + fees + taxes),\r\n promoDiscount,\r\n giftCardAmount: 0,\r\n };\r\n })()\r\n );\r\n\r\n // Disable Place-order until the server has confirmed the totals.\r\n // Showing \"Place order · $55\" while the actual Stripe charge will be\r\n // $63.55 is worse than briefly disabling the button. Free orders\r\n // never call the payment-intent endpoint, so they're exempt.\r\n // Showcase mode has no server, so its mock totals are final — treat them as\r\n // locked, otherwise the Place-order button is perpetually \"Placing order…\".\r\n // An unpriced order (orderTotals.total === null, e.g. a missing ticket price)\r\n // is NOT locked even with server totals present — the button must hard-block\r\n // over a \"—\" line rather than charge (mf#2383 / vc#619).\r\n let totalsLocked = $derived(\r\n isShowcaseMode || (!!config.serverTotals && orderTotals.total !== null)\r\n );\r\n\r\n let isFreeOrder = $derived(\r\n orderTotals.total === 0 && orderTotals.subtotal === 0\r\n );\r\n let isRegistration = $derived(config.event.isRegistrationEvent);\r\n\r\n // A paid order we can't price: either the server refused the payment-intent\r\n // (serverTotalsUnavailable) or a selected ticket's wire price is missing so\r\n // the client total is unknowable (orderTotals.total === null). The buy button\r\n // hard-blocks in both cases — show a plain line under it so the buyer isn't\r\n // left with a silent dead button on a page about their money (mf#2383/vc#619).\r\n let priceUnavailable = $derived(\r\n !isShowcaseMode &&\r\n !isFreeOrder &&\r\n (serverTotalsUnavailable || orderTotals.total === null)\r\n );\r\n\r\n // Set timer ONCE on initial mount — not on every config change.\r\n // Config changes frequently (Stripe loads, quantities update, etc.)\r\n // and must not reset the timer.\r\n let timerInitialized = false;\r\n $effect(() => {\r\n const c = config;\r\n if (!timerInitialized) {\r\n timerInitialized = true;\r\n // Convert the incoming \"seconds from now\" into an absolute deadline.\r\n // From this point on, deadlineMs is the source of truth.\r\n deadlineMs = Date.now() + c.timerStart * 1000;\r\n timerSeconds = c.timerStart;\r\n isExpired = c.forceExpired;\r\n }\r\n // A config change must NOT reset submission state. The hosted route re-emits\r\n // `config` from its 30s session-status poll (any timer drift > 5s) — a\r\n // routine event unrelated to the buyer's submission. `submitRequested` is a\r\n // monotonic edge-trigger counter that CheckoutForm chases with its own\r\n // `lastSubmitRequest` high-water mark; zeroing ONE without the other desyncs\r\n // the pair, so the form's submit-watch (`submitRequested > lastSubmitRequest`)\r\n // can never fire again and the buyer's next Place-order click is silently\r\n // swallowed (VC#345 — happens after a declined card, when `processing` has\r\n // already settled back to false). The counter is never reset: it only\r\n // increments on an explicit click, and both `processing` and `submitRequested`\r\n // are owned solely by the submission lifecycle (handlePlaceOrder's\r\n // finally-block, and the bfcache pageshow un-stick below).\r\n });\r\n\r\n function getCartIdFromCookie(): string | null {\r\n if (typeof document === 'undefined') return null;\r\n return getCookie(COOKIE_NAMES.CHECKOUT_CARTID);\r\n }\r\n\r\n function recomputeFromDeadline(): number {\r\n if (deadlineMs == null) return timerSeconds;\r\n return Math.max(0, Math.floor((deadlineMs - Date.now()) / 1000));\r\n }\r\n\r\n /**\r\n * Re-sync the deadline from the orders-service. Called on tab focus —\r\n * a backgrounded tab might have missed an extension granted in another\r\n * tab, or the server may have already expired the cart while we slept.\r\n *\r\n * Silent on any error: the existing deadlineMs continues to drive the\r\n * display, which is no worse than the pre-resync state.\r\n */\r\n async function resyncDeadlineFromServer(): Promise<void> {\r\n const cartId = getCartIdFromCookie();\r\n if (!cartId) return;\r\n try {\r\n const status = await getSessionStatus(cartId);\r\n if (status.notFound) {\r\n // Server has already released the reservation. Surface the\r\n // expired modal so the user isn't staring at a phantom timer.\r\n deadlineMs = Date.now();\r\n timerSeconds = 0;\r\n isExpired = true;\r\n warningModal.close();\r\n expiredModal.open();\r\n return;\r\n }\r\n if (status.expiresAt) {\r\n // Checkout hold-timer deadline — buyer's own wall clock, tz-independent\r\n deadlineMs = toInstant(status.expiresAt).getTime();\r\n timerSeconds = recomputeFromDeadline();\r\n }\r\n // Event-status flip piggybacked on the heartbeat. Set once (so a dismissed\r\n // banner doesn't reopen each poll); the buy button stays disabled via\r\n // saleClosed regardless. \"cancelled\" accepted defensively.\r\n const deadNow =\r\n status.eventStatus === 'canceled' || status.eventStatus === 'cancelled'\r\n ? 'canceled'\r\n : status.eventStatus === 'postponed'\r\n ? 'postponed'\r\n : null;\r\n if (deadNow && !eventStatusDead) {\r\n eventStatusDead = deadNow;\r\n eventUnavailableModal.open();\r\n }\r\n } catch {\r\n /* network error — keep current deadlineMs */\r\n }\r\n }\r\n\r\n // Timer countdown with warning and expired modal triggers.\r\n //\r\n // The interval ticks at 1 Hz, but its job is to *recompute* timerSeconds\r\n // from deadlineMs, not to decrement a counter. Backgrounded tabs throttle\r\n // this interval — that's fine; when the tab regains focus the\r\n // visibilitychange handler runs the recompute immediately and the display\r\n // jumps to truth.\r\n $effect(() => {\r\n // Depend on `isExpired` ONLY. `timerSeconds` is mutated by this effect's\r\n // own tick() below, so reading it reactively here made the effect a\r\n // dependency of its own output: every 1 Hz tick re-ran the whole effect,\r\n // tearing down + rebuilding the interval and re-firing the setup-time\r\n // resyncDeadlineFromServer() ~1×/sec instead of on the intended 30s\r\n // heartbeat. Reading it untracked keeps setup a one-shot per isExpired\r\n // transition — the tick handles the countdown->expiry flip itself.\r\n if (isExpired) return;\r\n if (untrack(() => timerSeconds) <= 0) {\r\n isExpired = true;\r\n warningModal.close();\r\n expiredModal.open();\r\n return;\r\n }\r\n\r\n const tick = () => {\r\n const next = recomputeFromDeadline();\r\n timerSeconds = next;\r\n\r\n // Persist deadline to localStorage every 10 displayed seconds.\r\n // (Storing the deadline directly — not a recomputed end-time —\r\n // keeps reads consistent across tabs.)\r\n if (\r\n next % 10 === 0 &&\r\n deadlineMs != null &&\r\n typeof localStorage !== 'undefined'\r\n ) {\r\n try {\r\n const cartId = getCartIdFromCookie();\r\n if (cartId) {\r\n localStorage.setItem(\r\n // @storage-escape: checkout-deadline timer persistence (intentional raw localStorage)\r\n `checkout-expiry-${cartId}`,\r\n String(deadlineMs)\r\n );\r\n }\r\n } catch {\r\n /* ignore */\r\n }\r\n }\r\n\r\n // Heartbeat: re-sync from the server every ~30s. Refreshes the deadline\r\n // AND carries the piggybacked event status, so the buy button flips within\r\n // ~30s of an operator canceling/postponing — no dedicated poll or socket.\r\n if (next > 0 && next % 30 === 0) {\r\n void resyncDeadlineFromServer();\r\n }\r\n\r\n // Show warning modal at 30 seconds remaining (only once per session).\r\n // We compare with <= because a backgrounded tab may have skipped over\r\n // the exact === WARNING_THRESHOLD boundary while throttled.\r\n if (next <= WARNING_THRESHOLD && next > 0 && !warningShown) {\r\n warningModal.open();\r\n warningShown = true;\r\n }\r\n\r\n if (next <= 0) {\r\n isExpired = true;\r\n warningModal.close();\r\n expiredModal.open();\r\n clearInterval(interval);\r\n }\r\n };\r\n\r\n const interval = setInterval(tick, 1000);\r\n\r\n // Recompute immediately whenever the tab becomes visible — a\r\n // throttled/paused interval may have left the display many minutes\r\n // behind reality. Also kick a server resync to catch the case where\r\n // the reservation already expired (or was extended in another tab).\r\n const onVisible = (e?: Event) => {\r\n // A bfcache restore — the Back button after a 3DS/redirect payment method\r\n // navigated away mid-confirmPayment — returns the page frozen: the\r\n // submission promise never resolved, so handlePlaceOrder's finally never\r\n // cleared `processing`, and Place-order dead-ends on `if (processing)\r\n // return` until a hard reload. Treat the restore as the end of any\r\n // in-flight submission and un-stick the button. (Guarded on `pageshow`\r\n // with `persisted` so a normal visibilitychange never clears a genuine\r\n // in-flight charge.)\r\n if (e?.type === 'pageshow' && (e as PageTransitionEvent).persisted) {\r\n // Un-stick a submission frozen mid-flight by the bfcache. Only\r\n // `processing` is cleared: the already-fired submit left submitRequested\r\n // in sync with the form's lastSubmitRequest, so leaving it untouched lets\r\n // the next click increment past the high-water mark and re-submit. Zeroing\r\n // it here would desync the pair and swallow that retry click (VC#345).\r\n processing = false;\r\n }\r\n if (\r\n typeof document !== 'undefined' &&\r\n document.visibilityState === 'visible'\r\n ) {\r\n tick();\r\n void resyncDeadlineFromServer();\r\n }\r\n };\r\n if (typeof document !== 'undefined') {\r\n document.addEventListener('visibilitychange', onVisible);\r\n }\r\n if (typeof window !== 'undefined') {\r\n window.addEventListener('pageshow', onVisible);\r\n }\r\n\r\n // Initial server resync — catches the case where the user landed on\r\n // checkout with a stale cookie whose cart has already been released.\r\n void resyncDeadlineFromServer();\r\n\r\n return () => {\r\n clearInterval(interval);\r\n if (typeof document !== 'undefined') {\r\n document.removeEventListener('visibilitychange', onVisible);\r\n }\r\n if (typeof window !== 'undefined') {\r\n window.removeEventListener('pageshow', onVisible);\r\n }\r\n };\r\n });\r\n\r\n // --- Handlers ---\r\n function handleBack() {\r\n // Showcase mode has no back target; production wires onBackProp.\r\n if (onBackProp) onBackProp();\r\n }\r\n\r\n /** Called from sidebar/mobile footer — signals the form to validate + submit */\r\n function requestPlaceOrder() {\r\n if (eventDead) return; // sales closed — buy button is disabled, block defensively\r\n submitRequested += 1;\r\n }\r\n\r\n /** Called by CheckoutForm after successful validation */\r\n function handlePlaceOrder(formData: CheckoutFormData) {\r\n if (processing) return;\r\n if (eventDead) return; // sales closed mid-checkout — do not submit\r\n processing = true;\r\n\r\n if (onPlaceOrderProp) {\r\n // Production mode: delegate to wrapper with form data\r\n onPlaceOrderProp(formData)\r\n .catch(() => {\r\n // Error handling is done by the wrapper; just reset processing\r\n })\r\n .finally(() => {\r\n processing = false;\r\n });\r\n return;\r\n }\r\n\r\n // Showcase mode: mock the async place-order delay, then clear processing.\r\n // No success surface here — production owns the real confirmation page.\r\n setTimeout(() => {\r\n processing = false;\r\n }, 1500);\r\n }\r\n\r\n function handleRetryExpired() {\r\n expiredModal.close();\r\n // Showcase mode has no ticket-selection target; production wires onRetryExpiredProp.\r\n if (onRetryExpiredProp) onRetryExpiredProp();\r\n }\r\n\r\n /** Extend the checkout session via the parent wrapper's onExtendSession callback */\r\n async function handleExtendSession() {\r\n if (!canExtend || isExtendingSession) return;\r\n isExtendingSession = true;\r\n\r\n try {\r\n if (onExtendSessionProp) {\r\n const result = await onExtendSessionProp();\r\n // The parent wrapper (Checkout.svelte) returns `null` when the\r\n // extend-session API call fails — e.g. when the reservation\r\n // has already expired server-side past its grace window, or\r\n // the user has used all 3 extensions. Treat null/undefined as\r\n // an unambiguous failure: don't reset the timer to +15min\r\n // locally (that would falsely show the user they still have a\r\n // valid cart when the server has already released the tickets).\r\n if (result == null) {\r\n throw new ApiError('Extension request returned no result', 0, {\r\n endpoint: 'extend-session',\r\n method: 'POST',\r\n });\r\n }\r\n if (typeof result === 'object') {\r\n if (result.newExpiryTime) {\r\n // Server gave us an absolute new expiry — use it directly.\r\n // Checkout hold-timer deadline — buyer's own wall clock, tz-independent\r\n deadlineMs = toInstant(result.newExpiryTime).getTime();\r\n } else {\r\n // Fallback: add 15 minutes from now\r\n deadlineMs = Date.now() + 15 * 60 * 1000;\r\n }\r\n timerSeconds = recomputeFromDeadline();\r\n if (result.remainingExtensions !== undefined) {\r\n remainingExtensions = result.remainingExtensions;\r\n canExtend = remainingExtensions > 0;\r\n }\r\n } else {\r\n // Truthy non-object: legacy callers that just return `true`\r\n // on success. Treat as a simple 15-minute extension.\r\n deadlineMs = Date.now() + 15 * 60 * 1000;\r\n timerSeconds = recomputeFromDeadline();\r\n }\r\n } else {\r\n // Showcase mode: just add 15 minutes\r\n deadlineMs = Date.now() + 15 * 60 * 1000;\r\n timerSeconds = recomputeFromDeadline();\r\n }\r\n\r\n isExpired = false;\r\n warningShown = false;\r\n warningModal.close();\r\n expiredModal.close();\r\n } catch (err) {\r\n logger.error('Failed to extend session:', err);\r\n // Extension failed — close the warning but keep the expired\r\n // modal open so the user is offered \"Select tickets again\".\r\n // Disable further extend attempts on this dead cart.\r\n warningModal.close();\r\n canExtend = false;\r\n if (timerSeconds <= 0) {\r\n isExpired = true;\r\n expiredModal.open();\r\n }\r\n } finally {\r\n isExtendingSession = false;\r\n }\r\n }\r\n\r\n /** Dismiss warning modal without extending (user will hurry) */\r\n function dismissWarning() {\r\n warningModal.close();\r\n }\r\n</script>\r\n\r\n<div class=\"w-full min-h-screen bg-surface-primary text-color-primary\">\r\n <div class=\"max-w-6xl mx-auto px-4 py-6 md:px-6 md:py-8\">\r\n {#if isEventEnded}\r\n <!-- Ended mid-checkout. Same treatment CartView gives this exact case\r\n (CartView.svelte, `{:else if event && isEventEnded}`): short-circuit\r\n the surface to one alert, same copy. The buy controls are unmounted\r\n here AND disabled at the guard layer via `eventDead`, which now\r\n folds this in. -->\r\n <LiveRegion visible politeness=\"assertive\" class=\"text-center py-12\">\r\n <p class=\"mb-2 {typography.h2}\">\r\n {mergedLabels.thisEventHasEnded || 'This event has ended'}\r\n </p>\r\n <p class=\"tone-secondary mb-6\">\r\n {mergedLabels.ticketsNoLongerAvailable ||\r\n 'Tickets are no longer available for this event'}\r\n </p>\r\n <Button\r\n variant=\"default\"\r\n onclick={handleBack}\r\n aria-label={mergedLabels.goBackToEventDetails ||\r\n 'Go back to event details'}\r\n >\r\n {mergedLabels.goBack || 'Go back'}\r\n </Button>\r\n </LiveRegion>\r\n {:else}\r\n <!-- Single CheckoutForm shared between desktop and mobile layouts.\r\n\t\t Previously there were two instances (one hidden md:grid, one md:hidden)\r\n\t\t which caused duplicate Stripe elements and broken form submission. -->\r\n <div class=\"max-w-6xl\">\r\n <!-- Desktop: two-column grid; Mobile: single column -->\r\n <div class=\"md:grid md:grid-cols-booking-split gap-8 items-start\">\r\n <!-- LEFT COLUMN (or full width on mobile): Checkout form -->\r\n <div class=\"pb-24 md:pb-0\">\r\n <!-- CheckoutForm re-mounts ONLY the Stripe element internally when\r\n `paymentIntent` changes (e.g. a partial gift card swaps in a\r\n reduced-amount PI), so Elements always binds to the current secret\r\n WITHOUT remounting the whole form and wiping the buyer's typed\r\n fields. (An earlier {#key paymentIntent} here blanked the form.) -->\r\n <CheckoutForm\r\n event={config.event}\r\n {orderTotals}\r\n {timerSeconds}\r\n {isExpired}\r\n {isRegistration}\r\n {isFreeOrder}\r\n promoApplied={config.promoApplied}\r\n promoDiscount={config.promoDiscount}\r\n onBack={handleBack}\r\n onPlaceOrder={handlePlaceOrder}\r\n {processing}\r\n {submitRequested}\r\n {stripe}\r\n {paymentIntent}\r\n bind:elements\r\n {paymentError}\r\n labels={mergedLabels}\r\n />\r\n\r\n <!-- Inline order summary for mobile (below form). Lead with the\r\n event header (poster + title + date + venue) so the buyer\r\n has visual confirmation of what they're paying for as they\r\n approach the sticky Place order button. Mirrors the desktop\r\n CheckoutSidebar layout. -->\r\n <section\r\n class=\"md:hidden mobile-order-summary border-default bg-surface-secondary mt-6\"\r\n >\r\n <div class=\"flex gap-3 pb-3 mb-3 border-b border-default\">\r\n <div\r\n class=\"shrink-0 w-20 h-14 rounded-lg overflow-hidden bg-surface-tertiary\"\r\n >\r\n <Image\r\n src={config.event.imageUrl}\r\n fallback={PLACEHOLDER_IMAGE}\r\n alt={config.event.title}\r\n class=\"w-full h-full\"\r\n />\r\n </div>\r\n <div class=\"flex-1 min-w-0\">\r\n <Text\r\n size=\"sm\"\r\n weight=\"semibold\"\r\n leading=\"tight\"\r\n class=\"block line-clamp-2\"\r\n >\r\n {config.event.title}\r\n </Text>\r\n <div class=\"flex items-center gap-1.5 mt-1\">\r\n <CalendarIcon size=\"16\" class=\"shrink-0 icon-muted\" />\r\n <Text size=\"xs\" color=\"muted\">\r\n {formatBrowseDate(\r\n config.event.startDateTime,\r\n config.event.timezone,\r\n locale\r\n )}\r\n {#if config.event.displayStartTime !== false}\r\n · {formatEventTime(\r\n config.event.startDateTime,\r\n config.event.timezone,\r\n locale\r\n )}\r\n {/if}\r\n </Text>\r\n </div>\r\n <div class=\"mt-0.5\">\r\n <Text size=\"xs\" color=\"muted\" class=\"block\">\r\n {config.event.venue.name}\r\n </Text>\r\n </div>\r\n </div>\r\n </div>\r\n <OrderSummary {orderTotals} labels={mergedLabels} />\r\n </section>\r\n </div>\r\n\r\n <!-- RIGHT COLUMN: Sticky order summary sidebar (desktop only) -->\r\n <div class=\"hidden md:block sticky top-6\">\r\n <CheckoutSidebar\r\n event={config.event}\r\n {orderTotals}\r\n {isFreeOrder}\r\n {priceUnavailable}\r\n onPlaceOrder={requestPlaceOrder}\r\n processing={processing || (!isFreeOrder && !totalsLocked)}\r\n saleClosed={!!eventDead}\r\n labels={mergedLabels}\r\n {locale}\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Mobile: Fixed bottom bar -->\r\n <div class=\"md:hidden\">\r\n <CheckoutMobileFooter\r\n {orderTotals}\r\n {isFreeOrder}\r\n {priceUnavailable}\r\n onPlaceOrder={requestPlaceOrder}\r\n processing={processing || (!isFreeOrder && !totalsLocked)}\r\n saleClosed={!!eventDead}\r\n labels={mergedLabels}\r\n />\r\n </div>\r\n {/if}\r\n </div>\r\n\r\n <!-- Session Warning Modal (30 seconds remaining).\r\n Wrapped in `{#if}` (instead of relying on `bind:open` alone) so\r\n the Modal fully mounts/unmounts each time warningModal.isOpen\r\n transitions. Surfaced by a wall-clock test where, after the\r\n user clicked \"Continue checkout\" on a first warning, the Modal\r\n component's internal open-state never reset cleanly — on the\r\n NEXT 30s threshold the timer text in DOM updated but the modal\r\n stayed visually hidden, so the user lost the cart with no\r\n chance to re-extend. Forcing remount with #if sidesteps that. -->\r\n {#if warningModal.isOpen}\r\n <Modal\r\n open={true}\r\n oncancel={() => warningModal.close()}\r\n size=\"sm\"\r\n aria-labelledby=\"warning-modal-title\"\r\n >\r\n {#snippet body()}\r\n <div class=\"timer-modal\" id=\"warning-modal-description\">\r\n <div class=\"timer-modal-icon warning\">\r\n <WarningTriIcon size=\"32\" />\r\n </div>\r\n <h3\r\n id=\"warning-modal-title\"\r\n class=\"timer-modal-title type-subheading\"\r\n >\r\n {mergedLabels.sessionExpiringSoon || 'Session expiring soon'}\r\n </h3>\r\n <p class=\"timer-modal-text type-body\">\r\n {(\r\n mergedLabels.sessionExpiringSoonMessage ||\r\n 'Your checkout session will expire in {time}. Your selected tickets will be released back to inventory'\r\n ).replace('{time}', timerDisplay)}\r\n </p>\r\n {#if canExtend && remainingExtensions > 0}\r\n <p class=\"timer-modal-hint type-caption\">\r\n {(\r\n mergedLabels.extensionsRemaining ||\r\n '{count} extension{plural} remaining'\r\n )\r\n .replace('{count}', String(remainingExtensions))\r\n .replace('{plural}', remainingExtensions === 1 ? '' : 's')}\r\n </p>\r\n {/if}\r\n </div>\r\n {/snippet}\r\n {#snippet footer()}\r\n <div class=\"timer-modal-actions\">\r\n {#if canExtend}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleExtendSession}\r\n disabled={isExtendingSession}\r\n loading={isExtendingSession}\r\n >\r\n {isExtendingSession\r\n ? mergedLabels.extendingSession || 'Extending...'\r\n : mergedLabels.continueCheckout || 'Continue checkout'}\r\n </Button>\r\n {:else}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={dismissWarning}\r\n >\r\n {mergedLabels.okIllHurry || \"OK, I'll hurry\"}\r\n </Button>\r\n <p class=\"timer-modal-hint type-caption\">\r\n {mergedLabels.maxExtensionsReached ||\r\n 'Maximum extensions reached'}\r\n </p>\r\n {/if}\r\n </div>\r\n {/snippet}\r\n </Modal>\r\n {/if}\r\n\r\n <!-- Session Expired Modal (\"Want to keep your tickets?\").\r\n Same `{#if}` wrap as the warning modal — forces a fresh\r\n Modal mount each time so reopening after a previous extend\r\n cycle actually re-displays the dialog. -->\r\n {#if expiredModal.isOpen}\r\n <Modal\r\n open={true}\r\n oncancel={() => expiredModal.close()}\r\n size=\"sm\"\r\n aria-labelledby=\"expired-modal-title\"\r\n >\r\n {#snippet body()}\r\n <div class=\"timer-modal\" id=\"expired-modal-description\">\r\n <div class=\"timer-modal-icon expired\">\r\n <ClockIcon size=\"32\" />\r\n </div>\r\n <h3\r\n id=\"expired-modal-title\"\r\n class=\"timer-modal-title type-subheading\"\r\n >\r\n {canExtend\r\n ? mergedLabels.wantToKeepTickets || 'Want to keep your tickets?'\r\n : mergedLabels.sessionExpired || 'Session expired'}\r\n </h3>\r\n <p class=\"timer-modal-text type-body\">\r\n {canExtend\r\n ? mergedLabels.sessionExpiredMessage ||\r\n 'Your checkout session has expired and your selected tickets have been released'\r\n : mergedLabels.reservationTimedOut ||\r\n 'Your reservation has timed out. Please select your tickets again to continue'}\r\n </p>\r\n </div>\r\n {/snippet}\r\n {#snippet footer()}\r\n <div class=\"timer-modal-actions\">\r\n {#if canExtend}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleExtendSession}\r\n disabled={isExtendingSession}\r\n loading={isExtendingSession}\r\n >\r\n {isExtendingSession\r\n ? mergedLabels.extendingSession || 'Extending...'\r\n : mergedLabels.keepMyTickets || 'Keep my tickets'}\r\n </Button>\r\n <Button\r\n variant=\"alternative\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleRetryExpired}\r\n >\r\n {mergedLabels.selectTicketsAgain || 'Select tickets again'}\r\n </Button>\r\n {:else}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleRetryExpired}\r\n >\r\n {mergedLabels.selectTicketsAgain || 'Select tickets again'}\r\n </Button>\r\n {/if}\r\n </div>\r\n {/snippet}\r\n </Modal>\r\n {/if}\r\n\r\n <!-- Event canceled / postponed mid-checkout (heartbeat flip). The buy button\r\n is already disabled (saleClosed); this explains why. Canceled is terminal;\r\n postponed is a softer \"sales paused\" message. The backend finalize gate\r\n (§2.13) is the no-charge guarantee — this is courtesy UX. -->\r\n {#if eventUnavailableModal.isOpen}\r\n <Modal\r\n open={true}\r\n oncancel={() => eventUnavailableModal.close()}\r\n size=\"sm\"\r\n aria-labelledby=\"sale-closed-modal-title\"\r\n >\r\n {#snippet body()}\r\n <div class=\"timer-modal\" id=\"sale-closed-modal-description\">\r\n <div class=\"timer-modal-icon expired\">\r\n <WarningTriIcon size=\"32\" />\r\n </div>\r\n <h3\r\n id=\"sale-closed-modal-title\"\r\n class=\"timer-modal-title type-subheading\"\r\n >\r\n {#if eventDead === 'canceled'}\r\n {mergedLabels.eventCanceledTitle || 'This event was cancelled'}\r\n {:else}\r\n {mergedLabels.eventPostponedTitle || 'Ticket sales are paused'}\r\n {/if}\r\n </h3>\r\n <p class=\"timer-modal-text type-body\">\r\n {#if eventDead === 'canceled'}\r\n {mergedLabels.eventCanceledMessage ||\r\n 'This event has been cancelled, so tickets are no longer for sale. You have not been charged'}\r\n {:else}\r\n {mergedLabels.eventPostponedMessage ||\r\n 'Ticket sales for this event have been paused. You have not been charged. Check back soon or contact the organizer'}\r\n {/if}\r\n </p>\r\n </div>\r\n {/snippet}\r\n {#snippet footer()}\r\n <div class=\"timer-modal-actions\">\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleRetryExpired}\r\n >\r\n {mergedLabels.backToEvents || 'Back to events'}\r\n </Button>\r\n </div>\r\n {/snippet}\r\n </Modal>\r\n {/if}\r\n</div>\r\n\r\n<style>\r\n /* Mobile order summary */\r\n .mobile-order-summary {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n }\r\n\r\n /* Timer modals */\r\n .timer-modal {\r\n text-align: center;\r\n padding: 0.5rem 0;\r\n }\r\n\r\n .timer-modal-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 3.5rem;\r\n height: 3.5rem;\r\n border-radius: 9999px;\r\n margin: 0 auto 1rem;\r\n }\r\n\r\n .timer-modal-icon.warning {\r\n background-color: hsl(var(--accent-warning) / 8%);\r\n color: hsl(var(--accent-warning));\r\n }\r\n\r\n .timer-modal-icon.expired {\r\n background-color: hsl(var(--accent-danger) / 5%);\r\n color: hsl(var(--accent-danger));\r\n }\r\n\r\n .timer-modal-title {\r\n margin-bottom: 0.5rem;\r\n }\r\n\r\n .timer-modal-text {\r\n color: hsl(var(--text-tertiary)); /* gray-500 */\r\n }\r\n\r\n .timer-modal-hint {\r\n color: hsl(var(--text-head)); /* gray-400 */\r\n margin-top: 0.5rem;\r\n }\r\n\r\n .timer-modal-actions {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 0.5rem;\r\n }\r\n /* The Button component's class=\"w-full\" is a Tailwind utility that\r\n isn't always emitted in the venue-calendar bundle (no scanner\r\n pass over node_modules), so force full width at the layout\r\n level. Applies to both <button> and the anchor variant. */\r\n .timer-modal-actions :global(button),\r\n .timer-modal-actions :global(a) {\r\n width: 100%;\r\n }\r\n</style>\r\n"],"names":["size","$","$$props","color","className","ctx","useIconWeight","resolved","svg","root_2","path","root","polyline","root_1","$$render","consequent","alternate","styles","createLogger","COOKIE_NAMES","asCookieName","parseCookies","acc","cookie","name","valueParts","getCookie","checked","indeterminate","value","disabled","inputEl","handleChange","colorClasses","colorClass","inputClasses","label","input","$$value","span","$$args","registry","backendSeq","backendIds","backendId","storage","id","registerStorageKey","descriptor","outer","inner","byBackend","existing","THEME_STORAGE_KEY","LEGACY_THEME_KEY","readLegacyTheme","raw","removeLegacyTheme","readThemeOverride","canonical","getLocalStorage","legacy","setLocalStorage","browser","detectDarkMode","containerSelector","saved","selector","containers","container","getStripeTheme","isDark","useStripeTheme","options","watchChanges","fallback","current","observer","mediaQuery","updateTheme","onMount","onDestroy","stripe","paymentIntent","elements","paymentError","labels","defaultLabels","stripeTheme","paymentMountDiv","paymentElement","mountedSecret","mountStripePayment","destroyStripePayment","firstName","lastName","email","keepUpdated","agreeTerms","cardNumber","cardExpiry","cardCvc","attendees","noPaymentRequired","submitted","errors","e","isEmailAddress","i","att","hasErrors","isTimerUrgent","totalTickets","sum","l","_","lastSubmitRequest","untrack","handleSubmit","handleSameAsPurchaser","index","a","div","root_11","div_1","Button","node","ChevronLeftIcon","$$anchor","CheckoutTimer","node_1","section","Heading","node_2","div_2","$3","Input","node_3","node_4","node_5","Checkbox","node_6","section_1","node_8","node_9","attendee","div_3","div_4","Text","node_10","node_11","div_5","div_6","node_12","node_13","node_14","section_2","node_7","div_7","node_16","div_8","node_17","node_18","div_9","fragment_10","p","root_3","consequent_2","p_1","consequent_3","p_2","root_5","consequent_4","node_22","p_3","node_23","node_24","div_10","node_25","node_26","consequent_1","consequent_6","alternate_1","section_3","node_27","a_1","text_14","div_11","root_10","WarningTriIcon","node_29","node_30","text_16","consequent_7","saleClosed","priceUnavailable","locale","Card","fragment_1","Image","PLACEHOLDER_IMAGE","CalendarIcon","formatEventTime","formatBrowseDate","text_3","OrderSummary","$0","$1","formatCurrency","toUSD","consequent_5","totalTicketCount","layers","logger","checkoutStateOptions","getShowcaseCheckoutStates","dataVariant","dataToggleStore","configProp","onPlaceOrderProp","onBackProp","onRetryExpiredProp","onExtendSessionProp","eventEnded","serverTotalsUnavailable","mergedLabels","getLabelsForLocale","isShowcaseMode","buildConfig","variant","mockFreeEvent","toTicketId","mockDonationEvent","mockRegistrationEvent","mockEvent","config","deadlineMs","timerSeconds","isExpired","processing","submitRequested","warningModal","createModalState","expiredModal","warningShown","isExtendingSession","remainingExtensions","canExtend","eventStatusDead","eventUnavailableModal","now","browserNow","clock","isEventEnded","isEventEndedShared","eventDead","WARNING_THRESHOLD","timerDisplay","m","s","orderTotals","lines","subtotal","roundCurrency","fees","promoDiscount","adjustedSubtotal","taxes","calculateTax","totalsLocked","isFreeOrder","isRegistration","timerInitialized","c","getCartIdFromCookie","recomputeFromDeadline","resyncDeadlineFromServer","cartId","status","getSessionStatus","toInstant","deadNow","tick","next","interval","onVisible","handleBack","requestPlaceOrder","handlePlaceOrder","formData","handleRetryExpired","handleExtendSession","result","ApiError","err","dismissWarning","LiveRegion","typography","fragment_3","CheckoutForm","text_6","CheckoutSidebar","CheckoutMobileFooter","Modal","div_12","root_4","div_13","h3","div_14","root_6","p_4","div_15","root_7","div_16","ClockIcon","h3_1","p_5","div_17","node_20","node_21","alternate_2","div_18","root_9","div_19","h3_2","alternate_3","p_6","consequent_8","alternate_4","div_20","consequent_9"],"mappings":";;;;;;;;;;;;;kBAAA;;AAmBE,MAAMA,IAAIC,EAAA,KAAAC,GAAA,QAAA,GAAG,IAAI,GAAEC,0BAAQ,cAAc,GAASC,0BAAY,EAAE;AAEhE,QAAMC,IAAMC,GAAa;AACzB,MAAIC,IAAoBN,EAAA,QAAA,MAAAC,EAAA,UAAsBG,GAAK,UAAU,SAAS;MAGvEG,IAAGC,GAAA;;kBAAHD,CAAG;;;UAUwBE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9BD,CAAE;AAUF,cAAAE,cAVAF,GAAE,CAAA,gBAUFE,CAAC;;;;2DAEGrG,CAAY,EAAC,wBACZ,6FAA6F,CAAA;;;2DAE9FA,CAAY,EAAC,yBACZ,mHAAmH,CAAA;;;AALlH,cAAAhO,EAAA,IAAA8P,EAAS,MAAK,aAAUjP,EAAAyT,EAAA,IAAAzT,EAAA0T,IAAA,EAAA;AAAA;;kBAD9BF,CAAC,WAdHL,CAAG,eAAHA,CAAG;AAAA;QAyBI,QAAM,CAAAjM,MAAA;cACbyM,IAAGpB,GAAA,eAAHoB,CAAG;AACD,UAAA5M,GAAMsD,GAAA;AAAA;;;qBAII+G;AAAA;;;0DAERjE,CAAY,EAAC,gBAAgB,gBAAgB,CAAA;;;sBAPjDwG,CAAG,eAAHA,CAAG;AAAA;;;;;AAlCL,MAAAhF,GAAsB,UAAM3O,EAAA4T,EAAA;AAAA;;UA7SlChN,CAAG,eAAHA,CAAG;AAFI;;;;;","x_google_ignoreList":[0,1,2,3,4,6]}
|
|
1
|
+
{"version":3,"file":"Checkout-C8kEhq77.js","sources":["../node_modules/@getmicdrop/svelte-components/dist/primitives/Icons/phosphor/ChevronLeftIcon.svelte","../node_modules/@getmicdrop/svelte-components/dist/cookies/cookies.js","../node_modules/@getmicdrop/svelte-components/dist/primitives/Checkbox/Checkbox.svelte","../node_modules/@getmicdrop/svelte-components/dist/utils/storage/registry.js","../node_modules/@getmicdrop/svelte-components/dist/utils/storage/themeStorage.js","../__SKIP_ENVIRONMENT__","../node_modules/@getmicdrop/svelte-components/dist/stripe/useStripeTheme.svelte.js","../src/lib/public-calendar-flow/CheckoutForm.svelte","../src/lib/public-calendar-flow/CheckoutSidebar.svelte","../src/lib/public-calendar-flow/CheckoutMobileFooter.svelte","../src/lib/public-calendar-flow/Checkout.svelte"],"sourcesContent":["<script lang=\"ts\">\r\n /**\r\n * ChevronLeft — Phosphor icon (canonical Micdrop icon family).\r\n * Outline by default; pass `weight=\"fill\"` for solid, or let a stateful parent\r\n * (NavItem / Tabs / BottomNav / status badge) drive it via icon-weight context.\r\n */\r\n import { useIconWeight, type IconWeight } from './iconWeight.js';\r\n\r\n interface Props {\r\n /** Pixel size (width + height). */\r\n size?: string;\r\n /** Icon color; defaults to `currentColor` (inherits text color). */\r\n color?: string;\r\n /** Extra classes. */\r\n class?: string;\r\n /** `regular` (outline) or `fill` (solid). Overrides ambient state weight. */\r\n weight?: IconWeight;\r\n }\r\n\r\n let { size = '24', color = 'currentColor', class: className = '', weight }: Props = $props();\r\n\r\n const ctx = useIconWeight();\r\n let resolved: IconWeight = $derived(weight ?? ctx?.weight ?? 'regular');\r\n</script>\r\n\r\n<svg\r\n class={className}\r\n aria-hidden=\"true\"\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 256 256\"\r\n fill=\"currentColor\"\r\n style:color={color === 'currentColor' ? undefined : color}\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n>\r\n {#if resolved === 'fill'}<path d=\"M163.06,40.61a8,8,0,0,0-8.72,1.73l-80,80a8,8,0,0,0,0,11.32l80,80A8,8,0,0,0,168,208V48A8,8,0,0,0,163.06,40.61Z\"/>{:else}<polyline points=\"160 208 80 128 160 48\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"16\"/>{/if}\r\n</svg>\r\n","/**\n * Cookies canonical — the ONE sanctioned surface for browser cookie access\n * across all four Micdrop apps. Lifts micdrop-frontend's typed cookies layer\n * (registry + per-event builders + HttpOnly diagnostic) onto svelte-components'\n * battle-tested `document.cookie` implementation.\n *\n * CANONICAL DESIGN DECISION (Atlas convergence — utility-cookies):\n * The runtime behaviour is **byte-identical to SC's pre-audit-09\n * `cookieHelpers.ts`** — `getCookie` returns `string | null` (not js-cookie's\n * `undefined`), `setCookie` takes the `{ maxAge, path }` options shape and\n * writes `document.cookie` with the `.get-micdrop.com` production-domain check\n * and hardcoded `samesite=lax`, `deleteCookie` sets `max-age=0`,\n * `setAuthCookies` / `clearAuthCookies` are unchanged. MF's *typing* layer\n * (the `COOKIE_NAMES` registry, the per-event templated name builders, the\n * HttpOnly write diagnostic, and the `getCookieStrict` variant) is folded in\n * around that behaviour. SC's exported function names keep resolving so no\n * consumer breaks. (Rubric: prevent bugs > no user-facing harm > consistency.)\n *\n * Reads NEVER throw on a missing cookie — `getCookie` returns `null`, matching\n * SC's historical contract. Use `getCookieStrict` when absence is a programmer\n * error (it throws `CookieError` with code `NOT_SET`).\n *\n * Names: prefer `COOKIE_NAMES.X` and the builder helpers over string literals\n * so renames stay atomic and typos surface at compile time — the read/write\n * surface is typed to `CookieName`, which only the registry + builders +\n * `toCookieName` mint.\n *\n * EVENT-SCOPED COOKIES ARE BUILDERS, NEVER REGISTRY ENTRIES. If a cookie holds\n * state a buyer built up on one event's checkout, its name carries the event id\n * and it lives below in the per-event builders, not in `COOKIE_NAMES`. The\n * registry is for app-wide singletons only. A per-event cookie registered as a\n * global key is how `checkout-promo-discount` leaked one event's discount onto\n * another event's total.\n *\n * @global-promo-cookie-escape: this file is the canonical that DEFINES the\n * per-event promo builders, and `clearLegacyGlobalPromoCookies` must name the\n * two pre-split global cookies in order to delete them. Every other file in\n * every repo is caught by `micdrop/no-global-promo-cookie` (R-STORAGE-10).\n */\nimport { CookieError } from '../errors/classes/CookieError.js';\nimport { asCookieName, toCookieName } from '../types/brands.js';\nimport { createLogger } from '../utils/logger.js';\nconst logger = createLogger('cookies');\n// ── Name registry ──────────────────────────────────────────────────────────\n/**\n * Registry of cookie names Micdrop apps read/write from JS.\n *\n * Covers the union of MF's `cookies.ts` registry and SC's pre-audit-09\n * `cookieHelpers.ts` literals. Prefer `COOKIE_NAMES.X` over raw strings so\n * renames are atomic and typos surface at compile time. Each entry is a\n * branded `CookieName` (minted via `asCookieName`), so values flow straight\n * into the read/write surface below without re-branding. For per-event\n * templated names (`checkout-promocode-${eventID}` etc.), use the builder\n * helpers below.\n */\nexport const COOKIE_NAMES = {\n // ── Operator (admin) auth — server-managed, HttpOnly ──\n // The server sets these on Set-Cookie; JS can read a presence shadow but\n // cannot write or delete them. Listed for type-safety in the client paths\n // that reference them.\n OPERATOR_TOKEN: asCookieName('operator_token'),\n REFRESH_TOKEN: asCookieName('refresh_token'),\n // ── Operator auth state (non-HttpOnly) ──\n TOKEN_EXPIRY: asCookieName('token_expiry'),\n ACTIVE_CONTEXT_ID: asCookieName('active_context_id'),\n // ── Performer (portal) auth — SC's cookieHelpers / performers-portal ──\n PERFORMER_TOKEN: asCookieName('performer_token'),\n PERFORMER_REFRESH_TOKEN: asCookieName('performer_refresh_token'),\n PERFORMER_TOKEN_EXPIRY: asCookieName('performer_token_expiry'),\n USER_DETAILS: asCookieName('userDetails'),\n SUPPRESSED_ALERTS: asCookieName('suppressedAlerts'),\n // ── Cart / checkout (non-templated) ──\n // NOTE: every *promo* cookie is per-event and lives behind a builder below.\n // There are deliberately no `CHECKOUT_PROMOCODE` / `CHECKOUT_PROMO_DISCOUNT`\n // entries here — see the per-event promo family for why a global discount\n // amount was a money bug.\n SESSION_ID: asCookieName('session_id'),\n CHECKOUT_CARTID: asCookieName('checkout-cartid'),\n // ── Browser-resolved IANA timezone, set by hooks.client on app init ──\n USER_TZ: asCookieName('user_tz'),\n // ── Shared cross-domain auth-expiry marker (unified login) ──\n // Written at `.get-micdrop.com` by the unified login so every Micdrop\n // subdomain (admin / portal / calendar) reads the same session expiry.\n // Cleared on logout via `clearCrossDomainCookie` — a host-only max-age=0\n // would leave the parent-domain copy alive.\n EXP: asCookieName('exp'),\n};\n/**\n * Cookies the server sets with HttpOnly. JS writes targeting these names are\n * effectively no-ops (the browser ignores `document.cookie =` writes that try\n * to overwrite an HttpOnly cookie). `setCookie` / `deleteCookie` emit a\n * dev-mode warning when one is targeted client-side — the historical bug was a\n * fake-delete of `operator_token` that silently did nothing. The fix is a\n * server endpoint that calls `cookies.delete()`.\n */\nconst HTTP_ONLY_COOKIES = new Set([\n COOKIE_NAMES.OPERATOR_TOKEN,\n COOKIE_NAMES.REFRESH_TOKEN,\n]);\nfunction warnIfHttpOnly(name, op, caller = `${op}Cookie`) {\n if (!HTTP_ONLY_COOKIES.has(name))\n return;\n logger.warn(`${caller}('${name}'): this cookie is HttpOnly; browsers ignore JS writes. ` +\n `Use a server endpoint (e.g. /api/auth/logout) that calls cookies.${op === 'set' ? 'set' : 'delete'}() instead.`);\n}\n// ── Per-event templated name builders ────────────────────────────────────────\n// Keep these as builders rather than raw template strings at call sites so\n// renames remain atomic. Each returns a branded `CookieName`.\n//\n// These are PURE NAME functions on purpose — they mint a string, they do not\n// read or write. That keeps them adoptable by every app regardless of its\n// cookie backend (venue-calendar drives js-cookie with `SameSite=None; Secure`\n// so promo cookies survive third-party iframe embeds; SC's own `setCookie`\n// hardcodes `samesite=lax`). The name is the canon; the write is the app's.\n/**\n * Reject a blank event id before it can mint a name.\n *\n * A per-event cookie built from an empty id collapses to a global cookie\n * (`checkout-promo-discount-` → shared by every event). That is precisely the\n * bug this family exists to prevent, so the builder throws rather than\n * silently returning a name that leaks state across events.\n */\nfunction requireEventID(eventID, builder) {\n if (typeof eventID !== 'string' || eventID.trim().length === 0) {\n throw CookieError.missingEventId(builder);\n }\n // Return the trimmed id, not the raw one: a padded `\" evt \"` would otherwise\n // mint a cookie name with spaces, and two callers passing `\"evt\"` vs `\" evt \"`\n // would land on different cookies for the same event.\n return eventID.trim();\n}\n/** `checkout-quantities-${eventID}` */\nexport const checkoutQuantitiesCookie = (eventID) => toCookieName(`checkout-quantities-${requireEventID(eventID, 'checkoutQuantitiesCookie')}`);\n/** `checkout-promocode-${eventID}` */\nexport const checkoutPromocodeCookie = (eventID) => toCookieName(`checkout-promocode-${requireEventID(eventID, 'checkoutPromocodeCookie')}`);\n/** `checkout-tickets-${eventID}` */\nexport const checkoutCartCookie = (eventID) => toCookieName(`checkout-tickets-${requireEventID(eventID, 'checkoutCartCookie')}`);\n/**\n * @deprecated Alias of {@link checkoutCartCookie} — MF named this builder\n * `checkoutTicketsCookie`. Kept so the lift is name-stable for MF consumers;\n * the canonical name is `checkoutCartCookie` (matches the proposal).\n */\nexport const checkoutTicketsCookie = checkoutCartCookie;\n// ── Per-event promo family ───────────────────────────────────────────────────\n// The applied-promo state a buyer builds up on ONE event's checkout. Every\n// member is scoped to that event.\n//\n// `checkout-promo-discount` used to be a single GLOBAL cookie while all four of\n// its siblings were per-event. A buyer who applied a promo on event A and then\n// opened event B's checkout read A's discount amount on B — the wrong total,\n// on a money path. There is no global variant here and no registry entry that\n// could mint one: the discount amount cannot be named without an event id.\n/** `checkout-promo-discount-${eventID}` — the applied discount amount. */\nexport const checkoutPromoDiscountCookie = (eventID) => toCookieName(`checkout-promo-discount-${requireEventID(eventID, 'checkoutPromoDiscountCookie')}`);\n/** `checkout-promo-discount-type-${eventID}` — e.g. `percentage` / `fixed`. */\nexport const checkoutPromoDiscountTypeCookie = (eventID) => toCookieName(`checkout-promo-discount-type-${requireEventID(eventID, 'checkoutPromoDiscountTypeCookie')}`);\n/** `checkout-promo-reveal-${eventID}` — whether the promo unhides hidden tickets. */\nexport const checkoutPromoRevealCookie = (eventID) => toCookieName(`checkout-promo-reveal-${requireEventID(eventID, 'checkoutPromoRevealCookie')}`);\n/** `checkout-promo-reveal-ids-${eventID}` — which ticket ids the promo unhides. */\nexport const checkoutPromoRevealIdsCookie = (eventID) => toCookieName(`checkout-promo-reveal-ids-${requireEventID(eventID, 'checkoutPromoRevealIdsCookie')}`);\n/**\n * Delete the pre-per-event global promo cookies — `checkout-promo-discount`\n * and `checkout-promocode`.\n *\n * Browsers that visited checkout before the per-event split still carry them.\n * Nothing reads them any more, so they are inert — but a stale money value\n * sitting in a cookie jar must not come back if an old bundle is ever served\n * from cache. Call once on checkout mount; it is idempotent and leaves every\n * `checkout-promo-*-${eventID}` cookie untouched.\n *\n * A pre-split browser may hold each name host-only (venue-calendar wrote them\n * via js-cookie with no domain) OR at the shared parent domain. Both shapes are\n * expired: a host-only `max-age=0` leaves a parent-domain copy alive and\n * vice-versa, so clearing one shape is not enough. SSR-safe (no-op with no\n * `document`).\n *\n * Delete this helper once no live browser can still hold those two cookies.\n */\nexport function clearLegacyGlobalPromoCookies() {\n if (typeof document === 'undefined')\n return;\n for (const name of ['checkout-promo-discount', 'checkout-promocode']) {\n const cookieName = toCookieName(name);\n // Host-only expiry (no domain) — clears the js-cookie-written copy in every\n // environment, including prod where `deleteCookie` would force a domain.\n document.cookie = `${cookieName}=; path=/; max-age=0`;\n // Parent-domain expiry (`.get-micdrop.com`) — clears the shared copy.\n clearCrossDomainCookie(cookieName);\n }\n}\n// ── Read / parse ──────────────────────────────────────────────────────────────\n/**\n * Parse all cookies into an object. SSR-safe (returns `{}` when `document` is\n * undefined). Behaviour is byte-identical to SC's pre-audit-09 `parseCookies`.\n */\nexport function parseCookies() {\n if (typeof document === 'undefined')\n return {};\n return document.cookie\n .split('; ')\n .reduce((acc, cookie) => {\n if (!cookie)\n return acc;\n const [name, ...valueParts] = cookie.split('=');\n acc[name] = decodeURIComponent(valueParts.join('='));\n return acc;\n }, {});\n}\n/**\n * Get a specific cookie value by name. Returns `null` for a missing value\n * (SC's historical contract — NOT js-cookie's `undefined`). Never throws.\n */\n// eslint-disable-next-line no-restricted-syntax -- this file IS the canonical getCookie; the rule points other call sites here\nexport function getCookie(name) {\n const cookies = parseCookies();\n return cookies[name] || null;\n}\n/**\n * Get a cookie value or throw if it is not set. Use when a missing cookie is a\n * programmer error rather than an expected state. Throws `CookieError` with\n * code `NOT_SET`.\n */\nexport function getCookieStrict(name) {\n const value = getCookie(name);\n if (value === null) {\n throw CookieError.notSet(name);\n }\n return value;\n}\n// ── Write / delete ────────────────────────────────────────────────────────────\n/**\n * Set a cookie. Behaviour is byte-identical to SC's pre-audit-09 `setCookie`:\n * encodes the value, derives the `.get-micdrop.com` production domain + `secure`\n * flag from `window.location`, hardcodes `samesite=lax`, defaults `path` to `/`.\n * Adds MF's HttpOnly-write diagnostic (a dev warning, no behaviour change).\n */\n// eslint-disable-next-line no-restricted-syntax -- this file IS the canonical setCookie; the rule points other call sites here\nexport function setCookie(name, value, options = {}) {\n warnIfHttpOnly(name, 'set');\n const isProd = typeof window !== 'undefined' &&\n window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n const secureAttr = typeof window !== 'undefined' && window.location.protocol === 'https:'\n ? 'secure;'\n : '';\n const maxAge = options.maxAge ? `max-age=${options.maxAge};` : '';\n const path = options.path || '/';\n document.cookie = `${name}=${encodeURIComponent(value)}; path=${path}; ${maxAge} ${domainAttr} ${secureAttr} samesite=lax`;\n}\n/**\n * Delete a cookie by name. Behaviour is byte-identical to SC's pre-audit-09\n * `deleteCookie`: SSR-safe no-op, sets `max-age=0` with the same domain/path\n * used by `setCookie` so the deletion takes effect on prod + dev. Adds MF's\n * HttpOnly-write diagnostic.\n */\nexport function deleteCookie(name, options = {}) {\n if (typeof document === 'undefined')\n return;\n warnIfHttpOnly(name, 'delete');\n const isProd = typeof window !== 'undefined' &&\n window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n const path = options.path || '/';\n document.cookie = `${name}=; path=${path}; max-age=0; ${domainAttr}`;\n}\n/**\n * Clear a cookie across the shared parent domain (cross-domain logout).\n *\n * Micdrop's auth cookies are written at the shared parent domain\n * `.get-micdrop.com` so one sign-out covers the admin / portal / calendar\n * subdomains. Expiring one needs a matching `domain=` on the `max-age=0` write:\n * a host-only clear leaves the parent-domain copy alive and the user\n * half-logged-out on the next subdomain. This is the canonical cross-domain\n * expiry — it writes exactly `<name>=; path=/; max-age=0; domain=<domain>;`,\n * the pattern the four apps hand-rolled at logout.\n *\n * Distinct from `deleteCookie`, which derives the domain from the prod hostname\n * and so writes NO domain in dev. Here the `domain` is written\n * UNCONDITIONALLY, defaulting to the shared parent `.get-micdrop.com`; pass an\n * explicit domain for a cookie scoped elsewhere. On a host the domain doesn't\n * match, the browser silently drops the write — non-destructive in dev. SSR-safe\n * (no-op when `document` is undefined) and never throws: a missing cookie is not\n * an error at logout.\n */\nexport function clearCrossDomainCookie(name, domain = '.get-micdrop.com') {\n if (typeof document === 'undefined')\n return;\n warnIfHttpOnly(name, 'delete', 'clearCrossDomainCookie');\n document.cookie = `${name}=; path=/; max-age=0; domain=${domain};`;\n}\n// ── Performer-token / details / alert helpers (SC pre-audit-09) ──────────────\n/** Get the performer token from cookies. */\nexport function getPerformerToken() {\n return getCookie(COOKIE_NAMES.PERFORMER_TOKEN);\n}\n/**\n * @deprecated R-STORAGE-07: the `userDetails` PII cookie has been removed.\n * Identity comes from `GET /api/auth/me` / the SSR profile, never from\n * `document.cookie`. Always returns null; retained only for API compatibility.\n */\nexport function getUserDetails() {\n return null;\n}\n/** Get suppressed alert IDs from cookies. Returns [] on miss / bad JSON. */\nexport function getSuppressedAlerts() {\n const alerts = getCookie(COOKIE_NAMES.SUPPRESSED_ALERTS);\n if (!alerts)\n return [];\n try {\n return JSON.parse(alerts);\n }\n catch {\n return [];\n }\n}\n/** Save suppressed alert IDs to cookies (1 year expiry). */\nexport function saveSuppressedAlerts(alertIds) {\n setCookie(COOKIE_NAMES.SUPPRESSED_ALERTS, JSON.stringify(alertIds), {\n maxAge: 31536000,\n });\n}\n// ── Auth cookie helpers (SC pre-audit-09 — LOAD-BEARING, byte-identical) ─────\n// SC's index.js exports `setAuthCookies` / `clearAuthCookies`; consumers rely\n// on the exact `document.cookie` writes below. Do NOT reroute these through\n// setCookie/deleteCookie — the raw writes (performer_token, userDetails,\n// performer_refresh_token, the 30-day max-age, the domain/secure derivation)\n// must stay identical.\n/**\n * Set authentication cookies with proper domain and security settings.\n *\n * SECURITY (R-STORAGE-07): this NO LONGER writes the `userDetails` PII cookie.\n * A `{firstName,lastName,email}` blob in a JS-readable cookie is XSS-extractable;\n * identity now comes from the cookie-authed `GET /api/auth/me` endpoint (or the\n * SSR profile), never from `document.cookie`. The `userDetails` param is retained\n * for signature compatibility but is intentionally ignored. The token cookies\n * (performer_token / performer_refresh_token) are unchanged.\n */\nexport function setAuthCookies(token, _userDetails, rememberMe = true, refreshToken = null) {\n void _userDetails; // R-STORAGE-07: never persist identity PII to document.cookie\n const isProd = window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n const secureAttr = window.location.protocol === 'https:' ? 'secure;' : '';\n const maxAge = rememberMe ? 'max-age=2592000;' : ''; // 30 days or session\n document.cookie = `performer_token=${token}; path=/; ${maxAge} ${domainAttr} ${secureAttr} samesite=lax`;\n if (refreshToken) {\n document.cookie = `performer_refresh_token=${refreshToken}; path=/; ${maxAge} ${domainAttr} ${secureAttr} samesite=lax`;\n }\n}\n/**\n * Clear authentication cookies.\n * Byte-identical to SC's pre-audit-09 `clearAuthCookies`.\n */\nexport function clearAuthCookies() {\n const isProd = window.location.hostname.includes('get-micdrop.com');\n const domainAttr = isProd ? 'domain=.get-micdrop.com;' : '';\n document.cookie = `userDetails=; path=/; max-age=0; ${domainAttr}`;\n document.cookie = `performer_token=; path=/; max-age=0; ${domainAttr}`;\n document.cookie = `performer_refresh_token=; path=/; max-age=0; ${domainAttr}`;\n}\n","<script lang=\"ts\">\r\n import type { Snippet } from 'svelte';\r\n\r\n interface Props {\r\n checked?: boolean;\r\n indeterminate?: boolean;\r\n value?: string;\r\n name?: string;\r\n disabled?: boolean;\r\n color?: 'blue' | 'red' | 'green' | 'purple' | 'orange' | 'yellow';\r\n class?: string;\r\n id?: string;\r\n 'aria-label'?: string;\r\n 'aria-labelledby'?: string;\r\n 'aria-describedby'?: string;\r\n // eslint-disable-next-line no-unused-vars -- intentionally retained (prop/slot/forward-compat or Svelte-5 reactive binding eslint cannot see)\r\n onchange?: (detail: { checked: boolean; value: string }) => void;\r\n onclick?: () => void;\r\n onfocus?: () => void;\r\n onblur?: () => void;\r\n // eslint-disable-next-line no-unused-vars -- intentionally retained (prop/slot/forward-compat or Svelte-5 reactive binding eslint cannot see)\r\n onkeydown?: (e: KeyboardEvent) => void;\r\n // eslint-disable-next-line no-unused-vars -- intentionally retained (prop/slot/forward-compat or Svelte-5 reactive binding eslint cannot see)\r\n onkeyup?: (e: KeyboardEvent) => void;\r\n children?: Snippet;\r\n }\r\n\r\n let {\r\n checked = $bindable(false),\r\n indeterminate = false,\r\n value = \"\",\r\n name = \"\",\r\n disabled = false,\r\n color = \"blue\",\r\n class: className = \"\",\r\n id,\r\n 'aria-label': ariaLabel,\r\n 'aria-labelledby': ariaLabelledBy,\r\n 'aria-describedby': ariaDescribedBy,\r\n onchange,\r\n onclick,\r\n onfocus,\r\n onblur,\r\n onkeydown,\r\n onkeyup,\r\n children,\r\n }: Props = $props();\r\n\r\n let inputEl = $state<HTMLInputElement>();\r\n // `indeterminate` is a DOM property, not a reflected HTML attribute,\r\n // so it has to be set imperatively after mount/update.\r\n $effect(() => {\r\n if (inputEl) inputEl.indeterminate = indeterminate;\r\n });\r\n\r\n function handleChange() {\r\n // Note: checked is already updated by bind:checked before this handler runs\r\n // We just need to call the onchange callback with the current values\r\n onchange?.({ checked, value });\r\n }\r\n\r\n const colorClasses = {\r\n blue: \"text-brand-primary\",\r\n red: \"text-accent-danger\",\r\n green: \"text-accent-success\",\r\n purple: \"text-brand-primary\",\r\n orange: \"text-accent-warning\",\r\n yellow: \"text-accent-warning\"\r\n };\r\n\r\n let colorClass = $derived(colorClasses[color] || colorClasses.blue);\r\n\r\n let inputClasses = $derived([\r\n \"w-4 h-4 shrink-0 rounded\",\r\n \"border-stroke-primary\",\r\n \"focus:outline-none focus:ring-0 focus:ring-offset-0 focus:shadow-none focus-visible:outline-none\",\r\n colorClass,\r\n disabled ? \"cursor-not-allowed opacity-50\" : \"cursor-pointer\"\r\n ].join(\" \"));\r\n</script>\r\n\r\n<!-- wrapping-pattern label: the <input> is nested inside this <label>, which\r\n associates them implicitly per the HTML spec. R-A11Y-16 can't see the wrap\r\n mechanically, so @label-no-for-escape: sanctions this specific label (the\r\n marker is line-scoped — it exempts only the <label> directly below it). -->\r\n<label\r\n class=\"inline-flex items-start gap-2 {disabled ? 'cursor-not-allowed' : 'cursor-pointer'} select-none {className}\"\r\n {id}\r\n>\r\n <input\r\n bind:this={inputEl}\r\n type=\"checkbox\"\r\n {name}\r\n {value}\r\n {disabled}\r\n bind:checked\r\n onchange={handleChange}\r\n {onclick}\r\n {onfocus}\r\n {onblur}\r\n {onkeydown}\r\n {onkeyup}\r\n aria-label={ariaLabel}\r\n aria-labelledby={ariaLabelledBy}\r\n aria-describedby={ariaDescribedBy}\r\n class={inputClasses}\r\n />\r\n {#if children}\r\n <span class=\"type-label tone-primary\">\r\n {@render children()}\r\n </span>\r\n {/if}\r\n</label>\r\n","/**\n * Storage key registry + canonical namespace (R-STORAGE-01/02/08).\n *\n * Every persisted key is colon-namespaced `micdrop:<feature>:<detail>` and\n * registered with its lifecycle flags so a single `clearAppStorageOnLogout()`\n * can walk the registry instead of every logout flow hand-clearing keys.\n */\nimport { ValueGuardError } from '../../errors/classes/ValueGuardError.js';\nimport { createStorageAccessor, } from './storage.js';\nconst NAMESPACE_RE = /^micdrop:[a-z0-9]+(:[a-z0-9-]+)+$/;\n/**\n * Build a canonical colon-namespaced storage key `micdrop:<feature>:<detail...>`\n * (R-STORAGE-02). Lowercases tokens and throws on empty / malformed segments so\n * a bad key fails at the builder, not silently at runtime.\n *\n * The guards throw `ValueGuardError` — the AppError branch for a primitive that\n * failed a fail-fast invariant at a data-trust boundary, the same branch\n * `DateTimeError` and the currency guards fold under. A caller catches one type\n * and branches on `code`, instead of scraping a bare Error's message.\n *\n * @example buildStorageKey('checkout', 'state', eventId) // micdrop:checkout:state:<id>\n * @throws {ValueGuardError} `STORAGE_KEY_INCOMPLETE` — fewer than two segments.\n * @throws {ValueGuardError} `STORAGE_KEY_NON_CANONICAL` — segments outside the namespace charset.\n */\nexport function buildStorageKey(feature, ...detail) {\n const segments = [feature, ...detail.map(String)]\n .map((s) => s.trim().toLowerCase())\n .filter((s) => s.length > 0);\n if (segments.length < 2) {\n throw new ValueGuardError(`buildStorageKey requires a feature and at least one detail segment (got: ${JSON.stringify([feature, ...detail])})`, 'STORAGE_KEY_INCOMPLETE', { details: { feature, detail } });\n }\n const key = `micdrop:${segments.join(':')}`;\n if (!NAMESPACE_RE.test(key)) {\n throw new ValueGuardError(`buildStorageKey produced a non-canonical key: \"${key}\"`, 'STORAGE_KEY_NON_CANONICAL', { details: { key } });\n }\n return key;\n}\n/** Whether a key matches the canonical `micdrop:<feature>:<detail>` namespace. */\nexport function isCanonicalStorageKey(key) {\n return NAMESPACE_RE.test(key);\n}\n/*\n * Two DIFFERENT injected backends can register the same (kind, key) — a fake in\n * one test, the real thing in another, or two live shims sharing a logical key.\n * Flattening them to one entry would let clearAppStorageOnLogout() wipe only the\n * last one registered and leave the other's data behind — a clearOnLogout flag\n * that silently lies. So each distinct injected backend earns a stable id and\n * gets its own entry.\n *\n * The registry is a nested map — `kind:key` → (`backendId` → descriptor) — NOT a\n * flat `kind:key:backendId` string. A flat string would let an arbitrary key\n * collide with a `(key, backendId)` concatenation: injected key `x` on backend\n * `#1` and window key `x#1` would hash to the same slot. `registerStorageKey`\n * does not enforce the canonical namespace (rememberedUser's key is legacy), so\n * that collision is reachable. Two map levels keep an arbitrary key from ever\n * touching a backend id. `kind` is a fixed two-value enum, so `kind:key` is\n * itself unambiguous.\n */\nconst registry = new Map();\nlet backendSeq = 0;\nconst backendIds = new WeakMap();\n/** Stable id for a backend: '' for the window backend, '#n' per injected shim. */\nfunction backendId(storage) {\n if (!storage)\n return '';\n let id = backendIds.get(storage);\n if (id === undefined) {\n backendSeq += 1;\n id = `#${backendSeq}`;\n backendIds.set(storage, id);\n }\n return id;\n}\n/**\n * Register a storage key + its lifecycle flags. Idempotent per (kind, key,\n * backend). Returns the key so a caller can `const K = registerStorageKey({...})`.\n *\n * Lifecycle/security flags ratchet up, never down: a re-registration of the same\n * (kind, key, backend) that omits `clearOnLogout` / `containsPII` must not strip\n * protection an earlier registration declared.\n */\nexport function registerStorageKey(descriptor) {\n const outer = `${descriptor.kind}:${descriptor.key}`;\n const inner = backendId(descriptor.storage);\n let byBackend = registry.get(outer);\n if (!byBackend) {\n byBackend = new Map();\n registry.set(outer, byBackend);\n }\n const existing = byBackend.get(inner);\n byBackend.set(inner, existing\n ? {\n ...descriptor,\n clearOnLogout: existing.clearOnLogout || descriptor.clearOnLogout,\n containsPII: existing.containsPII || descriptor.containsPII,\n }\n : descriptor);\n return descriptor.key;\n}\n/** Read-only snapshot of all registered descriptors. */\nexport function getStorageRegistry() {\n const descriptors = [];\n for (const byBackend of registry.values()) {\n for (const descriptor of byBackend.values())\n descriptors.push(descriptor);\n }\n return descriptors;\n}\n/**\n * Clear every registered key flagged `clearOnLogout` (R-STORAGE-08). The single\n * canonical logout cleanup — logout flows call this instead of inline clears,\n * so a new persisted key is wiped on logout the moment it declares the flag.\n */\nexport function clearAppStorageOnLogout(options = {}) {\n for (const byBackend of registry.values()) {\n for (const descriptor of byBackend.values()) {\n if (!descriptor.clearOnLogout)\n continue;\n if (options.onlyKey && descriptor.key !== options.onlyKey)\n continue;\n // Clear the key where it actually lives: an injected backend if one was\n // registered, otherwise the `window` backend named by `kind`.\n createStorageAccessor(descriptor.storage ?? descriptor.kind).remove(descriptor.key);\n }\n }\n}\n","/**\n * Theme persistence onto the storage canonical (`micdrop:ui:theme`).\n *\n * The theme override is TRINARY: an explicit `'light'` / `'dark'` choice, or its\n * ABSENCE meaning \"auto — follow the system preference\". Absence is load-bearing:\n * removing the key is how `DarkModeToggle` expresses auto mode, so this layer\n * stores ONLY explicit choices and treats a missing key as auto. It never\n * writes a sentinel for auto.\n *\n * Encoding: the storage canonical JSON-codes every value, so the explicit\n * override is persisted JSON-coded (`\"dark\"`) under the canonical key and read\n * back through `getLocalStorage` like any other canonical value.\n *\n * Legacy migration (the codex trap): before the canonical existed, all three\n * theme consumers read/wrote a bare un-namespaced `\"theme\"` key holding a PLAIN\n * string (`dark` / `light`), NOT JSON. That legacy value is unreadable through\n * `getLocalStorage` because `JSON.parse('dark')` throws and falls back to null.\n * `readThemeOverride()` therefore one-time-adopts a legacy bare value into the\n * canonical key (JSON-coded) and deletes the legacy key, so existing users keep\n * their exact theme with zero visual change. The read goes through the shared\n * helper, so whichever of the three consumers mounts first performs the adoption.\n */\nimport { getLocalStorage, setLocalStorage, removeLocalStorage, } from './storage.js';\nimport { registerStorageKey } from './registry.js';\n/**\n * Canonical key for the persisted theme override. Registered (not\n * clearOnLogout — a theme preference outlives the session, matching the\n * pre-canonical behavior where the bare `theme` key was never logout-cleared).\n */\nexport const THEME_STORAGE_KEY = registerStorageKey({\n key: 'micdrop:ui:theme',\n kind: 'local',\n});\n/** Pre-canonical bare key. Held a PLAIN string (`dark` / `light`), not JSON. */\nconst LEGACY_THEME_KEY = 'theme';\n/** Read the legacy bare `theme` value (plain string), SSR/private-mode safe. */\nfunction readLegacyTheme() {\n if (typeof window === 'undefined')\n return null;\n let raw;\n try {\n raw = window.localStorage.getItem(LEGACY_THEME_KEY);\n }\n catch {\n return null;\n }\n return raw === 'dark' || raw === 'light' ? raw : null;\n}\n/** Best-effort removal of the legacy bare key after adoption. */\nfunction removeLegacyTheme() {\n if (typeof window === 'undefined')\n return;\n try {\n window.localStorage.removeItem(LEGACY_THEME_KEY);\n }\n catch {\n // best-effort — removal must never throw\n }\n}\n/**\n * Read the explicit theme override, or `null` for \"auto / follow system\".\n *\n * One-time-migrates a legacy bare `theme` value into the canonical key and\n * deletes the legacy key. Idempotent: once migrated, subsequent calls just read\n * the canonical key. Canonical value always wins over a stale legacy key.\n */\nexport function readThemeOverride() {\n const canonical = getLocalStorage(THEME_STORAGE_KEY);\n const legacy = readLegacyTheme();\n if (canonical === 'dark' || canonical === 'light') {\n // Canonical wins; retire any stale legacy bare key still hanging around.\n if (legacy)\n removeLegacyTheme();\n return canonical;\n }\n if (legacy) {\n // Adopt the legacy choice into the canonical key, then drop the bare key.\n setLocalStorage(THEME_STORAGE_KEY, legacy);\n removeLegacyTheme();\n return legacy;\n }\n return null;\n}\n/** Persist an explicit theme override (`'light'` / `'dark'`). */\nexport function writeThemeOverride(theme) {\n setLocalStorage(THEME_STORAGE_KEY, theme);\n}\n/** Clear the override — back to auto / follow system. Also drops the legacy key. */\nexport function clearThemeOverride() {\n removeLocalStorage(THEME_STORAGE_KEY);\n removeLegacyTheme();\n}\n","\n export const browser = typeof window !== 'undefined';\n export const dev = false;\n export const building = false;\n export const version = '';\n ","/**\n * Stripe Theme Utility\n *\n * Provides reactive dark mode detection for Stripe Elements.\n * Automatically watches for theme changes via MutationObserver.\n *\n * @example\n * ```svelte\n * <script>\n * import { useStripeTheme } from '@getmicdrop/svelte-components/stripe';\n *\n * const stripeTheme = useStripeTheme();\n * // stripeTheme.current is 'stripe' | 'night'\n * // Automatically updates when theme changes\n * </script>\n *\n * <Elements theme={stripeTheme.current} {stripe} clientSecret={paymentIntent}>\n * <PaymentElement />\n * </Elements>\n * ```\n */\nimport { onMount, onDestroy } from 'svelte';\nimport { readThemeOverride } from '../utils/storage/index.js';\n/**\n * Detects if dark mode is active.\n *\n * Checks in order:\n * 1. localStorage 'theme' value\n * 2. Container element classes (.dark, [data-theme=\"dark\"])\n * 3. System preference (prefers-color-scheme)\n */\nexport function detectDarkMode(containerSelector) {\n if (typeof window === 'undefined')\n return false;\n try {\n // Check the persisted theme override first (auto/system → null).\n const saved = readThemeOverride();\n if (saved === 'dark')\n return true;\n if (saved === 'light')\n return false;\n // Check for data-theme on common containers\n const selector = containerSelector || '[data-theme=\"dark\"], [data-theme=\"light\"], .micdrop, [data-theme]';\n const containers = document.querySelectorAll(selector);\n for (const container of containers) {\n if (container.getAttribute('data-theme') === 'dark')\n return true;\n }\n // Check document root\n if (document.documentElement.getAttribute('data-theme') === 'dark')\n return true;\n // Fallback to system preference\n return window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;\n }\n catch {\n return false;\n }\n}\n/**\n * Maps dark mode state to Stripe theme.\n */\nexport function getStripeTheme(isDark) {\n return isDark ? 'night' : 'stripe';\n}\n/**\n * Creates a reactive Stripe theme that watches for dark mode changes.\n *\n * Returns an object with a `current` property that is reactive and\n * automatically updates when the theme changes.\n *\n * @example\n * ```svelte\n * <script>\n * import { useStripeTheme } from '@getmicdrop/svelte-components/stripe';\n * const stripeTheme = useStripeTheme();\n * </script>\n *\n * <Elements theme={stripeTheme.current} ...>\n * ```\n */\nexport function useStripeTheme(options = {}) {\n const { containerSelector = '[data-theme=\"dark\"], [data-theme=\"light\"], .micdrop, [data-theme]', watchChanges = true, fallback = 'stripe', } = options;\n let current = $state(fallback);\n let observer = null;\n let mediaQuery = null;\n function updateTheme() {\n current = getStripeTheme(detectDarkMode(containerSelector));\n }\n onMount(() => {\n // Initial detection\n updateTheme();\n if (watchChanges && typeof MutationObserver !== 'undefined') {\n // Watch for class changes on potential theme containers\n const containers = document.querySelectorAll(containerSelector);\n const root = document.documentElement;\n observer = new MutationObserver(() => {\n updateTheme();\n });\n // Observe document root\n observer.observe(root, {\n attributes: true,\n attributeFilter: ['class', 'data-theme'],\n });\n // Observe other containers\n containers.forEach(container => {\n observer?.observe(container, {\n attributes: true,\n attributeFilter: ['class', 'data-theme'],\n });\n });\n // Also listen for system preference changes. Kept on the closure scope\n // so onDestroy can remove it — otherwise the listener (and the closure it\n // holds, including this instance's $state) leaks on every unmount.\n mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n mediaQuery.addEventListener('change', updateTheme);\n }\n });\n onDestroy(() => {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n if (mediaQuery) {\n mediaQuery.removeEventListener('change', updateTheme);\n mediaQuery = null;\n }\n });\n return {\n get current() {\n return current;\n },\n /** Force refresh the theme detection */\n refresh: updateTheme,\n };\n}\n/**\n * Simple synchronous dark mode detection without reactivity.\n * Use this when you only need a one-time check.\n */\nexport function getInitialStripeTheme(containerSelector) {\n return getStripeTheme(detectDarkMode(containerSelector));\n}\n","<script lang=\"ts\">\r\n import { defaultLabels } from '$lib/public-calendar-flow/i18n/labels.js';\r\n import { onDestroy, untrack } from 'svelte';\r\n import { browser } from '$app/environment';\r\n import {\r\n ChevronLeftIcon,\r\n WarningTriIcon,\r\n } from '@getmicdrop/svelte-components/primitives/Icons/phosphor/index.js';\r\n import {\r\n Button,\r\n Heading,\r\n Text,\r\n Input,\r\n Checkbox,\r\n isEmailAddress,\r\n } from '@getmicdrop/svelte-components';\r\n import { useStripeTheme } from '@getmicdrop/svelte-components/stripe';\r\n import type {\r\n EventData,\r\n OrderTotals,\r\n CheckoutFormData,\r\n } from '$lib/public-calendar-flow/types';\r\n import CheckoutTimer from './CheckoutTimer.svelte';\r\n\r\n interface Props {\r\n event: EventData;\r\n orderTotals: OrderTotals;\r\n timerSeconds: number;\r\n isExpired: boolean;\r\n isRegistration: boolean;\r\n isFreeOrder: boolean;\r\n promoApplied: boolean;\r\n promoDiscount: number;\r\n onBack: () => void;\r\n onPlaceOrder: (_formData: CheckoutFormData) => void;\r\n processing: boolean;\r\n /** Incremented by parent to trigger form validation + submit from external buttons (sidebar, mobile footer) */\r\n submitRequested: number;\r\n /** Stripe instance for production mode (absence = showcase mock inputs) */\r\n stripe?: any;\r\n /** Stripe client secret for PaymentElement */\r\n paymentIntent?: string;\r\n /** Bindable Stripe elements reference for the wrapper to use during payment confirmation */\r\n elements?: any;\r\n /** Payment error message from the wrapper */\r\n paymentError?: string;\r\n labels?: Record<string, string>;\r\n }\r\n\r\n let {\r\n event: _event,\r\n orderTotals,\r\n timerSeconds,\r\n isExpired: _isExpired,\r\n isRegistration,\r\n isFreeOrder,\r\n promoApplied: _promoApplied,\r\n promoDiscount: _promoDiscount,\r\n onBack,\r\n onPlaceOrder,\r\n processing: _processing,\r\n submitRequested,\r\n stripe = undefined,\r\n paymentIntent = undefined,\r\n elements = $bindable(undefined),\r\n paymentError = '',\r\n labels = defaultLabels,\r\n }: Props = $props();\r\n\r\n // Use direct Stripe.js API instead of svelte-stripe (Svelte 5 compatibility bug).\r\n const stripeTheme = browser\r\n ? useStripeTheme()\r\n : { current: 'stripe' as const };\r\n let paymentMountDiv = $state<HTMLElement | null>(null);\r\n let paymentElement: any = null;\r\n // Track which client secret the mounted element is bound to. Re-mounting only\r\n // the Stripe element (not the whole CheckoutForm) when the PaymentIntent changes\r\n // lets a partial gift card swap in a reduced-amount PI WITHOUT wiping the\r\n // buyer's typed name/email/attendee fields (the {#key} approach remounted the\r\n // entire form and blanked them).\r\n let mountedSecret = $state<string | null>(null);\r\n\r\n function mountStripePayment() {\r\n if (!browser || !stripe || !paymentIntent || !paymentMountDiv) return;\r\n // Tear down any element bound to a stale secret before re-creating.\r\n if (paymentElement) {\r\n try {\r\n paymentElement.destroy();\r\n } catch (_) {\r\n // ignore\r\n }\r\n paymentElement = null;\r\n }\r\n elements = stripe.elements({\r\n clientSecret: paymentIntent,\r\n appearance: { theme: stripeTheme.current },\r\n });\r\n paymentElement = elements.create('payment');\r\n paymentElement.mount(paymentMountDiv);\r\n mountedSecret = paymentIntent;\r\n }\r\n\r\n function destroyStripePayment() {\r\n if (paymentElement) {\r\n try {\r\n paymentElement.destroy();\r\n } catch (_) {\r\n // ignore\r\n }\r\n paymentElement = null;\r\n }\r\n mountedSecret = null;\r\n }\r\n\r\n $effect(() => {\r\n // (Re)mount whenever the PaymentIntent secret changes — initial mount, or a\r\n // new reduced-amount PI after a partial gift card is applied.\r\n if (\r\n stripe &&\r\n paymentIntent &&\r\n paymentMountDiv &&\r\n paymentIntent !== mountedSecret\r\n ) {\r\n mountStripePayment();\r\n } else if ((!stripe || !paymentIntent) && mountedSecret) {\r\n // No longer needs Stripe (e.g. a gift card now fully covers the order, so\r\n // the wrapper cleared stripe/paymentIntent and the payment section is\r\n // hidden) — tear down the mounted element instead of orphaning the iframe.\r\n destroyStripePayment();\r\n }\r\n });\r\n\r\n // Re-skin Stripe Elements when the theme changes (data-theme toggle).\r\n $effect(() => {\r\n if (mountedSecret && elements && stripeTheme.current) {\r\n try {\r\n elements.update({ appearance: { theme: stripeTheme.current } });\r\n } catch (_) {\r\n // Stripe Elements is finicky about post-mount updates; ignore.\r\n }\r\n }\r\n });\r\n\r\n onDestroy(() => {\r\n if (paymentElement) {\r\n paymentElement.destroy();\r\n paymentElement = null;\r\n }\r\n mountedSecret = null;\r\n });\r\n\r\n // --- Form state ---\r\n let firstName = $state('');\r\n let lastName = $state('');\r\n let email = $state('');\r\n let keepUpdated = $state(false);\r\n let agreeTerms = $state(false);\r\n\r\n // Payment fields (mock)\r\n let cardNumber = $state('');\r\n let cardExpiry = $state('');\r\n let cardCvc = $state('');\r\n\r\n // Per-ticket attendee fields (for registration events)\r\n let attendees = $state<\r\n Array<{\r\n firstName: string;\r\n lastName: string;\r\n email: string;\r\n sameAsPurchaser: boolean;\r\n }>\r\n >([]);\r\n\r\n // No Stripe charge is needed when the order is free OR fully covered by a gift\r\n // card (total 0 but subtotal > 0, so isFreeOrder alone is false). In both cases\r\n // we must NOT render/validate the showcase mock-card inputs — otherwise a\r\n // fully-gift-card-covered order can't be submitted (the wrapper routes it to\r\n // executeGiftCardOnlyPurchase once onPlaceOrder fires).\r\n let noPaymentRequired = $derived(isFreeOrder || orderTotals.total === 0);\r\n\r\n // Validation state\r\n let submitted = $state(false);\r\n let errors = $derived(\r\n (() => {\r\n if (!submitted) return {};\r\n const e: Record<string, string> = {};\r\n if (!firstName.trim())\r\n e.firstName = labels.firstNameRequired || 'First name is required';\r\n if (!lastName.trim())\r\n e.lastName = labels.lastNameRequired || 'Last name is required';\r\n if (!email.trim()) e.email = labels.emailRequired || 'Email is required';\r\n else if (!isEmailAddress(email))\r\n e.email = labels.emailInvalid || 'Enter a valid email address';\r\n if (!noPaymentRequired && !stripe && !paymentError) {\r\n // Only validate mock card fields in showcase mode (Stripe absent AND a\r\n // real balance is due — not free / not fully gift-card covered). When\r\n // paymentError is set the mock form isn't rendered (a real config\r\n // failure), so don't demand card fields that aren't on screen — the\r\n // handleSubmit guard below blocks the order instead.\r\n if (!cardNumber.trim())\r\n e.cardNumber = labels.cardNumberRequired || 'Card number is required';\r\n if (!cardExpiry.trim())\r\n e.cardExpiry = labels.expiryRequired || 'Expiry date is required';\r\n if (!cardCvc.trim())\r\n e.cardCvc = labels.cvcRequired || 'CVC is required';\r\n }\r\n if (!agreeTerms)\r\n e.agreeTerms = labels.mustAgreeTerms || 'You must agree to the terms';\r\n\r\n // Validate attendee fields for registration events\r\n if (isRegistration) {\r\n for (let i = 0; i < attendees.length; i++) {\r\n const att = attendees[i];\r\n if (!att.sameAsPurchaser) {\r\n if (!att.firstName.trim())\r\n e[`attendee_${i}_firstName`] = 'First name is required';\r\n if (!att.lastName.trim())\r\n e[`attendee_${i}_lastName`] = 'Last name is required';\r\n if (!att.email.trim())\r\n e[`attendee_${i}_email`] =\r\n labels.emailRequired || 'Email is required';\r\n else if (!isEmailAddress(att.email))\r\n e[`attendee_${i}_email`] =\r\n labels.emailInvalidShort || 'Enter a valid email';\r\n }\r\n }\r\n }\r\n\r\n return e;\r\n })()\r\n );\r\n\r\n let hasErrors = $derived(Object.keys(errors).length > 0);\r\n\r\n let isTimerUrgent = $derived(timerSeconds > 0 && timerSeconds <= 120);\r\n\r\n // Initialize attendee list based on order lines\r\n $effect(() => {\r\n if (isRegistration) {\r\n const totalTickets = orderTotals.lines.reduce(\r\n (sum, l) => sum + l.quantity,\r\n 0\r\n );\r\n if (attendees.length !== totalTickets) {\r\n attendees = Array.from({ length: totalTickets }, (_, i) => ({\r\n firstName: '',\r\n lastName: '',\r\n email: '',\r\n sameAsPurchaser: i === 0,\r\n }));\r\n }\r\n }\r\n });\r\n\r\n // Watch for external submit requests (from sidebar/mobile footer buttons).\r\n // Seed the high-water mark from the CURRENT parent counter, not 0: parent's\r\n // `submitRequested` is monotonic and never reset (it must not be — resetting it\r\n // independently of this mark is the VC#345 swallowed-retry desync). If this form\r\n // ever remounts while the parent counter is already > 0 (a future {#key}, route\r\n // shell swap, or recovery path), a 0-seed would make `submitRequested > 0` true\r\n // on mount and fire a submit with no buyer click. Seeding from the live value\r\n // means only a NEW increment — a real click — ever triggers handleSubmit.\r\n let lastSubmitRequest = $state(untrack(() => submitRequested));\r\n $effect(() => {\r\n if (submitRequested > lastSubmitRequest) {\r\n lastSubmitRequest = submitRequested;\r\n handleSubmit();\r\n }\r\n });\r\n\r\n function handleSameAsPurchaser(index: number, checked: boolean) {\r\n attendees = attendees.map((att, i) => {\r\n if (i !== index) return att;\r\n return {\r\n ...att,\r\n sameAsPurchaser: checked,\r\n firstName: checked ? firstName : att.firstName,\r\n lastName: checked ? lastName : att.lastName,\r\n email: checked ? email : att.email,\r\n };\r\n });\r\n }\r\n\r\n function handleSubmit() {\r\n submitted = true;\r\n if (hasErrors) return;\r\n // A real balance is due but Stripe could not initialize (no publishable key\r\n // / payment config broken) — refuse to submit rather than post an order that\r\n // can never be charged. The payment section already shows paymentError.\r\n if (paymentError && !noPaymentRequired) return;\r\n onPlaceOrder({\r\n firstName,\r\n lastName,\r\n email,\r\n keepMeUpdated: keepUpdated,\r\n attendees: isRegistration\r\n ? attendees.map(a => ({\r\n firstName: a.sameAsPurchaser ? firstName : a.firstName,\r\n lastName: a.sameAsPurchaser ? lastName : a.lastName,\r\n email: a.sameAsPurchaser ? email : a.email,\r\n sameAsPurchaser: a.sameAsPurchaser,\r\n }))\r\n : undefined,\r\n });\r\n }\r\n</script>\r\n\r\n<!-- Form sits on a Boxes (surface-secondary) panel, not the page Background, so\r\n form controls — especially the bare Checkbox boxes — keep a consistent,\r\n readable surface on any themed scheme (matches the order-summary sidebar\r\n Card). The timer-header was already built to be this panel's flush header\r\n (it bleeds to the edges and rounds only its top). -->\r\n<div class=\"checkout-form-panel space-y-6 bg-surface-secondary border-default\">\r\n <!-- Timer header bar -->\r\n <div class=\"timer-header border-default bg-surface-secondary\">\r\n <Button\r\n variant=\"icon\"\r\n size=\"icon-sm\"\r\n onclick={onBack}\r\n aria-label={labels.goBack || 'Go back'}\r\n >\r\n <ChevronLeftIcon size=\"20\" />\r\n </Button>\r\n <CheckoutTimer seconds={timerSeconds} isUrgent={isTimerUrgent} {labels} />\r\n </div>\r\n\r\n <!-- Personal details -->\r\n <section class=\"space-y-4\">\r\n <Heading level={2} size=\"lg\" weight=\"semibold\">\r\n {labels.yourDetails || 'Your details'}\r\n </Heading>\r\n\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\r\n <Input\r\n label={labels.firstName || 'First name'}\r\n placeholder={labels.firstName || 'First name'}\r\n required\r\n bind:value={firstName}\r\n errorText={errors.firstName ?? ''}\r\n color={errors.firstName ? 'red' : 'base'}\r\n />\r\n <Input\r\n label={labels.lastName || 'Last name'}\r\n placeholder={labels.lastName || 'Last name'}\r\n required\r\n bind:value={lastName}\r\n errorText={errors.lastName ?? ''}\r\n color={errors.lastName ? 'red' : 'base'}\r\n />\r\n </div>\r\n\r\n <Input\r\n label={labels.emailAddress || 'Email address'}\r\n type=\"email\"\r\n placeholder={labels.emailPlaceholder || 'you@example.com'}\r\n required\r\n bind:value={email}\r\n errorText={errors.email ?? ''}\r\n color={errors.email ? 'red' : 'base'}\r\n />\r\n\r\n <Checkbox bind:checked={keepUpdated}>\r\n {labels.keepMeUpdated ||\r\n 'Keep me updated about this event and similar events'}\r\n </Checkbox>\r\n </section>\r\n\r\n <!-- Per-ticket attendee details (registration events) -->\r\n {#if isRegistration && attendees.length > 0}\r\n <section class=\"space-y-5\">\r\n <Heading level={2} size=\"lg\" weight=\"semibold\">\r\n {labels.attendeeDetails || 'Attendee details'}\r\n </Heading>\r\n\r\n {#each attendees as attendee, i (i)}\r\n <div class=\"attendee-card border-default bg-surface-secondary\">\r\n <div class=\"flex items-center justify-between mb-3\">\r\n <Text size=\"sm\" weight=\"semibold\">\r\n {labels.attendee || 'Attendee'}\r\n {i + 1}\r\n </Text>\r\n <Checkbox\r\n checked={attendee.sameAsPurchaser}\r\n onchange={({ checked }) => handleSameAsPurchaser(i, checked)}\r\n >\r\n {labels.sameAsPurchaser || 'Same as purchaser'}\r\n </Checkbox>\r\n </div>\r\n\r\n <div class=\"space-y-3\">\r\n <div class=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\r\n <Input\r\n label={labels.firstName || 'First name'}\r\n placeholder={labels.firstName || 'First name'}\r\n required\r\n disabled={attendee.sameAsPurchaser}\r\n bind:value={attendee.firstName}\r\n errorText={!attendee.sameAsPurchaser\r\n ? (errors[`attendee_${i}_firstName`] ?? '')\r\n : ''}\r\n color={!attendee.sameAsPurchaser &&\r\n errors[`attendee_${i}_firstName`]\r\n ? 'red'\r\n : 'base'}\r\n />\r\n <Input\r\n label={labels.lastName || 'Last name'}\r\n placeholder={labels.lastName || 'Last name'}\r\n required\r\n disabled={attendee.sameAsPurchaser}\r\n bind:value={attendee.lastName}\r\n errorText={!attendee.sameAsPurchaser\r\n ? (errors[`attendee_${i}_lastName`] ?? '')\r\n : ''}\r\n color={!attendee.sameAsPurchaser &&\r\n errors[`attendee_${i}_lastName`]\r\n ? 'red'\r\n : 'base'}\r\n />\r\n </div>\r\n <Input\r\n label={labels.email || 'Email'}\r\n type=\"email\"\r\n placeholder={labels.attendeeEmailPlaceholder ||\r\n 'attendee@example.com'}\r\n required\r\n disabled={attendee.sameAsPurchaser}\r\n bind:value={attendee.email}\r\n errorText={!attendee.sameAsPurchaser\r\n ? (errors[`attendee_${i}_email`] ?? '')\r\n : ''}\r\n color={!attendee.sameAsPurchaser && errors[`attendee_${i}_email`]\r\n ? 'red'\r\n : 'base'}\r\n />\r\n </div>\r\n </div>\r\n {/each}\r\n </section>\r\n {/if}\r\n\r\n <!-- Payment section -->\r\n <section class=\"space-y-4\">\r\n {#if noPaymentRequired}\r\n <div class=\"free-order-notice border-default bg-surface-secondary\">\r\n <Text size=\"sm\" color=\"secondary\" weight=\"medium\" class=\"block\">\r\n {labels.noPaymentRequired || 'No payment required'}\r\n </Text>\r\n <div class=\"mt-1\">\r\n <Text size=\"xs\" color=\"muted\" class=\"block\">\r\n {labels.freeEventMessage ||\r\n 'This is a free event. Complete the form above to reserve your spot'}\r\n </Text>\r\n </div>\r\n </div>\r\n {:else if stripe && paymentIntent}\r\n <!-- Production: Real Stripe PaymentElement -->\r\n <Heading level={2} size=\"lg\" weight=\"semibold\"\r\n >{labels.payment || 'Payment'}</Heading\r\n >\r\n {#if browser}\r\n <div bind:this={paymentMountDiv}></div>\r\n {#if !mountedSecret}\r\n <p class=\"type-body text-color-muted py-2\">\r\n {labels.loadingPaymentForm || 'Loading secure payment form...'}\r\n </p>\r\n {/if}\r\n {:else}\r\n <p class=\"type-body text-color-muted py-2\">\r\n {labels.loadingPaymentForm || 'Loading secure payment form...'}\r\n </p>\r\n {/if}\r\n {#if paymentError}\r\n <p class=\"type-body text-accent-danger mt-2\">{paymentError}</p>\r\n {/if}\r\n {:else if paymentError}\r\n <!-- Real checkout where Stripe could not initialize — most often the venue\r\n has no publishable key configured. Show the error and NO card form:\r\n the mock inputs in the next branch are a dev-showcase affordance that\r\n cannot take a real payment, so presenting them here would mislead the\r\n buyer into thinking they can pay (handleSubmit also refuses to submit). -->\r\n <Heading level={2} size=\"lg\" weight=\"semibold\"\r\n >{labels.payment || 'Payment'}</Heading\r\n >\r\n <p class=\"type-body text-accent-danger mt-2\">{paymentError}</p>\r\n {:else}\r\n <!-- Showcase/dev only (Stripe absent BY DESIGN, with no payment-config\r\n error). Not reached in a real checkout: a missing publishable key sets\r\n paymentError and routes to the branch above. -->\r\n <Heading level={2} size=\"lg\" weight=\"semibold\"\r\n >{labels.payment || 'Payment'}</Heading\r\n >\r\n\r\n <Input\r\n label={labels.cardNumber || 'Card number'}\r\n placeholder={labels.cardPlaceholder || '4242 4242 4242 4242'}\r\n type=\"creditCardNumber\"\r\n required\r\n bind:value={cardNumber}\r\n errorText={errors.cardNumber ?? ''}\r\n color={errors.cardNumber ? 'red' : 'base'}\r\n />\r\n\r\n <div class=\"grid grid-cols-2 gap-4\">\r\n <Input\r\n label={labels.expiryDate || 'Expiry date'}\r\n placeholder={labels.expiryPlaceholder || 'MM / YY'}\r\n required\r\n bind:value={cardExpiry}\r\n errorText={errors.cardExpiry ?? ''}\r\n color={errors.cardExpiry ? 'red' : 'base'}\r\n />\r\n <Input\r\n label={labels.cvc || 'CVC'}\r\n placeholder={labels.cvcPlaceholder || '123'}\r\n required\r\n maxlength={4}\r\n bind:value={cardCvc}\r\n errorText={errors.cardCvc ?? ''}\r\n color={errors.cardCvc ? 'red' : 'base'}\r\n />\r\n </div>\r\n {/if}\r\n </section>\r\n\r\n <!-- Terms -->\r\n <section class=\"space-y-2\">\r\n <Checkbox bind:checked={agreeTerms}>\r\n {labels.agreeToTerms || 'I agree to the'}\r\n <!-- Checkbox renders children inside its <label>, so this anchor sits\r\n inside the label. That is safe WITHOUT a click guard: HTML exempts\r\n interactive-content descendants (<a href> is one) from label\r\n activation, so opening the terms does not tick the box. Pinned in\r\n CheckoutForm.terms-link.test.ts — if this ever stops being an anchor,\r\n the exemption goes with it. -->\r\n <a\r\n href=\"https://get-micdrop.com/tos\"\r\n target=\"_blank\"\r\n rel=\"noopener noreferrer\"\r\n class=\"link underline\"\r\n >{labels.termsAndConditionsLink || 'terms and conditions'}<span\r\n class=\"sr-only\"> (opens in new tab)</span\r\n ></a\r\n >\r\n </Checkbox>\r\n {#if errors.agreeTerms}\r\n <div class=\"flex items-center gap-1.5\">\r\n <WarningTriIcon size=\"16\" class=\"text-accent-danger shrink-0\" />\r\n <Text size=\"xs\" class=\"text-accent-danger\">{errors.agreeTerms}</Text>\r\n </div>\r\n {/if}\r\n </section>\r\n\r\n <!-- Mobile submit is handled by CheckoutMobileFooter -->\r\n</div>\r\n\r\n<style>\r\n /* Boxes-coloured panel the whole form sits on. 1rem padding pairs with the\r\n timer-header's -1rem bleed so the header spans the panel's full width and\r\n caps its top. rounded/border match the order-summary sidebar Card. */\r\n .checkout-form-panel {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n overflow: hidden;\r\n }\r\n\r\n .timer-header {\r\n display: flex;\r\n align-items: center;\r\n gap: 0.75rem;\r\n padding: 0.75rem 1rem;\r\n margin-top: -1rem;\r\n margin-left: -1rem;\r\n margin-right: -1rem;\r\n border-bottom-width: 1px;\r\n border-bottom-style: solid;\r\n border-radius: 0.5rem 0.5rem 0 0;\r\n }\r\n\r\n .attendee-card {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n }\r\n\r\n .free-order-notice {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n }\r\n</style>\r\n","<script lang=\"ts\">\r\n import { defaultLabels } from '$lib/public-calendar-flow/i18n/labels.js';\r\n import { CalendarIcon } from '@getmicdrop/svelte-components/primitives/Icons/phosphor/index.js';\r\n import {\r\n Button,\r\n Card,\r\n Image,\r\n Text,\r\n formatCurrency,\r\n toUSD,\r\n } from '@getmicdrop/svelte-components';\r\n import type { EventData, OrderTotals } from '$lib/public-calendar-flow/types';\r\n import {\r\n formatBrowseDate,\r\n formatEventTime,\r\n } from '$lib/public-calendar-flow/defaults';\r\n import { PLACEHOLDER_IMAGE } from '$lib/utils/constants.js';\r\n import OrderSummary from './OrderSummary.svelte';\r\n\r\n interface Props {\r\n event: EventData;\r\n orderTotals: OrderTotals;\r\n isFreeOrder: boolean;\r\n onPlaceOrder: () => void;\r\n processing: boolean;\r\n /** Event canceled/postponed mid-checkout — disable the buy button. */\r\n saleClosed?: boolean;\r\n /** Price couldn't be loaded — show a plain line under the blocked button. */\r\n priceUnavailable?: boolean;\r\n labels?: Record<string, string>;\r\n /** BCP-47 locale tag (e.g. 'es', 'es-MX'). Undefined → en-US. */\r\n locale?: string;\r\n }\r\n\r\n let {\r\n event,\r\n orderTotals,\r\n isFreeOrder,\r\n onPlaceOrder,\r\n processing,\r\n saleClosed = false,\r\n priceUnavailable = false,\r\n labels = defaultLabels,\r\n locale = undefined,\r\n }: Props = $props();\r\n</script>\r\n\r\n<!--\r\n\tCap the sidebar card to the viewport so the Place Order button never\r\n\tfalls below the fold when many ticket types + fees + taxes + gift-card\r\n\tlines stack up. Three sections, top-to-bottom:\r\n\t 1. Event info — pinned at top so the buyer always sees what they're\r\n\t paying for.\r\n\t 2. Ticket-line list — scrolls when capacity exceeds viewport.\r\n\t 3. Totals + Place Order button — pinned at bottom so summary + CTA\r\n\t are always visible.\r\n-->\r\n<Card\r\n border\r\n padding={false}\r\n class=\"flex flex-col max-h-[calc(100vh-1.5rem)] rounded-xl shadow-lg overflow-hidden bg-surface-secondary\"\r\n>\r\n <!-- Pinned: event info -->\r\n <div class=\"p-5 shrink-0\">\r\n <div class=\"flex gap-3\">\r\n <div\r\n class=\"shrink-0 w-20 h-14 rounded-lg overflow-hidden bg-surface-tertiary\"\r\n >\r\n <Image\r\n src={event.imageUrl}\r\n alt={event.title}\r\n fallback={PLACEHOLDER_IMAGE}\r\n fit=\"cover\"\r\n class=\"w-full h-full\"\r\n />\r\n </div>\r\n <div class=\"flex-1 min-w-0\">\r\n <Text\r\n size=\"sm\"\r\n weight=\"semibold\"\r\n leading=\"tight\"\r\n class=\"block line-clamp-2\"\r\n >\r\n {event.title}\r\n </Text>\r\n <div class=\"flex items-center gap-1.5 mt-1\">\r\n <CalendarIcon size=\"16\" class=\"shrink-0 icon-muted\" />\r\n <Text size=\"xs\" color=\"muted\">\r\n {formatBrowseDate(event.startDateTime, event.timezone, locale)}\r\n {#if event.displayStartTime !== false}\r\n · {formatEventTime(\r\n event.startDateTime,\r\n event.timezone,\r\n locale\r\n )}\r\n {/if}\r\n </Text>\r\n </div>\r\n <div class=\"mt-0.5\">\r\n <Text size=\"xs\" color=\"muted\" class=\"block\">\r\n {event.venue.name}\r\n </Text>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Scrollable: ticket-line items only -->\r\n <div\r\n class=\"px-5 pb-3 flex-1 overflow-y-auto min-h-0 border-t border-default pt-3\"\r\n >\r\n <OrderSummary {orderTotals} mode=\"lines\" {labels} />\r\n </div>\r\n\r\n <!-- Pinned: totals + Place Order button -->\r\n <div class=\"px-5 pt-3 pb-5 shrink-0 border-t border-default space-y-3\">\r\n <OrderSummary {orderTotals} mode=\"totals\" {labels} />\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n disabled={processing || saleClosed || priceUnavailable}\r\n loading={processing && !saleClosed && !priceUnavailable}\r\n onclick={onPlaceOrder}\r\n >\r\n {#if saleClosed}\r\n {labels.salesClosed || 'Sales closed'}\r\n {:else if priceUnavailable}\r\n {labels.placeOrder || 'Place order'}\r\n {:else if processing}\r\n {labels.placingOrder || 'Placing order...'}\r\n {:else if isFreeOrder}\r\n {labels.completeOrder || 'Complete order'} · {labels.free ||\r\n 'Free'}\r\n {:else}\r\n {labels.placeOrder || 'Place order'} · {orderTotals.total == null\r\n ? '—'\r\n : formatCurrency(toUSD(orderTotals.total))}\r\n {/if}\r\n </Button>\r\n {#if priceUnavailable}\r\n <Text size=\"sm\" color=\"muted\">\r\n {labels.priceUnavailable ||\r\n \"We couldn't load the price for this order — refresh the page or contact the venue\"}\r\n </Text>\r\n {/if}\r\n </div>\r\n</Card>\r\n","<!-- @style-escape: widget-intentional. -->\r\n<script lang=\"ts\">\r\n import { defaultLabels } from '$lib/public-calendar-flow/i18n/labels.js';\r\n import {\r\n Button,\r\n Text,\r\n formatCurrency,\r\n layers,\r\n toUSD,\r\n } from '@getmicdrop/svelte-components';\r\n import type { OrderTotals } from '$lib/public-calendar-flow/types';\r\n\r\n interface Props {\r\n orderTotals: OrderTotals;\r\n isFreeOrder: boolean;\r\n onPlaceOrder: () => void;\r\n processing: boolean;\r\n /** Event canceled/postponed mid-checkout — disable the buy button. */\r\n saleClosed?: boolean;\r\n /** Price couldn't be loaded — show a plain line under the blocked button. */\r\n priceUnavailable?: boolean;\r\n labels?: Record<string, string>;\r\n }\r\n\r\n let {\r\n orderTotals,\r\n isFreeOrder,\r\n onPlaceOrder,\r\n processing,\r\n saleClosed = false,\r\n priceUnavailable = false,\r\n labels = defaultLabels,\r\n }: Props = $props();\r\n\r\n let totalTicketCount = $derived(\r\n orderTotals.lines.reduce((sum, l) => sum + l.quantity, 0)\r\n );\r\n</script>\r\n\r\n<div\r\n class=\"fixed bottom-0 left-0 right-0 md:hidden bg-surface-primary border-t border-default shadow-lg\"\r\n style:z-index={layers.overlay}\r\n style=\"padding-bottom: env(safe-area-inset-bottom, 0);\"\r\n>\r\n <div class=\"flex items-center justify-between gap-3 px-4 py-3\">\r\n <!-- Left: total info -->\r\n <div class=\"flex-1 min-w-0\">\r\n <Text size=\"sm\" weight=\"semibold\" class=\"tabular-nums block\">\r\n {#if isFreeOrder}\r\n {totalTicketCount}\r\n {totalTicketCount === 1\r\n ? labels.ticket || 'ticket'\r\n : labels.tickets || 'tickets'} · Free\r\n {:else if orderTotals.total == null}\r\n —\r\n {:else}\r\n {formatCurrency(toUSD(orderTotals.total))}\r\n {/if}\r\n </Text>\r\n </div>\r\n\r\n <!-- Right: Place order button -->\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n disabled={processing || saleClosed || priceUnavailable}\r\n loading={processing && !saleClosed && !priceUnavailable}\r\n onclick={onPlaceOrder}\r\n class=\"shrink-0 min-w-36\"\r\n >\r\n {#if saleClosed}\r\n {labels.salesClosed || 'Sales closed'}\r\n {:else if priceUnavailable}\r\n {labels.placeOrder || 'Place order'}\r\n {:else if processing}\r\n {labels.placingOrder || 'Placing order...'}\r\n {:else if isFreeOrder}\r\n {labels.completeOrder || 'Complete order'}\r\n {:else}\r\n {labels.placeOrder || 'Place order'}\r\n {/if}\r\n </Button>\r\n </div>\r\n {#if priceUnavailable}\r\n <div class=\"px-4 pb-3 -mt-1\">\r\n <Text size=\"sm\" color=\"muted\">\r\n {labels.priceUnavailable ||\r\n \"We couldn't load the price for this order — refresh the page or contact the venue\"}\r\n </Text>\r\n </div>\r\n {/if}\r\n</div>\r\n","<!--\r\n @form-handling-escape: `processing` is a Stripe payment-confirmation\r\n reentrancy guard (`if (processing) return; processing = true` around\r\n confirmPayment), NOT form-submission/validation state. createFormStore\r\n cannot express a payment-intent confirmation flow, and forcing it here\r\n would risk double-charge regressions for zero user-visible benefit.\r\n Same call as PP#193. Per Atlas behavior-form-handling convergence record.\r\n-->\r\n<script module>\r\n import { createLogger } from '@getmicdrop/svelte-components';\r\n import { toInstant } from '@getmicdrop/svelte-components/datetime';\r\n const logger = createLogger('CheckoutMain');\r\n</script>\r\n\r\n<script lang=\"ts\">\r\n import { untrack } from 'svelte';\r\n import {\r\n WarningTriIcon,\r\n ClockIcon,\r\n CalendarIcon,\r\n } from '@getmicdrop/svelte-components/primitives/Icons/phosphor/index.js';\r\n import { ApiError } from '@getmicdrop/svelte-components/errors';\r\n import {\r\n Button,\r\n Image,\r\n LiveRegion,\r\n Modal,\r\n Text,\r\n toTicketId,\r\n roundCurrency,\r\n getCookie,\r\n COOKIE_NAMES,\r\n createModalState,\r\n } from '@getmicdrop/svelte-components';\r\n import { typography } from '@getmicdrop/svelte-components';\r\n import { browserNow } from '@getmicdrop/svelte-components/datetime';\r\n // Shared with CartView — one derivation of \"has this event ended\", one answer.\r\n import { isEventEnded as isEventEndedShared } from '$lib/utils/event-ended';\r\n import { PLACEHOLDER_IMAGE } from '$lib/utils/constants.js';\r\n import { getSessionStatus } from '$lib/api';\r\n import {\r\n formatBrowseDate,\r\n formatEventTime,\r\n } from '$lib/public-calendar-flow/defaults';\r\n import type {\r\n OrderTotals,\r\n CheckoutConfig,\r\n CheckoutFormData,\r\n } from '$lib/public-calendar-flow/types';\r\n import {\r\n mockEvent,\r\n mockFreeEvent,\r\n mockDonationEvent,\r\n mockRegistrationEvent,\r\n } from '$lib/public-calendar-flow/mock-data';\r\n import { calculateTax } from '$lib/public-calendar-flow/defaults';\r\n import { dataToggleStore } from '$lib/public-calendar-flow/data-toggle-store.svelte';\r\n import { getShowcaseCheckoutStates } from '$lib/public-calendar-flow/showcase-state-options';\r\n\r\n import CheckoutForm from './CheckoutForm.svelte';\r\n import CheckoutSidebar from './CheckoutSidebar.svelte';\r\n import CheckoutMobileFooter from './CheckoutMobileFooter.svelte';\r\n import OrderSummary from './OrderSummary.svelte';\r\n import { getLabelsForLocale } from '$lib/public-calendar-flow/i18n/index.js';\r\n\r\n // mergedLabels initialized after props destructuring below\r\n\r\n // --- DataToggle types ---\r\n type CheckoutVariant =\r\n | 'default'\r\n | 'free'\r\n | 'donation'\r\n | 'registration'\r\n | 'timer_warning'\r\n | 'expired'\r\n | 'promo';\r\n\r\n const checkoutStateOptions = getShowcaseCheckoutStates();\r\n\r\n let dataVariant = $derived(dataToggleStore.current as CheckoutVariant);\r\n\r\n // --- Props (dual-mode: showcase vs production) ---\r\n interface Props {\r\n /** Pre-built checkout config for production mode. Absence = showcase. */\r\n config?: CheckoutConfig;\r\n /** Production order submission handler. Receives form data for the wrapper to submit. */\r\n onPlaceOrder?: (_formData: CheckoutFormData) => Promise<void>;\r\n /** Production back navigation handler. */\r\n onBack?: () => void;\r\n /** Production retry handler for expired sessions. */\r\n onRetryExpired?: () => void;\r\n /** Production session extension handler. Returns extension result with newExpiryTime and remainingExtensions. */\r\n onExtendSession?: () => Promise<{\r\n newExpiryTime?: string;\r\n remainingExtensions?: number;\r\n } | null | void>;\r\n /** Stripe instance passed through to CheckoutForm */\r\n stripe?: any;\r\n /** Stripe client secret passed through to CheckoutForm */\r\n paymentIntent?: string;\r\n /** Bindable Stripe elements for wrapper to access */\r\n elements?: any;\r\n /** Payment error message to display */\r\n paymentError?: string;\r\n /**\r\n * Bindable read-out of the ended-event derivation. This component owns the\r\n * clock that answers it, and the wrapper renders payment affordances as its\r\n * SIBLINGS (the gift-card input) which must go away at the same instant.\r\n * Surfacing the answer keeps one clock and one derivation rather than a\r\n * second copy in the wrapper. Read-only in practice — writes are ignored.\r\n */\r\n eventEnded?: boolean;\r\n /**\r\n * The server refused to price this order — a paid order whose payment-intent\r\n * carried no charged amount (mf#2383 / vc#619). The buy button hard-blocks,\r\n * so the checkout shows a plain line under it telling the buyer why.\r\n */\r\n serverTotalsUnavailable?: boolean;\r\n labels?: Record<string, string>;\r\n /** BCP-47 locale tag (e.g. 'es', 'es-MX'). Undefined → browser locale → en. */\r\n locale?: string;\r\n }\r\n\r\n let {\r\n config: configProp = undefined,\r\n onPlaceOrder: onPlaceOrderProp = undefined,\r\n onBack: onBackProp = undefined,\r\n onRetryExpired: onRetryExpiredProp = undefined,\r\n onExtendSession: onExtendSessionProp = undefined,\r\n stripe = undefined,\r\n paymentIntent = undefined,\r\n elements = $bindable(undefined),\r\n paymentError = '',\r\n eventEnded = $bindable(false),\r\n serverTotalsUnavailable = false,\r\n labels = {},\r\n locale = undefined,\r\n }: Props = $props();\r\n\r\n const mergedLabels = $derived(getLabelsForLocale(locale, labels));\r\n let isShowcaseMode = $derived(!configProp);\r\n\r\n $effect(() => {\r\n if (!isShowcaseMode) return;\r\n dataToggleStore.options = checkoutStateOptions;\r\n dataToggleStore.current = 'default';\r\n dataToggleStore.isActive = true;\r\n return () => {\r\n dataToggleStore.isActive = false;\r\n dataToggleStore.options = [];\r\n };\r\n });\r\n\r\n // --- Mock order configurations per variant ---\r\n function buildConfig(variant: CheckoutVariant): CheckoutConfig {\r\n switch (variant) {\r\n case 'free':\r\n return {\r\n event: mockFreeEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(201),\r\n ticketName: 'Free Entry',\r\n quantity: 2,\r\n unitPrice: 0,\r\n fee: 0,\r\n subtotal: 0,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'donation':\r\n return {\r\n event: mockDonationEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(401),\r\n ticketName: 'Donation',\r\n quantity: 1,\r\n unitPrice: 25,\r\n fee: 0,\r\n subtotal: 25,\r\n },\r\n {\r\n ticketId: toTicketId(402),\r\n ticketName: 'Standard Admission',\r\n quantity: 1,\r\n unitPrice: 30,\r\n fee: 3,\r\n subtotal: 30,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'registration':\r\n return {\r\n event: mockRegistrationEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(301),\r\n ticketName: 'Workshop Seat',\r\n quantity: 1,\r\n unitPrice: 75,\r\n fee: 7.5,\r\n subtotal: 75,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'timer_warning':\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 33, // Just over 30s — warning modal triggers at 30s\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n\r\n case 'expired':\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 0,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: true,\r\n };\r\n\r\n case 'promo':\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: true,\r\n promoDiscount: 10,\r\n forceExpired: false,\r\n };\r\n\r\n default:\r\n // Standard checkout\r\n return {\r\n event: mockEvent,\r\n lines: [\r\n {\r\n ticketId: toTicketId(101),\r\n ticketName: 'General Admission',\r\n quantity: 2,\r\n unitPrice: 25,\r\n fee: 2.5,\r\n subtotal: 50,\r\n },\r\n {\r\n ticketId: toTicketId(102),\r\n ticketName: 'VIP Front Row',\r\n quantity: 1,\r\n unitPrice: 55,\r\n fee: 5.5,\r\n subtotal: 55,\r\n },\r\n ],\r\n timerStart: 900,\r\n promoApplied: false,\r\n promoDiscount: 0,\r\n forceExpired: false,\r\n };\r\n }\r\n }\r\n\r\n // --- State ---\r\n let config: CheckoutConfig = $derived(\r\n isShowcaseMode ? buildConfig(dataVariant) : configProp!\r\n );\r\n // Deadline-based timer model.\r\n //\r\n // We track an absolute deadline timestamp (ms since epoch) and compute\r\n // the displayed seconds from `deadlineMs - Date.now()` on each tick.\r\n // This is immune to backgrounded-tab throttling: when the browser\r\n // suspends our setInterval, the displayed value falls behind, but the\r\n // very next tick (or the visibilitychange handler) recomputes from\r\n // wall-clock time and the display jumps to truth. Previously we\r\n // decremented `timerSeconds -= 1`, which drifted arbitrarily far from\r\n // reality whenever the tab was backgrounded (Chrome throttles 1Hz\r\n // intervals to ~1/min after a few minutes, then pauses them entirely).\r\n //\r\n // `timerSeconds` remains an explicit state var (rather than `$derived`)\r\n // because legacy code paths still write to it (legacy demo modes); the\r\n // canonical writer is now the deadline-driven tick effect below.\r\n let deadlineMs = $state<number | null>(null);\r\n let timerSeconds = $state(900);\r\n let isExpired = $state(false);\r\n let processing = $state(false);\r\n let submitRequested = $state(0);\r\n\r\n // Cart expiration warning/expired modal states\r\n const warningModal = createModalState();\r\n const expiredModal = createModalState();\r\n let warningShown = $state(false);\r\n let isExtendingSession = $state(false);\r\n let remainingExtensions = $state(3);\r\n let canExtend = $state(true);\r\n\r\n // Event-status flip: set when the heartbeat reports the event was\r\n // canceled/postponed mid-checkout. Disables the buy button + surfaces a banner\r\n // modal. The backend finalize gate (§2.13) is the no-charge guarantee; this is\r\n // the courtesy \"don't even let them try\".\r\n //\r\n // Operator-driven only — an event that simply reaches its end time flips\r\n // NOTHING here. That is what `isEventEnded` below adds; the two fold together\r\n // into `eventDead`, which is what every guard in this file reads.\r\n let eventStatusDead = $state<null | 'canceled' | 'postponed'>(null);\r\n const eventUnavailableModal = createModalState();\r\n\r\n // Clock for the ended-event derivation. The buyer can be sitting on this page\r\n // when the event's end time passes, so \"has it ended\" cannot be answered once\r\n // at mount — it has to be re-asked as the clock advances. Its own 1 Hz\r\n // interval rather than the hold-timer tick below, because that tick stops at\r\n // cart expiry and this question outlives it.\r\n let now = $state(browserNow());\r\n $effect(() => {\r\n const clock = setInterval(() => {\r\n now = browserNow();\r\n }, 1000);\r\n return () => clearInterval(clock);\r\n });\r\n\r\n // Same derivation CartView uses (extracted to $lib/utils/event-ended), fed the\r\n // ticking clock so it flips mid-checkout.\r\n let isEventEnded = $derived(isEventEndedShared(config.event, now));\r\n\r\n // Publish it to the wrapper, whose gift-card input sits beside this component\r\n // and would otherwise keep offering to pay for a finished event.\r\n $effect(() => {\r\n eventEnded = isEventEnded;\r\n });\r\n\r\n // The union every guard reads. Widened from operator status alone to include\r\n // time-based expiry, so `saleClosed={!!eventDead}` and the two pre-submit\r\n // `if (eventDead) return;` blocks cover an ended event with exactly the rigor\r\n // they already gave a canceled or postponed one.\r\n let eventDead = $derived<null | 'canceled' | 'postponed' | 'ended'>(\r\n eventStatusDead ?? (isEventEnded ? 'ended' : null)\r\n );\r\n\r\n const WARNING_THRESHOLD = 30; // Show warning modal at 30 seconds remaining\r\n\r\n // Formatted timer display for the modal\r\n let timerDisplay = $derived(\r\n (() => {\r\n const m = Math.floor(timerSeconds / 60);\r\n const s = timerSeconds % 60;\r\n return `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;\r\n })()\r\n );\r\n\r\n // Order totals — the server's payment-intent response is the source\r\n // of truth (it's what Stripe will actually charge). Fall back to a\r\n // local estimate only when the server hasn't responded yet (showcase\r\n // mode, or while the initial /payment-intent is in flight) so the\r\n // skeleton has something to render.\r\n let orderTotals: OrderTotals = $derived(\r\n (() => {\r\n const lines = config.lines;\r\n // A selected ticket with no (or malformed) client-side price makes the\r\n // ORDER unpriced — dash the subtotal + amount-due, hide the fee/tax rows,\r\n // and hard-block the buy button. This runs BEFORE the server-totals branch\r\n // on purpose: even if the server returned a number we can't reconcile to\r\n // that \"—\" line, we make the buyer refresh rather than let them submit a\r\n // charge over an unpriced line (mf#2383 / vc#619).\r\n if (lines.some(l => l.subtotal == null)) {\r\n return {\r\n lines,\r\n subtotal: null,\r\n fees: 0,\r\n taxes: 0,\r\n total: null,\r\n promoDiscount: 0,\r\n giftCardAmount: 0,\r\n };\r\n }\r\n if (config.serverTotals) {\r\n return {\r\n lines,\r\n subtotal: config.serverTotals.subtotal,\r\n fees: config.serverTotals.fees,\r\n taxes: config.serverTotals.taxes,\r\n total: config.serverTotals.total,\r\n promoDiscount: config.serverTotals.promoDiscount,\r\n giftCardAmount: config.serverTotals.giftCardAmount,\r\n };\r\n }\r\n const subtotal = roundCurrency(\r\n lines.reduce((sum, l) => sum + (l.subtotal == null ? 0 : l.subtotal), 0)\r\n );\r\n const fees = roundCurrency(\r\n lines.reduce((sum, l) => sum + l.fee * l.quantity, 0)\r\n );\r\n const promoDiscount = config.promoApplied ? config.promoDiscount : 0;\r\n const adjustedSubtotal = roundCurrency(\r\n Math.max(0, subtotal - promoDiscount)\r\n );\r\n const taxes = calculateTax(\r\n adjustedSubtotal + fees,\r\n config.event.venue.taxPercentage\r\n );\r\n return {\r\n lines,\r\n subtotal,\r\n fees,\r\n taxes,\r\n total: roundCurrency(adjustedSubtotal + fees + taxes),\r\n promoDiscount,\r\n giftCardAmount: 0,\r\n };\r\n })()\r\n );\r\n\r\n // Disable Place-order until the server has confirmed the totals.\r\n // Showing \"Place order · $55\" while the actual Stripe charge will be\r\n // $63.55 is worse than briefly disabling the button. Free orders\r\n // never call the payment-intent endpoint, so they're exempt.\r\n // Showcase mode has no server, so its mock totals are final — treat them as\r\n // locked, otherwise the Place-order button is perpetually \"Placing order…\".\r\n // An unpriced order (orderTotals.total === null, e.g. a missing ticket price)\r\n // is NOT locked even with server totals present — the button must hard-block\r\n // over a \"—\" line rather than charge (mf#2383 / vc#619).\r\n let totalsLocked = $derived(\r\n isShowcaseMode || (!!config.serverTotals && orderTotals.total !== null)\r\n );\r\n\r\n let isFreeOrder = $derived(\r\n orderTotals.total === 0 && orderTotals.subtotal === 0\r\n );\r\n let isRegistration = $derived(config.event.isRegistrationEvent);\r\n\r\n // A paid order we can't price: either the server refused the payment-intent\r\n // (serverTotalsUnavailable) or a selected ticket's wire price is missing so\r\n // the client total is unknowable (orderTotals.total === null). The buy button\r\n // hard-blocks in both cases — show a plain line under it so the buyer isn't\r\n // left with a silent dead button on a page about their money (mf#2383/vc#619).\r\n let priceUnavailable = $derived(\r\n !isShowcaseMode &&\r\n !isFreeOrder &&\r\n (serverTotalsUnavailable || orderTotals.total === null)\r\n );\r\n\r\n // Set timer ONCE on initial mount — not on every config change.\r\n // Config changes frequently (Stripe loads, quantities update, etc.)\r\n // and must not reset the timer.\r\n let timerInitialized = false;\r\n $effect(() => {\r\n const c = config;\r\n if (!timerInitialized) {\r\n timerInitialized = true;\r\n // Convert the incoming \"seconds from now\" into an absolute deadline.\r\n // From this point on, deadlineMs is the source of truth.\r\n deadlineMs = Date.now() + c.timerStart * 1000;\r\n timerSeconds = c.timerStart;\r\n isExpired = c.forceExpired;\r\n }\r\n // A config change must NOT reset submission state. The hosted route re-emits\r\n // `config` from its 30s session-status poll (any timer drift > 5s) — a\r\n // routine event unrelated to the buyer's submission. `submitRequested` is a\r\n // monotonic edge-trigger counter that CheckoutForm chases with its own\r\n // `lastSubmitRequest` high-water mark; zeroing ONE without the other desyncs\r\n // the pair, so the form's submit-watch (`submitRequested > lastSubmitRequest`)\r\n // can never fire again and the buyer's next Place-order click is silently\r\n // swallowed (VC#345 — happens after a declined card, when `processing` has\r\n // already settled back to false). The counter is never reset: it only\r\n // increments on an explicit click, and both `processing` and `submitRequested`\r\n // are owned solely by the submission lifecycle (handlePlaceOrder's\r\n // finally-block, and the bfcache pageshow un-stick below).\r\n });\r\n\r\n function getCartIdFromCookie(): string | null {\r\n if (typeof document === 'undefined') return null;\r\n return getCookie(COOKIE_NAMES.CHECKOUT_CARTID);\r\n }\r\n\r\n function recomputeFromDeadline(): number {\r\n if (deadlineMs == null) return timerSeconds;\r\n return Math.max(0, Math.floor((deadlineMs - Date.now()) / 1000));\r\n }\r\n\r\n /**\r\n * Re-sync the deadline from the orders-service. Called on tab focus —\r\n * a backgrounded tab might have missed an extension granted in another\r\n * tab, or the server may have already expired the cart while we slept.\r\n *\r\n * Silent on any error: the existing deadlineMs continues to drive the\r\n * display, which is no worse than the pre-resync state.\r\n */\r\n async function resyncDeadlineFromServer(): Promise<void> {\r\n const cartId = getCartIdFromCookie();\r\n if (!cartId) return;\r\n try {\r\n const status = await getSessionStatus(cartId);\r\n if (status.notFound) {\r\n // Server has already released the reservation. Surface the\r\n // expired modal so the user isn't staring at a phantom timer.\r\n deadlineMs = Date.now();\r\n timerSeconds = 0;\r\n isExpired = true;\r\n warningModal.close();\r\n expiredModal.open();\r\n return;\r\n }\r\n if (status.expiresAt) {\r\n // Checkout hold-timer deadline — buyer's own wall clock, tz-independent\r\n deadlineMs = toInstant(status.expiresAt).getTime();\r\n timerSeconds = recomputeFromDeadline();\r\n }\r\n // Event-status flip piggybacked on the heartbeat. Set once (so a dismissed\r\n // banner doesn't reopen each poll); the buy button stays disabled via\r\n // saleClosed regardless. \"cancelled\" accepted defensively.\r\n const deadNow =\r\n status.eventStatus === 'canceled' || status.eventStatus === 'cancelled'\r\n ? 'canceled'\r\n : status.eventStatus === 'postponed'\r\n ? 'postponed'\r\n : null;\r\n if (deadNow && !eventStatusDead) {\r\n eventStatusDead = deadNow;\r\n eventUnavailableModal.open();\r\n }\r\n } catch {\r\n /* network error — keep current deadlineMs */\r\n }\r\n }\r\n\r\n // Timer countdown with warning and expired modal triggers.\r\n //\r\n // The interval ticks at 1 Hz, but its job is to *recompute* timerSeconds\r\n // from deadlineMs, not to decrement a counter. Backgrounded tabs throttle\r\n // this interval — that's fine; when the tab regains focus the\r\n // visibilitychange handler runs the recompute immediately and the display\r\n // jumps to truth.\r\n $effect(() => {\r\n // Depend on `isExpired` ONLY. `timerSeconds` is mutated by this effect's\r\n // own tick() below, so reading it reactively here made the effect a\r\n // dependency of its own output: every 1 Hz tick re-ran the whole effect,\r\n // tearing down + rebuilding the interval and re-firing the setup-time\r\n // resyncDeadlineFromServer() ~1×/sec instead of on the intended 30s\r\n // heartbeat. Reading it untracked keeps setup a one-shot per isExpired\r\n // transition — the tick handles the countdown->expiry flip itself.\r\n if (isExpired) return;\r\n if (untrack(() => timerSeconds) <= 0) {\r\n isExpired = true;\r\n warningModal.close();\r\n expiredModal.open();\r\n return;\r\n }\r\n\r\n const tick = () => {\r\n const next = recomputeFromDeadline();\r\n timerSeconds = next;\r\n\r\n // Persist deadline to localStorage every 10 displayed seconds.\r\n // (Storing the deadline directly — not a recomputed end-time —\r\n // keeps reads consistent across tabs.)\r\n if (\r\n next % 10 === 0 &&\r\n deadlineMs != null &&\r\n typeof localStorage !== 'undefined'\r\n ) {\r\n try {\r\n const cartId = getCartIdFromCookie();\r\n if (cartId) {\r\n localStorage.setItem(\r\n // @storage-escape: checkout-deadline timer persistence (intentional raw localStorage)\r\n `checkout-expiry-${cartId}`,\r\n String(deadlineMs)\r\n );\r\n }\r\n } catch {\r\n /* ignore */\r\n }\r\n }\r\n\r\n // Heartbeat: re-sync from the server every ~30s. Refreshes the deadline\r\n // AND carries the piggybacked event status, so the buy button flips within\r\n // ~30s of an operator canceling/postponing — no dedicated poll or socket.\r\n if (next > 0 && next % 30 === 0) {\r\n void resyncDeadlineFromServer();\r\n }\r\n\r\n // Show warning modal at 30 seconds remaining (only once per session).\r\n // We compare with <= because a backgrounded tab may have skipped over\r\n // the exact === WARNING_THRESHOLD boundary while throttled.\r\n if (next <= WARNING_THRESHOLD && next > 0 && !warningShown) {\r\n warningModal.open();\r\n warningShown = true;\r\n }\r\n\r\n if (next <= 0) {\r\n isExpired = true;\r\n warningModal.close();\r\n expiredModal.open();\r\n clearInterval(interval);\r\n }\r\n };\r\n\r\n const interval = setInterval(tick, 1000);\r\n\r\n // Recompute immediately whenever the tab becomes visible — a\r\n // throttled/paused interval may have left the display many minutes\r\n // behind reality. Also kick a server resync to catch the case where\r\n // the reservation already expired (or was extended in another tab).\r\n const onVisible = (e?: Event) => {\r\n // A bfcache restore — the Back button after a 3DS/redirect payment method\r\n // navigated away mid-confirmPayment — returns the page frozen: the\r\n // submission promise never resolved, so handlePlaceOrder's finally never\r\n // cleared `processing`, and Place-order dead-ends on `if (processing)\r\n // return` until a hard reload. Treat the restore as the end of any\r\n // in-flight submission and un-stick the button. (Guarded on `pageshow`\r\n // with `persisted` so a normal visibilitychange never clears a genuine\r\n // in-flight charge.)\r\n if (e?.type === 'pageshow' && (e as PageTransitionEvent).persisted) {\r\n // Un-stick a submission frozen mid-flight by the bfcache. Only\r\n // `processing` is cleared: the already-fired submit left submitRequested\r\n // in sync with the form's lastSubmitRequest, so leaving it untouched lets\r\n // the next click increment past the high-water mark and re-submit. Zeroing\r\n // it here would desync the pair and swallow that retry click (VC#345).\r\n processing = false;\r\n }\r\n if (\r\n typeof document !== 'undefined' &&\r\n document.visibilityState === 'visible'\r\n ) {\r\n tick();\r\n void resyncDeadlineFromServer();\r\n }\r\n };\r\n if (typeof document !== 'undefined') {\r\n document.addEventListener('visibilitychange', onVisible);\r\n }\r\n if (typeof window !== 'undefined') {\r\n window.addEventListener('pageshow', onVisible);\r\n }\r\n\r\n // Initial server resync — catches the case where the user landed on\r\n // checkout with a stale cookie whose cart has already been released.\r\n void resyncDeadlineFromServer();\r\n\r\n return () => {\r\n clearInterval(interval);\r\n if (typeof document !== 'undefined') {\r\n document.removeEventListener('visibilitychange', onVisible);\r\n }\r\n if (typeof window !== 'undefined') {\r\n window.removeEventListener('pageshow', onVisible);\r\n }\r\n };\r\n });\r\n\r\n // --- Handlers ---\r\n function handleBack() {\r\n // Showcase mode has no back target; production wires onBackProp.\r\n if (onBackProp) onBackProp();\r\n }\r\n\r\n /** Called from sidebar/mobile footer — signals the form to validate + submit */\r\n function requestPlaceOrder() {\r\n if (eventDead) return; // sales closed — buy button is disabled, block defensively\r\n submitRequested += 1;\r\n }\r\n\r\n /** Called by CheckoutForm after successful validation */\r\n function handlePlaceOrder(formData: CheckoutFormData) {\r\n if (processing) return;\r\n if (eventDead) return; // sales closed mid-checkout — do not submit\r\n processing = true;\r\n\r\n if (onPlaceOrderProp) {\r\n // Production mode: delegate to wrapper with form data\r\n onPlaceOrderProp(formData)\r\n .catch(() => {\r\n // Error handling is done by the wrapper; just reset processing\r\n })\r\n .finally(() => {\r\n processing = false;\r\n });\r\n return;\r\n }\r\n\r\n // Showcase mode: mock the async place-order delay, then clear processing.\r\n // No success surface here — production owns the real confirmation page.\r\n setTimeout(() => {\r\n processing = false;\r\n }, 1500);\r\n }\r\n\r\n function handleRetryExpired() {\r\n expiredModal.close();\r\n // Showcase mode has no ticket-selection target; production wires onRetryExpiredProp.\r\n if (onRetryExpiredProp) onRetryExpiredProp();\r\n }\r\n\r\n /** Extend the checkout session via the parent wrapper's onExtendSession callback */\r\n async function handleExtendSession() {\r\n if (!canExtend || isExtendingSession) return;\r\n isExtendingSession = true;\r\n\r\n try {\r\n if (onExtendSessionProp) {\r\n const result = await onExtendSessionProp();\r\n // The parent wrapper (Checkout.svelte) returns `null` when the\r\n // extend-session API call fails — e.g. when the reservation\r\n // has already expired server-side past its grace window, or\r\n // the user has used all 3 extensions. Treat null/undefined as\r\n // an unambiguous failure: don't reset the timer to +15min\r\n // locally (that would falsely show the user they still have a\r\n // valid cart when the server has already released the tickets).\r\n if (result == null) {\r\n throw new ApiError('Extension request returned no result', 0, {\r\n endpoint: 'extend-session',\r\n method: 'POST',\r\n });\r\n }\r\n if (typeof result === 'object') {\r\n if (result.newExpiryTime) {\r\n // Server gave us an absolute new expiry — use it directly.\r\n // Checkout hold-timer deadline — buyer's own wall clock, tz-independent\r\n deadlineMs = toInstant(result.newExpiryTime).getTime();\r\n } else {\r\n // Fallback: add 15 minutes from now\r\n deadlineMs = Date.now() + 15 * 60 * 1000;\r\n }\r\n timerSeconds = recomputeFromDeadline();\r\n if (result.remainingExtensions !== undefined) {\r\n remainingExtensions = result.remainingExtensions;\r\n canExtend = remainingExtensions > 0;\r\n }\r\n } else {\r\n // Truthy non-object: legacy callers that just return `true`\r\n // on success. Treat as a simple 15-minute extension.\r\n deadlineMs = Date.now() + 15 * 60 * 1000;\r\n timerSeconds = recomputeFromDeadline();\r\n }\r\n } else {\r\n // Showcase mode: just add 15 minutes\r\n deadlineMs = Date.now() + 15 * 60 * 1000;\r\n timerSeconds = recomputeFromDeadline();\r\n }\r\n\r\n isExpired = false;\r\n warningShown = false;\r\n warningModal.close();\r\n expiredModal.close();\r\n } catch (err) {\r\n logger.error('Failed to extend session:', err);\r\n // Extension failed — close the warning but keep the expired\r\n // modal open so the user is offered \"Select tickets again\".\r\n // Disable further extend attempts on this dead cart.\r\n warningModal.close();\r\n canExtend = false;\r\n if (timerSeconds <= 0) {\r\n isExpired = true;\r\n expiredModal.open();\r\n }\r\n } finally {\r\n isExtendingSession = false;\r\n }\r\n }\r\n\r\n /** Dismiss warning modal without extending (user will hurry) */\r\n function dismissWarning() {\r\n warningModal.close();\r\n }\r\n</script>\r\n\r\n<div class=\"w-full min-h-screen bg-surface-primary text-color-primary\">\r\n <div class=\"max-w-6xl mx-auto px-4 py-6 md:px-6 md:py-8\">\r\n {#if isEventEnded}\r\n <!-- Ended mid-checkout. Same treatment CartView gives this exact case\r\n (CartView.svelte, `{:else if event && isEventEnded}`): short-circuit\r\n the surface to one alert, same copy. The buy controls are unmounted\r\n here AND disabled at the guard layer via `eventDead`, which now\r\n folds this in. -->\r\n <LiveRegion visible politeness=\"assertive\" class=\"text-center py-12\">\r\n <p class=\"mb-2 {typography.h2}\">\r\n {mergedLabels.thisEventHasEnded || 'This event has ended'}\r\n </p>\r\n <p class=\"tone-secondary mb-6\">\r\n {mergedLabels.ticketsNoLongerAvailable ||\r\n 'Tickets are no longer available for this event'}\r\n </p>\r\n <Button\r\n variant=\"default\"\r\n onclick={handleBack}\r\n aria-label={mergedLabels.goBackToEventDetails ||\r\n 'Go back to event details'}\r\n >\r\n {mergedLabels.goBack || 'Go back'}\r\n </Button>\r\n </LiveRegion>\r\n {:else}\r\n <!-- Single CheckoutForm shared between desktop and mobile layouts.\r\n\t\t Previously there were two instances (one hidden md:grid, one md:hidden)\r\n\t\t which caused duplicate Stripe elements and broken form submission. -->\r\n <div class=\"max-w-6xl\">\r\n <!-- Desktop: two-column grid; Mobile: single column -->\r\n <div class=\"md:grid md:grid-cols-booking-split gap-8 items-start\">\r\n <!-- LEFT COLUMN (or full width on mobile): Checkout form -->\r\n <div class=\"pb-24 md:pb-0\">\r\n <!-- CheckoutForm re-mounts ONLY the Stripe element internally when\r\n `paymentIntent` changes (e.g. a partial gift card swaps in a\r\n reduced-amount PI), so Elements always binds to the current secret\r\n WITHOUT remounting the whole form and wiping the buyer's typed\r\n fields. (An earlier {#key paymentIntent} here blanked the form.) -->\r\n <CheckoutForm\r\n event={config.event}\r\n {orderTotals}\r\n {timerSeconds}\r\n {isExpired}\r\n {isRegistration}\r\n {isFreeOrder}\r\n promoApplied={config.promoApplied}\r\n promoDiscount={config.promoDiscount}\r\n onBack={handleBack}\r\n onPlaceOrder={handlePlaceOrder}\r\n {processing}\r\n {submitRequested}\r\n {stripe}\r\n {paymentIntent}\r\n bind:elements\r\n {paymentError}\r\n labels={mergedLabels}\r\n />\r\n\r\n <!-- Inline order summary for mobile (below form). Lead with the\r\n event header (poster + title + date + venue) so the buyer\r\n has visual confirmation of what they're paying for as they\r\n approach the sticky Place order button. Mirrors the desktop\r\n CheckoutSidebar layout. -->\r\n <section\r\n class=\"md:hidden mobile-order-summary border-default bg-surface-secondary mt-6\"\r\n >\r\n <div class=\"flex gap-3 pb-3 mb-3 border-b border-default\">\r\n <div\r\n class=\"shrink-0 w-20 h-14 rounded-lg overflow-hidden bg-surface-tertiary\"\r\n >\r\n <Image\r\n src={config.event.imageUrl}\r\n fallback={PLACEHOLDER_IMAGE}\r\n alt={config.event.title}\r\n class=\"w-full h-full\"\r\n />\r\n </div>\r\n <div class=\"flex-1 min-w-0\">\r\n <Text\r\n size=\"sm\"\r\n weight=\"semibold\"\r\n leading=\"tight\"\r\n class=\"block line-clamp-2\"\r\n >\r\n {config.event.title}\r\n </Text>\r\n <div class=\"flex items-center gap-1.5 mt-1\">\r\n <CalendarIcon size=\"16\" class=\"shrink-0 icon-muted\" />\r\n <Text size=\"xs\" color=\"muted\">\r\n {formatBrowseDate(\r\n config.event.startDateTime,\r\n config.event.timezone,\r\n locale\r\n )}\r\n {#if config.event.displayStartTime !== false}\r\n · {formatEventTime(\r\n config.event.startDateTime,\r\n config.event.timezone,\r\n locale\r\n )}\r\n {/if}\r\n </Text>\r\n </div>\r\n <div class=\"mt-0.5\">\r\n <Text size=\"xs\" color=\"muted\" class=\"block\">\r\n {config.event.venue.name}\r\n </Text>\r\n </div>\r\n </div>\r\n </div>\r\n <OrderSummary {orderTotals} labels={mergedLabels} />\r\n </section>\r\n </div>\r\n\r\n <!-- RIGHT COLUMN: Sticky order summary sidebar (desktop only) -->\r\n <div class=\"hidden md:block sticky top-6\">\r\n <CheckoutSidebar\r\n event={config.event}\r\n {orderTotals}\r\n {isFreeOrder}\r\n {priceUnavailable}\r\n onPlaceOrder={requestPlaceOrder}\r\n processing={processing || (!isFreeOrder && !totalsLocked)}\r\n saleClosed={!!eventDead}\r\n labels={mergedLabels}\r\n {locale}\r\n />\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Mobile: Fixed bottom bar -->\r\n <div class=\"md:hidden\">\r\n <CheckoutMobileFooter\r\n {orderTotals}\r\n {isFreeOrder}\r\n {priceUnavailable}\r\n onPlaceOrder={requestPlaceOrder}\r\n processing={processing || (!isFreeOrder && !totalsLocked)}\r\n saleClosed={!!eventDead}\r\n labels={mergedLabels}\r\n />\r\n </div>\r\n {/if}\r\n </div>\r\n\r\n <!-- Session Warning Modal (30 seconds remaining).\r\n Wrapped in `{#if}` (instead of relying on `bind:open` alone) so\r\n the Modal fully mounts/unmounts each time warningModal.isOpen\r\n transitions. Surfaced by a wall-clock test where, after the\r\n user clicked \"Continue checkout\" on a first warning, the Modal\r\n component's internal open-state never reset cleanly — on the\r\n NEXT 30s threshold the timer text in DOM updated but the modal\r\n stayed visually hidden, so the user lost the cart with no\r\n chance to re-extend. Forcing remount with #if sidesteps that. -->\r\n {#if warningModal.isOpen}\r\n <Modal\r\n open={true}\r\n oncancel={() => warningModal.close()}\r\n size=\"sm\"\r\n aria-labelledby=\"warning-modal-title\"\r\n >\r\n {#snippet body()}\r\n <div class=\"timer-modal\" id=\"warning-modal-description\">\r\n <div class=\"timer-modal-icon warning\">\r\n <WarningTriIcon size=\"32\" />\r\n </div>\r\n <h3\r\n id=\"warning-modal-title\"\r\n class=\"timer-modal-title type-subheading\"\r\n >\r\n {mergedLabels.sessionExpiringSoon || 'Session expiring soon'}\r\n </h3>\r\n <p class=\"timer-modal-text type-body\">\r\n {(\r\n mergedLabels.sessionExpiringSoonMessage ||\r\n 'Your checkout session will expire in {time}. Your selected tickets will be released back to inventory'\r\n ).replace('{time}', timerDisplay)}\r\n </p>\r\n {#if canExtend && remainingExtensions > 0}\r\n <p class=\"timer-modal-hint type-caption\">\r\n {(\r\n mergedLabels.extensionsRemaining ||\r\n '{count} extension{plural} remaining'\r\n )\r\n .replace('{count}', String(remainingExtensions))\r\n .replace('{plural}', remainingExtensions === 1 ? '' : 's')}\r\n </p>\r\n {/if}\r\n </div>\r\n {/snippet}\r\n {#snippet footer()}\r\n <div class=\"timer-modal-actions\">\r\n {#if canExtend}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleExtendSession}\r\n disabled={isExtendingSession}\r\n loading={isExtendingSession}\r\n >\r\n {isExtendingSession\r\n ? mergedLabels.extendingSession || 'Extending...'\r\n : mergedLabels.continueCheckout || 'Continue checkout'}\r\n </Button>\r\n {:else}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={dismissWarning}\r\n >\r\n {mergedLabels.okIllHurry || \"OK, I'll hurry\"}\r\n </Button>\r\n <p class=\"timer-modal-hint type-caption\">\r\n {mergedLabels.maxExtensionsReached ||\r\n 'Maximum extensions reached'}\r\n </p>\r\n {/if}\r\n </div>\r\n {/snippet}\r\n </Modal>\r\n {/if}\r\n\r\n <!-- Session Expired Modal (\"Want to keep your tickets?\").\r\n Same `{#if}` wrap as the warning modal — forces a fresh\r\n Modal mount each time so reopening after a previous extend\r\n cycle actually re-displays the dialog. -->\r\n {#if expiredModal.isOpen}\r\n <Modal\r\n open={true}\r\n oncancel={() => expiredModal.close()}\r\n size=\"sm\"\r\n aria-labelledby=\"expired-modal-title\"\r\n >\r\n {#snippet body()}\r\n <div class=\"timer-modal\" id=\"expired-modal-description\">\r\n <div class=\"timer-modal-icon expired\">\r\n <ClockIcon size=\"32\" />\r\n </div>\r\n <h3\r\n id=\"expired-modal-title\"\r\n class=\"timer-modal-title type-subheading\"\r\n >\r\n {canExtend\r\n ? mergedLabels.wantToKeepTickets || 'Want to keep your tickets?'\r\n : mergedLabels.sessionExpired || 'Session expired'}\r\n </h3>\r\n <p class=\"timer-modal-text type-body\">\r\n {canExtend\r\n ? mergedLabels.sessionExpiredMessage ||\r\n 'Your checkout session has expired and your selected tickets have been released'\r\n : mergedLabels.reservationTimedOut ||\r\n 'Your reservation has timed out. Please select your tickets again to continue'}\r\n </p>\r\n </div>\r\n {/snippet}\r\n {#snippet footer()}\r\n <div class=\"timer-modal-actions\">\r\n {#if canExtend}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleExtendSession}\r\n disabled={isExtendingSession}\r\n loading={isExtendingSession}\r\n >\r\n {isExtendingSession\r\n ? mergedLabels.extendingSession || 'Extending...'\r\n : mergedLabels.keepMyTickets || 'Keep my tickets'}\r\n </Button>\r\n <Button\r\n variant=\"alternative\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleRetryExpired}\r\n >\r\n {mergedLabels.selectTicketsAgain || 'Select tickets again'}\r\n </Button>\r\n {:else}\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleRetryExpired}\r\n >\r\n {mergedLabels.selectTicketsAgain || 'Select tickets again'}\r\n </Button>\r\n {/if}\r\n </div>\r\n {/snippet}\r\n </Modal>\r\n {/if}\r\n\r\n <!-- Event canceled / postponed mid-checkout (heartbeat flip). The buy button\r\n is already disabled (saleClosed); this explains why. Canceled is terminal;\r\n postponed is a softer \"sales paused\" message. The backend finalize gate\r\n (§2.13) is the no-charge guarantee — this is courtesy UX. -->\r\n {#if eventUnavailableModal.isOpen}\r\n <Modal\r\n open={true}\r\n oncancel={() => eventUnavailableModal.close()}\r\n size=\"sm\"\r\n aria-labelledby=\"sale-closed-modal-title\"\r\n >\r\n {#snippet body()}\r\n <div class=\"timer-modal\" id=\"sale-closed-modal-description\">\r\n <div class=\"timer-modal-icon expired\">\r\n <WarningTriIcon size=\"32\" />\r\n </div>\r\n <h3\r\n id=\"sale-closed-modal-title\"\r\n class=\"timer-modal-title type-subheading\"\r\n >\r\n {#if eventDead === 'canceled'}\r\n {mergedLabels.eventCanceledTitle || 'This event was cancelled'}\r\n {:else}\r\n {mergedLabels.eventPostponedTitle || 'Ticket sales are paused'}\r\n {/if}\r\n </h3>\r\n <p class=\"timer-modal-text type-body\">\r\n {#if eventDead === 'canceled'}\r\n {mergedLabels.eventCanceledMessage ||\r\n 'This event has been cancelled, so tickets are no longer for sale. You have not been charged'}\r\n {:else}\r\n {mergedLabels.eventPostponedMessage ||\r\n 'Ticket sales for this event have been paused. You have not been charged. Check back soon or contact the organizer'}\r\n {/if}\r\n </p>\r\n </div>\r\n {/snippet}\r\n {#snippet footer()}\r\n <div class=\"timer-modal-actions\">\r\n <Button\r\n variant=\"default\"\r\n size=\"lg\"\r\n class=\"w-full\"\r\n onclick={handleRetryExpired}\r\n >\r\n {mergedLabels.backToEvents || 'Back to events'}\r\n </Button>\r\n </div>\r\n {/snippet}\r\n </Modal>\r\n {/if}\r\n</div>\r\n\r\n<style>\r\n /* Mobile order summary */\r\n .mobile-order-summary {\r\n padding: 1rem;\r\n border-radius: 0.5rem;\r\n border-width: 1px;\r\n border-style: solid;\r\n }\r\n\r\n /* Timer modals */\r\n .timer-modal {\r\n text-align: center;\r\n padding: 0.5rem 0;\r\n }\r\n\r\n .timer-modal-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 3.5rem;\r\n height: 3.5rem;\r\n border-radius: 9999px;\r\n margin: 0 auto 1rem;\r\n }\r\n\r\n .timer-modal-icon.warning {\r\n background-color: hsl(var(--accent-warning) / 8%);\r\n color: hsl(var(--accent-warning));\r\n }\r\n\r\n .timer-modal-icon.expired {\r\n background-color: hsl(var(--accent-danger) / 5%);\r\n color: hsl(var(--accent-danger));\r\n }\r\n\r\n .timer-modal-title {\r\n margin-bottom: 0.5rem;\r\n }\r\n\r\n .timer-modal-text {\r\n color: hsl(var(--text-tertiary)); /* gray-500 */\r\n }\r\n\r\n .timer-modal-hint {\r\n color: hsl(var(--text-head)); /* gray-400 */\r\n margin-top: 0.5rem;\r\n }\r\n\r\n .timer-modal-actions {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 0.5rem;\r\n }\r\n /* The Button component's class=\"w-full\" is a Tailwind utility that\r\n isn't always emitted in the venue-calendar bundle (no scanner\r\n pass over node_modules), so force full width at the layout\r\n level. Applies to both <button> and the anchor variant. */\r\n .timer-modal-actions :global(button),\r\n .timer-modal-actions :global(a) {\r\n width: 100%;\r\n }\r\n</style>\r\n"],"names":["size","$","$$props","color","className","ctx","useIconWeight","resolved","svg","root_2","path","root","polyline","root_1","$$render","consequent","alternate","styles","createLogger","COOKIE_NAMES","asCookieName","parseCookies","acc","cookie","name","valueParts","getCookie","checked","indeterminate","value","disabled","inputEl","handleChange","colorClasses","colorClass","inputClasses","label","input","$$value","span","$$args","registry","backendSeq","backendIds","backendId","storage","id","registerStorageKey","descriptor","outer","inner","byBackend","existing","THEME_STORAGE_KEY","LEGACY_THEME_KEY","readLegacyTheme","raw","removeLegacyTheme","readThemeOverride","canonical","getLocalStorage","legacy","setLocalStorage","browser","detectDarkMode","containerSelector","saved","selector","containers","container","getStripeTheme","isDark","useStripeTheme","options","watchChanges","fallback","current","observer","mediaQuery","updateTheme","onMount","onDestroy","stripe","paymentIntent","elements","paymentError","labels","defaultLabels","stripeTheme","paymentMountDiv","paymentElement","mountedSecret","mountStripePayment","destroyStripePayment","firstName","lastName","email","keepUpdated","agreeTerms","cardNumber","cardExpiry","cardCvc","attendees","noPaymentRequired","submitted","errors","e","isEmailAddress","i","att","hasErrors","isTimerUrgent","totalTickets","sum","l","_","lastSubmitRequest","untrack","handleSubmit","handleSameAsPurchaser","index","a","div","root_11","div_1","Button","node","ChevronLeftIcon","$$anchor","CheckoutTimer","node_1","section","Heading","node_2","div_2","$3","Input","node_3","node_4","node_5","Checkbox","node_6","section_1","node_8","node_9","attendee","div_3","div_4","Text","node_10","node_11","div_5","div_6","node_12","node_13","node_14","section_2","node_7","div_7","node_16","div_8","node_17","node_18","div_9","fragment_10","p","root_3","consequent_2","p_1","consequent_3","p_2","root_5","consequent_4","node_22","p_3","node_23","node_24","div_10","node_25","node_26","consequent_1","consequent_6","alternate_1","section_3","node_27","a_1","text_14","div_11","root_10","WarningTriIcon","node_29","node_30","text_16","consequent_7","saleClosed","priceUnavailable","locale","Card","fragment_1","Image","PLACEHOLDER_IMAGE","CalendarIcon","formatEventTime","formatBrowseDate","text_3","OrderSummary","$0","$1","formatCurrency","toUSD","consequent_5","totalTicketCount","layers","logger","checkoutStateOptions","getShowcaseCheckoutStates","dataVariant","dataToggleStore","configProp","onPlaceOrderProp","onBackProp","onRetryExpiredProp","onExtendSessionProp","eventEnded","serverTotalsUnavailable","mergedLabels","getLabelsForLocale","isShowcaseMode","buildConfig","variant","mockFreeEvent","toTicketId","mockDonationEvent","mockRegistrationEvent","mockEvent","config","deadlineMs","timerSeconds","isExpired","processing","submitRequested","warningModal","createModalState","expiredModal","warningShown","isExtendingSession","remainingExtensions","canExtend","eventStatusDead","eventUnavailableModal","now","browserNow","clock","isEventEnded","isEventEndedShared","eventDead","WARNING_THRESHOLD","timerDisplay","m","s","orderTotals","lines","subtotal","roundCurrency","fees","promoDiscount","adjustedSubtotal","taxes","calculateTax","totalsLocked","isFreeOrder","isRegistration","timerInitialized","c","getCartIdFromCookie","recomputeFromDeadline","resyncDeadlineFromServer","cartId","status","getSessionStatus","toInstant","deadNow","tick","next","interval","onVisible","handleBack","requestPlaceOrder","handlePlaceOrder","formData","handleRetryExpired","handleExtendSession","result","ApiError","err","dismissWarning","LiveRegion","typography","fragment_3","CheckoutForm","text_6","CheckoutSidebar","CheckoutMobileFooter","Modal","div_12","root_4","div_13","h3","div_14","root_6","p_4","div_15","root_7","div_16","ClockIcon","h3_1","p_5","div_17","node_20","node_21","alternate_2","div_18","root_9","div_19","h3_2","alternate_3","p_6","consequent_8","alternate_4","div_20","consequent_9"],"mappings":";;;;;;;;;;;;;kBAAA;;AAmBE,MAAMA,IAAIC,EAAA,KAAAC,GAAA,QAAA,GAAG,IAAI,GAAEC,0BAAQ,cAAc,GAASC,0BAAY,EAAE;AAEhE,QAAMC,IAAMC,GAAa;AACzB,MAAIC,IAAoBN,EAAA,QAAA,MAAAC,EAAA,UAAsBG,GAAK,UAAU,SAAS;MAGvEG,IA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