feat: add sales channel management (#6761)

Add V2 sales channel management to admin

`@medusajs/medusa`
- Add `POST /admin/sales-channels/:id/products/batch/remove`
- Refactor cross-module filter middleware to comply with the latest convention

`@medusajs/admin-next`
- Add all sales channel routes
- Moves the following sales channel UI to shared components in `modules/sales-channel`:
  - sales-channel-list
  - sales-channel-edit
  - sales-channel-details
    - sales-channel-general-section
  - sales-channel-create

The sales-channel-product-section is not shared because the API in V2 will change.
The sales-channel-add-products component is not shared because the API in V2 will change.

`@medusajs/core-flows`
- Add `detachProductsFromSalesChannelsStep`
- Add `removeProductsFromSalesChannelsWorkflow`
This commit is contained in:
Oli Juhl
2024-04-02 15:38:33 +02:00
committed by GitHub
parent 3dee91426e
commit 7895ff3849
40 changed files with 1184 additions and 58 deletions
@@ -7,6 +7,7 @@ import { Outlet } from "react-router-dom"
import { Spinner } from "@medusajs/icons"
import { ErrorBoundary } from "../../components/error/error-boundary"
import { useV2Session } from "../../lib/api-v2"
import { SalesChannelDTO } from "@medusajs/types"
import { UserDTO } from "@medusajs/types"
import { SearchProvider } from "../search-provider"
import { SidebarProvider } from "../sidebar-provider"
@@ -172,6 +173,54 @@ export const v2Routes: RouteObject[] = [
},
],
},
{
path: "sales-channels",
element: <Outlet />,
handle: {
crumb: () => "Sales Channels",
},
children: [
{
path: "",
lazy: () =>
import("../../v2-routes/sales-channels/sales-channel-list"),
children: [
{
path: "create",
lazy: () =>
import(
"../../v2-routes/sales-channels/sales-channel-create"
),
},
],
},
{
path: ":id",
lazy: () =>
import("../../v2-routes/sales-channels/sales-channel-detail"),
handle: {
crumb: (data: { sales_channel: SalesChannelDTO }) =>
data.sales_channel.name,
},
children: [
{
path: "edit",
lazy: () =>
import(
"../../v2-routes/sales-channels/sales-channel-edit"
),
},
{
path: "add-products",
lazy: () =>
import(
"../../v2-routes/sales-channels/sales-channel-add-products"
),
},
],
},
],
},
],
},
],