@seatsio/seatsio-vue 1.1.0 → 3.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 seats.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Vue wrapper for rendering [Seats.io](https://www.seats.io) seating charts. Brought to you by the Seats.io team.
4
4
 
5
+ # Recommended tools
6
+
7
+ This package uses TypeScript. In order to get the best possible developer experience, you may need some Vue plugins for your IDE. If you use Visual Studio Code, we recommend the following plugins (direct extension links):
8
+ - [Vue Language Features (Volar)](vscode:extension/Vue.volar)
9
+ - [TypeScript Vue Plugin](vscode:extension/Vue.vscode-typescript-vue-plugin)
10
+
11
+ If you use a different IDE, there may be similar plugins available.
12
+
5
13
  # Installation
6
14
 
7
15
  ```
@@ -9,7 +17,7 @@ Npm
9
17
  npm install --save @seatsio/seatsio-vue
10
18
 
11
19
  Yarn
12
- yarn add -dev @seatsio/seatsio-vue
20
+ yarn add @seatsio/seatsio-vue
13
21
  ```
14
22
 
15
23
  # Usage
@@ -18,7 +26,7 @@ yarn add -dev @seatsio/seatsio-vue
18
26
 
19
27
  ### Minimal example to render a seating chart:
20
28
 
21
- ```jsx
29
+ ```vue
22
30
  import { SeatsioSeatingChart } from '@seatsio/seatsio-vue';
23
31
 
24
32
  <div style="height: 500px">
@@ -32,13 +40,32 @@ import { SeatsioSeatingChart } from '@seatsio/seatsio-vue';
32
40
 
33
41
  The chart uses 100 % of the width and height of the DOM element (e.g. a div) in which you render it. Play with the size of that element to change the chart size.
34
42
 
43
+ ### Pricing
44
+
45
+ ```vue
46
+ import { SeatsioSeatingChart } from '@seatsio/seatsio-vue';
47
+
48
+ <div style="height: 500px">
49
+ <SeatsioSeatingChart
50
+ workspaceKey="<yourPublicWorkspaceKey>"
51
+ event="<yourEventKey>"
52
+ region="eu"
53
+ :pricing="[
54
+ {'category': 1, 'price': 30},
55
+ {'category': 2, 'price': 40},
56
+ {'category': 3, 'price': 50}
57
+ ]"
58
+ />
59
+ </div>
60
+ ```
61
+
35
62
  ## Reacting to events
36
63
 
37
64
  ### onRenderStarted()
38
65
 
39
66
  `onRenderStarted` is fired when the chart has started loading, but hasn't rendered yet. If you store the chart object that's passed to the `onRenderStarted` callback, you can access the properties defined on the wrapped `seatsio.SeatingChart`:
40
67
 
41
- ```jsx
68
+ ```vue
42
69
  // Single File Component (SFC) using SeatsioSeatingChart
43
70
  export default {
44
71
  ...
@@ -48,19 +75,19 @@ export default {
48
75
  }
49
76
  },
50
77
  methods: {
51
- onRenderStarted: function (chart) {
78
+ onRenderStarted: (chart) => {
52
79
  this.chart = chart
53
80
  console.log(chart.selectedObjects)
54
81
  }
55
82
  }
56
83
  }
57
84
 
85
+ // Notice how the event handler is defined with @&lt;eventListener&gt;
86
+ // For more information, see https://vuejs.org/guide/essentials/event-handling.html
58
87
  <SeatsioSeatingChart
59
88
  workspaceKey="<yourPublicWorkspaceKey>"
60
89
  event="<yourEventKey>"
61
- // Notice how the event handler is defined with @<eventListener>
62
- // For more information, see https://vuejs.org/guide/essentials/event-handling.html
63
- @onRenderStarted="onRenderStarted"
90
+ @renderStarted="onRenderStarted"
64
91
  region="eu"
65
92
  />
66
93
  ```
@@ -69,7 +96,7 @@ export default {
69
96
 
70
97
  `onChartRendered` is fired when the chart is rendered successfully:
71
98
 
72
- ```jsx
99
+ ```vue
73
100
  export default {
74
101
  ...
75
102
  data() {
@@ -88,7 +115,7 @@ export default {
88
115
  <SeatsioSeatingChart
89
116
  workspaceKey="<yourPublicWorkspaceKey>"
90
117
  event="<yourEventKey>"
91
- @onChartRendered="onChartRendered"
118
+ @chartRendered="onChartRendered"
92
119
  region="eu"
93
120
  />
94
121
  ```
@@ -96,14 +123,13 @@ export default {
96
123
 
97
124
  Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/renderer/embed-a-floor-plan
98
125
 
99
-
100
126
  Example: Passing in a custom object color:
101
- ```jsx
127
+ ```vue
102
128
  export default {
103
129
  ...
104
130
  data() {
105
131
  // Supports CSS color values
106
- objectColor: () => 'grey',
132
+ objectColor: () => 'grey'
107
133
  },
108
134
  }
109
135
 
@@ -119,7 +145,7 @@ Whenever one of the properties passed on to `<SeatsioSeatingChart />` changes, t
119
145
 
120
146
  ## Event manager
121
147
 
122
- ```jsx
148
+ ```vue
123
149
  import { SeatsioEventManager } from '@seatsio/seatsio-vue';
124
150
 
125
151
  <div style="height: 500px">
@@ -134,40 +160,25 @@ import { SeatsioEventManager } from '@seatsio/seatsio-vue';
134
160
 
135
161
  Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/event-manager/configuring
136
162
 
137
- ## Chart manager
138
-
139
- ```jsx
140
- import { SeatsioChartManager } from '@seatsio/seatsio-vue';
141
-
142
- <div style="height: 500px">
143
- <SeatsioChartManager
144
- secretKey="<yourWorkspaceSecretKey>"
145
- chart="<yourChartKey>"
146
- mode="<manageRulesets or another mode>"
147
- region="eu"
148
- />
149
- </div>
150
- ```
151
- Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/chart-manager/configuring/
152
-
153
163
  ## Seating Chart Designer
154
164
 
155
165
  To embed the seating chart designer for the purpose of creating a new chart, do this:
156
166
 
157
- ```jsx
167
+ ```vue
158
168
  import { SeatsioDesigner } from '@seatsio/seatsio-vue';
159
169
 
160
170
  <div style="height: 500px">
161
171
  <SeatsioDesigner
162
172
  secretKey="<yourWorkspaceSecretKey>"
163
173
  region="eu"
174
+ @chartCreated="onChartCreated"
164
175
  />
165
176
  </div>
166
177
  ```
167
178
 
168
179
  To be able to edit a chart from an embedded designer, you need to specify the chart to load:
169
180
 
170
- ```jsx
181
+ ```vue
171
182
  <SeatsioDesigner
172
183
  secretKey="<yourWorkspaceSecretKey>"
173
184
  chartKey="<yourChartKey>"
@@ -175,4 +186,4 @@ To be able to edit a chart from an embedded designer, you need to specify the ch
175
186
  />
176
187
  ```
177
188
 
178
- Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/embedded-designer/introduction
189
+ Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/embedded-designer/introduction
@@ -0,0 +1,4 @@
1
+ export { default as SeatsioDesigner } from './lib-components/seatsioDesigner.vue';
2
+ export { default as SeatsioEventManager } from './lib-components/seatsioEventManager.vue';
3
+ export { default as SeatsioSeatingChart } from './lib-components/seatsioSeatingChart.vue';
4
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import type { SeatsioChartDesignerProps } from '../types';
2
+ declare const _default: import("vue").DefineComponent<SeatsioChartDesignerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<SeatsioChartDesignerProps>, {}, {}>;
3
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import type { Region } from '@seatsio/seatsio-types';
2
+ import { PropType } from 'vue';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ chartJsUrl: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ id: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ region: {
13
+ type: PropType<Region>;
14
+ required: true;
15
+ };
16
+ }, unknown, unknown, {}, {
17
+ createAndRenderChart: () => Promise<void>;
18
+ propsAndAttrs: () => {};
19
+ getSeatsio: () => Promise<unknown>;
20
+ loadSeatsio: () => Promise<unknown>;
21
+ destroyChart: () => void;
22
+ getRegion: () => Region;
23
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
+ chartJsUrl: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ id: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ region: {
33
+ type: PropType<Region>;
34
+ required: true;
35
+ };
36
+ }>>, {
37
+ chartJsUrl: string;
38
+ id: string;
39
+ }, {}>;
40
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { SeatsioEventManagerProps } from '../types';
2
+ declare const _default: import("vue").DefineComponent<SeatsioEventManagerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<SeatsioEventManagerProps>, {
3
+ themeColors?: any;
4
+ }, {}>;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { SeatsioSeatingChartProps } from '../types';
2
+ declare const _default: import("vue").DefineComponent<SeatsioSeatingChartProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<SeatsioSeatingChartProps>, {
3
+ themeColors?: any;
4
+ }, {}>;
5
+ export default _default;
@@ -1,6 +1,6 @@
1
- import { openBlock, createElementBlock } from 'vue';
1
+ import { defineComponent, openBlock, createElementBlock } from 'vue';
2
2
 
3
- var script$4 = {
3
+ var script$3 = defineComponent({
4
4
  mounted() {
5
5
  this.createAndRenderChart();
6
6
  },
@@ -12,61 +12,52 @@ var script$4 = {
12
12
  type: String,
13
13
  default: 'https://cdn-{region}.seatsio.net/chart.js'
14
14
  },
15
- event: String,
16
15
  id: {
17
16
  type: String,
18
17
  default: 'chart'
19
18
  },
20
- extraConfig: Object,
21
- fitTo: String,
22
- language: String,
23
- messages: Object,
24
- mode: String,
25
- objectColor: Function,
26
- objectTooltip: Object,
27
- workspaceKey: {
28
- type: String,
29
- required: true
30
- },
31
19
  region: {
32
20
  type: String,
33
- default: 'eu'
34
- },
35
- showFullscreenButton: Boolean,
36
- tooltipInfo: Function,
37
- chartKey: String,
38
- secretKey: String
21
+ required: true
22
+ }
39
23
  },
40
24
  methods: {
41
25
  createAndRenderChart: async function () {
26
+ if (!this.$props.region) {
27
+ return;
28
+ }
42
29
  const seatsio = await this.getSeatsio();
43
- const callbacks = {
44
- onChartRendered: chart => this.$emit('onChartRendered', chart),
45
- onChartRenderingFailed: chart => this.$emit('onChartRenderingFailed', chart),
46
- onChartRerenderingStarted: chart => this.$emit('onChartRerenderingStarted', chart),
47
- onObjectSelected: selectedObject => this.$emit('onObjectSelected', selectedObject),
48
- onObjectDeselected: deselectedObject => this.$emit('onObjectDeselected', deselectedObject),
49
- onObjectClicked: clickedObject => this.$emit('onObjectClicked', clickedObject),
50
- onFullScreenOpened: () => this.$emit('onFullScreenOpened'),
51
- onFullScreenClosed: () => this.$emit('onFullScreenClosed'),
52
- onSubmitSucceeded: () => this.$emit('onSubmitSucceeded'),
53
- onSubmitFailed: () => this.$emit('onSubmitFailed')
54
- };
55
30
  const config = {
56
31
  divId: this.$props.id,
57
- ...this.finaliseProps(this.$props),
58
- ...callbacks
32
+ ...this.propsAndAttrs()
59
33
  };
34
+ // @ts-ignore
60
35
  this.chart = this.createChart(seatsio, config).render();
61
- this.chart && this.$emit('onRenderStarted', this.chart);
36
+ if (this.$attrs.onRenderStarted) {
37
+ // @ts-ignore
38
+ this.$attrs.onRenderStarted(this.chart);
39
+ }
62
40
  },
63
- finaliseProps: function (props) {
64
- return props;
41
+ propsAndAttrs: function () {
42
+ let allPropsAndAttrs = {
43
+ ...this.$props,
44
+ ...this.$attrs
45
+ };
46
+ // @ts-ignore
47
+ let {
48
+ id,
49
+ onRenderStarted,
50
+ chartJsUrl,
51
+ region,
52
+ ...filteredPropsAndAttrs
53
+ } = allPropsAndAttrs;
54
+ return filteredPropsAndAttrs;
65
55
  },
66
56
  getSeatsio: async function () {
67
57
  if (typeof window.seatsio === 'undefined') {
68
58
  return this.loadSeatsio();
69
- } else if (window.seatsio.region !== this.region) {
59
+ } else if (seatsio.region !== this.getRegion()) {
60
+ // @ts-ignore
70
61
  window.seatsio = undefined;
71
62
  return this.loadSeatsio();
72
63
  } else {
@@ -77,74 +68,48 @@ var script$4 = {
77
68
  return new Promise((resolve, reject) => {
78
69
  let script = document.createElement('script');
79
70
  script.onload = () => {
80
- window.seatsio.region = this.region;
71
+ seatsio.region = this.getRegion();
81
72
  resolve(window.seatsio);
82
73
  };
83
74
  script.onerror = () => reject(`Could not load ${script.src}`);
84
- script.src = this.chartJsUrl.replace('{region}', this.region);
75
+ script.src = this.chartJsUrl.replace('{region}', this.getRegion());
85
76
  document.head.appendChild(script);
86
77
  });
87
78
  },
88
79
  destroyChart: function () {
80
+ // @ts-ignore
89
81
  this.chart.destroy();
90
- }
91
- }
92
- };
93
-
94
- var script$3 = {
95
- mixins: [script$4],
96
- name: 'SeatsioChartManager',
97
- methods: {
98
- finaliseProps: function (props) {
99
- const {
100
- chartKey,
101
- chartJsUrl,
102
- id,
103
- region,
104
- showFullscreenButton,
105
- ...finalProps
106
- } = props;
107
- return {
108
- chart: chartKey,
109
- ...finalProps
110
- };
111
82
  },
112
- createChart: (seatsio, config) => {
113
- return new seatsio.ChartManager(config);
83
+ getRegion: function () {
84
+ return this.$props.region;
114
85
  }
115
86
  }
116
- };
87
+ });
117
88
 
118
- const _hoisted_1$3 = ["id"];
119
- function render$3(_ctx, _cache, $props, $setup, $data, $options) {
120
- return openBlock(), createElementBlock("div", {
121
- id: _ctx.id
122
- }, null, 8, _hoisted_1$3);
123
- }
89
+ script$3.__file = "src/lib-components/seatsioEmbeddable.vue";
124
90
 
125
- script$3.render = render$3;
126
-
127
- var script$2 = {
128
- mixins: [script$4],
91
+ var script$2 = defineComponent({
92
+ extends: script$3,
129
93
  name: 'SeatsioDesigner',
130
94
  methods: {
131
95
  createChart: function (seatsio, config) {
132
96
  return new seatsio.SeatingChartDesigner(config);
133
97
  }
134
98
  }
135
- };
99
+ });
136
100
 
137
101
  const _hoisted_1$2 = ["id"];
138
102
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
139
103
  return openBlock(), createElementBlock("div", {
140
104
  id: _ctx.id
141
- }, null, 8, _hoisted_1$2);
105
+ }, null, 8 /* PROPS */, _hoisted_1$2);
142
106
  }
