Skip to content

Commit

Permalink
Method signature and interface fixes (#2)
Browse files Browse the repository at this point in the history
* Fix object selection and listing interfaces

* Remove unused import

* Add id to InteractiveObjectProps

* Remove id property

* Make findObject generic
  • Loading branch information
mortendevold authored Dec 18, 2023
1 parent e646534 commit 23b0211
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
25 changes: 24 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ new seatsio.EventManager({
})

// Global seatsio object works as expected
new seatsio.SeatingChart({
const seatingChart = new seatsio.SeatingChart({
workspaceKey: 'myWorkspaceKey',
event: 'myEvent'
})
Expand All @@ -275,4 +275,27 @@ new seatsio.EventManager({

new seatsio.SeatingChartDesigner({
secretKey: 'mySecretKey'
})

// Seating chart tests
seatingChart.selectObjects(['A1', { id: 'someId', ticketType: 'aTicketType', amount: 2}])
seatingChart.deselectObjects(['A1', { id: 'someId', ticketType: 'aTicketType', amount: 2}])

seatingChart.listSelectedObjects().then(objects => {
objects.forEach(obj => {
obj.accessible
obj.category
obj.companionSeat
obj.deselect
obj.displayObjectType
obj.label
obj.labels
obj.objectType
obj.pricing
obj.restrictedView
obj.select
obj.selectable
obj.selected
obj.selectedTicketType
})
})
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1215,19 +1215,19 @@ export interface SeatingChart {
changeConfig: (config: ConfigChange) => Promise<void>
clearSelection: () => Promise<void>
deselectCategories: (categoryIds: string[]) => Promise<void>
deselectObjects: (objects: string[] | Selection[]) => Promise<void>
deselectObjects: (objects: (string | Selection)[]) => Promise<void>
destroy: () => void
findObject: (label: string) => Promise<SelectableObjectProps>
findObject: <T extends SelectableObjectProps>(label: string) => Promise<T>
getReportBySelectability: () => Promise<Object>
holdToken: string
listCategories: () => Promise<Category[]>
listSelectedObjects: () => Promise<(any)[]>
listSelectedObjects: <T extends SelectableObjectProps>() => Promise<T[]>
render: () => SeatingChart
rerender: () => void
resetView: () => Promise<void>
selectCategories: (categoryIds: string[]) => Promise<void>
selectedObjects: string[]
selectObjects: (objects: string [] | Selection[]) => Promise<void>
selectObjects: (objects: (string | Selection)[]) => Promise<void>
pulse: (objects: string []) => Promise<void>
unpulse: (objects: string []) => Promise<void>
startNewSession: () => Promise<void>
Expand Down

0 comments on commit 23b0211

Please sign in to comment.