Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add route registry for dashboard developers to allow registering/extending dashboard routes
Damian Legawiec9bfd7765c23e
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.tsindex b1e48e88ac..6f7a2ef697 100644--- a/packages/dashboard-core/src/index.ts+++ b/packages/dashboard-core/src/index.ts@@ -68,12 +68,14 @@ export * from './lib/formatters'// `i18n.addResourceBundle`) get it via the named re-export.export * from './lib/i18n'// ----------------------------------------------------------------------------// Registries — the four pluggable extension points+// Registries — five pluggable extension points (nav, route, slot,+// table, settings-nav)// ---------------------------------------------------------------------------export * from './lib/nav-registry'export * from './lib/permissions'export * from './lib/query-client'export * from './lib/query-keys'+export * from './lib/route-registry'export * from './lib/search-registry'export * from './lib/settings-nav-registry'export * from './lib/slot-registry'diff --git a/packages/dashboard-core/src/lib/route-registry.ts b/packages/dashboard-core/src/lib/route-registry.tsnew file mode 100644index 0000000000..b034eb184f--- /dev/null+++ b/packages/dashboard-core/src/lib/route-registry.ts@@ -0,0 +1,144 @@+import type { ComponentType } from 'react'+import { useSyncExternalStore } from 'react'+import type { SubjectName } from './permissions'++/**+ * Dashboard route contributed by a plugin. Mounted under the dashboard's+ * `/_authenticated/$storeId/_plugins/$` catch-all, which reads this registry+ * at render time and dispatches based on the splat path.+ *+ * Path patterns use TanStack-Router-style param tokens (`$brandId`) inside the+ * plugin's namespace. The dashboard strips the `/$storeId/` prefix before+ * matching, so a plugin pattern of `/brands/$brandId` matches the URL+ * `/store_xyz/brands/br_abc123` with `params: { brandId: 'br_abc123' }`.+ */+export interface RouteEntry {+ /**+ * Stable identifier — used for register/remove/update and as the React key.+ * Mirrors the slug a plugin would use in its `nav.add({ key })` call so the+ * sidebar entry and route stay paired.+ */+ key: string+ /**+ * Path pattern relative to `/$storeId`. Examples: `/brands`,+ * `/brands/$brandId`, `/wishlists/$wishlistId/items`.+ * Must start with `/`. Do NOT include the `/$storeId` prefix; the dashboard+ * adds it at render time.+ */+ path: string+ /**+ * The component to render. Receives:+ * - `params`: extracted path params (e.g. matching `/brands/$brandId`+ * against `/brands/br_abc` yields `{ brandId: 'br_abc' }`)+ * - `storeId`: the current store — every plugin route is implicitly scoped+ * under `/$storeId/...`+ * - `searchParams`: the URL search-state object from TanStack Router. Use+ * this with `<ResourceTable searchParams={searchParams} ... />` so+ * filter/sort/pagination round-trip through the URL.+ */+ component: ComponentType<{+ params: Record<string, string>+ storeId: string+ searchParams: Record<string, unknown>+ }>+ /**+ * Optional CanCanCan subject required to view the route. The catch-all+ * renderer checks `permissions.can('read', subject)` and renders a 403+ * fallback when denied. Omit for routes that don't need permission gating.+ */+ subject?: SubjectName+}++const entries: RouteEntry[] = []+const listeners = new Set<() => void>()++function notify() {+ for (const l of listeners) l()+}++function subscribe(listener: () => void): () => void {+ listeners.add(listener)+ return () => {+ listeners.delete(listener)+ }+}++function getSnapshot(): readonly RouteEntry[] {+ return entries+}++interface RouteMutator {+ /** Register a route. Throws if `key` is already registered. */+ add(entry: RouteEntry): void+ /** Remove a route by key. No-op when missing. */+ remove(key: string): void+}++export const pluginRoutes: RouteMutator = {+ add(entry) {+ if (entries.some((e) => e.key === entry.key)) {+ throw new Error(`Plugin route "${entry.key}" already registered.`)+ }+ if (!entry.path.startsWith('/')) {+ throw new Error(`Plugin route "${entry.key}" path must start with "/", got "${entry.path}".`)+ }+ entries.push(entry)+ notify()+ },+ remove(key) {+ const i = entries.findIndex((e) => e.key === key)+ if (i === -1) return+ entries.splice(i, 1)+ notify()+ },+}++/**+ * Subscribe to plugin route updates. Returns the full list of registered+ * routes; the catch-all renderer matches against this on every navigation.+ */+export function usePluginRoutes(): readonly RouteEntry[] {+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)+}++/**+ * Match a URL splat (the bit after `/$storeId/`) against the registered+ * routes. Returns the matched entry plus the extracted path params, or+ * `null` if nothing matched.+ *+ * Path patterns support TanStack-style `$param` tokens. A pattern segment+ * of `$brandId` matches any non-empty URL segment and binds it to+ * `params.brandId`.+ */+export function matchPluginRoute(+ splat: string,+ routes: readonly RouteEntry[],+): { entry: RouteEntry; params: Record<string, string> } | null {+ // Normalize: strip leading slash, drop empty trailing segments.+ const urlSegments = splat.replace(/^\/+/, '').split('/').filter(Boolean)+ for (const entry of routes) {+ const patternSegments = entry.path.replace(/^\/+/, '').split('/').filter(Boolean)+ if (patternSegments.length !== urlSegments.length) continue++ const params: Record<string, string> = {}+ let matched = true+ for (let i = 0; i < patternSegments.length; i++) {+ const p = patternSegments[i]+ const u = urlSegments[i]+ if (p.startsWith('$')) {+ params[p.slice(1)] = u+ } else if (p !== u) {+ matched = false+ break+ }+ }+ if (matched) return { entry, params }+ }+ return null+}++/** Test-only: clear the registry. */+export function __resetPluginRoutes(): void {+ entries.length = 0+ notify()+}diff --git a/packages/dashboard-core/src/plugin.ts b/packages/dashboard-core/src/plugin.tsindex 5c25d83912..8fddac7409 100644--- a/packages/dashboard-core/src/plugin.ts+++ b/packages/dashboard-core/src/plugin.ts@@ -33,6 +33,8 @@import type { NavEntry } from './lib/nav-registry'import { nav } from './lib/nav-registry'+import type { RouteEntry } from './lib/route-registry'+import { pluginRoutes } from './lib/route-registry'import type { SettingsNavEntry, SettingsNavGroup } from './lib/settings-nav-registry'import { settingsNav } from './lib/settings-nav-registry'import type { SlotEntry } from './lib/slot-registry'@@ -60,6 +62,14 @@ export interface DashboardPluginConfig {slots?: Record<string, SlotEntry[]>/** Table mutations keyed by table key (see `defineTable`). */tables?: Record<string, TableMutations>+ /**+ * Custom routes mounted under `/$storeId/`. Each entry's `path` is relative+ * (e.g. `/brands`, `/brands/$brandId`). The dashboard's catch-all route at+ * `/$storeId/*` dispatches based on the splat — your `component` renders+ * exactly like any first-party route, including TanStack Router's+ * `useParams()` for path params.+ */+ routes?: RouteEntry[]}/**@@ -118,6 +128,10 @@ export function defineDashboardPlugin(config: DashboardPluginConfig): void {}}+ if (config.routes) {+ for (const entry of config.routes) safely(pluginRoutes.add, entry)+ }+if (errors.length === 1) throw errors[0]if (errors.length > 1) {throw new AggregateError(errors, `${errors.length} registration(s) failed`)diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.tsindex 6730d87a43..e0319a6801 100644--- a/packages/dashboard/src/routeTree.gen.ts+++ b/packages/dashboard/src/routeTree.gen.ts@@ -9,16 +9,14 @@// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.import { Route as rootRouteImport } from './routes/__root'-import { Route as ResetPasswordRouteImport } from './routes/reset-password'import { Route as LoginRouteImport } from './routes/login'-import { Route as ForgotPasswordRouteImport } from './routes/forgot-password'import { Route as AuthenticatedRouteImport } from './routes/_authenticated'import { Route as AuthenticatedIndexRouteImport } from './routes/_authenticated/index'import { Route as AcceptInvitationInvitationIdRouteImport } from './routes/accept-invitation.$invitationId'import { Route as AuthenticatedStoreIdRouteImport } from './routes/_authenticated/$storeId'import { Route as AuthenticatedStoreIdIndexRouteImport } from './routes/_authenticated/$storeId/index'import { Route as AuthenticatedStoreIdSettingsRouteImport } from './routes/_authenticated/$storeId/settings'-import { Route as AuthenticatedStoreIdGettingStartedRouteImport } from './routes/_authenticated/$storeId/getting-started'+import { Route as AuthenticatedStoreIdSplatRouteImport } from './routes/_authenticated/$storeId/$'import { Route as AuthenticatedStoreIdSettingsIndexRouteImport } from './routes/_authenticated/$storeId/settings/index'import { Route as AuthenticatedStoreIdPromotionsIndexRouteImport } from './routes/_authenticated/$storeId/promotions/index'import { Route as AuthenticatedStoreIdProductsIndexRouteImport } from './routes/_authenticated/$storeId/products/index'@@ -49,7 +47,6 @@ import { Route as AuthenticatedStoreIdOrdersOrderIdRouteImport } from './routes/import { Route as AuthenticatedStoreIdCustomersGroupsRouteImport } from './routes/_authenticated/$storeId/customers/groups'import { Route as AuthenticatedStoreIdCustomersCustomerIdRouteImport } from './routes/_authenticated/$storeId/customers/$customerId'import { Route as AuthenticatedStoreIdSettingsWebhooksIndexRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/index'-import { Route as AuthenticatedStoreIdSettingsImportsIndexRouteImport } from './routes/_authenticated/$storeId/settings/imports/index'import { Route as AuthenticatedStoreIdProductsPriceListsIndexRouteImport } from './routes/_authenticated/$storeId/products/price-lists/index'import { Route as AuthenticatedStoreIdProductsCategoriesIndexRouteImport } from './routes/_authenticated/$storeId/products/categories/index'import { Route as AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'@@ -58,21 +55,11 @@ import { Route as AuthenticatedStoreIdProductsCategoriesNewRouteImport } from '.import { Route as AuthenticatedStoreIdProductsCategoriesCategoryIdRouteImport } from './routes/_authenticated/$storeId/products/categories/$categoryId'import { Route as AuthenticatedStoreIdProductsPriceListsPriceListIdIndexRouteImport } from './routes/_authenticated/$storeId/products/price-lists/$priceListId/index'-const ResetPasswordRoute = ResetPasswordRouteImport.update({- id: '/reset-password',- path: '/reset-password',- getParentRoute: () => rootRouteImport,-} as any)const LoginRoute = LoginRouteImport.update({id: '/login',path: '/login',getParentRoute: () => rootRouteImport,} as any)-const ForgotPasswordRoute = ForgotPasswordRouteImport.update({- id: '/forgot-password',- path: '/forgot-password',- getParentRoute: () => rootRouteImport,-} as any)const AuthenticatedRoute = AuthenticatedRouteImport.update({id: '/_authenticated',getParentRoute: () => rootRouteImport,@@ -105,10 +92,10 @@ const AuthenticatedStoreIdSettingsRoute =path: '/settings',getParentRoute: () => AuthenticatedStoreIdRoute,} as any)-const AuthenticatedStoreIdGettingStartedRoute =- AuthenticatedStoreIdGettingStartedRouteImport.update({- id: '/getting-started',- path: '/getting-started',+const AuthenticatedStoreIdSplatRoute =+ AuthenticatedStoreIdSplatRouteImport.update({+ id: '/$',+ path: '/$',getParentRoute: () => AuthenticatedStoreIdRoute,} as any)const AuthenticatedStoreIdSettingsIndexRoute =@@ -291,12 +278,6 @@ const AuthenticatedStoreIdSettingsWebhooksIndexRoute =path: '/webhooks/',getParentRoute: () => AuthenticatedStoreIdSettingsRoute,} as any)-const AuthenticatedStoreIdSettingsImportsIndexRoute =- AuthenticatedStoreIdSettingsImportsIndexRouteImport.update({- id: '/imports/',- path: '/imports/',- getParentRoute: () => AuthenticatedStoreIdSettingsRoute,- } as any)const AuthenticatedStoreIdProductsPriceListsIndexRoute =AuthenticatedStoreIdProductsPriceListsIndexRouteImport.update({id: '/products/price-lists/',@@ -342,12 +323,10 @@ const AuthenticatedStoreIdProductsPriceListsPriceListIdIndexRoute =export interface FileRoutesByFullPath {'/': typeof AuthenticatedIndexRoute- '/forgot-password': typeof ForgotPasswordRoute'/login': typeof LoginRoute- '/reset-password': typeof ResetPasswordRoute'/$storeId': typeof AuthenticatedStoreIdRouteWithChildren'/accept-invitation/$invitationId': typeof AcceptInvitationInvitationIdRoute- '/$storeId/getting-started': typeof AuthenticatedStoreIdGettingStartedRoute+ '/$storeId/$': typeof AuthenticatedStoreIdSplatRoute'/$storeId/settings': typeof AuthenticatedStoreIdSettingsRouteWithChildren'/$storeId/': typeof AuthenticatedStoreIdIndexRoute'/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute@@ -385,17 +364,14 @@ export interface FileRoutesByFullPath {'/$storeId/settings/webhooks/$webhookEndpointId': typeof AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute'/$storeId/products/categories/': typeof AuthenticatedStoreIdProductsCategoriesIndexRoute'/$storeId/products/price-lists/': typeof AuthenticatedStoreIdProductsPriceListsIndexRoute- '/$storeId/settings/imports/': typeof AuthenticatedStoreIdSettingsImportsIndexRoute'/$storeId/settings/webhooks/': typeof AuthenticatedStoreIdSettingsWebhooksIndexRoute'/$storeId/products/price-lists/$priceListId/': typeof AuthenticatedStoreIdProductsPriceListsPriceListIdIndexRoute}export interface FileRoutesByTo {- '/forgot-password': typeof ForgotPasswordRoute'/login': typeof LoginRoute- '/reset-password': typeof ResetPasswordRoute'/accept-invitation/$invitationId': typeof AcceptInvitationInvitationIdRoute'/': typeof AuthenticatedIndexRoute- '/$storeId/getting-started': typeof AuthenticatedStoreIdGettingStartedRoute+ '/$storeId/$': typeof AuthenticatedStoreIdSplatRoute'/$storeId': typeof AuthenticatedStoreIdIndexRoute'/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute'/$storeId/customers/groups': typeof AuthenticatedStoreIdCustomersGroupsRoute@@ -432,20 +408,17 @@ export interface FileRoutesByTo {'/$storeId/settings/webhooks/$webhookEndpointId': typeof AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute'/$storeId/products/categories': typeof AuthenticatedStoreIdProductsCategoriesIndexRoute'/$storeId/products/price-lists': typeof AuthenticatedStoreIdProductsPriceListsIndexRoute- '/$storeId/settings/imports': typeof AuthenticatedStoreIdSettingsImportsIndexRoute'/$storeId/settings/webhooks': typeof AuthenticatedStoreIdSettingsWebhooksIndexRoute'/$storeId/products/price-lists/$priceListId': typeof AuthenticatedStoreIdProductsPriceListsPriceListIdIndexRoute}export interface FileRoutesById {__root__: typeof rootRouteImport'/_authenticated': typeof AuthenticatedRouteWithChildren- '/forgot-password': typeof ForgotPasswordRoute'/login': typeof LoginRoute- '/reset-password': typeof ResetPasswordRoute'/_authenticated/$storeId': typeof AuthenticatedStoreIdRouteWithChildren'/accept-invitation/$invitationId': typeof AcceptInvitationInvitationIdRoute'/_authenticated/': typeof AuthenticatedIndexRoute- '/_authenticated/$storeId/getting-started': typeof AuthenticatedStoreIdGettingStartedRoute+ '/_authenticated/$storeId/$': typeof AuthenticatedStoreIdSplatRoute'/_authenticated/$storeId/settings': typeof AuthenticatedStoreIdSettingsRouteWithChildren'/_authenticated/$storeId/': typeof AuthenticatedStoreIdIndexRoute'/_authenticated/$storeId/customers/$customerId': typeof AuthenticatedStoreIdCustomersCustomerIdRoute@@ -483,7 +456,6 @@ export interface FileRoutesById {'/_authenticated/$storeId/settings/webhooks/$webhookEndpointId': typeof AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute'/_authenticated/$storeId/products/categories/': typeof AuthenticatedStoreIdProductsCategoriesIndexRoute'/_authenticated/$storeId/products/price-lists/': typeof AuthenticatedStoreIdProductsPriceListsIndexRoute- '/_authenticated/$storeId/settings/imports/': typeof AuthenticatedStoreIdSettingsImportsIndexRoute'/_authenticated/$storeId/settings/webhooks/': typeof AuthenticatedStoreIdSettingsWebhooksIndexRoute'/_authenticated/$storeId/products/price-lists/$priceListId/': typeof AuthenticatedStoreIdProductsPriceListsPriceListIdIndexRoute}@@ -491,12 +463,10 @@ export interface FileRouteTypes {fileRoutesByFullPath: FileRoutesByFullPathfullPaths:| '/'- | '/forgot-password'| '/login'- | '/reset-password'| '/$storeId'| '/accept-invitation/$invitationId'- | '/$storeId/getting-started'+ | '/$storeId/$'| '/$storeId/settings'| '/$storeId/'| '/$storeId/customers/$customerId'@@ -534,17 +504,14 @@ export interface FileRouteTypes {| '/$storeId/settings/webhooks/$webhookEndpointId'| '/$storeId/products/categories/'| '/$storeId/products/price-lists/'- | '/$storeId/settings/imports/'| '/$storeId/settings/webhooks/'| '/$storeId/products/price-lists/$priceListId/'fileRoutesByTo: FileRoutesByToto:- | '/forgot-password'| '/login'- | '/reset-password'| '/accept-invitation/$invitationId'| '/'- | '/$storeId/getting-started'+ | '/$storeId/$'| '/$storeId'| '/$storeId/customers/$customerId'| '/$storeId/customers/groups'@@ -581,19 +548,16 @@ export interface FileRouteTypes {| '/$storeId/settings/webhooks/$webhookEndpointId'| '/$storeId/products/categories'| '/$storeId/products/price-lists'- | '/$storeId/settings/imports'| '/$storeId/settings/webhooks'| '/$storeId/products/price-lists/$priceListId'id:| '__root__'| '/_authenticated'- | '/forgot-password'| '/login'- | '/reset-password'| '/_authenticated/$storeId'| '/accept-invitation/$invitationId'| '/_authenticated/'- | '/_authenticated/$storeId/getting-started'+ | '/_authenticated/$storeId/$'| '/_authenticated/$storeId/settings'| '/_authenticated/$storeId/'| '/_authenticated/$storeId/customers/$customerId'@@ -631,28 +595,18 @@ export interface FileRouteTypes {| '/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'| '/_authenticated/$storeId/products/categories/'| '/_authenticated/$storeId/products/price-lists/'- | '/_authenticated/$storeId/settings/imports/'| '/_authenticated/$storeId/settings/webhooks/'| '/_authenticated/$storeId/products/price-lists/$priceListId/'fileRoutesById: FileRoutesById}export interface RootRouteChildren {AuthenticatedRoute: typeof AuthenticatedRouteWithChildren- ForgotPasswordRoute: typeof ForgotPasswordRouteLoginRoute: typeof LoginRoute- ResetPasswordRoute: typeof ResetPasswordRouteAcceptInvitationInvitationIdRoute: typeof AcceptInvitationInvitationIdRoute}declare module '@tanstack/react-router' {interface FileRoutesByPath {- '/reset-password': {- id: '/reset-password'- path: '/reset-password'- fullPath: '/reset-password'- preLoaderRoute: typeof ResetPasswordRouteImport- parentRoute: typeof rootRouteImport- }'/login': {id: '/login'path: '/login'@@ -660,13 +614,6 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof LoginRouteImportparentRoute: typeof rootRouteImport}- '/forgot-password': {- id: '/forgot-password'- path: '/forgot-password'- fullPath: '/forgot-password'- preLoaderRoute: typeof ForgotPasswordRouteImport- parentRoute: typeof rootRouteImport- }'/_authenticated': {id: '/_authenticated'path: ''@@ -709,11 +656,11 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof AuthenticatedStoreIdSettingsRouteImportparentRoute: typeof AuthenticatedStoreIdRoute}- '/_authenticated/$storeId/getting-started': {- id: '/_authenticated/$storeId/getting-started'- path: '/getting-started'- fullPath: '/$storeId/getting-started'- preLoaderRoute: typeof AuthenticatedStoreIdGettingStartedRouteImport+ '/_authenticated/$storeId/$': {+ id: '/_authenticated/$storeId/$'+ path: '/$'+ fullPath: '/$storeId/$'+ preLoaderRoute: typeof AuthenticatedStoreIdSplatRouteImportparentRoute: typeof AuthenticatedStoreIdRoute}'/_authenticated/$storeId/settings/': {@@ -926,13 +873,6 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof AuthenticatedStoreIdSettingsWebhooksIndexRouteImportparentRoute: typeof AuthenticatedStoreIdSettingsRoute}- '/_authenticated/$storeId/settings/imports/': {- id: '/_authenticated/$storeId/settings/imports/'- path: '/imports'- fullPath: '/$storeId/settings/imports/'- preLoaderRoute: typeof AuthenticatedStoreIdSettingsImportsIndexRouteImport- parentRoute: typeof AuthenticatedStoreIdSettingsRoute- }'/_authenticated/$storeId/products/price-lists/': {id: '/_authenticated/$storeId/products/price-lists/'path: '/products/price-lists'@@ -1000,7 +940,6 @@ interface AuthenticatedStoreIdSettingsRouteChildren {AuthenticatedStoreIdSettingsTaxCategoriesRoute: typeof AuthenticatedStoreIdSettingsTaxCategoriesRouteAuthenticatedStoreIdSettingsIndexRoute: typeof AuthenticatedStoreIdSettingsIndexRouteAuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute: typeof AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute- AuthenticatedStoreIdSettingsImportsIndexRoute: typeof AuthenticatedStoreIdSettingsImportsIndexRouteAuthenticatedStoreIdSettingsWebhooksIndexRoute: typeof AuthenticatedStoreIdSettingsWebhooksIndexRoute}@@ -1034,8 +973,6 @@ const AuthenticatedStoreIdSettingsRouteChildren: AuthenticatedStoreIdSettingsRouAuthenticatedStoreIdSettingsIndexRoute,AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute:AuthenticatedStoreIdSettingsWebhooksWebhookEndpointIdRoute,- AuthenticatedStoreIdSettingsImportsIndexRoute:- AuthenticatedStoreIdSettingsImportsIndexRoute,AuthenticatedStoreIdSettingsWebhooksIndexRoute:AuthenticatedStoreIdSettingsWebhooksIndexRoute,}@@ -1046,7 +983,7 @@ const AuthenticatedStoreIdSettingsRouteWithChildren =)interface AuthenticatedStoreIdRouteChildren {- AuthenticatedStoreIdGettingStartedRoute: typeof AuthenticatedStoreIdGettingStartedRoute+ AuthenticatedStoreIdSplatRoute: typeof AuthenticatedStoreIdSplatRouteAuthenticatedStoreIdSettingsRoute: typeof AuthenticatedStoreIdSettingsRouteWithChildrenAuthenticatedStoreIdIndexRoute: typeof AuthenticatedStoreIdIndexRouteAuthenticatedStoreIdCustomersCustomerIdRoute: typeof AuthenticatedStoreIdCustomersCustomerIdRoute@@ -1074,8 +1011,7 @@ interface AuthenticatedStoreIdRouteChildren {}const AuthenticatedStoreIdRouteChildren: AuthenticatedStoreIdRouteChildren = {- AuthenticatedStoreIdGettingStartedRoute:- AuthenticatedStoreIdGettingStartedRoute,+ AuthenticatedStoreIdSplatRoute: AuthenticatedStoreIdSplatRoute,AuthenticatedStoreIdSettingsRoute:AuthenticatedStoreIdSettingsRouteWithChildren,AuthenticatedStoreIdIndexRoute: AuthenticatedStoreIdIndexRoute,@@ -1140,9 +1076,7 @@ const AuthenticatedRouteWithChildren = AuthenticatedRoute._addFileChildren(const rootRouteChildren: RootRouteChildren = {AuthenticatedRoute: AuthenticatedRouteWithChildren,- ForgotPasswordRoute: ForgotPasswordRoute,LoginRoute: LoginRoute,- ResetPasswordRoute: ResetPasswordRoute,AcceptInvitationInvitationIdRoute: AcceptInvitationInvitationIdRoute,}export const routeTree = rootRouteImportdiff --git a/packages/dashboard/src/routes/_authenticated/$storeId/$.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/$.tsxnew file mode 100644index 0000000000..82264d1ec9--- /dev/null+++ b/packages/dashboard/src/routes/_authenticated/$storeId/$.tsx@@ -0,0 +1,55 @@+/**+ * Catch-all splat route. TanStack Router falls through to this when none of+ * the dashboard's first-party routes (`customers/`, `orders/`, `products/`,+ * etc.) match. We use it to dispatch to plugin-registered routes from+ * `@spree/dashboard-core`'s route registry — plugins call+ * `defineDashboardPlugin({ routes: [{ path: '/brands', component: ... }] })`+ * and we render the matched component here.+ *+ * Unmatched paths get a simple "Not Found" message rather than the dashboard's+ * full 404 page; once the dashboard grows a proper 404 view, this can render+ * that instead.+ */+import { matchPluginRoute, usePermissions, usePluginRoutes } from '@spree/dashboard-core'+import { ErrorState } from '@spree/dashboard-ui'+import { createFileRoute } from '@tanstack/react-router'+import { useTranslation } from 'react-i18next'++export const Route = createFileRoute('/_authenticated/$storeId/$')({+ component: PluginRouteDispatcher,+})++function PluginRouteDispatcher() {+ const { storeId, _splat } = Route.useParams() as { storeId: string; _splat?: string }+ const searchParams = Route.useSearch() as Record<string, unknown>+ const routes = usePluginRoutes()+ const { t } = useTranslation()+ const { permissions } = usePermissions()++ const match = matchPluginRoute(_splat ?? '', routes)++ if (!match) {+ return (+ <ErrorState+ title={t('admin.errors.not_found_title', { defaultValue: 'Page not found' })}+ description={t('admin.errors.not_found_description', {+ defaultValue: 'The page you’re looking for doesn’t exist.',+ })}+ />+ )+ }++ if (match.entry.subject && !permissions.can('read', match.entry.subject)) {+ return (+ <ErrorState+ title={t('admin.errors.forbidden_title', { defaultValue: 'Not authorized' })}+ description={t('admin.errors.forbidden_description', {+ defaultValue: 'You don’t have permission to view this page.',+ })}+ />+ )+ }++ const Component = match.entry.component+ return <Component params={match.params} storeId={storeId} searchParams={searchParams} />+}