143
107
 
144
108
  script$2.render = render$2;
109
+ script$2.__file = "src/lib-components/seatsioDesigner.vue";
145
110
 
146
- var script$1 = {
147
- mixins: [script$4],
111
+ var script$1 = defineComponent({
112
+ extends: script$3,
148
113
  name: 'SeatsioEventManager',
149
114
  methods: {
150
115
  finaliseProps: function (props) {
@@ -152,12 +117,10 @@ var script$1 = {
152
117
  chartJsUrl,
153
118
  id,
154
119
  region,
155
- showFullscreenButton,
156
- chartKey,
120
+ showFullScreenButton,
157
121
  ...finalProps
158
122
  } = props;
159
123
  return {
160
- chart: chartKey,
161
124
  ...finalProps
162
125
  };
163
126
  },
@@ -165,51 +128,39 @@ var script$1 = {
165
128
  return new seatsio.EventManager(config);
166
129
  }
167
130
  }
168
- };
131
+ });
169
132
 
170
133
  const _hoisted_1$1 = ["id"];
171
134
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
172
135
  return openBlock(), createElementBlock("div", {
173
136
  id: _ctx.id
174
- }, null, 8, _hoisted_1$1);
137
+ }, null, 8 /* PROPS */, _hoisted_1$1);
175
138
  }
