@seatlayer/vue 0.52.0 → 0.53.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 +55 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -52
- package/dist/index.d.ts +51 -52
- package/dist/index.js +59 -53
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,25 @@ var SeatingChart = (0, import_vue.defineComponent)({
|
|
|
46
46
|
currency: { type: String, default: void 0 },
|
|
47
47
|
/** Render with colorblind-safe seat glyphs. */
|
|
48
48
|
colorblindSafe: { type: Boolean, default: void 0 },
|
|
49
|
+
/**
|
|
50
|
+
* Initial canvas projection. Read once when the chart is built, so
|
|
51
|
+
* changing it rebuilds.
|
|
52
|
+
* @deprecated `'isometric'` and `'perspective'` are retired in favour of
|
|
53
|
+
* the real 3D venue view; use `'flat'`.
|
|
54
|
+
*/
|
|
55
|
+
initialView: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: void 0
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* What the BUYER sees when the chart cannot load: `'message'` (default) is
|
|
61
|
+
* a styleable notice with a Try again button, `'none'` is silent for hosts
|
|
62
|
+
* that render their own failure UI from the `error` event.
|
|
63
|
+
*/
|
|
64
|
+
errorDisplay: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
49
68
|
/** Copy overrides, read once per mount. */
|
|
50
69
|
messages: {
|
|
51
70
|
type: Object,
|
|
@@ -120,69 +139,53 @@ var SeatingChart = (0, import_vue.defineComponent)({
|
|
|
120
139
|
const onAccessExpired = (state) => emit("access-expired", state);
|
|
121
140
|
const onAccessUnavailable = (state) => emit("access-unavailable", state);
|
|
122
141
|
const onSelectedObjectUnavailable = (state) => emit("selected-object-unavailable", state);
|
|
123
|
-
const instance = new import_js.SeatingChart(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const instance = new import_js.SeatingChart((0, import_js.buildSeatingChartOptions)(
|
|
143
|
+
element,
|
|
144
|
+
{
|
|
145
|
+
event: props.event,
|
|
146
|
+
apiBase: props.apiBase,
|
|
147
|
+
maxSelection: props.maxSelection,
|
|
148
|
+
publicKey: props.publicKey,
|
|
149
|
+
locale: props.locale,
|
|
150
|
+
currency: props.currency,
|
|
151
|
+
colorblindSafe: props.colorblindSafe,
|
|
152
|
+
initialView: props.initialView,
|
|
153
|
+
errorDisplay: props.errorDisplay,
|
|
154
|
+
messages: props.messages,
|
|
155
|
+
seatTooltip: props.seatTooltip,
|
|
156
|
+
buyerAccessTokenProvider: props.buyerAccessTokenProvider,
|
|
157
|
+
buyerAccessToken: props.buyerAccessToken
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
onAccessExpired,
|
|
161
|
+
onAccessUnavailable,
|
|
162
|
+
onSelectedObjectUnavailable,
|
|
163
|
+
onSelectionChange,
|
|
164
|
+
onHold,
|
|
165
|
+
onHoldRestored,
|
|
166
|
+
onHoldExpired,
|
|
167
|
+
onGAClick,
|
|
168
|
+
onError,
|
|
169
|
+
onDeckTap,
|
|
170
|
+
onHint,
|
|
171
|
+
onSeatHover
|
|
172
|
+
}
|
|
173
|
+
));
|
|
149
174
|
chart.value = instance;
|
|
150
175
|
void instance.render();
|
|
151
176
|
};
|
|
152
177
|
(0, import_vue.watch)(
|
|
153
178
|
() => [
|
|
154
179
|
container.value,
|
|
155
|
-
|
|
156
|
-
props.
|
|
157
|
-
props
|
|
158
|
-
props.publicKey,
|
|
159
|
-
props.locale,
|
|
160
|
-
props.currency,
|
|
161
|
-
props.colorblindSafe
|
|
180
|
+
// The shared identity list, not a hand-copied one — this is exactly the
|
|
181
|
+
// place Vue fell two props behind React.
|
|
182
|
+
...import_js.SEATING_CHART_IDENTITY_PROPS.map((prop) => props[prop])
|
|
162
183
|
],
|
|
163
184
|
build,
|
|
164
185
|
{ immediate: true, flush: "post" }
|
|
165
186
|
);
|
|
166
187
|
(0, import_vue.onBeforeUnmount)(destroy);
|
|
167
|
-
const exposed =
|
|
168
|
-
hold: (options) => chart.value?.hold(options) ?? Promise.resolve(null),
|
|
169
|
-
resumeHold: (holdId) => chart.value?.resumeHold(holdId) ?? Promise.resolve(null),
|
|
170
|
-
getCurrentHold: () => chart.value?.getCurrentHold() ?? null,
|
|
171
|
-
getGAAreas: () => chart.value?.getGAAreas() ?? [],
|
|
172
|
-
holdGA: (areaId, qty, options) => chart.value?.holdGA(areaId, qty, options) ?? Promise.resolve(null),
|
|
173
|
-
bestAvailable: (qty, categoryKey) => chart.value?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),
|
|
174
|
-
release: () => chart.value?.release() ?? Promise.resolve(),
|
|
175
|
-
releaseLabels: (labels) => chart.value?.releaseLabels(labels) ?? Promise.resolve(false),
|
|
176
|
-
getSelection: () => chart.value?.getSelection() ?? [],
|
|
177
|
-
setSeatTier: (seatId, tierId) => chart.value?.setSeatTier(seatId, tierId),
|
|
178
|
-
getFloors: () => chart.value?.getFloors() ?? [],
|
|
179
|
-
setFloor: (floorId) => chart.value?.setFloor(floorId),
|
|
180
|
-
setColorblindSafe: (on) => chart.value?.setColorblindSafe(on),
|
|
181
|
-
zoomIn: () => chart.value?.zoomIn(),
|
|
182
|
-
zoomOut: () => chart.value?.zoomOut(),
|
|
183
|
-
zoomToFit: () => chart.value?.zoomToFit(),
|
|
184
|
-
refreshAccess: () => chart.value?.refreshAccess() ?? Promise.resolve(false)
|
|
185
|
-
};
|
|
188
|
+
const exposed = (0, import_js.bindSeatingChartHandle)(() => chart.value);
|
|
186
189
|
expose(exposed);
|
|
187
190
|
return () => (0, import_vue.h)("div", { ref: container });
|
|
188
191
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/SeatingChart.ts"],"sourcesContent":["/**\n * @seatlayer/vue — the Vue 3 wrapper for the SeatLayer embed SDK.\n *\n * Components are written as render functions rather than SFCs, so installing\n * this package needs no Vue compiler plugin.\n */\nexport { SeatingChart } from './SeatingChart';\nexport type { SeatingChartExposed } from './SeatingChart';\n\nexport type {\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n SeatHoverDetails,\n} from '@seatlayer/js';\n\n// Sales Channels — buyer access sessions for private channel inventory.\nexport type {\n BuyerAccessToken,\n BuyerAccessTokenProvider,\n BuyerAccessRefreshReason,\n BuyerAccessUnavailableReason,\n BuyerAccessExpiredEvent,\n BuyerAccessUnavailableEvent,\n SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n// The framework-agnostic widget class — for the one-call modal (SeatPickerWidget.open()).\nexport { SeatPicker as SeatPickerWidget } from '@seatlayer/js';\n\n// Host-side embed helper: grows the iframe on `seatlayer:height` and pins it on\n// `seatlayer:fullscreen`. Vue hosts depend on this package alone, so it has to be\n// reachable here rather than only from @seatlayer/js.\nexport { attachPickerFrame } from '@seatlayer/js';\nexport type { AttachPickerFrameOptions } from '@seatlayer/js';\n","import {\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n shallowRef,\n watch,\n type PropType,\n type Ref,\n} from 'vue';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type SeatHoverDetails,\n type BuyerAccessToken,\n type BuyerAccessTokenProvider,\n type BuyerAccessExpiredEvent,\n type BuyerAccessUnavailableEvent,\n type SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n/**\n * What `ref=\"chart\"` gives you — call these to drive the picker from your app.\n *\n * Vue exposes these through `defineExpose`, so a template ref is typed as this\n * rather than as the raw component instance.\n */\nexport interface SeatingChartExposed {\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n hold(options?: { ttlMs?: number }): Promise<HoldResult | null>;\n /** Restore an active hold by its opaque id. */\n resumeHold(holdId: string): Promise<HoldResult | null>;\n /** Current active hold known to the chart. */\n getCurrentHold(): 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 /** Release some held labels while keeping the remainder active. */\n releaseLabels(labels: string[]): Promise<boolean>;\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[];\n /** Choose a ticket tier for a selected seat; `null` reverts to the default. */\n setSeatTier(seatId: string, tierId: string | null): void;\n /** Floors of a multi-floor chart. Empty before the first render. */\n getFloors(): { id: string; name: string }[];\n /** Switch the shown floor (2D). No-ops on single-floor charts. */\n setFloor(floorId: string): void;\n /** Toggle colorblind-safe rendering at runtime. */\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 * Re-acquire the buyer access session after your app re-authorizes the buyer\n * (Sales Channels). Resolves false when the chart is not access-scoped.\n */\n refreshAccess(): Promise<boolean>;\n}\n\n/**\n * Vue 3 wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The canvas is created once and torn down on unmount. Only the props that\n * change the chart's identity — `event`, `apiBase`, `maxSelection`, `publicKey`,\n * `locale`, `currency`, `colorblindSafe` — trigger a rebuild; everything else is\n * read live, so a parent re-render never destroys the canvas mid-selection.\n *\n * Written as a render function rather than an SFC so the package builds with\n * plain TypeScript — a consumer needs no Vue compiler plugin to install it.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue';\n * import { SeatingChart, type SeatingChartExposed } from '@seatlayer/vue';\n *\n * const chart = ref<SeatingChartExposed | null>(null);\n * const checkout = async () => {\n * const held = await chart.value?.hold();\n * if (held) await pay(held.holdId);\n * };\n * </script>\n *\n * <template>\n * <SeatingChart ref=\"chart\" event=\"summer-gala\" @selection-change=\"onChange\" />\n * </template>\n * ```\n */\nexport const SeatingChart = defineComponent({\n name: 'SeatLayerSeatingChart',\n\n props: {\n /** Event key to render. Changing it rebuilds the chart. */\n event: { type: String, required: true },\n /** API base URL. Defaults to the public API. */\n apiBase: { type: String, default: undefined },\n /** Cap on how many seats a buyer may select. */\n maxSelection: { type: Number, default: undefined },\n /** Publishable key, when your integration uses one. */\n publicKey: { type: String, default: undefined },\n /** BCP-47 locale for built-in copy. */\n locale: { type: String, default: undefined },\n /** ISO currency for price formatting. */\n currency: { type: String, default: undefined },\n /** Render with colorblind-safe seat glyphs. */\n colorblindSafe: { type: Boolean, default: undefined },\n /** Copy overrides, read once per mount. */\n messages: {\n type: Object as PropType<SeatingChartOptions['messages']>,\n default: undefined,\n },\n /**\n * Show the built-in seat tooltip. Set false to draw your own popover from\n * the `seat-hover` event.\n */\n seatTooltip: { type: Boolean, default: undefined },\n /**\n * Sales Channels: mint a buyer access session on demand. Called with a\n * `reason`; returns `{ token, expiresAt }` from YOUR backend. The token is\n * held in memory only — never storage, never a URL, never a log.\n */\n buyerAccessTokenProvider: {\n type: Function as PropType<BuyerAccessTokenProvider>,\n default: undefined,\n },\n /** One-shot session for hosts that own the lifecycle. Cannot be renewed. */\n buyerAccessToken: {\n type: [String, Object] as PropType<string | BuyerAccessToken>,\n default: undefined,\n },\n },\n\n emits: {\n /** The buyer's selection changed. */\n 'selection-change': (_seats: SelectedSeat[]) => true,\n /** A hold succeeded. */\n hold: (_result: HoldResult) => true,\n /** A previous hold was restored on mount. */\n 'hold-restored': (_result: HoldResult) => true,\n /** The active hold lapsed. */\n 'hold-expired': () => true,\n /** A GA area was clicked. */\n 'ga-click': (_area: GAAreaAvailability) => true,\n /** Something failed — a network error, a rejected hold. */\n error: (_error: unknown) => true,\n /** A floor deck was tapped in the 3D view. */\n 'deck-tap': (_floorId: string) => true,\n /** A transient hint worth showing the buyer, or `null` to clear it. */\n hint: (_message: string | null) => true,\n /** The pointer moved onto a seat, or off one (`null`). */\n 'seat-hover': (_details: SeatHoverDetails | null) => true,\n /** The buyer access session lapsed; `refreshed` says whether it recovered. */\n 'access-expired': (_event: BuyerAccessExpiredEvent) => true,\n /** Private inventory is unavailable and refreshing will not fix it. */\n 'access-unavailable': (_event: BuyerAccessUnavailableEvent) => true,\n /** Selected-but-unheld units stopped being selectable. */\n 'selected-object-unavailable': (_event: SelectedObjectUnavailableEvent) => true,\n },\n\n setup(props, { emit, expose }) {\n const container: Ref<HTMLDivElement | null> = ref(null);\n // shallowRef: the chart owns a canvas and a large scene graph, and making it\n // deeply reactive would have Vue walk all of it on every touch.\n const chart = shallowRef<CoreSeatingChart | null>(null);\n\n const destroy = () => {\n chart.value?.destroy();\n chart.value = null;\n };\n\n const build = () => {\n const element = container.value;\n if (!element) return;\n\n destroy();\n\n // Handlers are bound here rather than inline in the options literal.\n // Inline, TypeScript has to resolve `emit`'s overloads while it is still\n // contextually typing the literal against SeatingChartOptions, and it\n // gives up — collapsing to the last emit signature. Naming them first\n // separates the two inference problems, and reads better besides.\n const onSelectionChange = (seats: SelectedSeat[]) => emit('selection-change', seats);\n const onHold = (result: HoldResult) => emit('hold', result);\n const onHoldRestored = (result: HoldResult) => emit('hold-restored', result);\n const onHoldExpired = () => emit('hold-expired');\n const onGAClick = (area: GAAreaAvailability) => emit('ga-click', area);\n const onError = (error: unknown) => emit('error', error);\n const onDeckTap = (floorId: string) => emit('deck-tap', floorId);\n const onHint = (message: string | null) => emit('hint', message);\n const onSeatHover = (details: SeatHoverDetails | null) => emit('seat-hover', details);\n const onAccessExpired = (state: BuyerAccessExpiredEvent) => emit('access-expired', state);\n const onAccessUnavailable = (state: BuyerAccessUnavailableEvent) =>\n emit('access-unavailable', state);\n const onSelectedObjectUnavailable = (state: SelectedObjectUnavailableEvent) =>\n emit('selected-object-unavailable', state);\n\n const instance = new CoreSeatingChart({\n container: element,\n event: props.event,\n apiBase: props.apiBase,\n maxSelection: props.maxSelection,\n publicKey: props.publicKey,\n locale: props.locale,\n currency: props.currency,\n colorblindSafe: props.colorblindSafe,\n messages: props.messages,\n seatTooltip: props.seatTooltip,\n buyerAccessTokenProvider: props.buyerAccessTokenProvider,\n buyerAccessToken: props.buyerAccessToken,\n onAccessExpired,\n onAccessUnavailable,\n onSelectedObjectUnavailable,\n onSelectionChange,\n onHold,\n onHoldRestored,\n onHoldExpired,\n onGAClick,\n onError,\n onDeckTap,\n onHint,\n onSeatHover,\n });\n\n chart.value = instance;\n void instance.render();\n };\n\n // `flush: 'post'` so the container element exists on the first run — a\n // pre-flush watcher would fire before the DOM node is attached.\n watch(\n () => [\n container.value,\n props.event,\n props.apiBase,\n props.maxSelection,\n props.publicKey,\n props.locale,\n props.currency,\n props.colorblindSafe,\n ],\n build,\n { immediate: true, flush: 'post' },\n );\n\n onBeforeUnmount(destroy);\n\n const exposed: SeatingChartExposed = {\n hold: (options) => chart.value?.hold(options) ?? Promise.resolve(null),\n resumeHold: (holdId) => chart.value?.resumeHold(holdId) ?? Promise.resolve(null),\n getCurrentHold: () => chart.value?.getCurrentHold() ?? null,\n getGAAreas: () => chart.value?.getGAAreas() ?? [],\n holdGA: (areaId, qty, options) => chart.value?.holdGA(areaId, qty, options) ?? Promise.resolve(null),\n bestAvailable: (qty, categoryKey) =>\n chart.value?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => chart.value?.release() ?? Promise.resolve(),\n releaseLabels: (labels) => chart.value?.releaseLabels(labels) ?? Promise.resolve(false),\n getSelection: () => chart.value?.getSelection() ?? [],\n setSeatTier: (seatId, tierId) => chart.value?.setSeatTier(seatId, tierId),\n getFloors: () => chart.value?.getFloors() ?? [],\n setFloor: (floorId) => chart.value?.setFloor(floorId),\n setColorblindSafe: (on) => chart.value?.setColorblindSafe(on),\n zoomIn: () => chart.value?.zoomIn(),\n zoomOut: () => chart.value?.zoomOut(),\n zoomToFit: () => chart.value?.zoomToFit(),\n refreshAccess: () => chart.value?.refreshAccess() ?? Promise.resolve(false),\n };\n expose(exposed);\n\n return () => h('div', { ref: container });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBASO;AACP,gBAaO;AA6EA,IAAM,mBAAe,4BAAgB;AAAA,EAC1C,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA,IAEL,OAAO,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA;AAAA,IAEtC,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE5C,cAAc,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAEjD,WAAW,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE9C,QAAQ,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE3C,UAAU,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE7C,gBAAgB,EAAE,MAAM,SAAS,SAAS,OAAU;AAAA;AAAA,IAEpD,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,aAAa,EAAE,MAAM,SAAS,SAAS,OAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMjD,0BAA0B;AAAA,MACxB,MAAM;AAAA,M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apper for the SeatLayer embed SDK.\n *\n * Components are written as render functions rather than SFCs, so installing\n * this package needs no Vue compiler plugin.\n */\nexport { SeatingChart } from './SeatingChart';\nexport type { SeatingChartExposed } from './SeatingChart';\n\nexport type {\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n SeatHoverDetails,\n} from '@seatlayer/js';\n\n// Sales Channels — buyer access sessions for private channel inventory.\nexport type {\n BuyerAccessToken,\n BuyerAccessTokenProvider,\n BuyerAccessRefreshReason,\n BuyerAccessUnavailableReason,\n BuyerAccessExpiredEvent,\n BuyerAccessUnavailableEvent,\n SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n// The framework-agnostic widget class — for the one-call modal (SeatPickerWidget.open()).\nexport { SeatPicker as SeatPickerWidget } from '@seatlayer/js';\n\n// Host-side embed helper: grows the iframe on `seatlayer:height` and pins it on\n// `seatlayer:fullscreen`. Vue hosts depend on this package alone, so it has to be\n// reachable here rather than only from @seatlayer/js.\nexport { attachPickerFrame } from '@seatlayer/js';\nexport type { AttachPickerFrameOptions } from '@seatlayer/js';\n","import {\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n shallowRef,\n watch,\n type PropType,\n type Ref,\n} from 'vue';\nimport {\n SeatingChart as CoreSeatingChart,\n SEATING_CHART_IDENTITY_PROPS,\n bindSeatingChartHandle,\n buildSeatingChartOptions,\n type RendererViewMode,\n type SeatingChartHandle,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type SeatHoverDetails,\n type BuyerAccessToken,\n type BuyerAccessTokenProvider,\n type BuyerAccessExpiredEvent,\n type BuyerAccessUnavailableEvent,\n type SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n/**\n * What `ref=\"chart\"` gives you — call these to drive the picker from your app.\n *\n * Vue exposes these through `defineExpose`, so a template ref is typed as this\n * rather than as the raw component instance. It is the shared\n * `SeatingChartHandle` from `@seatlayer/js`: the same 17 methods React's `ref`\n * and Angular's component expose, from one declaration, so the three wrappers\n * cannot drift apart again.\n */\nexport type SeatingChartExposed = SeatingChartHandle;\n\n/**\n * Vue 3 wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The canvas is created once and torn down on unmount. Only the props that\n * change the chart's identity (`SEATING_CHART_IDENTITY_PROPS`: `event`,\n * `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`,\n * `colorblindSafe`, `initialView`, `errorDisplay`) trigger a rebuild;\n * everything else is read live, so a parent re-render never destroys the canvas\n * mid-selection.\n *\n * Written as a render function rather than an SFC so the package builds with\n * plain TypeScript — a consumer needs no Vue compiler plugin to install it.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue';\n * import { SeatingChart, type SeatingChartExposed } from '@seatlayer/vue';\n *\n * const chart = ref<SeatingChartExposed | null>(null);\n * const checkout = async () => {\n * const held = await chart.value?.hold();\n * if (held) await pay(held.holdId);\n * };\n * </script>\n *\n * <template>\n * <SeatingChart ref=\"chart\" event=\"summer-gala\" @selection-change=\"onChange\" />\n * </template>\n * ```\n */\nexport const SeatingChart = defineComponent({\n name: 'SeatLayerSeatingChart',\n\n props: {\n /** Event key to render. Changing it rebuilds the chart. */\n event: { type: String, required: true },\n /** API base URL. Defaults to the public API. */\n apiBase: { type: String, default: undefined },\n /** Cap on how many seats a buyer may select. */\n maxSelection: { type: Number, default: undefined },\n /** Publishable key, when your integration uses one. */\n publicKey: { type: String, default: undefined },\n /** BCP-47 locale for built-in copy. */\n locale: { type: String, default: undefined },\n /** ISO currency for price formatting. */\n currency: { type: String, default: undefined },\n /** Render with colorblind-safe seat glyphs. */\n colorblindSafe: { type: Boolean, default: undefined },\n /**\n * Initial canvas projection. Read once when the chart is built, so\n * changing it rebuilds.\n * @deprecated `'isometric'` and `'perspective'` are retired in favour of\n * the real 3D venue view; use `'flat'`.\n */\n initialView: {\n type: String as PropType<RendererViewMode>,\n default: undefined,\n },\n /**\n * What the BUYER sees when the chart cannot load: `'message'` (default) is\n * a styleable notice with a Try again button, `'none'` is silent for hosts\n * that render their own failure UI from the `error` event.\n */\n errorDisplay: {\n type: String as PropType<'message' | 'none'>,\n default: undefined,\n },\n /** Copy overrides, read once per mount. */\n messages: {\n type: Object as PropType<SeatingChartOptions['messages']>,\n default: undefined,\n },\n /**\n * Show the built-in seat tooltip. Set false to draw your own popover from\n * the `seat-hover` event.\n */\n seatTooltip: { type: Boolean, default: undefined },\n /**\n * Sales Channels: mint a buyer access session on demand. Called with a\n * `reason`; returns `{ token, expiresAt }` from YOUR backend. The token is\n * held in memory only — never storage, never a URL, never a log.\n */\n buyerAccessTokenProvider: {\n type: Function as PropType<BuyerAccessTokenProvider>,\n default: undefined,\n },\n /** One-shot session for hosts that own the lifecycle. Cannot be renewed. */\n buyerAccessToken: {\n type: [String, Object] as PropType<string | BuyerAccessToken>,\n default: undefined,\n },\n },\n\n emits: {\n /** The buyer's selection changed. */\n 'selection-change': (_seats: SelectedSeat[]) => true,\n /** A hold succeeded. */\n hold: (_result: HoldResult) => true,\n /** A previous hold was restored on mount. */\n 'hold-restored': (_result: HoldResult) => true,\n /** The active hold lapsed. */\n 'hold-expired': () => true,\n /** A GA area was clicked. */\n 'ga-click': (_area: GAAreaAvailability) => true,\n /** Something failed — a network error, a rejected hold. */\n error: (_error: unknown) => true,\n /** A floor deck was tapped in the 3D view. */\n 'deck-tap': (_floorId: string) => true,\n /** A transient hint worth showing the buyer, or `null` to clear it. */\n hint: (_message: string | null) => true,\n /** The pointer moved onto a seat, or off one (`null`). */\n 'seat-hover': (_details: SeatHoverDetails | null) => true,\n /** The buyer access session lapsed; `refreshed` says whether it recovered. */\n 'access-expired': (_event: BuyerAccessExpiredEvent) => true,\n /** Private inventory is unavailable and refreshing will not fix it. */\n 'access-unavailable': (_event: BuyerAccessUnavailableEvent) => true,\n /** Selected-but-unheld units stopped being selectable. */\n 'selected-object-unavailable': (_event: SelectedObjectUnavailableEvent) => true,\n },\n\n setup(props, { emit, expose }) {\n const container: Ref<HTMLDivElement | null> = ref(null);\n // shallowRef: the chart owns a canvas and a large scene graph, and making it\n // deeply reactive would have Vue walk all of it on every touch.\n const chart = shallowRef<CoreSeatingChart | null>(null);\n\n const destroy = () => {\n chart.value?.destroy();\n chart.value = null;\n };\n\n const build = () => {\n const element = container.value;\n if (!element) return;\n\n destroy();\n\n // Handlers are bound here rather than inline in the options literal.\n // Inline, TypeScript has to resolve `emit`'s overloads while it is still\n // contextually typing the literal against SeatingChartOptions, and it\n // gives up — collapsing to the last emit signature. Naming them first\n // separates the two inference problems, and reads better besides.\n const onSelectionChange = (seats: SelectedSeat[]) => emit('selection-change', seats);\n const onHold = (result: HoldResult) => emit('hold', result);\n const onHoldRestored = (result: HoldResult) => emit('hold-restored', result);\n const onHoldExpired = () => emit('hold-expired');\n const onGAClick = (area: GAAreaAvailability) => emit('ga-click', area);\n const onError = (error: unknown) => emit('error', error);\n const onDeckTap = (floorId: string) => emit('deck-tap', floorId);\n const onHint = (message: string | null) => emit('hint', message);\n const onSeatHover = (details: SeatHoverDetails | null) => emit('seat-hover', details);\n const onAccessExpired = (state: BuyerAccessExpiredEvent) => emit('access-expired', state);\n const onAccessUnavailable = (state: BuyerAccessUnavailableEvent) =>\n emit('access-unavailable', state);\n const onSelectedObjectUnavailable = (state: SelectedObjectUnavailableEvent) =>\n emit('selected-object-unavailable', state);\n\n const instance = new CoreSeatingChart(buildSeatingChartOptions(\n element,\n {\n event: props.event,\n apiBase: props.apiBase,\n maxSelection: props.maxSelection,\n publicKey: props.publicKey,\n locale: props.locale,\n currency: props.currency,\n colorblindSafe: props.colorblindSafe,\n initialView: props.initialView,\n errorDisplay: props.errorDisplay,\n messages: props.messages,\n seatTooltip: props.seatTooltip,\n buyerAccessTokenProvider: props.buyerAccessTokenProvider,\n buyerAccessToken: props.buyerAccessToken,\n },\n {\n onAccessExpired,\n onAccessUnavailable,\n onSelectedObjectUnavailable,\n onSelectionChange,\n onHold,\n onHoldRestored,\n onHoldExpired,\n onGAClick,\n onError,\n onDeckTap,\n onHint,\n onSeatHover,\n },\n ));\n\n chart.value = instance;\n void instance.render();\n };\n\n // `flush: 'post'` so the container element exists on the first run — a\n // pre-flush watcher would fire before the DOM node is attached.\n watch(\n () => [\n container.value,\n // The shared identity list, not a hand-copied one — this is exactly the\n // place Vue fell two props behind React.\n ...SEATING_CHART_IDENTITY_PROPS.map((prop) => props[prop]),\n ],\n build,\n { immediate: true, flush: 'post' },\n );\n\n onBeforeUnmount(destroy);\n\n // Built once and read live: the handle must survive every rebuild, so it\n // asks for the current instance on each call rather than capturing one.\n const exposed: SeatingChartExposed = bindSeatingChartHandle(() => chart.value);\n expose(exposed);\n\n return () => h('div', { ref: container });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBASO;AACP,gBAkBO;AA4CA,IAAM,mBAAe,4BAAgB;AAAA,EAC1C,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA,IAEL,OAAO,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA;AAAA,IAEtC,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE5C,cAAc,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAEjD,WAAW,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE9C,QAAQ,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE3C,UAAU,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE7C,gBAAgB,EAAE,MAAM,SAAS,SAAS,OAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOpD,aAAa;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA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AAAA,MAC3D;AAAA,MACA;AAAA,MACA,EAAE,WAAW,MAAM,OAAO,OAAO;AAAA,IACnC;AAEA,oCAAgB,OAAO;AAIvB,UAAM,cAA+B,kCAAuB,MAAM,MAAM,KAAK;AAC7E,WAAO,OAAO;AAEd,WAAO,UAAM,cAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AAAA,EAC1C;AACF,CAAC;;;ADpOD,IAAAC,aAA+C;AAK/C,IAAAA,aAAkC;","names":["CoreSeatingChart","import_js"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,69 +1,28 @@
|
|
|
1
1
|
import * as _seatlayer_core from '@seatlayer/core';
|
|
2
2
|
import * as vue from 'vue';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
-
import { SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, HoldResult, GAAreaAvailability, SeatHoverDetails, BuyerAccessExpiredEvent, BuyerAccessUnavailableEvent, SelectedObjectUnavailableEvent,
|
|
4
|
+
import { RendererViewMode, SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, HoldResult, GAAreaAvailability, SeatHoverDetails, BuyerAccessExpiredEvent, BuyerAccessUnavailableEvent, SelectedObjectUnavailableEvent, SeatingChartHandle } from '@seatlayer/js';
|
|
5
5
|
export { AttachPickerFrameOptions, BestAvailableResult, BuyerAccessExpiredEvent, BuyerAccessRefreshReason, BuyerAccessToken, BuyerAccessTokenProvider, BuyerAccessUnavailableEvent, BuyerAccessUnavailableReason, GAAreaAvailability, HoldLineItem, HoldResult, SeatHoverDetails, SeatPicker as SeatPickerWidget, SelectedObjectUnavailableEvent, SelectedSeat, attachPickerFrame } from '@seatlayer/js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* What `ref="chart"` gives you — call these to drive the picker from your app.
|
|
9
9
|
*
|
|
10
10
|
* Vue exposes these through `defineExpose`, so a template ref is typed as this
|
|
11
|
-
* rather than as the raw component instance.
|
|
11
|
+
* rather than as the raw component instance. It is the shared
|
|
12
|
+
* `SeatingChartHandle` from `@seatlayer/js`: the same 17 methods React's `ref`
|
|
13
|
+
* and Angular's component expose, from one declaration, so the three wrappers
|
|
14
|
+
* cannot drift apart again.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
/** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */
|
|
15
|
-
hold(options?: {
|
|
16
|
-
ttlMs?: number;
|
|
17
|
-
}): Promise<HoldResult | null>;
|
|
18
|
-
/** Restore an active hold by its opaque id. */
|
|
19
|
-
resumeHold(holdId: string): Promise<HoldResult | null>;
|
|
20
|
-
/** Current active hold known to the chart. */
|
|
21
|
-
getCurrentHold(): HoldResult | null;
|
|
22
|
-
/** GA areas with live remaining capacity. */
|
|
23
|
-
getGAAreas(): GAAreaAvailability[];
|
|
24
|
-
/** Atomically hold a quantity from one GA area. */
|
|
25
|
-
holdGA(areaId: string, qty: number, options?: {
|
|
26
|
-
tierId?: string | null;
|
|
27
|
-
ttlMs?: number;
|
|
28
|
-
}): Promise<HoldResult | null>;
|
|
29
|
-
/** Ask the server for the `qty` best free seats and hold them atomically. */
|
|
30
|
-
bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;
|
|
31
|
-
/** Release the current hold (if any). */
|
|
32
|
-
release(): Promise<void>;
|
|
33
|
-
/** Release some held labels while keeping the remainder active. */
|
|
34
|
-
releaseLabels(labels: string[]): Promise<boolean>;
|
|
35
|
-
/** The current selection, with prices resolved from the chart categories. */
|
|
36
|
-
getSelection(): SelectedSeat[];
|
|
37
|
-
/** Choose a ticket tier for a selected seat; `null` reverts to the default. */
|
|
38
|
-
setSeatTier(seatId: string, tierId: string | null): void;
|
|
39
|
-
/** Floors of a multi-floor chart. Empty before the first render. */
|
|
40
|
-
getFloors(): {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
}[];
|
|
44
|
-
/** Switch the shown floor (2D). No-ops on single-floor charts. */
|
|
45
|
-
setFloor(floorId: string): void;
|
|
46
|
-
/** Toggle colorblind-safe rendering at runtime. */
|
|
47
|
-
setColorblindSafe(on: boolean): void;
|
|
48
|
-
/** Zoom in one step (same increment as the wheel/pinch gesture). */
|
|
49
|
-
zoomIn(): void;
|
|
50
|
-
/** Zoom out one step. */
|
|
51
|
-
zoomOut(): void;
|
|
52
|
-
/** Reset the camera so the whole chart fits the container. */
|
|
53
|
-
zoomToFit(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Re-acquire the buyer access session after your app re-authorizes the buyer
|
|
56
|
-
* (Sales Channels). Resolves false when the chart is not access-scoped.
|
|
57
|
-
*/
|
|
58
|
-
refreshAccess(): Promise<boolean>;
|
|
59
|
-
}
|
|
16
|
+
type SeatingChartExposed = SeatingChartHandle;
|
|
60
17
|
/**
|
|
61
18
|
* Vue 3 wrapper around the framework-agnostic `@seatlayer/js` SDK.
|
|
62
19
|
*
|
|
63
20
|
* The canvas is created once and torn down on unmount. Only the props that
|
|
64
|
-
* change the chart's identity
|
|
65
|
-
* `
|
|
66
|
-
*
|
|
21
|
+
* change the chart's identity (`SEATING_CHART_IDENTITY_PROPS`: `event`,
|
|
22
|
+
* `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`,
|
|
23
|
+
* `colorblindSafe`, `initialView`, `errorDisplay`) trigger a rebuild;
|
|
24
|
+
* everything else is read live, so a parent re-render never destroys the canvas
|
|
25
|
+
* mid-selection.
|
|
67
26
|
*
|
|
68
27
|
* Written as a render function rather than an SFC so the package builds with
|
|
69
28
|
* plain TypeScript — a consumer needs no Vue compiler plugin to install it.
|
|
@@ -122,6 +81,25 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
122
81
|
type: BooleanConstructor;
|
|
123
82
|
default: undefined;
|
|
124
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Initial canvas projection. Read once when the chart is built, so
|
|
86
|
+
* changing it rebuilds.
|
|
87
|
+
* @deprecated `'isometric'` and `'perspective'` are retired in favour of
|
|
88
|
+
* the real 3D venue view; use `'flat'`.
|
|
89
|
+
*/
|
|
90
|
+
initialView: {
|
|
91
|
+
type: PropType<RendererViewMode>;
|
|
92
|
+
default: undefined;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* What the BUYER sees when the chart cannot load: `'message'` (default) is
|
|
96
|
+
* a styleable notice with a Try again button, `'none'` is silent for hosts
|
|
97
|
+
* that render their own failure UI from the `error` event.
|
|
98
|
+
*/
|
|
99
|
+
errorDisplay: {
|
|
100
|
+
type: PropType<"message" | "none">;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
125
103
|
/** Copy overrides, read once per mount. */
|
|
126
104
|
messages: {
|
|
127
105
|
type: PropType<SeatingChartOptions["messages"]>;
|
|
@@ -212,6 +190,25 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
212
190
|
type: BooleanConstructor;
|
|
213
191
|
default: undefined;
|
|
214
192
|
};
|
|
193
|
+
/**
|
|
194
|
+
* Initial canvas projection. Read once when the chart is built, so
|
|
195
|
+
* changing it rebuilds.
|
|
196
|
+
* @deprecated `'isometric'` and `'perspective'` are retired in favour of
|
|
197
|
+
* the real 3D venue view; use `'flat'`.
|
|
198
|
+
*/
|
|
199
|
+
initialView: {
|
|
200
|
+
type: PropType<RendererViewMode>;
|
|
201
|
+
default: undefined;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* What the BUYER sees when the chart cannot load: `'message'` (default) is
|
|
205
|
+
* a styleable notice with a Try again button, `'none'` is silent for hosts
|
|
206
|
+
* that render their own failure UI from the `error` event.
|
|
207
|
+
*/
|
|
208
|
+
errorDisplay: {
|
|
209
|
+
type: PropType<"message" | "none">;
|
|
210
|
+
default: undefined;
|
|
211
|
+
};
|
|
215
212
|
/** Copy overrides, read once per mount. */
|
|
216
213
|
messages: {
|
|
217
214
|
type: PropType<SeatingChartOptions["messages"]>;
|
|
@@ -260,6 +257,8 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
260
257
|
locale: string;
|
|
261
258
|
currency: string;
|
|
262
259
|
colorblindSafe: boolean;
|
|
260
|
+
initialView: RendererViewMode;
|
|
261
|
+
errorDisplay: "message" | "none";
|
|
263
262
|
seatTooltip: boolean;
|
|
264
263
|
buyerAccessTokenProvider: BuyerAccessTokenProvider;
|
|
265
264
|
buyerAccessToken: string | BuyerAccessToken;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,69 +1,28 @@
|
|
|
1
1
|
import * as _seatlayer_core from '@seatlayer/core';
|
|
2
2
|
import * as vue from 'vue';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
-
import { SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, HoldResult, GAAreaAvailability, SeatHoverDetails, BuyerAccessExpiredEvent, BuyerAccessUnavailableEvent, SelectedObjectUnavailableEvent,
|
|
4
|
+
import { RendererViewMode, SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, HoldResult, GAAreaAvailability, SeatHoverDetails, BuyerAccessExpiredEvent, BuyerAccessUnavailableEvent, SelectedObjectUnavailableEvent, SeatingChartHandle } from '@seatlayer/js';
|
|
5
5
|
export { AttachPickerFrameOptions, BestAvailableResult, BuyerAccessExpiredEvent, BuyerAccessRefreshReason, BuyerAccessToken, BuyerAccessTokenProvider, BuyerAccessUnavailableEvent, BuyerAccessUnavailableReason, GAAreaAvailability, HoldLineItem, HoldResult, SeatHoverDetails, SeatPicker as SeatPickerWidget, SelectedObjectUnavailableEvent, SelectedSeat, attachPickerFrame } from '@seatlayer/js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* What `ref="chart"` gives you — call these to drive the picker from your app.
|
|
9
9
|
*
|
|
10
10
|
* Vue exposes these through `defineExpose`, so a template ref is typed as this
|
|
11
|
-
* rather than as the raw component instance.
|
|
11
|
+
* rather than as the raw component instance. It is the shared
|
|
12
|
+
* `SeatingChartHandle` from `@seatlayer/js`: the same 17 methods React's `ref`
|
|
13
|
+
* and Angular's component expose, from one declaration, so the three wrappers
|
|
14
|
+
* cannot drift apart again.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
/** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */
|
|
15
|
-
hold(options?: {
|
|
16
|
-
ttlMs?: number;
|
|
17
|
-
}): Promise<HoldResult | null>;
|
|
18
|
-
/** Restore an active hold by its opaque id. */
|
|
19
|
-
resumeHold(holdId: string): Promise<HoldResult | null>;
|
|
20
|
-
/** Current active hold known to the chart. */
|
|
21
|
-
getCurrentHold(): HoldResult | null;
|
|
22
|
-
/** GA areas with live remaining capacity. */
|
|
23
|
-
getGAAreas(): GAAreaAvailability[];
|
|
24
|
-
/** Atomically hold a quantity from one GA area. */
|
|
25
|
-
holdGA(areaId: string, qty: number, options?: {
|
|
26
|
-
tierId?: string | null;
|
|
27
|
-
ttlMs?: number;
|
|
28
|
-
}): Promise<HoldResult | null>;
|
|
29
|
-
/** Ask the server for the `qty` best free seats and hold them atomically. */
|
|
30
|
-
bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;
|
|
31
|
-
/** Release the current hold (if any). */
|
|
32
|
-
release(): Promise<void>;
|
|
33
|
-
/** Release some held labels while keeping the remainder active. */
|
|
34
|
-
releaseLabels(labels: string[]): Promise<boolean>;
|
|
35
|
-
/** The current selection, with prices resolved from the chart categories. */
|
|
36
|
-
getSelection(): SelectedSeat[];
|
|
37
|
-
/** Choose a ticket tier for a selected seat; `null` reverts to the default. */
|
|
38
|
-
setSeatTier(seatId: string, tierId: string | null): void;
|
|
39
|
-
/** Floors of a multi-floor chart. Empty before the first render. */
|
|
40
|
-
getFloors(): {
|
|
41
|
-
id: string;
|
|
42
|
-
name: string;
|
|
43
|
-
}[];
|
|
44
|
-
/** Switch the shown floor (2D). No-ops on single-floor charts. */
|
|
45
|
-
setFloor(floorId: string): void;
|
|
46
|
-
/** Toggle colorblind-safe rendering at runtime. */
|
|
47
|
-
setColorblindSafe(on: boolean): void;
|
|
48
|
-
/** Zoom in one step (same increment as the wheel/pinch gesture). */
|
|
49
|
-
zoomIn(): void;
|
|
50
|
-
/** Zoom out one step. */
|
|
51
|
-
zoomOut(): void;
|
|
52
|
-
/** Reset the camera so the whole chart fits the container. */
|
|
53
|
-
zoomToFit(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Re-acquire the buyer access session after your app re-authorizes the buyer
|
|
56
|
-
* (Sales Channels). Resolves false when the chart is not access-scoped.
|
|
57
|
-
*/
|
|
58
|
-
refreshAccess(): Promise<boolean>;
|
|
59
|
-
}
|
|
16
|
+
type SeatingChartExposed = SeatingChartHandle;
|
|
60
17
|
/**
|
|
61
18
|
* Vue 3 wrapper around the framework-agnostic `@seatlayer/js` SDK.
|
|
62
19
|
*
|
|
63
20
|
* The canvas is created once and torn down on unmount. Only the props that
|
|
64
|
-
* change the chart's identity
|
|
65
|
-
* `
|
|
66
|
-
*
|
|
21
|
+
* change the chart's identity (`SEATING_CHART_IDENTITY_PROPS`: `event`,
|
|
22
|
+
* `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`,
|
|
23
|
+
* `colorblindSafe`, `initialView`, `errorDisplay`) trigger a rebuild;
|
|
24
|
+
* everything else is read live, so a parent re-render never destroys the canvas
|
|
25
|
+
* mid-selection.
|
|
67
26
|
*
|
|
68
27
|
* Written as a render function rather than an SFC so the package builds with
|
|
69
28
|
* plain TypeScript — a consumer needs no Vue compiler plugin to install it.
|
|
@@ -122,6 +81,25 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
122
81
|
type: BooleanConstructor;
|
|
123
82
|
default: undefined;
|
|
124
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Initial canvas projection. Read once when the chart is built, so
|
|
86
|
+
* changing it rebuilds.
|
|
87
|
+
* @deprecated `'isometric'` and `'perspective'` are retired in favour of
|
|
88
|
+
* the real 3D venue view; use `'flat'`.
|
|
89
|
+
*/
|
|
90
|
+
initialView: {
|
|
91
|
+
type: PropType<RendererViewMode>;
|
|
92
|
+
default: undefined;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* What the BUYER sees when the chart cannot load: `'message'` (default) is
|
|
96
|
+
* a styleable notice with a Try again button, `'none'` is silent for hosts
|
|
97
|
+
* that render their own failure UI from the `error` event.
|
|
98
|
+
*/
|
|
99
|
+
errorDisplay: {
|
|
100
|
+
type: PropType<"message" | "none">;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
125
103
|
/** Copy overrides, read once per mount. */
|
|
126
104
|
messages: {
|
|
127
105
|
type: PropType<SeatingChartOptions["messages"]>;
|
|
@@ -212,6 +190,25 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
212
190
|
type: BooleanConstructor;
|
|
213
191
|
default: undefined;
|
|
214
192
|
};
|
|
193
|
+
/**
|
|
194
|
+
* Initial canvas projection. Read once when the chart is built, so
|
|
195
|
+
* changing it rebuilds.
|
|
196
|
+
* @deprecated `'isometric'` and `'perspective'` are retired in favour of
|
|
197
|
+
* the real 3D venue view; use `'flat'`.
|
|
198
|
+
*/
|
|
199
|
+
initialView: {
|
|
200
|
+
type: PropType<RendererViewMode>;
|
|
201
|
+
default: undefined;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* What the BUYER sees when the chart cannot load: `'message'` (default) is
|
|
205
|
+
* a styleable notice with a Try again button, `'none'` is silent for hosts
|
|
206
|
+
* that render their own failure UI from the `error` event.
|
|
207
|
+
*/
|
|
208
|
+
errorDisplay: {
|
|
209
|
+
type: PropType<"message" | "none">;
|
|
210
|
+
default: undefined;
|
|
211
|
+
};
|
|
215
212
|
/** Copy overrides, read once per mount. */
|
|
216
213
|
messages: {
|
|
217
214
|
type: PropType<SeatingChartOptions["messages"]>;
|
|
@@ -260,6 +257,8 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
260
257
|
locale: string;
|
|
261
258
|
currency: string;
|
|
262
259
|
colorblindSafe: boolean;
|
|
260
|
+
initialView: RendererViewMode;
|
|
261
|
+
errorDisplay: "message" | "none";
|
|
263
262
|
seatTooltip: boolean;
|
|
264
263
|
buyerAccessTokenProvider: BuyerAccessTokenProvider;
|
|
265
264
|
buyerAccessToken: string | BuyerAccessToken;
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
watch
|
|
9
9
|
} from "vue";
|
|
10
10
|
import {
|
|
11
|
-
SeatingChart as CoreSeatingChart
|
|
11
|
+
SeatingChart as CoreSeatingChart,
|
|
12
|
+
SEATING_CHART_IDENTITY_PROPS,
|
|
13
|
+
bindSeatingChartHandle,
|
|
14
|
+
buildSeatingChartOptions
|
|
12
15
|
} from "@seatlayer/js";
|
|
13
16
|
var SeatingChart = defineComponent({
|
|
14
17
|
name: "SeatLayerSeatingChart",
|
|
@@ -27,6 +30,25 @@ var SeatingChart = defineComponent({
|
|
|
27
30
|
currency: { type: String, default: void 0 },
|
|
28
31
|
/** Render with colorblind-safe seat glyphs. */
|
|
29
32
|
colorblindSafe: { type: Boolean, default: void 0 },
|
|
33
|
+
/**
|
|
34
|
+
* Initial canvas projection. Read once when the chart is built, so
|
|
35
|
+
* changing it rebuilds.
|
|
36
|
+
* @deprecated `'isometric'` and `'perspective'` are retired in favour of
|
|
37
|
+
* the real 3D venue view; use `'flat'`.
|
|
38
|
+
*/
|
|
39
|
+
initialView: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* What the BUYER sees when the chart cannot load: `'message'` (default) is
|
|
45
|
+
* a styleable notice with a Try again button, `'none'` is silent for hosts
|
|
46
|
+
* that render their own failure UI from the `error` event.
|
|
47
|
+
*/
|
|
48
|
+
errorDisplay: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
30
52
|
/** Copy overrides, read once per mount. */
|
|
31
53
|
messages: {
|
|
32
54
|
type: Object,
|
|
@@ -101,69 +123,53 @@ var SeatingChart = defineComponent({
|
|
|
101
123
|
const onAccessExpired = (state) => emit("access-expired", state);
|
|
102
124
|
const onAccessUnavailable = (state) => emit("access-unavailable", state);
|
|
103
125
|
const onSelectedObjectUnavailable = (state) => emit("selected-object-unavailable", state);
|
|
104
|
-
const instance = new CoreSeatingChart(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
const instance = new CoreSeatingChart(buildSeatingChartOptions(
|
|
127
|
+
element,
|
|
128
|
+
{
|
|
129
|
+
event: props.event,
|
|
130
|
+
apiBase: props.apiBase,
|
|
131
|
+
maxSelection: props.maxSelection,
|
|
132
|
+
publicKey: props.publicKey,
|
|
133
|
+
locale: props.locale,
|
|
134
|
+
currency: props.currency,
|
|
135
|
+
colorblindSafe: props.colorblindSafe,
|
|
136
|
+
initialView: props.initialView,
|
|
137
|
+
errorDisplay: props.errorDisplay,
|
|
138
|
+
messages: props.messages,
|
|
139
|
+
seatTooltip: props.seatTooltip,
|
|
140
|
+
buyerAccessTokenProvider: props.buyerAccessTokenProvider,
|
|
141
|
+
buyerAccessToken: props.buyerAccessToken
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
onAccessExpired,
|
|
145
|
+
onAccessUnavailable,
|
|
146
|
+
onSelectedObjectUnavailable,
|
|
147
|
+
onSelectionChange,
|
|
148
|
+
onHold,
|
|
149
|
+
onHoldRestored,
|
|
150
|
+
onHoldExpired,
|
|
151
|
+
onGAClick,
|
|
152
|
+
onError,
|
|
153
|
+
onDeckTap,
|
|
154
|
+
onHint,
|
|
155
|
+
onSeatHover
|
|
156
|
+
}
|
|
157
|
+
));
|
|
130
158
|
chart.value = instance;
|
|
131
159
|
void instance.render();
|
|
132
160
|
};
|
|
133
161
|
watch(
|
|
134
162
|
() => [
|
|
135
163
|
container.value,
|
|
136
|
-
|
|
137
|
-
props.
|
|
138
|
-
props
|
|
139
|
-
props.publicKey,
|
|
140
|
-
props.locale,
|
|
141
|
-
props.currency,
|
|
142
|
-
props.colorblindSafe
|
|
164
|
+
// The shared identity list, not a hand-copied one — this is exactly the
|
|
165
|
+
// place Vue fell two props behind React.
|
|
166
|
+
...SEATING_CHART_IDENTITY_PROPS.map((prop) => props[prop])
|
|
143
167
|
],
|
|
144
168
|
build,
|
|
145
169
|
{ immediate: true, flush: "post" }
|
|
146
170
|
);
|
|
147
171
|
onBeforeUnmount(destroy);
|
|
148
|
-
const exposed =
|
|
149
|
-
hold: (options) => chart.value?.hold(options) ?? Promise.resolve(null),
|
|
150
|
-
resumeHold: (holdId) => chart.value?.resumeHold(holdId) ?? Promise.resolve(null),
|
|
151
|
-
getCurrentHold: () => chart.value?.getCurrentHold() ?? null,
|
|
152
|
-
getGAAreas: () => chart.value?.getGAAreas() ?? [],
|
|
153
|
-
holdGA: (areaId, qty, options) => chart.value?.holdGA(areaId, qty, options) ?? Promise.resolve(null),
|
|
154
|
-
bestAvailable: (qty, categoryKey) => chart.value?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),
|
|
155
|
-
release: () => chart.value?.release() ?? Promise.resolve(),
|
|
156
|
-
releaseLabels: (labels) => chart.value?.releaseLabels(labels) ?? Promise.resolve(false),
|
|
157
|
-
getSelection: () => chart.value?.getSelection() ?? [],
|
|
158
|
-
setSeatTier: (seatId, tierId) => chart.value?.setSeatTier(seatId, tierId),
|
|
159
|
-
getFloors: () => chart.value?.getFloors() ?? [],
|
|
160
|
-
setFloor: (floorId) => chart.value?.setFloor(floorId),
|
|
161
|
-
setColorblindSafe: (on) => chart.value?.setColorblindSafe(on),
|
|
162
|
-
zoomIn: () => chart.value?.zoomIn(),
|
|
163
|
-
zoomOut: () => chart.value?.zoomOut(),
|
|
164
|
-
zoomToFit: () => chart.value?.zoomToFit(),
|
|
165
|
-
refreshAccess: () => chart.value?.refreshAccess() ?? Promise.resolve(false)
|
|
166
|
-
};
|
|
172
|
+
const exposed = bindSeatingChartHandle(() => chart.value);
|
|
167
173
|
expose(exposed);
|
|
168
174
|
return () => h("div", { ref: container });
|
|
169
175
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SeatingChart.ts","../src/index.ts"],"sourcesContent":["import {\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n shallowRef,\n watch,\n type PropType,\n type Ref,\n} from 'vue';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type SeatHoverDetails,\n type BuyerAccessToken,\n type BuyerAccessTokenProvider,\n type BuyerAccessExpiredEvent,\n type BuyerAccessUnavailableEvent,\n type SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n/**\n * What `ref=\"chart\"` gives you — call these to drive the picker from your app.\n *\n * Vue exposes these through `defineExpose`, so a template ref is typed as this\n * rather than as the raw component instance.\n */\nexport interface SeatingChartExposed {\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n hold(options?: { ttlMs?: number }): Promise<HoldResult | null>;\n /** Restore an active hold by its opaque id. */\n resumeHold(holdId: string): Promise<HoldResult | null>;\n /** Current active hold known to the chart. */\n getCurrentHold(): 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 /** Release some held labels while keeping the remainder active. */\n releaseLabels(labels: string[]): Promise<boolean>;\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[];\n /** Choose a ticket tier for a selected seat; `null` reverts to the default. */\n setSeatTier(seatId: string, tierId: string | null): void;\n /** Floors of a multi-floor chart. Empty before the first render. */\n getFloors(): { id: string; name: string }[];\n /** Switch the shown floor (2D). No-ops on single-floor charts. */\n setFloor(floorId: string): void;\n /** Toggle colorblind-safe rendering at runtime. */\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 * Re-acquire the buyer access session after your app re-authorizes the buyer\n * (Sales Channels). Resolves false when the chart is not access-scoped.\n */\n refreshAccess(): Promise<boolean>;\n}\n\n/**\n * Vue 3 wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The canvas is created once and torn down on unmount. Only the props that\n * change the chart's identity — `event`, `apiBase`, `maxSelection`, `publicKey`,\n * `locale`, `currency`, `colorblindSafe` — trigger a rebuild; everything else is\n * read live, so a parent re-render never destroys the canvas mid-selection.\n *\n * Written as a render function rather than an SFC so the package builds with\n * plain TypeScript — a consumer needs no Vue compiler plugin to install it.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue';\n * import { SeatingChart, type SeatingChartExposed } from '@seatlayer/vue';\n *\n * const chart = ref<SeatingChartExposed | null>(null);\n * const checkout = async () => {\n * const held = await chart.value?.hold();\n * if (held) await pay(held.holdId);\n * };\n * </script>\n *\n * <template>\n * <SeatingChart ref=\"chart\" event=\"summer-gala\" @selection-change=\"onChange\" />\n * </template>\n * ```\n */\nexport const SeatingChart = defineComponent({\n name: 'SeatLayerSeatingChart',\n\n props: {\n /** Event key to render. Changing it rebuilds the chart. */\n event: { type: String, required: true },\n /** API base URL. Defaults to the public API. */\n apiBase: { type: String, default: undefined },\n /** Cap on how many seats a buyer may select. */\n maxSelection: { type: Number, default: undefined },\n /** Publishable key, when your integration uses one. */\n publicKey: { type: String, default: undefined },\n /** BCP-47 locale for built-in copy. */\n locale: { type: String, default: undefined },\n /** ISO currency for price formatting. */\n currency: { type: String, default: undefined },\n /** Render with colorblind-safe seat glyphs. */\n colorblindSafe: { type: Boolean, default: undefined },\n /** Copy overrides, read once per mount. */\n messages: {\n type: Object as PropType<SeatingChartOptions['messages']>,\n default: undefined,\n },\n /**\n * Show the built-in seat tooltip. Set false to draw your own popover from\n * the `seat-hover` event.\n */\n seatTooltip: { type: Boolean, default: undefined },\n /**\n * Sales Channels: mint a buyer access session on demand. Called with a\n * `reason`; returns `{ token, expiresAt }` from YOUR backend. The token is\n * held in memory only — never storage, never a URL, never a log.\n */\n buyerAccessTokenProvider: {\n type: Function as PropType<BuyerAccessTokenProvider>,\n default: undefined,\n },\n /** One-shot session for hosts that own the lifecycle. Cannot be renewed. */\n buyerAccessToken: {\n type: [String, Object] as PropType<string | BuyerAccessToken>,\n default: undefined,\n },\n },\n\n emits: {\n /** The buyer's selection changed. */\n 'selection-change': (_seats: SelectedSeat[]) => true,\n /** A hold succeeded. */\n hold: (_result: HoldResult) => true,\n /** A previous hold was restored on mount. */\n 'hold-restored': (_result: HoldResult) => true,\n /** The active hold lapsed. */\n 'hold-expired': () => true,\n /** A GA area was clicked. */\n 'ga-click': (_area: GAAreaAvailability) => true,\n /** Something failed — a network error, a rejected hold. */\n error: (_error: unknown) => true,\n /** A floor deck was tapped in the 3D view. */\n 'deck-tap': (_floorId: string) => true,\n /** A transient hint worth showing the buyer, or `null` to clear it. */\n hint: (_message: string | null) => true,\n /** The pointer moved onto a seat, or off one (`null`). */\n 'seat-hover': (_details: SeatHoverDetails | null) => true,\n /** The buyer access session lapsed; `refreshed` says whether it recovered. */\n 'access-expired': (_event: BuyerAccessExpiredEvent) => true,\n /** Private inventory is unavailable and refreshing will not fix it. */\n 'access-unavailable': (_event: BuyerAccessUnavailableEvent) => true,\n /** Selected-but-unheld units stopped being selectable. */\n 'selected-object-unavailable': (_event: SelectedObjectUnavailableEvent) => true,\n },\n\n setup(props, { emit, expose }) {\n const container: Ref<HTMLDivElement | null> = ref(null);\n // shallowRef: the chart owns a canvas and a large scene graph, and making it\n // deeply reactive would have Vue walk all of it on every touch.\n const chart = shallowRef<CoreSeatingChart | null>(null);\n\n const destroy = () => {\n chart.value?.destroy();\n chart.value = null;\n };\n\n const build = () => {\n const element = container.value;\n if (!element) return;\n\n destroy();\n\n // Handlers are bound here rather than inline in the options literal.\n // Inline, TypeScript has to resolve `emit`'s overloads while it is still\n // contextually typing the literal against SeatingChartOptions, and it\n // gives up — collapsing to the last emit signature. Naming them first\n // separates the two inference problems, and reads better besides.\n const onSelectionChange = (seats: SelectedSeat[]) => emit('selection-change', seats);\n const onHold = (result: HoldResult) => emit('hold', result);\n const onHoldRestored = (result: HoldResult) => emit('hold-restored', result);\n const onHoldExpired = () => emit('hold-expired');\n const onGAClick = (area: GAAreaAvailability) => emit('ga-click', area);\n const onError = (error: unknown) => emit('error', error);\n const onDeckTap = (floorId: string) => emit('deck-tap', floorId);\n const onHint = (message: string | null) => emit('hint', message);\n const onSeatHover = (details: SeatHoverDetails | null) => emit('seat-hover', details);\n const onAccessExpired = (state: BuyerAccessExpiredEvent) => emit('access-expired', state);\n const onAccessUnavailable = (state: BuyerAccessUnavailableEvent) =>\n emit('access-unavailable', state);\n const onSelectedObjectUnavailable = (state: SelectedObjectUnavailableEvent) =>\n emit('selected-object-unavailable', state);\n\n const instance = new CoreSeatingChart({\n container: element,\n event: props.event,\n apiBase: props.apiBase,\n maxSelection: props.maxSelection,\n publicKey: props.publicKey,\n locale: props.locale,\n currency: props.currency,\n colorblindSafe: props.colorblindSafe,\n messages: props.messages,\n seatTooltip: props.seatTooltip,\n buyerAccessTokenProvider: props.buyerAccessTokenProvider,\n buyerAccessToken: props.buyerAccessToken,\n onAccessExpired,\n onAccessUnavailable,\n onSelectedObjectUnavailable,\n onSelectionChange,\n onHold,\n onHoldRestored,\n onHoldExpired,\n onGAClick,\n onError,\n onDeckTap,\n onHint,\n onSeatHover,\n });\n\n chart.value = instance;\n void instance.render();\n };\n\n // `flush: 'post'` so the container element exists on the first run — a\n // pre-flush watcher would fire before the DOM node is attached.\n watch(\n () => [\n container.value,\n props.event,\n props.apiBase,\n props.maxSelection,\n props.publicKey,\n props.locale,\n props.currency,\n props.colorblindSafe,\n ],\n build,\n { immediate: true, flush: 'post' },\n );\n\n onBeforeUnmount(destroy);\n\n const exposed: SeatingChartExposed = {\n hold: (options) => chart.value?.hold(options) ?? Promise.resolve(null),\n resumeHold: (holdId) => chart.value?.resumeHold(holdId) ?? Promise.resolve(null),\n getCurrentHold: () => chart.value?.getCurrentHold() ?? null,\n getGAAreas: () => chart.value?.getGAAreas() ?? [],\n holdGA: (areaId, qty, options) => chart.value?.holdGA(areaId, qty, options) ?? Promise.resolve(null),\n bestAvailable: (qty, categoryKey) =>\n chart.value?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null),\n release: () => chart.value?.release() ?? Promise.resolve(),\n releaseLabels: (labels) => chart.value?.releaseLabels(labels) ?? Promise.resolve(false),\n getSelection: () => chart.value?.getSelection() ?? [],\n setSeatTier: (seatId, tierId) => chart.value?.setSeatTier(seatId, tierId),\n getFloors: () => chart.value?.getFloors() ?? [],\n setFloor: (floorId) => chart.value?.setFloor(floorId),\n setColorblindSafe: (on) => chart.value?.setColorblindSafe(on),\n zoomIn: () => chart.value?.zoomIn(),\n zoomOut: () => chart.value?.zoomOut(),\n zoomToFit: () => chart.value?.zoomToFit(),\n refreshAccess: () => chart.value?.refreshAccess() ?? Promise.resolve(false),\n };\n expose(exposed);\n\n return () => h('div', { ref: container });\n },\n});\n","/**\n * @seatlayer/vue — the Vue 3 wrapper for the SeatLayer embed SDK.\n *\n * Components are written as render functions rather than SFCs, so installing\n * this package needs no Vue compiler plugin.\n */\nexport { SeatingChart } from './SeatingChart';\nexport type { SeatingChartExposed } from './SeatingChart';\n\nexport type {\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n SeatHoverDetails,\n} from '@seatlayer/js';\n\n// Sales Channels — buyer access sessions for private channel inventory.\nexport type {\n BuyerAccessToken,\n BuyerAccessTokenProvider,\n BuyerAccessRefreshReason,\n BuyerAccessUnavailableReason,\n BuyerAccessExpiredEvent,\n BuyerAccessUnavailableEvent,\n SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n// The framework-agnostic widget class — for the one-call modal (SeatPickerWidget.open()).\nexport { SeatPicker as SeatPickerWidget } from '@seatlayer/js';\n\n// Host-side embed helper: grows the iframe on `seatlayer:height` and pins it on\n// `seatlayer:fullscreen`. Vue hosts depend on this package alone, so it has to be\n// reachable here rather than only from @seatlayer/js.\nexport { attachPickerFrame } from '@seatlayer/js';\nexport type { AttachPickerFrameOptions } from '@seatlayer/js';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE,gBAAgB;AAAA,OAYX;AA6EA,IAAM,eAAe,gBAAgB;AAAA,EAC1C,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA,IAEL,OAAO,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA;AAAA,IAEtC,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE5C,cAAc,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAEjD,WAAW,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE9C,QAAQ,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE3C,UAAU,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE7C,gBAAgB,EAAE,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AAO,MAAM,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AAAA,EAC1C;AACF,CAAC;;;AC5PD,SAAuB,kBAAwB;AAK/C,SAAS,yBAAyB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/SeatingChart.ts","../src/index.ts"],"sourcesContent":["import {\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n shallowRef,\n watch,\n type PropType,\n type Ref,\n} from 'vue';\nimport {\n SeatingChart as CoreSeatingChart,\n SEATING_CHART_IDENTITY_PROPS,\n bindSeatingChartHandle,\n buildSeatingChartOptions,\n type RendererViewMode,\n type SeatingChartHandle,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type SeatHoverDetails,\n type BuyerAccessToken,\n type BuyerAccessTokenProvider,\n type BuyerAccessExpiredEvent,\n type BuyerAccessUnavailableEvent,\n type SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n/**\n * What `ref=\"chart\"` gives you — call these to drive the picker from your app.\n *\n * Vue exposes these through `defineExpose`, so a template ref is typed as this\n * rather than as the raw component instance. It is the shared\n * `SeatingChartHandle` from `@seatlayer/js`: the same 17 methods React's `ref`\n * and Angular's component expose, from one declaration, so the three wrappers\n * cannot drift apart again.\n */\nexport type SeatingChartExposed = SeatingChartHandle;\n\n/**\n * Vue 3 wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * The canvas is created once and torn down on unmount. Only the props that\n * change the chart's identity (`SEATING_CHART_IDENTITY_PROPS`: `event`,\n * `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency`,\n * `colorblindSafe`, `initialView`, `errorDisplay`) trigger a rebuild;\n * everything else is read live, so a parent re-render never destroys the canvas\n * mid-selection.\n *\n * Written as a render function rather than an SFC so the package builds with\n * plain TypeScript — a consumer needs no Vue compiler plugin to install it.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { ref } from 'vue';\n * import { SeatingChart, type SeatingChartExposed } from '@seatlayer/vue';\n *\n * const chart = ref<SeatingChartExposed | null>(null);\n * const checkout = async () => {\n * const held = await chart.value?.hold();\n * if (held) await pay(held.holdId);\n * };\n * </script>\n *\n * <template>\n * <SeatingChart ref=\"chart\" event=\"summer-gala\" @selection-change=\"onChange\" />\n * </template>\n * ```\n */\nexport const SeatingChart = defineComponent({\n name: 'SeatLayerSeatingChart',\n\n props: {\n /** Event key to render. Changing it rebuilds the chart. */\n event: { type: String, required: true },\n /** API base URL. Defaults to the public API. */\n apiBase: { type: String, default: undefined },\n /** Cap on how many seats a buyer may select. */\n maxSelection: { type: Number, default: undefined },\n /** Publishable key, when your integration uses one. */\n publicKey: { type: String, default: undefined },\n /** BCP-47 locale for built-in copy. */\n locale: { type: String, default: undefined },\n /** ISO currency for price formatting. */\n currency: { type: String, default: undefined },\n /** Render with colorblind-safe seat glyphs. */\n colorblindSafe: { type: Boolean, default: undefined },\n /**\n * Initial canvas projection. Read once when the chart is built, so\n * changing it rebuilds.\n * @deprecated `'isometric'` and `'perspective'` are retired in favour of\n * the real 3D venue view; use `'flat'`.\n */\n initialView: {\n type: String as PropType<RendererViewMode>,\n default: undefined,\n },\n /**\n * What the BUYER sees when the chart cannot load: `'message'` (default) is\n * a styleable notice with a Try again button, `'none'` is silent for hosts\n * that render their own failure UI from the `error` event.\n */\n errorDisplay: {\n type: String as PropType<'message' | 'none'>,\n default: undefined,\n },\n /** Copy overrides, read once per mount. */\n messages: {\n type: Object as PropType<SeatingChartOptions['messages']>,\n default: undefined,\n },\n /**\n * Show the built-in seat tooltip. Set false to draw your own popover from\n * the `seat-hover` event.\n */\n seatTooltip: { type: Boolean, default: undefined },\n /**\n * Sales Channels: mint a buyer access session on demand. Called with a\n * `reason`; returns `{ token, expiresAt }` from YOUR backend. The token is\n * held in memory only — never storage, never a URL, never a log.\n */\n buyerAccessTokenProvider: {\n type: Function as PropType<BuyerAccessTokenProvider>,\n default: undefined,\n },\n /** One-shot session for hosts that own the lifecycle. Cannot be renewed. */\n buyerAccessToken: {\n type: [String, Object] as PropType<string | BuyerAccessToken>,\n default: undefined,\n },\n },\n\n emits: {\n /** The buyer's selection changed. */\n 'selection-change': (_seats: SelectedSeat[]) => true,\n /** A hold succeeded. */\n hold: (_result: HoldResult) => true,\n /** A previous hold was restored on mount. */\n 'hold-restored': (_result: HoldResult) => true,\n /** The active hold lapsed. */\n 'hold-expired': () => true,\n /** A GA area was clicked. */\n 'ga-click': (_area: GAAreaAvailability) => true,\n /** Something failed — a network error, a rejected hold. */\n error: (_error: unknown) => true,\n /** A floor deck was tapped in the 3D view. */\n 'deck-tap': (_floorId: string) => true,\n /** A transient hint worth showing the buyer, or `null` to clear it. */\n hint: (_message: string | null) => true,\n /** The pointer moved onto a seat, or off one (`null`). */\n 'seat-hover': (_details: SeatHoverDetails | null) => true,\n /** The buyer access session lapsed; `refreshed` says whether it recovered. */\n 'access-expired': (_event: BuyerAccessExpiredEvent) => true,\n /** Private inventory is unavailable and refreshing will not fix it. */\n 'access-unavailable': (_event: BuyerAccessUnavailableEvent) => true,\n /** Selected-but-unheld units stopped being selectable. */\n 'selected-object-unavailable': (_event: SelectedObjectUnavailableEvent) => true,\n },\n\n setup(props, { emit, expose }) {\n const container: Ref<HTMLDivElement | null> = ref(null);\n // shallowRef: the chart owns a canvas and a large scene graph, and making it\n // deeply reactive would have Vue walk all of it on every touch.\n const chart = shallowRef<CoreSeatingChart | null>(null);\n\n const destroy = () => {\n chart.value?.destroy();\n chart.value = null;\n };\n\n const build = () => {\n const element = container.value;\n if (!element) return;\n\n destroy();\n\n // Handlers are bound here rather than inline in the options literal.\n // Inline, TypeScript has to resolve `emit`'s overloads while it is still\n // contextually typing the literal against SeatingChartOptions, and it\n // gives up — collapsing to the last emit signature. Naming them first\n // separates the two inference problems, and reads better besides.\n const onSelectionChange = (seats: SelectedSeat[]) => emit('selection-change', seats);\n const onHold = (result: HoldResult) => emit('hold', result);\n const onHoldRestored = (result: HoldResult) => emit('hold-restored', result);\n const onHoldExpired = () => emit('hold-expired');\n const onGAClick = (area: GAAreaAvailability) => emit('ga-click', area);\n const onError = (error: unknown) => emit('error', error);\n const onDeckTap = (floorId: string) => emit('deck-tap', floorId);\n const onHint = (message: string | null) => emit('hint', message);\n const onSeatHover = (details: SeatHoverDetails | null) => emit('seat-hover', details);\n const onAccessExpired = (state: BuyerAccessExpiredEvent) => emit('access-expired', state);\n const onAccessUnavailable = (state: BuyerAccessUnavailableEvent) =>\n emit('access-unavailable', state);\n const onSelectedObjectUnavailable = (state: SelectedObjectUnavailableEvent) =>\n emit('selected-object-unavailable', state);\n\n const instance = new CoreSeatingChart(buildSeatingChartOptions(\n element,\n {\n event: props.event,\n apiBase: props.apiBase,\n maxSelection: props.maxSelection,\n publicKey: props.publicKey,\n locale: props.locale,\n currency: props.currency,\n colorblindSafe: props.colorblindSafe,\n initialView: props.initialView,\n errorDisplay: props.errorDisplay,\n messages: props.messages,\n seatTooltip: props.seatTooltip,\n buyerAccessTokenProvider: props.buyerAccessTokenProvider,\n buyerAccessToken: props.buyerAccessToken,\n },\n {\n onAccessExpired,\n onAccessUnavailable,\n onSelectedObjectUnavailable,\n onSelectionChange,\n onHold,\n onHoldRestored,\n onHoldExpired,\n onGAClick,\n onError,\n onDeckTap,\n onHint,\n onSeatHover,\n },\n ));\n\n chart.value = instance;\n void instance.render();\n };\n\n // `flush: 'post'` so the container element exists on the first run — a\n // pre-flush watcher would fire before the DOM node is attached.\n watch(\n () => [\n container.value,\n // The shared identity list, not a hand-copied one — this is exactly the\n // place Vue fell two props behind React.\n ...SEATING_CHART_IDENTITY_PROPS.map((prop) => props[prop]),\n ],\n build,\n { immediate: true, flush: 'post' },\n );\n\n onBeforeUnmount(destroy);\n\n // Built once and read live: the handle must survive every rebuild, so it\n // asks for the current instance on each call rather than capturing one.\n const exposed: SeatingChartExposed = bindSeatingChartHandle(() => chart.value);\n expose(exposed);\n\n return () => h('div', { ref: container });\n },\n});\n","/**\n * @seatlayer/vue — the Vue 3 wrapper for the SeatLayer embed SDK.\n *\n * Components are written as render functions rather than SFCs, so installing\n * this package needs no Vue compiler plugin.\n */\nexport { SeatingChart } from './SeatingChart';\nexport type { SeatingChartExposed } from './SeatingChart';\n\nexport type {\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n SeatHoverDetails,\n} from '@seatlayer/js';\n\n// Sales Channels — buyer access sessions for private channel inventory.\nexport type {\n BuyerAccessToken,\n BuyerAccessTokenProvider,\n BuyerAccessRefreshReason,\n BuyerAccessUnavailableReason,\n BuyerAccessExpiredEvent,\n BuyerAccessUnavailableEvent,\n SelectedObjectUnavailableEvent,\n} from '@seatlayer/js';\n\n// The framework-agnostic widget class — for the one-call modal (SeatPickerWidget.open()).\nexport { SeatPicker as SeatPickerWidget } from '@seatlayer/js';\n\n// Host-side embed helper: grows the iframe on `seatlayer:height` and pins it on\n// `seatlayer:fullscreen`. Vue hosts depend on this package alone, so it has to be\n// reachable here rather than only from @seatlayer/js.\nexport { attachPickerFrame } from '@seatlayer/js';\nexport type { AttachPickerFrameOptions } from '@seatlayer/js';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,OAcK;AA4CA,IAAM,eAAe,gBAAgB;AAAA,EAC1C,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA,IAEL,OAAO,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA;AAAA,IAEtC,SAAS,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE5C,cAAc,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAEjD,WAAW,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE9C,QAAQ,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE3C,UAAU,EAAE,MAAM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UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF,CAAC;AAED,YAAM,QAAQ;AACd,WAAK,SAAS,OAAO;AAAA,IACvB;AAIA;AAAA,MACE,MAAM;AAAA,QACJ,UAAU;AAAA;AAAA;AAAA,QAGV,GAAG,6BAA6B,IAAI,CAAC,SAAS,MAAM,IAAI,CAAC;AAAA,MAC3D;AAAA,MACA;AAAA,MACA,EAAE,WAAW,MAAM,OAAO,OAAO;AAAA,IACnC;AAEA,oBAAgB,OAAO;AAIvB,UAAM,UAA+B,uBAAuB,MAAM,MAAM,KAAK;AAC7E,WAAO,OAAO;AAEd,WAAO,MAAM,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AAAA,EAC1C;AACF,CAAC;;;ACpOD,SAAuB,kBAAwB;AAK/C,SAAS,yBAAyB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seatlayer/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Vue 3 SeatLayer SDK — one native SeatingChart wrapper plus raw JS SeatPickerWidget and iframe helper.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.seatlayer.io/buyer-sdk/seat-picker/",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"ticketing"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@seatlayer/
|
|
46
|
+
"@seatlayer/core": "0.53.0",
|
|
47
|
+
"@seatlayer/js": "0.53.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"vue": ">=3.3.0"
|