@seatlayer/vue 0.56.0 → 0.58.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/README.md +4 -3
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ async function checkout() {
|
|
|
65
65
|
| `selectedObjects` | `string[]` | Initial object ids or public labels. |
|
|
66
66
|
| `selectableObjects` | `string[] \| null` | Buyer-selectable allow-list. |
|
|
67
67
|
| `numberOfPlacesToSelect` | `number` | Exact count required for a valid selection. |
|
|
68
|
+
| `selectionValidators` | `PickerSelectionValidator[]` | Minimum, consecutive-seat, and no-orphan guards. |
|
|
68
69
|
| `publicKey` | `string` | Reserved compatibility input; stored by the chart but not transmitted to SeatLayer. |
|
|
69
70
|
| `locale` | `string` | BCP-47 locale for built-in copy. |
|
|
70
71
|
| `currency` | `string` | ISO currency for price formatting. |
|
|
@@ -72,7 +73,7 @@ async function checkout() {
|
|
|
72
73
|
| `seatTooltip` | `boolean` | Set `false` to draw your own popover from `@seat-hover`. |
|
|
73
74
|
| `messages` | `object` | Copy overrides. Read once per rebuild. |
|
|
74
75
|
|
|
75
|
-
`numberOfPlacesToSelect` and the other
|
|
76
|
+
`numberOfPlacesToSelect`, `selectionValidators`, and the other identity props rebuild the
|
|
76
77
|
canvas. `selectedObjects` and `selectableObjects` are initial values; use the
|
|
77
78
|
imperative methods for later changes so a new array identity cannot remount the
|
|
78
79
|
chart mid-selection.
|
|
@@ -82,8 +83,8 @@ chart mid-selection.
|
|
|
82
83
|
| Event | Payload |
|
|
83
84
|
| --- | --- |
|
|
84
85
|
| `@selection-change` | `SelectedSeat[]` |
|
|
85
|
-
| `@selection-validity-change` |
|
|
86
|
-
| `@selection-valid` / `@selection-invalid` |
|
|
86
|
+
| `@selection-validity-change` | Rule state with typed `violations` |
|
|
87
|
+
| `@selection-valid` / `@selection-invalid` | Rule-validity transition |
|
|
87
88
|
| `@selection-limit` | Active numeric cap |
|
|
88
89
|
| `@hold` | `HoldResult` |
|
|
89
90
|
| `@hold-restored` | `HoldResult` |
|
package/dist/index.cjs
CHANGED
|
@@ -44,6 +44,8 @@ var SeatingChart = (0, import_vue.defineComponent)({
|
|
|
44
44
|
selectableObjects: { type: Array, default: void 0 },
|
|
45
45
|
/** Exact ticket count required for a valid selection. */
|
|
46
46
|
numberOfPlacesToSelect: { type: Number, default: void 0 },
|
|
47
|
+
/** Local buyer selection guards. Changing them rebuilds the chart. */
|
|
48
|
+
selectionValidators: { type: Array, default: void 0 },
|
|
47
49
|
/** Publishable key, when your integration uses one. */
|
|
48
50
|
publicKey: { type: String, default: void 0 },
|
|
49
51
|
/** BCP-47 locale for built-in copy. */
|
|
@@ -166,6 +168,7 @@ var SeatingChart = (0, import_vue.defineComponent)({
|
|
|
166
168
|
selectedObjects: props.selectedObjects,
|
|
167
169
|
selectableObjects: props.selectableObjects,
|
|
168
170
|
numberOfPlacesToSelect: props.numberOfPlacesToSelect,
|
|
171
|
+
selectionValidators: props.selectionValidators,
|
|
169
172
|
publicKey: props.publicKey,
|
|
170
173
|
locale: props.locale,
|
|
171
174
|
currency: props.currency,
|
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 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 PickerSelectionValidity,\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`, `numberOfPlacesToSelect`, `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 /** Object ids or public labels selected after availability loads. */\n selectedObjects: { type: Array as PropType<string[]>, default: undefined },\n /** Object ids or public labels the buyer may select. */\n selectableObjects: { type: Array as PropType<string[] | null>, default: undefined },\n /** Exact ticket count required for a valid selection. */\n numberOfPlacesToSelect: { 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 /** Exact-count state changed. */\n 'selection-validity-change': (_state: PickerSelectionValidity) => true,\n /** The exact count was reached. */\n 'selection-valid': (_seats: SelectedSeat[]) => true,\n /** The selection is not at the exact count. */\n 'selection-invalid': (_state: PickerSelectionValidity) => true,\n /** The active selection cap was reached. */\n 'selection-limit': (_max: number) => 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 onSelectionValidityChange = (state: PickerSelectionValidity) => emit('selection-validity-change', state);\n const onSelectionValid = (seats: SelectedSeat[]) => emit('selection-valid', seats);\n const onSelectionInvalid = (state: PickerSelectionValidity) => emit('selection-invalid', state);\n const onSelectionLimit = (max: number) => emit('selection-limit', max);\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 selectedObjects: props.selectedObjects,\n selectableObjects: props.selectableObjects,\n numberOfPlacesToSelect: props.numberOfPlacesToSelect,\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 onSelectionValidityChange,\n onSelectionValid,\n onSelectionInvalid,\n onSelectionLimit,\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,gBAmBO;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,c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B,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;;;AD9PD,IAAAC,aAA+C;AAK/C,IAAAA,aAAkC;","names":["CoreSeatingChart","import_js"]}
|
|
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 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 PickerSelectionValidity,\n type PickerSelectionValidator,\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`, `numberOfPlacesToSelect`, `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 /** Object ids or public labels selected after availability loads. */\n selectedObjects: { type: Array as PropType<string[]>, default: undefined },\n /** Object ids or public labels the buyer may select. */\n selectableObjects: { type: Array as PropType<string[] | null>, default: undefined },\n /** Exact ticket count required for a valid selection. */\n numberOfPlacesToSelect: { type: Number, default: undefined },\n /** Local buyer selection guards. Changing them rebuilds the chart. */\n selectionValidators: { type: Array as PropType<PickerSelectionValidator[]>, 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 /** Exact-count state changed. */\n 'selection-validity-change': (_state: PickerSelectionValidity) => true,\n /** The exact count was reached. */\n 'selection-valid': (_seats: SelectedSeat[]) => true,\n /** The selection is not at the exact count. */\n 'selection-invalid': (_state: PickerSelectionValidity) => true,\n /** The active selection cap was reached. */\n 'selection-limit': (_max: number) => 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 onSelectionValidityChange = (state: PickerSelectionValidity) => emit('selection-validity-change', state);\n const onSelectionValid = (seats: SelectedSeat[]) => emit('selection-valid', seats);\n const onSelectionInvalid = (state: PickerSelectionValidity) => emit('selection-invalid', state);\n const onSelectionLimit = (max: number) => emit('selection-limit', max);\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 selectedObjects: props.selectedObjects,\n selectableObjects: props.selectableObjects,\n numberOfPlacesToSelect: props.numberOfPlacesToSelect,\n selectionValidators: props.selectionValidators,\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 onSelectionValidityChange,\n onSelectionValid,\n onSelectionInvalid,\n onSelectionLimit,\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,gBAoBO;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,iBAAiB,EAAE,MAAM,OAA6B,SAAS,OAAU;AAAA;AAAA,IAEzE,mBAAmB,EAAE,MAAM,OAAoC,SAAS,OAAU;AAAA;AAAA,IAElF,wBAAwB,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE3D,qBAAqB,EAAE,MAAM,OAA+C,SAAS,OAAU;AAAA;AAAA,IAE/F,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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AAA,UACzB,wBAAwB,MAAM;AAAA,UAC9B,qBAAqB,MAAM;AAAA,UAC3B,WAAW,MAAM;AAAA,UACjB,QAAQ,MAAM;AAAA,UACd,UAAU,MAAM;AAAA,UAChB,gBAAgB,MAAM;AAAA,UACtB,aAAa,MAAM;AAAA,UACnB,cAAc,MAAM;AAAA,UACpB,UAAU,MAAM;AAAA,UAChB,aAAa,MAAM;AAAA,UACnB,0BAA0B,MAAM;AAAA,UAChC,kBAAkB,MAAM;AAAA,QAC1B;AAAA,QACA;AAAA,UACE;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,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,uCAA6B,IAAI,CAAC,SAAS,MAAM,IAAI,CAAC;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;;;ADlQD,IAAAC,aAA+C;AAK/C,IAAAA,aAAkC;","names":["CoreSeatingChart","import_js"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _seatlayer_core from '@seatlayer/core';
|
|
2
2
|
import * as vue from 'vue';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
-
import { RendererViewMode, SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, PickerSelectionValidity, HoldResult, GAAreaAvailability, SeatHoverDetails, BuyerAccessExpiredEvent, BuyerAccessUnavailableEvent, SelectedObjectUnavailableEvent, SeatingChartHandle } from '@seatlayer/js';
|
|
4
|
+
import { PickerSelectionValidator, RendererViewMode, SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, PickerSelectionValidity, 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
|
/**
|
|
@@ -76,6 +76,11 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
76
76
|
type: NumberConstructor;
|
|
77
77
|
default: undefined;
|
|
78
78
|
};
|
|
79
|
+
/** Local buyer selection guards. Changing them rebuilds the chart. */
|
|
80
|
+
selectionValidators: {
|
|
81
|
+
type: PropType<PickerSelectionValidator[]>;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
79
84
|
/** Publishable key, when your integration uses one. */
|
|
80
85
|
publicKey: {
|
|
81
86
|
type: StringConstructor;
|
|
@@ -208,6 +213,11 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
208
213
|
type: NumberConstructor;
|
|
209
214
|
default: undefined;
|
|
210
215
|
};
|
|
216
|
+
/** Local buyer selection guards. Changing them rebuilds the chart. */
|
|
217
|
+
selectionValidators: {
|
|
218
|
+
type: PropType<PickerSelectionValidator[]>;
|
|
219
|
+
default: undefined;
|
|
220
|
+
};
|
|
211
221
|
/** Publishable key, when your integration uses one. */
|
|
212
222
|
publicKey: {
|
|
213
223
|
type: StringConstructor;
|
|
@@ -298,6 +308,7 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
298
308
|
selectedObjects: string[];
|
|
299
309
|
selectableObjects: string[] | null;
|
|
300
310
|
numberOfPlacesToSelect: number;
|
|
311
|
+
selectionValidators: PickerSelectionValidator[];
|
|
301
312
|
publicKey: string;
|
|
302
313
|
locale: string;
|
|
303
314
|
currency: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _seatlayer_core from '@seatlayer/core';
|
|
2
2
|
import * as vue from 'vue';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
-
import { RendererViewMode, SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, PickerSelectionValidity, HoldResult, GAAreaAvailability, SeatHoverDetails, BuyerAccessExpiredEvent, BuyerAccessUnavailableEvent, SelectedObjectUnavailableEvent, SeatingChartHandle } from '@seatlayer/js';
|
|
4
|
+
import { PickerSelectionValidator, RendererViewMode, SeatingChartOptions, BuyerAccessTokenProvider, BuyerAccessToken, SelectedSeat, PickerSelectionValidity, 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
|
/**
|
|
@@ -76,6 +76,11 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
76
76
|
type: NumberConstructor;
|
|
77
77
|
default: undefined;
|
|
78
78
|
};
|
|
79
|
+
/** Local buyer selection guards. Changing them rebuilds the chart. */
|
|
80
|
+
selectionValidators: {
|
|
81
|
+
type: PropType<PickerSelectionValidator[]>;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
79
84
|
/** Publishable key, when your integration uses one. */
|
|
80
85
|
publicKey: {
|
|
81
86
|
type: StringConstructor;
|
|
@@ -208,6 +213,11 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
208
213
|
type: NumberConstructor;
|
|
209
214
|
default: undefined;
|
|
210
215
|
};
|
|
216
|
+
/** Local buyer selection guards. Changing them rebuilds the chart. */
|
|
217
|
+
selectionValidators: {
|
|
218
|
+
type: PropType<PickerSelectionValidator[]>;
|
|
219
|
+
default: undefined;
|
|
220
|
+
};
|
|
211
221
|
/** Publishable key, when your integration uses one. */
|
|
212
222
|
publicKey: {
|
|
213
223
|
type: StringConstructor;
|
|
@@ -298,6 +308,7 @@ declare const SeatingChart: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
298
308
|
selectedObjects: string[];
|
|
299
309
|
selectableObjects: string[] | null;
|
|
300
310
|
numberOfPlacesToSelect: number;
|
|
311
|
+
selectionValidators: PickerSelectionValidator[];
|
|
301
312
|
publicKey: string;
|
|
302
313
|
locale: string;
|
|
303
314
|
currency: string;
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,8 @@ var SeatingChart = defineComponent({
|
|
|
28
28
|
selectableObjects: { type: Array, default: void 0 },
|
|
29
29
|
/** Exact ticket count required for a valid selection. */
|
|
30
30
|
numberOfPlacesToSelect: { type: Number, default: void 0 },
|
|
31
|
+
/** Local buyer selection guards. Changing them rebuilds the chart. */
|
|
32
|
+
selectionValidators: { type: Array, default: void 0 },
|
|
31
33
|
/** Publishable key, when your integration uses one. */
|
|
32
34
|
publicKey: { type: String, default: void 0 },
|
|
33
35
|
/** BCP-47 locale for built-in copy. */
|
|
@@ -150,6 +152,7 @@ var SeatingChart = defineComponent({
|
|
|
150
152
|
selectedObjects: props.selectedObjects,
|
|
151
153
|
selectableObjects: props.selectableObjects,
|
|
152
154
|
numberOfPlacesToSelect: props.numberOfPlacesToSelect,
|
|
155
|
+
selectionValidators: props.selectionValidators,
|
|
153
156
|
publicKey: props.publicKey,
|
|
154
157
|
locale: props.locale,
|
|
155
158
|
currency: props.currency,
|
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 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 PickerSelectionValidity,\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`, `numberOfPlacesToSelect`, `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 /** Object ids or public labels selected after availability loads. */\n selectedObjects: { type: Array as PropType<string[]>, default: undefined },\n /** Object ids or public labels the buyer may select. */\n selectableObjects: { type: Array as PropType<string[] | null>, default: undefined },\n /** Exact ticket count required for a valid selection. */\n numberOfPlacesToSelect: { 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 /** Exact-count state changed. */\n 'selection-validity-change': (_state: PickerSelectionValidity) => true,\n /** The exact count was reached. */\n 'selection-valid': (_seats: SelectedSeat[]) => true,\n /** The selection is not at the exact count. */\n 'selection-invalid': (_state: PickerSelectionValidity) => true,\n /** The active selection cap was reached. */\n 'selection-limit': (_max: number) => 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 onSelectionValidityChange = (state: PickerSelectionValidity) => emit('selection-validity-change', state);\n const onSelectionValid = (seats: SelectedSeat[]) => emit('selection-valid', seats);\n const onSelectionInvalid = (state: PickerSelectionValidity) => emit('selection-invalid', state);\n const onSelectionLimit = (max: number) => emit('selection-limit', max);\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 selectedObjects: props.selectedObjects,\n selectableObjects: props.selectableObjects,\n numberOfPlacesToSelect: props.numberOfPlacesToSelect,\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 onSelectionValidityChange,\n onSelectionValid,\n onSelectionInvalid,\n onSelectionLimit,\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,OAeK;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,iBAAiB,EAAE,MAAM,OAA6B,SAAS,OAAU;AAAA;AAAA,IAEzE,mBAAmB,EAAE,MAAM,OAAoC,SAAS,OAAU;AAAA;AAAA,IAElF,wBAAwB,EAAE,MAAM,QAAQ,SAAS,OAAU;AAAA;AAAA,IAE3D,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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,UAC9B,WAAW,MAAM;AAAA,UACjB,QAAQ,MAAM;AAAA,UACd,UAAU,MAAM;AAAA,UAChB,gBAAgB,MAAM;AAAA,UACtB,aAAa,MAAM;AAAA,UACnB,cAAc,MAAM;AAAA,UACpB,UAAU,MAAM;AAAA,UAChB,aAAa,MAAM;AAAA,UACnB,0BAA0B,MAAM;AAAA,UAChC,kBAAkB,MAAM;AAAA,QAC1B;AAAA,QACA;AAAA,UACE;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,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;;;AC9PD,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 PickerSelectionValidity,\n type PickerSelectionValidator,\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`, `numberOfPlacesToSelect`, `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 /** Object ids or public labels selected after availability loads. */\n selectedObjects: { type: Array as PropType<string[]>, default: undefined },\n /** Object ids or public labels the buyer may select. */\n selectableObjects: { type: Array as PropType<string[] | null>, default: undefined },\n /** Exact ticket count required for a valid selection. */\n numberOfPlacesToSelect: { type: Number, default: undefined },\n /** Local buyer selection guards. Changing them rebuilds the chart. */\n selectionValidators: { type: Array as PropType<PickerSelectionValidator[]>, 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 /** Exact-count state changed. */\n 'selection-validity-change': (_state: PickerSelectionValidity) => true,\n /** The exact count was reached. */\n 'selection-valid': (_seats: SelectedSeat[]) => true,\n /** The selection is not at the exact count. */\n 'selection-invalid': (_state: PickerSelectionValidity) => true,\n /** The active selection cap was reached. */\n 'selection-limit': (_max: number) => 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 onSelectionValidityChange = (state: PickerSelectionValidity) => emit('selection-validity-change', state);\n const onSelectionValid = (seats: SelectedSeat[]) => emit('selection-valid', seats);\n const onSelectionInvalid = (state: PickerSelectionValidity) => emit('selection-invalid', state);\n const onSelectionLimit = (max: number) => emit('selection-limit', max);\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 selectedObjects: props.selectedObjects,\n selectableObjects: props.selectableObjects,\n numberOfPlacesToSelect: props.numberOfPlacesToSelect,\n selectionValidators: props.selectionValidators,\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 onSelectionValidityChange,\n onSelectionValid,\n onSelectionInvalid,\n onSelectionLimit,\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,E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,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;;;AClQD,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.58.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,8 +43,8 @@
|
|
|
43
43
|
"ticketing"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@seatlayer/core": "0.
|
|
47
|
-
"@seatlayer/js": "0.
|
|
46
|
+
"@seatlayer/core": "0.58.0",
|
|
47
|
+
"@seatlayer/js": "0.58.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"vue": ">=3.3.0"
|