seatsio 67.4.0 → 67.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seatsio",
3
- "version": "67.4.0",
3
+ "version": "67.7.0",
4
4
  "main": "index.js",
5
5
  "description": "Official JavaScript and Node.JS client library for the Seats.io REST API",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  "url": "https://github.com/seatsio/seatsio-js"
15
15
  },
16
16
  "dependencies": {
17
- "axios": "0.25.0"
17
+ "axios": "0.26.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "browserify": "latest",
@@ -30,8 +30,8 @@
30
30
  "gulp-tap": "latest",
31
31
  "gulp-uglify": "latest",
32
32
  "gulp-uglify-es": "latest",
33
- "jest": "27.4.7",
34
- "jest-cli": "27.4.7",
33
+ "jest": "27.5.1",
34
+ "jest-cli": "27.5.1",
35
35
  "uuid": "8.3.2"
36
36
  }
37
37
  }
@@ -21,6 +21,7 @@ class Event {
21
21
  this.isPartialSeason = event.isPartialSeason
22
22
  this.isEventInSeason = event.isEventInSeason
23
23
  this.objectCategories = event.objectCategories
24
+ this.categories = event.categories
24
25
  }
25
26
 
26
27
  isSeason () {
@@ -14,6 +14,7 @@ class StatusChange {
14
14
  this.holdToken = statusChange.holdToken ? statusChange.holdToken : null
15
15
  this.origin = statusChange.origin
16
16
  this.isPresentOnChart = statusChange.isPresentOnChart
17
+ this.notPresentOnChartReason = statusChange.notPresentOnChartReason
17
18
  this.displayedLabel = statusChange.displayedLabel ? statusChange.displayedLabel : null
18
19
  }
19
20
  }
@@ -1,4 +1,5 @@
1
1
  const Season = require('./Season')
2
+ const EventDeserializer = require('../Events/EventDeserializer')
2
3
 
