# Venue booking presentation source

The presentation source is `/Users/hansuku/Desktop/WorkSpace/bigsales/src/booking-ui`. The original provider, tokens, fonts and controls were copied from `d3ee006e4e0772d65bd08fb707cd374bb59fb31a`; the shared page, catalog, order and checkout presentation was updated directly from `13f1be23f6a150718665f2617d83bc87613af8c4` on 2026-10-27. The Vite process serving port 5173 was verified to use this repository at that revision. The older `/Users/hansuku/Desktop/sunny-play` copy is not the source for this update.

This directory keeps the original `design/tokens.ts` registry, scoped CSS import order, three font files, accessible brand-colour derivation, brand components, scoped portal provider and explicit progression helper. It does not import demo storage, route handling, catalogue data, reservations or payment services. The production calendar remains the locally scoped AntD implementation; this update does not restore the demo's DayPicker dependency. `DAYPICKER-LICENSE.txt` is retained as the historical attribution notice.

## Shared presentation update

The following files retain the source DOM and classes, with the compatibility and controlled-input changes listed below:

- `shared/BookingPage.tsx`, `BookingActions.tsx`, `OrderContent.tsx`, `AmountRow.tsx`, `ProductCard.tsx`, `SelectionSection.tsx`, `StepIndicator.tsx`, `Feedback.tsx`.
- `Agreement.tsx`, `i18n.ts`, `shared/CheckoutBenefits.tsx`, `Forms.tsx`, `BookingPresentation.tsx`, `TimeValidity.tsx`. The existing `shared/ResourcePicker.tsx` already matches this source apart from the classic React import and is reused.
- `shared/booking-flow.css`, `booking-options.css`, `booking-presentation.css` and `benefits.css` are copied without changes from `13f1be2`. Existing `base.css`, `agreement.css`, `selection-section.css` and `shared.css` receive only required increments. Older Party, planner, summary, dialog, calendar and legacy-control rules remain available during page integration.

The existing production `BookingUIProvider`, scoped portal, `Dialog`, month calendar and token registry are preserved. `BookingDatePicker` adds only the optional `stepStatus: StepIndicatorState` prop. `ConfigurableBookingSteps` keeps its props and supplies `--step-count` / `--step-progress` for any number of stages; callers without those variables retain the previous three-stage CSS fallback.

| Export | Controlled composition contract |
| --- | --- |
| `BookingPage` | `navigation?`, `title?`, `description?`, `children`, `summary?`, `footer?`, `stage?`, `id?`, `className?`, `contentClassName?`; the footer is outside the animated content grid. |
| `BookingPrimaryAction`, `BookingFooter`, `ConfigurationFooter` | Receive `BookingAction {label, compactLabel?, onClick, disabled?, busy?}`; amounts, navigation and eligibility come from the page adapter. |
| `ProductCard` | Receives real name/description, optional image/badge, formatted price, metadata/details, selection count and action. Optional `unavailable: {label, kind}` represents settled product facts separately from temporary `disabled`/`busy` locks, placing the reason on the image (or placeholder) and disabling the action as `Unavailable`. Legacy `disabledReason` remains an accessibility-only fallback. Long descriptions reuse the read-only `AgreementDialog`; `descriptionContent` supplies formatted full details separately from the compact plain-text preview. |
| `ProductDescription` | Displays catalog rich text with paragraphs, line breaks, emphasis, lists, links, images and tables. Only allowed tags and presentation attributes become React nodes; no script/event attributes or arbitrary HTML insertion. Styles stay inside the booking description and do not change agreement content or KioskSales. Plain-text line breaks are preserved; literal Markdown markers are not reinterpreted. |
| `ProductDescriptionPreview` | Shared by product cards and the Tickets/Party configuration intro: a maximum of three preview lines, with `View details` only when overflowing. Full details use the existing reading dialog and retain formatted content; closing it keeps the configuration dialog and its selection intact. |
| `OrderItem`, `OrderDetails`, `PriceBreakdown`, `AmountRow` | Titles, facts, actions and amounts are supplied by the host. Amounts are `ReactNode`; an optional `formatAmount(number)` formats numeric values without assuming minor units. Discount rows keep the supplied sign. |
| `SelectionSection`, `StepIndicator`, `useStepIndicators` | The page owns open/locked/complete states. The hook records presentation transitions only; an in-flight `undefined` status must never authorize an action. Keep its `scope` object stable for one draft. |
| `CheckoutBenefits` | Receives the existing marketing UI through `children`, optional controlled `open` / `onOpenChange`, status and lifecycle callbacks. Its dialog keeps children mounted, uses the existing overlay allow-list, and accepts `dialogProps` for portal, z-index and focus integration. |
| `HolderSection`, `CheckoutSection`, `NoteField`, `TimeValidity`, `BookingBanner`, `ResourcePicker` | Layout and controlled values only. Existing Holder, resource, time, note and pricing contracts remain authoritative. |

