@seatsio/seatsio-react 14.14.0 → 14.16.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.
@@ -1,133 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/main/SeatsioDesigner.tsx
30
- var SeatsioDesigner_exports = {};
31
- __export(SeatsioDesigner_exports, {
32
- default: () => SeatsioDesigner
33
- });
34
- module.exports = __toCommonJS(SeatsioDesigner_exports);
35
-
36
- // src/main/Embeddable.tsx
37
- var React = __toESM(require("react"));
38
-
39
- // src/main/util.ts
40
- var didPropsChange = (prevProps, nextProps) => {
41
- if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {
42
- return true;
43
- }
44
- return Object.keys(nextProps).some((propName) => {
45
- let prevValue = prevProps[propName];
46
- let nextValue = nextProps[propName];
47
- if (prevValue && nextValue) {
48
- if (typeof prevValue === "function" && typeof nextValue === "function") {
49
- return prevValue.toString() !== nextValue.toString();
50
- }
51
- if (typeof prevValue === "object" && typeof nextValue === "object") {
52
- return didPropsChange(prevValue, nextValue);
53
- }
54
- }
55
- return prevValue !== nextValue;
56
- });
57
- };
58
-
59
- // src/main/Embeddable.tsx
60
- var _Embeddable = class _Embeddable extends React.Component {
61
- constructor(props) {
62
- super(props);
63
- this.container = React.createRef();
64
- this.firstRender = true;
65
- }
66
- componentDidMount() {
67
- if (!_Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {
68
- this.createAndRenderChart();
69
- this.firstRender = false;
70
- }
71
- }
72
- componentDidUpdate(prevProps) {
73
- if (didPropsChange(this.props, prevProps) && this.chart) {
74
- this.destroyChart();
75
- this.createAndRenderChart();
76
- }
77
- }
78
- getChartUrl() {
79
- return this.props.chartJsUrl.replace("{region}", this.props.region);
80
- }
81
- async createAndRenderChart() {
82
- const seatsio2 = await this.loadSeatsio();
83
- const config = this.extractConfigFromProps();
84
- config.container = this.container.current;
85
- this.chart = this.createChart(seatsio2, config).render();
86
- if (this.props.onRenderStarted) {
87
- this.props.onRenderStarted(this.chart);
88
- }
89
- }
90
- extractConfigFromProps() {
91
- let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props;
92
- return config;
93
- }
94
- componentWillUnmount() {
95
- this.destroyChart();
96
- }
97
- destroyChart() {
98
- if (this.chart && this.chart.state !== "DESTROYED") {
99
- this.chart.destroy();
100
- }
101
- }
102
- loadSeatsio() {
103
- const chartUrl = this.getChartUrl();
104
- if (!_Embeddable.seatsioBundles[chartUrl]) {
105
- _Embeddable.seatsioBundles[chartUrl] = new Promise((resolve, reject) => {
106
- const script = document.head.appendChild(document.createElement("script"));
107
- window.seatsio = void 0;
108
- script.onload = () => {
109
- resolve(seatsio);
110
- };
111
- script.onerror = () => reject(`Could not load ${script.src}`);
112
- script.src = chartUrl;
113
- });
114
- }
115
- return _Embeddable.seatsioBundles[chartUrl];
116
- }
117
- render() {
118
- return /* @__PURE__ */ React.createElement("div", { ref: this.container, style: { "height": "100%", "width": "100%" } });
119
- }
120
- };
121
- _Embeddable.seatsioBundles = {};
122
- _Embeddable.defaultProps = {
123
- chartJsUrl: "https://cdn-{region}.seatsio.net/chart.js"
124
- };
125
- var Embeddable = _Embeddable;
126
-
127
- // src/main/SeatsioDesigner.tsx
128
- var SeatsioDesigner = class extends Embeddable {
129
- createChart(seatsio2, config) {
130
- return new seatsio2.SeatingChartDesigner(config);
131
- }
132
- };
133
- //# sourceMappingURL=SeatsioDesigner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/main/SeatsioDesigner.tsx","../src/main/Embeddable.tsx","../src/main/util.ts"],"sourcesContent":["import Embeddable from './Embeddable'\nimport { ChartDesignerConfigOptions, Seatsio } from '@seatsio/seatsio-types'\n\nexport default class SeatsioDesigner extends Embeddable<ChartDesignerConfigOptions> {\n createChart (seatsio: Seatsio, config: ChartDesignerConfigOptions) {\n return new seatsio.SeatingChartDesigner(config)\n }\n}","import * as React from 'react'\nimport {didPropsChange} from './util'\nimport { ChartDesigner, CommonConfigOptions, EventManager, Region, SeatingChart, Seatsio } from '@seatsio/seatsio-types'\n\nexport type EmbeddableProps<T > = {\n onRenderStarted?: (chart: SeatingChart | EventManager) => void\n chartJsUrl?: string\n region: Region\n} & T\n\nexport default abstract class Embeddable<T extends CommonConfigOptions> extends React.Component<EmbeddableProps<T>> {\n private container: React.RefObject<HTMLDivElement>\n private chart: SeatingChart\n private firstRender: boolean\n\n private static seatsioBundles: { [key: string]: Promise<Seatsio> } = {}\n\n static defaultProps = {\n chartJsUrl: 'https://cdn-{region}.seatsio.net/chart.js'\n }\n\n constructor(props: EmbeddableProps<T>) {\n super(props);\n this.container = React.createRef()\n this.firstRender = true\n }\n\n abstract createChart (seatsio: Seatsio, config: T): SeatingChart | EventManager | ChartDesigner\n\n componentDidMount () {\n if (!Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {\n this.createAndRenderChart()\n this.firstRender = false\n }\n }\n\n componentDidUpdate (prevProps: EmbeddableProps<T>) {\n if (didPropsChange(this.props, prevProps) && this.chart) {\n this.destroyChart()\n this.createAndRenderChart()\n }\n }\n\n getChartUrl () {\n return this.props.chartJsUrl.replace('{region}', this.props.region)\n }\n\n async createAndRenderChart () {\n const seatsio = await this.loadSeatsio()\n const config = this.extractConfigFromProps()\n config.container = this.container.current\n this.chart = this.createChart(seatsio, config).render()\n if (this.props.onRenderStarted) {\n this.props.onRenderStarted(this.chart)\n }\n }\n\n extractConfigFromProps (): any {\n let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props\n return config\n }\n\n componentWillUnmount () {\n this.destroyChart()\n }\n\n destroyChart () {\n if (this.chart && (this.chart as any).state !== 'DESTROYED') {\n this.chart.destroy()\n }\n }\n\n loadSeatsio (): Promise<Seatsio> {\n const chartUrl = this.getChartUrl()\n if (!Embeddable.seatsioBundles[chartUrl]) {\n Embeddable.seatsioBundles[chartUrl] = new Promise<Seatsio>((resolve, reject) => {\n const script = document.head.appendChild(document.createElement('script'))\n // Seatsio global is not replaced if already present, which would cause the wrong region bundle to resolve when changing region\n window.seatsio = undefined\n script.onload = () => {\n resolve(seatsio)\n }\n script.onerror = () => reject(`Could not load ${script.src}`)\n script.src = chartUrl\n })\n }\n\n return Embeddable.seatsioBundles[chartUrl]\n }\n\n render (): React.ReactNode {\n return (\n <div ref={this.container as unknown as React.RefObject<HTMLDivElement>} style={{'height': '100%', 'width': '100%'}} />\n )\n }\n}","import {Booth, GeneralAdmissionArea, InteractiveSection, Seat, SelectableObject, Table} from \"@seatsio/seatsio-types\"\n\nexport const didPropsChange = <P extends { [key: string]: any}>(prevProps: P, nextProps: P): boolean => {\n if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {\n return true\n }\n return Object.keys(nextProps).some((propName: string) => {\n let prevValue = prevProps[propName]\n let nextValue = nextProps[propName]\n if (prevValue && nextValue) {\n if (typeof prevValue === 'function' && typeof nextValue === 'function') {\n return prevValue.toString() !== nextValue.toString()\n }\n if (typeof prevValue === 'object' && typeof nextValue === 'object') {\n return didPropsChange(prevValue, nextValue)\n }\n }\n return prevValue !== nextValue\n })\n}\n\nexport const isSeat = (obj: SelectableObject) => obj.objectType === 'Seat'\nexport const isTable = (obj: SelectableObject): obj is Table => obj.objectType === 'Table'\nexport const isSection = (obj: SelectableObject): obj is InteractiveSection => obj.objectType === 'section'\nexport const isBooth = (obj: SelectableObject): obj is Booth => obj.objectType === 'Booth'\nexport const isGeneralAdmission = (obj: SelectableObject): obj is GeneralAdmissionArea => obj.objectType === 'GeneralAdmissionArea'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACEhB,IAAM,iBAAiB,CAAkC,WAAc,cAA0B;AACpG,MAAI,OAAO,KAAK,SAAS,EAAE,WAAW,OAAO,KAAK,SAAS,EAAE,QAAQ;AACjE,WAAO;AAAA,EACX;AACA,SAAO,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,aAAqB;AACrD,QAAI,YAAY,UAAU,QAAQ;AAClC,QAAI,YAAY,UAAU,QAAQ;AAClC,QAAI,aAAa,WAAW;AACxB,UAAI,OAAO,cAAc,cAAc,OAAO,cAAc,YAAY;AACpE,eAAO,UAAU,SAAS,MAAM,UAAU,SAAS;AAAA,MACvD;AACA,UAAI,OAAO,cAAc,YAAY,OAAO,cAAc,UAAU;AAChE,eAAO,eAAe,WAAW,SAAS;AAAA,MAC9C;AAAA,IACJ;AACA,WAAO,cAAc;AAAA,EACzB,CAAC;AACL;;;ADTA,IAA8B,cAA9B,MAA8B,oBAAwD,gBAA8B;AAAA,EAWhH,YAAY,OAA2B;AACnC,UAAM,KAAK;AACX,SAAK,YAAkB,gBAAU;AACjC,SAAK,cAAc;AAAA,EACvB;A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;AAAA,QACnB;AACA,eAAO,UAAU,MAAM,OAAO,kBAAkB,OAAO,GAAG,EAAE;AAC5D,eAAO,MAAM;AAAA,MACjB,CAAC;AAAA,IACL;AAEA,WAAO,YAAW,eAAe,QAAQ;AAAA,EAC7C;AAAA,EAEA,SAA2B;AACvB,WACI,oCAAC,SAAI,KAAK,KAAK,WAAyD,OAAO,EAAC,UAAU,QAAQ,SAAS,OAAM,GAAG;AAAA,EAE5H;AACJ;AArF8B,YAKX,iBAAsD,CAAC;AAL5C,YAOnB,eAAe;AAAA,EAClB,YAAY;AAChB;AATJ,IAA8B,aAA9B;;;ADPA,IAAqB,kBAArB,cAA6C,WAAuC;AAAA,EAChF,YAAaC,UAAkB,QAAoC;AAC/D,WAAO,IAAIA,SAAQ,qBAAqB,MAAM;AAAA,EAClD;AACJ;","names":["seatsio","seatsio"]}
@@ -1,101 +0,0 @@
1
- // src/main/Embeddable.tsx
2
- import * as React from "react";
3
-
4
- // src/main/util.ts
5
- var didPropsChange = (prevProps, nextProps) => {
6
- if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {
7
- return true;
8
- }
9
- return Object.keys(nextProps).some((propName) => {
10
- let prevValue = prevProps[propName];
11
- let nextValue = nextProps[propName];
12
- if (prevValue && nextValue) {
13
- if (typeof prevValue === "function" && typeof nextValue === "function") {
14
- return prevValue.toString() !== nextValue.toString();
15
- }
16
- if (typeof prevValue === "object" && typeof nextValue === "object") {
17
- return didPropsChange(prevValue, nextValue);
18
- }
19
- }
20
- return prevValue !== nextValue;
21
- });
22
- };
23
-
24
- // src/main/Embeddable.tsx
25
- var _Embeddable = class _Embeddable extends React.Component {
26
- constructor(props) {
27
- super(props);
28
- this.container = React.createRef();
29
- this.firstRender = true;
30
- }
31
- componentDidMount() {
32
- if (!_Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {
33
- this.createAndRenderChart();
34
- this.firstRender = false;
35
- }
36
- }
37
- componentDidUpdate(prevProps) {
38
- if (didPropsChange(this.props, prevProps) && this.chart) {
39
- this.destroyChart();
40
- this.createAndRenderChart();
41
- }
42
- }
43
- getChartUrl() {
44
- return this.props.chartJsUrl.replace("{region}", this.props.region);
45
- }
46
- async createAndRenderChart() {
47
- const seatsio2 = await this.loadSeatsio();
48
- const config = this.extractConfigFromProps();
49
- config.container = this.container.current;
50
- this.chart = this.createChart(seatsio2, config).render();
51
- if (this.props.onRenderStarted) {
52
- this.props.onRenderStarted(this.chart);
53
- }
54
- }
55
- extractConfigFromProps() {
56
- let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props;
57
- return config;
58
- }
59
- componentWillUnmount() {
60
- this.destroyChart();
61
- }
62
- destroyChart() {
63
- if (this.chart && this.chart.state !== "DESTROYED") {
64
- this.chart.destroy();
65
- }
66
- }
67
- loadSeatsio() {
68
- const chartUrl = this.getChartUrl();
69
- if (!_Embeddable.seatsioBundles[chartUrl]) {
70
- _Embeddable.seatsioBundles[chartUrl] = new Promise((resolve, reject) => {
71
- const script = document.head.appendChild(document.createElement("script"));
72
- window.seatsio = void 0;
73
- script.onload = () => {
74
- resolve(seatsio);
75
- };
76
- script.onerror = () => reject(`Could not load ${script.src}`);
77
- script.src = chartUrl;
78
- });
79
- }
80
- return _Embeddable.seatsioBundles[chartUrl];
81
- }
82
- render() {
83
- return /* @__PURE__ */ React.createElement("div", { ref: this.container, style: { "height": "100%", "width": "100%" } });
84
- }
85
- };
86
- _Embeddable.seatsioBundles = {};
87
- _Embeddable.defaultProps = {
88
- chartJsUrl: "https://cdn-{region}.seatsio.net/chart.js"
89
- };
90
- var Embeddable = _Embeddable;
91
-
92
- // src/main/SeatsioDesigner.tsx
93
- var SeatsioDesigner = class extends Embeddable {
94
- createChart(seatsio2, config) {
95
- return new seatsio2.SeatingChartDesigner(config);
96
- }
97
- };
98
- export {
99
- SeatsioDesigner as default
100
- };
101
- //# sourceMappingURL=SeatsioDesigner.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/main/Embeddable.tsx","../src/main/util.ts","../src/main/SeatsioDesigner.tsx"],"sourcesContent":["import * as React from 'react'\nimport {didPropsChange} from './util'\nimport { ChartDesigner, CommonConfigOptions, EventManager, Region, SeatingChart, Seatsio } from '@seatsio/seatsio-types'\n\nexport type EmbeddableProps<T > = {\n onRenderStarted?: (chart: SeatingChart | EventManager) => void\n chartJsUrl?: string\n region: Region\n} & T\n\nexport default abstract class Embeddable<T extends CommonConfigOptions> extends React.Component<EmbeddableProps<T>> {\n private container: React.RefObject<HTMLDivElement>\n private chart: SeatingChart\n private firstRender: boolean\n\n private static seatsioBundles: { [key: string]: Promise<Seatsio> } = {}\n\n static defaultProps = {\n chartJsUrl: 'https://cdn-{region}.seatsio.net/chart.js'\n }\n\n constructor(props: EmbeddableProps<T>) {\n super(props);\n this.container = React.createRef()\n this.firstRender = true\n }\n\n abstract createChart (seatsio: Seatsio, config: T): SeatingChart | EventManager | ChartDesigner\n\n componentDidMount () {\n if (!Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {\n this.createAndRenderChart()\n this.firstRender = false\n }\n }\n\n componentDidUpdate (prevProps: EmbeddableProps<T>) {\n if (didPropsChange(this.props, prevProps) && this.chart) {\n this.destroyChart()\n this.createAndRenderChart()\n }\n }\n\n getChartUrl () {\n return this.props.chartJsUrl.replace('{region}', this.props.region)\n }\n\n async createAndRenderChart () {\n const seatsio = await this.loadSeatsio()\n const config = this.extractConfigFromProps()\n config.container = this.container.current\n this.chart = this.createChart(seatsio, config).render()\n if (this.props.onRenderStarted) {\n this.props.onRenderStarted(this.chart)\n }\n }\n\n extractConfigFromProps (): any {\n let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props\n return config\n }\n\n componentWillUnmount () {\n this.destroyChart()\n }\n\n destroyChart () {\n if (this.chart && (this.chart as any).state !== 'DESTROYED') {\n this.chart.destroy()\n }\n }\n\n loadSeatsio (): Promise<Seatsio> {\n const chartUrl = this.getChartUrl()\n if (!Embeddable.seatsioBundles[chartUrl]) {\n Embeddable.seatsioBundles[chartUrl] = new Promise<Seatsio>((resolve, reject) => {\n const script = document.head.appendChild(document.createElement('script'))\n // Seatsio global is not replaced if already present, which would cause the wrong region bundle to resolve when changing region\n window.seatsio = undefined\n script.onload = () => {\n resolve(seatsio)\n }\n script.onerror = () => reject(`Could not load ${script.src}`)\n script.src = chartUrl\n })\n }\n\n return Embeddable.seatsioBundles[chartUrl]\n }\n\n render (): React.ReactNode {\n return (\n <div ref={this.container as unknown as React.RefObject<HTMLDivElement>} style={{'height': '100%', 'width': '100%'}} />\n )\n }\n}","import {Booth, GeneralAdmissionArea, InteractiveSection, Seat, SelectableObject, Table} from \"@seatsio/seatsio-types\"\n\nexport const didPropsChange = <P extends { [key: string]: any}>(prevProps: P, nextProps: P): boolean => {\n if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {\n return true\n }\n return Object.keys(nextProps).some((propName: string) => {\n let prevValue = prevProps[propName]\n let nextValue = nextProps[propName]\n if (prevValue && nextValue) {\n if (typeof prevValue === 'function' && typeof nextValue === 'function') {\n return prevValue.toString() !== nextValue.toString()\n }\n if (typeof prevValue === 'object' && typeof nextValue === 'object') {\n return didPropsChange(prevValue, nextValue)\n }\n }\n return prevValue !== nextValue\n })\n}\n\nexport const isSeat = (obj: SelectableObject) => obj.objectType === 'Seat'\nexport const isTable = (obj: SelectableObject): obj is Table => obj.objectType === 'Table'\nexport const isSection = (obj: SelectableObject): obj is InteractiveSection => obj.objectType === 'section'\nexport const isBooth = (obj: SelectableObject): obj is Booth => obj.objectType === 'Booth'\nexport const isGeneralAdmission = (obj: SelectableObject): obj is GeneralAdmissionArea => obj.objectType === 'GeneralAdmissionArea'\n","import Embeddable from './Embeddable'\nimport { ChartDesignerConfigOptions, Seatsio } from '@seatsio/seatsio-types'\n\nexport default class SeatsioDesigner extends Embeddable<ChartDesignerConfigOptions> {\n createChart (seatsio: Seatsio, config: ChartDesignerConfigOptions) {\n return new seatsio.SeatingChartDesigner(config)\n }\n}"],"mappings":";AAAA,YAAY,W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import * as _seatsio_seatsio_types from '@seatsio/seatsio-types';
2
- import { EventManagerConfigOptions, Seatsio } from '@seatsio/seatsio-types';
3
- import Embeddable from './Embeddable.mjs';
4
- import 'react';
5
-
6
- declare class SeatsioEventManager extends Embeddable<EventManagerConfigOptions> {
7
- createChart(seatsio: Seatsio, config: EventManagerConfigOptions): _seatsio_seatsio_types.EventManager;
8
- }
9
-
10
- export { SeatsioEventManager as default };
@@ -1,10 +0,0 @@
1
- import * as _seatsio_seatsio_types from '@seatsio/seatsio-types';
2
- import { EventManagerConfigOptions, Seatsio } from '@seatsio/seatsio-types';
3
- import Embeddable from './Embeddable.js';
4
- import 'react';
5
-
6
- declare class SeatsioEventManager extends Embeddable<EventManagerConfigOptions> {
7
- createChart(seatsio: Seatsio, config: EventManagerConfigOptions): _seatsio_seatsio_types.EventManager;
8
- }
9
-
10
- export { SeatsioEventManager as default };
@@ -1,133 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/main/SeatsioEventManager.tsx
30
- var SeatsioEventManager_exports = {};
31
- __export(SeatsioEventManager_exports, {
32
- default: () => SeatsioEventManager
33
- });
34
- module.exports = __toCommonJS(SeatsioEventManager_exports);
35
-
36
- // src/main/Embeddable.tsx
37
- var React = __toESM(require("react"));
38
-
39
- // src/main/util.ts
40
- var didPropsChange = (prevProps, nextProps) => {
41
- if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {
42
- return true;
43
- }
44
- return Object.keys(nextProps).some((propName) => {
45
- let prevValue = prevProps[propName];
46
- let nextValue = nextProps[propName];
47
- if (prevValue && nextValue) {
48
- if (typeof prevValue === "function" && typeof nextValue === "function") {
49
- return prevValue.toString() !== nextValue.toString();
50
- }
51
- if (typeof prevValue === "object" && typeof nextValue === "object") {
52
- return didPropsChange(prevValue, nextValue);
53
- }
54
- }
55
- return prevValue !== nextValue;
56
- });
57
- };
58
-
59
- // src/main/Embeddable.tsx
60
- var _Embeddable = class _Embeddable extends React.Component {
61
- constructor(props) {
62
- super(props);
63
- this.container = React.createRef();
64
- this.firstRender = true;
65
- }
66
- componentDidMount() {
67
- if (!_Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {
68
- this.createAndRenderChart();
69
- this.firstRender = false;
70
- }
71
- }
72
- componentDidUpdate(prevProps) {
73
- if (didPropsChange(this.props, prevProps) && this.chart) {
74
- this.destroyChart();
75
- this.createAndRenderChart();
76
- }
77
- }
78
- getChartUrl() {
79
- return this.props.chartJsUrl.replace("{region}", this.props.region);
80
- }
81
- async createAndRenderChart() {
82
- const seatsio2 = await this.loadSeatsio();
83
- const config = this.extractConfigFromProps();
84
- config.container = this.container.current;
85
- this.chart = this.createChart(seatsio2, config).render();
86
- if (this.props.onRenderStarted) {
87
- this.props.onRenderStarted(this.chart);
88
- }
89
- }
90
- extractConfigFromProps() {
91
- let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props;
92
- return config;
93
- }
94
- componentWillUnmount() {
95
- this.destroyChart();
96
- }
97
- destroyChart() {
98
- if (this.chart && this.chart.state !== "DESTROYED") {
99
- this.chart.destroy();
100
- }
101
- }
102
- loadSeatsio() {
103
- const chartUrl = this.getChartUrl();
104
- if (!_Embeddable.seatsioBundles[chartUrl]) {
105
- _Embeddable.seatsioBundles[chartUrl] = new Promise((resolve, reject) => {
106
- const script = document.head.appendChild(document.createElement("script"));
107
- window.seatsio = void 0;
108
- script.onload = () => {
109
- resolve(seatsio);
110
- };
111
- script.onerror = () => reject(`Could not load ${script.src}`);
112
- script.src = chartUrl;
113
- });
114
- }
115
- return _Embeddable.seatsioBundles[chartUrl];
116
- }
117
- render() {
118
- return /* @__PURE__ */ React.createElement("div", { ref: this.container, style: { "height": "100%", "width": "100%" } });
119
- }
120
- };
121
- _Embeddable.seatsioBundles = {};
122
- _Embeddable.defaultProps = {
123
- chartJsUrl: "https://cdn-{region}.seatsio.net/chart.js"
124
- };
125
- var Embeddable = _Embeddable;
126
-
127
- // src/main/SeatsioEventManager.tsx
128
- var SeatsioEventManager = class extends Embeddable {
129
- createChart(seatsio2, config) {
130
- return new seatsio2.EventManager(config);
131
- }
132
- };
133
- //# sourceMappingURL=SeatsioEventManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/main/SeatsioEventManager.tsx","../src/main/Embeddable.tsx","../src/main/util.ts"],"sourcesContent":["import { EventManagerConfigOptions, Seatsio } from '@seatsio/seatsio-types'\nimport Embeddable from './Embeddable'\n\nexport default class SeatsioEventManager extends Embeddable<EventManagerConfigOptions> {\n createChart (seatsio: Seatsio, config: EventManagerConfigOptions) {\n return new seatsio.EventManager(config)\n }\n}","import * as React from 'react'\nimport {didPropsChange} from './util'\nimport { ChartDesigner, CommonConfigOptions, EventManager, Region, SeatingChart, Seatsio } from '@seatsio/seatsio-types'\n\nexport type EmbeddableProps<T > = {\n onRenderStarted?: (chart: SeatingChart | EventManager) => void\n chartJsUrl?: string\n region: Region\n} & T\n\nexport default abstract class Embeddable<T extends CommonConfigOptions> extends React.Component<EmbeddableProps<T>> {\n private container: React.RefObject<HTMLDivElement>\n private chart: SeatingChart\n private firstRender: boolean\n\n private static seatsioBundles: { [key: string]: Promise<Seatsio> } = {}\n\n static defaultProps = {\n chartJsUrl: 'https://cdn-{region}.seatsio.net/chart.js'\n }\n\n constructor(props: EmbeddableProps<T>) {\n super(props);\n this.container = React.createRef()\n this.firstRender = true\n }\n\n abstract createChart (seatsio: Seatsio, config: T): SeatingChart | EventManager | ChartDesigner\n\n componentDidMount () {\n if (!Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {\n this.createAndRenderChart()\n this.firstRender = false\n }\n }\n\n componentDidUpdate (prevProps: EmbeddableProps<T>) {\n if (didPropsChange(this.props, prevProps) && this.chart) {\n this.destroyChart()\n this.createAndRenderChart()\n }\n }\n\n getChartUrl () {\n return this.props.chartJsUrl.replace('{region}', this.props.region)\n }\n\n async createAndRenderChart () {\n const seatsio = await this.loadSeatsio()\n const config = this.extractConfigFromProps()\n config.container = this.container.current\n this.chart = this.createChart(seatsio, config).render()\n if (this.props.onRenderStarted) {\n this.props.onRenderStarted(this.chart)\n }\n }\n\n extractConfigFromProps (): any {\n let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props\n return config\n }\n\n componentWillUnmount () {\n this.destroyChart()\n }\n\n destroyChart () {\n if (this.chart && (this.chart as any).state !== 'DESTROYED') {\n this.chart.destroy()\n }\n }\n\n loadSeatsio (): Promise<Seatsio> {\n const chartUrl = this.getChartUrl()\n if (!Embeddable.seatsioBundles[chartUrl]) {\n Embeddable.seatsioBundles[chartUrl] = new Promise<Seatsio>((resolve, reject) => {\n const script = document.head.appendChild(document.createElement('script'))\n // Seatsio global is not replaced if already present, which would cause the wrong region bundle to resolve when changing region\n window.seatsio = undefined\n script.onload = () => {\n resolve(seatsio)\n }\n script.onerror = () => reject(`Could not load ${script.src}`)\n script.src = chartUrl\n })\n }\n\n return Embeddable.seatsioBundles[chartUrl]\n }\n\n render (): React.ReactNode {\n return (\n <div ref={this.container as unknown as React.RefObject<HTMLDivElement>} style={{'height': '100%', 'width': '100%'}} />\n )\n }\n}","import {Booth, GeneralAdmissionArea, InteractiveSection, Seat, SelectableObject, Table} from \"@seatsio/seatsio-types\"\n\nexport const didPropsChange = <P extends { [key: string]: any}>(prevProps: P, nextProps: P): boolean => {\n if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {\n return true\n }\n return Object.keys(nextProps).some((propName: string) => {\n let prevValue = prevProps[propName]\n let nextValue = nextProps[propName]\n if (prevValue && nextValue) {\n if (typeof prevValue === 'function' && typeof nextValue === 'function') {\n return prevValue.toString() !== nextValue.toString()\n }\n if (typeof prevValue === 'object' && typeof nextValue === 'object') {\n return didPropsChange(prevValue, nextValue)\n }\n }\n return prevValue !== nextValue\n })\n}\n\nexport const isSeat = (obj: SelectableObject) => obj.objectType === 'Seat'\nexport const isTable = (obj: SelectableObject): obj is Table => obj.objectType === 'Table'\nexport const isSection = (obj: SelectableObject): obj is InteractiveSection => obj.objectType === 'section'\nexport const isBooth = (obj: SelectableObject): obj is Booth => obj.objectType === 'Booth'\nexport const isGeneralAdmission = (obj: SelectableObject): obj is GeneralAdmissionArea => obj.objectType === 'GeneralAdmissionArea'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACEhB,IAAM,iBAAiB,CAAkC,WAAc,cAA0B;AACpG,MAAI,OAAO,KAAK,SAAS,EAAE,WAAW,OAAO,KAAK,SAAS,EAAE,QAAQ;AACjE,WAAO;AAAA,EACX;AACA,SAAO,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,aAAqB;AACrD,QAAI,YAAY,UAAU,QAAQ;AAClC,QAAI,YAAY,UAAU,QAAQ;AACl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;AAAA,EACtB;AAAA,EAEA,eAAgB;AACZ,QAAI,KAAK,SAAU,KAAK,MAAc,UAAU,aAAa;AACzD,WAAK,MAAM,QAAQ;AAAA,IACvB;AAAA,EACJ;AAAA,EAEA,cAAiC;AAC7B,UAAM,WAAW,KAAK,YAAY;AAClC,QAAI,CAAC,YAAW,eAAe,QAAQ,GAAG;AACtC,kBAAW,eAAe,QAAQ,IAAI,IAAI,QAAiB,CAAC,SAAS,WAAW;AAC5E,cAAM,SAAS,SAAS,KAAK,YAAY,SAAS,cAAc,QAAQ,CAAC;AAEzE,eAAO,UAAU;AACjB,eAAO,SAAS,MAAM;AAClB,kBAAQ,OAAO;AAAA,QACnB;AACA,eAAO,UAAU,MAAM,OAAO,kBAAkB,OAAO,GAAG,EAAE;AAC5D,eAAO,MAAM;AAAA,MACjB,CAAC;AAAA,IACL;AAEA,WAAO,YAAW,eAAe,QAAQ;AAAA,EAC7C;AAAA,EAEA,SAA2B;AACvB,WACI,oCAAC,SAAI,KAAK,KAAK,WAAyD,OAAO,EAAC,UAAU,QAAQ,SAAS,OAAM,GAAG;AAAA,EAE5H;AACJ;AArF8B,YAKX,iBAAsD,CAAC;AAL5C,YAOnB,eAAe;AAAA,EAClB,YAAY;AAChB;AATJ,IAA8B,aAA9B;;;ADPA,IAAqB,sBAArB,cAAiD,WAAsC;AAAA,EACnF,YAAaC,UAAkB,QAAmC;AAC9D,WAAO,IAAIA,SAAQ,aAAa,MAAM;AAAA,EAC1C;AACJ;","names":["seatsio","seatsio"]}
@@ -1,101 +0,0 @@
1
- // src/main/Embeddable.tsx
2
- import * as React from "react";
3
-
4
- // src/main/util.ts
5
- var didPropsChange = (prevProps, nextProps) => {
6
- if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {
7
- return true;
8
- }
9
- return Object.keys(nextProps).some((propName) => {
10
- let prevValue = prevProps[propName];
11
- let nextValue = nextProps[propName];
12
- if (prevValue && nextValue) {
13
- if (typeof prevValue === "function" && typeof nextValue === "function") {
14
- return prevValue.toString() !== nextValue.toString();
15
- }
16
- if (typeof prevValue === "object" && typeof nextValue === "object") {
17
- return didPropsChange(prevValue, nextValue);
18
- }
19
- }
20
- return prevValue !== nextValue;
21
- });
22
- };
23
-
24
- // src/main/Embeddable.tsx
25
- var _Embeddable = class _Embeddable extends React.Component {
26
- constructor(props) {
27
- super(props);
28
- this.container = React.createRef();
29
- this.firstRender = true;
30
- }
31
- componentDidMount() {
32
- if (!_Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {
33
- this.createAndRenderChart();
34
- this.firstRender = false;
35
- }
36
- }
37
- componentDidUpdate(prevProps) {
38
- if (didPropsChange(this.props, prevProps) && this.chart) {
39
- this.destroyChart();
40
- this.createAndRenderChart();
41
- }
42
- }
43
- getChartUrl() {
44
- return this.props.chartJsUrl.replace("{region}", this.props.region);
45
- }
46
- async createAndRenderChart() {
47
- const seatsio2 = await this.loadSeatsio();
48
- const config = this.extractConfigFromProps();
49
- config.container = this.container.current;
50
- this.chart = this.createChart(seatsio2, config).render();
51
- if (this.props.onRenderStarted) {
52
- this.props.onRenderStarted(this.chart);
53
- }
54
- }
55
- extractConfigFromProps() {
56
- let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props;
57
- return config;
58
- }
59
- componentWillUnmount() {
60
- this.destroyChart();
61
- }
62
- destroyChart() {
63
- if (this.chart && this.chart.state !== "DESTROYED") {
64
- this.chart.destroy();
65
- }
66
- }
67
- loadSeatsio() {
68
- const chartUrl = this.getChartUrl();
69
- if (!_Embeddable.seatsioBundles[chartUrl]) {
70
- _Embeddable.seatsioBundles[chartUrl] = new Promise((resolve, reject) => {
71
- const script = document.head.appendChild(document.createElement("script"));
72
- window.seatsio = void 0;
73
- script.onload = () => {
74
- resolve(seatsio);
75
- };
76
- script.onerror = () => reject(`Could not load ${script.src}`);
77
- script.src = chartUrl;
78
- });
79
- }
80
- return _Embeddable.seatsioBundles[chartUrl];
81
- }
82
- render() {
83
- return /* @__PURE__ */ React.createElement("div", { ref: this.container, style: { "height": "100%", "width": "100%" } });
84
- }
85
- };
86
- _Embeddable.seatsioBundles = {};
87
- _Embeddable.defaultProps = {
88
- chartJsUrl: "https://cdn-{region}.seatsio.net/chart.js"
89
- };
90
- var Embeddable = _Embeddable;
91
-
92
- // src/main/SeatsioEventManager.tsx
93
- var SeatsioEventManager = class extends Embeddable {
94
- createChart(seatsio2, config) {
95
- return new seatsio2.EventManager(config);
96
- }
97
- };
98
- export {
99
- SeatsioEventManager as default
100
- };
101
- //# sourceMappingURL=SeatsioEventManager.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/main/Embeddable.tsx","../src/main/util.ts","../src/main/SeatsioEventManager.tsx"],"sourcesContent":["import * as React from 'react'\nimport {didPropsChange} from './util'\nimport { ChartDesigner, CommonConfigOptions, EventManager, Region, SeatingChart, Seatsio } from '@seatsio/seatsio-types'\n\nexport type EmbeddableProps<T > = {\n onRenderStarted?: (chart: SeatingChart | EventManager) => void\n chartJsUrl?: string\n region: Region\n} & T\n\nexport default abstract class Embeddable<T extends CommonConfigOptions> extends React.Component<EmbeddableProps<T>> {\n private container: React.RefObject<HTMLDivElement>\n private chart: SeatingChart\n private firstRender: boolean\n\n private static seatsioBundles: { [key: string]: Promise<Seatsio> } = {}\n\n static defaultProps = {\n chartJsUrl: 'https://cdn-{region}.seatsio.net/chart.js'\n }\n\n constructor(props: EmbeddableProps<T>) {\n super(props);\n this.container = React.createRef()\n this.firstRender = true\n }\n\n abstract createChart (seatsio: Seatsio, config: T): SeatingChart | EventManager | ChartDesigner\n\n componentDidMount () {\n if (!Embeddable.seatsioBundles[this.getChartUrl()] || this.firstRender) {\n this.createAndRenderChart()\n this.firstRender = false\n }\n }\n\n componentDidUpdate (prevProps: EmbeddableProps<T>) {\n if (didPropsChange(this.props, prevProps) && this.chart) {\n this.destroyChart()\n this.createAndRenderChart()\n }\n }\n\n getChartUrl () {\n return this.props.chartJsUrl.replace('{region}', this.props.region)\n }\n\n async createAndRenderChart () {\n const seatsio = await this.loadSeatsio()\n const config = this.extractConfigFromProps()\n config.container = this.container.current\n this.chart = this.createChart(seatsio, config).render()\n if (this.props.onRenderStarted) {\n this.props.onRenderStarted(this.chart)\n }\n }\n\n extractConfigFromProps (): any {\n let { chartJsUrl, divId, onRenderStarted, region, ...config } = this.props\n return config\n }\n\n componentWillUnmount () {\n this.destroyChart()\n }\n\n destroyChart () {\n if (this.chart && (this.chart as any).state !== 'DESTROYED') {\n this.chart.destroy()\n }\n }\n\n loadSeatsio (): Promise<Seatsio> {\n const chartUrl = this.getChartUrl()\n if (!Embeddable.seatsioBundles[chartUrl]) {\n Embeddable.seatsioBundles[chartUrl] = new Promise<Seatsio>((resolve, reject) => {\n const script = document.head.appendChild(document.createElement('script'))\n // Seatsio global is not replaced if already present, which would cause the wrong region bundle to resolve when changing region\n window.seatsio = undefined\n script.onload = () => {\n resolve(seatsio)\n }\n script.onerror = () => reject(`Could not load ${script.src}`)\n script.src = chartUrl\n })\n }\n\n return Embeddable.seatsioBundles[chartUrl]\n }\n\n render (): React.ReactNode {\n return (\n <div ref={this.container as unknown as React.RefObject<HTMLDivElement>} style={{'height': '100%', 'width': '100%'}} />\n )\n }\n}","import {Booth, GeneralAdmissionArea, InteractiveSection, Seat, SelectableObject, Table} from \"@seatsio/seatsio-types\"\n\nexport const didPropsChange = <P extends { [key: string]: any}>(prevProps: P, nextProps: P): boolean => {\n if (Object.keys(prevProps).length !== Object.keys(nextProps).length) {\n return true\n }\n return Object.keys(nextProps).some((propName: string) => {\n let prevValue = prevProps[propName]\n let nextValue = nextProps[propName]\n if (prevValue && nextValue) {\n if (typeof prevValue === 'function' && typeof nextValue === 'function') {\n return prevValue.toString() !== nextValue.toString()\n }\n if (typeof prevValue === 'object' && typeof nextValue === 'object') {\n return didPropsChange(prevValue, nextValue)\n }\n }\n return prevValue !== nextValue\n })\n}\n\nexport const isSeat = (obj: SelectableObject) => obj.objectType === 'Seat'\nexport const isTable = (obj: SelectableObject): obj is Table => obj.objectType === 'Table'\nexport const isSection = (obj: SelectableObject): obj is InteractiveSection => obj.objectType === 'section'\nexport const isBooth = (obj: SelectableObject): obj is Booth => obj.objectType === 'Booth'\nexport const isGeneralAdmission = (obj: SelectableObject): obj is GeneralAdmissionArea => obj.objectType === 'GeneralAdmissionArea'\n","import { EventManagerConfigOptions, Seatsio } from '@seatsio/seatsio-types'\nimport Embeddable from './Embeddable'\n\nexport default class SeatsioEventManager extends Embeddable<EventManagerConfigOptions> {\n createChart (seatsio: Seatsio, config: EventManagerConfigOptions) {\n return new seatsio.EventManager(config)\n }\n}"],"mappings":";AAAA,YAAY,WAAW;;;ACEhB,IAAM,iBAAiB,CAAkC,WAAc,cAA0B;AACpG,MAAI,OAAO,KAAK,SAAS,EAAE,WAAW,OAAO,KAAK,SAAS,EAAE,QAAQ;AACjE,WAAO;AAAA,EACX;AACA,SAAO,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,aAAqB;AACrD,QAAI,YAAY,UAAU,QAAQ;AAClC,QAAI,YAAY,UAAU,QAAQ;AAClC,QAAI,aAAa,WAAW;AACxB,UAAI,OAAO,cAAc,cAAc,OAAO,cAAc,YAAY;AACpE,eAAO,UAAU,SAAS,MAAM,UAAU,SAAS;AAAA,MACvD;AACA,UAAI,OAAO,cAAc,YAAY,OAAO,cAAc,UAAU;AAChE,eAAO,eAAe,WAAW,SAAS;AAAA,MAC9C;AAAA,IACJ;AACA,WAAO,cAAc;AAAA,EACzB,CAAC;AACL;;;ADTA,IAA8B,cAA9B,MAA8B,oBAAwD,gBAA8B;AAAA,EAWhH,YAAY,OAA2B;AACnC,UAAM,KAAK;AACX,SAAK,YAAkB,gBAAU;AACjC,SAAK,cAAc;AAAA,EACvB;AAAA,EAIA,oBAAqB;AACjB,QAAI,CAAC,YAAW,eAAe,KAAK,YAAY,CAAC,KAAK,KAAK,aAAa;AACpE,WAAK,qBAAqB;AAC1B,WAAK,cAAc;AAAA,IACvB;AAAA,EACJ;AAAA,EAEA,mB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AA,EAEA,SAA2B;AACvB,WACI,oCAAC,SAAI,KAAK,KAAK,WAAyD,OAAO,EAAC,UAAU,QAAQ,SAAS,OAAM,GAAG;AAAA,EAE5H;AACJ;AArF8B,YAKX,iBAAsD,CAAC;AAL5C,YAOnB,eAAe;AAAA,EAClB,YAAY;AAChB;AATJ,IAA8B,aAA9B;;;AEPA,IAAqB,sBAArB,cAAiD,WAAsC;AAAA,EACnF,YAAaC,UAAkB,QAAmC;AAC9D,WAAO,IAAIA,SAAQ,aAAa,MAAM;AAAA,EAC1C;AACJ;","names":["seatsio","seatsio"]}
@@ -1,10 +0,0 @@
1
- import * as _seatsio_seatsio_types from '@seatsio/seatsio-types';
2
- import { ChartRendererConfigOptions, Seatsio } from '@seatsio/seatsio-types';
3
- import Embeddable from './Embeddable.mjs';
4
- import 'react';
5
-
6
- declare class SeatsioSeatingChart extends Embeddable<ChartRendererConfigOptions> {
7
- createChart(seatsio: Seatsio, config: ChartRendererConfigOptions): _seatsio_seatsio_types.SeatingChart;
8
- }
9
-
10
- export { SeatsioSeatingChart as default };
@@ -1,10 +0,0 @@
1
- import * as _seatsio_seatsio_types from '@seatsio/seatsio-types';
2
- import { ChartRendererConfigOptions, Seatsio } from '@seatsio/seatsio-types';
3
- import Embeddable from './Embeddable.js';
4
- import 'react';
5
-
6
- declare class SeatsioSeatingChart extends Embeddable<ChartRendererConfigOptions> {
7
- createChart(seatsio: Seatsio, config: ChartRendererConfigOptions): _seatsio_seatsio_types.SeatingChart;
8
- }
9
-
10
- export { SeatsioSeatingChart as default };