@medusajs/draft-order 3.0.0-snapshot-20251104011621 → 3.0.0-snapshot-20251106143524
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 -94
- package/.medusa/server/src/admin/index.mjs +95 -94
- package/package.json +16 -16
|
@@ -9758,6 +9758,95 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9758
9758
|
) });
|
|
9759
9759
|
};
|
|
9760
9760
|
const schema$5 = addressSchema;
|
|
9761
|
+
const Email = () => {
|
|
9762
|
+
const { id } = reactRouterDom.useParams();
|
|
9763
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9764
|
+
fields: "+email"
|
|
9765
|
+
});
|
|
9766
|
+
if (isError) {
|
|
9767
|
+
throw error;
|
|
9768
|
+
}
|
|
9769
|
+
const isReady = !isPending && !!order;
|
|
9770
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9771
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9772
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9773
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9774
|
+
] }),
|
|
9775
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9776
|
+
] });
|
|
9777
|
+
};
|
|
9778
|
+
const EmailForm = ({ order }) => {
|
|
9779
|
+
const form = reactHookForm.useForm({
|
|
9780
|
+
defaultValues: {
|
|
9781
|
+
email: order.email ?? ""
|
|
9782
|
+
},
|
|
9783
|
+
resolver: zod.zodResolver(schema$4)
|
|
9784
|
+
});
|
|
9785
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9786
|
+
const { handleSuccess } = useRouteModal();
|
|
9787
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9788
|
+
await mutateAsync(
|
|
9789
|
+
{ email: data.email },
|
|
9790
|
+
{
|
|
9791
|
+
onSuccess: () => {
|
|
9792
|
+
handleSuccess();
|
|
9793
|
+
},
|
|
9794
|
+
onError: (error) => {
|
|
9795
|
+
ui.toast.error(error.message);
|
|
9796
|
+
}
|
|
9797
|
+
}
|
|
9798
|
+
);
|
|
9799
|
+
});
|
|
9800
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9801
|
+
KeyboundForm,
|
|
9802
|
+
{
|
|
9803
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9804
|
+
onSubmit,
|
|
9805
|
+
children: [
|
|
9806
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9807
|
+
Form$2.Field,
|
|
9808
|
+
{
|
|
9809
|
+
control: form.control,
|
|
9810
|
+
name: "email",
|
|
9811
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9812
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9813
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9814
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9815
|
+
] })
|
|
9816
|
+
}
|
|
9817
|
+
) }),
|
|
9818
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9819
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9820
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9821
|
+
] }) })
|
|
9822
|
+
]
|
|
9823
|
+
}
|
|
9824
|
+
) });
|
|
9825
|
+
};
|
|
9826
|
+
const schema$4 = objectType({
|
|
9827
|
+
email: stringType().email()
|
|
9828
|
+
});
|
|
9829
|
+
const CustomItems = () => {
|
|
9830
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9831
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9832
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9833
|
+
] });
|
|
9834
|
+
};
|
|
9835
|
+
const CustomItemsForm = () => {
|
|
9836
|
+
const form = reactHookForm.useForm({
|
|
9837
|
+
resolver: zod.zodResolver(schema$3)
|
|
9838
|
+
});
|
|
9839
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9840
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9841
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9842
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9843
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9844
|
+
] }) })
|
|
9845
|
+
] }) });
|
|
9846
|
+
};
|
|
9847
|
+
const schema$3 = objectType({
|
|
9848
|
+
email: stringType().email()
|
|
9849
|
+
});
|
|
9761
9850
|
const NumberInput = React.forwardRef(
|
|
9762
9851
|
({
|
|
9763
9852
|
value,
|
|
@@ -10732,95 +10821,6 @@ const customItemSchema = objectType({
|
|
|
10732
10821
|
quantity: numberType(),
|
|
10733
10822
|
unit_price: unionType([numberType(), stringType()])
|
|
10734
10823
|
});
|
|
10735
|
-
const CustomItems = () => {
|
|
10736
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10737
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
10738
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
10739
|
-
] });
|
|
10740
|
-
};
|
|
10741
|
-
const CustomItemsForm = () => {
|
|
10742
|
-
const form = reactHookForm.useForm({
|
|
10743
|
-
resolver: zod.zodResolver(schema$4)
|
|
10744
|
-
});
|
|
10745
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10746
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
10747
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10748
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10749
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
10750
|
-
] }) })
|
|
10751
|
-
] }) });
|
|
10752
|
-
};
|
|
10753
|
-
const schema$4 = objectType({
|
|
10754
|
-
email: stringType().email()
|
|
10755
|
-
});
|
|
10756
|
-
const Email = () => {
|
|
10757
|
-
const { id } = reactRouterDom.useParams();
|
|
10758
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10759
|
-
fields: "+email"
|
|
10760
|
-
});
|
|
10761
|
-
if (isError) {
|
|
10762
|
-
throw error;
|
|
10763
|
-
}
|
|
10764
|
-
const isReady = !isPending && !!order;
|
|
10765
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10766
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10767
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10768
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10769
|
-
] }),
|
|
10770
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10771
|
-
] });
|
|
10772
|
-
};
|
|
10773
|
-
const EmailForm = ({ order }) => {
|
|
10774
|
-
const form = reactHookForm.useForm({
|
|
10775
|
-
defaultValues: {
|
|
10776
|
-
email: order.email ?? ""
|
|
10777
|
-
},
|
|
10778
|
-
resolver: zod.zodResolver(schema$3)
|
|
10779
|
-
});
|
|
10780
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10781
|
-
const { handleSuccess } = useRouteModal();
|
|
10782
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10783
|
-
await mutateAsync(
|
|
10784
|
-
{ email: data.email },
|
|
10785
|
-
{
|
|
10786
|
-
onSuccess: () => {
|
|
10787
|
-
handleSuccess();
|
|
10788
|
-
},
|
|
10789
|
-
onError: (error) => {
|
|
10790
|
-
ui.toast.error(error.message);
|
|
10791
|
-
}
|
|
10792
|
-
}
|
|
10793
|
-
);
|
|
10794
|
-
});
|
|
10795
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10796
|
-
KeyboundForm,
|
|
10797
|
-
{
|
|
10798
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10799
|
-
onSubmit,
|
|
10800
|
-
children: [
|
|
10801
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10802
|
-
Form$2.Field,
|
|
10803
|
-
{
|
|
10804
|
-
control: form.control,
|
|
10805
|
-
name: "email",
|
|
10806
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10807
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10808
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10809
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10810
|
-
] })
|
|
10811
|
-
}
|
|
10812
|
-
) }),
|
|
10813
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10814
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10815
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10816
|
-
] }) })
|
|
10817
|
-
]
|
|
10818
|
-
}
|
|
10819
|
-
) });
|
|
10820
|
-
};
|
|
10821
|
-
const schema$3 = objectType({
|
|
10822
|
-
email: stringType().email()
|
|
10823
|
-
});
|
|
10824
10824
|
const InlineTip = React.forwardRef(
|
|
10825
10825
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10826
10826
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13065,16 +13065,16 @@ const routeModule = {
|
|
|
13065
13065
|
path: "/draft-orders/:id/billing-address"
|
|
13066
13066
|
},
|
|
13067
13067
|
{
|
|
13068
|
-
Component:
|
|
13069
|
-
path: "/draft-orders/:id/
|
|
13068
|
+
Component: Email,
|
|
13069
|
+
path: "/draft-orders/:id/email"
|
|
13070
13070
|
},
|
|
13071
13071
|
{
|
|
13072
13072
|
Component: CustomItems,
|
|
13073
13073
|
path: "/draft-orders/:id/custom-items"
|
|
13074
13074
|
},
|
|
13075
13075
|
{
|
|
13076
|
-
Component:
|
|
13077
|
-
path: "/draft-orders/:id/
|
|
13076
|
+
Component: Items,
|
|
13077
|
+
path: "/draft-orders/:id/items"
|
|
13078
13078
|
},
|
|
13079
13079
|
{
|
|
13080
13080
|
Component: Metadata,
|
|
@@ -13110,7 +13110,8 @@ const menuItemModule = {
|
|
|
13110
13110
|
label: config.label,
|
|
13111
13111
|
icon: void 0,
|
|
13112
13112
|
path: "/draft-orders",
|
|
13113
|
-
nested: "/orders"
|
|
13113
|
+
nested: "/orders",
|
|
13114
|
+
translationNs: void 0
|
|
13114
13115
|
}
|
|
13115
13116
|
]
|
|
13116
13117
|
};
|
|
@@ -9751,6 +9751,95 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9751
9751
|
) });
|
|
9752
9752
|
};
|
|
9753
9753
|
const schema$5 = addressSchema;
|
|
9754
|
+
const Email = () => {
|
|
9755
|
+
const { id } = useParams();
|
|
9756
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9757
|
+
fields: "+email"
|
|
9758
|
+
});
|
|
9759
|
+
if (isError) {
|
|
9760
|
+
throw error;
|
|
9761
|
+
}
|
|
9762
|
+
const isReady = !isPending && !!order;
|
|
9763
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9764
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9765
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9766
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9767
|
+
] }),
|
|
9768
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9769
|
+
] });
|
|
9770
|
+
};
|
|
9771
|
+
const EmailForm = ({ order }) => {
|
|
9772
|
+
const form = useForm({
|
|
9773
|
+
defaultValues: {
|
|
9774
|
+
email: order.email ?? ""
|
|
9775
|
+
},
|
|
9776
|
+
resolver: zodResolver(schema$4)
|
|
9777
|
+
});
|
|
9778
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9779
|
+
const { handleSuccess } = useRouteModal();
|
|
9780
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9781
|
+
await mutateAsync(
|
|
9782
|
+
{ email: data.email },
|
|
9783
|
+
{
|
|
9784
|
+
onSuccess: () => {
|
|
9785
|
+
handleSuccess();
|
|
9786
|
+
},
|
|
9787
|
+
onError: (error) => {
|
|
9788
|
+
toast.error(error.message);
|
|
9789
|
+
}
|
|
9790
|
+
}
|
|
9791
|
+
);
|
|
9792
|
+
});
|
|
9793
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9794
|
+
KeyboundForm,
|
|
9795
|
+
{
|
|
9796
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9797
|
+
onSubmit,
|
|
9798
|
+
children: [
|
|
9799
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9800
|
+
Form$2.Field,
|
|
9801
|
+
{
|
|
9802
|
+
control: form.control,
|
|
9803
|
+
name: "email",
|
|
9804
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9805
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9806
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9807
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9808
|
+
] })
|
|
9809
|
+
}
|
|
9810
|
+
) }),
|
|
9811
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9812
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9813
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9814
|
+
] }) })
|
|
9815
|
+
]
|
|
9816
|
+
}
|
|
9817
|
+
) });
|
|
9818
|
+
};
|
|
9819
|
+
const schema$4 = objectType({
|
|
9820
|
+
email: stringType().email()
|
|
9821
|
+
});
|
|
9822
|
+
const CustomItems = () => {
|
|
9823
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9824
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9825
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9826
|
+
] });
|
|
9827
|
+
};
|
|
9828
|
+
const CustomItemsForm = () => {
|
|
9829
|
+
const form = useForm({
|
|
9830
|
+
resolver: zodResolver(schema$3)
|
|
9831
|
+
});
|
|
9832
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9833
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9834
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9835
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9836
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9837
|
+
] }) })
|
|
9838
|
+
] }) });
|
|
9839
|
+
};
|
|
9840
|
+
const schema$3 = objectType({
|
|
9841
|
+
email: stringType().email()
|
|
9842
|
+
});
|
|
9754
9843
|
const NumberInput = forwardRef(
|
|
9755
9844
|
({
|
|
9756
9845
|
value,
|
|
@@ -10725,95 +10814,6 @@ const customItemSchema = objectType({
|
|
|
10725
10814
|
quantity: numberType(),
|
|
10726
10815
|
unit_price: unionType([numberType(), stringType()])
|
|
10727
10816
|
});
|
|
10728
|
-
const CustomItems = () => {
|
|
10729
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10730
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
10731
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
10732
|
-
] });
|
|
10733
|
-
};
|
|
10734
|
-
const CustomItemsForm = () => {
|
|
10735
|
-
const form = useForm({
|
|
10736
|
-
resolver: zodResolver(schema$4)
|
|
10737
|
-
});
|
|
10738
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10739
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
10740
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10741
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10742
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
10743
|
-
] }) })
|
|
10744
|
-
] }) });
|
|
10745
|
-
};
|
|
10746
|
-
const schema$4 = objectType({
|
|
10747
|
-
email: stringType().email()
|
|
10748
|
-
});
|
|
10749
|
-
const Email = () => {
|
|
10750
|
-
const { id } = useParams();
|
|
10751
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10752
|
-
fields: "+email"
|
|
10753
|
-
});
|
|
10754
|
-
if (isError) {
|
|
10755
|
-
throw error;
|
|
10756
|
-
}
|
|
10757
|
-
const isReady = !isPending && !!order;
|
|
10758
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10759
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10760
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10761
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10762
|
-
] }),
|
|
10763
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10764
|
-
] });
|
|
10765
|
-
};
|
|
10766
|
-
const EmailForm = ({ order }) => {
|
|
10767
|
-
const form = useForm({
|
|
10768
|
-
defaultValues: {
|
|
10769
|
-
email: order.email ?? ""
|
|
10770
|
-
},
|
|
10771
|
-
resolver: zodResolver(schema$3)
|
|
10772
|
-
});
|
|
10773
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10774
|
-
const { handleSuccess } = useRouteModal();
|
|
10775
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10776
|
-
await mutateAsync(
|
|
10777
|
-
{ email: data.email },
|
|
10778
|
-
{
|
|
10779
|
-
onSuccess: () => {
|
|
10780
|
-
handleSuccess();
|
|
10781
|
-
},
|
|
10782
|
-
onError: (error) => {
|
|
10783
|
-
toast.error(error.message);
|
|
10784
|
-
}
|
|
10785
|
-
}
|
|
10786
|
-
);
|
|
10787
|
-
});
|
|
10788
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10789
|
-
KeyboundForm,
|
|
10790
|
-
{
|
|
10791
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10792
|
-
onSubmit,
|
|
10793
|
-
children: [
|
|
10794
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10795
|
-
Form$2.Field,
|
|
10796
|
-
{
|
|
10797
|
-
control: form.control,
|
|
10798
|
-
name: "email",
|
|
10799
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10800
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10801
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10802
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10803
|
-
] })
|
|
10804
|
-
}
|
|
10805
|
-
) }),
|
|
10806
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10807
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10808
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10809
|
-
] }) })
|
|
10810
|
-
]
|
|
10811
|
-
}
|
|
10812
|
-
) });
|
|
10813
|
-
};
|
|
10814
|
-
const schema$3 = objectType({
|
|
10815
|
-
email: stringType().email()
|
|
10816
|
-
});
|
|
10817
10817
|
const InlineTip = forwardRef(
|
|
10818
10818
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10819
10819
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13058,16 +13058,16 @@ const routeModule = {
|
|
|
13058
13058
|
path: "/draft-orders/:id/billing-address"
|
|
13059
13059
|
},
|
|
13060
13060
|
{
|
|
13061
|
-
Component:
|
|
13062
|
-
path: "/draft-orders/:id/
|
|
13061
|
+
Component: Email,
|
|
13062
|
+
path: "/draft-orders/:id/email"
|
|
13063
13063
|
},
|
|
13064
13064
|
{
|
|
13065
13065
|
Component: CustomItems,
|
|
13066
13066
|
path: "/draft-orders/:id/custom-items"
|
|
13067
13067
|
},
|
|
13068
13068
|
{
|
|
13069
|
-
Component:
|
|
13070
|
-
path: "/draft-orders/:id/
|
|
13069
|
+
Component: Items,
|
|
13070
|
+
path: "/draft-orders/:id/items"
|
|
13071
13071
|
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Metadata,
|
|
@@ -13103,7 +13103,8 @@ const menuItemModule = {
|
|
|
13103
13103
|
label: config.label,
|
|
13104
13104
|
icon: void 0,
|
|
13105
13105
|
path: "/draft-orders",
|
|
13106
|
-
nested: "/orders"
|
|
13106
|
+
nested: "/orders",
|
|
13107
|
+
translationNs: void 0
|
|
13107
13108
|
}
|
|
13108
13109
|
]
|
|
13109
13110
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "3.0.0-snapshot-
|
|
3
|
+
"version": "3.0.0-snapshot-20251106143524",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@babel/runtime": "^7.26.10",
|
|
39
39
|
"@hookform/resolvers": "3.4.2",
|
|
40
|
-
"@medusajs/js-sdk": "3.0.0-snapshot-
|
|
40
|
+
"@medusajs/js-sdk": "3.0.0-snapshot-20251106143524",
|
|
41
41
|
"@tanstack/react-query": "5.64.2",
|
|
42
42
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
43
43
|
"date-fns": "^3.6.0",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "3.0.0-snapshot-
|
|
52
|
-
"@medusajs/cli": "3.0.0-snapshot-
|
|
53
|
-
"@medusajs/framework": "3.0.0-snapshot-
|
|
54
|
-
"@medusajs/icons": "3.0.0-snapshot-
|
|
55
|
-
"@medusajs/test-utils": "3.0.0-snapshot-
|
|
56
|
-
"@medusajs/types": "3.0.0-snapshot-
|
|
57
|
-
"@medusajs/ui": "4.0.
|
|
58
|
-
"@medusajs/ui-preset": "3.0.0-snapshot-
|
|
51
|
+
"@medusajs/admin-sdk": "3.0.0-snapshot-20251106143524",
|
|
52
|
+
"@medusajs/cli": "3.0.0-snapshot-20251106143524",
|
|
53
|
+
"@medusajs/framework": "3.0.0-snapshot-20251106143524",
|
|
54
|
+
"@medusajs/icons": "3.0.0-snapshot-20251106143524",
|
|
55
|
+
"@medusajs/test-utils": "3.0.0-snapshot-20251106143524",
|
|
56
|
+
"@medusajs/types": "3.0.0-snapshot-20251106143524",
|
|
57
|
+
"@medusajs/ui": "4.0.28-snapshot-20251106143524",
|
|
58
|
+
"@medusajs/ui-preset": "3.0.0-snapshot-20251106143524"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "3.0.0-snapshot-
|
|
62
|
-
"@medusajs/cli": "3.0.0-snapshot-
|
|
63
|
-
"@medusajs/framework": "3.0.0-snapshot-
|
|
64
|
-
"@medusajs/icons": "3.0.0-snapshot-
|
|
65
|
-
"@medusajs/test-utils": "3.0.0-snapshot-
|
|
66
|
-
"@medusajs/ui": "4.0.
|
|
61
|
+
"@medusajs/admin-sdk": "3.0.0-snapshot-20251106143524",
|
|
62
|
+
"@medusajs/cli": "3.0.0-snapshot-20251106143524",
|
|
63
|
+
"@medusajs/framework": "3.0.0-snapshot-20251106143524",
|
|
64
|
+
"@medusajs/icons": "3.0.0-snapshot-20251106143524",
|
|
65
|
+
"@medusajs/test-utils": "3.0.0-snapshot-20251106143524",
|
|
66
|
+
"@medusajs/ui": "4.0.28-snapshot-20251106143524",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|