The copied `ContactFields` convenience renderer retains its source name/email hints; it does not replace the production Holder or resource-form validation. Result-only layout helpers and translated strings may remain in copied source files, but no result route, successful-order behavior, fake hold or demo payment service is included. The demo's `ExtrasPicker`, `HolderPicker`, flow models, catalog and transaction services are excluded. The two production page adapters decide their own step order and use the existing sales product list for extras.

This layer was checked with TypeScript parsing and a targeted `noEmit` pass over its 34 TS/TSX files, using the PC host's intact React 17.0.93 declarations through a read-only compiler-host mapping. The local Pisell2 React declaration copy has a pre-existing syntax error and was not changed. CSS was parsed with PostCSS; all relative imports resolve. These checks do not establish browser appearance or production loading. No build, Vitest or package publication was performed for this migration.

## Controlled configuration

The production time cards read `interface.capacity_display_content` from the current business's existing `os.otherParams.openData` snapshot. Missing, empty or invalid settings show no capacity information; unknown values are ignored. `maximum_capacity` displays the OS candidate's maximum usable **remaining** capacity (largest available resource within each required group, then the bottleneck across required groups), following BookingByStep's `count` rather than summing rooms. `available_quantity` displays available room choices for Party, and total remaining places for Tickets, taking the minimum across required groups. Optional groups do not constrain these figures. Missing projection values are omitted rather than invented as zero. `colour_indicators` adds an availability dot; unavailable time cards retain their existing reason. These are display-only calculations over the already-loaded candidate and never refresh resources or alter selection/checkout rules.

```tsx
import {
  VenueBookingDesignProvider,
  type DesignTokenConfig,
} from '../../plus/venueBookingDesign';

const design: DesignTokenConfig = {
  version: 1,
  overrides: {
    'page-gutter': { pc: 24 },
    'font-title': { pc: 30, h5: 24 },
  },
};

<VenueBookingDesignProvider
  lang="en"
  currency="AUD"
  timeZone="Australia/Sydney"
  brand={{ name: merchant.name, logo: merchant.logo, primaryColor: '#D61518' }}
  design={design}
>
  {children}
</VenueBookingDesignProvider>;
```

The provider accepts `design` and the original `theme` alias (`design` wins). Both use `{version:1, overrides:{tokenId:{pc?,h5?,kiosk?}}}` without localStorage. `normalizeVenueBookingDesignConfig` and `normalizeVenueBookingBrand` can validate host configuration before rendering; invalid input throws rather than partially applying a different theme. Token validation rejects unknown tokens, non-finite/out-of-range values and H5 overrides for scalar/spacing tokens.

`brand` is a partial original `BrandConfig`: `version`, `name`, `logo`, `logoMode`, `mascot`, `primaryColor`. The host maps its merchant identity into these fields. Default identity is empty name with no logo/mascot; the demo venue's name and photography are not bundled. The retained visual primary default is `#D61518`. Images remain host-provided URLs. This module never changes document title/favicon, host language metadata, authentication or order state.

The production `VenueBookingSales` adapter reads the existing PC/H5 `appHelper.constants.themeColor` (from `global.setting.colors.global.themeColor`) before passing `brand` to this provider. A valid shop colour takes priority over `config.brand.primaryColor`; missing/invalid shop values retain the configured/default fallback. Short/six-digit hex and opaque RGB/RGBA are normalized to `#RRGGBB`. The resulting palette is shared by the page, portals, SKU controls and promotion panels. No extra settings request or order/catalog scope change is needed; other brand fields remain unchanged.

`useBookingUI` / `useOptionalBookingUI` keep the original `lang`, `currency`, `timeZone`, `root`, `portal`, `background`, `progress`, `money` context. The adapter additionally exposes normalized `brand`, `design`, `brandTokens`, `scopeId`; `useVenueBookingDesign` is the same required-context hook. `money` retains the prototype's **integer minor-unit** contract; do not pass OS major-unit prices directly. Existing material price components can remain authoritative.

The main tree and its sibling portal receive identical scope selectors and brand CSS variables. Pass `context.portal` to material overlays that do not already use the copied `Dialog`; otherwise their styles will not inherit the venue theme. `backgroundElement`, when supplied, must not contain `portalContainer`, because the dialog makes its background inert. The provider does not inert the page itself.

## Original token defaults

