@medusajs/draft-order 2.10.2-preview-20250908210158 → 2.10.2-preview-20250909031450
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 +207 -207
- package/.medusa/server/src/admin/index.mjs +207 -207
- package/package.json +16 -16
|
@@ -9573,6 +9573,95 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
+
const CustomItems = () => {
|
|
9577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9578
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9579
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9580
|
+
] });
|
|
9581
|
+
};
|
|
9582
|
+
const CustomItemsForm = () => {
|
|
9583
|
+
const form = reactHookForm.useForm({
|
|
9584
|
+
resolver: zod.zodResolver(schema$5)
|
|
9585
|
+
});
|
|
9586
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9587
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9588
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9589
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9590
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9591
|
+
] }) })
|
|
9592
|
+
] }) });
|
|
9593
|
+
};
|
|
9594
|
+
const schema$5 = objectType({
|
|
9595
|
+
email: stringType().email()
|
|
9596
|
+
});
|
|
9597
|
+
const Email = () => {
|
|
9598
|
+
const { id } = reactRouterDom.useParams();
|
|
9599
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9600
|
+
fields: "+email"
|
|
9601
|
+
});
|
|
9602
|
+
if (isError) {
|
|
9603
|
+
throw error;
|
|
9604
|
+
}
|
|
9605
|
+
const isReady = !isPending && !!order;
|
|
9606
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9607
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9608
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9609
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9610
|
+
] }),
|
|
9611
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9612
|
+
] });
|
|
9613
|
+
};
|
|
9614
|
+
const EmailForm = ({ order }) => {
|
|
9615
|
+
const form = reactHookForm.useForm({
|
|
9616
|
+
defaultValues: {
|
|
9617
|
+
email: order.email ?? ""
|
|
9618
|
+
},
|
|
9619
|
+
resolver: zod.zodResolver(schema$4)
|
|
9620
|
+
});
|
|
9621
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9622
|
+
const { handleSuccess } = useRouteModal();
|
|
9623
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9624
|
+
await mutateAsync(
|
|
9625
|
+
{ email: data.email },
|
|
9626
|
+
{
|
|
9627
|
+
onSuccess: () => {
|
|
9628
|
+
handleSuccess();
|
|
9629
|
+
},
|
|
9630
|
+
onError: (error) => {
|
|
9631
|
+
ui.toast.error(error.message);
|
|
9632
|
+
}
|
|
9633
|
+
}
|
|
9634
|
+
);
|
|
9635
|
+
});
|
|
9636
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9637
|
+
KeyboundForm,
|
|
9638
|
+
{
|
|
9639
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9640
|
+
onSubmit,
|
|
9641
|
+
children: [
|
|
9642
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9643
|
+
Form$2.Field,
|
|
9644
|
+
{
|
|
9645
|
+
control: form.control,
|
|
9646
|
+
name: "email",
|
|
9647
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9648
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9649
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9650
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9651
|
+
] })
|
|
9652
|
+
}
|
|
9653
|
+
) }),
|
|
9654
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9655
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9656
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9657
|
+
] }) })
|
|
9658
|
+
]
|
|
9659
|
+
}
|
|
9660
|
+
) });
|
|
9661
|
+
};
|
|
9662
|
+
const schema$4 = objectType({
|
|
9663
|
+
email: stringType().email()
|
|
9664
|
+
});
|
|
9576
9665
|
const BillingAddress = () => {
|
|
9577
9666
|
const { id } = reactRouterDom.useParams();
|
|
9578
9667
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9605,7 +9694,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9605
9694
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9606
9695
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9607
9696
|
},
|
|
9608
|
-
resolver: zod.zodResolver(schema$
|
|
9697
|
+
resolver: zod.zodResolver(schema$3)
|
|
9609
9698
|
});
|
|
9610
9699
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9611
9700
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9762,96 +9851,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9851
|
}
|
|
9763
9852
|
) });
|
|
9764
9853
|
};
|
|
9765
|
-
const schema$
|
|
9766
|
-
const Email = () => {
|
|
9767
|
-
const { id } = reactRouterDom.useParams();
|
|
9768
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9769
|
-
fields: "+email"
|
|
9770
|
-
});
|
|
9771
|
-
if (isError) {
|
|
9772
|
-
throw error;
|
|
9773
|
-
}
|
|
9774
|
-
const isReady = !isPending && !!order;
|
|
9775
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9776
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9779
|
-
] }),
|
|
9780
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9781
|
-
] });
|
|
9782
|
-
};
|
|
9783
|
-
const EmailForm = ({ order }) => {
|
|
9784
|
-
const form = reactHookForm.useForm({
|
|
9785
|
-
defaultValues: {
|
|
9786
|
-
email: order.email ?? ""
|
|
9787
|
-
},
|
|
9788
|
-
resolver: zod.zodResolver(schema$4)
|
|
9789
|
-
});
|
|
9790
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9791
|
-
const { handleSuccess } = useRouteModal();
|
|
9792
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9793
|
-
await mutateAsync(
|
|
9794
|
-
{ email: data.email },
|
|
9795
|
-
{
|
|
9796
|
-
onSuccess: () => {
|
|
9797
|
-
handleSuccess();
|
|
9798
|
-
},
|
|
9799
|
-
onError: (error) => {
|
|
9800
|
-
ui.toast.error(error.message);
|
|
9801
|
-
}
|
|
9802
|
-
}
|
|
9803
|
-
);
|
|
9804
|
-
});
|
|
9805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9806
|
-
KeyboundForm,
|
|
9807
|
-
{
|
|
9808
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9809
|
-
onSubmit,
|
|
9810
|
-
children: [
|
|
9811
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9812
|
-
Form$2.Field,
|
|
9813
|
-
{
|
|
9814
|
-
control: form.control,
|
|
9815
|
-
name: "email",
|
|
9816
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9817
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9818
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9819
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9820
|
-
] })
|
|
9821
|
-
}
|
|
9822
|
-
) }),
|
|
9823
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9824
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9825
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9826
|
-
] }) })
|
|
9827
|
-
]
|
|
9828
|
-
}
|
|
9829
|
-
) });
|
|
9830
|
-
};
|
|
9831
|
-
const schema$4 = objectType({
|
|
9832
|
-
email: stringType().email()
|
|
9833
|
-
});
|
|
9834
|
-
const CustomItems = () => {
|
|
9835
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9836
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9837
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9838
|
-
] });
|
|
9839
|
-
};
|
|
9840
|
-
const CustomItemsForm = () => {
|
|
9841
|
-
const form = reactHookForm.useForm({
|
|
9842
|
-
resolver: zod.zodResolver(schema$3)
|
|
9843
|
-
});
|
|
9844
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9845
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9846
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9847
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9848
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9849
|
-
] }) })
|
|
9850
|
-
] }) });
|
|
9851
|
-
};
|
|
9852
|
-
const schema$3 = objectType({
|
|
9853
|
-
email: stringType().email()
|
|
9854
|
-
});
|
|
9854
|
+
const schema$3 = addressSchema;
|
|
9855
9855
|
const NumberInput = React.forwardRef(
|
|
9856
9856
|
({
|
|
9857
9857
|
value,
|
|
@@ -12463,112 +12463,6 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12463
12463
|
) });
|
|
12464
12464
|
};
|
|
12465
12465
|
const schema$2 = addressSchema;
|
|
12466
|
-
const SalesChannel = () => {
|
|
12467
|
-
const { id } = reactRouterDom.useParams();
|
|
12468
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12469
|
-
id,
|
|
12470
|
-
{
|
|
12471
|
-
fields: "+sales_channel_id"
|
|
12472
|
-
},
|
|
12473
|
-
{
|
|
12474
|
-
enabled: !!id
|
|
12475
|
-
}
|
|
12476
|
-
);
|
|
12477
|
-
if (isError) {
|
|
12478
|
-
throw error;
|
|
12479
|
-
}
|
|
12480
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
12481
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12482
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12483
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12484
|
-
/* @__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" }) })
|
|
12485
|
-
] }),
|
|
12486
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12487
|
-
] });
|
|
12488
|
-
};
|
|
12489
|
-
const SalesChannelForm = ({ order }) => {
|
|
12490
|
-
const form = reactHookForm.useForm({
|
|
12491
|
-
defaultValues: {
|
|
12492
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
12493
|
-
},
|
|
12494
|
-
resolver: zod.zodResolver(schema$1)
|
|
12495
|
-
});
|
|
12496
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12497
|
-
const { handleSuccess } = useRouteModal();
|
|
12498
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12499
|
-
await mutateAsync(
|
|
12500
|
-
{
|
|
12501
|
-
sales_channel_id: data.sales_channel_id
|
|
12502
|
-
},
|
|
12503
|
-
{
|
|
12504
|
-
onSuccess: () => {
|
|
12505
|
-
ui.toast.success("Sales channel updated");
|
|
12506
|
-
handleSuccess();
|
|
12507
|
-
},
|
|
12508
|
-
onError: (error) => {
|
|
12509
|
-
ui.toast.error(error.message);
|
|
12510
|
-
}
|
|
12511
|
-
}
|
|
12512
|
-
);
|
|
12513
|
-
});
|
|
12514
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12515
|
-
KeyboundForm,
|
|
12516
|
-
{
|
|
12517
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12518
|
-
onSubmit,
|
|
12519
|
-
children: [
|
|
12520
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12521
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12522
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12523
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12524
|
-
] }) })
|
|
12525
|
-
]
|
|
12526
|
-
}
|
|
12527
|
-
) });
|
|
12528
|
-
};
|
|
12529
|
-
const SalesChannelField = ({ control, order }) => {
|
|
12530
|
-
const salesChannels = useComboboxData({
|
|
12531
|
-
queryFn: async (params) => {
|
|
12532
|
-
return await sdk.admin.salesChannel.list(params);
|
|
12533
|
-
},
|
|
12534
|
-
queryKey: ["sales-channels"],
|
|
12535
|
-
getOptions: (data) => {
|
|
12536
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
12537
|
-
label: salesChannel.name,
|
|
12538
|
-
value: salesChannel.id
|
|
12539
|
-
}));
|
|
12540
|
-
},
|
|
12541
|
-
defaultValue: order.sales_channel_id || void 0
|
|
12542
|
-
});
|
|
12543
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12544
|
-
Form$2.Field,
|
|
12545
|
-
{
|
|
12546
|
-
control,
|
|
12547
|
-
name: "sales_channel_id",
|
|
12548
|
-
render: ({ field }) => {
|
|
12549
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12550
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
12551
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12552
|
-
Combobox,
|
|
12553
|
-
{
|
|
12554
|
-
options: salesChannels.options,
|
|
12555
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
12556
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
12557
|
-
searchValue: salesChannels.searchValue,
|
|
12558
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
12559
|
-
placeholder: "Select sales channel",
|
|
12560
|
-
...field
|
|
12561
|
-
}
|
|
12562
|
-
) }),
|
|
12563
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12564
|
-
] });
|
|
12565
|
-
}
|
|
12566
|
-
}
|
|
12567
|
-
);
|
|
12568
|
-
};
|
|
12569
|
-
const schema$1 = objectType({
|
|
12570
|
-
sales_channel_id: stringType().min(1)
|
|
12571
|
-
});
|
|
12572
12466
|
const TransferOwnership = () => {
|
|
12573
12467
|
const { id } = reactRouterDom.useParams();
|
|
12574
12468
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12592,7 +12486,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12592
12486
|
defaultValues: {
|
|
12593
12487
|
customer_id: order.customer_id || ""
|
|
12594
12488
|
},
|
|
12595
|
-
resolver: zod.zodResolver(schema)
|
|
12489
|
+
resolver: zod.zodResolver(schema$1)
|
|
12596
12490
|
});
|
|
12597
12491
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12598
12492
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13042,9 +12936,115 @@ const Illustration = () => {
|
|
|
13042
12936
|
}
|
|
13043
12937
|
);
|
|
13044
12938
|
};
|
|
13045
|
-
const schema = objectType({
|
|
12939
|
+
const schema$1 = objectType({
|
|
13046
12940
|
customer_id: stringType().min(1)
|
|
13047
12941
|
});
|
|
12942
|
+
const SalesChannel = () => {
|
|
12943
|
+
const { id } = reactRouterDom.useParams();
|
|
12944
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12945
|
+
id,
|
|
12946
|
+
{
|
|
12947
|
+
fields: "+sales_channel_id"
|
|
12948
|
+
},
|
|
12949
|
+
{
|
|
12950
|
+
enabled: !!id
|
|
12951
|
+
}
|
|
12952
|
+
);
|
|
12953
|
+
if (isError) {
|
|
12954
|
+
throw error;
|
|
12955
|
+
}
|
|
12956
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12957
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12958
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12959
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
12960
|
+
/* @__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" }) })
|
|
12961
|
+
] }),
|
|
12962
|
+
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
12963
|
+
] });
|
|
12964
|
+
};
|
|
12965
|
+
const SalesChannelForm = ({ order }) => {
|
|
12966
|
+
const form = reactHookForm.useForm({
|
|
12967
|
+
defaultValues: {
|
|
12968
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12969
|
+
},
|
|
12970
|
+
resolver: zod.zodResolver(schema)
|
|
12971
|
+
});
|
|
12972
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12973
|
+
const { handleSuccess } = useRouteModal();
|
|
12974
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12975
|
+
await mutateAsync(
|
|
12976
|
+
{
|
|
12977
|
+
sales_channel_id: data.sales_channel_id
|
|
12978
|
+
},
|
|
12979
|
+
{
|
|
12980
|
+
onSuccess: () => {
|
|
12981
|
+
ui.toast.success("Sales channel updated");
|
|
12982
|
+
handleSuccess();
|
|
12983
|
+
},
|
|
12984
|
+
onError: (error) => {
|
|
12985
|
+
ui.toast.error(error.message);
|
|
12986
|
+
}
|
|
12987
|
+
}
|
|
12988
|
+
);
|
|
12989
|
+
});
|
|
12990
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12991
|
+
KeyboundForm,
|
|
12992
|
+
{
|
|
12993
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12994
|
+
onSubmit,
|
|
12995
|
+
children: [
|
|
12996
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12997
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12998
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12999
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13000
|
+
] }) })
|
|
13001
|
+
]
|
|
13002
|
+
}
|
|
13003
|
+
) });
|
|
13004
|
+
};
|
|
13005
|
+
const SalesChannelField = ({ control, order }) => {
|
|
13006
|
+
const salesChannels = useComboboxData({
|
|
13007
|
+
queryFn: async (params) => {
|
|
13008
|
+
return await sdk.admin.salesChannel.list(params);
|
|
13009
|
+
},
|
|
13010
|
+
queryKey: ["sales-channels"],
|
|
13011
|
+
getOptions: (data) => {
|
|
13012
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
13013
|
+
label: salesChannel.name,
|
|
13014
|
+
value: salesChannel.id
|
|
13015
|
+
}));
|
|
13016
|
+
},
|
|
13017
|
+
defaultValue: order.sales_channel_id || void 0
|
|
13018
|
+
});
|
|
13019
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13020
|
+
Form$2.Field,
|
|
13021
|
+
{
|
|
13022
|
+
control,
|
|
13023
|
+
name: "sales_channel_id",
|
|
13024
|
+
render: ({ field }) => {
|
|
13025
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13026
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13027
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13028
|
+
Combobox,
|
|
13029
|
+
{
|
|
13030
|
+
options: salesChannels.options,
|
|
13031
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
13032
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13033
|
+
searchValue: salesChannels.searchValue,
|
|
13034
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13035
|
+
placeholder: "Select sales channel",
|
|
13036
|
+
...field
|
|
13037
|
+
}
|
|
13038
|
+
) }),
|
|
13039
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13040
|
+
] });
|
|
13041
|
+
}
|
|
13042
|
+
}
|
|
13043
|
+
);
|
|
13044
|
+
};
|
|
13045
|
+
const schema = objectType({
|
|
13046
|
+
sales_channel_id: stringType().min(1)
|
|
13047
|
+
});
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
13050
13050
|
routes: [
|
|
@@ -13066,16 +13066,16 @@ const routeModule = {
|
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
13068
|
{
|
|
13069
|
-
Component:
|
|
13070
|
-
path: "/draft-orders/:id/
|
|
13069
|
+
Component: CustomItems,
|
|
13070
|
+
path: "/draft-orders/:id/custom-items"
|
|
13071
13071
|
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Email,
|
|
13074
13074
|
path: "/draft-orders/:id/email"
|
|
13075
13075
|
},
|
|
13076
13076
|
{
|
|
13077
|
-
Component:
|
|
13078
|
-
path: "/draft-orders/:id/
|
|
13077
|
+
Component: BillingAddress,
|
|
13078
|
+
path: "/draft-orders/:id/billing-address"
|
|
13079
13079
|
},
|
|
13080
13080
|
{
|
|
13081
13081
|
Component: Items,
|
|
@@ -13097,13 +13097,13 @@ const routeModule = {
|
|
|
13097
13097
|
Component: ShippingAddress,
|
|
13098
13098
|
path: "/draft-orders/:id/shipping-address"
|
|
13099
13099
|
},
|
|
13100
|
-
{
|
|
13101
|
-
Component: SalesChannel,
|
|
13102
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13103
|
-
},
|
|
13104
13100
|
{
|
|
13105
13101
|
Component: TransferOwnership,
|
|
13106
13102
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
Component: SalesChannel,
|
|
13106
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|
|
@@ -9567,6 +9567,95 @@ const ID = () => {
|
|
|
9567
9567
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9568
9568
|
] });
|
|
9569
9569
|
};
|
|
9570
|
+
const CustomItems = () => {
|
|
9571
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9572
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9573
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9574
|
+
] });
|
|
9575
|
+
};
|
|
9576
|
+
const CustomItemsForm = () => {
|
|
9577
|
+
const form = useForm({
|
|
9578
|
+
resolver: zodResolver(schema$5)
|
|
9579
|
+
});
|
|
9580
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9581
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9582
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9583
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9584
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9585
|
+
] }) })
|
|
9586
|
+
] }) });
|
|
9587
|
+
};
|
|
9588
|
+
const schema$5 = objectType({
|
|
9589
|
+
email: stringType().email()
|
|
9590
|
+
});
|
|
9591
|
+
const Email = () => {
|
|
9592
|
+
const { id } = useParams();
|
|
9593
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9594
|
+
fields: "+email"
|
|
9595
|
+
});
|
|
9596
|
+
if (isError) {
|
|
9597
|
+
throw error;
|
|
9598
|
+
}
|
|
9599
|
+
const isReady = !isPending && !!order;
|
|
9600
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9601
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9602
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9603
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9604
|
+
] }),
|
|
9605
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9606
|
+
] });
|
|
9607
|
+
};
|
|
9608
|
+
const EmailForm = ({ order }) => {
|
|
9609
|
+
const form = useForm({
|
|
9610
|
+
defaultValues: {
|
|
9611
|
+
email: order.email ?? ""
|
|
9612
|
+
},
|
|
9613
|
+
resolver: zodResolver(schema$4)
|
|
9614
|
+
});
|
|
9615
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9616
|
+
const { handleSuccess } = useRouteModal();
|
|
9617
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9618
|
+
await mutateAsync(
|
|
9619
|
+
{ email: data.email },
|
|
9620
|
+
{
|
|
9621
|
+
onSuccess: () => {
|
|
9622
|
+
handleSuccess();
|
|
9623
|
+
},
|
|
9624
|
+
onError: (error) => {
|
|
9625
|
+
toast.error(error.message);
|
|
9626
|
+
}
|
|
9627
|
+
}
|
|
9628
|
+
);
|
|
9629
|
+
});
|
|
9630
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9631
|
+
KeyboundForm,
|
|
9632
|
+
{
|
|
9633
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9634
|
+
onSubmit,
|
|
9635
|
+
children: [
|
|
9636
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9637
|
+
Form$2.Field,
|
|
9638
|
+
{
|
|
9639
|
+
control: form.control,
|
|
9640
|
+
name: "email",
|
|
9641
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9642
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9643
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9644
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9645
|
+
] })
|
|
9646
|
+
}
|
|
9647
|
+
) }),
|
|
9648
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9649
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9650
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9651
|
+
] }) })
|
|
9652
|
+
]
|
|
9653
|
+
}
|
|
9654
|
+
) });
|
|
9655
|
+
};
|
|
9656
|
+
const schema$4 = objectType({
|
|
9657
|
+
email: stringType().email()
|
|
9658
|
+
});
|
|
9570
9659
|
const BillingAddress = () => {
|
|
9571
9660
|
const { id } = useParams();
|
|
9572
9661
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9599,7 +9688,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9599
9688
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9600
9689
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9601
9690
|
},
|
|
9602
|
-
resolver: zodResolver(schema$
|
|
9691
|
+
resolver: zodResolver(schema$3)
|
|
9603
9692
|
});
|
|
9604
9693
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9605
9694
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9756,96 +9845,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9756
9845
|
}
|
|
9757
9846
|
) });
|
|
9758
9847
|
};
|
|
9759
|
-
const schema$
|
|
9760
|
-
const Email = () => {
|
|
9761
|
-
const { id } = useParams();
|
|
9762
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9763
|
-
fields: "+email"
|
|
9764
|
-
});
|
|
9765
|
-
if (isError) {
|
|
9766
|
-
throw error;
|
|
9767
|
-
}
|
|
9768
|
-
const isReady = !isPending && !!order;
|
|
9769
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9770
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9772
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9773
|
-
] }),
|
|
9774
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9775
|
-
] });
|
|
9776
|
-
};
|
|
9777
|
-
const EmailForm = ({ order }) => {
|
|
9778
|
-
const form = useForm({
|
|
9779
|
-
defaultValues: {
|
|
9780
|
-
email: order.email ?? ""
|
|
9781
|
-
},
|
|
9782
|
-
resolver: zodResolver(schema$4)
|
|
9783
|
-
});
|
|
9784
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9785
|
-
const { handleSuccess } = useRouteModal();
|
|
9786
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9787
|
-
await mutateAsync(
|
|
9788
|
-
{ email: data.email },
|
|
9789
|
-
{
|
|
9790
|
-
onSuccess: () => {
|
|
9791
|
-
handleSuccess();
|
|
9792
|
-
},
|
|
9793
|
-
onError: (error) => {
|
|
9794
|
-
toast.error(error.message);
|
|
9795
|
-
}
|
|
9796
|
-
}
|
|
9797
|
-
);
|
|
9798
|
-
});
|
|
9799
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9800
|
-
KeyboundForm,
|
|
9801
|
-
{
|
|
9802
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9803
|
-
onSubmit,
|
|
9804
|
-
children: [
|
|
9805
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9806
|
-
Form$2.Field,
|
|
9807
|
-
{
|
|
9808
|
-
control: form.control,
|
|
9809
|
-
name: "email",
|
|
9810
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9811
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9812
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9813
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9814
|
-
] })
|
|
9815
|
-
}
|
|
9816
|
-
) }),
|
|
9817
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9818
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9819
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9820
|
-
] }) })
|
|
9821
|
-
]
|
|
9822
|
-
}
|
|
9823
|
-
) });
|
|
9824
|
-
};
|
|
9825
|
-
const schema$4 = objectType({
|
|
9826
|
-
email: stringType().email()
|
|
9827
|
-
});
|
|
9828
|
-
const CustomItems = () => {
|
|
9829
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9830
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9831
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9832
|
-
] });
|
|
9833
|
-
};
|
|
9834
|
-
const CustomItemsForm = () => {
|
|
9835
|
-
const form = useForm({
|
|
9836
|
-
resolver: zodResolver(schema$3)
|
|
9837
|
-
});
|
|
9838
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9839
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9840
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9841
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9842
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9843
|
-
] }) })
|
|
9844
|
-
] }) });
|
|
9845
|
-
};
|
|
9846
|
-
const schema$3 = objectType({
|
|
9847
|
-
email: stringType().email()
|
|
9848
|
-
});
|
|
9848
|
+
const schema$3 = addressSchema;
|
|
9849
9849
|
const NumberInput = forwardRef(
|
|
9850
9850
|
({
|
|
9851
9851
|
value,
|
|
@@ -12457,112 +12457,6 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12457
12457
|
) });
|
|
12458
12458
|
};
|
|
12459
12459
|
const schema$2 = addressSchema;
|
|
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
|
-
});
|
|
12566
12460
|
const TransferOwnership = () => {
|
|
12567
12461
|
const { id } = useParams();
|
|
12568
12462
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12586,7 +12480,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12586
12480
|
defaultValues: {
|
|
12587
12481
|
customer_id: order.customer_id || ""
|
|
12588
12482
|
},
|
|
12589
|
-
resolver: zodResolver(schema)
|
|
12483
|
+
resolver: zodResolver(schema$1)
|
|
12590
12484
|
});
|
|
12591
12485
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12592
12486
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13036,9 +12930,115 @@ const Illustration = () => {
|
|
|
13036
12930
|
}
|
|
13037
12931
|
);
|
|
13038
12932
|
};
|
|
13039
|
-
const schema = objectType({
|
|
12933
|
+
const schema$1 = objectType({
|
|
13040
12934
|
customer_id: stringType().min(1)
|
|
13041
12935
|
});
|
|
12936
|
+
const SalesChannel = () => {
|
|
12937
|
+
const { id } = useParams();
|
|
12938
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
12939
|
+
id,
|
|
12940
|
+
{
|
|
12941
|
+
fields: "+sales_channel_id"
|
|
12942
|
+
},
|
|
12943
|
+
{
|
|
12944
|
+
enabled: !!id
|
|
12945
|
+
}
|
|
12946
|
+
);
|
|
12947
|
+
if (isError) {
|
|
12948
|
+
throw error;
|
|
12949
|
+
}
|
|
12950
|
+
const ISrEADY = !!draft_order && !isPending;
|
|
12951
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12952
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12953
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
|
|
12954
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
|
|
12955
|
+
] }),
|
|
12956
|
+
ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
|
|
12957
|
+
] });
|
|
12958
|
+
};
|
|
12959
|
+
const SalesChannelForm = ({ order }) => {
|
|
12960
|
+
const form = useForm({
|
|
12961
|
+
defaultValues: {
|
|
12962
|
+
sales_channel_id: order.sales_channel_id || ""
|
|
12963
|
+
},
|
|
12964
|
+
resolver: zodResolver(schema)
|
|
12965
|
+
});
|
|
12966
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12967
|
+
const { handleSuccess } = useRouteModal();
|
|
12968
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12969
|
+
await mutateAsync(
|
|
12970
|
+
{
|
|
12971
|
+
sales_channel_id: data.sales_channel_id
|
|
12972
|
+
},
|
|
12973
|
+
{
|
|
12974
|
+
onSuccess: () => {
|
|
12975
|
+
toast.success("Sales channel updated");
|
|
12976
|
+
handleSuccess();
|
|
12977
|
+
},
|
|
12978
|
+
onError: (error) => {
|
|
12979
|
+
toast.error(error.message);
|
|
12980
|
+
}
|
|
12981
|
+
}
|
|
12982
|
+
);
|
|
12983
|
+
});
|
|
12984
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12985
|
+
KeyboundForm,
|
|
12986
|
+
{
|
|
12987
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12988
|
+
onSubmit,
|
|
12989
|
+
children: [
|
|
12990
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
|
|
12991
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12992
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12993
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12994
|
+
] }) })
|
|
12995
|
+
]
|
|
12996
|
+
}
|
|
12997
|
+
) });
|
|
12998
|
+
};
|
|
12999
|
+
const SalesChannelField = ({ control, order }) => {
|
|
13000
|
+
const salesChannels = useComboboxData({
|
|
13001
|
+
queryFn: async (params) => {
|
|
13002
|
+
return await sdk.admin.salesChannel.list(params);
|
|
13003
|
+
},
|
|
13004
|
+
queryKey: ["sales-channels"],
|
|
13005
|
+
getOptions: (data) => {
|
|
13006
|
+
return data.sales_channels.map((salesChannel) => ({
|
|
13007
|
+
label: salesChannel.name,
|
|
13008
|
+
value: salesChannel.id
|
|
13009
|
+
}));
|
|
13010
|
+
},
|
|
13011
|
+
defaultValue: order.sales_channel_id || void 0
|
|
13012
|
+
});
|
|
13013
|
+
return /* @__PURE__ */ jsx(
|
|
13014
|
+
Form$2.Field,
|
|
13015
|
+
{
|
|
13016
|
+
control,
|
|
13017
|
+
name: "sales_channel_id",
|
|
13018
|
+
render: ({ field }) => {
|
|
13019
|
+
return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13020
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
13021
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
|
|
13022
|
+
Combobox,
|
|
13023
|
+
{
|
|
13024
|
+
options: salesChannels.options,
|
|
13025
|
+
fetchNextPage: salesChannels.fetchNextPage,
|
|
13026
|
+
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
13027
|
+
searchValue: salesChannels.searchValue,
|
|
13028
|
+
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
13029
|
+
placeholder: "Select sales channel",
|
|
13030
|
+
...field
|
|
13031
|
+
}
|
|
13032
|
+
) }),
|
|
13033
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13034
|
+
] });
|
|
13035
|
+
}
|
|
13036
|
+
}
|
|
13037
|
+
);
|
|
13038
|
+
};
|
|
13039
|
+
const schema = objectType({
|
|
13040
|
+
sales_channel_id: stringType().min(1)
|
|
13041
|
+
});
|
|
13042
13042
|
const widgetModule = { widgets: [] };
|
|
13043
13043
|
const routeModule = {
|
|
13044
13044
|
routes: [
|
|
@@ -13060,16 +13060,16 @@ const routeModule = {
|
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
13062
|
{
|
|
13063
|
-
Component:
|
|
13064
|
-
path: "/draft-orders/:id/
|
|
13063
|
+
Component: CustomItems,
|
|
13064
|
+
path: "/draft-orders/:id/custom-items"
|
|
13065
13065
|
},
|
|
13066
13066
|
{
|
|
13067
13067
|
Component: Email,
|
|
13068
13068
|
path: "/draft-orders/:id/email"
|
|
13069
13069
|
},
|
|
13070
13070
|
{
|
|
13071
|
-
Component:
|
|
13072
|
-
path: "/draft-orders/:id/
|
|
13071
|
+
Component: BillingAddress,
|
|
13072
|
+
path: "/draft-orders/:id/billing-address"
|
|
13073
13073
|
},
|
|
13074
13074
|
{
|
|
13075
13075
|
Component: Items,
|
|
@@ -13091,13 +13091,13 @@ const routeModule = {
|
|
|
13091
13091
|
Component: ShippingAddress,
|
|
13092
13092
|
path: "/draft-orders/:id/shipping-address"
|
|
13093
13093
|
},
|
|
13094
|
-
{
|
|
13095
|
-
Component: SalesChannel,
|
|
13096
|
-
path: "/draft-orders/:id/sales-channel"
|
|
13097
|
-
},
|
|
13098
13094
|
{
|
|
13099
13095
|
Component: TransferOwnership,
|
|
13100
13096
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
|
+
},
|
|
13098
|
+
{
|
|
13099
|
+
Component: SalesChannel,
|
|
13100
|
+
path: "/draft-orders/:id/sales-channel"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.2-preview-
|
|
3
|
+
"version": "2.10.2-preview-20250909031450",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.10.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.2-preview-20250909031450",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.10.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
53
|
-
"@medusajs/types": "2.10.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250909031450",
|
|
49
|
+
"@medusajs/cli": "2.10.2-preview-20250909031450",
|
|
50
|
+
"@medusajs/framework": "2.10.2-preview-20250909031450",
|
|
51
|
+
"@medusajs/icons": "2.10.2-preview-20250909031450",
|
|
52
|
+
"@medusajs/test-utils": "2.10.2-preview-20250909031450",
|
|
53
|
+
"@medusajs/types": "2.10.2-preview-20250909031450",
|
|
54
|
+
"@medusajs/ui": "4.0.22-preview-20250909031450",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.2-preview-20250909031450",
|
|
56
56
|
"@mikro-orm/cli": "6.5.2",
|
|
57
57
|
"@mikro-orm/core": "6.5.2",
|
|
58
58
|
"@mikro-orm/knex": "6.5.2",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"yalc": "^1.0.0-pre.53"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@medusajs/admin-sdk": "2.10.2-preview-
|
|
80
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
81
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
82
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
83
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
84
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
79
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250909031450",
|
|
80
|
+
"@medusajs/cli": "2.10.2-preview-20250909031450",
|
|
81
|
+
"@medusajs/framework": "2.10.2-preview-20250909031450",
|
|
82
|
+
"@medusajs/icons": "2.10.2-preview-20250909031450",
|
|
83
|
+
"@medusajs/test-utils": "2.10.2-preview-20250909031450",
|
|
84
|
+
"@medusajs/ui": "4.0.22-preview-20250909031450",
|
|
85
85
|
"@mikro-orm/cli": "6.5.2",
|
|
86
86
|
"@mikro-orm/core": "6.5.2",
|
|
87
87
|
"@mikro-orm/knex": "6.5.2",
|