@medusajs/draft-order 2.12.2-snapshot-20251205131013 → 2.12.2-snapshot-20251205140019
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +110 -110
- package/.medusa/server/src/admin/index.mjs +110 -110
- package/package.json +16 -16
|
@@ -11452,6 +11452,112 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11452
11452
|
}
|
|
11453
11453
|
return Array.from(promotionIds);
|
|
11454
11454
|
}
|
|
11455
|
+
const SalesChannel = () => {
|
|
11456
|
+
const { id } = reactRouterDom.useParams();
|
|
11457
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11458
|
+
id,
|
|
11459
|
+
{
|
|
11460
|
+
fields: "+sales_channel_id"
|
|
11461
|
+
},
|
|
11462
|
+
{
|
|
11463
|
+
enabled: !!id
|
|
11464
|
+
}
|
|
11465
|
+
);
|
|
11466
|
+
if (isError) {
|
|
11467
|
+
throw error;
|
|
11468
|
+
}
|
|
11469
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11470
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11471
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11472
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11473
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11474
|
+
] }),
|
|
11475
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11476
|
+
] });
|
|
11477
|
+
};
|
|
11478
|
+
const SalesChannelForm = ({ order }) => {
|
|
11479
|
+
const form = reactHookForm.useForm({
|
|
11480
|
+
defaultValues: {
|
|
11481
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11482
|
+
},
|
|
11483
|
+
resolver: zod.zodResolver(schema$2)
|
|
11484
|
+
});
|
|
11485
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11486
|
+
const { handleSuccess } = useRouteModal();
|
|
11487
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11488
|
+
await mutateAsync(
|
|
11489
|
+
{
|
|
11490
|
+
sales_channel_id: data.sales_channel_id
|
|
11491
|
+
},
|
|
11492
|
+
{
|
|
11493
|
+
onSuccess: () => {
|
|
11494
|
+
ui.toast.success("Sales channel updated");
|
|
11495
|
+
handleSuccess();
|
|
11496
|
+
},
|
|
11497
|
+
onError: (error) => {
|
|
11498
|
+
ui.toast.error(error.message);
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
);
|
|
11502
|
+
});
|
|
11503
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11504
|
+
KeyboundForm,
|
|
11505
|
+
{
|
|
11506
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11507
|
+
onSubmit,
|
|
11508
|
+
children: [
|
|
11509
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11510
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11511
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11512
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11513
|
+
] }) })
|
|
11514
|
+
]
|
|
11515
|
+
}
|
|
11516
|
+
) });
|
|
11517
|
+
};
|
|
11518
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11519
|
+
const salesChannels = useComboboxData({
|
|
11520
|
+
queryFn: async (params) => {
|
|
11521
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11522
|
+
},
|
|
11523
|
+
queryKey: ["sales-channels"],
|
|
11524
|
+
getOptions: (data) => {
|
|
11525
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11526
|
+
label: salesChannel.name,
|
|
11527
|
+
value: salesChannel.id
|
|
11528
|
+
}));
|
|
11529
|
+
},
|
|
11530
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11531
|
+
});
|
|
11532
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11533
|
+
Form$2.Field,
|
|
11534
|
+
{
|
|
11535
|
+
control,
|
|
11536
|
+
name: "sales_channel_id",
|
|
11537
|
+
render: ({ field }) => {
|
|
11538
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11539
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11540
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11541
|
+
Combobox,
|
|
11542
|
+
{
|
|
11543
|
+
options: salesChannels.options,
|
|
11544
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11545
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11546
|
+
searchValue: salesChannels.searchValue,
|
|
11547
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11548
|
+
placeholder: "Select sales channel",
|
|
11549
|
+
...field
|
|
11550
|
+
}
|
|
11551
|
+
) }),
|
|
11552
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11553
|
+
] });
|
|
11554
|
+
}
|
|
11555
|
+
}
|
|
11556
|
+
);
|
|
11557
|
+
};
|
|
11558
|
+
const schema$2 = objectType({
|
|
11559
|
+
sales_channel_id: stringType().min(1)
|
|
11560
|
+
});
|
|
11455
11561
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11456
11562
|
const Shipping = () => {
|
|
11457
11563
|
var _a;
|
|
@@ -12259,112 +12365,6 @@ const CustomAmountField = ({
|
|
|
12259
12365
|
}
|
|
12260
12366
|
);
|
|
12261
12367
|
};
|
|
12262
|
-
const SalesChannel = () => {
|
|
12263
|
-
const { id } = reactRouterDom.useParams();
|
|
12264
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12265
|
-
id,
|
|
12266
|
-
{
|
|
12267
|
-
fields: "+sales_channel_id"
|
|
12268
|
-
},
|
|
12269
|
-
{
|
|
12270
|
-
enabled: !!id
|
|
12271
|
-
}
|
|
12272
|
-
);
|
|
12273
|
-
if (isError) {
|
|
12274
|
-
throw error;
|
|
12275
|
-
}
|
|
12276
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12277
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12278
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12279
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12280
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12281
|
-
] }),
|
|
12282
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12283
|
-
] });
|
|
12284
|
-
};
|
|
12285
|
-
const SalesChannelForm = ({ order }) => {
|
|
12286
|
-
const form = reactHookForm.useForm({
|
|
12287
|
-
defaultValues: {
|
|
12288
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12289
|
-
},
|
|
12290
|
-
resolver: zod.zodResolver(schema$2)
|
|
12291
|
-
});
|
|
12292
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12293
|
-
const { handleSuccess } = useRouteModal();
|
|
12294
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12295
|
-
await mutateAsync(
|
|
12296
|
-
{
|
|
12297
|
-
sales_channel_id: data.sales_channel_id
|
|
12298
|
-
},
|
|
12299
|
-
{
|
|
12300
|
-
onSuccess: () => {
|
|
12301
|
-
ui.toast.success("Sales channel updated");
|
|
12302
|
-
handleSuccess();
|
|
12303
|
-
},
|
|
12304
|
-
onError: (error) => {
|
|
12305
|
-
ui.toast.error(error.message);
|
|
12306
|
-
}
|
|
12307
|
-
}
|
|
12308
|
-
);
|
|
12309
|
-
});
|
|
12310
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12311
|
-
KeyboundForm,
|
|
12312
|
-
{
|
|
12313
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12314
|
-
onSubmit,
|
|
12315
|
-
children: [
|
|
12316
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12317
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12318
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12319
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12320
|
-
] }) })
|
|
12321
|
-
]
|
|
12322
|
-
}
|
|
12323
|
-
) });
|
|
12324
|
-
};
|
|
12325
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12326
|
-
const salesChannels = useComboboxData({
|
|
12327
|
-
queryFn: async (params) => {
|
|
12328
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12329
|
-
},
|
|
12330
|
-
queryKey: ["sales-channels"],
|
|
12331
|
-
getOptions: (data) => {
|
|
12332
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12333
|
-
label: salesChannel.name,
|
|
12334
|
-
value: salesChannel.id
|
|
12335
|
-
}));
|
|
12336
|
-
},
|
|
12337
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12338
|
-
});
|
|
12339
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12340
|
-
Form$2.Field,
|
|
12341
|
-
{
|
|
12342
|
-
control,
|
|
12343
|
-
name: "sales_channel_id",
|
|
12344
|
-
render: ({ field }) => {
|
|
12345
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12346
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12347
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12348
|
-
Combobox,
|
|
12349
|
-
{
|
|
12350
|
-
options: salesChannels.options,
|
|
12351
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12352
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12353
|
-
searchValue: salesChannels.searchValue,
|
|
12354
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12355
|
-
placeholder: "Select sales channel",
|
|
12356
|
-
...field
|
|
12357
|
-
}
|
|
12358
|
-
) }),
|
|
12359
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12360
|
-
] });
|
|
12361
|
-
}
|
|
12362
|
-
}
|
|
12363
|
-
);
|
|
12364
|
-
};
|
|
12365
|
-
const schema$2 = objectType({
|
|
12366
|
-
sales_channel_id: stringType().min(1)
|
|
12367
|
-
});
|
|
12368
12368
|
const ShippingAddress = () => {
|
|
12369
12369
|
const { id } = reactRouterDom.useParams();
|
|
12370
12370
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -13088,14 +13088,14 @@ const routeModule = {
|
|
|
13088
13088
|
Component: Promotions,
|
|
13089
13089
|
path: "/draft-orders/:id/promotions"
|
|
13090
13090
|
},
|
|
13091
|
-
{
|
|
13092
|
-
Component: Shipping,
|
|
13093
|
-
path: "/draft-orders/:id/shipping"
|
|
13094
|
-
},
|
|
13095
13091
|
{
|
|
13096
13092
|
Component: SalesChannel,
|
|
13097
13093
|
path: "/draft-orders/:id/sales-channel"
|
|
13098
13094
|
},
|
|
13095
|
+
{
|
|
13096
|
+
Component: Shipping,
|
|
13097
|
+
path: "/draft-orders/:id/shipping"
|
|
13098
|
+
},
|
|
13099
13099
|
{
|
|
13100
13100
|
Component: ShippingAddress,
|
|
13101
13101
|
path: "/draft-orders/:id/shipping-address"
|
|
@@ -11445,6 +11445,112 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11445
11445
|
}
|
|
11446
11446
|
return Array.from(promotionIds);
|
|
11447
11447
|
}
|
|
11448
|
+
const SalesChannel = () => {
|
|
11449
|
+
const { id } = useParams();
|
|
11450
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11451
|
+
id,
|
|
11452
|
+
{
|
|
11453
|
+
fields: "+sales_channel_id"
|
|
11454
|
+
},
|
|
11455
|
+
{
|
|
11456
|
+
enabled: !!id
|
|
11457
|
+
}
|
|
11458
|
+
);
|
|
11459
|
+
if (isError) {
|
|
11460
|
+
throw error;
|
|
11461
|
+
}
|
|
11462
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11463
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11464
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11465
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11466
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11467
|
+
] }),
|
|
11468
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11469
|
+
] });
|
|
11470
|
+
};
|
|
11471
|
+
const SalesChannelForm = ({ order }) => {
|
|
11472
|
+
const form = useForm({
|
|
11473
|
+
defaultValues: {
|
|
11474
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11475
|
+
},
|
|
11476
|
+
resolver: zodResolver(schema$2)
|
|
11477
|
+
});
|
|
11478
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11479
|
+
const { handleSuccess } = useRouteModal();
|
|
11480
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11481
|
+
await mutateAsync(
|
|
11482
|
+
{
|
|
11483
|
+
sales_channel_id: data.sales_channel_id
|
|
11484
|
+
},
|
|
11485
|
+
{
|
|
11486
|
+
onSuccess: () => {
|
|
11487
|
+
toast.success("Sales channel updated");
|
|
11488
|
+
handleSuccess();
|
|
11489
|
+
},
|
|
11490
|
+
onError: (error) => {
|
|
11491
|
+
toast.error(error.message);
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
);
|
|
11495
|
+
});
|
|
11496
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11497
|
+
KeyboundForm,
|
|
11498
|
+
{
|
|
11499
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11500
|
+
onSubmit,
|
|
11501
|
+
children: [
|
|
11502
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11503
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11504
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11505
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11506
|
+
] }) })
|
|
11507
|
+
]
|
|
11508
|
+
}
|
|
11509
|
+
) });
|
|
11510
|
+
};
|
|
11511
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11512
|
+
const salesChannels = useComboboxData({
|
|
11513
|
+
queryFn: async (params) => {
|
|
11514
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11515
|
+
},
|
|
11516
|
+
queryKey: ["sales-channels"],
|
|
11517
|
+
getOptions: (data) => {
|
|
11518
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11519
|
+
label: salesChannel.name,
|
|
11520
|
+
value: salesChannel.id
|
|
11521
|
+
}));
|
|
11522
|
+
},
|
|
11523
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11524
|
+
});
|
|
11525
|
+
return /* @__PURE__ */ jsx(
|
|
11526
|
+
Form$2.Field,
|
|
11527
|
+
{
|
|
11528
|
+
control,
|
|
11529
|
+
name: "sales_channel_id",
|
|
11530
|
+
render: ({ field }) => {
|
|
11531
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11532
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11533
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11534
|
+
Combobox,
|
|
11535
|
+
{
|
|
11536
|
+
options: salesChannels.options,
|
|
11537
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11538
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11539
|
+
searchValue: salesChannels.searchValue,
|
|
11540
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11541
|
+
placeholder: "Select sales channel",
|
|
11542
|
+
...field
|
|
11543
|
+
}
|
|
11544
|
+
) }),
|
|
11545
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11546
|
+
] });
|
|
11547
|
+
}
|
|
11548
|
+
}
|
|
11549
|
+
);
|
|
11550
|
+
};
|
|
11551
|
+
const schema$2 = objectType({
|
|
11552
|
+
sales_channel_id: stringType().min(1)
|
|
11553
|
+
});
|
|
11448
11554
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11449
11555
|
const Shipping = () => {
|
|
11450
11556
|
var _a;
|
|
@@ -12252,112 +12358,6 @@ const CustomAmountField = ({
|
|
|
12252
12358
|
}
|
|
12253
12359
|
);
|
|
12254
12360
|
};
|
|
12255
|
-
const SalesChannel = () => {
|
|
12256
|
-
const { id } = useParams();
|
|
12257
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12258
|
-
id,
|
|
12259
|
-
{
|
|
12260
|
-
fields: "+sales_channel_id"
|
|
12261
|
-
},
|
|
12262
|
-
{
|
|
12263
|
-
enabled: !!id
|
|
12264
|
-
}
|
|
12265
|
-
);
|
|
12266
|
-
if (isError) {
|
|
12267
|
-
throw error;
|
|
12268
|
-
}
|
|
12269
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12270
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12271
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12272
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12273
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12274
|
-
] }),
|
|
12275
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12276
|
-
] });
|
|
12277
|
-
};
|
|
12278
|
-
const SalesChannelForm = ({ order }) => {
|
|
12279
|
-
const form = useForm({
|
|
12280
|
-
defaultValues: {
|
|
12281
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12282
|
-
},
|
|
12283
|
-
resolver: zodResolver(schema$2)
|
|
12284
|
-
});
|
|
12285
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12286
|
-
const { handleSuccess } = useRouteModal();
|
|
12287
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12288
|
-
await mutateAsync(
|
|
12289
|
-
{
|
|
12290
|
-
sales_channel_id: data.sales_channel_id
|
|
12291
|
-
},
|
|
12292
|
-
{
|
|
12293
|
-
onSuccess: () => {
|
|
12294
|
-
toast.success("Sales channel updated");
|
|
12295
|
-
handleSuccess();
|
|
12296
|
-
},
|
|
12297
|
-
onError: (error) => {
|
|
12298
|
-
toast.error(error.message);
|
|
12299
|
-
}
|
|
12300
|
-
}
|
|
12301
|
-
);
|
|
12302
|
-
});
|
|
12303
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12304
|
-
KeyboundForm,
|
|
12305
|
-
{
|
|
12306
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12307
|
-
onSubmit,
|
|
12308
|
-
children: [
|
|
12309
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12310
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12311
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12312
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12313
|
-
] }) })
|
|
12314
|
-
]
|
|
12315
|
-
}
|
|
12316
|
-
) });
|
|
12317
|
-
};
|
|
12318
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12319
|
-
const salesChannels = useComboboxData({
|
|
12320
|
-
queryFn: async (params) => {
|
|
12321
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12322
|
-
},
|
|
12323
|
-
queryKey: ["sales-channels"],
|
|
12324
|
-
getOptions: (data) => {
|
|
12325
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12326
|
-
label: salesChannel.name,
|
|
12327
|
-
value: salesChannel.id
|
|
12328
|
-
}));
|
|
12329
|
-
},
|
|
12330
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12331
|
-
});
|
|
12332
|
-
return /* @__PURE__ */ jsx(
|
|
12333
|
-
Form$2.Field,
|
|
12334
|
-
{
|
|
12335
|
-
control,
|
|
12336
|
-
name: "sales_channel_id",
|
|
12337
|
-
render: ({ field }) => {
|
|
12338
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12339
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12340
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12341
|
-
Combobox,
|
|
12342
|
-
{
|
|
12343
|
-
options: salesChannels.options,
|
|
12344
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12345
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12346
|
-
searchValue: salesChannels.searchValue,
|
|
12347
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12348
|
-
placeholder: "Select sales channel",
|
|
12349
|
-
...field
|
|
12350
|
-
}
|
|
12351
|
-
) }),
|
|
12352
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12353
|
-
] });
|
|
12354
|
-
}
|
|
12355
|
-
}
|
|
12356
|
-
);
|
|
12357
|
-
};
|
|
12358
|
-
const schema$2 = objectType({
|
|
12359
|
-
sales_channel_id: stringType().min(1)
|
|
12360
|
-
});
|
|
12361
12361
|
const ShippingAddress = () => {
|
|
12362
12362
|
const { id } = useParams();
|
|
12363
12363
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -13081,14 +13081,14 @@ const routeModule = {
|
|
|
13081
13081
|
Component: Promotions,
|
|
13082
13082
|
path: "/draft-orders/:id/promotions"
|
|
13083
13083
|
},
|
|
13084
|
-
{
|
|
13085
|
-
Component: Shipping,
|
|
13086
|
-
path: "/draft-orders/:id/shipping"
|
|
13087
|
-
},
|
|
13088
13084
|
{
|
|
13089
13085
|
Component: SalesChannel,
|
|
13090
13086
|
path: "/draft-orders/:id/sales-channel"
|
|
13091
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: Shipping,
|
|
13090
|
+
path: "/draft-orders/:id/shipping"
|
|
13091
|
+
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: ShippingAddress,
|
|
13094
13094
|
path: "/draft-orders/:id/shipping-address"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.12.2-snapshot-
|
|
3
|
+
"version": "2.12.2-snapshot-20251205140019",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@babel/runtime": "^7.26.10",
|
|
39
39
|
"@hookform/resolvers": "3.4.2",
|
|
40
|
-
"@medusajs/js-sdk": "2.12.2-snapshot-
|
|
40
|
+
"@medusajs/js-sdk": "2.12.2-snapshot-20251205140019",
|
|
41
41
|
"@tanstack/react-query": "5.64.2",
|
|
42
42
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
43
43
|
"date-fns": "^3.6.0",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "2.12.2-snapshot-
|
|
52
|
-
"@medusajs/cli": "2.12.2-snapshot-
|
|
53
|
-
"@medusajs/framework": "2.12.2-snapshot-
|
|
54
|
-
"@medusajs/icons": "2.12.2-snapshot-
|
|
55
|
-
"@medusajs/test-utils": "2.12.2-snapshot-
|
|
56
|
-
"@medusajs/types": "2.12.2-snapshot-
|
|
57
|
-
"@medusajs/ui": "4.0.30-snapshot-
|
|
58
|
-
"@medusajs/ui-preset": "2.12.2-snapshot-
|
|
51
|
+
"@medusajs/admin-sdk": "2.12.2-snapshot-20251205140019",
|
|
52
|
+
"@medusajs/cli": "2.12.2-snapshot-20251205140019",
|
|
53
|
+
"@medusajs/framework": "2.12.2-snapshot-20251205140019",
|
|
54
|
+
"@medusajs/icons": "2.12.2-snapshot-20251205140019",
|
|
55
|
+
"@medusajs/test-utils": "2.12.2-snapshot-20251205140019",
|
|
56
|
+
"@medusajs/types": "2.12.2-snapshot-20251205140019",
|
|
57
|
+
"@medusajs/ui": "4.0.30-snapshot-20251205140019",
|
|
58
|
+
"@medusajs/ui-preset": "2.12.2-snapshot-20251205140019"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "2.12.2-snapshot-
|
|
62
|
-
"@medusajs/cli": "2.12.2-snapshot-
|
|
63
|
-
"@medusajs/framework": "2.12.2-snapshot-
|
|
64
|
-
"@medusajs/icons": "2.12.2-snapshot-
|
|
65
|
-
"@medusajs/test-utils": "2.12.2-snapshot-
|
|
66
|
-
"@medusajs/ui": "4.0.30-snapshot-
|
|
61
|
+
"@medusajs/admin-sdk": "2.12.2-snapshot-20251205140019",
|
|
62
|
+
"@medusajs/cli": "2.12.2-snapshot-20251205140019",
|
|
63
|
+
"@medusajs/framework": "2.12.2-snapshot-20251205140019",
|
|
64
|
+
"@medusajs/icons": "2.12.2-snapshot-20251205140019",
|
|
65
|
+
"@medusajs/test-utils": "2.12.2-snapshot-20251205140019",
|
|
66
|
+
"@medusajs/ui": "4.0.30-snapshot-20251205140019",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|