React Query hooks for **public-read** access to Onboarding Guides, plus a shared cache key builder (`onboardingGuideKeys`) used by both this module and hub-side admin mutations. ## Key Components ### `onboardingGuideKeys` Structured cache key builder for the `['onboarding-guides']` namespace. Covers both public sub-keys and an `admin` sub-namespace, ensuring a single source of truth for cache invalidation across public and admin hooks. | Key | Description | |---|---| | `all` | Root namespace key | | `lists()` / `list(filters)` | Filtered list queries | | `details()` / `detail(slug)` | Single guide by slug | | `sections()` | Section summary list | | `admin.*` | Sub-namespace for hub-side admin mutations | ### `useOnboardingGuides(filters?)` Fetches a paginated/filtered list of guides from `/api/onboarding-guides`. Supports `search`, `section`, `limit`, and `offset` filter params. ### `useOnboardingGuide(slug)` Fetches a single guide by slug from `/api/onboarding-guides/:slug`. Query is disabled when `slug` is undefined or empty. ### `useOnboardingGuideSections()` Fetches section summaries from `/api/onboarding-guides/sections`. Sets `staleTime: 0` to always revalidate on mount. ## Usage Example ```typescript import { useOnboardingGuides, useOnboardingGuide, useOnboardingGuideSections, onboardingGuideKeys, } from './use-onboarding-guides' // Filtered list const { data: guides } = useOnboardingGuides({ section: 'setup', limit: 10 }) // Single guide — query skips when slug is undefined const { data: guide } = useOnboardingGuide('getting-started') // Section navigation const { data: sections } = useOnboardingGuideSections() // Admin hook (hub-side) — invalidates both admin and public caches queryClient.invalidateQueries({ queryKey: onboardingGuideKeys.all }) queryClient.invalidateQueries({ queryKey: onboardingGuideKeys.admin.all }) ``` > **Note:** Endpoints (`/api/onboarding-guides*`) are host-supplied. Non-Next.js embedders must reverse-proxy these routes before using these hooks.