@medusajs/draft-order 2.10.0-snapshot-20250828080217 → 2.10.0-snapshot-20250828112236
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 +89 -89
- package/.medusa/server/src/admin/index.mjs +89 -89
- package/package.json +18 -18
|
@@ -9560,27 +9560,6 @@ const ID = () => {
|
|
|
9560
9560
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9561
9561
|
] });
|
|
9562
9562
|
};
|
|
9563
|
-
const CustomItems = () => {
|
|
9564
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9565
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9566
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9567
|
-
] });
|
|
9568
|
-
};
|
|
9569
|
-
const CustomItemsForm = () => {
|
|
9570
|
-
const form = reactHookForm.useForm({
|
|
9571
|
-
resolver: zod.zodResolver(schema$5)
|
|
9572
|
-
});
|
|
9573
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9574
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9575
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9576
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9577
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9578
|
-
] }) })
|
|
9579
|
-
] }) });
|
|
9580
|
-
};
|
|
9581
|
-
const schema$5 = objectType({
|
|
9582
|
-
email: stringType().email()
|
|
9583
|
-
});
|
|
9584
9563
|
const BillingAddress = () => {
|
|
9585
9564
|
const { id } = reactRouterDom.useParams();
|
|
9586
9565
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9613,7 +9592,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9613
9592
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9614
9593
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9615
9594
|
},
|
|
9616
|
-
resolver: zod.zodResolver(schema$
|
|
9595
|
+
resolver: zod.zodResolver(schema$5)
|
|
9617
9596
|
});
|
|
9618
9597
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9619
9598
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9770,73 +9749,26 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9770
9749
|
}
|
|
9771
9750
|
) });
|
|
9772
9751
|
};
|
|
9773
|
-
const schema$
|
|
9774
|
-
const
|
|
9775
|
-
const { id } = reactRouterDom.useParams();
|
|
9776
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9777
|
-
fields: "+email"
|
|
9778
|
-
});
|
|
9779
|
-
if (isError) {
|
|
9780
|
-
throw error;
|
|
9781
|
-
}
|
|
9782
|
-
const isReady = !isPending && !!order;
|
|
9752
|
+
const schema$5 = addressSchema;
|
|
9753
|
+
const CustomItems = () => {
|
|
9783
9754
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9784
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9785
|
-
|
|
9786
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9787
|
-
] }),
|
|
9788
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9755
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9756
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9789
9757
|
] });
|
|
9790
9758
|
};
|
|
9791
|
-
const
|
|
9759
|
+
const CustomItemsForm = () => {
|
|
9792
9760
|
const form = reactHookForm.useForm({
|
|
9793
|
-
|
|
9794
|
-
email: order.email ?? ""
|
|
9795
|
-
},
|
|
9796
|
-
resolver: zod.zodResolver(schema$3)
|
|
9797
|
-
});
|
|
9798
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9799
|
-
const { handleSuccess } = useRouteModal();
|
|
9800
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9801
|
-
await mutateAsync(
|
|
9802
|
-
{ email: data.email },
|
|
9803
|
-
{
|
|
9804
|
-
onSuccess: () => {
|
|
9805
|
-
handleSuccess();
|
|
9806
|
-
},
|
|
9807
|
-
onError: (error) => {
|
|
9808
|
-
ui.toast.error(error.message);
|
|
9809
|
-
}
|
|
9810
|
-
}
|
|
9811
|
-
);
|
|
9761
|
+
resolver: zod.zodResolver(schema$4)
|
|
9812
9762
|
});
|
|
9813
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9814
|
-
|
|
9815
|
-
{
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
Form$2.Field,
|
|
9821
|
-
{
|
|
9822
|
-
control: form.control,
|
|
9823
|
-
name: "email",
|
|
9824
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9825
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9826
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9827
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9828
|
-
] })
|
|
9829
|
-
}
|
|
9830
|
-
) }),
|
|
9831
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9832
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9833
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9834
|
-
] }) })
|
|
9835
|
-
]
|
|
9836
|
-
}
|
|
9837
|
-
) });
|
|
9763
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9764
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9765
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9766
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9767
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9768
|
+
] }) })
|
|
9769
|
+
] }) });
|
|
9838
9770
|
};
|
|
9839
|
-
const schema$
|
|
9771
|
+
const schema$4 = objectType({
|
|
9840
9772
|
email: stringType().email()
|
|
9841
9773
|
});
|
|
9842
9774
|
const NumberInput = React.forwardRef(
|
|
@@ -10813,6 +10745,74 @@ const customItemSchema = objectType({
|
|
|
10813
10745
|
quantity: numberType(),
|
|
10814
10746
|
unit_price: unionType([numberType(), stringType()])
|
|
10815
10747
|
});
|
|
10748
|
+
const Email = () => {
|
|
10749
|
+
const { id } = reactRouterDom.useParams();
|
|
10750
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10751
|
+
fields: "+email"
|
|
10752
|
+
});
|
|
10753
|
+
if (isError) {
|
|
10754
|
+
throw error;
|
|
10755
|
+
}
|
|
10756
|
+
const isReady = !isPending && !!order;
|
|
10757
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10758
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10759
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10760
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10761
|
+
] }),
|
|
10762
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10763
|
+
] });
|
|
10764
|
+
};
|
|
10765
|
+
const EmailForm = ({ order }) => {
|
|
10766
|
+
const form = reactHookForm.useForm({
|
|
10767
|
+
defaultValues: {
|
|
10768
|
+
email: order.email ?? ""
|
|
10769
|
+
},
|
|
10770
|
+
resolver: zod.zodResolver(schema$3)
|
|
10771
|
+
});
|
|
10772
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10773
|
+
const { handleSuccess } = useRouteModal();
|
|
10774
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10775
|
+
await mutateAsync(
|
|
10776
|
+
{ email: data.email },
|
|
10777
|
+
{
|
|
10778
|
+
onSuccess: () => {
|
|
10779
|
+
handleSuccess();
|
|
10780
|
+
},
|
|
10781
|
+
onError: (error) => {
|
|
10782
|
+
ui.toast.error(error.message);
|
|
10783
|
+
}
|
|
10784
|
+
}
|
|
10785
|
+
);
|
|
10786
|
+
});
|
|
10787
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10788
|
+
KeyboundForm,
|
|
10789
|
+
{
|
|
10790
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10791
|
+
onSubmit,
|
|
10792
|
+
children: [
|
|
10793
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10794
|
+
Form$2.Field,
|
|
10795
|
+
{
|
|
10796
|
+
control: form.control,
|
|
10797
|
+
name: "email",
|
|
10798
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10799
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10800
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10801
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10802
|
+
] })
|
|
10803
|
+
}
|
|
10804
|
+
) }),
|
|
10805
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10806
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10807
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10808
|
+
] }) })
|
|
10809
|
+
]
|
|
10810
|
+
}
|
|
10811
|
+
) });
|
|
10812
|
+
};
|
|
10813
|
+
const schema$3 = objectType({
|
|
10814
|
+
email: stringType().email()
|
|
10815
|
+
});
|
|
10816
10816
|
const InlineTip = React.forwardRef(
|
|
10817
10817
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10818
10818
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13052,22 +13052,22 @@ const routeModule = {
|
|
|
13052
13052
|
handle,
|
|
13053
13053
|
loader,
|
|
13054
13054
|
children: [
|
|
13055
|
-
{
|
|
13056
|
-
Component: CustomItems,
|
|
13057
|
-
path: "/draft-orders/:id/custom-items"
|
|
13058
|
-
},
|
|
13059
13055
|
{
|
|
13060
13056
|
Component: BillingAddress,
|
|
13061
13057
|
path: "/draft-orders/:id/billing-address"
|
|
13062
13058
|
},
|
|
13063
13059
|
{
|
|
13064
|
-
Component:
|
|
13065
|
-
path: "/draft-orders/:id/
|
|
13060
|
+
Component: CustomItems,
|
|
13061
|
+
path: "/draft-orders/:id/custom-items"
|
|
13066
13062
|
},
|
|
13067
13063
|
{
|
|
13068
13064
|
Component: Items,
|
|
13069
13065
|
path: "/draft-orders/:id/items"
|
|
13070
13066
|
},
|
|
13067
|
+
{
|
|
13068
|
+
Component: Email,
|
|
13069
|
+
path: "/draft-orders/:id/email"
|
|
13070
|
+
},
|
|
13071
13071
|
{
|
|
13072
13072
|
Component: Metadata,
|
|
13073
13073
|
path: "/draft-orders/:id/metadata"
|
|
@@ -9554,27 +9554,6 @@ const ID = () => {
|
|
|
9554
9554
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9555
9555
|
] });
|
|
9556
9556
|
};
|
|
9557
|
-
const CustomItems = () => {
|
|
9558
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9559
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9560
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9561
|
-
] });
|
|
9562
|
-
};
|
|
9563
|
-
const CustomItemsForm = () => {
|
|
9564
|
-
const form = useForm({
|
|
9565
|
-
resolver: zodResolver(schema$5)
|
|
9566
|
-
});
|
|
9567
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9568
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9569
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9570
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9571
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9572
|
-
] }) })
|
|
9573
|
-
] }) });
|
|
9574
|
-
};
|
|
9575
|
-
const schema$5 = objectType({
|
|
9576
|
-
email: stringType().email()
|
|
9577
|
-
});
|
|
9578
9557
|
const BillingAddress = () => {
|
|
9579
9558
|
const { id } = useParams();
|
|
9580
9559
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9607,7 +9586,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9607
9586
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9608
9587
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9609
9588
|
},
|
|
9610
|
-
resolver: zodResolver(schema$
|
|
9589
|
+
resolver: zodResolver(schema$5)
|
|
9611
9590
|
});
|
|
9612
9591
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9613
9592
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9764,73 +9743,26 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9764
9743
|
}
|
|
9765
9744
|
) });
|
|
9766
9745
|
};
|
|
9767
|
-
const schema$
|
|
9768
|
-
const
|
|
9769
|
-
const { id } = useParams();
|
|
9770
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9771
|
-
fields: "+email"
|
|
9772
|
-
});
|
|
9773
|
-
if (isError) {
|
|
9774
|
-
throw error;
|
|
9775
|
-
}
|
|
9776
|
-
const isReady = !isPending && !!order;
|
|
9746
|
+
const schema$5 = addressSchema;
|
|
9747
|
+
const CustomItems = () => {
|
|
9777
9748
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9778
|
-
/* @__PURE__ */
|
|
9779
|
-
|
|
9780
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9781
|
-
] }),
|
|
9782
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9749
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9750
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9783
9751
|
] });
|
|
9784
9752
|
};
|
|
9785
|
-
const
|
|
9753
|
+
const CustomItemsForm = () => {
|
|
9786
9754
|
const form = useForm({
|
|
9787
|
-
|
|
9788
|
-
email: order.email ?? ""
|
|
9789
|
-
},
|
|
9790
|
-
resolver: zodResolver(schema$3)
|
|
9791
|
-
});
|
|
9792
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9793
|
-
const { handleSuccess } = useRouteModal();
|
|
9794
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9795
|
-
await mutateAsync(
|
|
9796
|
-
{ email: data.email },
|
|
9797
|
-
{
|
|
9798
|
-
onSuccess: () => {
|
|
9799
|
-
handleSuccess();
|
|
9800
|
-
},
|
|
9801
|
-
onError: (error) => {
|
|
9802
|
-
toast.error(error.message);
|
|
9803
|
-
}
|
|
9804
|
-
}
|
|
9805
|
-
);
|
|
9755
|
+
resolver: zodResolver(schema$4)
|
|
9806
9756
|
});
|
|
9807
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9808
|
-
|
|
9809
|
-
{
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
Form$2.Field,
|
|
9815
|
-
{
|
|
9816
|
-
control: form.control,
|
|
9817
|
-
name: "email",
|
|
9818
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9819
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9820
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9821
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9822
|
-
] })
|
|
9823
|
-
}
|
|
9824
|
-
) }),
|
|
9825
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9826
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9827
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9828
|
-
] }) })
|
|
9829
|
-
]
|
|
9830
|
-
}
|
|
9831
|
-
) });
|
|
9757
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9758
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9759
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9760
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9761
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9762
|
+
] }) })
|
|
9763
|
+
] }) });
|
|
9832
9764
|
};
|
|
9833
|
-
const schema$
|
|
9765
|
+
const schema$4 = objectType({
|
|
9834
9766
|
email: stringType().email()
|
|
9835
9767
|
});
|
|
9836
9768
|
const NumberInput = forwardRef(
|
|
@@ -10807,6 +10739,74 @@ const customItemSchema = objectType({
|
|
|
10807
10739
|
quantity: numberType(),
|
|
10808
10740
|
unit_price: unionType([numberType(), stringType()])
|
|
10809
10741
|
});
|
|
10742
|
+
const Email = () => {
|
|
10743
|
+
const { id } = useParams();
|
|
10744
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10745
|
+
fields: "+email"
|
|
10746
|
+
});
|
|
10747
|
+
if (isError) {
|
|
10748
|
+
throw error;
|
|
10749
|
+
}
|
|
10750
|
+
const isReady = !isPending && !!order;
|
|
10751
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10752
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10753
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10754
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10755
|
+
] }),
|
|
10756
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10757
|
+
] });
|
|
10758
|
+
};
|
|
10759
|
+
const EmailForm = ({ order }) => {
|
|
10760
|
+
const form = useForm({
|
|
10761
|
+
defaultValues: {
|
|
10762
|
+
email: order.email ?? ""
|
|
10763
|
+
},
|
|
10764
|
+
resolver: zodResolver(schema$3)
|
|
10765
|
+
});
|
|
10766
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10767
|
+
const { handleSuccess } = useRouteModal();
|
|
10768
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10769
|
+
await mutateAsync(
|
|
10770
|
+
{ email: data.email },
|
|
10771
|
+
{
|
|
10772
|
+
onSuccess: () => {
|
|
10773
|
+
handleSuccess();
|
|
10774
|
+
},
|
|
10775
|
+
onError: (error) => {
|
|
10776
|
+
toast.error(error.message);
|
|
10777
|
+
}
|
|
10778
|
+
}
|
|
10779
|
+
);
|
|
10780
|
+
});
|
|
10781
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10782
|
+
KeyboundForm,
|
|
10783
|
+
{
|
|
10784
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10785
|
+
onSubmit,
|
|
10786
|
+
children: [
|
|
10787
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10788
|
+
Form$2.Field,
|
|
10789
|
+
{
|
|
10790
|
+
control: form.control,
|
|
10791
|
+
name: "email",
|
|
10792
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10793
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10794
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10795
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10796
|
+
] })
|
|
10797
|
+
}
|
|
10798
|
+
) }),
|
|
10799
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10800
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10801
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10802
|
+
] }) })
|
|
10803
|
+
]
|
|
10804
|
+
}
|
|
10805
|
+
) });
|
|
10806
|
+
};
|
|
10807
|
+
const schema$3 = objectType({
|
|
10808
|
+
email: stringType().email()
|
|
10809
|
+
});
|
|
10810
10810
|
const InlineTip = forwardRef(
|
|
10811
10811
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10812
10812
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13046,22 +13046,22 @@ const routeModule = {
|
|
|
13046
13046
|
handle,
|
|
13047
13047
|
loader,
|
|
13048
13048
|
children: [
|
|
13049
|
-
{
|
|
13050
|
-
Component: CustomItems,
|
|
13051
|
-
path: "/draft-orders/:id/custom-items"
|
|
13052
|
-
},
|
|
13053
13049
|
{
|
|
13054
13050
|
Component: BillingAddress,
|
|
13055
13051
|
path: "/draft-orders/:id/billing-address"
|
|
13056
13052
|
},
|
|
13057
13053
|
{
|
|
13058
|
-
Component:
|
|
13059
|
-
path: "/draft-orders/:id/
|
|
13054
|
+
Component: CustomItems,
|
|
13055
|
+
path: "/draft-orders/:id/custom-items"
|
|
13060
13056
|
},
|
|
13061
13057
|
{
|
|
13062
13058
|
Component: Items,
|
|
13063
13059
|
path: "/draft-orders/:id/items"
|
|
13064
13060
|
},
|
|
13061
|
+
{
|
|
13062
|
+
Component: Email,
|
|
13063
|
+
path: "/draft-orders/:id/email"
|
|
13064
|
+
},
|
|
13065
13065
|
{
|
|
13066
13066
|
Component: Metadata,
|
|
13067
13067
|
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.0-snapshot-
|
|
3
|
+
"version": "2.10.0-snapshot-20250828112236",
|
|
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.0-snapshot-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.0-snapshot-20250828112236",
|
|
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,15 +45,15 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.10.0-snapshot-
|
|
49
|
-
"@medusajs/cli": "2.10.0-snapshot-
|
|
50
|
-
"@medusajs/framework": "2.10.0-snapshot-
|
|
51
|
-
"@medusajs/icons": "2.10.0-snapshot-
|
|
52
|
-
"@medusajs/medusa": "2.10.0-snapshot-
|
|
53
|
-
"@medusajs/test-utils": "2.10.0-snapshot-
|
|
54
|
-
"@medusajs/types": "2.10.0-snapshot-
|
|
55
|
-
"@medusajs/ui": "4.0.20-snapshot-
|
|
56
|
-
"@medusajs/ui-preset": "2.10.0-snapshot-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.0-snapshot-20250828112236",
|
|
49
|
+
"@medusajs/cli": "2.10.0-snapshot-20250828112236",
|
|
50
|
+
"@medusajs/framework": "2.10.0-snapshot-20250828112236",
|
|
51
|
+
"@medusajs/icons": "2.10.0-snapshot-20250828112236",
|
|
52
|
+
"@medusajs/medusa": "2.10.0-snapshot-20250828112236",
|
|
53
|
+
"@medusajs/test-utils": "2.10.0-snapshot-20250828112236",
|
|
54
|
+
"@medusajs/types": "2.10.0-snapshot-20250828112236",
|
|
55
|
+
"@medusajs/ui": "4.0.20-snapshot-20250828112236",
|
|
56
|
+
"@medusajs/ui-preset": "2.10.0-snapshot-20250828112236",
|
|
57
57
|
"@mikro-orm/cli": "6.4.3",
|
|
58
58
|
"@mikro-orm/core": "6.4.3",
|
|
59
59
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"yalc": "^1.0.0-pre.53"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@medusajs/admin-sdk": "2.10.0-snapshot-
|
|
81
|
-
"@medusajs/cli": "2.10.0-snapshot-
|
|
82
|
-
"@medusajs/framework": "2.10.0-snapshot-
|
|
83
|
-
"@medusajs/icons": "2.10.0-snapshot-
|
|
84
|
-
"@medusajs/medusa": "2.10.0-snapshot-
|
|
85
|
-
"@medusajs/test-utils": "2.10.0-snapshot-
|
|
86
|
-
"@medusajs/ui": "4.0.20-snapshot-
|
|
80
|
+
"@medusajs/admin-sdk": "2.10.0-snapshot-20250828112236",
|
|
81
|
+
"@medusajs/cli": "2.10.0-snapshot-20250828112236",
|
|
82
|
+
"@medusajs/framework": "2.10.0-snapshot-20250828112236",
|
|
83
|
+
"@medusajs/icons": "2.10.0-snapshot-20250828112236",
|
|
84
|
+
"@medusajs/medusa": "2.10.0-snapshot-20250828112236",
|
|
85
|
+
"@medusajs/test-utils": "2.10.0-snapshot-20250828112236",
|
|
86
|
+
"@medusajs/ui": "4.0.20-snapshot-20250828112236",
|
|
87
87
|
"@mikro-orm/cli": "6.4.3",
|
|
88
88
|
"@mikro-orm/core": "6.4.3",
|
|
89
89
|
"@mikro-orm/knex": "6.4.3",
|