All 44 token definitions retain their source IDs, limits, steps, defaults and labels. Values below are PC/H5; a single value is shared. Dimensions are px unless stated otherwise.

| Group | IDs and defaults |
| --- | --- |
| Spacing | `space-unit` 6; `space-h5-scale` exactly 2/3; `page-gutter`, `section-gap`, `card-padding`, `dialog-padding-x`, `grid-gap` 24/16; `heading-content-gap`, `dialog-padding-y`, `form-gap`, `action-gap`, `compact-padding` 18/12; `inline-gap` 12/8; `column-gap` 36/24 |
| Layout | `content-max` 1360; `content-compact-max` 1180; `summary-width` 350; `dialog-width` 500; `dialog-wide-width` 760; `dialog-package-width` 880; `dialog-calendar-width` 410/480; `summary-sticky-offset` 22 |
| Typography | `font-body` 16; `font-label` 14; `font-small` 13/12; `font-caption` 11; `font-heading` 23/20; `font-subheading` 20/18; `font-title` 30/24; `font-page-title` 42/32; `font-amount` 30/23; unitless `line-body` 1.5, `line-heading` 1.2, `weight-body` 400, `weight-strong` 700 |
| Shape | `radius-control` 10; `radius-button` 12; `radius-card` 16/14; `radius-dialog` 22/18; `border-width` 1 |
| Controls | `control-height` 52/48; `control-compact-height` 48; `icon-target` 44 |
| Shadow | Unitless `shadow-strength` 1 |

At **700px**, only spacing is scaled by `space-h5-scale`; paired tokens switch to their H5 value. The page is never globally zoomed. Unoverridden purpose spacings derive from `space-unit`; a purpose override fixes its PC value and still scales on H5. The eight derived `space-2xs/xs/sm/md/lg/xl/2xl/3xl` values use 0.5/1/2/3/4/6/8/12 times the unit. Shadow strength controls the original panel/dialog/bar shadows.

Brand colour is independent of numeric design tokens. Original fixed semantic colours include ink `#092d3e`, cream `#fffdf8`, yellow `#ffcb33`, muted `#526371`, line `#e1e3de`, error `#a82e28`, success `#137256`. The primary colour derives contrast-safe foreground, hover, pale surfaces, border, focus and link colours. Baloo 2 ExtraBold is declared as `BookingBaloo` for headings; DM Sans Regular/Bold are `BookingDM` for body text, with PingFang SC/Microsoft YaHei fallbacks. No family/photography setting was added.

## Compatibility-only changes

- Classic React JSX imports are explicit for the material package.
- DOM/ARIA IDs use the existing `useStableInstanceId` hook. PC/H5 provide React 17, so copied presentation components must not call React 18-only `useId`.
- Local `Language` replaces imports of the demo transaction `contracts.ts`.
- `designCSS` uses its existing scoped-selector argument instead of `replaceAll`.
- `resetDesignTokens` and progression use ES2017-compatible reducers instead of `Object.fromEntries`/`flatMap`; the existing web token defaults remain compatible; optional Kiosk tokens extend the registry.
- Reduced-motion scrolling uses standard `auto` instead of the newer `instant` literal.
- The original `narrowSymbol` currency display is retained with a local type assertion for the package's ES2017 Intl declarations.
- Host normalization and scoped design context are added; there is no global brand or token persistence.

CSS files and fonts are copied directly, preserving original selectors and layout. The base and design-consumer stylesheet adaptations exclude descendants of `.venue-booking-legacy-controls` from native button/input resets using a zero-specificity `:where()` guard. This protects retained SKU and marketing components. Existing AntD fields use a small theme bridge rather than a second visual system.

Other production adapters keep the original presentation while changing data and lifecycle contracts:

- Calendar availability comes from OS projections. An unqueried day is disabled until confirmed available. The demo's 180-day window is only a growing display range, not a default booking cutoff; only an explicit `maxDate` sets a business boundary.
- Summary and booking dialogs cooperate with existing higher-layer SKU/marketing overlays; merchant tokens apply to both the main tree and portal. SKU-only Party flows do not render booking fields.
- Catalog cards are rendered through the existing product-list slot. Product filtering, quantity, prices, loading and selection remain owned by the existing sales list; retail extras retain its standard cards.
- Capacity, resources and order prices are real OS data. Missing photo, brand logo or mascot does not introduce demo venue assets.

## Material configuration entry

Pass the Design Studio exported JSON as `venueBookingConfig.design` alongside the independently configured menus. For example:

