@medusajs/draft-order 2.11.4-snapshot-20251106122834 → 2.11.4-snapshot-20251106130942
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 +99 -98
- package/.medusa/server/src/admin/index.mjs +99 -98
- package/package.json +16 -16
|
@@ -9568,6 +9568,27 @@ const ID = () => {
|
|
|
9568
9568
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9569
9569
|
] });
|
|
9570
9570
|
};
|
|
9571
|
+
const CustomItems = () => {
|
|
9572
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9573
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9574
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9575
|
+
] });
|
|
9576
|
+
};
|
|
9577
|
+
const CustomItemsForm = () => {
|
|
9578
|
+
const form = reactHookForm.useForm({
|
|
9579
|
+
resolver: zod.zodResolver(schema$5)
|
|
9580
|
+
});
|
|
9581
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9582
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9583
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9584
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9585
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9586
|
+
] }) })
|
|
9587
|
+
] }) });
|
|
9588
|
+
};
|
|
9589
|
+
const schema$5 = objectType({
|
|
9590
|
+
email: stringType().email()
|
|
9591
|
+
});
|
|
9571
9592
|
const BillingAddress = () => {
|
|
9572
9593
|
const { id } = reactRouterDom.useParams();
|
|
9573
9594
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9600,7 +9621,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9600
9621
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9601
9622
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9602
9623
|
},
|
|
9603
|
-
resolver: zod.zodResolver(schema$
|
|
9624
|
+
resolver: zod.zodResolver(schema$4)
|
|
9604
9625
|
});
|
|
9605
9626
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9606
9627
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9757,96 +9778,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9757
9778
|
}
|
|
9758
9779
|
) });
|
|
9759
9780
|
};
|
|
9760
|
-
const schema$
|
|
9761
|
-
const CustomItems = () => {
|
|
9762
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9763
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9764
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9765
|
-
] });
|
|
9766
|
-
};
|
|
9767
|
-
const CustomItemsForm = () => {
|
|
9768
|
-
const form = reactHookForm.useForm({
|
|
9769
|
-
resolver: zod.zodResolver(schema$4)
|
|
9770
|
-
});
|
|
9771
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9772
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9773
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9774
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9775
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9776
|
-
] }) })
|
|
9777
|
-
] }) });
|
|
9778
|
-
};
|
|
9779
|
-
const schema$4 = objectType({
|
|
9780
|
-
email: stringType().email()
|
|
9781
|
-
});
|
|
9782
|
-
const Email = () => {
|
|
9783
|
-
const { id } = reactRouterDom.useParams();
|
|
9784
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9785
|
-
fields: "+email"
|
|
9786
|
-
});
|
|
9787
|
-
if (isError) {
|
|
9788
|
-
throw error;
|
|
9789
|
-
}
|
|
9790
|
-
const isReady = !isPending && !!order;
|
|
9791
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9792
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9793
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9794
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9795
|
-
] }),
|
|
9796
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9797
|
-
] });
|
|
9798
|
-
};
|
|
9799
|
-
const EmailForm = ({ order }) => {
|
|
9800
|
-
const form = reactHookForm.useForm({
|
|
9801
|
-
defaultValues: {
|
|
9802
|
-
email: order.email ?? ""
|
|
9803
|
-
},
|
|
9804
|
-
resolver: zod.zodResolver(schema$3)
|
|
9805
|
-
});
|
|
9806
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9807
|
-
const { handleSuccess } = useRouteModal();
|
|
9808
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9809
|
-
await mutateAsync(
|
|
9810
|
-
{ email: data.email },
|
|
9811
|
-
{
|
|
9812
|
-
onSuccess: () => {
|
|
9813
|
-
handleSuccess();
|
|
9814
|
-
},
|
|
9815
|
-
onError: (error) => {
|
|
9816
|
-
ui.toast.error(error.message);
|
|
9817
|
-
}
|
|
9818
|
-
}
|
|
9819
|
-
);
|
|
9820
|
-
});
|
|
9821
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9822
|
-
KeyboundForm,
|
|
9823
|
-
{
|
|
9824
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9825
|
-
onSubmit,
|
|
9826
|
-
children: [
|
|
9827
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9828
|
-
Form$2.Field,
|
|
9829
|
-
{
|
|
9830
|
-
control: form.control,
|
|
9831
|
-
name: "email",
|
|
9832
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9833
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9834
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9835
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9836
|
-
] })
|
|
9837
|
-
}
|
|
9838
|
-
) }),
|
|
9839
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9840
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9841
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9842
|
-
] }) })
|
|
9843
|
-
]
|
|
9844
|
-
}
|
|
9845
|
-
) });
|
|
9846
|
-
};
|
|
9847
|
-
const schema$3 = objectType({
|
|
9848
|
-
email: stringType().email()
|
|
9849
|
-
});
|
|
9781
|
+
const schema$4 = addressSchema;
|
|
9850
9782
|
const NumberInput = React.forwardRef(
|
|
9851
9783
|
({
|
|
9852
9784
|
value,
|
|
@@ -10821,6 +10753,74 @@ const customItemSchema = objectType({
|
|
|
10821
10753
|
quantity: numberType(),
|
|
10822
10754
|
unit_price: unionType([numberType(), stringType()])
|
|
10823
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");
|
|
@@ -13060,22 +13060,22 @@ const routeModule = {
|
|
|
13060
13060
|
handle,
|
|
13061
13061
|
loader,
|
|
13062
13062
|
children: [
|
|
13063
|
-
{
|
|
13064
|
-
Component: BillingAddress,
|
|
13065
|
-
path: "/draft-orders/:id/billing-address"
|
|
13066
|
-
},
|
|
13067
13063
|
{
|
|
13068
13064
|
Component: CustomItems,
|
|
13069
13065
|
path: "/draft-orders/:id/custom-items"
|
|
13070
13066
|
},
|
|
13071
13067
|
{
|
|
13072
|
-
Component:
|
|
13073
|
-
path: "/draft-orders/:id/
|
|
13068
|
+
Component: BillingAddress,
|
|
13069
|
+
path: "/draft-orders/:id/billing-address"
|
|
13074
13070
|
},
|
|
13075
13071
|
{
|
|
13076
13072
|
Component: Items,
|
|
13077
13073
|
path: "/draft-orders/:id/items"
|
|
13078
13074
|
},
|
|
13075
|
+
{
|
|
13076
|
+
Component: Email,
|
|
13077
|
+
path: "/draft-orders/:id/email"
|
|
13078
|
+
},
|
|
13079
13079
|
{
|
|
13080
13080
|
Component: Metadata,
|
|
13081
13081
|
path: "/draft-orders/:id/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
|
};
|
|
@@ -9561,6 +9561,27 @@ const ID = () => {
|
|
|
9561
9561
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9562
9562
|
] });
|
|
9563
9563
|
};
|
|
9564
|
+
const CustomItems = () => {
|
|
9565
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9566
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9567
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9568
|
+
] });
|
|
9569
|
+
};
|
|
9570
|
+
const CustomItemsForm = () => {
|
|
9571
|
+
const form = useForm({
|
|
9572
|
+
resolver: zodResolver(schema$5)
|
|
9573
|
+
});
|
|
9574
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9575
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9576
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9577
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9578
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9579
|
+
] }) })
|
|
9580
|
+
] }) });
|
|
9581
|
+
};
|
|
9582
|
+
const schema$5 = objectType({
|
|
9583
|
+
email: stringType().email()
|
|
9584
|
+
});
|
|
9564
9585
|
const BillingAddress = () => {
|
|
9565
9586
|
const { id } = useParams();
|
|
9566
9587
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9593,7 +9614,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9593
9614
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9594
9615
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9595
9616
|
},
|
|
9596
|
-
resolver: zodResolver(schema$
|
|
9617
|
+
resolver: zodResolver(schema$4)
|
|
9597
9618
|
});
|
|
9598
9619
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9599
9620
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9750,96 +9771,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9750
9771
|
}
|
|
9751
9772
|
) });
|
|
9752
9773
|
};
|
|
9753
|
-
const schema$
|
|
9754
|
-
const CustomItems = () => {
|
|
9755
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9756
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9757
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9758
|
-
] });
|
|
9759
|
-
};
|
|
9760
|
-
const CustomItemsForm = () => {
|
|
9761
|
-
const form = useForm({
|
|
9762
|
-
resolver: zodResolver(schema$4)
|
|
9763
|
-
});
|
|
9764
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9765
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9766
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9767
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9768
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9769
|
-
] }) })
|
|
9770
|
-
] }) });
|
|
9771
|
-
};
|
|
9772
|
-
const schema$4 = objectType({
|
|
9773
|
-
email: stringType().email()
|
|
9774
|
-
});
|
|
9775
|
-
const Email = () => {
|
|
9776
|
-
const { id } = useParams();
|
|
9777
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9778
|
-
fields: "+email"
|
|
9779
|
-
});
|
|
9780
|
-
if (isError) {
|
|
9781
|
-
throw error;
|
|
9782
|
-
}
|
|
9783
|
-
const isReady = !isPending && !!order;
|
|
9784
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9785
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9786
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9787
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9788
|
-
] }),
|
|
9789
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9790
|
-
] });
|
|
9791
|
-
};
|
|
9792
|
-
const EmailForm = ({ order }) => {
|
|
9793
|
-
const form = useForm({
|
|
9794
|
-
defaultValues: {
|
|
9795
|
-
email: order.email ?? ""
|
|
9796
|
-
},
|
|
9797
|
-
resolver: zodResolver(schema$3)
|
|
9798
|
-
});
|
|
9799
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9800
|
-
const { handleSuccess } = useRouteModal();
|
|
9801
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9802
|
-
await mutateAsync(
|
|
9803
|
-
{ email: data.email },
|
|
9804
|
-
{
|
|
9805
|
-
onSuccess: () => {
|
|
9806
|
-
handleSuccess();
|
|
9807
|
-
},
|
|
9808
|
-
onError: (error) => {
|
|
9809
|
-
toast.error(error.message);
|
|
9810
|
-
}
|
|
9811
|
-
}
|
|
9812
|
-
);
|
|
9813
|
-
});
|
|
9814
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9815
|
-
KeyboundForm,
|
|
9816
|
-
{
|
|
9817
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9818
|
-
onSubmit,
|
|
9819
|
-
children: [
|
|
9820
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9821
|
-
Form$2.Field,
|
|
9822
|
-
{
|
|
9823
|
-
control: form.control,
|
|
9824
|
-
name: "email",
|
|
9825
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9826
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9827
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9828
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9829
|
-
] })
|
|
9830
|
-
}
|
|
9831
|
-
) }),
|
|
9832
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9833
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9834
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9835
|
-
] }) })
|
|
9836
|
-
]
|
|
9837
|
-
}
|
|
9838
|
-
) });
|
|
9839
|
-
};
|
|
9840
|
-
const schema$3 = objectType({
|
|
9841
|
-
email: stringType().email()
|
|
9842
|
-
});
|
|
9774
|
+
const schema$4 = addressSchema;
|
|
9843
9775
|
const NumberInput = forwardRef(
|
|
9844
9776
|
({
|
|
9845
9777
|
value,
|
|
@@ -10814,6 +10746,74 @@ const customItemSchema = objectType({
|
|
|
10814
10746
|
quantity: numberType(),
|
|
10815
10747
|
unit_price: unionType([numberType(), stringType()])
|
|
10816
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");
|
|
@@ -13053,22 +13053,22 @@ const routeModule = {
|
|
|
13053
13053
|
handle,
|
|
13054
13054
|
loader,
|
|
13055
13055
|
children: [
|
|
13056
|
-
{
|
|
13057
|
-
Component: BillingAddress,
|
|
13058
|
-
path: "/draft-orders/:id/billing-address"
|
|
13059
|
-
},
|
|
13060
13056
|
{
|
|
13061
13057
|
Component: CustomItems,
|
|
13062
13058
|
path: "/draft-orders/:id/custom-items"
|
|
13063
13059
|
},
|
|
13064
13060
|
{
|
|
13065
|
-
Component:
|
|
13066
|
-
path: "/draft-orders/:id/
|
|
13061
|
+
Component: BillingAddress,
|
|
13062
|
+
path: "/draft-orders/:id/billing-address"
|
|
13067
13063
|
},
|
|
13068
13064
|
{
|
|
13069
13065
|
Component: Items,
|
|
13070
13066
|
path: "/draft-orders/:id/items"
|
|
13071
13067
|
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: Email,
|
|
13070
|
+
path: "/draft-orders/:id/email"
|
|
13071
|
+
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Metadata,
|
|
13074
13074
|
path: "/draft-orders/:id/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": "2.11.4-snapshot-
|
|
3
|
+
"version": "2.11.4-snapshot-20251106130942",
|
|
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": "2.11.4-snapshot-
|
|
40
|
+
"@medusajs/js-sdk": "2.11.4-snapshot-20251106130942",
|
|
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": "2.11.4-snapshot-
|
|
52
|
-
"@medusajs/cli": "2.11.4-snapshot-
|
|
53
|
-
"@medusajs/framework": "2.11.4-snapshot-
|
|
54
|
-
"@medusajs/icons": "2.11.4-snapshot-
|
|
55
|
-
"@medusajs/test-utils": "2.11.4-snapshot-
|
|
56
|
-
"@medusajs/types": "2.11.4-snapshot-
|
|
57
|
-
"@medusajs/ui": "4.0.28-snapshot-
|
|
58
|
-
"@medusajs/ui-preset": "2.11.4-snapshot-
|
|
51
|
+
"@medusajs/admin-sdk": "2.11.4-snapshot-20251106130942",
|
|
52
|
+
"@medusajs/cli": "2.11.4-snapshot-20251106130942",
|
|
53
|
+
"@medusajs/framework": "2.11.4-snapshot-20251106130942",
|
|
54
|
+
"@medusajs/icons": "2.11.4-snapshot-20251106130942",
|
|
55
|
+
"@medusajs/test-utils": "2.11.4-snapshot-20251106130942",
|
|
56
|
+
"@medusajs/types": "2.11.4-snapshot-20251106130942",
|
|
57
|
+
"@medusajs/ui": "4.0.28-snapshot-20251106130942",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.4-snapshot-20251106130942"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "2.11.4-snapshot-
|
|
62
|
-
"@medusajs/cli": "2.11.4-snapshot-
|
|
63
|
-
"@medusajs/framework": "2.11.4-snapshot-
|
|
64
|
-
"@medusajs/icons": "2.11.4-snapshot-
|
|
65
|
-
"@medusajs/test-utils": "2.11.4-snapshot-
|
|
66
|
-
"@medusajs/ui": "4.0.28-snapshot-
|
|
61
|
+
"@medusajs/admin-sdk": "2.11.4-snapshot-20251106130942",
|
|
62
|
+
"@medusajs/cli": "2.11.4-snapshot-20251106130942",
|
|
63
|
+
"@medusajs/framework": "2.11.4-snapshot-20251106130942",
|
|
64
|
+
"@medusajs/icons": "2.11.4-snapshot-20251106130942",
|
|
65
|
+
"@medusajs/test-utils": "2.11.4-snapshot-20251106130942",
|
|
66
|
+
"@medusajs/ui": "4.0.28-snapshot-20251106130942",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|