diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts index 2fb81acf13..113069d56c 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts @@ -12,14 +12,14 @@ import type { StateCreator } from "zustand"; import { SharedStore } from "./shared"; export interface TeamStore { + boundaryBBox?: Team["boundaryBBox"]; + notifyPersonalisation?: NotifyPersonalisation; teamId: number; - teamTheme: TeamTheme; + teamIntegrations: TeamIntegrations; teamName: string; teamSettings?: TeamSettings; - teamIntegrations?: TeamIntegrations; teamSlug: string; - notifyPersonalisation?: NotifyPersonalisation; - boundaryBBox?: Team["boundaryBBox"]; + teamTheme: TeamTheme; setTeam: (team: Team) => void; getTeam: () => Team; @@ -35,24 +35,25 @@ export const teamStore: StateCreator< [], TeamStore > = (set, get) => ({ + boundaryBBox: undefined, + notifyPersonalisation: undefined, teamId: 0, - teamTheme: {} as TeamTheme, + teamIntegrations: {} as TeamIntegrations, teamName: "", teamSettings: undefined, teamSlug: "", - notifyPersonalisation: undefined, - boundaryBBox: undefined, + teamTheme: {} as TeamTheme, setTeam: (team) => { set({ + boundaryBBox: team.boundaryBBox, + notifyPersonalisation: team.notifyPersonalisation, teamId: team.id, - teamTheme: team.theme, - teamName: team.name, teamIntegrations: team.integrations, + teamName: team.name, teamSettings: team.settings, teamSlug: team.slug, - notifyPersonalisation: team.notifyPersonalisation, - boundaryBBox: team.boundaryBBox, + teamTheme: team.theme, }); if (team.theme?.favicon) { @@ -62,14 +63,14 @@ export const teamStore: StateCreator< }, getTeam: () => ({ + boundaryBBox: get().boundaryBBox, id: get().teamId, + integrations: get().teamIntegrations, name: get().teamName, - slug: get().teamSlug, + notifyPersonalisation: get().notifyPersonalisation, settings: get().teamSettings, + slug: get().teamSlug, theme: get().teamTheme, - notifyPersonalisation: get().notifyPersonalisation, - boundaryBBox: get().boundaryBBox, - integrations: get().teamIntegrations, }), initTeamStore: async (slug) => { @@ -108,13 +109,14 @@ export const teamStore: StateCreator< clearTeamStore: () => set({ + boundaryBBox: undefined, + notifyPersonalisation: undefined, teamId: 0, - teamTheme: undefined, + teamIntegrations: undefined, teamName: "", teamSettings: undefined, teamSlug: "", - notifyPersonalisation: undefined, - boundaryBBox: undefined, + teamTheme: undefined, }), /**