@medusajs/draft-order 2.10.0-preview-20250828135607 → 2.10.0-preview-20250828150148
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 +78 -78
- package/.medusa/server/src/admin/index.mjs +78 -78
- package/package.json +16 -16
|
@@ -9771,74 +9771,6 @@ const CustomItemsForm = () => {
|
|
|
9771
9771
|
const schema$4 = objectType({
|
|
9772
9772
|
email: stringType().email()
|
|
9773
9773
|
});
|
|
9774
|
-
const Email = () => {
|
|
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;
|
|
9783
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9784
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9785
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
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 })
|
|
9789
|
-
] });
|
|
9790
|
-
};
|
|
9791
|
-
const EmailForm = ({ order }) => {
|
|
9792
|
-
const form = reactHookForm.useForm({
|
|
9793
|
-
defaultValues: {
|
|
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
|
-
);
|
|
9812
|
-
});
|
|
9813
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9814
|
-
KeyboundForm,
|
|
9815
|
-
{
|
|
9816
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9817
|
-
onSubmit,
|
|
9818
|
-
children: [
|
|
9819
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
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
|
-
) });
|
|
9838
|
-
};
|
|
9839
|
-
const schema$3 = objectType({
|
|
9840
|
-
email: stringType().email()
|
|
9841
|
-
});
|
|
9842
9774
|
const NumberInput = React.forwardRef(
|
|
9843
9775
|
({
|
|
9844
9776
|
value,
|
|
@@ -11468,7 +11400,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11468
11400
|
defaultValues: {
|
|
11469
11401
|
sales_channel_id: order.sales_channel_id || ""
|
|
11470
11402
|
},
|
|
11471
|
-
resolver: zod.zodResolver(schema$
|
|
11403
|
+
resolver: zod.zodResolver(schema$3)
|
|
11472
11404
|
});
|
|
11473
11405
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11474
11406
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11543,7 +11475,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11543
11475
|
}
|
|
11544
11476
|
);
|
|
11545
11477
|
};
|
|
11546
|
-
const schema$
|
|
11478
|
+
const schema$3 = objectType({
|
|
11547
11479
|
sales_channel_id: stringType().min(1)
|
|
11548
11480
|
});
|
|
11549
11481
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12385,7 +12317,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12385
12317
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12386
12318
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12387
12319
|
},
|
|
12388
|
-
resolver: zod.zodResolver(schema$
|
|
12320
|
+
resolver: zod.zodResolver(schema$2)
|
|
12389
12321
|
});
|
|
12390
12322
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12391
12323
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12555,7 +12487,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12555
12487
|
}
|
|
12556
12488
|
) });
|
|
12557
12489
|
};
|
|
12558
|
-
const schema$
|
|
12490
|
+
const schema$2 = addressSchema;
|
|
12559
12491
|
const TransferOwnership = () => {
|
|
12560
12492
|
const { id } = reactRouterDom.useParams();
|
|
12561
12493
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12579,7 +12511,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12579
12511
|
defaultValues: {
|
|
12580
12512
|
customer_id: order.customer_id || ""
|
|
12581
12513
|
},
|
|
12582
|
-
resolver: zod.zodResolver(schema)
|
|
12514
|
+
resolver: zod.zodResolver(schema$1)
|
|
12583
12515
|
});
|
|
12584
12516
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12585
12517
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13029,9 +12961,77 @@ const Illustration = () => {
|
|
|
13029
12961
|
}
|
|
13030
12962
|
);
|
|
13031
12963
|
};
|
|
13032
|
-
const schema = objectType({
|
|
12964
|
+
const schema$1 = objectType({
|
|
13033
12965
|
customer_id: stringType().min(1)
|
|
13034
12966
|
});
|
|
12967
|
+
const Email = () => {
|
|
12968
|
+
const { id } = reactRouterDom.useParams();
|
|
12969
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12970
|
+
fields: "+email"
|
|
12971
|
+
});
|
|
12972
|
+
if (isError) {
|
|
12973
|
+
throw error;
|
|
12974
|
+
}
|
|
12975
|
+
const isReady = !isPending && !!order;
|
|
12976
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12977
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12978
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12979
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12980
|
+
] }),
|
|
12981
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12982
|
+
] });
|
|
12983
|
+
};
|
|
12984
|
+
const EmailForm = ({ order }) => {
|
|
12985
|
+
const form = reactHookForm.useForm({
|
|
12986
|
+
defaultValues: {
|
|
12987
|
+
email: order.email ?? ""
|
|
12988
|
+
},
|
|
12989
|
+
resolver: zod.zodResolver(schema)
|
|
12990
|
+
});
|
|
12991
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12992
|
+
const { handleSuccess } = useRouteModal();
|
|
12993
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12994
|
+
await mutateAsync(
|
|
12995
|
+
{ email: data.email },
|
|
12996
|
+
{
|
|
12997
|
+
onSuccess: () => {
|
|
12998
|
+
handleSuccess();
|
|
12999
|
+
},
|
|
13000
|
+
onError: (error) => {
|
|
13001
|
+
ui.toast.error(error.message);
|
|
13002
|
+
}
|
|
13003
|
+
}
|
|
13004
|
+
);
|
|
13005
|
+
});
|
|
13006
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13007
|
+
KeyboundForm,
|
|
13008
|
+
{
|
|
13009
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13010
|
+
onSubmit,
|
|
13011
|
+
children: [
|
|
13012
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13013
|
+
Form$2.Field,
|
|
13014
|
+
{
|
|
13015
|
+
control: form.control,
|
|
13016
|
+
name: "email",
|
|
13017
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13018
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
13019
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13020
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13021
|
+
] })
|
|
13022
|
+
}
|
|
13023
|
+
) }),
|
|
13024
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13025
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13026
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13027
|
+
] }) })
|
|
13028
|
+
]
|
|
13029
|
+
}
|
|
13030
|
+
) });
|
|
13031
|
+
};
|
|
13032
|
+
const schema = objectType({
|
|
13033
|
+
email: stringType().email()
|
|
13034
|
+
});
|
|
13035
13035
|
const widgetModule = { widgets: [] };
|
|
13036
13036
|
const routeModule = {
|
|
13037
13037
|
routes: [
|
|
@@ -13060,10 +13060,6 @@ const routeModule = {
|
|
|
13060
13060
|
Component: CustomItems,
|
|
13061
13061
|
path: "/draft-orders/:id/custom-items"
|
|
13062
13062
|
},
|
|
13063
|
-
{
|
|
13064
|
-
Component: Email,
|
|
13065
|
-
path: "/draft-orders/:id/email"
|
|
13066
|
-
},
|
|
13067
13063
|
{
|
|
13068
13064
|
Component: Items,
|
|
13069
13065
|
path: "/draft-orders/:id/items"
|
|
@@ -13091,6 +13087,10 @@ const routeModule = {
|
|
|
13091
13087
|
{
|
|
13092
13088
|
Component: TransferOwnership,
|
|
13093
13089
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13090
|
+
},
|
|
13091
|
+
{
|
|
13092
|
+
Component: Email,
|
|
13093
|
+
path: "/draft-orders/:id/email"
|
|
13094
13094
|
}
|
|
13095
13095
|
]
|
|
13096
13096
|
}
|
|
@@ -9765,74 +9765,6 @@ const CustomItemsForm = () => {
|
|
|
9765
9765
|
const schema$4 = objectType({
|
|
9766
9766
|
email: stringType().email()
|
|
9767
9767
|
});
|
|
9768
|
-
const Email = () => {
|
|
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;
|
|
9777
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9778
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9779
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
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 })
|
|
9783
|
-
] });
|
|
9784
|
-
};
|
|
9785
|
-
const EmailForm = ({ order }) => {
|
|
9786
|
-
const form = useForm({
|
|
9787
|
-
defaultValues: {
|
|
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
|
-
);
|
|
9806
|
-
});
|
|
9807
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9808
|
-
KeyboundForm,
|
|
9809
|
-
{
|
|
9810
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9811
|
-
onSubmit,
|
|
9812
|
-
children: [
|
|
9813
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
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
|
-
) });
|
|
9832
|
-
};
|
|
9833
|
-
const schema$3 = objectType({
|
|
9834
|
-
email: stringType().email()
|
|
9835
|
-
});
|
|
9836
9768
|
const NumberInput = forwardRef(
|
|
9837
9769
|
({
|
|
9838
9770
|
value,
|
|
@@ -11462,7 +11394,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11462
11394
|
defaultValues: {
|
|
11463
11395
|
sales_channel_id: order.sales_channel_id || ""
|
|
11464
11396
|
},
|
|
11465
|
-
resolver: zodResolver(schema$
|
|
11397
|
+
resolver: zodResolver(schema$3)
|
|
11466
11398
|
});
|
|
11467
11399
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11468
11400
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11537,7 +11469,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11537
11469
|
}
|
|
11538
11470
|
);
|
|
11539
11471
|
};
|
|
11540
|
-
const schema$
|
|
11472
|
+
const schema$3 = objectType({
|
|
11541
11473
|
sales_channel_id: stringType().min(1)
|
|
11542
11474
|
});
|
|
11543
11475
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12379,7 +12311,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12379
12311
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12380
12312
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12381
12313
|
},
|
|
12382
|
-
resolver: zodResolver(schema$
|
|
12314
|
+
resolver: zodResolver(schema$2)
|
|
12383
12315
|
});
|
|
12384
12316
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12385
12317
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12549,7 +12481,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12549
12481
|
}
|
|
12550
12482
|
) });
|
|
12551
12483
|
};
|
|
12552
|
-
const schema$
|
|
12484
|
+
const schema$2 = addressSchema;
|
|
12553
12485
|
const TransferOwnership = () => {
|
|
12554
12486
|
const { id } = useParams();
|
|
12555
12487
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12573,7 +12505,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12573
12505
|
defaultValues: {
|
|
12574
12506
|
customer_id: order.customer_id || ""
|
|
12575
12507
|
},
|
|
12576
|
-
resolver: zodResolver(schema)
|
|
12508
|
+
resolver: zodResolver(schema$1)
|
|
12577
12509
|
});
|
|
12578
12510
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12579
12511
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13023,9 +12955,77 @@ const Illustration = () => {
|
|
|
13023
12955
|
}
|
|
13024
12956
|
);
|
|
13025
12957
|
};
|
|
13026
|
-
const schema = objectType({
|
|
12958
|
+
const schema$1 = objectType({
|
|
13027
12959
|
customer_id: stringType().min(1)
|
|
13028
12960
|
});
|
|
12961
|
+
const Email = () => {
|
|
12962
|
+
const { id } = useParams();
|
|
12963
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12964
|
+
fields: "+email"
|
|
12965
|
+
});
|
|
12966
|
+
if (isError) {
|
|
12967
|
+
throw error;
|
|
12968
|
+
}
|
|
12969
|
+
const isReady = !isPending && !!order;
|
|
12970
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12971
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12972
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12973
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12974
|
+
] }),
|
|
12975
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12976
|
+
] });
|
|
12977
|
+
};
|
|
12978
|
+
const EmailForm = ({ order }) => {
|
|
12979
|
+
const form = useForm({
|
|
12980
|
+
defaultValues: {
|
|
12981
|
+
email: order.email ?? ""
|
|
12982
|
+
},
|
|
12983
|
+
resolver: zodResolver(schema)
|
|
12984
|
+
});
|
|
12985
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12986
|
+
const { handleSuccess } = useRouteModal();
|
|
12987
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12988
|
+
await mutateAsync(
|
|
12989
|
+
{ email: data.email },
|
|
12990
|
+
{
|
|
12991
|
+
onSuccess: () => {
|
|
12992
|
+
handleSuccess();
|
|
12993
|
+
},
|
|
12994
|
+
onError: (error) => {
|
|
12995
|
+
toast.error(error.message);
|
|
12996
|
+
}
|
|
12997
|
+
}
|
|
12998
|
+
);
|
|
12999
|
+
});
|
|
13000
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13001
|
+
KeyboundForm,
|
|
13002
|
+
{
|
|
13003
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13004
|
+
onSubmit,
|
|
13005
|
+
children: [
|
|
13006
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13007
|
+
Form$2.Field,
|
|
13008
|
+
{
|
|
13009
|
+
control: form.control,
|
|
13010
|
+
name: "email",
|
|
13011
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13012
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13013
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13014
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13015
|
+
] })
|
|
13016
|
+
}
|
|
13017
|
+
) }),
|
|
13018
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13019
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13020
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13021
|
+
] }) })
|
|
13022
|
+
]
|
|
13023
|
+
}
|
|
13024
|
+
) });
|
|
13025
|
+
};
|
|
13026
|
+
const schema = objectType({
|
|
13027
|
+
email: stringType().email()
|
|
13028
|
+
});
|
|
13029
13029
|
const widgetModule = { widgets: [] };
|
|
13030
13030
|
const routeModule = {
|
|
13031
13031
|
routes: [
|
|
@@ -13054,10 +13054,6 @@ const routeModule = {
|
|
|
13054
13054
|
Component: CustomItems,
|
|
13055
13055
|
path: "/draft-orders/:id/custom-items"
|
|
13056
13056
|
},
|
|
13057
|
-
{
|
|
13058
|
-
Component: Email,
|
|
13059
|
-
path: "/draft-orders/:id/email"
|
|
13060
|
-
},
|
|
13061
13057
|
{
|
|
13062
13058
|
Component: Items,
|
|
13063
13059
|
path: "/draft-orders/:id/items"
|
|
@@ -13085,6 +13081,10 @@ const routeModule = {
|
|
|
13085
13081
|
{
|
|
13086
13082
|
Component: TransferOwnership,
|
|
13087
13083
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13084
|
+
},
|
|
13085
|
+
{
|
|
13086
|
+
Component: Email,
|
|
13087
|
+
path: "/draft-orders/:id/email"
|
|
13088
13088
|
}
|
|
13089
13089
|
]
|
|
13090
13090
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.0-preview-
|
|
3
|
+
"version": "2.10.0-preview-20250828150148",
|
|
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-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.0-preview-20250828150148",
|
|
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.10.0-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.0-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.0-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.0-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.0-preview-
|
|
53
|
-
"@medusajs/types": "2.10.0-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.20-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.0-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.0-preview-20250828150148",
|
|
49
|
+
"@medusajs/cli": "2.10.0-preview-20250828150148",
|
|
50
|
+
"@medusajs/framework": "2.10.0-preview-20250828150148",
|
|
51
|
+
"@medusajs/icons": "2.10.0-preview-20250828150148",
|
|
52
|
+
"@medusajs/test-utils": "2.10.0-preview-20250828150148",
|
|
53
|
+
"@medusajs/types": "2.10.0-preview-20250828150148",
|
|
54
|
+
"@medusajs/ui": "4.0.20-preview-20250828150148",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.0-preview-20250828150148",
|
|
56
56
|
"@mikro-orm/cli": "6.4.3",
|
|
57
57
|
"@mikro-orm/core": "6.4.3",
|
|
58
58
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"yalc": "^1.0.0-pre.53"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@medusajs/admin-sdk": "2.10.0-preview-
|
|
80
|
-
"@medusajs/cli": "2.10.0-preview-
|
|
81
|
-
"@medusajs/framework": "2.10.0-preview-
|
|
82
|
-
"@medusajs/icons": "2.10.0-preview-
|
|
83
|
-
"@medusajs/test-utils": "2.10.0-preview-
|
|
84
|
-
"@medusajs/ui": "4.0.20-preview-
|
|
79
|
+
"@medusajs/admin-sdk": "2.10.0-preview-20250828150148",
|
|
80
|
+
"@medusajs/cli": "2.10.0-preview-20250828150148",
|
|
81
|
+
"@medusajs/framework": "2.10.0-preview-20250828150148",
|
|
82
|
+
"@medusajs/icons": "2.10.0-preview-20250828150148",
|
|
83
|
+
"@medusajs/test-utils": "2.10.0-preview-20250828150148",
|
|
84
|
+
"@medusajs/ui": "4.0.20-preview-20250828150148",
|
|
85
85
|
"@mikro-orm/cli": "6.4.3",
|
|
86
86
|
"@mikro-orm/core": "6.4.3",
|
|
87
87
|
"@mikro-orm/knex": "6.4.3",
|