@seatlayer/react 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  EmbeddedDesigner: () => EmbeddedDesigner,
24
+ SeatPicker: () => SeatPicker,
24
25
  SeatingChart: () => SeatingChart
25
26
  });
26
27
  module.exports = __toCommonJS(index_exports);
@@ -78,7 +79,10 @@ var SeatingChart = (0, import_react.forwardRef)(
78
79
  setSeatTier: (seatId, tierId) => chartRef.current?.setSeatTier(seatId, tierId),
79
80
  getFloors: () => chartRef.current?.getFloors() ?? [],
80
81
  setFloor: (floorId) => chartRef.current?.setFloor(floorId),
81
- setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on)
82
+ setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on),
83
+ zoomIn: () => chartRef.current?.zoomIn(),
84
+ zoomOut: () => chartRef.current?.zoomOut(),
85
+ zoomToFit: () => chartRef.current?.zoomToFit()
82
86
  }),
83
87
  []
84
88
  );
@@ -131,9 +135,61 @@ var EmbeddedDesigner = (0, import_react2.forwardRef)(
131
135
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: containerRef, className: props.className, style: props.style });
132
136
  }
133
137
  );
138
+
139
+ // src/SeatPicker.tsx
140
+ var import_react3 = require("react");
141
+ var import_js3 = require("@seatlayer/js");
142
+ var import_jsx_runtime3 = require("react/jsx-runtime");
143
+ var SeatPicker = (0, import_react3.forwardRef)(
144
+ function SeatPicker2(props, ref) {
145
+ const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs } = props;
146
+ const containerRef = (0, import_react3.useRef)(null);
147
+ const pickerRef = (0, import_react3.useRef)(null);
148
+ const callbacks = (0, import_react3.useRef)(props);
149
+ callbacks.current = props;
150
+ (0, import_react3.useEffect)(() => {
151
+ const el = containerRef.current;
152
+ if (!el) return;
153
+ const picker = new import_js3.SeatPicker({
154
+ container: el,
155
+ event,
156
+ apiBase,
157
+ maxSelection,
158
+ publicKey,
159
+ locale,
160
+ currency,
161
+ colorblindSafe,
162
+ holdTtlMs,
163
+ theme: callbacks.current.theme,
164
+ messages: callbacks.current.messages,
165
+ onCheckout: (hold, seats) => callbacks.current.onCheckout?.(hold, seats),
166
+ onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),
167
+ onHoldExpired: () => callbacks.current.onHoldExpired?.(),
168
+ onError: (err) => callbacks.current.onError?.(err)
169
+ });
170
+ pickerRef.current = picker;
171
+ void picker.render();
172
+ return () => {
173
+ picker.destroy();
174
+ pickerRef.current = null;
175
+ };
176
+ }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs]);
177
+ (0, import_react3.useImperativeHandle)(
178
+ ref,
179
+ () => ({
180
+ getSelection: () => pickerRef.current?.getSelection() ?? [],
181
+ bestAvailable: (qty, categoryKey) => pickerRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),
182
+ release: () => pickerRef.current?.release() ?? Promise.resolve()
183
+ }),
184
+ []
185
+ );
186
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: containerRef, className, style });
187
+ }
188
+ );
134
189
  // Annotate the CommonJS export names for ESM import in node:
135
190
  0 && (module.exports = {
136
191
  EmbeddedDesigner,
192
+ SeatPicker,
137
193
  SeatingChart
138
194
  });
