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.

Add the dashboard role editor on the shared permission catalog

Damian Legawiec51a6dea859e7
diff --git a/docs/developer/customization/permissions.mdx b/docs/developer/customization/permissions.mdx
index 0b85f53590..043854bf23 100644
--- a/docs/developer/customization/permissions.mdx
+++ b/docs/developer/customization/permissions.mdx
@@ -2,266 +2,122 @@
title: Permissions
---
-Spree uses [CanCanCan](https://github.com/CanCanCommunity/cancancan) for authorization. The permission system allows you to define granular access control for different user roles.
+Spree authorizes staff through **roles** that hold flat **permission keys** from a single catalog. Merchants manage everything in the dashboard — no Ruby required — and the same vocabulary powers secret API key scopes, so a role grant and a key scope always mean the same thing.
-## Permission Sets (Recommended)
+## The permission catalog
-Permission Sets provide a clean, modular way to manage permissions. Each permission set is a reusable group of permissions that can be assigned to roles.
+Every grantable capability is a key of the form `read_<resource>` or `write_<resource>` — `read_orders`, `write_products`, `write_staff`, and so on. Each resource covers a slice of the Admin API and the models behind it; `write_*` implies the matching `read_*`.
-### How It Works
+Discover the catalog at runtime:
-1. **Roles** - Determine which permission sets govern a user's access (e.g., `admin`, `customer_service`)
-2. **Permission Sets** - Contain the logic defining what actions users can perform on resources
-3. **Role Configuration** - Associates roles with their corresponding permission sets
-
-### Configuring Roles
-
-In your `config/initializers/spree.rb`, configure which permission sets are assigned to each role:
-
-```ruby
-Rails.application.config.after_initialize do
- # Default permissions for all users (guests and logged-in customers)
- Spree.permissions.assign(:default, [Spree::PermissionSets::DefaultCustomer])
-
- # Full admin access
- Spree.permissions.assign(:admin, [Spree::PermissionSets::SuperUser])
-
- # Custom role with specific permissions
- Spree.permissions.assign(:customer_service, [
- Spree::PermissionSets::DashboardDisplay,
- Spree::PermissionSets::OrderManagement,
- Spree::PermissionSets::UserDisplay
- ])
-
- # Merchandiser role for product management
- Spree.permissions.assign(:merchandiser, [
- Spree::PermissionSets::DashboardDisplay,
- Spree::PermissionSets::ProductManagement,
- Spree::PermissionSets::StockManagement
- ])
-end
+```bash
+GET /api/v3/admin/permissions
```
-### Built-in Permission Sets
-
-| Permission Set | Description |
-|---------------|-------------|
-| `SuperUser` | Full admin access with safety restrictions |
-| `DefaultCustomer` | Basic storefront permissions (browse, checkout, manage own account) |
-| `DashboardDisplay` | View admin dashboard |
-| `OrderDisplay` | Read-only access to orders |
-| `OrderManagement` | Full order management (view, edit, refund, etc.) |
-| `ProductDisplay` | Read-only access to products and catalog |
-| `ProductManagement` | Full catalog management (products, variants, taxonomies) |
-| `UserDisplay` | Read-only access to users |
-| `UserManagement` | Full user management |
-| `StockDisplay` | Read-only access to inventory |
-| `StockManagement` | Full inventory management |
-| `PromotionManagement` | Manage promotions and coupon codes |
-| `ConfigurationManagement` | Manage store settings, shipping, taxes, etc. |
-| `RoleManagement` | Manage roles (except the protected admin role) |
-
-### Creating Custom Permission Sets
-
-Create a new permission set in `app/models/spree/permission_sets/`:
+Each entry describes the key, its resource, its `read`/`write` kind, a UI group, and localized labels — the role editor and the API-key scope picker are both rendered from this endpoint.
-```ruby
-# app/models/spree/permission_sets/warehouse_management.rb
-module Spree
- module PermissionSets
- class WarehouseManagement < Base
- def activate!
- can :manage, Spree::StockItem
- can :manage, Spree::StockLocation
- can :manage, Spree::StockMovement
- can :manage, Spree::Shipment
- can [:read, :admin], Spree::Order
- end
- end
- end
-end
-```
+The important granularity choice: keys are **per resource, not per action**. There is no `cancel_orders` — `write_orders` covers all order writes. The money-adjacent areas are separate resources (`payments`, `refunds`, `gift_cards`, `store_credits`), so "customer service can view orders but cannot refund" is simply `read_orders` without `write_refunds`.
-Then assign it to a role:
+## Managing roles
-```ruby
-Spree.permissions.assign(:warehouse_staff, [
- Spree::PermissionSets::DashboardDisplay,
- Spree::PermissionSets::WarehouseManagement
-])
-```
+Roles are data. Create and edit them in the dashboard under **Settings → Roles**: each role has a name, a description, and a permission grid; staff are assigned roles per store from **Settings → Staff**.
-### Permission Set API
+The same surface exists on the Admin API:
-Within a permission set, you have access to:
-
-- `can(action, subject, conditions = {})` - Grant permission
-- `cannot(action, subject, conditions = {})` - Deny permission
-- `can?(action, subject)` - Check if permission exists
-- `user` - The current user
-- `store` - The current store (for multi-store setups)
-
-```ruby
-module Spree
- module PermissionSets
- class OrderManagementForOwnOrders < Base
- def activate!
- # Users can only manage orders they created
- can :manage, Spree::Order, created_by_id: user.id
-
- # But cannot cancel any order
- cannot :cancel, Spree::Order
-
- # Unless it's cancellable
- can :cancel, Spree::Order, &:allow_cancel?
- end
- end
- end
-end
+```bash
+GET /api/v3/admin/roles
+POST /api/v3/admin/roles # { name, description, permissions: ["read_orders", ...] }
+PATCH /api/v3/admin/roles/:id
+DELETE /api/v3/admin/roles/:id
```
-### Managing Permission Configuration
+For reproducible environments, seed roles with plain ActiveRecord:
```ruby
-# Assign permission sets to a role
-Spree.permissions.assign(:customer_service, [
- Spree::PermissionSets::OrderDisplay,
- Spree::PermissionSets::UserManagement
-])
-
-# Add more permission sets to an existing role
-Spree.permissions.assign(:customer_service, [
- Spree::PermissionSets::StockDisplay
-])
-
-# Clear all permission sets from a role
-Spree.permissions.clear(:customer_service)
-
-# Check what permission sets a role has
-Spree.permissions.permission_sets_for(:customer_service)
-# => [Spree::PermissionSets::OrderDisplay, ...]
-
-# Check if a role is configured
-Spree.permissions.role_configured?(:customer_service)
-# => true
+# db/seeds.rb
+Spree::Role.find_or_create_by!(name: 'support')
+ .update!(permissions: %w[read_orders read_customers], description: 'Read-only support')
```
-## Users and Roles
+A few rules the server enforces everywhere:
-Spree comes with an `admin` role by default. You can create more roles in the Admin Panel or via Rails console:
+- **The `admin` role is protected.** It always grants everything and cannot be renamed, re-permissioned, or deleted.
+- **Locked roles.** A role with `mutable: false` (set from seeds or the console) renders read-only in the dashboard — for roles a host application does not want store staff to edit.
+- **A role in use cannot be deleted.** Reassign staff and revoke pending invitations first.
+- **No privilege escalation.** A caller can only grant permissions they effectively hold — when creating or editing roles, assigning roles to staff, inviting staff, or minting API keys. Only admins can grant the `admin` role.
-```ruby
-Spree::Role.find_or_create_by(name: 'customer_service')
-Spree::Role.find_or_create_by(name: 'merchandiser')
-Spree::Role.find_or_create_by(name: 'warehouse_staff')
-```
+## How enforcement works
-Assign a role to a user:
+Every Admin API controller declares the resource it belongs to. On each request the principal's keys — a staff member's role permissions, or a secret key's scopes — are checked against `read_<resource>` or `write_<resource>` depending on the action. A missing key produces a 403 that names it:
-```ruby
-user = Spree.user_class.find_by(email: '[email protected]')
-role = Spree::Role.find_by(name: 'customer_service')
-user.spree_roles << role
+```json
+{
+ "error": {
+ "code": "access_denied",
+ "message": "Missing permission: write_orders",
+ "details": { "required_permission": "write_orders" }
+ }
+}
```
-### Default Role Behavior
+Behind that gate, keys compile to [CanCanCan](https://github.com/CanCanCommunity/cancancan) rules (a read key grants `can [:read, :admin]` on the resource's models; a write key grants `can :manage`), which handle record-level concerns. `GET /api/v3/admin/me` returns both views — the rule dump the dashboard mirrors for UI gating, and `permission_keys`, the flat list of keys the user holds on the current store.
-- Users with **no roles assigned** automatically get the `:default` role permissions
-- No `RoleUser` records are created for regular customers
-- Only users with special permissions need explicit role assignments
+Storefront customers are **not** part of this system. Customer authorization is ownership — carts and orders by token or account, addresses by `user_id` — enforced by a fixed internal baseline and the Store API's scoped lookups. There is nothing to configure.
-## Legacy Approach: Custom Ability Classes
+## Extensions: registering permissions
-<Note>
-The permission sets approach above is recommended for new projects. The legacy approach below is supported for backward compatibility.
-</Note>
+An extension registers its resources into the catalog once. The keys appear in the role editor, become mintable API-key scopes, and gate the extension's admin endpoints — no further wiring:
-### Adding Custom Permissions via Decorator
+```ruby
+# in your engine's initializer
+Spree.permissions.register_resource(:reviews, group: :catalog, subjects: -> {
+ [SpreeReviews::Review]
+})
+```
-Create a new ability class in `app/models/customer_service_ability.rb`:
+- `group` places the row in the permission pickers (`:orders`, `:catalog`, `:marketing`, `:customers`, `:settings`, `:access`, `:analytics` — or your own).
+- `subjects` is a lambda returning the CanCanCan subjects the keys grant; it resolves lazily, so load order does not matter.
+- Pass `write: false` for read-only resources (like the analytics dashboard).
-```ruby
-class CustomerServiceAbility
- include CanCan::Ability
+Localize the labels in your engine's locale file:
- def initialize(user)
- if user.respond_to?(:has_spree_role?) && user.has_spree_role?('customer_service')
- can :manage, Spree::Order
- end
- end
-end
+```yaml
+en:
+ spree:
+ permissions_catalog:
+ resources:
+ reviews:
+ label: Reviews
+ description: Moderate and reply to product reviews
```
-Register it via a decorator in `app/models/spree/ability_decorator.rb`:
+Your admin controllers then declare the same resource:
```ruby
-module Spree
- module AbilityDecorator
- def abilities_to_register
- [CustomerServiceAbility]
- end
- end
-
- Ability.prepend(AbilityDecorator)
+class SpreeReviews::Admin::ReviewsController < Spree::Api::V3::Admin::ResourceController
+ scoped_resource :reviews
end
```
-### Replacing the Ability Class
-
-You can replace the entire ability class via [Dependencies](/developer/customization/dependencies):
+## Advanced: record-level custom rules
-```ruby
-# config/initializers/spree.rb
-Spree::Dependencies.ability_class = 'CustomAbility'
-```
+The catalog is deliberately flat. When a host application needs rules the catalog cannot express — regional restrictions, ownership conditions — register a plain `CanCan::Ability` class; its rules merge into every ability:
```ruby
-# app/models/custom_ability.rb
-class CustomAbility < Spree::Ability
- def initialize(user, options = {})
- alias_cancan_delete_action
-
- @user = user || Spree.user_class.new
- @store = options[:store] || Spree::Current.store
-
- if @user.respond_to?(:has_spree_role?) && @user.has_spree_role?('admin')
- apply_admin_permissions(@user, options)
- elsif @user.respond_to?(:has_spree_role?) && @user.has_spree_role?(:customer_service)
- apply_customer_service_permissions(@user)
- else
- apply_user_permissions(@user, options)
- end
-
- protect_admin_role
- end
+# app/models/regional_support_ability.rb
+class RegionalSupportAbility
+ include CanCan::Ability
- protected
+ def initialize(user)
+ return unless user.respond_to?(:market_id) && user.market_id
- def apply_customer_service_permissions(user)
- can :manage, Spree::Order
- can [:read, :admin], Spree.user_class
+ cannot :manage, Spree::Order
+ can [:read, :admin], Spree::Order, market_id: user.market_id
end
end
-```
-
-## CanCanCan Reference
-Spree's permission system is built on CanCanCan. Key concepts:
-
-- `can :action, Subject` - Grant permission
-- `can :manage, Subject` - Grant all actions (create, read, update, destroy)
-- `cannot :action, Subject` - Explicitly deny permission
-- `can :action, Subject, conditions` - Conditional permission
-
-```ruby
-# Examples
-can :read, Spree::Product # Can read any product
-can :manage, Spree::Order, user_id: user.id # Can manage own orders
-can :update, Spree::Order do |order| # Block conditions
- order.user == user && !order.completed?
-end
-cannot :destroy, Spree::Order # Cannot destroy any order
-can :destroy, Spree::Order, &:can_be_deleted? # Unless it's deletable
+# config/initializers/spree.rb
+Spree::Ability.register_ability(RegionalSupportAbility)
```
-See the [CanCanCan documentation](https://github.com/CanCanCommunity/cancancan) for more details.
+Keep record-state rules ("a completed order cannot be deleted") out of abilities entirely — they belong on models and workflows, where every caller hits them, including secret API keys that never consult CanCanCan.
diff --git a/docs/developer/dashboard/customization/permissions.mdx b/docs/developer/dashboard/customization/permissions.mdx
index bd08811332..410d802ac6 100644
--- a/docs/developer/dashboard/customization/permissions.mdx
+++ b/docs/developer/dashboard/customization/permissions.mdx
@@ -101,21 +101,18 @@ function ReportsPage() {
The same `permissions` object backs the nav registry's `if` predicate, so you can move logic between the two without changing behaviour. For declarative gating, `<Can I="update" a="Spree::Order">…</Can>` (also from `@spree/dashboard-core`) renders children only when the check passes.
-## Custom abilities
+## Custom permissions
-If your customization introduces a new model on the backend, extend the CanCanCan ability there (typically a decorator on `Spree::PermissionSets::DefaultCustomer` or `Spree::PermissionSets::DashboardManagement`):
+If your customization introduces a new model on the backend, register it as a permission catalog resource so its keys become grantable to roles (and mintable as API-key scopes):
```ruby
-# config/initializers/spree.rb (host app)
-Spree::PermissionSets::DashboardManagement.class_eval do
- def activate!
- super
- can :manage, MyApp::Report
- end
-end
+# in your engine's initializer (host app or extension)
+Spree.permissions.register_resource(:reports, group: :analytics, subjects: -> {
+ [MyApp::Report]
+})
```
-After that, `permissions.can('read', 'MyApp::Report')` resolves in the dashboard exactly like a first-party check — the abilities ship to the dashboard with the current-user response (`GET /api/v3/admin/me`) at sign-in.
+After that, any role granted `read_reports` makes `permissions.can('read', 'MyApp::Report')` resolve in the dashboard exactly like a first-party check — the abilities ship to the dashboard with the current-user response (`GET /api/v3/admin/me`) at sign-in, alongside `permission_keys`, the flat key list. For record-level rules the catalog can't express, register a plain `CanCan::Ability` class via `Spree::Ability.register_ability` — see [Permissions](/developer/customization/permissions).
## Reference
diff --git a/docs/developer/upgrades/5.6-to-6.0.mdx b/docs/developer/upgrades/5.6-to-6.0.mdx
index abc5e1b5c5..446a82ca9d 100644
--- a/docs/developer/upgrades/5.6-to-6.0.mdx
+++ b/docs/developer/upgrades/5.6-to-6.0.mdx
@@ -388,6 +388,36 @@ Every rename keeps the legacy name working for one release with a deprecation wa
| Calling cart services with `order:` kwargs | `cart:` kwargs |
| `OrderWalkthrough` (testing support) | factories: `:cart_ready_for_delivery`, `:cart_ready_to_complete`, `:completed_order_with_totals` |
+## Staff permissions: roles are data
+
+Permission sets are **removed with no bridge**. Staff roles now hold flat permission keys from one catalog — the same `read_<resource>` / `write_<resource>` vocabulary secret API keys use — and are managed as data: in the dashboard (Settings → Roles), through the Admin API (`/api/v3/admin/roles`), or in seeds. Code no longer defines what a role can do.
+
+| Removed | Use instead |
+|---|---|
+| `Spree::PermissionSets::*` (all classes) | catalog keys on the role row: `Spree::Role#permissions` |
+| `Spree.permissions.assign(:role, [sets])` | the role editor, `POST /api/v3/admin/roles`, or plain ActiveRecord in seeds |
+| Custom permission sets with record-level rules | `Spree::Ability.register_ability(MyAbility)` — a plain `CanCan::Ability` class |
+| `Spree::ApiKey::SCOPES` | `Spree::ApiKey.known_scopes` (derived from the catalog) |
+
+Old initializers fail loudly at boot: the set constants raise `NameError`, and `Spree.permissions.assign` raises with directions. **Recreate your custom roles before deploying** — a pre-existing role row comes up with no permissions, so staff holding it are locked out (fail closed) until its permissions are filled in:
+
+```ruby
+# db/seeds.rb — "roles as code" is plain ActiveRecord now
+Spree::Role.find_or_create_by!(name: 'support')
+ .update!(permissions: %w[read_orders read_customers])
+```
+
+Storefront customers are not part of this system: the old `:default` role and `DefaultCustomer` set became internal ability code, and customers never resolve roles. Extensions register their resources into the catalog once, which makes them grantable to roles **and** mintable as API-key scopes:
+
+```ruby
+Spree.permissions.register_resource(:reviews, group: :catalog, subjects: -> { [SpreeReviews::Review] })
+```
+
+Two enforcement changes on the Admin API:
+
+- **JWT staff pass the same per-controller key gate as secret keys.** A request whose principal lacks `<read|write>_<resource>` gets a 403 with `details.required_permission` naming the missing key.
+- **Staff endpoints moved out of the `settings` scope.** `/admin_users`, `/invitations`, and `/roles` now require the new `read_staff` / `write_staff` scopes; secret keys minted with `settings` before 6.0 lose those endpoints. `/countries` and `/locales` became scope-exempt reference data.
+
## For extension authors
- **Don't reach for model business methods from services** — 6.0 code style writes behavior inline in service/workflow steps; models keep data, validations, predicates and persistence primitives. Extensions patching removed model methods (`finalize!` internals, updater hooks) should move to workflow hooks (`Spree.hooks.register('carts.complete.before_finalize') { |flow| ... }` — handlers receive the workflow instance) or event subscribers.
diff --git a/packages/dashboard-core/src/lib/permissions.ts b/packages/dashboard-core/src/lib/permissions.ts
index 6159029a70..d43e0f5faa 100644
--- a/packages/dashboard-core/src/lib/permissions.ts
+++ b/packages/dashboard-core/src/lib/permissions.ts
@@ -44,6 +44,8 @@ export const Subject = {
PromotionAction: 'Spree::PromotionAction',
PromotionRule: 'Spree::PromotionRule',
GiftCard: 'Spree::GiftCard',
+ Role: 'Spree::Role',
+ Invitation: 'Spree::Invitation',
Market: 'Spree::Market',
WebhookEndpoint: 'Spree::WebhookEndpoint',
WebhookDelivery: 'Spree::WebhookDelivery',
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index 36b01fc1bb..dbf089fc04 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -1,47 +1,48 @@
{
"admin": {
"actions": {
+ "actions_menu": "الإجراءات",
"add": "إضافة",
+ "adding": "جارٍ الإضافة…",
"apply": "تطبيق",
+ "back": "رجوع",
"cancel": "إلغاء",
"clear": "مسح",
- "revoke": "إلغاء التفويض",
"close": "إغلاق",
"confirm": "تأكيد",
- "done": "تم",
+ "copied": "تم النسخ!",
+ "copy": "نسخ",
"create": "إنشاء",
"creating": "جارٍ الإنشاء…",
"delete": "حذف",
"deleting": "جارٍ الحذف…",
"discard": "تجاهل",
"discard_changes": "تجاهل التغييرات",
+ "done": "تم",
+ "duplicate": "تكرار",
"edit": "تعديل",
- "view": "عرض",
+ "export": "تصدير",
+ "exporting": "جارٍ التصدير…",
"generate": "إنشاء",
+ "hide": "إخفاء",
+ "import": "استيراد",
+ "invite": "دعوة",
+ "more_actions": "المزيد من الإجراءات",
"remove": "إزالة",
+ "reset": "إعادة تعيين",
+ "revoke": "إلغاء التفويض",
"save": "حفظ",
"saving": "جارٍ الحفظ…",
"search": "بحث",
- "sign_in": "تسجيل الدخول",
- "signing_in": "جارٍ تسجيل الدخول…",
- "view_all": "عرض الكل",
- "view_details": "عرض التفاصيل",
- "copy": "نسخ",
- "copied": "تم النسخ!",
- "export": "تصدير",
- "exporting": "جارٍ التصدير…",
- "import": "استيراد",
- "invite": "دعوة",
"send": "إرسال",
"send_invitation": "إرسال دعوة",
"sending": "جارٍ الإرسال…",
- "reset": "إعادة تعيين",
"show": "إظهار",
- "hide": "إخفاء",
- "back": "رجوع",
- "actions_menu": "الإجراءات",
- "more_actions": "المزيد من الإجراءات",
- "adding": "جارٍ الإضافة…"
+ "sign_in": "تسجيل الدخول",
+ "signing_in": "جارٍ تسجيل الدخول…",
+ "view": "عرض",
+ "view_all": "عرض الكل",
+ "view_details": "عرض التفاصيل"
},
"row_actions": {
"menu_label": "فتح الإجراءات",
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index 5e847f655e..e0ed7674da 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -1,47 +1,48 @@
{
"admin": {
"actions": {
+ "actions_menu": "Aktionen",
"add": "Hinzufügen",
+ "adding": "Hinzufügen…",
"apply": "Anwenden",
+ "back": "Zurück",
"cancel": "Abbrechen",
"clear": "Zurücksetzen",
- "revoke": "Widerrufen",
"close": "Schließen",
"confirm": "Bestätigen",
- "done": "Fertig",
+ "copied": "Kopiert!",
+ "copy": "Kopieren",
"create": "Erstellen",
"creating": "Wird erstellt…",
"delete": "Löschen",
"deleting": "Wird gelöscht…",
"discard": "Verwerfen",
"discard_changes": "Änderungen verwerfen",
+ "done": "Fertig",
+ "duplicate": "Duplizieren",
"edit": "Bearbeiten",
- "view": "Anzeigen",
+ "export": "Exportieren",
+ "exporting": "Wird exportiert…",
"generate": "Generieren",
+ "hide": "Ausblenden",
+ "import": "Importieren",
+ "invite": "Einladen",
+ "more_actions": "Weitere Aktionen",
"remove": "Entfernen",
+ "reset": "Zurücksetzen",
+ "revoke": "Widerrufen",
"save": "Speichern",
"saving": "Wird gespeichert…",
"search": "Suchen",
- "sign_in": "Anmelden",
- "signing_in": "Anmeldung läuft…",
- "view_all": "Alle anzeigen",
- "view_details": "Details anzeigen",
- "copy": "Kopieren",
- "copied": "Kopiert!",
- "export": "Exportieren",
- "exporting": "Wird exportiert…",
- "import": "Importieren",
- "invite": "Einladen",
"send": "Senden",
"send_invitation": "Einladung senden",
"sending": "Wird gesendet…",
- "reset": "Zurücksetzen",
"show": "Anzeigen",
- "hide": "Ausblenden",
- "back": "Zurück",
- "actions_menu": "Aktionen",
- "more_actions": "Weitere Aktionen",
- "adding": "Hinzufügen…"
+ "sign_in": "Anmelden",
+ "signing_in": "Anmeldung läuft…",
+ "view": "Anzeigen",
+ "view_all": "Alle anzeigen",
+ "view_details": "Details anzeigen"
},
"row_actions": {
"menu_label": "Aktionen öffnen",
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index 591104c81a..45c0937ecf 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -1,47 +1,48 @@
{
"admin": {
"actions": {
+ "actions_menu": "Actions",
"add": "Add",
+ "adding": "Adding…",
"apply": "Apply",
+ "back": "Back",
"cancel": "Cancel",
"clear": "Clear",
- "revoke": "Revoke",
"close": "Close",
"confirm": "Confirm",
- "done": "Done",
+ "copied": "Copied!",
+ "copy": "Copy",
"create": "Create",
"creating": "Creating…",
"delete": "Delete",
"deleting": "Deleting…",
"discard": "Discard",
"discard_changes": "Discard changes",
+ "done": "Done",
+ "duplicate": "Duplicate",
"edit": "Edit",
- "view": "View",
+ "export": "Export",
+ "exporting": "Exporting…",
"generate": "Generate",
+ "hide": "Hide",
+ "import": "Import",
+ "invite": "Invite",
+ "more_actions": "More actions",
"remove": "Remove",
+ "reset": "Reset",
+ "revoke": "Revoke",
"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",
- "adding": "Adding…"
+ "sign_in": "Sign in",
+ "signing_in": "Signing in…",
+ "view": "View",
+ "view_all": "View all",
+ "view_details": "View details"
},
"row_actions": {
"menu_label": "Open actions",
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index e03809c6f3..fe59a5d595 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -1,47 +1,48 @@
{
"admin": {
"actions": {
+ "actions_menu": "Actions",
"add": "Ajouter",
+ "adding": "Ajout…",
"apply": "Appliquer",
+ "back": "Retour",
"cancel": "Annuler",
"clear": "Effacer",
- "revoke": "Révoquer",
"close": "Fermer",
"confirm": "Confirmer",
- "done": "Terminé",
+ "copied": "Copié !",
+ "copy": "Copier",
"create": "Créer",
"creating": "Création…",
"delete": "Supprimer",
"deleting": "Suppression…",
"discard": "Abandonner",
"discard_changes": "Abandonner les modifications",
+ "done": "Terminé",
+ "duplicate": "Dupliquer",
"edit": "Modifier",
- "view": "Afficher",
+ "export": "Exporter",
+ "exporting": "Exportation…",
"generate": "Générer",
+ "hide": "Masquer",
+ "import": "Importer",
+ "invite": "Inviter",
+ "more_actions": "Plus d'actions",
"remove": "Retirer",
+ "reset": "Réinitialiser",
+ "revoke": "Révoquer",
"save": "Enregistrer",
"saving": "Enregistrement…",
"search": "Rechercher",
- "sign_in": "Se connecter",
- "signing_in": "Connexion…",
- "view_all": "Tout afficher",
- "view_details": "Voir les détails",
- "copy": "Copier",
- "copied": "Copié !",
- "export": "Exporter",
- "exporting": "Exportation…",
- "import": "Importer",
- "invite": "Inviter",
"send": "Envoyer",
"send_invitation": "Envoyer l'invitation",
"sending": "Envoi…",
- "reset": "Réinitialiser",
"show": "Afficher",
- "hide": "Masquer",
- "back": "Retour",
- "actions_menu": "Actions",
- "more_actions": "Plus d'actions",
- "adding": "Ajout…"
+ "sign_in": "Se connecter",
+ "signing_in": "Connexion…",
+ "view": "Afficher",
+ "view_all": "Tout afficher",
+ "view_details": "Voir les détails"
},
"row_actions": {
"menu_label": "Ouvrir les actions",
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index 9cb3c52cee..9fd2759c78 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -1,47 +1,48 @@
{
"admin": {
"actions": {
+ "actions_menu": "Akcje",
"add": "Dodaj",
+ "adding": "Dodawanie…",
"apply": "Zastosuj",
+ "back": "Wstecz",
"cancel": "Anuluj",
"clear": "Wyczyść",
- "revoke": "Cofnij",
"close": "Zamknij",
"confirm": "Potwierdź",
- "done": "Gotowe",
+ "copied": "Skopiowano!",
+ "copy": "Kopiuj",
"create": "Utwórz",
"creating": "Tworzenie…",
"delete": "Usuń",
"deleting": "Usuwanie…",
"discard": "Odrzuć",
"discard_changes": "Odrzuć zmiany",
+ "done": "Gotowe",
+ "duplicate": "Duplikuj",
"edit": "Edytuj",
- "view": "Zobacz",
+ "export": "Eksportuj",
+ "exporting": "Eksportowanie…",
"generate": "Generuj",
+ "hide": "Ukryj",
+ "import": "Importuj",
+ "invite": "Zaproś",
+ "more_actions": "Więcej akcji",
"remove": "Usuń",
+ "reset": "Resetuj",
+ "revoke": "Cofnij",
"save": "Zapisz",
"saving": "Zapisywanie…",
"search": "Szukaj",
- "sign_in": "Zaloguj się",
- "signing_in": "Logowanie…",
- "view_all": "Zobacz wszystko",
- "view_details": "Zobacz szczegóły",
- "copy": "Kopiuj",
- "copied": "Skopiowano!",
- "export": "Eksportuj",
- "exporting": "Eksportowanie…",
- "import": "Importuj",
- "invite": "Zaproś",
"send": "Wyślij",
"send_invitation": "Wyślij zaproszenie",
"sending": "Wysyłanie…",
- "reset": "Resetuj",
"show": "Pokaż",
- "hide": "Ukryj",
- "back": "Wstecz",
- "actions_menu": "Akcje",
- "more_actions": "Więcej akcji",
- "adding": "Dodawanie…"
+ "sign_in": "Zaloguj się",
+ "signing_in": "Logowanie…",
+ "view": "Zobacz",
+ "view_all": "Zobacz wszystko",
+ "view_details": "Zobacz szczegóły"
},
"row_actions": {
"menu_label": "Otwórz akcje",
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index e6bf6c0224..d288a7f796 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -1,47 +1,48 @@
{
"admin": {
"actions": {
+ "actions_menu": "操作",
"add": "添加",
+ "adding": "添加中…",
"apply": "应用",
+ "back": "返回",
"cancel": "取消",
"clear": "清除",
- "revoke": "撤销",
"close": "关闭",
"confirm": "确认",
- "done": "完成",
+ "copied": "已复制!",
+ "copy": "复制",
"create": "创建",
"creating": "创建中…",
"delete": "删除",
"deleting": "删除中…",
"discard": "放弃",
"discard_changes": "放弃更改",
+ "done": "完成",
+ "duplicate": "复制",
"edit": "编辑",
- "view": "查看",
+ "export": "导出",
+ "exporting": "导出中…",
"generate": "生成",
+ "hide": "隐藏",
+ "import": "导入",
+ "invite": "邀请",
+ "more_actions": "更多操作",
"remove": "移除",
+ "reset": "重置",
+ "revoke": "撤销",
"save": "保存",
"saving": "保存中…",
"search": "搜索",
- "sign_in": "登录",
- "signing_in": "登录中…",
- "view_all": "查看全部",
- "view_details": "查看详情",
- "copy": "复制",
- "copied": "已复制!",
- "export": "导出",
- "exporting": "导出中…",
- "import": "导入",
- "invite": "邀请",
"send": "发送",
"send_invitation": "发送邀请",
"sending": "发送中…",
- "reset": "重置",
"show": "显示",
- "hide": "隐藏",
- "back": "返回",
- "actions_menu": "操作",
- "more_actions": "更多操作",
- "adding": "添加中…"
+ "sign_in": "登录",
+ "signing_in": "登录中…",
+ "view": "查看",
+ "view_all": "查看全部",
+ "view_details": "查看详情"
},
"row_actions": {
"menu_label": "打开操作",
diff --git a/packages/dashboard-core/src/providers/permission-provider.tsx b/packages/dashboard-core/src/providers/permission-provider.tsx
index ab314d60a0..82954f79f9 100644
--- a/packages/dashboard-core/src/providers/permission-provider.tsx
+++ b/packages/dashboard-core/src/providers/permission-provider.tsx
@@ -1,5 +1,13 @@
import type { PermissionRule } from '@spree/admin-sdk'
-import { createContext, type ReactNode, useContext, useEffect, useMemo, useState } from 'react'
+import {
+ createContext,
+ type ReactNode,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useState,
+} from 'react'
import { adminClient } from '../client'
import { useAuth } from '../hooks/use-auth'
import type { ActionName, SubjectName } from '../lib/permissions'
@@ -24,7 +32,18 @@ export interface Permissions {
interface PermissionContextValue {
permissions: Permissions
rules: PermissionRule[]
+ /**
+ * The flat expanded catalog permission keys the user holds on the current
+ * store (`read_orders`, `write_products`, …) — the same vocabulary as API
+ * key scopes and the role editor.
+ */
+ permissionKeys: string[]
isLoading: boolean
+ /**
+ * Reloads `/me`. Permissions are store-scoped (roles are held per store),
+ * so the store route calls this whenever the active store changes.
+ */
+ refresh: () => Promise<void>
}
const PermissionContext = createContext<PermissionContextValue | null>(null)
@@ -72,11 +91,27 @@ const EMPTY_PERMISSIONS: Permissions = {
export function PermissionProvider({ children }: { children: ReactNode }) {
const { isAuthenticated } = useAuth()
const [rules, setRules] = useState<PermissionRule[]>([])
+ const [permissionKeys, setPermissionKeys] = useState<string[]>([])
const [isLoading, setIsLoading] = useState(false)
+ const refresh = useCallback(async () => {
+ setIsLoading(true)
+ try {
+ const res = await adminClient.me.get()
+ setRules(res.permissions)
+ setPermissionKeys(res.permission_keys ?? [])
+ } catch {
+ setRules([])
+ setPermissionKeys([])
+ } finally {
+ setIsLoading(false)
+ }
+ }, [])
+
useEffect(() => {
if (!isAuthenticated) {
setRules([])
+ setPermissionKeys([])
return
}
@@ -85,10 +120,14 @@ export function PermissionProvider({ children }: { children: ReactNode }) {
adminClient.me
.get()
.then((res) => {
- if (!cancelled) setRules(res.permissions)
+ if (cancelled) return
+ setRules(res.permissions)
+ setPermissionKeys(res.permission_keys ?? [])
})
.catch(() => {
- if (!cancelled) setRules([])
+ if (cancelled) return
+ setRules([])
+ setPermissionKeys([])
})
.finally(() => {
if (!cancelled) setIsLoading(false)
@@ -105,7 +144,7 @@ export function PermissionProvider({ children }: { children: ReactNode }) {
)
return (
- <PermissionContext.Provider value={{ permissions, rules, isLoading }}>
+ <PermissionContext.Provider value={{ permissions, rules, permissionKeys, isLoading, refresh }}>
{children}
</PermissionContext.Provider>
)
diff --git a/packages/dashboard-starter/src/routeTree.gen.ts b/packages/dashboard-starter/src/routeTree.gen.ts
index 2419b9aa6d..faacd4a033 100644
--- a/packages/dashboard-starter/src/routeTree.gen.ts
+++ b/packages/dashboard-starter/src/routeTree.gen.ts
@@ -58,11 +58,14 @@ import { Route as CustomersGroupsRouteImport } from './../../dashboard/src/route
import { Route as CustomersCustomerIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/customers/$customerId'
import { Route as BrandsDotbrandIdRouteImport } from './../../dashboard-plugin-example/src/routes/brands.$brandId'
import { Route as SettingsWebhooksIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index'
+import { Route as SettingsRolesIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/roles/index'
import { Route as SettingsImportsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/imports/index'
import { Route as ProductsPriceListsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/price-lists/index'
import { Route as ProductsCollectionsIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/collections/index'
import { Route as ProductsCategoriesIndexRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/categories/index'
import { Route as SettingsWebhooksWebhookEndpointIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'
+import { Route as SettingsRolesNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/roles/new'
+import { Route as SettingsRolesRoleIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/settings/roles/$roleId'
import { Route as ProductsPriceListsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/price-lists/new'
import { Route as ProductsCollectionsNewRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/collections/new'
import { Route as ProductsCollectionsCollectionIdRouteImport } from './../../dashboard/src/routes/_authenticated/$storeId/products/collections/$collectionId'
@@ -316,6 +319,11 @@ const SettingsWebhooksIndexRoute = SettingsWebhooksIndexRouteImport.update({
path: '/webhooks/',
getParentRoute: () => SettingsRoute,
} as any)
+const SettingsRolesIndexRoute = SettingsRolesIndexRouteImport.update({
+ id: '/roles/',
+ path: '/roles/',
+ getParentRoute: () => SettingsRoute,
+} as any)
const SettingsImportsIndexRoute = SettingsImportsIndexRouteImport.update({
id: '/imports/',
path: '/imports/',
@@ -343,6 +351,16 @@ const SettingsWebhooksWebhookEndpointIdRoute =
path: '/webhooks/$webhookEndpointId',
getParentRoute: () => SettingsRoute,
} as any)
+const SettingsRolesNewRoute = SettingsRolesNewRouteImport.update({
+ id: '/roles/new',
+ path: '/roles/new',
+ getParentRoute: () => SettingsRoute,
+} as any)
+const SettingsRolesRoleIdRoute = SettingsRolesRoleIdRouteImport.update({
+ id: '/roles/$roleId',
+ path: '/roles/$roleId',
+ getParentRoute: () => SettingsRoute,
+} as any)
const ProductsPriceListsNewRoute = ProductsPriceListsNewRouteImport.update({
id: '/products/price-lists/new',
path: '/products/price-lists/new',
@@ -430,11 +448,14 @@ export interface FileRoutesByFullPath {
'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/$storeId/settings/roles/$roleId': typeof SettingsRolesRoleIdRoute
+ '/$storeId/settings/roles/new': typeof SettingsRolesNewRoute
'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute
'/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute
'/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute
'/$storeId/settings/imports/': typeof SettingsImportsIndexRoute
+ '/$storeId/settings/roles/': typeof SettingsRolesIndexRoute
'/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute
'/$storeId/products/price-lists/$priceListId/': typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -489,11 +510,14 @@ export interface FileRoutesByTo {
'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/$storeId/settings/roles/$roleId': typeof SettingsRolesRoleIdRoute
+ '/$storeId/settings/roles/new': typeof SettingsRolesNewRoute
'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/$storeId/products/categories': typeof ProductsCategoriesIndexRoute
'/$storeId/products/collections': typeof ProductsCollectionsIndexRoute
'/$storeId/products/price-lists': typeof ProductsPriceListsIndexRoute
'/$storeId/settings/imports': typeof SettingsImportsIndexRoute
+ '/$storeId/settings/roles': typeof SettingsRolesIndexRoute
'/$storeId/settings/webhooks': typeof SettingsWebhooksIndexRoute
'/$storeId/products/price-lists/$priceListId': typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -552,11 +576,14 @@ export interface FileRoutesById {
'/_authenticated/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/_authenticated/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/_authenticated/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/_authenticated/$storeId/settings/roles/$roleId': typeof SettingsRolesRoleIdRoute
+ '/_authenticated/$storeId/settings/roles/new': typeof SettingsRolesNewRoute
'/_authenticated/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/_authenticated/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute
'/_authenticated/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute
'/_authenticated/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute
'/_authenticated/$storeId/settings/imports/': typeof SettingsImportsIndexRoute
+ '/_authenticated/$storeId/settings/roles/': typeof SettingsRolesIndexRoute
'/_authenticated/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute
'/_authenticated/$storeId/products/price-lists/$priceListId/': typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -615,11 +642,14 @@ export interface FileRouteTypes {
| '/$storeId/products/collections/$collectionId'
| '/$storeId/products/collections/new'
| '/$storeId/products/price-lists/new'
+ | '/$storeId/settings/roles/$roleId'
+ | '/$storeId/settings/roles/new'
| '/$storeId/settings/webhooks/$webhookEndpointId'
| '/$storeId/products/categories/'
| '/$storeId/products/collections/'
| '/$storeId/products/price-lists/'
| '/$storeId/settings/imports/'
+ | '/$storeId/settings/roles/'
| '/$storeId/settings/webhooks/'
| '/$storeId/products/price-lists/$priceListId/'
fileRoutesByTo: FileRoutesByTo
@@ -674,11 +704,14 @@ export interface FileRouteTypes {
| '/$storeId/products/collections/$collectionId'
| '/$storeId/products/collections/new'
| '/$storeId/products/price-lists/new'
+ | '/$storeId/settings/roles/$roleId'
+ | '/$storeId/settings/roles/new'
| '/$storeId/settings/webhooks/$webhookEndpointId'
| '/$storeId/products/categories'
| '/$storeId/products/collections'
| '/$storeId/products/price-lists'
| '/$storeId/settings/imports'
+ | '/$storeId/settings/roles'
| '/$storeId/settings/webhooks'
| '/$storeId/products/price-lists/$priceListId'
id:
@@ -736,11 +769,14 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/products/collections/$collectionId'
| '/_authenticated/$storeId/products/collections/new'
| '/_authenticated/$storeId/products/price-lists/new'
+ | '/_authenticated/$storeId/settings/roles/$roleId'
+ | '/_authenticated/$storeId/settings/roles/new'
| '/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'
| '/_authenticated/$storeId/products/categories/'
| '/_authenticated/$storeId/products/collections/'
| '/_authenticated/$storeId/products/price-lists/'
| '/_authenticated/$storeId/settings/imports/'
+ | '/_authenticated/$storeId/settings/roles/'
| '/_authenticated/$storeId/settings/webhooks/'
| '/_authenticated/$storeId/products/price-lists/$priceListId/'
fileRoutesById: FileRoutesById
@@ -1098,6 +1134,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsWebhooksIndexRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/settings/roles/': {
+ id: '/_authenticated/$storeId/settings/roles/'
+ path: '/roles'
+ fullPath: '/$storeId/settings/roles/'
+ preLoaderRoute: typeof SettingsRolesIndexRouteImport
+ parentRoute: typeof SettingsRoute
+ }
'/_authenticated/$storeId/settings/imports/': {
id: '/_authenticated/$storeId/settings/imports/'
path: '/imports'
@@ -1133,6 +1176,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsWebhooksWebhookEndpointIdRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/settings/roles/new': {
+ id: '/_authenticated/$storeId/settings/roles/new'
+ path: '/roles/new'
+ fullPath: '/$storeId/settings/roles/new'
+ preLoaderRoute: typeof SettingsRolesNewRouteImport
+ parentRoute: typeof SettingsRoute
+ }
+ '/_authenticated/$storeId/settings/roles/$roleId': {
+ id: '/_authenticated/$storeId/settings/roles/$roleId'
+ path: '/roles/$roleId'
+ fullPath: '/$storeId/settings/roles/$roleId'
+ preLoaderRoute: typeof SettingsRolesRoleIdRouteImport
+ parentRoute: typeof SettingsRoute
+ }
'/_authenticated/$storeId/products/price-lists/new': {
id: '/_authenticated/$storeId/products/price-lists/new'
path: '/products/price-lists/new'
@@ -1195,8 +1252,11 @@ interface SettingsRouteChildren {
SettingsStoreRoute: typeof SettingsStoreRoute
SettingsTaxCategoriesRoute: typeof SettingsTaxCategoriesRoute
SettingsIndexRoute: typeof SettingsIndexRoute
+ SettingsRolesRoleIdRoute: typeof SettingsRolesRoleIdRoute
+ SettingsRolesNewRoute: typeof SettingsRolesNewRoute
SettingsWebhooksWebhookEndpointIdRoute: typeof SettingsWebhooksWebhookEndpointIdRoute
SettingsImportsIndexRoute: typeof SettingsImportsIndexRoute
+ SettingsRolesIndexRoute: typeof SettingsRolesIndexRoute
SettingsWebhooksIndexRoute: typeof SettingsWebhooksIndexRoute
}
@@ -1217,9 +1277,12 @@ const SettingsRouteChildren: SettingsRouteChildren = {
SettingsStoreRoute: SettingsStoreRoute,
SettingsTaxCategoriesRoute: SettingsTaxCategoriesRoute,
SettingsIndexRoute: SettingsIndexRoute,
+ SettingsRolesRoleIdRoute: SettingsRolesRoleIdRoute,
+ SettingsRolesNewRoute: SettingsRolesNewRoute,
SettingsWebhooksWebhookEndpointIdRoute:
SettingsWebhooksWebhookEndpointIdRoute,
SettingsImportsIndexRoute: SettingsImportsIndexRoute,
+ SettingsRolesIndexRoute: SettingsRolesIndexRoute,
SettingsWebhooksIndexRoute: SettingsWebhooksIndexRoute,
}
diff --git a/packages/dashboard/e2e/roles.spec.ts b/packages/dashboard/e2e/roles.spec.ts
new file mode 100644
index 0000000000..ec83fbf9c1
--- /dev/null
+++ b/packages/dashboard/e2e/roles.spec.ts
@@ -0,0 +1,142 @@
+import { expect, type Page, test } from '@playwright/test'
+import { login } from './helpers'
+
+const ROLES_PATH = (storeId: string) => `/${storeId}/settings/roles`
+
+async function gotoRoles(page: Page, storeId: string) {
+ await page.goto(ROLES_PATH(storeId))
+ await expect(page.getByRole('button', { name: /add role/i })).toBeVisible({ timeout: 15_000 })
+}
+
+test.describe('roles', () => {
+ test('lists roles with the protected admin role', async ({ page }) => {
+ const creds = await login(page)
+ await gotoRoles(page, creds.store_id)
+
+ await expect(page.getByRole('cell', { name: /admin/i }).first()).toBeVisible()
+ await expect(page.getByText(/full access/i).first()).toBeVisible()
+ })
+
+ test('creates a role from the permission grid and edits it', async ({ page }) => {
+ const creds = await login(page)
+ await gotoRoles(page, creds.store_id)
+
+ const name = `e2e-support-${Date.now()}`
+
+ await page.getByRole('button', { name: /add role/i }).click()
+ await expect(page.getByRole('heading', { name: /new role/i })).toBeVisible()
+
+ await page.locator('#role-name').fill(name)
+ await page.locator('#role-description').fill('Read-only support role')
+ await page.getByRole('checkbox', { name: /view orders/i }).check()
+ await page.getByRole('checkbox', { name: /view customers/i }).check()
+ await page.getByRole('button', { name: /^save$/i }).click()
+
+ // Back on the list with the new role and its permission badges.
+ await expect(page.getByRole('cell', { name: new RegExp(name, 'i') })).toBeVisible({
+ timeout: 15_000,
+ })
+ await expect(page.getByText('read_orders')).toBeVisible()
+
+ // Round-trip: open the editor, grant manage on orders, save.
+ await page.getByRole('cell', { name: new RegExp(name, 'i') }).click()
+ await expect(page.getByRole('heading', { name: new RegExp(name, 'i') })).toBeVisible()
+
+ const manageOrders = page.getByRole('checkbox', { name: /manage orders/i })
+ await manageOrders.check()
+ await page.getByRole('button', { name: /^save$/i }).click()
+ await expect(page.getByText(/role updated/i)).toBeVisible({ timeout: 15_000 })
+ })
+
+ test('starts from a template on the create page', async ({ page }) => {
+ const creds = await login(page)
+ await gotoRoles(page, creds.store_id)
+
+ await page.getByRole('button', { name: /add role/i }).click()
+ await page.getByRole('button', { name: /^support$/i }).click()
+
+ // The template pre-fills the grid; "view orders" is part of Support.
+ await expect(page.getByRole('checkbox', { name: /view orders/i })).toBeChecked()
+
+ const name = `e2e-template-${Date.now()}`
+ await page.locator('#role-name').fill(name)
+ await page.getByRole('button', { name: /^save$/i }).click()
+
+ await expect(page.getByRole('cell', { name: new RegExp(name, 'i') })).toBeVisible({
+ timeout: 15_000,
+ })
+ })
+
+ test('the admin role opens read-only', async ({ page }) => {
+ const creds = await login(page)
+ await gotoRoles(page, creds.store_id)
+
+ await page
+ .getByRole('cell', { name: /^admin/i })
+ .first()
+ .click()
+ await expect(page.getByText(/protected/i).first()).toBeVisible()
+ await expect(page.getByRole('button', { name: /^save$/i })).toHaveCount(0)
+ await expect(page.locator('#role-name')).toBeDisabled()
+ })
+
+ test('blocks deleting a role while staff hold it, allows after unassign', async ({ page }) => {
+ const creds = await login(page)
+ const name = `e2e-held-${Date.now()}`
+
+ // Create the role.
+ await gotoRoles(page, creds.store_id)
+ await page.getByRole('button', { name: /add role/i }).click()
+ await page.locator('#role-name').fill(name)
+ await page.getByRole('checkbox', { name: /view orders/i }).check()
+ await page.getByRole('button', { name: /^save$/i }).click()
+ await expect(page.getByRole('cell', { name: new RegExp(name, 'i') })).toBeVisible({
+ timeout: 15_000,
+ })
+
+ // Assign it to the seed admin from the staff page.
+ await page.goto(`/${creds.store_id}/settings/staff`)
+ await page
+ .getByRole('row', { name: /spree@example\.com/i })
+ .getByRole('button')
+ .last()
+ .click()
+ await page.getByRole('menuitem', { name: /edit/i }).click()
+ await page.getByRole('checkbox', { name: new RegExp(name, 'i') }).check()
+ await page.getByRole('button', { name: /^save$/i }).click()
+ await expect(page.getByText(new RegExp(name, 'i')).first()).toBeVisible({ timeout: 15_000 })
+
+ // Delete is disabled while the role is held.
+ await gotoRoles(page, creds.store_id)
+ const row = page.getByRole('row', { name: new RegExp(name, 'i') })
+ await row.getByRole('button').last().click()
+ await expect(page.getByRole('menuitem', { name: /delete/i })).toBeDisabled()
+ await page.keyboard.press('Escape')
+
+ // Unassign, then delete goes through.
+ await page.goto(`/${creds.store_id}/settings/staff`)
+ await page
+ .getByRole('row', { name: /spree@example\.com/i })
+ .getByRole('button')
+ .last()
+ .click()
+ await page.getByRole('menuitem', { name: /edit/i }).click()
+ await page.getByRole('checkbox', { name: new RegExp(name, 'i') }).uncheck()
+ await page.getByRole('button', { name: /^save$/i }).click()
+ // The sheet closes on success and the badge leaves the staff row.
+ await expect(
+ page.getByRole('row', { name: /spree@example\.com/i }).getByText(new RegExp(name, 'i')),
+ ).toHaveCount(0, { timeout: 15_000 })
+
+ await gotoRoles(page, creds.store_id)
+ await row.getByRole('button').last().click()
+ await page.getByRole('menuitem', { name: /delete/i }).click()
+ await page
+ .getByRole('dialog')
+ .getByRole('button', { name: /^delete$/i })
+ .click()
+ await expect(page.getByRole('cell', { name: new RegExp(name, 'i') })).toHaveCount(0, {
+ timeout: 15_000,
+ })
+ })
+})
diff --git a/packages/dashboard/src/components/spree/permission-picker.tsx b/packages/dashboard/src/components/spree/permission-picker.tsx
new file mode 100644
index 0000000000..fdb5b8044f
--- /dev/null
+++ b/packages/dashboard/src/components/spree/permission-picker.tsx
@@ -0,0 +1,184 @@
+import type { Permission } from '@spree/admin-sdk'
+import { Checkbox, cn } from '@spree/dashboard-ui'
+import { Fragment } from 'react'
+import { useTranslation } from 'react-i18next'
+
+/**
+ * One picker row: a catalog resource with its read key and (usually) write
+ * key. Built from the `/admin/permissions` catalog entries, so extensions'
+ * registered resources appear automatically.
+ */
+export interface PermissionRow {
+ resource: string
+ group: string
+ groupLabel: string
+ label: string
+ description: string
+ readKey: string
+ writeKey?: string
+}
+
+export function buildPermissionRows(entries: Permission[]): PermissionRow[] {
+ const rows = new Map<string, PermissionRow>()
+ for (const entry of entries) {
+ const existing = rows.get(entry.resource)
+ if (existing) {
+ if (entry.kind === 'write') existing.writeKey = entry.key
+ continue
+ }
+ rows.set(entry.resource, {
+ resource: entry.resource,
+ group: entry.group,
+ groupLabel: entry.group_label,
+ label: entry.label,
+ description: entry.description,
+ readKey: entry.kind === 'read' ? entry.key : `read_${entry.resource}`,
+ writeKey: entry.kind === 'write' ? entry.key : undefined,
+ })
+ }
+ return [...rows.values()]
+}
+
+/** Every read key in the catalog — the "Read only" preset. */
+export function allReadKeys(entries: Permission[]): string[] {
+ return entries.filter((entry) => entry.kind === 'read').map((entry) => entry.key)
+}
+
+/** Every write key in the catalog (read is implied) plus read-only resources' read keys. */
+export function allWriteKeys(entries: Permission[]): string[] {
+ return buildPermissionRows(entries).map((row) => row.writeKey ?? row.readKey)
+}
+
+/**
+ * Shared read/write permission grid over the catalog — used by the role
+ * editor and the API-key scope picker (which layers its `read_all`/`write_all`
+ * alias toggles on top). Grouped by catalog group; checking write implies
+ * read, mirrored in the UI by locking the read checkbox.
+ *
+ * Row labels translate client-side (`admin.permissions.resources.<resource>`)
+ * so they follow the admin's UI language; unknown resources (extensions) fall
+ * back to the server-localized label from the catalog entry.
+ */
+export function PermissionGrid({
+ entries,
+ value,
+ onChange,
+ disabled = false,
+ disabledKeys,
+}: {
+ entries: Permission[]
+ value: string[]
+ onChange?: (next: string[]) => void
+ /** Renders the whole grid read-only. */
+ disabled?: boolean
+ /** Keys the caller may not grant (beyond their own) — rendered disabled. */
+ disabledKeys?: Set<string>
+}) {
+ const { t } = useTranslation()
+ const rows = buildPermissionRows(entries)
+ const groups: { group: string; groupLabel: string; rows: PermissionRow[] }[] = []
+ for (const row of rows) {
+ const bucket = groups.find((candidate) => candidate.group === row.group)
+ if (bucket) {
+ bucket.rows.push(row)
+ } else {
+ groups.push({ group: row.group, groupLabel: row.groupLabel, rows: [row] })
+ }
+ }
+
+ function toggle(key: string) {
+ onChange?.(value.includes(key) ? value.filter((v) => v !== key) : [...value, key])
+ }
+
+ return (
+ <div className={cn('flex flex-col rounded-md border border-border', disabled && 'opacity-70')}>
+ <div className="grid grid-cols-[1fr_auto_auto] items-center gap-x-6 gap-y-2 p-3 text-sm">
+ <span className="font-medium text-muted-foreground">
+ {t('admin.permissions.grid.resource_header')}
+ </span>
+ <span className="w-12 text-center font-medium text-muted-foreground">
+ {t('admin.permissions.grid.read_header')}
+ </span>
+ <span className="w-12 text-center font-medium text-muted-foreground">
+ {t('admin.permissions.grid.write_header')}
+ </span>
+
+ {groups.map((group) => (
+ <GroupRows
+ key={group.group}
+ group={group}
+ value={value}
+ disabled={disabled}
+ disabledKeys={disabledKeys}
+ onToggle={toggle}
+ />
+ ))}
+ </div>
+ </div>
+ )
+}
+
+function GroupRows({
+ group,
+ value,
+ disabled,
+ disabledKeys,
+ onToggle,
+}: {
+ group: { group: string; groupLabel: string; rows: PermissionRow[] }
+ value: string[]
+ disabled: boolean
+ disabledKeys?: Set<string>
+ onToggle: (key: string) => void
+}) {
+ const { t } = useTranslation()
+
+ return (
+ <>
+ <span className="col-span-3 mt-2 border-t border-border pt-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground first:mt-0 first:border-t-0 first:pt-0">
+ {t(`admin.permissions.groups.${group.group}`, { defaultValue: group.groupLabel })}
+ </span>
+ {group.rows.map((row) => {
+ const hasWrite = row.writeKey ? value.includes(row.writeKey) : false
+ const hasRead = value.includes(row.readKey) || hasWrite
+ const readBlocked = disabledKeys?.has(row.readKey) ?? false
+ const writeBlocked = row.writeKey ? (disabledKeys?.has(row.writeKey) ?? false) : true
+ const label = t(`admin.permissions.resources.${row.resource}`, {
+ defaultValue: row.label,
+ })
+ return (
+ <Fragment key={row.resource}>
+ <span className="flex flex-col">
+ <span>{label}</span>
+ <span className="text-xs text-muted-foreground">
+ {t(`admin.permissions.descriptions.${row.resource}`, {
+ defaultValue: row.description,
+ })}
+ </span>
+ </span>
+ <Checkbox
+ checked={hasRead}
+ onCheckedChange={() => onToggle(row.readKey)}
+ // Checking write implies read on the server; lock the read box so
+ // the UI can't look out of sync with what will be enforced.
+ disabled={disabled || hasWrite || readBlocked}
+ aria-label={t('admin.permissions.grid.read_aria', { resource: label })}
+ className="justify-self-center"
+ />
+ {row.writeKey ? (
+ <Checkbox
+ checked={hasWrite}
+ onCheckedChange={() => onToggle(row.writeKey as string)}
+ disabled={disabled || writeBlocked}
+ aria-label={t('admin.permissions.grid.write_aria', { resource: label })}
+ className="justify-self-center"
+ />
+ ) : (
+ <span className="justify-self-center text-xs text-muted-foreground">—</span>
+ )}
+ </Fragment>
+ )
+ })}
+ </>
+ )
+}
diff --git a/packages/dashboard/src/components/spree/role-form.tsx b/packages/dashboard/src/components/spree/role-form.tsx
new file mode 100644
index 0000000000..a8b5e9695f
--- /dev/null
+++ b/packages/dashboard/src/components/spree/role-form.tsx
@@ -0,0 +1,288 @@
+import { zodResolver } from '@hookform/resolvers/zod'
+import type { Role } from '@spree/admin-sdk'
+import { SpreeError } from '@spree/admin-sdk'
+import { mapSpreeErrorsToForm, usePermissions } from '@spree/dashboard-core'
+import {
+ Badge,
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldError,
+ FieldLabel,
+ Input,
+ Skeleton,
+ Textarea,
+} from '@spree/dashboard-ui'
+import i18n from 'i18next'
+import { LockIcon } from 'lucide-react'
+import { useMemo } from 'react'
+import { Controller, useForm } from 'react-hook-form'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
+import { z } from 'zod/v4'
+import { usePermissionCatalog } from '../../hooks/use-roles'
+import { useStaff } from '../../hooks/use-staff'
+import { allReadKeys, allWriteKeys, PermissionGrid } from './permission-picker'
+
+const roleSchema = z.object({
+ name: z.string().min(1, { error: () => i18n.t('admin.roles.validation.name_required') }),
+ description: z.string(),
+ permissions: z.array(z.string()),
+})
+
+export type RoleFormValues = z.infer<typeof roleSchema>
+
+/**
+ * Quick-start permission sets offered on the create page. Dashboard constants
+ * only — nothing is seeded; a template just pre-fills the grid before saving.
+ */
+export const ROLE_TEMPLATES: Array<{ key: string; permissions: string[] }> = [
+ {
+ key: 'order_manager',
+ permissions: [
+ 'write_orders',
+ 'write_payments',
+ 'write_fulfillments',
+ 'write_refunds',
+ 'write_gift_cards',
+ 'write_store_credits',
+ 'read_customers',
+ ],
+ },
+ {
+ key: 'merchandiser',
+ permissions: ['write_products', 'write_categories', 'write_collections', 'write_stock'],
+ },
+ {
+ key: 'support',
+ permissions: ['read_orders', 'read_customers', 'read_dashboard'],
+ },
+]
+
+export function useRoleForm(initial?: Partial<RoleFormValues>) {
+ return useForm<RoleFormValues>({
+ resolver: zodResolver(roleSchema),
+ defaultValues: {
+ name: initial?.name ?? '',
+ description: initial?.description ?? '',
+ permissions: initial?.permissions ?? [],
+ },
+ })
+}
+
+/** Wraps a submit handler with the standard 422 → form-error mapping. */
+export function submitRole(
+ form: ReturnType<typeof useRoleForm>,
+ action: (values: RoleFormValues) => Promise<void>,
+) {
+ return form.handleSubmit(async (values) => {
+ try {
+ await action(values)
+ } catch (err) {
+ if (mapSpreeErrorsToForm(err, form.setError)) return
+ if (err instanceof SpreeError) {
+ toast.error(err.message)
+ return
+ }
+ throw err
+ }
+ })
+}
+
+/**
+ * The role editor body — name/description, the permission grid with presets,
+ * and the summary sidebar. Shared by the create and edit pages; the pages own
+ * the header, submit wiring, and navigation.
+ */
+export function RoleFormFields({
+ form,
+ role,
+ readOnly = false,
+}: {
+ form: ReturnType<typeof useRoleForm>
+ /** Present on the edit page — drives the members panel and immutable state. */
+ role?: Role
+ readOnly?: boolean
+}) {
+ const { t } = useTranslation()
+ const { data: catalog } = usePermissionCatalog()
+ const { permissionKeys } = usePermissions()
+ const permissions = form.watch('permissions')
+
+ // Keys the current admin cannot grant (the API rejects them) render
+ // disabled. An admin holding the full catalog is never restricted.
+ const blockedKeys = useMemo(() => {
+ if (!catalog) return undefined
+ const blocked = new Set(
+ catalog.data.filter((entry) => !permissionKeys.includes(entry.key)).map((entry) => entry.key),
+ )
+ return blocked.size > 0 ? blocked : undefined
+ }, [catalog, permissionKeys])
+
+ function applyPreset(keys: string[]) {
+ form.setValue(
+ 'permissions',
+ keys.filter((key) => permissionKeys.includes(key)),
+ { shouldDirty: true },
+ )
+ }
+
+ return (
+ <div className="flex flex-col gap-6 lg:flex-row">
+ <div className="flex min-w-0 flex-1 flex-col gap-6">
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.roles.form.details_section')}</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-4">
+ {form.formState.errors.root?.message && (
+ <p className="text-sm text-destructive" role="alert">
+ {form.formState.errors.root.message}
+ </p>
+ )}
+ <Field>
+ <FieldLabel htmlFor="role-name">{t('admin.fields.role.name.label')}</FieldLabel>
+ <Input
+ id="role-name"
+ placeholder={t('admin.fields.role.name.placeholder')}
+ disabled={readOnly}
+ aria-invalid={!!form.formState.errors.name || undefined}
+ {...form.register('name')}
+ />
+ <FieldError errors={[form.formState.errors.name]} />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="role-description">
+ {t('admin.fields.role.description.label')}
+ </FieldLabel>
+ <Textarea
+ id="role-description"
+ rows={2}
+ placeholder={t('admin.fields.role.description.placeholder')}
+ disabled={readOnly}
+ {...form.register('description')}
+ />
+ </Field>
+ </CardContent>
+ </Card>
+
+ <Card>
+ <CardHeader className="flex flex-row items-center justify-between">
+ <CardTitle>{t('admin.roles.form.permissions_section')}</CardTitle>
+ {!readOnly && catalog && (
+ <div className="flex gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => applyPreset(allReadKeys(catalog.data))}
+ >
+ {t('admin.roles.presets.read_only')}
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => applyPreset(allWriteKeys(catalog.data))}
+ >
+ {t('admin.roles.presets.full_access')}
+ </Button>
+ <Button type="button" variant="ghost" size="sm" onClick={() => applyPreset([])}>
+ {t('admin.roles.presets.clear')}
+ </Button>
+ </div>
+ )}
+ </CardHeader>
+ <CardContent>
+ {catalog ? (
+ <Controller
+ name="permissions"
+ control={form.control}
+ render={({ field }) => (
+ <PermissionGrid
+ entries={catalog.data}
+ value={field.value}
+ onChange={field.onChange}
+ disabled={readOnly}
+ disabledKeys={blockedKeys}
+ />
+ )}
+ />
+ ) : (
+ <div className="flex flex-col gap-2">
+ <Skeleton className="h-8 w-full" />
+ <Skeleton className="h-8 w-full" />
+ <Skeleton className="h-8 w-full" />
+ </div>
+ )}
+ {form.formState.errors.permissions && (
+ <p className="mt-2 text-sm text-destructive">
+ {form.formState.errors.permissions.message}
+ </p>
+ )}
+ </CardContent>
+ </Card>
+ </div>
+
+ <div className="flex w-full flex-col gap-6 lg:w-72">
+ <Card>
+ <CardHeader>
+ <CardTitle>{t('admin.roles.form.summary_section')}</CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-col gap-3 text-sm">
+ {readOnly && (
+ <p className="flex items-start gap-2 text-muted-foreground">
+ <LockIcon className="mt-0.5 size-4 shrink-0" />
+ {t('admin.roles.form.locked_hint')}
+ </p>
+ )}
+ <div className="flex items-center justify-between">
+ <span className="text-muted-foreground">
+ {t('admin.roles.form.permissions_count')}
+ </span>
+ <Badge>
+ {role?.name === 'admin' ? t('admin.roles.badges.full_access') : permissions.length}
+ </Badge>
+ </div>
+ {role && <RoleMembers role={role} />}
+ </CardContent>
+ </Card>
+ </div>
+ </div>
+ )
+}
+
+function RoleMembers({ role }: { role: Role }) {
+ const { t } = useTranslation()
+ const { data: staff } = useStaff()
+
+ const members = (staff?.data ?? []).filter((member) =>
+ member.roles.some((memberRole) => memberRole.id === role.id),
+ )
+
+ return (
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between">
+ <span className="text-muted-foreground">{t('admin.roles.form.members')}</span>
+ <Badge variant="secondary">{role.users_count}</Badge>
+ </div>
+ {members.length > 0 && (
+ <ul className="flex flex-col gap-1">
+ {members.slice(0, 8).map((member) => (
+ <li key={member.id} className="truncate text-muted-foreground">
+ {member.full_name || member.email}
+ </li>
+ ))}
+ {members.length > 8 && (
+ <li className="text-xs text-muted-foreground">
+ {t('admin.roles.form.more_members', { count: members.length - 8 })}
+ </li>
+ )}
+ </ul>
+ )}
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/hooks/use-roles.ts b/packages/dashboard/src/hooks/use-roles.ts
new file mode 100644
index 0000000000..41f38d3c8e
--- /dev/null
+++ b/packages/dashboard/src/hooks/use-roles.ts
@@ -0,0 +1,56 @@
+import type { RoleCreateParams, RoleUpdateParams } from '@spree/admin-sdk'
+import { adminClient, useResourceKey, useResourceMutation } from '@spree/dashboard-core'
+import { useQuery } from '@tanstack/react-query'
+
+export { useRoles } from './use-staff'
+
+export function useRole(id: string) {
+ return useQuery({
+ queryKey: [...useResourceKey('roles'), id],
+ queryFn: () => adminClient.roles.get(id),
+ // An empty id would hit the roles index instead of a record — the create
+ // page passes '' when it is not duplicating an existing role.
+ enabled: id !== '',
+ })
+}
+
+/**
+ * The permission catalog — the grant vocabulary shared by staff roles and API
+ * key scopes. Static per server boot; store-keyed anyway so labels follow the
+ * store's locale context.
+ */
+export function usePermissionCatalog() {
+ return useQuery({
+ queryKey: useResourceKey('permissions'),
+ queryFn: () => adminClient.permissions.list(),
+ staleTime: 30 * 60 * 1000,
+ })
+}
+
+export function useCreateRole() {
+ return useResourceMutation<unknown, Error, RoleCreateParams>({
+ mutationFn: (params) => adminClient.roles.create(params),
+ invalidate: [['roles']],
+ successMessage: false,
+ errorMessage: false,
+ })
+}
+
+export function useUpdateRole() {
+ return useResourceMutation<unknown, Error, { id: string; params: RoleUpdateParams }>({
+ mutationFn: ({ id, params }) => adminClient.roles.update(id, params),
+ invalidate: [['roles']],
+ successMessage: false,
+ errorMessage: false,
+ })
+}
+
+export function useDeleteRole() {
+ return useResourceMutation<unknown, Error, string>({
+ mutationFn: (id) => adminClient.roles.delete(id),
+ // Deleting a role also updates staff members' role badge lists.
+ invalidate: [['roles'], ['staff']],
+ successMessage: false,
+ errorMessage: false,
+ })
+}
diff --git a/packages/dashboard/src/hooks/use-staff.ts b/packages/dashboard/src/hooks/use-staff.ts
index 10794d5f69..9098726501 100644
--- a/packages/dashboard/src/hooks/use-staff.ts
+++ b/packages/dashboard/src/hooks/use-staff.ts
@@ -17,9 +17,10 @@ export function useInvitations() {
}
export function useRoles() {
- // Roles are global across stores; no storeId scope.
+ // Role definitions are global, but `users_count` is computed for the
+ // current store — so the cache is store-scoped like every other resource.
return useQuery({
- queryKey: ['roles'],
+ queryKey: useResourceKey('roles'),
queryFn: () => adminClient.roles.list({ limit: 100 }),
staleTime: 5 * 60 * 1000,
})
@@ -28,7 +29,8 @@ export function useRoles() {
export function useUpdateStaff() {
return useResourceMutation<unknown, Error, { id: string; params: AdminUserUpdateParams }>({
mutationFn: ({ id, params }) => adminClient.adminUsers.update(id, params),
- invalidate: [['staff']],
+ // Role assignments change each role's users_count on the roles page.
+ invalidate: [['staff'], ['roles']],
successMessage: false,
errorMessage: false,
})
@@ -41,7 +43,7 @@ export function useUpdateStaff() {
export function useRemoveStaff() {
return useResourceMutation<unknown, Error, string>({
mutationFn: (id) => adminClient.adminUsers.delete(id),
- invalidate: [['staff']],
+ invalidate: [['staff'], ['roles']],
successMessage: false,
errorMessage: false,
})
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 6d5652a637..23abf35c8a 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -65,30 +65,8 @@
"full_access_label": "Full access (write_all)",
"read_all_hint": "- اقرأ على كل مورد",
"read_all_label": "Read all (read_all)",
- "read_aria": "إقرأ {{resource}}",
- "read_header": "يقرأ",
- "resource_header": "الموارد",
- "resources": {
- "api_keys": "API مفاتيح",
- "categories": "فئات",
- "customers": "العملاء",
- "dashboard": "Dashboard",
- "fulfillments": "Fulfillments",
- "gift_cards": "بطاقات الهدايا",
- "orders": "طلبات",
- "payments": "المدفوعات",
- "products": "منتجات",
- "promotions": "الترقيات",
- "refunds": "المبالغ المستردة",
- "settings": "إعدادات",
- "stock": "مخزون",
- "store_credits": "Store credits",
- "webhooks": "Webhooks"
- },
"show_more_aria_one": "أظهر {{count}} نطاقًا أكبر",
- "show_more_aria_other": "عرض {{count}} المزيد من النطاقات",
- "write_aria": "اكتب {{resource}}",
- "write_header": "يكتب"
+ "show_more_aria_other": "عرض {{count}} المزيد من النطاقات"
},
"scopes_immutable_help": "Scopes لا يمكن تغييره بعد إنشاء المفتاح. لتغييرها، قم بإنشاء مفتاح جديد بالنطاقات التي تحتاجها وقم بإبطال هذا المفتاح.",
"validation": {
@@ -725,8 +703,8 @@
"label": "مناطق التوصيل"
},
"fulfillment_provider": {
- "label": "مزود التنفيذ",
- "help": "كيفية معالجة عمليات التنفيذ لهذه الطريقة وتتبعها."
+ "help": "كيفية معالجة عمليات التنفيذ لهذه الطريقة وتتبعها.",
+ "label": "مزود التنفيذ"
},
"fulfillment_type": {
"label": "نوع التنفيذ"
@@ -1094,6 +1072,16 @@
"placeholder": "غير محدود"
}
},
+ "role": {
+ "description": {
+ "label": "الوصف",
+ "placeholder": "ما الغرض من هذا الدور؟"
+ },
+ "name": {
+ "label": "الاسم",
+ "placeholder": "مثال: مدير الطلبات"
+ }
+ },
"role_id": {
"label": "الدور"
},
@@ -1864,23 +1852,23 @@
},
"claims": {
"actions": {
- "resolve_refund": "الحل بالاسترداد",
- "resolve_replacement": "الحل بالاستبدال",
- "deny": "رفض",
"create": "مطالبة جديدة",
- "resolve": "حل"
+ "deny": "رفض",
+ "resolve": "حل",
+ "resolve_refund": "الحل بالاسترداد",
+ "resolve_replacement": "الحل بالاستبدال"
},
- "empty": "لا توجد مطالبات لهذا الطلب.",
"create_title": "مطالبة جديدة",
+ "empty": "لا توجد مطالبات لهذا الطلب.",
"refund_amount": "مبلغ الاسترداد",
- "resolve_title": "حل المطالبة",
- "resolution": "طريقة الحل",
"replacement_items": "إرسال بديل لـ",
+ "resolution": "طريقة الحل",
"resolutions": {
"refund": "استرداد",
- "replacement": "استبدال",
- "refund_and_replacement": "استرداد واستبدال"
- }
+ "refund_and_replacement": "استرداد واستبدال",
+ "replacement": "استبدال"
+ },
+ "resolve_title": "حل المطالبة"
},
"dialogs": {
"approve_title": "الموافقة على الطلب؟",
@@ -1892,43 +1880,43 @@
"empty_shipments": "لا توجد شحنات حتى الآن.",
"exchanges": {
"actions": {
- "fulfill": "شحن البديل",
- "create": "استبدال جديد"
+ "create": "استبدال جديد",
+ "fulfill": "شحن البديل"
},
- "price_difference": "فرق السعر",
- "empty": "لا توجد استبدالات لهذا الطلب.",
"create_title": "استبدال جديد",
+ "empty": "لا توجد استبدالات لهذا الطلب.",
+ "price_difference": "فرق السعر",
"replacement_variant": "معرّف النسخة البديلة"
},
"no_delivery_method": "لم يتم اختيار طريقة توصيل.",
"returns": {
"actions": {
"approve": "موافقة",
+ "create": "مرتجع جديد",
"receive": "استلام العناصر",
- "refund": "استرداد",
- "create": "مرتجع جديد"
+ "refund": "استرداد"
},
"confirm": {
"cancel": "إلغاء هذا المرتجع؟ لن تتم إعادة أي مخزون ولن يتم تحويل أي مبلغ."
},
- "refund_total": "إجمالي الاسترداد",
- "received_of": "تم استلام {{received}} من {{requested}}",
+ "create_title": "مرتجع جديد",
+ "empty": "لا توجد مرتجعات لهذا الطلب.",
+ "empty_no_units": "لا توجد سجلات تنفيذ في هذا الطلب يمكن الرجوع إليها.",
+ "memo": "ملاحظة",
"not_resellable": "غير قابل لإعادة البيع",
+ "reason": "السبب",
"receive_title": "استلام العناصر المرتجعة",
+ "received_of": "تم استلام {{received}} من {{requested}}",
"received_quantity": "المستلم",
- "resellable": "قابل لإعادة البيع",
- "refund_title": "استرداد المرتجع",
"refund_amount": "المبلغ",
"refund_method": "استرداد إلى",
"refund_methods": {
"original_payment": "الدفعة الأصلية",
"store_credit": "رصيد المتجر"
},
- "empty": "لا توجد مرتجعات لهذا الطلب.",
- "memo": "ملاحظة",
- "reason": "السبب",
- "create_title": "مرتجع جديد",
- "empty_no_units": "لا توجد سجلات تنفيذ في هذا الطلب يمكن الرجوع إليها."
+ "refund_title": "استرداد المرتجع",
+ "refund_total": "إجمالي الاسترداد",
+ "resellable": "قابل لإعادة البيع"
},
"section_billing_address": "عنوان إرسال الفواتير",
"section_claims": "المطالبات",
@@ -2249,6 +2237,19 @@
"loading": "جارٍ تحميل العرض الترويجي…",
"new_title": "ترقية جديدة"
},
+ "roles": {
+ "add_cta": "إضافة دور",
+ "empty": "لا توجد أدوار بعد",
+ "empty_description": "أنشئ دورًا لمنح أعضاء الفريق وصولًا محددًا.",
+ "new_title": "دور جديد",
+ "subtitle": "حدد ما يمكن لكل دور من أدوار الفريق رؤيته والقيام به",
+ "table": {
+ "members": "الأعضاء",
+ "permissions": "الأذونات",
+ "role": "الدور"
+ },
+ "title": "الأدوار"
+ },
"settings": {
"allowed_origins": {
"add_sheet_title": "أضف الأصل المسموح به",
@@ -2522,21 +2523,77 @@
},
"title": "Payment Methods"
},
+ "permissions": {
+ "descriptions": {
+ "api_keys": "إنشاء بيانات اعتماد API وإلغاؤها",
+ "categories": "شجرة الفئات والتصنيفات",
+ "collections": "مجموعات المنتجات اليدوية والقائمة على القواعد",
+ "customers": "حسابات العملاء والعناوين والبطاقات والمجموعات",
+ "dashboard": "تحليلات المبيعات والأداء",
+ "fulfillments": "تجهيز الطلبات وشحنها وتتبعها",
+ "gift_cards": "بطاقات الهدايا ودفعاتها",
+ "orders": "الطلبات وبنودها والإرجاعات والاستبدالات والمطالبات",
+ "payments": "مدفوعات الطلبات وتحصيلها",
+ "products": "المنتجات والمتغيرات والخيارات والأسعار والوسائط",
+ "promotions": "العروض الترويجية والقواعد وأكواد الخصم",
+ "refunds": "إصدار المبالغ المستردة وعرضها",
+ "settings": "إعدادات المتجر والدفع والتوصيل والضرائب والقنوات",
+ "staff": "أعضاء الفريق والدعوات والأدوار وأذوناتها",
+ "stock": "مستويات المخزون والمواقع والحركات والتحويلات",
+ "store_credits": "أرصدة المتجر للعملاء",
+ "webhooks": "نقاط الويب هوك وعمليات التسليم"
+ },
+ "grid": {
+ "read_aria": "عرض {{resource}}",
+ "read_header": "عرض",
+ "resource_header": "المورد",
+ "write_aria": "إدارة {{resource}}",
+ "write_header": "إدارة"
+ },
+ "groups": {
+ "access": "الوصول",
+ "analytics": "التحليلات",
+ "catalog": "الكتالوج",
+ "customers": "العملاء",
+ "marketing": "التسويق",
+ "orders": "الطلبات",
+ "settings": "الإعدادات"
+ },
+ "resources": {
+ "api_keys": "API مفاتيح",
+ "categories": "فئات",
+ "collections": "المجموعات",
+ "customers": "العملاء",
+ "dashboard": "Dashboard",
+ "fulfillments": "Fulfillments",
+ "gift_cards": "بطاقات الهدايا",
+ "orders": "طلبات",
+ "payments": "المدفوعات",
+ "products": "منتجات",
+ "promotions": "الترقيات",
+ "refunds": "المبالغ المستردة",
+ "settings": "إعدادات",
+ "staff": "الفريق والأدوار",
+ "stock": "مخزون",
+ "store_credits": "Store credits",
+ "webhooks": "Webhooks"
+ }
+ },
"post_sale": {
- "search_placeholder": "البحث بالرقم…",
- "returns_empty": "لا توجد مرتجعات بعد.",
- "exchanges_empty": "لا توجد استبدالات بعد.",
"claims_empty": "لا توجد مطالبات بعد.",
+ "exchanges_empty": "لا توجد استبدالات بعد.",
+ "returns_empty": "لا توجد مرتجعات بعد.",
+ "search_placeholder": "البحث بالرقم…",
"statuses": {
- "requested": "مطلوب",
- "open": "مفتوحة",
"approved": "تمت الموافقة",
+ "canceled": "ملغى",
+ "denied": "مرفوضة",
+ "fulfilled": "تم الشحن",
+ "open": "مفتوحة",
"received": "تم الاستلام",
"refunded": "تم الاسترداد",
- "fulfilled": "تم الشحن",
- "resolved": "تم الحل",
- "denied": "مرفوضة",
- "canceled": "ملغى"
+ "requested": "مطلوب",
+ "resolved": "تم الحل"
}
},
"preferences": {
@@ -3000,38 +3057,83 @@
}
},
"reasons": {
- "title": "المرتجعات والأسباب",
- "description": "القوائم التي يختار منها فريقك عند معالجة المرتجعات والمطالبات والمبالغ المستردة.",
+ "active_label": "متاح للسجلات الجديدة",
"add_cta": "إضافة سبب",
"add_sheet_title": "إضافة سبب",
- "edit_sheet_title": "تعديل السبب",
+ "claim": {
+ "help": "ما حدث من خطأ في التسليم — تالف أو مفقود أو منتج خاطئ.",
+ "title": "أسباب المطالبة"
+ },
"create_description": "تظهر الأسباب في قائمة منسدلة عند إنشاء مرتجع أو مطالبة أو مبلغ مسترد.",
- "name_placeholder": "مثال: مقاس غير مناسب",
- "active_label": "متاح للسجلات الجديدة",
+ "delete_confirm": {
+ "message": "لن يعود {{name}} متاحًا. تحتفظ به السجلات التي تستخدمه بالفعل.",
+ "title": "حذف السبب؟"
+ },
+ "description": "القوائم التي يختار منها فريقك عند معالجة المرتجعات والمطالبات والمبالغ المستردة.",
+ "edit_sheet_title": "تعديل السبب",
"empty": "لا توجد أسباب بعد",
- "inactive": "غير نشط",
"in_use": "قيد الاستخدام",
"in_use_help": "هذا السبب مستخدم بالفعل في سجلات قائمة، لذا لا يمكن حذفه.",
- "delete_confirm": {
- "title": "حذف السبب؟",
- "message": "لن يعود {{name}} متاحًا. تحتفظ به السجلات التي تستخدمه بالفعل."
- },
+ "inactive": "غير نشط",
"messages": {
"created": "تم إنشاء السبب",
- "updated": "تم تحديث السبب",
- "deleted": "تم حذف السبب"
+ "deleted": "تم حذف السبب",
+ "updated": "تم تحديث السبب"
+ },
+ "name_placeholder": "مثال: مقاس غير مناسب",
+ "refund": {
+ "help": "سبب إعادة الأموال. يُستخدم في تقارير جميع المبالغ المستردة.",
+ "title": "أسباب رد المبلغ"
},
"return": {
- "title": "أسباب الإرجاع",
- "help": "سبب إعادة العميل للمنتج. مشترك بين المرتجعات والاستبدال."
+ "help": "سبب إعادة العميل للمنتج. مشترك بين المرتجعات والاستبدال.",
+ "title": "أسباب الإرجاع"
},
- "claim": {
- "title": "أسباب المطالبة",
- "help": "ما حدث من خطأ في التسليم — تالف أو مفقود أو منتج خاطئ."
+ "title": "المرتجعات والأسباب"
+ },
+ "roles": {
+ "badges": {
+ "full_access": "وصول كامل",
+ "more": "+{{count}} أخرى",
+ "none": "لا توجد أذونات",
+ "protected": "محمي"
},
- "refund": {
- "title": "أسباب رد المبلغ",
- "help": "سبب إعادة الأموال. يُستخدم في تقارير جميع المبالغ المستردة."
+ "confirm": {
+ "delete_message": "هل تريد حذف الدور \"{{name}}\"؟ لا يمكن التراجع عن هذا الإجراء.",
+ "delete_title": "حذف الدور"
+ },
+ "duplicate_name": "نسخة {{name}}",
+ "errors": {
+ "failed_to_delete": "فشل حذف الدور"
+ },
+ "form": {
+ "details_section": "التفاصيل",
+ "locked_hint": "هذا الدور محمي ولا يمكن تعديله.",
+ "members": "الأعضاء",
+ "more_members": "+{{count}} أخرى",
+ "permissions_count": "الأذونات",
+ "permissions_section": "الأذونات",
+ "summary_section": "الملخص"
+ },
+ "manage_roles_link": "إدارة الأدوار",
+ "messages": {
+ "created": "تم إنشاء الدور",
+ "deleted": "تم حذف الدور",
+ "updated": "تم تحديث الدور"
+ },
+ "presets": {
+ "clear": "مسح",
+ "full_access": "وصول كامل",
+ "read_only": "قراءة فقط"
+ },
+ "templates": {
+ "merchandiser": "مسؤول المنتجات",
+ "order_manager": "مدير الطلبات",
+ "start_from": "ابدأ من:",
+ "support": "الدعم"
+ },
+ "validation": {
+ "name_required": "الاسم مطلوب"
}
},
"settings": {
@@ -3068,6 +3170,7 @@
"product_types": "أنواع المنتجات",
"profile": "الملف الشخصي",
"reasons": "المرتجعات والأسباب",
+ "roles": "الأدوار",
"staff": "الموظفون",
"stock_locations": "مواقع المخزون",
"store": "المتجر",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index f84c608dae..71f2c91cca 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -65,30 +65,8 @@
"full_access_label": "Vollzugriff (write_all)",
"read_all_hint": "– Lesen für jede Ressource",
"read_all_label": "Alles lesen (read_all)",
- "read_aria": "{{resource}} lesen",
- "read_header": "Lesen",
- "resource_header": "Ressource",
- "resources": {
- "api_keys": "API-Schlüssel",
- "categories": "Kategorien",
- "customers": "Kunden",
- "dashboard": "Dashboard",
- "fulfillments": "Fulfillments",
- "gift_cards": "Geschenkkarten",
- "orders": "Bestellungen",
- "payments": "Zahlungen",
- "products": "Produkte",
- "promotions": "Aktionen",
- "refunds": "Rückerstattungen",
- "settings": "Einstellungen",
- "stock": "Bestand",
- "store_credits": "Guthaben",
- "webhooks": "Webhooks"
- },
"show_more_aria_one": "{{count}} weiteren Geltungsbereich anzeigen",
- "show_more_aria_other": "{{count}} weitere Geltungsbereiche anzeigen",
- "write_aria": "{{resource}} schreiben",
- "write_header": "Schreiben"
+ "show_more_aria_other": "{{count}} weitere Geltungsbereiche anzeigen"
},
"scopes_immutable_help": "Berechtigungen können nach der Erstellung eines Schlüssels nicht mehr geändert werden. Um sie zu ändern, erstellen Sie einen neuen Schlüssel mit den benötigten Berechtigungen und widerrufen Sie diesen.",
"validation": {
@@ -725,8 +703,8 @@
"label": "Lieferzonen"
},
"fulfillment_provider": {
- "label": "Fulfillment-Anbieter",
- "help": "Wie Sendungen dieser Methode abgewickelt und verfolgt werden."
+ "help": "Wie Sendungen dieser Methode abgewickelt und verfolgt werden.",
+ "label": "Fulfillment-Anbieter"
},
"fulfillment_type": {
"label": "Fulfillment-Typ"
@@ -1094,6 +1072,16 @@
"placeholder": "Unbegrenzt"
}
},
+ "role": {
+ "description": {
+ "label": "Beschreibung",
+ "placeholder": "Wofür ist diese Rolle gedacht?"
+ },
+ "name": {
+ "label": "Name",
+ "placeholder": "z. B. Bestellmanager"
+ }
+ },
"role_id": {
"label": "Rolle"
},
@@ -1864,23 +1852,23 @@
},
"claims": {
"actions": {
- "resolve_refund": "Mit Erstattung lösen",
- "resolve_replacement": "Mit Ersatz lösen",
- "deny": "Ablehnen",
"create": "Neue Reklamation",
- "resolve": "Lösen"
+ "deny": "Ablehnen",
+ "resolve": "Lösen",
+ "resolve_refund": "Mit Erstattung lösen",
+ "resolve_replacement": "Mit Ersatz lösen"
},
- "empty": "Keine Reklamationen für diese Bestellung.",
"create_title": "Neue Reklamation",
+ "empty": "Keine Reklamationen für diese Bestellung.",
"refund_amount": "Erstattungsbetrag",
- "resolve_title": "Reklamation lösen",
- "resolution": "Lösungsweg",
"replacement_items": "Ersatz senden für",
+ "resolution": "Lösungsweg",
"resolutions": {
"refund": "Erstattung",
- "replacement": "Ersatz",
- "refund_and_replacement": "Erstattung und Ersatz"
- }
+ "refund_and_replacement": "Erstattung und Ersatz",
+ "replacement": "Ersatz"
+ },
+ "resolve_title": "Reklamation lösen"
},
"dialogs": {
"approve_title": "Bestellung genehmigen?",
@@ -1892,43 +1880,43 @@
"empty_shipments": "Noch keine Sendungen.",
"exchanges": {
"actions": {
- "fulfill": "Ersatz versenden",
- "create": "Neuer Umtausch"
+ "create": "Neuer Umtausch",
+ "fulfill": "Ersatz versenden"
},
- "price_difference": "Preisdifferenz",
- "empty": "Kein Umtausch für diese Bestellung.",
"create_title": "Neuer Umtausch",
+ "empty": "Kein Umtausch für diese Bestellung.",
+ "price_difference": "Preisdifferenz",
"replacement_variant": "Varianten-ID des Ersatzes"
},
"no_delivery_method": "Keine Versandmethode ausgewählt.",
"returns": {
"actions": {
"approve": "Genehmigen",
+ "create": "Neue Retoure",
"receive": "Artikel annehmen",
- "refund": "Erstatten",
- "create": "Neue Retoure"
+ "refund": "Erstatten"
},
"confirm": {
"cancel": "Diese Retoure stornieren? Es wird nichts eingelagert und kein Geld bewegt."
},
- "refund_total": "Erstattungssumme",
- "received_of": "{{received}} von {{requested}} erhalten",
+ "create_title": "Neue Retoure",
+ "empty": "Keine Retouren für diese Bestellung.",
+ "empty_no_units": "Für diese Bestellung gibt es keine Fulfillment-Einträge, auf die sich eine Retoure beziehen könnte.",
+ "memo": "Notiz",
"not_resellable": "Nicht wiederverkäuflich",
+ "reason": "Grund",
"receive_title": "Retournierte Artikel annehmen",
+ "received_of": "{{received}} von {{requested}} erhalten",
"received_quantity": "Erhalten",
- "resellable": "Wiederverkäuflich",
- "refund_title": "Retoure erstatten",
"refund_amount": "Betrag",
"refund_method": "Erstatten an",
"refund_methods": {
"original_payment": "Ursprüngliche Zahlung",
"store_credit": "Guthaben"
},
- "empty": "Keine Retouren für diese Bestellung.",
- "memo": "Notiz",
- "reason": "Grund",
- "create_title": "Neue Retoure",
- "empty_no_units": "Für diese Bestellung gibt es keine Fulfillment-Einträge, auf die sich eine Retoure beziehen könnte."
+ "refund_title": "Retoure erstatten",
+ "refund_total": "Erstattungssumme",
+ "resellable": "Wiederverkäuflich"
},
"section_billing_address": "Rechnungsadresse",
"section_claims": "Reklamationen",
@@ -2249,6 +2237,19 @@
"loading": "Aktion wird geladen…",
"new_title": "Neue Aktion"
},
+ "roles": {
+ "add_cta": "Rolle hinzufügen",
+ "empty": "Noch keine Rollen",
+ "empty_description": "Erstelle eine Rolle, um Teammitgliedern gezielten Zugriff zu geben.",
+ "new_title": "Neue Rolle",
+ "subtitle": "Lege fest, was jede Mitarbeiterrolle sehen und tun darf",
+ "table": {
+ "members": "Mitglieder",
+ "permissions": "Berechtigungen",
+ "role": "Rolle"
+ },
+ "title": "Rollen"
+ },
"settings": {
"allowed_origins": {
"add_sheet_title": "Erlaubten Ursprung hinzufügen",
@@ -2522,21 +2523,77 @@
},
"title": "Zahlungsarten"
},
+ "permissions": {
+ "descriptions": {
+ "api_keys": "API-Zugangsdaten erstellen und widerrufen",
+ "categories": "Kategoriebaum und Taxonomien",
+ "collections": "Manuelle und regelbasierte Produktkollektionen",
+ "customers": "Kundenkonten, Adressen, Karten und Gruppen",
+ "dashboard": "Umsatz- und Leistungsanalysen",
+ "fulfillments": "Bestellungen packen, versenden und verfolgen",
+ "gift_cards": "Geschenkkarten und Geschenkkarten-Chargen",
+ "orders": "Bestellungen, Positionen, Retouren, Umtausch und Reklamationen",
+ "payments": "Zahlungen und Zahlungserfassung",
+ "products": "Produkte, Varianten, Optionen, Preise und Medien",
+ "promotions": "Aktionen, Regeln und Gutscheincodes",
+ "refunds": "Erstattungen ausstellen und einsehen",
+ "settings": "Shop-, Zahlungs-, Liefer-, Steuer- und Kanalkonfiguration",
+ "staff": "Teammitglieder, Einladungen, Rollen und ihre Berechtigungen",
+ "stock": "Bestände, Lagerorte, Bewegungen und Transfers",
+ "store_credits": "Guthaben der Kunden",
+ "webhooks": "Webhook-Endpunkte und Zustellungen"
+ },
+ "grid": {
+ "read_aria": "{{resource}} ansehen",
+ "read_header": "Ansehen",
+ "resource_header": "Ressource",
+ "write_aria": "{{resource}} verwalten",
+ "write_header": "Verwalten"
+ },
+ "groups": {
+ "access": "Zugriff",
+ "analytics": "Analysen",
+ "catalog": "Katalog",
+ "customers": "Kunden",
+ "marketing": "Marketing",
+ "orders": "Bestellungen",
+ "settings": "Einstellungen"
+ },
+ "resources": {
+ "api_keys": "API-Schlüssel",
+ "categories": "Kategorien",
+ "collections": "Kollektionen",
+ "customers": "Kunden",
+ "dashboard": "Dashboard",
+ "fulfillments": "Fulfillments",
+ "gift_cards": "Geschenkkarten",
+ "orders": "Bestellungen",
+ "payments": "Zahlungen",
+ "products": "Produkte",
+ "promotions": "Aktionen",
+ "refunds": "Rückerstattungen",
+ "settings": "Einstellungen",
+ "staff": "Team & Rollen",
+ "stock": "Bestand",
+ "store_credits": "Guthaben",
+ "webhooks": "Webhooks"
+ }
+ },
"post_sale": {
- "search_placeholder": "Nach Nummer suchen…",
- "returns_empty": "Noch keine Retouren.",
- "exchanges_empty": "Noch kein Umtausch.",
"claims_empty": "Noch keine Reklamationen.",
+ "exchanges_empty": "Noch kein Umtausch.",
+ "returns_empty": "Noch keine Retouren.",
+ "search_placeholder": "Nach Nummer suchen…",
"statuses": {
- "requested": "Angefragt",
- "open": "Offen",
"approved": "Genehmigt",
+ "canceled": "Storniert",
+ "denied": "Abgelehnt",
+ "fulfilled": "Versandt",
+ "open": "Offen",
"received": "Erhalten",
"refunded": "Erstattet",
- "fulfilled": "Versandt",
- "resolved": "Gelöst",
- "denied": "Abgelehnt",
- "canceled": "Storniert"
+ "requested": "Angefragt",
+ "resolved": "Gelöst"
}
},
"preferences": {
@@ -2994,38 +3051,83 @@
}
},
"reasons": {
- "title": "Rücksendungen & Gründe",
- "description": "Die Auswahllisten, aus denen Ihr Team bei Rücksendungen, Reklamationen und Rückerstattungen wählt.",
+ "active_label": "Für neue Vorgänge verfügbar",
"add_cta": "Grund hinzufügen",
"add_sheet_title": "Grund hinzufügen",
- "edit_sheet_title": "Grund bearbeiten",
+ "claim": {
+ "help": "Was bei der Lieferung schiefging – beschädigt, fehlend oder falscher Artikel.",
+ "title": "Reklamationsgründe"
+ },
"create_description": "Gründe erscheinen als Auswahl, wenn Mitarbeitende eine Rücksendung, Reklamation oder Rückerstattung anlegen.",
- "name_placeholder": "z. B. Falsche Größe",
- "active_label": "Für neue Vorgänge verfügbar",
+ "delete_confirm": {
+ "message": "{{name}} wird nicht mehr angeboten. Bestehende Vorgänge behalten ihn.",
+ "title": "Grund löschen?"
+ },
+ "description": "Die Auswahllisten, aus denen Ihr Team bei Rücksendungen, Reklamationen und Rückerstattungen wählt.",
+ "edit_sheet_title": "Grund bearbeiten",
"empty": "Noch keine Gründe",
- "inactive": "Inaktiv",
"in_use": "In Verwendung",
"in_use_help": "Dieser Grund wird bereits von vorhandenen Datensätzen verwendet und kann daher nicht gelöscht werden.",
- "delete_confirm": {
- "title": "Grund löschen?",
- "message": "{{name}} wird nicht mehr angeboten. Bestehende Vorgänge behalten ihn."
- },
+ "inactive": "Inaktiv",
"messages": {
"created": "Grund erstellt",
- "updated": "Grund aktualisiert",
- "deleted": "Grund gelöscht"
+ "deleted": "Grund gelöscht",
+ "updated": "Grund aktualisiert"
+ },
+ "name_placeholder": "z. B. Falsche Größe",
+ "refund": {
+ "help": "Warum Geld zurückging. Für Auswertungen über alle Rückerstattungen.",
+ "title": "Rückerstattungsgründe"
},
"return": {
- "title": "Rücksendegründe",
- "help": "Warum ein Kunde etwas zurückschickt. Gilt für Rücksendungen und Umtausch."
+ "help": "Warum ein Kunde etwas zurückschickt. Gilt für Rücksendungen und Umtausch.",
+ "title": "Rücksendegründe"
},
- "claim": {
- "title": "Reklamationsgründe",
- "help": "Was bei der Lieferung schiefging – beschädigt, fehlend oder falscher Artikel."
+ "title": "Rücksendungen & Gründe"
+ },
+ "roles": {
+ "badges": {
+ "full_access": "Vollzugriff",
+ "more": "+{{count}} weitere",
+ "none": "Keine Berechtigungen",
+ "protected": "Geschützt"
},
- "refund": {
- "title": "Rückerstattungsgründe",
- "help": "Warum Geld zurückging. Für Auswertungen über alle Rückerstattungen."
+ "confirm": {
+ "delete_message": "Rolle \"{{name}}\" löschen? Diese Aktion kann nicht rückgängig gemacht werden.",
+ "delete_title": "Rolle löschen"
+ },
+ "duplicate_name": "{{name}} Kopie",
+ "errors": {
+ "failed_to_delete": "Rolle konnte nicht gelöscht werden"
+ },
+ "form": {
+ "details_section": "Details",
+ "locked_hint": "Diese Rolle ist geschützt und kann nicht bearbeitet werden.",
+ "members": "Mitglieder",
+ "more_members": "+{{count}} weitere",
+ "permissions_count": "Berechtigungen",
+ "permissions_section": "Berechtigungen",
+ "summary_section": "Zusammenfassung"
+ },
+ "manage_roles_link": "Rollen verwalten",
+ "messages": {
+ "created": "Rolle erstellt",
+ "deleted": "Rolle gelöscht",
+ "updated": "Rolle aktualisiert"
+ },
+ "presets": {
+ "clear": "Leeren",
+ "full_access": "Vollzugriff",
+ "read_only": "Nur Lesen"
+ },
+ "templates": {
+ "merchandiser": "Merchandiser",
+ "order_manager": "Bestellmanager",
+ "start_from": "Vorlage:",
+ "support": "Support"
+ },
+ "validation": {
+ "name_required": "Name ist erforderlich"
}
},
"settings": {
@@ -3062,6 +3164,7 @@
"product_types": "Produkttypen",
"profile": "Profil",
"reasons": "Rücksendungen & Gründe",
+ "roles": "Rollen",
"staff": "Mitarbeiter",
"stock_locations": "Lagerstandorte",
"store": "Shop",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 069af5b24f..86c8a459f0 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -65,30 +65,8 @@
"full_access_label": "Full access (write_all)",
"read_all_hint": "— read on every resource",
"read_all_label": "Read all (read_all)",
- "read_aria": "Read {{resource}}",
- "read_header": "Read",
- "resource_header": "Resource",
- "resources": {
- "api_keys": "API keys",
- "categories": "Categories",
- "customers": "Customers",
- "dashboard": "Dashboard",
- "fulfillments": "Fulfillments",
- "gift_cards": "Gift cards",
- "orders": "Orders",
- "payments": "Payments",
- "products": "Products",
- "promotions": "Promotions",
- "refunds": "Refunds",
- "settings": "Settings",
- "stock": "Stock",
- "store_credits": "Store credits",
- "webhooks": "Webhooks"
- },
"show_more_aria_one": "Show {{count}} more scope",
- "show_more_aria_other": "Show {{count}} more scopes",
- "write_aria": "Write {{resource}}",
- "write_header": "Write"
+ "show_more_aria_other": "Show {{count}} more scopes"
},
"scopes_immutable_help": "Scopes can't be changed after a key is created. To change them, create a new key with the scopes you need and revoke this one.",
"validation": {
@@ -725,8 +703,8 @@
"label": "Delivery zones"
},
"fulfillment_provider": {
- "label": "Fulfillment provider",
- "help": "How fulfillments for this method are dispatched and tracked."
+ "help": "How fulfillments for this method are dispatched and tracked.",
+ "label": "Fulfillment provider"
},
"fulfillment_type": {
"label": "Fulfillment type"
@@ -1094,6 +1072,16 @@
"placeholder": "Unlimited"
}
},
+ "role": {
+ "description": {
+ "label": "Description",
+ "placeholder": "What is this role for?"
+ },
+ "name": {
+ "label": "Name",
+ "placeholder": "e.g. Order manager"
+ }
+ },
"role_id": {
"label": "Role"
},
@@ -1864,23 +1852,23 @@
},
"claims": {
"actions": {
- "resolve_refund": "Resolve with refund",
- "resolve_replacement": "Resolve with replacement",
- "deny": "Deny",
"create": "New claim",
- "resolve": "Resolve"
+ "deny": "Deny",
+ "resolve": "Resolve",
+ "resolve_refund": "Resolve with refund",
+ "resolve_replacement": "Resolve with replacement"
},
- "empty": "No claims for this order.",
"create_title": "New claim",
+ "empty": "No claims for this order.",
"refund_amount": "Refund amount",
- "resolve_title": "Resolve claim",
- "resolution": "How to resolve",
"replacement_items": "Send a replacement for",
+ "resolution": "How to resolve",
"resolutions": {
"refund": "Refund",
- "replacement": "Replacement",
- "refund_and_replacement": "Refund and replacement"
- }
+ "refund_and_replacement": "Refund and replacement",
+ "replacement": "Replacement"
+ },
+ "resolve_title": "Resolve claim"
},
"dialogs": {
"approve_title": "Approve order?",
@@ -1892,43 +1880,43 @@
"empty_shipments": "No shipments yet.",
"exchanges": {
"actions": {
- "fulfill": "Ship replacement",
- "create": "New exchange"
+ "create": "New exchange",
+ "fulfill": "Ship replacement"
},
- "price_difference": "Price difference",
- "empty": "No exchanges for this order.",
"create_title": "New exchange",
+ "empty": "No exchanges for this order.",
+ "price_difference": "Price difference",
"replacement_variant": "Replacement variant ID"
},
"no_delivery_method": "No delivery method selected.",
"returns": {
"actions": {
"approve": "Approve",
+ "create": "New return",
"receive": "Receive items",
- "refund": "Refund",
- "create": "New return"
+ "refund": "Refund"
},
"confirm": {
"cancel": "Cancel this return? Nothing will be restocked and no money will move."
},
- "refund_total": "Refund total",
- "received_of": "{{received}} of {{requested}} received",
+ "create_title": "New return",
+ "empty": "No returns for this order.",
+ "empty_no_units": "This order has no fulfillment records to return against.",
+ "memo": "Note",
"not_resellable": "Not resellable",
+ "reason": "Reason",
"receive_title": "Receive returned items",
+ "received_of": "{{received}} of {{requested}} received",
"received_quantity": "Received",
- "resellable": "Resellable",
- "refund_title": "Refund return",
"refund_amount": "Amount",
"refund_method": "Refund to",
"refund_methods": {
"original_payment": "Original payment",
"store_credit": "Store credit"
},
- "empty": "No returns for this order.",
- "memo": "Note",
- "reason": "Reason",
- "create_title": "New return",
- "empty_no_units": "This order has no fulfillment records to return against."
+ "refund_title": "Refund return",
+ "refund_total": "Refund total",
+ "resellable": "Resellable"
},
"section_billing_address": "Billing address",
"section_claims": "Claims",
@@ -2249,6 +2237,19 @@
"loading": "Loading promotion…",
"new_title": "New promotion"
},
+ "roles": {
+ "add_cta": "Add role",
+ "empty": "No roles yet",
+ "empty_description": "Create a role to give staff members scoped access.",
+ "new_title": "New role",
+ "subtitle": "Define what each staff role can see and do",
+ "table": {
+ "members": "Members",
+ "permissions": "Permissions",
+ "role": "Role"
+ },
+ "title": "Roles"
+ },
"settings": {
"allowed_origins": {
"add_sheet_title": "Add allowed origin",
@@ -2522,21 +2523,77 @@
},
"title": "Payment Methods"
},
+ "permissions": {
+ "descriptions": {
+ "api_keys": "Create and revoke API credentials",
+ "categories": "Category tree and taxonomies",
+ "collections": "Manual and rule-based product collections",
+ "customers": "Customer accounts, addresses, cards and groups",
+ "dashboard": "Sales and performance analytics",
+ "fulfillments": "Pack, ship and track order fulfillments",
+ "gift_cards": "Gift cards and gift card batches",
+ "orders": "Orders, line items, returns, exchanges and claims",
+ "payments": "Order payments and payment capture",
+ "products": "Products, variants, options, prices and media",
+ "promotions": "Promotions, rules and coupon codes",
+ "refunds": "Issue and view refunds",
+ "settings": "Store, payment, delivery, tax and channel configuration",
+ "staff": "Team members, invitations, roles and their permissions",
+ "stock": "Stock levels, locations, movements and transfers",
+ "store_credits": "Customer store credit balances",
+ "webhooks": "Webhook endpoints and deliveries"
+ },
+ "grid": {
+ "read_aria": "View {{resource}}",
+ "read_header": "View",
+ "resource_header": "Resource",
+ "write_aria": "Manage {{resource}}",
+ "write_header": "Manage"
+ },
+ "groups": {
+ "access": "Access",
+ "analytics": "Analytics",
+ "catalog": "Catalog",
+ "customers": "Customers",
+ "marketing": "Marketing",
+ "orders": "Orders",
+ "settings": "Settings"
+ },
+ "resources": {
+ "api_keys": "API keys",
+ "categories": "Categories",
+ "collections": "Collections",
+ "customers": "Customers",
+ "dashboard": "Dashboard",
+ "fulfillments": "Fulfillments",
+ "gift_cards": "Gift cards",
+ "orders": "Orders",
+ "payments": "Payments",
+ "products": "Products",
+ "promotions": "Promotions",
+ "refunds": "Refunds",
+ "settings": "Settings",
+ "staff": "Staff & roles",
+ "stock": "Stock",
+ "store_credits": "Store credits",
+ "webhooks": "Webhooks"
+ }
+ },
"post_sale": {
- "search_placeholder": "Search by number…",
- "returns_empty": "No returns yet.",
- "exchanges_empty": "No exchanges yet.",
"claims_empty": "No claims yet.",
+ "exchanges_empty": "No exchanges yet.",
+ "returns_empty": "No returns yet.",
+ "search_placeholder": "Search by number…",
"statuses": {
- "requested": "Requested",
- "open": "Open",
"approved": "Approved",
+ "canceled": "Canceled",
+ "denied": "Denied",
+ "fulfilled": "Fulfilled",
+ "open": "Open",
"received": "Received",
"refunded": "Refunded",
- "fulfilled": "Fulfilled",
- "resolved": "Resolved",
- "denied": "Denied",
- "canceled": "Canceled"
+ "requested": "Requested",
+ "resolved": "Resolved"
}
},
"preferences": {
@@ -2994,38 +3051,83 @@
}
},
"reasons": {
- "title": "Returns & reasons",
- "description": "The vocabularies your team picks from when handling returns, claims and refunds.",
+ "active_label": "Available on new records",
"add_cta": "Add reason",
"add_sheet_title": "Add reason",
- "edit_sheet_title": "Edit reason",
+ "claim": {
+ "help": "What went wrong with a delivery — damaged, missing or wrong item.",
+ "title": "Claim reasons"
+ },
"create_description": "Reasons appear in a dropdown when staff open a return, claim or refund.",
- "name_placeholder": "e.g. Wrong size",
- "active_label": "Available on new records",
+ "delete_confirm": {
+ "message": "{{name}} will no longer be offered. Records already using it keep it.",
+ "title": "Delete reason?"
+ },
+ "description": "The vocabularies your team picks from when handling returns, claims and refunds.",
+ "edit_sheet_title": "Edit reason",
"empty": "No reasons yet",
- "inactive": "Inactive",
"in_use": "In use",
"in_use_help": "This reason is already used by existing records, so it cannot be deleted.",
- "delete_confirm": {
- "title": "Delete reason?",
- "message": "{{name}} will no longer be offered. Records already using it keep it."
- },
+ "inactive": "Inactive",
"messages": {
"created": "Reason created",
- "updated": "Reason updated",
- "deleted": "Reason deleted"
+ "deleted": "Reason deleted",
+ "updated": "Reason updated"
+ },
+ "name_placeholder": "e.g. Wrong size",
+ "refund": {
+ "help": "Why money went back. Used for reporting across every refund.",
+ "title": "Refund reasons"
},
"return": {
- "title": "Return reasons",
- "help": "Why a customer is sending something back. Shared by returns and exchanges."
+ "help": "Why a customer is sending something back. Shared by returns and exchanges.",
+ "title": "Return reasons"
},
- "claim": {
- "title": "Claim reasons",
- "help": "What went wrong with a delivery — damaged, missing or wrong item."
+ "title": "Returns & reasons"
+ },
+ "roles": {
+ "badges": {
+ "full_access": "Full access",
+ "more": "+{{count}} more",
+ "none": "No permissions",
+ "protected": "Protected"
},
- "refund": {
- "title": "Refund reasons",
- "help": "Why money went back. Used for reporting across every refund."
+ "confirm": {
+ "delete_message": "Delete the role \"{{name}}\"? This action cannot be undone.",
+ "delete_title": "Delete role"
+ },
+ "duplicate_name": "{{name}} copy",
+ "errors": {
+ "failed_to_delete": "Failed to delete role"
+ },
+ "form": {
+ "details_section": "Details",
+ "locked_hint": "This role is protected and cannot be edited.",
+ "members": "Members",
+ "more_members": "+{{count}} more",
+ "permissions_count": "Permissions",
+ "permissions_section": "Permissions",
+ "summary_section": "Summary"
+ },
+ "manage_roles_link": "Manage roles",
+ "messages": {
+ "created": "Role created",
+ "deleted": "Role deleted",
+ "updated": "Role updated"
+ },
+ "presets": {
+ "clear": "Clear",
+ "full_access": "Full access",
+ "read_only": "Read only"
+ },
+ "templates": {
+ "merchandiser": "Merchandiser",
+ "order_manager": "Order manager",
+ "start_from": "Start from:",
+ "support": "Support"
+ },
+ "validation": {
+ "name_required": "Name is required"
}
},
"settings": {
@@ -3062,6 +3164,7 @@
"product_types": "Product types",
"profile": "Profile",
"reasons": "Returns & reasons",
+ "roles": "Roles",
"staff": "Staff",
"stock_locations": "Stock locations",
"store": "Store",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 03ae855d06..3ce5c1d112 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -65,30 +65,8 @@
"full_access_label": "Accès complet (write_all)",
"read_all_hint": "– lecture sur chaque ressource",
"read_all_label": "Tout lire (read_all)",
- "read_aria": "Lire {{resource}}",
- "read_header": "Lecture",
- "resource_header": "Ressource",
- "resources": {
- "api_keys": "Clés API",
- "categories": "Catégories",
- "customers": "Clients",
- "dashboard": "Tableau de bord",
- "fulfillments": "Exécutions des commandes",
- "gift_cards": "Cartes cadeaux",
- "orders": "Commandes",
- "payments": "Paiements",
- "products": "Produits",
- "promotions": "Promotions",
- "refunds": "Remboursements",
- "settings": "Paramètres",
- "stock": "Stock",
- "store_credits": "Avoirs en boutique",
- "webhooks": "Webhooks"
- },
"show_more_aria_one": "Afficher {{count}} portée supplémentaire",
- "show_more_aria_other": "Afficher {{count}} portées supplémentaires",
- "write_aria": "Écrire {{resource}}",
- "write_header": "Écriture"
+ "show_more_aria_other": "Afficher {{count}} portées supplémentaires"
},
"scopes_immutable_help": "Les portées ne peuvent pas être modifiées après la création d'une clé. Pour les modifier, créez une nouvelle clé avec les portées dont vous avez besoin et révoquez celle-ci.",
"validation": {
@@ -725,8 +703,8 @@
"label": "Zones de livraison"
},
"fulfillment_provider": {
- "label": "Fournisseur d'expédition",
- "help": "Comment les expéditions de cette méthode sont traitées et suivies."
+ "help": "Comment les expéditions de cette méthode sont traitées et suivies.",
+ "label": "Fournisseur d'expédition"
},
"fulfillment_type": {
"label": "Type de traitement"
@@ -1094,6 +1072,16 @@
"placeholder": "Illimité"
}
},
+ "role": {
+ "description": {
+ "label": "Description",
+ "placeholder": "À quoi sert ce rôle ?"
+ },
+ "name": {
+ "label": "Nom",
+ "placeholder": "ex. Gestionnaire de commandes"
+ }
+ },
"role_id": {
"label": "Rôle"
},
@@ -1864,23 +1852,23 @@
},
"claims": {
"actions": {
- "resolve_refund": "Résoudre par remboursement",
- "resolve_replacement": "Résoudre par remplacement",
- "deny": "Refuser",
"create": "Nouvelle réclamation",
- "resolve": "Résoudre"
+ "deny": "Refuser",
+ "resolve": "Résoudre",
+ "resolve_refund": "Résoudre par remboursement",
+ "resolve_replacement": "Résoudre par remplacement"
},
- "empty": "Aucune réclamation pour cette commande.",
"create_title": "Nouvelle réclamation",
+ "empty": "Aucune réclamation pour cette commande.",
"refund_amount": "Montant du remboursement",
- "resolve_title": "Résoudre la réclamation",
- "resolution": "Mode de résolution",
"replacement_items": "Envoyer un remplacement pour",
+ "resolution": "Mode de résolution",
"resolutions": {
"refund": "Remboursement",
- "replacement": "Remplacement",
- "refund_and_replacement": "Remboursement et remplacement"
- }
+ "refund_and_replacement": "Remboursement et remplacement",
+ "replacement": "Remplacement"
+ },
+ "resolve_title": "Résoudre la réclamation"
},
"dialogs": {
"approve_title": "Approuver la commande ?",
@@ -1892,43 +1880,43 @@
"empty_shipments": "Aucune expédition pour le moment.",
"exchanges": {
"actions": {
- "fulfill": "Expédier le remplacement",
- "create": "Nouvel échange"
+ "create": "Nouvel échange",
+ "fulfill": "Expédier le remplacement"
},
- "price_difference": "Différence de prix",
- "empty": "Aucun échange pour cette commande.",
"create_title": "Nouvel échange",
+ "empty": "Aucun échange pour cette commande.",
+ "price_difference": "Différence de prix",
"replacement_variant": "ID de la variante de remplacement"
},
"no_delivery_method": "Aucune méthode de livraison sélectionnée.",
"returns": {
"actions": {
"approve": "Approuver",
+ "create": "Nouveau retour",
"receive": "Réceptionner les articles",
- "refund": "Rembourser",
- "create": "Nouveau retour"
+ "refund": "Rembourser"
},
"confirm": {
"cancel": "Annuler ce retour ? Aucun article ne sera remis en stock et aucun montant ne sera remboursé."
},
- "refund_total": "Total du remboursement",
- "received_of": "{{received}} sur {{requested}} reçus",
+ "create_title": "Nouveau retour",
+ "empty": "Aucun retour pour cette commande.",
+ "empty_no_units": "Cette commande n’a aucun enregistrement de traitement sur lequel baser un retour.",
+ "memo": "Note",
"not_resellable": "Non revendable",
+ "reason": "Motif",
"receive_title": "Réceptionner les articles retournés",
+ "received_of": "{{received}} sur {{requested}} reçus",
"received_quantity": "Reçu",
- "resellable": "Revendable",
- "refund_title": "Rembourser le retour",
"refund_amount": "Montant",
"refund_method": "Rembourser sur",
"refund_methods": {
"original_payment": "Paiement d’origine",
"store_credit": "Avoir"
},
- "empty": "Aucun retour pour cette commande.",
- "memo": "Note",
- "reason": "Motif",
- "create_title": "Nouveau retour",
- "empty_no_units": "Cette commande n’a aucun enregistrement de traitement sur lequel baser un retour."
+ "refund_title": "Rembourser le retour",
+ "refund_total": "Total du remboursement",
+ "resellable": "Revendable"
},
"section_billing_address": "Adresse de facturation",
"section_claims": "Réclamations",
@@ -2249,6 +2237,19 @@
"loading": "Chargement de la promotion…",
"new_title": "Nouvelle promotion"
},
+ "roles": {
+ "add_cta": "Ajouter un rôle",
+ "empty": "Aucun rôle pour le moment",
+ "empty_description": "Créez un rôle pour donner un accès ciblé aux membres de l’équipe.",
+ "new_title": "Nouveau rôle",
+ "subtitle": "Définissez ce que chaque rôle du personnel peut voir et faire",
+ "table": {
+ "members": "Membres",
+ "permissions": "Permissions",
+ "role": "Rôle"
+ },
+ "title": "Rôles"
+ },
"settings": {
"allowed_origins": {
"add_sheet_title": "Ajouter une origine autorisée",
@@ -2522,21 +2523,77 @@
},
"title": "Moyens de paiement"
},
+ "permissions": {
+ "descriptions": {
+ "api_keys": "Créer et révoquer des identifiants API",
+ "categories": "Arborescence des catégories et taxonomies",
+ "collections": "Collections manuelles et basées sur des règles",
+ "customers": "Comptes clients, adresses, cartes et groupes",
+ "dashboard": "Analyses des ventes et des performances",
+ "fulfillments": "Préparer, expédier et suivre les commandes",
+ "gift_cards": "Cartes cadeaux et lots de cartes cadeaux",
+ "orders": "Commandes, articles, retours, échanges et réclamations",
+ "payments": "Paiements des commandes et capture des paiements",
+ "products": "Produits, variantes, options, prix et médias",
+ "promotions": "Promotions, règles et codes promo",
+ "refunds": "Émettre et consulter les remboursements",
+ "settings": "Configuration boutique, paiement, livraison, taxes et canaux",
+ "staff": "Membres de l’équipe, invitations, rôles et leurs permissions",
+ "stock": "Niveaux de stock, emplacements, mouvements et transferts",
+ "store_credits": "Avoirs des clients",
+ "webhooks": "Points de terminaison et livraisons de webhooks"
+ },
+ "grid": {
+ "read_aria": "Voir {{resource}}",
+ "read_header": "Voir",
+ "resource_header": "Ressource",
+ "write_aria": "Gérer {{resource}}",
+ "write_header": "Gérer"
+ },
+ "groups": {
+ "access": "Accès",
+ "analytics": "Analyses",
+ "catalog": "Catalogue",
+ "customers": "Clients",
+ "marketing": "Marketing",
+ "orders": "Commandes",
+ "settings": "Paramètres"
+ },
+ "resources": {
+ "api_keys": "Clés API",
+ "categories": "Catégories",
+ "collections": "Collections",
+ "customers": "Clients",
+ "dashboard": "Tableau de bord",
+ "fulfillments": "Exécutions des commandes",
+ "gift_cards": "Cartes cadeaux",
+ "orders": "Commandes",
+ "payments": "Paiements",
+ "products": "Produits",
+ "promotions": "Promotions",
+ "refunds": "Remboursements",
+ "settings": "Paramètres",
+ "staff": "Équipe et rôles",
+ "stock": "Stock",
+ "store_credits": "Avoirs en boutique",
+ "webhooks": "Webhooks"
+ }
+ },
"post_sale": {
- "search_placeholder": "Rechercher par numéro…",
- "returns_empty": "Aucun retour pour l’instant.",
- "exchanges_empty": "Aucun échange pour l’instant.",
"claims_empty": "Aucune réclamation pour l’instant.",
+ "exchanges_empty": "Aucun échange pour l’instant.",
+ "returns_empty": "Aucun retour pour l’instant.",
+ "search_placeholder": "Rechercher par numéro…",
"statuses": {
- "requested": "Demandé",
- "open": "Ouvert",
"approved": "Approuvé",
+ "canceled": "Annulé",
+ "denied": "Refusé",
+ "fulfilled": "Expédié",
+ "open": "Ouvert",
"received": "Reçu",
"refunded": "Remboursé",
- "fulfilled": "Expédié",
- "resolved": "Résolu",
- "denied": "Refusé",
- "canceled": "Annulé"
+ "requested": "Demandé",
+ "resolved": "Résolu"
}
},
"preferences": {
@@ -2994,38 +3051,83 @@
}
},
"reasons": {
- "title": "Retours et motifs",
- "description": "Les listes de motifs que votre équipe utilise pour les retours, réclamations et remboursements.",
+ "active_label": "Proposé sur les nouveaux enregistrements",
"add_cta": "Ajouter un motif",
"add_sheet_title": "Ajouter un motif",
- "edit_sheet_title": "Modifier le motif",
+ "claim": {
+ "help": "Ce qui s'est mal passé à la livraison — endommagé, manquant ou article incorrect.",
+ "title": "Motifs de réclamation"
+ },
"create_description": "Les motifs apparaissent dans une liste déroulante lors de la création d'un retour, d'une réclamation ou d'un remboursement.",
- "name_placeholder": "ex. Mauvaise taille",
- "active_label": "Proposé sur les nouveaux enregistrements",
+ "delete_confirm": {
+ "message": "{{name}} ne sera plus proposé. Les enregistrements existants le conservent.",
+ "title": "Supprimer le motif ?"
+ },
+ "description": "Les listes de motifs que votre équipe utilise pour les retours, réclamations et remboursements.",
+ "edit_sheet_title": "Modifier le motif",
"empty": "Aucun motif pour l'instant",
- "inactive": "Inactif",
"in_use": "Utilisé",
"in_use_help": "Ce motif est déjà utilisé par des enregistrements existants, il ne peut donc pas être supprimé.",
- "delete_confirm": {
- "title": "Supprimer le motif ?",
- "message": "{{name}} ne sera plus proposé. Les enregistrements existants le conservent."
- },
+ "inactive": "Inactif",
"messages": {
"created": "Motif créé",
- "updated": "Motif mis à jour",
- "deleted": "Motif supprimé"
+ "deleted": "Motif supprimé",
+ "updated": "Motif mis à jour"
+ },
+ "name_placeholder": "ex. Mauvaise taille",
+ "refund": {
+ "help": "Pourquoi l'argent a été rendu. Utilisé pour le suivi de tous les remboursements.",
+ "title": "Motifs de remboursement"
},
"return": {
- "title": "Motifs de retour",
- "help": "Pourquoi un client renvoie un article. Partagé par les retours et les échanges."
+ "help": "Pourquoi un client renvoie un article. Partagé par les retours et les échanges.",
+ "title": "Motifs de retour"
},
- "claim": {
- "title": "Motifs de réclamation",
- "help": "Ce qui s'est mal passé à la livraison — endommagé, manquant ou article incorrect."
+ "title": "Retours et motifs"
+ },
+ "roles": {
+ "badges": {
+ "full_access": "Accès complet",
+ "more": "+{{count}} de plus",
+ "none": "Aucune permission",
+ "protected": "Protégé"
},
- "refund": {
- "title": "Motifs de remboursement",
- "help": "Pourquoi l'argent a été rendu. Utilisé pour le suivi de tous les remboursements."
+ "confirm": {
+ "delete_message": "Supprimer le rôle « {{name}} » ? Cette action est irréversible.",
+ "delete_title": "Supprimer le rôle"
+ },
+ "duplicate_name": "{{name}} copie",
+ "errors": {
+ "failed_to_delete": "Échec de la suppression du rôle"
+ },
+ "form": {
+ "details_section": "Détails",
+ "locked_hint": "Ce rôle est protégé et ne peut pas être modifié.",
+ "members": "Membres",
+ "more_members": "+{{count}} de plus",
+ "permissions_count": "Permissions",
+ "permissions_section": "Permissions",
+ "summary_section": "Résumé"
+ },
+ "manage_roles_link": "Gérer les rôles",
+ "messages": {
+ "created": "Rôle créé",
+ "deleted": "Rôle supprimé",
+ "updated": "Rôle mis à jour"
+ },
+ "presets": {
+ "clear": "Effacer",
+ "full_access": "Accès complet",
+ "read_only": "Lecture seule"
+ },
+ "templates": {
+ "merchandiser": "Merchandiser",
+ "order_manager": "Gestionnaire de commandes",
+ "start_from": "Partir de :",
+ "support": "Support"
+ },
+ "validation": {
+ "name_required": "Le nom est requis"
}
},
"settings": {
@@ -3062,6 +3164,7 @@
"product_types": "Types de produit",
"profile": "Profil",
"reasons": "Retours et motifs",
+ "roles": "Rôles",
"staff": "Personnel",
"stock_locations": "Emplacements de stock",
"store": "Boutique",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 8ee409d4ff..894300c787 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -65,32 +65,10 @@
"full_access_label": "Pełny dostęp (write_all)",
"read_all_hint": "– odczyt dla każdego zasobu",
"read_all_label": "Odczyt wszystkiego (read_all)",
- "read_aria": "Odczyt: {{resource}}",
- "read_header": "Odczyt",
- "resource_header": "Zasób",
- "resources": {
- "api_keys": "Klucze API",
- "categories": "Kategorie",
- "customers": "Klienci",
- "dashboard": "Panel",
- "fulfillments": "Realizacje",
- "gift_cards": "Karty podarunkowe",
- "orders": "Zamówienia",
- "payments": "Płatności",
- "products": "Produkty",
- "promotions": "Promocje",
- "refunds": "Zwroty pieniędzy",
- "settings": "Ustawienia",
- "stock": "Stan magazynowy",
- "store_credits": "Środki w sklepie",
- "webhooks": "Webhooki"
- },
"show_more_aria_few": "Pokaż {{count}} dodatkowe zakresy",
"show_more_aria_many": "Pokaż {{count}} dodatkowych zakresów",
"show_more_aria_one": "Pokaż {{count}} dodatkowy zakres",
- "show_more_aria_other": "Pokaż {{count}} dodatkowych zakresów",
- "write_aria": "Zapis: {{resource}}",
- "write_header": "Zapis"
+ "show_more_aria_other": "Pokaż {{count}} dodatkowych zakresów"
},
"scopes_immutable_help": "Zakresów nie można zmienić po utworzeniu klucza. Aby je zmienić, utwórz nowy klucz z potrzebnymi zakresami, a ten unieważnij.",
"validation": {
@@ -733,8 +711,8 @@
"label": "Strefy dostawy"
},
"fulfillment_provider": {
- "label": "Dostawca realizacji",
- "help": "Jak realizacje tej metody są przetwarzane i śledzone."
+ "help": "Jak realizacje tej metody są przetwarzane i śledzone.",
+ "label": "Dostawca realizacji"
},
"fulfillment_type": {
"label": "Typ realizacji"
@@ -1102,6 +1080,16 @@
"placeholder": "Bez ograniczeń"
}
},
+ "role": {
+ "description": {
+ "label": "Opis",
+ "placeholder": "Do czego służy ta rola?"
+ },
+ "name": {
+ "label": "Nazwa",
+ "placeholder": "np. Menedżer zamówień"
+ }
+ },
"role_id": {
"label": "Rola"
},
@@ -1876,23 +1864,23 @@
},
"claims": {
"actions": {
- "resolve_refund": "Rozwiąż zwrotem płatności",
- "resolve_replacement": "Rozwiąż zamiennikiem",
- "deny": "Odrzuć",
"create": "Nowa reklamacja",
- "resolve": "Rozwiąż"
+ "deny": "Odrzuć",
+ "resolve": "Rozwiąż",
+ "resolve_refund": "Rozwiąż zwrotem płatności",
+ "resolve_replacement": "Rozwiąż zamiennikiem"
},
- "empty": "Brak reklamacji dla tego zamówienia.",
"create_title": "Nowa reklamacja",
+ "empty": "Brak reklamacji dla tego zamówienia.",
"refund_amount": "Kwota zwrotu",
- "resolve_title": "Rozwiąż reklamację",
- "resolution": "Sposób rozwiązania",
"replacement_items": "Wyślij zamiennik dla",
+ "resolution": "Sposób rozwiązania",
"resolutions": {
"refund": "Zwrot płatności",
- "replacement": "Zamiennik",
- "refund_and_replacement": "Zwrot i zamiennik"
- }
+ "refund_and_replacement": "Zwrot i zamiennik",
+ "replacement": "Zamiennik"
+ },
+ "resolve_title": "Rozwiąż reklamację"
},
"dialogs": {
"approve_title": "Zatwierdzić zamówienie?",
@@ -1904,43 +1892,43 @@
"empty_shipments": "Brak przesyłek.",
"exchanges": {
"actions": {
- "fulfill": "Wyślij zamiennik",
- "create": "Nowa wymiana"
+ "create": "Nowa wymiana",
+ "fulfill": "Wyślij zamiennik"
},
- "price_difference": "Różnica w cenie",
- "empty": "Brak wymian dla tego zamówienia.",
"create_title": "Nowa wymiana",
+ "empty": "Brak wymian dla tego zamówienia.",
+ "price_difference": "Różnica w cenie",
"replacement_variant": "ID wariantu zamiennego"
},
"no_delivery_method": "Nie wybrano metody dostawy.",
"returns": {
"actions": {
"approve": "Zatwierdź",
+ "create": "Nowy zwrot",
"receive": "Przyjmij produkty",
- "refund": "Zwróć płatność",
- "create": "Nowy zwrot"
+ "refund": "Zwróć płatność"
},
"confirm": {
"cancel": "Anulować ten zwrot? Nic nie wróci do magazynu i żadne pieniądze nie zostaną zwrócone."
},
- "refund_total": "Kwota zwrotu",
- "received_of": "Otrzymano {{received}} z {{requested}}",
+ "create_title": "Nowy zwrot",
+ "empty": "Brak zwrotów dla tego zamówienia.",
+ "empty_no_units": "To zamówienie nie ma pozycji realizacji, do których można odnieść zwrot.",
+ "memo": "Notatka",
"not_resellable": "Nie nadaje się do sprzedaży",
+ "reason": "Powód",
"receive_title": "Przyjmij zwrócone produkty",
+ "received_of": "Otrzymano {{received}} z {{requested}}",
"received_quantity": "Otrzymano",
- "resellable": "Nadaje się do sprzedaży",
- "refund_title": "Zwrot płatności",
"refund_amount": "Kwota",
"refund_method": "Zwróć na",
"refund_methods": {
"original_payment": "Pierwotna płatność",
"store_credit": "Kredyt sklepowy"
},
- "empty": "Brak zwrotów dla tego zamówienia.",
- "memo": "Notatka",
- "reason": "Powód",
- "create_title": "Nowy zwrot",
- "empty_no_units": "To zamówienie nie ma pozycji realizacji, do których można odnieść zwrot."
+ "refund_title": "Zwrot płatności",
+ "refund_total": "Kwota zwrotu",
+ "resellable": "Nadaje się do sprzedaży"
},
"section_billing_address": "Adres rozliczeniowy",
"section_claims": "Reklamacje",
@@ -2275,6 +2263,19 @@
"loading": "Ładowanie promocji…",
"new_title": "Nowa promocja"
},
+ "roles": {
+ "add_cta": "Dodaj rolę",
+ "empty": "Brak ról",
+ "empty_description": "Utwórz rolę, aby nadać członkom zespołu ograniczony dostęp.",
+ "new_title": "Nowa rola",
+ "subtitle": "Określ, co każda rola personelu może widzieć i robić",
+ "table": {
+ "members": "Członkowie",
+ "permissions": "Uprawnienia",
+ "role": "Rola"
+ },
+ "title": "Role"
+ },
"settings": {
"allowed_origins": {
"add_sheet_title": "Dodaj dozwolone źródło",
@@ -2554,21 +2555,77 @@
},
"title": "Metody płatności"
},
+ "permissions": {
+ "descriptions": {
+ "api_keys": "Tworzenie i unieważnianie kluczy API",
+ "categories": "Drzewo kategorii i taksonomie",
+ "collections": "Kolekcje ręczne i oparte na regułach",
+ "customers": "Konta klientów, adresy, karty i grupy",
+ "dashboard": "Analizy sprzedaży i wyników",
+ "fulfillments": "Pakowanie, wysyłka i śledzenie realizacji",
+ "gift_cards": "Karty podarunkowe i ich partie",
+ "orders": "Zamówienia, pozycje, zwroty, wymiany i reklamacje",
+ "payments": "Płatności zamówień i pobieranie płatności",
+ "products": "Produkty, warianty, opcje, ceny i media",
+ "promotions": "Promocje, reguły i kody rabatowe",
+ "refunds": "Wystawianie i podgląd zwrotów środków",
+ "settings": "Konfiguracja sklepu, płatności, dostaw, podatków i kanałów",
+ "staff": "Członkowie zespołu, zaproszenia, role i ich uprawnienia",
+ "stock": "Stany magazynowe, lokalizacje, ruchy i transfery",
+ "store_credits": "Salda środków sklepowych klientów",
+ "webhooks": "Punkty końcowe i dostarczenia webhooków"
+ },
+ "grid": {
+ "read_aria": "Podgląd: {{resource}}",
+ "read_header": "Podgląd",
+ "resource_header": "Zasób",
+ "write_aria": "Zarządzanie: {{resource}}",
+ "write_header": "Zarządzanie"
+ },
+ "groups": {
+ "access": "Dostęp",
+ "analytics": "Analityka",
+ "catalog": "Katalog",
+ "customers": "Klienci",
+ "marketing": "Marketing",
+ "orders": "Zamówienia",
+ "settings": "Ustawienia"
+ },
+ "resources": {
+ "api_keys": "Klucze API",
+ "categories": "Kategorie",
+ "collections": "Kolekcje",
+ "customers": "Klienci",
+ "dashboard": "Panel",
+ "fulfillments": "Realizacje",
+ "gift_cards": "Karty podarunkowe",
+ "orders": "Zamówienia",
+ "payments": "Płatności",
+ "products": "Produkty",
+ "promotions": "Promocje",
+ "refunds": "Zwroty pieniędzy",
+ "settings": "Ustawienia",
+ "staff": "Zespół i role",
+ "stock": "Stan magazynowy",
+ "store_credits": "Środki w sklepie",
+ "webhooks": "Webhooki"
+ }
+ },
"post_sale": {
- "search_placeholder": "Szukaj po numerze…",
- "returns_empty": "Brak zwrotów.",
- "exchanges_empty": "Brak wymian.",
"claims_empty": "Brak reklamacji.",
+ "exchanges_empty": "Brak wymian.",
+ "returns_empty": "Brak zwrotów.",
+ "search_placeholder": "Szukaj po numerze…",
"statuses": {
- "requested": "Zgłoszony",
- "open": "Otwarta",
"approved": "Zatwierdzony",
+ "canceled": "Anulowany",
+ "denied": "Odrzucona",
+ "fulfilled": "Wysłany",
+ "open": "Otwarta",
"received": "Otrzymany",
"refunded": "Zwrócony",
- "fulfilled": "Wysłany",
- "resolved": "Rozwiązana",
- "denied": "Odrzucona",
- "canceled": "Anulowany"
+ "requested": "Zgłoszony",
+ "resolved": "Rozwiązana"
}
},
"preferences": {
@@ -3036,38 +3093,83 @@
}
},
"reasons": {
- "title": "Zwroty i powody",
- "description": "Listy, z których zespół wybiera przy zwrotach, reklamacjach i zwrotach pieniędzy.",
+ "active_label": "Dostępny dla nowych zgłoszeń",
"add_cta": "Dodaj powód",
"add_sheet_title": "Dodaj powód",
- "edit_sheet_title": "Edytuj powód",
+ "claim": {
+ "help": "Co poszło nie tak z dostawą — uszkodzony, brakujący lub zły towar.",
+ "title": "Powody reklamacji"
+ },
"create_description": "Powody pojawiają się na liście przy tworzeniu zwrotu, reklamacji lub zwrotu pieniędzy.",
- "name_placeholder": "np. Zły rozmiar",
- "active_label": "Dostępny dla nowych zgłoszeń",
+ "delete_confirm": {
+ "message": "{{name}} nie będzie już proponowany. Istniejące zgłoszenia go zachowują.",
+ "title": "Usunąć powód?"
+ },
+ "description": "Listy, z których zespół wybiera przy zwrotach, reklamacjach i zwrotach pieniędzy.",
+ "edit_sheet_title": "Edytuj powód",
"empty": "Brak powodów",
- "inactive": "Nieaktywny",
"in_use": "W użyciu",
"in_use_help": "Ten powód jest już używany przez istniejące rekordy, więc nie można go usunąć.",
- "delete_confirm": {
- "title": "Usunąć powód?",
- "message": "{{name}} nie będzie już proponowany. Istniejące zgłoszenia go zachowują."
- },
+ "inactive": "Nieaktywny",
"messages": {
"created": "Powód utworzony",
- "updated": "Powód zaktualizowany",
- "deleted": "Powód usunięty"
+ "deleted": "Powód usunięty",
+ "updated": "Powód zaktualizowany"
+ },
+ "name_placeholder": "np. Zły rozmiar",
+ "refund": {
+ "help": "Dlaczego pieniądze wróciły. Używane w raportach o wszystkich zwrotach.",
+ "title": "Powody zwrotu pieniędzy"
},
"return": {
- "title": "Powody zwrotu",
- "help": "Dlaczego klient odsyła towar. Wspólne dla zwrotów i wymian."
+ "help": "Dlaczego klient odsyła towar. Wspólne dla zwrotów i wymian.",
+ "title": "Powody zwrotu"
},
- "claim": {
- "title": "Powody reklamacji",
- "help": "Co poszło nie tak z dostawą — uszkodzony, brakujący lub zły towar."
+ "title": "Zwroty i powody"
+ },
+ "roles": {
+ "badges": {
+ "full_access": "Pełny dostęp",
+ "more": "+{{count}} więcej",
+ "none": "Brak uprawnień",
+ "protected": "Chroniona"
},
- "refund": {
- "title": "Powody zwrotu pieniędzy",
- "help": "Dlaczego pieniądze wróciły. Używane w raportach o wszystkich zwrotach."
+ "confirm": {
+ "delete_message": "Usunąć rolę „{{name}}”? Tej akcji nie można cofnąć.",
+ "delete_title": "Usuń rolę"
+ },
+ "duplicate_name": "{{name}} kopia",
+ "errors": {
+ "failed_to_delete": "Nie udało się usunąć roli"
+ },
+ "form": {
+ "details_section": "Szczegóły",
+ "locked_hint": "Ta rola jest chroniona i nie można jej edytować.",
+ "members": "Członkowie",
+ "more_members": "+{{count}} więcej",
+ "permissions_count": "Uprawnienia",
+ "permissions_section": "Uprawnienia",
+ "summary_section": "Podsumowanie"
+ },
+ "manage_roles_link": "Zarządzaj rolami",
+ "messages": {
+ "created": "Rola utworzona",
+ "deleted": "Rola usunięta",
+ "updated": "Rola zaktualizowana"
+ },
+ "presets": {
+ "clear": "Wyczyść",
+ "full_access": "Pełny dostęp",
+ "read_only": "Tylko odczyt"
+ },
+ "templates": {
+ "merchandiser": "Merchandiser",
+ "order_manager": "Menedżer zamówień",
+ "start_from": "Zacznij od:",
+ "support": "Wsparcie"
+ },
+ "validation": {
+ "name_required": "Nazwa jest wymagana"
}
},
"settings": {
@@ -3104,6 +3206,7 @@
"product_types": "Typy produktów",
"profile": "Profil",
"reasons": "Zwroty i powody",
+ "roles": "Role",
"staff": "Zespół",
"stock_locations": "Lokalizacje magazynowe",
"store": "Sklep",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 0ca538af0b..a0bb93647e 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -65,30 +65,8 @@
"full_access_label": "完全访问 (write_all)",
"read_all_hint": "— 对每个资源的读取",
"read_all_label": "全部读取 (read_all)",
- "read_aria": "读取 {{resource}}",
- "read_header": "读取",
- "resource_header": "资源",
- "resources": {
- "api_keys": "API keys",
- "categories": "分类",
- "customers": "客户",
- "dashboard": "仪表盘",
- "fulfillments": "履约",
- "gift_cards": "礼品卡",
- "orders": "订单",
- "payments": "支付",
- "products": "商品",
- "promotions": "优惠",
- "refunds": "退款",
- "settings": "设置",
- "stock": "库存",
- "store_credits": "店铺信用",
- "webhooks": "Webhooks"
- },
"show_more_aria_one": "显示另外 {{count}} 个权限范围",
- "show_more_aria_other": "显示另外 {{count}} 个权限范围",
- "write_aria": "写入 {{resource}}",
- "write_header": "写入"
+ "show_more_aria_other": "显示另外 {{count}} 个权限范围"
},
"scopes_immutable_help": "密钥创建后权限范围无法更改。如需更改,请使用所需的权限范围创建一个新密钥,并撤销此密钥。",
"validation": {
@@ -725,8 +703,8 @@
"label": "配送区域"
},
"fulfillment_provider": {
- "label": "履约服务商",
- "help": "此配送方式的履约如何发运与跟踪。"
+ "help": "此配送方式的履约如何发运与跟踪。",
+ "label": "履约服务商"
},
"fulfillment_type": {
"label": "履约类型"
@@ -1094,6 +1072,16 @@
"placeholder": "不限"
}
},
+ "role": {
+ "description": {
+ "label": "描述",
+ "placeholder": "这个角色的用途是什么?"
+ },
+ "name": {
+ "label": "名称",
+ "placeholder": "例如:订单管理员"
+ }
+ },
"role_id": {
"label": "角色"
},
@@ -1864,23 +1852,23 @@
},
"claims": {
"actions": {
- "resolve_refund": "以退款解决",
- "resolve_replacement": "以换货解决",
- "deny": "拒绝",
"create": "新建索赔",
- "resolve": "解决"
+ "deny": "拒绝",
+ "resolve": "解决",
+ "resolve_refund": "以退款解决",
+ "resolve_replacement": "以换货解决"
},
- "empty": "此订单暂无索赔。",
"create_title": "新建索赔",
+ "empty": "此订单暂无索赔。",
"refund_amount": "退款金额",
- "resolve_title": "解决索赔",
- "resolution": "解决方式",
"replacement_items": "为以下商品发送替换",
+ "resolution": "解决方式",
"resolutions": {
"refund": "退款",
- "replacement": "换货",
- "refund_and_replacement": "退款并换货"
- }
+ "refund_and_replacement": "退款并换货",
+ "replacement": "换货"
+ },
+ "resolve_title": "解决索赔"
},
"dialogs": {
"approve_title": "批准订单?",
@@ -1892,43 +1880,43 @@
"empty_shipments": "暂无发货。",
"exchanges": {
"actions": {
- "fulfill": "寄出替换商品",
- "create": "新建换货"
+ "create": "新建换货",
+ "fulfill": "寄出替换商品"
},
- "price_difference": "差价",
- "empty": "此订单暂无换货。",
"create_title": "新建换货",
+ "empty": "此订单暂无换货。",
+ "price_difference": "差价",
"replacement_variant": "替换变体 ID"
},
"no_delivery_method": "未选择配送方式。",
"returns": {
"actions": {
"approve": "批准",
+ "create": "新建退货",
"receive": "接收商品",
- "refund": "退款",
- "create": "新建退货"
+ "refund": "退款"
},
"confirm": {
"cancel": "取消此退货?不会恢复库存,也不会退款。"
},
- "refund_total": "退款总额",
- "received_of": "已收到 {{received}} / {{requested}}",
+ "create_title": "新建退货",
+ "empty": "此订单暂无退货。",
+ "empty_no_units": "此订单没有可用于退货的履约记录。",
+ "memo": "备注",
"not_resellable": "不可再销售",
+ "reason": "原因",
"receive_title": "接收退回的商品",
+ "received_of": "已收到 {{received}} / {{requested}}",
"received_quantity": "已收到",
- "resellable": "可再销售",
- "refund_title": "退货退款",
"refund_amount": "金额",
"refund_method": "退款至",
"refund_methods": {
"original_payment": "原支付方式",
"store_credit": "商店积分"
},
- "empty": "此订单暂无退货。",
- "memo": "备注",
- "reason": "原因",
- "create_title": "新建退货",
- "empty_no_units": "此订单没有可用于退货的履约记录。"
+ "refund_title": "退货退款",
+ "refund_total": "退款总额",
+ "resellable": "可再销售"
},
"section_billing_address": "账单地址",
"section_claims": "索赔",
@@ -2249,6 +2237,19 @@
"loading": "正在加载优惠活动…",
"new_title": "新建优惠活动"
},
+ "roles": {
+ "add_cta": "添加角色",
+ "empty": "暂无角色",
+ "empty_description": "创建角色,为团队成员授予相应的访问权限。",
+ "new_title": "新建角色",
+ "subtitle": "定义每个员工角色可以查看和执行的操作",
+ "table": {
+ "members": "成员",
+ "permissions": "权限",
+ "role": "角色"
+ },
+ "title": "角色"
+ },
"settings": {
"allowed_origins": {
"add_sheet_title": "添加允许的来源",
@@ -2522,21 +2523,77 @@
},
"title": "支付方式"
},
+ "permissions": {
+ "descriptions": {
+ "api_keys": "创建和吊销 API 凭据",
+ "categories": "分类树与分类体系",
+ "collections": "手动与规则驱动的商品集合",
+ "customers": "客户账户、地址、卡片与分组",
+ "dashboard": "销售与业绩分析",
+ "fulfillments": "打包、发货并跟踪订单履约",
+ "gift_cards": "礼品卡及其批次",
+ "orders": "订单、订单项、退货、换货与索赔",
+ "payments": "订单付款与扣款",
+ "products": "商品、变体、选项、价格与媒体",
+ "promotions": "促销、规则与优惠码",
+ "refunds": "发起和查看退款",
+ "settings": "店铺、支付、配送、税务与渠道配置",
+ "staff": "团队成员、邀请、角色及其权限",
+ "stock": "库存水平、仓库、变动与调拨",
+ "store_credits": "客户店铺余额",
+ "webhooks": "Webhook 端点与投递记录"
+ },
+ "grid": {
+ "read_aria": "查看{{resource}}",
+ "read_header": "查看",
+ "resource_header": "资源",
+ "write_aria": "管理{{resource}}",
+ "write_header": "管理"
+ },
+ "groups": {
+ "access": "访问",
+ "analytics": "分析",
+ "catalog": "商品目录",
+ "customers": "客户",
+ "marketing": "营销",
+ "orders": "订单",
+ "settings": "设置"
+ },
+ "resources": {
+ "api_keys": "API keys",
+ "categories": "分类",
+ "collections": "商品集合",
+ "customers": "客户",
+ "dashboard": "仪表盘",
+ "fulfillments": "履约",
+ "gift_cards": "礼品卡",
+ "orders": "订单",
+ "payments": "支付",
+ "products": "商品",
+ "promotions": "优惠",
+ "refunds": "退款",
+ "settings": "设置",
+ "staff": "团队与角色",
+ "stock": "库存",
+ "store_credits": "店铺信用",
+ "webhooks": "Webhooks"
+ }
+ },
"post_sale": {
- "search_placeholder": "按编号搜索…",
- "returns_empty": "暂无退货。",
- "exchanges_empty": "暂无换货。",
"claims_empty": "暂无索赔。",
+ "exchanges_empty": "暂无换货。",
+ "returns_empty": "暂无退货。",
+ "search_placeholder": "按编号搜索…",
"statuses": {
- "requested": "已申请",
- "open": "待处理",
"approved": "已批准",
+ "canceled": "已取消",
+ "denied": "已拒绝",
+ "fulfilled": "已发货",
+ "open": "待处理",
"received": "已收到",
"refunded": "已退款",
- "fulfilled": "已发货",
- "resolved": "已解决",
- "denied": "已拒绝",
- "canceled": "已取消"
+ "requested": "已申请",
+ "resolved": "已解决"
}
},
"preferences": {
@@ -2994,38 +3051,83 @@
}
},
"reasons": {
- "title": "退货与原因",
- "description": "团队处理退货、理赔和退款时可选择的原因列表。",
+ "active_label": "可用于新记录",
"add_cta": "添加原因",
"add_sheet_title": "添加原因",
- "edit_sheet_title": "编辑原因",
+ "claim": {
+ "help": "配送出现的问题——商品损坏、缺失或发错。",
+ "title": "理赔原因"
+ },
"create_description": "员工创建退货、理赔或退款时,可从下拉列表中选择原因。",
- "name_placeholder": "例如:尺码不合适",
- "active_label": "可用于新记录",
+ "delete_confirm": {
+ "message": "将不再提供 {{name}}。已使用它的记录保持不变。",
+ "title": "删除原因?"
+ },
+ "description": "团队处理退货、理赔和退款时可选择的原因列表。",
+ "edit_sheet_title": "编辑原因",
"empty": "暂无原因",
- "inactive": "已停用",
"in_use": "使用中",
"in_use_help": "此原因已被现有记录使用,因此无法删除。",
- "delete_confirm": {
- "title": "删除原因?",
- "message": "将不再提供 {{name}}。已使用它的记录保持不变。"
- },
+ "inactive": "已停用",
"messages": {
"created": "原因已创建",
- "updated": "原因已更新",
- "deleted": "原因已删除"
+ "deleted": "原因已删除",
+ "updated": "原因已更新"
+ },
+ "name_placeholder": "例如:尺码不合适",
+ "refund": {
+ "help": "退款的原因。用于所有退款的统计分析。",
+ "title": "退款原因"
},
"return": {
- "title": "退货原因",
- "help": "客户退回商品的原因。退货和换货共用。"
+ "help": "客户退回商品的原因。退货和换货共用。",
+ "title": "退货原因"
},
- "claim": {
- "title": "理赔原因",
- "help": "配送出现的问题——商品损坏、缺失或发错。"
+ "title": "退货与原因"
+ },
+ "roles": {
+ "badges": {
+ "full_access": "完全访问",
+ "more": "+{{count}} 项",
+ "none": "无权限",
+ "protected": "受保护"
},
- "refund": {
- "title": "退款原因",
- "help": "退款的原因。用于所有退款的统计分析。"
+ "confirm": {
+ "delete_message": "确定删除角色“{{name}}”?此操作无法撤销。",
+ "delete_title": "删除角色"
+ },
+ "duplicate_name": "{{name}} 副本",
+ "errors": {
+ "failed_to_delete": "删除角色失败"
+ },
+ "form": {
+ "details_section": "详情",
+ "locked_hint": "该角色受保护,无法编辑。",
+ "members": "成员",
+ "more_members": "+{{count}} 位",
+ "permissions_count": "权限",
+ "permissions_section": "权限",
+ "summary_section": "摘要"
+ },
+ "manage_roles_link": "管理角色",
+ "messages": {
+ "created": "角色已创建",
+ "deleted": "角色已删除",
+ "updated": "角色已更新"
+ },
+ "presets": {
+ "clear": "清空",
+ "full_access": "完全访问",
+ "read_only": "只读"
+ },
+ "templates": {
+ "merchandiser": "商品管理员",
+ "order_manager": "订单管理员",
+ "start_from": "从模板开始:",
+ "support": "客服"
+ },
+ "validation": {
+ "name_required": "名称为必填项"
}
},
"settings": {
@@ -3062,6 +3164,7 @@
"product_types": "商品类型",
"profile": "个人资料",
"reasons": "退货与原因",
+ "roles": "角色",
"staff": "员工",
"stock_locations": "库存地点",
"store": "店铺",
diff --git a/packages/dashboard/src/nav/settings.ts b/packages/dashboard/src/nav/settings.ts
index c78312d8f1..99efcc6e1f 100644
--- a/packages/dashboard/src/nav/settings.ts
+++ b/packages/dashboard/src/nav/settings.ts
@@ -10,6 +10,7 @@ import {
RadioTowerIcon,
RotateCcwIcon,
ShapesIcon,
+ ShieldCheckIcon,
StoreIcon,
TagIcon,
TruckIcon,
@@ -167,6 +168,16 @@ settingsNav.add({
subject: Subject.AdminUser,
})
+settingsNav.add({
+ key: 'settings.roles',
+ labelKey: 'admin.settings_nav.items.roles',
+ path: '/roles',
+ icon: ShieldCheckIcon,
+ group: 'team',
+ position: 150,
+ subject: Subject.Role,
+})
+
settingsNav.add({
key: 'settings.api-keys',
labelKey: 'admin.settings_nav.items.api_keys',
diff --git a/packages/dashboard/src/routeTree.gen.ts b/packages/dashboard/src/routeTree.gen.ts
index 3dc1cf6478..5f3462a890 100644
--- a/packages/dashboard/src/routeTree.gen.ts
+++ b/packages/dashboard/src/routeTree.gen.ts
@@ -56,11 +56,14 @@ import { Route as OrdersOrderIdRouteImport } from './routes/_authenticated/$stor
import { Route as CustomersGroupsRouteImport } from './routes/_authenticated/$storeId/customers/groups'
import { Route as CustomersCustomerIdRouteImport } from './routes/_authenticated/$storeId/customers/$customerId'
import { Route as SettingsWebhooksIndexRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/index'
+import { Route as SettingsRolesIndexRouteImport } from './routes/_authenticated/$storeId/settings/roles/index'
import { Route as SettingsImportsIndexRouteImport } from './routes/_authenticated/$storeId/settings/imports/index'
import { Route as ProductsPriceListsIndexRouteImport } from './routes/_authenticated/$storeId/products/price-lists/index'
import { Route as ProductsCollectionsIndexRouteImport } from './routes/_authenticated/$storeId/products/collections/index'
import { Route as ProductsCategoriesIndexRouteImport } from './routes/_authenticated/$storeId/products/categories/index'
import { Route as SettingsWebhooksWebhookEndpointIdRouteImport } from './routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'
+import { Route as SettingsRolesNewRouteImport } from './routes/_authenticated/$storeId/settings/roles/new'
+import { Route as SettingsRolesRoleIdRouteImport } from './routes/_authenticated/$storeId/settings/roles/$roleId'
import { Route as ProductsPriceListsNewRouteImport } from './routes/_authenticated/$storeId/products/price-lists/new'
import { Route as ProductsCollectionsNewRouteImport } from './routes/_authenticated/$storeId/products/collections/new'
import { Route as ProductsCollectionsCollectionIdRouteImport } from './routes/_authenticated/$storeId/products/collections/$collectionId'
@@ -304,6 +307,11 @@ const SettingsWebhooksIndexRoute = SettingsWebhooksIndexRouteImport.update({
path: '/webhooks/',
getParentRoute: () => SettingsRoute,
} as any)
+const SettingsRolesIndexRoute = SettingsRolesIndexRouteImport.update({
+ id: '/roles/',
+ path: '/roles/',
+ getParentRoute: () => SettingsRoute,
+} as any)
const SettingsImportsIndexRoute = SettingsImportsIndexRouteImport.update({
id: '/imports/',
path: '/imports/',
@@ -331,6 +339,16 @@ const SettingsWebhooksWebhookEndpointIdRoute =
path: '/webhooks/$webhookEndpointId',
getParentRoute: () => SettingsRoute,
} as any)
+const SettingsRolesNewRoute = SettingsRolesNewRouteImport.update({
+ id: '/roles/new',
+ path: '/roles/new',
+ getParentRoute: () => SettingsRoute,
+} as any)
+const SettingsRolesRoleIdRoute = SettingsRolesRoleIdRouteImport.update({
+ id: '/roles/$roleId',
+ path: '/roles/$roleId',
+ getParentRoute: () => SettingsRoute,
+} as any)
const ProductsPriceListsNewRoute = ProductsPriceListsNewRouteImport.update({
id: '/products/price-lists/new',
path: '/products/price-lists/new',
@@ -416,11 +434,14 @@ export interface FileRoutesByFullPath {
'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/$storeId/settings/roles/$roleId': typeof SettingsRolesRoleIdRoute
+ '/$storeId/settings/roles/new': typeof SettingsRolesNewRoute
'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute
'/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute
'/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute
'/$storeId/settings/imports/': typeof SettingsImportsIndexRoute
+ '/$storeId/settings/roles/': typeof SettingsRolesIndexRoute
'/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute
'/$storeId/products/price-lists/$priceListId/': typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -473,11 +494,14 @@ export interface FileRoutesByTo {
'/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/$storeId/settings/roles/$roleId': typeof SettingsRolesRoleIdRoute
+ '/$storeId/settings/roles/new': typeof SettingsRolesNewRoute
'/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/$storeId/products/categories': typeof ProductsCategoriesIndexRoute
'/$storeId/products/collections': typeof ProductsCollectionsIndexRoute
'/$storeId/products/price-lists': typeof ProductsPriceListsIndexRoute
'/$storeId/settings/imports': typeof SettingsImportsIndexRoute
+ '/$storeId/settings/roles': typeof SettingsRolesIndexRoute
'/$storeId/settings/webhooks': typeof SettingsWebhooksIndexRoute
'/$storeId/products/price-lists/$priceListId': typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -534,11 +558,14 @@ export interface FileRoutesById {
'/_authenticated/$storeId/products/collections/$collectionId': typeof ProductsCollectionsCollectionIdRoute
'/_authenticated/$storeId/products/collections/new': typeof ProductsCollectionsNewRoute
'/_authenticated/$storeId/products/price-lists/new': typeof ProductsPriceListsNewRoute
+ '/_authenticated/$storeId/settings/roles/$roleId': typeof SettingsRolesRoleIdRoute
+ '/_authenticated/$storeId/settings/roles/new': typeof SettingsRolesNewRoute
'/_authenticated/$storeId/settings/webhooks/$webhookEndpointId': typeof SettingsWebhooksWebhookEndpointIdRoute
'/_authenticated/$storeId/products/categories/': typeof ProductsCategoriesIndexRoute
'/_authenticated/$storeId/products/collections/': typeof ProductsCollectionsIndexRoute
'/_authenticated/$storeId/products/price-lists/': typeof ProductsPriceListsIndexRoute
'/_authenticated/$storeId/settings/imports/': typeof SettingsImportsIndexRoute
+ '/_authenticated/$storeId/settings/roles/': typeof SettingsRolesIndexRoute
'/_authenticated/$storeId/settings/webhooks/': typeof SettingsWebhooksIndexRoute
'/_authenticated/$storeId/products/price-lists/$priceListId/': typeof ProductsPriceListsPriceListIdIndexRoute
}
@@ -595,11 +622,14 @@ export interface FileRouteTypes {
| '/$storeId/products/collections/$collectionId'
| '/$storeId/products/collections/new'
| '/$storeId/products/price-lists/new'
+ | '/$storeId/settings/roles/$roleId'
+ | '/$storeId/settings/roles/new'
| '/$storeId/settings/webhooks/$webhookEndpointId'
| '/$storeId/products/categories/'
| '/$storeId/products/collections/'
| '/$storeId/products/price-lists/'
| '/$storeId/settings/imports/'
+ | '/$storeId/settings/roles/'
| '/$storeId/settings/webhooks/'
| '/$storeId/products/price-lists/$priceListId/'
fileRoutesByTo: FileRoutesByTo
@@ -652,11 +682,14 @@ export interface FileRouteTypes {
| '/$storeId/products/collections/$collectionId'
| '/$storeId/products/collections/new'
| '/$storeId/products/price-lists/new'
+ | '/$storeId/settings/roles/$roleId'
+ | '/$storeId/settings/roles/new'
| '/$storeId/settings/webhooks/$webhookEndpointId'
| '/$storeId/products/categories'
| '/$storeId/products/collections'
| '/$storeId/products/price-lists'
| '/$storeId/settings/imports'
+ | '/$storeId/settings/roles'
| '/$storeId/settings/webhooks'
| '/$storeId/products/price-lists/$priceListId'
id:
@@ -712,11 +745,14 @@ export interface FileRouteTypes {
| '/_authenticated/$storeId/products/collections/$collectionId'
| '/_authenticated/$storeId/products/collections/new'
| '/_authenticated/$storeId/products/price-lists/new'
+ | '/_authenticated/$storeId/settings/roles/$roleId'
+ | '/_authenticated/$storeId/settings/roles/new'
| '/_authenticated/$storeId/settings/webhooks/$webhookEndpointId'
| '/_authenticated/$storeId/products/categories/'
| '/_authenticated/$storeId/products/collections/'
| '/_authenticated/$storeId/products/price-lists/'
| '/_authenticated/$storeId/settings/imports/'
+ | '/_authenticated/$storeId/settings/roles/'
| '/_authenticated/$storeId/settings/webhooks/'
| '/_authenticated/$storeId/products/price-lists/$priceListId/'
fileRoutesById: FileRoutesById
@@ -1060,6 +1096,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsWebhooksIndexRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/settings/roles/': {
+ id: '/_authenticated/$storeId/settings/roles/'
+ path: '/roles'
+ fullPath: '/$storeId/settings/roles/'
+ preLoaderRoute: typeof SettingsRolesIndexRouteImport
+ parentRoute: typeof SettingsRoute
+ }
'/_authenticated/$storeId/settings/imports/': {
id: '/_authenticated/$storeId/settings/imports/'
path: '/imports'
@@ -1095,6 +1138,20 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof SettingsWebhooksWebhookEndpointIdRouteImport
parentRoute: typeof SettingsRoute
}
+ '/_authenticated/$storeId/settings/roles/new': {
+ id: '/_authenticated/$storeId/settings/roles/new'
+ path: '/roles/new'
+ fullPath: '/$storeId/settings/roles/new'
+ preLoaderRoute: typeof SettingsRolesNewRouteImport
+ parentRoute: typeof SettingsRoute
+ }
+ '/_authenticated/$storeId/settings/roles/$roleId': {
+ id: '/_authenticated/$storeId/settings/roles/$roleId'
+ path: '/roles/$roleId'
+ fullPath: '/$storeId/settings/roles/$roleId'
+ preLoaderRoute: typeof SettingsRolesRoleIdRouteImport
+ parentRoute: typeof SettingsRoute
+ }
'/_authenticated/$storeId/products/price-lists/new': {
id: '/_authenticated/$storeId/products/price-lists/new'
path: '/products/price-lists/new'
@@ -1157,8 +1214,11 @@ interface SettingsRouteChildren {
SettingsStoreRoute: typeof SettingsStoreRoute
SettingsTaxCategoriesRoute: typeof SettingsTaxCategoriesRoute
SettingsIndexRoute: typeof SettingsIndexRoute
+ SettingsRolesRoleIdRoute: typeof SettingsRolesRoleIdRoute
+ SettingsRolesNewRoute: typeof SettingsRolesNewRoute
SettingsWebhooksWebhookEndpointIdRoute: typeof SettingsWebhooksWebhookEndpointIdRoute
SettingsImportsIndexRoute: typeof SettingsImportsIndexRoute
+ SettingsRolesIndexRoute: typeof SettingsRolesIndexRoute
SettingsWebhooksIndexRoute: typeof SettingsWebhooksIndexRoute
}
@@ -1179,9 +1239,12 @@ const SettingsRouteChildren: SettingsRouteChildren = {
SettingsStoreRoute: SettingsStoreRoute,
SettingsTaxCategoriesRoute: SettingsTaxCategoriesRoute,
SettingsIndexRoute: SettingsIndexRoute,
+ SettingsRolesRoleIdRoute: SettingsRolesRoleIdRoute,
+ SettingsRolesNewRoute: SettingsRolesNewRoute,
SettingsWebhooksWebhookEndpointIdRoute:
SettingsWebhooksWebhookEndpointIdRoute,
SettingsImportsIndexRoute: SettingsImportsIndexRoute,
+ SettingsRolesIndexRoute: SettingsRolesIndexRoute,
SettingsWebhooksIndexRoute: SettingsWebhooksIndexRoute,
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
index eaba875c96..a18d824268 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
@@ -7,10 +7,11 @@ import {
StoreProvider,
TopBar,
useAutoCollapseSidebar,
+ usePermissions,
} from '@spree/dashboard-core'
import { SidebarInset, SidebarProvider } from '@spree/dashboard-ui'
import { createFileRoute, Outlet, useRouterState } from '@tanstack/react-router'
-import { useEffect, useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
import { CommandPalette } from '../../components/spree/command-palette/command-palette'
import { ProfileDialog } from '../../components/spree/profile-dialog'
import { getAvailableUiLocales } from '../../i18n-setup'
@@ -26,10 +27,20 @@ function StoreLayout() {
const { storeId } = Route.useParams()
const pathname = useRouterState({ select: (s) => s.location.pathname })
const inSettings = pathname.startsWith(`/${storeId}/settings`)
+ const { refresh: refreshPermissions } = usePermissions()
+ const isFirstStore = useRef(true)
useEffect(() => {
adminClient.setStore(storeId)
- }, [storeId])
+ // Permissions are store-scoped (roles are held per store). The provider
+ // already loaded them for the initial store on login; reload only when
+ // the admin switches to a different store.
+ if (isFirstStore.current) {
+ isFirstStore.current = false
+ return
+ }
+ void refreshPermissions()
+ }, [storeId, refreshPermissions])
return (
<StoreProvider storeId={storeId}>
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 003d41e6dc..4d584873a0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
@@ -73,6 +73,7 @@ import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { z } from 'zod/v4'
+import { PermissionGrid } from '../../../../components/spree/permission-picker'
import {
useApiKeys,
useCreateApiKey,
@@ -81,34 +82,12 @@ import {
useUpdateApiKey,
} from '../../../../hooks/use-api-keys'
import { useChannels } from '../../../../hooks/use-channels'
+import { usePermissionCatalog } from '../../../../hooks/use-roles'
export const Route = createFileRoute('/_authenticated/$storeId/settings/api-keys')({
component: ApiKeysSettingsPage,
})
-// Scope resource families, in display order — the `read_*` / `write_*` pairs
-// recognised by `Spree::ApiKey::SCOPES`. Labels resolve at render time from
-// `admin.api_keys.scope_picker.resources.<resource>`. We only render
-// `write_*` for resources that ship a write scope (dashboard is read-only).
-// Keep this in sync with the server-side allowlist.
-const SCOPE_GROUPS: Array<{ resource: string; readOnly?: boolean }> = [
- { resource: 'orders' },
- { resource: 'products' },
- { resource: 'promotions' },
- { resource: 'customers' },
- { resource: 'payments' },
- { resource: 'fulfillments' },
- { resource: 'refunds' },
- { resource: 'gift_cards' },
- { resource: 'store_credits' },
- { resource: 'stock' },
- { resource: 'categories' },
- { resource: 'settings' },
- { resource: 'webhooks' },
- { resource: 'api_keys' },
- { resource: 'dashboard', readOnly: true },
-]
-
// ---------------------------------------------------------------------------
// Page
// ---------------------------------------------------------------------------
@@ -882,13 +861,10 @@ function ScopePicker({
disabled?: boolean
}) {
const { t } = useTranslation()
+ const { data: catalog } = usePermissionCatalog()
const hasWriteAll = value.includes('write_all')
const hasReadAll = value.includes('read_all')
- function toggleScope(scope: string) {
- onChange?.(value.includes(scope) ? value.filter((v) => v !== scope) : [...value, scope])
- }
-
function setAllRead(checked: boolean) {
let next = value.filter((v) => v !== 'read_all' && !v.startsWith('read_'))
if (checked) next = [...next, 'read_all']
@@ -938,94 +914,27 @@ function ScopePicker({
</div>
<div
- className={cn(
- 'grid grid-cols-[1fr_auto_auto] gap-x-4 gap-y-2 p-3 text-sm',
- !disabled && (hasWriteAll || hasReadAll) && 'pointer-events-none opacity-50',
- )}
+ className={cn(!disabled && (hasWriteAll || hasReadAll) && 'pointer-events-none opacity-50')}
>
- <span className="font-medium text-muted-foreground">
- {t('admin.api_keys.scope_picker.resource_header')}
- </span>
- <span className="font-medium text-muted-foreground">
- {t('admin.api_keys.scope_picker.read_header')}
- </span>
- <span className="font-medium text-muted-foreground">
- {t('admin.api_keys.scope_picker.write_header')}
- </span>
- {SCOPE_GROUPS.map((group) => {
- const readScope = `read_${group.resource}`
- const writeScope = `write_${group.resource}`
- const hasRead = value.includes(readScope) || value.includes(writeScope)
- const hasWrite = value.includes(writeScope)
- return (
- <ScopeRow
- key={group.resource}
- label={t(`admin.api_keys.scope_picker.resources.${group.resource}`)}
- hasRead={hasRead}
- hasWrite={hasWrite}
- readOnly={group.readOnly}
- disabled={disabled}
- onToggleRead={() => toggleScope(readScope)}
- onToggleWrite={() => {
- // Toggling write also implies read on the server, but we keep
- // them as separate checkboxes to make the user's intent
- // explicit. If they tick write without read, the server
- // grants read implicitly via `has_scope?`.
- toggleScope(writeScope)
- }}
- />
- )
- })}
+ {catalog ? (
+ <PermissionGrid
+ entries={catalog.data}
+ value={value}
+ onChange={(next) => onChange?.(next)}
+ disabled={disabled}
+ />
+ ) : (
+ <div className="flex flex-col gap-2 p-3">
+ <Skeleton className="h-6 w-full" />
+ <Skeleton className="h-6 w-full" />
+ <Skeleton className="h-6 w-full" />
+ </div>
+ )}
</div>
</div>
)
}
-function ScopeRow({
- label,
- hasRead,
- hasWrite,
- readOnly,
- disabled,
- onToggleRead,
- onToggleWrite,
-}: {
- label: string
- hasRead: boolean
- hasWrite: boolean
- readOnly?: boolean
- disabled?: boolean
- onToggleRead: () => void
- onToggleWrite: () => void
-}) {
- const { t } = useTranslation()
- return (
- <>
- <span>{label}</span>
- <Checkbox
- checked={hasRead}
- onCheckedChange={onToggleRead}
- // Checking write implies read; reflect that here so the UI doesn't
- // look out of sync with what the server will enforce.
- disabled={disabled || hasWrite}
- aria-label={t('admin.api_keys.scope_picker.read_aria', { resource: label })}
- className="justify-self-center"
- />
- {readOnly ? (
- <span className="text-xs text-muted-foreground justify-self-center">—</span>
- ) : (
- <Checkbox
- checked={hasWrite}
- onCheckedChange={onToggleWrite}
- disabled={disabled}
- aria-label={t('admin.api_keys.scope_picker.write_aria', { resource: label })}
- className="justify-self-center"
- />
- )}
- </>
- )
-}
-
// ---------------------------------------------------------------------------
// Token reveal dialog (one-shot, on create)
// ---------------------------------------------------------------------------
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/$roleId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/$roleId.tsx
new file mode 100644
index 0000000000..5cecc094e0
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/$roleId.tsx
@@ -0,0 +1,99 @@
+import { PageHeader } from '@spree/dashboard-core'
+import { Badge, Button, ErrorState, Skeleton } from '@spree/dashboard-ui'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
+import { RoleFormFields, submitRole, useRoleForm } from '../../../../../components/spree/role-form'
+import { useDeleteRole, useRole, useUpdateRole } from '../../../../../hooks/use-roles'
+
+export const Route = createFileRoute('/_authenticated/$storeId/settings/roles/$roleId')({
+ component: EditRolePage,
+})
+
+function EditRolePage() {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const { storeId, roleId } = Route.useParams()
+ const { data: role, isLoading, isError } = useRole(roleId)
+ const updateMutation = useUpdateRole()
+ const deleteMutation = useDeleteRole()
+
+ const form = useRoleForm()
+
+ // Populate once the role loads (and after refetches while pristine).
+ useEffect(() => {
+ if (!role || form.formState.isDirty) return
+ form.reset({
+ name: role.name,
+ description: role.description ?? '',
+ permissions: role.name === 'admin' ? [] : role.permissions,
+ })
+ }, [role, form])
+
+ const handleSubmit = submitRole(form, async (values) => {
+ await updateMutation.mutateAsync({
+ id: roleId,
+ params: {
+ name: values.name,
+ description: values.description || null,
+ permissions: values.permissions,
+ },
+ })
+ toast.success(t('admin.roles.messages.updated'))
+ form.reset(values)
+ })
+
+ async function handleDelete() {
+ try {
+ await deleteMutation.mutateAsync(roleId)
+ toast.success(t('admin.roles.messages.deleted'))
+ navigate({ to: '/$storeId/settings/roles', params: { storeId } })
+ } catch (err) {
+ toast.error(err instanceof Error ? err.message : t('admin.roles.errors.failed_to_delete'))
+ }
+ }
+
+ if (isError) {
+ return <ErrorState />
+ }
+
+ if (isLoading || !role) {
+ return (
+ <div className="flex flex-col gap-4">
+ <Skeleton className="h-10 w-64" />
+ <Skeleton className="h-64 w-full" />
+ </div>
+ )
+ }
+
+ const readOnly = !role.mutable
+
+ return (
+ <div className="flex flex-col gap-6">
+ <PageHeader
+ title={<span className="capitalize">{role.name}</span>}
+ subtitle={role.description ?? undefined}
+ backTo={`/${storeId}/settings/roles`}
+ badges={
+ readOnly ? <Badge variant="secondary">{t('admin.roles.badges.protected')}</Badge> : null
+ }
+ resource={role}
+ onDelete={role.mutable && role.users_count === 0 ? handleDelete : undefined}
+ actions={
+ !readOnly && (
+ <Button
+ size="sm"
+ onClick={handleSubmit}
+ disabled={form.formState.isSubmitting || !form.formState.isDirty}
+ >
+ {form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
+ </Button>
+ )
+ }
+ />
+
+ <RoleFormFields form={form} role={role} readOnly={readOnly} />
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/index.tsx
new file mode 100644
index 0000000000..1e5a3ab15e
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/index.tsx
@@ -0,0 +1,209 @@
+import type { Role } from '@spree/admin-sdk'
+import { PageHeader, usePermissions } from '@spree/dashboard-core'
+import {
+ Badge,
+ Button,
+ Card,
+ CardContent,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
+ RowActions,
+ Skeleton,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ useConfirm,
+} from '@spree/dashboard-ui'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { CopyIcon, LockIcon, PlusIcon, ShieldIcon } from 'lucide-react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
+import { useDeleteRole, useRoles } from '../../../../../hooks/use-roles'
+
+export const Route = createFileRoute('/_authenticated/$storeId/settings/roles/')({
+ component: RolesSettingsPage,
+})
+
+function RolesSettingsPage() {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const { storeId } = Route.useParams()
+ const { data, isLoading } = useRoles()
+ const roles = data?.data ?? []
+
+ return (
+ <div className="flex flex-col gap-6">
+ <PageHeader
+ title={t('admin.pages.roles.title')}
+ subtitle={t('admin.pages.roles.subtitle')}
+ actions={
+ <Button
+ size="sm"
+ onClick={() => navigate({ to: '/$storeId/settings/roles/new', params: { storeId } })}
+ >
+ <PlusIcon className="size-4" />
+ {t('admin.pages.roles.add_cta')}
+ </Button>
+ }
+ />
+
+ <Card>
+ <CardContent className="p-0">
+ {isLoading ? (
+ <div className="flex flex-col gap-3 p-4">
+ <Skeleton className="h-10 w-full" />
+ <Skeleton className="h-10 w-full" />
+ </div>
+ ) : roles.length === 0 ? (
+ <Empty>
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <ShieldIcon />
+ </EmptyMedia>
+ <EmptyTitle>{t('admin.pages.roles.empty')}</EmptyTitle>
+ <EmptyDescription>{t('admin.pages.roles.empty_description')}</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ ) : (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>{t('admin.pages.roles.table.role')}</TableHead>
+ <TableHead>{t('admin.pages.roles.table.permissions')}</TableHead>
+ <TableHead>{t('admin.pages.roles.table.members')}</TableHead>
+ <TableHead className="w-12" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {roles.map((role) => (
+ <RoleRow key={role.id} role={role} />
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ </CardContent>
+ </Card>
+ </div>
+ )
+}
+
+function RoleRow({ role }: { role: Role }) {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const { storeId } = Route.useParams()
+ const { permissions } = usePermissions()
+ const deleteMutation = useDeleteRole()
+ const confirm = useConfirm()
+
+ function openEditor() {
+ navigate({
+ to: '/$storeId/settings/roles/$roleId',
+ params: { storeId, roleId: role.id },
+ })
+ }
+
+ async function handleDelete() {
+ const ok = await confirm({
+ title: t('admin.roles.confirm.delete_title'),
+ message: t('admin.roles.confirm.delete_message', { name: role.name }),
+ variant: 'destructive',
+ confirmLabel: t('admin.actions.delete'),
+ })
+ if (!ok) return
+
+ try {
+ await deleteMutation.mutateAsync(role.id)
+ toast.success(t('admin.roles.messages.deleted'))
+ } catch (err) {
+ toast.error(err instanceof Error ? err.message : t('admin.roles.errors.failed_to_delete'))
+ }
+ }
+
+ return (
+ <TableRow className="cursor-pointer" onClick={openEditor}>
+ <TableCell>
+ <div className="flex flex-col">
+ <span className="flex items-center gap-1.5 font-medium capitalize">
+ {role.name}
+ {!role.mutable && <LockIcon className="size-3.5 text-muted-foreground" />}
+ </span>
+ {role.description && (
+ <span className="text-xs text-muted-foreground">{role.description}</span>
+ )}
+ </div>
+ </TableCell>
+ <TableCell>
+ <PermissionSummary role={role} />
+ </TableCell>
+ <TableCell>
+ <Badge variant="secondary">{role.users_count}</Badge>
+ </TableCell>
+ <TableCell className="text-right" onClick={(event) => event.stopPropagation()}>
+ <RowActions
+ actions={[
+ { key: 'edit', onSelect: openEditor },
+ {
+ key: 'duplicate',
+ label: t('admin.actions.duplicate'),
+ icon: <CopyIcon className="size-4" />,
+ onSelect: () =>
+ navigate({
+ to: '/$storeId/settings/roles/new',
+ params: { storeId },
+ search: { from: role.id },
+ }),
+ },
+ {
+ key: 'delete',
+ label: t('admin.actions.delete'),
+ destructive: true,
+ disabled:
+ !role.mutable ||
+ role.users_count > 0 ||
+ deleteMutation.isPending ||
+ permissions.cannot('destroy', 'Spree::Role'),
+ onSelect: handleDelete,
+ },
+ ]}
+ />
+ </TableCell>
+ </TableRow>
+ )
+}
+
+// Mirrors the API-keys page's scope badges: a compact preview with overflow.
+const PERMISSION_PREVIEW_COUNT = 3
+
+function PermissionSummary({ role }: { role: Role }) {
+ const { t } = useTranslation()
+
+ if (role.name === 'admin') {
+ return <Badge>{t('admin.roles.badges.full_access')}</Badge>
+ }
+ if (role.permissions.length === 0) {
+ return <span className="text-sm text-muted-foreground">{t('admin.roles.badges.none')}</span>
+ }
+
+ const preview = role.permissions.slice(0, PERMISSION_PREVIEW_COUNT)
+ const overflow = role.permissions.length - preview.length
+ return (
+ <div className="flex flex-wrap items-center gap-1">
+ {preview.map((key) => (
+ <Badge key={key} className="font-mono text-[10px]">
+ {key}
+ </Badge>
+ ))}
+ {overflow > 0 && (
+ <span className="text-xs text-muted-foreground">
+ {t('admin.roles.badges.more', { count: overflow })}
+ </span>
+ )}
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/new.tsx
new file mode 100644
index 0000000000..c590dd5bb1
--- /dev/null
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles/new.tsx
@@ -0,0 +1,97 @@
+import { PageHeader } from '@spree/dashboard-core'
+import { Button } from '@spree/dashboard-ui'
+import { createFileRoute, useNavigate } from '@tanstack/react-router'
+import { useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { toast } from 'sonner'
+import { z } from 'zod/v4'
+import {
+ ROLE_TEMPLATES,
+ RoleFormFields,
+ submitRole,
+ useRoleForm,
+} from '../../../../../components/spree/role-form'
+import { useCreateRole, useRole } from '../../../../../hooks/use-roles'
+
+// `from` carries the prefixed ID of a role being duplicated — the form
+// prefills with its name and permissions once it loads.
+const newRoleSearchSchema = z.object({
+ from: z.string().optional(),
+})
+
+export const Route = createFileRoute('/_authenticated/$storeId/settings/roles/new')({
+ validateSearch: newRoleSearchSchema,
+ component: NewRolePage,
+})
+
+function NewRolePage() {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const { storeId } = Route.useParams()
+ const { from } = Route.useSearch()
+ const { data: sourceRole } = useRole(from ?? '')
+ const createMutation = useCreateRole()
+
+ const form = useRoleForm()
+
+ // Duplicate flow: prefill once the source role arrives. Guarded on a
+ // pristine form so a user's in-progress edits are never clobbered.
+ useEffect(() => {
+ if (!sourceRole || form.formState.isDirty) return
+ form.reset({
+ name: t('admin.roles.duplicate_name', { name: sourceRole.name }),
+ description: sourceRole.description ?? '',
+ permissions: sourceRole.permissions,
+ })
+ }, [sourceRole, form, t])
+
+ const handleSubmit = submitRole(form, async (values) => {
+ await createMutation.mutateAsync({
+ name: values.name,
+ description: values.description || null,
+ permissions: values.permissions,
+ })
+ toast.success(t('admin.roles.messages.created'))
+ navigate({ to: '/$storeId/settings/roles', params: { storeId } })
+ })
+
+ return (
+ <div className="flex flex-col gap-6">
+ <PageHeader
+ title={t('admin.pages.roles.new_title')}
+ backTo={`/${storeId}/settings/roles`}
+ actions={
+ <Button size="sm" onClick={handleSubmit} disabled={form.formState.isSubmitting}>
+ {form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
+ </Button>
+ }
+ />
+
+ {!from && (
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="text-sm text-muted-foreground">
+ {t('admin.roles.templates.start_from')}
+ </span>
+ {ROLE_TEMPLATES.map((template) => (
+ <Button
+ key={template.key}
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ form.setValue('permissions', template.permissions, { shouldDirty: true })
+ if (!form.getValues('name')) {
+ form.setValue('name', t(`admin.roles.templates.${template.key}`))
+ }
+ }}
+ >
+ {t(`admin.roles.templates.${template.key}`)}
+ </Button>
+ ))}
+ </div>
+ )}
+
+ <RoleFormFields form={form} />
+ </div>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
index 2b0c1ea90e..7cd9ce5933 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
@@ -52,7 +52,7 @@ import {
useConfirm,
useCopyToClipboard,
} from '@spree/dashboard-ui'
-import { createFileRoute } from '@tanstack/react-router'
+import { createFileRoute, Link } from '@tanstack/react-router'
import i18n from 'i18next'
import {
BanIcon,
@@ -555,6 +555,7 @@ function EditStaffSheet({
member: AdminUser
}) {
const { t } = useTranslation()
+ const { storeId } = Route.useParams()
const { data: roles } = useRoles()
const updateMutation = useUpdateStaff()
@@ -650,6 +651,13 @@ function EditStaffSheet({
)}
/>
<FieldError errors={[form.formState.errors.role_ids]} />
+ <Link
+ to="/$storeId/settings/roles"
+ params={{ storeId }}
+ className="text-xs text-muted-foreground underline-offset-4 hover:underline"
+ >
+ {t('admin.roles.manage_roles_link')}
+ </Link>
</Field>
</div>
<SheetFooter>