176
139
 
177
140
  script$1.render = render$1;
141
+ script$1.__file = "src/lib-components/seatsioEventManager.vue";
178
142
 
179
- var script = {
180
- mixins: [script$4],
143
+ var script = defineComponent({
144
+ extends: script$3,
145
+ components: {
146
+ SeatsioEmbeddable: script$3
147
+ },
181
148
  name: 'SeatsioSeatingChart',
182
149
  methods: {
183
150
  createChart: function (seatsio, config) {
184
151
  return new seatsio.SeatingChart(config);
185
152
  }
186
153
  }
187
- };
154
+ });
188
155
 
189
156
  const _hoisted_1 = ["id"];
190
157
  function render(_ctx, _cache, $props, $setup, $data, $options) {
191
158
  return openBlock(), createElementBlock("div", {
192
159
  id: _ctx.id
193
- }, null, 8, _hoisted_1);
160
+ }, null, 8 /* PROPS */, _hoisted_1);
194
161
  }
195
162
 
196
163
  script.render = render;
164
+ script.__file = "src/lib-components/seatsioSeatingChart.vue";
197
165
 
198
- const components = {
199
- SeatsioChartManager: script$3,
200
- SeatsioDesigner: script$2,
201
- SeatsioEventManager: script$1,
202
- SeatsioSeatingChart: script
203
- };
204
- var entry = {
205
- install(app, _options) {
206
- for (const prop in components) {
207
- if (components.hasOwnProperty(prop)) {
208
- const component = components[prop];
209
- app.component(component.name, component);
210
- }
211
- }
212
- }
213
- };
214
-
215
- export { script$3 as SeatsioChartManager, script$2 as SeatsioDesigner, script$1 as SeatsioEventManager, script as SeatsioSeatingChart, entry as default };
166
+ export { script$2 as SeatsioDesigner, script$1 as SeatsioEventManager, script as SeatsioSeatingChart };
@@ -0,0 +1,13 @@
1
+ import type { ChartDesigner, ChartDesignerConfigOptions, ChartRendererConfigOptions, EventManager, EventManagerConfigOptions, Region, SeatingChart } from '@seatsio/seatsio-types';
2
+ export type * from '@seatsio/seatsio-types';
3
+ export type SeatsioConfig = ChartRendererConfigOptions | EventManagerConfigOptions | ChartDesignerConfigOptions;
4
+ export interface SeatsioEmbeddableProps {
5
+ chartJsUrl?: string;
6
+ id?: string;
7
+ region: Region;
8
+ onRenderStarted?: (chart: SeatsioChartInstance) => void;
9
+ }
10
+ export type SeatsioChartInstance = SeatingChart | EventManager | ChartDesigner;
11
+ export type SeatsioSeatingChartProps = SeatsioEmbeddableProps & ChartRendererConfigOptions;
12
+ export type SeatsioEventManagerProps = SeatsioEmbeddableProps & EventManagerConfigOptions;
13
+ export type SeatsioChartDesignerProps = SeatsioEmbeddableProps & ChartDesignerConfigOptions;
package/package.json CHANGED
@@ -1,33 +1,42 @@
1
1
  {
2
2
  "name": "@seatsio/seatsio-vue",
3
- "version": "1.1.0",
4
- "license": "MIT",
5
- "main": "dist/seatsio-vue.js",
6
- "sideEffects": false,
3
+ "version": "3.0.0",
7
4
  "scripts": {
8
- "serve": "vue-cli-service serve dev/serve.js",
9
- "prebuild": "rimraf ./dist",
10
- "build": "cross-env NODE_ENV=production rollup --config build/rollup.config.js"
5
+ "serve": "vue-cli-service serve dev/serve.ts",
6
+ "build": "cross-env NODE_ENV=production && rollup --config build/rollup.config.js --format es",
7
+ "prebuild": "rimraf ./dist"
8
+ },
9
+ "module": "dist/seatsio-vue.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": ["dist"],
12
+ "dependencies": {
13
+ "@seatsio/seatsio-types": "^2.0.0"
11
14
  },
12
15
  "devDependencies": {
13
- "@babel/core": "^7.21.3",
14
- "@babel/preset-env": "^7.14.7",
15
- "@rollup/plugin-alias": "^4.0.3",
16
+ "@babel/core": "^7.23.2",
17
+ "@babel/preset-env": "^7.22.20",
18
+ "@rollup/plugin-alias": "^5.0.1",
16
19
  "@rollup/plugin-babel": "^6.0.3",
17
- "@rollup/plugin-commonjs": "^24.0.1",
18
- "@rollup/plugin-node-resolve": "^15.0.1",
19
- "@rollup/plugin-replace": "^2.4.2",
20
+ "@rollup/plugin-commonjs": "^25.0.7",
21
+ "@rollup/plugin-node-resolve": "^15.2.3",
22
+ "@rollup/plugin-replace": "^5.0.5",
20
23
  "@vue/cli-plugin-babel": "^5.0.8",
24
+ "@vue/cli-plugin-typescript": "~5.0.0",
21
25
  "@vue/cli-service": "^5.0.8",
26
+ "@vue/tsconfig": "^0.4.0",
22
27
  "cross-env": "^7.0.3",
23
- "minimist": "^1.2.5",
24
- "rimraf": "^3.0.2",
28
+ "minimist": "^1.2.8",
29
+ "rimraf": "^5.0.5",
25
30
  "rollup": "^2.52.8",
26
31
  "rollup-plugin-terser": "^7.0.2",
32
+ "rollup-plugin-typescript2": "^0.36.0",
27
33
  "rollup-plugin-vue": "^6.0.0",
28
- "vue": "3.2.47"
34
+ "typescript": "~5.0.0",
35
+ "vue": "3.3.4"
29
36
  },
30
37
  "peerDependencies": {
31
38
  "vue": "^3.2.47"
32
- }
39
+ },
40
+ "license": "MIT",
41
+ "sideEffects": false
33
42
  }
