@seatsio/seatsio-vue 2.0.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
  ```
@@ -152,22 +160,6 @@ import { SeatsioEventManager } from '@seatsio/seatsio-vue';
152
160
 
153
161
  Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/event-manager/configuring
154
162
 
155
- ## Chart manager
156
-
157
- ```vue
158
- import { SeatsioChartManager } from '@seatsio/seatsio-vue';
159
-
160
- <div style="height: 500px">
161
- <SeatsioChartManager
162
- secretKey="<yourWorkspaceSecretKey>"
163
- chart="<yourChartKey>"
164
- mode="<manageRulesets or another mode>"
165
- region="eu"
166
- />
167
- </div>
168
- ```
169
- Other parameters are supported as well. For a full list, check https://docs.seats.io/docs/chart-manager/configuring/
170
-
171
163
  ## Seating Chart Designer
172
164
 
173
165
  To embed the seating chart designer for the purpose of creating a new chart, do this:
@@ -179,6 +171,7 @@ import { SeatsioDesigner } from '@seatsio/seatsio-vue';
179
171
  <SeatsioDesigner
180
172
  secretKey="<yourWorkspaceSecretKey>"
181
173
  region="eu"
174
+ @chartCreated="onChartCreated"
182
175
  />
183
176
  </div>
184
177
  ```
@@ -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
  },
@@ -31,8 +31,10 @@ var script$4 = {
31
31
  divId: this.$props.id,
32
32
  ...this.propsAndAttrs()
33
33
  };
34
+ // @ts-ignore
34
35
  this.chart = this.createChart(seatsio, config).render();
35
36
  if (this.$attrs.onRenderStarted) {
37
+ // @ts-ignore
36
38
  this.$attrs.onRenderStarted(this.chart);
37
39
  }
38
40
  },
@@ -41,6 +43,7 @@ var script$4 = {
41
43
  ...this.$props,
42
44
  ...this.$attrs
43
45
  };
46
+ // @ts-ignore
44
47
  let {
45
48
  id,
46
49
  onRenderStarted,
@@ -53,7 +56,8 @@ var script$4 = {
53
56
  getSeatsio: async function () {
54
57
  if (typeof window.seatsio === 'undefined') {
55
58
  return this.loadSeatsio();
56
- } else if (window.seatsio.region !== this.getRegion()) {
59
+ } else if (seatsio.region !== this.getRegion()) {
60
+ // @ts-ignore
57
61
  window.seatsio = undefined;
58
62
  return this.loadSeatsio();
59
63
  } else {
@@ -64,7 +68,7 @@ var script$4 = {
64
68
  return new Promise((resolve, reject) => {
65
69
  let script = document.createElement('script');
66
70
  script.onload = () => {
67
- window.seatsio.region = this.getRegion();
71
+ seatsio.region = this.getRegion();
68
72
  resolve(window.seatsio);
69
73
  };
70
74
  script.onerror = () => reject(`Could not load ${script.src}`);
@@ -73,68 +77,39 @@ var script$4 = {
73
77
  });
74
78
  },
75
79
  destroyChart: function () {
80
+ // @ts-ignore
76
81
  this.chart.destroy();
77
82
  },
78
83
  getRegion: function () {
79
84
  return this.$props.region;
80
85
  }
81
86
  }
82
- };
87
+ });
83
88
 
84
- var script$3 = {
85
- mixins: [script$4],
86
- name: 'SeatsioChartManager',
87
- methods: {
88
- finaliseProps: function (props) {
89
- const {
90
- chartKey,
91
- chartJsUrl,
92
- id,
93
- region,
94
- showFullscreenButton,
95
- ...finalProps
96
- } = props;
97
- return {
98
- chart: chartKey,
99
- ...finalProps
100
- };
101
- },
102
- createChart: (seatsio, config) => {
103
- return new seatsio.ChartManager(config);
104
- }
105
- }
106
- };
107
-
108
- const _hoisted_1$3 = ["id"];
109
- function render$3(_ctx, _cache, $props, $setup, $data, $options) {
110
- return openBlock(), createElementBlock("div", {
111
- id: _ctx.id
112
- }, null, 8, _hoisted_1$3);
113
- }
89
+ script$3.__file = "src/lib-components/seatsioEmbeddable.vue";
114
90
 
115
- script$3.render = render$3;
116
-
117
- var script$2 = {
118
- mixins: [script$4],
91
+ var script$2 = defineComponent({
92
+ extends: script$3,
119
93
  name: 'SeatsioDesigner',
120
94
  methods: {
121
95
  createChart: function (seatsio, config) {
122
96
  return new seatsio.SeatingChartDesigner(config);
123
97
  }
124
98
  }
125
- };
99
+ });
126
100
 
127
101
  const _hoisted_1$2 = ["id"];
128
102
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
129
103
  return openBlock(), createElementBlock("div", {
130
104
  id: _ctx.id
131
- }, null, 8, _hoisted_1$2);
105
+ }, null, 8 /* PROPS */, _hoisted_1$2);
132
106
  }
