import { HttpTypes } from "@medusajs/types"
import { t } from "i18next"
import { Outlet, RouteObject, UIMatch } from "react-router-dom"
import { ProtectedRoute } from "../../components/authentication/protected-route"
import { RoutePermissionGuard } from "../../components/authentication/route-permission-guard"
import { MainLayout } from "../../components/layout/main-layout"
import { PublicLayout } from "../../components/layout/public-layout"
import { SettingsLayout } from "../../components/layout/settings-layout"
import { ErrorBoundary } from "../../components/utilities/error-boundary"
import { HydrateFallback } from "../../components/utilities/hydrate-fallback"
export function getRouteMap({
settingsRoutes,
coreRoutes,
}: {
settingsRoutes: RouteObject[]
coreRoutes: RouteObject[]
}) {
return [
{
element: ,
errorElement: ,
hydrateFallbackElement: ,
children: [
{
element: ,
children: [
{
path: "/",
errorElement: ,
lazy: () => import("../../routes/home"),
},
{
path: "/products",
errorElement: ,
handle: {
breadcrumb: () => t("products.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/products/product-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/products/product-create"),
},
{
path: "import",
lazy: () =>
import("../../routes/products/product-import"),
},
{
path: "export",
lazy: () =>
import("../../routes/products/product-export"),
},
],
},
{
path: ":id",
errorElement: ,
lazy: async () => {
const { Breadcrumb, loader, seo } =
await import("../../routes/products/product-detail")
return {
Component: Outlet,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "",
lazy: () =>
import("../../routes/products/product-detail"),
children: [
{
path: "edit",
lazy: () =>
import("../../routes/products/product-edit"),
},
{
path: "edit-variant",
lazy: () =>
import("../../routes/product-variants/product-variant-edit"),
},
{
path: "sales-channels",
lazy: () =>
import("../../routes/products/product-sales-channels"),
},
{
path: "attributes",
lazy: () =>
import("../../routes/products/product-attributes"),
},
{
path: "organization",
lazy: () =>
import("../../routes/products/product-organization"),
},
{
path: "shipping-profile",
lazy: () =>
import("../../routes/products/product-shipping-profile"),
},
{
path: "media",
lazy: () =>
import("../../routes/products/product-media"),
},
{
path: "images/:image_id/variants",
lazy: () =>
import("../../routes/products/product-image-variants-edit"),
},
{
path: "prices",
lazy: () =>
import("../../routes/products/product-prices"),
},
{
path: "variants/create",
lazy: () =>
import("../../routes/products/product-create-variant"),
},
{
path: "stock",
lazy: () =>
import("../../routes/products/product-stock"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/products/product-metadata"),
},
{
path: "options/manage",
lazy: () =>
import("../../routes/products/product-options-manage"),
},
],
},
{
path: "variants/:variant_id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/product-variants/product-variant-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
// eslint-disable-next-line max-len
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/product-variants/product-variant-edit"),
},
{
path: "prices",
lazy: () =>
import("../../routes/products/product-prices"),
},
{
path: "manage-items",
lazy: () =>
import("../../routes/product-variants/product-variant-manage-inventory-items"),
},
{
path: "media",
lazy: () =>
import("../../routes/product-variants/product-variant-media"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/product-variants/product-variant-metadata"),
},
],
},
],
},
],
},
{
path: "/product-options",
errorElement: ,
handle: {
breadcrumb: () => t("productOptions.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/product-options/product-option-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/product-options/product-option-create"),
},
],
},
{
path: ":id",
errorElement: ,
lazy: async () => {
const { Breadcrumb, loader } =
await import("../../routes/product-options/product-option-detail")
return {
Component: Outlet,
loader,
handle: {
breadcrumb: (match: UIMatch) => (
),
},
}
},
children: [
{
path: "",
lazy: () =>
import("../../routes/product-options/product-option-detail"),
children: [
{
path: "edit",
lazy: () =>
import("../../routes/product-options/product-option-edit"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/product-options/product-option-metadata"),
},
],
},
{
path: "values/:value_id",
lazy: async () => {
const { Component, Breadcrumb, loader } =
await import("../../routes/product-options/product-option-value-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
// eslint-disable-next-line max-len
match: UIMatch
) => ,
},
}
},
children: [
{
path: "metadata/edit",
lazy: () =>
import("../../routes/product-options/product-option-value-metadata"),
},
],
},
],
},
],
},
{
path: "/categories",
errorElement: ,
handle: {
breadcrumb: () => t("categories.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/categories/category-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/categories/category-create"),
},
{
path: "organize",
lazy: () =>
import("../../routes/categories/category-organize"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/categories/category-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/categories/category-edit"),
},
{
path: "products",
lazy: () =>
import("../../routes/categories/category-products"),
},
{
path: "organize",
lazy: () =>
import("../../routes/categories/category-organize"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/categories/categories-metadata"),
},
],
},
],
},
{
path: "/orders",
errorElement: ,
handle: {
breadcrumb: () => t("orders.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/orders/order-list"),
children: [
{
path: "export",
lazy: () => import("../../routes/orders/order-export"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/orders/order-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "fulfillment",
lazy: () =>
import("../../routes/orders/order-create-fulfillment"),
},
{
path: "returns/:return_id/receive",
lazy: () =>
import("../../routes/orders/order-receive-return"),
},
{
path: "allocate-items",
lazy: () =>
import("../../routes/orders/order-allocate-items"),
},
{
path: ":f_id/create-shipment",
lazy: () =>
import("../../routes/orders/order-create-shipment"),
},
{
path: "returns",
lazy: () =>
import("../../routes/orders/order-create-return"),
},
{
path: "claims",
lazy: () =>
import("../../routes/orders/order-create-claim"),
},
{
path: "exchanges",
lazy: () =>
import("../../routes/orders/order-create-exchange"),
},
{
path: "edits",
lazy: () =>
import("../../routes/orders/order-create-edit"),
},
{
path: "refund",
lazy: () =>
import("../../routes/orders/order-create-refund"),
},
{
path: "transfer",
lazy: () =>
import("../../routes/orders/order-request-transfer"),
},
{
path: "email",
lazy: () =>
import("../../routes/orders/order-edit-email"),
},
{
path: "shipping-address",
lazy: () =>
import("../../routes/orders/order-edit-shipping-address"),
},
{
path: "billing-address",
lazy: () =>
import("../../routes/orders/order-edit-billing-address"),
},
{
path: "metadata/edit",
lazy: () => import("../../routes/orders/order-metadata"),
},
],
},
],
},
{
path: "/promotions",
errorElement: ,
handle: {
breadcrumb: () => t("promotions.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/promotions/promotion-list"),
},
{
path: "create",
lazy: () =>
import("../../routes/promotions/promotion-create"),
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/promotions/promotion-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/promotions/promotion-edit-details"),
},
{
path: "add-to-campaign",
lazy: () =>
import("../../routes/promotions/promotion-add-campaign"),
},
{
path: ":ruleType/edit",
lazy: () =>
import("../../routes/promotions/common/edit-rules"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/promotions/promotion-metadata"),
},
],
},
],
},
{
path: "/campaigns",
errorElement: ,
handle: {
breadcrumb: () => t("campaigns.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/campaigns/campaign-list"),
children: [],
},
{
path: "create",
lazy: () => import("../../routes/campaigns/campaign-create"),
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/campaigns/campaign-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/campaigns/campaign-edit"),
},
{
path: "configuration",
lazy: () =>
import("../../routes/campaigns/campaign-configuration"),
},
{
path: "edit-budget",
lazy: () =>
import("../../routes/campaigns/campaign-budget-edit"),
},
{
path: "add-promotions",
lazy: () =>
import("../../routes/campaigns/add-campaign-promotions"),
},
],
},
],
},
{
path: "/collections",
errorElement: ,
handle: {
breadcrumb: () => t("collections.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/collections/collection-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/collections/collection-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/collections/collection-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/collections/collection-edit"),
},
{
path: "products",
lazy: () =>
import("../../routes/collections/collection-add-products"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/collections/collection-metadata"),
},
],
},
],
},
{
path: "/price-lists",
errorElement: ,
handle: {
breadcrumb: () => t("priceLists.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/price-lists/price-list-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/price-lists/price-list-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/price-lists/price-list-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/price-lists/price-list-edit"),
},
{
path: "configuration",
lazy: () =>
import("../../routes/price-lists/price-list-configuration"),
},
{
path: "products/add",
lazy: () =>
import("../../routes/price-lists/price-list-prices-add"),
},
{
path: "products/edit",
lazy: () =>
import("../../routes/price-lists/price-list-prices-edit"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/price-lists/price-list-metadata"),
},
],
},
],
},
{
path: "/customers",
errorElement: ,
handle: {
breadcrumb: () => t("customers.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/customers/customer-list"),
children: [
{
path: "create",
element: ,
handle: { permissions: "customer:create" },
children: [
{
path: "",
lazy: () =>
import("../../routes/customers/customer-create"),
},
],
},
{
path: "export",
lazy: () =>
import("../../routes/customers/customer-export"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/customers/customer-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
element: ,
handle: { permissions: "customer:update" },
children: [
{
path: "",
lazy: () =>
import("../../routes/customers/customer-edit"),
},
],
},
{
path: "create-address",
element: ,
handle: { permissions: "customer:update" },
children: [
{
path: "",
lazy: () =>
import("../../routes/customers/customer-create-address"),
},
],
},
{
path: "add-customer-groups",
element: ,
handle: { permissions: "customer:update" },
children: [
{
path: "",
lazy: () =>
import("../../routes/customers/customers-add-customer-group"),
},
],
},
{
path: ":order_id/transfer",
lazy: () =>
import("../../routes/orders/order-request-transfer"),
},
{
path: "metadata/edit",
element: ,
handle: { permissions: "customer:update" },
children: [
{
path: "",
lazy: () =>
import("../../routes/customers/customer-metadata"),
},
],
},
],
},
],
},
{
path: "/customer-groups",
errorElement: ,
handle: {
breadcrumb: () => t("customerGroups.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/customer-groups/customer-group-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/customer-groups/customer-group-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/customer-groups/customer-group-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/customer-groups/customer-group-edit"),
},
{
path: "add-customers",
lazy: () =>
import("../../routes/customer-groups/customer-group-add-customers"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/customer-groups/customer-group-metadata"),
},
],
},
],
},
{
path: "/reservations",
errorElement: ,
handle: {
breadcrumb: () => t("reservations.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/reservations/reservation-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/reservations/reservation-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/reservations/reservation-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/reservations/reservation-detail/components/edit-reservation"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/reservations/reservation-metadata"),
},
],
},
],
},
{
path: "/inventory",
errorElement: ,
handle: {
breadcrumb: () => t("inventory.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/inventory/inventory-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/inventory/inventory-create"),
},
{
path: "export",
lazy: () =>
import("../../routes/inventory/inventory-export"),
},
{
path: "stock",
lazy: () =>
import("../../routes/inventory/inventory-stock"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/inventory/inventory-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/inventory/inventory-detail/components/edit-inventory-item"),
},
{
path: "attributes",
lazy: () =>
import("../../routes/inventory/inventory-detail/components/edit-inventory-item-attributes"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/inventory/inventory-metadata"),
},
{
path: "locations",
lazy: () =>
import("../../routes/inventory/inventory-detail/components/manage-locations"),
},
{
path: "locations/:location_id",
lazy: () =>
import("../../routes/inventory/inventory-detail/components/adjust-inventory"),
},
],
},
],
},
...coreRoutes,
],
},
],
},
{
element: ,
errorElement: ,
hydrateFallbackElement: ,
children: [
{
path: "/settings",
handle: {
breadcrumb: () => t("app.nav.settings.header"),
},
element: ,
children: [
{
index: true,
errorElement: ,
lazy: () => import("../../routes/settings"),
},
{
path: "profile",
errorElement: ,
lazy: () => import("../../routes/profile/profile-detail"),
handle: {
breadcrumb: () => t("profile.domain"),
},
children: [
{
path: "edit",
lazy: () => import("../../routes/profile/profile-edit"),
},
],
},
{
path: "regions",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("regions.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/regions/region-list"),
children: [
{
path: "create",
lazy: () => import("../../routes/regions/region-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/regions/region-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () => import("../../routes/regions/region-edit"),
},
{
path: "countries/add",
lazy: () =>
import("../../routes/regions/region-add-countries"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/regions/region-metadata"),
},
],
},
],
},
{
path: "property-labels",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("propertyLabels.domain", "Property Labels"),
},
children: [
{
path: "",
lazy: () => import("../../routes/property-labels"),
children: [
{
path: ":entity/edit",
lazy: () =>
import("../../routes/property-labels/property-labels-edit"),
},
],
},
],
},
{
path: "store",
errorElement: ,
lazy: () => import("../../routes/store/store-detail"),
handle: {
breadcrumb: () => t("store.domain"),
},
children: [
{
path: "edit",
lazy: () => import("../../routes/store/store-edit"),
},
{
path: "currencies",
lazy: () => import("../../routes/store/store-add-currencies"),
},
{
path: "locales",
lazy: () => import("../../routes/store/store-add-locales"),
},
{
path: "metadata/edit",
lazy: () => import("../../routes/store/store-metadata"),
},
],
},
{
path: "users",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("users.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/users/user-list"),
children: [
{
path: "invite",
element: ,
handle: {
permissions: ["invite:create", "invite:read"],
},
children: [
{
path: "",
lazy: () => import("../../routes/users/user-invite"),
},
],
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/users/user-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () => import("../../routes/users/user-edit"),
},
{
path: "metadata/edit",
lazy: () => import("../../routes/users/user-metadata"),
},
],
},
],
},
{
path: "roles",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("roles.domain"),
permissions: "rbac_role:read",
},
children: [
{
path: "",
lazy: () => import("../../routes/roles/role-list"),
children: [
{
path: "create",
element: ,
handle: { permissions: "rbac_role:create" },
children: [
{
path: "",
lazy: () => import("../../routes/roles/role-create"),
},
],
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader } =
await import("../../routes/roles/role-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
},
}
},
children: [
{
path: "edit",
element: ,
handle: { permissions: "rbac_role:update" },
children: [
{
path: "",
lazy: () => import("../../routes/roles/role-edit"),
},
],
},
{
path: "add-users",
element: ,
handle: {
permissions: ["user:update", "rbac_role:update"],
},
children: [
{
path: "",
lazy: () =>
import("../../routes/roles/role-add-users"),
},
],
},
{
path: "permissions",
element: ,
handle: { permissions: "rbac_role:update" },
children: [
{
path: "",
lazy: () =>
import("../../routes/roles/role-permissions"),
},
],
},
],
},
],
},
{
path: "policies",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("policies.domain"),
permissions: "rbac_policy:read",
},
children: [
{
path: "",
lazy: () => import("../../routes/policies/policy-list"),
// TODO: V1: policy CRUD lives in code (`definePolicies`).Uncomment
// along with the matching list/detail action sites to
// re-enable dashboard CRUD.
// children: [
// {
// path: "create",
// element: ,
// handle: { permissions: "rbac_policy:create" },
// children: [
// {
// path: "",
// lazy: () =>
// import("../../routes/policies/policy-create"),
// },
// ],
// },
// ],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader } =
await import("../../routes/policies/policy-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
},
}
},
// TODO: V1: `edit` child kept commented out — see note above.
// children: [
// {
// path: "edit",
// element: ,
// handle: { permissions: "rbac_policy:update" },
// children: [
// {
// path: "",
// lazy: () =>
// import("../../routes/policies/policy-edit"),
// },
// ],
// },
// ],
},
],
},
{
path: "sales-channels",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("salesChannels.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/sales-channels/sales-channel-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/sales-channels/sales-channel-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/sales-channels/sales-channel-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/sales-channels/sales-channel-edit"),
},
{
path: "add-products",
lazy: () =>
import("../../routes/sales-channels/sales-channel-add-products"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/sales-channels/sales-channel-metadata"),
},
],
},
],
},
{
path: "locations",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("locations.domain"),
},
children: [
{
path: "",
lazy: () => import("../../routes/locations/location-list"),
},
{
path: "create",
lazy: () => import("../../routes/locations/location-create"),
},
{
path: "shipping-profiles",
element: ,
handle: {
breadcrumb: () => t("shippingProfile.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/shipping-profiles/shipping-profiles-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/shipping-profiles/shipping-profile-create"),
},
],
},
{
path: ":shipping_profile_id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/shipping-profiles/shipping-profile-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
// eslint-disable-next-line max-len
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "metadata/edit",
lazy: () =>
import("../../routes/shipping-profiles/shipping-profile-metadata"),
},
],
},
],
},
{
path: "shipping-option-types",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("shippingOptionTypes.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/shipping-option-types/shipping-option-type-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/shipping-option-types/shipping-option-type-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/shipping-option-types/shipping-option-type-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
// eslint-disable-next-line max-len
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/shipping-option-types/shipping-option-type-edit"),
},
],
},
],
},
{
path: ":location_id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/locations/location-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/locations/location-edit"),
},
{
path: "sales-channels",
lazy: () =>
import("../../routes/locations/location-sales-channels"),
},
{
path: "fulfillment-providers",
lazy: () =>
import("../../routes/locations/location-fulfillment-providers"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/locations/location-metadata"),
},
{
path: "fulfillment-set/:fset_id",
children: [
{
path: "service-zones/create",
lazy: () =>
import("../../routes/locations/location-service-zone-create"),
},
{
path: "service-zone/:zone_id",
children: [
{
path: "edit",
lazy: () =>
import("../../routes/locations/location-service-zone-edit"),
},
{
path: "areas",
lazy: () =>
import("../../routes/locations/location-service-zone-manage-areas"),
},
{
path: "shipping-option",
children: [
{
path: "create",
lazy: () =>
import("../../routes/locations/location-service-zone-shipping-option-create"),
},
{
path: ":so_id",
children: [
{
path: "edit",
lazy: () =>
import("../../routes/locations/location-service-zone-shipping-option-edit"),
},
{
path: "pricing",
lazy: () =>
import("../../routes/locations/location-service-zone-shipping-option-pricing"),
},
],
},
],
},
],
},
],
},
],
},
],
},
{
path: "product-tags",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("productTags.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/product-tags/product-tag-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/product-tags/product-tag-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/product-tags/product-tag-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/product-tags/product-tag-edit"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/product-tags/product-tag-metadata"),
},
],
},
],
},
{
path: "workflows",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("workflowExecutions.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/workflow-executions/workflow-execution-list"),
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/workflow-executions/workflow-execution-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
// eslint-disable-next-line max-len
match: UIMatch
) => ,
seo,
},
}
},
},
],
},
{
path: "search",
errorElement: ,
handle: {
breadcrumb: () => t("searchIndexes.domain"),
},
lazy: () =>
import("../../routes/search-indexes/search-index-list"),
},
{
path: "product-types",
errorElement: ,
element: ,
handle: {
breadcrumb: () => t("productTypes.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/product-types/product-type-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/product-types/product-type-create"),
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/product-types/product-type-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/product-types/product-type-edit"),
},
{
path: "metadata/edit",
lazy: () =>
import("../../routes/product-types/product-type-metadata"),
},
],
},
],
},
{
path: "publishable-api-keys",
element: ,
handle: {
breadcrumb: () => t("apiKeyManagement.domain.publishable"),
},
children: [
{
path: "",
element: ,
children: [
{
path: "",
lazy: () =>
import("../../routes/api-key-management/api-key-management-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/api-key-management/api-key-management-create"),
},
],
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/api-key-management/api-key-management-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/api-key-management/api-key-management-edit"),
},
{
path: "sales-channels",
lazy: () =>
import("../../routes/api-key-management/api-key-management-sales-channels"),
},
],
},
],
},
{
path: "secret-api-keys",
element: ,
handle: {
breadcrumb: () => t("apiKeyManagement.domain.secret"),
},
children: [
{
path: "",
element: ,
children: [
{
path: "",
lazy: () =>
import("../../routes/api-key-management/api-key-management-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/api-key-management/api-key-management-create"),
},
],
},
],
},
{
path: ":id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/api-key-management/api-key-management-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/api-key-management/api-key-management-edit"),
},
],
},
],
},
{
path: "tax-regions",
element: ,
handle: {
breadcrumb: () => t("taxRegions.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/tax-regions/tax-region-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/tax-regions/tax-region-create"),
},
],
},
{
path: ":id",
errorElement: ,
lazy: async () => {
const { Breadcrumb, loader, seo } =
await import("../../routes/tax-regions/tax-region-detail")
return {
Component: Outlet,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "",
lazy: async () => {
const { Component } =
await import("../../routes/tax-regions/tax-region-detail")
return {
Component,
}
},
children: [
{
path: "edit",
lazy: () =>
import("../../routes/tax-regions/tax-region-edit"),
},
{
path: "provinces/create",
lazy: () =>
import("../../routes/tax-regions/tax-region-province-create"),
},
{
path: "overrides/create",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-override-create"),
},
{
path: "overrides/:tax_rate_id/edit",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-override-edit"),
},
{
path: "tax-rates/create",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-rate-create"),
},
{
path: "tax-rates/:tax_rate_id/edit",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-rate-edit"),
},
],
},
{
path: "provinces/:province_id",
lazy: async () => {
const { Component, Breadcrumb, loader, seo } =
await import("../../routes/tax-regions/tax-region-province-detail")
return {
Component,
loader,
handle: {
breadcrumb: (
match: UIMatch
) => ,
seo,
},
}
},
children: [
{
path: "tax-rates/create",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-rate-create"),
},
{
path: "tax-rates/:tax_rate_id/edit",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-rate-edit"),
},
{
path: "overrides/create",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-override-create"),
},
{
path: "overrides/:tax_rate_id/edit",
lazy: () =>
import("../../routes/tax-regions/tax-region-tax-override-edit"),
},
],
},
],
},
],
},
{
path: "return-reasons",
element: ,
handle: {
breadcrumb: () => t("returnReasons.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/return-reasons/return-reason-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/return-reasons/return-reason-create"),
},
{
path: ":id",
children: [
{
path: "edit",
lazy: () =>
import("../../routes/return-reasons/return-reason-edit"),
},
],
},
],
},
],
},
{
path: "refund-reasons",
element: ,
handle: {
breadcrumb: () => t("refundReasons.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/refund-reasons/refund-reason-list"),
children: [
{
path: "create",
lazy: () =>
import("../../routes/refund-reasons/refund-reason-create"),
},
{
path: ":id",
children: [
{
path: "edit",
lazy: () =>
import("../../routes/refund-reasons/refund-reason-edit"),
},
],
},
],
},
],
},
{
path: "translations",
errorElement: ,
handle: {
breadcrumb: () => t("translations.domain"),
},
children: [
{
path: "",
lazy: () =>
import("../../routes/translations/translation-list"),
children: [
{
path: "settings",
lazy: () => import("../../routes/translations/settings"),
},
],
},
{
path: "edit",
lazy: () =>
import("../../routes/translations/translations-edit"),
},
{
path: "add-locales",
lazy: () => import("../../routes/translations/add-locales"),
},
],
},
...settingsRoutes.flatMap((r) => r?.children || []),
],
},
],
},
{
element: ,
children: [
{
errorElement: ,
children: [
{
path: "/login",
lazy: () => import("../../routes/login"),
handle: {
breadcrumb: () => t("login.title"),
},
},
{
path: "/reset-password",
lazy: () => import("../../routes/reset-password"),
handle: {
breadcrumb: () => t("resetPassword.title"),
},
},
{
path: "/invite",
lazy: () => import("../../routes/invite"),
handle: {
breadcrumb: () => t("invite.title"),
},
},
{
path: "*",
lazy: () => import("../../routes/no-match"),
},
],
},
],
},
]
}