The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.
TypeScript b2b-marketplacecomposable-commerceecommerceenterpriseheadless-commercemarketplacemedusamedusajsmulti-vendortypescript
import { ComponentType, ReactNode } from "react";
import type { NavGroupId } from "./config/types";
import type { Permission } from "./permissions";
/**
* Configuration for the Mercur dashboard plugin.
*
* Passed to `mercurDashboardPlugin()` in `vite.config.ts` to configure
* the vendor or admin dashboard at build time.
*
* @example
* ```ts
* mercurDashboardPlugin({
* medusaConfigPath: '../../packages/api/medusa-config.ts',
* enableSellerRegistration: true,
* })
* ```
*/
export interface MercurConfig {
/** Path to the MedusaJS config file, resolved relative to the project root. */
medusaConfigPath: string
/**
* Backend URL for API requests.
* @default "http://localhost:9000"
*/
backendUrl?: string
/**
* Absolute base URL for the vendor dashboard, including any path prefix
* (for example `https://vendors.example.com/seller`).
*
* The plugin does not read `.env` files on its own. Load env in your
* app's `vite.config.ts` and pass the value here when you need
* cross-origin links such as seller invite URLs.
*
* If omitted, the plugin falls back to vendor module dev server
* detection in development and to the configured vendor path in
* production.
*/
vendorUrl?: string
/** Dashboard display name. */
name?: string
/** Path to a logo asset for the dashboard. */
logo?: string
/** Internationalization settings. */
i18n?: {
/** The default language code (e.g. `"en"`). */
defaultLanguage: string
}
/** Whether to allow new sellers to register from the login screen. */
enableSellerRegistration?: boolean;
/**
* Maximum allowed size for image uploads, in bytes.
* Used by dashboard upload components to reject oversized files
* before they are sent to the backend.
* @default 2_097_152 // 2 MB
*/
imageLimit?: number;
}
export interface BuiltMercurConfig extends MercurConfig {
backendUrl: string;
base?: string;
root: string
/** The host app's own `src`, crawled as the last layer. */
srcDir: string
/**
* The Medusa project's `src/<admin|vendor>`, crawled as the layer between
* the plugins and the host app. Unset when the folder does not exist.
*/
projectDir?: string
/** Prebuilt plugin entries, in `medusa-config` plugin order. */
pluginExtensions: string[]
imageLimit: number
}
export type RouteConfig = {
label: string
icon?: ComponentType
rank?: number
nested?: string
/**
* Sidebar group to list the route under: one declared in `_navigation.ts`
* or, for a `/settings/*` route, a built-in settings group. Must be a
* string literal.
*/
group?: NavGroupId | (string & {})
translationNs?: string
public?: boolean
/**
* Permissions the actor must hold for this route's sidebar entry to be
* shown. Enforcement of the route itself comes from `handle.permissions`
* — this only controls navigation visibility.
*/
permissions?: Permission[]
/** If true, ALL `permissions` are required. Defaults to ANY. */
requireAll?: boolean
}
/**
* The value of a route module's `export const handle`. Read by react-router's
* `useMatches()`; `permissions` is enforced by `RoutePermissionGuard`.
*/
export type RouteHandle = {
permissions?: Permission | Permission[]
/** If true (default at the route level), ALL permissions are required. */
requireAll?: boolean
/** Where to send the actor on denial. Renders Access Denied when unset. */
redirectTo?: string
breadcrumb?: (match: never) => ReactNode
}