133
107
 
134
108
  script$2.render = render$2;
109
+ script$2.__file = "src/lib-components/seatsioDesigner.vue";
135
110
 
136
- var script$1 = {
137
- mixins: [script$4],
111
+ var script$1 = defineComponent({
112
+ extends: script$3,
138
113
  name: 'SeatsioEventManager',
139
114
  methods: {
140
115
  finaliseProps: function (props) {
@@ -142,12 +117,10 @@ var script$1 = {
142
117
  chartJsUrl,
143
118
  id,
144
119
  region,
145
- showFullscreenButton,
146
- chartKey,
120
+ showFullScreenButton,
147
121
  ...finalProps
148
122
  } = props;
149
123
  return {
150
- chart: chartKey,
151
124
  ...finalProps
152
125
  };
153
126
  },
@@ -155,51 +128,39 @@ var script$1 = {
155
128
  return new seatsio.EventManager(config);
156
129
  }
157
130
  }
158
- };
131
+ });
159
132
 
160
133
  const _hoisted_1$1 = ["id"];
161
134
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
162
135
  return openBlock(), createElementBlock("div", {
163
136
  id: _ctx.id
164
- }, null, 8, _hoisted_1$1);
137
+ }, null, 8 /* PROPS */, _hoisted_1$1);
165
138
  }
166
139
 
167
140
  script$1.render = render$1;
141
+ script$1.__file = "src/lib-components/seatsioEventManager.vue";
168
142
 
169
- var script = {
170
- mixins: [script$4],
143
+ var script = defineComponent({
144
+ extends: script$3,
145
+ components: {
146
+ SeatsioEmbeddable: script$3
147
+ },
171
148
  name: 'SeatsioSeatingChart',
172
149
  methods: {
173
150
  createChart: function (seatsio, config) {
174
151
  return new seatsio.SeatingChart(config);
175
152
  }
176
153
  }
177
- };
154
+ });
178
155
 
179
156
  const _hoisted_1 = ["id"];
180
157
  function render(_ctx, _cache, $props, $setup, $data, $options) {
181
158
  return openBlock(), createElementBlock("div", {
182
159
  id: _ctx.id
183
- }, null, 8, _hoisted_1);
160
+ }, null, 8 /* PROPS */, _hoisted_1);
184
161
  }
185
162
 
186
163
  script.render = render;
164
+ script.__file = "src/lib-components/seatsioSeatingChart.vue";
187
165
 
188
- const components = {
189
- SeatsioChartManager: script$3,
190
- SeatsioDesigner: script$2,
191
- SeatsioEventManager: script$1,
192
- SeatsioSeatingChart: script
193
- };
194
- var entry = {
195
- install(app, _options) {
196
- for (const prop in components) {
197
- if (components.hasOwnProperty(prop)) {
198
- const component = components[prop];
199
- app.component(component.name, component);
200
- }
201
- }
202
- }
203
- };
204
-
205
- 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": "2.0.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.5",
14
- "@babel/preset-env": "^7.21.5",
15
- "@rollup/plugin-alias": "^5.0.0",
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.1.0",
18
- "@rollup/plugin-node-resolve": "^15.0.2",
19
- "@rollup/plugin-replace": "^5.0.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
28
  "minimist": "^1.2.8",
