@seatschart/angular 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +148 -148
  3. package/package.json +2 -2
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 SeatsChart
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SeatsChart
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,148 +1,148 @@
1
- # @seatschart/angular
2
-
3
- Angular standalone components for SeatsChart: the buyer seat chart, the Event Manager and the map designer. They are
4
- thin wrappers over the script-tag host API of [`@seatschart/embed`](https://www.npmjs.com/package/@seatschart/embed)
5
- (`SeatsChart`, `SeatsChartEventManager`, `SeatsChartDesigner`): same options, seats.io-compatible callback names and
6
- the same commands. SSR-safe (Angular SSR / Universal): nothing touches `window` at import and the iframe is created
7
- in the browser only, after the view is ready.
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm install @seatschart/angular @seatschart/embed
13
- ```
14
-
15
- Angular 18 or newer (tested with the Angular 21 LTS). The package ships partially compiled (Ivy) components that the
16
- Angular CLI links into your app; it works with and without zone.js.
17
-
18
- ## Buyer seat chart
19
-
20
- `token` is a short-lived buyer JWT minted by your server with the API key (`POST /api/viewer-tokens`). Never pass an
21
- API key or a secret to the browser.
22
-
23
- ```ts
24
- import { Component, ViewChild } from "@angular/core";
25
- import { SeatChartComponent, type SeatChartPrompt } from "@seatschart/angular";
26
- import type { ChartObjectSelected, ChartSessionHold } from "@seatschart/embed";
27
-
28
- @Component({
29
- selector: "app-seats",
30
- imports: [SeatChartComponent],
31
- template: `
32
- <seatschart-chart
33
- #chart
34
- class="seat-map"
35
- webBase="https://your-tenant.seatschart.com"
36
- [event]="eventId"
37
- [token]="jwt"
38
- language="pt"
39
- [height]="640"
40
- [maxSelectedObjects]="maxSeats"
41
- [objectColor]="{ byStatus: { locked: '#f59e0b' } }"
42
- [settings3d]="{ lightPreset: 'exteriorSunset' }"
43
- (chartRendered)="ready = true"
44
- (objectSelected)="onSelected($event)"
45
- (sessionHold)="onHold($event)"
46
- (holdFailed)="error = $event.message"
47
- />
48
- <button type="button" (click)="chart.clearSelection()">Clear</button>
49
- <button type="button" (click)="chart.selectBestAvailable({ number: 2, categories: ['VIP'] })">Best 2 VIP</button>
50
- `,
51
- })
52
- export class SeatsComponent {
53
- @ViewChild(SeatChartComponent) chart?: SeatChartComponent;
54
- eventId = "EVENT_UUID";
55
- jwt = "";
56
- maxSeats = 4;
57
- ready = false;
58
- error = "";
59
- cart: string[] = [];
60
-
61
- onSelected(e: ChartObjectSelected): void {
62
- this.cart = [...this.cart, e.label];
63
- }
64
- onHold(e: ChartSessionHold): void {
65
- // Route to your payment step with e.holdToken + e.seatIds.
66
- }
67
- async viewFromSeat(label: string): Promise<void> {
68
- await this.chart?.showViewFromSeat(label); // "3d" or "photo"
69
- }
70
- }
71
- ```
72
-
73
- - **Inputs** are the `SeatsChart` options of `@seatschart/embed` (`event`, `token`, `webBase`, `parentOrigin`,
74
- `channel`, `channelKey(s)`, `holdToken`, `pricing`, `language`, `theme`, `defaultRenderer`, …) and every declarative
75
- renderer option (`objectColor`, `objectLabel`, `tooltip`, `maxSelectedObjects`, `legend`, `filterControls`,
76
- `settings3d`, …). The chart `style` option (`{ font, cornerRadius, buttonShape }`) is **`chartStyle`**: `class` and
77
- `style` style the host element `<seatschart-chart>` (a block); `className` styles the iframe.
78
- - **Changes** (`ngOnChanges`) are compared by value — pass new object references, in-place mutations are not seen.
79
- Declarative options and `pricing` are applied live with `changeConfig` (no reload); `height`, `title` and
80
- `className` update the iframe in place; any other input re-renders the iframe and the hold session continues.
81
- - **Outputs**: every chart callback without `on`: `(objectSelected)`, `(objectClicked)`, `(holdSucceeded)`,
82
- `(holdConfirmed)`, `(selectionInvalid)`, `(bestAvailableSelected)`, `(floorChanged)`, `(fullScreenOpened)`,
83
- `(holdCreated)` (`SEATSCHART_RESERVATION_SUCCESS`), … with the `@seatschart/embed` payload as `$event`. Chart
84
- messages run outside the Angular zone: only outputs you subscribe to trigger change detection.
85
- - **Host-drawn prompts**: subscribing to `(placesPrompt)`, `(ticketTypePrompt)` or `(placesWithTicketTypesPrompt)`
86
- switches that viewer prompt to your page; `$event` is `{ params, confirm, cancel }` (`SeatChartPrompt<T>`).
87
- - **Commands** are component methods (`@ViewChild` or a template variable): every `SeatsChart` command —
88
- `selectObjects`, `deselectObjects`, `clearSelection`, `trySelectObjects`, `selectBestAvailable`, `changeConfig`,
89
- `setFilters`, `zoomToObjects`, `zoomToSection`, `goToFloor`, `showViewFromSeat`, `getHoldToken`,
90
- `releaseHoldToken`, `exportImage`, … Each resolves once the chart rendered and rejects with `ChartCommandError`.
91
- `chart` is the `SeatsChart` instance (`chart?.selectedObjects`, `chart?.holdToken` synchronously); `getIframe()`
92
- and `rerender()` are there too.
93
- - **Cleanup**: `ngOnDestroy` removes the iframe and its message listener; pending commands reject.
94
-
95
- ## Event Manager (back office)
96
-
97
- ```ts
98
- import { EventManagerComponent } from "@seatschart/angular";
99
-
100
- @Component({
101
- selector: "app-box-office",
102
- imports: [EventManagerComponent],
103
- template: `
104
- <seatschart-event-manager #manager webBase="https://your-tenant.seatschart.com" [event]="eventId"
105
- [token]="managerEmbedToken" mode="select" colorScheme="auto" [maxSelectedObjects]="8"
106
- (selectionChanged)="cart = $event" (managerError)="error = $event.message" />
107
- <button type="button" (click)="manager.setHighlightedObjects(['A-1'])">Highlight A-1</button>
108
- `,
109
- })
110
- export class BoxOfficeComponent { /* … */ }
111
- ```
112
-
113
- Selectability rules, `maxSelectedObjects`, `selectedObjects`, `order`, `filters`, `language` and `colorScheme`
114
- change live (`changeConfig`); `mode`, `event` or `token` re-render the iframe. Methods: every
115
- `SeatsChartEventManager` command (`listSelectedObjects`, `selectObjects`, `listOrderChanges`, `zoomToObjects`, …);
116
- `manager` is the instance. The seats.io `onError` callback is `(managerError)` (an output named `error` would also
117
- catch native DOM `error` events).
118
-
119
- ## Designer
120
-
121
- ```ts
122
- import { DesignerComponent } from "@seatschart/angular";
123
-
124
- @Component({
125
- selector: "app-venue-editor",
126
- imports: [DesignerComponent],
127
- template: `
128
- <seatschart-designer #designer webBase="https://your-tenant.seatschart.com" [token]="designerEmbedToken"
129
- [chartId]="chartId" mode="safe" canvasColorScheme="dark"
130
- (chartUpdated)="saved = true" (exitRequested)="close()" />
131
- <button type="button" (click)="designer.publish('Summer layout')">Publish</button>
132
- `,
133
- })
134
- export class VenueEditorComponent { /* … */ }
135
- ```
136
-
137
- Without `chartId` the designer creates a chart (`(chartCreated)`). The Exit button shows only when something
138
- subscribes to `(exitRequested)`. Outputs emit the callback's event (`(chartUpdated)` gets `{ chartId, draftUpdatedAt,
139
- … }`); `onError` is `(designerError)`. `language`, `colorScheme`, `canvasColorScheme`, `mode` and `safeModeOptions`
140
- change live. Methods: `save()`, `publish(note?)`, `getState()`, `changeConfig()`; `designer?.chartId` is the chart
141
- being edited.
142
-
143
- ## Documentation
144
-
145
- - [Embed guide](https://github.com/seatschart/seatschart-prod/blob/main/docs/locales/en/README.md) and
146
- [Quickstart](https://github.com/seatschart/seatschart-prod/blob/main/docs/locales/en/QUICKSTART.md)
147
- - Every option, callback and command: `@seatschart/embed` (`SeatsChartConfig`, `SeatsChartEventManagerConfig`,
148
- `SeatsChartDesignerConfig`).
1
+ # @seatschart/angular
2
+
3
+ Angular standalone components for SeatsChart: the buyer seat chart, the Event Manager and the map designer. They are
4
+ thin wrappers over the script-tag host API of [`@seatschart/embed`](https://www.npmjs.com/package/@seatschart/embed)
5
+ (`SeatsChart`, `SeatsChartEventManager`, `SeatsChartDesigner`): same options, seats.io-compatible callback names and
6
+ the same commands. SSR-safe (Angular SSR / Universal): nothing touches `window` at import and the iframe is created
7
+ in the browser only, after the view is ready.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @seatschart/angular @seatschart/embed
13
+ ```
14
+
15
+ Angular 18 or newer (tested with the Angular 21 LTS). The package ships partially compiled (Ivy) components that the
16
+ Angular CLI links into your app; it works with and without zone.js.
17
+
18
+ ## Buyer seat chart
19
+
20
+ `token` is a short-lived buyer JWT minted by your server with the API key (`POST /api/viewer-tokens`). Never pass an
21
+ API key or a secret to the browser.
22
+
23
+ ```ts
24
+ import { Component, ViewChild } from "@angular/core";
25
+ import { SeatChartComponent, type SeatChartPrompt } from "@seatschart/angular";
26
+ import type { ChartObjectSelected, ChartSessionHold } from "@seatschart/embed";
27
+
28
+ @Component({
29
+ selector: "app-seats",
30
+ imports: [SeatChartComponent],
31
+ template: `
32
+ <seatschart-chart
33
+ #chart
34
+ class="seat-map"
35
+ webBase="https://your-tenant.seatschart.com"
36
+ [event]="eventId"
37
+ [token]="jwt"
38
+ language="pt"
39
+ [height]="640"
40
+ [maxSelectedObjects]="maxSeats"
41
+ [objectColor]="{ byStatus: { locked: '#f59e0b' } }"
42
+ [settings3d]="{ lightPreset: 'exteriorSunset' }"
43
+ (chartRendered)="ready = true"
44
+ (objectSelected)="onSelected($event)"
45
+ (sessionHold)="onHold($event)"
46
+ (holdFailed)="error = $event.message"
47
+ />
48
+ <button type="button" (click)="chart.clearSelection()">Clear</button>
49
+ <button type="button" (click)="chart.selectBestAvailable({ number: 2, categories: ['VIP'] })">Best 2 VIP</button>
50
+ `,
51
+ })
52
+ export class SeatsComponent {
53
+ @ViewChild(SeatChartComponent) chart?: SeatChartComponent;
54
+ eventId = "EVENT_UUID";
55
+ jwt = "";
56
+ maxSeats = 4;
57
+ ready = false;
58
+ error = "";
59
+ cart: string[] = [];
60
+
61
+ onSelected(e: ChartObjectSelected): void {
62
+ this.cart = [...this.cart, e.label];
63
+ }
64
+ onHold(e: ChartSessionHold): void {
65
+ // Route to your payment step with e.holdToken + e.seatIds.
66
+ }
67
+ async viewFromSeat(label: string): Promise<void> {
68
+ await this.chart?.showViewFromSeat(label); // "3d" or "photo"
69
+ }
70
+ }
71
+ ```
72
+
73
+ - **Inputs** are the `SeatsChart` options of `@seatschart/embed` (`event`, `token`, `webBase`, `parentOrigin`,
74
+ `channel`, `channelKey(s)`, `holdToken`, `pricing`, `language`, `theme`, `defaultRenderer`, …) and every declarative
75
+ renderer option (`objectColor`, `objectLabel`, `tooltip`, `maxSelectedObjects`, `legend`, `filterControls`,
76
+ `settings3d`, …). The chart `style` option (`{ font, cornerRadius, buttonShape }`) is **`chartStyle`**: `class` and
77
+ `style` style the host element `<seatschart-chart>` (a block); `className` styles the iframe.
78
+ - **Changes** (`ngOnChanges`) are compared by value — pass new object references, in-place mutations are not seen.
79
+ Declarative options and `pricing` are applied live with `changeConfig` (no reload); `height`, `title` and
80
+ `className` update the iframe in place; any other input re-renders the iframe and the hold session continues.
81
+ - **Outputs**: every chart callback without `on`: `(objectSelected)`, `(objectClicked)`, `(holdSucceeded)`,
82
+ `(holdConfirmed)`, `(selectionInvalid)`, `(bestAvailableSelected)`, `(floorChanged)`, `(fullScreenOpened)`,
83
+ `(holdCreated)` (`SEATSCHART_RESERVATION_SUCCESS`), … with the `@seatschart/embed` payload as `$event`. Chart
84
+ messages run outside the Angular zone: only outputs you subscribe to trigger change detection.
85
+ - **Host-drawn prompts**: subscribing to `(placesPrompt)`, `(ticketTypePrompt)` or `(placesWithTicketTypesPrompt)`
86
+ switches that viewer prompt to your page; `$event` is `{ params, confirm, cancel }` (`SeatChartPrompt<T>`).
87
+ - **Commands** are component methods (`@ViewChild` or a template variable): every `SeatsChart` command —
88
+ `selectObjects`, `deselectObjects`, `clearSelection`, `trySelectObjects`, `selectBestAvailable`, `changeConfig`,
89
+ `setFilters`, `zoomToObjects`, `zoomToSection`, `goToFloor`, `showViewFromSeat`, `getHoldToken`,
90
+ `releaseHoldToken`, `exportImage`, … Each resolves once the chart rendered and rejects with `ChartCommandError`.
91
+ `chart` is the `SeatsChart` instance (`chart?.selectedObjects`, `chart?.holdToken` synchronously); `getIframe()`
92
+ and `rerender()` are there too.
93
+ - **Cleanup**: `ngOnDestroy` removes the iframe and its message listener; pending commands reject.
94
+
95
+ ## Event Manager (back office)
96
+
97
+ ```ts
98
+ import { EventManagerComponent } from "@seatschart/angular";
99
+
100
+ @Component({
101
+ selector: "app-box-office",
102
+ imports: [EventManagerComponent],
103
+ template: `
104
+ <seatschart-event-manager #manager webBase="https://your-tenant.seatschart.com" [event]="eventId"
105
+ [token]="managerEmbedToken" mode="select" colorScheme="auto" [maxSelectedObjects]="8"
106
+ (selectionChanged)="cart = $event" (managerError)="error = $event.message" />
107
+ <button type="button" (click)="manager.setHighlightedObjects(['A-1'])">Highlight A-1</button>
108
+ `,
109
+ })
110
+ export class BoxOfficeComponent { /* … */ }
111
+ ```
112
+
113
+ Selectability rules, `maxSelectedObjects`, `selectedObjects`, `order`, `filters`, `language` and `colorScheme`
114
+ change live (`changeConfig`); `mode`, `event` or `token` re-render the iframe. Methods: every
115
+ `SeatsChartEventManager` command (`listSelectedObjects`, `selectObjects`, `listOrderChanges`, `zoomToObjects`, …);
116
+ `manager` is the instance. The seats.io `onError` callback is `(managerError)` (an output named `error` would also
117
+ catch native DOM `error` events).
118
+
119
+ ## Designer
120
+
121
+ ```ts
122
+ import { DesignerComponent } from "@seatschart/angular";
123
+
124
+ @Component({
125
+ selector: "app-venue-editor",
126
+ imports: [DesignerComponent],
127
+ template: `
128
+ <seatschart-designer #designer webBase="https://your-tenant.seatschart.com" [token]="designerEmbedToken"
129
+ [chartId]="chartId" mode="safe" canvasColorScheme="dark"
130
+ (chartUpdated)="saved = true" (exitRequested)="close()" />
131
+ <button type="button" (click)="designer.publish('Summer layout')">Publish</button>
132
+ `,
133
+ })
134
+ export class VenueEditorComponent { /* … */ }
135
+ ```
136
+
137
+ Without `chartId` the designer creates a chart (`(chartCreated)`). The Exit button shows only when something
138
+ subscribes to `(exitRequested)`. Outputs emit the callback's event (`(chartUpdated)` gets `{ chartId, draftUpdatedAt,
139
+ … }`); `onError` is `(designerError)`. `language`, `colorScheme`, `canvasColorScheme`, `mode` and `safeModeOptions`
140
+ change live. Methods: `save()`, `publish(note?)`, `getState()`, `changeConfig()`; `designer?.chartId` is the chart
141
+ being edited.
142
+
143
+ ## Documentation
144
+
145
+ - [Embed guide](https://github.com/seatschart/seatschart-prod/blob/main/docs/locales/en/README.md) and
146
+ [Quickstart](https://github.com/seatschart/seatschart-prod/blob/main/docs/locales/en/QUICKSTART.md)
147
+ - Every option, callback and command: `@seatschart/embed` (`SeatsChartConfig`, `SeatsChartEventManagerConfig`,
148
+ `SeatsChartDesignerConfig`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seatschart/angular",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Angular standalone components for SeatsChart seat maps: buyer chart, Event Manager and designer embeds",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "@angular/core": ">=19.0.0"
44
44
  },
45
45
  "dependencies": {
46
- "@seatschart/embed": "^0.5.0"
46
+ "@seatschart/embed": "^0.6.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@angular/common": "21.2.25",