@medusajs/draft-order 2.12.0-preview-20251103180145 → 3.0.0-snapshot-20251104011621
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 +93 -97
- package/.medusa/server/src/admin/index.mjs +94 -98
- package/package.json +16 -31
|
@@ -4654,9 +4654,6 @@ ZodReadonly.create = (type, params) => {
|
|
|
4654
4654
|
...processCreateParams(params)
|
|
4655
4655
|
});
|
|
4656
4656
|
};
|
|
4657
|
-
({
|
|
4658
|
-
object: ZodObject.lazycreate
|
|
4659
|
-
});
|
|
4660
4657
|
var ZodFirstPartyTypeKind;
|
|
4661
4658
|
(function(ZodFirstPartyTypeKind2) {
|
|
4662
4659
|
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
@@ -4703,7 +4700,6 @@ const anyType = ZodAny.create;
|
|
|
4703
4700
|
ZodNever.create;
|
|
4704
4701
|
const arrayType = ZodArray.create;
|
|
4705
4702
|
const objectType = ZodObject.create;
|
|
4706
|
-
ZodObject.strictCreate;
|
|
4707
4703
|
const unionType = ZodUnion.create;
|
|
4708
4704
|
ZodIntersection.create;
|
|
4709
4705
|
ZodTuple.create;
|
|
@@ -9762,95 +9758,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9758
|
) });
|
|
9763
9759
|
};
|
|
9764
9760
|
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
|
-
});
|
|
9854
9761
|
const NumberInput = React.forwardRef(
|
|
9855
9762
|
({
|
|
9856
9763
|
value,
|
|
@@ -10825,6 +10732,95 @@ const customItemSchema = objectType({
|
|
|
10825
10732
|
quantity: numberType(),
|
|
10826
10733
|
unit_price: unionType([numberType(), stringType()])
|
|
10827
10734
|
});
|
|
10735
|
+
const CustomItems = () => {
|
|
10736
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10737
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
10738
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
10739
|
+
] });
|
|
10740
|
+
};
|
|
10741
|
+
const CustomItemsForm = () => {
|
|
10742
|
+
const form = reactHookForm.useForm({
|
|
10743
|
+
resolver: zod.zodResolver(schema$4)
|
|
10744
|
+
});
|
|
10745
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10746
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
10747
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10748
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10749
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
10750
|
+
] }) })
|
|
10751
|
+
] }) });
|
|
10752
|
+
};
|
|
10753
|
+
const schema$4 = objectType({
|
|
10754
|
+
email: stringType().email()
|
|
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
|
+
});
|
|
10828
10824
|
const InlineTip = React.forwardRef(
|
|
10829
10825
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10830
10826
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13068,6 +13064,10 @@ const routeModule = {
|
|
|
13068
13064
|
Component: BillingAddress,
|
|
13069
13065
|
path: "/draft-orders/:id/billing-address"
|
|
13070
13066
|
},
|
|
13067
|
+
{
|
|
13068
|
+
Component: Items,
|
|
13069
|
+
path: "/draft-orders/:id/items"
|
|
13070
|
+
},
|
|
13071
13071
|
{
|
|
13072
13072
|
Component: CustomItems,
|
|
13073
13073
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13076,10 +13076,6 @@ const routeModule = {
|
|
|
13076
13076
|
Component: Email,
|
|
13077
13077
|
path: "/draft-orders/:id/email"
|
|
13078
13078
|
},
|
|
13079
|
-
{
|
|
13080
|
-
Component: Items,
|
|
13081
|
-
path: "/draft-orders/:id/items"
|
|
13082
|
-
},
|
|
13083
13079
|
{
|
|
13084
13080
|
Component: Metadata,
|
|
13085
13081
|
path: "/draft-orders/:id/metadata"
|
|
@@ -9,7 +9,7 @@ import Medusa from "@medusajs/js-sdk";
|
|
|
9
9
|
import { format, formatDistance, sub, subDays, subMonths } from "date-fns";
|
|
10
10
|
import { enUS } from "date-fns/locale";
|
|
11
11
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
12
|
-
import { FormProvider,
|
|
12
|
+
import { FormProvider, useFormContext, useFormState, Controller, useForm, useWatch, useFieldArray } from "react-hook-form";
|
|
13
13
|
import { Slot, Collapsible, Accordion } from "radix-ui";
|
|
14
14
|
import { ComboboxProvider, Combobox as Combobox$1, ComboboxDisclosure, ComboboxPopover, ComboboxItem, ComboboxItemCheck, ComboboxItemValue, Separator } from "@ariakit/react";
|
|
15
15
|
import { matchSorter } from "match-sorter";
|
|
@@ -4647,9 +4647,6 @@ ZodReadonly.create = (type, params) => {
|
|
|
4647
4647
|
...processCreateParams(params)
|
|
4648
4648
|
});
|
|
4649
4649
|
};
|
|
4650
|
-
({
|
|
4651
|
-
object: ZodObject.lazycreate
|
|
4652
|
-
});
|
|
4653
4650
|
var ZodFirstPartyTypeKind;
|
|
4654
4651
|
(function(ZodFirstPartyTypeKind2) {
|
|
4655
4652
|
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
@@ -4696,7 +4693,6 @@ const anyType = ZodAny.create;
|
|
|
4696
4693
|
ZodNever.create;
|
|
4697
4694
|
const arrayType = ZodArray.create;
|
|
4698
4695
|
const objectType = ZodObject.create;
|
|
4699
|
-
ZodObject.strictCreate;
|
|
4700
4696
|
const unionType = ZodUnion.create;
|
|
4701
4697
|
ZodIntersection.create;
|
|
4702
4698
|
ZodTuple.create;
|
|
@@ -9755,95 +9751,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9755
9751
|
) });
|
|
9756
9752
|
};
|
|
9757
9753
|
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
|
-
});
|
|
9847
9754
|
const NumberInput = forwardRef(
|
|
9848
9755
|
({
|
|
9849
9756
|
value,
|
|
@@ -10818,6 +10725,95 @@ const customItemSchema = objectType({
|
|
|
10818
10725
|
quantity: numberType(),
|
|
10819
10726
|
unit_price: unionType([numberType(), stringType()])
|
|
10820
10727
|
});
|
|
10728
|
+
const CustomItems = () => {
|
|
10729
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10730
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
10731
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
10732
|
+
] });
|
|
10733
|
+
};
|
|
10734
|
+
const CustomItemsForm = () => {
|
|
10735
|
+
const form = useForm({
|
|
10736
|
+
resolver: zodResolver(schema$4)
|
|
10737
|
+
});
|
|
10738
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10739
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
10740
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10741
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10742
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
10743
|
+
] }) })
|
|
10744
|
+
] }) });
|
|
10745
|
+
};
|
|
10746
|
+
const schema$4 = objectType({
|
|
10747
|
+
email: stringType().email()
|
|
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
|
+
});
|
|
10821
10817
|
const InlineTip = forwardRef(
|
|
10822
10818
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10823
10819
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13061,6 +13057,10 @@ const routeModule = {
|
|
|
13061
13057
|
Component: BillingAddress,
|
|
13062
13058
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13059
|
},
|
|
13060
|
+
{
|
|
13061
|
+
Component: Items,
|
|
13062
|
+
path: "/draft-orders/:id/items"
|
|
13063
|
+
},
|
|
13064
13064
|
{
|
|
13065
13065
|
Component: CustomItems,
|
|
13066
13066
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13069,10 +13069,6 @@ const routeModule = {
|
|
|
13069
13069
|
Component: Email,
|
|
13070
13070
|
path: "/draft-orders/:id/email"
|
|
13071
13071
|
},
|
|
13072
|
-
{
|
|
13073
|
-
Component: Items,
|
|
13074
|
-
path: "/draft-orders/:id/items"
|
|
13075
|
-
},
|
|
13076
13072
|
{
|
|
13077
13073
|
Component: Metadata,
|
|
13078
13074
|
path: "/draft-orders/:id/metadata"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-snapshot-20251104011621",
|
|
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": "
|
|
40
|
+
"@medusajs/js-sdk": "3.0.0-snapshot-20251104011621",
|
|
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,37 +48,22 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "
|
|
52
|
-
"@medusajs/cli": "
|
|
53
|
-
"@medusajs/framework": "
|
|
54
|
-
"@medusajs/icons": "
|
|
55
|
-
"@medusajs/test-utils": "
|
|
56
|
-
"@medusajs/types": "
|
|
57
|
-
"@medusajs/ui": "4.0.27-
|
|
58
|
-
"@medusajs/ui-preset": "
|
|
59
|
-
"@swc/core": "^1.7.28",
|
|
60
|
-
"@types/lodash": "^4.17.15",
|
|
61
|
-
"@types/lodash.debounce": "^4.0.9",
|
|
62
|
-
"@types/lodash.isequal": "^4.5.8",
|
|
63
|
-
"@types/node": "^20.12.11",
|
|
64
|
-
"@types/react": "^18.3.2",
|
|
65
|
-
"@types/react-dom": "^18.2.25",
|
|
66
|
-
"react": "^18.3.1",
|
|
67
|
-
"react-dom": "^18.3.1",
|
|
68
|
-
"react-router-dom": "6.20.1",
|
|
69
|
-
"ts-node": "^10.9.2",
|
|
70
|
-
"tsup": "^8.4.0",
|
|
71
|
-
"typescript": "^5.6.2",
|
|
72
|
-
"vite": "^5.4.14",
|
|
73
|
-
"yalc": "^1.0.0-pre.53"
|
|
51
|
+
"@medusajs/admin-sdk": "3.0.0-snapshot-20251104011621",
|
|
52
|
+
"@medusajs/cli": "3.0.0-snapshot-20251104011621",
|
|
53
|
+
"@medusajs/framework": "3.0.0-snapshot-20251104011621",
|
|
54
|
+
"@medusajs/icons": "3.0.0-snapshot-20251104011621",
|
|
55
|
+
"@medusajs/test-utils": "3.0.0-snapshot-20251104011621",
|
|
56
|
+
"@medusajs/types": "3.0.0-snapshot-20251104011621",
|
|
57
|
+
"@medusajs/ui": "4.0.27-snapshot-20251104011621",
|
|
58
|
+
"@medusajs/ui-preset": "3.0.0-snapshot-20251104011621"
|
|
74
59
|
},
|
|
75
60
|
"peerDependencies": {
|
|
76
|
-
"@medusajs/admin-sdk": "
|
|
77
|
-
"@medusajs/cli": "
|
|
78
|
-
"@medusajs/framework": "
|
|
79
|
-
"@medusajs/icons": "
|
|
80
|
-
"@medusajs/test-utils": "
|
|
81
|
-
"@medusajs/ui": "4.0.27-
|
|
61
|
+
"@medusajs/admin-sdk": "3.0.0-snapshot-20251104011621",
|
|
62
|
+
"@medusajs/cli": "3.0.0-snapshot-20251104011621",
|
|
63
|
+
"@medusajs/framework": "3.0.0-snapshot-20251104011621",
|
|
64
|
+
"@medusajs/icons": "3.0.0-snapshot-20251104011621",
|
|
65
|
+
"@medusajs/test-utils": "3.0.0-snapshot-20251104011621",
|
|
66
|
+
"@medusajs/ui": "4.0.27-snapshot-20251104011621",
|
|
82
67
|
"react": "^18.3.1",
|
|
83
68
|
"react-dom": "^18.3.1",
|
|
84
69
|
"react-router-dom": "6.20.1"
|