From 23b02114a7d70c95eb7660ff2bd8eeab928ab725 Mon Sep 17 00:00:00 2001 From: mortendevold <2213243+mortendevold@users.noreply.github.com> Date: Mon, 18 Dec 2023 09:15:45 +0100 Subject: [PATCH] Method signature and interface fixes (#2) * Fix object selection and listing interfaces * Remove unused import * Add id to InteractiveObjectProps * Remove id property * Make findObject generic --- src/index.test.ts | 25 ++++++++++++++++++++++++- src/index.ts | 8 ++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index bbed43f..0db5767 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -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' }) @@ -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 + }) }) \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index a03eb44..7210259 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1215,19 +1215,19 @@ export interface SeatingChart { changeConfig: (config: ConfigChange) => Promise clearSelection: () => Promise deselectCategories: (categoryIds: string[]) => Promise - deselectObjects: (objects: string[] | Selection[]) => Promise + deselectObjects: (objects: (string | Selection)[]) => Promise destroy: () => void - findObject: (label: string) => Promise + findObject: (label: string) => Promise getReportBySelectability: () => Promise holdToken: string listCategories: () => Promise - listSelectedObjects: () => Promise<(any)[]> + listSelectedObjects: () => Promise render: () => SeatingChart rerender: () => void resetView: () => Promise selectCategories: (categoryIds: string[]) => Promise selectedObjects: string[] - selectObjects: (objects: string [] | Selection[]) => Promise + selectObjects: (objects: (string | Selection)[]) => Promise pulse: (objects: string []) => Promise unpulse: (objects: string []) => Promise startNewSession: () => Promise