@medusajs/draft-order 2.10.4-preview-20251009210155 → 2.10.4-preview-20251010031433
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 +97 -97
- package/.medusa/server/src/admin/index.mjs +97 -97
- package/package.json +16 -16
|
@@ -9573,6 +9573,27 @@ 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
|
+
});
|
|
9576
9597
|
const BillingAddress = () => {
|
|
9577
9598
|
const { id } = reactRouterDom.useParams();
|
|
9578
9599
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9605,7 +9626,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9605
9626
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9606
9627
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9607
9628
|
},
|
|
9608
|
-
resolver: zod.zodResolver(schema$
|
|
9629
|
+
resolver: zod.zodResolver(schema$4)
|
|
9609
9630
|
});
|
|
9610
9631
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9611
9632
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9762,96 +9783,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9783
|
}
|
|
9763
9784
|
) });
|
|
9764
9785
|
};
|
|
9765
|
-
const schema$
|
|
9766
|
-
const CustomItems = () => {
|
|
9767
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9768
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9769
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9770
|
-
] });
|
|
9771
|
-
};
|
|
9772
|
-
const CustomItemsForm = () => {
|
|
9773
|
-
const form = reactHookForm.useForm({
|
|
9774
|
-
resolver: zod.zodResolver(schema$4)
|
|
9775
|
-
});
|
|
9776
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9779
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9780
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9781
|
-
] }) })
|
|
9782
|
-
] }) });
|
|
9783
|
-
};
|
|
9784
|
-
const schema$4 = objectType({
|
|
9785
|
-
email: stringType().email()
|
|
9786
|
-
});
|
|
9787
|
-
const Email = () => {
|
|
9788
|
-
const { id } = reactRouterDom.useParams();
|
|
9789
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9790
|
-
fields: "+email"
|
|
9791
|
-
});
|
|
9792
|
-
if (isError) {
|
|
9793
|
-
throw error;
|
|
9794
|
-
}
|
|
9795
|
-
const isReady = !isPending && !!order;
|
|
9796
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9797
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9798
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9799
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9800
|
-
] }),
|
|
9801
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9802
|
-
] });
|
|
9803
|
-
};
|
|
9804
|
-
const EmailForm = ({ order }) => {
|
|
9805
|
-
const form = reactHookForm.useForm({
|
|
9806
|
-
defaultValues: {
|
|
9807
|
-
email: order.email ?? ""
|
|
9808
|
-
},
|
|
9809
|
-
resolver: zod.zodResolver(schema$3)
|
|
9810
|
-
});
|
|
9811
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9812
|
-
const { handleSuccess } = useRouteModal();
|
|
9813
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9814
|
-
await mutateAsync(
|
|
9815
|
-
{ email: data.email },
|
|
9816
|
-
{
|
|
9817
|
-
onSuccess: () => {
|
|
9818
|
-
handleSuccess();
|
|
9819
|
-
},
|
|
9820
|
-
onError: (error) => {
|
|
9821
|
-
ui.toast.error(error.message);
|
|
9822
|
-
}
|
|
9823
|
-
}
|
|
9824
|
-
);
|
|
9825
|
-
});
|
|
9826
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9827
|
-
KeyboundForm,
|
|
9828
|
-
{
|
|
9829
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9830
|
-
onSubmit,
|
|
9831
|
-
children: [
|
|
9832
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9833
|
-
Form$2.Field,
|
|
9834
|
-
{
|
|
9835
|
-
control: form.control,
|
|
9836
|
-
name: "email",
|
|
9837
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9838
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9839
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9840
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9841
|
-
] })
|
|
9842
|
-
}
|
|
9843
|
-
) }),
|
|
9844
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9845
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9846
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9847
|
-
] }) })
|
|
9848
|
-
]
|
|
9849
|
-
}
|
|
9850
|
-
) });
|
|
9851
|
-
};
|
|
9852
|
-
const schema$3 = objectType({
|
|
9853
|
-
email: stringType().email()
|
|
9854
|
-
});
|
|
9786
|
+
const schema$4 = addressSchema;
|
|
9855
9787
|
const NumberInput = React.forwardRef(
|
|
9856
9788
|
({
|
|
9857
9789
|
value,
|
|
@@ -10826,6 +10758,74 @@ const customItemSchema = objectType({
|
|
|
10826
10758
|
quantity: numberType(),
|
|
10827
10759
|
unit_price: unionType([numberType(), stringType()])
|
|
10828
10760
|
});
|
|
10761
|
+
const Email = () => {
|
|
10762
|
+
const { id } = reactRouterDom.useParams();
|
|
10763
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10764
|
+
fields: "+email"
|
|
10765
|
+
});
|
|
10766
|
+
if (isError) {
|
|
10767
|
+
throw error;
|
|
10768
|
+
}
|
|
10769
|
+
const isReady = !isPending && !!order;
|
|
10770
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10771
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10772
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10773
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10774
|
+
] }),
|
|
10775
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10776
|
+
] });
|
|
10777
|
+
};
|
|
10778
|
+
const EmailForm = ({ order }) => {
|
|
10779
|
+
const form = reactHookForm.useForm({
|
|
10780
|
+
defaultValues: {
|
|
10781
|
+
email: order.email ?? ""
|
|
10782
|
+
},
|
|
10783
|
+
resolver: zod.zodResolver(schema$3)
|
|
10784
|
+
});
|
|
10785
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10786
|
+
const { handleSuccess } = useRouteModal();
|
|
10787
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10788
|
+
await mutateAsync(
|
|
10789
|
+
{ email: data.email },
|
|
10790
|
+
{
|
|
10791
|
+
onSuccess: () => {
|
|
10792
|
+
handleSuccess();
|
|
10793
|
+
},
|
|
10794
|
+
onError: (error) => {
|
|
10795
|
+
ui.toast.error(error.message);
|
|
10796
|
+
}
|
|
10797
|
+
}
|
|
10798
|
+
);
|
|
10799
|
+
});
|
|
10800
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10801
|
+
KeyboundForm,
|
|
10802
|
+
{
|
|
10803
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10804
|
+
onSubmit,
|
|
10805
|
+
children: [
|
|
10806
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10807
|
+
Form$2.Field,
|
|
10808
|
+
{
|
|
10809
|
+
control: form.control,
|
|
10810
|
+
name: "email",
|
|
10811
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10812
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10813
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10814
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10815
|
+
] })
|
|
10816
|
+
}
|
|
10817
|
+
) }),
|
|
10818
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10819
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10820
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10821
|
+
] }) })
|
|
10822
|
+
]
|
|
10823
|
+
}
|
|
10824
|
+
) });
|
|
10825
|
+
};
|
|
10826
|
+
const schema$3 = objectType({
|
|
10827
|
+
email: stringType().email()
|
|
10828
|
+
});
|
|
10829
10829
|
const InlineTip = React.forwardRef(
|
|
10830
10830
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10831
10831
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13065,22 +13065,22 @@ const routeModule = {
|
|
|
13065
13065
|
handle,
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
|
-
{
|
|
13069
|
-
Component: BillingAddress,
|
|
13070
|
-
path: "/draft-orders/:id/billing-address"
|
|
13071
|
-
},
|
|
13072
13068
|
{
|
|
13073
13069
|
Component: CustomItems,
|
|
13074
13070
|
path: "/draft-orders/:id/custom-items"
|
|
13075
13071
|
},
|
|
13076
13072
|
{
|
|
13077
|
-
Component:
|
|
13078
|
-
path: "/draft-orders/:id/
|
|
13073
|
+
Component: BillingAddress,
|
|
13074
|
+
path: "/draft-orders/:id/billing-address"
|
|
13079
13075
|
},
|
|
13080
13076
|
{
|
|
13081
13077
|
Component: Items,
|
|
13082
13078
|
path: "/draft-orders/:id/items"
|
|
13083
13079
|
},
|
|
13080
|
+
{
|
|
13081
|
+
Component: Email,
|
|
13082
|
+
path: "/draft-orders/:id/email"
|
|
13083
|
+
},
|
|
13084
13084
|
{
|
|
13085
13085
|
Component: Metadata,
|
|
13086
13086
|
path: "/draft-orders/:id/metadata"
|
|
@@ -9567,6 +9567,27 @@ 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
|
+
});
|
|
9570
9591
|
const BillingAddress = () => {
|
|
9571
9592
|
const { id } = useParams();
|
|
9572
9593
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9599,7 +9620,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9599
9620
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9600
9621
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9601
9622
|
},
|
|
9602
|
-
resolver: zodResolver(schema$
|
|
9623
|
+
resolver: zodResolver(schema$4)
|
|
9603
9624
|
});
|
|
9604
9625
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9605
9626
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9756,96 +9777,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9756
9777
|
}
|
|
9757
9778
|
) });
|
|
9758
9779
|
};
|
|
9759
|
-
const schema$
|
|
9760
|
-
const CustomItems = () => {
|
|
9761
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9762
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9763
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9764
|
-
] });
|
|
9765
|
-
};
|
|
9766
|
-
const CustomItemsForm = () => {
|
|
9767
|
-
const form = useForm({
|
|
9768
|
-
resolver: zodResolver(schema$4)
|
|
9769
|
-
});
|
|
9770
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9772
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9773
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9774
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9775
|
-
] }) })
|
|
9776
|
-
] }) });
|
|
9777
|
-
};
|
|
9778
|
-
const schema$4 = objectType({
|
|
9779
|
-
email: stringType().email()
|
|
9780
|
-
});
|
|
9781
|
-
const Email = () => {
|
|
9782
|
-
const { id } = useParams();
|
|
9783
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9784
|
-
fields: "+email"
|
|
9785
|
-
});
|
|
9786
|
-
if (isError) {
|
|
9787
|
-
throw error;
|
|
9788
|
-
}
|
|
9789
|
-
const isReady = !isPending && !!order;
|
|
9790
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9791
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9792
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9793
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9794
|
-
] }),
|
|
9795
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9796
|
-
] });
|
|
9797
|
-
};
|
|
9798
|
-
const EmailForm = ({ order }) => {
|
|
9799
|
-
const form = useForm({
|
|
9800
|
-
defaultValues: {
|
|
9801
|
-
email: order.email ?? ""
|
|
9802
|
-
},
|
|
9803
|
-
resolver: zodResolver(schema$3)
|
|
9804
|
-
});
|
|
9805
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9806
|
-
const { handleSuccess } = useRouteModal();
|
|
9807
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9808
|
-
await mutateAsync(
|
|
9809
|
-
{ email: data.email },
|
|
9810
|
-
{
|
|
9811
|
-
onSuccess: () => {
|
|
9812
|
-
handleSuccess();
|
|
9813
|
-
},
|
|
9814
|
-
onError: (error) => {
|
|
9815
|
-
toast.error(error.message);
|
|
9816
|
-
}
|
|
9817
|
-
}
|
|
9818
|
-
);
|
|
9819
|
-
});
|
|
9820
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9821
|
-
KeyboundForm,
|
|
9822
|
-
{
|
|
9823
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9824
|
-
onSubmit,
|
|
9825
|
-
children: [
|
|
9826
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9827
|
-
Form$2.Field,
|
|
9828
|
-
{
|
|
9829
|
-
control: form.control,
|
|
9830
|
-
name: "email",
|
|
9831
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9832
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9833
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9834
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9835
|
-
] })
|
|
9836
|
-
}
|
|
9837
|
-
) }),
|
|
9838
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9841
|
-
] }) })
|
|
9842
|
-
]
|
|
9843
|
-
}
|
|
9844
|
-
) });
|
|
9845
|
-
};
|
|
9846
|
-
const schema$3 = objectType({
|
|
9847
|
-
email: stringType().email()
|
|
9848
|
-
});
|
|
9780
|
+
const schema$4 = addressSchema;
|
|
9849
9781
|
const NumberInput = forwardRef(
|
|
9850
9782
|
({
|
|
9851
9783
|
value,
|
|
@@ -10820,6 +10752,74 @@ const customItemSchema = objectType({
|
|
|
10820
10752
|
quantity: numberType(),
|
|
10821
10753
|
unit_price: unionType([numberType(), stringType()])
|
|
10822
10754
|
});
|
|
10755
|
+
const Email = () => {
|
|
10756
|
+
const { id } = useParams();
|
|
10757
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10758
|
+
fields: "+email"
|
|
10759
|
+
});
|
|
10760
|
+
if (isError) {
|
|
10761
|
+
throw error;
|
|
10762
|
+
}
|
|
10763
|
+
const isReady = !isPending && !!order;
|
|
10764
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10765
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10766
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10767
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10768
|
+
] }),
|
|
10769
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10770
|
+
] });
|
|
10771
|
+
};
|
|
10772
|
+
const EmailForm = ({ order }) => {
|
|
10773
|
+
const form = useForm({
|
|
10774
|
+
defaultValues: {
|
|
10775
|
+
email: order.email ?? ""
|
|
10776
|
+
},
|
|
10777
|
+
resolver: zodResolver(schema$3)
|
|
10778
|
+
});
|
|
10779
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10780
|
+
const { handleSuccess } = useRouteModal();
|
|
10781
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10782
|
+
await mutateAsync(
|
|
10783
|
+
{ email: data.email },
|
|
10784
|
+
{
|
|
10785
|
+
onSuccess: () => {
|
|
10786
|
+
handleSuccess();
|
|
10787
|
+
},
|
|
10788
|
+
onError: (error) => {
|
|
10789
|
+
toast.error(error.message);
|
|
10790
|
+
}
|
|
10791
|
+
}
|
|
10792
|
+
);
|
|
10793
|
+
});
|
|
10794
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10795
|
+
KeyboundForm,
|
|
10796
|
+
{
|
|
10797
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10798
|
+
onSubmit,
|
|
10799
|
+
children: [
|
|
10800
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10801
|
+
Form$2.Field,
|
|
10802
|
+
{
|
|
10803
|
+
control: form.control,
|
|
10804
|
+
name: "email",
|
|
10805
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10806
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10807
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10808
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10809
|
+
] })
|
|
10810
|
+
}
|
|
10811
|
+
) }),
|
|
10812
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10813
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10814
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10815
|
+
] }) })
|
|
10816
|
+
]
|
|
10817
|
+
}
|
|
10818
|
+
) });
|
|
10819
|
+
};
|
|
10820
|
+
const schema$3 = objectType({
|
|
10821
|
+
email: stringType().email()
|
|
10822
|
+
});
|
|
10823
10823
|
const InlineTip = forwardRef(
|
|
10824
10824
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10825
10825
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13059,22 +13059,22 @@ const routeModule = {
|
|
|
13059
13059
|
handle,
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
|
-
{
|
|
13063
|
-
Component: BillingAddress,
|
|
13064
|
-
path: "/draft-orders/:id/billing-address"
|
|
13065
|
-
},
|
|
13066
13062
|
{
|
|
13067
13063
|
Component: CustomItems,
|
|
13068
13064
|
path: "/draft-orders/:id/custom-items"
|
|
13069
13065
|
},
|
|
13070
13066
|
{
|
|
13071
|
-
Component:
|
|
13072
|
-
path: "/draft-orders/:id/
|
|
13067
|
+
Component: BillingAddress,
|
|
13068
|
+
path: "/draft-orders/:id/billing-address"
|
|
13073
13069
|
},
|
|
13074
13070
|
{
|
|
13075
13071
|
Component: Items,
|
|
13076
13072
|
path: "/draft-orders/:id/items"
|
|
13077
13073
|
},
|
|
13074
|
+
{
|
|
13075
|
+
Component: Email,
|
|
13076
|
+
path: "/draft-orders/:id/email"
|
|
13077
|
+
},
|
|
13078
13078
|
{
|
|
13079
13079
|
Component: Metadata,
|
|
13080
13080
|
path: "/draft-orders/:id/metadata"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.4-preview-
|
|
3
|
+
"version": "2.10.4-preview-20251010031433",
|
|
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.4-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.4-preview-20251010031433",
|
|
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.4-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
53
|
-
"@medusajs/types": "2.10.4-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.4-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20251010031433",
|
|
49
|
+
"@medusajs/cli": "2.10.4-preview-20251010031433",
|
|
50
|
+
"@medusajs/framework": "2.10.4-preview-20251010031433",
|
|
51
|
+
"@medusajs/icons": "2.10.4-preview-20251010031433",
|
|
52
|
+
"@medusajs/test-utils": "2.10.4-preview-20251010031433",
|
|
53
|
+
"@medusajs/types": "2.10.4-preview-20251010031433",
|
|
54
|
+
"@medusajs/ui": "4.0.24-preview-20251010031433",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.4-preview-20251010031433",
|
|
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.10.4-preview-
|
|
73
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
74
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
75
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20251010031433",
|
|
73
|
+
"@medusajs/cli": "2.10.4-preview-20251010031433",
|
|
74
|
+
"@medusajs/framework": "2.10.4-preview-20251010031433",
|
|
75
|
+
"@medusajs/icons": "2.10.4-preview-20251010031433",
|
|
76
|
+
"@medusajs/test-utils": "2.10.4-preview-20251010031433",
|
|
77
|
+
"@medusajs/ui": "4.0.24-preview-20251010031433",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|