@seatlayer/core 0.29.0 → 0.30.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 CHANGED
@@ -1,29 +1,22 @@
1
1
  # @seatlayer/core
2
2
 
3
- The shared, framework-agnostic seat-rendering engine behind the
4
- [SeatLayer](https://seatlayer.io) SDKs. Pure TypeScript + [Konva](https://konvajs.org/)
5
- (HTML canvas) — no framework.
3
+ [![npm](https://img.shields.io/npm/v/@seatlayer/core)](https://www.npmjs.com/package/@seatlayer/core)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@seatlayer/core)](https://www.npmjs.com/package/@seatlayer/core)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-111827.svg)](../../LICENSE)
6
6
 
7
- > **You almost never install this directly.** It's the low-level engine shared by
8
- > the SeatLayer SDKs. Use one of these instead:
9
- >
10
- > - **[`@seatlayer/js`](https://www.npmjs.com/package/@seatlayer/js)** — the SDK for plain JS and any framework
11
- > - **[`@seatlayer/react`](https://www.npmjs.com/package/@seatlayer/react)** — the React component
7
+ The low-level, framework-agnostic rendering engine and shared domain model behind
8
+ the SeatLayer SDKs. It is pure TypeScript with a Konva canvas renderer.
12
9
 
13
- Full documentation: **<https://docs.seatlayer.io>**
10
+ [Package on npm](https://www.npmjs.com/package/@seatlayer/core) ·
11
+ [Source](https://github.com/seatlayer/seatlayer-sdk/tree/main/packages/core) ·
12
+ [Developer docs](https://docs.seatlayer.io/) ·
13
+ [Live demo](https://app.seatlayer.io/demo/play) ·
14
+ [AI Toolkit](https://github.com/seatlayer/seatlayer-ai-toolkit)
14
15
 
15
- ## What's in here
16
-
17
- `@seatlayer/core` renders a seat map onto a canvas and manages live buyer
18
- interaction, independent of any UI framework:
19
-
20
- - **`SeatmapRenderer`** / `createRenderer(container, opts)` — the Konva-based renderer
21
- - **`PickerController`** — buyer selection + live seat-status state machine (hold / release / best-available), transport-agnostic
22
- - **`expandChart`** and the chart layout helpers — turn a `ChartDoc` into positioned seats
23
- - The shared domain **types** (`ChartDoc`, `Category`, `ExpandedSeat`, `SeatStatus`, …)
24
-
25
- The higher-level SDKs (`@seatlayer/js`, `@seatlayer/react`) wrap this with the
26
- public embed contract (mount a picker, hold seats, hand the `holdId` to your server).
16
+ > **Most applications should not install this package directly.** Use
17
+ > [`@seatlayer/js`](https://www.npmjs.com/package/@seatlayer/js) or
18
+ > [`@seatlayer/react`](https://www.npmjs.com/package/@seatlayer/react) when you
19
+ > need SeatLayer's hosted chart transport, live inventory, holds, and buyer UI.
27
20
 
28
21
  ## Install
29
22
 
@@ -31,7 +24,94 @@ public embed contract (mount a picker, hold seats, hand the `holdId` to your ser
31
24
  npm install @seatlayer/core
32
25
  ```
33
26
 
34
- Requires [`konva`](https://www.npmjs.com/package/konva) (declared as a dependency).
27
+ `konva`, `earcut`, and `ogl` are normal package dependencies and install with
28
+ the package.
29
+
30
+ ## Use it when
31
+
32
+ Install `@seatlayer/core` directly when you are:
33
+
34
+ - building a SeatLayer SDK wrapper for another UI framework or platform;
35
+ - rendering an already-authorized `ChartDoc` with your own data transport;
36
+ - implementing a specialized preview, operator, or evidence surface; or
37
+ - consuming shared chart layout, section, GA, panorama, quality, i18n, or money
38
+ primitives.
39
+
40
+ For a regular checkout integration, start with the
41
+ [Buyer SDK installation guide](https://docs.seatlayer.io/buyer-sdk/install/).
42
+
43
+ ## Main exports
44
+
45
+ | Export | Purpose |
46
+ | --- | --- |
47
+ | `createRenderer` / `SeatmapRenderer` | Create and control the Konva seat-map renderer |
48
+ | `PickerController` | Coordinate selection and seat status with a host-supplied transport |
49
+ | `ChartDoc`, `SeatStatus`, and domain types | Use the canonical chart and inventory contracts |
50
+ | `expandChart` and layout helpers | Expand venue geometry into positioned bookable objects |
51
+ | GA and section helpers | Work with capacities, tiers, hierarchy, and section state |
52
+ | `generatePanorama` | Generate the optional buyer panorama representation |
53
+ | rendered-quality helpers | Validate labels, hierarchy, and visual evidence |
54
+ | i18n and money helpers | Reuse SeatLayer locale and price formatting behavior |
55
+ | `@seatlayer/core/view3d` | Load the optional 3D view entry point |
56
+
57
+ The package exports TypeScript declarations for both ESM and CommonJS consumers.
58
+
59
+ ## Renderer lifecycle
60
+
61
+ `@seatlayer/core` does not fetch a chart or connect to live inventory. Provide a
62
+ trusted `ChartDoc`, apply status changes from your own transport, and destroy the
63
+ renderer with the host view.
64
+
65
+ ```ts
66
+ import {
67
+ createRenderer,
68
+ type ChartDoc,
69
+ } from '@seatlayer/core';
70
+
71
+ const container = document.querySelector<HTMLDivElement>('#seat-map');
72
+ if (!container) throw new Error('Missing #seat-map container');
73
+
74
+ const chart: ChartDoc = await loadAuthorizedChart();
75
+ const renderer = createRenderer(container, { maxSelection: 10 });
76
+
77
+ renderer.setChart(chart);
78
+ renderer.setStatus(['seat_42'], 'booked');
79
+
80
+ // During host teardown:
81
+ renderer.destroy();
82
+ ```
83
+
84
+ Give the container an explicit width and height. The renderer owns pan, zoom,
85
+ selection, and drawing inside that box.
86
+
87
+ ## Responsibilities you still own
88
+
89
+ Direct consumers must deliberately provide:
90
+
91
+ - authorized chart loading and schema/version handling;
92
+ - initial and realtime seat-status transport;
93
+ - reconnect, stale-state, and conflict recovery;
94
+ - hold, extension, release, best-available, and booking orchestration;
95
+ - server-only secret handling and authoritative pricing; and
96
+ - responsive, keyboard, touch, accessibility, and teardown behavior.
97
+
98
+ If you do not need to own all of those boundaries, the higher-level SDK is the
99
+ safer integration surface.
100
+
101
+ ## Security model
102
+
103
+ Rendering is a client concern; permanent booking is not. A browser or mobile app
104
+ may select and hold seats, but only a trusted server should inspect the hold,
105
+ calculate the charge, and book using a secret key. See
106
+ [how the integration works](https://docs.seatlayer.io/start/how-it-works/).
107
+
108
+ ## Related resources
109
+
110
+ - [`@seatlayer/js`](https://www.npmjs.com/package/@seatlayer/js)
111
+ - [`@seatlayer/react`](https://www.npmjs.com/package/@seatlayer/react)
112
+ - [Complete checkout example](https://docs.seatlayer.io/examples/complete-checkout/)
113
+ - [SeatLayer developer site](https://seatlayer.io/developers/)
114
+ - [Agent-readable documentation](https://docs.seatlayer.io/llms.txt)
35
115
 
36
116
  ## License
37
117