MDK Logo

Stores

Zustand stores for global state management

Zustand stores providing global state management for authentication, devices, actions, notifications, and timezone handling.

Package

@tetherto/mdk-ui-foundation

Stores

@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

actionsStore

Module-level singleton holding the queue of pending submission actions and the sidebar open/pinned state.

State

FieldType
pendingSubmissions-
sidebarOpen-
sidebarPinned-

Actions

setPendingSubmissionActions

(actions: PendingSubmissionAction[]) => void

setAddPendingSubmissionAction

(action: Omit<PendingSubmissionAction, 'id'>) => void

removeTagsFromPendingAction

(payload: { submissionId: number; tags: string[] }) => void

removePendingSubmissionAction

(payload: { id: number }) => void

updatePendingSubmissionAction

(action: Partial<PendingSubmissionAction> & { id: number }) => void

clearAllPendingSubmissions

() => void

setSidebarOpen

(open: boolean) => void

setSidebarPinned

(pinned: boolean) => void
@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

authStore

Module-level singleton store holding the current session token and resolved permissions config. React adapters bind to this through useAuth(); non-React callers can authStore.getState() directly.

State

FieldType
token-
permissions-

Actions

setToken

(token: string | null) => void

setPermissions

(permissions: unknown | null) => void

reset

() => void
@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

devicesStore

Module-level singleton tracking selected devices, containers, sockets, and the device-tag map across the UI. Drives bulk-action toolbars, filtering, and the device explorer.

State

FieldType
selectedDevices-
selectedSockets-
filterTags-
selectedDevicesTags-
selectedContainers-
selectedLvCabinets-

Actions

selectContainer

(device: DevicePayload) => void

selectLVCabinet

(device: DevicePayload) => void

removeSelectedContainer

(device: DevicePayload) => void

removeSelectedLVCabinet

(device: DevicePayload) => void

selectMultipleContainers

(devices: DevicePayload[]) => void

removeMultipleContainers

(devices: DevicePayload[]) => void

setSelectedDevices

(devices: DevicePayload[]) => void

setSelectedLvCabinets

(devices: Record<string, DevicePayload>) => void

setMultipleSelectedDevices

(devices: DevicePayload[]) => void

removeMultipleSelectedDevices

(deviceIds: string[]) => void

setSelectDevice

(device: DevicePayload) => void

removeSelectedDevice

(deviceId: string) => void

setFilterTags

(tags: string[]) => void

removeFilterTag

(tag: string) => void

setSelectedSockets

(sockets: Record<string, { sockets: SocketData[] }>) => void

setSelectSocket

(socket: SocketData) => void

removeSelectedSocket

(payload: RemoveSocketPayload) => void

setMultipleSelectedSockets

(sockets: SocketData[]) => void

removeMultipleSelectedSockets

(sockets: SocketData[]) => void

setResetSelections

() => void

resetSelectedDevicesTags

() => void

selectDeviceTag

(payload: DeviceTagPayload) => void

removeDeviceTag

(payload: DeviceTagPayload) => void
@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

notificationStore

Module-level singleton exposing the unread-notification counter that drives header badges and the toast viewport. Increment/decrement from anywhere; React subscribers re-render automatically.

State

FieldType
count-

Actions

increment

() => void

decrement

() => void

reset

() => void
@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

timezoneStore

Module-level singleton holding the user's currently selected IANA timezone (e.g. 'America/New_York'). Drives every timestamp renderer in the UI and the useTimezoneFormatter adapter hook.

State

FieldType
timezone-

Actions

setTimezone

(timezone: string) => void

On this page