seatsio 67.1.0 → 67.4.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
package/src/Events/Event.js
CHANGED
|
@@ -16,6 +16,11 @@ class Event {
|
|
|
16
16
|
this.updatedOn = event.updatedOn ? new Date(event.updatedOn) : null
|
|
17
17
|
this.channels = event.channels ? event.channels.map(c => new Channel(c)) : null
|
|
18
18
|
this.socialDistancingRulesetKey = event.socialDistancingRulesetKey
|
|
19
|
+
this.topLevelSeasonKey = event.topLevelSeasonKey
|
|
20
|
+
this.isTopLevelSeason = event.isTopLevelSeason
|
|
21
|
+
this.isPartialSeason = event.isPartialSeason
|
|
22
|
+
this.isEventInSeason = event.isEventInSeason
|
|
23
|
+
this.objectCategories = event.objectCategories
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
isSeason () {
|
package/src/Events/Events.js
CHANGED
|
@@ -20,9 +20,10 @@ class Events {
|
|
|
20
20
|
* @param {?string} eventKey
|
|
21
21
|
* @param {?TableBookingConfig} tableBookingConfig
|
|
22
22
|
* @param {?string} socialDistancingRulesetKey
|
|
23
|
+
* @param {?object} objectCategories
|
|
23
24
|
* @returns {Promise<Event>}
|
|
24
25
|
*/
|
|
25
|
-
create (chartKey, eventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null) {
|
|
26
|
+
create (chartKey, eventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null, objectCategories = null) {
|
|
26
27
|
const requestParameters = {}
|
|
27
28
|
|
|
28
29
|
requestParameters.chartKey = chartKey
|
|
@@ -39,6 +40,10 @@ class Events {
|
|
|
39
40
|
requestParameters.socialDistancingRulesetKey = socialDistancingRulesetKey
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
if (objectCategories !== null) {
|
|
44
|
+
requestParameters.objectCategories = objectCategories
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
return this.client.post('/events', requestParameters)
|
|
43
48
|
.then((res) => new EventDeserializer().fromJson(res.data))
|
|
44
49
|
}
|
|
@@ -66,9 +71,10 @@ class Events {
|
|
|
66
71
|
* @param {?string} newEventKey
|
|
67
72
|
* @param {?TableBookingConfig} tableBookingConfig
|
|
68
73
|
* @param {?string} socialDistancingRulesetKey
|
|
74
|
+
* @param {?object} objectCategories
|
|
69
75
|
* @returns {Promise}
|
|
70
76
|
*/
|
|
71
|
-
update (eventKey, chartKey = null, newEventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null) {
|
|
77
|
+
update (eventKey, chartKey = null, newEventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null, objectCategories = null) {
|
|
72
78
|
const requestParameters = {}
|
|
73
79
|
|
|
74
80
|
if (chartKey !== null) {
|
|
@@ -87,6 +93,10 @@ class Events {
|
|
|
87
93
|
requestParameters.socialDistancingRulesetKey = socialDistancingRulesetKey
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
if (objectCategories !== null) {
|
|
97
|
+
requestParameters.objectCategories = objectCategories
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
return this.client.post(`events/${encodeURIComponent(eventKey)}`, requestParameters)
|
|
91
101
|
}
|
|
92
102
|
|
|
@@ -61,3 +61,13 @@ test('it supports a social distancing ruleset key', async () => {
|
|
|
61
61
|
|
|
62
62
|
expect(event.socialDistancingRulesetKey).toBe('ruleset1')
|
|
63
63
|
})
|
|
64
|
+
|
|
65
|
+
test('it supports object categories', async () => {
|
|
66
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
67
|
+
const chartKey = testUtils.getChartKey()
|
|
68
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
69
|
+
|
|
70
|
+
const event = await client.events.create(chartKey, null, null, null, { 'A-1': 10 })
|
|
71
|
+
|
|
72
|
+
expect(event.objectCategories).toEqual({ 'A-1': 10 })
|
|
73
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const testUtils = require('../testUtils.js')
|
|
2
2
|
const TableBookingConfig = require('../../src/Events/TableBookingConfig')
|
|
3
|
-
const SeasonParams = require(
|
|
3
|
+
const SeasonParams = require('../../src/Seasons/SeasonParams')
|
|
4
4
|
|
|
5
5
|
test('should retrieve event', async () => {
|
|
6
6
|
const { client, user } = await testUtils.createTestUserAndClient()
|
|
@@ -20,6 +20,7 @@ test('should retrieve event', async () => {
|
|
|
20
20
|
expect(retrievedEvent.createdOn.getTime()).toBeLessThanOrEqual(now.getTime() + 5000)
|
|
21
21
|
expect(retrievedEvent.forSaleConfig).toBeFalsy()
|
|
22
22
|
expect(retrievedEvent.updatedOn).toBeNull()
|
|
23
|
+
expect(retrievedEvent.topLevelSeasonKey).toBe(undefined)
|
|
23
24
|
})
|
|
24
25
|
|
|
25
26
|
test('retrieve season', async () => {
|
|
@@ -32,6 +33,10 @@ test('retrieve season', async () => {
|
|
|
32
33
|
|
|
33
34
|
const retrievedSeason = await client.events.retrieve(season.key)
|
|
34
35
|
|
|
36
|
+
expect(retrievedSeason.isSeason()).toBe(true)
|
|
37
|
+
expect(retrievedSeason.isTopLevelSeason).toBe(true)
|
|
38
|
+
expect(retrievedSeason.isPartialSeason).toBe(false)
|
|
39
|
+
expect(retrievedSeason.isEventInSeason).toBe(false)
|
|
35
40
|
expect(retrievedSeason.key).toBeTruthy()
|
|
36
41
|
expect(retrievedSeason.id).toBeTruthy()
|
|
37
42
|
expect(retrievedSeason.partialSeasonKeys).toEqual([partialSeason1.key, partialSeason2.key])
|
|
@@ -42,4 +47,47 @@ test('retrieve season', async () => {
|
|
|
42
47
|
expect(retrievedSeason.createdOn).toBeInstanceOf(Date)
|
|
43
48
|
expect(retrievedSeason.forSaleConfig).toBeFalsy()
|
|
44
49
|
expect(retrievedSeason.updatedOn).toBeFalsy()
|
|
50
|
+
expect(retrievedSeason.topLevelSeasonKey).toBe(undefined)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('retrieve partial season', async () => {
|
|
54
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
55
|
+
const chartKey = testUtils.getChartKey()
|
|
56
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
57
|
+
const season = await client.seasons.create(chartKey, new SeasonParams().eventKeys(['event1', 'event2']))
|
|
58
|
+
const partialSeason1 = await client.seasons.createPartialSeason(season.key, null, ['event1', 'event2'])
|
|
59
|
+
const partialSeason2 = await client.seasons.createPartialSeason(season.key)
|
|
60
|
+
|
|
61
|
+
const retrievedSeason = await client.events.retrieve(partialSeason1.key)
|
|
62
|
+
|
|
63
|
+
expect(retrievedSeason.isSeason()).toBe(true)
|
|
64
|
+
expect(retrievedSeason.isTopLevelSeason).toBe(false)
|
|
65
|
+
expect(retrievedSeason.isPartialSeason).toBe(true)
|
|
66
|
+
expect(retrievedSeason.isEventInSeason).toBe(false)
|
|
67
|
+
expect(retrievedSeason.key).toBeTruthy()
|
|
68
|
+
expect(retrievedSeason.id).toBeTruthy()
|
|
69
|
+
expect(retrievedSeason.partialSeasonKeys).toBe(undefined)
|
|
70
|
+
expect(retrievedSeason.events.map(e => e.key)).toEqual(['event1', 'event2'])
|
|
71
|
+
expect(retrievedSeason.chartKey).toBe(chartKey)
|
|
72
|
+
expect(retrievedSeason.tableBookingConfig).toEqual(TableBookingConfig.inherit())
|
|
73
|
+
expect(retrievedSeason.supportsBestAvailable).toBe(true)
|
|
74
|
+
expect(retrievedSeason.createdOn).toBeInstanceOf(Date)
|
|
75
|
+
expect(retrievedSeason.forSaleConfig).toBeFalsy()
|
|
76
|
+
expect(retrievedSeason.updatedOn).toBeFalsy()
|
|
77
|
+
expect(retrievedSeason.topLevelSeasonKey).toBe(season.key)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
test('retrieve event in season', async () => {
|
|
81
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
82
|
+
const chartKey = testUtils.getChartKey()
|
|
83
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
84
|
+
const season = await client.seasons.create(chartKey, new SeasonParams().eventKeys(['event1', 'event2']))
|
|
85
|
+
|
|
86
|
+
const retrievedEvent = await client.events.retrieve('event1')
|
|
87
|
+
|
|
88
|
+
expect(retrievedEvent.isSeason()).toBe(false)
|
|
89
|
+
expect(retrievedEvent.isTopLevelSeason).toBe(false)
|
|
90
|
+
expect(retrievedEvent.isPartialSeason).toBe(false)
|
|
91
|
+
expect(retrievedEvent.isEventInSeason).toBe(true)
|
|
92
|
+
expect(retrievedEvent.topLevelSeasonKey).toBe(season.key)
|
|
45
93
|
})
|
|
@@ -74,3 +74,29 @@ test('it supports removing the social distancing ruleset key', async () => {
|
|
|
74
74
|
const retrievedEvent = await client.events.retrieve(event.key)
|
|
75
75
|
expect(retrievedEvent.socialDistancingRulesetKey).toBe(undefined)
|
|
76
76
|
})
|
|
77
|
+
|
|
78
|
+
test('it supports object categories', async () => {
|
|
79
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
80
|
+
const chartKey = testUtils.getChartKey()
|
|
81
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
82
|
+
|
|
83
|
+
const event = await client.events.create(chartKey, null, null, null, { 'A-1': 9 })
|
|
84
|
+
|
|
85
|
+
await client.events.update(event.key, null, null, null, null, { 'A-1': 10 })
|
|
86
|
+
|
|
87
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
88
|
+
expect(retrievedEvent.objectCategories).toEqual({ 'A-1': 10 })
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('it supports removing the object categories', async () => {
|
|
92
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
93
|
+
const chartKey = testUtils.getChartKey()
|
|
94
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
95
|
+
|
|
96
|
+
const event = await client.events.create(chartKey, null, null, null, { 'A-2': 9 })
|
|
97
|
+
|
|
98
|
+
await client.events.update(event.key, null, null, null, null, { })
|
|
99
|
+
|
|
100
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
101
|
+
expect(retrievedEvent.objectCategories).toBeFalsy()
|
|
102
|
+
})
|