```ts
venueBookingConfig: {
  template: 'tickets',
  steps: { tickets: { catalog: { menuListIds: [49215] } } },
  brand: { name: 'Your venue', primaryColor: '#D61518' },
  design: {
    version: 1,
    overrides: {
      'space-unit': { pc: 6 },
      'space-h5-scale': { pc: 2 / 3 },
      'page-gutter': { pc: 24 },
      'font-title': { pc: 30, h5: 24 },
    },
  },
}
```

The numeric editor UI is not bundled into the customer booking page. Its version-1 configuration and 44 web tokens remain compatible; optional Kiosk overrides extend the same schema. Updating valid visual configuration does not recreate the order; invalid visual configuration retains the last valid appearance and shows a warning. Menus and template remain part of the order scope.


## Explicit Kiosk presentation

`BookingUIProvider` accepts `presentationPlatform="kiosk"` and `layout="compact"`.
The Kiosk presentation defaults to compact composition; the layout choice controls
`useOrderPanel()` independently of the 700px browser breakpoint. The page, its
provider portal and explicitly scoped `Dialog` portals all carry
`data-booking-presentation="kiosk"`. Ordinary providers default to the existing
responsive web presentation.

`kiosk.css` is carried directly from `WorkSpace/bigsales/src/kiosk/kiosk.css`.
Changes are scoped selectors, bindings to design tokens, production catalogue
selectors, the retained AntD calendar and touch sizes for retained controls.
It does not bring the demo session timer, service or payment logic.

The Provider reuses the existing Kiosk body-transform/visual-viewport convention:
scaled hosts divide the visible viewport height by the target body scale; at
scale 1, the host container height and existing `--app-content-height` take
priority. The visible keyboard height is already reflected by visualViewport,
so no second deduction is applied. Page and portals receive the same logical
height. The Kiosk page owns a bounded vertical scroll area; action-bar and offers
reservations divide their element rects by the current computed body scale.
Window, visualViewport, body-style and container-size listeners are cleaned up.

The retained customer-auth portal can opt into `venue-booking-kiosk-auth` for
large typography and touch targets without changing ordinary auth modals. It
keeps its existing authentication logic and independent AntD portal.

Existing paired and spacing tokens accept a `kiosk` value. Without it, dimensions
derive from the H5 value at `kiosk-scale` (default 2); unitless line heights and
weights are not multiplied. Shared scalar settings, such as `space-unit`, continue
to use their existing `pc` entry. Kiosk pixel overrides allow the existing token
range up to three times its web maximum, so touch-sized values remain valid.

Eleven Kiosk-only tokens accept only a `kiosk` value:

- `kiosk-scale` 2; `kiosk-card-scale` 1.5; `kiosk-card-padding-scale` 1.25.
- `kiosk-catalog-columns` 2; `kiosk-description-lines` 2.
- `kiosk-card-body` 24 and `kiosk-card-title` 36, derived from H5 typography and
  the card scale when not explicitly overridden; `kiosk-card-price` 40.
- `kiosk-card-action-height` 80; `kiosk-date-card-height` 108;
  `kiosk-calendar-day-size` 88.

For example, this changes self-service typography/touch targets without changing
PC or H5 values:

```ts
{ version: 1, overrides: {
  'font-body': { kiosk: 34 },
  'control-height': { kiosk: 104 },
  'page-gutter': { kiosk: 40 },
  'kiosk-card-title': { kiosk: 38 },
  'kiosk-catalog-columns': { kiosk: 2 },
} }
```

The 1080×1920 composition retains two main-product columns and a single-column
retail-extras list. At narrower viewports it falls back to one main-product column
without pretending to be an H5 business client. The existing three-line web
summary remains unchanged; Kiosk uses its independently configured line count.

The production entry additionally requires a real `platform: 'kiosk'` and
`venueBookingMode: 'tickets' | 'party'` on the existing UnifiedBookingSales
instance. Presentation width does not grant Kiosk business capabilities. The
Kiosk host chooses `ticketing_1` / `party_1` from the current business's Kiosk
OpenData, supplies independent main/extras menus, and owns `onRequestHome`.
Unknown templates continue to use the original KioskSale.

Venue Kiosk drafts use the current order customer and do not persist a browser
reload draft or synchronize the device operator into the customer. Required
Holder authentication reuses the existing CustomerAuth host. Checkout reuses
native Kiosk payment, printing and result components; cancellation retries the
same submitted order. Payment keeps its draft lease until the complete native
promise settles, including on unmount. Exit, host screen-protector execution and
successful result navigation retire only their captured order owner. No demo
idle timer or payment simulation is used.

Source integration does not update the host's published material/OS versions.
Release those packages and update the host's consumed versions before device
acceptance. Static CSS fixtures and controlled hook probes verify layout and
ownership contracts; they do not establish physical payment or printer results.
