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.

3.7 KB
Raw Blame
import { i18n, Subject, settingsNav } from '@spree/dashboard-core'
import {
  PackageIcon,
  ScrollTextIcon,
  TruckIcon,
  UsersRoundIcon,
  WarehouseIcon,
} from '@spree/dashboard-ui/icons'

// The panel's settings rail, registered into the same registry the operator's
// dashboard writes to — so a marketplace adds, removes or reorders entries
// with `defineDashboardPlugin` rather than forking the chrome.
//
// Deliberately short. Most of what an operator configures is the
// marketplace's, not a seller's; what belongs here is what a seller owns and
// only they can answer.

settingsNav.addGroup({
  key: 'fulfillment',
  labelKey: 'admin.settings_nav.groups.fulfillment',
  position: 200,
})

settingsNav.addGroup({
  key: 'legal',
  label: i18n.t('nav.legal'),
  position: 250,
})

settingsNav.addGroup({
  key: 'team',
  labelKey: 'admin.settings_nav.groups.team',
  position: 300,
})

settingsNav.add({
  key: 'settings.stock-locations',
  labelKey: 'admin.settings_nav.items.stock_locations',
  descriptionKey: 'admin.settings_nav.descriptions.stock_locations',
  keywords: ['warehouse', 'inventory', 'fulfillment', 'pickup'],
  path: '/stock-locations',
  icon: WarehouseIcon,
  group: 'fulfillment',
  position: 100,
  // The seller-branch subject the API's `/me` serializes. A member without
  // stock permission never sees the entry.
  subject: Subject.StockLocation,
})

// How this seller's goods ship. Beside stock locations because the two are
// one question asked twice — where the goods are, and how they leave.
settingsNav.add({
  key: 'settings.delivery-methods',
  label: i18n.t('nav.delivery_methods'),
  descriptionKey: 'admin.settings_nav.descriptions.delivery_methods',
  keywords: ['shipping', 'rates', 'carriers', 'delivery'],
  path: '/delivery-methods',
  icon: TruckIcon,
  group: 'fulfillment',
  position: 200,
  // The seller-branch subject the API's `/me` serializes. A member without
  // delivery permission never sees the entry.
  subject: Subject.DeliveryMethod,
})

// What this seller packs their goods into. Beside the other two because the
// three answer one question together: where the goods are, how they leave,
// and what they leave in (docs/plans/6.0-seller-package-types.md).
settingsNav.add({
  key: 'settings.package-types',
  label: i18n.t('nav.package_types'),
  descriptionKey: 'admin.settings_nav.descriptions.package_types',
  keywords: ['box', 'carton', 'pallet', 'container', 'packaging', 'parcel'],
  path: '/package-types',
  icon: PackageIcon,
  group: 'fulfillment',
  position: 300,
  // The seller-branch subject the API's `/me` serializes. A member without
  // packaging permission never sees the entry.
  subject: Subject.PackageType,
})

// Who runs this seller. Under settings rather than in the main rail, matching
// where the operator's dashboard puts its own staff page: managing people is
// configuration, not day-to-day selling.
settingsNav.add({
  key: 'settings.team',
  label: i18n.t('nav.team'),
  descriptionKey: 'admin.settings_nav.descriptions.team',
  keywords: ['users', 'staff', 'invite', 'members'],
  path: '/team',
  icon: UsersRoundIcon,
  group: 'team',
  position: 100,
  subject: 'seller_profile',
  action: 'update',
})

// The seller's own legal documents. Under settings because publishing them is
// configuration a seller does once, not day-to-day selling — and because what
// they must publish is the marketplace's onboarding checklist, which links
// here.
settingsNav.add({
  key: 'settings.policies',
  label: i18n.t('nav.policies'),
  descriptionKey: 'admin.settings_nav.descriptions.policies',
  keywords: ['legal', 'terms', 'privacy', 'returns', 'refund'],
  path: '/policies',
  icon: ScrollTextIcon,
  group: 'legal',
  position: 100,
  subject: 'seller_profile',
  action: 'update',
})