@medusajs/draft-order 2.13.4 → 2.13.5-preview-20260317120848
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 +184 -184
- package/.medusa/server/src/admin/index.mjs +184 -184
- package/package.json +16 -16
|
@@ -9785,6 +9785,74 @@ const CustomItemsForm = () => {
|
|
|
9785
9785
|
const schema$4 = objectType({
|
|
9786
9786
|
email: stringType().email()
|
|
9787
9787
|
});
|
|
9788
|
+
const Email = () => {
|
|
9789
|
+
const { id } = reactRouterDom.useParams();
|
|
9790
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9791
|
+
fields: "+email"
|
|
9792
|
+
});
|
|
9793
|
+
if (isError) {
|
|
9794
|
+
throw error;
|
|
9795
|
+
}
|
|
9796
|
+
const isReady = !isPending && !!order;
|
|
9797
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9798
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9799
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9800
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9801
|
+
] }),
|
|
9802
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9803
|
+
] });
|
|
9804
|
+
};
|
|
9805
|
+
const EmailForm = ({ order }) => {
|
|
9806
|
+
const form = reactHookForm.useForm({
|
|
9807
|
+
defaultValues: {
|
|
9808
|
+
email: order.email ?? ""
|
|
9809
|
+
},
|
|
9810
|
+
resolver: zod.zodResolver(schema$3)
|
|
9811
|
+
});
|
|
9812
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9813
|
+
const { handleSuccess } = useRouteModal();
|
|
9814
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9815
|
+
await mutateAsync(
|
|
9816
|
+
{ email: data.email },
|
|
9817
|
+
{
|
|
9818
|
+
onSuccess: () => {
|
|
9819
|
+
handleSuccess();
|
|
9820
|
+
},
|
|
9821
|
+
onError: (error) => {
|
|
9822
|
+
ui.toast.error(error.message);
|
|
9823
|
+
}
|
|
9824
|
+
}
|
|
9825
|
+
);
|
|
9826
|
+
});
|
|
9827
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9828
|
+
KeyboundForm,
|
|
9829
|
+
{
|
|
9830
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9831
|
+
onSubmit,
|
|
9832
|
+
children: [
|
|
9833
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9834
|
+
Form$2.Field,
|
|
9835
|
+
{
|
|
9836
|
+
control: form.control,
|
|
9837
|
+
name: "email",
|
|
9838
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9840
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9841
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9842
|
+
] })
|
|
9843
|
+
}
|
|
9844
|
+
) }),
|
|
9845
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9846
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9847
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9848
|
+
] }) })
|
|
9849
|
+
]
|
|
9850
|
+
}
|
|
9851
|
+
) });
|
|
9852
|
+
};
|
|
9853
|
+
const schema$3 = objectType({
|
|
9854
|
+
email: stringType().email()
|
|
9855
|
+
});
|
|
9788
9856
|
const NumberInput = React.forwardRef(
|
|
9789
9857
|
({
|
|
9790
9858
|
value,
|
|
@@ -11386,6 +11454,112 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11386
11454
|
}
|
|
11387
11455
|
return Array.from(promotionIds);
|
|
11388
11456
|
}
|
|
11457
|
+
const SalesChannel = () => {
|
|
11458
|
+
const { id } = reactRouterDom.useParams();
|
|
11459
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11460
|
+
id,
|
|
11461
|
+
{
|
|
11462
|
+
fields: "+sales_channel_id"
|
|
11463
|
+
},
|
|
11464
|
+
{
|
|
11465
|
+
enabled: !!id
|
|
11466
|
+
}
|
|
11467
|
+
);
|
|
11468
|
+
if (isError) {
|
|
11469
|
+
throw error;
|
|
11470
|
+
}
|
|
11471
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11472
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11473
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11474
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11475
|
+
/* @__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" }) })
|
|
11476
|
+
] }),
|
|
11477
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11478
|
+
] });
|
|
11479
|
+
};
|
|
11480
|
+
const SalesChannelForm = ({ order }) => {
|
|
11481
|
+
const form = reactHookForm.useForm({
|
|
11482
|
+
defaultValues: {
|
|
11483
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11484
|
+
},
|
|
11485
|
+
resolver: zod.zodResolver(schema$2)
|
|
11486
|
+
});
|
|
11487
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11488
|
+
const { handleSuccess } = useRouteModal();
|
|
11489
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11490
|
+
await mutateAsync(
|
|
11491
|
+
{
|
|
11492
|
+
sales_channel_id: data.sales_channel_id
|
|
11493
|
+
},
|
|
11494
|
+
{
|
|
11495
|
+
onSuccess: () => {
|
|
11496
|
+
ui.toast.success("Sales channel updated");
|
|
11497
|
+
handleSuccess();
|
|
11498
|
+
},
|
|
11499
|
+
onError: (error) => {
|
|
11500
|
+
ui.toast.error(error.message);
|
|
11501
|
+
}
|
|
11502
|
+
}
|
|
11503
|
+
);
|
|
11504
|
+
});
|
|
11505
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11506
|
+
KeyboundForm,
|
|
11507
|
+
{
|
|
11508
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11509
|
+
onSubmit,
|
|
11510
|
+
children: [
|
|
11511
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11512
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11513
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11514
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11515
|
+
] }) })
|
|
11516
|
+
]
|
|
11517
|
+
}
|
|
11518
|
+
) });
|
|
11519
|
+
};
|
|
11520
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11521
|
+
const salesChannels = useComboboxData({
|
|
11522
|
+
queryFn: async (params) => {
|
|
11523
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11524
|
+
},
|
|
11525
|
+
queryKey: ["sales-channels"],
|
|
11526
|
+
getOptions: (data) => {
|
|
11527
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11528
|
+
label: salesChannel.name,
|
|
11529
|
+
value: salesChannel.id
|
|
11530
|
+
}));
|
|
11531
|
+
},
|
|
11532
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11533
|
+
});
|
|
11534
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11535
|
+
Form$2.Field,
|
|
11536
|
+
{
|
|
11537
|
+
control,
|
|
11538
|
+
name: "sales_channel_id",
|
|
11539
|
+
render: ({ field }) => {
|
|
11540
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11541
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11542
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11543
|
+
Combobox,
|
|
11544
|
+
{
|
|
11545
|
+
options: salesChannels.options,
|
|
11546
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11547
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11548
|
+
searchValue: salesChannels.searchValue,
|
|
11549
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11550
|
+
placeholder: "Select sales channel",
|
|
11551
|
+
...field
|
|
11552
|
+
}
|
|
11553
|
+
) }),
|
|
11554
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11555
|
+
] });
|
|
11556
|
+
}
|
|
11557
|
+
}
|
|
11558
|
+
);
|
|
11559
|
+
};
|
|
11560
|
+
const schema$2 = objectType({
|
|
11561
|
+
sales_channel_id: stringType().min(1)
|
|
11562
|
+
});
|
|
11389
11563
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11390
11564
|
const Shipping = () => {
|
|
11391
11565
|
var _a;
|
|
@@ -12193,74 +12367,6 @@ const CustomAmountField = ({
|
|
|
12193
12367
|
}
|
|
12194
12368
|
);
|
|
12195
12369
|
};
|
|
12196
|
-
const Email = () => {
|
|
12197
|
-
const { id } = reactRouterDom.useParams();
|
|
12198
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12199
|
-
fields: "+email"
|
|
12200
|
-
});
|
|
12201
|
-
if (isError) {
|
|
12202
|
-
throw error;
|
|
12203
|
-
}
|
|
12204
|
-
const isReady = !isPending && !!order;
|
|
12205
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12206
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12207
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12208
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12209
|
-
] }),
|
|
12210
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12211
|
-
] });
|
|
12212
|
-
};
|
|
12213
|
-
const EmailForm = ({ order }) => {
|
|
12214
|
-
const form = reactHookForm.useForm({
|
|
12215
|
-
defaultValues: {
|
|
12216
|
-
email: order.email ?? ""
|
|
12217
|
-
},
|
|
12218
|
-
resolver: zod.zodResolver(schema$3)
|
|
12219
|
-
});
|
|
12220
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12221
|
-
const { handleSuccess } = useRouteModal();
|
|
12222
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12223
|
-
await mutateAsync(
|
|
12224
|
-
{ email: data.email },
|
|
12225
|
-
{
|
|
12226
|
-
onSuccess: () => {
|
|
12227
|
-
handleSuccess();
|
|
12228
|
-
},
|
|
12229
|
-
onError: (error) => {
|
|
12230
|
-
ui.toast.error(error.message);
|
|
12231
|
-
}
|
|
12232
|
-
}
|
|
12233
|
-
);
|
|
12234
|
-
});
|
|
12235
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12236
|
-
KeyboundForm,
|
|
12237
|
-
{
|
|
12238
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12239
|
-
onSubmit,
|
|
12240
|
-
children: [
|
|
12241
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12242
|
-
Form$2.Field,
|
|
12243
|
-
{
|
|
12244
|
-
control: form.control,
|
|
12245
|
-
name: "email",
|
|
12246
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12247
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
12248
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12249
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12250
|
-
] })
|
|
12251
|
-
}
|
|
12252
|
-
) }),
|
|
12253
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12254
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12255
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12256
|
-
] }) })
|
|
12257
|
-
]
|
|
12258
|
-
}
|
|
12259
|
-
) });
|
|
12260
|
-
};
|
|
12261
|
-
const schema$3 = objectType({
|
|
12262
|
-
email: stringType().email()
|
|
12263
|
-
});
|
|
12264
12370
|
const ShippingAddress = () => {
|
|
12265
12371
|
const { id } = reactRouterDom.useParams();
|
|
12266
12372
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12293,7 +12399,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12293
12399
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12294
12400
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12295
12401
|
},
|
|
12296
|
-
resolver: zod.zodResolver(schema$
|
|
12402
|
+
resolver: zod.zodResolver(schema$1)
|
|
12297
12403
|
});
|
|
12298
12404
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12299
12405
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12463,113 +12569,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12463
12569
|
}
|
|
12464
12570
|
) });
|
|
12465
12571
|
};
|
|
12466
|
-
const schema$
|
|
12467
|
-
const SalesChannel = () => {
|
|
12468
|
-
const { id } = reactRouterDom.useParams();
|
|
12469
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12470
|
-
id,
|
|
12471
|
-
{
|
|
12472
|
-
fields: "+sales_channel_id"
|
|
12473
|
-
},
|
|
12474
|
-
{
|
|
12475
|
-
enabled: !!id
|
|
12476
|
-
}
|
|
12477
|
-
);
|
|
12478
|
-
if (isError) {
|
|
12479
|
-
throw error;
|
|
12480
|
-
}
|
|
12481
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12482
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12483
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12484
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12485
|
-
/* @__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" }) })
|
|
12486
|
-
] }),
|
|
12487
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12488
|
-
] });
|
|
12489
|
-
};
|
|
12490
|
-
const SalesChannelForm = ({ order }) => {
|
|
12491
|
-
const form = reactHookForm.useForm({
|
|
12492
|
-
defaultValues: {
|
|
12493
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12494
|
-
},
|
|
12495
|
-
resolver: zod.zodResolver(schema$1)
|
|
12496
|
-
});
|
|
12497
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12498
|
-
const { handleSuccess } = useRouteModal();
|
|
12499
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12500
|
-
await mutateAsync(
|
|
12501
|
-
{
|
|
12502
|
-
sales_channel_id: data.sales_channel_id
|
|
12503
|
-
},
|
|
12504
|
-
{
|
|
12505
|
-
onSuccess: () => {
|
|
12506
|
-
ui.toast.success("Sales channel updated");
|
|
12507
|
-
handleSuccess();
|
|
12508
|
-
},
|
|
12509
|
-
onError: (error) => {
|
|
12510
|
-
ui.toast.error(error.message);
|
|
12511
|
-
}
|
|
12512
|
-
}
|
|
12513
|
-
);
|
|
12514
|
-
});
|
|
12515
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12516
|
-
KeyboundForm,
|
|
12517
|
-
{
|
|
12518
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12519
|
-
onSubmit,
|
|
12520
|
-
children: [
|
|
12521
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12522
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12523
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12524
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12525
|
-
] }) })
|
|
12526
|
-
]
|
|
12527
|
-
}
|
|
12528
|
-
) });
|
|
12529
|
-
};
|
|
12530
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12531
|
-
const salesChannels = useComboboxData({
|
|
12532
|
-
queryFn: async (params) => {
|
|
12533
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12534
|
-
},
|
|
12535
|
-
queryKey: ["sales-channels"],
|
|
12536
|
-
getOptions: (data) => {
|
|
12537
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12538
|
-
label: salesChannel.name,
|
|
12539
|
-
value: salesChannel.id
|
|
12540
|
-
}));
|
|
12541
|
-
},
|
|
12542
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12543
|
-
});
|
|
12544
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12545
|
-
Form$2.Field,
|
|
12546
|
-
{
|
|
12547
|
-
control,
|
|
12548
|
-
name: "sales_channel_id",
|
|
12549
|
-
render: ({ field }) => {
|
|
12550
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12551
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12552
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12553
|
-
Combobox,
|
|
12554
|
-
{
|
|
12555
|
-
options: salesChannels.options,
|
|
12556
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12557
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12558
|
-
searchValue: salesChannels.searchValue,
|
|
12559
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12560
|
-
placeholder: "Select sales channel",
|
|
12561
|
-
...field
|
|
12562
|
-
}
|
|
12563
|
-
) }),
|
|
12564
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12565
|
-
] });
|
|
12566
|
-
}
|
|
12567
|
-
}
|
|
12568
|
-
);
|
|
12569
|
-
};
|
|
12570
|
-
const schema$1 = objectType({
|
|
12571
|
-
sales_channel_id: stringType().min(1)
|
|
12572
|
-
});
|
|
12572
|
+
const schema$1 = addressSchema;
|
|
12573
12573
|
const TransferOwnership = () => {
|
|
12574
12574
|
const { id } = reactRouterDom.useParams();
|
|
12575
12575
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13074,6 +13074,10 @@ const routeModule = {
|
|
|
13074
13074
|
Component: CustomItems,
|
|
13075
13075
|
path: "/draft-orders/:id/custom-items"
|
|
13076
13076
|
},
|
|
13077
|
+
{
|
|
13078
|
+
Component: Email,
|
|
13079
|
+
path: "/draft-orders/:id/email"
|
|
13080
|
+
},
|
|
13077
13081
|
{
|
|
13078
13082
|
Component: Items,
|
|
13079
13083
|
path: "/draft-orders/:id/items"
|
|
@@ -13087,21 +13091,17 @@ const routeModule = {
|
|
|
13087
13091
|
path: "/draft-orders/:id/promotions"
|
|
13088
13092
|
},
|
|
13089
13093
|
{
|
|
13090
|
-
Component:
|
|
13091
|
-
path: "/draft-orders/:id/
|
|
13094
|
+
Component: SalesChannel,
|
|
13095
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13092
13096
|
},
|
|
13093
13097
|
{
|
|
13094
|
-
Component:
|
|
13095
|
-
path: "/draft-orders/:id/
|
|
13098
|
+
Component: Shipping,
|
|
13099
|
+
path: "/draft-orders/:id/shipping"
|
|
13096
13100
|
},
|
|
13097
13101
|
{
|
|
13098
13102
|
Component: ShippingAddress,
|
|
13099
13103
|
path: "/draft-orders/:id/shipping-address"
|
|
13100
13104
|
},
|
|
13101
|
-
{
|
|
13102
|
-
Component: SalesChannel,
|
|
13103
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13104
|
-
},
|
|
13105
13105
|
{
|
|
13106
13106
|
Component: TransferOwnership,
|
|
13107
13107
|
path: "/draft-orders/:id/transfer-ownership"
|
|
@@ -9778,6 +9778,74 @@ const CustomItemsForm = () => {
|
|
|
9778
9778
|
const schema$4 = objectType({
|
|
9779
9779
|
email: stringType().email()
|
|
9780
9780
|
});
|
|
9781
|
+
const Email = () => {
|
|
9782
|
+
const { id } = useParams();
|
|
9783
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9784
|
+
fields: "+email"
|
|
9785
|
+
});
|
|
9786
|
+
if (isError) {
|
|
9787
|
+
throw error;
|
|
9788
|
+
}
|
|
9789
|
+
const isReady = !isPending && !!order;
|
|
9790
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9791
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9792
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9793
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9794
|
+
] }),
|
|
9795
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9796
|
+
] });
|
|
9797
|
+
};
|
|
9798
|
+
const EmailForm = ({ order }) => {
|
|
9799
|
+
const form = useForm({
|
|
9800
|
+
defaultValues: {
|
|
9801
|
+
email: order.email ?? ""
|
|
9802
|
+
},
|
|
9803
|
+
resolver: zodResolver(schema$3)
|
|
9804
|
+
});
|
|
9805
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9806
|
+
const { handleSuccess } = useRouteModal();
|
|
9807
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9808
|
+
await mutateAsync(
|
|
9809
|
+
{ email: data.email },
|
|
9810
|
+
{
|
|
9811
|
+
onSuccess: () => {
|
|
9812
|
+
handleSuccess();
|
|
9813
|
+
},
|
|
9814
|
+
onError: (error) => {
|
|
9815
|
+
toast.error(error.message);
|
|
9816
|
+
}
|
|
9817
|
+
}
|
|
9818
|
+
);
|
|
9819
|
+
});
|
|
9820
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9821
|
+
KeyboundForm,
|
|
9822
|
+
{
|
|
9823
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9824
|
+
onSubmit,
|
|
9825
|
+
children: [
|
|
9826
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9827
|
+
Form$2.Field,
|
|
9828
|
+
{
|
|
9829
|
+
control: form.control,
|
|
9830
|
+
name: "email",
|
|
9831
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9832
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9833
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9834
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9835
|
+
] })
|
|
9836
|
+
}
|
|
9837
|
+
) }),
|
|
9838
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9841
|
+
] }) })
|
|
9842
|
+
]
|
|
9843
|
+
}
|
|
9844
|
+
) });
|
|
9845
|
+
};
|
|
9846
|
+
const schema$3 = objectType({
|
|
9847
|
+
email: stringType().email()
|
|
9848
|
+
});
|
|
9781
9849
|
const NumberInput = forwardRef(
|
|
9782
9850
|
({
|
|
9783
9851
|
value,
|
|
@@ -11379,6 +11447,112 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11379
11447
|
}
|
|
11380
11448
|
return Array.from(promotionIds);
|
|
11381
11449
|
}
|
|
11450
|
+
const SalesChannel = () => {
|
|
11451
|
+
const { id } = useParams();
|
|
11452
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11453
|
+
id,
|
|
11454
|
+
{
|
|
11455
|
+
fields: "+sales_channel_id"
|
|
11456
|
+
},
|
|
11457
|
+
{
|
|
11458
|
+
enabled: !!id
|
|
11459
|
+
}
|
|
11460
|
+
);
|
|
11461
|
+
if (isError) {
|
|
11462
|
+
throw error;
|
|
11463
|
+
}
|
|
11464
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
11465
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11466
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11467
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
11468
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
11469
|
+
] }),
|
|
11470
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
11471
|
+
] });
|
|
11472
|
+
};
|
|
11473
|
+
const SalesChannelForm = ({ order }) => {
|
|
11474
|
+
const form = useForm({
|
|
11475
|
+
defaultValues: {
|
|
11476
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
11477
|
+
},
|
|
11478
|
+
resolver: zodResolver(schema$2)
|
|
11479
|
+
});
|
|
11480
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11481
|
+
const { handleSuccess } = useRouteModal();
|
|
11482
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11483
|
+
await mutateAsync(
|
|
11484
|
+
{
|
|
11485
|
+
sales_channel_id: data.sales_channel_id
|
|
11486
|
+
},
|
|
11487
|
+
{
|
|
11488
|
+
onSuccess: () => {
|
|
11489
|
+
toast.success("Sales channel updated");
|
|
11490
|
+
handleSuccess();
|
|
11491
|
+
},
|
|
11492
|
+
onError: (error) => {
|
|
11493
|
+
toast.error(error.message);
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
);
|
|
11497
|
+
});
|
|
11498
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11499
|
+
KeyboundForm,
|
|
11500
|
+
{
|
|
11501
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11502
|
+
onSubmit,
|
|
11503
|
+
children: [
|
|
11504
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11505
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11506
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11507
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11508
|
+
] }) })
|
|
11509
|
+
]
|
|
11510
|
+
}
|
|
11511
|
+
) });
|
|
11512
|
+
};
|
|
11513
|
+
const SalesChannelField = ({ control, order }) => {
|
|
11514
|
+
const salesChannels = useComboboxData({
|
|
11515
|
+
queryFn: async (params) => {
|
|
11516
|
+
return await sdk.admin.salesChannel.list(params);
|
|
11517
|
+
},
|
|
11518
|
+
queryKey: ["sales-channels"],
|
|
11519
|
+
getOptions: (data) => {
|
|
11520
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
11521
|
+
label: salesChannel.name,
|
|
11522
|
+
value: salesChannel.id
|
|
11523
|
+
}));
|
|
11524
|
+
},
|
|
11525
|
+
defaultValue: order.sales_channel_id || void 0
|
|
11526
|
+
});
|
|
11527
|
+
return /* @__PURE__ */ jsx(
|
|
11528
|
+
Form$2.Field,
|
|
11529
|
+
{
|
|
11530
|
+
control,
|
|
11531
|
+
name: "sales_channel_id",
|
|
11532
|
+
render: ({ field }) => {
|
|
11533
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11534
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11535
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
11536
|
+
Combobox,
|
|
11537
|
+
{
|
|
11538
|
+
options: salesChannels.options,
|
|
11539
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
11540
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11541
|
+
searchValue: salesChannels.searchValue,
|
|
11542
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11543
|
+
placeholder: "Select sales channel",
|
|
11544
|
+
...field
|
|
11545
|
+
}
|
|
11546
|
+
) }),
|
|
11547
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11548
|
+
] });
|
|
11549
|
+
}
|
|
11550
|
+
}
|
|
11551
|
+
);
|
|
11552
|
+
};
|
|
11553
|
+
const schema$2 = objectType({
|
|
11554
|
+
sales_channel_id: stringType().min(1)
|
|
11555
|
+
});
|
|
11382
11556
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11383
11557
|
const Shipping = () => {
|
|
11384
11558
|
var _a;
|
|
@@ -12186,74 +12360,6 @@ const CustomAmountField = ({
|
|
|
12186
12360
|
}
|
|
12187
12361
|
);
|
|
12188
12362
|
};
|
|
12189
|
-
const Email = () => {
|
|
12190
|
-
const { id } = useParams();
|
|
12191
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12192
|
-
fields: "+email"
|
|
12193
|
-
});
|
|
12194
|
-
if (isError) {
|
|
12195
|
-
throw error;
|
|
12196
|
-
}
|
|
12197
|
-
const isReady = !isPending && !!order;
|
|
12198
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12199
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12200
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12201
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12202
|
-
] }),
|
|
12203
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12204
|
-
] });
|
|
12205
|
-
};
|
|
12206
|
-
const EmailForm = ({ order }) => {
|
|
12207
|
-
const form = useForm({
|
|
12208
|
-
defaultValues: {
|
|
12209
|
-
email: order.email ?? ""
|
|
12210
|
-
},
|
|
12211
|
-
resolver: zodResolver(schema$3)
|
|
12212
|
-
});
|
|
12213
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12214
|
-
const { handleSuccess } = useRouteModal();
|
|
12215
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12216
|
-
await mutateAsync(
|
|
12217
|
-
{ email: data.email },
|
|
12218
|
-
{
|
|
12219
|
-
onSuccess: () => {
|
|
12220
|
-
handleSuccess();
|
|
12221
|
-
},
|
|
12222
|
-
onError: (error) => {
|
|
12223
|
-
toast.error(error.message);
|
|
12224
|
-
}
|
|
12225
|
-
}
|
|
12226
|
-
);
|
|
12227
|
-
});
|
|
12228
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12229
|
-
KeyboundForm,
|
|
12230
|
-
{
|
|
12231
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12232
|
-
onSubmit,
|
|
12233
|
-
children: [
|
|
12234
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
12235
|
-
Form$2.Field,
|
|
12236
|
-
{
|
|
12237
|
-
control: form.control,
|
|
12238
|
-
name: "email",
|
|
12239
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12240
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
12241
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12242
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12243
|
-
] })
|
|
12244
|
-
}
|
|
12245
|
-
) }),
|
|
12246
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12247
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12248
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12249
|
-
] }) })
|
|
12250
|
-
]
|
|
12251
|
-
}
|
|
12252
|
-
) });
|
|
12253
|
-
};
|
|
12254
|
-
const schema$3 = objectType({
|
|
12255
|
-
email: stringType().email()
|
|
12256
|
-
});
|
|
12257
12363
|
const ShippingAddress = () => {
|
|
12258
12364
|
const { id } = useParams();
|
|
12259
12365
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -12286,7 +12392,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12286
12392
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12287
12393
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12288
12394
|
},
|
|
12289
|
-
resolver: zodResolver(schema$
|
|
12395
|
+
resolver: zodResolver(schema$1)
|
|
12290
12396
|
});
|
|
12291
12397
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12292
12398
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12456,113 +12562,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12456
12562
|
}
|
|
12457
12563
|
) });
|
|
12458
12564
|
};
|
|
12459
|
-
const schema$
|
|
12460
|
-
const SalesChannel = () => {
|
|
12461
|
-
const { id } = useParams();
|
|
12462
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12463
|
-
id,
|
|
12464
|
-
{
|
|
12465
|
-
fields: "+sales_channel_id"
|
|
12466
|
-
},
|
|
12467
|
-
{
|
|
12468
|
-
enabled: !!id
|
|
12469
|
-
}
|
|
12470
|
-
);
|
|
12471
|
-
if (isError) {
|
|
12472
|
-
throw error;
|
|
12473
|
-
}
|
|
12474
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12475
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12476
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12477
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12478
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12479
|
-
] }),
|
|
12480
|
-
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12481
|
-
] });
|
|
12482
|
-
};
|
|
12483
|
-
const SalesChannelForm = ({ order }) => {
|
|
12484
|
-
const form = useForm({
|
|
12485
|
-
defaultValues: {
|
|
12486
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12487
|
-
},
|
|
12488
|
-
resolver: zodResolver(schema$1)
|
|
12489
|
-
});
|
|
12490
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12491
|
-
const { handleSuccess } = useRouteModal();
|
|
12492
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12493
|
-
await mutateAsync(
|
|
12494
|
-
{
|
|
12495
|
-
sales_channel_id: data.sales_channel_id
|
|
12496
|
-
},
|
|
12497
|
-
{
|
|
12498
|
-
onSuccess: () => {
|
|
12499
|
-
toast.success("Sales channel updated");
|
|
12500
|
-
handleSuccess();
|
|
12501
|
-
},
|
|
12502
|
-
onError: (error) => {
|
|
12503
|
-
toast.error(error.message);
|
|
12504
|
-
}
|
|
12505
|
-
}
|
|
12506
|
-
);
|
|
12507
|
-
});
|
|
12508
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12509
|
-
KeyboundForm,
|
|
12510
|
-
{
|
|
12511
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12512
|
-
onSubmit,
|
|
12513
|
-
children: [
|
|
12514
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12515
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12516
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12517
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12518
|
-
] }) })
|
|
12519
|
-
]
|
|
12520
|
-
}
|
|
12521
|
-
) });
|
|
12522
|
-
};
|
|
12523
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12524
|
-
const salesChannels = useComboboxData({
|
|
12525
|
-
queryFn: async (params) => {
|
|
12526
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12527
|
-
},
|
|
12528
|
-
queryKey: ["sales-channels"],
|
|
12529
|
-
getOptions: (data) => {
|
|
12530
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12531
|
-
label: salesChannel.name,
|
|
12532
|
-
value: salesChannel.id
|
|
12533
|
-
}));
|
|
12534
|
-
},
|
|
12535
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12536
|
-
});
|
|
12537
|
-
return /* @__PURE__ */ jsx(
|
|
12538
|
-
Form$2.Field,
|
|
12539
|
-
{
|
|
12540
|
-
control,
|
|
12541
|
-
name: "sales_channel_id",
|
|
12542
|
-
render: ({ field }) => {
|
|
12543
|
-
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12544
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12545
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
12546
|
-
Combobox,
|
|
12547
|
-
{
|
|
12548
|
-
options: salesChannels.options,
|
|
12549
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12550
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12551
|
-
searchValue: salesChannels.searchValue,
|
|
12552
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12553
|
-
placeholder: "Select sales channel",
|
|
12554
|
-
...field
|
|
12555
|
-
}
|
|
12556
|
-
) }),
|
|
12557
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12558
|
-
] });
|
|
12559
|
-
}
|
|
12560
|
-
}
|
|
12561
|
-
);
|
|
12562
|
-
};
|
|
12563
|
-
const schema$1 = objectType({
|
|
12564
|
-
sales_channel_id: stringType().min(1)
|
|
12565
|
-
});
|
|
12565
|
+
const schema$1 = addressSchema;
|
|
12566
12566
|
const TransferOwnership = () => {
|
|
12567
12567
|
const { id } = useParams();
|
|
12568
12568
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13067,6 +13067,10 @@ const routeModule = {
|
|
|
13067
13067
|
Component: CustomItems,
|
|
13068
13068
|
path: "/draft-orders/:id/custom-items"
|
|
13069
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: Email,
|
|
13072
|
+
path: "/draft-orders/:id/email"
|
|
13073
|
+
},
|
|
13070
13074
|
{
|
|
13071
13075
|
Component: Items,
|
|
13072
13076
|
path: "/draft-orders/:id/items"
|
|
@@ -13080,21 +13084,17 @@ const routeModule = {
|
|
|
13080
13084
|
path: "/draft-orders/:id/promotions"
|
|
13081
13085
|
},
|
|
13082
13086
|
{
|
|
13083
|
-
Component:
|
|
13084
|
-
path: "/draft-orders/:id/
|
|
13087
|
+
Component: SalesChannel,
|
|
13088
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13085
13089
|
},
|
|
13086
13090
|
{
|
|
13087
|
-
Component:
|
|
13088
|
-
path: "/draft-orders/:id/
|
|
13091
|
+
Component: Shipping,
|
|
13092
|
+
path: "/draft-orders/:id/shipping"
|
|
13089
13093
|
},
|
|
13090
13094
|
{
|
|
13091
13095
|
Component: ShippingAddress,
|
|
13092
13096
|
path: "/draft-orders/:id/shipping-address"
|
|
13093
13097
|
},
|
|
13094
|
-
{
|
|
13095
|
-
Component: SalesChannel,
|
|
13096
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13097
|
-
},
|
|
13098
13098
|
{
|
|
13099
13099
|
Component: TransferOwnership,
|
|
13100
13100
|
path: "/draft-orders/:id/transfer-ownership"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.5-preview-20260317120848",
|
|
4
4
|
"description": "A draft order plugin for Medusa.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@ariakit/react": "^0.4.15",
|
|
43
43
|
"@babel/runtime": "^7.26.10",
|
|
44
44
|
"@hookform/resolvers": "3.4.2",
|
|
45
|
-
"@medusajs/js-sdk": "2.13.
|
|
45
|
+
"@medusajs/js-sdk": "2.13.5-preview-20260317120848",
|
|
46
46
|
"@tanstack/react-query": "5.64.2",
|
|
47
47
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
48
48
|
"date-fns": "^3.6.0",
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
"react-hook-form": "7.49.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@medusajs/admin-sdk": "2.13.
|
|
57
|
-
"@medusajs/cli": "2.13.
|
|
58
|
-
"@medusajs/framework": "2.13.
|
|
59
|
-
"@medusajs/icons": "2.13.
|
|
60
|
-
"@medusajs/test-utils": "2.13.
|
|
61
|
-
"@medusajs/types": "2.13.
|
|
62
|
-
"@medusajs/ui": "4.1.
|
|
63
|
-
"@medusajs/ui-preset": "2.13.
|
|
56
|
+
"@medusajs/admin-sdk": "2.13.5-preview-20260317120848",
|
|
57
|
+
"@medusajs/cli": "2.13.5-preview-20260317120848",
|
|
58
|
+
"@medusajs/framework": "2.13.5-preview-20260317120848",
|
|
59
|
+
"@medusajs/icons": "2.13.5-preview-20260317120848",
|
|
60
|
+
"@medusajs/test-utils": "2.13.5-preview-20260317120848",
|
|
61
|
+
"@medusajs/types": "2.13.5-preview-20260317120848",
|
|
62
|
+
"@medusajs/ui": "4.1.5-preview-20260317120848",
|
|
63
|
+
"@medusajs/ui-preset": "2.13.5-preview-20260317120848"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@medusajs/admin-sdk": "2.13.
|
|
67
|
-
"@medusajs/cli": "2.13.
|
|
68
|
-
"@medusajs/framework": "2.13.
|
|
69
|
-
"@medusajs/icons": "2.13.
|
|
70
|
-
"@medusajs/test-utils": "2.13.
|
|
71
|
-
"@medusajs/ui": "4.1.
|
|
66
|
+
"@medusajs/admin-sdk": "2.13.5-preview-20260317120848",
|
|
67
|
+
"@medusajs/cli": "2.13.5-preview-20260317120848",
|
|
68
|
+
"@medusajs/framework": "2.13.5-preview-20260317120848",
|
|
69
|
+
"@medusajs/icons": "2.13.5-preview-20260317120848",
|
|
70
|
+
"@medusajs/test-utils": "2.13.5-preview-20260317120848",
|
|
71
|
+
"@medusajs/ui": "4.1.5-preview-20260317120848",
|
|
72
72
|
"react": "^18.3.1",
|
|
73
73
|
"react-dom": "^18.3.1",
|
|
74
74
|
"react-router-dom": "6.30.3"
|