SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat(storybook): add initial support for storybook (#12639)
Vinicius Lourenço8fa9178b6ca2
diff --git a/.claude/skills/signoz-page-story/SKILL.md b/.claude/skills/signoz-page-story/SKILL.mdnew file mode 100644index 0000000000..c157cf8e0b--- /dev/null+++ b/.claude/skills/signoz-page-story/SKILL.md@@ -0,0 +1,95 @@+---+name: signoz-page-story+description: Explore a SigNoz page, map the endpoints, states and query params it has, then write its Storybook page story with control-driven msw mocks that reach every state. Use when asked to create, extend or review a Storybook story for a page under frontend/src/pages, to add controls to an existing page story, or to write defineStoryMocks handlers and mock data for a page.+---++# SigNoz page stories++A page story renders the real page inside the real app shell against msw, and its+controls panel can reach every state the page has. The panel is the deliverable,+not the story list.++`frontend/src/storybook/README.md` is the API surface (providers, parameters,+control builders, module mocks, navigation). Read it first; this skill is the+process on top of it.++## Workflow++1. **Map the page**: [references/discovery.md](references/discovery.md). Produce+ the inventory (endpoints, states, params, permissions, caps) before writing+ code. No inventory, no story.+2. **Skeleton first**: story + empty `defineStoryMocks`, then run it. The console+ names the endpoints step 1 missed.+3. **Inventory to controls**: [references/controls.md](references/controls.md).+4. **Mock data and handlers**: builders in `__story_mockdata__`, handlers in the page's+ mocks module.+5. **Verify in the browser**: [references/verify.md](references/verify.md). Never+ report the story as done without it.++## Rules++- **Default is the loaded page.** `export const Default: Story = {}` with no args,+ every widget carrying data. Empty, loading and failed are variants or control+ values, never the default.+- **A control is a knob on a response**, resolved through `handlers`, `config` or+ `effect`. Never a component prop, never a module mock added for one story.+- **Every branch in the inventory is reachable from the panel.** A state that+ needs a code edit to see is a missing control.+- **Never re-declare what every story already has**: banner, side nav, data state+ (loaded/loading/error), access preset, permissions, check state.+- **A variant earns a story only when it is worth linking to**: an empty+ workspace, a viewer, a page mid-load. Everything else stays a control.+- **Endpoints the page owns go through `response.json`**, so the Data control+ covers loaded, loading and failed in one declaration. Endpoints the page cannot+ render without (ingestion detection, preferences, feature payloads) take a+ plain resolver so the shell survives the loading and error states.+- **Query-param state starts from `route`** (`/logs?tab=explorer`). In-page param+ navigation works inside a story; a different pathname is blocked and reported+ by the overlay. A control for a param is worth it only when the param is a page+ mode someone would want to flip.+- **File layout**: every story file for a page lives under+ `src/pages/<Page>/stories/`: `<Page>.stories.tsx`, `<Page>.stories.mocks.tsx`,+ payload builders in `stories/__story_mockdata__/<page>.ts`. Nothing+ page-specific in `src/storybook/controls/`.+- **The mocks are AI-owned and say so.** `<Page>.stories.mocks.tsx` and every file+ under a `__story_mockdata__/` open with this banner, above the imports:++ ```ts+ /**+ * AI-owned. Generated and maintained by the `signoz-page-story` skill.+ * Do not hand-edit: regenerate instead.+ */+ ```++ The root `.gitattributes` marks both paths `linguist-generated=true`, so the+ reviewer gets them collapsed and spends the attention on the rendered page. The+ story file is the human surface and never carries the banner. A file with the+ banner has to stay regenerable from the page alone: no page knowledge in+ `src/storybook/`, and builders typed from `src/api/generated` where the endpoint+ has types, so a contract change is a compile error instead of a mock that lies.+- **Reuse fixtures** from `src/mocks-server/` and `src/tests/fixtures/` where they+ exist. An endpoint jest needs too belongs in `src/mocks-server/handlers.ts`.+- **Shared response builders live in `src/storybook/msw/__story_mockdata__/`**: typed+ helpers like `queryRangeV5ScalarResponse` that multiple pages need. Before+ writing a response shape inline, check if a builder exists; if not and the+ shape will repeat, add it there. Page-specific builders stay in the page's+ `__story_mockdata__/`.+- **No comment is the default.** Write one only for what the code cannot show:+ a shape the backend dictates, an app bug the mock reproduces, an ordering or+ cap the page depends on, a workaround and the reason for it. Never restate a+ name, a type, or what a builder plainly builds; if the sentence reads as the+ signature in prose, delete it. Nothing addressed to a reviewer. The one+ comment a story always gets is its own doc comment: what it shows, in the+ page's own terms.++## Done means++- [ ] `Default` shows the page with data, checked in dark and light+- [ ] the mocks module and every `__story_mockdata__` file carry the AI-owned banner+- [ ] every control flipped once, its effect seen on screen+- [ ] console clean: no `[storybook] no msw handler`, no 501, no msw unhandled+ request, no React warning+- [ ] no navigation overlay on mount+- [ ] `pnpm tsgo --noEmit`, `pnpm exec oxlint <files>`,+ `pnpm exec oxfmt --check <files>` all clean. The repo has no+ prettier: `pnpm exec prettier` prints a pass while exiting 254diff --git a/.claude/skills/signoz-page-story/references/controls.md b/.claude/skills/signoz-page-story/references/controls.mdnew file mode 100644index 0000000000..8a60b71a14--- /dev/null+++ b/.claude/skills/signoz-page-story/references/controls.md@@ -0,0 +1,165 @@+# Turning the inventory into controls++Every row of the inventory becomes a control, a global control that already+exists, or a documented reason it cannot be one.++## Imports++Paths written as `src/storybook/...` in prose are repo paths, not import+specifiers. Stories import through the `@/` alias (`@/*` → `./src/*`); modules+inside `src/storybook/` import each other relatively.++| Import | From |+| --- | --- |+| `toggleControl`, `countControl`, `choiceControl`, `multiChoiceControl` | `../controls/controls` |+| `defineStoryMocks`, `storyMocks` | `../controls/defineStoryMocks` |+| `PageStoryArgs` | `../controls/resolveStoryMocks` |+| `MockRequest`, `MockResponse` | `../controls/types` |+| the page's mocks, from the story | `./<Page>.stories.mocks` |+| `queryRangeV5ScalarResponse`, `queryRangeV5RawResponse`, etc. | `@/storybook/msw/__story_mockdata__/queryRange` |++## Which builder++`src/storybook/controls/controls.ts`:++| The state is | Builder |+| --- | --- |+| on or off (a signal ingesting, a feature present) | `toggleControl` |+| how many rows a list has | `countControl` |+| one of several modes (tab, visibility, plan, severity filter) | `choiceControl` |+| a subset (steps skipped, columns shown, signals selected) | `multiChoiceControl` |++Rules that come with them:++- `countControl` `max` goes past what the page renders, so a story can show the+ cap being hit. `0` is the empty state, which is why an empty list rarely needs+ its own story. When the cap is in the *request* (`?limit=5`) rather than the+ renderer, stop `max` at the limit: a longer response is a body the backend+ cannot send.+- `choiceControl` options come from a `const` array typed with+ `(typeof X)[number]`, not from string literals scattered in the handlers.+- Defaults describe the fully-populated page. The panel starts where `Default`+ starts.+- `group` is `'<Page> · <facet>'`, such as `'Services · lists'` or+ `'Alerts · rules'`. Keep a page's knobs in two or three groups, not one per+ control.+- `description` only when the name does not carry the effect (what dismissing+ does, what the cap is, which widget it feeds).++## Which hook++`defineStoryMocks` takes three, all optional:++- `handlers(values, response)`: the page's endpoints. Everything the page owns+ goes through `response.json`, so the global Data control turns the whole page+ into loading or failed without a second declaration. An endpoint the page+ cannot render at all without (ingestion detection, preferences, license+ payloads) takes a plain `rest.get(...)` resolver instead, so the shell stays+ visible while the rest hangs or fails.+- `config(values)`: `SignozStoryConfig` for knobs no endpoint covers: `route`,+ `appContext`, `reduxState`, `queryBuilder`, `theme`.+- `effect(values)`: module-level state no provider exposes.++One endpoint feeding several widgets stays one handler that reads the request.+`response.json` hands the request to the builder and awaits it, so reading a+query param, or a POST body, does not cost the Data control:++```ts+rest.get(+ 'http://localhost/api/v1/explorer/views',+ response.json((req) =>+ savedViews(values.savedViews, req.url.searchParams.get('sourcePage') ?? 'logs'),+ ),+),+```++```ts+rest.post(+ 'http://localhost/api/v5/query_range',+ response.json(async (req) => {+ const body = (await req.json()) as QueryRangeRequestV5;+ const signal = body.compositeQuery?.queries?.[0]?.spec?.signal;++ return countResponse(values[`${signal}Ingestion`] ? 4213 : 0);+ }),+),+```++Reach for a plain `rest.post(url, async (req, res, ctx) => …)` only when the+endpoint has to keep answering while the Data control is on `loading` or+`error`: detection calls the page cannot render without.++## Mutations++A control drives the response, so a write the page makes against state a control+owns does not stick: the refetch answers with the control's value and the button+appears to do nothing. Two honest options: leave it declarative and say so in+the PR, or move the state into `effect` so the handler can read what the page+wrote. Never fake the write by mutating a builder's module state without saying+where the state lives.++## Wiring it up++```ts+// src/pages/Services/stories/Services.stories.mocks.tsx+/**+ * AI-owned. Generated and maintained by the `signoz-page-story` skill.+ * Do not hand-edit: regenerate instead.+ */+export const servicesMocks = defineStoryMocks({+ controls: {+ services: countControl('Services', { group: LISTS, value: 8, max: 12 }),+ apdex: choiceControl<ApdexState>('Apdex', {+ group: HEALTH,+ options: APDEX_STATES,+ value: 'mixed',+ }),+ },+ handlers: (values, response) => [+ rest.post(+ 'http://localhost/api/v2/services',+ response.json(() => buildServices(values.services, values.apdex)),+ ),+ ],+});+```++```tsx+// src/pages/Services/stories/Services.stories.tsx+type ServicesArgs = PageStoryArgs<typeof servicesMocks>;++const meta = {+ title: 'Pages/Services',+ component: Services,+ ...storyMocks(servicesMocks, { route: ROUTES.APPLICATION, layout: 'app' }),+} satisfies Meta<ServicesArgs>;+```++`PageStoryArgs` folds in the global controls, so a story's `args` can set+`access`, `dataState` or `banner` next to the page's own knobs and stay typed.++## Not a control++- Anything the global controls already cover: banner, side nav, data state,+ access preset, permissions, check state.+- A knob whose effect nobody can see on the page. Delete it or find the widget it+ was supposed to drive.+- A raw payload as an object control. Controls carry intent (`5 dashboards`,+ `viewer`), and the builder turns intent into the payload.+- Anything that needs a module mock or a component prop to work. If the state+ cannot be produced from a response, config or module state, say so in the PR+ instead of faking it.++## Control or story++Default to a control. Write a story when the state is worth a link:++- the fresh workspace, because that is what a new user sees+- the restricted user, when permissions visibly change the page+- a page-defining mode (a tab, a category) that has its own layout++Combinations of controls do not need stories, which is what the panel is for.++Each story gets one prose doc comment: what it shows, in the page's own terms.+Everywhere else the comment rule in SKILL.md applies: write one only for what+the code cannot show.diff --git a/.claude/skills/signoz-page-story/references/discovery.md b/.claude/skills/signoz-page-story/references/discovery.mdnew file mode 100644index 0000000000..18fc2a7eef--- /dev/null+++ b/.claude/skills/signoz-page-story/references/discovery.md@@ -0,0 +1,64 @@+# Mapping a page++Two passes: read the code, then let the running story correct you. Write the+inventory down: it is what the controls are derived from, and the only+protection against a story that renders one state and calls it a page.++## Pass 1: read the page++Start at `src/pages/<Page>/` and follow it outward: the containers it mounts+(`src/container/<Feature>/`), the hooks those use, the components with their own+fetches. Stop at leaf components that take props only.++Grep recipes, run against the page's directories:++| Looking for | Grep |+| --- | --- |+| endpoints | `useQuery\|useMutation\|useInfiniteQuery`, then the `api/` module it calls |+| endpoint URLs | the api module's `axios.get\|post` |+| endpoint URLs behind a generated hook | the hook lives in `src/api/generated/services/<name>/index.ts` and the URL only appears in the fetcher body: `rg 'url: \`' src/api/generated/services/<name>/` |+| url state | `useUrlQuery\|useUrlQueryData\|useUrlSearchState\|useQueryState\|QueryParams\.` |+| navigation | `useSafeNavigate\|history.push\|<Link` |+| permissions | `useAuthZ\|AuthZGuard\|AuthZButton\|hasEditPermission\|routePermission` |+| flags and prefs | `useFeatureFlag\|FeatureKeys\.\|USER_PREFERENCES\.\|userPreferences` |+| empty and error branches | `isLoading\|isError\|isFetching\|length === 0\|!data` |+| render caps | `slice(0,\|PAGE_SIZE\|pageSize\|limit` |++`src/constants/routes.ts` has the route, `src/constants/query.ts` the param names,+`src/lib/authz/README.md` how a permission check resolves.++## The inventory++One table, in the story's PR or scratch notes:++| Endpoint | Feeds | States it can be in |+| --- | --- | --- |+| `GET /api/v1/x` | the header count | populated, zero, error |++Plus four short lists:++- **Query params** the page reads, and what each one switches.+- **Permission checks** the page makes, and what disappears when each is denied.+- **Preferences and flags** that change layout (dismissed banners, onboarding+ checklists, opt-in views).+- **Caps**: how many rows each list renders before it truncates or paginates.++A state that appears in this inventory and not in the controls panel is a bug in+the story.++## Pass 2: let it run++Write the story and an empty `defineStoryMocks({ controls: {} })`, point it at the+route with `layout: 'app'`, then open it (see verify.md). The console is the+oracle:++- `[storybook] no msw handler` or a 501 from the catch-all: an endpoint pass 1+ missed. Add it to the inventory.+- an msw unhandled-request warning: a request going to an origin the handlers do+ not answer on. handlers are declared against `http://localhost`.+- a spinner that never resolves with the Data control on `loaded`: a handler+ whose URL does not match what the page calls.+- the navigation overlay on mount: the page redirects, usually because `route`+ is wrong or a guard is failing on a permission the controls have not granted.++Repeat until the console is silent. Only then start declaring controls.diff --git a/.claude/skills/signoz-page-story/references/verify.md b/.claude/skills/signoz-page-story/references/verify.mdnew file mode 100644index 0000000000..661a9ca7f5--- /dev/null+++ b/.claude/skills/signoz-page-story/references/verify.md@@ -0,0 +1,110 @@+# Verifying a page story++A story is not done because it compiles. It is done when each control has been+seen changing the page and the console is silent.++## Run it++```bash+cd frontend && pnpm storybook --ci --quiet # :6006, background it+```++A newly added `.stories.tsx` takes a few seconds to appear in `index.json` on an+already-running server; an empty first poll is not a broken `stories` glob.++Story ids come from the meta title: `Pages/Services` → `pages-services`, plus the+story export in kebab-case. Render one story on its own:++```+http://localhost:6006/iframe.html?id=pages-services--default&viewMode=story+```++## Flip controls from the URL++Args are settable in the iframe URL, so a whole sweep runs headless without+touching the panel. Booleans go as `!true` / `!false`, numbers bare, arrays+indexed, several separated by `;`, and the theme through `globals`:++```+&args=services:0;apdex:poor;access:viewer;dataState:loading+&args=signals[0]:logs;signals[1]:traces+&globals=theme:light+```++That is the cheap way to check a control does something: load with and without+it, diff the page text.++## Drive it++Playwright lives in the repo's e2e workspace, so a scratch script can use it+directly:++```js+import pw from '<repo>/tests/e2e/node_modules/playwright/index.js';+const { chromium } = pw;++const browser = await chromium.launch();+const page = await browser.newPage();+const problems = [];+page.on('console', (m) => {+ if (m.type() === 'error' || m.type() === 'warning') problems.push(m.text());+});+page.on('pageerror', (e) => problems.push(e.message));++await page.goto(`${story}&args=services:0`, { waitUntil: 'networkidle' });+await page.locator('body').waitFor();+console.log((await page.locator('body').innerText()).slice(0, 1500), problems);+await browser.close();+```++Screenshots are worth taking for `Default` in both themes+(`&globals=theme:light`): text extraction does not catch an unstyled page.++## Gates++- **Console silent.** `[storybook] no msw handler`, a 501 from the catch-all, an+ msw unhandled-request warning, a React key or state warning: assume the story+ is wrong first. A warning that survives is sometimes the app's. Prove it by+ turning off the control that renders the widget and watching the warning go+ with it, and by finding the same component elsewhere doing it right. Then+ report the app bug in the PR. Never invent a field the API does not return to+ silence a warning.+- **No navigation overlay on mount.** "Navigation blocked in Storybook" on load+ means the page is trying to leave: wrong `route`, or a guard denying on a+ permission the controls did not grant.+- **Every control moves something.** Sweep them one at a time from the URL and+ diff the page text. A control with no diff is either wired to nothing or aimed+ at a widget that is not rendering. Some only show their effect after an+ interaction, such as a tab that has to be clicked or a select that has to be+ opened. Drive that interaction rather than calling the control unobservable.+- **Both themes render styled.** An unstyled page means the story is not inside+ the provider decorator, or `<body data-theme>` was lost.+- **Roles agree.** `<body data-signoz-story-role>` and+ `<body data-signoz-context-role>` disagreeing means the page reads a different+ `AppContext` than the story config fills.+- **The page's own navigation works.** Tabs, filters and pagination that write+ query params should re-render the page in place; only leaving the page belongs+ in the overlay.++## Then the usual++```bash+pnpm tsgo --noEmit+pnpm exec oxlint <changed files>+pnpm exec oxfmt --check <changed files>+```++There is no prettier in this repo. `pnpm exec prettier --check` fetches something+else, prints `Prettier: All files formatted correctly` and exits 254: a pass that is+not one.++## Common failures++| Symptom | Cause |+| --- | --- |+| endless spinner with Data on `loaded` | handler URL does not match the call; handlers answer on `http://localhost` |+| page renders but empty | response shape wrong; compare against the api module's type, not a guess |+| 501 in the console | endpoint nobody mocked; the catch-all is answering |+| new control missing from the panel | project-level control added; the tab needs a reload |+| control flips but nothing changes | the widget is gated by something else: a permission, a flag, a preference |+| shell disappears in `loading` | an endpoint the shell needs went through `response.json`; give it a plain resolver |diff --git a/.gitattributes b/.gitattributesindex 8c64395944..07848e4b7c 100644--- a/.gitattributes+++ b/.gitattributes@@ -1 +1,3 @@-*.css linguist-detectable=false\ No newline at end of file+*.css linguist-detectable=false+*.stories.mocks.tsx linguist-generated=true+**/__story_mockdata__/** linguist-generated=truediff --git a/frontend/.gitignore b/frontend/.gitignoreindex cfd8dac366..605e9252f3 100644--- a/frontend/.gitignore+++ b/frontend/.gitignore@@ -28,4 +28,8 @@ e2e/test-plan/saved-views/e2e/test-plan/service-map/e2e/test-plan/services/e2e/test-plan/traces/-e2e/test-plan/user-preferences/\ No newline at end of file+e2e/test-plan/user-preferences/++# Storybook+/storybook-static/+debug-storybook.logdiff --git a/frontend/.storybook/main.ts b/frontend/.storybook/main.tsnew file mode 100644index 0000000000..d746bc5eca--- /dev/null+++ b/frontend/.storybook/main.ts@@ -0,0 +1,89 @@+import { dirname, resolve } from 'path';+import { fileURLToPath } from 'url';+import type { StorybookConfig } from '@storybook/react-vite';+import type { Plugin, PluginOption } from 'vite';++const srcPath = resolve(dirname(fileURLToPath(import.meta.url)), '../src');++/**+ * Modules replaced for every story. Same idea as `moduleNameMapper` in+ * `jest.config.ts`: the app keeps importing its own paths, Storybook resolves+ * them to a mock. Regexes so only exact specifiers match: `lib/history` must+ * not catch `lib/historyUtils`.+ *+ * Each replacement is typed as the module it stands in for, so drift is a+ * compile error rather than a story that fails at render. The `jest` note on+ * each entry is where the same import lands under the other runner. The two+ * only diverge where the runner needs them to.+ */+const mockAliases = [+ {+ // jest: not replaced, jsdom drives a real browser history.+ find: /^(?:src\/)?lib\/history$/,+ replacement: `${srcPath}/storybook/navigation/history.alias.ts`,+ },+ {+ // jest: src/__tests__/logEventMock.ts+ find: /^(?:src\/)?api\/common\/logEvent$/,+ replacement: `${srcPath}/storybook/mocks/logEvent.mock.ts`,+ },+ {+ // jest: __mocks__/env.ts, which leaves `baseURL` empty because jsdom already+ // resolves a relative `/api/...` against `http://localhost`.+ find: /^(?:src\/)?constants\/env$/,+ replacement: `${srcPath}/storybook/mocks/env.mock.ts`,+ },+];++/**+ * Plugins from `vite.config.ts` that either target the app's `index.html` or+ * only pay off in a production build.+ */+const EXCLUDED_PLUGINS = [+ 'vite-plugin-checker',+ 'dev-base-path',+ 'dev-boot-data',+ 'vite-plugin-image-optimizer',+ 'vite-plugin-compression',+];++const isExcluded = (plugin: PluginOption): boolean =>+ !!plugin &&+ typeof plugin === 'object' &&+ 'name' in plugin &&+ EXCLUDED_PLUGINS.includes((plugin as Plugin).name);++const config: StorybookConfig = {+ framework: '@storybook/react-vite',+ stories: ['../src/**/*.stories.@(ts|tsx)'],+ // `../public` carries the fonts, icons and i18n bundles the app expects at+ // the root; `./public` carries the msw worker, which must not ship in a+ // production build.+ staticDirs: ['../public', './public'],+ addons: ['@storybook/addon-a11y'],+ core: { disableTelemetry: true },+ viteFinal: async (viteConfig) => {+ const plugins = (viteConfig.plugins ?? [])+ .flat(Infinity as 1)+ .filter((plugin) => !isExcluded(plugin as PluginOption));++ const existingAlias = viteConfig.resolve?.alias;+ const normalizedAlias = Array.isArray(existingAlias)+ ? existingAlias+ : Object.entries(existingAlias ?? {}).map(([find, replacement]) => ({+ find,+ replacement: replacement as string,+ }));++ return {+ ...viteConfig,+ plugins,+ resolve: {+ ...viteConfig.resolve,+ alias: [...mockAliases, ...normalizedAlias],+ },+ };+ },+};++export default config;diff --git a/frontend/.storybook/preview-head.html b/frontend/.storybook/preview-head.htmlnew file mode 100644index 0000000000..aa2cad3319--- /dev/null+++ b/frontend/.storybook/preview-head.html@@ -0,0 +1,24 @@+<link rel="preconnect" href="https://fonts.googleapis.com" />+<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+<link+ href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"+ rel="stylesheet"+/>+<link rel="stylesheet" href="css/uPlot.min.css" />++<script>+ // i18n's language detector would pick the browser locale (e.g. `en-US`), which+ // /public/locales does not ship; pin it to the bundled language instead.+ window.localStorage.setItem('i18nextLng', 'en');++ // The Go backend injects this at boot; every integration it enables is off in+ // Storybook so no third-party script loads inside the iframe.+ window.signozBootData = {+ settings: {+ posthog: { enabled: false, apiHost: '', key: '', uiHost: '' },+ appcues: { enabled: false, appId: '' },+ sentry: { enabled: false, dsn: '', tunnel: '' },+ pylon: { enabled: false, appId: '', identitySecret: '' },+ },+ };+</script>diff --git a/frontend/.storybook/preview.tsx b/frontend/.storybook/preview.tsxnew file mode 100644index 0000000000..c2874fd8a9--- /dev/null+++ b/frontend/.storybook/preview.tsx@@ -0,0 +1,110 @@+import type { Preview } from '@storybook/react-vite';+import type { SetupWorker } from 'msw';+import { setupWorker } from 'msw';++import { withProviders } from '../src/storybook/decorators/withProviders';+import { globalMocks } from '../src/storybook/globals';+import { resetStoryHistory } from '../src/storybook/navigation/containment';+import { clearBlockedNavigations } from '../src/storybook/navigation/blockedNavigationStore';+import {+ resolveStory,+ type StoryRuntimeContext,+} from '../src/storybook/runtime/resolveStory';++import '../src/ReactI18';++import '../src/styles.scss';++import '../src/storybook/storybook-root.scss';++interface StorybookWorkerHolder {+ __signozStorybookWorker?: StorybookWorker;+}++const holder = window as unknown as StorybookWorkerHolder;++/**+ * One worker per page, even if this module is re-executed by HMR. Two live+ * workers both answer the service worker and the story gets whichever replies+ * first.+ */+interface StorybookWorker {+ worker: SetupWorker;+ ready: Promise<unknown>;+}++const { worker, ready } = (holder.__signozStorybookWorker ??=+ ((): StorybookWorker => {+ const instance = setupWorker();++ return {+ worker: instance,+ ready: instance.start({+ serviceWorker: { url: './mockServiceWorker.js' },+ // Storybook's own traffic (index.json, HMR, telemetry) goes unhandled by+ // design; only flag the app's API calls so a missing handler is obvious.+ onUnhandledRequest: (request, print): void => {+ const url = new URL(request.url.href);+ const isStaticAsset =+ /\.(?:woff2?|ttf|otf|css|js|map|png|jpe?g|svg|webp|ico)$/.test(+ url.pathname,+ );+ const isAppRequest =+ !isStaticAsset &&+ (url.pathname.startsWith('/api/') || url.host !== window.location.host);++ if (isAppRequest) {+ print.warning();+ }+ },+ }),+ };+ })());++const preview: Preview = {+ parameters: {+ layout: 'fullscreen',+ controls: { expanded: true },+ },+ globalTypes: {+ theme: {+ description: 'SigNoz color scheme',+ toolbar: {+ title: 'Theme',+ icon: 'paintbrush',+ items: [+ { value: 'dark', title: 'Dark' },+ { value: 'light', title: 'Light' },+ ],+ dynamicTitle: true,+ },+ },+ },+ initialGlobals: { theme: 'dark' },+ // Controls every story carries: permissions, banners, and whether the page's+ // own endpoints answer, hang or fail.+ args: globalMocks.args,+ argTypes: globalMocks.argTypes,+ decorators: [withProviders],+ loaders: [+ // Runs on every render, args changes included, and ahead of the decorators:+ // the whole story world is put in place here, so the provider tree only has+ // to read it. Re-registering the handlers per render also means an edit to a+ // handler module takes effect on the next render instead of leaving the+ // worker on the set it was created with.+ async (context): Promise<void> => {+ const world = resolveStory(context as unknown as StoryRuntimeContext);++ world.apply();+ world.install(worker);++ await ready;+ },+ ],+ beforeEach: () => {+ clearBlockedNavigations();+ resetStoryHistory();+ },+};++export default preview;diff --git a/frontend/.storybook/public/mockServiceWorker.js b/frontend/.storybook/public/mockServiceWorker.jsnew file mode 100644index 0000000000..51d85eeebf--- /dev/null+++ b/frontend/.storybook/public/mockServiceWorker.js@@ -0,0 +1,303 @@+/* eslint-disable */+/* tslint:disable */++/**+ * Mock Service Worker (1.3.2).+ * @see https://github.com/mswjs/msw+ * - Please do NOT modify this file.+ * - Please do NOT serve this file on production.+ */++const INTEGRITY_CHECKSUM = '3d6b9f06410d179a7f7404d4bf4c3c70'+const activeClientIds = new Set()++self.addEventListener('install', function () {+ self.skipWaiting()+})++self.addEventListener('activate', function (event) {+ event.waitUntil(self.clients.claim())+})++self.addEventListener('message', async function (event) {+ const clientId = event.source.id++ if (!clientId || !self.clients) {+ return+ }++ const client = await self.clients.get(clientId)++ if (!client) {+ return+ }++ const allClients = await self.clients.matchAll({+ type: 'window',+ })++ switch (event.data) {+ case 'KEEPALIVE_REQUEST': {+ sendToClient(client, {+ type: 'KEEPALIVE_RESPONSE',+ })+ break+ }++ case 'INTEGRITY_CHECK_REQUEST': {+ sendToClient(client, {+ type: 'INTEGRITY_CHECK_RESPONSE',+ payload: INTEGRITY_CHECKSUM,+ })+ break+ }++ case 'MOCK_ACTIVATE': {+ activeClientIds.add(clientId)++ sendToClient(client, {+ type: 'MOCKING_ENABLED',+ payload: true,+ })+ break+ }++ case 'MOCK_DEACTIVATE': {+ activeClientIds.delete(clientId)+ break+ }++ case 'CLIENT_CLOSED': {+ activeClientIds.delete(clientId)++ const remainingClients = allClients.filter((client) => {+ return client.id !== clientId+ })++ // Unregister itself when there are no more clients+ if (remainingClients.length === 0) {+ self.registration.unregister()+ }++ break+ }+ }+})++self.addEventListener('fetch', function (event) {+ const { request } = event+ const accept = request.headers.get('accept') || ''++ // Bypass server-sent events.+ if (accept.includes('text/event-stream')) {+ return+ }++ // Bypass navigation requests.+ if (request.mode === 'navigate') {+ return+ }++ // Opening the DevTools triggers the "only-if-cached" request+ // that cannot be handled by the worker. Bypass such requests.+ if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {+ return+ }++ // Bypass all requests when there are no active clients.+ // Prevents the self-unregistered worked from handling requests+ // after it's been deleted (still remains active until the next reload).+ if (activeClientIds.size === 0) {+ return+ }++ // Generate unique request ID.+ const requestId = Math.random().toString(16).slice(2)++ event.respondWith(+ handleRequest(event, requestId).catch((error) => {+ if (error.name === 'NetworkError') {+ console.warn(+ '[MSW] Successfully emulated a network error for the "%s %s" request.',+ request.method,+ request.url,+ )+ return+ }++ // At this point, any exception indicates an issue with the original request/response.+ console.error(+ `\+[MSW] Caught an exception from the "%s %s" request (%s). This is probably not a problem with Mock Service Worker. There is likely an additional logging output above.`,+ request.method,+ request.url,+ `${error.name}: ${error.message}`,+ )+ }),+ )+})++async function handleRequest(event, requestId) {+ const client = await resolveMainClient(event)+ const response = await getResponse(event, client, requestId)++ // Send back the response clone for the "response:*" life-cycle events.+ // Ensure MSW is active and ready to handle the message, otherwise+ // this message will pend indefinitely.+ if (client && activeClientIds.has(client.id)) {+ ;(async function () {+ const clonedResponse = response.clone()+ sendToClient(client, {+ type: 'RESPONSE',+ payload: {+ requestId,+ type: clonedResponse.type,+ ok: clonedResponse.ok,+ status: clonedResponse.status,+ statusText: clonedResponse.statusText,+ body:+ clonedResponse.body === null ? null : await clonedResponse.text(),+ headers: Object.fromEntries(clonedResponse.headers.entries()),+ redirected: clonedResponse.redirected,+ },+ })+ })()+ }++ return response+}++// Resolve the main client for the given event.+// Client that issues a request doesn't necessarily equal the client+// that registered the worker. It's with the latter the worker should+// communicate with during the response resolving phase.+async function resolveMainClient(event) {+ const client = await self.clients.get(event.clientId)++ if (client?.frameType === 'top-level') {+ return client+ }++ const allClients = await self.clients.matchAll({+ type: 'window',+ })++ return allClients+ .filter((client) => {+ // Get only those clients that are currently visible.+ return client.visibilityState === 'visible'+ })+ .find((client) => {+ // Find the client ID that's recorded in the+ // set of clients that have registered the worker.+ return activeClientIds.has(client.id)+ })+}++async function getResponse(event, client, requestId) {+ const { request } = event+ const clonedRequest = request.clone()++ function passthrough() {+ // Clone the request because it might've been already used+ // (i.e. its body has been read and sent to the client).+ const headers = Object.fromEntries(clonedRequest.headers.entries())++ // Remove MSW-specific request headers so the bypassed requests+ // comply with the server's CORS preflight check.+ // Operate with the headers as an object because request "Headers"+ // are immutable.+ delete headers['x-msw-bypass']++ return fetch(clonedRequest, { headers })+ }++ // Bypass mocking when the client is not active.+ if (!client) {+ return passthrough()+ }++ // Bypass initial page load requests (i.e. static assets).+ // The absence of the immediate/parent client in the map of the active clients+ // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet+ // and is not ready to handle requests.+ if (!activeClientIds.has(client.id)) {+ return passthrough()+ }++ // Bypass requests with the explicit bypass header.+ // Such requests can be issued by "ctx.fetch()".+ if (request.headers.get('x-msw-bypass') === 'true') {+ return passthrough()+ }++ // Notify the client that a request has been intercepted.+ const clientMessage = await sendToClient(client, {+ type: 'REQUEST',+ payload: {+ id: requestId,+ url: request.url,+ method: request.method,+ headers: Object.fromEntries(request.headers.entries()),+ cache: request.cache,+ mode: request.mode,+ credentials: request.credentials,+ destination: request.destination,+ integrity: request.integrity,+ redirect: request.redirect,+ referrer: request.referrer,+ referrerPolicy: request.referrerPolicy,+ body: await request.text(),+ bodyUsed: request.bodyUsed,+ keepalive: request.keepalive,+ },+ })++ switch (clientMessage.type) {+ case 'MOCK_RESPONSE': {+ return respondWithMock(clientMessage.data)+ }++ case 'MOCK_NOT_FOUND': {+ return passthrough()+ }++ case 'NETWORK_ERROR': {+ const { name, message } = clientMessage.data+ const networkError = new Error(message)+ networkError.name = name++ // Rejecting a "respondWith" promise emulates a network error.+ throw networkError+ }+ }++ return passthrough()+}++function sendToClient(client, message) {+ return new Promise((resolve, reject) => {+ const channel = new MessageChannel()++ channel.port1.onmessage = (event) => {+ if (event.data && event.data.error) {+ return reject(event.data.error)+ }++ resolve(event.data)+ }++ client.postMessage(message, [channel.port2])+ })+}++function sleep(timeMs) {+ return new Promise((resolve) => {+ setTimeout(resolve, timeMs)+ })+}++async function respondWithMock(response) {+ await sleep(response.delay)+ return new Response(response.body, response)+}diff --git a/frontend/README.md b/frontend/README.mdindex 591334988b..9f33e0f934 100644--- a/frontend/README.md+++ b/frontend/README.md@@ -88,6 +88,17 @@ pnpm testpnpm tsgo --noEmit```+## Storybook++```bash+pnpm storybook+```++Opens [http://localhost:6006](http://localhost:6006). Pages run against msw+mocks with no backend; query-param navigation works inside a story, leaving the+page is blocked. See [`src/storybook/README.md`](src/storybook/README.md) for the+override surface.+## Linting```bashdiff --git a/frontend/package.json b/frontend/package.jsonindex c1f53910b3..fd47655a77 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -7,6 +7,8 @@"preinstall": "npx only-allow pnpm","i18n:generate-hash": "node ./i18-generate-hash.cjs","dev": "vite",+ "storybook": "storybook dev -p 6006",+ "storybook:build": "storybook build -o storybook-static","build": "vite build","preview": "vite preview","prettify": "oxfmt",@@ -158,6 +160,9 @@"@commitlint/config-conventional": "20.4.4","@jest/globals": "30.4.1","@jest/types": "30.2.0",+ "@storybook/addon-a11y": "10.5.9",+ "@storybook/react-vite": "10.5.9",+ "@testing-library/dom": "8.20.0","@testing-library/jest-dom": "5.16.5","@testing-library/react": "13.4.0","@testing-library/user-event": "14.4.3",@@ -203,6 +208,7 @@"redux-mock-store": "1.5.4","sass": "1.97.3","sharp": "0.35.0",+ "storybook": "10.5.9","stylelint": "17.7.0","svgo": "4.0.2","ts-jest": "29.4.9",diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yamlindex 52785cc3e3..a18e1b6858 100644--- a/frontend/pnpm-lock.yaml+++ b/frontend/pnpm-lock.yaml@@ -356,6 +356,15 @@ importers:'@jest/types':specifier: 30.2.0version: 30.2.0+ '@storybook/addon-a11y':+ specifier: 10.5.9+ version: 10.5.9([email protected](@types/[email protected])([email protected])([email protected]))+ '@storybook/react-vite':+ specifier: 10.5.9+ version: 10.5.9(@types/[email protected])(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected]))([email protected])+ '@testing-library/dom':+ specifier: 8.20.0+ version: 8.20.0'@testing-library/jest-dom':specifier: 5.16.5version: 5.16.5@@ -491,6 +500,9 @@ importers:sharp:specifier: 0.35.0version: 0.35.0+ storybook:+ specifier: 10.5.9stylelint:specifier: 17.7.0version: 17.7.0([email protected])@@ -524,6 +536,9 @@ packages:'@adobe/[email protected]':resolution: {integrity: sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ==}+ '@adobe/[email protected]':+ resolution: {integrity: sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==}+'@ant-design/[email protected]':resolution: {integrity: sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ==}@@ -1470,18 +1485,33 @@ packages:peerDependencies:react: '>=16.8.0'+ '@emnapi/[email protected]':+ resolution: {integrity: sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==}+'@emnapi/[email protected]':resolution: {integrity: sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==}+ '@emnapi/[email protected]':+ resolution: {integrity: sha512-UC+ZhH3XtczQYfOlu3lNEkdW/p4dsJ1r/bP7H8+rhao3TTTMO1ATq/4DdIi23XuGoFY+Cz0JmCbdVl0hz9jZcA==}+'@emnapi/[email protected]':resolution: {integrity: sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==}'@emnapi/[email protected]':resolution: {integrity: sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==}+ '@emnapi/[email protected]':+ resolution: {integrity: sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw==}+'@emnapi/[email protected]':resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==}+ '@emnapi/[email protected]':+ resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==}++ '@emnapi/[email protected]':+ resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==}+'@emotion/[email protected]':resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==}@@ -2050,6 +2080,15 @@ packages:resolution: {integrity: sha512-f1x/vJXIfjOlEmejYpbkbgw1gOqpPECwMvMEtBqe47j7H2Hg8h8w3o3ikhSXq3MI15kg+oQ0exWO0uCtTNJLoQ==}engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0}+ '@joshwooding/[email protected]':+ resolution: {integrity: sha512-qvsTEwEFefhdirGOPnu9Wp6ChfIwy2dBCRuETU3uE+4cC+PFoxMSiiEhxk4lOluA34eARHA0OxqsEUYDqRMgeQ==}+ peerDependencies:+ typescript: '>= 4.3.x'+ vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0+ peerDependenciesMeta:+ typescript:+ optional: true+'@jridgewell/[email protected]':resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}@@ -2137,6 +2176,13 @@ packages:'@napi-rs/[email protected]':resolution: {integrity: sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==}+ '@napi-rs/[email protected]':+ resolution: {integrity: sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q==}+ engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}+ peerDependencies:+ '@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4+ '@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4+'@nodelib/[email protected]':resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}engines: {node: '>= 8'}@@ -2190,6 +2236,133 @@ packages:'@orval/[email protected]':resolution: {integrity: sha512-MV75Xzz28W3ZttloNNmdTPa96AneY8FZExEwxmcySdY7lirJtErsqXt2EHnorETDAVEvSldVszhWG/AXpFBAPg==}+ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-0LC7ye4hvqbIKxAzThzvswgHLFu2AURKzYLeSVvLdu2TBOYWQDmHnTqPLeA597BcUCxiLqLsS4CJ5uoI5WYWCQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [android]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-b5jtVTH6AU5CJXHNdj7Jj9IEiR9yVjjnwHzPJhGyHGPdcsZSzBCkS9GBbV33niRMvKthDwQRFRJfI4a+k4PvYg==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [android]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-obCE8B7ISKkJidjlhv9xRGJPOSDG2Yu6PRga9Ruaz35uintHxbp1Ki/Yc71wx4rj3Edrm0a1kzG1TAwit0wFpg==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [darwin]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-JL6Xb5IwPQT8rUzlpsX7E+AgfcdNklXNPFp8pjCQQ5MQOQo5rtEB2ui+3Hgg9Sn7Y9Egj6YOLLiHhLpdAe12Aw==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [darwin]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-SDQ/3MQFw58fqQz3Z1PhSKFF3JoCF4gmlNjziDm8X02tTahCw0qJbd7FGPDKw1i4VTBZene9JPyC3mHtSvi+wA==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [freebsd]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-Av+D1MIqzV0YMGPT9we2SIZaMKD7Cxs4CvXSx/yxaWHewZjYEjScpOf5igc8IILASViw4WTnjlwUdI1KzVtDHQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [linux]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-Cs2fdJ8cPpFdeebj6p4dag8A4+56hPvZ0AhQQzlaLswGz1tz7bXt1nETLeorrM9+AMcWFFkqxcXwDGfTVidY8g==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm]+ os: [linux]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-qdOfTcT6SY8gsJrrV92uyEUyjqMGPpIB5JZUG6QN5dukYd+7/j0kX6MwK1DgQj39jtUYixxPiaRUiEN1+0CXgQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-EoTCZneNFU/P2qrpEM+RHmQwt+CvDkyGESG6qhr7KaegXLZwePfbrkCDfAk8/rhxbDUVGsZILX+2tqPzFtoFWA==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-zALjmZYgxFLHjXeudcDF0xFGNydTAtkAeXAr2EuC17ywCyFxcmQra4w0BMde0Yi/re4Bi4iwEoEXtYN7l6eBLQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [ppc64]+ os: [linux]+ libc: [glibc]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-fPP8M6zQLS7Jz7o9d5ArUSuAuSK3e+WCYVrCpdzeCOejidtZExJ9tjhDrAd3HEPqARBCPmdpqxESPFqy44vkBQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [riscv64]+ os: [linux]+ libc: [glibc]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-7IcC4Ao02oGpfnjt+X/oF4U2mllo2qoSkw5xxiXNKL9MCTsTiAC6616beOuehdxGcnz1bRoPC1RQ2f1GQDdN+g==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [riscv64]+ os: [linux]+ libc: [musl]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-pbXIhiNFHoqWeqDNLiJ9JkpHz1IM9k4DXa66x+1GTWMG7iLxtkXgE53iiuKSXwmk3zIYmaPVfBvgcAhS583K4Q==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [s390x]+ os: [linux]+ libc: [glibc]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-MYCguB9RvBvlSd6gbuNI7QwiLoCCAlGnlRJFPrzLI6U1/9wkC/WK6LtBAUln55H1Ctqw45PWmqrobKoMhsYQzQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-5eY0B/bxf1xIUxb4NOTvOI3KWtBQfPWYyKAzgcrCt0mDibSZygVpO1Pz8bkeiSZ5Jj9+M09dkggG3H8I5d0Uyg==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-Gld0ajrFTUXNtdw20fVBuTQx66FA75nIVg+//pPfR3sXkuABB4mTBhl3r9JNzrJpgW//qiwxf0nWXUWGJSL3UQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [openharmony]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-T6KVD7rhLzFlwGRXMnxUFfkCZD8FHnb968wVXW1mXzgRFc5RNXOBY2mPPDZ77x5Ln76ltLMgtPg0cOkU1NSrEQ==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [wasm32]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-Ujvw4X+LD1CCGULcsQcvb4YNVoBGqt+JHgNNzGGaCImELiZLk477ifUH53gIbE7EKd933NdTi25JWEr9K2HwXw==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [arm64]+ os: [win32]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-0cwxKO7KHQQQfo4Uf4B2SQrhgm+cJaP9OvFFhx52Tkg4bezsacu83GB2/In5bC415Ueeym+kXdnge/57rbSfTw==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [ia32]+ os: [win32]++ '@oxc-parser/[email protected]':+ resolution: {integrity: sha512-rOrnSQSCbhI2kowr9XxE7m9a8oQXnBHjnS6j95LxxAnEZ0+Fz20WlRXG4ondQb+ejjt2KOsa65sE6++L6kUd+w==}+ engines: {node: ^20.19.0 || >=22.12.0}+ cpu: [x64]+ os: [win32]+'@oxc-project/[email protected]':resolution: {integrity: sha512-t3qpfVZIqSiLQ5Kqt/MC4Ge/WCOGrrcagAdzTcDaggupjiGxUx4nJF2v6wUCXWSzWHn5Ns7XLv13fCJEwCOERQ==}engines: {node: ^20.19.0 || >=22.12.0}@@ -2197,6 +2370,112 @@ packages:'@oxc-project/[email protected]':resolution: {integrity: sha512-nuFhqlUzJX+gVIPPfuE6xurd4lST3mdcWOhyK/rZO0B9XWMKm79SuszIQEnSMmmDhq1DC8WWVYGVd+6F93o1gQ==}+ '@oxc-project/[email protected]':+ resolution: {integrity: sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ==}++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-y09e0L0SRI2OA2tUIrjBgoV3eH5hvUKXNkJqXmNo5V2WxIjyC7I7aJfRLMEVpA8yi95f90gFDvO0VMgrDw+vwA==}+ cpu: [arm]+ os: [android]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-cl4icWaZFnLdg8m6qtnh5rBMuGbxc/ptStFHLeCNwr+2cZjkjNwQu/jYRS0CHlnPecOJMpuS5M6/BH+0J/YkEg==}+ cpu: [arm64]+ os: [android]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-At29QEMF6HajbQvgY8K6OXnHD1x9rad74xBEfmCB6ZqCGsdq75aK7tOYcTbOanMy8qdIBrfL3SMr3p/lfSlb9w==}+ cpu: [arm64]+ os: [darwin]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-A5Kqr1EUj4oIL5CF4WRssq/o5P0Y11cwoFouMRmQ7YnC/A8V93nv1nb7aSU8HwcgmXropjLNkVTl4MN87cu28Q==}+ cpu: [x64]+ os: [darwin]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-R5xkRBRRz7ceH/P5Jrc6G7FmdUdgpLYyESFAUDVTNQ9K0sGPxcp4ljiwEwEqsvNcQ4sYbMRrWcHHBCu7ksAJVw==}+ cpu: [x64]+ os: [freebsd]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-k/RuYL4L/R58IBn3wT5ma3Wh4k62bp1eYCFRWCmMsasUOqL+H6sW0VGFadEzKWXFFlz+2uIMoeMk9ySSZJHgbg==}+ cpu: [arm]+ os: [linux]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-bnHAak3ujYfH5pKk4NieFNbvYvernfoQDgwLddbZ3OtMYrem87/qjlA+u+aKG0oZcqSLGCful/6/CEA+aeAgaA==}+ cpu: [arm]+ os: [linux]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA==}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw==}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA==}+ cpu: [ppc64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw==}+ cpu: [riscv64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w==}+ cpu: [riscv64]+ os: [linux]+ libc: [musl]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ==}+ cpu: [s390x]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg==}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw==}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-MvyGik3a6pVgZ0t/kWlbmFxFLmXQJwgLsY2eYFHLpy0wGwRbfzeIGgDwQ3kXqE30z+kSXennRkCrT7TUvkptNg==}+ cpu: [arm64]+ os: [openharmony]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-vHcssMPwO08RTvj/c0iOBz90attxyG3wQJ0dTcyEQK43LRpcdLWZlV5feBhv6Isn6ahbQIzHbCgfa81+RiML0Q==}+ engines: {node: '>=14.0.0'}+ cpu: [wasm32]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-uokJqro2iBqkFvJdKQLP7d8/BUmFwESQFVmIJUQKj1Xn1a/LysJoe1vmeECLF5b3jsV8CAL5sEMJXX6SdK9Nhg==}+ cpu: [arm64]+ os: [win32]++ '@oxc-resolver/[email protected]':+ resolution: {integrity: sha512-UqGPmo56KDfLlfXFAFIrNflHT8tFxWGEivWg3Zeyp4Uy2NlKN1FGPr6/BxcLGG3+kZ6Wp14g5Uj+n71boqZfiw==}+ cpu: [x64]+ os: [win32]+'@oxfmt/[email protected]':resolution: {integrity: sha512-NAtpl/SiaeU103e7/OmZw0MvUnsUUopW7hEm/ecegJg7YM0skQaA0IXEZoyTV6NUdiNPupdIUreRqUZTShbn/g==}engines: {node: ^20.19.0 || >=22.12.0}@@ -3226,6 +3505,15 @@ packages:resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==}engines: {node: '>= 8.0.0'}+ '@rollup/[email protected]':+ resolution: {integrity: sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==}+ engines: {node: '>=14.0.0'}+ peerDependencies:+ rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0+ peerDependenciesMeta:+ rollup:+ optional: true+'@scalar/[email protected]':resolution: {integrity: sha512-Pi1GAl8jO6ungmGj2sjDfCfqiBNrKW6HXDZmminV94ybGU/KtRLOqHwd0n9FIhY3j0RYGpGC0VCuniCICfQPHg==}engines: {node: '>=22'}@@ -3424,6 +3712,86 @@ packages:'@standard-schema/[email protected]':resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==}+ '@storybook/[email protected]':+ resolution: {integrity: sha512-MvXkoJIVRcZrqhWi+wynYAmFkvTWm5aHdJfYohhgPeEJVDRF91zejtOsN7zPRE/lQvBDY+IiomKxeRN3UhWNVw==}+ peerDependencies:+ storybook: ^10.5.9++ '@storybook/[email protected]':+ resolution: {integrity: sha512-Zg4JbGQiHFPGlFJ9HM+XPgzKmU/RFPCymhohVRJhBBYfmgaQgz0flWWzscseCDpl638MNd8/r/H+nwuoBgSYDg==}+ peerDependencies:+ storybook: ^10.5.9+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0++ '@storybook/[email protected]':+ resolution: {integrity: sha512-4H5QIHQVtQYCuL43GCRLGjNQhZpQg9gL03ja0DV80kO2Dn9LEt6ol87bSnSjn4VDgcAXtgTzXFvRLknfVgAAqg==}+ peerDependencies:+ esbuild: '>=0.28.1 <0.29.0'+ rollup: '*'+ storybook: ^10.5.9+ vite: '*'+ webpack: '*'+ peerDependenciesMeta:+ esbuild:+ optional: true+ rollup:+ optional: true+ vite:+ optional: true+ webpack:+ optional: true++ '@storybook/[email protected]':+ resolution: {integrity: sha512-FcOqPAXACP0I3oJ/ws6/rrPT9WGhu915Cg8D02a9YxLo0DE9zI+a9A5gRGvmQ09fiWPukqI8ZAEoQEdWUKMQdQ==}++ '@storybook/[email protected]':+ resolution: {integrity: sha512-Fxh9vYpX9bQqFeHRiY8h2ApeRGDzRSMLwJwNZ/AIRqnyOKHxRKL+yFe+ctEkVJmuptRE9u1Hrn8ZZNHyfDKKNg==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0++ '@storybook/[email protected]':+ resolution: {integrity: sha512-7qZD6CSa64p1m/zX9tG4ALcEHlEk0Bx+5++4RL3MFlRCgCFfAomXsCHTzF0RyF8cI4vl+hS7Y0ryjQchVs6UQA==}+ peerDependencies:+ '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ '@types/react-dom': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ storybook: ^10.5.9+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true++ '@storybook/[email protected]':+ resolution: {integrity: sha512-mDI+UssrOEP8IwgBsefLG+gqW1gZbZEPbpH5PoHK/P1WPi8BfrLEqrFi9H9wmMkal/Vh8SmL1awgOi0ir3XwcQ==}+ peerDependencies:+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ storybook: ^10.5.9+ typescript: '>= 4.9.x'+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0+ peerDependenciesMeta:+ typescript:+ optional: true++ '@storybook/[email protected]':+ resolution: {integrity: sha512-kApGOuNT26NkpioTsr1iT/Q2c44tA7OIsNUSyFqtT7W8k3fRn/jQWfrDegYxty0WG0wxdNMZq2ndRfOOF8HaHw==}+ peerDependencies:+ '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ '@types/react-dom': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ storybook: ^10.5.9+ typescript: '>= 4.9.x'+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ typescript:+ optional: true+'@tanstack/[email protected]':resolution: {integrity: sha512-5nNMTSETP4ykGegmVkhjcS8tTLW6Vl4axfEGQN3v0zdHYbK4UfoqfPChclTrJ4EoK9QynqAu9oUf8VEmrpZ5Ww==}engines: {node: '>=12'}@@ -3453,6 +3821,10 @@ packages:'@tanstack/[email protected]':resolution: {integrity: sha512-bp+v10y65sp2H7WpWfIMyxTNfl8ZVfxFTLRjPIFRryi6FV/J33z4IS53WO4pTk36KlvJ4iLiQz+oaydDC1xbcA==}+ '@testing-library/[email protected]':+ resolution: {integrity: sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==}+ engines: {node: '>=18'}+'@testing-library/[email protected]':resolution: {integrity: sha512-d9ULIT+a4EXLX3UU8FBjauG9NnsZHkHztXoIcTsOKoOw030fyjheN9svkTULjJxtYag9DZz5Jz5qkWZDPxTFwA==}engines: {node: '>=12'}@@ -3461,6 +3833,10 @@ packages:resolution: {integrity: sha512-N5ixQ2qKpi5OLYfwQmUb/5mSV9LneAcaUfp32pn4yCnpb8r/Yz0pXFPck21dIicKmi+ta5WRAknkZCfA8refMA==}engines: {node: '>=8', npm: '>=6', yarn: '>=1'}+ '@testing-library/[email protected]':+ resolution: {integrity: sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==}+ engines: {node: '>=14', npm: '>=6', yarn: '>=1'}+'@testing-library/[email protected]':resolution: {integrity: sha512-sXOGON+WNTh3MLE9rve97ftaZukN3oNf2KjDy7YTx6hcTO2uuLHuCGynMDhFwGw/jYf4OJ2Qk0i4i79qMNNkyw==}engines: {node: '>=12'}@@ -3474,6 +3850,12 @@ packages:peerDependencies:'@testing-library/dom': '>=7.21.4'+ '@testing-library/[email protected]':+ resolution: {integrity: sha512-Jbs9FpkkIDw8FgSc6kOVsOv8JuuqGAL7J4X1oot77JxAoDlkNn2GRkd0aYRVuQ+pVQAiHWVkE4rX/dkF5fBiCw==}+ engines: {node: '>=12', npm: '>=6'}+ peerDependencies:+ '@testing-library/dom': '>=7.21.4'+'@tootallnate/[email protected]':resolution: {integrity: sha512-HqmEUIGRJ5fSXchkVgR5F7qn48bDBzv0kWj/Kfu5e6uci4UlEeng4331LnBkWffb++Ei3FOVLxo8JJWMFBDMeQ==}engines: {node: '>= 10'}@@ -3496,6 +3878,9 @@ packages:'@tybys/[email protected]':resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==}+ '@tybys/[email protected]':+ resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}+'@types/[email protected]':resolution: {integrity: sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==}@@ -3511,6 +3896,12 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-enCvTL8m/EHS/zIvJno9nE+ndYPh1/oNFzRYRmtUqJICG2VnCSBzMLW5VN2KCQU91f23tsNKR8v7VJJQMatl7Q==}+ '@types/[email protected]':+ resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}++ '@types/[email protected]':+ resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}+'@types/[email protected]':resolution: {integrity: sha512-m7GG7IKKGuJUXvkZ1qqG3ChccdIM/qBBo913z+Xft0nKCX4hAU/IxKwZBU4cpRZ7GS5kV4vOblUkILtSShCPXQ==}@@ -3568,6 +3959,12 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-8Hz50m2eoS56ldRlepxSBa6PWEVCtzUo/92HgLc2qTMnotJNIm7xP+UZhyWoYsyOdd5dxZ+NZLb24rsKyFs2ow==}+ '@types/[email protected]':+ resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-eOIHzCUSH7SMfonMG1LsC2f8vxBFtho6NGBznK41R84YzPuvSBzrhEps33IsQiOW9+VL6NQ9DbjQJznk/S4uRA==}+'@types/[email protected]':resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==}@@ -3694,6 +4091,9 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-53nDnXba4M7aOJsRod8HKENDC9M2ccm19yZcXImoP15oDLuBru+Q+WKWOCQwKYOC1S/6AJx58mFp8kd4s8q1rQ==}+ '@types/[email protected]':+ resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==}+'@types/[email protected]':resolution: {integrity: sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==}@@ -3975,6 +4375,21 @@ packages:peerDependencies:vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0+ '@vitest/[email protected]':+ resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==}++ '@webcontainer/[email protected]':+ resolution: {integrity: sha512-6aN99yL695Hi9SuIk1oC88l9o0gmxL1nGWWQ/kNy81HigJ0FoaoTXpytCj6ItzgyCEwA9kF1wixsTuv5cjsgng==}+'@xmldom/[email protected]':resolution: {integrity: sha512-KRYzxepc14G/CEpEGc3Yn+JKaAeT63smlDr+vjB8jRfgTBBI9wRj/nkQEO+ucV8p8I9bfKLWp37uHgFrbntPvw==}engines: {node: '>=10.0.0'}@@ -4103,6 +4518,9 @@ packages:resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==}+ resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==}+resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==}engines: {node: '>= 0.4'}@@ -4113,6 +4531,14 @@ packages:resolution: {integrity: sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw==}+ resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==}+ engines: {node: '>=4'}+resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==}engines: {node: '>=8'}@@ -4130,6 +4556,10 @@ packages:resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-UzGt8zg7Ny8djbYMhxl2zuEevVa7r2gJjYY5Lwr1xM7+XU2nd6CkIWFTVcCIbAP63vSz71NaVyyuSk9lHKcy0A==}+ engines: {node: '>=4'}+resolution: {integrity: sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==}@@ -4336,6 +4766,10 @@ packages:resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}+ resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==}engines: {node: '>=8'}@@ -4376,6 +4810,10 @@ packages:peerDependencies:chart.js: ^3.1.0+ resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==}+ engines: {node: '>= 16'}+resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}engines: {node: '>= 8.10.0'}@@ -4846,6 +5284,10 @@ packages:babel-plugin-macros:optional: true+ resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==}+ engines: {node: '>=6'}+resolution: {integrity: sha512-lKdkdV6EOGoVn65XaOsPdH4rMxTZOnmFyuIkMjM1i5HHCbfjC97dawgTAy0deYNfuqUqW+Q5VrVaQYtUpSd6yQ==}@@ -4923,9 +5365,16 @@ packages:resolution: {integrity: sha512-HK294sl7tbw6F6IeuK16YSBUoorvHpY8RHO+9yFfaJyCDVb6n7PRcezrOEOa2SBCqiYpemh5Jx20ZcjKdFAVng==}+ resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}+ engines: {node: '>=6.0.0'}+resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==}+ resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}+resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==}@@ -5003,6 +5452,10 @@ packages:resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}+ resolution: {integrity: sha512-YGRs8knHhKHVShLkFET/rWAU8kmHbOV5LwN938RHI0pljAJ1Gf6SzXsSmRaEzcXTtOOmVqJ5+WtQPL5uigY50Q==}+ engines: {node: '>=14'}+resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==}engines: {node: '>=8.6'}@@ -6233,6 +6686,9 @@ packages:engines: {node: '>=6'}hasBin: true+ resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==}+resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}@@ -6436,6 +6892,9 @@ packages:resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}hasBin: true+ resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==}+resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}@@ -6977,6 +7436,10 @@ packages:resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==}engines: {node: '>=18'}+ resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw==}engines: {node: '>=20'}@@ -7011,6 +7474,13 @@ packages:resolution: {integrity: sha512-N03oje/q7j93D0aLZtoCdsDSYLmhheSsv8H7oSLE7HhdV9P/bmCURtLV/KbPye7P/bpfyt/obSfDpGUYoJ0OWg==}+ resolution: {integrity: sha512-bkgD4qHlN7WxLdX8bLXdaU54TtQtAIg/ZBAfm0aje/mo3MRDo3P0hZSgr4U7O3xfX+fQmR5AP04JS/TGcZLcFA==}+ engines: {node: ^20.19.0 || >=22.12.0}++ resolution: {integrity: sha512-FY91FiDBj7ls5MsFS9jN3tjz2o0/zsdSsymlakySaBwVJZorHhkWyICLZMKxlu1R9vYo+sd3z1jwb4J8x7bNDw==}+resolution: {integrity: sha512-DjnMwn7smSLF+Mc2+pRItnuPftm/dkUFpY/d4+33y9TfKrsHZo8GLhmUg9BrOIUEy94Rlom1Q11N6vuhE+e0oQ==}engines: {node: ^20.19.0 || >=22.12.0}@@ -7158,6 +7628,10 @@ packages:resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}+ resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==}+ engines: {node: '>= 14.16'}+resolution: {integrity: sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==}hasBin: true@@ -7626,6 +8100,15 @@ packages:'@types/react':optional: true+ resolution: {integrity: sha512-ZtAp5XTO5HRzQctjPU0ybY0RRCQO19X/8fxn3w7y2VVTUbGHDKULPTL4ky3vB05euSgG5NpALhEhDPvQ56wvXg==}+ peerDependencies:+ typescript: '>= 4.3.x'++ resolution: {integrity: sha512-aEZ9qP+/M+58x2qgfSFEWH1BxLyHe5+qkLNJOZQb5iGS017jpbRnoKhNRrXPeA6RfBrZO5wZrT9DMC1UqE1f1w==}+ engines: {node: ^20.9.0 || >=22}+resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==}peerDependencies:@@ -7885,6 +8368,10 @@ packages:resolution: {integrity: sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==}engines: {node: '>= 20.19.0'}+ resolution: {integrity: sha512-mFAyJq9vUbSTARLZUvAEf1z3YxlvAwswbmxMx2mPA/MSm4KmpwvwvhsH/NIrZhyOuwD60Lzyw2qh83uCbgTPYw==}+ engines: {node: '>= 4'}+resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==}engines: {node: '>=8'}@@ -8307,6 +8794,21 @@ packages:resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-UfdMKSjEhIKr8LbqYyIE5r7vT/drL/PxN75YaouJ+UG0FssEy6cf49OdTF3kstAqVMHskc+zEqyRoiQHZXHwgA==}+ hasBin: true+ peerDependencies:+ '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0+ prettier: ^2 || ^3+ vite-plus: ^0.1.15 || ^0.2.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ prettier:+ optional: true+ vite-plus:+ optional: true+resolution: {integrity: sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==}@@ -8380,6 +8882,10 @@ packages:resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}engines: {node: '>=8'}+ resolution: {integrity: sha512-SlyRoSkdh1dYP0PzclLE7r0M9sgbFKKMFXpFRUMNuKhQSbC6VQIGzq3E0qsfvGJaUFJPGv6Ws1NZ/haTAjfbMA==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}engines: {node: '>=8'}@@ -8507,6 +9013,14 @@ packages:resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==}engines: {node: ^20.0.0 || >=22.0.0}+ resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}+ engines: {node: '>=14.0.0'}++ resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==}+ engines: {node: '>=14.0.0'}+resolution: {integrity: sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==}engines: {node: '>=14.14'}@@ -8547,6 +9061,10 @@ packages:peerDependencies:typescript: '>=4.8.4'+ resolution: {integrity: sha512-JfJeIHke7y2egdGGgRAvpCwYFUsHlM2gPcrVOxFkznt/4uzQ7HFmvE63iFHVLBJNDuyDOQgijDK/tXH/f6Msjg==}+ engines: {node: '>=6.10'}+resolution: {integrity: sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==}@@ -8744,6 +9262,10 @@ packages:resolution: {integrity: sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==}+ resolution: {integrity: sha512-5uKD0nqiYVzlmCRs01Fhs2BdkEgBS3SAVP6ndrBsuK42iC2+JHyxM05Rm9G8+5mkmRtzMZGY8Ct5+mliZxU/Ww==}+ engines: {node: '>=18.12.0'}+resolution: {integrity: sha512-bSjt9pjaEBnNiGgc9rUiHGKv5l4/TGzDmYw3RhnkJGtLhbnnA/5qJj7x3dNDCRx/PJxu774LlH8lCOlB4hEfKg==}@@ -8936,6 +9458,9 @@ packages:resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}engines: {node: '>=12'}+ resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}+resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==}engines: {node: '>=12'}@@ -9027,6 +9552,22 @@ packages:utf-8-validate:optional: true+ resolution: {integrity: sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==}+ engines: {node: '>=10.0.0'}+ peerDependencies:+ bufferutil: ^4.0.1+ utf-8-validate: '>=5.0.2'+ peerDependenciesMeta:+ bufferutil:+ optional: true+ utf-8-validate:+ optional: true++ resolution: {integrity: sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg==}engines: {node: '>=20'}@@ -9129,6 +9670,8 @@ snapshots:'@adobe/[email protected]': {}+ '@adobe/[email protected]': {}+'@ant-design/[email protected]':dependencies:'@ctrl/tinycolor': 3.6.1@@ -10339,12 +10882,24 @@ snapshots:react: 18.2.0tslib: 2.8.1+ '@emnapi/[email protected]':+ dependencies:+ '@emnapi/wasi-threads': 1.2.2+ tslib: 2.8.1+ optional: true+'@emnapi/[email protected]':dependencies:'@emnapi/wasi-threads': 1.1.0tslib: 2.8.1optional: true+ '@emnapi/[email protected]':+ dependencies:+ '@emnapi/wasi-threads': 1.2.1+ tslib: 2.8.1+ optional: true+'@emnapi/[email protected]':dependencies:tslib: 2.8.1@@ -10355,11 +10910,26 @@ snapshots:tslib: 2.8.1optional: true+ '@emnapi/[email protected]':+ dependencies:+ tslib: 2.8.1+ optional: true+'@emnapi/[email protected]':dependencies:tslib: 2.8.1optional: true+ '@emnapi/[email protected]':+ dependencies:+ tslib: 2.8.1+ optional: true++ '@emnapi/[email protected]':+ dependencies:+ tslib: 2.8.1+ optional: true+'@emotion/[email protected]': {}'@emotion/[email protected]':@@ -10990,6 +11560,14 @@ snapshots:'@types/yargs': 17.0.35chalk: 4.1.2+ '@joshwooding/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])':+ dependencies:+ glob: 13.0.6+ react-docgen-typescript: 2.4.0([email protected])+ vite: [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ optionalDependencies:+ typescript: 5.9.3+'@jridgewell/[email protected]':dependencies:'@jridgewell/sourcemap-codec': 1.5.5@@ -11101,11 +11679,25 @@ snapshots:'@tybys/wasm-util': 0.10.1optional: true- '@napi-rs/[email protected]':+ '@napi-rs/[email protected]':+ dependencies:+ '@emnapi/core': 1.8.1+ '@emnapi/runtime': 1.8.1+ '@tybys/wasm-util': 0.10.1+ optional: true++ dependencies:+ '@emnapi/core': 1.11.2+ '@emnapi/runtime': 1.11.2+ '@tybys/wasm-util': 0.10.3+ optional: true+dependencies:- '@emnapi/core': 1.8.1- '@emnapi/runtime': 1.8.1- '@tybys/wasm-util': 0.10.1+ '@emnapi/core': 1.9.2+ '@emnapi/runtime': 1.9.2+ '@tybys/wasm-util': 0.10.3optional: true'@nodelib/[email protected]':@@ -11231,10 +11823,137 @@ snapshots:- supports-color- typescript+ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ dependencies:+ '@emnapi/core': 1.9.2+ '@emnapi/runtime': 1.9.2+ '@napi-rs/wasm-runtime': 1.2.3(@emnapi/[email protected])(@emnapi/[email protected])+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true++ '@oxc-parser/[email protected]':+ optional: true+'@oxc-project/[email protected]': {}'@oxc-project/[email protected]': {}+ '@oxc-project/[email protected]': {}++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ dependencies:+ '@emnapi/core': 1.11.2+ '@emnapi/runtime': 1.11.2+ '@napi-rs/wasm-runtime': 1.2.3(@emnapi/[email protected])(@emnapi/[email protected])+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true++ '@oxc-resolver/[email protected]':+ optional: true+'@oxfmt/[email protected]':optional: true@@ -12067,6 +12786,12 @@ snapshots:estree-walker: 2.0.2picomatch: 2.3.2+ '@rollup/[email protected]':+ dependencies:+ '@types/estree': 1.0.8+ estree-walker: 2.0.2+ picomatch: 4.0.4+'@scalar/[email protected]': {}'@scalar/[email protected]': {}@@ -12315,6 +13040,87 @@ snapshots:'@standard-schema/[email protected]': {}+ '@storybook/[email protected]([email protected](@types/[email protected])([email protected])([email protected]))':+ dependencies:+ '@storybook/global': 5.0.0+ axe-core: 4.13.0++ '@storybook/[email protected]([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected]))':+ dependencies:+ '@storybook/csf-plugin': 10.5.9([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected]))+ ts-dedent: 2.3.0+ vite: [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ transitivePeerDependencies:+ - esbuild+ - rollup+ - webpack++ '@storybook/[email protected]([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected]))':+ dependencies:+ unplugin: 2.3.11+ optionalDependencies:+ esbuild: 0.28.1+ vite: [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])++ '@storybook/[email protected]': {}++ '@storybook/[email protected]([email protected])':+ dependencies:+ react: 18.2.0++ '@storybook/[email protected](@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]))':+ dependencies:+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ optionalDependencies:+ '@types/react': 18.0.26+ '@types/react-dom': 18.0.10++ '@storybook/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected]))([email protected])':+ dependencies:+ '@joshwooding/vite-plugin-react-docgen-typescript': 0.7.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])+ '@rollup/pluginutils': 5.4.0+ '@storybook/builder-vite': 10.5.9([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected]))+ '@storybook/react': 10.5.9(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]))([email protected])+ empathic: 2.0.1+ magic-string: 0.30.8+ react: 18.2.0+ react-docgen: 8.0.3+ react-dom: 18.2.0([email protected])+ resolve: 1.22.11+ tsconfig-paths: 4.2.0+ vite: [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ optionalDependencies:+ typescript: 5.9.3+ transitivePeerDependencies:+ - '@types/react'+ - '@types/react-dom'+ - esbuild+ - rollup+ - supports-color+ - webpack++ '@storybook/[email protected](@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]))([email protected])':+ dependencies:+ '@storybook/global': 5.0.0+ '@storybook/react-dom-shim': 10.5.9(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected]))+ react: 18.2.0+ react-docgen: 8.0.3+ react-docgen-typescript: 2.4.0([email protected])+ react-dom: 18.2.0([email protected])+ optionalDependencies:+ '@types/react': 18.0.26+ '@types/react-dom': 18.0.10+ typescript: 5.9.3+ transitivePeerDependencies:+ - supports-color+dependencies:'@tanstack/table-core': 8.21.3@@ -12339,12 +13145,23 @@ snapshots:'@tanstack/[email protected]': {}+ '@testing-library/[email protected]':+ dependencies:+ '@babel/code-frame': 7.29.7+ '@babel/runtime': 7.29.2+ '@types/aria-query': 5.0.1+ aria-query: 5.3.0+ dom-accessibility-api: 0.5.16+ lz-string: 1.5.0+ picocolors: 1.1.1+ pretty-format: 27.5.1+'@testing-library/[email protected]':dependencies:- '@babel/code-frame': 7.29.0- '@babel/runtime': 7.28.2+ '@babel/code-frame': 7.29.7+ '@babel/runtime': 7.29.2'@types/aria-query': 5.0.1- aria-query: 5.1.3+ aria-query: 5.3.0chalk: 4.1.2dom-accessibility-api: 0.5.16lz-string: 1.5.0@@ -12362,6 +13179,15 @@ snapshots:lodash: 4.18.1redent: 3.0.0+ '@testing-library/[email protected]':+ dependencies:+ '@adobe/css-tools': 4.5.0+ aria-query: 5.1.3+ css.escape: 1.5.1+ dom-accessibility-api: 0.6.3+ picocolors: 1.1.1+ redent: 3.0.0+dependencies:'@babel/runtime': 7.28.2@@ -12374,6 +13200,10 @@ snapshots:dependencies:'@testing-library/dom': 8.20.0+ '@testing-library/[email protected](@testing-library/[email protected])':+ dependencies:+ '@testing-library/dom': 10.4.1+'@tootallnate/[email protected]': {}'@tsconfig/[email protected]':@@ -12395,6 +13225,11 @@ snapshots:tslib: 2.8.1optional: true+ '@tybys/[email protected]':+ dependencies:+ tslib: 2.8.1+ optional: true+'@types/[email protected]': {}'@types/[email protected]':@@ -12418,6 +13253,15 @@ snapshots:dependencies:'@babel/types': 7.29.0+ '@types/[email protected]':+ dependencies:+ '@babel/types': 7.29.7++ '@types/[email protected]':+ dependencies:+ '@types/deep-eql': 4.0.2+ assertion-error: 2.0.1+'@types/[email protected]':dependencies:'@types/color-name': 1.1.1@@ -12470,6 +13314,10 @@ snapshots:dependencies:'@types/ms': 0.7.31+ '@types/[email protected]': {}++ '@types/[email protected]': {}+'@types/[email protected]': {}'@types/[email protected]': {}@@ -12617,6 +13465,8 @@ snapshots:dependencies:redux: 4.2.1+ '@types/[email protected]': {}+'@types/[email protected]': {}'@types/[email protected]':@@ -12902,6 +13752,30 @@ snapshots:transitivePeerDependencies:- supports-color+ '@vitest/[email protected]':+ dependencies:+ '@types/chai': 5.2.3+ '@vitest/spy': 3.2.4+ '@vitest/utils': 3.2.4+ chai: 5.3.3+ tinyrainbow: 2.0.0++ '@vitest/[email protected]':+ dependencies:+ tinyrainbow: 2.0.0++ '@vitest/[email protected]':+ dependencies:+ tinyspy: 4.0.4++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 3.2.4+ loupe: 3.2.1+ tinyrainbow: 2.0.0++ '@webcontainer/[email protected]': {}+'@xmldom/[email protected]': {}'@xobotyi/[email protected]': {}@@ -13065,6 +13939,10 @@ snapshots:dependencies:deep-equal: 2.2.1+ dependencies:+ dequal: 2.0.3+dependencies:call-bound: 1.0.4@@ -13074,6 +13952,12 @@ snapshots:+ [email protected]: {}++ dependencies:+ tslib: 2.8.1+@@ -13086,6 +13970,8 @@ snapshots:dependencies:possible-typed-array-names: 1.1.0+ [email protected]: {}+dependencies:follow-redirects: 1.16.0@@ -13368,6 +14254,14 @@ snapshots:+ dependencies:+ assertion-error: 2.0.1+ check-error: 2.1.3+ deep-eql: 5.0.2+ loupe: 3.2.1+ pathval: 2.0.1+dependencies:ansi-styles: 4.3.0@@ -13400,6 +14294,8 @@ snapshots:dependencies:chart.js: 3.9.1+ [email protected]: {}+dependencies:anymatch: 3.1.3@@ -13843,6 +14739,8 @@ snapshots:optionalDependencies:babel-plugin-macros: 3.1.0+ [email protected]: {}+dependencies:array-buffer-byte-length: 1.0.2@@ -13927,8 +14825,14 @@ snapshots:'@react-dnd/invariant': 4.0.2redux: 4.2.1+ dependencies:+ esutils: 2.0.3++ [email protected]: {}+dependencies:domelementtype: 2.3.0@@ -14008,6 +14912,8 @@ snapshots:+ [email protected]: {}+dependencies:ansi-colors: 4.1.3@@ -15631,6 +16537,8 @@ snapshots:+ [email protected]: {}+dependencies:universalify: 2.0.0@@ -15817,6 +16725,8 @@ snapshots:dependencies:js-tokens: 4.0.0+ [email protected]: {}+dependencies:tslib: 2.8.1@@ -16499,6 +17409,13 @@ snapshots:dependencies:mimic-function: 5.0.1+ dependencies:+ default-browser: 5.5.0+ define-lazy-prop: 3.0.0+ is-inside-container: 1.0.0+ wsl-utils: 0.1.0+dependencies:default-browser: 5.5.0@@ -16576,6 +17493,53 @@ snapshots:+ dependencies:+ '@oxc-project/types': 0.127.0+ optionalDependencies:+ '@oxc-parser/binding-android-arm-eabi': 0.127.0+ '@oxc-parser/binding-android-arm64': 0.127.0+ '@oxc-parser/binding-darwin-arm64': 0.127.0+ '@oxc-parser/binding-darwin-x64': 0.127.0+ '@oxc-parser/binding-freebsd-x64': 0.127.0+ '@oxc-parser/binding-linux-arm-gnueabihf': 0.127.0+ '@oxc-parser/binding-linux-arm-musleabihf': 0.127.0+ '@oxc-parser/binding-linux-arm64-gnu': 0.127.0+ '@oxc-parser/binding-linux-arm64-musl': 0.127.0+ '@oxc-parser/binding-linux-ppc64-gnu': 0.127.0+ '@oxc-parser/binding-linux-riscv64-gnu': 0.127.0+ '@oxc-parser/binding-linux-riscv64-musl': 0.127.0+ '@oxc-parser/binding-linux-s390x-gnu': 0.127.0+ '@oxc-parser/binding-linux-x64-gnu': 0.127.0+ '@oxc-parser/binding-linux-x64-musl': 0.127.0+ '@oxc-parser/binding-openharmony-arm64': 0.127.0+ '@oxc-parser/binding-wasm32-wasi': 0.127.0+ '@oxc-parser/binding-win32-arm64-msvc': 0.127.0+ '@oxc-parser/binding-win32-ia32-msvc': 0.127.0+ '@oxc-parser/binding-win32-x64-msvc': 0.127.0++ optionalDependencies:+ '@oxc-resolver/binding-android-arm-eabi': 11.24.2+ '@oxc-resolver/binding-android-arm64': 11.24.2+ '@oxc-resolver/binding-darwin-arm64': 11.24.2+ '@oxc-resolver/binding-darwin-x64': 11.24.2+ '@oxc-resolver/binding-freebsd-x64': 11.24.2+ '@oxc-resolver/binding-linux-arm-gnueabihf': 11.24.2+ '@oxc-resolver/binding-linux-arm-musleabihf': 11.24.2+ '@oxc-resolver/binding-linux-arm64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-arm64-musl': 11.24.2+ '@oxc-resolver/binding-linux-ppc64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-riscv64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-riscv64-musl': 11.24.2+ '@oxc-resolver/binding-linux-s390x-gnu': 11.24.2+ '@oxc-resolver/binding-linux-x64-gnu': 11.24.2+ '@oxc-resolver/binding-linux-x64-musl': 11.24.2+ '@oxc-resolver/binding-openharmony-arm64': 11.24.2+ '@oxc-resolver/binding-wasm32-wasi': 11.24.2+ '@oxc-resolver/binding-win32-arm64-msvc': 11.24.2+ '@oxc-resolver/binding-win32-x64-msvc': 11.24.2+dependencies:tinypool: 2.1.0@@ -16741,6 +17705,8 @@ snapshots:+ [email protected]: {}+dependencies:ieee754: 1.2.1@@ -17291,6 +18257,25 @@ snapshots:'@types/node': 16.18.25'@types/react': 18.0.26+ dependencies:+ typescript: 5.9.3++ dependencies:+ '@babel/core': 7.29.7+ '@babel/traverse': 7.29.7+ '@babel/types': 7.29.7+ '@types/babel__core': 7.20.5+ '@types/babel__traverse': 7.28.0+ '@types/doctrine': 0.0.9+ '@types/resolve': 1.20.6+ doctrine: 3.0.0+ resolve: 1.22.11+ strip-indent: 4.1.1+ transitivePeerDependencies:+ - supports-color+dependencies:loose-envify: 1.4.0@@ -17613,6 +18598,14 @@ snapshots:+ dependencies:+ ast-types: 0.16.1+ esprima: 4.0.1+ source-map: 0.6.1+ tiny-invariant: 1.3.3+ tslib: 2.8.1+dependencies:indent-string: 4.0.0@@ -18068,6 +19061,33 @@ snapshots:es-errors: 1.3.0internal-slot: 1.1.0+ dependencies:+ '@storybook/global': 5.0.0+ '@storybook/icons': 2.1.0([email protected])+ '@testing-library/dom': 10.4.1+ '@testing-library/jest-dom': 6.9.1+ '@testing-library/user-event': 14.6.6(@testing-library/[email protected])+ '@vitest/expect': 3.2.4+ '@vitest/spy': 3.2.4+ '@webcontainer/env': 1.1.1+ esbuild: 0.28.1+ jsonc-parser: 3.3.1+ open: 10.2.0+ oxc-parser: 0.127.0+ oxc-resolver: 11.24.2+ recast: 0.23.21+ semver: 7.8.5+ use-sync-external-store: 1.6.0([email protected])+ ws: 8.21.3+ optionalDependencies:+ '@types/react': 18.0.26+ prettier: 3.8.3+ transitivePeerDependencies:+ - bufferutil+ - react+ - utf-8-validate+dependencies:debug: 2.6.9@@ -18143,6 +19163,8 @@ snapshots:dependencies:min-indent: 1.0.1+ [email protected]: {}+@@ -18315,6 +19337,10 @@ snapshots:+ [email protected]: {}++ [email protected]: {}+@@ -18348,6 +19374,8 @@ snapshots:dependencies:typescript: 6.0.2+ [email protected]: {}+[email protected](@babel/[email protected])(@jest/[email protected])(@jest/[email protected])([email protected](@babel/[email protected]))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected](@types/[email protected])([email protected])))([email protected]):@@ -18548,6 +19576,13 @@ snapshots:'@babel/runtime': 7.28.2detect-node: 2.1.0+ dependencies:+ '@jridgewell/remapping': 2.3.5+ acorn: 8.16.0+ picomatch: 4.0.4+ webpack-virtual-modules: 0.6.2+dependencies:napi-postinstall: 0.3.4@@ -18767,6 +19802,8 @@ snapshots:+ [email protected]: {}+dependencies:iconv-lite: 0.6.3@@ -18868,6 +19905,12 @@ snapshots:+ [email protected]: {}++ dependencies:+ is-wsl: 3.1.1+dependencies:is-wsl: 3.1.1diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsxindex cdf1741701..9768967804 100644--- a/frontend/src/AppRoutes/index.tsx+++ b/frontend/src/AppRoutes/index.tsx@@ -1,11 +1,12 @@-import { Suspense, useCallback, useEffect, useState } from 'react';+import { ReactNode, Suspense, useCallback, useEffect, useState } from 'react';import { Route, Router, Switch } from 'react-router-dom';import { CompatRouter } from 'react-router-dom-v5-compat';import * as Sentry from '@sentry/react';-import { ConfigProvider } from 'antd';import getLocalStorageApi from 'api/browser/localstorage/get';import setLocalStorageApi from 'api/browser/localstorage/set';import logEvent from 'api/common/logEvent';+import AppPageProviders from 'app/AppPageProviders';+import AppShell from 'app/AppShell';import AppLoading from 'components/AppLoading/AppLoading';import { CmdKPalette } from 'components/cmdKPalette/cmdKPalette';import NotFound from 'components/NotFound';@@ -17,22 +18,15 @@ import ROUTES from 'constants/routes';import AppLayout from 'container/AppLayout';import Hex from 'crypto-js/enc-hex';import HmacSHA256 from 'crypto-js/hmac-sha256';-import { KeyboardHotkeysProvider } from 'hooks/hotkeys/useKeyboardHotkeys';import { useIsAIAssistantEnabled } from 'hooks/useIsAIAssistantEnabled';-import { useIsDarkMode, useThemeConfig } from 'hooks/useDarkMode';+import { useIsDarkMode } from 'hooks/useDarkMode';import { useGetTenantLicense } from 'hooks/useGetTenantLicense';-import { NotificationProvider } from 'hooks/useNotifications';-import { ResourceProvider } from 'hooks/useResourceAttribute';import { StatusCodes } from 'http-status-codes';import history from 'lib/history';import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';import posthog from 'posthog-js';import { useAppContext } from 'providers/App/App';import { IUser } from 'providers/App/types';-import { CmdKProvider } from 'providers/cmdKProvider';-import { ErrorModalProvider } from 'providers/ErrorModalProvider';-import { PreferenceContextProvider } from 'providers/preferences/context/PreferenceContextProvider';-import { QueryBuilderProvider } from 'providers/QueryBuilder';import { LicenseStatus } from 'types/api/licensesV3/getActive';import { extractDomain } from 'utils/app';@@ -44,8 +38,17 @@ import defaultRoutes, {SUPPORT_ROUTE,} from './routes';+const appRouter = (children: ReactNode): ReactNode => (+ <Router history={history}>+ <CompatRouter>{children}</CompatRouter>+ </Router>+);++const appLayout = (children: ReactNode): ReactNode => (+ <AppLayout>{children}</AppLayout>+);+function App(): JSX.Element {- const themeConfig = useThemeConfig();const {user,isFetchingUser,@@ -451,48 +454,36 @@ function App(): JSX.Element {return (<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>- <ConfigProvider theme={themeConfig}>- <Router history={history}>- <CompatRouter>- <CmdKProvider>- <NotificationProvider>- <ErrorModalProvider>- {isLoggedInState && <CmdKPalette userRole={user.role} />}- {isLoggedInState && (- <ShiftHoldOverlayController userRole={user.role} />- )}- <PrivateRoute>- <ResourceProvider>- <QueryBuilderProvider>- <KeyboardHotkeysProvider>- <AppLayout>- <PreferenceContextProvider>- <Suspense fallback={<Spinner size="large" tip="Loading..." />}>- <Switch>- {routes.map(({ path, component, exact }) => (- <Route- key={`${path}`}- exact={exact}- path={path}- component={component}- />- ))}- <Route exact path="/" component={Home} />- <Route path="*" component={NotFound} />- </Switch>- </Suspense>- </PreferenceContextProvider>- </AppLayout>- </KeyboardHotkeysProvider>- </QueryBuilderProvider>- </ResourceProvider>- </PrivateRoute>- </ErrorModalProvider>- </NotificationProvider>- </CmdKProvider>- </CompatRouter>- </Router>- </ConfigProvider>+ <AppShell+ router={appRouter}+ overlays={+ isLoggedInState && (+ <>+ <CmdKPalette userRole={user.role} />+ <ShiftHoldOverlayController userRole={user.role} />+ </>+ )+ }+ >+ <PrivateRoute>+ <AppPageProviders layout={appLayout}>+ <Suspense fallback={<Spinner size="large" tip="Loading..." />}>+ <Switch>+ {routes.map(({ path, component, exact }) => (+ <Route+ key={`${path}`}+ exact={exact}+ path={path}+ component={component}+ />+ ))}+ <Route exact path="/" component={Home} />+ <Route path="*" component={NotFound} />+ </Switch>+ </Suspense>+ </AppPageProviders>+ </PrivateRoute>+ </AppShell></Sentry.ErrorBoundary>);}diff --git a/frontend/src/app/AppPageProviders.tsx b/frontend/src/app/AppPageProviders.tsxnew file mode 100644index 0000000000..409a57d880--- /dev/null+++ b/frontend/src/app/AppPageProviders.tsx@@ -0,0 +1,61 @@+import { ReactNode } from 'react';+import { KeyboardHotkeysProvider } from 'hooks/hotkeys/useKeyboardHotkeys';+import { ResourceProvider } from 'hooks/useResourceAttribute';+import { PreferenceContextProvider } from 'providers/preferences/context/PreferenceContextProvider';+import {+ QueryBuilderContext,+ QueryBuilderProvider,+} from 'providers/QueryBuilder';+import { QueryBuilderContextType } from 'types/common/queryBuilder';++import { AppLayer } from './types';++export interface AppPageProvidersProps {+ children: ReactNode;+ layout: AppLayer;+ /** When set, replaces `QueryBuilderProvider` with a fixed context value. */+ queryBuilder?: Partial<QueryBuilderContextType>;+}++/**+ * The layers a routed page renders in, below `PrivateRoute` and inside the app+ * chrome. A new provider belongs here when only pages need it, or when it has to+ * sit inside `AppLayout`.+ *+ * One ordering constraint: `AppLayout` calls `useKeyboardHotkeys`, so the+ * hotkeys provider has to stay above the layout. The rest of the order is the+ * one `AppRoutes` has, kept as-is so a story and a route render the same tree.+ */+function AppPageProviders({+ children,+ layout,+ queryBuilder,+}: AppPageProvidersProps): JSX.Element {+ const hotkeys = (+ <KeyboardHotkeysProvider>+ <>+ {layout(<PreferenceContextProvider>{children}</PreferenceContextProvider>)}+ </>+ </KeyboardHotkeysProvider>+ );++ return (+ <ResourceProvider>+ {queryBuilder ? (+ <QueryBuilderContext.Provider+ value={queryBuilder as QueryBuilderContextType}+ >+ {hotkeys}+ </QueryBuilderContext.Provider>+ ) : (+ <QueryBuilderProvider>{hotkeys}</QueryBuilderProvider>+ )}+ </ResourceProvider>+ );+}++AppPageProviders.defaultProps = {+ queryBuilder: undefined,+};++export default AppPageProviders;diff --git a/frontend/src/app/AppProviders.tsx b/frontend/src/app/AppProviders.tsxnew file mode 100644index 0000000000..faf3472540--- /dev/null+++ b/frontend/src/app/AppProviders.tsx@@ -0,0 +1,56 @@+import { ReactNode } from 'react';+import { HelmetProvider } from 'react-helmet-async';+import { QueryClient, QueryClientProvider } from 'react-query';+// eslint-disable-next-line no-restricted-imports+import { Provider } from 'react-redux';+// eslint-disable-next-line no-restricted-imports+import { Store } from 'redux';+import { GlobalTimeStoreAdapter } from 'components/GlobalTimeStoreAdapter/GlobalTimeStoreAdapter';+import { ThemeProvider } from 'hooks/useDarkMode';+import TimezoneProvider from 'providers/Timezone';++import { AppLayer } from './types';++export interface AppProvidersProps {+ children: ReactNode;+ store: Store;+ queryClient: QueryClient;+ appContext: AppLayer;+ searchParams: AppLayer;+}++/**+ * The layers that exist before the app knows anything. Mounted for the whole+ * session, including while `AppProvider` is still fetching the user and the boot+ * spinner is on screen, and never remounted after that.+ *+ * A new provider belongs here only if it holds process-wide state that does not+ * depend on the user, the license or the route. One that fetches on mount would+ * fire unauthenticated from here; put it in `AppShell` or lower.+ */+function AppProviders({+ children,+ store,+ queryClient,+ appContext,+ searchParams,+}: AppProvidersProps): JSX.Element {+ return (+ <HelmetProvider>+ {searchParams(+ <ThemeProvider>+ <TimezoneProvider>+ <QueryClientProvider client={queryClient}>+ <Provider store={store}>+ <GlobalTimeStoreAdapter />+ {appContext(children)}+ </Provider>+ </QueryClientProvider>+ </TimezoneProvider>+ </ThemeProvider>,+ )}+ </HelmetProvider>+ );+}++export default AppProviders;diff --git a/frontend/src/app/AppShell.tsx b/frontend/src/app/AppShell.tsxnew file mode 100644index 0000000000..629c86c850--- /dev/null+++ b/frontend/src/app/AppShell.tsx@@ -0,0 +1,52 @@+import { ReactNode } from 'react';+import { ConfigProvider } from 'antd';+import { useThemeConfig } from 'hooks/useDarkMode';+import { NotificationProvider } from 'hooks/useNotifications';+import { CmdKProvider } from 'providers/cmdKProvider';+import { ErrorModalProvider } from 'providers/ErrorModalProvider';++import { AppLayer } from './types';++export interface AppShellProps {+ children: ReactNode;+ router: AppLayer;+ /** Mounted beside the routed content: the command palette and its siblings. */+ overlays?: ReactNode;+}++/**+ * The layers between a resolved session and a page. Mounted once the boot+ * fetches settle, above `PrivateRoute`, so it also covers the redirects and the+ * not-found route, and it survives every navigation.+ *+ * A new provider belongs here if it needs the router or the user and has to+ * outlive the page: a global overlay, a shortcut host, anything one route opens+ * and the next one keeps.+ *+ * `ConfigProvider` reads `useThemeConfig`, which needs `ThemeProvider` above it,+ * so the antd theme is settled here instead of by the caller.+ */+function AppShell({ children, router, overlays }: AppShellProps): JSX.Element {+ const themeConfig = useThemeConfig();++ return (+ <ConfigProvider theme={themeConfig}>+ {router(+ <CmdKProvider>+ <NotificationProvider>+ <ErrorModalProvider>+ {overlays}+ {children}+ </ErrorModalProvider>+ </NotificationProvider>+ </CmdKProvider>,+ )}+ </ConfigProvider>+ );+}++AppShell.defaultProps = {+ overlays: undefined,+};++export default AppShell;diff --git a/frontend/src/app/types.ts b/frontend/src/app/types.tsnew file mode 100644index 0000000000..f416d23903--- /dev/null+++ b/frontend/src/app/types.ts@@ -0,0 +1,3 @@+import { ReactNode } from 'react';++export type AppLayer = (children: ReactNode) => ReactNode;diff --git a/frontend/src/index.tsx b/frontend/src/index.tsxindex 3d6ec0c4d7..f91af10443 100644--- a/frontend/src/index.tsx+++ b/frontend/src/index.tsx@@ -1,16 +1,12 @@+import { ReactNode } from 'react';import { createRoot } from 'react-dom/client';-import { HelmetProvider } from 'react-helmet-async';-import { QueryClient, QueryClientProvider } from 'react-query';-// eslint-disable-next-line no-restricted-imports-import { Provider } from 'react-redux';+import { QueryClient } from 'react-query';+import AppProviders from 'app/AppProviders';import AppRoutes from 'AppRoutes';import { AxiosError } from 'axios';-import { GlobalTimeStoreAdapter } from 'components/GlobalTimeStoreAdapter/GlobalTimeStoreAdapter';-import { ThemeProvider } from 'hooks/useDarkMode';import { configureOverlayScrollbars } from 'lib/configureOverlayScrollbars';import { NuqsAdapter } from 'nuqs/adapters/react';import { AppProvider } from 'providers/App/App';-import TimezoneProvider from 'providers/Timezone';import store from 'store';import APIError from 'types/api/error';import { installTranslationResilience } from 'translation-resilience';@@ -47,27 +43,27 @@ const queryClient = new QueryClient({},});+const searchParams = (children: ReactNode): ReactNode => (+ <NuqsAdapter>{children}</NuqsAdapter>+);++const appContext = (children: ReactNode): ReactNode => (+ <AppProvider>{children}</AppProvider>+);+const container = document.getElementById('root');if (container) {const root = createRoot(container);root.render(- <HelmetProvider>- <NuqsAdapter>- <ThemeProvider>- <TimezoneProvider>- <QueryClientProvider client={queryClient}>- <Provider store={store}>- <GlobalTimeStoreAdapter />- <AppProvider>- <AppRoutes />- </AppProvider>- </Provider>- </QueryClientProvider>- </TimezoneProvider>- </ThemeProvider>- </NuqsAdapter>- </HelmetProvider>,+ <AppProviders+ store={store}+ queryClient={queryClient}+ appContext={appContext}+ searchParams={searchParams}+ >+ <AppRoutes />+ </AppProviders>,);}diff --git a/frontend/src/lib/authz/devtools/useAuthZDevStore.ts b/frontend/src/lib/authz/devtools/useAuthZDevStore.tsindex d971825da9..d454afec7b 100644--- a/frontend/src/lib/authz/devtools/useAuthZDevStore.ts+++ b/frontend/src/lib/authz/devtools/useAuthZDevStore.ts@@ -135,3 +135,5 @@ export const closeAuthZDevModal = (): void =>useAuthZDevStore.getState().closeModal();export const toggleAuthZDevModal = (): void =>useAuthZDevStore.getState().toggleModal();+export const clearAllAuthZDevOverrides = (): void =>+ useAuthZDevStore.getState().clearAllOverrides();diff --git a/frontend/src/pages/HomePage/stories/HomePage.stories.mocks.tsx b/frontend/src/pages/HomePage/stories/HomePage.stories.mocks.tsxnew file mode 100644index 0000000000..a079f103f7--- /dev/null+++ b/frontend/src/pages/HomePage/stories/HomePage.stories.mocks.tsx@@ -0,0 +1,200 @@+/**+ * AI-owned. Generated and maintained by the `signoz-page-story` skill.+ * Do not hand-edit: regenerate instead.+ */++import { rest } from 'msw';++import {+ countControl,+ choiceControl,+ multiChoiceControl,+ toggleControl,+} from '@/storybook/controls/controls';+import { defineStoryMocks } from '@/storybook/controls/defineStoryMocks';+import {+ buildAlertRules,+ buildServices,+ homeFeatureFlags,+ homeUserPreferences,+ HOME_CHECKLIST_STEPS,+ isSavedViewSignal,+ metricsOnboardingResponse,+ queryRangeV5ScalarResponse,+ recentDashboardsResponse,+ SAVED_VIEW_SIGNALS,+ type SavedViewSignal,+ savedViewsResponse,+ SERVICES_SOURCES,+ type ServicesSource,+ spanMetricsResponse,+ topLevelOperationsResponse,+} from './__story_mockdata__/home';++const SIGNALS = 'Home · signals';+const ONBOARDING = 'Home · onboarding';+const LISTS = 'Home · lists';++const INGESTED_COUNT = 4213;++/** Home caps every list at five rows, so the control has to go past that. */+const LIST_MAX = 8;++const CHECKLIST_VISIBILITY = ['visible', 'dismissed'] as const;++type ChecklistVisibility = (typeof CHECKLIST_VISIBILITY)[number];++interface QueryRangeV5Body {+ compositeQuery?: { queries?: { spec?: { signal?: string } }[] };+}++/**+ * Home detects logs and traces with one `query_range` call each, told apart by+ * the signal on the query spec.+ */+const signalOf = (body: QueryRangeV5Body): string | undefined =>+ body.compositeQuery?.queries?.[0]?.spec?.signal;++export const homeMocks = defineStoryMocks({+ controls: {+ logsIngestion: toggleControl('Logs ingestion', {+ group: SIGNALS,+ value: true,+ }),+ tracesIngestion: toggleControl('Traces ingestion', {+ group: SIGNALS,+ value: true,+ }),+ metricsIngestion: toggleControl('Metrics ingestion', {+ group: SIGNALS,+ value: true,+ }),+ welcomeChecklist: choiceControl<ChecklistVisibility>('Welcome checklist', {+ group: ONBOARDING,+ description:+ 'Dismissing it moves the checklist behind the header button, as "I\'ll do this later" does.',+ options: CHECKLIST_VISIBILITY,+ value: 'visible',+ }),+ skippedSteps: multiChoiceControl('Skipped steps', {+ group: ONBOARDING,+ description: 'Steps the user chose to skip. Completion follows the data.',+ options: HOME_CHECKLIST_STEPS,+ value: [],+ }),+ alertRules: countControl('Alert rules', {+ group: LISTS,+ value: 5,+ max: LIST_MAX,+ }),+ dashboards: countControl('Recent dashboards', {+ group: LISTS,+ value: 5,+ max: LIST_MAX,+ }),+ savedViews: countControl('Saved views per signal', {+ group: LISTS,+ value: 5,+ max: LIST_MAX,+ }),+ savedViewSignals: multiChoiceControl<SavedViewSignal>('Signals with views', {+ group: LISTS,+ description:+ 'Explorer tabs that have views; the rest fall back to their empty state.',+ options: SAVED_VIEW_SIGNALS,+ value: SAVED_VIEW_SIGNALS,+ }),+ services: countControl('Services', {+ group: LISTS,+ value: 6,+ max: LIST_MAX,+ }),+ servicesSource: choiceControl<ServicesSource>('Services source', {+ group: LISTS,+ description:+ '`span-metrics` turns on the feature flag that swaps the services card for the span-metrics one.',+ options: SERVICES_SOURCES,+ value: 'traces',+ }),+ },+ handlers: (values, response) => [+ rest.get('http://localhost/api/v2/metrics/onboarding', (_req, res, ctx) =>+ res(+ ctx.status(200),+ ctx.json(metricsOnboardingResponse(values.metricsIngestion)),+ ),+ ),++ rest.post('http://localhost/api/v5/query_range', async (req, res, ctx) => {+ const signal = signalOf((await req.json()) as QueryRangeV5Body);++ const isActive =+ signal === 'traces' ? values.tracesIngestion : values.logsIngestion;++ return res(+ ctx.status(200),+ ctx.json(queryRangeV5ScalarResponse(isActive ? INGESTED_COUNT : 0)),+ );+ }),++ rest.get('http://localhost/api/v1/user/preferences', (_req, res, ctx) =>+ res(+ ctx.status(200),+ ctx.json({+ status: 'success',+ data: homeUserPreferences({+ checklistDismissed: values.welcomeChecklist === 'dismissed',+ skippedSteps: values.skippedSteps,+ }),+ }),+ ),+ ),++ rest.get(+ 'http://localhost/api/v2/users/me/dashboards',+ response.json(() => recentDashboardsResponse(values.dashboards)),+ ),++ rest.get(+ 'http://localhost/api/v2/rules',+ response.json(() => ({+ status: 'success',+ data: buildAlertRules(values.alertRules),+ })),+ ),++ rest.get(+ 'http://localhost/api/v1/explorer/views',+ response.json((req) => {+ const sourcePage = req.url.searchParams.get('sourcePage') ?? 'logs';+ const signal = isSavedViewSignal(sourcePage) ? sourcePage : 'logs';++ return savedViewsResponse(+ values.savedViewSignals.includes(signal) ? values.savedViews : 0,+ signal,+ );+ }),+ ),++ rest.post(+ 'http://localhost/api/v2/services',+ response.json(() => ({+ status: 'success',+ data: buildServices(values.services),+ })),+ ),++ rest.post(+ 'http://localhost/api/v1/service/top_level_operations',+ response.json(() => topLevelOperationsResponse(values.services)),+ ),++ rest.post(+ 'http://localhost/api/v4/query_range',+ response.json(() => spanMetricsResponse()),+ ),+ ],+ config: ({ servicesSource }) => ({+ appContext: { featureFlags: homeFeatureFlags(servicesSource) },+ }),+});diff --git a/frontend/src/pages/HomePage/stories/HomePage.stories.tsx b/frontend/src/pages/HomePage/stories/HomePage.stories.tsxnew file mode 100644index 0000000000..bf2758aafb--- /dev/null+++ b/frontend/src/pages/HomePage/stories/HomePage.stories.tsx@@ -0,0 +1,53 @@+import type { Meta, StoryObj } from '@storybook/react-vite';+import ROUTES from 'constants/routes';++import { storyMocks } from '@/storybook/controls/defineStoryMocks';+import type { PageStoryArgs } from '@/storybook/runtime/resolveStory';+import { homeMocks } from './HomePage.stories.mocks';++import HomePage from '../HomePage';++type HomeArgs = PageStoryArgs<typeof homeMocks>;++const meta = {+ title: 'Pages/Home',+ component: HomePage,+ ...storyMocks(homeMocks, { route: ROUTES.HOME, layout: 'app' }),+} satisfies Meta<HomeArgs>;++export default meta;++type Story = StoryObj<HomeArgs>;++/**+ * Every widget carrying data: all three signals ingesting, alert rules across+ * severities, recent dashboards, saved views on each explorer tab and a+ * services table with failing services.+ */+export const Default: Story = {};++/** Fresh workspace: nothing ingested yet, so the welcome checklist takes over. */+export const NoIngestion: Story = {+ args: {+ logsIngestion: false,+ tracesIngestion: false,+ metricsIngestion: false,+ alertRules: 0,+ dashboards: 0,+ savedViews: 0,+ services: 0,+ },+};++/**+ * Telemetry reads only: no permission to manage anything, so the create actions+ * and the legacy editor role are both gone.+ */+export const ViewerAccess: Story = {+ args: { access: 'viewer' },+};++/** Widgets stuck in their loading state, shell included. */+export const Loading: Story = {+ args: { dataState: 'loading' },+};diff --git a/frontend/src/pages/HomePage/stories/__story_mockdata__/home.ts b/frontend/src/pages/HomePage/stories/__story_mockdata__/home.tsnew file mode 100644index 0000000000..4cbfa280f3--- /dev/null+++ b/frontend/src/pages/HomePage/stories/__story_mockdata__/home.ts@@ -0,0 +1,316 @@+/**+ * AI-owned. Generated and maintained by the `signoz-page-story` skill.+ * Do not hand-edit: regenerate instead.+ */++import { FeatureKeys } from 'constants/features';+import { ORG_PREFERENCES } from 'constants/orgPreferences';+import { checkListStepToPreferenceKeyMap } from 'container/Home/constants';+import type { RuletypesRuleDTO } from 'api/generated/services/sigNoz.schemas';+import type { ServiceDataProps } from 'api/metrics/getTopLevelOperations';+import { alertRulesFixture } from 'mocks-server/__mockdata__/alert_rules';+import { explorerView } from 'mocks-server/__mockdata__/explorer_views';+import { defaultFeatureFlags } from 'tests/fixtures/appContextMock';+import type { FeatureFlagProps } from 'types/api/features/getFeaturesFlags';+import type { MetricRangePayloadV3 } from 'types/api/metrics/getQueryRange';+import type { ServicesList } from 'types/api/metrics/getService';+import type { UserPreference } from 'types/api/preferences/preference';++import { baseUserPreferences } from '@/storybook/msw/__story_mockdata__/appShell';+import { queryRangeV5ScalarResponse } from '@/storybook/msw/__story_mockdata__/queryRange';++export { queryRangeV5ScalarResponse };++/** Shapes follow the fields the components read, not the full generated DTOs. */++export const metricsOnboardingResponse = (+ hasMetrics: boolean,+): Record<string, unknown> => ({+ status: 'success',+ data: { hasMetrics },+});++export const HOME_CHECKLIST_STEPS = [+ 'SEND_LOGS',+ 'SEND_TRACES',+ 'SEND_METRICS',+ 'SETUP_ALERTS',+ 'SETUP_SAVED_VIEWS',+ 'SETUP_DASHBOARDS',+] as const;++export type HomeChecklistStep = (typeof HOME_CHECKLIST_STEPS)[number];++const skippedPreference = (name: string): UserPreference => ({+ name,+ description: 'Welcome checklist step skipped',+ valueType: 'boolean',+ defaultValue: false,+ allowedValues: ['true', 'false'],+ allowedScopes: ['org'],+ value: true,+});++/**+ * The welcome checklist reads its dismissed and skipped flags off the user+ * preferences list, one entry per step.+ */+export const homeUserPreferences = ({+ checklistDismissed,+ skippedSteps,+}: {+ checklistDismissed: boolean;+ skippedSteps: readonly HomeChecklistStep[];+}): UserPreference[] => [+ ...baseUserPreferences,+ ...(checklistDismissed+ ? [skippedPreference(ORG_PREFERENCES.WELCOME_CHECKLIST_DO_LATER)]+ : []),+ ...skippedSteps.map((step) =>+ skippedPreference(checkListStepToPreferenceKeyMap[step]),+ ),+];++const DASHBOARDS = [+ {+ name: 'Kubernetes cluster health',+ tags: [{ key: 'team', value: 'platform' }, { key: 'k8s' }],+ },+ { name: 'API latency overview', tags: [{ key: 'sre' }] },+ {+ name: 'Checkout funnel',+ tags: [{ key: 'team', value: 'payments' }, { key: 'business' }],+ },+ { name: 'Postgres slow queries', tags: [{ key: 'database' }] },+ {+ name: 'Kafka consumer lag',+ tags: [{ key: 'team', value: 'data' }, { key: 'streaming' }],+ },+ { name: 'Ingress error budget', tags: [{ key: 'sre' }, { key: 'slo' }] },+ { name: 'Cost per service', tags: [{ key: 'finops' }] },+ {+ name: 'Redis cache hit rate',+ tags: [{ key: 'database' }, { key: 'cache' }],+ },+];++export const recentDashboardsResponse = (+ count: number,+): Record<string, unknown> => ({+ status: 'success',+ data: {+ dashboards: DASHBOARDS.slice(0, count).map((dashboard, index) => ({+ id: `storybook-dashboard-${index + 1}`,+ name: dashboard.name,+ spec: { display: { name: dashboard.name } },+ tags: dashboard.tags,+ })),+ },+});++const ALERT_NAMES = [+ 'Checkout p99 above 2s',+ 'Payment failure rate',+ 'Log volume spike',+ 'Kafka consumer lag',+ 'Pod restart storm',+ 'Disk usage above 85%',+ 'Frontend error rate',+ 'Postgres connections saturated',+];++/**+ * Cycles the jest fixtures so the list keeps their severity and firing spread.+ * `updatedAt` descends because that is the order the page sorts on.+ */+export const buildAlertRules = (count: number): RuletypesRuleDTO[] =>+ Array.from({ length: count }, (_, index) => ({+ ...alertRulesFixture[index % alertRulesFixture.length],+ id: `storybook-rule-${index + 1}`,+ alert: ALERT_NAMES[index % ALERT_NAMES.length],+ updatedAt: new Date(Date.UTC(2026, 7, 20 - index, 9)).toISOString(),+ }));++export const SAVED_VIEW_SIGNALS = ['logs', 'traces', 'metrics'] as const;++export type SavedViewSignal = (typeof SAVED_VIEW_SIGNALS)[number];++const VIEW_NAMES: Record<SavedViewSignal, string[]> = {+ logs: [+ 'Checkout errors',+ 'Auth service warnings',+ 'Slow SQL statements',+ 'Payment webhooks',+ 'Rate limited requests',+ 'Cron job failures',+ ],+ traces: [+ 'Slowest checkout spans',+ 'Failed payment traces',+ 'Cart to order funnel',+ 'External API calls',+ 'Cold start requests',+ 'Retried gRPC calls',+ ],+ metrics: [+ 'Pod memory by namespace',+ 'Queue depth by topic',+ 'HTTP throughput',+ 'Container CPU throttling',+ 'JVM heap usage',+ 'Cache hit ratio',+ ],+};++export const isSavedViewSignal = (value: string): value is SavedViewSignal =>+ SAVED_VIEW_SIGNALS.includes(value as SavedViewSignal);++export const savedViewsResponse = (+ count: number,+ sourcePage: SavedViewSignal,+): Record<string, unknown> => {+ const names = VIEW_NAMES[sourcePage];++ return {+ status: 'success',+ data: Array.from({ length: Math.min(count, names.length) }, (_, index) => ({+ ...explorerView.data[0],+ id: `storybook-${sourcePage}-view-${index + 1}`,+ name: names[index],+ sourcePage,+ tags: [sourcePage],+ })),+ };+};++/** Ordered by p99 with errors at both ends, so any slice keeps the spread. */+const SERVICES: ServicesList[] = [+ {+ serviceName: 'payments',+ p99: 2_940_100_000,+ avgDuration: 921_440_000,+ numCalls: 46_080,+ callRate: 25.6,+ numErrors: 5990,+ errorRate: 13,+ },+ {+ serviceName: 'checkout',+ p99: 1_248_900_000,+ avgDuration: 486_310_000,+ numCalls: 92_160,+ callRate: 51.2,+ numErrors: 4608,+ errorRate: 5,+ },+ {+ serviceName: 'frontend',+ p99: 812_450_000,+ avgDuration: 274_120_000,+ numCalls: 184_320,+ callRate: 102.4,+ numErrors: 1843,+ errorRate: 1,+ },+ {+ serviceName: 'shipping',+ p99: 486_200_000,+ avgDuration: 192_800_000,+ numCalls: 23_040,+ callRate: 12.8,+ numErrors: 691,+ errorRate: 3,+ },+ {+ serviceName: 'cart',+ p99: 214_800_000,+ avgDuration: 88_640_000,+ numCalls: 138_240,+ callRate: 76.8,+ numErrors: 0,+ errorRate: 0,+ },+ {+ serviceName: 'catalogue',+ p99: 96_300_000,+ avgDuration: 41_220_000,+ numCalls: 276_480,+ callRate: 153.6,+ numErrors: 276,+ errorRate: 0.1,+ },+ {+ serviceName: 'recommendations',+ p99: 64_100_000,+ avgDuration: 28_400_000,+ numCalls: 61_440,+ callRate: 34.1,+ numErrors: 61,+ errorRate: 0.1,+ },+ {+ serviceName: 'notifications',+ p99: 38_700_000,+ avgDuration: 15_900_000,+ numCalls: 12_288,+ callRate: 6.8,+ numErrors: 0,+ errorRate: 0,+ },+];++export const buildServices = (count: number): ServicesList[] =>+ SERVICES.slice(0, count);++export const SERVICES_SOURCES = ['traces', 'span-metrics'] as const;++export type ServicesSource = (typeof SERVICES_SOURCES)[number];++/** `USE_SPAN_METRICS` swaps the services card for the span-metrics one. */+export const homeFeatureFlags = (source: ServicesSource): FeatureFlagProps[] =>+ defaultFeatureFlags.map((flag) =>+ flag.name === FeatureKeys.USE_SPAN_METRICS+ ? { ...flag, active: source === 'span-metrics' }+ : flag,+ );++/** The span-metrics card takes its row set from the top level operations. */+export const topLevelOperationsResponse = (count: number): ServiceDataProps =>+ Object.fromEntries(+ buildServices(count).map((service) => [+ service.serviceName,+ ['HTTP GET /', 'HTTP POST /checkout'],+ ]),+ );++/**+ * Span-metrics latency, error rate and ops per second come off a table panel.+ * The page reads them from `newResult`, which the table branch of+ * `GetMetricQueryRange` never adds, so the columns render as zero however+ * complete this body is. That is the app's gap, not the mock's.+ */+export const spanMetricsResponse = (): {+ status: string;+ data: MetricRangePayloadV3['data'];+} => ({+ status: 'success',+ data: {+ resultType: 'table',+ result: [+ {+ queryName: '',+ legend: '',+ series: null,+ list: null,+ table: {+ columns: [+ { name: 'A', queryName: 'A', isValueColumn: true },+ { name: 'D', queryName: 'D', isValueColumn: true },+ { name: 'F1', queryName: 'F1', isValueColumn: true },+ ],+ rows: [{ data: { A: 148_000_000, D: 12.4, F1: 1.8 } }],+ },+ },+ ],+ },+});diff --git a/frontend/src/storybook/README.md b/frontend/src/storybook/README.mdnew file mode 100644index 0000000000..2b3d468dbd--- /dev/null+++ b/frontend/src/storybook/README.md@@ -0,0 +1,323 @@+# Storybook++Runs SigNoz pages and components with no backend: every request is answered by+msw, and the providers the app mounts at boot are replaced by story-controlled+values.++```bash+pnpm storybook # dev server on :6006+pnpm storybook:build # static build into storybook-static/+```++## Layout++| Path | What lives there |+| ----------------- | ---------------------------------------------------------------------- |+| `runtime/` | `resolveStory`: story context in, the world the story renders in out |+| `controls/` | Declaring controls (`defineStoryMocks`) and composing mock modules |+| `globals/` | The mock modules every story carries: app shell and access |+| `access/` | What a permission grant allows, and the legacy role it derives |+| `providers/` | The Storybook adapter over the app's provider tree in `src/app/` |+| `navigation/` | Keeping a story on its page, and reporting what it tried to leave for |+| `msw/` | The default handler set and the shell's endpoints |+| `mocks/` | Modules aliased in place of the app's own |+| `decorators/` | `withProviders`, the global decorator |++A page's own mocks live with the page, not here. See [Adding a page+story](#adding-a-page-story).++## What a story gets for free++`withProviders` (global decorator, `.storybook/preview.tsx`) wraps every story in+`StorybookProviders`, the Storybook adapter over the app's own provider tree.+That tree is not a copy: `src/index.tsx` and `src/AppRoutes/index.tsx` mount the+same three components, and each leaves the pieces a runner has to choose as+props.++| Component | What it holds | What the runner chooses |+| ----------------------- | --------------------------------------------------------------------- | ------------------------------------- |+| `app/AppProviders` | Helmet, nuqs, theme, timezone, react-query, redux, `AppContext` | store, query client, nuqs adapter, `AppContext` |+| `app/AppShell` | antd config, router, cmd-K, notifications, the error modal | router, the overlays beside the routes |+| `app/AppPageProviders` | resource attributes, query builder, hotkeys, the layout, preferences | the layout, a fixed query-builder context |++What stays with the app and never reaches a story: Sentry, posthog, `AppProvider`+(Storybook has no user, license or flags to fetch), `PrivateRoute` and the route+switch.++`tests/test-utils` mounts its own, smaller tree for jest and does not go through+them: the suite has ~20 files that mock `hooks/useDarkMode`,+`hooks/useNotifications` or `providers/cmdKProvider` down to a single export, so+the providers those modules also carry would come back `undefined`. A provider+added to the app therefore still needs adding in both places.++Storybook fills the seams with:++- `AppContext` from `tests/fixtures/appContextMock`, the same fixture the jest+ suite uses, so a story and a test see the same user, license and flags.+- A fresh react-query client and redux store per story: no cache or state bleed.+- `nuqs` on its testing adapter, so query-param state lives in memory and never+ touches the iframe URL.+- Theme from the toolbar (dark/light). `applyThemeBodyClass` puts `<body>` in the+ state the app gets from `index.html` plus `AppLayout`: `data-theme="default"`+ (every `@signozhq/design-tokens` semantic token is scoped to it, and without it+ `--l1-background` and friends resolve to nothing and the page renders+ unstyled) and the `darkMode`/`dark`/`lightMode` classes.++## The story runtime++`runtime/resolveStory.ts` is the one place that turns a story's parameters and+the controls panel's current values into everything the story runs on: the msw+handlers in resolution order, the provider config, the theme, the remount key,+and the module-level state to seed. The preview loader applies it before the+decorators run; the decorator reads the same result, memoised on the story and+its args.++Handlers resolve first-match-wins, in this order:++1. the story's own `parameters.msw.handlers`;+2. the page's control-driven handlers;+3. the global mocks' handlers (access);+4. `msw/appShellHandlers.ts`, the endpoints the shell hits on every route, and+ the ones whose jest fixture is too thin to show it doing its job;+5. `src/mocks-server/handlers.ts`, the jest handlers verbatim. An endpoint both+ runners need belongs here so jest gets it too;+6. a catch-all for `http://localhost/api/*` that logs and answers 501, so an+ endpoint nobody mocked fails loudly instead of hanging on a refused+ connection.++The whole set is re-registered on every story render rather than handed to+`setupWorker` once. Editing a handler module then takes effect on the next+render; with the handlers baked in at worker creation, a long-lived dev server+kept answering with the set it started with, and endpoints added later showed up+as failed requests.++The handlers are declared against `http://localhost`, which is why+`constants/env` is mocked to that origin. msw intercepts before the request+leaves the page, so nothing reaches the network.++## Overrides++Per-story, through `parameters`:++```tsx+export const Elsewhere: Story = {+ parameters: {+ signoz: {+ route: '/home?relativeTime=1h',+ appContext: { featureFlags: [] },+ reduxState: { globalTime: { ... } },+ theme: 'light',+ },+ msw: {+ handlers: [+ rest.get('http://localhost/api/v2/rules', handleInternalServerError),+ ],+ },+ },+};+```++`parameters.signoz` is typed by `SignozStoryConfig` in `src/storybook/types.ts`.+Who the story runs as is not in there. See [Access](#access).++Anything a page declares as a control belongs in `args`, not in `parameters`.++## The app shell++A page story always runs inside the real `AppLayout` (side nav, top nav,+banners). A page without its shell is not the page anyone sees. Ask for it once+on the meta so every story of that page inherits it:++```tsx+const meta = {+ title: 'Pages/Home',+ component: HomePage,+ ...storyMocks(homeMocks, { route: ROUTES.HOME, layout: 'app' }),+} satisfies Meta<typeof HomePage>;+```++`layout: 'app'` mounts the story where the router mounts a page, inside+`AppPageProviders`, rather than in a decorator below the providers.++## Controls++A page declares what about its mocks is adjustable, and the controls panel drives+it. Every control is a knob on the response, not a prop on the component: turning+one re-registers the msw handlers and remounts the story with an empty query+cache, so the page fetches again and renders the new data.++```tsx+// src/pages/HomePage/stories/HomePage.stories.mocks.ts+export const homeMocks = defineStoryMocks({+ controls: {+ logsIngestion: toggleControl('Logs ingestion', { group: SIGNALS, value: true }),+ dashboards: countControl('Recent dashboards', { group: LISTS, value: 5, max: 8 }),+ welcomeChecklist: choiceControl<ChecklistVisibility>('Welcome checklist', {+ group: ONBOARDING,+ options: CHECKLIST_VISIBILITY,+ value: 'visible',+ }),+ },+ handlers: (values, response) => [+ rest.get(+ 'http://localhost/api/v2/users/me/dashboards',+ response.json(() => recentDashboardsResponse(values.dashboards)),+ ),+ ],+});+```++```tsx+// src/pages/HomePage/stories/HomePage.stories.tsx+type HomeArgs = PageStoryArgs<typeof homeMocks>;++const meta = {+ title: 'Pages/Home',+ component: HomePage,+ ...storyMocks(homeMocks, { route: ROUTES.HOME, layout: 'app' }),+} satisfies Meta<HomeArgs>;++export const NoIngestion: StoryObj<HomeArgs> = {+ args: { logsIngestion: false, tracesIngestion: false, metricsIngestion: false },+};+```++`toggleControl`, `countControl`, `choiceControl` and `multiChoiceControl` build+the panel row and carry the value's type, so `values` inside `handlers` is typed+and a story's `args` are checked.++The hooks a mock module can answer, all optional. `handlers` answers the page's+endpoints; `config` returns the provider-level knobs no endpoint covers;+`responseState` says how the endpoints declared through `response` answer;+`effect` seeds module-level state no provider exposes, such as no-auth mode; and+`role` derives the legacy role, which only `authzMocks` does.++Endpoints declared through `response.json` follow the response state (`loaded`,+`loading` or `error`) which the `Data` control drives, so one declaration covers+all three. Endpoints the page cannot render without, such as ingestion detection+and preferences, take a plain msw resolver so they keep answering while the rest+of the page hangs or fails.++The mock modules every story carries are registered in `globals/index.ts`:+`appShellMocks` (app-wide banners, side nav state, `Data`) and `authzMocks`+(below). Adding one there publishes its controls and widens `PageStoryArgs` in+the same edit.++## Access++Permissions are the knob, not roles. `POST /api/v1/authz/check` is the single+gate the app reads: route guards, `AuthZGuard`, `AuthZButton` and `user.role` all+resolve through it, so the controls answer that endpoint and everything+downstream follows. `access/access.ts` is what decides:+`accessFor(preset, extra, revoked)` returns the permission set, whether a given+check is allowed, and the legacy role it derives.++- **Access**: `admin`, `editor`, `viewer`, `anonymous`, `grant-all`, `deny-all`,+ `custom`, `dev-tools`.+- **Permissions**: granted on top of the preset, as `relation:kind`+ (`read:logs`, `create:serviceaccount`, …); `custom` starts from nothing, so+ there the list is the whole grant. Generated from+ `lib/authz/hooks/useAuthZ/permissions.type.ts`, so a resource added to the+ catalogue shows up without touching Storybook. A selector-scoped check+ (`update` on `role:some-id`) matches the entry for its kind; the legacy+ `assignee:role:signoz-*` permissions are listed individually.+- **Revoked**: taken back off the preset and the grants above, from the same+ catalogue. This is how a story is a complete role missing one permission,+ which is what a page's `stories/authz/` file turns: `revoked:+ ['read:subscription']` reads as the page's `Default` minus that one check,+ and stays that as the catalogue grows.+- **Check state**: `loaded`, `loading` or `error`, the same forcing the AuthZ+ dev modal offers.++`user.role` comes from the same grant, derived the way `AppProvider` derives it,+so the legacy role, `hasEditPermission`, `routePermission` and+`componentPermission` all follow the same control and no story can set them to+something the check endpoint disagrees with. The runtime writes the result to+`<body data-signoz-story-role>`, and the provider tree writes what+`useAppContext()` actually yields to `<body data-signoz-context-role>`, so+whether the page is reading it is one glance away in the Elements panel.++Granting no legacy role at all (`deny-all`, or `custom` without one ticked)+derives `ANONYMOUS`, exactly as `AppProvider` does. The legacy checks are written+as `role !== VIEWER`, so an anonymous user passes them and sees *more* than a+viewer. That is the app's gap, faithfully reproduced: to see the viewer UI, grant+the viewer role. The role-named presets exist because those checks still exist;+when the roles go, delete the presets and the derivation. The permission list+stays.++For anything finer than a preset, the app's own dev tools are mounted in every+story: `⌘K` → **AuthZ DevTools** lists the permissions the page actually checked+and overrides them one by one (granted, denied, delayed, error). Set Access to+`dev-tools` first, because the other values reset the override store on render, so+a leftover override from a real dev session cannot answer for the controls panel.+Overrides only apply while `IS_DEV` is true, which means the dev server, not a+static build.++Adding or renaming a project-level control needs a tab reload: Vite hot-updates+`preview.tsx` without re-preparing the open stories, so the panel keeps the+controls, and the arg values, it was built with.++## Module mocks++Aliased for every story in `.storybook/main.ts`, the same way `jest.config.ts`+does it through `moduleNameMapper`. Each replacement is typed as the module it+stands in for, so an export added to the real module is a compile error here+rather than a story that fails at render:++| Module | Replacement | Why |+| --------------------- | ---------------------------------- | ------------------------------------------ |+| `lib/history` | `navigation/history.alias.ts` | keeps a story on its page, see below |+| `api/common/logEvent` | `mocks/logEvent.mock.ts` | analytics never leave the iframe |+| `constants/env` | `mocks/env.mock.ts` | pins the API origin the handlers answer on |++Mocks use `fn()` from `storybook/test`, so a play function can assert on them:++```tsx+import logEvent from 'api/common/logEvent';++play: async () => {+ await expect(logEvent).toHaveBeenCalledWith('Homepage: Visited', {});+},+```++## Navigation++A story renders one page, so leaving that page would unmount it.+`navigation/pageScope.ts` holds the rule, `navigation/containment.ts` is what the+app sees in place of `lib/history`, and the two tell a navigation apart by+pathname:++- **Same page**: a query-param or hash change, which is how tabs, filters,+ pagination and time ranges are driven. It is applied, and the page re-renders+ the way it does in the app. Anchors are covered too: an in-page `<a href="?tab=x">`+ or `<Link to="/home?tab=x">` is intercepted and pushed onto the story's history+ rather than followed, which would navigate the iframe out of the story.+- **Another page**: a different pathname, an off-site href, `window.open` (what+ `useSafeNavigate({ newTab })` calls) or a relative `go`/`goBack`, which carries+ no target to compare against. It is swallowed and reported to+ `NavigationBlockedOverlay`, which lists what was attempted. Nothing is silently+ dropped.++`nuqs` is the one gap: it runs on its testing adapter and keeps its own copy of+the query string, seeded from the story's `route`. A page that writes params+through both `useQueryState` and `history.push({ search })` sees the two diverge+inside a story; a page that stays on one mechanism does not.++## Adding a page story++The `signoz-page-story` skill in `.claude/skills/` carries this as a workflow:+mapping the page, deriving its controls, and the checks a story has to pass.++1. Point the story at the page component under `src/pages/<Page>`.+2. Keep every story file under `src/pages/<Page>/stories/`: the story, the+ page's mocks in `<Page>.stories.mocks.ts`, and its payload builders under+ `stories/__story_mockdata__/`. Spread `storyMocks(<page>Mocks, { route })`+ into the meta.+3. Pass `layout: 'app'` in the same config, so the page renders inside+ `AppLayout` where a route puts it.+4. Give the default story every widget populated. A page story earns its keep by+ showing what the page looks like with data, not with empty states.+5. Run it and watch the console: an msw warning or a `[storybook] no msw handler`+ line is an endpoint the page hits that no handler covers yet.+6. Reach for a control before a story. A variant earns a story only when it is+ worth linking to; anything else is a control someone can turn.diff --git a/frontend/src/storybook/access/access.ts b/frontend/src/storybook/access/access.tsnew file mode 100644index 0000000000..b09ea1f814--- /dev/null+++ b/frontend/src/storybook/access/access.ts@@ -0,0 +1,161 @@+import type { AuthtypesTransactionDTO } from 'api/generated/services/sigNoz.schemas';+import {+ IsAdminPermission,+ IsAnonymousPermission,+ IsEditorPermission,+ IsViewerPermission,+} from 'lib/authz/hooks/useAuthZ/legacy';+import permissionsType from 'lib/authz/hooks/useAuthZ/permissions.type';+import {+ formatPermission,+ gettableTransactionToPermission,+} from 'lib/authz/hooks/useAuthZ/utils';+import { ROLES, USER_ROLES } from 'types/roles';++/**+ * `relation:kind` for every verb the backend allows on a resource, from the+ * generated permission catalogue, so a resource added there shows up here+ * without anyone touching this file. Selector-scoped checks (`role:some-id`)+ * match the entry for their kind.+ */+export const permissionCatalogue = (): string[] => {+ const entries = new Set<string>();++ for (const [relation, types] of Object.entries(+ permissionsType.data.relations,+ )) {+ for (const resource of permissionsType.data.resources) {+ const appliesToResource = (types as readonly string[]).includes(+ resource.type,+ );++ const allowsVerb = (resource.allowedVerbs as readonly string[]).includes(+ relation,+ );++ if (appliesToResource && allowsVerb) {+ entries.add(`${relation}:${resource.kind}`);+ }+ }+ }++ return [...entries].sort();+};++const CATALOGUE = permissionCatalogue();++const TELEMETRY_READS = CATALOGUE.filter((permission) =>+ permissionsType.data.resources.some(+ (resource) =>+ resource.type === 'telemetryresource' &&+ permission === `read:${resource.kind}`,+ ),+);++/**+ * `user.role` is itself an authz check in the real app (`AppProvider` derives it+ * from these), so a caller that wants a role grants the matching permission+ * rather than setting the role directly.+ */+export const LEGACY_ROLE_PERMISSIONS = {+ [USER_ROLES.ADMIN]: formatPermission(IsAdminPermission),+ [USER_ROLES.EDITOR]: formatPermission(IsEditorPermission),+ [USER_ROLES.VIEWER]: formatPermission(IsViewerPermission),+ [USER_ROLES.ANONYMOUS]: formatPermission(IsAnonymousPermission),+};++export const ACCESS_PRESETS = [+ 'admin',+ 'editor',+ 'viewer',+ 'anonymous',+ 'grant-all',+ 'deny-all',+ 'custom',+ 'dev-tools',+] as const;++export type AccessPreset = (typeof ACCESS_PRESETS)[number];++/**+ * The legacy roles only differ in authz for the resources the backend already+ * covers: an admin manages roles, service accounts and API keys, while editor+ * and viewer are telemetry readers and differ through `user.role` alone. The+ * presets go away with the roles; the permission list does not.+ */+const ADMIN_PERMISSIONS = [+ LEGACY_ROLE_PERMISSIONS[USER_ROLES.ADMIN],+ // Without the `assignee` wildcard, which would hand out every legacy role at+ // once. That is what `grant-all` is for.+ ...CATALOGUE.filter((permission) => permission !== 'assignee:role'),+];++const PRESET_PERMISSIONS: Record<AccessPreset, readonly string[]> = {+ admin: ADMIN_PERMISSIONS,+ editor: [LEGACY_ROLE_PERMISSIONS[USER_ROLES.EDITOR], ...TELEMETRY_READS],+ viewer: [LEGACY_ROLE_PERMISSIONS[USER_ROLES.VIEWER], ...TELEMETRY_READS],+ anonymous: [LEGACY_ROLE_PERMISSIONS[USER_ROLES.ANONYMOUS]],+ 'grant-all': [...Object.values(LEGACY_ROLE_PERMISSIONS), ...CATALOGUE],+ 'deny-all': [],+ custom: [],+ 'dev-tools': ADMIN_PERMISSIONS,+};++/** Every permission a caller can grant on top of a preset. */+export const PERMISSION_OPTIONS = [+ ...Object.values(LEGACY_ROLE_PERMISSIONS),+ ...CATALOGUE,+];++export interface AccessGrant {+ permissions: ReadonlySet<string>;+ /** Answers one `authz/check` transaction the way the backend would. */+ allows(transaction: AuthtypesTransactionDTO): boolean;+ /**+ * The legacy role the granted `assignee:role:signoz-*` permissions derive,+ * the way `AppProvider` derives it. No legacy role granted lands on+ * `ANONYMOUS`.+ */+ legacyRole: ROLES;+}++const deriveLegacyRole = (granted: ReadonlySet<string>): ROLES => {+ const role = Object.entries(LEGACY_ROLE_PERMISSIONS).find(([, permission]) =>+ granted.has(permission),+ );++ return (role?.[0] ?? USER_ROLES.ANONYMOUS) as ROLES;+};++/**+ * The permission set a preset plus its extra grants resolve to, less what is+ * revoked on top, and the two questions the app asks of it. `custom` and+ * `deny-all` start from nothing, so there the extra grants are the whole set.+ * Revoking is what reaches "everything but this one", which is the shape of a+ * page's per-permission stories: listing a whole preset back out by hand drifts+ * from it the moment the catalogue grows.+ */+export const accessFor = (+ preset: AccessPreset,+ extraPermissions: readonly string[] = [],+ revokedPermissions: readonly string[] = [],+): AccessGrant => {+ const permissions = new Set([+ ...PRESET_PERMISSIONS[preset],+ ...extraPermissions,+ ]);++ revokedPermissions.forEach((permission) => permissions.delete(permission));++ return {+ permissions,+ allows: (transaction): boolean =>+ permissions.has(+ formatPermission(gettableTransactionToPermission(transaction)),+ ) ||+ permissions.has(+ `${transaction.relation}:${transaction.object.resource.kind}`,+ ),+ legacyRole: deriveLegacyRole(permissions),+ };+};diff --git a/frontend/src/storybook/controls/composeStoryMocks.ts b/frontend/src/storybook/controls/composeStoryMocks.tsnew file mode 100644index 0000000000..37394f3687--- /dev/null+++ b/frontend/src/storybook/controls/composeStoryMocks.ts@@ -0,0 +1,34 @@+import type { AnyStoryMocks, ControlDescriptor, StoryMockArgs } from './types';++type UnionToIntersection<TUnion> = (+ TUnion extends unknown ? (arg: TUnion) => void : never+) extends (arg: infer TIntersection) => void+ ? TIntersection+ : never;++/** The args of every mock module in a list, as one object type. */+export type ComposedMockArgs<TMocks extends readonly AnyStoryMocks[]> =+ UnionToIntersection<StoryMockArgs<TMocks[number]>>;++export interface ComposedStoryMocks<TMocks extends readonly AnyStoryMocks[]> {+ /** In resolution order: the first module to answer a question wins. */+ members: TMocks;+ args: ComposedMockArgs<TMocks>;+ argTypes: Record<string, ControlDescriptor>;+}++/**+ * One registration point for a set of mock modules: the panel rows they publish+ * and the args type a story is checked against are both derived from the list,+ * so adding a module is a single edit.+ */+export const composeStoryMocks = <TMocks extends readonly AnyStoryMocks[]>(+ ...members: TMocks+): ComposedStoryMocks<TMocks> => ({+ members,+ args: Object.assign(+ {},+ ...members.map((mocks) => mocks.args),+ ) as ComposedMockArgs<TMocks>,+ argTypes: Object.assign({}, ...members.map((mocks) => mocks.argTypes)),+});diff --git a/frontend/src/storybook/controls/controls.ts b/frontend/src/storybook/controls/controls.tsnew file mode 100644index 0000000000..87931e408a--- /dev/null+++ b/frontend/src/storybook/controls/controls.ts@@ -0,0 +1,73 @@+import type { ControlDescriptor, MockControl } from './types';++interface ControlOptions {+ /** Controls-panel group, so a page's knobs stay together. */+ group: string;+ description?: string;+}++const describe = (+ name: string,+ { group, description }: ControlOptions,+ value: unknown,+): ControlDescriptor => ({+ name,+ description,+ table: {+ category: group,+ defaultValue: { summary: JSON.stringify(value) },+ },+});++export const toggleControl = (+ name: string,+ options: ControlOptions & { value: boolean },+): MockControl<boolean> => ({+ defaultValue: options.value,+ argType: {+ ...describe(name, options, options.value),+ control: { type: 'boolean' },+ },+});++/**+ * Item count for a list. `max` should go past what the page renders so a story+ * can show the cap being hit.+ */+export const countControl = (+ name: string,+ options: ControlOptions & { value: number; max: number },+): MockControl<number> => ({+ defaultValue: options.value,+ argType: {+ ...describe(name, options, options.value),+ control: { type: 'range', min: 0, max: options.max, step: 1 },+ },+});++export const choiceControl = <TOption extends string>(+ name: string,+ options: ControlOptions & { value: TOption; options: readonly TOption[] },+): MockControl<TOption> => ({+ defaultValue: options.value,+ argType: {+ ...describe(name, options, options.value),+ control: { type: 'select' },+ options: [...options.options],+ },+});++export const multiChoiceControl = <TOption extends string>(+ name: string,+ options: ControlOptions & {+ value: readonly TOption[];+ options: readonly TOption[];+ },+): MockControl<TOption[]> => ({+ defaultValue: [...options.value],+ argType: {+ ...describe(name, options, options.value),+ control: { type: 'check' },+ options: [...options.options],+ },+});diff --git a/frontend/src/storybook/controls/defineStoryMocks.ts b/frontend/src/storybook/controls/defineStoryMocks.tsnew file mode 100644index 0000000000..2c2a0d930a--- /dev/null+++ b/frontend/src/storybook/controls/defineStoryMocks.ts@@ -0,0 +1,59 @@+import type {+ ControlDescriptor,+ MockControlMap,+ MockControlValues,+ StoryMocks,+ StoryMocksDefinition,+} from './types';+import type { SignozStoryConfig, StoryOwnedConfig } from '../types';++/**+ * Turns a page's control declarations into the `args` / `argTypes` its meta+ * exposes and the reader the runtime uses to fold the panel's current values+ * back into mock responses.+ */+export const defineStoryMocks = <TControls extends MockControlMap>(+ definition: StoryMocksDefinition<TControls>,+): StoryMocks<TControls> => {+ const entries = Object.entries(definition.controls);++ const args = Object.fromEntries(+ entries.map(([name, control]) => [name, control.defaultValue]),+ ) as MockControlValues<TControls>;++ const argTypes: Record<string, ControlDescriptor> = Object.fromEntries(+ entries.map(([name, control]) => [name, control.argType]),+ );++ return {+ ...definition,+ args,+ argTypes,+ read: (storyArgs): MockControlValues<TControls> =>+ Object.fromEntries(+ entries.map(([name, control]) => [+ name,+ storyArgs[name] ?? control.defaultValue,+ ]),+ ) as MockControlValues<TControls>,+ };+};++interface StoryMocksMeta<TControls extends MockControlMap> {+ args: MockControlValues<TControls>;+ argTypes: Record<string, ControlDescriptor>;+ parameters: { signoz: SignozStoryConfig };+}++/**+ * Meta fragment a page spreads to publish its controls:+ * `...storyMocks(homeMocks, { route: ROUTES.HOME })`.+ */+export const storyMocks = <TControls extends MockControlMap>(+ mocks: StoryMocks<TControls>,+ config?: StoryOwnedConfig,+): StoryMocksMeta<TControls> => ({+ args: mocks.args,+ argTypes: mocks.argTypes,+ parameters: { signoz: { ...config, mocks } },+});diff --git a/frontend/src/storybook/controls/types.ts b/frontend/src/storybook/controls/types.tsnew file mode 100644index 0000000000..b8bd5c3478--- /dev/null+++ b/frontend/src/storybook/controls/types.ts@@ -0,0 +1,63 @@+import type { ArgTypes } from '@storybook/react-vite';+import type { RequestHandler } from 'msw';++import type { MockResponse } from '../msw/types';+import type { ResponseState } from '../runtime/responseState';+import type { StoryOwnedConfig, StoryRole } from '../types';++export type ControlDescriptor = ArgTypes[string];++/** One row of the Storybook controls panel plus the value it starts at. */+export interface MockControl<TValue> {+ defaultValue: TValue;+ argType: ControlDescriptor;+}++export type MockControlMap = Record<string, MockControl<unknown>>;++export type MockControlValues<TControls extends MockControlMap> = {+ [TName in keyof TControls]: TControls[TName] extends MockControl<infer TValue>+ ? TValue+ : never;+};++/**+ * What a mock module contributes to the story it runs in. Only `controls` is+ * required; the rest are the ways a control can reach the page.+ */+export interface StoryMocksDefinition<TControls extends MockControlMap> {+ controls: TControls;+ handlers?(+ values: MockControlValues<TControls>,+ response: MockResponse,+ ): RequestHandler[];+ /** Provider-level knobs no endpoint covers. */+ config?(values: MockControlValues<TControls>): Partial<StoryOwnedConfig>;+ /** Seeds module-level app state no provider exposes, e.g. no-auth mode. */+ effect?(values: MockControlValues<TControls>): void;+ /**+ * How the endpoints declared through `response` answer. The first module that+ * answers decides, page modules ahead of the global ones.+ */+ responseState?(values: MockControlValues<TControls>): ResponseState;+ /**+ * The legacy role the story runs as. Derived, never set by a story. See+ * `authzMocks`, which derives it from the permissions it grants.+ */+ role?(values: MockControlValues<TControls>): StoryRole;+}++export interface StoryMocks<+ TControls extends MockControlMap,+> extends StoryMocksDefinition<TControls> {+ args: MockControlValues<TControls>;+ argTypes: Record<string, ControlDescriptor>;+ read(args: Record<string, unknown>): MockControlValues<TControls>;+}++export type AnyStoryMocks = StoryMocks<MockControlMap>;++export type StoryMockArgs<TMocks extends AnyStoryMocks> =+ TMocks extends StoryMocks<infer TControls>+ ? MockControlValues<TControls>+ : never;diff --git a/frontend/src/storybook/decorators/withProviders.tsx b/frontend/src/storybook/decorators/withProviders.tsxnew file mode 100644index 0000000000..69c2944a38--- /dev/null+++ b/frontend/src/storybook/decorators/withProviders.tsx@@ -0,0 +1,23 @@+import type { Decorator } from '@storybook/react-vite';++import StorybookProviders from '../providers/StorybookProviders';+import {+ resolveStory,+ type StoryRuntimeContext,+} from '../runtime/resolveStory';++/**+ * Global decorator: every story renders inside the mocked provider tree the+ * story runtime resolved. Everything the tree needs in place first (handlers,+ * module-level state, theme) is applied by the preview loader, which runs+ * ahead of this.+ */+export const withProviders: Decorator = (Story, context) => {+ const world = resolveStory(context as unknown as StoryRuntimeContext);++ return (+ <StorybookProviders key={world.key} {...world.config}>+ <Story />+ </StorybookProviders>+ );+};diff --git a/frontend/src/storybook/globals/appShellMocks.ts b/frontend/src/storybook/globals/appShellMocks.tsnew file mode 100644index 0000000000..65bd84c103--- /dev/null+++ b/frontend/src/storybook/globals/appShellMocks.ts@@ -0,0 +1,267 @@+import { StatusCodes } from 'http-status-codes';+import { FeatureKeys } from 'constants/features';+import { USER_PREFERENCES } from 'constants/userPreferences';+import type { IAppContext } from 'providers/App/types';+import { createAppContextMock } from 'tests/fixtures/appContextMock';+import APIError from 'types/api/error';+import type { FeatureFlagProps } from 'types/api/features/getFeaturesFlags';+import {+ LicenseEvent,+ LicensePlatform,+ type LicenseResModel,+ LicenseState,+} from 'types/api/licensesV3/getActive';+import type { UserPreference } from 'types/api/preferences/preference';+import { USER_ROLES } from 'types/roles';+import { setNoAuthMode } from 'utils/noAuthMode';++import { choiceControl } from '../controls/controls';+import { defineStoryMocks } from '../controls/defineStoryMocks';+import type { StoryMockArgs } from '../controls/types';+import { RESPONSE_STATES, type ResponseState } from '../runtime/responseState';++const APP_SHELL = 'App shell';+const DATA = 'Data';+const LICENSE = 'License';++const DAY_IN_SECONDS = 24 * 60 * 60;++const LICENSES = [+ 'cloud',+ 'enterprise',+ 'community-enterprise',+ 'community',+] as const;++const BANNERS = [+ 'none',+ 'trial-expiry',+ 'payment-failed',+ 'license-expired',+ 'license-terminated',+ 'no-auth',+] as const;++type License = (typeof LICENSES)[number];++type Banner = (typeof BANNERS)[number];++const SIDENAV_STATES = ['pinned', 'collapsed'] as const;++type SidenavState = (typeof SIDENAV_STATES)[number];++const {+ activeLicense: baseLicense,+ trialInfo: baseTrialInfo,+ featureFlags: baseFeatureFlags,+ versionData: baseVersionData,+} = createAppContextMock(USER_ROLES.ADMIN);++/**+ * The status code `/licenses/active` failed with is itself the signal+ * `useGetTenantLicense` reads: 404 is the enterprise build running unlicensed,+ * 501 the community build, where the endpoint does not exist at all.+ */+const licenseFetchError = (httpStatusCode: StatusCodes): APIError =>+ new APIError({+ httpStatusCode,+ error: {+ code: 'license_unavailable',+ message: 'storybook: no active license',+ url: '',+ errors: [],+ },+ });++const feature = (name: FeatureKeys, active: boolean): FeatureFlagProps => ({+ name,+ active,+ usage: 0,+ usage_limit: -1,+ route: '',+});++/**+ * What the backend serves an unlicensed enterprise build — the same keys as the+ * enterprise plan, all inactive. Mirrors `BasicPlan` in+ * `pkg/types/licensetypes/plan.go`; the community build serves none at all.+ */+const BASIC_PLAN: FeatureFlagProps[] = [+ FeatureKeys.SSO,+ FeatureKeys.GATEWAY,+ FeatureKeys.PREMIUM_SUPPORT,+ FeatureKeys.ANOMALY_DETECTION,+].map((name) => feature(name, false));++/**+ * Which of the four deployments `useGetTenantLicense` distinguishes the story+ * runs on. The license drives the plan the app believes it is on, so the feature+ * flags and the enterprise/community build marker follow it.+ */+const licenseContext = (license: License): Partial<IAppContext> => {+ switch (license) {+ case 'enterprise':+ return {+ activeLicense: baseLicense && {+ ...baseLicense,+ platform: LicensePlatform.SELF_HOSTED,+ },+ activeLicenseFetchError: null,+ };++ case 'community-enterprise':+ return {+ activeLicense: null,+ activeLicenseFetchError: licenseFetchError(StatusCodes.NOT_FOUND),+ featureFlags: BASIC_PLAN,+ };++ case 'community':+ return {+ activeLicense: null,+ activeLicenseFetchError: licenseFetchError(StatusCodes.NOT_IMPLEMENTED),+ featureFlags: [],+ versionData: baseVersionData && { ...baseVersionData, ee: 'N' },+ };++ default:+ return {+ activeLicense: baseLicense,+ activeLicenseFetchError: null,+ featureFlags: baseFeatureFlags,+ };+ }+};++/**+ * A banner that reads the license needs one to read, so the community+ * deployments fall back to the licensed fixture rather than showing nothing.+ */+const licensedBanner = (+ activeLicense: LicenseResModel | null,+ extend: (license: LicenseResModel) => LicenseResModel,+): Partial<IAppContext> => {+ const license = activeLicense ?? baseLicense;++ return {+ activeLicense: license && extend(license),+ activeLicenseFetchError: null,+ };+};++const bannerContext = (+ banner: Banner,+ activeLicense: LicenseResModel | null,+): Partial<IAppContext> => {+ const nowInSeconds = Math.floor(Date.now() / 1000);++ switch (banner) {+ case 'trial-expiry':+ return {+ trialInfo: {+ ...baseTrialInfo,+ onTrial: true,+ trialStart: nowInSeconds - 27 * DAY_IN_SECONDS,+ trialEnd: nowInSeconds + 3 * DAY_IN_SECONDS,+ workSpaceBlock: false,+ trialConvertedToSubscription: false,+ gracePeriodEnd: -1,+ },+ };++ case 'payment-failed':+ return licensedBanner(activeLicense, (license) => ({+ ...license,+ eventQueue: {+ ...license.eventQueue,+ event: LicenseEvent.DEFAULT,+ scheduledAt: new Date(+ Date.now() + 7 * DAY_IN_SECONDS * 1000,+ ).toISOString(),+ },+ }));++ // Both restricted-workspace banners need a self-hosted license; the cloud+ // platform never reaches that branch.+ case 'license-expired':+ return licensedBanner(activeLicense, (license) => ({+ ...license,+ platform: LicensePlatform.SELF_HOSTED,+ state: LicenseState.EXPIRED,+ }));++ case 'license-terminated':+ return licensedBanner(activeLicense, (license) => ({+ ...license,+ platform: LicensePlatform.SELF_HOSTED,+ state: LicenseState.TERMINATED,+ }));++ default:+ return {};+ }+};++/**+ * `AppLayout` lays the shell out from the context rather than the API, so the+ * side nav only matches the real app when this is seeded.+ */+const sidenavPreferences = (pinned: boolean): UserPreference[] => [+ {+ name: USER_PREFERENCES.SIDENAV_PINNED,+ description: 'Keep the side navigation pinned open',+ valueType: 'boolean',+ defaultValue: false,+ allowedValues: ['true', 'false'],+ allowedScopes: ['user'],+ value: pinned,+ },+];++/** Who is looking at the page is `authzMocks`; everything else is here. */+export const appShellMocks = defineStoryMocks({+ controls: {+ license: choiceControl<License>('License', {+ group: LICENSE,+ description:+ 'The deployment the story runs on, as `useGetTenantLicense` reads it. `cloud` and `enterprise` are licensed and carry the enterprise plan; `community-enterprise` is the enterprise build with no license (basic plan, every feature inactive) and `community` the open-source build (no plan, `ee: N`).',+ options: LICENSES,+ value: 'cloud',+ }),+ banner: choiceControl<Banner>('Banner', {+ group: APP_SHELL,+ description:+ 'License, trial and no-auth banners above the shell. The license ones need a license to read, so they override an unlicensed License control.',+ options: BANNERS,+ value: 'none',+ }),+ sidenav: choiceControl<SidenavState>('Side nav', {+ group: APP_SHELL,+ options: SIDENAV_STATES,+ value: 'pinned',+ }),+ dataState: choiceControl<ResponseState>('State', {+ group: DATA,+ description: 'How the endpoints the page owns answer.',+ options: RESPONSE_STATES,+ value: 'loaded',+ }),+ },+ responseState: ({ dataState }) => dataState,+ config: ({ license, banner, sidenav }) => {+ const tenant = licenseContext(license);++ return {+ appContext: {+ ...tenant,+ ...bannerContext(banner, tenant.activeLicense ?? null),+ userPreferences: sidenavPreferences(sidenav === 'pinned'),+ },+ };+ },+ effect: ({ banner }) => {+ setNoAuthMode(banner === 'no-auth');+ },+});++export type AppShellArgs = StoryMockArgs<typeof appShellMocks>;diff --git a/frontend/src/storybook/globals/authzMocks.ts b/frontend/src/storybook/globals/authzMocks.tsnew file mode 100644index 0000000000..e040c7b708--- /dev/null+++ b/frontend/src/storybook/globals/authzMocks.ts@@ -0,0 +1,91 @@+import { rest } from 'msw';+import type { AuthtypesTransactionDTO } from 'api/generated/services/sigNoz.schemas';+import { clearAllAuthZDevOverrides } from 'lib/authz/devtools/useAuthZDevStore';+import {+ AUTHZ_CHECK_URL,+ authzMockResponse,+} from 'lib/authz/utils/authz-test-utils';++import {+ accessFor,+ ACCESS_PRESETS,+ type AccessPreset,+ PERMISSION_OPTIONS,+} from '../access/access';+import { choiceControl, multiChoiceControl } from '../controls/controls';+import { defineStoryMocks } from '../controls/defineStoryMocks';+import type { StoryMockArgs } from '../controls/types';+import {+ respondWith,+ RESPONSE_STATES,+ type ResponseState,+} from '../runtime/responseState';++const ACCESS = 'Access';++/**+ * Every permission check a story makes, answered from the controls panel rather+ * than from a role. `POST /api/v1/authz/check` is the single gate the app reads:+ * route guards, `AuthZGuard`, `AuthZButton` and `user.role` all resolve through+ * it, and `access/access.ts` decides what the grant allows.+ */+export const authzMocks = defineStoryMocks({+ controls: {+ access: choiceControl<AccessPreset>('Access', {+ group: ACCESS,+ description:+ 'Base permission set the check endpoint answers with. `custom` starts from nothing, so only the list below counts; `dev-tools` grants an admin set and leaves the AuthZ dev modal (⌘K) in charge. Granting no legacy role lands on `ANONYMOUS`, which the role-based checks still treat as "not a viewer".',+ options: ACCESS_PRESETS,+ value: 'admin',+ }),+ permissions: multiChoiceControl('Permissions', {+ group: ACCESS,+ description:+ 'Granted on top of the preset, as `relation:kind`. A selector-scoped check matches its kind. With Access on `custom` this is the whole list.',+ options: PERMISSION_OPTIONS,+ value: [],+ }),+ revoked: multiChoiceControl('Revoked', {+ group: ACCESS,+ description:+ "Taken back off the preset and the grants above, so a story can be an otherwise complete role missing one permission. This is what a page's per-permission stories turn.",+ options: PERMISSION_OPTIONS,+ value: [],+ }),+ authzState: choiceControl<ResponseState>('Check state', {+ group: ACCESS,+ description:+ 'How `authz/check` answers, the way the dev modal can force it.',+ options: RESPONSE_STATES,+ value: 'loaded',+ }),+ },+ handlers: ({ access, permissions, revoked, authzState }) => {+ const granted = accessFor(access, permissions, revoked);++ return [+ rest.post(+ AUTHZ_CHECK_URL,+ respondWith(authzState, async (req) => {+ const payload = (await req.json()) as AuthtypesTransactionDTO[];++ return authzMockResponse(+ payload,+ payload.map((transaction) => granted.allows(transaction)),+ );+ }),+ ),+ ];+ },+ role: ({ access, permissions, revoked }) =>+ accessFor(access, permissions, revoked).legacyRole,+ // Overrides persist in localStorage, so a leftover one from a real dev session+ // would silently answer for the controls panel.+ effect: ({ access }) => {+ if (access !== 'dev-tools') {+ clearAllAuthZDevOverrides();+ }+ },+});++export type AuthzArgs = StoryMockArgs<typeof authzMocks>;diff --git a/frontend/src/storybook/globals/index.ts b/frontend/src/storybook/globals/index.tsnew file mode 100644index 0000000000..c2b3e317fb--- /dev/null+++ b/frontend/src/storybook/globals/index.ts@@ -0,0 +1,12 @@+import { composeStoryMocks } from '../controls/composeStoryMocks';+import { appShellMocks } from './appShellMocks';+import { authzMocks } from './authzMocks';++/**+ * The mock modules every story carries, page or component, declared at project+ * level in `.storybook/preview.tsx`. Adding one here publishes its controls and+ * widens `PageStoryArgs` in the same edit.+ */+export const globalMocks = composeStoryMocks(authzMocks, appShellMocks);++export type GlobalMockArgs = typeof globalMocks.args;diff --git a/frontend/src/storybook/mocks/createStoryAppContext.ts b/frontend/src/storybook/mocks/createStoryAppContext.tsnew file mode 100644index 0000000000..e8590a27e3--- /dev/null+++ b/frontend/src/storybook/mocks/createStoryAppContext.ts@@ -0,0 +1,8 @@+import { IAppContext } from 'providers/App/types';+import { fn } from 'storybook/test';+import { createAppContextMock } from 'tests/fixtures/appContextMock';++export const createStoryAppContext = (+ role: string,+ overrides?: Partial<IAppContext>,+): IAppContext => createAppContextMock(role, overrides, () => fn());diff --git a/frontend/src/storybook/mocks/env.mock.ts b/frontend/src/storybook/mocks/env.mock.tsnew file mode 100644index 0000000000..2e09b8703d--- /dev/null+++ b/frontend/src/storybook/mocks/env.mock.ts@@ -0,0 +1,20 @@+/**+ * Replaces `constants/env` in Storybook (aliased in `.storybook/main.ts`).+ *+ * The base URL must stay `http://localhost` so the msw handlers shared with+ * jest (`src/mocks-server/handlers.ts`), which are declared against that+ * origin, match requests issued from the Storybook iframe. msw intercepts+ * before the request leaves the page, so the cross-origin URL never hits the+ * network and CORS never applies.+ *+ * The annotation checks the module's shape against the real one, so a value+ * added to `constants/env` fails to compile here rather than at render.+ */+const libEnv: typeof import('constants/env') = {+ ENVIRONMENT: {+ baseURL: 'http://localhost',+ wsURL: 'ws://localhost',+ },+};++export const { ENVIRONMENT } = libEnv;diff --git a/frontend/src/storybook/mocks/logEvent.mock.ts b/frontend/src/storybook/mocks/logEvent.mock.tsnew file mode 100644index 0000000000..e0c4d85f5f--- /dev/null+++ b/frontend/src/storybook/mocks/logEvent.mock.ts@@ -0,0 +1,20 @@+import { fn } from 'storybook/test';++/**+ * Replaces `api/common/logEvent` in Storybook (aliased in `.storybook/main.ts`)+ * so analytics never leave the iframe. Stories can assert on the calls:+ * `import logEvent from 'api/common/logEvent'` then `expect(logEvent)...`.+ *+ * The annotation checks the module's shape against the real one, so a change to+ * `logEvent`'s signature fails to compile here rather than at render.+ */+const libLogEvent: typeof import('api/common/logEvent') = {+ default: fn(async () => ({+ statusCode: 200 as const,+ error: null,+ message: 'success',+ payload: { status: 'success', data: '' },+ })).mockName('logEvent'),+};++export default libLogEvent.default;diff --git a/frontend/src/storybook/msw/__story_mockdata__/appShell.ts b/frontend/src/storybook/msw/__story_mockdata__/appShell.tsnew file mode 100644index 0000000000..d496ff5f43--- /dev/null+++ b/frontend/src/storybook/msw/__story_mockdata__/appShell.ts@@ -0,0 +1,110 @@+/**+ * AI-owned. Generated and maintained by the `signoz-page-story` skill.+ * Do not hand-edit: regenerate instead.+ */++import { USER_PREFERENCES } from 'constants/userPreferences';+import type { UserPreference } from 'types/api/preferences/preference';++/**+ * Wire-shaped payloads for the endpoints the app shell calls on every route.+ * Shapes follow the fields the components read, not the full generated DTOs.+ */++export const baseUserPreferences: UserPreference[] = [+ {+ name: USER_PREFERENCES.SIDENAV_PINNED,+ description: 'Keep the side navigation pinned open',+ valueType: 'boolean',+ defaultValue: false,+ allowedValues: ['true', 'false'],+ allowedScopes: ['user'],+ value: true,+ },+];++export const userPreferencesResponse = (+ preferences: UserPreference[] = baseUserPreferences,+): Record<string, unknown> => ({+ status: 'success',+ data: preferences,+});++export const zeusHostsResponse = {+ status: 'success',+ data: {+ hosts: [{ url: 'https://ingest.us.signoz.cloud:443', is_default: true }],+ },+};++export const versionResponse = {+ version: 'v0.0.0',+ ee: 'Y',+ setupCompleted: true,+};++export const latestGithubReleaseResponse = {+ tag_name: 'v0.0.0',+ name: 'v0.0.0',+ html_url: 'https://github.com/SigNoz/signoz/releases/tag/v0.0.0',+};++export const globalConfigResponse = {+ status: 'success',+ data: {+ ai_assistant_url: null,+ external_url: 'https://storybook.signoz.local',+ ingestion_url: 'https://ingest.us.signoz.cloud:443',+ mcp_url: null,+ },+};++/**+ * `ChangelogSchema` for the current version. Kept non-empty because+ * `getChangelogByVersion` treats an empty list as a failure, and media is left+ * null so no story reaches out for an image.+ */+export const changelogResponse = {+ data: [+ {+ id: 1,+ documentId: 'changelog-v0-99-0',+ version: 'v0.0.0',+ release_date: '2026-08-12',+ bug_fixes:+ 'Fixed dashboard variables losing their selection on refresh.\nFixed alert history pagination.',+ maintenance: 'Upgraded the query service to Go 1.24.',+ createdAt: '2026-08-12T09:00:00.000Z',+ updatedAt: '2026-08-12T09:00:00.000Z',+ publishedAt: '2026-08-12T09:00:00.000Z',+ features: [+ {+ id: 11,+ documentId: 'feature-metrics-explorer',+ title: 'Metrics explorer',+ sort_order: 1,+ createdAt: '2026-08-12T09:00:00.000Z',+ updatedAt: '2026-08-12T09:00:00.000Z',+ publishedAt: '2026-08-12T09:00:00.000Z',+ description:+ 'Browse every metric you send, inspect its labels and turn it into a panel without writing a query.',+ deployment_type: 'All',+ media: null,+ },+ {+ id: 12,+ documentId: 'feature-trace-funnels',+ title: 'Trace funnels',+ sort_order: 2,+ createdAt: '2026-08-12T09:00:00.000Z',+ updatedAt: '2026-08-12T09:00:00.000Z',+ publishedAt: '2026-08-12T09:00:00.000Z',+ description:+ 'Measure conversion and drop-off across a multi-service request path.',+ deployment_type: 'All',+ media: null,+ },+ ],+ },+ ],+};diff --git a/frontend/src/storybook/msw/__story_mockdata__/queryRange.ts b/frontend/src/storybook/msw/__story_mockdata__/queryRange.tsnew file mode 100644index 0000000000..eb2fcd0a2d--- /dev/null+++ b/frontend/src/storybook/msw/__story_mockdata__/queryRange.ts@@ -0,0 +1,73 @@+/**+ * AI-owned. Generated and maintained by the `signoz-page-story` skill.+ * Do not hand-edit: regenerate instead.+ */++import type { MetricRangePayloadV5 } from 'types/api/v5/queryRange';++/** Typed builders for the query_range v5 response shapes. */++export const queryRangeV5ScalarResponse = (+ value: number,+ queryName = 'A',+): MetricRangePayloadV5 => ({+ data: {+ type: 'scalar',+ data: {+ results: [+ {+ columns: [+ {+ name: '__result_0',+ queryName,+ aggregationIndex: 0,+ columnType: 'aggregation',+ },+ ],+ data: [[value]],+ },+ ],+ },+ meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0, stepIntervals: {} },+ },+});++export const queryRangeV5EmptyResponse = (+ queryName = 'A',+): MetricRangePayloadV5 => ({+ data: {+ type: 'raw',+ data: {+ results: [{ queryName, nextCursor: '', rows: [] }],+ },+ meta: { rowsScanned: 0, bytesScanned: 0, durationMs: 0, stepIntervals: {} },+ },+});++export const queryRangeV5RawResponse = <T>(+ rows: Array<{ timestamp: string; data: T }>,+ options: { queryName?: string; hasMore?: boolean } = {},+): MetricRangePayloadV5 => {+ const { queryName = 'A', hasMore = false } = options;++ return {+ data: {+ type: 'raw',+ data: {+ results: [+ {+ queryName,+ nextCursor: hasMore ? 'next-cursor-token' : '',+ rows,+ },+ ],+ },+ meta: {+ rowsScanned: rows.length,+ bytesScanned: 0,+ durationMs: 0,+ stepIntervals: {},+ },+ },+ };+};diff --git a/frontend/src/storybook/msw/appShellHandlers.ts b/frontend/src/storybook/msw/appShellHandlers.tsnew file mode 100644index 0000000000..117a704d47--- /dev/null+++ b/frontend/src/storybook/msw/appShellHandlers.ts@@ -0,0 +1,48 @@+import { rest } from 'msw';++import {+ changelogResponse,+ globalConfigResponse,+ latestGithubReleaseResponse,+ userPreferencesResponse,+ versionResponse,+ zeusHostsResponse,+} from './__story_mockdata__/appShell';++/**+ * Endpoints the app shell hits on every route that the jest handlers in+ * `src/mocks-server/handlers.ts` either do not cover or answer with fixtures+ * too thin to show the shell doing its job. Resolved ahead of the shared set,+ * and a page's own control-driven handlers are resolved ahead of these.+ */+export const appShellHandlers = [+ rest.get('http://localhost/api/v1/user/preferences', (_req, res, ctx) =>+ res(ctx.status(200), ctx.json(userPreferencesResponse())),+ ),++ rest.put('http://localhost/api/v1/user/preferences/:name', (_req, res, ctx) =>+ res(ctx.status(200), ctx.json({ status: 'success', data: null })),+ ),++ rest.get('http://localhost/api/v2/zeus/hosts', (_req, res, ctx) =>+ res(ctx.status(200), ctx.json(zeusHostsResponse)),+ ),++ rest.get('http://localhost/api/v1/global/config', (_req, res, ctx) =>+ res(ctx.status(200), ctx.json(globalConfigResponse)),+ ),++ rest.get('http://localhost/api/v1/version', (_req, res, ctx) =>+ res(ctx.status(200), ctx.json(versionResponse)),+ ),++ rest.get(+ 'https://api.github.com/repos/signoz/signoz/releases/latest',+ (_req, res, ctx) =>+ res(ctx.status(200), ctx.json(latestGithubReleaseResponse)),+ ),++ rest.get('https://cms.signoz.cloud/api/release-changelogs', (_req, res, ctx) =>+ res(ctx.status(200), ctx.json(changelogResponse)),+ ),+];diff --git a/frontend/src/storybook/msw/handlers.ts b/frontend/src/storybook/msw/handlers.tsnew file mode 100644index 0000000000..4e1256920d--- /dev/null+++ b/frontend/src/storybook/msw/handlers.ts@@ -0,0 +1,36 @@+import { rest } from 'msw';+import { handlers as sharedHandlers } from 'mocks-server/handlers';++import { appShellHandlers } from './appShellHandlers';++/**+ * Last resort: every axios instance is built on `ENVIRONMENT.baseURL`, which+ * `mocks/env.mock.ts` pins to `http://localhost`, so an endpoint nobody mocked+ * lands here instead of leaving the browser. Failing loudly beats a request+ * that hangs until the connection is refused.+ */+const unmockedApiGuard = [+ rest.all('http://localhost/api/*', (req, res, ctx) => {+ console.error(+ `[storybook] no msw handler for ${req.method} ${req.url.pathname}. Add one to the page's mocks or to src/storybook/msw/appShellHandlers.ts`,+ );++ return res(+ ctx.status(501),+ ctx.json({ status: 'error', error: 'not mocked in Storybook' }),+ );+ }),+];++/**+ * Default handler set for every story, resolved first match wins: the+ * Storybook-only shell handlers override the jest ones where the shell needs+ * richer data, and both a page's control-driven handlers and a story's own+ * `parameters.msw.handlers` are layered on top at render time. An endpoint both+ * runners need belongs in `src/mocks-server/handlers.ts` instead.+ */+export const storybookHandlers = [+ ...appShellHandlers,+ ...sharedHandlers,+ ...unmockedApiGuard,+];diff --git a/frontend/src/storybook/msw/storyHandlers.ts b/frontend/src/storybook/msw/storyHandlers.tsnew file mode 100644index 0000000000..3be33d4cd8--- /dev/null+++ b/frontend/src/storybook/msw/storyHandlers.ts@@ -0,0 +1,35 @@+import type { RequestHandler } from 'msw';++/**+ * Handlers may be grouped under names, so unrelated overrides in the same story+ * stay readable.+ */+export type StoryMswParameter =+ | RequestHandler[]+ | {+ handlers?: RequestHandler[] | Record<string, RequestHandler[] | undefined>;+ };++export const collectStoryHandlers = (+ msw: StoryMswParameter | undefined,+): RequestHandler[] => {+ if (!msw) {+ return [];+ }++ if (Array.isArray(msw)) {+ return msw;+ }++ const { handlers } = msw;++ if (!handlers) {+ return [];+ }++ return Array.isArray(handlers)+ ? handlers+ : Object.values(handlers)+ .filter((group): group is RequestHandler[] => Boolean(group))+ .flat();+};diff --git a/frontend/src/storybook/msw/types.ts b/frontend/src/storybook/msw/types.tsnew file mode 100644index 0000000000..35266ee751--- /dev/null+++ b/frontend/src/storybook/msw/types.ts@@ -0,0 +1,28 @@+import type {+ DefaultBodyType,+ PathParams,+ ResponseResolver,+ RestContext,+ RestRequest,+} from 'msw';++export type MockRequest = RestRequest<DefaultBodyType, PathParams>;++export type MockResolver = ResponseResolver<+ MockRequest,+ RestContext,+ DefaultBodyType+>;++/**+ * Resolver factory handed to a mock module's `handlers`. Endpoints declared+ * through it follow the response state, so one declaration covers the loaded,+ * loading and failed states. Endpoints that have to answer for the page to+ * render at all (ingestion detection, preferences) take a plain resolver+ * instead.+ */+export interface MockResponse {+ json: <TBody>(+ build: (req: MockRequest) => TBody | Promise<TBody>,+ ) => MockResolver;+}diff --git a/frontend/src/storybook/navigation/NavigationBlockedOverlay.module.scss b/frontend/src/storybook/navigation/NavigationBlockedOverlay.module.scssnew file mode 100644index 0000000000..9ad41cc181--- /dev/null+++ b/frontend/src/storybook/navigation/NavigationBlockedOverlay.module.scss@@ -0,0 +1,55 @@+.overlay {+ position: fixed;+ right: var(--spacing-8);+ bottom: var(--spacing-8);+ z-index: 2000;+ display: flex;+ max-width: 420px;+ flex-direction: column;+ gap: var(--spacing-4);+ padding: var(--spacing-6) var(--spacing-7);+ border: 1px solid var(--accent-amber);+ border-radius: 6px;+ background: var(--l2-background);+ box-shadow: 0 8px 24px color-mix(in srgb, var(--base-black) 45%, transparent);+ color: var(--l1-foreground);+ font-family: var(--font-sans);+}++.header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: var(--spacing-6);+}++.actions {+ display: flex;+ gap: var(--spacing-4);+}++.button {+ padding: var(--spacing-1) var(--spacing-4);+ border: 1px solid var(--l1-border);+ border-radius: 4px;+ background: transparent;+ color: inherit;+ cursor: pointer;++ &:hover {+ background: var(--l2-background-hover);+ border-color: var(--l2-border);+ }+}++.list {+ margin: 0;+ max-height: 160px;+ padding-left: var(--spacing-8);+ overflow-y: auto;+}++.item {+ margin-bottom: var(--spacing-1);+ word-break: break-all;+}diff --git a/frontend/src/storybook/navigation/NavigationBlockedOverlay.tsx b/frontend/src/storybook/navigation/NavigationBlockedOverlay.tsxnew file mode 100644index 0000000000..d8e935da19--- /dev/null+++ b/frontend/src/storybook/navigation/NavigationBlockedOverlay.tsx@@ -0,0 +1,61 @@+import { Typography } from '@signozhq/ui/typography';++import { useBlockedNavigationStore } from './blockedNavigationStore';++import styles from './NavigationBlockedOverlay.module.scss';++/**+ * Surfaces every navigation the story swallowed. Rendered by `withProviders`,+ * so any story that tries to leave the page says so instead of silently+ * doing nothing.+ */+function NavigationBlockedOverlay(): JSX.Element | null {+ const blockedNavigations = useBlockedNavigationStore(+ (state) => state.blockedNavigations,+ );+ const clear = useBlockedNavigationStore((state) => state.clear);++ if (blockedNavigations.length === 0) {+ return null;+ }++ return (+ <aside+ className={styles.overlay}+ aria-live="polite"+ data-testid="navigation-blocked-overlay"+ >+ <div className={styles.header}>+ <Typography.Text as="span" size="small" weight="semibold" color="warning">+ Navigation blocked in Storybook+ </Typography.Text>+ <div className={styles.actions}>+ <button+ type="button"+ className={styles.button}+ onClick={clear}+ data-testid="navigation-blocked-clear"+ >+ <Typography.Text as="span" size="small" weight="medium">+ clear+ </Typography.Text>+ </button>+ </div>+ </div>+ <ul className={styles.list}>+ {blockedNavigations.map((navigation) => (+ <li key={navigation.id} className={styles.item}>+ <Typography.Text as="span" size="small" color="muted">+ {navigation.via}+ </Typography.Text>{' '}+ <Typography.Text as="span" size="small">+ → {navigation.to}+ </Typography.Text>+ </li>+ ))}+ </ul>+ </aside>+ );+}++export default NavigationBlockedOverlay;diff --git a/frontend/src/storybook/navigation/blockedNavigationStore.ts b/frontend/src/storybook/navigation/blockedNavigationStore.tsnew file mode 100644index 0000000000..dcbabbfc70--- /dev/null+++ b/frontend/src/storybook/navigation/blockedNavigationStore.ts@@ -0,0 +1,35 @@+import { create } from 'zustand';++export interface BlockedNavigation {+ id: number;+ /** History method the app called, e.g. `push`, `replace`, `window.open`. */+ via: string;+ /** Target the app tried to reach, already resolved to an href. */+ to: string;+}++interface BlockedNavigationStore {+ blockedNavigations: BlockedNavigation[];+ record: (via: string, to: string) => void;+ clear: () => void;+}++export const useBlockedNavigationStore = create<BlockedNavigationStore>()(+ (set) => ({+ blockedNavigations: [],+ record: (via, to): void =>+ set(({ blockedNavigations }) => ({+ blockedNavigations: [+ ...blockedNavigations,+ { id: blockedNavigations.length + 1, via, to },+ ],+ })),+ clear: (): void => set({ blockedNavigations: [] }),+ }),+);++export const recordBlockedNavigation = (via: string, to: string): void =>+ useBlockedNavigationStore.getState().record(via, to);++export const clearBlockedNavigations = (): void =>+ useBlockedNavigationStore.getState().clear();diff --git a/frontend/src/storybook/navigation/containment.ts b/frontend/src/storybook/navigation/containment.tsnew file mode 100644index 0000000000..9fa3c7932a--- /dev/null+++ b/frontend/src/storybook/navigation/containment.ts@@ -0,0 +1,65 @@+import {+ History,+ LocationDescriptor,+ LocationDescriptorObject,+ parsePath,+} from 'history';+import { fn, type Mock } from 'storybook/test';++import { recordBlockedNavigation } from './blockedNavigationStore';+import { navigateWithinPage, storyHistory, toHref } from './pageScope';++const guardedNavigate = (+ via: 'push' | 'replace',+): Mock<(to: LocationDescriptor, state?: unknown) => void> =>+ fn((to: LocationDescriptor, state?: unknown): void => {+ const target: LocationDescriptorObject =+ typeof to === 'string' ? { ...parsePath(to), state } : { state, ...to };++ if (navigateWithinPage(target, { replace: via === 'replace' })) {+ return;+ }++ recordBlockedNavigation(via, toHref(to));+ }).mockName(`history.${via}`);++const blockedRelativeNavigate = (via: string): Mock<(delta?: number) => void> =>+ fn((delta?: number): void => {+ recordBlockedNavigation(via, delta === undefined ? via : `${via}(${delta})`);+ }).mockName(`history.${via}`);++const overriddenMethods = {+ push: guardedNavigate('push'),+ replace: guardedNavigate('replace'),+ go: blockedRelativeNavigate('go'),+ goBack: blockedRelativeNavigate('goBack'),+ goForward: blockedRelativeNavigate('goForward'),+} as const;++type OverriddenMethod = keyof typeof overriddenMethods;++const isOverriddenMethod = (prop: string | symbol): prop is OverriddenMethod =>+ typeof prop === 'string' && prop in overriddenMethods;++/**+ * What the app sees in place of `lib/history`. Reads (`location`, `action`,+ * `listen`) are proxied to the story's memory history so react-router renders+ * normally; navigation goes through `pageScope`, and whatever would leave the+ * page is swallowed and reported to `blockedNavigationStore`.+ * `react-router-dom-v5-compat` drives its `useNavigate` through this same+ * object, so `useSafeNavigate` is covered too.+ */+export const containedHistory: History = new Proxy(storyHistory, {+ get(target, prop, receiver) {+ if (isOverriddenMethod(prop)) {+ return overriddenMethods[prop];+ }+ return Reflect.get(target, prop, receiver);+ },+});++export const hasInAppHistory = (): boolean => false;++export const resetStoryHistory = (): void => {+ Object.values(overriddenMethods).forEach((method) => method.mockClear());+};diff --git a/frontend/src/storybook/navigation/history.alias.ts b/frontend/src/storybook/navigation/history.alias.tsnew file mode 100644index 0000000000..40ef958c74--- /dev/null+++ b/frontend/src/storybook/navigation/history.alias.ts@@ -0,0 +1,20 @@+import {+ containedHistory,+ hasInAppHistory as containedHasInAppHistory,+} from './containment';++/**+ * Replaces `lib/history` in Storybook (aliased in `.storybook/main.ts`). The+ * containment rule lives in `containment.ts`; this file only has to keep the+ * module's shape, and the annotation is what checks it against the real one.+ * An export added to `lib/history` fails to compile here instead of failing at+ * render in whichever component imports it.+ */+const libHistory: typeof import('lib/history') = {+ default: containedHistory,+ hasInAppHistory: containedHasInAppHistory,+};++export default libHistory.default;++export const { hasInAppHistory } = libHistory;diff --git a/frontend/src/storybook/navigation/interceptExternalNavigation.ts b/frontend/src/storybook/navigation/interceptExternalNavigation.tsnew file mode 100644index 0000000000..e54830f898--- /dev/null+++ b/frontend/src/storybook/navigation/interceptExternalNavigation.ts@@ -0,0 +1,55 @@+import { recordBlockedNavigation } from './blockedNavigationStore';+import {+ isBlockableHref,+ navigateWithinPage,+ toStoryLocation,+} from './pageScope';++/**+ * Takes over the navigations that never reach the story's history: plain anchors+ * and `window.open` (used by `useSafeNavigate` for `newTab`). An anchor staying+ * on the story's page is applied, because letting the browser follow it would+ * navigate the iframe away and unmount the story. Anything else is reported as+ * blocked. Returns the teardown.+ */+export const interceptExternalNavigation = (): (() => void) => {+ const onClick = (event: MouseEvent): void => {+ const target = event.target as Element | null;+ const anchor = target?.closest?.('a[href]');++ if (!anchor) {+ return;+ }++ const href = anchor.getAttribute('href') ?? '';++ if (!isBlockableHref(href)) {+ return;+ }++ // Ahead of react-router's own `Link` handler, which skips a click that is+ // already handled, so an in-page link is never pushed twice.+ event.preventDefault();++ const to = toStoryLocation(href, window.location.href);++ if (to && navigateWithinPage(to)) {+ return;+ }++ recordBlockedNavigation('link', href);+ };++ document.addEventListener('click', onClick, true);++ const originalOpen = window.open;+ window.open = (url?: string | URL): null => {+ recordBlockedNavigation('window.open', String(url ?? ''));+ return null;+ };++ return (): void => {+ document.removeEventListener('click', onClick, true);+ window.open = originalOpen;+ };+};diff --git a/frontend/src/storybook/navigation/pageScope.ts b/frontend/src/storybook/navigation/pageScope.tsnew file mode 100644index 0000000000..2f977907a8--- /dev/null+++ b/frontend/src/storybook/navigation/pageScope.ts@@ -0,0 +1,85 @@+import {+ createMemoryHistory,+ LocationDescriptor,+ MemoryHistory,+ parsePath,+} from 'history';++/**+ * The story's own history. A story renders one page, so this never leaves it:+ * `pageScope` decides what counts as staying, and `containment.ts` is what the+ * app sees in place of `lib/history`.+ */+export const storyHistory: MemoryHistory = createMemoryHistory({+ initialEntries: ['/'],+});++export const toHref = (to: LocationDescriptor): string =>+ typeof to === 'string' ? to : storyHistory.createHref(to);++/** `/home/` and `/home` are the same page as far as a story is concerned. */+const normalizePathname = (pathname: string): string =>+ pathname.length > 1 && pathname.endsWith('/')+ ? pathname.slice(0, -1)+ : pathname;++export const isSamePagePathname = (pathname: string | undefined): boolean =>+ !pathname ||+ normalizePathname(pathname) ===+ normalizePathname(storyHistory.location.pathname);++/**+ * Applies a navigation that stays on the story's page: a query-param or hash+ * change, which is how tabs, filters and pagination are driven. Returns false+ * when the target is another page, leaving the caller to report it as blocked.+ */+export const navigateWithinPage = (+ to: LocationDescriptor,+ { replace = false }: { replace?: boolean } = {},+): boolean => {+ const target = typeof to === 'string' ? parsePath(to) : to;++ if (!isSamePagePathname(target.pathname)) {+ return false;+ }++ storyHistory[replace ? 'replace' : 'push']({+ ...target,+ pathname: storyHistory.location.pathname,+ });++ return true;+};++/** Places the story at a route without going through the block. */+export const setStoryLocation = (to: LocationDescriptor): void => {+ storyHistory.replace(to);+};++/**+ * An in-page anchor or a `javascript:` href is the browser's business, not the+ * story's: it is left alone rather than applied or reported.+ */+export const isBlockableHref = (href: string): boolean =>+ href.length > 0 && !href.startsWith('#') && !href.startsWith('javascript:');++/**+ * An anchor href as a location the story's history understands, or `undefined`+ * when it leads off the page. Relative hrefs (`?tab=logs`) carry no pathname and+ * stay on the page; app links do, and are resolved against the iframe so an+ * off-site href fails the host check before its path is compared.+ */+export const toStoryLocation = (+ href: string,+ base: string,+): string | undefined => {+ if (href.startsWith('?')) {+ return href;+ }++ const url = new URL(href, base);++ return url.host === new URL(base).host+ ? `${url.pathname}${url.search}${url.hash}`+ : undefined;+};diff --git a/frontend/src/storybook/providers/StorybookProviders.tsx b/frontend/src/storybook/providers/StorybookProviders.tsxnew file mode 100644index 0000000000..1b6904f7cf--- /dev/null+++ b/frontend/src/storybook/providers/StorybookProviders.tsx@@ -0,0 +1,108 @@+import { ReactNode, useEffect, useMemo } from 'react';+import { Router } from 'react-router-dom';+import { CompatRouter } from 'react-router-dom-v5-compat';+import { TooltipProvider } from '@signozhq/ui/tooltip';+import AppPageProviders from '@/app/AppPageProviders';+import AppProviders from '@/app/AppProviders';+import AppShell from '@/app/AppShell';+import type { AppLayer } from '@/app/types';+import { CmdKPalette } from 'components/cmdKPalette/cmdKPalette';+import AppLayout from 'container/AppLayout';+import history from 'lib/history';+import { NuqsTestingAdapter } from 'nuqs/adapters/testing';+import { AppContext, useAppContext } from 'providers/App/App';++import { createStoryAppContext } from '../mocks/createStoryAppContext';+import { interceptExternalNavigation } from '../navigation/interceptExternalNavigation';+import NavigationBlockedOverlay from '../navigation/NavigationBlockedOverlay';+import { ResolvedStoryConfig } from '../types';+import { createStorybookQueryClient } from './createStorybookQueryClient';+import { createStorybookStore } from './createStorybookStore';+import { useStoryRoute } from './useStoryRoute';++interface StorybookProvidersProps extends ResolvedStoryConfig {+ children: ReactNode;+}++/**+ * Reports the role `useAppContext()` yields to `<body data-signoz-context-role>`,+ * next to the `data-signoz-story-role` the runtime resolved. Both come from the+ * same access grant, so a disagreement means the story is reading a different+ * `AppContext` than the one the runtime filled.+ */+function StoryContextProbe(): null {+ const { user } = useAppContext();++ useEffect(() => {+ document.body.dataset.signozContextRole = user?.role ?? '';+ }, [user?.role]);++ return null;+}++const storyRouter: AppLayer = (children) => (+ <Router history={history}>+ <CompatRouter>{children}</CompatRouter>+ </Router>+);++const appLayout: AppLayer = (children) => <AppLayout>{children}</AppLayout>;++const bareLayout: AppLayer = (children) => (+ <TooltipProvider>{children}</TooltipProvider>+);++function StorybookProviders({+ children,+ role,+ appContext,+ queryBuilder,+ route = '/',+ layout = 'none',+ reduxState,+}: StorybookProvidersProps): JSX.Element {+ const searchParams = useStoryRoute(route);+ const queryClient = useMemo(createStorybookQueryClient, []);+ const store = useMemo(() => createStorybookStore(reduxState), [reduxState]);+ const appContextValue = useMemo(+ () => createStoryAppContext(role, appContext),+ [role, appContext],+ );++ useEffect(interceptExternalNavigation, []);++ return (+ <AppProviders+ store={store}+ queryClient={queryClient}+ appContext={(scoped): ReactNode => (+ <AppContext.Provider value={appContextValue}>{scoped}</AppContext.Provider>+ )}+ searchParams={(scoped): ReactNode => (+ <NuqsTestingAdapter searchParams={searchParams} hasMemory>+ {scoped}+ </NuqsTestingAdapter>+ )}+ >+ <AppShell+ router={storyRouter}+ overlays={+ <>+ <StoryContextProbe />+ <CmdKPalette userRole={role} />+ <NavigationBlockedOverlay />+ </>+ }+ >+ <AppPageProviders+ layout={layout === 'app' ? appLayout : bareLayout}+ queryBuilder={queryBuilder}+ >+ {children}+ </AppPageProviders>+ </AppShell>+ </AppProviders>+ );+}++export default StorybookProviders;diff --git a/frontend/src/storybook/providers/applyThemeBodyClass.ts b/frontend/src/storybook/providers/applyThemeBodyClass.tsnew file mode 100644index 0000000000..23d693e781--- /dev/null+++ b/frontend/src/storybook/providers/applyThemeBodyClass.ts@@ -0,0 +1,12 @@+import { THEME_MODE } from 'hooks/useDarkMode/constant';++import type { StoryTheme } from '../types';++export const applyThemeBodyClass = (theme: StoryTheme): void => {+ const isDarkMode = theme === THEME_MODE.DARK;++ document.body.dataset.theme = 'default';+ document.body.classList.toggle('darkMode', isDarkMode);+ document.body.classList.toggle('dark', isDarkMode);+ document.body.classList.toggle('lightMode', !isDarkMode);+};diff --git a/frontend/src/storybook/providers/createStorybookQueryClient.ts b/frontend/src/storybook/providers/createStorybookQueryClient.tsnew file mode 100644index 0000000000..7dc97a1049--- /dev/null+++ b/frontend/src/storybook/providers/createStorybookQueryClient.ts@@ -0,0 +1,18 @@+import { QueryClient } from 'react-query';++/**+ * One client per story: retries off so a deliberately failing handler renders+ * its error state immediately, and no cache carried over between stories.+ */+export const createStorybookQueryClient = (): QueryClient =>+ new QueryClient({+ defaultOptions: {+ queries: {+ refetchOnWindowFocus: false,+ retry: false,+ },+ mutations: {+ retry: false,+ },+ },+ });diff --git a/frontend/src/storybook/providers/createStorybookStore.ts b/frontend/src/storybook/providers/createStorybookStore.tsnew file mode 100644index 0000000000..c704f28482--- /dev/null+++ b/frontend/src/storybook/providers/createStorybookStore.ts@@ -0,0 +1,19 @@+// eslint-disable-next-line no-restricted-imports+import {+ applyMiddleware,+ legacy_createStore as createStore,+ Store,+} from 'redux';+import thunk from 'redux-thunk';+import reducers, { AppState } from 'store/reducers';++/**+ * A fresh store per story, seeded with the real reducers so dispatches keep+ * working, unlike the mock store used in jest. Nothing leaks between stories.+ */+export const createStorybookStore = (reduxState?: Partial<AppState>): Store =>+ createStore(+ reducers,+ reduxState as ReturnType<typeof reducers> | undefined,+ applyMiddleware(thunk),+ );diff --git a/frontend/src/storybook/providers/useStoryRoute.ts b/frontend/src/storybook/providers/useStoryRoute.tsnew file mode 100644index 0000000000..0c3f3f8c06--- /dev/null+++ b/frontend/src/storybook/providers/useStoryRoute.ts@@ -0,0 +1,14 @@+import { useMemo } from 'react';++import { setStoryLocation } from '../navigation/pageScope';++/**+ * Places the story's history at its route before the router mounts and hands+ * back the search params for the nuqs testing adapter.+ */+export const useStoryRoute = (route: string): URLSearchParams =>+ useMemo(() => {+ setStoryLocation(route);+ const [, search = ''] = route.split('?');+ return new URLSearchParams(search);+ }, [route]);diff --git a/frontend/src/storybook/runtime/resolveStory.ts b/frontend/src/storybook/runtime/resolveStory.tsnew file mode 100644index 0000000000..34ca0dada5--- /dev/null+++ b/frontend/src/storybook/runtime/resolveStory.ts@@ -0,0 +1,173 @@+import type { RequestHandler, SetupWorker } from 'msw';+import set from 'api/browser/localstorage/set';+import { LOCALSTORAGE } from 'constants/localStorage';+import { USER_ROLES } from 'types/roles';++import type { AnyStoryMocks, StoryMockArgs } from '../controls/types';+import { globalMocks, type GlobalMockArgs } from '../globals';+import { storybookHandlers } from '../msw/handlers';+import { collectStoryHandlers } from '../msw/storyHandlers';+import type { MockResolver, MockResponse } from '../msw/types';+import { applyThemeBodyClass } from '../providers/applyThemeBodyClass';+import type {+ ResolvedStoryConfig,+ SignozStoryConfig,+ SignozStoryParameters,+ StoryOwnedConfig,+ StoryRole,+ StoryTheme,+} from '../types';+import { respondWith, type ResponseState } from './responseState';++/** Args of a page story: its own controls plus the ones every story carries. */+export type PageStoryArgs<TMocks extends AnyStoryMocks> = GlobalMockArgs &+ StoryMockArgs<TMocks>;++/**+ * What Storybook hands both the loader and the decorator. Declared structurally,+ * so the runtime does not depend on which lifecycle hook is calling it.+ */+export interface StoryRuntimeContext {+ id: string;+ parameters: SignozStoryParameters;+ args: Record<string, unknown>;+ globals?: Record<string, unknown>;+}++export interface StoryWorld {+ config: ResolvedStoryConfig;+ theme: StoryTheme;+ /**+ * Changes with every control a mock reads. The provider tree is keyed on it so+ * the story remounts with a fresh query cache instead of showing what the+ * previous control values resolved to.+ */+ key: string;+ /** In resolution order: msw answers with the first handler that matches. */+ handlers: RequestHandler[];+ install(worker: SetupWorker): void;+ /**+ * Everything that has to be in place before the provider tree mounts:+ * module-level app state, the theme `ThemeProvider` reads at boot, and the+ * `<body>` markers that say what the controls resolved to.+ */+ apply(): void;+}++const withoutMocks = (config: SignozStoryConfig): StoryOwnedConfig => {+ const owned = { ...config };+ delete (owned as SignozStoryConfig).mocks;+ return owned;+};++const mergeConfigs = (configs: StoryOwnedConfig[]): StoryOwnedConfig =>+ configs.reduce(+ (merged, config) => ({+ ...merged,+ ...config,+ appContext: { ...merged.appContext, ...config.appContext },+ }),+ {} as StoryOwnedConfig,+ );++const createMockResponse = (state: ResponseState): MockResponse => ({+ json: (build): MockResolver => respondWith(state, build),+});++const firstAnswer = <TAnswer>(+ answers: (TAnswer | undefined)[],+ fallback: TAnswer,+): TAnswer =>+ answers.find((answer): answer is TAnswer => answer !== undefined) ?? fallback;++const resolveWorld = (context: StoryRuntimeContext): StoryWorld => {+ const { parameters, args } = context;+ const storyConfig = parameters.signoz ?? {};++ // A page's own mocks resolve ahead of the global ones, so the page wins every+ // question both answer.+ const members: AnyStoryMocks[] = storyConfig.mocks+ ? [storyConfig.mocks, ...globalMocks.members]+ : [...globalMocks.members];++ const values = members.map((mocks) => mocks.read(args));++ const response = createMockResponse(+ firstAnswer(+ members.map((mocks, index) => mocks.responseState?.(values[index])),+ 'loaded',+ ),+ );++ const role = firstAnswer(+ members.map((mocks, index) => mocks.role?.(values[index])),+ USER_ROLES.ADMIN as StoryRole,+ );++ const config = mergeConfigs([+ // Reversed, so a page's own config wins over the global one, and the+ // story's own `parameters.signoz` is the last word over both.+ ...members+ .map((mocks, index) => mocks.config?.(values[index]) ?? {})+ .reverse(),+ withoutMocks(storyConfig),+ ]);++ const theme = config.theme ?? (context.globals?.theme as StoryTheme) ?? 'dark';++ const valuesKey = JSON.stringify(values);++ const handlers = [+ // A story that declares its own handler always wins.+ ...collectStoryHandlers(parameters.msw),+ ...members.flatMap(+ (mocks, index) => mocks.handlers?.(values[index], response) ?? [],+ ),+ // Shell endpoints, the jest handlers, then the catch-all that logs.+ ...storybookHandlers,+ ];++ return {+ config: { ...config, role },+ theme,+ key: `${theme}|${valuesKey}`,+ handlers,+ install: (worker): void => {+ worker.resetHandlers(...handlers);+ },+ apply: (): void => {+ members.forEach((mocks, index) => mocks.effect?.(values[index]));++ // `ThemeProvider` seeds its state from localStorage, so the value has to+ // be in place before it mounts; `key` forces the remount on a change.+ set(LOCALSTORAGE.THEME, theme);+ applyThemeBodyClass(theme);++ // Readable from the Elements panel, so what the controls resolved to can+ // be checked without reaching into the story store.+ document.body.dataset.signozStoryRole = role;+ document.body.dataset.signozStoryMocks = valuesKey;+ },+ };+};++let memo: { signature: string; world: StoryWorld } | undefined;++/**+ * The single owner of "story context → the world the story renders in". Both the+ * preview loader and the provider decorator ask for the same story render, so+ * the result is memoised on what the story is and what its controls hold.+ */+export const resolveStory = (context: StoryRuntimeContext): StoryWorld => {+ const signature = JSON.stringify([+ context.id,+ context.args,+ context.globals?.theme,+ ]);++ if (memo?.signature !== signature) {+ memo = { signature, world: resolveWorld(context) };+ }++ return memo.world;+};diff --git a/frontend/src/storybook/runtime/responseState.ts b/frontend/src/storybook/runtime/responseState.tsnew file mode 100644index 0000000000..89557c57b5--- /dev/null+++ b/frontend/src/storybook/runtime/responseState.ts@@ -0,0 +1,33 @@+import type { DefaultBodyType } from 'msw';++import type { MockRequest, MockResolver } from '../msw/types';++export const RESPONSE_STATES = ['loaded', 'loading', 'error'] as const;++export type ResponseState = (typeof RESPONSE_STATES)[number];++/**+ * The three answers every mocked endpoint can give, in one place: the payload+ * the caller built, a request that never resolves, or a failure. A story reaches+ * all three by turning one control, and a fourth state added here reaches every+ * endpoint declared through it.+ */+export const respondWith =+ <TBody>(+ state: ResponseState,+ build: (req: MockRequest) => TBody | Promise<TBody>,+ ): MockResolver =>+ async (req, res, ctx) => {+ if (state === 'loading') {+ return res(ctx.delay('infinite'));+ }++ if (state === 'error') {+ return res(+ ctx.status(500),+ ctx.json({ status: 'error', error: 'storybook: forced failure' }),+ );+ }++ return res(ctx.status(200), ctx.json((await build(req)) as DefaultBodyType));+ };diff --git a/frontend/src/storybook/storybook-root.scss b/frontend/src/storybook/storybook-root.scssnew file mode 100644index 0000000000..b625dccefe--- /dev/null+++ b/frontend/src/storybook/storybook-root.scss@@ -0,0 +1,6 @@+/* `styles.scss` sizes `#root`; the Storybook preview mounts into+ `#storybook-root`, which needs the same box for `AppLayout` to lay out. */+#storybook-root {+ height: 100%;+ overflow: hidden;+}diff --git a/frontend/src/storybook/types.ts b/frontend/src/storybook/types.tsnew file mode 100644index 0000000000..84d11ca1c3--- /dev/null+++ b/frontend/src/storybook/types.ts@@ -0,0 +1,58 @@+import type { IAppContext } from 'providers/App/types';+import type { AppState } from 'store/reducers';+import type { QueryBuilderContextType } from 'types/common/queryBuilder';+import type { ROLES } from 'types/roles';++import type { AnyStoryMocks } from './controls/types';+import type { StoryMswParameter } from './msw/storyHandlers';++export type StoryTheme = 'dark' | 'light';++export type StoryRole = ROLES;++export type StoryLayout = 'app' | 'none';++/** What a story or a mock module may set about the tree it renders in. */+export interface StoryOwnedConfig {+ /** Deep-merged over the default mocked `AppContext` value. */+ appContext?: Partial<IAppContext>;+ /** When set, replaces `QueryBuilderProvider` with a fixed context value. */+ queryBuilder?: Partial<QueryBuilderContextType>;+ /** Initial route, search included, e.g. `/home?relativeTime=1h`. */+ route?: string;+ /** Overrides the theme toolbar for this story. */+ theme?: StoryTheme;+ /**+ * `'app'` mounts the story inside `AppLayout`, where a route renders: the nav+ * rail, the banners and the shell's own providers. Page stories want it;+ * `'none'`, the default, leaves the story bare.+ */+ layout?: StoryLayout;+ /**+ * When set, the real redux store is seeded with this state instead of the+ * reducers' own initial state.+ */+ reduxState?: Partial<AppState>;+}++export interface SignozStoryConfig extends StoryOwnedConfig {+ /**+ * The page's control-driven mocks, declared with `defineStoryMocks` and+ * attached by spreading `storyMocks(...)` into the meta.+ */+ mocks?: AnyStoryMocks;+}++/**+ * What the story runtime hands the provider tree. `role` is derived from the+ * Access controls rather than set by a story, so the mocked `AppContext` and the+ * mocked `authz/check` endpoint always answer from the same grant.+ */+export interface ResolvedStoryConfig extends StoryOwnedConfig {+ role: StoryRole;+}++export interface SignozStoryParameters {+ signoz?: SignozStoryConfig;+ msw?: StoryMswParameter;+}diff --git a/frontend/src/tests/fixtures/appContextMock.ts b/frontend/src/tests/fixtures/appContextMock.tsnew file mode 100644index 0000000000..7a7cc0fe55--- /dev/null+++ b/frontend/src/tests/fixtures/appContextMock.ts@@ -0,0 +1,170 @@+import { FeatureKeys } from 'constants/features';+import { ORG_PREFERENCES } from 'constants/orgPreferences';+import { IAppContext } from 'providers/App/types';+import {+ LicenseEvent,+ LicensePlatform,+ LicenseState,+ LicenseStatus,+} from 'types/api/licensesV3/getActive';+import { ROLES, USER_ROLES } from 'types/roles';++/**+ * Factory for the spies assigned to the callable members of `IAppContext`.+ * Jest passes `jest.fn`, Storybook passes `fn` from `storybook/test`; the+ * fixture itself stays free of any test-runner import so both can consume it.+ */+export type SpyFactory = () => (...args: unknown[]) => void;++const noopSpyFactory: SpyFactory = () => (): void => {};++export const defaultFeatureFlags = [+ { name: FeatureKeys.SSO, active: true, usage: 0, usage_limit: -1, route: '' },+ {+ name: FeatureKeys.USE_SPAN_METRICS,+ active: false,+ usage: 0,+ usage_limit: -1,+ route: '',+ },+ {+ name: FeatureKeys.GATEWAY,+ active: true,+ usage: 0,+ usage_limit: -1,+ route: '',+ },+ {+ name: FeatureKeys.PREMIUM_SUPPORT,+ active: true,+ usage: 0,+ usage_limit: -1,+ route: '',+ },+ {+ name: FeatureKeys.ANOMALY_DETECTION,+ active: true,+ usage: 0,+ usage_limit: -1,+ route: '',+ },+ {+ name: FeatureKeys.ONBOARDING,+ active: true,+ usage: 0,+ usage_limit: -1,+ route: '',+ },+ {+ name: FeatureKeys.CHAT_SUPPORT,+ active: true,+ usage: 0,+ usage_limit: -1,+ route: '',+ },+];++export function createAppContextMock(+ role: string,+ appContextOverrides?: Partial<IAppContext>,+ createSpy: SpyFactory = noopSpyFactory,+): IAppContext {+ return {+ activeLicense: {+ id: 'test-license-id',+ eventQueue: {+ createdAt: '0',+ event: LicenseEvent.NO_EVENT,+ scheduledAt: '0',+ status: '',+ updatedAt: '0',+ },+ state: LicenseState.ACTIVATED,+ status: LicenseStatus.VALID,+ platform: LicensePlatform.CLOUD,+ createdAt: '0',+ plan: {+ id: '0',+ createdAt: '0',+ description: '',+ isActive: true,+ name: '',+ updatedAt: '0',+ },+ freeUntil: '0',+ updatedAt: '0',+ validFrom: 0,+ validUntil: 0,+ },+ trialInfo: {+ trialStart: -1,+ trialEnd: -1,+ onTrial: false,+ workSpaceBlock: false,+ trialConvertedToSubscription: false,+ gracePeriodEnd: -1,+ },+ isFetchingActiveLicense: false,+ activeLicenseFetchError: null,+ changelog: null,+ user: {+ accessJwt: 'some-token',+ refreshJwt: 'some-refresh-token',+ id: 'some-user-id',+ email: '[email protected]',+ displayName: 'John Doe',+ createdAt: 1732544623,+ organization: 'Nightswatch',+ orgId: 'does-not-matter-id',+ role: role as ROLES,+ },+ org: [+ {+ createdAt: 0,+ id: 'does-not-matter-id',+ displayName: 'Pentagon',+ },+ ],+ hasEditPermission: role === USER_ROLES.ADMIN || role === USER_ROLES.EDITOR,+ isFetchingUser: false,+ userFetchError: null,+ featureFlags: defaultFeatureFlags,+ isFetchingFeatureFlags: false,+ featureFlagsFetchError: null,+ hostsData: null,+ isFetchingHosts: false,+ hostsFetchError: null,+ orgPreferences: [+ {+ name: ORG_PREFERENCES.ORG_ONBOARDING,+ description: 'Organisation Onboarding',+ valueType: 'boolean',+ defaultValue: false,+ allowedValues: ['true', 'false'],+ allowedScopes: ['org'],+ value: false,+ },+ ],+ userPreferences: [],+ updateUserPreferenceInContext: createSpy(),+ isFetchingOrgPreferences: false,+ isFetchingUserPreferences: false,+ orgPreferencesFetchError: null,+ isLoggedIn: true,+ isPreflightLoading: false,+ showChangelogModal: false,+ updateUser: createSpy(),+ updateOrg: createSpy(),+ updateOrgPreferences: createSpy(),+ activeLicenseRefetch: createSpy(),+ updateChangelog: createSpy(),+ toggleChangelogModal: createSpy(),+ versionData: {+ version: '1.0.0',+ ee: 'Y',+ setupCompleted: true,+ },++ ...appContextOverrides,+ };+}diff --git a/frontend/src/tests/test-utils.tsx b/frontend/src/tests/test-utils.tsxindex 8fac8590e6..a9765efdc6 100644--- a/frontend/src/tests/test-utils.tsx+++ b/frontend/src/tests/test-utils.tsx@@ -5,8 +5,6 @@ import { Provider } from 'react-redux';import { MemoryRouter } from 'react-router-dom';import { render, RenderOptions, RenderResult } from '@testing-library/react';import { TooltipProvider } from '@signozhq/ui/tooltip';-import { FeatureKeys } from 'constants/features';-import { ORG_PREFERENCES } from 'constants/orgPreferences';import { ResourceProvider } from 'hooks/useResourceAttribute';import { NuqsAdapter } from 'nuqs/adapters/react';import { AppContext } from 'providers/App/App';@@ -19,16 +17,10 @@ import {} from 'providers/QueryBuilder';import TimezoneProvider from 'providers/Timezone';import configureStore from 'redux-mock-store';+import { createAppContextMock } from 'tests/fixtures/appContextMock';import thunk from 'redux-thunk';import store from 'store';-import {- LicenseEvent,- LicensePlatform,- LicenseState,- LicenseStatus,-} from 'types/api/licensesV3/getActive';import { QueryBuilderContextType } from 'types/common/queryBuilder';-import { ROLES, USER_ROLES } from 'types/roles';// import { MemoryRouter as V5MemoryRouter } from 'react-router-dom-v5-compat';// Mock ResizeObserver@@ -106,154 +98,13 @@ jest.mock('react-i18next', () => ({}),}));-export const defaultFeatureFlags = [- { name: FeatureKeys.SSO, active: true, usage: 0, usage_limit: -1, route: '' },- {- name: FeatureKeys.USE_SPAN_METRICS,- active: false,- usage: 0,- usage_limit: -1,- route: '',- },- {- name: FeatureKeys.GATEWAY,- active: true,- usage: 0,- usage_limit: -1,- route: '',- },- {- name: FeatureKeys.PREMIUM_SUPPORT,- active: true,- usage: 0,- usage_limit: -1,- route: '',- },- {- name: FeatureKeys.ANOMALY_DETECTION,- active: true,- usage: 0,- usage_limit: -1,- route: '',- },- {- name: FeatureKeys.ONBOARDING,- active: true,- usage: 0,- usage_limit: -1,- route: '',- },- {- name: FeatureKeys.CHAT_SUPPORT,- active: true,- usage: 0,- usage_limit: -1,- route: '',- },-];+export { defaultFeatureFlags } from 'tests/fixtures/appContextMock';export function getAppContextMock(role: string,appContextOverrides?: Partial<IAppContext>,): IAppContext {- return {- activeLicense: {- id: 'test-license-id',- eventQueue: {- createdAt: '0',- event: LicenseEvent.NO_EVENT,- scheduledAt: '0',- status: '',- updatedAt: '0',- },- state: LicenseState.ACTIVATED,- status: LicenseStatus.VALID,- platform: LicensePlatform.CLOUD,- createdAt: '0',- plan: {- id: '0',- createdAt: '0',- description: '',- isActive: true,- name: '',- updatedAt: '0',- },- freeUntil: '0',- updatedAt: '0',- validFrom: 0,- validUntil: 0,- },- trialInfo: {- trialStart: -1,- trialEnd: -1,- onTrial: false,- workSpaceBlock: false,- trialConvertedToSubscription: false,- gracePeriodEnd: -1,- },- isFetchingActiveLicense: false,- activeLicenseFetchError: null,- changelog: null,- user: {- accessJwt: 'some-token',- refreshJwt: 'some-refresh-token',- id: 'some-user-id',- email: '[email protected]',- displayName: 'John Doe',- createdAt: 1732544623,- organization: 'Nightswatch',- orgId: 'does-not-matter-id',- role: role as ROLES,- },- org: [- {- createdAt: 0,- id: 'does-not-matter-id',- displayName: 'Pentagon',- },- ],- hasEditPermission: role === USER_ROLES.ADMIN || role === USER_ROLES.EDITOR,- isFetchingUser: false,- userFetchError: null,- featureFlags: defaultFeatureFlags,- isFetchingFeatureFlags: false,- featureFlagsFetchError: null,- hostsData: null,- isFetchingHosts: false,- hostsFetchError: null,- orgPreferences: [- {- name: ORG_PREFERENCES.ORG_ONBOARDING,- description: 'Organisation Onboarding',- valueType: 'boolean',- defaultValue: false,- allowedValues: ['true', 'false'],- allowedScopes: ['org'],- value: false,- },- ],- userPreferences: [],- updateUserPreferenceInContext: jest.fn(),- isFetchingOrgPreferences: false,- isFetchingUserPreferences: false,- orgPreferencesFetchError: null,- isLoggedIn: true,- isPreflightLoading: false,- showChangelogModal: false,- updateUser: jest.fn(),- updateOrg: jest.fn(),- updateOrgPreferences: jest.fn(),- activeLicenseRefetch: jest.fn(),- updateChangelog: jest.fn(),- toggleChangelogModal: jest.fn(),- versionData: {- version: '1.0.0',- ee: 'Y',- setupCompleted: true,- },-- ...appContextOverrides,- };+ return createAppContextMock(role, appContextOverrides, () => jest.fn());}export function AllTheProviders({diff --git a/frontend/tsconfig.json b/frontend/tsconfig.jsonindex d3004acfd8..3889297ae7 100644--- a/frontend/tsconfig.json+++ b/frontend/tsconfig.json@@ -36,6 +36,7 @@"./__mocks__/*"],"api": ["./src/api"],+ "app/*": ["./src/app/*"],"AppRoutes": ["./src/AppRoutes"],"ReactI18": ["./src/ReactI18"],"store": ["./src/store"],@@ -76,6 +77,7 @@],"include": ["./src",+ "./.storybook","./__mocks__","./babel.config.cjs","./jest.config.ts",