24
- "rimraf": "^4.4.1",
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,103 +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
- },
17
- data: () => ({
18
- messages: {
19
- clickToSelect: 'Click to pick',
20
- STAGE: 'stage-translated'
21
- },
22
- selectedComponent: 'seatingChart',
23
- objectColor: () => 'purple',
24
- tooltipInfo: () => 'My custom info',
25
- chartJsUrl: 'https://cdn-staging-eu.seatsio.net/chart.js'
26
- }),
27
- methods: {
28
- onRenderStarted: chart => console.log('Render started', chart),
29
- onObjectClicked: clickedObject => console.log('Object clicked', clickedObject),
30
- priceFormatter: price => '$' + price
31
- }
32
- }
33
- </script>
34
-
35
- <template>
36
- <ComponentSelector @selectChartType="component => selectedComponent = component" />
37
- <SeatsioSeatingChart
38
- v-if="selectedComponent === 'seatingChart'"
39
- id="myChart"
40
- workspaceKey="publicDemoKey"
41
- event="smallTheatreEvent"
42
- region="eu"
43
- language="en"
44
- :chartJsUrl="chartJsUrl"
45
- :messages="messages"
46
- :objectColor="objectColor"
47
- :tooltipInfo="tooltipInfo"
48
- :priceFormatter="priceFormatter"
49
- @renderStarted="onRenderStarted"
50
- @objectClicked="onObjectClicked"
51
- :pricing="[
52
- { category: 1, price: 30 },
53
- { category: 2, price: 40 },
54
- { category: 3, price: 50 }
55
- ]"
56
- />
57
- <SeatsioDesigner
58
- v-if="selectedComponent === 'chartDesigner'"
59
- region="eu"
60
- id="myChartDesigner"
61
- workspaceKey="publicDemoKey"
62
- mode="readOnly"
63
- :chartJsUrl="chartJsUrl"
64
- :show-fullscreen-button="true"
65
- :messages="messages"
66
- :tooltipInfo="tooltipInfo"
67
- @renderStarted="onRenderStarted"
68
- @objectClicked="onObjectClicked"
69
- chartKey="0bcf8295-0063-486b-85fe-77b8d85008b5"
70
- />
71
- <SeatsioChartManager
72
- v-if="selectedComponent === 'chartManager'"
73
- region="eu"
74
- id="myChartManager"
75
- mode="manageRulesets"
76
- :chartJsUrl="chartJsUrl"
77
- :messages="messages"
78
- :tooltipInfo="tooltipInfo"
79
- @renderStarted="onRenderStarted"
80
- @objectClicked="onObjectClicked"
81
- chart="0bcf8295-0063-486b-85fe-77b8d85008b5"
82
- secretKey="demoKey"
83
- />
84
- <SeatsioEventManager
85
- v-if="selectedComponent === 'eventManager'"
86
- region="eu"
87
- id="myEventManager"
88
- mode="manageCategories"
89
- :chartJsUrl="chartJsUrl"
90
- :messages="messages"
91
- :tooltipInfo="tooltipInfo"
92
- @renderStarted="onRenderStarted"
93
- @objectClicked="onObjectClicked"
94
- event="smallTheatreEvent"
95
- secretKey="demoKey"
96
- />
97
- </template>
98
-
99
- <style scoped>
100
- #myChart, #myChartDesigner, #myChartManager, #myEventManager {
101
- height: 100vh
102
- }
103
- </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,66 +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
- id: {type: String, default: 'chart'},
12
- region: {type: String, required: true}
13
- },
14
- methods: {
15
- createAndRenderChart: async function () {
16
- if(!this.$props.region) {
17
- return
18
- }
19
-
20
- const seatsio = await this.getSeatsio()
21
-
22
- const config = {
23
- divId: this.$props.id,
24
- ...this.propsAndAttrs()
25
- }
26
- this.chart = this.createChart(seatsio, config).render()
27
- if(this.$attrs.onRenderStarted) {
28
- this.$attrs.onRenderStarted(this.chart)
29
- }
30
- },
31
- propsAndAttrs: function () {
32
- let allPropsAndAttrs = {...this.$props, ...this.$attrs};
33
- let { id, onRenderStarted, chartJsUrl, region, ...filteredPropsAndAttrs } = allPropsAndAttrs
34
- return filteredPropsAndAttrs
35
- },
36
- getSeatsio: async function () {
37
- if (typeof window.seatsio === 'undefined') {
38
- return this.loadSeatsio()
39
- } else if (window.seatsio.region !== this.getRegion()) {
40
- window.seatsio = undefined
41
- return this.loadSeatsio()
42
- } else {
43
- return Promise.resolve(seatsio)
44
- }
45
- },
46
- loadSeatsio: async function () {
47
- return new Promise((resolve, reject) => {
48
- let script = document.createElement('script')
49
- script.onload = () => {
50
- window.seatsio.region = this.getRegion()
51
- resolve(window.seatsio)
52
- }
53
- script.onerror = () => reject(`Could not load ${script.src}`)
54
- script.src = this.chartJsUrl.replace('{region}', this.getRegion())
55
- document.head.appendChild(script)
56
- })
57
- },
58
- destroyChart: function () {
59
- this.chart.destroy()
60
- },
61
- getRegion: function () {
62
- return this.$props.region
63
- }
64
- }
65
- }
66
- </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>