package/.browserslistrc DELETED
@@ -1,3 +0,0 @@
1
- current node
2
- last 2 versions and > 2%
3
- ie > 10
@@ -1,11 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "npm"
9
- directory: "/"
10
- schedule:
11
- interval: "monthly"
@@ -1,21 +0,0 @@
1
- name: 'Build'
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- build:
11
-
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v3
16
- - uses: actions/setup-node@v3
17
- with:
18
- node-version: 16
19
- registry-url: https://registry.npmjs.org/
20
- - run: yarn install
21
- - run: yarn build
@@ -1,44 +0,0 @@
1
- # Very important!
2
- # Make sure that the github token has read AND WRITE access on github.
3
- # 1. hit https://github.com/seatsio/[REPO]/settings/actions
4
- # 2. under "Workflow permissions", make sure "Read and write permissions" is checked instead of the (default?) read only.
5
- #
6
-
7
- name: Release
8
- run-name: Release ${{ github.repository }}
9
- on:
10
- workflow_dispatch:
11
- inputs:
12
- versionToBump:
13
- description: 'The version to bump. Major for incompatible API changes, minor for adding BC features'
14
- required: true
15
- type: choice
16
- options:
17
- - minor
18
- - major
19
- jobs:
20
- release:
21
- runs-on: ubuntu-latest
22
- steps:
23
- - uses: actions/checkout@v3
24
- - uses: fregante/setup-git-user@v2
25
- - id: install-zx
26
- run: npm i -g zx
27
- - id: install-semver-tool
28
- run: |
29
- wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
30
- chmod +x /usr/local/bin/semver
31
- - run: zx ./release.mjs -v $VERSION_TO_BUMP
32
- env:
33
- VERSION_TO_BUMP: ${{ inputs.versionToBump }}
34
- GH_TOKEN: ${{ github.token }}
35
- - uses: actions/setup-node@v1
36
- with:
37
- node-version: 16
38
- registry-url: https://registry.npmjs.org/
39
- - run: yarn install
40
- - run: yarn build
41
- - run: yarn publish
42
- env:
43
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
44
-
package/babel.config.js DELETED
@@ -1,16 +0,0 @@
1
- const devPresets = ['@vue/babel-preset-app'];
2
- const buildPresets = [
3
- [
4
- '@babel/preset-env',
5
- // Config for @babel/preset-env
6
- {
7
- // Example: Always transpile optional chaining/nullish coalescing
8
- // include: [
9
- // /(optional-chaining|nullish-coalescing)/
10
- // ],
11
- },
12
- ],
13
- ];
14
- module.exports = {
15
- presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets),
16
- };
@@ -1,143 +0,0 @@
1
- // rollup.config.js
2
- import fs from 'fs';
3
- import path from 'path';
4
- import vue from 'rollup-plugin-vue';
5
- import alias from '@rollup/plugin-alias';
6
- import commonjs from '@rollup/plugin-commonjs';
7
- import resolve from '@rollup/plugin-node-resolve';
8
- import replace from '@rollup/plugin-replace';
9
- import babel from '@rollup/plugin-babel';
10
- import { terser } from 'rollup-plugin-terser';
11
- import minimist from 'minimist';
12
-
13
- // Get browserslist config and remove ie from es build targets
14
- const esbrowserslist = fs.readFileSync('./.browserslistrc')
15
- .toString()
16
- .split('\n')
17
- .filter((entry) => entry && entry.substring(0, 2) !== 'ie');
18
-
19
- // Extract babel preset-env config, to combine with esbrowserslist
20
- const babelPresetEnvConfig = require('../babel.config')
21
- .presets.filter((entry) => entry[0] === '@babel/preset-env')[0][1];
22
-
23
- const argv = minimist(process.argv.slice(2));
24
-
25
- const projectRoot = path.resolve(__dirname, '..');
26
-
27
- const baseConfig = {
28
- input: 'src/entry.js',
29
- plugins: {
30
- preVue: [
31
- alias({
32
- entries: [
33
- {
34
- find: '@',
35
- replacement: `${path.resolve(projectRoot, 'src')}`,
36
- },
37
- ],
38
- }),
39
- ],
40
- replace: {
41
- 'process.env.NODE_ENV': JSON.stringify('production'),
42
- preventAssignment: true
43
- },
44
- vue: {
45
- css: true,
46
- template: {
47
- isProduction: true,
48
- },
49
- },
50
- postVue: [
51
- resolve({
52
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
53
- }),
54
- commonjs(),
55
- ],
56
- babel: {
57
- exclude: 'node_modules/**',
58
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'],
59
- babelHelpers: 'bundled',
60
- },
61
- },
62
- };
63
-
64
- // ESM/UMD/IIFE shared settings: externals
65
- // Refer to https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
66
- const external = [
67
- // list external dependencies, exactly the way it is written in the import statement.
68
- // eg. 'jquery'
69
- 'vue',
70
- ];
71
-
72
- // UMD/IIFE shared settings: output.globals
73
- // Refer to https://rollupjs.org/guide/en#output-globals for details
74
- const globals = {
75
- // Provide global variable names to replace your external imports
76
- // eg. jquery: '$'
77
- vue: 'Vue',
78
- };
79
-
80
- // Customize configs for individual targets
81
- const buildFormats = [];
82
- if (!argv.format || argv.format === 'es') {
83
- const esConfig = {
84
- ...baseConfig,
85
- input: 'src/entry.js',
86
- external,
87
- output: {
88
- file: 'dist/seatsio-vue.js',
89
- format: 'esm',
90
- exports: 'named',
91
- },
92
- plugins: [
93
- replace(baseConfig.plugins.replace),
94
- ...baseConfig.plugins.preVue,
95
- vue(baseConfig.plugins.vue),
96
- ...baseConfig.plugins.postVue,
97
- babel({
98
- ...baseConfig.plugins.babel,
99
- presets: [
100
- [
101
- '@babel/preset-env',
102
- {
103
- ...babelPresetEnvConfig,
104
- targets: esbrowserslist,
105
- },
106
- ],
107
- ],
108
- }),
109
- ],
110
- };
111
- buildFormats.push(esConfig);
112
- }
113
-
114
- if (!argv.format || argv.format === 'iife') {
115
- const unpkgConfig = {
116
- ...baseConfig,
117
- external,
118
- output: {
119
- compact: true,
120
- file: 'dist/seatsio-vue.min.js',
121
- format: 'iife',
122
- name: 'SeatsioVue',
123
- exports: 'named',
124
- globals,
125
- },
126
- plugins: [
127
- replace(baseConfig.plugins.replace),
128
- ...baseConfig.plugins.preVue,
129
- vue(baseConfig.plugins.vue),
130
- ...baseConfig.plugins.postVue,
131
- babel(baseConfig.plugins.babel),
132
- terser({
133
- output: {
134
- ecma: 5,
135
- },
136
- }),
137
- ],
138
- };
139
- buildFormats.push(unpkgConfig);
140
- }
141
-
142
- // Export config
143
- export default buildFormats;
@@ -1,31 +0,0 @@
1
- <script>
2
- export default {
3
- name: 'ComponentSelector',
4
- methods: {
5
- onClick: function(selection) {
6
- this.$emit('selectChartType', selection)
7
- }
8
- }
9
- }
10
- </script>
11
-
12
- <template>
13
- <ul id="menu">
14
- <li><button @click="onClick('seatingChart')">Seating Chart</button></li>
15
- <li><button @click="onClick('chartDesigner')">Designer</button></li>
16
- <li><button @click="onClick('chartManager')">ChartManager</button></li>
17
- <li><button @click="onClick('eventManager')">EventManager</button></li>
18
- </ul>
19
- </template>
20
-
21
- <style scoped>
22
- #menu {
23
- list-style-type: none;
24
- display: inline;
25
- }
26
-
27
- #menu > li {
28
- display: inline;
29
- margin-right: 4px;
30
- }
31
- </style>
package/dev/serve.js DELETED
@@ -1,4 +0,0 @@
1
- import { createApp } from 'vue';
2
- import ServeDev from './serve.vue'
3
-
4
- createApp(ServeDev).mount('#app')
package/dev/serve.vue DELETED
@@ -1,87 +0,0 @@
1
- <script>
2
- import ComponentSelector from './componentSelector.vue'
3
- import SeatsioSeatingChart from '@/lib-components/seatsioSeatingChart.vue'
4
- import SeatsioChartManager from '@/lib-components/seatsioChartManager.vue'
5
- import SeatsioDesigner from '@/lib-components/seatsioDesigner.vue'
6
- import SeatsioEventManager from '@/lib-components/seatsioEventManager.vue'
7
-
8
- export default {
9
- name: 'ServeDev',
10
- components: {
11
- ComponentSelector,
12
- SeatsioSeatingChart,
13
- SeatsioChartManager,
14
- SeatsioDesigner,
15
- SeatsioEventManager,
16
- SeatsioSeatingChart,
17
- },
18
- data: () => ({
19
- messages: { clickToSelect: 'Click to pick'},
20
- objectColor: () => 'grey',
21
- tooltipInfo: () => 'My custom info',
22
- selectedComponent: 'seatingChart',
23
- }),
24
- methods: {
25
- onRenderStarted: chart => console.log('Render started', chart),
26
- onObjectClicked: clickedObject => console.log('Object clicked', clickedObject),
27
- },
28
- }
29
- </script>
30
-
31
- <template>
32
- <ComponentSelector @selectChartType="component => selectedComponent = component" />
33
- <SeatsioSeatingChart
34
- v-if="selectedComponent === 'seatingChart'"
35
- id="myChart"
36
- workspaceKey="publicDemoKey"
37
- event="smallTheatreEvent"
38
- region="eu"
39
- :messages="messages"
40
- :objectColor="objectColor"
41
- :tooltipInfo="tooltipInfo"
42
- @onRenderStarted="onRenderStarted"
43
- @onObjectClicked="onObjectClicked"
44
- />
45
- <SeatsioDesigner
46
- v-if="selectedComponent === 'chartDesigner'"
47
- event="437fd038-ba0c-42aa-9ba9-e06bd5b790a3"
48
- id="myChartDesigner"
49
- workspaceKey="publicDemoKey"
50
- mode="readOnly"
51
- :messages="messages"
52
- :tooltipInfo="tooltipInfo"
53
- @onRenderStarted="onRenderStarted"
54
- @onObjectClicked="onObjectClicked"
55
- chartKey="0bcf8295-0063-486b-85fe-77b8d85008b5"
56
- />
57
- <SeatsioChartManager
58
- v-if="selectedComponent === 'chartManager'"
59
- id="myChartManager"
60
- mode="manageRulesets"
61
- :messages="messages"
62
- :tooltipInfo="tooltipInfo"
63
- @onRenderStarted="onRenderStarted"
64
- @onObjectClicked="onObjectClicked"
65
- workspaceKey="<yourWorkspaceKey>"
66
- chartKey="<yourChartKey>"
67
- secretKey="<yourWorkspaceSecretKey>"
68
- />
69
- <SeatsioEventManager
70
- v-if="selectedComponent === 'eventManager'"
71
- id="myEventManager"
72
- mode="manageCategories"
73
- :messages="messages"
74
- :tooltipInfo="tooltipInfo"
75
- @onRenderStarted="onRenderStarted"
76
- @onObjectClicked="onObjectClicked"
77
- event="<yourEventKey"
78
- secretKey="<yourWorkspaceSecretKey>"
79
- workspaceKey="<yourWorkspaceKey>"
80
- />
81
- </template>
82
-
83
- <style scoped>
84
- #myChart, #myChartDesigner, #myChartManager, #myEventManager {
85
- height: 100vh
86
- }
87
- </style>
package/release.mjs DELETED
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env zx
2
-
3
- /*
4
- * Script to release the seats.io java lib.
5
- * - changes the version number in README.md
6
- * - changes the version number in build.gradle
7
- * - creates the release in Gihub (using gh cli)
8
- *
9
- *
10
- * Prerequisites:
11
- * - zx installed (https://github.com/google/zx)
12
- * - gh cli installed (https://cli.github.com/)
13
- * - semver cli installed (https://github.com/fsaintjacques/semver-tool)
14
- *
15
- * Usage:
16
- * zx ./release.mjs -v major/minor -n "release notes"
17
- * */
18
-
19
- // don't output the commands themselves
20
- $.verbose = false
21
-
22
- const versionToBump = getVersionToBump()
23
- const latestVersion = await fetchLatestReleasedVersionNumber()
24
- const nextVersion = await determineNextVersionNumber(latestVersion)
25
-
26
- await pullLastVersion()
27
- .then(bumpVersionInFiles)
28
- .then(commitAndPush)
29
- .then(release)
30
-
31
- function getVersionToBump() {
32
- if (!argv.v || !(argv.v === 'minor' || argv.v === 'major')) {
33
- throw new Error ("Please specify -v major/minor")
34
- }
35
- return argv.v
36
- }
37
-
38
- function removeLeadingV(tagName) {
39
- if (tagName.startsWith('v')) {
40
- return tagName.substring(1)
41
- }
42
- return tagName
43
- }
44
-
45
- async function fetchLatestReleasedVersionNumber() {
46
- let result = await $`gh release view --json tagName`
47
- let tagName = JSON.parse(result).tagName
48
- return removeLeadingV(tagName)
49
- }
50
-
51
- async function determineNextVersionNumber(previous) {
52
- return (await $`semver bump ${versionToBump} ${previous}`).stdout.trim()
53
- }
54
-
55
- async function bumpVersionInFiles() {
56
- await replaceInFile("package.json", `"version": "${latestVersion}",`, `"version": "${nextVersion}",`)
57
- }
58
-
59
- async function replaceInFile(filename, latestVersion, nextVersion) {
60
- return await fs.readFile(filename, 'utf8')
61
- .then(text => {
62
- if (text.indexOf(latestVersion) < 0) {
63
- throw new Error('Not the correct version. Could not find ' + latestVersion + ' in ' + filename)
64
- }
65
- return text
66
- })
67
- .then(text => text.replace(latestVersion, nextVersion))
68
- .then(text => fs.writeFileSync(filename, text))
69
- .then(() => gitAdd(filename))
70
- }
71
-
72
- async function pullLastVersion() {
73
- await $`git checkout master`
74
- await $`git pull origin master`
75
- }
76
-
77
- async function gitAdd(filename) {
78
- return await $`git add ${filename}`
79
- }
80
-
81
- async function commitAndPush() {
82
- await $`git commit -m "version bump"`
83
- await $`git push origin master`
84
- }
85
-
86
- async function release() {
87
- const newTag = 'v' + nextVersion
88
- return await $`gh release create ${newTag} --generate-notes`.catch(error => {
89
- console.error('something went wrong while creating the release. Please revert the version change!')
90
- throw error
91
- })
92
- }
package/src/entry.js DELETED
@@ -1,26 +0,0 @@
1
- import {
2
- SeatsioChartManager,
3
- SeatsioDesigner,
4
- SeatsioEventManager,
5
- SeatsioSeatingChart
6
- } from './lib-components';
7
-
8
- const components = {
9
- SeatsioChartManager,
10
- SeatsioDesigner,
11
- SeatsioEventManager,
12
- SeatsioSeatingChart
13
- }
14
-
15
- export default {
16
- install (app, _options) {
17
- for (const prop in components) {
18
- if (components.hasOwnProperty(prop)) {
19
- const component = components[prop]
20
- app.component(component.name, component)
21
- }
22
- }
23
- }
24
- }
25
-
26
- export { SeatsioChartManager, SeatsioDesigner, SeatsioEventManager, SeatsioSeatingChart }
@@ -1,5 +0,0 @@
1
- /* eslint-disable import/prefer-default-export */
2
- export { default as SeatsioChartManager } from './seatsioChartManager.vue';
3
- export { default as SeatsioDesigner } from './seatsioDesigner.vue';
4
- export { default as SeatsioEventManager } from './seatsioEventManager.vue';
5
- export { default as SeatsioSeatingChart } from './seatsioSeatingChart.vue';
@@ -1,21 +0,0 @@
1
- <script>
2
- import SeatsioEmbeddable from './seatsioEmbeddable.vue'
3
-
4
- export default {
5
- mixins: [SeatsioEmbeddable],
6
- name: 'SeatsioChartManager',
7
- methods: {
8
- finaliseProps: function (props) {
9
- const { chartKey, chartJsUrl, id, region, showFullscreenButton, ...finalProps } = props
10
- return { chart: chartKey, ...finalProps }
11
- },
12
- createChart: (seatsio, config) => {
13
- return new seatsio.ChartManager(config)
14
- }
15
- }
16
- }
17
- </script>
18
-
19
- <template>
20
- <div :id="id"></div>
21
- </template>
@@ -1,17 +0,0 @@
1
- <script>
2
- import SeatsioEmbeddable from './seatsioEmbeddable.vue'
3
-
4
- export default {
5
- mixins: [SeatsioEmbeddable],
6
- name: 'SeatsioDesigner',
7
- methods: {
8
- createChart: function (seatsio, config) {
9
- return new seatsio.SeatingChartDesigner(config)
10
- }
11
- }
12
- }
13
- </script>
14
-
15
- <template>
16
- <div :id="id"></div>
17
- </template>
@@ -1,77 +0,0 @@
1
- <script>
2
- export default {
3
- mounted() {
4
- this.createAndRenderChart()
5
- },
6
- beforeUnmount() {
7
- this.destroyChart()
8
- },
9
- props: {
10
- chartJsUrl: {type: String, default: 'https://cdn-{region}.seatsio.net/chart.js'},
11
- event: String,
12
- id: {type: String, default: 'chart'},
13
- extraConfig: Object,
14
- fitTo: String,
15
- language: String,
16
- messages: Object,
17
- mode: String,
18
- objectColor: Function,
19
- objectTooltip: Object,
20
- workspaceKey: {type: String, required: true},
21
- region: {type: String, default: 'eu'},
22
- showFullscreenButton: Boolean,
23
- tooltipInfo: Function,
24
- chartKey: String,
25
- secretKey: String
26
- },
27
- methods: {
28
- createAndRenderChart: async function () {
29
- const seatsio = await this.getSeatsio()
30
- const callbacks = {
31
- onChartRendered: chart => this.$emit('onChartRendered', chart),
32
- onChartRenderingFailed: chart => this.$emit('onChartRenderingFailed', chart),
33
- onChartRerenderingStarted: chart => this.$emit('onChartRerenderingStarted', chart),
34
- onObjectSelected: selectedObject => this.$emit('onObjectSelected', selectedObject),
35
- onObjectDeselected: deselectedObject => this.$emit('onObjectDeselected', deselectedObject),
36
- onObjectClicked: clickedObject => this.$emit('onObjectClicked', clickedObject),
37
- onFullScreenOpened: () => this.$emit('onFullScreenOpened'),
38
- onFullScreenClosed: () => this.$emit('onFullScreenClosed'),
39
- onSubmitSucceeded: () => this.$emit('onSubmitSucceeded'),
40
- onSubmitFailed: () => this.$emit('onSubmitFailed'),
41
- }
42
-
43
- const config = {divId: this.$props.id, ...this.finaliseProps(this.$props), ...callbacks}
44
- this.chart = this.createChart(seatsio, config).render()
45
- this.chart && this.$emit('onRenderStarted', this.chart)
46
- },
47
- finaliseProps: function (props) {
48
- return props
49
- },
50
- getSeatsio: async function () {
51
- if (typeof window.seatsio === 'undefined') {
52
- return this.loadSeatsio()
53
- } else if (window.seatsio.region !== this.region) {
54
- window.seatsio = undefined
55
- return this.loadSeatsio()
56
- } else {
57
- return Promise.resolve(seatsio)
58
- }
59
- },
60
- loadSeatsio: async function () {
61
- return new Promise((resolve, reject) => {
62
- let script = document.createElement('script')
63
- script.onload = () => {
64
- window.seatsio.region = this.region
65
- resolve(window.seatsio)
66
- }
67
- script.onerror = () => reject(`Could not load ${script.src}`)
68
- script.src = this.chartJsUrl.replace('{region}', this.region)
69
- document.head.appendChild(script)
70
- })
71
- },
72
- destroyChart: function () {
73
- this.chart.destroy()
74
- }
75
- }
76
- }
77
- </script>
@@ -1,21 +0,0 @@
1
- <script>
2
- import SeatsioEmbeddable from './seatsioEmbeddable.vue'
3
-
4
- export default {
5
- mixins: [SeatsioEmbeddable],
6
- name: 'SeatsioEventManager',
7
- methods: {
8
- finaliseProps: function (props) {
9
- const { chartJsUrl, id, region, showFullscreenButton, chartKey, ...finalProps } = props
10
- return { chart: chartKey, ...finalProps }
11
- },
12
- createChart: (seatsio, config) => {
13
- return new seatsio.EventManager(config)
14
- }
15
- }
16
- }
17
- </script>
18
-
19
- <template>
20
- <div :id="id"></div>
21
- </template>
@@ -1,17 +0,0 @@
1
- <script>
2
- import SeatsioEmbeddable from './seatsioEmbeddable.vue'
3
-
4
- export default {
5
- mixins: [SeatsioEmbeddable],
6
- name: 'SeatsioSeatingChart',
7
- methods: {
8
- createChart: function (seatsio, config) {
9
- return new seatsio.SeatingChart(config)
10
- }
11
- }
12
- }
13
- </script>
14
-
15
- <template>
16
- <div :id="id"></div>
17
- </template>