@medusajs/draft-order 2.11.1-snapshot-20251021125705 → 2.11.1-snapshot-20251022072519
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 +80 -80
- package/.medusa/server/src/admin/index.mjs +80 -80
- package/package.json +16 -16
|
@@ -9761,74 +9761,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9761
9761
|
) });
|
|
9762
9762
|
};
|
|
9763
9763
|
const schema$5 = addressSchema;
|
|
9764
|
-
const Email = () => {
|
|
9765
|
-
const { id } = reactRouterDom.useParams();
|
|
9766
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9767
|
-
fields: "+email"
|
|
9768
|
-
});
|
|
9769
|
-
if (isError) {
|
|
9770
|
-
throw error;
|
|
9771
|
-
}
|
|
9772
|
-
const isReady = !isPending && !!order;
|
|
9773
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9774
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9775
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9776
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9777
|
-
] }),
|
|
9778
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9779
|
-
] });
|
|
9780
|
-
};
|
|
9781
|
-
const EmailForm = ({ order }) => {
|
|
9782
|
-
const form = reactHookForm.useForm({
|
|
9783
|
-
defaultValues: {
|
|
9784
|
-
email: order.email ?? ""
|
|
9785
|
-
},
|
|
9786
|
-
resolver: zod.zodResolver(schema$4)
|
|
9787
|
-
});
|
|
9788
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9789
|
-
const { handleSuccess } = useRouteModal();
|
|
9790
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9791
|
-
await mutateAsync(
|
|
9792
|
-
{ email: data.email },
|
|
9793
|
-
{
|
|
9794
|
-
onSuccess: () => {
|
|
9795
|
-
handleSuccess();
|
|
9796
|
-
},
|
|
9797
|
-
onError: (error) => {
|
|
9798
|
-
ui.toast.error(error.message);
|
|
9799
|
-
}
|
|
9800
|
-
}
|
|
9801
|
-
);
|
|
9802
|
-
});
|
|
9803
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9804
|
-
KeyboundForm,
|
|
9805
|
-
{
|
|
9806
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9807
|
-
onSubmit,
|
|
9808
|
-
children: [
|
|
9809
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9810
|
-
Form$2.Field,
|
|
9811
|
-
{
|
|
9812
|
-
control: form.control,
|
|
9813
|
-
name: "email",
|
|
9814
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9815
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9816
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9817
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9818
|
-
] })
|
|
9819
|
-
}
|
|
9820
|
-
) }),
|
|
9821
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9822
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9823
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9824
|
-
] }) })
|
|
9825
|
-
]
|
|
9826
|
-
}
|
|
9827
|
-
) });
|
|
9828
|
-
};
|
|
9829
|
-
const schema$4 = objectType({
|
|
9830
|
-
email: stringType().email()
|
|
9831
|
-
});
|
|
9832
9764
|
const CustomItems = () => {
|
|
9833
9765
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9834
9766
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9837,7 +9769,7 @@ const CustomItems = () => {
|
|
|
9837
9769
|
};
|
|
9838
9770
|
const CustomItemsForm = () => {
|
|
9839
9771
|
const form = reactHookForm.useForm({
|
|
9840
|
-
resolver: zod.zodResolver(schema$
|
|
9772
|
+
resolver: zod.zodResolver(schema$4)
|
|
9841
9773
|
});
|
|
9842
9774
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9843
9775
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
@@ -9847,7 +9779,7 @@ const CustomItemsForm = () => {
|
|
|
9847
9779
|
] }) })
|
|
9848
9780
|
] }) });
|
|
9849
9781
|
};
|
|
9850
|
-
const schema$
|
|
9782
|
+
const schema$4 = objectType({
|
|
9851
9783
|
email: stringType().email()
|
|
9852
9784
|
});
|
|
9853
9785
|
const InlineTip = React.forwardRef(
|
|
@@ -10551,7 +10483,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
10551
10483
|
defaultValues: {
|
|
10552
10484
|
sales_channel_id: order.sales_channel_id || ""
|
|
10553
10485
|
},
|
|
10554
|
-
resolver: zod.zodResolver(schema$
|
|
10486
|
+
resolver: zod.zodResolver(schema$3)
|
|
10555
10487
|
});
|
|
10556
10488
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10557
10489
|
const { handleSuccess } = useRouteModal();
|
|
@@ -10626,7 +10558,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
10626
10558
|
}
|
|
10627
10559
|
);
|
|
10628
10560
|
};
|
|
10629
|
-
const schema$
|
|
10561
|
+
const schema$3 = objectType({
|
|
10630
10562
|
sales_channel_id: stringType().min(1)
|
|
10631
10563
|
});
|
|
10632
10564
|
function convertNumber(value) {
|
|
@@ -11471,7 +11403,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11471
11403
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11472
11404
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11473
11405
|
},
|
|
11474
|
-
resolver: zod.zodResolver(schema$
|
|
11406
|
+
resolver: zod.zodResolver(schema$2)
|
|
11475
11407
|
});
|
|
11476
11408
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11477
11409
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11641,7 +11573,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11641
11573
|
}
|
|
11642
11574
|
) });
|
|
11643
11575
|
};
|
|
11644
|
-
const schema$
|
|
11576
|
+
const schema$2 = addressSchema;
|
|
11645
11577
|
const TransferOwnership = () => {
|
|
11646
11578
|
const { id } = reactRouterDom.useParams();
|
|
11647
11579
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -11665,7 +11597,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
11665
11597
|
defaultValues: {
|
|
11666
11598
|
customer_id: order.customer_id || ""
|
|
11667
11599
|
},
|
|
11668
|
-
resolver: zod.zodResolver(schema)
|
|
11600
|
+
resolver: zod.zodResolver(schema$1)
|
|
11669
11601
|
});
|
|
11670
11602
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11671
11603
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12115,9 +12047,77 @@ const Illustration = () => {
|
|
|
12115
12047
|
}
|
|
12116
12048
|
);
|
|
12117
12049
|
};
|
|
12118
|
-
const schema = objectType({
|
|
12050
|
+
const schema$1 = objectType({
|
|
12119
12051
|
customer_id: stringType().min(1)
|
|
12120
12052
|
});
|
|
12053
|
+
const Email = () => {
|
|
12054
|
+
const { id } = reactRouterDom.useParams();
|
|
12055
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12056
|
+
fields: "+email"
|
|
12057
|
+
});
|
|
12058
|
+
if (isError) {
|
|
12059
|
+
throw error;
|
|
12060
|
+
}
|
|
12061
|
+
const isReady = !isPending && !!order;
|
|
12062
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12063
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12064
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12065
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12066
|
+
] }),
|
|
12067
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12068
|
+
] });
|
|
12069
|
+
};
|
|
12070
|
+
const EmailForm = ({ order }) => {
|
|
12071
|
+
const form = reactHookForm.useForm({
|
|
12072
|
+
defaultValues: {
|
|
12073
|
+
email: order.email ?? ""
|
|
12074
|
+
},
|
|
12075
|
+
resolver: zod.zodResolver(schema)
|
|
12076
|
+
});
|
|
12077
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12078
|
+
const { handleSuccess } = useRouteModal();
|
|
12079
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12080
|
+
await mutateAsync(
|
|
12081
|
+
{ email: data.email },
|
|
12082
|
+
{
|
|
12083
|
+
onSuccess: () => {
|
|
12084
|
+
handleSuccess();
|
|
12085
|
+
},
|
|
12086
|
+
onError: (error) => {
|
|
12087
|
+
ui.toast.error(error.message);
|
|
12088
|
+
}
|
|
12089
|
+
}
|
|
12090
|
+
);
|
|
12091
|
+
});
|
|
12092
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12093
|
+
KeyboundForm,
|
|
12094
|
+
{
|
|
12095
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12096
|
+
onSubmit,
|
|
12097
|
+
children: [
|
|
12098
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12099
|
+
Form$2.Field,
|
|
12100
|
+
{
|
|
12101
|
+
control: form.control,
|
|
12102
|
+
name: "email",
|
|
12103
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12104
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
12105
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12106
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12107
|
+
] })
|
|
12108
|
+
}
|
|
12109
|
+
) }),
|
|
12110
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12111
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12112
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12113
|
+
] }) })
|
|
12114
|
+
]
|
|
12115
|
+
}
|
|
12116
|
+
) });
|
|
12117
|
+
};
|
|
12118
|
+
const schema = objectType({
|
|
12119
|
+
email: stringType().email()
|
|
12120
|
+
});
|
|
12121
12121
|
const NumberInput = React.forwardRef(
|
|
12122
12122
|
({
|
|
12123
12123
|
value,
|
|
@@ -13067,10 +13067,6 @@ const routeModule = {
|
|
|
13067
13067
|
Component: BillingAddress,
|
|
13068
13068
|
path: "/draft-orders/:id/billing-address"
|
|
13069
13069
|
},
|
|
13070
|
-
{
|
|
13071
|
-
Component: Email,
|
|
13072
|
-
path: "/draft-orders/:id/email"
|
|
13073
|
-
},
|
|
13074
13070
|
{
|
|
13075
13071
|
Component: CustomItems,
|
|
13076
13072
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13099,6 +13095,10 @@ const routeModule = {
|
|
|
13099
13095
|
Component: TransferOwnership,
|
|
13100
13096
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13101
13097
|
},
|
|
13098
|
+
{
|
|
13099
|
+
Component: Email,
|
|
13100
|
+
path: "/draft-orders/:id/email"
|
|
13101
|
+
},
|
|
13102
13102
|
{
|
|
13103
13103
|
Component: Items,
|
|
13104
13104
|
path: "/draft-orders/:id/items"
|
|
@@ -9755,74 +9755,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9755
9755
|
) });
|
|
9756
9756
|
};
|
|
9757
9757
|
const schema$5 = addressSchema;
|
|
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
9758
|
const CustomItems = () => {
|
|
9827
9759
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9828
9760
|
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9831,7 +9763,7 @@ const CustomItems = () => {
|
|
|
9831
9763
|
};
|
|
9832
9764
|
const CustomItemsForm = () => {
|
|
9833
9765
|
const form = useForm({
|
|
9834
|
-
resolver: zodResolver(schema$
|
|
9766
|
+
resolver: zodResolver(schema$4)
|
|
9835
9767
|
});
|
|
9836
9768
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9837
9769
|
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
@@ -9841,7 +9773,7 @@ const CustomItemsForm = () => {
|
|
|
9841
9773
|
] }) })
|
|
9842
9774
|
] }) });
|
|
9843
9775
|
};
|
|
9844
|
-
const schema$
|
|
9776
|
+
const schema$4 = objectType({
|
|
9845
9777
|
email: stringType().email()
|
|
9846
9778
|
});
|
|
9847
9779
|
const InlineTip = forwardRef(
|
|
@@ -10545,7 +10477,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
10545
10477
|
defaultValues: {
|
|
10546
10478
|
sales_channel_id: order.sales_channel_id || ""
|
|
10547
10479
|
},
|
|
10548
|
-
resolver: zodResolver(schema$
|
|
10480
|
+
resolver: zodResolver(schema$3)
|
|
10549
10481
|
});
|
|
10550
10482
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10551
10483
|
const { handleSuccess } = useRouteModal();
|
|
@@ -10620,7 +10552,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
10620
10552
|
}
|
|
10621
10553
|
);
|
|
10622
10554
|
};
|
|
10623
|
-
const schema$
|
|
10555
|
+
const schema$3 = objectType({
|
|
10624
10556
|
sales_channel_id: stringType().min(1)
|
|
10625
10557
|
});
|
|
10626
10558
|
function convertNumber(value) {
|
|
@@ -11465,7 +11397,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11465
11397
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11466
11398
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11467
11399
|
},
|
|
11468
|
-
resolver: zodResolver(schema$
|
|
11400
|
+
resolver: zodResolver(schema$2)
|
|
11469
11401
|
});
|
|
11470
11402
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11471
11403
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11635,7 +11567,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11635
11567
|
}
|
|
11636
11568
|
) });
|
|
11637
11569
|
};
|
|
11638
|
-
const schema$
|
|
11570
|
+
const schema$2 = addressSchema;
|
|
11639
11571
|
const TransferOwnership = () => {
|
|
11640
11572
|
const { id } = useParams();
|
|
11641
11573
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -11659,7 +11591,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
11659
11591
|
defaultValues: {
|
|
11660
11592
|
customer_id: order.customer_id || ""
|
|
11661
11593
|
},
|
|
11662
|
-
resolver: zodResolver(schema)
|
|
11594
|
+
resolver: zodResolver(schema$1)
|
|
11663
11595
|
});
|
|
11664
11596
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11665
11597
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12109,9 +12041,77 @@ const Illustration = () => {
|
|
|
12109
12041
|
}
|
|
12110
12042
|
);
|
|
12111
12043
|
};
|
|
12112
|
-
const schema = objectType({
|
|
12044
|
+
const schema$1 = objectType({
|
|
12113
12045
|
customer_id: stringType().min(1)
|
|
12114
12046
|
});
|
|
12047
|
+
const Email = () => {
|
|
12048
|
+
const { id } = useParams();
|
|
12049
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12050
|
+
fields: "+email"
|
|
12051
|
+
});
|
|
12052
|
+
if (isError) {
|
|
12053
|
+
throw error;
|
|
12054
|
+
}
|
|
12055
|
+
const isReady = !isPending && !!order;
|
|
12056
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12057
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12058
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12059
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12060
|
+
] }),
|
|
12061
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12062
|
+
] });
|
|
12063
|
+
};
|
|
12064
|
+
const EmailForm = ({ order }) => {
|
|
12065
|
+
const form = useForm({
|
|
12066
|
+
defaultValues: {
|
|
12067
|
+
email: order.email ?? ""
|
|
12068
|
+
},
|
|
12069
|
+
resolver: zodResolver(schema)
|
|
12070
|
+
});
|
|
12071
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12072
|
+
const { handleSuccess } = useRouteModal();
|
|
12073
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12074
|
+
await mutateAsync(
|
|
12075
|
+
{ email: data.email },
|
|
12076
|
+
{
|
|
12077
|
+
onSuccess: () => {
|
|
12078
|
+
handleSuccess();
|
|
12079
|
+
},
|
|
12080
|
+
onError: (error) => {
|
|
12081
|
+
toast.error(error.message);
|
|
12082
|
+
}
|
|
12083
|
+
}
|
|
12084
|
+
);
|
|
12085
|
+
});
|
|
12086
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12087
|
+
KeyboundForm,
|
|
12088
|
+
{
|
|
12089
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12090
|
+
onSubmit,
|
|
12091
|
+
children: [
|
|
12092
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
12093
|
+
Form$2.Field,
|
|
12094
|
+
{
|
|
12095
|
+
control: form.control,
|
|
12096
|
+
name: "email",
|
|
12097
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12098
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
12099
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12100
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12101
|
+
] })
|
|
12102
|
+
}
|
|
12103
|
+
) }),
|
|
12104
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12105
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12106
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12107
|
+
] }) })
|
|
12108
|
+
]
|
|
12109
|
+
}
|
|
12110
|
+
) });
|
|
12111
|
+
};
|
|
12112
|
+
const schema = objectType({
|
|
12113
|
+
email: stringType().email()
|
|
12114
|
+
});
|
|
12115
12115
|
const NumberInput = forwardRef(
|
|
12116
12116
|
({
|
|
12117
12117
|
value,
|
|
@@ -13061,10 +13061,6 @@ const routeModule = {
|
|
|
13061
13061
|
Component: BillingAddress,
|
|
13062
13062
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13063
|
},
|
|
13064
|
-
{
|
|
13065
|
-
Component: Email,
|
|
13066
|
-
path: "/draft-orders/:id/email"
|
|
13067
|
-
},
|
|
13068
13064
|
{
|
|
13069
13065
|
Component: CustomItems,
|
|
13070
13066
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13093,6 +13089,10 @@ const routeModule = {
|
|
|
13093
13089
|
Component: TransferOwnership,
|
|
13094
13090
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
13091
|
},
|
|
13092
|
+
{
|
|
13093
|
+
Component: Email,
|
|
13094
|
+
path: "/draft-orders/:id/email"
|
|
13095
|
+
},
|
|
13096
13096
|
{
|
|
13097
13097
|
Component: Items,
|
|
13098
13098
|
path: "/draft-orders/:id/items"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.1-snapshot-
|
|
3
|
+
"version": "2.11.1-snapshot-20251022072519",
|
|
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.11.1-snapshot-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.1-snapshot-20251022072519",
|
|
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,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.11.1-snapshot-
|
|
49
|
-
"@medusajs/cli": "2.11.1-snapshot-
|
|
50
|
-
"@medusajs/framework": "2.11.1-snapshot-
|
|
51
|
-
"@medusajs/icons": "2.11.1-snapshot-
|
|
52
|
-
"@medusajs/test-utils": "2.11.1-snapshot-
|
|
53
|
-
"@medusajs/types": "2.11.1-snapshot-
|
|
54
|
-
"@medusajs/ui": "4.0.25-snapshot-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.1-snapshot-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.1-snapshot-20251022072519",
|
|
49
|
+
"@medusajs/cli": "2.11.1-snapshot-20251022072519",
|
|
50
|
+
"@medusajs/framework": "2.11.1-snapshot-20251022072519",
|
|
51
|
+
"@medusajs/icons": "2.11.1-snapshot-20251022072519",
|
|
52
|
+
"@medusajs/test-utils": "2.11.1-snapshot-20251022072519",
|
|
53
|
+
"@medusajs/types": "2.11.1-snapshot-20251022072519",
|
|
54
|
+
"@medusajs/ui": "4.0.25-snapshot-20251022072519",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.1-snapshot-20251022072519",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.11.1-snapshot-
|
|
73
|
-
"@medusajs/cli": "2.11.1-snapshot-
|
|
74
|
-
"@medusajs/framework": "2.11.1-snapshot-
|
|
75
|
-
"@medusajs/icons": "2.11.1-snapshot-
|
|
76
|
-
"@medusajs/test-utils": "2.11.1-snapshot-
|
|
77
|
-
"@medusajs/ui": "4.0.25-snapshot-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.1-snapshot-20251022072519",
|
|
73
|
+
"@medusajs/cli": "2.11.1-snapshot-20251022072519",
|
|
74
|
+
"@medusajs/framework": "2.11.1-snapshot-20251022072519",
|
|
75
|
+
"@medusajs/icons": "2.11.1-snapshot-20251022072519",
|
|
76
|
+
"@medusajs/test-utils": "2.11.1-snapshot-20251022072519",
|
|
77
|
+
"@medusajs/ui": "4.0.25-snapshot-20251022072519",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|