@medusajs/draft-order 2.11.0-preview-20251019090151 → 2.11.0-preview-20251019120202
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 +95 -95
- package/.medusa/server/src/admin/index.mjs +95 -95
- package/package.json +16 -16
|
@@ -9571,6 +9571,95 @@ const ID = () => {
|
|
|
9571
9571
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9572
9572
|
] });
|
|
9573
9573
|
};
|
|
9574
|
+
const CustomItems = () => {
|
|
9575
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9576
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9577
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9578
|
+
] });
|
|
9579
|
+
};
|
|
9580
|
+
const CustomItemsForm = () => {
|
|
9581
|
+
const form = reactHookForm.useForm({
|
|
9582
|
+
resolver: zod.zodResolver(schema$5)
|
|
9583
|
+
});
|
|
9584
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9585
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9586
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9587
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9588
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9589
|
+
] }) })
|
|
9590
|
+
] }) });
|
|
9591
|
+
};
|
|
9592
|
+
const schema$5 = objectType({
|
|
9593
|
+
email: stringType().email()
|
|
9594
|
+
});
|
|
9595
|
+
const Email = () => {
|
|
9596
|
+
const { id } = reactRouterDom.useParams();
|
|
9597
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9598
|
+
fields: "+email"
|
|
9599
|
+
});
|
|
9600
|
+
if (isError) {
|
|
9601
|
+
throw error;
|
|
9602
|
+
}
|
|
9603
|
+
const isReady = !isPending && !!order;
|
|
9604
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9605
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9606
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9607
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9608
|
+
] }),
|
|
9609
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9610
|
+
] });
|
|
9611
|
+
};
|
|
9612
|
+
const EmailForm = ({ order }) => {
|
|
9613
|
+
const form = reactHookForm.useForm({
|
|
9614
|
+
defaultValues: {
|
|
9615
|
+
email: order.email ?? ""
|
|
9616
|
+
},
|
|
9617
|
+
resolver: zod.zodResolver(schema$4)
|
|
9618
|
+
});
|
|
9619
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9620
|
+
const { handleSuccess } = useRouteModal();
|
|
9621
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9622
|
+
await mutateAsync(
|
|
9623
|
+
{ email: data.email },
|
|
9624
|
+
{
|
|
9625
|
+
onSuccess: () => {
|
|
9626
|
+
handleSuccess();
|
|
9627
|
+
},
|
|
9628
|
+
onError: (error) => {
|
|
9629
|
+
ui.toast.error(error.message);
|
|
9630
|
+
}
|
|
9631
|
+
}
|
|
9632
|
+
);
|
|
9633
|
+
});
|
|
9634
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9635
|
+
KeyboundForm,
|
|
9636
|
+
{
|
|
9637
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9638
|
+
onSubmit,
|
|
9639
|
+
children: [
|
|
9640
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9641
|
+
Form$2.Field,
|
|
9642
|
+
{
|
|
9643
|
+
control: form.control,
|
|
9644
|
+
name: "email",
|
|
9645
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9646
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9647
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9648
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9649
|
+
] })
|
|
9650
|
+
}
|
|
9651
|
+
) }),
|
|
9652
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9653
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9654
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9655
|
+
] }) })
|
|
9656
|
+
]
|
|
9657
|
+
}
|
|
9658
|
+
) });
|
|
9659
|
+
};
|
|
9660
|
+
const schema$4 = objectType({
|
|
9661
|
+
email: stringType().email()
|
|
9662
|
+
});
|
|
9574
9663
|
const BillingAddress = () => {
|
|
9575
9664
|
const { id } = reactRouterDom.useParams();
|
|
9576
9665
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9603,7 +9692,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9603
9692
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9604
9693
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9605
9694
|
},
|
|
9606
|
-
resolver: zod.zodResolver(schema$
|
|
9695
|
+
resolver: zod.zodResolver(schema$3)
|
|
9607
9696
|
});
|
|
9608
9697
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9609
9698
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9760,96 +9849,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9760
9849
|
}
|
|
9761
9850
|
) });
|
|
9762
9851
|
};
|
|
9763
|
-
const schema$
|
|
9764
|
-
const CustomItems = () => {
|
|
9765
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9766
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9767
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9768
|
-
] });
|
|
9769
|
-
};
|
|
9770
|
-
const CustomItemsForm = () => {
|
|
9771
|
-
const form = reactHookForm.useForm({
|
|
9772
|
-
resolver: zod.zodResolver(schema$4)
|
|
9773
|
-
});
|
|
9774
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9775
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9776
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9779
|
-
] }) })
|
|
9780
|
-
] }) });
|
|
9781
|
-
};
|
|
9782
|
-
const schema$4 = objectType({
|
|
9783
|
-
email: stringType().email()
|
|
9784
|
-
});
|
|
9785
|
-
const Email = () => {
|
|
9786
|
-
const { id } = reactRouterDom.useParams();
|
|
9787
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9788
|
-
fields: "+email"
|
|
9789
|
-
});
|
|
9790
|
-
if (isError) {
|
|
9791
|
-
throw error;
|
|
9792
|
-
}
|
|
9793
|
-
const isReady = !isPending && !!order;
|
|
9794
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9795
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9796
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9797
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9798
|
-
] }),
|
|
9799
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9800
|
-
] });
|
|
9801
|
-
};
|
|
9802
|
-
const EmailForm = ({ order }) => {
|
|
9803
|
-
const form = reactHookForm.useForm({
|
|
9804
|
-
defaultValues: {
|
|
9805
|
-
email: order.email ?? ""
|
|
9806
|
-
},
|
|
9807
|
-
resolver: zod.zodResolver(schema$3)
|
|
9808
|
-
});
|
|
9809
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9810
|
-
const { handleSuccess } = useRouteModal();
|
|
9811
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9812
|
-
await mutateAsync(
|
|
9813
|
-
{ email: data.email },
|
|
9814
|
-
{
|
|
9815
|
-
onSuccess: () => {
|
|
9816
|
-
handleSuccess();
|
|
9817
|
-
},
|
|
9818
|
-
onError: (error) => {
|
|
9819
|
-
ui.toast.error(error.message);
|
|
9820
|
-
}
|
|
9821
|
-
}
|
|
9822
|
-
);
|
|
9823
|
-
});
|
|
9824
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9825
|
-
KeyboundForm,
|
|
9826
|
-
{
|
|
9827
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9828
|
-
onSubmit,
|
|
9829
|
-
children: [
|
|
9830
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9831
|
-
Form$2.Field,
|
|
9832
|
-
{
|
|
9833
|
-
control: form.control,
|
|
9834
|
-
name: "email",
|
|
9835
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9836
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9837
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9838
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9839
|
-
] })
|
|
9840
|
-
}
|
|
9841
|
-
) }),
|
|
9842
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9843
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9844
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9845
|
-
] }) })
|
|
9846
|
-
]
|
|
9847
|
-
}
|
|
9848
|
-
) });
|
|
9849
|
-
};
|
|
9850
|
-
const schema$3 = objectType({
|
|
9851
|
-
email: stringType().email()
|
|
9852
|
-
});
|
|
9852
|
+
const schema$3 = addressSchema;
|
|
9853
9853
|
const NumberInput = React.forwardRef(
|
|
9854
9854
|
({
|
|
9855
9855
|
value,
|
|
@@ -13063,10 +13063,6 @@ const routeModule = {
|
|
|
13063
13063
|
handle,
|
|
13064
13064
|
loader,
|
|
13065
13065
|
children: [
|
|
13066
|
-
{
|
|
13067
|
-
Component: BillingAddress,
|
|
13068
|
-
path: "/draft-orders/:id/billing-address"
|
|
13069
|
-
},
|
|
13070
13066
|
{
|
|
13071
13067
|
Component: CustomItems,
|
|
13072
13068
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13075,6 +13071,10 @@ const routeModule = {
|
|
|
13075
13071
|
Component: Email,
|
|
13076
13072
|
path: "/draft-orders/:id/email"
|
|
13077
13073
|
},
|
|
13074
|
+
{
|
|
13075
|
+
Component: BillingAddress,
|
|
13076
|
+
path: "/draft-orders/:id/billing-address"
|
|
13077
|
+
},
|
|
13078
13078
|
{
|
|
13079
13079
|
Component: Items,
|
|
13080
13080
|
path: "/draft-orders/:id/items"
|
|
@@ -9565,6 +9565,95 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
+
const CustomItems = () => {
|
|
9569
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9570
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9571
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9572
|
+
] });
|
|
9573
|
+
};
|
|
9574
|
+
const CustomItemsForm = () => {
|
|
9575
|
+
const form = useForm({
|
|
9576
|
+
resolver: zodResolver(schema$5)
|
|
9577
|
+
});
|
|
9578
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9579
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9580
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9581
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9582
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9583
|
+
] }) })
|
|
9584
|
+
] }) });
|
|
9585
|
+
};
|
|
9586
|
+
const schema$5 = objectType({
|
|
9587
|
+
email: stringType().email()
|
|
9588
|
+
});
|
|
9589
|
+
const Email = () => {
|
|
9590
|
+
const { id } = useParams();
|
|
9591
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9592
|
+
fields: "+email"
|
|
9593
|
+
});
|
|
9594
|
+
if (isError) {
|
|
9595
|
+
throw error;
|
|
9596
|
+
}
|
|
9597
|
+
const isReady = !isPending && !!order;
|
|
9598
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9599
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9600
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9601
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9602
|
+
] }),
|
|
9603
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9604
|
+
] });
|
|
9605
|
+
};
|
|
9606
|
+
const EmailForm = ({ order }) => {
|
|
9607
|
+
const form = useForm({
|
|
9608
|
+
defaultValues: {
|
|
9609
|
+
email: order.email ?? ""
|
|
9610
|
+
},
|
|
9611
|
+
resolver: zodResolver(schema$4)
|
|
9612
|
+
});
|
|
9613
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9614
|
+
const { handleSuccess } = useRouteModal();
|
|
9615
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9616
|
+
await mutateAsync(
|
|
9617
|
+
{ email: data.email },
|
|
9618
|
+
{
|
|
9619
|
+
onSuccess: () => {
|
|
9620
|
+
handleSuccess();
|
|
9621
|
+
},
|
|
9622
|
+
onError: (error) => {
|
|
9623
|
+
toast.error(error.message);
|
|
9624
|
+
}
|
|
9625
|
+
}
|
|
9626
|
+
);
|
|
9627
|
+
});
|
|
9628
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9629
|
+
KeyboundForm,
|
|
9630
|
+
{
|
|
9631
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9632
|
+
onSubmit,
|
|
9633
|
+
children: [
|
|
9634
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9635
|
+
Form$2.Field,
|
|
9636
|
+
{
|
|
9637
|
+
control: form.control,
|
|
9638
|
+
name: "email",
|
|
9639
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9640
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9641
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9642
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9643
|
+
] })
|
|
9644
|
+
}
|
|
9645
|
+
) }),
|
|
9646
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9647
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9648
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9649
|
+
] }) })
|
|
9650
|
+
]
|
|
9651
|
+
}
|
|
9652
|
+
) });
|
|
9653
|
+
};
|
|
9654
|
+
const schema$4 = objectType({
|
|
9655
|
+
email: stringType().email()
|
|
9656
|
+
});
|
|
9568
9657
|
const BillingAddress = () => {
|
|
9569
9658
|
const { id } = useParams();
|
|
9570
9659
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9597,7 +9686,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9597
9686
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
9687
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
9688
|
},
|
|
9600
|
-
resolver: zodResolver(schema$
|
|
9689
|
+
resolver: zodResolver(schema$3)
|
|
9601
9690
|
});
|
|
9602
9691
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9603
9692
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9754,96 +9843,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9754
9843
|
}
|
|
9755
9844
|
) });
|
|
9756
9845
|
};
|
|
9757
|
-
const schema$
|
|
9758
|
-
const CustomItems = () => {
|
|
9759
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9761
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9762
|
-
] });
|
|
9763
|
-
};
|
|
9764
|
-
const CustomItemsForm = () => {
|
|
9765
|
-
const form = useForm({
|
|
9766
|
-
resolver: zodResolver(schema$4)
|
|
9767
|
-
});
|
|
9768
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9769
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9770
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9772
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9773
|
-
] }) })
|
|
9774
|
-
] }) });
|
|
9775
|
-
};
|
|
9776
|
-
const schema$4 = objectType({
|
|
9777
|
-
email: stringType().email()
|
|
9778
|
-
});
|
|
9779
|
-
const Email = () => {
|
|
9780
|
-
const { id } = useParams();
|
|
9781
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9782
|
-
fields: "+email"
|
|
9783
|
-
});
|
|
9784
|
-
if (isError) {
|
|
9785
|
-
throw error;
|
|
9786
|
-
}
|
|
9787
|
-
const isReady = !isPending && !!order;
|
|
9788
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9789
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9790
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9791
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9792
|
-
] }),
|
|
9793
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9794
|
-
] });
|
|
9795
|
-
};
|
|
9796
|
-
const EmailForm = ({ order }) => {
|
|
9797
|
-
const form = useForm({
|
|
9798
|
-
defaultValues: {
|
|
9799
|
-
email: order.email ?? ""
|
|
9800
|
-
},
|
|
9801
|
-
resolver: zodResolver(schema$3)
|
|
9802
|
-
});
|
|
9803
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9804
|
-
const { handleSuccess } = useRouteModal();
|
|
9805
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9806
|
-
await mutateAsync(
|
|
9807
|
-
{ email: data.email },
|
|
9808
|
-
{
|
|
9809
|
-
onSuccess: () => {
|
|
9810
|
-
handleSuccess();
|
|
9811
|
-
},
|
|
9812
|
-
onError: (error) => {
|
|
9813
|
-
toast.error(error.message);
|
|
9814
|
-
}
|
|
9815
|
-
}
|
|
9816
|
-
);
|
|
9817
|
-
});
|
|
9818
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9819
|
-
KeyboundForm,
|
|
9820
|
-
{
|
|
9821
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9822
|
-
onSubmit,
|
|
9823
|
-
children: [
|
|
9824
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9825
|
-
Form$2.Field,
|
|
9826
|
-
{
|
|
9827
|
-
control: form.control,
|
|
9828
|
-
name: "email",
|
|
9829
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9830
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9831
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9832
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9833
|
-
] })
|
|
9834
|
-
}
|
|
9835
|
-
) }),
|
|
9836
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9837
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9838
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9839
|
-
] }) })
|
|
9840
|
-
]
|
|
9841
|
-
}
|
|
9842
|
-
) });
|
|
9843
|
-
};
|
|
9844
|
-
const schema$3 = objectType({
|
|
9845
|
-
email: stringType().email()
|
|
9846
|
-
});
|
|
9846
|
+
const schema$3 = addressSchema;
|
|
9847
9847
|
const NumberInput = forwardRef(
|
|
9848
9848
|
({
|
|
9849
9849
|
value,
|
|
@@ -13057,10 +13057,6 @@ const routeModule = {
|
|
|
13057
13057
|
handle,
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
|
-
{
|
|
13061
|
-
Component: BillingAddress,
|
|
13062
|
-
path: "/draft-orders/:id/billing-address"
|
|
13063
|
-
},
|
|
13064
13060
|
{
|
|
13065
13061
|
Component: CustomItems,
|
|
13066
13062
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13069,6 +13065,10 @@ const routeModule = {
|
|
|
13069
13065
|
Component: Email,
|
|
13070
13066
|
path: "/draft-orders/:id/email"
|
|
13071
13067
|
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: BillingAddress,
|
|
13070
|
+
path: "/draft-orders/:id/billing-address"
|
|
13071
|
+
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Items,
|
|
13074
13074
|
path: "/draft-orders/:id/items"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.0-preview-
|
|
3
|
+
"version": "2.11.0-preview-20251019120202",
|
|
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.11.0-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.0-preview-20251019120202",
|
|
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.11.0-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.0-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.0-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.0-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.0-preview-
|
|
53
|
-
"@medusajs/types": "2.11.0-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.0-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.0-preview-20251019120202",
|
|
49
|
+
"@medusajs/cli": "2.11.0-preview-20251019120202",
|
|
50
|
+
"@medusajs/framework": "2.11.0-preview-20251019120202",
|
|
51
|
+
"@medusajs/icons": "2.11.0-preview-20251019120202",
|
|
52
|
+
"@medusajs/test-utils": "2.11.0-preview-20251019120202",
|
|
53
|
+
"@medusajs/types": "2.11.0-preview-20251019120202",
|
|
54
|
+
"@medusajs/ui": "4.0.24-preview-20251019120202",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.0-preview-20251019120202",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.11.0-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.0-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.0-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.0-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.0-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.0-preview-20251019120202",
|
|
73
|
+
"@medusajs/cli": "2.11.0-preview-20251019120202",
|
|
74
|
+
"@medusajs/framework": "2.11.0-preview-20251019120202",
|
|
75
|
+
"@medusajs/icons": "2.11.0-preview-20251019120202",
|
|
76
|
+
"@medusajs/test-utils": "2.11.0-preview-20251019120202",
|
|
77
|
+
"@medusajs/ui": "4.0.24-preview-20251019120202",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|