139
195
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/SeatingChart.tsx","../src/EmbeddedDesigner.tsx"],"sourcesContent":["/**\n * @seatlayer/react — the React wrapper for the SeatLayer embed SDK.\n */\nexport { SeatingChart } from './SeatingChart';\nexport { EmbeddedDesigner } from './EmbeddedDesigner';\nexport type {\n SeatingChartProps,\n SeatingChartHandle,\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n} from './SeatingChart';\nexport type { EmbeddedDesignerProps, EmbeddedDesignerHandle, EmbeddedDesignerMessage } from './EmbeddedDesigner';\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type HoldLineItem,\n} from '@seatlayer/js';\n\nexport type { SelectedSeat, HoldResult, BestAvailableResult, GAAreaAvailability, HoldLineItem } from '@seatlayer/js';\nexport type { SeatHoverDetails } from '@seatlayer/js';\n\n/** Imperative handle exposed via `ref` — call these to drive the picker from your app. */\nexport interface SeatingChartHandle {\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n hold(options?: { ttlMs?: number }): Promise<HoldResult | null>;\n /** GA areas with live remaining capacity. */\n getGAAreas(): GAAreaAvailability[];\n /** Atomically hold a quantity from one GA area. */\n holdGA(areaId: string, qty: number, options?: { tierId?: string | null; ttlMs?: number }): Promise<HoldResult | null>;\n /** Ask the server for the `qty` best free seats and hold them atomically. */\n bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;\n /** Release the current hold (if any). */\n release(): Promise<void>;\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[];\n /**\n * Choose a ticket tier for a selected seat (e.g. Adult → Child). Available\n * `tiers` are on each `SelectedSeat`; `tierId=null` reverts to the default.\n */\n setSeatTier(seatId: string, tierId: string | null): void;\n /**\n * Floors of a multi-floor chart — `[{ id, name }]` (single-floor charts\n * return one entry; empty before render()). Pair with setFloor().\n */\n getFloors(): { id: string; name: string }[];\n /** Switch the shown floor (2D). Warns + no-ops on single-floor charts. */\n setFloor(floorId: string): void;\n /** Toggle colorblind-safe rendering at runtime (see the `colorblindSafe` prop). */\n setColorblindSafe(on: boolean): void;\n}\n\nexport interface SeatingChartProps extends Omit<SeatingChartOptions, 'container'> {\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * React wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The underlying canvas is created once and torn down on unmount. Callback props\n * (`onSelectionChange`, `onHold`, `onError`, `onDeckTap`, `onHint`) may change\n * freely between renders without re-mounting the canvas — only `event`,\n * `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`, and\n * `colorblindSafe` trigger a rebuild. (`messages` is read once per mount;\n * changing it alone does not re-apply.)\n */\nexport const SeatingChart = forwardRef<SeatingChartHandle, SeatingChartProps>(\n function SeatingChart(props, ref) {\n const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe } = props;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartRef = useRef<CoreSeatingChart | null>(null);\n\n // Always call the latest callbacks without rebuilding the chart.\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const chart = new CoreSeatingChart({\n container: el,\n event,\n apiBase,\n maxSelection,\n publicKey,\n locale,\n currency,\n colorblindSafe,\n messages: callbacks.current.messages,\n onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),\n onHold: (result) => callbacks.current.onHold?.(result),\n onHoldExpired: () => callbacks.current.onHoldExpired?.(),\n onGAClick: (area) => callbacks.current.onGAClick?.(area),\n onError: (err) => callbacks.current.onError?.(err),\n onDeckTap: (floorId) => callbacks.current.onDeckTap?.(floorId),\n onHint: (message) => callbacks.current.onHint?.(message),\n seatTooltip: props.seatTooltip,\n onSeatHover: (details) => callbacks.current.onSeatHover?.(details),\n });\n chartRef.current = chart;\n void chart.render();\n\n return () => {\n chart.destroy();\n chartRef.current = null;\n };\n // Rebuild only when the identity of the chart changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe]);\n\n useImperativeHandle(\n ref,\n (): SeatingChartHandle => ({\n hold: (options) => chartRef.current?.hold(options) ?? Promise.resolve(null),\n getGAAreas: () => chartRef.current?.getGAAreas() ?? [],\n holdGA: (areaId, qty, options) => chartRef.current?.holdGA(areaId, qty, options) ?? Promise.resolve(null),\n bestAvailable: (qty, categoryKey) =>\n chartRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => chartRef.current?.release() ?? Promise.resolve(),\n getSelection: () => chartRef.current?.getSelection() ?? [],\n setSeatTier: (seatId, tierId) => chartRef.current?.setSeatTier(seatId, tierId),\n getFloors: () => chartRef.current?.getFloors() ?? [],\n setFloor: (floorId) => chartRef.current?.setFloor(floorId),\n setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on),\n }),\n [],\n );\n\n return <div ref={containerRef} className={className} style={style} />;\n },\n);\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n EmbeddedDesigner as CoreEmbeddedDesigner,\n type EmbeddedDesignerMessage,\n} from '@seatlayer/js';\n\nexport type { EmbeddedDesignerMessage } from '@seatlayer/js';\n\nexport interface EmbeddedDesignerHandle {\n /** Recreate the iframe with a newly-minted session URL. */\n setDesignerUrl(designerUrl: string): void;\n /** The currently mounted iframe, if any. */\n getIframe(): HTMLIFrameElement | null;\n}\n\nexport interface EmbeddedDesignerProps {\n /** Short-lived `designerUrl` returned by your backend. Never pass an `sk_` key. */\n designerUrl: string;\n expectedChartId?: string;\n expectedWorkspaceId?: string;\n title?: string;\n className?: string;\n style?: CSSProperties;\n iframeClassName?: string;\n iframeStyle?: Partial<CSSStyleDeclaration>;\n allow?: string;\n referrerPolicy?: ReferrerPolicy;\n onReady?: (message: EmbeddedDesignerMessage) => void;\n onSaved?: (message: EmbeddedDesignerMessage) => void;\n onPublished?: (message: EmbeddedDesignerMessage) => void;\n onClose?: (message: EmbeddedDesignerMessage) => void;\n onError?: (message: EmbeddedDesignerMessage) => void;\n}\n\n/**\n * Native-feeling React host for the secure SeatLayer Designer iframe.\n * A new `designerUrl` always recreates the iframe, so a new fragment token can\n * never retain state from an earlier chart session.\n */\nexport const EmbeddedDesigner = forwardRef<EmbeddedDesignerHandle, EmbeddedDesignerProps>(\n function EmbeddedDesigner(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const designerRef = useRef<CoreEmbeddedDesigner | null>(null);\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const designer = new CoreEmbeddedDesigner({\n designerUrl: props.designerUrl,\n container,\n expectedChartId: props.expectedChartId,\n expectedWorkspaceId: props.expectedWorkspaceId,\n title: props.title,\n className: props.iframeClassName,\n style: props.iframeStyle,\n allow: props.allow,\n referrerPolicy: props.referrerPolicy,\n onReady: (message) => callbacks.current.onReady?.(message),\n onSaved: (message) => callbacks.current.onSaved?.(message),\n onPublished: (message) => callbacks.current.onPublished?.(message),\n onClose: (message) => callbacks.current.onClose?.(message),\n onError: (message) => callbacks.current.onError?.(message),\n });\n designer.mount();\n designerRef.current = designer;\n return () => {\n designer.destroy();\n designerRef.current = null;\n };\n // Session/chart identity changes must recreate the iframe. Callback changes are\n // picked up from the ref without reloading an in-progress Designer session.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.designerUrl, props.expectedChartId, props.expectedWorkspaceId, props.title, props.iframeClassName, props.iframeStyle, props.allow, props.referrerPolicy]);\n\n useImperativeHandle(ref, () => ({\n setDesignerUrl: (designerUrl) => { designerRef.current?.setDesignerUrl(designerUrl); },\n getIframe: () => designerRef.current?.getIframe() ?? null,\n }), []);\n\n return <div ref={containerRef} className={props.className} style={props.style} />;\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAMO;AACP,gBAQO;AAkHI;AAhEJ,IAAM,mBAAe;AAAA,EAC1B,SAASA,cAAa,OAAO,KAAK;AAChC,UAAM,EAAE,WAAW,OAAO,OAAO,SAAS,cAAc,WAAW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AC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,QACzD,SAAS,CAAC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,QACzD,aAAa,CAAC,YAAY,UAAU,QAAQ,cAAc,OAAO;AAAA,QACjE,SAAS,CAAC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,QACzD,SAAS,CAAC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,MAC3D,CAAC;AACD,eAAS,MAAM;AACf,kBAAY,UAAU;AACtB,aAAO,MAAM;AACX,iBAAS,QAAQ;AACjB,oBAAY,UAAU;AAAA,MACxB;AAAA,IAIF,GAAG,CAAC,MAAM,aAAa,MAAM,iBAAiB,MAAM,qBAAqB,MAAM,OAAO,MAAM,iBAAiB,MAAM,aAAa,MAAM,OAAO,MAAM,cAAc,CAAC;AAElK,2CAAoB,KAAK,OAAO;AAAA,MAC9B,gBAAgB,CAAC,gBAAgB;AAAE,oBAAY,SAAS,eAAe,WAAW;AAAA,MAAG;AAAA,MACrF,WAAW,MAAM,YAAY,SAAS,UAAU,KAAK;AAAA,IACvD,IAAI,CAAC,CAAC;AAEN,WAAO,6CAAC,SAAI,KAAK,cAAc,WAAW,MAAM,WAAW,OAAO,MAAM,OAAO;AAAA,EACjF;AACF;","names":["SeatingChart","CoreSeatingChart","import_react","import_js","import_jsx_runtime","EmbeddedDesigner","CoreEmbeddedDesigner"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/SeatingChart.tsx","../src/EmbeddedDesigner.tsx","../src/SeatPicker.tsx"],"sourcesContent":["/**\n * @seatlayer/react — the React wrapper for the SeatLayer embed SDK.\n */\nexport { SeatingChart } from './SeatingChart';\nexport { EmbeddedDesigner } from './EmbeddedDesigner';\nexport type {\n SeatingChartProps,\n SeatingChartHandle,\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n} from './SeatingChart';\nexport type { EmbeddedDesignerProps, EmbeddedDesignerHandle, EmbeddedDesignerMessage } from './EmbeddedDesigner';\nexport { SeatPicker } from './SeatPicker';\nexport type { SeatPickerHandle, SeatPickerProps, SeatPickerOptions, SeatPickerTheme } from './SeatPicker';\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type HoldLineItem,\n} from '@seatlayer/js';\n\nexport type { SelectedSeat, HoldResult, BestAvailableResult, GAAreaAvailability, HoldLineItem } from '@seatlayer/js';\nexport type { SeatHoverDetails } from '@seatlayer/js';\n\n/** Imperative handle exposed via `ref` — call these to drive the picker from your app. */\nexport interface SeatingChartHandle {\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n hold(options?: { ttlMs?: number }): Promise<HoldResult | null>;\n /** GA areas with live remaining capacity. */\n getGAAreas(): GAAreaAvailability[];\n /** Atomically hold a quantity from one GA area. */\n holdGA(areaId: string, qty: number, options?: { tierId?: string | null; ttlMs?: number }): Promise<HoldResult | null>;\n /** Ask the server for the `qty` best free seats and hold them atomically. */\n bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;\n /** Release the current hold (if any). */\n release(): Promise<void>;\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[];\n /**\n * Choose a ticket tier for a selected seat (e.g. Adult → Child). Available\n * `tiers` are on each `SelectedSeat`; `tierId=null` reverts to the default.\n */\n setSeatTier(seatId: string, tierId: string | null): void;\n /**\n * Floors of a multi-floor chart — `[{ id, name }]` (single-floor charts\n * return one entry; empty before render()). Pair with setFloor().\n */\n getFloors(): { id: string; name: string }[];\n /** Switch the shown floor (2D). Warns + no-ops on single-floor charts. */\n setFloor(floorId: string): void;\n /** Toggle colorblind-safe rendering at runtime (see the `colorblindSafe` prop). */\n setColorblindSafe(on: boolean): void;\n /** Zoom in one step (same increment as the wheel/pinch gesture). */\n zoomIn(): void;\n /** Zoom out one step. */\n zoomOut(): void;\n /** Reset the camera so the whole chart fits the container. */\n zoomToFit(): void;\n}\n\nexport interface SeatingChartProps extends Omit<SeatingChartOptions, 'container'> {\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * React wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The underlying canvas is created once and torn down on unmount. Callback props\n * (`onSelectionChange`, `onHold`, `onError`, `onDeckTap`, `onHint`) may change\n * freely between renders without re-mounting the canvas — only `event`,\n * `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`, and\n * `colorblindSafe` trigger a rebuild. (`messages` is read once per mount;\n * changing it alone does not re-apply.)\n */\nexport const SeatingChart = forwardRef<SeatingChartHandle, SeatingChartProps>(\n function SeatingChart(props, ref) {\n const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe } = props;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartRef = useRef<CoreSeatingChart | null>(null);\n\n // Always call the latest callbacks without rebuilding the chart.\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const chart = new CoreSeatingChart({\n container: el,\n event,\n apiBase,\n maxSelection,\n publicKey,\n locale,\n currency,\n colorblindSafe,\n messages: callbacks.current.messages,\n onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),\n onHold: (result) => callbacks.current.onHold?.(result),\n onHoldExpired: () => callbacks.current.onHoldExpired?.(),\n onGAClick: (area) => callbacks.current.onGAClick?.(area),\n onError: (err) => callbacks.current.onError?.(err),\n onDeckTap: (floorId) => callbacks.current.onDeckTap?.(floorId),\n onHint: (message) => callbacks.current.onHint?.(message),\n seatTooltip: props.seatTooltip,\n onSeatHover: (details) => callbacks.current.onSeatHover?.(details),\n });\n chartRef.current = chart;\n void chart.render();\n\n return () => {\n chart.destroy();\n chartRef.current = null;\n };\n // Rebuild only when the identity of the chart changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe]);\n\n useImperativeHandle(\n ref,\n (): SeatingChartHandle => ({\n hold: (options) => chartRef.current?.hold(options) ?? Promise.resolve(null),\n getGAAreas: () => chartRef.current?.getGAAreas() ?? [],\n holdGA: (areaId, qty, options) => chartRef.current?.holdGA(areaId, qty, options) ?? Promise.resolve(null),\n bestAvailable: (qty, categoryKey) =>\n chartRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => chartRef.current?.release() ?? Promise.resolve(),\n getSelection: () => chartRef.current?.getSelection() ?? [],\n setSeatTier: (seatId, tierId) => chartRef.current?.setSeatTier(seatId, tierId),\n getFloors: () => chartRef.current?.getFloors() ?? [],\n setFloor: (floorId) => chartRef.current?.setFloor(floorId),\n setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on),\n zoomIn: () => chartRef.current?.zoomIn(),\n zoomOut: () => chartRef.current?.zoomOut(),\n zoomToFit: () => chartRef.current?.zoomToFit(),\n }),\n [],\n );\n\n return <div ref={containerRef} className={className} style={style} />;\n },\n);\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n EmbeddedDesigner as CoreEmbeddedDesigner,\n type EmbeddedDesignerMessage,\n} from '@seatlayer/js';\n\nexport type { EmbeddedDesignerMessage } from '@seatlayer/js';\n\nexport interface EmbeddedDesignerHandle {\n /** Recreate the iframe with a newly-minted session URL. */\n setDesignerUrl(designerUrl: string): void;\n /** The currently mounted iframe, if any. */\n getIframe(): HTMLIFrameElement | null;\n}\n\nexport interface EmbeddedDesignerProps {\n /** Short-lived `designerUrl` returned by your backend. Never pass an `sk_` key. */\n designerUrl: string;\n expectedChartId?: string;\n expectedWorkspaceId?: string;\n title?: string;\n className?: string;\n style?: CSSProperties;\n iframeClassName?: string;\n iframeStyle?: Partial<CSSStyleDeclaration>;\n allow?: string;\n referrerPolicy?: ReferrerPolicy;\n onReady?: (message: EmbeddedDesignerMessage) => void;\n onSaved?: (message: EmbeddedDesignerMessage) => void;\n onPublished?: (message: EmbeddedDesignerMessage) => void;\n onClose?: (message: EmbeddedDesignerMessage) => void;\n onError?: (message: EmbeddedDesignerMessage) => void;\n}\n\n/**\n * Native-feeling React host for the secure SeatLayer Designer iframe.\n * A new `designerUrl` always recreates the iframe, so a new fragment token can\n * never retain state from an earlier chart session.\n */\nexport const EmbeddedDesigner = forwardRef<EmbeddedDesignerHandle, EmbeddedDesignerProps>(\n function EmbeddedDesigner(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const designerRef = useRef<CoreEmbeddedDesigner | null>(null);\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const designer = new CoreEmbeddedDesigner({\n designerUrl: props.designerUrl,\n container,\n expectedChartId: props.expectedChartId,\n expectedWorkspaceId: props.expectedWorkspaceId,\n title: props.title,\n className: props.iframeClassName,\n style: props.iframeStyle,\n allow: props.allow,\n referrerPolicy: props.referrerPolicy,\n onReady: (message) => callbacks.current.onReady?.(message),\n onSaved: (message) => callbacks.current.onSaved?.(message),\n onPublished: (message) => callbacks.current.onPublished?.(message),\n onClose: (message) => callbacks.current.onClose?.(message),\n onError: (message) => callbacks.current.onError?.(message),\n });\n designer.mount();\n designerRef.current = designer;\n return () => {\n designer.destroy();\n designerRef.current = null;\n };\n // Session/chart identity changes must recreate the iframe. Callback changes are\n // picked up from the ref without reloading an in-progress Designer session.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.designerUrl, props.expectedChartId, props.expectedWorkspaceId, props.title, props.iframeClassName, props.iframeStyle, props.allow, props.referrerPolicy]);\n\n useImperativeHandle(ref, () => ({\n setDesignerUrl: (designerUrl) => { designerRef.current?.setDesignerUrl(designerUrl); },\n getIframe: () => designerRef.current?.getIframe() ?? null,\n }), []);\n\n return <div ref={containerRef} className={props.className} style={props.style} />;\n },\n);\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n SeatPicker as CoreSeatPicker,\n type SeatPickerOptions,\n type SeatPickerTheme,\n type SelectedSeat,\n type HoldResult,\n} from '@seatlayer/js';\n\nexport type { SeatPickerOptions, SeatPickerTheme } from '@seatlayer/js';\n\n/** Imperative handle for the full-experience picker widget. */\nexport interface SeatPickerHandle {\n /** Current selection with resolved prices. */\n getSelection(): SelectedSeat[];\n /** Server-side best seats + hold, reflected in the widget tray. */\n bestAvailable(qty: number, categoryKey?: string): Promise<HoldResult | null>;\n /** Release the current hold (if any) and reset the tray. */\n release(): Promise<void>;\n}\n\nexport interface SeatPickerProps extends Omit<SeatPickerOptions, 'container'> {\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * React wrapper around the full SeatPicker widget (header · live price panel ·\n * tray · GA · hold countdown · toasts). The widget is container-adaptive: give\n * the wrapping div a size and it lays itself out for that box (side panel wide,\n * bottom sheet narrow). For the one-call modal, use `SeatPicker.open()` from\n * `@seatlayer/js` directly.\n */\nexport const SeatPicker = forwardRef<SeatPickerHandle, SeatPickerProps>(\n function SeatPicker(props, ref) {\n const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs } = props;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const pickerRef = useRef<CoreSeatPicker | null>(null);\n\n // Always call the latest callbacks without rebuilding the widget.\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const picker = new CoreSeatPicker({\n container: el,\n event,\n apiBase,\n maxSelection,\n publicKey,\n locale,\n currency,\n colorblindSafe,\n holdTtlMs,\n theme: callbacks.current.theme,\n messages: callbacks.current.messages,\n onCheckout: (hold, seats) => callbacks.current.onCheckout?.(hold, seats),\n onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),\n onHoldExpired: () => callbacks.current.onHoldExpired?.(),\n onError: (err) => callbacks.current.onError?.(err),\n });\n pickerRef.current = picker;\n void picker.render();\n\n return () => {\n picker.destroy();\n pickerRef.current = null;\n };\n // Rebuild only when the identity of the event/config changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs]);\n\n useImperativeHandle(\n ref,\n (): SeatPickerHandle => ({\n getSelection: () => pickerRef.current?.getSelection() ?? [],\n bestAvailable: (qty, categoryKey) => pickerRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => pickerRef.current?.release() ?? Promise.resolve(),\n }),\n [],\n );\n\n return <div ref={containerRef} className={className} style={style} />;\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAMO;AACP,gBAQO;AA2HI;AAnEJ,IAAM,mBAAe;AAAA,EAC1B,SAASA,cAAa,OAAO,KAAK;AAChC,UAAM,EAAE,WAAW,OAAO,OAAO,SAAS,cAAc,WAAW,QAAQ,UAAU,eAAe,IAAI;AAExG,UAAM,mBAAe,qBAA8B,IAAI;AACvD,UAAM,eAAW,qBAAgC,IAAI;AAGrD,UAAM,gBAAY,qBAAO,KAAK;AAC9B,cAAU,UAAU;AAEpB,gCAAU,MAAM;AACd,YAAM,KAAK,aAAa;AACxB,UAAI,CAAC,GAAI;AAET,YAAM,QAAQ,IAAI,UAAAC,aAAiB;AAAA,QACjC,WAAW;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,UAAU,QAAQ;AAAA,QAC5B,mBAAmB,CAAC,UAAU,UAAU,QAAQ,oBAAoB,KAAK;AAAA,QACzE,QAAQ,CAAC,WAAW,UAAU,QAAQ,SAAS,MAAM;AAAA,QACrD,eAAe,MAAM,UAAU,QAAQ,gBAAgB;AAAA,QACvD,WAAW,CAAC,SAAS,UAAU,QAAQ,YAAY,IAAI;AAAA,QACvD,SAAS,CAAC,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kBAAU,UAAU;AAAA,MACtB;AAAA,IAGF,GAAG,CAAC,OAAO,SAAS,cAAc,WAAW,QAAQ,UAAU,gBAAgB,SAAS,CAAC;AAEzF;AAAA,MACE;AAAA,MACA,OAAyB;AAAA,QACvB,cAAc,MAAM,UAAU,SAAS,aAAa,KAAK,CAAC;AAAA,QAC1D,eAAe,CAAC,KAAK,gBAAgB,UAAU,SAAS,cAAc,KAAK,WAAW,KAAK,QAAQ,QAAQ,IAAI;AAAA,QAC/G,SAAS,MAAM,UAAU,SAAS,QAAQ,KAAK,QAAQ,QAAQ;AAAA,MACjE;AAAA,MACA,CAAC;AAAA,IACH;AAEA,WAAO,6CAAC,SAAI,KAAK,cAAc,WAAsB,OAAc;AAAA,EACrE;AACF;","names":["SeatingChart","CoreSeatingChart","import_react","import_js","import_jsx_runtime","EmbeddedDesigner","CoreEmbeddedDesigner","import_react","import_js","import_jsx_runtime","SeatPicker","CoreSeatPicker"]}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties } from 'react';
3
- import { SeatingChartOptions, HoldResult, GAAreaAvailability, BestAvailableResult, SelectedSeat, EmbeddedDesignerMessage } from '@seatlayer/js';
4
- export { BestAvailableResult, EmbeddedDesignerMessage, GAAreaAvailability, HoldLineItem, HoldResult, SelectedSeat } from '@seatlayer/js';
3
+ import { SeatingChartOptions, HoldResult, GAAreaAvailability, BestAvailableResult, SelectedSeat, EmbeddedDesignerMessage, SeatPickerOptions } from '@seatlayer/js';
4
+ export { BestAvailableResult, EmbeddedDesignerMessage, GAAreaAvailability, HoldLineItem, HoldResult, SeatPickerOptions, SeatPickerTheme, SelectedSeat } from '@seatlayer/js';
5
5
 
6
6
  /** Imperative handle exposed via `ref` — call these to drive the picker from your app. */
7
7
  interface SeatingChartHandle {
@@ -39,6 +39,12 @@ interface SeatingChartHandle {
39
39
  setFloor(floorId: string): void;
40
40
  /** Toggle colorblind-safe rendering at runtime (see the `colorblindSafe` prop). */
41
41
  setColorblindSafe(on: boolean): void;
42
+ /** Zoom in one step (same increment as the wheel/pinch gesture). */
43
+ zoomIn(): void;
44
+ /** Zoom out one step. */
45
+ zoomOut(): void;
46
+ /** Reset the camera so the whole chart fits the container. */
47
+ zoomToFit(): void;
42
48
  }
43
49
  interface SeatingChartProps extends Omit<SeatingChartOptions, 'container'> {
44
50
  className?: string;
@@ -87,4 +93,26 @@ interface EmbeddedDesignerProps {
87
93
  */
88
94
  declare const EmbeddedDesigner: react.ForwardRefExoticComponent<EmbeddedDesignerProps & react.RefAttributes<EmbeddedDesignerHandle>>;
89
95
 
90
- export { EmbeddedDesigner, type EmbeddedDesignerHandle, type EmbeddedDesignerProps, SeatingChart, type SeatingChartHandle, type SeatingChartProps };
96
+ /** Imperative handle for the full-experience picker widget. */
97
+ interface SeatPickerHandle {
98
+ /** Current selection with resolved prices. */
99
+ getSelection(): SelectedSeat[];
100
+ /** Server-side best seats + hold, reflected in the widget tray. */
101
+ bestAvailable(qty: number, categoryKey?: string): Promise<HoldResult | null>;
102
+ /** Release the current hold (if any) and reset the tray. */
103
+ release(): Promise<void>;
104
+ }
105
+ interface SeatPickerProps extends Omit<SeatPickerOptions, 'container'> {
106
+ className?: string;
107
+ style?: CSSProperties;
108
+ }
109
+ /**
110
+ * React wrapper around the full SeatPicker widget (header · live price panel ·
111
+ * tray · GA · hold countdown · toasts). The widget is container-adaptive: give
112
+ * the wrapping div a size and it lays itself out for that box (side panel wide,
113
+ * bottom sheet narrow). For the one-call modal, use `SeatPicker.open()` from
114
+ * `@seatlayer/js` directly.
115
+ */
116
+ declare const SeatPicker: react.ForwardRefExoticComponent<SeatPickerProps & react.RefAttributes<SeatPickerHandle>>;
117
+
118
+ export { EmbeddedDesigner, type EmbeddedDesignerHandle, type EmbeddedDesignerProps, SeatPicker, type SeatPickerHandle, type SeatPickerProps, SeatingChart, type SeatingChartHandle, type SeatingChartProps };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { CSSProperties } from 'react';
3
- import { SeatingChartOptions, HoldResult, GAAreaAvailability, BestAvailableResult, SelectedSeat, EmbeddedDesignerMessage } from '@seatlayer/js';
4
- export { BestAvailableResult, EmbeddedDesignerMessage, GAAreaAvailability, HoldLineItem, HoldResult, SelectedSeat } from '@seatlayer/js';
3
+ import { SeatingChartOptions, HoldResult, GAAreaAvailability, BestAvailableResult, SelectedSeat, EmbeddedDesignerMessage, SeatPickerOptions } from '@seatlayer/js';
4
+ export { BestAvailableResult, EmbeddedDesignerMessage, GAAreaAvailability, HoldLineItem, HoldResult, SeatPickerOptions, SeatPickerTheme, SelectedSeat } from '@seatlayer/js';
5
5
 
6
6
  /** Imperative handle exposed via `ref` — call these to drive the picker from your app. */
7
7
  interface SeatingChartHandle {
@@ -39,6 +39,12 @@ interface SeatingChartHandle {
39
39
  setFloor(floorId: string): void;
40
40
  /** Toggle colorblind-safe rendering at runtime (see the `colorblindSafe` prop). */
41
41
  setColorblindSafe(on: boolean): void;
42
+ /** Zoom in one step (same increment as the wheel/pinch gesture). */
43
+ zoomIn(): void;
44
+ /** Zoom out one step. */
45
+ zoomOut(): void;
46
+ /** Reset the camera so the whole chart fits the container. */
47
+ zoomToFit(): void;
42
48
  }
43
49
  interface SeatingChartProps extends Omit<SeatingChartOptions, 'container'> {
44
50
  className?: string;
@@ -87,4 +93,26 @@ interface EmbeddedDesignerProps {
87
93
  */
88
94
  declare const EmbeddedDesigner: react.ForwardRefExoticComponent<EmbeddedDesignerProps & react.RefAttributes<EmbeddedDesignerHandle>>;
89
95
 
90
- export { EmbeddedDesigner, type EmbeddedDesignerHandle, type EmbeddedDesignerProps, SeatingChart, type SeatingChartHandle, type SeatingChartProps };
96
+ /** Imperative handle for the full-experience picker widget. */
97
+ interface SeatPickerHandle {
98
+ /** Current selection with resolved prices. */
99
+ getSelection(): SelectedSeat[];
100
+ /** Server-side best seats + hold, reflected in the widget tray. */
101
+ bestAvailable(qty: number, categoryKey?: string): Promise<HoldResult | null>;
102
+ /** Release the current hold (if any) and reset the tray. */
103
+ release(): Promise<void>;
104
+ }
105
+ interface SeatPickerProps extends Omit<SeatPickerOptions, 'container'> {
106
+ className?: string;
107
+ style?: CSSProperties;
108
+ }
109
+ /**
110
+ * React wrapper around the full SeatPicker widget (header · live price panel ·
111
+ * tray · GA · hold countdown · toasts). The widget is container-adaptive: give
112
+ * the wrapping div a size and it lays itself out for that box (side panel wide,
113
+ * bottom sheet narrow). For the one-call modal, use `SeatPicker.open()` from
114
+ * `@seatlayer/js` directly.
115
+ */
116
+ declare const SeatPicker: react.ForwardRefExoticComponent<SeatPickerProps & react.RefAttributes<SeatPickerHandle>>;
117
+
118
+ export { EmbeddedDesigner, type EmbeddedDesignerHandle, type EmbeddedDesignerProps, SeatPicker, type SeatPickerHandle, type SeatPickerProps, SeatingChart, type SeatingChartHandle, type SeatingChartProps };
package/dist/index.js CHANGED
@@ -58,7 +58,10 @@ var SeatingChart = forwardRef(
58
58
  setSeatTier: (seatId, tierId) => chartRef.current?.setSeatTier(seatId, tierId),
59
59
  getFloors: () => chartRef.current?.getFloors() ?? [],
60
60
  setFloor: (floorId) => chartRef.current?.setFloor(floorId),
61
- setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on)
61
+ setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on),
62
+ zoomIn: () => chartRef.current?.zoomIn(),
63
+ zoomOut: () => chartRef.current?.zoomOut(),
64
+ zoomToFit: () => chartRef.current?.zoomToFit()
62
65
  }),
63
66
  []
64
67
  );
@@ -118,8 +121,67 @@ var EmbeddedDesigner = forwardRef2(
118
121
  return /* @__PURE__ */ jsx2("div", { ref: containerRef, className: props.className, style: props.style });
119
122
  }
120
123
  );
124
+
125
+ // src/SeatPicker.tsx
126
+ import {
127
+ forwardRef as forwardRef3,
128
+ useEffect as useEffect3,
129
+ useImperativeHandle as useImperativeHandle3,
130
+ useRef as useRef3
131
+ } from "react";
132
+ import {
133
+ SeatPicker as CoreSeatPicker
134
+ } from "@seatlayer/js";
135
+ import { jsx as jsx3 } from "react/jsx-runtime";
136
+ var SeatPicker = forwardRef3(
137
+ function SeatPicker2(props, ref) {
138
+ const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs } = props;
139
+ const containerRef = useRef3(null);
140
+ const pickerRef = useRef3(null);
141
+ const callbacks = useRef3(props);
142
+ callbacks.current = props;
143
+ useEffect3(() => {
144
+ const el = containerRef.current;
145
+ if (!el) return;
146
+ const picker = new CoreSeatPicker({
147
+ container: el,
148
+ event,
149
+ apiBase,
150
+ maxSelection,
151
+ publicKey,
152
+ locale,
153
+ currency,
154
+ colorblindSafe,
155
+ holdTtlMs,
156
+ theme: callbacks.current.theme,
157
+ messages: callbacks.current.messages,
158
+ onCheckout: (hold, seats) => callbacks.current.onCheckout?.(hold, seats),
159
+ onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),
160
+ onHoldExpired: () => callbacks.current.onHoldExpired?.(),
161
+ onError: (err) => callbacks.current.onError?.(err)
162
+ });
163
+ pickerRef.current = picker;
164
+ void picker.render();
165
+ return () => {
166
+ picker.destroy();
167
+ pickerRef.current = null;
168
+ };
169
+ }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs]);
170
+ useImperativeHandle3(
171
+ ref,
172
+ () => ({
173
+ getSelection: () => pickerRef.current?.getSelection() ?? [],
174
+ bestAvailable: (qty, categoryKey) => pickerRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),
175
+ release: () => pickerRef.current?.release() ?? Promise.resolve()
176
+ }),
177
+ []
178
+ );
179
+ return /* @__PURE__ */ jsx3("div", { ref: containerRef, className, style });
180
+ }
181
+ );
121
182
  export {
122
183
  EmbeddedDesigner,
184
+ SeatPicker,
123
185
  SeatingChart
124
186
  };
