Stores
Zustand stores for global state management
Zustand stores providing global state management for authentication, devices, 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.
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
| Field | Type |
|---|---|
token | - |
permissions | - |
Actions
setToken
(token: string | null) => voidsetPermissions
(permissions: unknown | null) => voidreset
() => 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
| Field | Type |
|---|---|
selectedDevices | - |
selectedSockets | - |
filterTags | - |
selectedDevicesTags | - |
selectedContainers | - |
selectedLvCabinets | - |
Actions
selectContainer
(device: DevicePayload) => voidselectLVCabinet
(device: DevicePayload) => voidremoveSelectedContainer
(device: DevicePayload) => voidremoveSelectedLVCabinet
(device: DevicePayload) => voidselectMultipleContainers
(devices: DevicePayload[]) => voidremoveMultipleContainers
(devices: DevicePayload[]) => voidsetSelectedDevices
(devices: DevicePayload[]) => voidsetSelectedLvCabinets
(devices: Record<string, DevicePayload>) => voidsetMultipleSelectedDevices
(devices: DevicePayload[]) => voidremoveMultipleSelectedDevices
(deviceIds: string[]) => voidsetSelectDevice
(device: DevicePayload) => voidremoveSelectedDevice
(deviceId: string) => voidsetFilterTags
(tags: string[]) => voidremoveFilterTag
(tag: string) => voidsetSelectedSockets
(sockets: Record<string, { sockets: SocketData[] }>) => voidsetSelectSocket
(socket: SocketData) => voidremoveSelectedSocket
(payload: RemoveSocketPayload) => voidsetMultipleSelectedSockets
(sockets: SocketData[]) => voidremoveMultipleSelectedSockets
(sockets: SocketData[]) => voidsetResetSelections
() => voidresetSelectedDevicesTags
() => voidselectDeviceTag
(payload: DeviceTagPayload) => voidremoveDeviceTag
(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
| Field | Type |
|---|---|
count | - |
Actions
increment
() => voiddecrement
() => voidreset
() => 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
| Field | Type |
|---|---|
timezone | - |
Actions
setTimezone
(timezone: string) => void