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