3
4
  class Seasons {
4
5
  /**
@@ -84,7 +85,7 @@ class Seasons {
84
85
  }
85
86
 
86
87
  return this.client.post(`/seasons/${encodeURIComponent(key)}/actions/create-events`, requestParameters)
87
- .then((res) => new Season(res.data))
88
+ .then((res) => res.data.events.map(e => new EventDeserializer().fromJson(e)))
88
89
  }
89
90
 
90
91
  /**
@@ -94,6 +94,11 @@ test('summaryByCategoryKey', async () => {
94
94
  seat: 16
95
95
  }
96
96
  },
97
+ 'string11': {
98
+ count: 0,
99
+ bySection: {},
100
+ byObjectType: {}
101
+ },
97
102
  NO_CATEGORY: {
98
103
  count: 0,
99
104
  bySection: {},
@@ -126,6 +131,11 @@ test('summaryByCategoryLabel', async () => {
126
131
  seat: 16
127
132
  }
128
133
  },
134
+ Cat3: {
135
+ count: 0,
136
+ bySection: {},
137
+ byObjectType: {}
138
+ },
129
139
  NO_CATEGORY: {
130
140
  count: 0,
131
141
  bySection: {},
@@ -128,6 +128,16 @@ test('summaryByCategoryKey', async () => {
128
128
  seat: 16
129
129
  }
130
130
  },
131
+ 'string11': {
132
+ count: 0,
133
+ bySection: {},
134
+ bySelectability: {},
135
+ byAvailability: {},
136
+ byAvailabilityReason: { },
137
+ byStatus: {},
138
+ byChannel: {},
139
+ byObjectType: {}
140
+ },
131
141
  NO_CATEGORY: {
132
142
  count: 0,
133
143
  bySection: {},
@@ -177,6 +187,16 @@ test('summaryByCategoryLabel', async () => {
177
187
  seat: 16
178
188
  }
179
189
  },
190
+ Cat3: {
191
+ count: 0,
192
+ bySection: {},
193
+ bySelectability: {},
194
+ byAvailability: {},
195
+ byAvailabilityReason: { },
196
+ byStatus: {},
197
+ byChannel: {},
198
+ byObjectType: {}
199
+ },
180
200
  NO_CATEGORY: {
181
201
  count: 0,
182
202
  bySection: {},
@@ -2,6 +2,7 @@ const testUtils = require('../testUtils.js')
2
2
  const ObjectProperties = require('../../src/Events/ObjectProperties.js')
3
3
  const EventObjectInfo = require('../../src/Events/EventObjectInfo.js')
4
4
  const StatusChangesParams = require('../../src/Events/StatusChangesParams.js')
5
+ const {TableBookingconfig} = require("../../index");
5
6
 
6
7
  test('should list all status changes', async () => {
7
8
  const { client, user } = await testUtils.createTestUserAndClient()
@@ -176,6 +177,23 @@ test('properties of status changes', async () => {
176
177
  expect(statusChange.value.origin.type).toBe('API_CALL')
177
178
  expect(statusChange.value.displayedLabel).toBe('A-1')
178
179
  expect(statusChange.value.isPresentOnChart).toBe(true)
180
+ expect(statusChange.value.notPresentOnChartReason).toBe(undefined)
181
+ })
182
+
183
+ test('not present on chart anymore', async () => {
184
+ const { client, user } = await testUtils.createTestUserAndClient()
185
+ const chartKey = testUtils.getChartKey()
186
+ await testUtils.createTestChartWithTables(chartKey, user.secretKey)
187
+ const event = await client.events.create(chartKey, null, TableBookingconfig.allByTable())
188
+ await client.events.book(event.key, 'T1')
189
+ await client.events.update(event.key, null, null, TableBookingconfig.allBySeat())
190
+
191
+ const statusChanges = client.events.statusChanges(event.key).all()
192
+ const statusChangesIterator = statusChanges[Symbol.asyncIterator]()
193
+ const statusChange = await statusChangesIterator.next()
194
+
195
+ expect(statusChange.value.isPresentOnChart).toBe(false)
196
+ expect(statusChange.value.notPresentOnChartReason).toBe('SWITCHED_TO_BOOK_BY_SEAT')
179
197
  })
180
198
 
181
199
  test('should list status changes with hold token', async () => {
@@ -21,6 +21,7 @@ test('should retrieve event', async () => {
21
21
  expect(retrievedEvent.forSaleConfig).toBeFalsy()
22
22
  expect(retrievedEvent.updatedOn).toBeNull()
23
23
  expect(retrievedEvent.topLevelSeasonKey).toBe(undefined)
24
+ expect(retrievedEvent.categories.length).toBe(3)
24
25
  })
25
26
 
26
27
  test('retrieve season', async () => {
@@ -15,6 +15,12 @@
15
15
  "color": "#5E42ED",
16
16
  "accessible": false,
17
17
  "key": 10
18
+ },
19
+ {
20
+ "label": "Cat3",
21
+ "color": "#5E42BB",
22
+ "accessible": false,
23
+ "key": "string11"
18
24
  }
19
25
  ],
20
26
  "maxCategoryKey": 10
@@ -5,9 +5,9 @@ test('create events in season by event keys', async () => {
5
5
  const chart = await client.charts.create()
6
6
  const season = await client.seasons.create(chart.key)
7
7
 
8
- const updatedSeason = await client.seasons.createEvents(season.key, null, ['event1', 'event2'])
8
+ const events = await client.seasons.createEvents(season.key, null, ['event1', 'event2'])
9
9
 
10
- expect(updatedSeason.events.map(e => e.key)).toEqual(['event1', 'event2'])
10
+ expect(events.map(e => e.key)).toEqual(['event2', 'event1'])
11
11
  })
12
12
 
13
13
  test('create events in season by number of events', async () => {
@@ -15,7 +15,7 @@ test('create events in season by number of events', async () => {
15
15
  const chart = await client.charts.create()
16
16
  const season = await client.seasons.create(chart.key)
17
17
 
18
- const updatedSeason = await client.seasons.createEvents(season.key, 2)
18
+ const events = await client.seasons.createEvents(season.key, 2)
19
19
 
20
- expect(updatedSeason.events.length).toBe(2)
20
+ expect(events.length).toBe(2)
21
21
  })