Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Setup `@spree/dashboard-core` package (#14106)

Damian Legawiecb68e1755dc97
diff --git a/packages/dashboard-core/README.md b/packages/dashboard-core/README.md
index 3b777a72d0..358fc6a3fc 100644
--- a/packages/dashboard-core/README.md
+++ b/packages/dashboard-core/README.md
@@ -1,35 +1,301 @@
# @spree/dashboard-core
-Spree Dashboard framework. The extension API surface for plugin authors.
+Spree Dashboard framework. Registries, providers, infra hooks, the admin SDK client, and the `defineDashboardPlugin` extension API.
-> **Phase 0 placeholder.** The package is scaffolded with its target structure; the registries, providers, and hooks haven't been extracted yet. See `docs/plans/6.0-admin-spa.md` → "Package Split".
+This is the package plugin authors install. Use it to register nav entries, slot widgets, table column extensions, and settings pages from a separate npm package that gets imported into `@spree/dashboard` at boot.
-## What goes here
+## Install
-- **Registries** (`src/lib/*-registry.ts`): `table`, `nav`, `slot`, `settings-nav`. Module-singleton stores driven by `useSyncExternalStore`. The plugin extension surface.
-- **Providers** (`src/providers/`): `AuthProvider`, `PermissionProvider`, `StoreProvider`, `ThemeProvider`. Must be mounted by the consuming app shell.
-- **Generic infra hooks** (`src/hooks/`): `use-auth`, `use-permissions`, `use-store`, `use-theme`, `use-resource-mutation`, `use-direct-upload`, `use-global-search`, `use-command-palette`, `use-copy-to-clipboard`, `use-scrolled`, `use-mobile`. Plus the cross-cutting infrastructure-flavored hooks (`use-countries`, `use-export`, `use-custom-fields`).
-- **Admin SDK client** (`src/client.ts`): the Vite-aware `adminClient` singleton.
-- **`defineDashboardPlugin`** (`src/plugin.ts`): the facade plugin authors call.
+```bash
+pnpm add @spree/dashboard-core @spree/dashboard-ui
+```
-## Peer dependencies
+Peer dependencies that the consuming app provides: `react`, `react-dom`, `@spree/admin-sdk`, `@spree/dashboard-ui`, `@tanstack/react-query`, `@tanstack/react-router`, `@tanstack/react-hotkeys`, `react-hook-form`, `react-i18next`, `i18next`, `sonner`.
-`react`, `react-dom`, and `@spree/dashboard-ui` are peer deps. **Critical**: the four registries are module singletons. If a plugin bundles its own copy of `@spree/dashboard-core`, `registerSlot` writes to a different Map than `<Slot>` reads — silent no-op. Always keep `@spree/dashboard-core` as a peer dep in every plugin package; pnpm dedupes to a single instance.
+**Why peer deps:** the four registries (nav, slot, table, settings-nav) are module singletons. If your plugin bundles its own copy of `@spree/dashboard-core`, `registerSlot` writes to a different Map than the app's `<Slot>` reads — silent no-op. Same applies to React, the query client, the router instance, and the i18n singleton. pnpm dedupes these to a single instance as long as they're peers.
-## What's NOT here
+## What's in the box
+
+```
+@spree/dashboard-core
+├── adminClient # @spree/admin-sdk instance, baseUrl wired to VITE_SPREE_API_URL
+│
+├── Providers (mount in your app shell, in this order)
+│ ├── AuthProvider # JWT + refresh token, /auth/refresh on cold load
+│ ├── PermissionProvider # /api/v3/admin/me → CanCanCan rules
+│ └── StoreProvider # current store context (multi-store)
+│
+├── Registries (the four extension points)
+│ ├── nav # sidebar items
+│ ├── settingsNav # settings sub-shell groups + items
+│ ├── slot # named injection points (`product.form_sidebar`, ...)
+│ └── tables # column add/remove/update per list view
+│
+├── Infra hooks
+│ ├── useAuth # { token, user, login(), logout() }
+│ ├── usePermissions # CanCanCan rules + <Can> helper
+│ ├── useStore # current store
+│ ├── useResourceMutation # useMutation + toast + form-error mapping
+│ ├── useDirectUpload # Active Storage direct-upload
+│ ├── useGlobalSearch # cross-resource search
+│ ├── useCommandPalette # ⌘K palette state
+│ ├── useCopyToClipboard
+│ ├── useScrolled
+│ ├── useCountries # admin/countries (geo data, cached)
+│ ├── useExport # CSV export jobs (polled)
+│ └── useCustomFields # metafield definitions + values
+│
+├── i18n (i18next + react-i18next)
+│ ├── Base translation namespace (`admin.actions.*`, `admin.common.*`, `admin.validation.*`, …)
+│ ├── Trans, useTranslation # re-exported from react-i18next
+│ └── i18n # the i18next singleton (call addResourceBundle to extend)
+│
+├── Helpers
+│ ├── filtersToRansack # UI filter shape → Ransack params
+│ ├── mapSpreeErrorsToForm # 422 → RHF setError
+│ ├── formatPrice / getInitials
+│ ├── Subject, Action # CanCanCan subject/action constants
+│ └── queryClient # TanStack Query client singleton
+│
+└── defineDashboardPlugin # the one-call extension facade
+```
-Resource-specific hooks (`use-orders`, `use-products`, `use-customers`, `use-promotions`, …), Zod schemas, feature pages, route definitions, and locale strings live in `@spree/dashboard` (the app). We do not publish feature internals — that's the same call Medusa, Vendure, and Saleor make.
+## Plugin authoring — the basics
-## Plugin authoring (post-Phase 2)
+Your plugin is an npm package. Its entry module calls `defineDashboardPlugin({...})` at import time. The dashboard app imports your entry module before first render — every registry handles late registration via `useSyncExternalStore`, so even if your plugin loads asynchronously the sidebar/slots re-render.
```tsx
-import { defineDashboardPlugin } from '@spree/dashboard-core/plugin'
-import { PageHeader, Button } from '@spree/dashboard-ui'
+// my-spree-plugin/src/index.ts
+import { defineDashboardPlugin, usePermissions } from '@spree/dashboard-core'
+import { Card, CardHeader, CardTitle, CardContent } from '@spree/dashboard-ui'
+import { BarChartIcon } from 'lucide-react'
+
+function WishlistsWidget({ product }: { product: { id: string; wishlist_count: number } }) {
+ return (
+ <Card>
+ <CardHeader><CardTitle>Wishlists</CardTitle></CardHeader>
+ <CardContent>{product.wishlist_count} customers</CardContent>
+ </Card>
+ )
+}
defineDashboardPlugin({
- nav: [{ key: 'reports', label: 'Reports', url: '/reports', position: 50 }],
+ nav: [
+ { key: 'wishlists', label: 'Wishlists', path: '/wishlists', icon: BarChartIcon, position: 50 },
+ ],
slots: {
- 'product.form_sidebar': [{ id: 'my-widget', component: MyWidget }],
+ 'product.form_sidebar': [
+ { id: 'wishlist-count', component: WishlistsWidget, position: 50 },
+ ],
+ },
+ tables: {
+ products: {
+ add: [{ key: 'wishlist_count', label: 'Wishlists', sortable: true }],
+ },
},
})
```
+
+Then in the consuming app's entry point:
+
+```ts
+// my-spree-app/src/main.tsx
+import '@spree/dashboard-core/lib/i18n' // base translations
+import 'my-spree-plugin' // your plugin registers extensions
+// ...rest of normal dashboard bootstrap
+```
+
+## Translations — extending the base namespace
+
+Plugin authors **inherit the framework's base translation namespace** (`admin.actions.save`, `admin.common.no_results`, `admin.validation.required`, `admin.fields.<simple>.label`, …) for free. To add your own keys, call `i18n.addResourceBundle` after the side-effect import.
+
+```ts
+// my-spree-plugin/src/index.ts
+import { i18n } from '@spree/dashboard-core'
+import en from './locales/en.json'
+//
+// {
+// "admin": {
+// "wishlists": {
+// "title": "Wishlists",
+// "empty_state": "No wishlists yet"
+// }
+// }
+// }
+
+i18n.addResourceBundle('en', 'translation', en, true, true)
+// `deep: true` + `overwrite: true` merge nested keys into the base namespace
+// without dropping anything the framework provided.
+```
+
+Now anywhere in your plugin you can mix base keys and your own:
+
+```tsx
+import { useTranslation } from '@spree/dashboard-core'
+
+function WishlistsHeader() {
+ const { t } = useTranslation()
+ return (
+ <header>
+ <h1>{t('admin.wishlists.title')}</h1>
+ <button>{t('admin.actions.create')}</button>{/* base */}
+ </header>
+ )
+}
+```
+
+### When plugins should pick their own sub-namespace
+
+`addResourceBundle` deep-merges into `admin.*`, so `admin.actions.save` from a plugin would **overwrite** the framework's `admin.actions.save`. To avoid collisions, put plugin-specific text under a vendor-prefixed key:
+
+```jsonc
+{
+ "admin": {
+ "wishlists": { ... } // ok — fresh namespace under admin
+ }
+}
+```
+
+Not:
+
+```jsonc
+{
+ "admin": {
+ "actions": {
+ "share": "Share" // collides if the framework ever adds `admin.actions.share`
+ }
+ }
+}
+```
+
+Prefer `admin.<plugin>.*` for everything you own. Use base keys (`admin.actions.*`, `admin.common.*`, `admin.fields.<simple>.*`) by *reading* them, not by extending them.
+
+### Multi-locale plugins
+
+Same pattern, once per locale:
+
+```ts
+import { i18n } from '@spree/dashboard-core'
+import en from './locales/en.json'
+import fr from './locales/fr.json'
+
+i18n.addResourceBundle('en', 'translation', en, true, true)
+i18n.addResourceBundle('fr', 'translation', fr, true, true)
+```
+
+The framework currently ships English only; once Spree's locale list grows the same `addResourceBundle` pattern applies.
+
+## Extension surface — the four registries
+
+### `nav` — main sidebar items
+
+```ts
+import { nav } from '@spree/dashboard-core'
+import { PackageIcon } from 'lucide-react'
+
+nav.add({
+ key: 'wishlists',
+ label: 'Wishlists',
+ path: '/wishlists', // prefixed with /$storeId at render time
+ icon: PackageIcon,
+ position: 50, // built-ins use 100/200/300 — slot in between
+ subject: 'Spree::Wishlist', // CanCanCan subject — hides item without permission
+})
+
+// Or: insert relative to an existing entry
+nav.insertAfter('orders', { key: 'wishlists', label: 'Wishlists', path: '/wishlists' })
+nav.update('orders', { label: 'All Orders' })
+nav.remove('legacy-thing')
+```
+
+### `settingsNav` — settings sub-shell
+
+Settings entries cluster under groups:
+
+```ts
+import { settingsNav } from '@spree/dashboard-core'
+
+settingsNav.addGroup({ key: 'integrations', label: 'Integrations', position: 500 })
+settingsNav.add({
+ key: 'wishlist-settings',
+ label: 'Wishlists',
+ path: '/wishlists', // prefixed with /$storeId/settings at render time
+ group: 'integrations',
+ position: 100,
+})
+```
+
+### `registerSlot` — named injection points
+
+Slots are typed by their context. A `product.form_sidebar` slot receives the product, ambient permissions, store, and user:
+
+```tsx
+import { registerSlot } from '@spree/dashboard-core'
+import { Card } from '@spree/dashboard-ui'
+
+registerSlot<{ product: { id: string; wishlist_count: number } }>('product.form_sidebar', {
+ id: 'wishlist-count',
+ component: ({ product, permissions }) => {
+ if (!permissions?.can('manage', 'Spree::Wishlist')) return null
+ return <Card>Wishlists: {product.wishlist_count}</Card>
+ },
+ position: 50,
+ // Optional visibility predicate — receives the merged context
+ if: (ctx) => ctx.product.wishlist_count > 0,
+})
+```
+
+Built-in slot names match the legacy Rails admin's `render_admin_partials` mental model (e.g. `product.form_sidebar`, `order.page_body`, `product.actions`). The full list is documented per route in `@spree/dashboard`.
+
+### `tables` — list-view column extensions
+
+```ts
+import { tables } from '@spree/dashboard-core'
+
+tables.products.addColumn({
+ key: 'wishlist_count',
+ label: 'Wishlists',
+ sortable: true,
+ render: (product) => product.wishlist_count,
+})
+tables.products.removeColumn('legacy_column')
+tables.products.updateColumn('total', { label: 'Net total' })
+```
+
+**Ordering:** built-in tables register lazily via side-effect imports in route files (`import '@/tables/products'` inside the products route), so calling `tables.products.addColumn(...)` from your plugin's entry module — which loads before any route mounts — would otherwise race the registration. The mutator handles this transparently: mutations on a not-yet-registered table are queued and replayed when `defineTable('products', ...)` runs. Mutations on tables that never register stay pending and never fire, which is the right behavior when your plugin extends an optional feature.
+
+## `defineDashboardPlugin` — one-call facade
+
+All four registries in a single declarative config:
+
+```ts
+import { defineDashboardPlugin } from '@spree/dashboard-core/plugin'
+
+defineDashboardPlugin({
+ nav: [...],
+ settingsNavGroups: [...],
+ settingsNav: [...],
+ slots: { 'product.form_sidebar': [...] },
+ tables: {
+ products: {
+ add: [...],
+ remove: ['legacy_column'],
+ update: { total: { label: 'Net total' } },
+ },
+ },
+})
+```
+
+Equivalent to calling the underlying registry methods directly. Use whichever feels right — the facade is purely ergonomic.
+
+## What's NOT here
+
+Resource-specific hooks (`use-orders`, `use-products`, `use-customers`, …), Zod schemas, feature pages, route definitions, and per-feature locale strings live in `@spree/dashboard` (the app). We do not publish feature internals — that's the same call Medusa, Vendure, and Saleor make. Plugin authors compose new pages out of `@spree/dashboard-ui` primitives + `@spree/dashboard-core` infra, not out of forked feature internals.
+
+Theme and toast UI live in `@spree/dashboard-ui` (they're rendering concerns, no Spree backend coupling): `ThemeProvider`, `useTheme`, `Toaster`.
+
+## Architectural notes
+
+- **Client injection**: `adminClient` reads `import.meta.env.VITE_SPREE_API_URL` at build time. Three deployment topologies (dev proxy, prod single-origin, prod cross-origin) all share one code path. See `src/client.ts` for details.
+- **i18n bootstrap**: `import '@spree/dashboard-core/lib/i18n'` initializes i18next with the base namespace. Must run before any component calls `useTranslation`. The dashboard's `i18n-setup.ts` does this + adds the app's resources via `addResourceBundle`. Plugins follow the same pattern.
+- **Registries are module singletons**: see "Peer dependencies" above. Build your plugin with `@spree/dashboard-core` listed as a peer dep, not a regular dep.
diff --git a/packages/dashboard-core/package.json b/packages/dashboard-core/package.json
index e0ae3c7dc6..b2afe562bf 100644
--- a/packages/dashboard-core/package.json
+++ b/packages/dashboard-core/package.json
@@ -3,14 +3,19 @@
"private": true,
"license": "MIT",
"version": "0.0.0",
- "description": "Spree Dashboard framework — registries (table, nav, slot, settings-nav), providers (auth, permission, store, theme), generic infra hooks, and the defineDashboardPlugin extension API.",
+ "description": "Spree Dashboard framework — registries (table, nav, slot, settings-nav), providers (auth, permission, store), admin SDK client, generic infra hooks, and the defineDashboardPlugin extension API.",
"type": "module",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": "./src/index.ts",
- "./plugin": "./src/plugin.ts"
+ "./plugin": "./src/plugin.ts",
+ "./providers/*": "./src/providers/*.tsx",
+ "./hooks/*": "./src/hooks/*.ts",
+ "./hooks/use-command-palette": "./src/hooks/use-command-palette.tsx",
+ "./lib/*": "./src/lib/*.ts",
+ "./locales/en.json": "./src/locales/en.json"
},
"files": [
"src",
@@ -23,13 +28,27 @@
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
+ "@spree/admin-sdk": "workspace:^",
"@spree/dashboard-ui": "workspace:^",
+ "@tanstack/react-hotkeys": "^0.10.0",
+ "@tanstack/react-query": "^5.100.9",
+ "@tanstack/react-router": "^1.169.2",
+ "i18next": "^26.2.0",
"react": "^19.2.6",
- "react-dom": "^19.2.6"
+ "react-dom": "^19.2.6",
+ "react-hook-form": "^7.75.0",
+ "react-i18next": "^17.0.8",
+ "sonner": "^2.0.7"
+ },
+ "dependencies": {
+ "lucide-react": "^1.14.0",
+ "spark-md5": "^3.0.2"
},
"devDependencies": {
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
- "typescript": "~6.0.3"
+ "@types/spark-md5": "^3.0.5",
+ "typescript": "~6.0.3",
+ "vite": "^8.0.11"
}
}
diff --git a/packages/dashboard/src/client.ts b/packages/dashboard-core/src/client.ts
similarity index 100%
rename from packages/dashboard/src/client.ts
rename to packages/dashboard-core/src/client.ts
diff --git a/packages/dashboard/src/hooks/use-auth.ts b/packages/dashboard-core/src/hooks/use-auth.ts
similarity index 78%
rename from packages/dashboard/src/hooks/use-auth.ts
rename to packages/dashboard-core/src/hooks/use-auth.ts
index 7d322fca03..4e10a0440c 100644
--- a/packages/dashboard/src/hooks/use-auth.ts
+++ b/packages/dashboard-core/src/hooks/use-auth.ts
@@ -1,5 +1,5 @@
import { useContext } from 'react'
-import { AuthContext } from '@/providers/auth-provider'
+import { AuthContext } from '../providers/auth-provider'
export function useAuth() {
const context = useContext(AuthContext)
diff --git a/packages/dashboard/src/hooks/use-command-palette.tsx b/packages/dashboard-core/src/hooks/use-command-palette.tsx
similarity index 100%
rename from packages/dashboard/src/hooks/use-command-palette.tsx
rename to packages/dashboard-core/src/hooks/use-command-palette.tsx
diff --git a/packages/dashboard/src/hooks/use-copy-to-clipboard.ts b/packages/dashboard-core/src/hooks/use-copy-to-clipboard.ts
similarity index 100%
rename from packages/dashboard/src/hooks/use-copy-to-clipboard.ts
rename to packages/dashboard-core/src/hooks/use-copy-to-clipboard.ts
diff --git a/packages/dashboard/src/hooks/use-countries.ts b/packages/dashboard-core/src/hooks/use-countries.ts
similarity index 91%
rename from packages/dashboard/src/hooks/use-countries.ts
rename to packages/dashboard-core/src/hooks/use-countries.ts
index e7a2278315..c5dfc0661a 100644
--- a/packages/dashboard/src/hooks/use-countries.ts
+++ b/packages/dashboard-core/src/hooks/use-countries.ts
@@ -1,6 +1,6 @@
import type { Country } from '@spree/admin-sdk'
import { useQuery } from '@tanstack/react-query'
-import { adminClient } from '@/client'
+import { adminClient } from '../client'
export function useCountries() {
const { data, isLoading } = useQuery({
diff --git a/packages/dashboard/src/hooks/use-custom-fields.ts b/packages/dashboard-core/src/hooks/use-custom-fields.ts
similarity index 98%
rename from packages/dashboard/src/hooks/use-custom-fields.ts
rename to packages/dashboard-core/src/hooks/use-custom-fields.ts
index 1eaf8fc2cb..71a3d5afc1 100644
--- a/packages/dashboard/src/hooks/use-custom-fields.ts
+++ b/packages/dashboard-core/src/hooks/use-custom-fields.ts
@@ -7,8 +7,8 @@ import type {
CustomFieldUpdateParams,
} from '@spree/admin-sdk'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
+import { adminClient } from '../client'
+import { useResourceMutation } from './use-resource-mutation'
const valuesKey = (ownerType: CustomFieldOwnerType, ownerId: string) =>
['custom-fields', ownerType, ownerId] as const
diff --git a/packages/dashboard/src/hooks/use-direct-upload.ts b/packages/dashboard-core/src/hooks/use-direct-upload.ts
similarity index 98%
rename from packages/dashboard/src/hooks/use-direct-upload.ts
rename to packages/dashboard-core/src/hooks/use-direct-upload.ts
index 5fa0dba0ab..5be8e1aa93 100644
--- a/packages/dashboard/src/hooks/use-direct-upload.ts
+++ b/packages/dashboard-core/src/hooks/use-direct-upload.ts
@@ -1,6 +1,6 @@
import { useMutation } from '@tanstack/react-query'
import SparkMD5 from 'spark-md5'
-import { adminClient } from '@/client'
+import { adminClient } from '../client'
function computeMD5Checksum(file: File): Promise<string> {
return new Promise((resolve, reject) => {
diff --git a/packages/dashboard/src/hooks/use-export.ts b/packages/dashboard-core/src/hooks/use-export.ts
similarity index 97%
rename from packages/dashboard/src/hooks/use-export.ts
rename to packages/dashboard-core/src/hooks/use-export.ts
index b76b86ac21..3138ff9e02 100644
--- a/packages/dashboard/src/hooks/use-export.ts
+++ b/packages/dashboard-core/src/hooks/use-export.ts
@@ -1,8 +1,8 @@
import type { Export, ExportCreateParams } from '@spree/admin-sdk'
import { useMutation } from '@tanstack/react-query'
import { toast } from 'sonner'
-import { adminClient } from '@/client'
-import { useAuth } from '@/hooks/use-auth'
+import { adminClient } from '../client'
+import { useAuth } from './use-auth'
const POLL_INTERVAL_MS = 2000
const POLL_TIMEOUT_MS = 5 * 60 * 1000
diff --git a/packages/dashboard/src/hooks/use-global-search.ts b/packages/dashboard-core/src/hooks/use-global-search.ts
similarity index 98%
rename from packages/dashboard/src/hooks/use-global-search.ts
rename to packages/dashboard-core/src/hooks/use-global-search.ts
index 3f13496134..a479c9ade0 100644
--- a/packages/dashboard/src/hooks/use-global-search.ts
+++ b/packages/dashboard-core/src/hooks/use-global-search.ts
@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query'
import { useEffect, useState } from 'react'
-import { adminClient } from '@/client'
+import { adminClient } from '../client'
const RESULT_LIMIT = 5
const MIN_QUERY_LENGTH = 2
diff --git a/packages/dashboard/src/hooks/use-resource-mutation.ts b/packages/dashboard-core/src/hooks/use-resource-mutation.ts
similarity index 100%
rename from packages/dashboard/src/hooks/use-resource-mutation.ts
rename to packages/dashboard-core/src/hooks/use-resource-mutation.ts
diff --git a/packages/dashboard/src/hooks/use-scrolled.ts b/packages/dashboard-core/src/hooks/use-scrolled.ts
similarity index 100%
rename from packages/dashboard/src/hooks/use-scrolled.ts
rename to packages/dashboard-core/src/hooks/use-scrolled.ts
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index ba409d7e30..f603b25679 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -1,6 +1,59 @@
// @spree/dashboard-core — Spree Dashboard framework.
//
-// Phase 0 placeholder. The registries, providers, generic hooks, and
-// defineDashboardPlugin facade land in Phase 2 (see
-// docs/plans/6.0-admin-spa.md "Package Split").
-export {}
+// The extension API for plugin authors. Consumers import flat from this barrel:
+//
+// import { useAuth, defineTable, registerSlot, nav } from '@spree/dashboard-core'
+//
+// Or use the focused entry points:
+//
+// import { defineDashboardPlugin } from '@spree/dashboard-core/plugin'
+// import { AuthProvider } from '@spree/dashboard-core/providers/auth-provider'
+// import { useResourceMutation } from '@spree/dashboard-core/hooks/use-resource-mutation'
+
+// ---------------------------------------------------------------------------
+// Admin SDK client (Vite-aware singleton; reads VITE_SPREE_API_URL at build)
+// ---------------------------------------------------------------------------
+export { adminClient } from './client'
+// ---------------------------------------------------------------------------
+// Infra hooks
+// ---------------------------------------------------------------------------
+export * from './hooks/use-auth'
+export * from './hooks/use-command-palette'
+export * from './hooks/use-copy-to-clipboard'
+export * from './hooks/use-countries'
+export * from './hooks/use-custom-fields'
+export * from './hooks/use-direct-upload'
+export * from './hooks/use-export'
+export * from './hooks/use-global-search'
+export * from './hooks/use-resource-mutation'
+export * from './hooks/use-scrolled'
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+export * from './lib/filters-to-ransack'
+export * from './lib/form-errors'
+export * from './lib/form-mappers'
+export * from './lib/formatters'
+// i18n side-effect import bootstraps i18next + React adapter on first import.
+// Consumers that need the singleton (e.g. plugin authors calling
+// `i18n.addResourceBundle`) get it via the named re-export.
+export * from './lib/i18n'
+// ---------------------------------------------------------------------------
+// Registries — the four pluggable extension points
+// ---------------------------------------------------------------------------
+export * from './lib/nav-registry'
+export * from './lib/permissions'
+export * from './lib/query-client'
+export * from './lib/settings-nav-registry'
+export * from './lib/slot-registry'
+export * from './lib/table-registry'
+// ---------------------------------------------------------------------------
+// Plugin facade — re-exported for convenience; same API as `/plugin` subpath
+// ---------------------------------------------------------------------------
+export * from './plugin'
+// ---------------------------------------------------------------------------
+// Providers — must be mounted by the consuming app shell
+// ---------------------------------------------------------------------------
+export * from './providers/auth-provider'
+export * from './providers/permission-provider'
+export * from './providers/store-provider'
diff --git a/packages/dashboard/src/lib/filters-to-ransack.ts b/packages/dashboard-core/src/lib/filters-to-ransack.ts
similarity index 98%
rename from packages/dashboard/src/lib/filters-to-ransack.ts
rename to packages/dashboard-core/src/lib/filters-to-ransack.ts
index a4252bb854..eed1d23a0a 100644
--- a/packages/dashboard/src/lib/filters-to-ransack.ts
+++ b/packages/dashboard-core/src/lib/filters-to-ransack.ts
@@ -1,4 +1,4 @@
-import { type ColumnDef, type FilterRule, parseFilterIds } from '@/lib/table-registry'
+import { type ColumnDef, type FilterRule, parseFilterIds } from './table-registry'
/**
* Convert toolbar `FilterRule[]` state into a flat Ransack predicate hash:
diff --git a/packages/dashboard/src/lib/form-errors.ts b/packages/dashboard-core/src/lib/form-errors.ts
similarity index 100%
rename from packages/dashboard/src/lib/form-errors.ts
rename to packages/dashboard-core/src/lib/form-errors.ts
diff --git a/packages/dashboard/src/lib/form-mappers.ts b/packages/dashboard-core/src/lib/form-mappers.ts
similarity index 100%
rename from packages/dashboard/src/lib/form-mappers.ts
rename to packages/dashboard-core/src/lib/form-mappers.ts
diff --git a/packages/dashboard/src/lib/formatters.ts b/packages/dashboard-core/src/lib/formatters.ts
similarity index 100%
rename from packages/dashboard/src/lib/formatters.ts
rename to packages/dashboard-core/src/lib/formatters.ts
diff --git a/packages/dashboard/src/lib/i18n.ts b/packages/dashboard-core/src/lib/i18n.ts
similarity index 54%
rename from packages/dashboard/src/lib/i18n.ts
rename to packages/dashboard-core/src/lib/i18n.ts
index 7555ab6709..adab8050cd 100644
--- a/packages/dashboard/src/lib/i18n.ts
+++ b/packages/dashboard-core/src/lib/i18n.ts
@@ -1,7 +1,18 @@
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
-import en from '@/locales/en.json'
+// Relative path, not `@/...`: dashboard-core ships source; the consuming
+// project's `@/*` alias is theirs alone (see Phase 1's rationale).
+import en from '../locales/en.json'
+// Bootstrap i18next with the framework's base translation namespace. Side-effect
+// import — `import '@spree/dashboard-core/lib/i18n'` from the consuming app's
+// entry point runs this once before any component calls `useTranslation()`.
+//
+// The app (and any plugin) extends the base by calling
+// `i18n.addResourceBundle('en', 'translation', extraKeys, true, true)`
+// after this side-effect import has settled. The `deep` + `overwrite` flags
+// merge the extension into the base namespace without dropping framework keys.
+//
// English-only at launch. Adding another locale = add a `<code>.json` next to
// `en.json` and load it here. Lazy chunks come later if/when the locale list
// grows enough to matter.
diff --git a/packages/dashboard/src/lib/nav-registry.ts b/packages/dashboard-core/src/lib/nav-registry.ts
similarity index 98%
rename from packages/dashboard/src/lib/nav-registry.ts
rename to packages/dashboard-core/src/lib/nav-registry.ts
index 371a19ec18..57800913cc 100644
--- a/packages/dashboard/src/lib/nav-registry.ts
+++ b/packages/dashboard-core/src/lib/nav-registry.ts
@@ -1,6 +1,6 @@
import type { LucideIcon } from 'lucide-react'
import { useSyncExternalStore } from 'react'
-import type { SubjectName } from '@/lib/permissions'
+import type { SubjectName } from './permissions'
// ============================================================================
// Types
diff --git a/packages/dashboard/src/lib/permissions.ts b/packages/dashboard-core/src/lib/permissions.ts
similarity index 100%
rename from packages/dashboard/src/lib/permissions.ts
rename to packages/dashboard-core/src/lib/permissions.ts
diff --git a/packages/dashboard/src/lib/query-client.ts b/packages/dashboard-core/src/lib/query-client.ts
similarity index 100%
rename from packages/dashboard/src/lib/query-client.ts
rename to packages/dashboard-core/src/lib/query-client.ts
diff --git a/packages/dashboard/src/lib/settings-nav-registry.ts b/packages/dashboard-core/src/lib/settings-nav-registry.ts
similarity index 98%
rename from packages/dashboard/src/lib/settings-nav-registry.ts
rename to packages/dashboard-core/src/lib/settings-nav-registry.ts
index f4b1f7e98f..e798bef6aa 100644
--- a/packages/dashboard/src/lib/settings-nav-registry.ts
+++ b/packages/dashboard-core/src/lib/settings-nav-registry.ts
@@ -1,6 +1,6 @@
import type { LucideIcon } from 'lucide-react'
import { useSyncExternalStore } from 'react'
-import type { SubjectName } from '@/lib/permissions'
+import type { SubjectName } from './permissions'
/**
* Registry for the settings sub-shell sidebar. Mirrors `nav-registry.ts` but
diff --git a/packages/dashboard/src/lib/slot-registry.ts b/packages/dashboard-core/src/lib/slot-registry.ts
similarity index 100%
rename from packages/dashboard/src/lib/slot-registry.ts
rename to packages/dashboard-core/src/lib/slot-registry.ts
diff --git a/packages/dashboard/src/lib/table-registry.ts b/packages/dashboard-core/src/lib/table-registry.ts
similarity index 68%
rename from packages/dashboard/src/lib/table-registry.ts
rename to packages/dashboard-core/src/lib/table-registry.ts
index a6206de8c1..eb386492fd 100644
--- a/packages/dashboard/src/lib/table-registry.ts
+++ b/packages/dashboard-core/src/lib/table-registry.ts
@@ -123,9 +123,54 @@ export interface TableDef<T = any> {
const registry = new Map<string, TableDef>()
+/**
+ * Queued mutations against tables that haven't been `defineTable`-d yet.
+ *
+ * Built-in tables register via side-effect imports in route files
+ * (`import '@/tables/products'`) — they only execute when the route loads.
+ * Plugin authors who call `tables.products.addColumn(...)` from their
+ * boot-time entry module would race with that lazy registration. To avoid
+ * forcing every plugin to know which routes have loaded, mutations on an
+ * unregistered table are queued and replayed by `defineTable` when the
+ * table appears.
+ *
+ * Mutations on tables that NEVER register stay in the queue and never fire,
+ * which is the right semantics: a plugin extending an optional feature
+ * shouldn't crash when that feature isn't installed.
+ */
+const pending = new Map<string, Array<(t: TableDef) => void>>()
+
+function enqueue(tableKey: string, fn: (t: TableDef) => void) {
+ const list = pending.get(tableKey) ?? []
+ list.push(fn)
+ pending.set(tableKey, list)
+}
+
+function flushPending(tableKey: string, table: TableDef) {
+ const queue = pending.get(tableKey)
+ if (!queue) return
+ pending.delete(tableKey)
+ // Iterate the full queue even if individual mutations throw. A plugin that
+ // registers a duplicate column shouldn't silently drop every later mutation
+ // for the same table — collect errors and surface them all.
+ const errors: unknown[] = []
+ for (const fn of queue) {
+ try {
+ fn(table)
+ } catch (err) {
+ errors.push(err)
+ }
+ }
+ if (errors.length === 1) throw errors[0]
+ if (errors.length > 1) {
+ throw new AggregateError(errors, `${errors.length} mutation(s) failed for table "${tableKey}"`)
+ }
+}
+
export function defineTable<T = any>(key: string, def: Omit<TableDef<T>, 'key'>): TableDef<T> {
const tableDef = { ...def, key } as TableDef<T>
registry.set(key, tableDef)
+ flushPending(key, tableDef as TableDef)
return tableDef
}
@@ -152,34 +197,51 @@ interface TableMutator {
updateColumn<T = any>(key: string, updates: Partial<ColumnDef<T>>): void
}
+function applyAddColumn(table: TableDef, column: ColumnDef) {
+ if (table.columns.some((c) => c.key === column.key)) {
+ throw new Error(
+ `Column "${column.key}" already exists in table "${table.key}". Use updateColumn() instead.`,
+ )
+ }
+ table.columns.push(column)
+}
+
+function applyRemoveColumn(table: TableDef, key: string) {
+ table.columns = table.columns.filter((c) => c.key !== key)
+}
+
+function applyUpdateColumn(table: TableDef, key: string, updates: Partial<ColumnDef>) {
+ const col = table.columns.find((c) => c.key === key)
+ if (!col) throw new Error(`Column "${key}" not found in table "${table.key}".`)
+ Object.assign(col, updates)
+}
+
function createMutator(tableKey: string): TableMutator {
return {
addColumn(column) {
const table = registry.get(tableKey)
- if (!table) throw new Error(`Table "${tableKey}" is not registered.`)
- // Prevent duplicates
- if (table.columns.some((c) => c.key === column.key)) {
- throw new Error(
- `Column "${column.key}" already exists in table "${tableKey}". Use updateColumn() instead.`,
- )
- }
- table.columns.push(column)
+ if (table) applyAddColumn(table, column as ColumnDef)
+ else enqueue(tableKey, (t) => applyAddColumn(t, column as ColumnDef))
},
removeColumn(key) {
const table = registry.get(tableKey)
- if (!table) throw new Error(`Table "${tableKey}" is not registered.`)
- table.columns = table.columns.filter((c) => c.key !== key)
+ if (table) applyRemoveColumn(table, key)
+ else enqueue(tableKey, (t) => applyRemoveColumn(t, key))
},
updateColumn(key, updates) {
const table = registry.get(tableKey)
- if (!table) throw new Error(`Table "${tableKey}" is not registered.`)
- const col = table.columns.find((c) => c.key === key)
- if (!col) throw new Error(`Column "${key}" not found in table "${tableKey}".`)
- Object.assign(col, updates)
+ if (table) applyUpdateColumn(table, key, updates as Partial<ColumnDef>)
+ else enqueue(tableKey, (t) => applyUpdateColumn(t, key, updates as Partial<ColumnDef>))
},
}
}
+/** Test-only: clear the registry and any pending mutations. */
+export function __resetTableRegistry(): void {
+ registry.clear()
+ pending.clear()
+}
+
// ============================================================================
// Helpers
// ============================================================================
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
new file mode 100644
index 0000000000..cb14589e8c
--- /dev/null
+++ b/packages/dashboard-core/src/locales/en.json
@@ -0,0 +1,380 @@
+{
+ "admin": {
+ "actions": {
+ "add": "Add",
+ "apply": "Apply",
+ "cancel": "Cancel",
+ "clear": "Clear",
+ "revoke": "Revoke",
+ "close": "Close",
+ "confirm": "Confirm",
+ "create": "Create",
+ "creating": "Creating…",
+ "delete": "Delete",
+ "deleting": "Deleting…",
+ "discard": "Discard",
+ "discard_changes": "Discard changes",
+ "edit": "Edit",
+ "generate": "Generate",
+ "remove": "Remove",
+ "save": "Save",
+ "saving": "Saving…",
+ "search": "Search",
+ "sign_in": "Sign in",
+ "signing_in": "Signing in…",
+ "view_all": "View all",
+ "view_details": "View details",
+ "copy": "Copy",
+ "copied": "Copied!",
+ "export": "Export",
+ "exporting": "Exporting…",
+ "import": "Import",
+ "invite": "Invite",
+ "send": "Send",
+ "send_invitation": "Send invitation",
+ "sending": "Sending…",
+ "reset": "Reset",
+ "show": "Show",
+ "hide": "Hide",
+ "back": "Back",
+ "actions_menu": "Actions",
+ "more_actions": "More actions"
+ },
+ "row_actions": {
+ "menu_label": "Open actions",
+ "edit": "Edit",
+ "clone": "Duplicate",
+ "delete": "Delete"
+ },
+ "a11y": {
+ "breadcrumb": "Breadcrumb",
+ "toggle_sidebar": "Toggle sidebar",
+ "settings_navigation": "Settings navigation",
+ "user_menu": "User menu",
+ "drag_to_reorder": "Drag to reorder",
+ "reorder": "Reorder",
+ "select_all_rows": "Select all rows on this page",
+ "select_row": "Select row",
+ "clear_date": "Clear date",
+ "clear_selection": "Clear selection",
+ "expand_all": "Expand all",
+ "collapse_all": "Collapse all",
+ "refetch": "Refetch",
+ "hide_value": "Hide value",
+ "show_value": "Show value",
+ "pick_color": "Pick a color",
+ "change_color": "Change color ({{value}})",
+ "stock_at_locations": "Stock at locations",
+ "edit_media": "Edit media",
+ "delete_image": "Delete image",
+ "remove_image": "Remove image",
+ "view_image": "View image",
+ "upload_image": "Upload image",
+ "remove_value": "Remove value"
+ },
+ "common": {
+ "loading": "Loading…",
+ "searching": "Searching…",
+ "no_results": "No results",
+ "optional": "Optional",
+ "required": "Required",
+ "yes": "Yes",
+ "no": "No",
+ "or": "or",
+ "and": "and",
+ "all": "All",
+ "none": "None",
+ "page_of": "Page {{page}} of {{total}}",
+ "prev": "Prev",
+ "next": "Next",
+ "select_placeholder": "Select…",
+ "search_placeholder": "Search…",
+ "pick_date": "Pick a date",
+ "comma_separated_hint": "Separate values with commas.",
+ "are_you_sure": "Are you sure?",
+ "remove_question": "Remove?",
+ "deleted": "Deleted",
+ "unsaved_changes": "You have unsaved changes.",
+ "prices": "Prices"
+ },
+ "color_picker": {
+ "no_color": "No color"
+ },
+ "messages": {
+ "saved": "Saved",
+ "created": "Created",
+ "updated": "Updated",
+ "removed": "Removed",
+ "settings_updated": "Settings updated",
+ "store_settings_updated": "Store settings updated",
+ "invitation_sent": "Invitation sent",
+ "invitation_resent": "Invitation resent",
+ "invitation_accepted": "Welcome to Spree",
+ "key_created": "Key created",
+ "key_revoked": "Key revoked",
+ "key_deleted": "Key deleted",
+ "product_saved": "Product saved",
+ "product_created": "Product created",
+ "product_deleted": "Product deleted",
+ "order_saved": "Order saved",
+ "customer_saved": "Customer saved",
+ "customer_deleted": "Customer deleted",
+ "payment_method_saved": "Payment method saved",
+ "tax_category_saved": "Tax category saved",
+ "stock_location_saved": "Stock location saved",
+ "promotion_created": "Promotion created",
+ "promotion_saved": "Promotion saved",
+ "promotion_deleted": "Promotion deleted",
+ "gift_card_created": "Gift card created",
+ "address_saved": "Address saved",
+ "address_removed": "Address removed",
+ "store_credit_saved": "Store credit saved",
+ "store_credit_removed": "Store credit removed",
+ "copied_to_clipboard": "Copied to clipboard"
+ },
+ "errors": {
+ "required": "This field is required",
+ "generic": "Something went wrong",
+ "unexpected": "An unexpected error occurred",
+ "failed_to_load": "Failed to load",
+ "failed_to_save": "Failed to save",
+ "failed_to_update": "Failed to update",
+ "failed_to_create": "Failed to create",
+ "failed_to_delete": "Failed to delete",
+ "failed_to_load_customer": "Failed to load customer",
+ "failed_to_load_order": "Failed to load order",
+ "failed_to_load_product": "Failed to load product",
+ "failed_to_send_invitation": "Failed to send invitation",
+ "failed_to_revoke_key": "Failed to revoke key",
+ "failed_to_update_store": "Failed to update store settings",
+ "failed_to_update_staff": "Failed to update staff",
+ "network": "Network error — please retry",
+ "unauthorized": "You don't have permission to do that",
+ "not_found": "Not found"
+ },
+ "auth": {
+ "login": {
+ "title": "Welcome back",
+ "subtitle": "Sign in to your admin account"
+ },
+ "logout": "Sign out"
+ },
+ "fields": {
+ "name": {
+ "label": "Name"
+ },
+ "label": {
+ "label": "Label"
+ },
+ "description": {
+ "label": "Description"
+ },
+ "code": {
+ "label": "Code"
+ },
+ "email": {
+ "label": "Email"
+ },
+ "password": {
+ "label": "Password"
+ },
+ "first_name": {
+ "label": "First name"
+ },
+ "last_name": {
+ "label": "Last name"
+ },
+ "phone": {
+ "label": "Phone"
+ },
+ "company": {
+ "label": "Company"
+ },
+ "address1": {
+ "label": "Address line 1"
+ },
+ "address2": {
+ "label": "Address line 2"
+ },
+ "city": {
+ "label": "City"
+ },
+ "zipcode": {
+ "label": "Postal code"
+ },
+ "country_iso": {
+ "label": "Country"
+ },
+ "state_abbr": {
+ "label": "State / Province"
+ },
+ "state_name": {
+ "label": "State / Province"
+ },
+ "starts_at": {
+ "label": "Starts"
+ },
+ "ends_at": {
+ "label": "Ends"
+ },
+ "expires_at": {
+ "label": "Expires"
+ },
+ "active": {
+ "label": "Active"
+ },
+ "kind": {
+ "label": "Kind"
+ },
+ "amount": {
+ "label": "Amount"
+ },
+ "currency": {
+ "label": "Currency"
+ },
+ "quantity": {
+ "label": "Quantity"
+ },
+ "slug": {
+ "label": "Slug"
+ },
+ "meta_title": {
+ "label": "Meta title"
+ },
+ "meta_description": {
+ "label": "Meta description"
+ },
+ "status": {
+ "label": "Status"
+ },
+ "created_at": {
+ "label": "Created at"
+ },
+ "updated_at": {
+ "label": "Updated at"
+ },
+ "completed_at": {
+ "label": "Completed at"
+ },
+ "total": {
+ "label": "Total"
+ },
+ "subtotal": {
+ "label": "Subtotal"
+ },
+ "tax": {
+ "label": "Tax"
+ },
+ "shipping": {
+ "label": "Shipping"
+ },
+ "discount": {
+ "label": "Discount"
+ },
+ "login": {
+ "email": {
+ "placeholder": "[email protected]"
+ }
+ },
+ "address": {
+ "label": {
+ "label": "Label",
+ "placeholder": "e.g. Home, Office"
+ },
+ "address1": {
+ "label": "Address"
+ },
+ "address2": {
+ "label": "Apartment, suite, etc."
+ },
+ "postal_code": {
+ "label": "Postal code"
+ },
+ "is_default_billing": {
+ "label": "Default billing address"
+ },
+ "is_default_shipping": {
+ "label": "Default shipping address"
+ }
+ },
+ "media": {
+ "alt": {
+ "label": "Alt text",
+ "placeholder": "Describe the image for accessibility and SEO"
+ }
+ }
+ },
+ "components": {
+ "currency_select": {
+ "placeholder": "Select a currency"
+ },
+ "locale_select": {
+ "placeholder": "Select a locale",
+ "multi_placeholder": "Add locales…",
+ "empty": "No locales found"
+ },
+ "country_combobox": {
+ "search_placeholder": "Search countries…",
+ "empty": "No countries found"
+ },
+ "state_combobox": {
+ "search_placeholder": "Search states…",
+ "empty": "No states found"
+ },
+ "command_palette": {
+ "placeholder": "Search products, orders, customers…",
+ "title": "Search and commands",
+ "description": "Search across products, orders, and customers, or run a command.",
+ "no_results": "No results for \"{{query}}\".",
+ "empty_hint": "Type to search, or pick a command below.",
+ "goto": "Go to",
+ "goto_label": "Go to {{label}}"
+ },
+ "bulk_action_bar": {
+ "selected": "{{count}} selected",
+ "default_success": "Updated {n} records",
+ "default_error": "Bulk operation failed"
+ },
+ "preferences_form": {
+ "comma_separated_hint": "Separate values with commas.",
+ "tiers": {
+ "label": "Tiers",
+ "header_threshold": "Order total ≥",
+ "header_value": "Discount",
+ "empty": "No tiers yet. The base rate applies until you add a tier.",
+ "add_tier": "Add tier",
+ "remove_tier": "Remove tier"
+ }
+ },
+ "confirm_dialog": {
+ "title": "Are you sure?"
+ },
+ "table_toolbar": {
+ "search_placeholder": "Search…",
+ "filter_select_placeholder": "Select…",
+ "filter_date_placeholder": "Pick a date",
+ "filter_text_placeholder": "Filter…",
+ "filters_button": "Filters"
+ },
+ "media": {
+ "remove_tooltip": "Remove image"
+ },
+ "custom_fields": {
+ "json_placeholder": "{ \"example\": \"value\" }"
+ }
+ },
+ "validation": {
+ "required": "{{field}} is required",
+ "positive_number": "{{field}} must be greater than 0",
+ "min_length": "{{field}} must be at least {{count}} characters",
+ "passwords_dont_match": "Passwords do not match",
+ "invalid_email_or_password": "Invalid email or password",
+ "invalid_email": "Enter a valid email",
+ "invalid_hex_color": "Invalid hex color",
+ "invalid_password": "Invalid password",
+ "password_required": "Password is required",
+ "first_name_required": "First name is required",
+ "last_name_required": "Last name is required"
+ }
+ }
+}
diff --git a/packages/dashboard-core/src/plugin.ts b/packages/dashboard-core/src/plugin.ts
index b4910e9dcb..571451db34 100644
--- a/packages/dashboard-core/src/plugin.ts
+++ b/packages/dashboard-core/src/plugin.ts
@@ -1,6 +1,126 @@
// `@spree/dashboard-core/plugin` — the single import plugin authors use.
//
-// Phase 0 placeholder; defineDashboardPlugin lands in Phase 2 (see
-// docs/plans/6.0-admin-spa.md "Package Split"). Until then plugin authors
-// register via the underlying registries directly (also kept stable).
-export {}
+// A plugin's entry module calls `defineDashboardPlugin({...})` at import time;
+// the dashboard app imports plugin entries in its bootstrap before the first
+// render. Each registry uses `useSyncExternalStore`, so late registration
+// (after the app has mounted) still re-renders consumers.
+//
+// Example:
+//
+// import { defineDashboardPlugin } from '@spree/dashboard-core/plugin'
+// import { Card } from '@spree/dashboard-ui'
+//
+// function WishlistCount({ product }: { product: { wishlist_count: number } }) {
+// return <Card>Wishlists: {product.wishlist_count}</Card>
+// }
+//
+// defineDashboardPlugin({
+// nav: [
+// { key: 'wishlists', label: 'Wishlists', path: '/wishlists', position: 50 },
+// ],
+// slots: {
+// 'product.form_sidebar': [
+// { id: 'wishlist-count', component: WishlistCount, position: 50 },
+// ],
+// },
+// tables: {
+// products: { add: [{ key: 'wishlist_count', label: 'Wishlists', sortable: true }] },
+// },
+// settingsNav: [
+// { key: 'wishlist-settings', label: 'Wishlists', path: '/wishlists', group: 'integrations' },
+// ],
+// })
+
+import type { NavEntry } from './lib/nav-registry'
+import { nav } from './lib/nav-registry'
+import type { SettingsNavEntry, SettingsNavGroup } from './lib/settings-nav-registry'
+import { settingsNav } from './lib/settings-nav-registry'
+import type { SlotEntry } from './lib/slot-registry'
+import { registerSlot } from './lib/slot-registry'
+import type { ColumnDef } from './lib/table-registry'
+import { tables } from './lib/table-registry'
+
+export interface TableMutations {
+ /** Columns to append to the table. Keys must not already exist. */
+ add?: ColumnDef[]
+ /** Column keys to remove. No-op when the column is already gone. */
+ remove?: string[]
+ /** Column patches keyed by column key — `{ totals: { label: 'Net total' } }`. */
+ // biome-ignore lint/suspicious/noExplicitAny: ColumnDef is generic per-row-type and the plugin layer can't know which.
+ update?: Record<string, Partial<ColumnDef<any>>>
+}
+
+export interface DashboardPluginConfig {
+ /** Sidebar entries. Each must have a unique `key`. */
+ nav?: NavEntry[]
+ /** Settings sub-shell groups (defined before any entry that uses the group key). */
+ settingsNavGroups?: SettingsNavGroup[]
+ /** Settings sub-shell entries. */
+ settingsNav?: SettingsNavEntry[]
+ /** Slot extensions keyed by slot name. Each entry must have a unique `id`. */
+ slots?: Record<string, SlotEntry[]>
+ /** Table mutations keyed by table key (see `defineTable`). */
+ tables?: Record<string, TableMutations>
+}
+
+/**
+ * Register all the extensions in `config` against the dashboard's registries.
+ * Safe to call multiple times — each registry enforces uniqueness on its own
+ * keys, so a duplicate `key`/`id` throws with a useful message.
+ *
+ * Plugins typically call this once from their entry module (e.g.
+ * `src/index.ts`). The dashboard app imports plugin entries during bootstrap.
+ *
+ * @returns nothing — registries are module singletons. To unregister, call the
+ * relevant `nav.remove` / `removeSlot` / `tables.<key>.removeColumn` /
+ * `settingsNav.remove` directly.
+ */
+export function defineDashboardPlugin(config: DashboardPluginConfig): void {
+ // Collect errors across every registry call and rethrow once at the end.
+ // A duplicate nav key shouldn't stop the rest of the config (slots, tables,
+ // other nav entries) from registering — plugin authors should see every
+ // problem in their config at once, not whack-a-mole through reload cycles.
+ // Matches the deferred-flush semantics in `table-registry.ts`.
+ const errors: unknown[] = []
+ const safely = <T extends unknown[]>(fn: (...args: T) => void, ...args: T) => {
+ try {
+ fn(...args)
+ } catch (err) {
+ errors.push(err)
+ }
+ }
+
+ if (config.nav) {
+ for (const entry of config.nav) safely(nav.add, entry)
+ }
+
+ if (config.settingsNavGroups) {
+ for (const group of config.settingsNavGroups) safely(settingsNav.addGroup, group)
+ }
+
+ if (config.settingsNav) {
+ for (const entry of config.settingsNav) safely(settingsNav.add, entry)
+ }
+
+ if (config.slots) {
+ for (const [name, list] of Object.entries(config.slots)) {
+ for (const entry of list) safely(registerSlot, name, entry)
+ }
+ }
+
+ if (config.tables) {
+ for (const [tableKey, mutations] of Object.entries(config.tables)) {
+ const mutator = tables[tableKey]
+ for (const column of mutations.add ?? []) safely(mutator.addColumn, column)
+ for (const key of mutations.remove ?? []) safely(mutator.removeColumn, key)
+ for (const [key, patch] of Object.entries(mutations.update ?? {})) {
+ safely(mutator.updateColumn, key, patch)
+ }
+ }
+ }
+
+ 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/providers/auth-provider.tsx b/packages/dashboard-core/src/providers/auth-provider.tsx
similarity index 99%
rename from packages/dashboard/src/providers/auth-provider.tsx
rename to packages/dashboard-core/src/providers/auth-provider.tsx
index f9da2a3ba2..d937583abf 100644
--- a/packages/dashboard/src/providers/auth-provider.tsx
+++ b/packages/dashboard-core/src/providers/auth-provider.tsx
@@ -1,6 +1,6 @@
import type { AdminUser, AuthTokens, InvitationAcceptParams } from '@spree/admin-sdk'
import { createContext, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'
-import { adminClient } from '@/client'
+import { adminClient } from '../client'
interface AuthContextValue {
user: AdminUser | null
diff --git a/packages/dashboard/src/providers/permission-provider.tsx b/packages/dashboard-core/src/providers/permission-provider.tsx
similarity index 95%
rename from packages/dashboard/src/providers/permission-provider.tsx
rename to packages/dashboard-core/src/providers/permission-provider.tsx
index a69069e23d..ab314d60a0 100644
--- a/packages/dashboard/src/providers/permission-provider.tsx
+++ b/packages/dashboard-core/src/providers/permission-provider.tsx
@@ -1,8 +1,8 @@
import type { PermissionRule } from '@spree/admin-sdk'
import { createContext, type ReactNode, useContext, useEffect, useMemo, useState } from 'react'
-import { adminClient } from '@/client'
-import { useAuth } from '@/hooks/use-auth'
-import type { ActionName, SubjectName } from '@/lib/permissions'
+import { adminClient } from '../client'
+import { useAuth } from '../hooks/use-auth'
+import type { ActionName, SubjectName } from '../lib/permissions'
/**
* Matcher that mirrors CanCanCan semantics:
diff --git a/packages/dashboard/src/providers/store-provider.tsx b/packages/dashboard-core/src/providers/store-provider.tsx
similarity index 98%
rename from packages/dashboard/src/providers/store-provider.tsx
rename to packages/dashboard-core/src/providers/store-provider.tsx
index a042c3ab47..eb1a33a011 100644
--- a/packages/dashboard/src/providers/store-provider.tsx
+++ b/packages/dashboard-core/src/providers/store-provider.tsx
@@ -1,6 +1,6 @@
import type { Store } from '@spree/admin-sdk'
import { createContext, type ReactNode, useCallback, useContext, useEffect, useState } from 'react'
-import { adminClient } from '@/client'
+import { adminClient } from '../client'
interface StoreContextValue {
store: Store | null
diff --git a/packages/dashboard-core/tsconfig.json b/packages/dashboard-core/tsconfig.json
index 84dfa24a44..0d25d68c61 100644
--- a/packages/dashboard-core/tsconfig.json
+++ b/packages/dashboard-core/tsconfig.json
@@ -5,6 +5,7 @@
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
+ "types": ["vite/client"],
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
@@ -17,10 +18,7 @@
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
- "noUncheckedSideEffectImports": true,
- "paths": {
- "@/*": ["./src/*"]
- }
+ "noUncheckedSideEffectImports": true
},
"include": ["src"]
}
diff --git a/packages/dashboard-ui/package.json b/packages/dashboard-ui/package.json
index efb75dd75c..1e5b013559 100644
--- a/packages/dashboard-ui/package.json
+++ b/packages/dashboard-ui/package.json
@@ -58,6 +58,7 @@
"react-day-picker": "^9.14.0",
"recharts": "^3.8.1",
"shadcn": "^4.7.0",
+ "sonner": "^2.0.7",
"tailwind-merge": "^3.5.0",
"tw-animate-css": "^1.4.0"
},
diff --git a/packages/dashboard-ui/src/index.ts b/packages/dashboard-ui/src/index.ts
index f70ed4b877..de035cd8fb 100644
--- a/packages/dashboard-ui/src/index.ts
+++ b/packages/dashboard-ui/src/index.ts
@@ -40,6 +40,7 @@ export * from './spree/row-click-bridge'
export * from './spree/secret-input'
export * from './spree/storefront-visible-switch'
export * from './spree/tag-list'
+export * from './spree/theme-provider'
// ---------------------------------------------------------------------------
// UI primitives (shadcn) — see ./ui/*
// ---------------------------------------------------------------------------
@@ -74,6 +75,7 @@ export * from './ui/sheet'
export * from './ui/sidebar'
export * from './ui/skeleton'
export * from './ui/slot'
+export * from './ui/sonner'
export * from './ui/switch'
export * from './ui/textarea'
export * from './ui/tooltip'
diff --git a/packages/dashboard/src/providers/theme-provider.tsx b/packages/dashboard-ui/src/spree/theme-provider.tsx
similarity index 100%
rename from packages/dashboard/src/providers/theme-provider.tsx
rename to packages/dashboard-ui/src/spree/theme-provider.tsx
diff --git a/packages/dashboard/src/components/ui/sonner.tsx b/packages/dashboard-ui/src/ui/sonner.tsx
similarity index 96%
rename from packages/dashboard/src/components/ui/sonner.tsx
rename to packages/dashboard-ui/src/ui/sonner.tsx
index 84222ed3bd..dc2d846eef 100644
--- a/packages/dashboard/src/components/ui/sonner.tsx
+++ b/packages/dashboard-ui/src/ui/sonner.tsx
@@ -7,7 +7,7 @@ import {
} from 'lucide-react'
import type { CSSProperties } from 'react'
import { Toaster as Sonner, type ToasterProps } from 'sonner'
-import { useTheme } from '@/providers/theme-provider'
+import { useTheme } from '../spree/theme-provider'
const Toaster = ({ ...props }: ToasterProps) => {
// The shadcn-default Sonner template assumes `next-themes`. This app has its
diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json
index 8b72632e6b..c1a97cf038 100644
--- a/packages/dashboard/package.json
+++ b/packages/dashboard/package.json
@@ -24,6 +24,7 @@
"@fontsource-variable/geist-mono": "^5.2.7",
"@hookform/resolvers": "^5.2.2",
"@spree/admin-sdk": "workspace:^",
+ "@spree/dashboard-core": "workspace:^",
"@spree/dashboard-ui": "workspace:^",
"@tanstack/react-hotkeys": "^0.10.0",
"@tanstack/react-query": "^5.100.9",
diff --git a/packages/dashboard/src/components/spree/address-form-dialog.tsx b/packages/dashboard/src/components/spree/address-form-dialog.tsx
index 636859cbd8..4a6d9f866d 100644
--- a/packages/dashboard/src/components/spree/address-form-dialog.tsx
+++ b/packages/dashboard/src/components/spree/address-form-dialog.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Address } from '@spree/admin-sdk'
+import { mapSpreeErrorsToForm } from '@spree/dashboard-core'
import {
Button,
Checkbox,
@@ -22,7 +23,6 @@ import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
import { CountryCombobox } from '@/components/spree/country-combobox'
import { StateCombobox, useCountryStates } from '@/components/spree/country-state-fields'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
export interface AddressParams {
first_name: string
diff --git a/packages/dashboard/src/components/spree/app-sidebar.tsx b/packages/dashboard/src/components/spree/app-sidebar.tsx
index 501a9fa928..a69c756609 100644
--- a/packages/dashboard/src/components/spree/app-sidebar.tsx
+++ b/packages/dashboard/src/components/spree/app-sidebar.tsx
@@ -1,11 +1,15 @@
+import {
+ type NavEntry,
+ type Permissions,
+ useNavEntries,
+ usePermissions,
+} from '@spree/dashboard-core'
import { Sidebar, SidebarContent, SidebarHeader } from '@spree/dashboard-ui'
import { useParams } from '@tanstack/react-router'
import { PackageIcon } from 'lucide-react'
import type { ComponentProps } from 'react'
import { type NavItem, NavMain } from '@/components/spree/nav-main'
import { StoreSwitcher } from '@/components/spree/store-switcher'
-import { type NavEntry, useNavEntries } from '@/lib/nav-registry'
-import { type Permissions, usePermissions } from '@/providers/permission-provider'
import '@/nav/default'
diff --git a/packages/dashboard/src/components/spree/bulk-action-bar.tsx b/packages/dashboard/src/components/spree/bulk-action-bar.tsx
index f791f9f44e..9770479879 100644
--- a/packages/dashboard/src/components/spree/bulk-action-bar.tsx
+++ b/packages/dashboard/src/components/spree/bulk-action-bar.tsx
@@ -1,3 +1,4 @@
+import { usePermissions } from '@spree/dashboard-core'
import { Button, useConfirm } from '@spree/dashboard-ui'
import type { QueryKey } from '@tanstack/react-query'
import { useQueryClient } from '@tanstack/react-query'
@@ -5,7 +6,6 @@ import type { ReactNode } from 'react'
import { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import { usePermissions } from '@/providers/permission-provider'
/**
* Context handed to a bulk action's `run` and `form` callbacks. `ids` is the
diff --git a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
index b2f90986c5..93506991bc 100644
--- a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
+++ b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
@@ -1,4 +1,5 @@
import type { PriceList, Product } from '@spree/admin-sdk'
+import { useStore } from '@spree/dashboard-core'
import {
Button,
Dialog,
@@ -20,7 +21,6 @@ import {
BulkPriceEditor,
type BulkPriceEditorState,
} from '@/components/spree/bulk-price-editor/bulk-price-editor'
-import { useStore } from '@/providers/store-provider'
/**
* Discriminator for what the dialog edits.
diff --git a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
index c485cc8001..54775a2c7e 100644
--- a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
+++ b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
@@ -1,4 +1,5 @@
import type { PriceBulkUpsertRow } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import {
Button,
DataGrid,
@@ -12,7 +13,6 @@ import type { ColumnDef } from '@tanstack/react-table'
import { useCallback, useDeferredValue, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import { adminClient } from '@/client'
import { useBulkUpsertPrices } from '@/hooks/use-prices'
const PAGE_SIZE = 50
diff --git a/packages/dashboard/src/components/spree/can.tsx b/packages/dashboard/src/components/spree/can.tsx
index 903ecfc1e8..d04889aa2c 100644
--- a/packages/dashboard/src/components/spree/can.tsx
+++ b/packages/dashboard/src/components/spree/can.tsx
@@ -1,6 +1,6 @@
+import type { ActionName, SubjectName } from '@spree/dashboard-core'
+import { usePermissions } from '@spree/dashboard-core'
import type { ReactNode } from 'react'
-import type { ActionName, SubjectName } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
interface CanProps {
/** Action name (e.g. "update", "destroy", "manage") */
diff --git a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
index c428e45038..df12954c9d 100644
--- a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
+++ b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
@@ -1,3 +1,4 @@
+import { useAuth, useCommandPalette, useGlobalSearch, useTranslation } from '@spree/dashboard-core'
import {
Command,
CommandEmpty,
@@ -24,10 +25,6 @@ import {
UsersIcon,
} from 'lucide-react'
import { type ReactNode, useState } from 'react'
-import { useAuth } from '@/hooks/use-auth'
-import { useCommandPalette } from '@/hooks/use-command-palette'
-import { useGlobalSearch } from '@/hooks/use-global-search'
-import { useTranslation } from '@/lib/i18n'
export function CommandPalette() {
const { open, setOpen } = useCommandPalette()
diff --git a/packages/dashboard/src/components/spree/country-combobox.tsx b/packages/dashboard/src/components/spree/country-combobox.tsx
index 3ae187434c..de684768f5 100644
--- a/packages/dashboard/src/components/spree/country-combobox.tsx
+++ b/packages/dashboard/src/components/spree/country-combobox.tsx
@@ -1,3 +1,4 @@
+import { useCountries, useTranslation } from '@spree/dashboard-core'
import {
Combobox,
ComboboxChip,
@@ -14,8 +15,6 @@ import {
useComboboxAnchor,
} from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { useCountries } from '@/hooks/use-countries'
-import { useTranslation } from '@/lib/i18n'
export type CountryOption = { iso: string; iso3: string; name: string }
diff --git a/packages/dashboard/src/components/spree/country-state-fields.tsx b/packages/dashboard/src/components/spree/country-state-fields.tsx
index 8a805766d5..34c5194b9d 100644
--- a/packages/dashboard/src/components/spree/country-state-fields.tsx
+++ b/packages/dashboard/src/components/spree/country-state-fields.tsx
@@ -1,4 +1,5 @@
import type { State } from '@spree/admin-sdk'
+import { useCountries } from '@spree/dashboard-core'
import {
Combobox,
ComboboxContent,
@@ -9,7 +10,6 @@ import {
} from '@spree/dashboard-ui'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import { useCountries } from '@/hooks/use-countries'
type StateOption = { abbr: string; name: string }
diff --git a/packages/dashboard/src/components/spree/currency-select.tsx b/packages/dashboard/src/components/spree/currency-select.tsx
index 07b43ca72c..f0b0ac0e17 100644
--- a/packages/dashboard/src/components/spree/currency-select.tsx
+++ b/packages/dashboard/src/components/spree/currency-select.tsx
@@ -1,7 +1,6 @@
+import { useStore, useTranslation } from '@spree/dashboard-core'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { useTranslation } from '@/lib/i18n'
-import { useStore } from '@/providers/store-provider'
interface CurrencySelectProps {
/** ID for the trigger — paired with the parent `<FieldLabel htmlFor>`. */
diff --git a/packages/dashboard/src/components/spree/custom-fields/custom-fields-card.tsx b/packages/dashboard/src/components/spree/custom-fields/custom-fields-card.tsx
index b63cbdb451..fc4d7ea564 100644
--- a/packages/dashboard/src/components/spree/custom-fields/custom-fields-card.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/custom-fields-card.tsx
@@ -1,4 +1,5 @@
import type { CustomFieldOwnerType } from '@spree/admin-sdk'
+import { useCustomFieldDefinitions, useCustomFields } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -14,7 +15,6 @@ import {
} from '@spree/dashboard-ui'
import { PencilIcon, TagIcon } from 'lucide-react'
import { Fragment, useState } from 'react'
-import { useCustomFieldDefinitions, useCustomFields } from '@/hooks/use-custom-fields'
import { CustomFieldsDrawer } from './custom-fields-drawer'
interface CustomFieldsCardProps {
diff --git a/packages/dashboard/src/components/spree/custom-fields/custom-fields-drawer.tsx b/packages/dashboard/src/components/spree/custom-fields/custom-fields-drawer.tsx
index 6620df61b7..f5171b860d 100644
--- a/packages/dashboard/src/components/spree/custom-fields/custom-fields-drawer.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/custom-fields-drawer.tsx
@@ -1,4 +1,11 @@
import type { CustomFieldOwnerType } from '@spree/admin-sdk'
+import {
+ useCreateCustomField,
+ useCustomFieldDefinitions,
+ useCustomFields,
+ useDeleteCustomField,
+ useUpdateCustomField,
+} from '@spree/dashboard-core'
import {
Button,
Empty,
@@ -20,13 +27,6 @@ import { type ReactNode, useEffect, useMemo, useState } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import {
- useCreateCustomField,
- useCustomFieldDefinitions,
- useCustomFields,
- useDeleteCustomField,
- useUpdateCustomField,
-} from '@/hooks/use-custom-fields'
import { DefinitionForm } from './definition-form'
import { ValueInput } from './value-input'
diff --git a/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx b/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx
index 3f1d2b14c1..529a91711f 100644
--- a/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx
@@ -1,4 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
+import { mapSpreeErrorsToForm, useCreateCustomFieldDefinition } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -16,8 +17,6 @@ import { Loader2Icon } from 'lucide-react'
import type { ReactNode } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { useCreateCustomFieldDefinition } from '@/hooks/use-custom-fields'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
import {
CUSTOM_FIELD_DEFINITION_DEFAULTS,
type CustomFieldDefinitionFormValues,
diff --git a/packages/dashboard/src/components/spree/custom-fields/value-input.tsx b/packages/dashboard/src/components/spree/custom-fields/value-input.tsx
index 135adac00f..8c4cf7a195 100644
--- a/packages/dashboard/src/components/spree/custom-fields/value-input.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/value-input.tsx
@@ -1,6 +1,6 @@
+import { useTranslation } from '@spree/dashboard-core'
import { Input, RichTextEditor, Switch, Textarea } from '@spree/dashboard-ui'
import { type Control, Controller } from 'react-hook-form'
-import { useTranslation } from '@/lib/i18n'
type FieldType = 'short_text' | 'long_text' | 'rich_text' | 'number' | 'boolean' | 'json'
diff --git a/packages/dashboard/src/components/spree/export-button.tsx b/packages/dashboard/src/components/spree/export-button.tsx
index e8ddd35fbb..0744f3d37c 100644
--- a/packages/dashboard/src/components/spree/export-button.tsx
+++ b/packages/dashboard/src/components/spree/export-button.tsx
@@ -1,4 +1,5 @@
import type { ExportType } from '@spree/admin-sdk'
+import { filtersToRansack, useExport } from '@spree/dashboard-core'
import {
Button,
Dialog,
@@ -19,8 +20,6 @@ import {
import { DownloadIcon, FilterIcon, GlobeIcon } from 'lucide-react'
import { useState } from 'react'
import type { ResourceActionsContext } from '@/components/spree/resource-table'
-import { useExport } from '@/hooks/use-export'
-import { filtersToRansack } from '@/lib/filters-to-ransack'
interface ExportButtonProps extends ResourceActionsContext {
/** Which dataset to export. Server validates against `Spree::Export.available_types`. */
diff --git a/packages/dashboard/src/components/spree/json-preview-drawer.tsx b/packages/dashboard/src/components/spree/json-preview-drawer.tsx
index 8daf04b89b..347a4b1b98 100644
--- a/packages/dashboard/src/components/spree/json-preview-drawer.tsx
+++ b/packages/dashboard/src/components/spree/json-preview-drawer.tsx
@@ -1,3 +1,4 @@
+import { useCopyToClipboard } from '@spree/dashboard-core'
import {
Button,
cn,
@@ -24,7 +25,6 @@ import {
import type { ComponentProps } from 'react'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
const PREFIX_DESTINATIONS: Record<string, { route: string; param: string }> = {
or: { route: '/$storeId/orders/$orderId', param: 'orderId' },
diff --git a/packages/dashboard/src/components/spree/locale-select.tsx b/packages/dashboard/src/components/spree/locale-select.tsx
index 13baccb0bb..98c1f246b8 100644
--- a/packages/dashboard/src/components/spree/locale-select.tsx
+++ b/packages/dashboard/src/components/spree/locale-select.tsx
@@ -1,3 +1,4 @@
+import { useStore, useTranslation } from '@spree/dashboard-core'
import {
Combobox,
ComboboxChip,
@@ -16,8 +17,6 @@ import {
useComboboxAnchor,
} from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { useTranslation } from '@/lib/i18n'
-import { useStore } from '@/providers/store-provider'
interface BaseProps {
/** Locale codes to pick from. Defaults to the current store's `supported_locales`. */
diff --git a/packages/dashboard/src/components/spree/nav-main.tsx b/packages/dashboard/src/components/spree/nav-main.tsx
index da88a20210..340221fb30 100644
--- a/packages/dashboard/src/components/spree/nav-main.tsx
+++ b/packages/dashboard/src/components/spree/nav-main.tsx
@@ -1,3 +1,4 @@
+import type { SubjectName } from '@spree/dashboard-core'
import {
DropdownMenu,
DropdownMenuContent,
@@ -15,7 +16,6 @@ import {
import { Link, useRouterState } from '@tanstack/react-router'
import type { LucideIcon } from 'lucide-react'
import { useState } from 'react'
-import type { SubjectName } from '@/lib/permissions'
export type NavItem = {
title: string
diff --git a/packages/dashboard/src/components/spree/page-header.tsx b/packages/dashboard/src/components/spree/page-header.tsx
index 9db7a8dae0..ff72ebe4cc 100644
--- a/packages/dashboard/src/components/spree/page-header.tsx
+++ b/packages/dashboard/src/components/spree/page-header.tsx
@@ -1,3 +1,4 @@
+import { useCopyToClipboard, useScrolled } from '@spree/dashboard-core'
import {
BackButton,
Button,
@@ -15,8 +16,6 @@ import { lazy, type ReactNode, Suspense, useState } from 'react'
import { useTranslation } from 'react-i18next'
import type { JsonPreviewDrawerProps } from '@/components/spree/json-preview-drawer'
import { Slot } from '@/components/spree/slot'
-import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
-import { useScrolled } from '@/hooks/use-scrolled'
// JSON drawer is a developer-only feature; pulling its tree (which includes
// @uiw/react-json-view at ~30KB gzip) into the route bundle is wasteful.
diff --git a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
index 3e322c32a1..d3dec5b6ee 100644
--- a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
+++ b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-form.tsx
@@ -1,4 +1,5 @@
import type { PaymentMethod, PreferenceField } from '@spree/admin-sdk'
+import { useSlotEntries } from '@spree/dashboard-core'
import {
Field,
FieldError,
@@ -18,7 +19,6 @@ import { Controller, type UseFormReturn } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { PreferencesForm } from '@/components/spree/preferences-form'
import { Slot } from '@/components/spree/slot'
-import { useSlotEntries } from '@/lib/slot-registry'
import {
type PaymentMethodEditorContext,
type PaymentMethodFormMode,
diff --git a/packages/dashboard/src/components/spree/preferences-form.tsx b/packages/dashboard/src/components/spree/preferences-form.tsx
index 4c76ec13c0..9af0100ae1 100644
--- a/packages/dashboard/src/components/spree/preferences-form.tsx
+++ b/packages/dashboard/src/components/spree/preferences-form.tsx
@@ -1,4 +1,5 @@
import type { PreferenceField as PreferenceFieldDef } from '@spree/admin-sdk'
+import { useTranslation } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -12,7 +13,6 @@ import {
import { PlusIcon, TrashIcon } from 'lucide-react'
import { useId, useMemo, useState } from 'react'
import { CurrencySelect } from '@/components/spree/currency-select'
-import { useTranslation } from '@/lib/i18n'
/**
* Hydrates a `preferences` hash with each field's default. Used to seed
diff --git a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
index 3f75460276..baf48c4922 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { PriceList, PriceRule, ResourceTypeDefinition } from '@spree/admin-sdk'
+import { adminClient, useStore } from '@spree/dashboard-core'
import { useConfirm } from '@spree/dashboard-ui'
import { parseISO } from 'date-fns'
import { formatInTimeZone } from 'date-fns-tz'
@@ -15,18 +16,17 @@ import {
import { useEffect, useState } from 'react'
import { Controller, type UseFormReturn, useFieldArray, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { adminClient } from '@/client'
import { BulkPriceEditorDialog } from '@/components/spree/bulk-price-editor/bulk-price-editor-dialog'
import { Can } from '@/components/spree/can'
import { PageHeader } from '@/components/spree/page-header'
import { PreferencesForm } from '@/components/spree/preferences-form'
import { PriceListStatusBadge } from '@/components/spree/price-list-editors/status-badge'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { useStore } from '@/providers/store-provider'
// Side-effect import — registers per-rule editors (customer, customer
// group, …) into the slot registry. Must run before any RuleEditSheet
// mounts.
import '@/components/spree/price-list-editors/register'
+import { mapSpreeErrorsToForm, Subject } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -63,8 +63,6 @@ import {
useDeactivatePriceList,
usePriceRuleTypes,
} from '@/hooks/use-price-lists'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
import {
MATCH_POLICIES,
PRICE_LIST_DEFAULTS,
diff --git a/packages/dashboard/src/components/spree/price-list-editors/register.ts b/packages/dashboard/src/components/spree/price-list-editors/register.ts
index 1c47c2fa35..a3fd529b35 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/register.ts
+++ b/packages/dashboard/src/components/spree/price-list-editors/register.ts
@@ -1,4 +1,4 @@
-import { registerSlot } from '@/lib/slot-registry'
+import { registerSlot } from '@spree/dashboard-core'
import { CustomerRuleEditor } from './rule-customer'
import { CustomerGroupRuleEditor } from './rule-customer-group'
import { ruleFormSlot } from './types'
diff --git a/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx b/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx
index 1961c9219a..dc22d0a2ca 100644
--- a/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx
+++ b/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx
@@ -1,4 +1,5 @@
import type { Media, Variant } from '@spree/admin-sdk'
+import { useTranslation } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -14,7 +15,6 @@ import { CheckIcon, DownloadIcon, ExternalLinkIcon, ImagePlusIcon, Loader2Icon }
import { useEffect, useState } from 'react'
import { toast } from 'sonner'
import { useUpdateProductMedia } from '@/hooks/use-product-media'
-import { useTranslation } from '@/lib/i18n'
type Props = {
productId: string
diff --git a/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx b/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx
index a86deef5c3..9b1b3a3975 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/action-adjustment.tsx
@@ -1,4 +1,5 @@
import type { PromotionActionCalculator } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import {
Field,
FieldGroup,
@@ -11,7 +12,6 @@ import {
} from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
import { useEffect, useMemo, useState } from 'react'
-import { adminClient } from '@/client'
import { PreferencesForm } from '@/components/spree/preferences-form'
import { EditorShell } from './editor-shell'
import type { PromotionActionEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index 871a1834aa..56855146d6 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -19,6 +19,7 @@ import { PreferencesForm } from '@/components/spree/preferences-form'
import { EditorShell } from '@/components/spree/promotion-editors/editor-shell'
import { StoreDatePicker } from '@/components/spree/store-date-picker'
import '@/components/spree/promotion-editors/register'
+import { mapSpreeErrorsToForm, Subject, useExport, useStore } from '@spree/dashboard-core'
import {
ActiveBadge,
Badge,
@@ -68,15 +69,11 @@ import {
ruleFormSlot,
} from '@/components/spree/promotion-editors/types'
import { Slot } from '@/components/spree/slot'
-import { useExport } from '@/hooks/use-export'
import {
usePromotionActionTypes,
usePromotionCouponCodes,
usePromotionRuleTypes,
} from '@/hooks/use-promotions'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { useStore } from '@/providers/store-provider'
import {
MATCH_POLICIES,
type MatchPolicy,
diff --git a/packages/dashboard/src/components/spree/promotion-editors/register.ts b/packages/dashboard/src/components/spree/promotion-editors/register.ts
index 8b4124709c..c65e2e20c2 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/register.ts
+++ b/packages/dashboard/src/components/spree/promotion-editors/register.ts
@@ -1,4 +1,4 @@
-import { registerSlot } from '@/lib/slot-registry'
+import { registerSlot } from '@spree/dashboard-core'
import { AdjustmentActionEditor } from './action-adjustment'
import { CategoryRuleEditor } from './rule-category'
import { CountryRuleEditor } from './rule-country'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx
index fcdc003621..9a6275302b 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-category.tsx
@@ -1,9 +1,8 @@
import type { Category } from '@spree/admin-sdk'
+import { adminClient, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { adminClient } from '@/client'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { useTranslation } from '@/lib/i18n'
import { EditorShell } from './editor-shell'
import { MatchPolicyPicker } from './match-policy-picker'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
index 2338022bdc..a6b9ea3fce 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-country.tsx
@@ -1,9 +1,8 @@
import type { Country } from '@spree/admin-sdk'
+import { useCountries, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
import { CountryMultiCombobox } from '@/components/spree/country-combobox'
-import { useCountries } from '@/hooks/use-countries'
-import { useTranslation } from '@/lib/i18n'
import { EditorShell } from './editor-shell'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx
index e0b9c67acf..a972e23621 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-customer-group.tsx
@@ -1,9 +1,9 @@
import type { CustomerGroup } from '@spree/admin-sdk'
+import { useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useState } from 'react'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { customerGroupAutocompleteProps } from '@/hooks/use-customer-groups'
-import { useTranslation } from '@/lib/i18n'
import { EditorShell } from './editor-shell'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx
index bc0662fbc7..87f565fba9 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-product.tsx
@@ -1,9 +1,8 @@
import type { Product } from '@spree/admin-sdk'
+import { adminClient, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useMemo, useState } from 'react'
-import { adminClient } from '@/client'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { useTranslation } from '@/lib/i18n'
import { EditorShell } from './editor-shell'
import { MatchPolicyPicker } from './match-policy-picker'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx b/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx
index 30a2120e0b..8a6b806875 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/rule-user.tsx
@@ -1,9 +1,8 @@
import type { Customer } from '@spree/admin-sdk'
+import { adminClient, useTranslation } from '@spree/dashboard-core'
import { Field, FieldGroup, FieldLabel } from '@spree/dashboard-ui'
import { useState } from 'react'
-import { adminClient } from '@/client'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
-import { useTranslation } from '@/lib/i18n'
import { EditorShell } from './editor-shell'
import type { PromotionRuleEditorContext } from './types'
diff --git a/packages/dashboard/src/components/spree/resource-table.tsx b/packages/dashboard/src/components/spree/resource-table.tsx
index 04c0366a63..387a9cfd61 100644
--- a/packages/dashboard/src/components/spree/resource-table.tsx
+++ b/packages/dashboard/src/components/spree/resource-table.tsx
@@ -15,6 +15,16 @@ import {
verticalListSortingStrategy,
} from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
+import {
+ type ColumnDef,
+ type FilterRule,
+ filtersToRansack,
+ getDefaultColumnKeys,
+ getDisplayableColumns,
+ getTable,
+ type SortOption,
+ useAuth,
+} from '@spree/dashboard-core'
import {
Card,
CardContent,
@@ -51,16 +61,6 @@ import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
import { type BulkAction, BulkActionBar } from '@/components/spree/bulk-action-bar'
import { TableToolbar } from '@/components/spree/table-toolbar'
-import { useAuth } from '@/hooks/use-auth'
-import { filtersToRansack } from '@/lib/filters-to-ransack'
-import {
- type ColumnDef,
- type FilterRule,
- getDefaultColumnKeys,
- getDisplayableColumns,
- getTable,
- type SortOption,
-} from '@/lib/table-registry'
// ============================================================================
// Search schema — shared by all resource table routes
diff --git a/packages/dashboard/src/components/spree/settings-sidebar.tsx b/packages/dashboard/src/components/spree/settings-sidebar.tsx
index d637fab92e..779c7e2fea 100644
--- a/packages/dashboard/src/components/spree/settings-sidebar.tsx
+++ b/packages/dashboard/src/components/spree/settings-sidebar.tsx
@@ -1,3 +1,10 @@
+import {
+ type Permissions,
+ type SettingsNavEntry,
+ type SettingsNavSnapshot,
+ usePermissions,
+ useSettingsNav,
+} from '@spree/dashboard-core'
import {
Badge,
cn,
@@ -11,12 +18,6 @@ import { Link, useParams, useRouterState } from '@tanstack/react-router'
import { PackageIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { NavIcon } from '@/components/spree/nav-main'
-import {
- type SettingsNavEntry,
- type SettingsNavSnapshot,
- useSettingsNav,
-} from '@/lib/settings-nav-registry'
-import { type Permissions, usePermissions } from '@/providers/permission-provider'
import '@/nav/settings'
diff --git a/packages/dashboard/src/components/spree/slot.tsx b/packages/dashboard/src/components/spree/slot.tsx
index 0cd86aae24..4c6f769dfa 100644
--- a/packages/dashboard/src/components/spree/slot.tsx
+++ b/packages/dashboard/src/components/spree/slot.tsx
@@ -1,5 +1,5 @@
+import { type SlotAmbientContext, useSlotEntries } from '@spree/dashboard-core'
import { Fragment } from 'react'
-import { type SlotAmbientContext, useSlotEntries } from '@/lib/slot-registry'
interface SlotProps<TContext> {
/** Slot name, e.g. "product.form_sidebar" or "order.dropdown". */
diff --git a/packages/dashboard/src/components/spree/store-date-picker.tsx b/packages/dashboard/src/components/spree/store-date-picker.tsx
index 2284d7018c..450e27b376 100644
--- a/packages/dashboard/src/components/spree/store-date-picker.tsx
+++ b/packages/dashboard/src/components/spree/store-date-picker.tsx
@@ -1,5 +1,5 @@
+import { useStore } from '@spree/dashboard-core'
import { DatePicker, type DatePickerProps } from '@spree/dashboard-ui'
-import { useStore } from '@/providers/store-provider'
/**
* Drop-in `<DatePicker>` that pulls the timezone from `<StoreProvider>` so
diff --git a/packages/dashboard/src/components/spree/store-switcher.tsx b/packages/dashboard/src/components/spree/store-switcher.tsx
index 73d15c30bd..2ec48a3384 100644
--- a/packages/dashboard/src/components/spree/store-switcher.tsx
+++ b/packages/dashboard/src/components/spree/store-switcher.tsx
@@ -1,3 +1,4 @@
+import { useStore } from '@spree/dashboard-core'
import {
Avatar,
AvatarFallback,
@@ -12,7 +13,6 @@ import {
useSidebar,
} from '@spree/dashboard-ui'
import { ChevronsUpDownIcon, ExternalLinkIcon } from 'lucide-react'
-import { useStore } from '@/providers/store-provider'
export function StoreSwitcher() {
const { isMobile, state } = useSidebar()
diff --git a/packages/dashboard/src/components/spree/table-toolbar.tsx b/packages/dashboard/src/components/spree/table-toolbar.tsx
index 33570c3532..edd6587a97 100644
--- a/packages/dashboard/src/components/spree/table-toolbar.tsx
+++ b/packages/dashboard/src/components/spree/table-toolbar.tsx
@@ -1,3 +1,11 @@
+import {
+ type ColumnDef,
+ type FilterRule,
+ parseFilterIds,
+ type SortOption,
+ useStore,
+ useTranslation,
+} from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -37,14 +45,6 @@ import { useCallback, useMemo, useRef, useState } from 'react'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
import { StoreDatePicker } from '@/components/spree/store-date-picker'
import { TagCombobox } from '@/components/spree/tag-combobox'
-import { useTranslation } from '@/lib/i18n'
-import {
- type ColumnDef,
- type FilterRule,
- parseFilterIds,
- type SortOption,
-} from '@/lib/table-registry'
-import { useStore } from '@/providers/store-provider'
interface TableToolbarProps {
/** Displayable columns (for column selector and table headers) */
diff --git a/packages/dashboard/src/components/spree/tag-combobox.tsx b/packages/dashboard/src/components/spree/tag-combobox.tsx
index 8fcc6927d8..8bb3505cbe 100644
--- a/packages/dashboard/src/components/spree/tag-combobox.tsx
+++ b/packages/dashboard/src/components/spree/tag-combobox.tsx
@@ -1,3 +1,5 @@
+import type { TaggableType } from '@spree/dashboard-core'
+import { adminClient, useAuth } from '@spree/dashboard-core'
import {
Combobox,
ComboboxChip,
@@ -12,9 +14,6 @@ import {
} from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
import { useMemo, useState } from 'react'
-import { adminClient } from '@/client'
-import { useAuth } from '@/hooks/use-auth'
-import type { TaggableType } from '@/lib/table-registry'
export type { TaggableType }
diff --git a/packages/dashboard/src/components/spree/theme-toggle.tsx b/packages/dashboard/src/components/spree/theme-toggle.tsx
index 53b5bf5f79..156fe5b284 100644
--- a/packages/dashboard/src/components/spree/theme-toggle.tsx
+++ b/packages/dashboard/src/components/spree/theme-toggle.tsx
@@ -1,6 +1,10 @@
-import { DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator } from '@spree/dashboard-ui'
+import {
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ useTheme,
+} from '@spree/dashboard-ui'
import { CheckIcon, MonitorIcon, MoonIcon, SunIcon } from 'lucide-react'
-import { useTheme } from '@/providers/theme-provider'
/**
* Theme picker rendered inside the user dropdown menu. Three-way (Light / Dark
diff --git a/packages/dashboard/src/components/spree/top-bar.tsx b/packages/dashboard/src/components/spree/top-bar.tsx
index 72cd626c8d..56641911da 100644
--- a/packages/dashboard/src/components/spree/top-bar.tsx
+++ b/packages/dashboard/src/components/spree/top-bar.tsx
@@ -1,3 +1,4 @@
+import { getInitials, useAuth, useCommandPalette, useStore } from '@spree/dashboard-core'
import {
Avatar,
AvatarFallback,
@@ -20,10 +21,6 @@ import {
} from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { ThemeMenuItems } from '@/components/spree/theme-toggle'
-import { useAuth } from '@/hooks/use-auth'
-import { useCommandPalette } from '@/hooks/use-command-palette'
-import { getInitials } from '@/lib/formatters'
-import { useStore } from '@/providers/store-provider'
const IS_MAC = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform ?? '')
diff --git a/packages/dashboard/src/hooks/use-admin-users.ts b/packages/dashboard/src/hooks/use-admin-users.ts
index fd3d1a947a..f2d12e6300 100644
--- a/packages/dashboard/src/hooks/use-admin-users.ts
+++ b/packages/dashboard/src/hooks/use-admin-users.ts
@@ -1,6 +1,5 @@
import type { AdminUser } from '@spree/admin-sdk'
-import { adminClient } from '@/client'
-import { i18n } from '@/lib/i18n'
+import { adminClient, i18n } from '@spree/dashboard-core'
/**
* Shared config for any `<ResourceCombobox>` / `<ResourceMultiAutocomplete>`
diff --git a/packages/dashboard/src/hooks/use-allowed-origins.ts b/packages/dashboard/src/hooks/use-allowed-origins.ts
index 7076a7ddb3..3fd1e68baa 100644
--- a/packages/dashboard/src/hooks/use-allowed-origins.ts
+++ b/packages/dashboard/src/hooks/use-allowed-origins.ts
@@ -3,9 +3,8 @@ import type {
AllowedOriginCreateParams,
AllowedOriginUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const allowedOriginsQueryKey = ['allowed-origins'] as const
diff --git a/packages/dashboard/src/hooks/use-api-keys.ts b/packages/dashboard/src/hooks/use-api-keys.ts
index 6cb73a3321..240cc2aa9e 100644
--- a/packages/dashboard/src/hooks/use-api-keys.ts
+++ b/packages/dashboard/src/hooks/use-api-keys.ts
@@ -1,6 +1,6 @@
import type { ApiKey, ApiKeyCreateParams } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
const API_KEYS_KEY = ['api-keys'] as const
diff --git a/packages/dashboard/src/hooks/use-categories.ts b/packages/dashboard/src/hooks/use-categories.ts
index 296c99bd19..97cd0e4238 100644
--- a/packages/dashboard/src/hooks/use-categories.ts
+++ b/packages/dashboard/src/hooks/use-categories.ts
@@ -1,7 +1,7 @@
import type { Category } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import { useQuery } from '@tanstack/react-query'
import i18n from 'i18next'
-import { adminClient } from '@/client'
export function useCategories() {
return useQuery({
diff --git a/packages/dashboard/src/hooks/use-customer-groups.ts b/packages/dashboard/src/hooks/use-customer-groups.ts
index 1fef186a75..3be1c4d6bb 100644
--- a/packages/dashboard/src/hooks/use-customer-groups.ts
+++ b/packages/dashboard/src/hooks/use-customer-groups.ts
@@ -3,9 +3,8 @@ import type {
CustomerGroupCreateParams,
CustomerGroupUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
/**
* Shared config for any `<ResourceMultiAutocomplete>` picking customer
diff --git a/packages/dashboard/src/hooks/use-customer-store-credits.ts b/packages/dashboard/src/hooks/use-customer-store-credits.ts
index c7eab7a89e..e39af1235e 100644
--- a/packages/dashboard/src/hooks/use-customer-store-credits.ts
+++ b/packages/dashboard/src/hooks/use-customer-store-credits.ts
@@ -1,7 +1,5 @@
-import { adminClient } from '@/client'
+import { adminClient, i18n, useResourceMutation } from '@spree/dashboard-core'
import { customerQueryKey } from '@/hooks/use-customers'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
-import { i18n } from '@/lib/i18n'
type StoreCreditCreateParams = Parameters<typeof adminClient.customers.storeCredits.create>[1]
type StoreCreditUpdateParams = Parameters<typeof adminClient.customers.storeCredits.update>[2]
diff --git a/packages/dashboard/src/hooks/use-customers.ts b/packages/dashboard/src/hooks/use-customers.ts
index e49a64940e..878a1653d2 100644
--- a/packages/dashboard/src/hooks/use-customers.ts
+++ b/packages/dashboard/src/hooks/use-customers.ts
@@ -1,9 +1,6 @@
import type { Customer } from '@spree/admin-sdk'
+import { adminClient, i18n, useAuth, useResourceMutation } from '@spree/dashboard-core'
import { useQuery } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useAuth } from '@/hooks/use-auth'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
-import { i18n } from '@/lib/i18n'
/**
* Shared config for any `<ResourceCombobox>` / `<ResourceMultiAutocomplete>`
diff --git a/packages/dashboard/src/hooks/use-gift-cards.ts b/packages/dashboard/src/hooks/use-gift-cards.ts
index d7b8b2822f..69dc68e239 100644
--- a/packages/dashboard/src/hooks/use-gift-cards.ts
+++ b/packages/dashboard/src/hooks/use-gift-cards.ts
@@ -5,10 +5,8 @@ import type {
GiftCardCreateParams,
GiftCardUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, i18n, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
-import { i18n } from '@/lib/i18n'
export const giftCardsQueryKey = ['gift-cards'] as const
diff --git a/packages/dashboard/src/hooks/use-markets.ts b/packages/dashboard/src/hooks/use-markets.ts
index 0f823cbf53..cd26927020 100644
--- a/packages/dashboard/src/hooks/use-markets.ts
+++ b/packages/dashboard/src/hooks/use-markets.ts
@@ -1,7 +1,6 @@
import type { Market, MarketCreateParams, MarketUpdateParams } from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const marketsQueryKey = ['markets'] as const
diff --git a/packages/dashboard/src/hooks/use-option-types.ts b/packages/dashboard/src/hooks/use-option-types.ts
index 4bdc29fd48..f702abfbac 100644
--- a/packages/dashboard/src/hooks/use-option-types.ts
+++ b/packages/dashboard/src/hooks/use-option-types.ts
@@ -1,7 +1,6 @@
import type { OptionType, OptionTypeCreateParams, OptionTypeUpdateParams } from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const optionTypesQueryKey = ['option-types'] as const
diff --git a/packages/dashboard/src/hooks/use-order.ts b/packages/dashboard/src/hooks/use-order.ts
index c81ec8c609..b1711f49cd 100644
--- a/packages/dashboard/src/hooks/use-order.ts
+++ b/packages/dashboard/src/hooks/use-order.ts
@@ -1,5 +1,5 @@
+import { adminClient } from '@spree/dashboard-core'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
export const orderQueryKey = (id: string) => ['order', id] as const
export const ordersQueryKey = ['orders'] as const
diff --git a/packages/dashboard/src/hooks/use-payment-methods.ts b/packages/dashboard/src/hooks/use-payment-methods.ts
index 4e7fc47759..ab3b82b390 100644
--- a/packages/dashboard/src/hooks/use-payment-methods.ts
+++ b/packages/dashboard/src/hooks/use-payment-methods.ts
@@ -3,9 +3,8 @@ import type {
PaymentMethodCreateParams,
PaymentMethodUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const paymentMethodTypesQueryKey = ['payment-methods', 'types'] as const
diff --git a/packages/dashboard/src/hooks/use-price-lists.ts b/packages/dashboard/src/hooks/use-price-lists.ts
index 89fcae5a86..f442c43c2f 100644
--- a/packages/dashboard/src/hooks/use-price-lists.ts
+++ b/packages/dashboard/src/hooks/use-price-lists.ts
@@ -1,7 +1,6 @@
import type { PriceList, PriceListCreateParams, PriceListUpdateParams } from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const priceListsQueryKey = ['price-lists'] as const
diff --git a/packages/dashboard/src/hooks/use-prices.ts b/packages/dashboard/src/hooks/use-prices.ts
index a287d2f90e..d3183a689c 100644
--- a/packages/dashboard/src/hooks/use-prices.ts
+++ b/packages/dashboard/src/hooks/use-prices.ts
@@ -1,6 +1,6 @@
import type { PriceBulkUpsertRow } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import { useMutation, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
/**
* Mutation hook for the bulk-upsert endpoint behind the price spreadsheet.
diff --git a/packages/dashboard/src/hooks/use-product-media.ts b/packages/dashboard/src/hooks/use-product-media.ts
index c1b8d1ad01..93a4c6c336 100644
--- a/packages/dashboard/src/hooks/use-product-media.ts
+++ b/packages/dashboard/src/hooks/use-product-media.ts
@@ -1,6 +1,6 @@
import type { Media } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
type MediaListSnapshot = { data: Media[] }
diff --git a/packages/dashboard/src/hooks/use-product.ts b/packages/dashboard/src/hooks/use-product.ts
index ff4e51e3b0..cff6941dd5 100644
--- a/packages/dashboard/src/hooks/use-product.ts
+++ b/packages/dashboard/src/hooks/use-product.ts
@@ -1,5 +1,5 @@
+import { adminClient } from '@spree/dashboard-core'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
export function useProduct(id: string) {
return useQuery({
diff --git a/packages/dashboard/src/hooks/use-products.ts b/packages/dashboard/src/hooks/use-products.ts
index 1d764ef10c..aa0d206dbf 100644
--- a/packages/dashboard/src/hooks/use-products.ts
+++ b/packages/dashboard/src/hooks/use-products.ts
@@ -1,8 +1,7 @@
+import type { FilterRule } from '@spree/dashboard-core'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery } from '@tanstack/react-query'
import i18n from 'i18next'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
-import type { FilterRule } from '@/lib/table-registry'
interface UseProductsParams {
page?: number
diff --git a/packages/dashboard/src/hooks/use-promotions.ts b/packages/dashboard/src/hooks/use-promotions.ts
index 1bb384d1a0..763fc7d4c0 100644
--- a/packages/dashboard/src/hooks/use-promotions.ts
+++ b/packages/dashboard/src/hooks/use-promotions.ts
@@ -9,9 +9,8 @@ import type {
PromotionRuleUpdateParams,
PromotionUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const promotionsQueryKey = ['promotions'] as const
diff --git a/packages/dashboard/src/hooks/use-staff.ts b/packages/dashboard/src/hooks/use-staff.ts
index 66a9917ec3..401241341c 100644
--- a/packages/dashboard/src/hooks/use-staff.ts
+++ b/packages/dashboard/src/hooks/use-staff.ts
@@ -1,6 +1,6 @@
import type { AdminUserUpdateParams, InvitationCreateParams } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
const STAFF_KEY = ['staff'] as const
const INVITATIONS_KEY = ['invitations'] as const
diff --git a/packages/dashboard/src/hooks/use-stock-items.ts b/packages/dashboard/src/hooks/use-stock-items.ts
index 8680dfe636..77f1ffc890 100644
--- a/packages/dashboard/src/hooks/use-stock-items.ts
+++ b/packages/dashboard/src/hooks/use-stock-items.ts
@@ -1,7 +1,6 @@
import type { StockItem, StockItemUpdateParams } from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { type QueryKey, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const stockItemsQueryKey = ['stock-items'] as const
diff --git a/packages/dashboard/src/hooks/use-stock-locations.ts b/packages/dashboard/src/hooks/use-stock-locations.ts
index 3223336145..3cb815a01a 100644
--- a/packages/dashboard/src/hooks/use-stock-locations.ts
+++ b/packages/dashboard/src/hooks/use-stock-locations.ts
@@ -3,9 +3,8 @@ import type {
StockLocationCreateParams,
StockLocationUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const stockLocationsQueryKey = ['stock-locations'] as const
diff --git a/packages/dashboard/src/hooks/use-stock-transfers.ts b/packages/dashboard/src/hooks/use-stock-transfers.ts
index b95773f766..a25a566cc7 100644
--- a/packages/dashboard/src/hooks/use-stock-transfers.ts
+++ b/packages/dashboard/src/hooks/use-stock-transfers.ts
@@ -1,7 +1,6 @@
import type { StockTransfer, StockTransferCreateParams } from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const stockTransfersQueryKey = ['stock-transfers'] as const
diff --git a/packages/dashboard/src/hooks/use-store-credit-categories.ts b/packages/dashboard/src/hooks/use-store-credit-categories.ts
index 8e10d07d9e..630517b540 100644
--- a/packages/dashboard/src/hooks/use-store-credit-categories.ts
+++ b/packages/dashboard/src/hooks/use-store-credit-categories.ts
@@ -1,5 +1,5 @@
+import { adminClient } from '@spree/dashboard-core'
import { useQuery } from '@tanstack/react-query'
-import { adminClient } from '@/client'
export function useStoreCreditCategories() {
return useQuery({
diff --git a/packages/dashboard/src/hooks/use-store-settings.ts b/packages/dashboard/src/hooks/use-store-settings.ts
index 1c3f6aeb68..791b4b1e47 100644
--- a/packages/dashboard/src/hooks/use-store-settings.ts
+++ b/packages/dashboard/src/hooks/use-store-settings.ts
@@ -1,7 +1,6 @@
import type { StoreUpdateParams } from '@spree/admin-sdk'
+import { adminClient, useStore } from '@spree/dashboard-core'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useStore } from '@/providers/store-provider'
export function useStoreSettings() {
return useQuery({
diff --git a/packages/dashboard/src/hooks/use-tax-categories.ts b/packages/dashboard/src/hooks/use-tax-categories.ts
index eec80ebff0..3f57808060 100644
--- a/packages/dashboard/src/hooks/use-tax-categories.ts
+++ b/packages/dashboard/src/hooks/use-tax-categories.ts
@@ -3,9 +3,8 @@ import type {
TaxCategoryCreateParams,
TaxCategoryUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, useResourceMutation } from '@spree/dashboard-core'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { adminClient } from '@/client'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
export const taxCategoriesQueryKey = ['tax-categories'] as const
diff --git a/packages/dashboard/src/hooks/use-variant-media.ts b/packages/dashboard/src/hooks/use-variant-media.ts
index 8ee478a662..ed5f715928 100644
--- a/packages/dashboard/src/hooks/use-variant-media.ts
+++ b/packages/dashboard/src/hooks/use-variant-media.ts
@@ -1,5 +1,5 @@
+import { adminClient } from '@spree/dashboard-core'
import { useQuery } from '@tanstack/react-query'
-import { adminClient } from '@/client'
// Lists media linked to a variant. Mutations go through useUpdateProductMedia
// with `variant_ids` — there's no variant-scoped mutation endpoint.
diff --git a/packages/dashboard/src/i18n-setup.ts b/packages/dashboard/src/i18n-setup.ts
new file mode 100644
index 0000000000..4b62cb93e2
--- /dev/null
+++ b/packages/dashboard/src/i18n-setup.ts
@@ -0,0 +1,21 @@
+// i18n bootstrap for `@spree/dashboard`.
+//
+// 1. The side-effect import below initializes i18next with the framework's
+// base translation namespace (`admin.actions.*`, `admin.common.*`,
+// `admin.fields.<simple>.*`, etc.) shipped in `@spree/dashboard-core`.
+// 2. We then merge the app's resource bundle (`admin.nav.*`, resource pages,
+// integrations) so callers can `t('admin.nav.orders')` alongside
+// `t('admin.actions.save')` from the same namespace.
+//
+// Plugin authors follow the same pattern from their entry module:
+//
+// import { i18n } from '@spree/dashboard-core'
+// import myEn from './locales/en.json'
+// i18n.addResourceBundle('en', 'translation', myEn.admin, true, true)
+//
+// `deep: true` + `overwrite: true` merge nested objects without dropping
+// keys the framework already provided; plugin keys win on collision.
+import { i18n } from '@spree/dashboard-core'
+import en from './locales/en.json'
+
+i18n.addResourceBundle('en', 'translation', en, true, true)
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 5aa83915f7..d48123b877 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -1,105 +1,5 @@
{
"admin": {
- "actions": {
- "add": "Add",
- "apply": "Apply",
- "cancel": "Cancel",
- "clear": "Clear",
- "revoke": "Revoke",
- "close": "Close",
- "confirm": "Confirm",
- "create": "Create",
- "creating": "Creating…",
- "delete": "Delete",
- "deleting": "Deleting…",
- "discard": "Discard",
- "discard_changes": "Discard changes",
- "edit": "Edit",
- "generate": "Generate",
- "remove": "Remove",
- "save": "Save",
- "saving": "Saving…",
- "search": "Search",
- "sign_in": "Sign in",
- "signing_in": "Signing in…",
- "view_all": "View all",
- "view_details": "View details",
- "copy": "Copy",
- "copied": "Copied!",
- "export": "Export",
- "exporting": "Exporting…",
- "import": "Import",
- "invite": "Invite",
- "send": "Send",
- "send_invitation": "Send invitation",
- "sending": "Sending…",
- "reset": "Reset",
- "show": "Show",
- "hide": "Hide",
- "back": "Back",
- "actions_menu": "Actions",
- "more_actions": "More actions"
- },
- "row_actions": {
- "menu_label": "Open actions",
- "edit": "Edit",
- "clone": "Duplicate",
- "delete": "Delete"
- },
- "a11y": {
- "breadcrumb": "Breadcrumb",
- "toggle_sidebar": "Toggle sidebar",
- "settings_navigation": "Settings navigation",
- "user_menu": "User menu",
- "drag_to_reorder": "Drag to reorder",
- "reorder": "Reorder",
- "select_all_rows": "Select all rows on this page",
- "select_row": "Select row",
- "clear_date": "Clear date",
- "clear_selection": "Clear selection",
- "expand_all": "Expand all",
- "collapse_all": "Collapse all",
- "refetch": "Refetch",
- "hide_value": "Hide value",
- "show_value": "Show value",
- "pick_color": "Pick a color",
- "change_color": "Change color ({{value}})",
- "stock_at_locations": "Stock at locations",
- "edit_media": "Edit media",
- "delete_image": "Delete image",
- "remove_image": "Remove image",
- "view_image": "View image",
- "upload_image": "Upload image",
- "remove_value": "Remove value"
- },
- "common": {
- "loading": "Loading…",
- "searching": "Searching…",
- "no_results": "No results",
- "optional": "Optional",
- "required": "Required",
- "yes": "Yes",
- "no": "No",
- "or": "or",
- "and": "and",
- "all": "All",
- "none": "None",
- "page_of": "Page {{page}} of {{total}}",
- "prev": "Prev",
- "next": "Next",
- "select_placeholder": "Select…",
- "search_placeholder": "Search…",
- "pick_date": "Pick a date",
- "comma_separated_hint": "Separate values with commas.",
- "are_you_sure": "Are you sure?",
- "remove_question": "Remove?",
- "deleted": "Deleted",
- "unsaved_changes": "You have unsaved changes.",
- "prices": "Prices"
- },
- "color_picker": {
- "no_color": "No color"
- },
"gift_cards": {
"statuses": {
"active": "Active",
@@ -135,59 +35,10 @@
"empty": "No batches match"
}
},
- "messages": {
- "saved": "Saved",
- "created": "Created",
- "updated": "Updated",
- "removed": "Removed",
- "settings_updated": "Settings updated",
- "store_settings_updated": "Store settings updated",
- "invitation_sent": "Invitation sent",
- "invitation_resent": "Invitation resent",
- "invitation_accepted": "Welcome to Spree",
- "key_created": "Key created",
- "key_revoked": "Key revoked",
- "key_deleted": "Key deleted",
- "product_saved": "Product saved",
- "product_created": "Product created",
- "product_deleted": "Product deleted",
- "order_saved": "Order saved",
- "customer_saved": "Customer saved",
- "customer_deleted": "Customer deleted",
- "payment_method_saved": "Payment method saved",
- "tax_category_saved": "Tax category saved",
- "stock_location_saved": "Stock location saved",
- "promotion_created": "Promotion created",
- "promotion_saved": "Promotion saved",
- "promotion_deleted": "Promotion deleted",
- "gift_card_created": "Gift card created",
- "address_saved": "Address saved",
- "address_removed": "Address removed",
- "store_credit_saved": "Store credit saved",
- "store_credit_removed": "Store credit removed",
- "copied_to_clipboard": "Copied to clipboard"
+ "branding": {
+ "app_name": "Spree Admin",
+ "powered_by": "Powered by Spree Commerce"
},
- "errors": {
- "required": "This field is required",
- "generic": "Something went wrong",
- "unexpected": "An unexpected error occurred",
- "failed_to_load": "Failed to load",
- "failed_to_save": "Failed to save",
- "failed_to_update": "Failed to update",
- "failed_to_create": "Failed to create",
- "failed_to_delete": "Failed to delete",
- "failed_to_load_customer": "Failed to load customer",
- "failed_to_load_order": "Failed to load order",
- "failed_to_load_product": "Failed to load product",
- "failed_to_send_invitation": "Failed to send invitation",
- "failed_to_revoke_key": "Failed to revoke key",
- "failed_to_update_store": "Failed to update store settings",
- "failed_to_update_staff": "Failed to update staff",
- "network": "Network error — please retry",
- "unauthorized": "You don't have permission to do that",
- "not_found": "Not found"
- },
- "branding": { "app_name": "Spree Admin", "powered_by": "Powered by Spree Commerce" },
"nav": {
"home": "Home",
"account": "Account",
@@ -205,77 +56,74 @@
"reports": "Reports",
"settings": "Settings"
},
- "auth": {
- "login": { "title": "Welcome back", "subtitle": "Sign in to your admin account" },
- "logout": "Sign out"
- },
"fields": {
- "name": { "label": "Name" },
- "label": { "label": "Label" },
- "description": { "label": "Description" },
- "code": { "label": "Code" },
- "email": { "label": "Email" },
- "password": { "label": "Password" },
- "first_name": { "label": "First name" },
- "last_name": { "label": "Last name" },
- "phone": { "label": "Phone" },
- "company": { "label": "Company" },
- "address1": { "label": "Address line 1" },
- "address2": { "label": "Address line 2" },
- "city": { "label": "City" },
- "zipcode": { "label": "Postal code" },
- "country_iso": { "label": "Country" },
- "state_abbr": { "label": "State / Province" },
- "state_name": { "label": "State / Province" },
- "starts_at": { "label": "Starts" },
- "ends_at": { "label": "Ends" },
- "expires_at": { "label": "Expires" },
- "products_count": { "label": "Products" },
- "prices_count": { "label": "Prices" },
- "active": { "label": "Active" },
- "kind": { "label": "Kind" },
- "amount": { "label": "Amount" },
- "currency": { "label": "Currency" },
- "quantity": { "label": "Quantity" },
- "customer_id": { "label": "Customer" },
- "role_id": { "label": "Role" },
- "role_ids": { "label": "Roles" },
- "slug": { "label": "Slug" },
- "meta_title": { "label": "Meta title" },
- "meta_description": { "label": "Meta description" },
- "tax_category_id": { "label": "Tax category" },
- "status": { "label": "Status" },
- "created_at": { "label": "Created at" },
- "updated_at": { "label": "Updated at" },
- "completed_at": { "label": "Completed at" },
- "total": { "label": "Total" },
- "subtotal": { "label": "Subtotal" },
- "tax": { "label": "Tax" },
- "shipping": { "label": "Shipping" },
- "discount": { "label": "Discount" },
+ "products_count": {
+ "label": "Products"
+ },
+ "prices_count": {
+ "label": "Prices"
+ },
+ "customer_id": {
+ "label": "Customer"
+ },
+ "role_id": {
+ "label": "Role"
+ },
+ "role_ids": {
+ "label": "Roles"
+ },
+ "tax_category_id": {
+ "label": "Tax category"
+ },
"promotion": {
- "name": { "placeholder": "Summer Sale" },
- "description": { "placeholder": "Internal description (optional)" },
- "kind": { "label": "How is this promotion applied?" },
- "code": { "placeholder": "SUMMER2026" },
+ "name": {
+ "placeholder": "Summer Sale"
+ },
+ "description": {
+ "placeholder": "Internal description (optional)"
+ },
+ "kind": {
+ "label": "How is this promotion applied?"
+ },
+ "code": {
+ "placeholder": "SUMMER2026"
+ },
"multi_codes": {
"label": "Generate a batch of unique codes",
"help": "Useful for one-time-use codes — each customer redeems a different code."
},
- "number_of_codes": { "label": "Number of codes", "placeholder": "100" },
+ "number_of_codes": {
+ "label": "Number of codes",
+ "placeholder": "100"
+ },
"code_prefix": {
"label": "Code prefix (optional)",
"placeholder": "VIP",
"help": "Each generated code will start with this prefix."
},
- "starts_at": { "placeholder": "No start date" },
- "expires_at": { "placeholder": "No expiry" },
- "usage_limit": { "label": "Usage limit", "placeholder": "Unlimited" },
- "match_policy": { "label": "Match policy" }
+ "starts_at": {
+ "placeholder": "No start date"
+ },
+ "expires_at": {
+ "placeholder": "No expiry"
+ },
+ "usage_limit": {
+ "label": "Usage limit",
+ "placeholder": "Unlimited"
+ },
+ "match_policy": {
+ "label": "Match policy"
+ }
},
"custom_field_definition": {
- "label": { "label": "Label", "placeholder": "e.g. Material" },
- "namespace": { "label": "Namespace", "placeholder": "custom" },
+ "label": {
+ "label": "Label",
+ "placeholder": "e.g. Material"
+ },
+ "namespace": {
+ "label": "Namespace",
+ "placeholder": "custom"
+ },
"key": {
"label": "Key",
"placeholder": "e.g. material",
@@ -311,12 +159,16 @@
}
},
"tax_category": {
- "name": { "placeholder": "e.g. Reduced rate" },
+ "name": {
+ "placeholder": "e.g. Reduced rate"
+ },
"tax_code": {
"label": "Tax code",
"placeholder": "External tax provider code (Avalara, etc.)"
},
- "description": { "placeholder": "Optional internal description" },
+ "description": {
+ "placeholder": "Optional internal description"
+ },
"is_default": {
"label": "Default",
"help": "Setting this demotes the previous default. Products without an explicit category fall back to this one."
@@ -330,12 +182,20 @@
}
},
"invitation_acceptance": {
- "password": { "label": "Password" },
- "password_confirmation": { "label": "Confirm password" }
+ "password": {
+ "label": "Password"
+ },
+ "password_confirmation": {
+ "label": "Confirm password"
+ }
},
"customer_group": {
- "name": { "placeholder": "e.g. VIP customers" },
- "description": { "placeholder": "Optional internal description" }
+ "name": {
+ "placeholder": "e.g. VIP customers"
+ },
+ "description": {
+ "placeholder": "Optional internal description"
+ }
},
"price_list": {
"name": {
@@ -380,12 +240,16 @@
}
},
"stock_location": {
- "name": { "placeholder": "Brooklyn warehouse" },
+ "name": {
+ "placeholder": "Brooklyn warehouse"
+ },
"admin_name": {
"label": "Internal name",
"placeholder": "Optional — shown only in the admin"
},
- "kind": { "label": "Kind" },
+ "kind": {
+ "label": "Kind"
+ },
"active": {
"label": "Active",
"help": "Inactive locations don't appear in fulfillment selection."
@@ -406,26 +270,45 @@
"label": "Allow customer pickup",
"help": "Customers can pick orders up from this location at checkout."
},
- "pickup_stock_policy": { "label": "Stock policy" },
- "pickup_ready_in_minutes": { "label": "Ready in (minutes)", "placeholder": "60" },
+ "pickup_stock_policy": {
+ "label": "Stock policy"
+ },
+ "pickup_ready_in_minutes": {
+ "label": "Ready in (minutes)",
+ "placeholder": "60"
+ },
"pickup_instructions": {
"label": "Pickup instructions",
"placeholder": "Where the customer should go to collect their order."
}
},
"payment_method": {
- "type": { "label": "Provider", "placeholder": "Select a provider" },
- "name": { "placeholder": "e.g. Credit card (Stripe)" },
- "description": { "placeholder": "Customer-facing description shown at checkout" },
- "storefront_visible": { "label": "Visible on storefront" },
- "active": { "label": "Active", "help": "Inactive methods are hidden from checkout." },
+ "type": {
+ "label": "Provider",
+ "placeholder": "Select a provider"
+ },
+ "name": {
+ "placeholder": "e.g. Credit card (Stripe)"
+ },
+ "description": {
+ "placeholder": "Customer-facing description shown at checkout"
+ },
+ "storefront_visible": {
+ "label": "Visible on storefront"
+ },
+ "active": {
+ "label": "Active",
+ "help": "Inactive methods are hidden from checkout."
+ },
"auto_capture": {
"label": "Auto-capture",
"help": "Capture funds automatically on authorization. When off, you must capture manually."
}
},
"market": {
- "name": { "placeholder": "e.g. Europe" },
+ "name": {
+ "placeholder": "e.g. Europe"
+ },
"currency": {
"label": "Currency",
"help": "ISO 4217 currency used for all prices in this market."
@@ -451,9 +334,6 @@
"help": "Shoppers without a known country see this market. Only one can be default per store."
}
},
- "login": {
- "email": { "placeholder": "[email protected]" }
- },
"option_type": {
"name": {
"label": "Internal name",
@@ -475,135 +355,145 @@
}
},
"option_value": {
- "name": { "label": "Internal name", "placeholder": "e.g. small" },
- "label": { "label": "Label", "placeholder": "e.g. Small" },
- "color_code": { "label": "Color" },
- "image": { "label": "Image" }
+ "name": {
+ "label": "Internal name",
+ "placeholder": "e.g. small"
+ },
+ "label": {
+ "label": "Label",
+ "placeholder": "e.g. Small"
+ },
+ "color_code": {
+ "label": "Color"
+ },
+ "image": {
+ "label": "Image"
+ }
},
"api_key": {
- "name": { "label": "Name", "placeholder": "Backend integration, Storefront prod, …" },
- "key_type": { "label": "Type" },
- "scopes": { "label": "Scopes" }
+ "name": {
+ "label": "Name",
+ "placeholder": "Backend integration, Storefront prod, …"
+ },
+ "key_type": {
+ "label": "Type"
+ },
+ "scopes": {
+ "label": "Scopes"
+ }
},
"store": {
- "name": { "label": "Store name" },
+ "name": {
+ "label": "Store name"
+ },
"preferred_admin_locale": {
"label": "Admin language",
"placeholder": "Use the default language"
},
- "preferred_timezone": { "label": "Timezone", "placeholder": "Select a timezone" },
- "preferred_unit_system": { "label": "Unit system" },
- "preferred_weight_unit": { "label": "Weight unit" }
+ "preferred_timezone": {
+ "label": "Timezone",
+ "placeholder": "Select a timezone"
+ },
+ "preferred_unit_system": {
+ "label": "Unit system"
+ },
+ "preferred_weight_unit": {
+ "label": "Weight unit"
+ }
},
"product": {
- "name": { "placeholder": "Product name" },
- "description": { "placeholder": "Write a product description…" },
- "make_active_at": { "label": "Make active at" },
- "available_on": { "label": "Available on" },
- "discontinue_on": { "label": "Discontinue on" },
- "category_ids": { "label": "Categories" },
- "tags": { "label": "Tags" }
+ "name": {
+ "placeholder": "Product name"
+ },
+ "description": {
+ "placeholder": "Write a product description…"
+ },
+ "make_active_at": {
+ "label": "Make active at"
+ },
+ "available_on": {
+ "label": "Available on"
+ },
+ "discontinue_on": {
+ "label": "Discontinue on"
+ },
+ "category_ids": {
+ "label": "Categories"
+ },
+ "tags": {
+ "label": "Tags"
+ }
},
"gift_card": {
"code": {
"label": "Code",
"help": "Leave blank to auto-generate. For batches, this becomes the prefix."
},
- "amount": { "label": "Amount" },
- "currency": { "label": "Currency" },
- "expires_at": { "label": "Expires", "placeholder": "No expiry" },
- "customer_id": { "label": "Customer" },
+ "amount": {
+ "label": "Amount"
+ },
+ "currency": {
+ "label": "Currency"
+ },
+ "expires_at": {
+ "label": "Expires",
+ "placeholder": "No expiry"
+ },
+ "customer_id": {
+ "label": "Customer"
+ },
"quantity": {
"label": "Quantity",
"help": "1 issues a single card. More than 1 issues a batch with auto-generated codes."
}
},
"customer": {
- "tags": { "label": "Tags" },
- "customer_groups": { "label": "Customer groups" },
- "accepts_email_marketing": { "label": "Subscribed to marketing" },
+ "tags": {
+ "label": "Tags"
+ },
+ "customer_groups": {
+ "label": "Customer groups"
+ },
+ "accepts_email_marketing": {
+ "label": "Subscribed to marketing"
+ },
"internal_note": {
"label": "Internal note",
"placeholder": "Staff-only context about this customer…"
}
},
- "address": {
- "label": { "label": "Label", "placeholder": "e.g. Home, Office" },
- "address1": { "label": "Address" },
- "address2": { "label": "Apartment, suite, etc." },
- "postal_code": { "label": "Postal code" },
- "is_default_billing": { "label": "Default billing address" },
- "is_default_shipping": { "label": "Default shipping address" }
- },
"store_credit": {
- "amount": { "label": "Amount" },
- "currency": { "label": "Currency" },
- "category_id": { "label": "Category" },
- "memo": { "label": "Memo", "placeholder": "Reason for issuing this credit" }
+ "amount": {
+ "label": "Amount"
+ },
+ "currency": {
+ "label": "Currency"
+ },
+ "category_id": {
+ "label": "Category"
+ },
+ "memo": {
+ "label": "Memo",
+ "placeholder": "Reason for issuing this credit"
+ }
},
"order": {
- "email": { "label": "Or use a guest email", "placeholder": "[email protected]" },
- "customer_note": { "label": "Customer note (visible to customer)" },
- "internal_note": { "label": "Internal note (staff only)" },
- "coupon_code": { "label": "Coupon code", "placeholder": "Optional" }
- },
- "media": {
- "alt": {
- "label": "Alt text",
- "placeholder": "Describe the image for accessibility and SEO"
+ "email": {
+ "label": "Or use a guest email",
+ "placeholder": "[email protected]"
+ },
+ "customer_note": {
+ "label": "Customer note (visible to customer)"
+ },
+ "internal_note": {
+ "label": "Internal note (staff only)"
+ },
+ "coupon_code": {
+ "label": "Coupon code",
+ "placeholder": "Optional"
}
}
},
- "components": {
- "currency_select": { "placeholder": "Select a currency" },
- "locale_select": {
- "placeholder": "Select a locale",
- "multi_placeholder": "Add locales…",
- "empty": "No locales found"
- },
- "country_combobox": {
- "search_placeholder": "Search countries…",
- "empty": "No countries found"
- },
- "state_combobox": { "search_placeholder": "Search states…", "empty": "No states found" },
- "command_palette": {
- "placeholder": "Search products, orders, customers…",
- "title": "Search and commands",
- "description": "Search across products, orders, and customers, or run a command.",
- "no_results": "No results for \"{{query}}\".",
- "empty_hint": "Type to search, or pick a command below.",
- "goto": "Go to",
- "goto_label": "Go to {{label}}"
- },
- "bulk_action_bar": {
- "selected": "{{count}} selected",
- "default_success": "Updated {n} records",
- "default_error": "Bulk operation failed"
- },
- "preferences_form": {
- "comma_separated_hint": "Separate values with commas.",
- "tiers": {
- "label": "Tiers",
- "header_threshold": "Order total ≥",
- "header_value": "Discount",
- "empty": "No tiers yet. The base rate applies until you add a tier.",
- "add_tier": "Add tier",
- "remove_tier": "Remove tier"
- }
- },
- "confirm_dialog": { "title": "Are you sure?" },
- "table_toolbar": {
- "search_placeholder": "Search…",
- "filter_select_placeholder": "Select…",
- "filter_date_placeholder": "Pick a date",
- "filter_text_placeholder": "Filter…",
- "filters_button": "Filters"
- },
- "media": {
- "remove_tooltip": "Remove image"
- },
- "custom_fields": { "json_placeholder": "{ \"example\": \"value\" }" }
- },
"promotions": {
"generate_code": {
"title": "Generate a random code"
@@ -690,7 +580,10 @@
"top_products": "Top Products",
"top_products_description": "Best-selling products in your store."
},
- "login": { "title": "Welcome back", "subtitle": "Sign in to your admin account" },
+ "login": {
+ "title": "Welcome back",
+ "subtitle": "Sign in to your admin account"
+ },
"staff": {
"title": "Staff",
"subtitle": "Manage admin teammates and roles",
@@ -710,8 +603,14 @@
"title": "Invite teammate",
"description": "We'll email them a link to set their password."
},
- "edit_sheet": { "title": "Edit teammate" },
- "actions": { "resend": "Resend", "revoke": "Revoke", "remove": "Remove from staff" },
+ "edit_sheet": {
+ "title": "Edit teammate"
+ },
+ "actions": {
+ "resend": "Resend",
+ "revoke": "Revoke",
+ "remove": "Remove from staff"
+ },
"messages": {
"revoked": "Invitation revoked",
"updated": "Staff updated",
@@ -859,7 +758,11 @@
"media_empty": "No media yet.",
"media_upload": "Upload media",
"variants_empty": "No variants yet.",
- "status_options": { "draft": "Draft", "active": "Active", "archived": "Archived" },
+ "status_options": {
+ "draft": "Draft",
+ "active": "Active",
+ "archived": "Archived"
+ },
"inventory": {
"out_of_stock": "Out of stock",
"on_backorder": "On backorder",
@@ -883,7 +786,9 @@
"values_section": "Values",
"values_empty": "No values yet.",
"add_value": "Add option value",
- "table": { "values": "Values" }
+ "table": {
+ "values": "Values"
+ }
},
"price_lists": {
"title": "Price Lists",
@@ -1011,7 +916,10 @@
},
"save_secret_title": "Save your secret key",
"save_secret_description": "Copy this value now — we won't show it again.",
- "scope_badge": { "full_access": "Full access", "read_all": "Read all" }
+ "scope_badge": {
+ "full_access": "Full access",
+ "read_all": "Read all"
+ }
},
"payment_methods": {
"add_sheet_title": "Add payment method",
@@ -1052,7 +960,11 @@
"create_label": "Create gift card",
"batch_section": "Batch",
"create_batch_cta": "Create {{count}} gift cards",
- "status_options": { "redeemed": "Redeemed", "expired": "Expired", "void": "Void" },
+ "status_options": {
+ "redeemed": "Redeemed",
+ "expired": "Expired",
+ "void": "Void"
+ },
"sheet": {
"create_description": "Issue a single gift card or generate a batch with auto-generated codes.",
"edit_description": "Update the gift card's customer or expiry. The code and amount are immutable once issued."
@@ -1083,19 +995,6 @@
}
}
},
- "validation": {
- "required": "{{field}} is required",
- "positive_number": "{{field}} must be greater than 0",
- "min_length": "{{field}} must be at least {{count}} characters",
- "passwords_dont_match": "Passwords do not match",
- "invalid_email_or_password": "Invalid email or password",
- "invalid_email": "Enter a valid email",
- "invalid_hex_color": "Invalid hex color",
- "invalid_password": "Invalid password",
- "password_required": "Password is required",
- "first_name_required": "First name is required",
- "last_name_required": "Last name is required"
- },
"invitation": {
"missing_token_title": "Missing invitation token",
"missing_token_message": "This link looks incomplete. Ask whoever invited you to send it again.",
@@ -1141,7 +1040,9 @@
"roles_placeholder": "Select a role",
"no_roles": "No roles available."
},
- "edit": { "roles_label": "Roles for this store" },
+ "edit": {
+ "roles_label": "Roles for this store"
+ },
"edit_description": "Update profile details and assigned roles for this staff member.",
"actions_aria": "Actions"
},
@@ -1178,8 +1079,13 @@
"revoke": "Revoke key",
"copy_token_aria": "Copy token"
},
- "badge": { "revoked": "Revoked", "never_used": "Never" },
- "errors": { "failed_to_delete": "Failed to delete key" },
+ "badge": {
+ "revoked": "Revoked",
+ "never_used": "Never"
+ },
+ "errors": {
+ "failed_to_delete": "Failed to delete key"
+ },
"by_email": "by {{email}}"
},
"customers": {
@@ -1268,7 +1174,11 @@
"use_default_addresses": "Use customer's default billing & shipping addresses",
"add_variant": "Add a variant",
"section_discount": "Discount",
- "items_table": { "variant": "Variant", "sku": "SKU", "qty": "Qty" },
+ "items_table": {
+ "variant": "Variant",
+ "sku": "SKU",
+ "qty": "Qty"
+ },
"creates_draft_note": "Creates a draft order. Add payments and complete it after creation."
},
"detail": {
@@ -1407,7 +1317,11 @@
"reference_label": "Reference",
"reference_placeholder": "PO number, vendor invoice, …",
"search_items_placeholder": "Search by name or SKU (3+ chars)…",
- "items_table": { "variant": "Variant", "sku": "SKU", "qty": "Qty" },
+ "items_table": {
+ "variant": "Variant",
+ "sku": "SKU",
+ "qty": "Qty"
+ },
"delete_confirm": {
"title": "Delete this transfer?",
"message": "Stock movements created by this transfer will be reversed."
@@ -1424,7 +1338,11 @@
}
},
"options": {
- "kinds": { "dropdown": "Dropdown", "color_swatch": "Color swatch", "buttons": "Buttons" },
+ "kinds": {
+ "dropdown": "Dropdown",
+ "color_swatch": "Color swatch",
+ "buttons": "Buttons"
+ },
"add_cta": "Add option type",
"create_label": "Create option type",
"create_description": "Define an option that variants can use (e.g. size, color).",
@@ -1527,14 +1445,21 @@
"title": "Stock at this location",
"help": "Adjust on-hand and backorderable counts per variant.",
"search_placeholder": "Search SKU or product…",
- "table": { "variant": "Variant", "on_hand": "On hand", "backorder": "Backorder" },
+ "table": {
+ "variant": "Variant",
+ "on_hand": "On hand",
+ "backorder": "Backorder"
+ },
"empty": "No stock items at this location yet.",
"empty_search": "No stock items match your search."
}
},
"store": {
"load_failed_title": "Failed to load store settings",
- "unit_systems": { "metric": "Metric", "imperial": "Imperial" },
+ "unit_systems": {
+ "metric": "Metric",
+ "imperial": "Imperial"
+ },
"weight_units": {
"kg": "Kilogram (kg)",
"g": "Gram (g)",
diff --git a/packages/dashboard/src/main.tsx b/packages/dashboard/src/main.tsx
index 086c9918f8..b84c345c42 100644
--- a/packages/dashboard/src/main.tsx
+++ b/packages/dashboard/src/main.tsx
@@ -3,13 +3,12 @@ import { QueryClientProvider } from '@tanstack/react-query'
import { RouterProvider } from '@tanstack/react-router'
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
-// Side-effect import: registers i18next with react-i18next before any component
-// calls useTranslation(). Must come before @/router.
-import '@/lib/i18n'
-import { queryClient } from '@/lib/query-client'
-import { AuthProvider } from '@/providers/auth-provider'
-import { PermissionProvider } from '@/providers/permission-provider'
-import { ThemeProvider } from '@/providers/theme-provider'
+// Side-effect import: bootstraps i18next via dashboard-core (base namespace)
+// and merges the app's resource bundle. Must run before any component calls
+// useTranslation() — i.e. before @/router.
+import '@/i18n-setup'
+import { AuthProvider, PermissionProvider, queryClient } from '@spree/dashboard-core'
+import { ThemeProvider } from '@spree/dashboard-ui'
import { router } from '@/router'
import '@spree/dashboard-ui/styles.css'
diff --git a/packages/dashboard/src/nav/default.ts b/packages/dashboard/src/nav/default.ts
index 8eca26f541..fce4315820 100644
--- a/packages/dashboard/src/nav/default.ts
+++ b/packages/dashboard/src/nav/default.ts
@@ -1,3 +1,4 @@
+import { i18n, nav, Subject } from '@spree/dashboard-core'
import {
BarChart3Icon,
HomeIcon,
@@ -7,9 +8,6 @@ import {
TagIcon,
UsersIcon,
} from 'lucide-react'
-import { i18n } from '@/lib/i18n'
-import { nav } from '@/lib/nav-registry'
-import { Subject } from '@/lib/permissions'
nav.add({
key: 'home',
diff --git a/packages/dashboard/src/nav/settings.ts b/packages/dashboard/src/nav/settings.ts
index 5d67186207..88bd2e1bfd 100644
--- a/packages/dashboard/src/nav/settings.ts
+++ b/packages/dashboard/src/nav/settings.ts
@@ -1,3 +1,4 @@
+import { Subject, settingsNav } from '@spree/dashboard-core'
import {
CreditCardIcon,
GlobeIcon,
@@ -9,8 +10,6 @@ import {
UsersRoundIcon,
WarehouseIcon,
} from 'lucide-react'
-import { Subject } from '@/lib/permissions'
-import { settingsNav } from '@/lib/settings-nav-registry'
settingsNav.addGroup({ key: 'store', label: 'Store', position: 100 })
settingsNav.addGroup({ key: 'payments', label: 'Payments & taxes', position: 150 })
diff --git a/packages/dashboard/src/routes/__root.tsx b/packages/dashboard/src/routes/__root.tsx
index 7b83c945af..d24bb29953 100644
--- a/packages/dashboard/src/routes/__root.tsx
+++ b/packages/dashboard/src/routes/__root.tsx
@@ -1,5 +1,5 @@
+import { Toaster } from '@spree/dashboard-ui'
import { createRootRoute, Outlet } from '@tanstack/react-router'
-import { Toaster } from '@/components/ui/sonner'
export const Route = createRootRoute({
component: RootLayout,
diff --git a/packages/dashboard/src/routes/_authenticated.tsx b/packages/dashboard/src/routes/_authenticated.tsx
index 23178d28ae..fa07857db5 100644
--- a/packages/dashboard/src/routes/_authenticated.tsx
+++ b/packages/dashboard/src/routes/_authenticated.tsx
@@ -1,5 +1,5 @@
+import { useAuth } from '@spree/dashboard-core'
import { createFileRoute, Navigate, Outlet } from '@tanstack/react-router'
-import { useAuth } from '@/hooks/use-auth'
export const Route = createFileRoute('/_authenticated')({
component: AuthenticatedLayout,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
index 06641dc7d8..09c26f7787 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
@@ -1,13 +1,11 @@
+import { adminClient, CommandPaletteProvider, StoreProvider } from '@spree/dashboard-core'
import { SidebarInset, SidebarProvider } from '@spree/dashboard-ui'
import { createFileRoute, Outlet, useRouterState } from '@tanstack/react-router'
import { useEffect } from 'react'
-import { adminClient } from '@/client'
import { AppSidebar } from '@/components/spree/app-sidebar'
import { CommandPalette } from '@/components/spree/command-palette/command-palette'
import { SettingsSidebar } from '@/components/spree/settings-sidebar'
import { TopBar } from '@/components/spree/top-bar'
-import { CommandPaletteProvider } from '@/hooks/use-command-palette'
-import { StoreProvider } from '@/providers/store-provider'
export const Route = createFileRoute('/_authenticated/$storeId')({
component: StoreLayout,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
index 35a006ae64..7a388ce0f6 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Address, Customer, Order, StoreCredit } from '@spree/admin-sdk'
+import { mapSpreeErrorsToForm, useCountries, useStore } from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -62,7 +63,6 @@ import { CurrencySelect } from '@/components/spree/currency-select'
import { CustomFieldsCard } from '@/components/spree/custom-fields/custom-fields-card'
import { PageHeader } from '@/components/spree/page-header'
import { TagCombobox } from '@/components/spree/tag-combobox'
-import { useCountries } from '@/hooks/use-countries'
import {
type StoreCreditUpdateParams,
useCreateCustomerStoreCredit,
@@ -79,8 +79,6 @@ import {
useUpdateCustomerAddress,
} from '@/hooks/use-customers'
import { useStoreCreditCategories } from '@/hooks/use-store-credit-categories'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { useStore } from '@/providers/store-provider'
import { type CustomerProfileFormValues, customerProfileFormSchema } from '@/schemas/customer'
import {
type EditStoreCreditFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
index 1a0d7eb491..7681a8d728 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { CustomerGroup, CustomerGroupCreateParams } from '@spree/admin-sdk'
+import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -23,7 +24,6 @@ import { useEffect } from 'react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
@@ -32,9 +32,6 @@ import {
useDeleteCustomerGroup,
useUpdateCustomerGroup,
} from '@/hooks/use-customer-groups'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import {
CUSTOMER_GROUP_DEFAULTS,
type CustomerGroupFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
index e4a5169251..72dfdce938 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Customer } from '@spree/admin-sdk'
+import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
import {
BulkDialog,
Button,
@@ -26,7 +27,6 @@ import { useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import type { BulkAction, BulkActionFormProps } from '@/components/spree/bulk-action-bar'
import { ExportButton } from '@/components/spree/export-button'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
@@ -40,9 +40,6 @@ import {
useBulkRemoveCustomerTags,
useDeleteCustomer,
} from '@/hooks/use-customers'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import {
NEW_CUSTOMER_DEFAULTS,
type NewCustomerFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
index 43380cefd6..61318b0612 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
@@ -1,4 +1,5 @@
import type { DashboardAnalytics } from '@spree/admin-sdk'
+import { adminClient } from '@spree/dashboard-core'
import {
Card,
CardContent,
@@ -20,7 +21,6 @@ import { PackageIcon } from 'lucide-react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Bar, BarChart, CartesianGrid, XAxis } from 'recharts'
-import { adminClient } from '@/client'
export const Route = createFileRoute('/_authenticated/$storeId/')({
component: DashboardPage,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
index 59a92cd406..1b7bdbfe9a 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId.tsx
@@ -1,4 +1,5 @@
import type { Order, Variant } from '@spree/admin-sdk'
+import { adminClient, formatPrice, getInitials, useResourceMutation } from '@spree/dashboard-core'
import {
AddressBlock,
Avatar,
@@ -70,14 +71,11 @@ import {
} from 'lucide-react'
import { type FormEvent, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { adminClient } from '@/client'
import { AddressFormDialog, type AddressParams } from '@/components/spree/address-form-dialog'
import { CustomFieldsCard } from '@/components/spree/custom-fields/custom-fields-card'
import { PageHeader } from '@/components/spree/page-header'
import { TagCombobox } from '@/components/spree/tag-combobox'
import { orderQueryKey, useOrder, useOrderMutation } from '@/hooks/use-order'
-import { useResourceMutation } from '@/hooks/use-resource-mutation'
-import { formatPrice, getInitials } from '@/lib/formatters'
export const Route = createFileRoute('/_authenticated/$storeId/orders/$orderId')({
component: OrderDetailPage,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx
index a411ff8443..53c536a10d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/drafts.tsx
@@ -1,8 +1,8 @@
+import { adminClient } from '@spree/dashboard-core'
import { Button } from '@spree/dashboard-ui'
import { createFileRoute } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { adminClient } from '@/client'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import '@/tables/orders'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx
index a95d2aac79..f7eadb77db 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/index.tsx
@@ -1,7 +1,7 @@
+import { adminClient } from '@spree/dashboard-core'
import { Button } from '@spree/dashboard-ui'
import { createFileRoute, Link } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
-import { adminClient } from '@/client'
import { ExportButton } from '@/components/spree/export-button'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import '@/tables/orders'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
index 9265fc007b..bc329ed9ef 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/new.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Customer, Variant } from '@spree/admin-sdk'
+import { adminClient, formatPrice, mapSpreeErrorsToForm } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -21,12 +22,9 @@ import { TrashIcon } from 'lucide-react'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { adminClient } from '@/client'
import { PageHeader } from '@/components/spree/page-header'
import { ResourceCombobox } from '@/components/spree/resource-combobox'
import { customerAutocompleteProps } from '@/hooks/use-customers'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { formatPrice } from '@/lib/formatters'
import { NEW_ORDER_DEFAULTS, type NewOrderFormValues, newOrderFormSchema } from '@/schemas/order'
export const Route = createFileRoute('/_authenticated/$storeId/orders/new')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
index 9678fa59ef..ff1892be3f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
@@ -15,6 +15,7 @@ import {
import { CSS } from '@dnd-kit/utilities'
import { zodResolver } from '@hookform/resolvers/zod'
import { type Media, type Product, SpreeError, type Variant } from '@spree/admin-sdk'
+import { adminClient, mapSpreeErrorsToForm, useDirectUpload } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -47,7 +48,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import { adminClient } from '@/client'
import { BulkPriceEditorDialog } from '@/components/spree/bulk-price-editor/bulk-price-editor-dialog'
import { CustomFieldsCard } from '@/components/spree/custom-fields/custom-fields-card'
import { PageHeader } from '@/components/spree/page-header'
@@ -57,7 +57,6 @@ import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-aut
import { StoreDatePicker } from '@/components/spree/store-date-picker'
import { TagCombobox } from '@/components/spree/tag-combobox'
import { categoryAutocompleteProps } from '@/hooks/use-categories'
-import { useDirectUpload } from '@/hooks/use-direct-upload'
import { useDeleteProduct, useProduct, useUpdateProduct } from '@/hooks/use-product'
import {
useCreateProductMedia,
@@ -66,7 +65,6 @@ import {
useUpdateProductMedia,
} from '@/hooks/use-product-media'
import { useTaxCategories } from '@/hooks/use-tax-categories'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
import { type ProductFormValues, productFormSchema } from '@/schemas/product'
// Purchasable attributes (sku, barcode, prices, weight, dimensions, stock,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
index 17c7179eb7..f5a2c9e3e8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
@@ -1,4 +1,5 @@
import type { Product } from '@spree/admin-sdk'
+import { adminClient, Subject, usePermissions } from '@spree/dashboard-core'
import {
BulkDialog,
Button,
@@ -24,7 +25,6 @@ import {
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import { adminClient } from '@/client'
import type { BulkAction, BulkActionFormProps } from '@/components/spree/bulk-action-bar'
import { ExportButton } from '@/components/spree/export-button'
import { ResourceMultiAutocomplete } from '@/components/spree/resource-multi-autocomplete'
@@ -41,8 +41,6 @@ import {
useBulkRemoveProductTags,
useCloneProduct,
} from '@/hooks/use-products'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import '@/tables/products'
export const Route = createFileRoute('/_authenticated/$storeId/products/')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
index 597ad91333..1fb614a758 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
@@ -16,6 +16,13 @@ import {
import { CSS } from '@dnd-kit/utilities'
import { zodResolver } from '@hookform/resolvers/zod'
import type { OptionType, OptionTypeCreateParams } from '@spree/admin-sdk'
+import {
+ adminClient,
+ mapSpreeErrorsToForm,
+ Subject,
+ useDirectUpload,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Button,
ColorPicker,
@@ -67,10 +74,8 @@ import {
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
-import { useDirectUpload } from '@/hooks/use-direct-upload'
import {
optionTypesQueryKey,
useCreateOptionType,
@@ -78,9 +83,6 @@ import {
useOptionType,
useUpdateOptionType,
} from '@/hooks/use-option-types'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import {
OPTION_TYPE_DEFAULTS,
OPTION_TYPE_KINDS,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
index 4fa4a9d454..4713b5c0e2 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
@@ -1,15 +1,13 @@
import type { PriceList } from '@spree/admin-sdk'
+import { adminClient, Subject, usePermissions } from '@spree/dashboard-core'
import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useDeletePriceList } from '@/hooks/use-price-lists'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import '@/tables/price-lists'
export const Route = createFileRoute('/_authenticated/$storeId/products/price-lists/')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
index 886c2cba48..59c2db5b68 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
@@ -1,4 +1,5 @@
import type { StockTransfer, Variant } from '@spree/admin-sdk'
+import { adminClient, formatPrice, Subject, usePermissions } from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -32,7 +33,6 @@ import { ArrowLeftRightIcon, EyeIcon, PlusIcon, TrashIcon } from 'lucide-react'
import { useMemo, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useStockLocations } from '@/hooks/use-stock-locations'
@@ -41,9 +41,6 @@ import {
useDeleteStockTransfer,
useStockTransfer,
} from '@/hooks/use-stock-transfers'
-import { formatPrice } from '@/lib/formatters'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import '@/tables/stock-transfers'
const stockTransfersSearchSchema = resourceSearchSchema.extend({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
index 0b93f1924e..888ae43dbf 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Customer, GiftCard } from '@spree/admin-sdk'
+import { mapSpreeErrorsToForm, Subject, usePermissions, useStore } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -37,10 +38,6 @@ import {
useGiftCard,
useUpdateGiftCard,
} from '@/hooks/use-gift-cards'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
-import { useStore } from '@/providers/store-provider'
import {
BATCH_LIMIT,
type GiftCardCreateFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx
index 6d8b25a853..f2e73aa9ca 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/index.tsx
@@ -1,14 +1,12 @@
import type { Promotion } from '@spree/admin-sdk'
+import { adminClient, Subject, usePermissions } from '@spree/dashboard-core'
import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import { useDeletePromotion } from '@/hooks/use-promotions'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import '@/tables/promotions'
export const Route = createFileRoute('/_authenticated/$storeId/promotions/')({
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
index 9c2f6b4f1e..5f6e624de9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
@@ -1,5 +1,12 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { AllowedOrigin, AllowedOriginCreateParams } from '@spree/admin-sdk'
+import {
+ adminClient,
+ i18n,
+ mapSpreeErrorsToForm,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Button,
Field,
@@ -23,7 +30,6 @@ import { PlusIcon } from 'lucide-react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
@@ -32,10 +38,6 @@ import {
useDeleteAllowedOrigin,
useUpdateAllowedOrigin,
} from '@/hooks/use-allowed-origins'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { i18n } from '@/lib/i18n'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import '@/tables/allowed-origins'
// Block paths, queries, fragments, and trailing slashes — the backend rejects
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
index 47327bfa51..f2cdc412c8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { type ApiKey, type ApiKeyCreateParams, SpreeError } from '@spree/admin-sdk'
+import { mapSpreeErrorsToForm, useCopyToClipboard } from '@spree/dashboard-core'
import {
Badge,
Button,
@@ -66,8 +67,6 @@ import { toast } from 'sonner'
import { z } from 'zod/v4'
import { PageHeader } from '@/components/spree/page-header'
import { useApiKeys, useCreateApiKey, useDeleteApiKey, useRevokeApiKey } from '@/hooks/use-api-keys'
-import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
export const Route = createFileRoute('/_authenticated/$storeId/settings/api-keys')({
component: ApiKeysSettingsPage,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
index dc2f914006..ce5ddf44d9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
@@ -1,5 +1,15 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { CustomFieldDefinition } from '@spree/admin-sdk'
+import {
+ adminClient,
+ mapSpreeErrorsToForm,
+ Subject,
+ useCreateCustomFieldDefinitionForSettings,
+ useCustomFieldDefinition,
+ useDeleteCustomFieldDefinitionForSettings,
+ usePermissions,
+ useUpdateCustomFieldDefinitionForSettings,
+} from '@spree/dashboard-core'
import {
Button,
RowActions,
@@ -18,19 +28,9 @@ import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { DefinitionFormFields } from '@/components/spree/custom-fields/definition-form'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
-import {
- useCreateCustomFieldDefinitionForSettings,
- useCustomFieldDefinition,
- useDeleteCustomFieldDefinitionForSettings,
- useUpdateCustomFieldDefinitionForSettings,
-} from '@/hooks/use-custom-fields'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import {
CUSTOM_FIELD_DEFINITION_DEFAULTS,
type CustomFieldDefinitionFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
index 6a43e9643b..a839b82b6e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
@@ -1,5 +1,12 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Market } from '@spree/admin-sdk'
+import {
+ adminClient,
+ mapSpreeErrorsToForm,
+ Subject,
+ usePermissions,
+ useStore,
+} from '@spree/dashboard-core'
import {
Button,
Field,
@@ -25,7 +32,6 @@ import { useEffect, useMemo } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { CountryMultiCombobox } from '@/components/spree/country-combobox'
import { CurrencySelect } from '@/components/spree/currency-select'
@@ -38,10 +44,6 @@ import {
useMarket,
useUpdateMarket,
} from '@/hooks/use-markets'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
-import { useStore } from '@/providers/store-provider'
import {
MARKET_DEFAULTS,
type MarketFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
index b1bfee9157..5bea64b26c 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
@@ -1,5 +1,12 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { PaymentMethod, PreferenceField } from '@spree/admin-sdk'
+import {
+ adminClient,
+ mapSpreeErrorsToForm,
+ Subject,
+ usePermissions,
+ useStore,
+} from '@spree/dashboard-core'
import {
Button,
RowActions,
@@ -19,7 +26,6 @@ import { useEffect, useMemo, useRef, useState } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { PaymentMethodForm } from '@/components/spree/payment-method-editors/payment-method-form'
import type { PaymentMethodFormValues } from '@/components/spree/payment-method-editors/types'
@@ -32,10 +38,6 @@ import {
usePaymentMethodTypes,
useUpdatePaymentMethod,
} from '@/hooks/use-payment-methods'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
-import { useStore } from '@/providers/store-provider'
import {
PAYMENT_METHOD_BASE_DEFAULTS,
PAYMENT_METHOD_CREATE_DEFAULTS,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
index 3dd39bd596..2115a32a2d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { type AdminUser, type Invitation, type Role, SpreeError } from '@spree/admin-sdk'
+import { getInitials, mapSpreeErrorsToForm, useCopyToClipboard } from '@spree/dashboard-core'
import {
Avatar,
AvatarFallback,
@@ -64,7 +65,6 @@ import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { z } from 'zod/v4'
import { PageHeader } from '@/components/spree/page-header'
-import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
import {
useCreateInvitation,
useDeleteInvitation,
@@ -75,8 +75,6 @@ import {
useStaff,
useUpdateStaff,
} from '@/hooks/use-staff'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { getInitials } from '@/lib/formatters'
export const Route = createFileRoute('/_authenticated/$storeId/settings/staff')({
component: StaffSettingsPage,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
index a62d0e163c..5085fbbe1a 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
@@ -5,6 +5,7 @@ import type {
StockLocationCreateParams,
StockLocationUpdateParams,
} from '@spree/admin-sdk'
+import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
import {
Button,
Collapsible,
@@ -38,7 +39,6 @@ import { useEffect, useMemo, useState } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { CountryCombobox } from '@/components/spree/country-combobox'
import { StateCombobox, useCountryStates } from '@/components/spree/country-state-fields'
@@ -50,9 +50,6 @@ import {
useStockLocation,
useUpdateStockLocation,
} from '@/hooks/use-stock-locations'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import {
formValuesToParams,
PICKUP_STOCK_POLICIES,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
index a063eff356..2d06c433f5 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { SpreeError, type Store } from '@spree/admin-sdk'
+import { mapSpreeErrorsToForm } from '@spree/dashboard-core'
import {
Card,
CardContent,
@@ -34,7 +35,6 @@ import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { PageHeader } from '@/components/spree/page-header'
import { useStoreSettings, useUpdateStoreSettings } from '@/hooks/use-store-settings'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
import {
ADMIN_LOCALE_OPTIONS,
type StoreSettingsFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
index a2b02ea3a9..31cace6e1f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { TaxCategory, TaxCategoryCreateParams } from '@spree/admin-sdk'
+import { adminClient, mapSpreeErrorsToForm, Subject, usePermissions } from '@spree/dashboard-core'
import {
Button,
Field,
@@ -25,7 +26,6 @@ import { useEffect } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
import { Can } from '@/components/spree/can'
import { ResourceTable, resourceSearchSchema } from '@/components/spree/resource-table'
import {
@@ -34,9 +34,6 @@ import {
useTaxCategory,
useUpdateTaxCategory,
} from '@/hooks/use-tax-categories'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
-import { Subject } from '@/lib/permissions'
-import { usePermissions } from '@/providers/permission-provider'
import {
TAX_CATEGORY_DEFAULTS,
type TaxCategoryFormValues,
diff --git a/packages/dashboard/src/routes/_authenticated/index.tsx b/packages/dashboard/src/routes/_authenticated/index.tsx
index e79d799c33..b1e3e0cdb4 100644
--- a/packages/dashboard/src/routes/_authenticated/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/index.tsx
@@ -1,6 +1,6 @@
+import { adminClient } from '@spree/dashboard-core'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useEffect } from 'react'
-import { adminClient } from '@/client'
export const Route = createFileRoute('/_authenticated/')({
component: IndexRedirect,
diff --git a/packages/dashboard/src/routes/accept-invitation.$invitationId.tsx b/packages/dashboard/src/routes/accept-invitation.$invitationId.tsx
index 52eace441b..0ab98fcc09 100644
--- a/packages/dashboard/src/routes/accept-invitation.$invitationId.tsx
+++ b/packages/dashboard/src/routes/accept-invitation.$invitationId.tsx
@@ -1,5 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Invitation, SpreeError } from '@spree/admin-sdk'
+import { adminClient, mapSpreeErrorsToForm, useAuth } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -15,9 +16,6 @@ import { createFileRoute, Navigate, useNavigate } from '@tanstack/react-router'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
-import { adminClient } from '@/client'
-import { useAuth } from '@/hooks/use-auth'
-import { mapSpreeErrorsToForm } from '@/lib/form-errors'
import {
type AcceptInvitationSignInFormValues,
type AcceptInvitationSignUpFormValues,
diff --git a/packages/dashboard/src/routes/login.tsx b/packages/dashboard/src/routes/login.tsx
index 79514be5a7..0b7181ea61 100644
--- a/packages/dashboard/src/routes/login.tsx
+++ b/packages/dashboard/src/routes/login.tsx
@@ -1,4 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
+import { useAuth } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -13,7 +14,6 @@ import {
import { createFileRoute, Navigate } from '@tanstack/react-router'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { useAuth } from '@/hooks/use-auth'
import { type LoginFormValues, loginFormSchema } from '@/schemas/auth'
export const Route = createFileRoute('/login')({
diff --git a/packages/dashboard/src/schemas/auth.ts b/packages/dashboard/src/schemas/auth.ts
index d7bd483a6a..1548527c94 100644
--- a/packages/dashboard/src/schemas/auth.ts
+++ b/packages/dashboard/src/schemas/auth.ts
@@ -1,5 +1,5 @@
+import { i18n } from '@spree/dashboard-core'
import { z } from 'zod/v4'
-import { i18n } from '@/lib/i18n'
// Lazy message factories — Zod v4 accepts `{ error: () => string }` as an
// error map, which it invokes per validation. Module-scope `i18n.t(...)`
diff --git a/packages/dashboard/src/schemas/custom-field-definition.ts b/packages/dashboard/src/schemas/custom-field-definition.ts
index 16e2351ac6..b196a9524e 100644
--- a/packages/dashboard/src/schemas/custom-field-definition.ts
+++ b/packages/dashboard/src/schemas/custom-field-definition.ts
@@ -2,9 +2,9 @@ import type {
CustomFieldDefinitionCreateParams,
CustomFieldDefinitionUpdateParams,
} from '@spree/admin-sdk'
+import { i18n } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { i18n } from '@/lib/i18n'
// Mirrors `Spree::Metafield::FIELD_TYPE_TOKENS` on the backend. Keep in sync
// with the typelized `field_type` union on `CustomFieldDefinition`. Labels
diff --git a/packages/dashboard/src/schemas/customer-group.ts b/packages/dashboard/src/schemas/customer-group.ts
index 92b3fbc73f..aea2f177b9 100644
--- a/packages/dashboard/src/schemas/customer-group.ts
+++ b/packages/dashboard/src/schemas/customer-group.ts
@@ -1,7 +1,7 @@
import type { CustomerGroupCreateParams, CustomerGroupUpdateParams } from '@spree/admin-sdk'
+import { blankToNull } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { blankToNull } from '@/lib/form-mappers'
export const customerGroupFormSchema = z.object({
name: z
diff --git a/packages/dashboard/src/schemas/customer.ts b/packages/dashboard/src/schemas/customer.ts
index b16f5c4626..19e4db9519 100644
--- a/packages/dashboard/src/schemas/customer.ts
+++ b/packages/dashboard/src/schemas/customer.ts
@@ -1,6 +1,6 @@
+import { i18n } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { i18n } from '@/lib/i18n'
const customerProfileBase = z.object({
// Server requires a valid email; check client-side so the user gets an
diff --git a/packages/dashboard/src/schemas/gift-card.ts b/packages/dashboard/src/schemas/gift-card.ts
index 2646c9f53b..3df84e44e6 100644
--- a/packages/dashboard/src/schemas/gift-card.ts
+++ b/packages/dashboard/src/schemas/gift-card.ts
@@ -3,9 +3,8 @@ import type {
GiftCardCreateParams,
GiftCardUpdateParams,
} from '@spree/admin-sdk'
+import { blankToNull, blankToUndefined, i18n } from '@spree/dashboard-core'
import { z } from 'zod/v4'
-import { blankToNull, blankToUndefined } from '@/lib/form-mappers'
-import { i18n } from '@/lib/i18n'
// Mirrors `Spree::Config[:gift_card_batch_limit]`. Hardcoded for now; if the
// merchant overrides it we'll surface it via a store-settings endpoint later.
diff --git a/packages/dashboard/src/schemas/option-type.ts b/packages/dashboard/src/schemas/option-type.ts
index ed0afda143..97ea590d4d 100644
--- a/packages/dashboard/src/schemas/option-type.ts
+++ b/packages/dashboard/src/schemas/option-type.ts
@@ -1,7 +1,7 @@
import type { OptionValue, OptionValueParams } from '@spree/admin-sdk'
+import { i18n } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { i18n } from '@/lib/i18n'
// Labels live in `en.json` under `admin.products.options.kinds.*` — consumers
// translate at render time.
diff --git a/packages/dashboard/src/schemas/order.ts b/packages/dashboard/src/schemas/order.ts
index c0b0760688..12a27336ee 100644
--- a/packages/dashboard/src/schemas/order.ts
+++ b/packages/dashboard/src/schemas/order.ts
@@ -1,5 +1,5 @@
+import { i18n } from '@spree/dashboard-core'
import { z } from 'zod/v4'
-import { i18n } from '@/lib/i18n'
/**
* New-order form schema. The "customer OR email" rule is enforced at the
diff --git a/packages/dashboard/src/schemas/price-list.ts b/packages/dashboard/src/schemas/price-list.ts
index d51eac51c2..38683d1b42 100644
--- a/packages/dashboard/src/schemas/price-list.ts
+++ b/packages/dashboard/src/schemas/price-list.ts
@@ -6,10 +6,10 @@ import type {
PriceListUpdateParams,
PriceRule,
} from '@spree/admin-sdk'
+import { blankToNull } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
import { defaultPreferences } from '@/components/spree/preferences-form'
-import { blankToNull } from '@/lib/form-mappers'
export const MATCH_POLICIES = ['all', 'any'] as const
export type MatchPolicy = (typeof MATCH_POLICIES)[number]
diff --git a/packages/dashboard/src/schemas/promotion.ts b/packages/dashboard/src/schemas/promotion.ts
index 243a790c8a..d55f43b148 100644
--- a/packages/dashboard/src/schemas/promotion.ts
+++ b/packages/dashboard/src/schemas/promotion.ts
@@ -1,11 +1,10 @@
+import { emptyToUndefined, i18n } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
import type {
PromotionActionFormDraft,
PromotionRuleFormDraft,
} from '@/components/spree/promotion-editors/types'
-import { emptyToUndefined } from '@/lib/form-mappers'
-import { i18n } from '@/lib/i18n'
export type PromotionKind = 'coupon_code' | 'automatic'
export type MatchPolicy = 'all' | 'any'
diff --git a/packages/dashboard/src/schemas/stock-location.ts b/packages/dashboard/src/schemas/stock-location.ts
index 542ed37efc..cb5fb22953 100644
--- a/packages/dashboard/src/schemas/stock-location.ts
+++ b/packages/dashboard/src/schemas/stock-location.ts
@@ -3,9 +3,9 @@ import type {
StockLocationCreateParams,
StockLocationUpdateParams,
} from '@spree/admin-sdk'
+import { blankToUndefined, emptyToUndefined } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { blankToUndefined, emptyToUndefined } from '@/lib/form-mappers'
// Labels live in `en.json` under `admin.stock_locations.kinds.*` and
// `admin.stock_locations.pickup_stock_policies.*`. Consumers map these
diff --git a/packages/dashboard/src/schemas/store-credit.ts b/packages/dashboard/src/schemas/store-credit.ts
index 88e69fc995..2678ef9dcf 100644
--- a/packages/dashboard/src/schemas/store-credit.ts
+++ b/packages/dashboard/src/schemas/store-credit.ts
@@ -1,6 +1,6 @@
+import { i18n } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { i18n } from '@/lib/i18n'
const amountPositive = () =>
i18n.t('admin.validation.positive_number', {
diff --git a/packages/dashboard/src/schemas/tax-category.ts b/packages/dashboard/src/schemas/tax-category.ts
index e02dc2301b..f9e0a4de59 100644
--- a/packages/dashboard/src/schemas/tax-category.ts
+++ b/packages/dashboard/src/schemas/tax-category.ts
@@ -1,7 +1,7 @@
import type { TaxCategoryCreateParams, TaxCategoryUpdateParams } from '@spree/admin-sdk'
+import { blankToNull } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
-import { blankToNull } from '@/lib/form-mappers'
export const taxCategoryFormSchema = z.object({
name: z.string().min(1, { error: requiredMessage('name') }),
diff --git a/packages/dashboard/src/tables/allowed-origins.tsx b/packages/dashboard/src/tables/allowed-origins.tsx
index a6abfec85a..d9c2818671 100644
--- a/packages/dashboard/src/tables/allowed-origins.tsx
+++ b/packages/dashboard/src/tables/allowed-origins.tsx
@@ -1,8 +1,8 @@
import type { AllowedOrigin } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { GlobeLockIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<AllowedOrigin>('allowed-origins', {
title: i18n.t('admin.allowed_origins.table_title'),
diff --git a/packages/dashboard/src/tables/custom-field-definitions.tsx b/packages/dashboard/src/tables/custom-field-definitions.tsx
index 1904c02675..e51b48a03b 100644
--- a/packages/dashboard/src/tables/custom-field-definitions.tsx
+++ b/packages/dashboard/src/tables/custom-field-definitions.tsx
@@ -1,8 +1,7 @@
import type { CustomFieldDefinition } from '@spree/admin-sdk'
+import { defineTable, i18n } from '@spree/dashboard-core'
import { ActiveBadge, Badge, ResourceNameCell } from '@spree/dashboard-ui'
import { TagIcon } from 'lucide-react'
-import { i18n } from '@/lib/i18n'
-import { defineTable } from '@/lib/table-registry'
import {
DEFAULT_RESOURCE_TYPES,
FIELD_TYPES,
diff --git a/packages/dashboard/src/tables/customer-groups.tsx b/packages/dashboard/src/tables/customer-groups.tsx
index 0cf27c6cd0..8c489925a2 100644
--- a/packages/dashboard/src/tables/customer-groups.tsx
+++ b/packages/dashboard/src/tables/customer-groups.tsx
@@ -1,7 +1,7 @@
import type { CustomerGroup } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ResourceNameCell } from '@spree/dashboard-ui'
import { UsersRoundIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<CustomerGroup>('customer-groups', {
title: 'Customer Groups',
diff --git a/packages/dashboard/src/tables/customers.tsx b/packages/dashboard/src/tables/customers.tsx
index 3efe9edf49..2a24ea98ad 100644
--- a/packages/dashboard/src/tables/customers.tsx
+++ b/packages/dashboard/src/tables/customers.tsx
@@ -1,10 +1,9 @@
+import { defineTable, Subject } from '@spree/dashboard-core'
import { ActiveBadge, Badge, RelativeTime, TagList } from '@spree/dashboard-ui'
import { Link } from '@tanstack/react-router'
import i18n from 'i18next'
import { UsersIcon } from 'lucide-react'
import { customerGroupAutocompleteProps } from '@/hooks/use-customer-groups'
-import { Subject } from '@/lib/permissions'
-import { defineTable } from '@/lib/table-registry'
defineTable('customers', {
title: 'Customers',
diff --git a/packages/dashboard/src/tables/gift-cards.tsx b/packages/dashboard/src/tables/gift-cards.tsx
index f00177902d..906effd1b9 100644
--- a/packages/dashboard/src/tables/gift-cards.tsx
+++ b/packages/dashboard/src/tables/gift-cards.tsx
@@ -1,11 +1,11 @@
import type { GiftCard } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { Badge, RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { GiftIcon } from 'lucide-react'
import { adminUserAutocompleteProps } from '@/hooks/use-admin-users'
import { customerAutocompleteProps } from '@/hooks/use-customers'
import { giftCardBatchAutocompleteProps } from '@/hooks/use-gift-cards'
-import { defineTable } from '@/lib/table-registry'
// Server `Spree::GiftCard#display_state` exposes "expired" when the card
// is past its expiration date, even though the underlying column is still
diff --git a/packages/dashboard/src/tables/markets.tsx b/packages/dashboard/src/tables/markets.tsx
index cf30e0c9cf..43a0c0cf63 100644
--- a/packages/dashboard/src/tables/markets.tsx
+++ b/packages/dashboard/src/tables/markets.tsx
@@ -1,8 +1,8 @@
import type { Market } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ActiveBadge, Badge, ResourceNameCell } from '@spree/dashboard-ui'
import { GlobeIcon } from 'lucide-react'
import { LocaleLabel } from '@/components/spree/locale-select'
-import { defineTable } from '@/lib/table-registry'
defineTable<Market>('markets', {
title: 'Markets',
diff --git a/packages/dashboard/src/tables/option-types.tsx b/packages/dashboard/src/tables/option-types.tsx
index c4c9746159..46afdf123d 100644
--- a/packages/dashboard/src/tables/option-types.tsx
+++ b/packages/dashboard/src/tables/option-types.tsx
@@ -1,7 +1,7 @@
import type { OptionType } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ActiveBadge, Badge, RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
import { ListChecksIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
const KIND_LABELS: Record<string, string> = {
dropdown: 'Dropdown',
diff --git a/packages/dashboard/src/tables/orders.tsx b/packages/dashboard/src/tables/orders.tsx
index c2584a0428..2dfd95697d 100644
--- a/packages/dashboard/src/tables/orders.tsx
+++ b/packages/dashboard/src/tables/orders.tsx
@@ -1,9 +1,8 @@
+import { defineTable, Subject } from '@spree/dashboard-core'
import { RelativeTime, StatusBadge, TagList } from '@spree/dashboard-ui'
import { Link } from '@tanstack/react-router'
import i18n from 'i18next'
import { ShoppingCartIcon } from 'lucide-react'
-import { Subject } from '@/lib/permissions'
-import { defineTable } from '@/lib/table-registry'
defineTable('orders', {
title: 'Orders',
diff --git a/packages/dashboard/src/tables/payment-methods.tsx b/packages/dashboard/src/tables/payment-methods.tsx
index d9cab8b2a4..13f52cc133 100644
--- a/packages/dashboard/src/tables/payment-methods.tsx
+++ b/packages/dashboard/src/tables/payment-methods.tsx
@@ -1,7 +1,7 @@
import type { PaymentMethod } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ActiveBadge, Badge, ResourceNameCell } from '@spree/dashboard-ui'
import { CreditCardIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<PaymentMethod>('payment-methods', {
title: 'Payment Methods',
diff --git a/packages/dashboard/src/tables/price-lists.tsx b/packages/dashboard/src/tables/price-lists.tsx
index 77628e9b21..366b0a9b97 100644
--- a/packages/dashboard/src/tables/price-lists.tsx
+++ b/packages/dashboard/src/tables/price-lists.tsx
@@ -1,9 +1,9 @@
import type { PriceList } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ResourceNameCell } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { TagsIcon } from 'lucide-react'
import { PriceListStatusBadge } from '@/components/spree/price-list-editors/status-badge'
-import { defineTable } from '@/lib/table-registry'
defineTable<PriceList>('price-lists', {
title: i18n.t('admin.nav.price_lists'),
diff --git a/packages/dashboard/src/tables/products.tsx b/packages/dashboard/src/tables/products.tsx
index 53c9013daa..79c927cb4a 100644
--- a/packages/dashboard/src/tables/products.tsx
+++ b/packages/dashboard/src/tables/products.tsx
@@ -1,11 +1,9 @@
+import { defineTable, formatPrice, Subject } from '@spree/dashboard-core'
import { RelativeTime, StatusBadge, TagList } from '@spree/dashboard-ui'
import { Link } from '@tanstack/react-router'
import i18n from 'i18next'
import { PackageIcon } from 'lucide-react'
import { categoryAutocompleteProps } from '@/hooks/use-categories'
-import { formatPrice } from '@/lib/formatters'
-import { Subject } from '@/lib/permissions'
-import { defineTable } from '@/lib/table-registry'
defineTable('products', {
title: i18n.t('admin.nav.products'),
diff --git a/packages/dashboard/src/tables/promotions.tsx b/packages/dashboard/src/tables/promotions.tsx
index 673e796a75..90aa4fd694 100644
--- a/packages/dashboard/src/tables/promotions.tsx
+++ b/packages/dashboard/src/tables/promotions.tsx
@@ -1,7 +1,7 @@
import type { Promotion } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { Badge, RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
import { TagIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<Promotion>('promotions', {
title: 'Promotions',
diff --git a/packages/dashboard/src/tables/stock-locations.tsx b/packages/dashboard/src/tables/stock-locations.tsx
index 2356499e7b..74bd40bc3d 100644
--- a/packages/dashboard/src/tables/stock-locations.tsx
+++ b/packages/dashboard/src/tables/stock-locations.tsx
@@ -1,7 +1,7 @@
import type { StockLocation } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ActiveBadge, ResourceNameCell } from '@spree/dashboard-ui'
import { WarehouseIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<StockLocation>('stock-locations', {
title: 'Stock Locations',
diff --git a/packages/dashboard/src/tables/stock-transfers.tsx b/packages/dashboard/src/tables/stock-transfers.tsx
index c177131501..d1db04bae9 100644
--- a/packages/dashboard/src/tables/stock-transfers.tsx
+++ b/packages/dashboard/src/tables/stock-transfers.tsx
@@ -1,8 +1,8 @@
import type { StockTransfer } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { Badge, RelativeTime, ResourceNameCell } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { ArrowLeftRightIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<StockTransfer>('stock-transfers', {
title: 'Stock Transfers',
diff --git a/packages/dashboard/src/tables/tax-categories.tsx b/packages/dashboard/src/tables/tax-categories.tsx
index 771a525ad4..6febf01010 100644
--- a/packages/dashboard/src/tables/tax-categories.tsx
+++ b/packages/dashboard/src/tables/tax-categories.tsx
@@ -1,7 +1,7 @@
import type { TaxCategory } from '@spree/admin-sdk'
+import { defineTable } from '@spree/dashboard-core'
import { ActiveBadge, ResourceNameCell } from '@spree/dashboard-ui'
import { PercentIcon } from 'lucide-react'
-import { defineTable } from '@/lib/table-registry'
defineTable<TaxCategory>('tax-categories', {
title: 'Tax Categories',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1c7ce3ae08..ba8da7fa50 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -155,6 +155,9 @@ importers:
'@spree/admin-sdk':
specifier: workspace:^
version: link:../admin-sdk
+ '@spree/dashboard-core':
+ specifier: workspace:^
+ version: link:../dashboard-core
'@spree/dashboard-ui':
specifier: workspace:^
version: link:../dashboard-ui
@@ -288,15 +291,45 @@ importers:
packages/dashboard-core:
dependencies:
+ '@spree/admin-sdk':
+ specifier: workspace:^
+ version: link:../admin-sdk
'@spree/dashboard-ui':
specifier: workspace:^
version: link:../dashboard-ui
+ '@tanstack/react-hotkeys':
+ specifier: ^0.10.0
+ '@tanstack/react-query':
+ specifier: ^5.100.9
+ version: 5.100.9([email protected])
+ '@tanstack/react-router':
+ specifier: ^1.169.2
+ i18next:
+ specifier: ^26.2.0
+ version: 26.2.0([email protected])
+ lucide-react:
+ specifier: ^1.14.0
+ version: 1.14.0([email protected])
react:
specifier: ^19.2.6
version: 19.2.6
react-dom:
specifier: ^19.2.6
version: 19.2.6([email protected])
+ react-hook-form:
+ specifier: ^7.75.0
+ version: 7.75.0([email protected])
+ react-i18next:
+ specifier: ^17.0.8
+ sonner:
+ specifier: ^2.0.7
+ spark-md5:
+ specifier: ^3.0.2
+ version: 3.0.2
devDependencies:
'@types/react':
specifier: ^19.2.14
@@ -304,9 +337,15 @@ importers:
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/[email protected])
+ '@types/spark-md5':
+ specifier: ^3.0.5
+ version: 3.0.5
typescript:
specifier: ~6.0.3
version: 6.0.3
+ vite:
+ specifier: ^8.0.11
packages/dashboard-ui:
dependencies:
@@ -397,6 +436,9 @@ importers:
shadcn:
specifier: ^4.7.0
version: 4.7.0(@types/[email protected])([email protected])
+ sonner:
+ specifier: ^2.0.7
tailwind-merge:
specifier: ^3.5.0
version: 3.5.0