@okyrychenko-dev/react-action-guard 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/store/uiBlockingStore.constants.ts","../src/store/uiBlockingStore.utils.ts","../src/store/uiBlockingStore.actions.ts","../src/store/uiBlockingStore.config.ts","../src/store/uiBlockingStore.store.ts","../src/hooks/useBlocker.ts","../src/hooks/useIsBlocked.ts","../src/hooks/useAsyncAction.ts"],"names":["create","devtools","useEffect","useCallback"],"mappings":";;;;;;;;;AAOO,IAAM,aAAA,GAAgB,QAAA;AAKtB,IAAM,cAAA,GAAiB,SAAA;AAKvB,IAAM,gBAAA,GAAmB,CAAA;AAKzB,IAAM,qBAAA,GAAwB,EAAA;AAK9B,IAAM,aAAA,GAAgB,YAAA;;;ACnBtB,SAAS,sBAAsB,KAAA,EAAsD;AAC1F,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,CAAC,KAAK,CAAA;AAAA,EACf;AACA,EAAA,OAAO,KAAA,CAAM,KAAK,KAAK,CAAA;AACzB;;;ACGO,IAAM,uBAAA,GAAkF,CAC7F,GAAA,EACA,GAAA,MACI;AAAA;AAAA,EAEJ,cAAA,sBAAoB,GAAA,EAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUxB,UAAA,EAAY,CAAC,EAAA,EAAY,MAAA,GAAwB,EAAC,KAAY;AAC5D,IAAA,GAAA,CAAI,CAAC,KAAA,KAAU;AACb,MAAA,MAAM,WAAA,GAAc,IAAI,GAAA,CAAI,KAAA,CAAM,cAAc,CAAA;AAChD,MAAA,MAAM,aAAA,GAA+B;AAAA,QACnC,KAAA,EAAO,OAAO,KAAA,IAAS,aAAA;AAAA,QACvB,MAAA,EAAQ,OAAO,MAAA,IAAU,cAAA;AAAA,QACzB,QAAA,EAAU,OAAO,QAAA,IAAY,gBA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,QAAQ,CAAA,CAAA;AAAA,UAC7B,QAAA,EAAU;AAAA,SACX,CAAA;AAED,QAAA,OAAO,MAAM,OAAA,EAAQ;AAAA,MACvB,CAAA,SAAE;AACA,QAAA,aAAA,CAAc,SAAS,CAAA;AAAA,MACzB;AAAA,IACF,CAAA;AAAA,IACA,CAAC,QAAA,EAAU,KAAA,EAAO,UAAA,EAAY,aAAa;AAAA,GAC7C;AAEA,EAAA,OAAO,mBAAA;AACT","file":"index.cjs","sourcesContent":["/**\n * Default values and constants for UI Blocking Store\n */\n\n/**\n * Default scope for blockers\n */\nexport const DEFAULT_SCOPE = \"global\" as const;\n\n/**\n * Default reason when none is provided\n */\nexport const DEFAULT_REASON = \"Unknown\" as const;\n\n/**\n * Default priority for blockers\n */\nexport const DEFAULT_PRIORITY = 0 as const;\n\n/**\n * Default priority for async actions\n */\nexport const ASYNC_ACTION_PRIORITY = 20 as const;\n\n/**\n * DevTools store name\n */\nexport const DEVTOOLS_NAME = \"UIBlocking\" as const;\n","/**\n * Normalize scope to array format\n *\n * @param scope - Single scope or array of scopes\n * @returns Array of scopes\n *\n * @internal\n */\nexport function normalizeScopeToArray(scope: string | ReadonlyArray<string>): Array<string> {\n if (typeof scope === \"string\") {\n return [scope];\n }\n return Array.from(scope);\n}\n","import type { StateCreator } from \"zustand\";\nimport type {\n BlockerConfig,\n BlockerInfo,\n StoredBlocker,\n UIBlockingStore,\n} from \"./uiBlockingStore.types\";\nimport { DEFAULT_SCOPE, DEFAULT_REASON, DEFAULT_PRIORITY } from \"./uiBlockingStore.constants\";\nimport { normalizeScopeToArray } from \"./uiBlockingStore.utils\";\n\n/**\n * UI Blocking Store Slice\n *\n * Implements the state and actions for UI blocking management.\n * This slice follows the Zustand slice pattern for better code organization.\n */\nexport const createUIBlockingActions: StateCreator<UIBlockingStore, [], [], UIBlockingStore> = (\n set,\n get\n) => ({\n // State\n activeBlockers: new Map(),\n\n // Actions\n /**\n * Add a blocker to the store\n *\n * @param id - Unique blocker identifier\n * @param config - Optional blocker configuration\n *\n */\n addBlocker: (id: string, config: BlockerConfig = {}): void => {\n set((state) => {\n const newBlockers = new Map(state.activeBlockers);\n const storedBlocker: StoredBlocker = {\n scope: config.scope ?? DEFAULT_SCOPE,\n reason: config.reason ?? DEFAULT_REASON,\n priority: config.priority ?? DEFAULT_PRIORITY,\n timestamp: config.timestamp ?? Date.now(),\n };\n newBlockers.set(id, storedBlocker);\n\n return { activeBlockers: newBlockers };\n });\n },\n\n /**\n * Remove a blocker from the store\n *\n * @param id - Blocker identifier to remove\n *\n */\n removeBlocker: (id: string): void => {\n set((state) => {\n const newBlockers = new Map(state.activeBlockers);\n newBlockers.delete(id);\n\n return { activeBlockers: newBlockers };\n });\n },\n\n /**\n * Check if a scope is currently blocked\n *\n * @param scope - Scope or array of scopes to check (default: \"global\")\n * @returns True if any of the scopes are blocked\n *\n */\n isBlocked: (scope: string | ReadonlyArray<string> = DEFAULT_SCOPE): boolean => {\n const { activeBlockers } = get();\n const scopes = normalizeScopeToArray(scope);\n\n for (const [, blocker] of activeBlockers) {\n // Global blocking blocks everything\n if (blocker.scope === DEFAULT_SCOPE) {\n return true;\n }\n\n // Check scope intersection\n const blockerScopes = normalizeScopeToArray(blocker.scope);\n\n if (scopes.some((s) => blockerScopes.includes(s))) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Get detailed blocking information for a specific scope\n *\n * @param scope - Scope to get blocking information for\n * @returns Array of blockers affecting the scope, sorted by priority (highest first)\n *\n */\n getBlockingInfo: (scope: string): ReadonlyArray<BlockerInfo> => {\n const { activeBlockers } = get();\n const blockers: Array<BlockerInfo> = [];\n\n for (const [id, blocker] of activeBlockers) {\n const blockerScopes = normalizeScopeToArray(blocker.scope);\n\n if (blocker.scope === DEFAULT_SCOPE || blockerScopes.includes(scope)) {\n blockers.push({ id, ...blocker });\n }\n }\n\n return blockers.sort((a, b) => b.priority - a.priority);\n },\n\n /**\n * Clear all blockers from the store\n */\n clearAllBlockers: (): void => {\n set({ activeBlockers: new Map() });\n },\n\n /**\n * Clear all blockers for a specific scope\n *\n * @param scope - Scope to clear blockers for\n *\n */\n clearBlockersForScope: (scope: string): void => {\n set((state) => {\n const newBlockers = new Map();\n\n for (const [id, blocker] of state.activeBlockers) {\n const blockerScopes = normalizeScopeToArray(blocker.scope);\n\n if (!blockerScopes.includes(scope)) {\n newBlockers.set(id, blocker);\n }\n }\n\n return { activeBlockers: newBlockers };\n });\n },\n});\n","import type { DevtoolsOptions } from \"zustand/middleware\";\nimport { DEVTOOLS_NAME } from \"./uiBlockingStore.constants\";\n\n/**\n * DevTools configuration for UI Blocking Store\n *\n * Enables Redux DevTools integration only in development mode\n * for better debugging experience without production overhead.\n */\nexport const devtoolsConfig: DevtoolsOptions = {\n name: DEVTOOLS_NAME,\n enabled: process.env.NODE_ENV !== \"production\",\n};\n","import { create } from \"zustand\";\nimport { devtools } from \"zustand/middleware\";\nimport { createUIBlockingActions } from \"./uiBlockingStore.actions\";\nimport { devtoolsConfig } from \"./uiBlockingStore.config\";\nimport type { UIBlockingStore } from \"./uiBlockingStore.types\";\n\n/**\n * UI Blocking Store\n *\n * Global Zustand store for managing UI blocking state across the application.\n *\n * Features:\n * - Priority-based blocking system\n * - Scope-based blocking (global, specific areas, or multiple scopes)\n * - Automatic cleanup on unmount (when using hooks)\n * - DevTools integration for debugging\n *\n */\nexport const useUIBlockingStore = create<UIBlockingStore>()(\n devtools(createUIBlockingActions, devtoolsConfig)\n);\n","import { useEffect } from \"react\";\nimport { useUIBlockingStore } from \"../store\";\nimport type { BlockerConfig } from \"../store\";\n\n/**\n * Hook to automatically add and remove a blocker based on component lifecycle\n *\n * Automatically adds a blocker when the component mounts (or when activated)\n * and removes it when the component unmounts (or when deactivated).\n *\n * @param blockerId - Unique identifier for the blocker\n * @param config - Blocker configuration (scope, reason, priority)\n * @param isActive - Whether the blocker is currently active (default: true)\n *\n */\nexport const useBlocker = (blockerId: string, config: BlockerConfig, isActive = true): void => {\n const { addBlocker, removeBlocker } = useUIBlockingStore();\n\n useEffect(() => {\n if (!isActive || !blockerId) {\n return;\n }\n\n addBlocker(blockerId, config);\n\n return () => {\n removeBlocker(blockerId);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [blockerId, isActive, addBlocker, removeBlocker]);\n};\n","import { useUIBlockingStore } from \"../store\";\n\n/**\n * Hook to check if a scope is currently blocked\n *\n * Returns a boolean indicating whether the specified scope(s) are blocked.\n * Automatically re-renders when the blocking state changes.\n *\n * @param scope - Scope or array of scopes to check (default: \"global\")\n * @returns True if any of the specified scopes are blocked\n *\n */\nexport const useIsBlocked = (scope?: string | ReadonlyArray<string>): boolean => {\n return useUIBlockingStore((state) => state.isBlocked(scope));\n};\n","import { useCallback } from \"react\";\nimport { useUIBlockingStore } from \"../store\";\nimport { ASYNC_ACTION_PRIORITY } from \"../store\";\n\n/**\n * Hook to wrap async functions with automatic blocking/unblocking\n *\n * Creates a wrapper function that automatically adds a blocker before executing\n * the async function and removes it after completion (success or failure).\n *\n * @template T - The return type of the async function\n * @param actionId - Unique identifier for the action (used in blocker ID and reason)\n * @param scope - Scope(s) to block during execution (default: \"global\")\n * @returns Function that wraps async functions with blocking behavior\n *\n */\nexport const useAsyncAction = <T = unknown>(\n actionId: string,\n scope?: string | ReadonlyArray<string>\n): ((asyncFn: () => Promise<T>) => Promise<T>) => {\n const { addBlocker, removeBlocker } = useUIBlockingStore();\n\n const executeWithBlocking = useCallback(\n async (asyncFn: () => Promise<T>): Promise<T> => {\n const blockerId = `${actionId}-${Date.now().toString()}`;\n\n try {\n addBlocker(blockerId, {\n scope,\n reason: `Executing ${actionId}`,\n priority: ASYNC_ACTION_PRIORITY,\n });\n\n return await asyncFn();\n } finally {\n removeBlocker(blockerId);\n }\n },\n [actionId, scope, addBlocker, removeBlocker]\n );\n\n return executeWithBlocking;\n};\n"]}
1
+ {"version":3,"sources":["../src/store/uiBlockingStore.constants.ts","../src/store/uiBlockingStore.utils.ts","../src/store/uiBlockingStore.actions.ts","../src/store/uiBlockingStore.config.ts","../src/store/uiBlockingStore.store.ts","../src/hooks/useBlocker.ts","../src/hooks/useIsBlocked.ts","../src/hooks/useAsyncAction.ts","../src/hooks/useConfigRef.ts","../src/hooks/useBlocker.utils.ts","../src/hooks/useConditionalBlocker.ts","../src/hooks/useConfirmableBlocker.ts","../src/hooks/useScheduledBlocker.ts","../src/middleware/loggerMiddleware.utils.ts","../src/middleware/loggerMiddleware.ts","../src/middleware/analyticsMiddleware.utils.ts","../src/middleware/analyticsMiddleware.ts","../src/middleware/performanceMiddleware.utils.ts","../src/middleware/performanceMiddleware.ts"],"names":["create","devtools","useEffect","useCallback","useRef","useState"],"mappings":";;;;;;;;;AAOO,IAAM,aAAA,GAAgB,QAAA;AAKtB,IAAM,cAAA,GAAiB,SAAA;AAKvB,IAAM,gBAAA,GAAmB,CAAA;AAKzB,IAAM,qBAAA,GAAwB,EAAA;AAK9B,IAAM,aAAA,GAAgB,YAAA;;;ACnBtB,SAAS,sBAAsB,KAAA,EAAsD;AAC1F,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,OAAO,CAAC,KAAK,CAAA;AAAA,EACf;AACA,EAAA,OAAO,KAAA,CAAM,KAAK,KAAK,CAAA;AACzB;;;ACDO,IAAM,uBAAA,GAAkF,CAAC,GAAA,EAAK,GAAA,MAAS;AAAA;AAAA,EAE5G,cAAA,sBAAoB,GAAA,EAAI;AAAA,EACxB,WAAA,sBAAiB,GAAA,EAAI;AAAA,EAErB,kBAAA,EAAoB,CAAC,IAAA,EAAc,UAAA,KAA2B;AAC5D,IAAA,GAAA,CAAI,CAAC,KAAA,KAAU;AACb,MAAA,MAAM,cAAA,GAAiB,IAAI,GAAA,CAAI,KAAA,CAAM,WAAW,CAAA;AAChD,MAAA,cAAA,CAAe,GAAA,CAAI,MAAM,UAAU,CAAA;AACnC,MAAA,OAAO,EAAE,aAAa,cAAA,EAAe;AAAA,IACvC,CAAC,CAAA;AACD,IAAA,OAAA,C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A,CAAgB,GAAA,CAAI,OAAA,CAAQ,SAAS,CAAA;AAEvD,EAAA,IAAI,cAAc,MAAA,EAAW;AAC3B,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,QAAA,GAAW,QAAQ,SAAA,GAAY,SAAA;AACrC,EAAA,eAAA,CAAgB,MAAA,CAAO,QAAQ,SAAS,CAAA;AAExC,EAAA,IAAI,YAAY,kBAAA,EAAoB;AAClC,IAAA,OAAA,CAAQ,IAAA,CAAK,sCAAsC,OAAA,CAAQ,SAAS,UAAU,QAAA,CAAS,QAAA,EAAU,CAAA,EAAA,CAAI,CAAA;AAErG,IAAA,WAAA,GAAc,OAAA,CAAQ,WAAW,QAAQ,CAAA;AAAA,EAC3C;AACF,CAAA;AAEO,IAAM,2BAAA,GAA8B,CAAC,MAAA,GAA4B,EAAC,KAAkB;AACzF,EAAA,MAAM,EAAE,kBAAA,GAAqB,4BAAA,EAA8B,WAAA,EAAY,GAAI,MAAA;AAC3E,EAAA,MAAM,eAAA,uBAAsB,GAAA,EAAoB;AAEhD,EAAA,OAAO,CAAC,OAAA,KAAY;AAClB,IAAA,IAAI,OAAA,CAAQ,WAAW,UAAA,EAAY;AACjC,MAAA,eAAA,CAAgB,OAAA,CAAQ,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAW,eAAe,CAAA;AAAA,IACvE,CAAA,MAAA,IAAW,OAAA,CAAQ,MAAA,KAAW,aAAA,EAAe;AAC3C,MAAA,kBAAA,CAAmB,OAAA,EAAS,eAAA,EAAiB,kBAAA,EAAoB,WAAW,CAAA;AAAA,IAC9E;AAAA,EACF,CAAA;AACF","file":"index.cjs","sourcesContent":["/**\n * Default values and constants for UI Blocking Store\n */\n\n/**\n * Default scope for blockers\n */\nexport const DEFAULT_SCOPE = \"global\" as const;\n\n/**\n * Default reason when none is provided\n */\nexport const DEFAULT_REASON = \"Unknown\" as const;\n\n/**\n * Default priority for blockers\n */\nexport const DEFAULT_PRIORITY = 0 as const;\n\n/**\n * Default priority for async actions\n */\nexport const ASYNC_ACTION_PRIORITY = 20 as const;\n\n/**\n * DevTools store name\n */\nexport const DEVTOOLS_NAME = \"UIBlocking\" as const;\n","/**\n * Normalize scope to array format\n *\n * @param scope - Single scope or array of scopes\n * @returns Array of scopes\n *\n * @internal\n */\nexport function normalizeScopeToArray(scope: string | ReadonlyArray<string>): Array<string> {\n if (typeof scope === \"string\") {\n return [scope];\n }\n return Array.from(scope);\n}\n","import type { StateCreator } from \"zustand\";\nimport type { BlockerConfig, BlockerInfo, StoredBlocker, UIBlockingStore } from \"./uiBlockingStore.types\";\nimport { DEFAULT_SCOPE, DEFAULT_REASON, DEFAULT_PRIORITY } from \"./uiBlockingStore.constants\";\nimport { normalizeScopeToArray } from \"./uiBlockingStore.utils\";\nimport { Middleware, MiddlewareContext } from \"../middleware\";\n\n/**\n * UI Blocking Store Slice\n *\n * Implements the state and actions for UI blocking management.\n * This slice follows the Zustand slice pattern for better code organization.\n */\nexport const createUIBlockingActions: StateCreator<UIBlockingStore, [], [], UIBlockingStore> = (set, get) => ({\n // State\n activeBlockers: new Map(),\n middlewares: new Map(),\n\n registerMiddleware: (name: string, middleware: Middleware) => {\n set((state) => {\n const newMiddlewares = new Map(state.middlewares);\n newMiddlewares.set(name, middleware);\n return { middlewares: newMiddlewares };\n });\n console.log(`[UIBlocking] Registered middleware: ${name}`);\n },\n\n unregisterMiddleware: (name: string) => {\n set((state) => {\n const newMiddlewares = new Map(state.middlewares);\n newMiddlewares.delete(name);\n return { middlewares: newMiddlewares };\n });\n console.log(`[UIBlocking] Unregistered middleware: ${name}`);\n },\n\n runMiddlewares: async (context: MiddlewareContext) => {\n const { middlewares } = get();\n\n for (const [name, middleware] of middlewares) {\n try {\n await middleware(context);\n } catch (error) {\n console.error(`[UIBlocking] Middleware \"${name}\" error:`, error);\n }\n }\n },\n\n // Actions\n /**\n * Add a blocker to the store\n *\n * @param id - Unique blocker identifier\n * @param config - Optional blocker configuration\n *\n */\n addBlocker: (id: string, config: BlockerConfig = {}): void => {\n set((state) => {\n const newBlockers = new Map(state.activeBlockers);\n const storedBlocker: StoredBlocker = {\n scope: config.scope ?? DEFAULT_SCOPE,\n reason: config.reason ?? DEFAULT_REASON,\n priority: config.priority ?? DEFAULT_PRIORITY,\n timestamp: config.timestamp ?? Date.now(),\n };\n newBlockers.set(id, storedBlocker);\n\n return { activeBlockers: newBlockers };\n });\n\n void get().runMiddlewares({\n action: \"add\",\n blockerId: id,\n config: {\n scope: config.scope,\n reason: config.reason,\n priority: config.priority,\n },\n timestamp: Date.now(),\n });\n },\n\n /**\n * Remove a blocker from the store\n *\n * @param id - Blocker identifier to remove\n *\n */\n removeBlocker: (id: string): void => {\n const prevBlocker = get().activeBlockers.get(id);\n\n set((state) => {\n const newBlockers = new Map(state.activeBlockers);\n newBlockers.delete(id);\n\n return { activeBlockers: newBlockers };\n });\n\n if (prevBlocker) {\n void get().runMiddlewares({\n action: \"remove\",\n blockerId: id,\n config: prevBlocker,\n timestamp: Date.now(),\n prevState: prevBlocker,\n });\n }\n },\n\n /**\n * Check if a scope is currently blocked\n *\n * @param scope - Scope or array of scopes to check (default: \"global\")\n * @returns True if any of the scopes are blocked\n *\n */\n isBlocked: (scope: string | ReadonlyArray<string> = DEFAULT_SCOPE): boolean => {\n const { activeBlockers } = get();\n const scopes = normalizeScopeToArray(scope);\n\n for (const [, blocker] of activeBlockers) {\n // Global blocking blocks everything\n if (blocker.scope === DEFAULT_SCOPE) {\n return true;\n }\n\n // Check scope intersection\n const blockerScopes = normalizeScopeToArray(blocker.scope);\n\n if (scopes.some((s) => blockerScopes.includes(s))) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Get detailed blocking information for a specific scope\n *\n * @param scope - Scope to get blocking information for\n * @returns Array of blockers affecting the scope, sorted by priority (highest first)\n *\n */\n getBlockingInfo: (scope: string): ReadonlyArray<BlockerInfo> => {\n const { activeBlockers } = get();\n const blockers: Array<BlockerInfo> = [];\n\n for (const [id, blocker] of activeBlockers) {\n const blockerScopes = normalizeScopeToArray(blocker.scope);\n\n if (blocker.scope === DEFAULT_SCOPE || blockerScopes.includes(scope)) {\n blockers.push({ id, ...blocker });\n }\n }\n\n return blockers.sort((a, b) => b.priority - a.priority);\n },\n\n /**\n * Clear all blockers from the store\n */\n clearAllBlockers: (): void => {\n set({ activeBlockers: new Map() });\n },\n\n /**\n * Clear all blockers for a specific scope\n *\n * @param scope - Scope to clear blockers for\n *\n */\n clearBlockersForScope: (scope: string): void => {\n set((state) => {\n const newBlockers = new Map();\n\n for (const [id, blocker] of state.activeBlockers) {\n const blockerScopes = normalizeScopeToArray(blocker.scope);\n\n if (!blockerScopes.includes(scope)) {\n newBlockers.set(id, blocker);\n }\n }\n\n return { activeBlockers: newBlockers };\n });\n },\n});\n","import type { DevtoolsOptions } from \"zustand/middleware\";\nimport { DEVTOOLS_NAME } from \"./uiBlockingStore.constants\";\n\n/**\n * DevTools configuration for UI Blocking Store\n *\n * Enables Redux DevTools integration only in development mode\n * for better debugging experience without production overhead.\n */\nexport const devtoolsConfig: DevtoolsOptions = {\n name: DEVTOOLS_NAME,\n enabled: process.env.NODE_ENV !== \"production\",\n};\n","import { create } from \"zustand\";\nimport { devtools } from \"zustand/middleware\";\nimport { createUIBlockingActions } from \"./uiBlockingStore.actions\";\nimport { devtoolsConfig } from \"./uiBlockingStore.config\";\nimport type { UIBlockingStore } from \"./uiBlockingStore.types\";\n\n/**\n * UI Blocking Store\n *\n * Global Zustand store for managing UI blocking state across the application.\n *\n * Features:\n * - Priority-based blocking system\n * - Scope-based blocking (global, specific areas, or multiple scopes)\n * - Automatic cleanup on unmount (when using hooks)\n * - DevTools integration for debugging\n *\n */\nexport const useUIBlockingStore = create<UIBlockingStore>()(\n devtools(createUIBlockingActions, devtoolsConfig)\n);\n","import { useEffect } from \"react\";\nimport { useUIBlockingStore } from \"../store\";\nimport type { BlockerConfig } from \"../store\";\n\n/**\n * Hook to automatically add and remove a blocker based on component lifecycle\n *\n * Automatically adds a blocker when the component mounts (or when activated)\n * and removes it when the component unmounts (or when deactivated).\n *\n * @param blockerId - Unique identifier for the blocker\n * @param config - Blocker configuration (scope, reason, priority)\n * @param isActive - Whether the blocker is currently active (default: true)\n *\n */\nexport const useBlocker = (blockerId: string, config: BlockerConfig, isActive = true): void => {\n const { addBlocker, removeBlocker } = useUIBlockingStore();\n\n useEffect(() => {\n if (!isActive || !blockerId) {\n return;\n }\n\n addBlocker(blockerId, config);\n\n return () => {\n removeBlocker(blockerId);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [blockerId, isActive, addBlocker, removeBlocker]);\n};\n","import { useUIBlockingStore } from \"../store\";\n\n/**\n * Hook to check if a scope is currently blocked\n *\n * Returns a boolean indicating whether the specified scope(s) are blocked.\n * Automatically re-renders when the blocking state changes.\n *\n * @param scope - Scope or array of scopes to check (default: \"global\")\n * @returns True if any of the specified scopes are blocked\n *\n */\nexport const useIsBlocked = (scope?: string | ReadonlyArray<string>): boolean => {\n return useUIBlockingStore((state) => state.isBlocked(scope));\n};\n","import { useCallback } from \"react\";\nimport { useUIBlockingStore } from \"../store\";\nimport { ASYNC_ACTION_PRIORITY } from \"../store\";\n\n/**\n * Hook to wrap async functions with automatic blocking/unblocking\n *\n * Creates a wrapper function that automatically adds a blocker before executing\n * the async function and removes it after completion (success or failure).\n *\n * @template T - The return type of the async function\n * @param actionId - Unique identifier for the action (used in blocker ID and reason)\n * @param scope - Scope(s) to block during execution (default: \"global\")\n * @returns Function that wraps async functions with blocking behavior\n *\n */\nexport const useAsyncAction = <T = unknown>(\n actionId: string,\n scope?: string | ReadonlyArray<string>\n): ((asyncFn: () => Promise<T>) => Promise<T>) => {\n const { addBlocker, removeBlocker } = useUIBlockingStore();\n\n const executeWithBlocking = useCallback(\n async (asyncFn: () => Promise<T>): Promise<T> => {\n const blockerId = `${actionId}-${Date.now().toString()}`;\n\n try {\n addBlocker(blockerId, {\n scope,\n reason: `Executing ${actionId}`,\n priority: ASYNC_ACTION_PRIORITY,\n });\n\n return await asyncFn();\n } finally {\n removeBlocker(blockerId);\n }\n },\n [actionId, scope, addBlocker, removeBlocker]\n );\n\n return executeWithBlocking;\n};\n","import { useRef, useEffect, RefObject } from \"react\";\n\n/**\n * Keeps a ref updated with the latest config value.\n * Useful for accessing current config in callbacks without stale closures.\n *\n * @param config - Configuration object to track\n * @returns Mutable ref that always contains the latest config\n *\n */\nexport function useConfigRef<T>(config: T): RefObject<T> {\n const configRef = useRef(config);\n\n useEffect(() => {\n configRef.current = config;\n }, [config]);\n\n return configRef;\n}\n","import { BlockerConfig } from \"../store\";\n\n/**\n * Creates a blocker configuration object from partial config.\n * Filters out undefined values to create a clean BlockerConfig.\n *\n * @param config - Partial blocker configuration\n * @returns Complete BlockerConfig object\n *\n */\nexport function createBlockerConfig(config: {\n scope?: string | ReadonlyArray<string>;\n reason?: string;\n priority?: number;\n}): BlockerConfig {\n return {\n scope: config.scope,\n reason: config.reason,\n priority: config.priority,\n };\n}\n","import { useRef, useEffect, useCallback } from \"react\";\nimport { useUIBlockingStore } from \"../store\";\nimport { ConditionalBlockerConfig } from \"./useConditionalBlocker.types\";\nimport { useConfigRef } from \"./useConfigRef\";\nimport { createBlockerConfig } from \"./useBlocker.utils\";\n\n/**\n * Hook for conditional blocking based on a condition function.\n *\n * Periodically checks a condition and blocks/unblocks based on the result.\n * The condition is evaluated at the specified interval (default 1000ms).\n *\n * @param blockerId - Unique identifier for this blocker\n * @param config - Configuration including condition function and check interval\n *\n */\nexport const useConditionalBlocker = <TState = unknown>(\n blockerId: string,\n config: ConditionalBlockerConfig<TState>\n): void => {\n const { addBlocker, removeBlocker } = useUIBlockingStore();\n const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n const isBlockedRef = useRef(false);\n const configRef = useConfigRef(config);\n\n const checkCondition = useCallback(() => {\n const currentConfig = configRef.current;\n const shouldBlock = currentConfig.condition(currentConfig.state);\n\n // No state change needed\n if (shouldBlock === isBlockedRef.current) {\n return;\n }\n\n if (shouldBlock) {\n addBlocker(blockerId, createBlockerConfig(currentConfig));\n isBlockedRef.current = true;\n } else {\n removeBlocker(blockerId);\n isBlockedRef.current = false;\n }\n }, [blockerId, addBlocker, removeBlocker, configRef]);\n\n useEffect(() => {\n checkCondition();\n\n const interval = configRef.current.checkInterval ?? 1000;\n intervalRef.current = setInterval(checkCondition, interval);\n\n return (): void => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n intervalRef.current = null;\n }\n if (isBlockedRef.current) {\n removeBlocker(blockerId);\n isBlockedRef.current = false;\n }\n };\n // configRef is stable and doesn't need to be in dependencies\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [checkCondition, blockerId, removeBlocker]);\n};\n","import { useState, useCallback } from \"react\";\nimport { useBlocker } from \"./useBlocker\";\nimport { ConfirmableBlockerConfig, UseConfirmableBlockerReturn } from \"./useConfirmableBlocker.types\";\n\n/**\n * Hook for creating a confirmable action with blocking UI\n *\n */\nexport const useConfirmableBlocker = (\n blockerId: string,\n config: ConfirmableBlockerConfig\n): UseConfirmableBlockerReturn => {\n const [isDialogOpen, setIsDialogOpen] = useState(false);\n const [isExecuting, setIsExecuting] = useState(false);\n\n useBlocker(\n blockerId,\n {\n ...config,\n reason: config.reason ?? config.confirmMessage,\n },\n isDialogOpen || isExecuting\n );\n\n const execute = useCallback(() => {\n setIsDialogOpen(true);\n }, []);\n\n const onConfirm = useCallback(async () => {\n setIsDialogOpen(false);\n setIsExecuting(true);\n\n try {\n await config.onConfirm();\n } catch (error) {\n console.error(\"[UIBlocking] Confirmable action error:\", error);\n throw error;\n } finally {\n setIsExecuting(false);\n }\n }, [config]);\n\n const onCancel = useCallback(() => {\n setIsDialogOpen(false);\n config.onCancel?.();\n }, [config]);\n\n return {\n execute,\n isDialogOpen,\n isExecuting,\n confirmConfig: {\n title: config.confirmTitle ?? \"Confirm Action\",\n message: config.confirmMessage,\n confirmText: config.confirmButtonText ?? \"Confirm\",\n cancelText: config.cancelButtonText ?? \"Cancel\",\n },\n onConfirm,\n onCancel,\n };\n};\n","import { useEffect, useRef, useCallback } from \"react\";\nimport { useUIBlockingStore } from \"../store\";\nimport { ScheduledBlockerConfig } from \"./useScheduledBlocker.types\";\nimport { useConfigRef } from \"./useConfigRef\";\nimport { createBlockerConfig } from \"./useBlocker.utils\";\n\n/**\n * Hook for scheduling UI blocking for a specific time period.\n *\n * Blocks UI during a scheduled maintenance window or time period.\n * Supports start/end times as Date objects, ISO strings, or timestamps.\n * If both duration and end are provided, duration takes precedence.\n *\n * @param blockerId - Unique identifier for this blocker\n * @param config - Configuration including schedule and callbacks\n *\n */\nexport const useScheduledBlocker = (blockerId: string, config: ScheduledBlockerConfig): void => {\n const { addBlocker, removeBlocker } = useUIBlockingStore();\n const timeoutsRef = useRef<{\n start?: ReturnType<typeof setTimeout>;\n end?: ReturnType<typeof setTimeout>;\n }>({});\n const configRef = useConfigRef(config);\n\n const cleanup = useCallback(() => {\n if (timeoutsRef.current.start) {\n clearTimeout(timeoutsRef.current.start);\n timeoutsRef.current.start = undefined;\n }\n if (timeoutsRef.current.end) {\n clearTimeout(timeoutsRef.current.end);\n timeoutsRef.current.end = undefined;\n }\n }, []);\n\n useEffect(() => {\n const currentConfig = configRef.current;\n const startTime = new Date(currentConfig.schedule.start).getTime();\n const now = Date.now();\n\n let endTime: number | undefined;\n if (currentConfig.schedule.duration) {\n endTime = startTime + currentConfig.schedule.duration;\n } else if (currentConfig.schedule.end) {\n endTime = new Date(currentConfig.schedule.end).getTime();\n }\n\n const scheduleEnd = (end: number): void => {\n const remainingTime = end - Date.now();\n if (remainingTime > 0) {\n timeoutsRef.current.end = setTimeout(() => {\n removeBlocker(blockerId);\n configRef.current.onScheduleEnd?.();\n }, remainingTime);\n }\n };\n\n // If start time hasn't arrived yet\n if (startTime > now) {\n timeoutsRef.current.start = setTimeout(() => {\n const cfg = configRef.current;\n addBlocker(blockerId, createBlockerConfig(cfg));\n cfg.onScheduleStart?.();\n\n if (endTime) {\n scheduleEnd(endTime);\n }\n }, startTime - now);\n }\n // If already in blocking period\n else if (endTime && endTime > now) {\n addBlocker(blockerId, createBlockerConfig(currentConfig));\n currentConfig.onScheduleStart?.();\n scheduleEnd(endTime);\n }\n // If schedule without end/duration\n else if (!endTime && startTime <= now) {\n addBlocker(blockerId, createBlockerConfig(currentConfig));\n currentConfig.onScheduleStart?.();\n } else {\n console.warn(`[UIBlocking] Schedule is in the past for blocker \"${blockerId}\"`);\n }\n\n return (): void => {\n cleanup();\n removeBlocker(blockerId);\n };\n // configRef is stable and doesn't need to be in dependencies\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [blockerId, addBlocker, removeBlocker, cleanup]);\n};\n","import { MiddlewareBlockerConfig, MiddlewareContext } from \"./middleware.types\";\n\nexport const getActionEmoji = (action: string): string => {\n switch (action) {\n case \"add\":\n return \"➕\";\n case \"remove\":\n return \"➖\";\n case \"update\":\n return \"🔄\";\n case \"cancel\":\n return \"❌\";\n case \"timeout\":\n return \"⏱️\";\n default:\n return \"❓\";\n }\n};\n\nconst extractConfigDetails = (config?: MiddlewareBlockerConfig): Record<string, unknown> => {\n if (!config) {\n return {};\n }\n\n const { scope, reason, priority } = config;\n\n const details: Record<string, unknown> = {\n scope,\n reason,\n };\n\n if (priority !== undefined) {\n details.priority = priority;\n }\n\n return details;\n};\n\nexport const formatLogData = (context: MiddlewareContext): Record<string, unknown> => {\n const configDetails = extractConfigDetails(context.config);\n\n if (context.prevState) {\n return {\n config: configDetails,\n prevState: extractConfigDetails(context.prevState),\n };\n }\n\n return configDetails;\n};\n","import { getActionEmoji, formatLogData } from \"./loggerMiddleware.utils\";\nimport { Middleware } from \"./middleware.types\";\n\nconst LOG_PREFIX = \"[UIBlocking]\";\n\nexport const loggerMiddleware: Middleware = (context) => {\n const emoji = getActionEmoji(context.action);\n const logData = formatLogData(context);\n\n console.log(LOG_PREFIX, emoji, context.blockerId, logData);\n};\n","import { AnalyticsEventData } from \"./analyticsMiddleware.types\";\nimport { MiddlewareContext } from \"./middleware.types\";\n\nconst capitalizeFirst = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\nexport const buildEventData = (context: MiddlewareContext): AnalyticsEventData => {\n const eventData: AnalyticsEventData = {\n blocker_id: context.blockerId,\n };\n const { scope, reason, priority } = context.config ?? {};\n\n if (scope !== undefined) {\n eventData.scope = Array.isArray(scope) ? scope.join(\",\") : scope;\n }\n\n if (reason !== undefined) {\n eventData.reason = reason;\n }\n\n if (priority !== undefined) {\n eventData.priority = priority;\n }\n\n return eventData;\n};\n\nexport const trackGoogleAnalytics = (action: string, eventData: AnalyticsEventData): void => {\n if (window.gtag) {\n window.gtag(\"event\", `ui_blocking_${action}`, eventData);\n }\n};\n\nexport const trackMixpanel = (action: string, eventData: AnalyticsEventData): void => {\n if (window.mixpanel) {\n const eventName = `UI Blocking ${action.split(\"_\").map(capitalizeFirst).join(\" \")}`;\n\n window.mixpanel.track(eventName, eventData);\n }\n};\n\nexport const trackAmplitude = (action: string, eventData: AnalyticsEventData): void => {\n if (window.amplitude) {\n const eventName = `UI Blocking ${action.split(\"_\").map(capitalizeFirst).join(\" \")}`;\n\n window.amplitude.track(eventName, eventData);\n }\n};\n\nexport const trackCustom = (\n trackFn: (event: string, data: AnalyticsEventData) => void,\n action: string,\n eventData: AnalyticsEventData\n): void => {\n try {\n trackFn(`ui_blocking_${action}`, eventData);\n } catch {\n // Silently ignore errors in custom tracker\n }\n};\n","import { AnalyticsConfig, AnalyticsEventData } from \"./analyticsMiddleware.types\";\nimport {\n buildEventData,\n trackGoogleAnalytics,\n trackMixpanel,\n trackAmplitude,\n trackCustom,\n} from \"./analyticsMiddleware.utils\";\nimport { Middleware, MiddlewareContext } from \"./middleware.types\";\n\nconst trackEvent = (config: AnalyticsConfig, context: MiddlewareContext, eventData: AnalyticsEventData): void => {\n if (\"provider\" in config) {\n switch (config.provider) {\n case \"ga\":\n trackGoogleAnalytics(context.action, eventData);\n return;\n case \"mixpanel\":\n trackMixpanel(context.action, eventData);\n return;\n case \"amplitude\":\n trackAmplitude(context.action, eventData);\n return;\n }\n }\n\n if (\"track\" in config) {\n trackCustom(config.track, context.action, eventData);\n }\n};\n\nexport const createAnalyticsMiddleware = (config: AnalyticsConfig): Middleware => {\n return (context) => {\n const eventData = buildEventData(context);\n\n trackEvent(config, context, eventData);\n };\n};\n","export const handleAddAction = (blockerId: string, timestamp: number, blockStartTimes: Map<string, number>): void => {\n blockStartTimes.set(blockerId, timestamp);\n};\n","import { Middleware, MiddlewareContext } from \"./middleware.types\";\nimport { PerformanceConfig } from \"./performanceMiddleware.types\";\nimport { handleAddAction } from \"./performanceMiddleware.utils\";\n\nconst DEFAULT_SLOW_BLOCK_THRESHOLD = 3000;\nconst ACTION_ADD = \"add\";\nconst ACTION_REMOVE = \"remove\";\n\nconst handleRemoveAction = (\n context: MiddlewareContext,\n blockStartTimes: Map<string, number>,\n slowBlockThreshold: number,\n onSlowBlock?: (blockerId: string, duration: number) => void\n): void => {\n const startTime = blockStartTimes.get(context.blockerId);\n\n if (startTime === undefined) {\n return;\n }\n\n const duration = context.timestamp - startTime;\n blockStartTimes.delete(context.blockerId);\n\n if (duration >= slowBlockThreshold) {\n console.warn(`[UIBlocking] Slow block detected: \"${context.blockerId}\" took ${duration.toString()}ms`);\n\n onSlowBlock?.(context.blockerId, duration);\n }\n};\n\nexport const createPerformanceMiddleware = (config: PerformanceConfig = {}): Middleware => {\n const { slowBlockThreshold = DEFAULT_SLOW_BLOCK_THRESHOLD, onSlowBlock } = config;\n const blockStartTimes = new Map<string, number>();\n\n return (context) => {\n if (context.action === ACTION_ADD) {\n handleAddAction(context.blockerId, context.timestamp, blockStartTimes);\n } else if (context.action === ACTION_REMOVE) {\n handleRemoveAction(context, blockStartTimes, slowBlockThreshold, onSlowBlock);\n }\n };\n};\n"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,43 @@
1
1
  import * as zustand from 'zustand';
2
2
 
3
+ type BlockingAction = "add" | "remove" | "update" | "cancel" | "timeout";
4
+ type MiddlewareBlockerConfig = BlockerConfig;
5
+ interface MiddlewareContext {
6
+ action: BlockingAction;
7
+ blockerId: string;
8
+ config?: MiddlewareBlockerConfig;
9
+ timestamp: number;
10
+ prevState?: MiddlewareBlockerConfig;
11
+ }
12
+ type Middleware = (context: MiddlewareContext) => void | Promise<void>;
13
+
14
+ declare const loggerMiddleware: Middleware;
15
+
16
+ type AnalyticsEventData = Record<string, string | number | ReadonlyArray<string> | undefined>;
17
+ type AnalyticsProvider = "ga" | "mixpanel" | "amplitude";
18
+ interface GoogleAnalyticsConfig {
19
+ provider: "ga";
20
+ }
21
+ interface MixpanelConfig {
22
+ provider: "mixpanel";
23
+ }
24
+ interface AmplitudeConfig {
25
+ provider: "amplitude";
26
+ }
27
+ interface CustomAnalyticsConfig {
28
+ track: (event: string, data: AnalyticsEventData) => void;
29
+ }
30
+ type AnalyticsConfig = GoogleAnalyticsConfig | MixpanelConfig | AmplitudeConfig | CustomAnalyticsConfig;
31
+
32
+ declare const createAnalyticsMiddleware: (config: AnalyticsConfig) => Middleware;
33
+
34
+ interface PerformanceConfig {
35
+ slowBlockThreshold?: number;
36
+ onSlowBlock?: (blockerId: string, duration: number) => void;
37
+ }
38
+
39
+ declare const createPerformanceMiddleware: (config?: PerformanceConfig) => Middleware;
40
+
3
41
  /**
4
42
  * Configuration for a blocker
5
43
  */
@@ -29,6 +67,7 @@ interface BlockerInfo extends StoredBlocker {
29
67
  */
30
68
  interface UIBlockingStoreState {
31
69
  activeBlockers: Map<string, StoredBlocker>;
70
+ middlewares: Map<string, Middleware>;
32
71
  }
33
72
  /**
34
73
  * Store actions
@@ -38,8 +77,11 @@ interface UIBlockingStoreActions {
38
77
  removeBlocker: (id: string) => void;
39
78
  isBlocked: (scope?: string | ReadonlyArray<string>) => boolean;
40
79
  getBlockingInfo: (scope: string) => ReadonlyArray<BlockerInfo>;
41
- clearAllBlockers: () => void;
80
+ clearAllBlockers: VoidFunction;
42
81
  clearBlockersForScope: (scope: string) => void;
82
+ registerMiddleware: (name: string, middleware: Middleware) => void;
83
+ unregisterMiddleware: (name: string) => void;
84
+ runMiddlewares: (context: MiddlewareContext) => Promise<void>;
43
85
  }
44
86
  /**
45
87
  * Complete store type (state + actions)
@@ -115,4 +157,122 @@ declare const useIsBlocked: (scope?: string | ReadonlyArray<string>) => boolean;
115
157
  */
116
158
  declare const useAsyncAction: <T = unknown>(actionId: string, scope?: string | ReadonlyArray<string>) => ((asyncFn: () => Promise<T>) => Promise<T>);
117
159
 
118
- export { type BlockerConfig, type BlockerInfo, type StoredBlocker, type UIBlockingStore, type UIBlockingStoreActions, type UIBlockingStoreState, useAsyncAction, useBlocker, useIsBlocked, useUIBlockingStore };
160
+ /**
161
+ * Configuration for conditional blocker hook.
162
+ *
163
+ * Note: Unlike the base BlockerConfig, the scope property is required here
164
+ * because conditional blockers must have a defined scope to check against.
165
+ */
166
+ interface ConditionalBlockerConfig<TState = unknown> extends Omit<BlockerConfig, "scope"> {
167
+ /** Required scope(s) to block. Unlike base BlockerConfig, this is mandatory for conditional blockers. */
168
+ scope: string | ReadonlyArray<string>;
169
+ /** Function that determines whether blocking should be active */
170
+ condition: (state?: TState) => boolean;
171
+ /** Interval in milliseconds to check the condition (default: 1000ms) */
172
+ checkInterval?: number;
173
+ /** Optional state to pass to the condition function */
174
+ state?: TState;
175
+ }
176
+
177
+ /**
178
+ * Hook for conditional blocking based on a condition function.
179
+ *
180
+ * Periodically checks a condition and blocks/unblocks based on the result.
181
+ * The condition is evaluated at the specified interval (default 1000ms).
182
+ *
183
+ * @param blockerId - Unique identifier for this blocker
184
+ * @param config - Configuration including condition function and check interval
185
+ *
186
+ */
187
+ declare const useConditionalBlocker: <TState = unknown>(blockerId: string, config: ConditionalBlockerConfig<TState>) => void;
188
+
189
+ /**
190
+ * Configuration for the confirmation dialog
191
+ */
192
+ interface ConfirmDialogConfig {
193
+ title: string;
194
+ message: string;
195
+ confirmText: string;
196
+ cancelText: string;
197
+ }
198
+ /**
199
+ * Configuration for confirmable blocker hook.
200
+ *
201
+ * The reason property can be used to provide a different blocking reason
202
+ * than the confirmMessage. If not provided, confirmMessage will be used as the reason.
203
+ */
204
+ interface ConfirmableBlockerConfig extends BlockerConfig {
205
+ /** Message to display in the confirmation dialog */
206
+ confirmMessage: string;
207
+ /** Title for the confirmation dialog (default: "Confirm Action") */
208
+ confirmTitle?: string;
209
+ /** Text for the confirm button (default: "Confirm") */
210
+ confirmButtonText?: string;
211
+ /** Text for the cancel button (default: "Cancel") */
212
+ cancelButtonText?: string;
213
+ /** Callback to execute when confirmed. Can be async. */
214
+ onConfirm: () => void | Promise<void>;
215
+ /** Optional callback to execute when cancelled */
216
+ onCancel?: VoidFunction;
217
+ }
218
+ /**
219
+ * Return type for useConfirmableBlocker hook
220
+ */
221
+ interface UseConfirmableBlockerReturn {
222
+ execute: VoidFunction;
223
+ isDialogOpen: boolean;
224
+ isExecuting: boolean;
225
+ confirmConfig: ConfirmDialogConfig;
226
+ onConfirm: () => Promise<void>;
227
+ onCancel: VoidFunction;
228
+ }
229
+
230
+ /**
231
+ * Hook for creating a confirmable action with blocking UI
232
+ *
233
+ */
234
+ declare const useConfirmableBlocker: (blockerId: string, config: ConfirmableBlockerConfig) => UseConfirmableBlockerReturn;
235
+
236
+ /**
237
+ * Schedule configuration for time-based blocking.
238
+ *
239
+ * You can specify the blocking period in two ways:
240
+ * 1. start + duration: Block for a specific duration after start time
241
+ * 2. start + end: Block between start and end times
242
+ *
243
+ * Note: If both duration and end are provided, duration takes precedence.
244
+ */
245
+ interface BlockingSchedule {
246
+ /** Start time as ISO string, Date object, or timestamp */
247
+ start: string | Date | number;
248
+ /** Optional end time as ISO string, Date object, or timestamp */
249
+ end?: string | Date | number;
250
+ /** Duration in milliseconds (takes precedence over end if both provided) */
251
+ duration?: number;
252
+ }
253
+ /**
254
+ * Configuration for scheduled blocker hook
255
+ */
256
+ interface ScheduledBlockerConfig extends BlockerConfig {
257
+ /** Schedule defining when blocking should be active */
258
+ schedule: BlockingSchedule;
259
+ /** Optional callback to execute when the blocking schedule starts */
260
+ onScheduleStart?: VoidFunction;
261
+ /** Optional callback to execute when the blocking schedule ends */
262
+ onScheduleEnd?: VoidFunction;
263
+ }
264
+
265
+ /**
266
+ * Hook for scheduling UI blocking for a specific time period.
267
+ *
268
+ * Blocks UI during a scheduled maintenance window or time period.
269
+ * Supports start/end times as Date objects, ISO strings, or timestamps.
270
+ * If both duration and end are provided, duration takes precedence.
271
+ *
272
+ * @param blockerId - Unique identifier for this blocker
273
+ * @param config - Configuration including schedule and callbacks
274
+ *
275
+ */
276
+ declare const useScheduledBlocker: (blockerId: string, config: ScheduledBlockerConfig) => void;
277
+
278
+ export { type AmplitudeConfig, type AnalyticsConfig, type AnalyticsEventData, type AnalyticsProvider, type BlockerConfig, type BlockerInfo, type BlockingAction, type BlockingSchedule, type ConditionalBlockerConfig, type ConfirmDialogConfig, type ConfirmableBlockerConfig, type CustomAnalyticsConfig, type GoogleAnalyticsConfig, type Middleware, type MiddlewareContext, type MixpanelConfig, type PerformanceConfig, type ScheduledBlockerConfig, type StoredBlocker, type UIBlockingStore, type UIBlockingStoreActions, type UIBlockingStoreState, type UseConfirmableBlockerReturn, createAnalyticsMiddleware, createPerformanceMiddleware, loggerMiddleware, useAsyncAction, useBlocker, useConditionalBlocker, useConfirmableBlocker, useIsBlocked, useScheduledBlocker, useUIBlockingStore };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,43 @@
1
1
  import * as zustand from 'zustand';
2
2
 
3
+ type BlockingAction = "add" | "remove" | "update" | "cancel" | "timeout";
4
+ type MiddlewareBlockerConfig = BlockerConfig;
5
+ interface MiddlewareContext {
6
+ action: BlockingAction;
7
+ blockerId: string;
8
+ config?: MiddlewareBlockerConfig;
9
+ timestamp: number;
10
+ prevState?: MiddlewareBlockerConfig;
11
+ }
12
+ type Middleware = (context: MiddlewareContext) => void | Promise<void>;
13
+
14
+ declare const loggerMiddleware: Middleware;
15
+
16
+ type AnalyticsEventData = Record<string, string | number | ReadonlyArray<string> | undefined>;
17
+ type AnalyticsProvider = "ga" | "mixpanel" | "amplitude";
18
+ interface GoogleAnalyticsConfig {
19
+ provider: "ga";
20
+ }
21
+ interface MixpanelConfig {
22
+ provider: "mixpanel";
23
+ }
24
+ interface AmplitudeConfig {
25
+ provider: "amplitude";
26
+ }
27
+ interface CustomAnalyticsConfig {
28
+ track: (event: string, data: AnalyticsEventData) => void;
29
+ }
30
+ type AnalyticsConfig = GoogleAnalyticsConfig | MixpanelConfig | AmplitudeConfig | CustomAnalyticsConfig;
31
+
32
+ declare const createAnalyticsMiddleware: (config: AnalyticsConfig) => Middleware;
33
+
34
+ interface PerformanceConfig {
35
+ slowBlockThreshold?: number;
36
+ onSlowBlock?: (blockerId: string, duration: number) => void;
37
+ }
38
+
39
+ declare const createPerformanceMiddleware: (config?: PerformanceConfig) => Middleware;
40
+
3
41
  /**
4
42
  * Configuration for a blocker
5
43
  */
@@ -29,6 +67,7 @@ interface BlockerInfo extends StoredBlocker {
29
67
  */
30
68
  interface UIBlockingStoreState {
31
69
  activeBlockers: Map<string, StoredBlocker>;
70
+ middlewares: Map<string, Middleware>;
32
71
  }
33
72
  /**
34
73
  * Store actions
@@ -38,8 +77,11 @@ interface UIBlockingStoreActions {
38
77
  removeBlocker: (id: string) => void;
39
78
  isBlocked: (scope?: string | ReadonlyArray<string>) => boolean;
40
79
  getBlockingInfo: (scope: string) => ReadonlyArray<BlockerInfo>;
41
- clearAllBlockers: () => void;
80
+ clearAllBlockers: VoidFunction;
42
81
  clearBlockersForScope: (scope: string) => void;
82
+ registerMiddleware: (name: string, middleware: Middleware) => void;
83
+ unregisterMiddleware: (name: string) => void;
84
+ runMiddlewares: (context: MiddlewareContext) => Promise<void>;
43
85
  }
44
86
  /**
45
87
  * Complete store type (state + actions)
@@ -115,4 +157,122 @@ declare const useIsBlocked: (scope?: string | ReadonlyArray<string>) => boolean;
115
157
  */
116
158
  declare const useAsyncAction: <T = unknown>(actionId: string, scope?: string | ReadonlyArray<string>) => ((asyncFn: () => Promise<T>) => Promise<T>);
117
159
 
118
- export { type BlockerConfig, type BlockerInfo, type StoredBlocker, type UIBlockingStore, type UIBlockingStoreActions, type UIBlockingStoreState, useAsyncAction, useBlocker, useIsBlocked, useUIBlockingStore };
160
+ /**
161
+ * Configuration for conditional blocker hook.
162
+ *
163
+ * Note: Unlike the base BlockerConfig, the scope property is required here
164
+ * because conditional blockers must have a defined scope to check against.
165
+ */
166
+ interface ConditionalBlockerConfig<TState = unknown> extends Omit<BlockerConfig, "scope"> {
167
+ /** Required scope(s) to block. Unlike base BlockerConfig, this is mandatory for conditional blockers. */
168
+ scope: string | ReadonlyArray<string>;
169
+ /** Function that determines whether blocking should be active */
170
+ condition: (state?: TState) => boolean;
171
+ /** Interval in milliseconds to check the condition (default: 1000ms) */
172
+ checkInterval?: number;
173
+ /** Optional state to pass to the condition function */
174
+ state?: TState;
175
+ }
176
+
177
+ /**
178
+ * Hook for conditional blocking based on a condition function.
179
+ *
180
+ * Periodically checks a condition and blocks/unblocks based on the result.
181
+ * The condition is evaluated at the specified interval (default 1000ms).
182
+ *
183
+ * @param blockerId - Unique identifier for this blocker
184
+ * @param config - Configuration including condition function and check interval
185
+ *
186
+ */
187
+ declare const useConditionalBlocker: <TState = unknown>(blockerId: string, config: ConditionalBlockerConfig<TState>) => void;
188
+
189
+ /**
190
+ * Configuration for the confirmation dialog
191
+ */
192
+ interface ConfirmDialogConfig {
193
+ title: string;
194
+ message: string;
195
+ confirmText: string;
196
+ cancelText: string;
197
+ }
198
+ /**
199
+ * Configuration for confirmable blocker hook.
200
+ *
201
+ * The reason property can be used to provide a different blocking reason
202
+ * than the confirmMessage. If not provided, confirmMessage will be used as the reason.
203
+ */
204
+ interface ConfirmableBlockerConfig extends BlockerConfig {
205
+ /** Message to display in the confirmation dialog */
206
+ confirmMessage: string;
207
+ /** Title for the confirmation dialog (default: "Confirm Action") */
208
+ confirmTitle?: string;
209
+ /** Text for the confirm button (default: "Confirm") */
210
+ confirmButtonText?: string;
211
+ /** Text for the cancel button (default: "Cancel") */
212
+ cancelButtonText?: string;
213
+ /** Callback to execute when confirmed. Can be async. */
214
+ onConfirm: () => void | Promise<void>;
215
+ /** Optional callback to execute when cancelled */
216
+ onCancel?: VoidFunction;
217
+ }
218
+ /**
219
+ * Return type for useConfirmableBlocker hook
220
+ */
221
+ interface UseConfirmableBlockerReturn {
222
+ execute: VoidFunction;
223
+ isDialogOpen: boolean;
224
+ isExecuting: boolean;
225
+ confirmConfig: ConfirmDialogConfig;
226
+ onConfirm: () => Promise<void>;
227
+ onCancel: VoidFunction;
228
+ }
229
+
230
+ /**
231
+ * Hook for creating a confirmable action with blocking UI
232
+ *
233
+ */
234
+ declare const useConfirmableBlocker: (blockerId: string, config: ConfirmableBlockerConfig) => UseConfirmableBlockerReturn;
235
+
236
+ /**
237
+ * Schedule configuration for time-based blocking.
238
+ *
239
+ * You can specify the blocking period in two ways:
240
+ * 1. start + duration: Block for a specific duration after start time
241
+ * 2. start + end: Block between start and end times
242
+ *
243
+ * Note: If both duration and end are provided, duration takes precedence.
244
+ */
245
+ interface BlockingSchedule {
246
+ /** Start time as ISO string, Date object, or timestamp */
247
+ start: string | Date | number;
248
+ /** Optional end time as ISO string, Date object, or timestamp */
249
+ end?: string | Date | number;
250
+ /** Duration in milliseconds (takes precedence over end if both provided) */
251
+ duration?: number;
252
+ }
253
+ /**
254
+ * Configuration for scheduled blocker hook
255
+ */
256
+ interface ScheduledBlockerConfig extends BlockerConfig {
257
+ /** Schedule defining when blocking should be active */
258
+ schedule: BlockingSchedule;
259
+ /** Optional callback to execute when the blocking schedule starts */
260
+ onScheduleStart?: VoidFunction;
261
+ /** Optional callback to execute when the blocking schedule ends */
262
+ onScheduleEnd?: VoidFunction;
263
+ }
264
+
265
+ /**
266
+ * Hook for scheduling UI blocking for a specific time period.
267
+ *
268
+ * Blocks UI during a scheduled maintenance window or time period.
269
+ * Supports start/end times as Date objects, ISO strings, or timestamps.
270
+ * If both duration and end are provided, duration takes precedence.
271
+ *
272
+ * @param blockerId - Unique identifier for this blocker
273
+ * @param config - Configuration including schedule and callbacks
274
+ *
275
+ */
276
+ declare const useScheduledBlocker: (blockerId: string, config: ScheduledBlockerConfig) => void;
277
+
278
+ export { type AmplitudeConfig, type AnalyticsConfig, type AnalyticsEventData, type AnalyticsProvider, type BlockerConfig, type BlockerInfo, type BlockingAction, type BlockingSchedule, type ConditionalBlockerConfig, type ConfirmDialogConfig, type ConfirmableBlockerConfig, type CustomAnalyticsConfig, type GoogleAnalyticsConfig, type Middleware, type MiddlewareContext, type MixpanelConfig, type PerformanceConfig, type ScheduledBlockerConfig, type StoredBlocker, type UIBlockingStore, type UIBlockingStoreActions, type UIBlockingStoreState, type UseConfirmableBlockerReturn, createAnalyticsMiddleware, createPerformanceMiddleware, loggerMiddleware, useAsyncAction, useBlocker, useConditionalBlocker, useConfirmableBlocker, useIsBlocked, useScheduledBlocker, useUIBlockingStore };