@seatschart/angular 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +147 -2
- package/dist/designer.component.d.ts +62 -0
- package/dist/designer.component.d.ts.map +1 -0
- package/dist/designer.component.js +92 -0
- package/dist/event-manager.component.d.ts +61 -0
- package/dist/event-manager.component.d.ts.map +1 -0
- package/dist/event-manager.component.js +83 -0
- package/dist/host-core.d.ts +125 -0
- package/dist/host-core.d.ts.map +1 -0
- package/dist/host-core.js +292 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/outputs.d.ts +22 -0
- package/dist/outputs.d.ts.map +1 -0
- package/dist/outputs.js +42 -0
- package/dist/seat-chart.component.d.ts +79 -0
- package/dist/seat-chart.component.d.ts.map +1 -0
- package/dist/seat-chart.component.js +132 -0
- package/package.json +58 -4
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { isPlatformBrowser } from "@angular/common";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, NgZone, PLATFORM_ID, inject, } from "@angular/core";
|
|
3
|
+
import { CHART_CALLBACKS, CHART_COMMANDS, CHART_KIND, EmbedBinding, runCommand, } from "./host-core.js";
|
|
4
|
+
import { createOutputs, emitterOf, outputForwarders, pickInputs } from "./outputs.js";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
// Literal lists: the Angular compiler reads component metadata statically (checked against the embed below).
|
|
7
|
+
const INPUTS = [
|
|
8
|
+
"objectColor", "objectLabel", "tooltip", "priceFormatter", "numberOfPlacesToSelect", "maxSelectedObjects",
|
|
9
|
+
"showSectionContents", "showMinimap", "showSurroundings", "sessionMode", "selectionValidators", "accessibilityFilter",
|
|
10
|
+
"mode", "prompts", "objectWithoutPricingSelectable", "fitTo", "loading", "messages", "selectedObjects",
|
|
11
|
+
"gestureHandling", "selectionModes", "showSeatLabels", "minimumSelectedPlaces", "sectionColor", "objectIcon",
|
|
12
|
+
"isObjectVisible", "hideSectionsNotForSale", "selectableObjects", "objectWithoutCategorySelectable",
|
|
13
|
+
"showSectionPricingOverlay", "showObjectPopover", "showFilterControls", "showLegend", "showZoomOutButton",
|
|
14
|
+
"showFullScreenButton", "fullScreenTarget", "canGoBack", "resaleListings", "partySize", "chartStyle", "objectPopover",
|
|
15
|
+
"legend", "filterControls", "activeFloor", "lockActiveFloor", "showFloorElevator", "settings3d",
|
|
16
|
+
"webBase", "event", "events", "publicKey", "workspaceKey", "token", "parentOrigin", "channel", "channelKey",
|
|
17
|
+
"channelKeys", "session", "season", "language", "multiSelectEnabled", "holdToken", "availableCategories",
|
|
18
|
+
"unavailableCategories", "currency", "theme", "statusPalette", "transparent", "backgroundColor", "pricing",
|
|
19
|
+
"defaultRenderer", "height", "title", "className", "allowFullscreen", "timeoutMs", "holdTokenInputName",
|
|
20
|
+
"selectedObjectsInputName", "form",
|
|
21
|
+
];
|
|
22
|
+
const OUTPUTS = [
|
|
23
|
+
"objectSelected", "objectDeselected", "sessionHold", "holdSucceeded", "holdCallsInProgress", "holdCallsComplete",
|
|
24
|
+
"holdConfirmed", "releaseHoldSucceeded", "releaseHoldFailed", "selectedObjectUnavailable", "chartRerenderingStarted",
|
|
25
|
+
"promptRequest", "holdTokenExpired", "chartRendered", "chartRenderingFailed", "objectClicked", "objectHovered",
|
|
26
|
+
"objectUnhovered", "holdFailed", "selectionInvalid", "selectionValid", "objectStatusChanged", "bestAvailableSelected",
|
|
27
|
+
"bestAvailableFailed", "filteredCategoriesChanged", "accessibilityFilterChanged", "filtersChanged",
|
|
28
|
+
"sessionInitialized", "floorChanged", "fullScreenOpened", "fullScreenClosed", "fullScreenRequest", "objectMouseOver",
|
|
29
|
+
"objectMouseOut", "bestAvailableSelectionFailed", "selectedObjectBooked", "holdCreated",
|
|
30
|
+
"placesPrompt", "ticketTypePrompt", "placesWithTicketTypesPrompt",
|
|
31
|
+
];
|
|
32
|
+
const PROMPTS = [
|
|
33
|
+
["onPlacesPrompt", "placesPrompt", "places"],
|
|
34
|
+
["onTicketTypePrompt", "ticketTypePrompt", "ticketType"],
|
|
35
|
+
["onPlacesWithTicketTypesPrompt", "placesWithTicketTypesPrompt", "placesWithTicketTypes"],
|
|
36
|
+
];
|
|
37
|
+
const bindings = new WeakMap();
|
|
38
|
+
/**
|
|
39
|
+
* `<seatschart-chart>`: the SeatsChart buyer seat map (sandboxed viewer iframe). Inputs map to the `SeatsChart`
|
|
40
|
+
* loader options; changes to declarative options (colours, labels, caps, pricing, prompts, `settings3d`, …) are
|
|
41
|
+
* applied live with `changeConfig`, other changes re-render the iframe (the hold session continues). Pass new object
|
|
42
|
+
* references to change object inputs (`OnChanges`). Every chart callback is an output; every `SeatsChart` command is a
|
|
43
|
+
* method (`@ViewChild(SeatChartComponent)`), each resolving once the chart rendered. `token` is a short-lived buyer
|
|
44
|
+
* JWT from your backend — never an API key.
|
|
45
|
+
*/
|
|
46
|
+
export class SeatChartComponent {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.host = inject(ElementRef);
|
|
49
|
+
this.zone = inject(NgZone);
|
|
50
|
+
this.browser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
51
|
+
this.promptForwarders = {};
|
|
52
|
+
createOutputs(this, OUTPUTS);
|
|
53
|
+
bindings.set(this, new EmbedBinding(CHART_KIND));
|
|
54
|
+
this.forwarders = outputForwarders(this, CHART_CALLBACKS, this.zone);
|
|
55
|
+
for (const [callback, output] of PROMPTS) {
|
|
56
|
+
this.promptForwarders[callback] = (params, confirm, cancel) => {
|
|
57
|
+
const emitter = emitterOf(this, output);
|
|
58
|
+
if (!emitter.observed)
|
|
59
|
+
cancel();
|
|
60
|
+
else
|
|
61
|
+
this.zone.run(() => emitter.emit({ params, confirm, cancel }));
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The underlying `SeatsChart` instance (null before the view is ready, on the server and after destroy):
|
|
67
|
+
* `chart?.selectedObjects` and `chart?.holdToken` give the live selection and hold token synchronously (the
|
|
68
|
+
* component's `selectedObjects` / `holdToken` are the inputs).
|
|
69
|
+
*/
|
|
70
|
+
get chart() {
|
|
71
|
+
return bindings.get(this)?.current ?? null;
|
|
72
|
+
}
|
|
73
|
+
getIframe() {
|
|
74
|
+
return this.chart?.getIframe() ?? null;
|
|
75
|
+
}
|
|
76
|
+
/** Re-create the iframe with the current inputs; an active hold session continues. */
|
|
77
|
+
rerender() {
|
|
78
|
+
this.zone.runOutsideAngular(() => bindings.get(this)?.rerender());
|
|
79
|
+
}
|
|
80
|
+
ngOnChanges() {
|
|
81
|
+
const config = this.config();
|
|
82
|
+
// Outside the zone: chart messages without a subscribed output never trigger change detection.
|
|
83
|
+
this.zone.runOutsideAngular(() => bindings.get(this)?.update(config));
|
|
84
|
+
}
|
|
85
|
+
ngAfterViewInit() {
|
|
86
|
+
if (!this.browser)
|
|
87
|
+
return; // Server rendering: the host element only.
|
|
88
|
+
const config = this.config();
|
|
89
|
+
this.zone.runOutsideAngular(() => bindings.get(this)?.mount(this.host.nativeElement, config));
|
|
90
|
+
}
|
|
91
|
+
ngOnDestroy() {
|
|
92
|
+
bindings.get(this)?.destroy();
|
|
93
|
+
}
|
|
94
|
+
config() {
|
|
95
|
+
const options = pickInputs(this, INPUTS);
|
|
96
|
+
if (options.chartStyle !== undefined)
|
|
97
|
+
options.style = options.chartStyle;
|
|
98
|
+
delete options.chartStyle;
|
|
99
|
+
// A subscribed prompt output switches its viewer prompt to the host (same merge as the loader).
|
|
100
|
+
const prompts = { ...(this.prompts ?? {}) };
|
|
101
|
+
for (const [callback, output, prompt] of PROMPTS) {
|
|
102
|
+
if (!emitterOf(this, output).observed)
|
|
103
|
+
continue;
|
|
104
|
+
prompts[prompt] = true;
|
|
105
|
+
options[callback] = this.promptForwarders[callback];
|
|
106
|
+
}
|
|
107
|
+
if (Object.keys(prompts).length > 0)
|
|
108
|
+
options.prompts = prompts;
|
|
109
|
+
else
|
|
110
|
+
delete options.prompts;
|
|
111
|
+
return { ...options, ...this.forwarders };
|
|
112
|
+
}
|
|
113
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: SeatChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
114
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.25", type: SeatChartComponent, isStandalone: true, selector: "seatschart-chart", inputs: { objectColor: "objectColor", objectLabel: "objectLabel", tooltip: "tooltip", priceFormatter: "priceFormatter", numberOfPlacesToSelect: "numberOfPlacesToSelect", maxSelectedObjects: "maxSelectedObjects", showSectionContents: "showSectionContents", showMinimap: "showMinimap", showSurroundings: "showSurroundings", sessionMode: "sessionMode", selectionValidators: "selectionValidators", accessibilityFilter: "accessibilityFilter", mode: "mode", prompts: "prompts", objectWithoutPricingSelectable: "objectWithoutPricingSelectable", fitTo: "fitTo", loading: "loading", messages: "messages", selectedObjects: "selectedObjects", gestureHandling: "gestureHandling", selectionModes: "selectionModes", showSeatLabels: "showSeatLabels", minimumSelectedPlaces: "minimumSelectedPlaces", sectionColor: "sectionColor", objectIcon: "objectIcon", isObjectVisible: "isObjectVisible", hideSectionsNotForSale: "hideSectionsNotForSale", selectableObjects: "selectableObjects", objectWithoutCategorySelectable: "objectWithoutCategorySelectable", showSectionPricingOverlay: "showSectionPricingOverlay", showObjectPopover: "showObjectPopover", showFilterControls: "showFilterControls", showLegend: "showLegend", showZoomOutButton: "showZoomOutButton", showFullScreenButton: "showFullScreenButton", fullScreenTarget: "fullScreenTarget", canGoBack: "canGoBack", resaleListings: "resaleListings", partySize: "partySize", chartStyle: "chartStyle", objectPopover: "objectPopover", legend: "legend", filterControls: "filterControls", activeFloor: "activeFloor", lockActiveFloor: "lockActiveFloor", showFloorElevator: "showFloorElevator", settings3d: "settings3d", webBase: "webBase", event: "event", events: "events", publicKey: "publicKey", workspaceKey: "workspaceKey", token: "token", parentOrigin: "parentOrigin", channel: "channel", channelKey: "channelKey", channelKeys: "channelKeys", session: "session", season: "season", language: "language", multiSelectEnabled: "multiSelectEnabled", holdToken: "holdToken", availableCategories: "availableCategories", unavailableCategories: "unavailableCategories", currency: "currency", theme: "theme", statusPalette: "statusPalette", transparent: "transparent", backgroundColor: "backgroundColor", pricing: "pricing", defaultRenderer: "defaultRenderer", height: "height", title: "title", className: "className", allowFullscreen: "allowFullscreen", timeoutMs: "timeoutMs", holdTokenInputName: "holdTokenInputName", selectedObjectsInputName: "selectedObjectsInputName", form: "form" }, outputs: { objectSelected: "objectSelected", objectDeselected: "objectDeselected", sessionHold: "sessionHold", holdSucceeded: "holdSucceeded", holdCallsInProgress: "holdCallsInProgress", holdCallsComplete: "holdCallsComplete", holdConfirmed: "holdConfirmed", releaseHoldSucceeded: "releaseHoldSucceeded", releaseHoldFailed: "releaseHoldFailed", selectedObjectUnavailable: "selectedObjectUnavailable", chartRerenderingStarted: "chartRerenderingStarted", promptRequest: "promptRequest", holdTokenExpired: "holdTokenExpired", chartRendered: "chartRendered", chartRenderingFailed: "chartRenderingFailed", objectClicked: "objectClicked", objectHovered: "objectHovered", objectUnhovered: "objectUnhovered", holdFailed: "holdFailed", selectionInvalid: "selectionInvalid", selectionValid: "selectionValid", objectStatusChanged: "objectStatusChanged", bestAvailableSelected: "bestAvailableSelected", bestAvailableFailed: "bestAvailableFailed", filteredCategoriesChanged: "filteredCategoriesChanged", accessibilityFilterChanged: "accessibilityFilterChanged", filtersChanged: "filtersChanged", sessionInitialized: "sessionInitialized", floorChanged: "floorChanged", fullScreenOpened: "fullScreenOpened", fullScreenClosed: "fullScreenClosed", fullScreenRequest: "fullScreenRequest", objectMouseOver: "objectMouseOver", objectMouseOut: "objectMouseOut", bestAvailableSelectionFailed: "bestAvailableSelectionFailed", selectedObjectBooked: "selectedObjectBooked", holdCreated: "holdCreated", placesPrompt: "placesPrompt", ticketTypePrompt: "ticketTypePrompt", placesWithTicketTypesPrompt: "placesWithTicketTypesPrompt" }, host: { attributes: { "data-seatschart-chart": "" } }, usesOnChanges: true, ngImport: i0, template: "", isInline: true, styles: [":host{display:block}"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
115
|
+
}
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: SeatChartComponent, decorators: [{
|
|
117
|
+
type: Component,
|
|
118
|
+
args: [{ selector: "seatschart-chart", standalone: true, template: "", changeDetection: ChangeDetectionStrategy.OnPush, host: { "data-seatschart-chart": "" }, inputs: [...INPUTS], outputs: [...OUTPUTS], styles: [":host{display:block}"] }]
|
|
119
|
+
}], ctorParameters: () => [] });
|
|
120
|
+
for (const name of CHART_COMMANDS) {
|
|
121
|
+
Object.defineProperty(SeatChartComponent.prototype, name, {
|
|
122
|
+
configurable: true,
|
|
123
|
+
writable: true,
|
|
124
|
+
value(...args) {
|
|
125
|
+
return runCommand(bindings.get(this)?.current ?? null, name, CHART_KIND.label, args);
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/** `<seatschart-chart>` input names (`chartStyle` is the chart `style` option). */
|
|
130
|
+
export const SEAT_CHART_INPUTS = INPUTS;
|
|
131
|
+
/** `<seatschart-chart>` output names (`onObjectSelected` → `objectSelected`, plus the three prompts). */
|
|
132
|
+
export const SEAT_CHART_OUTPUTS = OUTPUTS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seatschart/angular",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Angular standalone components for SeatsChart seat maps: buyer chart, Event Manager and designer embeds",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/seatschart/seatschart-prod.git"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"seatschart",
|
|
27
|
+
"seats",
|
|
28
|
+
"angular",
|
|
29
|
+
"embed",
|
|
30
|
+
"ticketing"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "ngc -p tsconfig.json",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"test": "bun test src",
|
|
39
|
+
"prepublishOnly": "bun run build"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@angular/common": ">=19.0.0",
|
|
43
|
+
"@angular/core": ">=19.0.0"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@seatschart/embed": "^0.6.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@angular/common": "21.2.25",
|
|
50
|
+
"@angular/compiler": "21.2.25",
|
|
51
|
+
"@angular/compiler-cli": "21.2.25",
|
|
52
|
+
"@angular/core": "21.2.25",
|
|
53
|
+
"@angular/platform-browser": "21.2.25",
|
|
54
|
+
"@happy-dom/global-registrator": "^21.0.4",
|
|
55
|
+
"happy-dom": "^21.0.4",
|
|
56
|
+
"rxjs": "^7.8.2",
|
|
57
|
+
"typescript": "~6.0.3"
|
|
58
|
+
},
|
|
59
|
+
"sideEffects": false
|
|
60
|
+
}
|