125
187
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SeatingChart.tsx","../src/EmbeddedDesigner.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type HoldLineItem,\n} from '@seatlayer/js';\n\nexport type { SelectedSeat, HoldResult, BestAvailableResult, GAAreaAvailability, HoldLineItem } from '@seatlayer/js';\nexport type { SeatHoverDetails } from '@seatlayer/js';\n\n/** Imperative handle exposed via `ref` — call these to drive the picker from your app. */\nexport interface SeatingChartHandle {\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n hold(options?: { ttlMs?: number }): Promise<HoldResult | null>;\n /** GA areas with live remaining capacity. */\n getGAAreas(): GAAreaAvailability[];\n /** Atomically hold a quantity from one GA area. */\n holdGA(areaId: string, qty: number, options?: { tierId?: string | null; ttlMs?: number }): Promise<HoldResult | null>;\n /** Ask the server for the `qty` best free seats and hold them atomically. */\n bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;\n /** Release the current hold (if any). */\n release(): Promise<void>;\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[];\n /**\n * Choose a ticket tier for a selected seat (e.g. Adult → Child). Available\n * `tiers` are on each `SelectedSeat`; `tierId=null` reverts to the default.\n */\n setSeatTier(seatId: string, tierId: string | null): void;\n /**\n * Floors of a multi-floor chart — `[{ id, name }]` (single-floor charts\n * return one entry; empty before render()). Pair with setFloor().\n */\n getFloors(): { id: string; name: string }[];\n /** Switch the shown floor (2D). Warns + no-ops on single-floor charts. */\n setFloor(floorId: string): void;\n /** Toggle colorblind-safe rendering at runtime (see the `colorblindSafe` prop). */\n setColorblindSafe(on: boolean): void;\n}\n\nexport interface SeatingChartProps extends Omit<SeatingChartOptions, 'container'> {\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * React wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The underlying canvas is created once and torn down on unmount. Callback props\n * (`onSelectionChange`, `onHold`, `onError`, `onDeckTap`, `onHint`) may change\n * freely between renders without re-mounting the canvas — only `event`,\n * `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`, and\n * `colorblindSafe` trigger a rebuild. (`messages` is read once per mount;\n * changing it alone does not re-apply.)\n */\nexport const SeatingChart = forwardRef<SeatingChartHandle, SeatingChartProps>(\n function SeatingChart(props, ref) {\n const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe } = props;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartRef = useRef<CoreSeatingChart | null>(null);\n\n // Always call the latest callbacks without rebuilding the chart.\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const chart = new CoreSeatingChart({\n container: el,\n event,\n apiBase,\n maxSelection,\n publicKey,\n locale,\n currency,\n colorblindSafe,\n messages: callbacks.current.messages,\n onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),\n onHold: (result) => callbacks.current.onHold?.(result),\n onHoldExpired: () => callbacks.current.onHoldExpired?.(),\n onGAClick: (area) => callbacks.current.onGAClick?.(area),\n onError: (err) => callbacks.current.onError?.(err),\n onDeckTap: (floorId) => callbacks.current.onDeckTap?.(floorId),\n onHint: (message) => callbacks.current.onHint?.(message),\n seatTooltip: props.seatTooltip,\n onSeatHover: (details) => callbacks.current.onSeatHover?.(details),\n });\n chartRef.current = chart;\n void chart.render();\n\n return () => {\n chart.destroy();\n chartRef.current = null;\n };\n // Rebuild only when the identity of the chart changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe]);\n\n useImperativeHandle(\n ref,\n (): SeatingChartHandle => ({\n hold: (options) => chartRef.current?.hold(options) ?? Promise.resolve(null),\n getGAAreas: () => chartRef.current?.getGAAreas() ?? [],\n holdGA: (areaId, qty, options) => chartRef.current?.holdGA(areaId, qty, options) ?? Promise.resolve(null),\n bestAvailable: (qty, categoryKey) =>\n chartRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => chartRef.current?.release() ?? Promise.resolve(),\n getSelection: () => chartRef.current?.getSelection() ?? [],\n setSeatTier: (seatId, tierId) => chartRef.current?.setSeatTier(seatId, tierId),\n getFloors: () => chartRef.current?.getFloors() ?? [],\n setFloor: (floorId) => chartRef.current?.setFloor(floorId),\n setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on),\n }),\n [],\n );\n\n return <div ref={containerRef} className={className} style={style} />;\n },\n);\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n EmbeddedDesigner as CoreEmbeddedDesigner,\n type EmbeddedDesignerMessage,\n} from '@seatlayer/js';\n\nexport type { EmbeddedDesignerMessage } from '@seatlayer/js';\n\nexport interface EmbeddedDesignerHandle {\n /** Recreate the iframe with a newly-minted session URL. */\n setDesignerUrl(designerUrl: string): void;\n /** The currently mounted iframe, if any. */\n getIframe(): HTMLIFrameElement | null;\n}\n\nexport interface EmbeddedDesignerProps {\n /** Short-lived `designerUrl` returned by your backend. Never pass an `sk_` key. */\n designerUrl: string;\n expectedChartId?: string;\n expectedWorkspaceId?: string;\n title?: string;\n className?: string;\n style?: CSSProperties;\n iframeClassName?: string;\n iframeStyle?: Partial<CSSStyleDeclaration>;\n allow?: string;\n referrerPolicy?: ReferrerPolicy;\n onReady?: (message: EmbeddedDesignerMessage) => void;\n onSaved?: (message: EmbeddedDesignerMessage) => void;\n onPublished?: (message: EmbeddedDesignerMessage) => void;\n onClose?: (message: EmbeddedDesignerMessage) => void;\n onError?: (message: EmbeddedDesignerMessage) => void;\n}\n\n/**\n * Native-feeling React host for the secure SeatLayer Designer iframe.\n * A new `designerUrl` always recreates the iframe, so a new fragment token can\n * never retain state from an earlier chart session.\n */\nexport const EmbeddedDesigner = forwardRef<EmbeddedDesignerHandle, EmbeddedDesignerProps>(\n function EmbeddedDesigner(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const designerRef = useRef<CoreEmbeddedDesigner | null>(null);\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const designer = new CoreEmbeddedDesigner({\n designerUrl: props.designerUrl,\n container,\n expectedChartId: props.expectedChartId,\n expectedWorkspaceId: props.expectedWorkspaceId,\n title: props.title,\n className: props.iframeClassName,\n style: props.iframeStyle,\n allow: props.allow,\n referrerPolicy: props.referrerPolicy,\n onReady: (message) => callbacks.current.onReady?.(message),\n onSaved: (message) => callbacks.current.onSaved?.(message),\n onPublished: (message) => callbacks.current.onPublished?.(message),\n onClose: (message) => callbacks.current.onClose?.(message),\n onError: (message) => callbacks.current.onError?.(message),\n });\n designer.mount();\n designerRef.current = designer;\n return () => {\n designer.destroy();\n designerRef.current = null;\n };\n // Session/chart identity changes must recreate the iframe. Callback changes are\n // picked up from the ref without reloading an in-progress Designer session.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.designerUrl, props.expectedChartId, props.expectedWorkspaceId, props.title, props.iframeClassName, props.iframeStyle, props.allow, props.referrerPolicy]);\n\n useImperativeHandle(ref, () => ({\n setDesignerUrl: (designerUrl) => { designerRef.current?.setDesignerUrl(designerUrl); },\n getIframe: () => designerRef.current?.getIframe() ?? null,\n }), []);\n\n return <div ref={containerRef} className={props.className} style={props.style} />;\n },\n);\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE,gBAAgB;AAAA,OAOX;AAkHI;AAhEJ,IAAM,eAAe;AAAA,EAC1B,SAASA,cAAa,OAAO,KAAK;AAChC,UAAM,EAAE,WAAW,OAAO,OAAO,SAAS,cAAc,WAAW,QAAQ,UAAU,eAAe,IAAI;AAExG,UAAM,eAAe,OAA8B,IAAI;AACvD,UAAM,WAAW,OAAgC,IAAI;AAGrD,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UAAU,OAAO;AAAA,QACzD,SAAS,CAAC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,QACzD,aAAa,CAAC,YAAY,UAAU,QAAQ,cAAc,OAAO;AAAA,QACjE,SAAS,CAAC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,QACzD,SAAS,CAAC,YAAY,UAAU,QAAQ,UAAU,OAAO;AAAA,MAC3D,CAAC;AACD,eAAS,MAAM;AACf,kBAAY,UAAU;AACtB,aAAO,MAAM;AACX,iBAAS,QAAQ;AACjB,oBAAY,UAAU;AAAA,MACxB;AAAA,IAIF,GAAG,CAAC,MAAM,aAAa,MAAM,iBAAiB,MAAM,qBAAqB,MAAM,OAAO,MAAM,iBAAiB,MAAM,aAAa,MAAM,OAAO,MAAM,cAAc,CAAC;AAElK,IAAAC,qBAAoB,KAAK,OAAO;AAAA,MAC9B,gBAAgB,CAAC,gBAAgB;AAAE,oBAAY,SAAS,eAAe,WAAW;AAAA,MAAG;AAAA,MACrF,WAAW,MAAM,YAAY,SAAS,UAAU,KAAK;AAAA,IACvD,IAAI,CAAC,CAAC;AAEN,WAAO,gBAAAE,KAAC,SAAI,KAAK,cAAc,WAAW,MAAM,WAAW,OAAO,MAAM,OAAO;AAAA,EACjF;AACF;","names":["SeatingChart","forwardRef","useEffect","useImperativeHandle","useRef","jsx","EmbeddedDesigner"]}
1
+ {"version":3,"sources":["../src/SeatingChart.tsx","../src/EmbeddedDesigner.tsx","../src/SeatPicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type HoldLineItem,\n} from '@seatlayer/js';\n\nexport type { SelectedSeat, HoldResult, BestAvailableResult, GAAreaAvailability, HoldLineItem } from '@seatlayer/js';\nexport type { SeatHoverDetails } from '@seatlayer/js';\n\n/** Imperative handle exposed via `ref` — call these to drive the picker from your app. */\nexport interface SeatingChartHandle {\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n hold(options?: { ttlMs?: number }): Promise<HoldResult | null>;\n /** GA areas with live remaining capacity. */\n getGAAreas(): GAAreaAvailability[];\n /** Atomically hold a quantity from one GA area. */\n holdGA(areaId: string, qty: number, options?: { tierId?: string | null; ttlMs?: number }): Promise<HoldResult | null>;\n /** Ask the server for the `qty` best free seats and hold them atomically. */\n bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;\n /** Release the current hold (if any). */\n release(): Promise<void>;\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[];\n /**\n * Choose a ticket tier for a selected seat (e.g. Adult → Child). Available\n * `tiers` are on each `SelectedSeat`; `tierId=null` reverts to the default.\n */\n setSeatTier(seatId: string, tierId: string | null): void;\n /**\n * Floors of a multi-floor chart — `[{ id, name }]` (single-floor charts\n * return one entry; empty before render()). Pair with setFloor().\n */\n getFloors(): { id: string; name: string }[];\n /** Switch the shown floor (2D). Warns + no-ops on single-floor charts. */\n setFloor(floorId: string): void;\n /** Toggle colorblind-safe rendering at runtime (see the `colorblindSafe` prop). */\n setColorblindSafe(on: boolean): void;\n /** Zoom in one step (same increment as the wheel/pinch gesture). */\n zoomIn(): void;\n /** Zoom out one step. */\n zoomOut(): void;\n /** Reset the camera so the whole chart fits the container. */\n zoomToFit(): void;\n}\n\nexport interface SeatingChartProps extends Omit<SeatingChartOptions, 'container'> {\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * React wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The underlying canvas is created once and torn down on unmount. Callback props\n * (`onSelectionChange`, `onHold`, `onError`, `onDeckTap`, `onHint`) may change\n * freely between renders without re-mounting the canvas — only `event`,\n * `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`, and\n * `colorblindSafe` trigger a rebuild. (`messages` is read once per mount;\n * changing it alone does not re-apply.)\n */\nexport const SeatingChart = forwardRef<SeatingChartHandle, SeatingChartProps>(\n function SeatingChart(props, ref) {\n const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe } = props;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartRef = useRef<CoreSeatingChart | null>(null);\n\n // Always call the latest callbacks without rebuilding the chart.\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const chart = new CoreSeatingChart({\n container: el,\n event,\n apiBase,\n maxSelection,\n publicKey,\n locale,\n currency,\n colorblindSafe,\n messages: callbacks.current.messages,\n onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),\n onHold: (result) => callbacks.current.onHold?.(result),\n onHoldExpired: () => callbacks.current.onHoldExpired?.(),\n onGAClick: (area) => callbacks.current.onGAClick?.(area),\n onError: (err) => callbacks.current.onError?.(err),\n onDeckTap: (floorId) => callbacks.current.onDeckTap?.(floorId),\n onHint: (message) => callbacks.current.onHint?.(message),\n seatTooltip: props.seatTooltip,\n onSeatHover: (details) => callbacks.current.onSeatHover?.(details),\n });\n chartRef.current = chart;\n void chart.render();\n\n return () => {\n chart.destroy();\n chartRef.current = null;\n };\n // Rebuild only when the identity of the chart changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe]);\n\n useImperativeHandle(\n ref,\n (): SeatingChartHandle => ({\n hold: (options) => chartRef.current?.hold(options) ?? Promise.resolve(null),\n getGAAreas: () => chartRef.current?.getGAAreas() ?? [],\n holdGA: (areaId, qty, options) => chartRef.current?.holdGA(areaId, qty, options) ?? Promise.resolve(null),\n bestAvailable: (qty, categoryKey) =>\n chartRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => chartRef.current?.release() ?? Promise.resolve(),\n getSelection: () => chartRef.current?.getSelection() ?? [],\n setSeatTier: (seatId, tierId) => chartRef.current?.setSeatTier(seatId, tierId),\n getFloors: () => chartRef.current?.getFloors() ?? [],\n setFloor: (floorId) => chartRef.current?.setFloor(floorId),\n setColorblindSafe: (on) => chartRef.current?.setColorblindSafe(on),\n zoomIn: () => chartRef.current?.zoomIn(),\n zoomOut: () => chartRef.current?.zoomOut(),\n zoomToFit: () => chartRef.current?.zoomToFit(),\n }),\n [],\n );\n\n return <div ref={containerRef} className={className} style={style} />;\n },\n);\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n EmbeddedDesigner as CoreEmbeddedDesigner,\n type EmbeddedDesignerMessage,\n} from '@seatlayer/js';\n\nexport type { EmbeddedDesignerMessage } from '@seatlayer/js';\n\nexport interface EmbeddedDesignerHandle {\n /** Recreate the iframe with a newly-minted session URL. */\n setDesignerUrl(designerUrl: string): void;\n /** The currently mounted iframe, if any. */\n getIframe(): HTMLIFrameElement | null;\n}\n\nexport interface EmbeddedDesignerProps {\n /** Short-lived `designerUrl` returned by your backend. Never pass an `sk_` key. */\n designerUrl: string;\n expectedChartId?: string;\n expectedWorkspaceId?: string;\n title?: string;\n className?: string;\n style?: CSSProperties;\n iframeClassName?: string;\n iframeStyle?: Partial<CSSStyleDeclaration>;\n allow?: string;\n referrerPolicy?: ReferrerPolicy;\n onReady?: (message: EmbeddedDesignerMessage) => void;\n onSaved?: (message: EmbeddedDesignerMessage) => void;\n onPublished?: (message: EmbeddedDesignerMessage) => void;\n onClose?: (message: EmbeddedDesignerMessage) => void;\n onError?: (message: EmbeddedDesignerMessage) => void;\n}\n\n/**\n * Native-feeling React host for the secure SeatLayer Designer iframe.\n * A new `designerUrl` always recreates the iframe, so a new fragment token can\n * never retain state from an earlier chart session.\n */\nexport const EmbeddedDesigner = forwardRef<EmbeddedDesignerHandle, EmbeddedDesignerProps>(\n function EmbeddedDesigner(props, ref) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const designerRef = useRef<CoreEmbeddedDesigner | null>(null);\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const designer = new CoreEmbeddedDesigner({\n designerUrl: props.designerUrl,\n container,\n expectedChartId: props.expectedChartId,\n expectedWorkspaceId: props.expectedWorkspaceId,\n title: props.title,\n className: props.iframeClassName,\n style: props.iframeStyle,\n allow: props.allow,\n referrerPolicy: props.referrerPolicy,\n onReady: (message) => callbacks.current.onReady?.(message),\n onSaved: (message) => callbacks.current.onSaved?.(message),\n onPublished: (message) => callbacks.current.onPublished?.(message),\n onClose: (message) => callbacks.current.onClose?.(message),\n onError: (message) => callbacks.current.onError?.(message),\n });\n designer.mount();\n designerRef.current = designer;\n return () => {\n designer.destroy();\n designerRef.current = null;\n };\n // Session/chart identity changes must recreate the iframe. Callback changes are\n // picked up from the ref without reloading an in-progress Designer session.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.designerUrl, props.expectedChartId, props.expectedWorkspaceId, props.title, props.iframeClassName, props.iframeStyle, props.allow, props.referrerPolicy]);\n\n useImperativeHandle(ref, () => ({\n setDesignerUrl: (designerUrl) => { designerRef.current?.setDesignerUrl(designerUrl); },\n getIframe: () => designerRef.current?.getIframe() ?? null,\n }), []);\n\n return <div ref={containerRef} className={props.className} style={props.style} />;\n },\n);\n","import {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n type CSSProperties,\n} from 'react';\nimport {\n SeatPicker as CoreSeatPicker,\n type SeatPickerOptions,\n type SeatPickerTheme,\n type SelectedSeat,\n type HoldResult,\n} from '@seatlayer/js';\n\nexport type { SeatPickerOptions, SeatPickerTheme } from '@seatlayer/js';\n\n/** Imperative handle for the full-experience picker widget. */\nexport interface SeatPickerHandle {\n /** Current selection with resolved prices. */\n getSelection(): SelectedSeat[];\n /** Server-side best seats + hold, reflected in the widget tray. */\n bestAvailable(qty: number, categoryKey?: string): Promise<HoldResult | null>;\n /** Release the current hold (if any) and reset the tray. */\n release(): Promise<void>;\n}\n\nexport interface SeatPickerProps extends Omit<SeatPickerOptions, 'container'> {\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * React wrapper around the full SeatPicker widget (header · live price panel ·\n * tray · GA · hold countdown · toasts). The widget is container-adaptive: give\n * the wrapping div a size and it lays itself out for that box (side panel wide,\n * bottom sheet narrow). For the one-call modal, use `SeatPicker.open()` from\n * `@seatlayer/js` directly.\n */\nexport const SeatPicker = forwardRef<SeatPickerHandle, SeatPickerProps>(\n function SeatPicker(props, ref) {\n const { className, style, event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs } = props;\n\n const containerRef = useRef<HTMLDivElement | null>(null);\n const pickerRef = useRef<CoreSeatPicker | null>(null);\n\n // Always call the latest callbacks without rebuilding the widget.\n const callbacks = useRef(props);\n callbacks.current = props;\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n\n const picker = new CoreSeatPicker({\n container: el,\n event,\n apiBase,\n maxSelection,\n publicKey,\n locale,\n currency,\n colorblindSafe,\n holdTtlMs,\n theme: callbacks.current.theme,\n messages: callbacks.current.messages,\n onCheckout: (hold, seats) => callbacks.current.onCheckout?.(hold, seats),\n onSelectionChange: (seats) => callbacks.current.onSelectionChange?.(seats),\n onHoldExpired: () => callbacks.current.onHoldExpired?.(),\n onError: (err) => callbacks.current.onError?.(err),\n });\n pickerRef.current = picker;\n void picker.render();\n\n return () => {\n picker.destroy();\n pickerRef.current = null;\n };\n // Rebuild only when the identity of the event/config changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [event, apiBase, maxSelection, publicKey, locale, currency, colorblindSafe, holdTtlMs]);\n\n useImperativeHandle(\n ref,\n (): SeatPickerHandle => ({\n getSelection: () => pickerRef.current?.getSelection() ?? [],\n bestAvailable: (qty, categoryKey) => pickerRef.current?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => pickerRef.current?.release() ?? Promise.resolve(),\n }),\n [],\n );\n\n return <div ref={containerRef} className={className} style={style} />;\n },\n);\n"],"mappings":";AAAA;AAAA,EAC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B,UAAU,SAAS,cAAc,KAAK,WAAW,KAAK,QAAQ,QAAQ,IAAI;AAAA,QAC/G,SAAS,MAAM,UAAU,SAAS,QAAQ,KAAK,QAAQ,QAAQ;AAAA,MACjE;AAAA,MACA,CAAC;AAAA,IACH;AAEA,WAAO,gBAAAE,KAAC,SAAI,KAAK,cAAc,WAAsB,OAAc;AAAA,EACrE;AACF;","names":["SeatingChart","forwardRef","useEffect","useImperativeHandle","useRef","jsx","EmbeddedDesigner","forwardRef","useEffect","useImperativeHandle","useRef","jsx","SeatPicker"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seatlayer/react",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "description": "React component for the SeatLayer embed SDK — render an interactive seat picker and hold seats.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.seatlayer.io",
@@ -35,7 +35,7 @@
35
35
  "ticketing"
36
36
  ],
37
37
  "dependencies": {
38
- "@seatlayer/js": "^0.4.1"
38
+ "@seatlayer/js": "^0.6.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=17.0.0"