@seatlayer/angular 0.35.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/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +128 -0
- package/dist/fesm2022/seatlayer-angular.mjs +246 -0
- package/dist/fesm2022/seatlayer-angular.mjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/seating-chart.component.d.ts +113 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SeatLayer
|
|
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
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @seatlayer/angular
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@seatlayer/angular)
|
|
4
|
+
[](https://www.npmjs.com/package/@seatlayer/angular)
|
|
5
|
+
[](https://angular.dev/)
|
|
6
|
+
[](../../LICENSE)
|
|
7
|
+
|
|
8
|
+
The official Angular component for SeatLayer reserved seating. Render an
|
|
9
|
+
interactive chart, hold inventory in the browser, and complete the booking from
|
|
10
|
+
your trusted server.
|
|
11
|
+
|
|
12
|
+
[Package on npm](https://www.npmjs.com/package/@seatlayer/angular) ·
|
|
13
|
+
[SeatPicker docs](https://docs.seatlayer.io/buyer-sdk/seat-picker/) ·
|
|
14
|
+
[Live demo](https://app.seatlayer.io/demo/play) ·
|
|
15
|
+
[Website](https://seatlayer.io/developers/)
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @seatlayer/angular
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires Angular 17 or newer. The component is **standalone** — import it
|
|
24
|
+
directly, no NgModule needed.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { Component, ViewChild } from '@angular/core';
|
|
30
|
+
import { SeatLayerSeatingChartComponent, type SelectedSeat } from '@seatlayer/angular';
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
selector: 'app-checkout',
|
|
34
|
+
standalone: true,
|
|
35
|
+
imports: [SeatLayerSeatingChartComponent],
|
|
36
|
+
template: `
|
|
37
|
+
<seatlayer-seating-chart
|
|
38
|
+
#chart
|
|
39
|
+
event="ev_9f3a"
|
|
40
|
+
style="display:block; height:520px"
|
|
41
|
+
(selectionChange)="onSelectionChange($event)"
|
|
42
|
+
(hold)="bookOnYourServer($event.holdId)"
|
|
43
|
+
/>
|
|
44
|
+
<button (click)="chart.holdSelection()">Continue</button>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class CheckoutComponent {
|
|
48
|
+
@ViewChild('chart') chart!: SeatLayerSeatingChartComponent;
|
|
49
|
+
|
|
50
|
+
onSelectionChange(seats: SelectedSeat[]) {
|
|
51
|
+
console.log('selected', seats);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
bookOnYourServer(holdId: string) { /* … */ }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Inputs
|
|
59
|
+
|
|
60
|
+
| Input | Type | Notes |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `event` | `string` | **Required.** Changing it rebuilds the chart. |
|
|
63
|
+
| `apiBase` | `string` | Defaults to the public API. |
|
|
64
|
+
| `maxSelection` | `number` | Cap on how many seats a buyer may select. |
|
|
65
|
+
| `publicKey` | `string` | Publishable key, when your integration uses one. |
|
|
66
|
+
| `locale` | `string` | BCP-47 locale for built-in copy. |
|
|
67
|
+
| `currency` | `string` | ISO currency for price formatting. |
|
|
68
|
+
| `colorblindSafe` | `boolean` | Render colorblind-safe seat glyphs. |
|
|
69
|
+
| `seatTooltip` | `boolean` | Set `false` to draw your own popover from `(seatHover)`. |
|
|
70
|
+
| `messages` | `object` | Copy overrides. Read once per rebuild. |
|
|
71
|
+
|
|
72
|
+
Only `event`, `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency` and
|
|
73
|
+
`colorblindSafe` rebuild the canvas — an unrelated change-detection pass never
|
|
74
|
+
destroys the chart mid-selection.
|
|
75
|
+
|
|
76
|
+
## Outputs
|
|
77
|
+
|
|
78
|
+
| Output | Payload |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `(selectionChange)` | `SelectedSeat[]` |
|
|
81
|
+
| `(hold)` | `HoldResult` |
|
|
82
|
+
| `(holdRestored)` | `HoldResult` |
|
|
83
|
+
| `(holdExpired)` | — |
|
|
84
|
+
| `(gaClick)` | `GAAreaAvailability` |
|
|
85
|
+
| `(errored)` | `unknown` |
|
|
86
|
+
| `(deckTap)` | `string` (floor id) |
|
|
87
|
+
| `(hint)` | `string \| null` — `null` clears the hint |
|
|
88
|
+
| `(seatHover)` | `SeatHoverDetails \| null` — `null` when the pointer leaves |
|
|
89
|
+
|
|
90
|
+
> `(errored)` rather than `(error)`: `error` collides with the native DOM error
|
|
91
|
+
> event on the host element, which would fire your handler for unrelated
|
|
92
|
+
> failures.
|
|
93
|
+
|
|
94
|
+
## Imperative API
|
|
95
|
+
|
|
96
|
+
Via a template ref (`#chart`):
|
|
97
|
+
|
|
98
|
+
`holdSelection` · `resumeHold` · `getCurrentHold` · `getGAAreas` · `holdGA` ·
|
|
99
|
+
`bestAvailable` · `release` · `releaseLabels` · `getSelection` · `setSeatTier` ·
|
|
100
|
+
`getFloors` · `setFloor` · `setColorblindSafe` · `zoomIn` · `zoomOut` ·
|
|
101
|
+
`zoomToFit`
|
|
102
|
+
|
|
103
|
+
> `holdSelection()` rather than `hold()`: `hold` is already the name of the
|
|
104
|
+
> `@Output`, and a class cannot have both.
|
|
105
|
+
|
|
106
|
+
## Zone behaviour
|
|
107
|
+
|
|
108
|
+
The chart runs a `requestAnimationFrame` render loop and its own pointer
|
|
109
|
+
handlers. Those are created **outside** the Angular zone — left inside it, every
|
|
110
|
+
frame would schedule change detection for your whole application. Each callback
|
|
111
|
+
re-enters the zone only to emit, which is the only part Angular needs to see.
|
|
112
|
+
|
|
113
|
+
## Also exported
|
|
114
|
+
|
|
115
|
+
- `SeatPickerWidget` — the framework-agnostic one-call modal (`SeatPickerWidget.open()`).
|
|
116
|
+
- `attachPickerFrame` — host-side iframe helper; grows on `seatlayer:height` and
|
|
117
|
+
pins on `seatlayer:fullscreen`.
|
|
118
|
+
|
|
119
|
+
## Related
|
|
120
|
+
|
|
121
|
+
- [`@seatlayer/react`](https://www.npmjs.com/package/@seatlayer/react) — React components
|
|
122
|
+
- [`@seatlayer/vue`](https://www.npmjs.com/package/@seatlayer/vue) — Vue 3 components
|
|
123
|
+
- [`@seatlayer/js`](https://www.npmjs.com/package/@seatlayer/js) — framework-agnostic core
|
|
124
|
+
- [Server SDKs](https://docs.seatlayer.io/server-sdk/install/) — Node.js, Python, PHP, Java, Go, Ruby, .NET
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SeatLayer
|
|
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/dist/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @seatlayer/angular
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@seatlayer/angular)
|
|
4
|
+
[](https://www.npmjs.com/package/@seatlayer/angular)
|
|
5
|
+
[](https://angular.dev/)
|
|
6
|
+
[](../../LICENSE)
|
|
7
|
+
|
|
8
|
+
The official Angular component for SeatLayer reserved seating. Render an
|
|
9
|
+
interactive chart, hold inventory in the browser, and complete the booking from
|
|
10
|
+
your trusted server.
|
|
11
|
+
|
|
12
|
+
[Package on npm](https://www.npmjs.com/package/@seatlayer/angular) ·
|
|
13
|
+
[SeatPicker docs](https://docs.seatlayer.io/buyer-sdk/seat-picker/) ·
|
|
14
|
+
[Live demo](https://app.seatlayer.io/demo/play) ·
|
|
15
|
+
[Website](https://seatlayer.io/developers/)
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @seatlayer/angular
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires Angular 17 or newer. The component is **standalone** — import it
|
|
24
|
+
directly, no NgModule needed.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { Component, ViewChild } from '@angular/core';
|
|
30
|
+
import { SeatLayerSeatingChartComponent, type SelectedSeat } from '@seatlayer/angular';
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
selector: 'app-checkout',
|
|
34
|
+
standalone: true,
|
|
35
|
+
imports: [SeatLayerSeatingChartComponent],
|
|
36
|
+
template: `
|
|
37
|
+
<seatlayer-seating-chart
|
|
38
|
+
#chart
|
|
39
|
+
event="ev_9f3a"
|
|
40
|
+
style="display:block; height:520px"
|
|
41
|
+
(selectionChange)="onSelectionChange($event)"
|
|
42
|
+
(hold)="bookOnYourServer($event.holdId)"
|
|
43
|
+
/>
|
|
44
|
+
<button (click)="chart.holdSelection()">Continue</button>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class CheckoutComponent {
|
|
48
|
+
@ViewChild('chart') chart!: SeatLayerSeatingChartComponent;
|
|
49
|
+
|
|
50
|
+
onSelectionChange(seats: SelectedSeat[]) {
|
|
51
|
+
console.log('selected', seats);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
bookOnYourServer(holdId: string) { /* … */ }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Inputs
|
|
59
|
+
|
|
60
|
+
| Input | Type | Notes |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `event` | `string` | **Required.** Changing it rebuilds the chart. |
|
|
63
|
+
| `apiBase` | `string` | Defaults to the public API. |
|
|
64
|
+
| `maxSelection` | `number` | Cap on how many seats a buyer may select. |
|
|
65
|
+
| `publicKey` | `string` | Publishable key, when your integration uses one. |
|
|
66
|
+
| `locale` | `string` | BCP-47 locale for built-in copy. |
|
|
67
|
+
| `currency` | `string` | ISO currency for price formatting. |
|
|
68
|
+
| `colorblindSafe` | `boolean` | Render colorblind-safe seat glyphs. |
|
|
69
|
+
| `seatTooltip` | `boolean` | Set `false` to draw your own popover from `(seatHover)`. |
|
|
70
|
+
| `messages` | `object` | Copy overrides. Read once per rebuild. |
|
|
71
|
+
|
|
72
|
+
Only `event`, `apiBase`, `maxSelection`, `publicKey`, `locale`, `currency` and
|
|
73
|
+
`colorblindSafe` rebuild the canvas — an unrelated change-detection pass never
|
|
74
|
+
destroys the chart mid-selection.
|
|
75
|
+
|
|
76
|
+
## Outputs
|
|
77
|
+
|
|
78
|
+
| Output | Payload |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `(selectionChange)` | `SelectedSeat[]` |
|
|
81
|
+
| `(hold)` | `HoldResult` |
|
|
82
|
+
| `(holdRestored)` | `HoldResult` |
|
|
83
|
+
| `(holdExpired)` | — |
|
|
84
|
+
| `(gaClick)` | `GAAreaAvailability` |
|
|
85
|
+
| `(errored)` | `unknown` |
|
|
86
|
+
| `(deckTap)` | `string` (floor id) |
|
|
87
|
+
| `(hint)` | `string \| null` — `null` clears the hint |
|
|
88
|
+
| `(seatHover)` | `SeatHoverDetails \| null` — `null` when the pointer leaves |
|
|
89
|
+
|
|
90
|
+
> `(errored)` rather than `(error)`: `error` collides with the native DOM error
|
|
91
|
+
> event on the host element, which would fire your handler for unrelated
|
|
92
|
+
> failures.
|
|
93
|
+
|
|
94
|
+
## Imperative API
|
|
95
|
+
|
|
96
|
+
Via a template ref (`#chart`):
|
|
97
|
+
|
|
98
|
+
`holdSelection` · `resumeHold` · `getCurrentHold` · `getGAAreas` · `holdGA` ·
|
|
99
|
+
`bestAvailable` · `release` · `releaseLabels` · `getSelection` · `setSeatTier` ·
|
|
100
|
+
`getFloors` · `setFloor` · `setColorblindSafe` · `zoomIn` · `zoomOut` ·
|
|
101
|
+
`zoomToFit`
|
|
102
|
+
|
|
103
|
+
> `holdSelection()` rather than `hold()`: `hold` is already the name of the
|
|
104
|
+
> `@Output`, and a class cannot have both.
|
|
105
|
+
|
|
106
|
+
## Zone behaviour
|
|
107
|
+
|
|
108
|
+
The chart runs a `requestAnimationFrame` render loop and its own pointer
|
|
109
|
+
handlers. Those are created **outside** the Angular zone — left inside it, every
|
|
110
|
+
frame would schedule change detection for your whole application. Each callback
|
|
111
|
+
re-enters the zone only to emit, which is the only part Angular needs to see.
|
|
112
|
+
|
|
113
|
+
## Also exported
|
|
114
|
+
|
|
115
|
+
- `SeatPickerWidget` — the framework-agnostic one-call modal (`SeatPickerWidget.open()`).
|
|
116
|
+
- `attachPickerFrame` — host-side iframe helper; grows on `seatlayer:height` and
|
|
117
|
+
pins on `seatlayer:fullscreen`.
|
|
118
|
+
|
|
119
|
+
## Related
|
|
120
|
+
|
|
121
|
+
- [`@seatlayer/react`](https://www.npmjs.com/package/@seatlayer/react) — React components
|
|
122
|
+
- [`@seatlayer/vue`](https://www.npmjs.com/package/@seatlayer/vue) — Vue 3 components
|
|
123
|
+
- [`@seatlayer/js`](https://www.npmjs.com/package/@seatlayer/js) — framework-agnostic core
|
|
124
|
+
- [Server SDKs](https://docs.seatlayer.io/server-sdk/install/) — Node.js, Python, PHP, Java, Go, Ruby, .NET
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, inject, NgZone, DestroyRef, ViewChild, Output, Input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { SeatingChart } from '@seatlayer/js';
|
|
4
|
+
export { SeatPicker as SeatPickerWidget, attachPickerFrame } from '@seatlayer/js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Angular wrapper around the framework-agnostic `@seatlayer/js` SDK.
|
|
8
|
+
*
|
|
9
|
+
* Standalone, so it is imported directly rather than through an NgModule.
|
|
10
|
+
*
|
|
11
|
+
* The canvas is created once and torn down on destroy. Only the inputs that
|
|
12
|
+
* change the chart's identity — `event`, `apiBase`, `maxSelection`, `publicKey`,
|
|
13
|
+
* `locale`, `currency`, `colorblindSafe` — trigger a rebuild, so an unrelated
|
|
14
|
+
* change-detection pass never destroys the canvas mid-selection.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <seatlayer-seating-chart
|
|
19
|
+
* #chart
|
|
20
|
+
* event="summer-gala"
|
|
21
|
+
* (selectionChange)="onSelectionChange($event)"
|
|
22
|
+
* (hold)="onHold($event)"
|
|
23
|
+
* />
|
|
24
|
+
* <button (click)="chart.hold()">Continue</button>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
class SeatLayerSeatingChartComponent {
|
|
28
|
+
/** Event key to render. Changing it rebuilds the chart. */
|
|
29
|
+
event;
|
|
30
|
+
/** API base URL. Defaults to the public API. */
|
|
31
|
+
apiBase;
|
|
32
|
+
/** Cap on how many seats a buyer may select. */
|
|
33
|
+
maxSelection;
|
|
34
|
+
/** Publishable key, when your integration uses one. */
|
|
35
|
+
publicKey;
|
|
36
|
+
/** BCP-47 locale for built-in copy. */
|
|
37
|
+
locale;
|
|
38
|
+
/** ISO currency for price formatting. */
|
|
39
|
+
currency;
|
|
40
|
+
/** Render with colorblind-safe seat glyphs. */
|
|
41
|
+
colorblindSafe;
|
|
42
|
+
/** Show the built-in seat tooltip. Set false to draw your own from `seatHover`. */
|
|
43
|
+
seatTooltip;
|
|
44
|
+
/** Copy overrides, read once per rebuild. */
|
|
45
|
+
messages;
|
|
46
|
+
/** The buyer's selection changed. */
|
|
47
|
+
selectionChange = new EventEmitter();
|
|
48
|
+
/** A hold succeeded. */
|
|
49
|
+
hold = new EventEmitter();
|
|
50
|
+
/** A previous hold was restored on mount. */
|
|
51
|
+
holdRestored = new EventEmitter();
|
|
52
|
+
/** The active hold lapsed. */
|
|
53
|
+
holdExpired = new EventEmitter();
|
|
54
|
+
/** A GA area was clicked. */
|
|
55
|
+
gaClick = new EventEmitter();
|
|
56
|
+
/** Something failed — a network error, a rejected hold. */
|
|
57
|
+
errored = new EventEmitter();
|
|
58
|
+
/** A floor deck was tapped in the 3D view. */
|
|
59
|
+
deckTap = new EventEmitter();
|
|
60
|
+
/** A transient hint worth showing the buyer, or `null` to clear it. */
|
|
61
|
+
hint = new EventEmitter();
|
|
62
|
+
/** The pointer moved onto a seat, or off one (`null`). */
|
|
63
|
+
seatHover = new EventEmitter();
|
|
64
|
+
container;
|
|
65
|
+
zone = inject(NgZone);
|
|
66
|
+
chart = null;
|
|
67
|
+
/** Inputs that require tearing the canvas down and rebuilding it. */
|
|
68
|
+
static REBUILD_INPUTS = [
|
|
69
|
+
'event', 'apiBase', 'maxSelection', 'publicKey', 'locale', 'currency', 'colorblindSafe',
|
|
70
|
+
];
|
|
71
|
+
constructor() {
|
|
72
|
+
inject(DestroyRef).onDestroy(() => this.destroy());
|
|
73
|
+
}
|
|
74
|
+
ngOnChanges(changes) {
|
|
75
|
+
const needsRebuild = SeatLayerSeatingChartComponent.REBUILD_INPUTS.some((name) => name in changes);
|
|
76
|
+
if (needsRebuild) {
|
|
77
|
+
this.build();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// ---------- imperative API, for a template ref ----------
|
|
81
|
+
/** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */
|
|
82
|
+
holdSelection(options) {
|
|
83
|
+
return this.chart?.hold(options) ?? Promise.resolve(null);
|
|
84
|
+
}
|
|
85
|
+
/** Restore an active hold by its opaque id. */
|
|
86
|
+
resumeHold(holdId) {
|
|
87
|
+
return this.chart?.resumeHold(holdId) ?? Promise.resolve(null);
|
|
88
|
+
}
|
|
89
|
+
/** Current active hold known to the chart. */
|
|
90
|
+
getCurrentHold() {
|
|
91
|
+
return this.chart?.getCurrentHold() ?? null;
|
|
92
|
+
}
|
|
93
|
+
/** GA areas with live remaining capacity. */
|
|
94
|
+
getGAAreas() {
|
|
95
|
+
return this.chart?.getGAAreas() ?? [];
|
|
96
|
+
}
|
|
97
|
+
/** Atomically hold a quantity from one GA area. */
|
|
98
|
+
holdGA(areaId, qty, options) {
|
|
99
|
+
return this.chart?.holdGA(areaId, qty, options) ?? Promise.resolve(null);
|
|
100
|
+
}
|
|
101
|
+
/** Ask the server for the `qty` best free seats and hold them atomically. */
|
|
102
|
+
bestAvailable(qty, categoryKey) {
|
|
103
|
+
return this.chart?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null);
|
|
104
|
+
}
|
|
105
|
+
/** Release the current hold (if any). */
|
|
106
|
+
release() {
|
|
107
|
+
return this.chart?.release() ?? Promise.resolve();
|
|
108
|
+
}
|
|
109
|
+
/** Release some held labels while keeping the remainder active. */
|
|
110
|
+
releaseLabels(labels) {
|
|
111
|
+
return this.chart?.releaseLabels(labels) ?? Promise.resolve(false);
|
|
112
|
+
}
|
|
113
|
+
/** The current selection, with prices resolved from the chart categories. */
|
|
114
|
+
getSelection() {
|
|
115
|
+
return this.chart?.getSelection() ?? [];
|
|
116
|
+
}
|
|
117
|
+
/** Choose a ticket tier for a selected seat; `null` reverts to the default. */
|
|
118
|
+
setSeatTier(seatId, tierId) {
|
|
119
|
+
this.chart?.setSeatTier(seatId, tierId);
|
|
120
|
+
}
|
|
121
|
+
/** Floors of a multi-floor chart. Empty before the first render. */
|
|
122
|
+
getFloors() {
|
|
123
|
+
return this.chart?.getFloors() ?? [];
|
|
124
|
+
}
|
|
125
|
+
/** Switch the shown floor (2D). No-ops on single-floor charts. */
|
|
126
|
+
setFloor(floorId) {
|
|
127
|
+
this.chart?.setFloor(floorId);
|
|
128
|
+
}
|
|
129
|
+
/** Toggle colorblind-safe rendering at runtime. */
|
|
130
|
+
setColorblindSafe(on) {
|
|
131
|
+
this.chart?.setColorblindSafe(on);
|
|
132
|
+
}
|
|
133
|
+
/** Zoom in one step (same increment as the wheel/pinch gesture). */
|
|
134
|
+
zoomIn() {
|
|
135
|
+
this.chart?.zoomIn();
|
|
136
|
+
}
|
|
137
|
+
/** Zoom out one step. */
|
|
138
|
+
zoomOut() {
|
|
139
|
+
this.chart?.zoomOut();
|
|
140
|
+
}
|
|
141
|
+
/** Reset the camera so the whole chart fits the container. */
|
|
142
|
+
zoomToFit() {
|
|
143
|
+
this.chart?.zoomToFit();
|
|
144
|
+
}
|
|
145
|
+
// ---------- internals ----------
|
|
146
|
+
build() {
|
|
147
|
+
const element = this.container?.nativeElement;
|
|
148
|
+
if (!element)
|
|
149
|
+
return;
|
|
150
|
+
this.destroy();
|
|
151
|
+
// The chart runs a rAF render loop and pointer handlers. Left inside the
|
|
152
|
+
// Angular zone, every frame would schedule change detection for the whole
|
|
153
|
+
// application — so it is built outside, and each callback re-enters the zone
|
|
154
|
+
// only to emit, which is the only part Angular needs to see.
|
|
155
|
+
this.zone.runOutsideAngular(() => {
|
|
156
|
+
const emit = (emitter, value) => this.zone.run(() => emitter.emit(value));
|
|
157
|
+
const instance = new SeatingChart({
|
|
158
|
+
container: element,
|
|
159
|
+
event: this.event,
|
|
160
|
+
apiBase: this.apiBase,
|
|
161
|
+
maxSelection: this.maxSelection,
|
|
162
|
+
publicKey: this.publicKey,
|
|
163
|
+
locale: this.locale,
|
|
164
|
+
currency: this.currency,
|
|
165
|
+
colorblindSafe: this.colorblindSafe,
|
|
166
|
+
seatTooltip: this.seatTooltip,
|
|
167
|
+
messages: this.messages,
|
|
168
|
+
onSelectionChange: (seats) => emit(this.selectionChange, seats),
|
|
169
|
+
onHold: (result) => emit(this.hold, result),
|
|
170
|
+
onHoldRestored: (result) => emit(this.holdRestored, result),
|
|
171
|
+
onHoldExpired: () => this.zone.run(() => this.holdExpired.emit()),
|
|
172
|
+
onGAClick: (area) => emit(this.gaClick, area),
|
|
173
|
+
onError: (error) => emit(this.errored, error),
|
|
174
|
+
onDeckTap: (floorId) => emit(this.deckTap, floorId),
|
|
175
|
+
onHint: (message) => emit(this.hint, message),
|
|
176
|
+
onSeatHover: (details) => emit(this.seatHover, details),
|
|
177
|
+
});
|
|
178
|
+
this.chart = instance;
|
|
179
|
+
void instance.render();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
destroy() {
|
|
183
|
+
this.chart?.destroy();
|
|
184
|
+
this.chart = null;
|
|
185
|
+
}
|
|
186
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SeatLayerSeatingChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
187
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: SeatLayerSeatingChartComponent, isStandalone: true, selector: "seatlayer-seating-chart", inputs: { event: "event", apiBase: "apiBase", maxSelection: "maxSelection", publicKey: "publicKey", locale: "locale", currency: "currency", colorblindSafe: "colorblindSafe", seatTooltip: "seatTooltip", messages: "messages" }, outputs: { selectionChange: "selectionChange", hold: "hold", holdRestored: "holdRestored", holdExpired: "holdExpired", gaClick: "gaClick", errored: "errored", deckTap: "deckTap", hint: "hint", seatHover: "seatHover" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: '<div #container class="seatlayer-container"></div>', isInline: true, styles: [":host{display:block}.seatlayer-container{width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
188
|
+
}
|
|
189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SeatLayerSeatingChartComponent, decorators: [{
|
|
190
|
+
type: Component,
|
|
191
|
+
args: [{ selector: 'seatlayer-seating-chart', standalone: true, template: '<div #container class="seatlayer-container"></div>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block}.seatlayer-container{width:100%;height:100%}\n"] }]
|
|
192
|
+
}], ctorParameters: () => [], propDecorators: { event: [{
|
|
193
|
+
type: Input,
|
|
194
|
+
args: [{ required: true }]
|
|
195
|
+
}], apiBase: [{
|
|
196
|
+
type: Input
|
|
197
|
+
}], maxSelection: [{
|
|
198
|
+
type: Input
|
|
199
|
+
}], publicKey: [{
|
|
200
|
+
type: Input
|
|
201
|
+
}], locale: [{
|
|
202
|
+
type: Input
|
|
203
|
+
}], currency: [{
|
|
204
|
+
type: Input
|
|
205
|
+
}], colorblindSafe: [{
|
|
206
|
+
type: Input
|
|
207
|
+
}], seatTooltip: [{
|
|
208
|
+
type: Input
|
|
209
|
+
}], messages: [{
|
|
210
|
+
type: Input
|
|
211
|
+
}], selectionChange: [{
|
|
212
|
+
type: Output
|
|
213
|
+
}], hold: [{
|
|
214
|
+
type: Output
|
|
215
|
+
}], holdRestored: [{
|
|
216
|
+
type: Output
|
|
217
|
+
}], holdExpired: [{
|
|
218
|
+
type: Output
|
|
219
|
+
}], gaClick: [{
|
|
220
|
+
type: Output
|
|
221
|
+
}], errored: [{
|
|
222
|
+
type: Output
|
|
223
|
+
}], deckTap: [{
|
|
224
|
+
type: Output
|
|
225
|
+
}], hint: [{
|
|
226
|
+
type: Output
|
|
227
|
+
}], seatHover: [{
|
|
228
|
+
type: Output
|
|
229
|
+
}], container: [{
|
|
230
|
+
type: ViewChild,
|
|
231
|
+
args: ['container', { static: true }]
|
|
232
|
+
}] } });
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @seatlayer/angular — the Angular wrapper for the SeatLayer embed SDK.
|
|
236
|
+
*
|
|
237
|
+
* The component is standalone; import it directly rather than through an
|
|
238
|
+
* NgModule.
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Generated bundle index. Do not edit.
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
export { SeatLayerSeatingChartComponent };
|
|
246
|
+
//# sourceMappingURL=seatlayer-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seatlayer-angular.mjs","sources":["../../src/seating-chart.component.ts","../../src/index.ts","../../src/seatlayer-angular.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n EventEmitter,\n Input,\n NgZone,\n OnChanges,\n Output,\n SimpleChanges,\n ViewChild,\n inject,\n} from '@angular/core';\nimport {\n SeatingChart as CoreSeatingChart,\n type SeatingChartOptions,\n type SelectedSeat,\n type HoldResult,\n type BestAvailableResult,\n type GAAreaAvailability,\n type SeatHoverDetails,\n} from '@seatlayer/js';\n\n/**\n * Angular wrapper around the framework-agnostic `@seatlayer/js` SDK.\n *\n * Standalone, so it is imported directly rather than through an NgModule.\n *\n * The canvas is created once and torn down on destroy. Only the inputs that\n * change the chart's identity — `event`, `apiBase`, `maxSelection`, `publicKey`,\n * `locale`, `currency`, `colorblindSafe` — trigger a rebuild, so an unrelated\n * change-detection pass never destroys the canvas mid-selection.\n *\n * @example\n * ```html\n * <seatlayer-seating-chart\n * #chart\n * event=\"summer-gala\"\n * (selectionChange)=\"onSelectionChange($event)\"\n * (hold)=\"onHold($event)\"\n * />\n * <button (click)=\"chart.hold()\">Continue</button>\n * ```\n */\n@Component({\n selector: 'seatlayer-seating-chart',\n standalone: true,\n template: '<div #container class=\"seatlayer-container\"></div>',\n styles: [':host { display: block; } .seatlayer-container { width: 100%; height: 100%; }'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SeatLayerSeatingChartComponent implements OnChanges {\n /** Event key to render. Changing it rebuilds the chart. */\n @Input({ required: true }) event!: string;\n\n /** API base URL. Defaults to the public API. */\n @Input() apiBase?: string;\n\n /** Cap on how many seats a buyer may select. */\n @Input() maxSelection?: number;\n\n /** Publishable key, when your integration uses one. */\n @Input() publicKey?: string;\n\n /** BCP-47 locale for built-in copy. */\n @Input() locale?: string;\n\n /** ISO currency for price formatting. */\n @Input() currency?: string;\n\n /** Render with colorblind-safe seat glyphs. */\n @Input() colorblindSafe?: boolean;\n\n /** Show the built-in seat tooltip. Set false to draw your own from `seatHover`. */\n @Input() seatTooltip?: boolean;\n\n /** Copy overrides, read once per rebuild. */\n @Input() messages?: SeatingChartOptions['messages'];\n\n /** The buyer's selection changed. */\n @Output() readonly selectionChange: EventEmitter<SelectedSeat[]> = new EventEmitter<SelectedSeat[]>();\n\n /** A hold succeeded. */\n @Output() readonly hold: EventEmitter<HoldResult> = new EventEmitter<HoldResult>();\n\n /** A previous hold was restored on mount. */\n @Output() readonly holdRestored: EventEmitter<HoldResult> = new EventEmitter<HoldResult>();\n\n /** The active hold lapsed. */\n @Output() readonly holdExpired: EventEmitter<void> = new EventEmitter<void>();\n\n /** A GA area was clicked. */\n @Output() readonly gaClick: EventEmitter<GAAreaAvailability> = new EventEmitter<GAAreaAvailability>();\n\n /** Something failed — a network error, a rejected hold. */\n @Output() readonly errored: EventEmitter<unknown> = new EventEmitter<unknown>();\n\n /** A floor deck was tapped in the 3D view. */\n @Output() readonly deckTap: EventEmitter<string> = new EventEmitter<string>();\n\n /** A transient hint worth showing the buyer, or `null` to clear it. */\n @Output() readonly hint: EventEmitter<string | null> = new EventEmitter<string | null>();\n\n /** The pointer moved onto a seat, or off one (`null`). */\n @Output() readonly seatHover: EventEmitter<SeatHoverDetails | null> = new EventEmitter<SeatHoverDetails | null>();\n\n @ViewChild('container', { static: true })\n private readonly container!: ElementRef<HTMLDivElement>;\n\n private readonly zone = inject(NgZone);\n private chart: CoreSeatingChart | null = null;\n\n /** Inputs that require tearing the canvas down and rebuilding it. */\n private static readonly REBUILD_INPUTS = [\n 'event', 'apiBase', 'maxSelection', 'publicKey', 'locale', 'currency', 'colorblindSafe',\n ] as const;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.destroy());\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n const needsRebuild = SeatLayerSeatingChartComponent.REBUILD_INPUTS.some((name) => name in changes);\n if (needsRebuild) {\n this.build();\n }\n }\n\n // ---------- imperative API, for a template ref ----------\n\n /** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */\n holdSelection(options?: { ttlMs?: number }): Promise<HoldResult | null> {\n return this.chart?.hold(options) ?? Promise.resolve(null);\n }\n\n /** Restore an active hold by its opaque id. */\n resumeHold(holdId: string): Promise<HoldResult | null> {\n return this.chart?.resumeHold(holdId) ?? Promise.resolve(null);\n }\n\n /** Current active hold known to the chart. */\n getCurrentHold(): HoldResult | null {\n return this.chart?.getCurrentHold() ?? null;\n }\n\n /** GA areas with live remaining capacity. */\n getGAAreas(): GAAreaAvailability[] {\n return this.chart?.getGAAreas() ?? [];\n }\n\n /** Atomically hold a quantity from one GA area. */\n holdGA(\n areaId: string,\n qty: number,\n options?: { tierId?: string | null; ttlMs?: number },\n ): Promise<HoldResult | null> {\n return this.chart?.holdGA(areaId, qty, options) ?? Promise.resolve(null);\n }\n\n /** Ask the server for the `qty` best free seats and hold them atomically. */\n bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null> {\n return this.chart?.bestAvailable(qty, categoryKey) ?? Promise.resolve(null);\n }\n\n /** Release the current hold (if any). */\n release(): Promise<void> {\n return this.chart?.release() ?? Promise.resolve();\n }\n\n /** Release some held labels while keeping the remainder active. */\n releaseLabels(labels: string[]): Promise<boolean> {\n return this.chart?.releaseLabels(labels) ?? Promise.resolve(false);\n }\n\n /** The current selection, with prices resolved from the chart categories. */\n getSelection(): SelectedSeat[] {\n return this.chart?.getSelection() ?? [];\n }\n\n /** Choose a ticket tier for a selected seat; `null` reverts to the default. */\n setSeatTier(seatId: string, tierId: string | null): void {\n this.chart?.setSeatTier(seatId, tierId);\n }\n\n /** Floors of a multi-floor chart. Empty before the first render. */\n getFloors(): { id: string; name: string }[] {\n return this.chart?.getFloors() ?? [];\n }\n\n /** Switch the shown floor (2D). No-ops on single-floor charts. */\n setFloor(floorId: string): void {\n this.chart?.setFloor(floorId);\n }\n\n /** Toggle colorblind-safe rendering at runtime. */\n setColorblindSafe(on: boolean): void {\n this.chart?.setColorblindSafe(on);\n }\n\n /** Zoom in one step (same increment as the wheel/pinch gesture). */\n zoomIn(): void {\n this.chart?.zoomIn();\n }\n\n /** Zoom out one step. */\n zoomOut(): void {\n this.chart?.zoomOut();\n }\n\n /** Reset the camera so the whole chart fits the container. */\n zoomToFit(): void {\n this.chart?.zoomToFit();\n }\n\n // ---------- internals ----------\n\n private build(): void {\n const element = this.container?.nativeElement;\n if (!element) return;\n\n this.destroy();\n\n // The chart runs a rAF render loop and pointer handlers. Left inside the\n // Angular zone, every frame would schedule change detection for the whole\n // application — so it is built outside, and each callback re-enters the zone\n // only to emit, which is the only part Angular needs to see.\n this.zone.runOutsideAngular(() => {\n const emit = <T>(emitter: EventEmitter<T>, value: T) =>\n this.zone.run(() => emitter.emit(value));\n\n const instance = new CoreSeatingChart({\n container: element,\n event: this.event,\n apiBase: this.apiBase,\n maxSelection: this.maxSelection,\n publicKey: this.publicKey,\n locale: this.locale,\n currency: this.currency,\n colorblindSafe: this.colorblindSafe,\n seatTooltip: this.seatTooltip,\n messages: this.messages,\n onSelectionChange: (seats) => emit(this.selectionChange, seats),\n onHold: (result) => emit(this.hold, result),\n onHoldRestored: (result) => emit(this.holdRestored, result),\n onHoldExpired: () => this.zone.run(() => this.holdExpired.emit()),\n onGAClick: (area) => emit(this.gaClick, area),\n onError: (error) => emit(this.errored, error),\n onDeckTap: (floorId) => emit(this.deckTap, floorId),\n onHint: (message) => emit(this.hint, message),\n onSeatHover: (details) => emit(this.seatHover, details),\n });\n\n this.chart = instance;\n void instance.render();\n });\n }\n\n private destroy(): void {\n this.chart?.destroy();\n this.chart = null;\n }\n}\n","/**\n * @seatlayer/angular — the Angular wrapper for the SeatLayer embed SDK.\n *\n * The component is standalone; import it directly rather than through an\n * NgModule.\n */\nexport { SeatLayerSeatingChartComponent } from './seating-chart.component';\n\nexport type {\n SelectedSeat,\n HoldResult,\n BestAvailableResult,\n GAAreaAvailability,\n HoldLineItem,\n SeatHoverDetails,\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`. Angular hosts depend on this package alone, so it has to\n// be reachable here rather than only from @seatlayer/js.\nexport { attachPickerFrame } from '@seatlayer/js';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["CoreSeatingChart"],"mappings":";;;;;AAwBA;;;;;;;;;;;;;;;;;;;;AAoBG;MAQU,8BAA8B,CAAA;;AAEd,IAAA,KAAK;;AAGvB,IAAA,OAAO;;AAGP,IAAA,YAAY;;AAGZ,IAAA,SAAS;;AAGT,IAAA,MAAM;;AAGN,IAAA,QAAQ;;AAGR,IAAA,cAAc;;AAGd,IAAA,WAAW;;AAGX,IAAA,QAAQ;;AAGE,IAAA,eAAe,GAAiC,IAAI,YAAY,EAAkB;;AAGlF,IAAA,IAAI,GAA6B,IAAI,YAAY,EAAc;;AAG/D,IAAA,YAAY,GAA6B,IAAI,YAAY,EAAc;;AAGvE,IAAA,WAAW,GAAuB,IAAI,YAAY,EAAQ;;AAG1D,IAAA,OAAO,GAAqC,IAAI,YAAY,EAAsB;;AAGlF,IAAA,OAAO,GAA0B,IAAI,YAAY,EAAW;;AAG5D,IAAA,OAAO,GAAyB,IAAI,YAAY,EAAU;;AAG1D,IAAA,IAAI,GAAgC,IAAI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IpB,KAAK,EAAA,CAAA;sBAA/B,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAGhB,OAAO,EAAA,CAAA;sBAAf;gBAGQ,YAAY,EAAA,CAAA;sBAApB;gBAGQ,SAAS,EAAA,CAAA;sBAAjB;gBAGQ,MAAM,EAAA,CAAA;sBAAd;gBAGQ,QAAQ,EAAA,CAAA;sBAAhB;gBAGQ,cAAc,EAAA,CAAA;sBAAtB;gBAGQ,WAAW,EAAA,CAAA;sBAAnB;gBAGQ,QAAQ,EAAA,CAAA;sBAAhB;gBAGkB,eAAe,EAAA,CAAA;sBAAjC;gBAGkB,IAAI,EAAA,CAAA;sBAAtB;gBAGkB,YAAY,EAAA,CAAA;sBAA9B;gBAGkB,WAAW,EAAA,CAAA;sBAA7B;gBAGkB,OAAO,EAAA,CAAA;sBAAzB;gBAGkB,OAAO,EAAA,CAAA;sBAAzB;gBAGkB,OAAO,EAAA,CAAA;sBAAzB;gBAGkB,IAAI,EAAA,CAAA;sBAAtB;gBAGkB,SAAS,EAAA,CAAA;sBAA3B;gBAGgB,SAAS,EAAA,CAAA;sBADzB,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;AC3G1C;;;;;AAKG;;ACLH;;AAEG;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @seatlayer/angular — the Angular wrapper for the SeatLayer embed SDK.
|
|
3
|
+
*
|
|
4
|
+
* The component is standalone; import it directly rather than through an
|
|
5
|
+
* NgModule.
|
|
6
|
+
*/
|
|
7
|
+
export { SeatLayerSeatingChartComponent } from './seating-chart.component';
|
|
8
|
+
export type { SelectedSeat, HoldResult, BestAvailableResult, GAAreaAvailability, HoldLineItem, SeatHoverDetails, } from '@seatlayer/js';
|
|
9
|
+
export { SeatPicker as SeatPickerWidget } from '@seatlayer/js';
|
|
10
|
+
export { attachPickerFrame } from '@seatlayer/js';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { type SeatingChartOptions, type SelectedSeat, type HoldResult, type BestAvailableResult, type GAAreaAvailability, type SeatHoverDetails } from '@seatlayer/js';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Angular wrapper around the framework-agnostic `@seatlayer/js` SDK.
|
|
6
|
+
*
|
|
7
|
+
* Standalone, so it is imported directly rather than through an NgModule.
|
|
8
|
+
*
|
|
9
|
+
* The canvas is created once and torn down on destroy. Only the inputs that
|
|
10
|
+
* change the chart's identity — `event`, `apiBase`, `maxSelection`, `publicKey`,
|
|
11
|
+
* `locale`, `currency`, `colorblindSafe` — trigger a rebuild, so an unrelated
|
|
12
|
+
* change-detection pass never destroys the canvas mid-selection.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <seatlayer-seating-chart
|
|
17
|
+
* #chart
|
|
18
|
+
* event="summer-gala"
|
|
19
|
+
* (selectionChange)="onSelectionChange($event)"
|
|
20
|
+
* (hold)="onHold($event)"
|
|
21
|
+
* />
|
|
22
|
+
* <button (click)="chart.hold()">Continue</button>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class SeatLayerSeatingChartComponent implements OnChanges {
|
|
26
|
+
/** Event key to render. Changing it rebuilds the chart. */
|
|
27
|
+
event: string;
|
|
28
|
+
/** API base URL. Defaults to the public API. */
|
|
29
|
+
apiBase?: string;
|
|
30
|
+
/** Cap on how many seats a buyer may select. */
|
|
31
|
+
maxSelection?: number;
|
|
32
|
+
/** Publishable key, when your integration uses one. */
|
|
33
|
+
publicKey?: string;
|
|
34
|
+
/** BCP-47 locale for built-in copy. */
|
|
35
|
+
locale?: string;
|
|
36
|
+
/** ISO currency for price formatting. */
|
|
37
|
+
currency?: string;
|
|
38
|
+
/** Render with colorblind-safe seat glyphs. */
|
|
39
|
+
colorblindSafe?: boolean;
|
|
40
|
+
/** Show the built-in seat tooltip. Set false to draw your own from `seatHover`. */
|
|
41
|
+
seatTooltip?: boolean;
|
|
42
|
+
/** Copy overrides, read once per rebuild. */
|
|
43
|
+
messages?: SeatingChartOptions['messages'];
|
|
44
|
+
/** The buyer's selection changed. */
|
|
45
|
+
readonly selectionChange: EventEmitter<SelectedSeat[]>;
|
|
46
|
+
/** A hold succeeded. */
|
|
47
|
+
readonly hold: EventEmitter<HoldResult>;
|
|
48
|
+
/** A previous hold was restored on mount. */
|
|
49
|
+
readonly holdRestored: EventEmitter<HoldResult>;
|
|
50
|
+
/** The active hold lapsed. */
|
|
51
|
+
readonly holdExpired: EventEmitter<void>;
|
|
52
|
+
/** A GA area was clicked. */
|
|
53
|
+
readonly gaClick: EventEmitter<GAAreaAvailability>;
|
|
54
|
+
/** Something failed — a network error, a rejected hold. */
|
|
55
|
+
readonly errored: EventEmitter<unknown>;
|
|
56
|
+
/** A floor deck was tapped in the 3D view. */
|
|
57
|
+
readonly deckTap: EventEmitter<string>;
|
|
58
|
+
/** A transient hint worth showing the buyer, or `null` to clear it. */
|
|
59
|
+
readonly hint: EventEmitter<string | null>;
|
|
60
|
+
/** The pointer moved onto a seat, or off one (`null`). */
|
|
61
|
+
readonly seatHover: EventEmitter<SeatHoverDetails | null>;
|
|
62
|
+
private readonly container;
|
|
63
|
+
private readonly zone;
|
|
64
|
+
private chart;
|
|
65
|
+
/** Inputs that require tearing the canvas down and rebuilding it. */
|
|
66
|
+
private static readonly REBUILD_INPUTS;
|
|
67
|
+
constructor();
|
|
68
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
69
|
+
/** Hold the current selection. Resolves the hold, or `null` on a 409 conflict. */
|
|
70
|
+
holdSelection(options?: {
|
|
71
|
+
ttlMs?: number;
|
|
72
|
+
}): Promise<HoldResult | null>;
|
|
73
|
+
/** Restore an active hold by its opaque id. */
|
|
74
|
+
resumeHold(holdId: string): Promise<HoldResult | null>;
|
|
75
|
+
/** Current active hold known to the chart. */
|
|
76
|
+
getCurrentHold(): HoldResult | null;
|
|
77
|
+
/** GA areas with live remaining capacity. */
|
|
78
|
+
getGAAreas(): GAAreaAvailability[];
|
|
79
|
+
/** Atomically hold a quantity from one GA area. */
|
|
80
|
+
holdGA(areaId: string, qty: number, options?: {
|
|
81
|
+
tierId?: string | null;
|
|
82
|
+
ttlMs?: number;
|
|
83
|
+
}): Promise<HoldResult | null>;
|
|
84
|
+
/** Ask the server for the `qty` best free seats and hold them atomically. */
|
|
85
|
+
bestAvailable(qty: number, categoryKey?: string): Promise<BestAvailableResult | null>;
|
|
86
|
+
/** Release the current hold (if any). */
|
|
87
|
+
release(): Promise<void>;
|
|
88
|
+
/** Release some held labels while keeping the remainder active. */
|
|
89
|
+
releaseLabels(labels: string[]): Promise<boolean>;
|
|
90
|
+
/** The current selection, with prices resolved from the chart categories. */
|
|
91
|
+
getSelection(): SelectedSeat[];
|
|
92
|
+
/** Choose a ticket tier for a selected seat; `null` reverts to the default. */
|
|
93
|
+
setSeatTier(seatId: string, tierId: string | null): void;
|
|
94
|
+
/** Floors of a multi-floor chart. Empty before the first render. */
|
|
95
|
+
getFloors(): {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
}[];
|
|
99
|
+
/** Switch the shown floor (2D). No-ops on single-floor charts. */
|
|
100
|
+
setFloor(floorId: string): void;
|
|
101
|
+
/** Toggle colorblind-safe rendering at runtime. */
|
|
102
|
+
setColorblindSafe(on: boolean): void;
|
|
103
|
+
/** Zoom in one step (same increment as the wheel/pinch gesture). */
|
|
104
|
+
zoomIn(): void;
|
|
105
|
+
/** Zoom out one step. */
|
|
106
|
+
zoomOut(): void;
|
|
107
|
+
/** Reset the camera so the whole chart fits the container. */
|
|
108
|
+
zoomToFit(): void;
|
|
109
|
+
private build;
|
|
110
|
+
private destroy;
|
|
111
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SeatLayerSeatingChartComponent, never>;
|
|
112
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SeatLayerSeatingChartComponent, "seatlayer-seating-chart", never, { "event": { "alias": "event"; "required": true; }; "apiBase": { "alias": "apiBase"; "required": false; }; "maxSelection": { "alias": "maxSelection"; "required": false; }; "publicKey": { "alias": "publicKey"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "currency": { "alias": "currency"; "required": false; }; "colorblindSafe": { "alias": "colorblindSafe"; "required": false; }; "seatTooltip": { "alias": "seatTooltip"; "required": false; }; "messages": { "alias": "messages"; "required": false; }; }, { "selectionChange": "selectionChange"; "hold": "hold"; "holdRestored": "holdRestored"; "holdExpired": "holdExpired"; "gaClick": "gaClick"; "errored": "errored"; "deckTap": "deckTap"; "hint": "hint"; "seatHover": "seatHover"; }, never, never, true, never>;
|
|
113
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seatlayer/angular",
|
|
3
|
+
"version": "0.35.0",
|
|
4
|
+
"description": "Angular component for the SeatLayer embed SDK — render an interactive seat picker and hold seats.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://docs.seatlayer.io/buyer-sdk/seat-picker/",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/seatlayer/seatlayer-sdk.git",
|
|
10
|
+
"directory": "packages/angular"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/seatlayer/seatlayer-sdk/issues"
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"keywords": [
|
|
17
|
+
"seating",
|
|
18
|
+
"seat-map",
|
|
19
|
+
"seating-chart",
|
|
20
|
+
"seat-picker",
|
|
21
|
+
"seatlayer",
|
|
22
|
+
"angular",
|
|
23
|
+
"ticketing"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"tslib": "^2.8.1",
|
|
27
|
+
"@seatlayer/core": "0.35.0",
|
|
28
|
+
"@seatlayer/js": "0.35.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@angular/common": ">=17.0.0",
|
|
32
|
+
"@angular/core": ">=17.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@angular/common": "^19.0.0",
|
|
36
|
+
"@angular/compiler": "^19.0.0",
|
|
37
|
+
"@angular/compiler-cli": "^19.0.0",
|
|
38
|
+
"@angular/core": "^19.0.0",
|
|
39
|
+
"ng-packagr": "^19.0.0",
|
|
40
|
+
"rxjs": "^7.8.1",
|
|
41
|
+
"typescript": "~5.6.0",
|
|
42
|
+
"zone.js": "^0.15.0"
|
|
43
|
+
},
|
|
44
|
+
"module": "./dist/fesm2022/seatlayer-angular.mjs",
|
|
45
|
+
"types": "./dist/index.d.ts",
|
|
46
|
+
"exports": {
|
|
47
|
+
".": {
|
|
48
|
+
"types": "./dist/index.d.ts",
|
|
49
|
+
"default": "./dist/fesm2022/seatlayer-angular.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./package.json": {
|
|
52
|
+
"default": "./package.json"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist"
|
|
57
|
+
],
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "ng-packagr -p ng-package.json && node ./check-entry-points.mjs",
|
|
60
|
+
"typecheck": "tsc --noEmit -p tsconfig.lib.json"
|
|
61
|
+
}
|
|
62
|
+
}
|