@medusajs/draft-order 2.11.2-snapshot-20251031083831 → 2.11.2-snapshot-20251031090242
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 -99
- package/.medusa/server/src/admin/index.mjs +99 -99
- package/package.json +44 -16
|
@@ -9572,6 +9572,27 @@ 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
|
+
});
|
|
9575
9596
|
const BillingAddress = () => {
|
|
9576
9597
|
const { id } = reactRouterDom.useParams();
|
|
9577
9598
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9604,7 +9625,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9604
9625
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9605
9626
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9606
9627
|
},
|
|
9607
|
-
resolver: zod.zodResolver(schema$
|
|
9628
|
+
resolver: zod.zodResolver(schema$4)
|
|
9608
9629
|
});
|
|
9609
9630
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9610
9631
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9761,96 +9782,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9761
9782
|
}
|
|
9762
9783
|
) });
|
|
9763
9784
|
};
|
|
9764
|
-
const schema$
|
|
9765
|
-
const Email = () => {
|
|
9766
|
-
const { id } = reactRouterDom.useParams();
|
|
9767
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9768
|
-
fields: "+email"
|
|
9769
|
-
});
|
|
9770
|
-
if (isError) {
|
|
9771
|
-
throw error;
|
|
9772
|
-
}
|
|
9773
|
-
const isReady = !isPending && !!order;
|
|
9774
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9775
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9776
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9778
|
-
] }),
|
|
9779
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9780
|
-
] });
|
|
9781
|
-
};
|
|
9782
|
-
const EmailForm = ({ order }) => {
|
|
9783
|
-
const form = reactHookForm.useForm({
|
|
9784
|
-
defaultValues: {
|
|
9785
|
-
email: order.email ?? ""
|
|
9786
|
-
},
|
|
9787
|
-
resolver: zod.zodResolver(schema$4)
|
|
9788
|
-
});
|
|
9789
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9790
|
-
const { handleSuccess } = useRouteModal();
|
|
9791
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9792
|
-
await mutateAsync(
|
|
9793
|
-
{ email: data.email },
|
|
9794
|
-
{
|
|
9795
|
-
onSuccess: () => {
|
|
9796
|
-
handleSuccess();
|
|
9797
|
-
},
|
|
9798
|
-
onError: (error) => {
|
|
9799
|
-
ui.toast.error(error.message);
|
|
9800
|
-
}
|
|
9801
|
-
}
|
|
9802
|
-
);
|
|
9803
|
-
});
|
|
9804
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9805
|
-
KeyboundForm,
|
|
9806
|
-
{
|
|
9807
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9808
|
-
onSubmit,
|
|
9809
|
-
children: [
|
|
9810
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9811
|
-
Form$2.Field,
|
|
9812
|
-
{
|
|
9813
|
-
control: form.control,
|
|
9814
|
-
name: "email",
|
|
9815
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9816
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9817
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9818
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9819
|
-
] })
|
|
9820
|
-
}
|
|
9821
|
-
) }),
|
|
9822
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9823
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9824
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9825
|
-
] }) })
|
|
9826
|
-
]
|
|
9827
|
-
}
|
|
9828
|
-
) });
|
|
9829
|
-
};
|
|
9830
|
-
const schema$4 = objectType({
|
|
9831
|
-
email: stringType().email()
|
|
9832
|
-
});
|
|
9833
|
-
const CustomItems = () => {
|
|
9834
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9835
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9836
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9837
|
-
] });
|
|
9838
|
-
};
|
|
9839
|
-
const CustomItemsForm = () => {
|
|
9840
|
-
const form = reactHookForm.useForm({
|
|
9841
|
-
resolver: zod.zodResolver(schema$3)
|
|
9842
|
-
});
|
|
9843
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9844
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9845
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9846
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9847
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9848
|
-
] }) })
|
|
9849
|
-
] }) });
|
|
9850
|
-
};
|
|
9851
|
-
const schema$3 = objectType({
|
|
9852
|
-
email: stringType().email()
|
|
9853
|
-
});
|
|
9785
|
+
const schema$4 = addressSchema;
|
|
9854
9786
|
const NumberInput = React.forwardRef(
|
|
9855
9787
|
({
|
|
9856
9788
|
value,
|
|
@@ -10825,6 +10757,74 @@ const customItemSchema = objectType({
|
|
|
10825
10757
|
quantity: numberType(),
|
|
10826
10758
|
unit_price: unionType([numberType(), stringType()])
|
|
10827
10759
|
});
|
|
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: BillingAddress,
|
|
13069
|
-
path: "/draft-orders/:id/billing-address"
|
|
13070
|
-
},
|
|
13071
|
-
{
|
|
13072
|
-
Component: Email,
|
|
13073
|
-
path: "/draft-orders/:id/email"
|
|
13074
|
-
},
|
|
13075
13067
|
{
|
|
13076
13068
|
Component: CustomItems,
|
|
13077
13069
|
path: "/draft-orders/:id/custom-items"
|
|
13078
13070
|
},
|
|
13071
|
+
{
|
|
13072
|
+
Component: BillingAddress,
|
|
13073
|
+
path: "/draft-orders/:id/billing-address"
|
|
13074
|
+
},
|
|
13079
13075
|
{
|
|
13080
13076
|
Component: Items,
|
|
13081
13077
|
path: "/draft-orders/:id/items"
|
|
13082
13078
|
},
|
|
13079
|
+
{
|
|
13080
|
+
Component: Email,
|
|
13081
|
+
path: "/draft-orders/:id/email"
|
|
13082
|
+
},
|
|
13083
13083
|
{
|
|
13084
13084
|
Component: Metadata,
|
|
13085
13085
|
path: "/draft-orders/:id/metadata"
|
|
@@ -9565,6 +9565,27 @@ 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
|
+
});
|
|
9568
9589
|
const BillingAddress = () => {
|
|
9569
9590
|
const { id } = useParams();
|
|
9570
9591
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9597,7 +9618,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9597
9618
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
9619
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
9620
|
},
|
|
9600
|
-
resolver: zodResolver(schema$
|
|
9621
|
+
resolver: zodResolver(schema$4)
|
|
9601
9622
|
});
|
|
9602
9623
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9603
9624
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9754,96 +9775,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9754
9775
|
}
|
|
9755
9776
|
) });
|
|
9756
9777
|
};
|
|
9757
|
-
const schema$
|
|
9758
|
-
const Email = () => {
|
|
9759
|
-
const { id } = useParams();
|
|
9760
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9761
|
-
fields: "+email"
|
|
9762
|
-
});
|
|
9763
|
-
if (isError) {
|
|
9764
|
-
throw error;
|
|
9765
|
-
}
|
|
9766
|
-
const isReady = !isPending && !!order;
|
|
9767
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9768
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9769
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9770
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9771
|
-
] }),
|
|
9772
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9773
|
-
] });
|
|
9774
|
-
};
|
|
9775
|
-
const EmailForm = ({ order }) => {
|
|
9776
|
-
const form = useForm({
|
|
9777
|
-
defaultValues: {
|
|
9778
|
-
email: order.email ?? ""
|
|
9779
|
-
},
|
|
9780
|
-
resolver: zodResolver(schema$4)
|
|
9781
|
-
});
|
|
9782
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9783
|
-
const { handleSuccess } = useRouteModal();
|
|
9784
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9785
|
-
await mutateAsync(
|
|
9786
|
-
{ email: data.email },
|
|
9787
|
-
{
|
|
9788
|
-
onSuccess: () => {
|
|
9789
|
-
handleSuccess();
|
|
9790
|
-
},
|
|
9791
|
-
onError: (error) => {
|
|
9792
|
-
toast.error(error.message);
|
|
9793
|
-
}
|
|
9794
|
-
}
|
|
9795
|
-
);
|
|
9796
|
-
});
|
|
9797
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9798
|
-
KeyboundForm,
|
|
9799
|
-
{
|
|
9800
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9801
|
-
onSubmit,
|
|
9802
|
-
children: [
|
|
9803
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9804
|
-
Form$2.Field,
|
|
9805
|
-
{
|
|
9806
|
-
control: form.control,
|
|
9807
|
-
name: "email",
|
|
9808
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9809
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9810
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9811
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9812
|
-
] })
|
|
9813
|
-
}
|
|
9814
|
-
) }),
|
|
9815
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9816
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9817
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9818
|
-
] }) })
|
|
9819
|
-
]
|
|
9820
|
-
}
|
|
9821
|
-
) });
|
|
9822
|
-
};
|
|
9823
|
-
const schema$4 = objectType({
|
|
9824
|
-
email: stringType().email()
|
|
9825
|
-
});
|
|
9826
|
-
const CustomItems = () => {
|
|
9827
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9828
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9829
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9830
|
-
] });
|
|
9831
|
-
};
|
|
9832
|
-
const CustomItemsForm = () => {
|
|
9833
|
-
const form = useForm({
|
|
9834
|
-
resolver: zodResolver(schema$3)
|
|
9835
|
-
});
|
|
9836
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9837
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
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", children: "Save" })
|
|
9841
|
-
] }) })
|
|
9842
|
-
] }) });
|
|
9843
|
-
};
|
|
9844
|
-
const schema$3 = objectType({
|
|
9845
|
-
email: stringType().email()
|
|
9846
|
-
});
|
|
9778
|
+
const schema$4 = addressSchema;
|
|
9847
9779
|
const NumberInput = forwardRef(
|
|
9848
9780
|
({
|
|
9849
9781
|
value,
|
|
@@ -10818,6 +10750,74 @@ const customItemSchema = objectType({
|
|
|
10818
10750
|
quantity: numberType(),
|
|
10819
10751
|
unit_price: unionType([numberType(), stringType()])
|
|
10820
10752
|
});
|
|
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: BillingAddress,
|
|
13062
|
-
path: "/draft-orders/:id/billing-address"
|
|
13063
|
-
},
|
|
13064
|
-
{
|
|
13065
|
-
Component: Email,
|
|
13066
|
-
path: "/draft-orders/:id/email"
|
|
13067
|
-
},
|
|
13068
13060
|
{
|
|
13069
13061
|
Component: CustomItems,
|
|
13070
13062
|
path: "/draft-orders/:id/custom-items"
|
|
13071
13063
|
},
|
|
13064
|
+
{
|
|
13065
|
+
Component: BillingAddress,
|
|
13066
|
+
path: "/draft-orders/:id/billing-address"
|
|
13067
|
+
},
|
|
13072
13068
|
{
|
|
13073
13069
|
Component: Items,
|
|
13074
13070
|
path: "/draft-orders/:id/items"
|
|
13075
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: Email,
|
|
13074
|
+
path: "/draft-orders/:id/email"
|
|
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.2-snapshot-
|
|
3
|
+
"version": "2.11.2-snapshot-20251031090242",
|
|
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.0",
|
|
39
39
|
"@hookform/resolvers": "3.4.2",
|
|
40
|
-
"@medusajs/js-sdk": "2.11.2-snapshot-
|
|
40
|
+
"@medusajs/js-sdk": "2.11.2-snapshot-20251031090242",
|
|
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,14 +48,14 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "2.11.2-snapshot-
|
|
52
|
-
"@medusajs/cli": "2.11.2-snapshot-
|
|
53
|
-
"@medusajs/framework": "2.11.2-snapshot-
|
|
54
|
-
"@medusajs/icons": "2.11.2-snapshot-
|
|
55
|
-
"@medusajs/test-utils": "2.11.2-snapshot-
|
|
56
|
-
"@medusajs/types": "2.11.2-snapshot-
|
|
57
|
-
"@medusajs/ui": "4.0.26-snapshot-
|
|
58
|
-
"@medusajs/ui-preset": "2.11.2-snapshot-
|
|
51
|
+
"@medusajs/admin-sdk": "2.11.2-snapshot-20251031090242",
|
|
52
|
+
"@medusajs/cli": "2.11.2-snapshot-20251031090242",
|
|
53
|
+
"@medusajs/framework": "2.11.2-snapshot-20251031090242",
|
|
54
|
+
"@medusajs/icons": "2.11.2-snapshot-20251031090242",
|
|
55
|
+
"@medusajs/test-utils": "2.11.2-snapshot-20251031090242",
|
|
56
|
+
"@medusajs/types": "2.11.2-snapshot-20251031090242",
|
|
57
|
+
"@medusajs/ui": "4.0.26-snapshot-20251031090242",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.2-snapshot-20251031090242",
|
|
59
59
|
"@swc/core": "^1.7.28",
|
|
60
60
|
"@types/lodash": "^4.17.15",
|
|
61
61
|
"@types/lodash.debounce": "^4.0.9",
|
|
@@ -73,14 +73,42 @@
|
|
|
73
73
|
"yalc": "^1.0.0-pre.53"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@medusajs/admin-sdk": "2.11.2-snapshot-
|
|
77
|
-
"@medusajs/cli": "2.11.2-snapshot-
|
|
78
|
-
"@medusajs/framework": "2.11.2-snapshot-
|
|
79
|
-
"@medusajs/icons": "2.11.2-snapshot-
|
|
80
|
-
"@medusajs/test-utils": "2.11.2-snapshot-
|
|
81
|
-
"@medusajs/ui": "4.0.26-snapshot-
|
|
76
|
+
"@medusajs/admin-sdk": "2.11.2-snapshot-20251031090242",
|
|
77
|
+
"@medusajs/cli": "2.11.2-snapshot-20251031090242",
|
|
78
|
+
"@medusajs/framework": "2.11.2-snapshot-20251031090242",
|
|
79
|
+
"@medusajs/icons": "2.11.2-snapshot-20251031090242",
|
|
80
|
+
"@medusajs/test-utils": "2.11.2-snapshot-20251031090242",
|
|
81
|
+
"@medusajs/ui": "4.0.26-snapshot-20251031090242",
|
|
82
|
+
"react": "^18.3.1",
|
|
83
|
+
"react-dom": "^18.3.1",
|
|
82
84
|
"react-router-dom": "6.20.1"
|
|
83
85
|
},
|
|
86
|
+
"peerDependenciesMeta": {
|
|
87
|
+
"@medusajs/admin-sdk": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"@medusajs/cli": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"@medusajs/icons": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"@medusajs/test-utils": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"@medusajs/ui": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"react": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"react-dom": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"react-router-dom": {
|
|
109
|
+
"optional": true
|
|
110
|
+
}
|
|
111
|
+
},
|
|
84
112
|
"engines": {
|
|
85
113
|
"node": ">=20"
|
|
86
114
|
},
|