@medusajs/draft-order 2.11.4-preview-20251121210133 → 2.11.4-preview-20251122000259
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
|
@@ -11107,74 +11107,6 @@ function getHasUneditableRows(metadata) {
|
|
|
11107
11107
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11108
11108
|
);
|
|
11109
11109
|
}
|
|
11110
|
-
const Email = () => {
|
|
11111
|
-
const { id } = reactRouterDom.useParams();
|
|
11112
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11113
|
-
fields: "+email"
|
|
11114
|
-
});
|
|
11115
|
-
if (isError) {
|
|
11116
|
-
throw error;
|
|
11117
|
-
}
|
|
11118
|
-
const isReady = !isPending && !!order;
|
|
11119
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11120
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11121
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
11122
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11123
|
-
] }),
|
|
11124
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
11125
|
-
] });
|
|
11126
|
-
};
|
|
11127
|
-
const EmailForm = ({ order }) => {
|
|
11128
|
-
const form = reactHookForm.useForm({
|
|
11129
|
-
defaultValues: {
|
|
11130
|
-
email: order.email ?? ""
|
|
11131
|
-
},
|
|
11132
|
-
resolver: zod.zodResolver(schema$3)
|
|
11133
|
-
});
|
|
11134
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11135
|
-
const { handleSuccess } = useRouteModal();
|
|
11136
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11137
|
-
await mutateAsync(
|
|
11138
|
-
{ email: data.email },
|
|
11139
|
-
{
|
|
11140
|
-
onSuccess: () => {
|
|
11141
|
-
handleSuccess();
|
|
11142
|
-
},
|
|
11143
|
-
onError: (error) => {
|
|
11144
|
-
ui.toast.error(error.message);
|
|
11145
|
-
}
|
|
11146
|
-
}
|
|
11147
|
-
);
|
|
11148
|
-
});
|
|
11149
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11150
|
-
KeyboundForm,
|
|
11151
|
-
{
|
|
11152
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11153
|
-
onSubmit,
|
|
11154
|
-
children: [
|
|
11155
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11156
|
-
Form$2.Field,
|
|
11157
|
-
{
|
|
11158
|
-
control: form.control,
|
|
11159
|
-
name: "email",
|
|
11160
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11161
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
11162
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11163
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11164
|
-
] })
|
|
11165
|
-
}
|
|
11166
|
-
) }),
|
|
11167
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11168
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11169
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11170
|
-
] }) })
|
|
11171
|
-
]
|
|
11172
|
-
}
|
|
11173
|
-
) });
|
|
11174
|
-
};
|
|
11175
|
-
const schema$3 = objectType({
|
|
11176
|
-
email: stringType().email()
|
|
11177
|
-
});
|
|
11178
11110
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11179
11111
|
const promotionsQueryKeys = {
|
|
11180
11112
|
list: (query2) => [
|
|
@@ -11480,7 +11412,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11480
11412
|
defaultValues: {
|
|
11481
11413
|
sales_channel_id: order.sales_channel_id || ""
|
|
11482
11414
|
},
|
|
11483
|
-
resolver: zod.zodResolver(schema$
|
|
11415
|
+
resolver: zod.zodResolver(schema$3)
|
|
11484
11416
|
});
|
|
11485
11417
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11486
11418
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11555,7 +11487,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11555
11487
|
}
|
|
11556
11488
|
);
|
|
11557
11489
|
};
|
|
11558
|
-
const schema$
|
|
11490
|
+
const schema$3 = objectType({
|
|
11559
11491
|
sales_channel_id: stringType().min(1)
|
|
11560
11492
|
});
|
|
11561
11493
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12397,7 +12329,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12397
12329
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12398
12330
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12399
12331
|
},
|
|
12400
|
-
resolver: zod.zodResolver(schema$
|
|
12332
|
+
resolver: zod.zodResolver(schema$2)
|
|
12401
12333
|
});
|
|
12402
12334
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12403
12335
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12567,7 +12499,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12567
12499
|
}
|
|
12568
12500
|
) });
|
|
12569
12501
|
};
|
|
12570
|
-
const schema$
|
|
12502
|
+
const schema$2 = addressSchema;
|
|
12571
12503
|
const TransferOwnership = () => {
|
|
12572
12504
|
const { id } = reactRouterDom.useParams();
|
|
12573
12505
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12591,7 +12523,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12591
12523
|
defaultValues: {
|
|
12592
12524
|
customer_id: order.customer_id || ""
|
|
12593
12525
|
},
|
|
12594
|
-
resolver: zod.zodResolver(schema)
|
|
12526
|
+
resolver: zod.zodResolver(schema$1)
|
|
12595
12527
|
});
|
|
12596
12528
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12597
12529
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13041,9 +12973,77 @@ const Illustration = () => {
|
|
|
13041
12973
|
}
|
|
13042
12974
|
);
|
|
13043
12975
|
};
|
|
13044
|
-
const schema = objectType({
|
|
12976
|
+
const schema$1 = objectType({
|
|
13045
12977
|
customer_id: stringType().min(1)
|
|
13046
12978
|
});
|
|
12979
|
+
const Email = () => {
|
|
12980
|
+
const { id } = reactRouterDom.useParams();
|
|
12981
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12982
|
+
fields: "+email"
|
|
12983
|
+
});
|
|
12984
|
+
if (isError) {
|
|
12985
|
+
throw error;
|
|
12986
|
+
}
|
|
12987
|
+
const isReady = !isPending && !!order;
|
|
12988
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12989
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12990
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12991
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12992
|
+
] }),
|
|
12993
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12994
|
+
] });
|
|
12995
|
+
};
|
|
12996
|
+
const EmailForm = ({ order }) => {
|
|
12997
|
+
const form = reactHookForm.useForm({
|
|
12998
|
+
defaultValues: {
|
|
12999
|
+
email: order.email ?? ""
|
|
13000
|
+
},
|
|
13001
|
+
resolver: zod.zodResolver(schema)
|
|
13002
|
+
});
|
|
13003
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13004
|
+
const { handleSuccess } = useRouteModal();
|
|
13005
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
13006
|
+
await mutateAsync(
|
|
13007
|
+
{ email: data.email },
|
|
13008
|
+
{
|
|
13009
|
+
onSuccess: () => {
|
|
13010
|
+
handleSuccess();
|
|
13011
|
+
},
|
|
13012
|
+
onError: (error) => {
|
|
13013
|
+
ui.toast.error(error.message);
|
|
13014
|
+
}
|
|
13015
|
+
}
|
|
13016
|
+
);
|
|
13017
|
+
});
|
|
13018
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13019
|
+
KeyboundForm,
|
|
13020
|
+
{
|
|
13021
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13022
|
+
onSubmit,
|
|
13023
|
+
children: [
|
|
13024
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13025
|
+
Form$2.Field,
|
|
13026
|
+
{
|
|
13027
|
+
control: form.control,
|
|
13028
|
+
name: "email",
|
|
13029
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13030
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
13031
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13033
|
+
] })
|
|
13034
|
+
}
|
|
13035
|
+
) }),
|
|
13036
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13037
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13038
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13039
|
+
] }) })
|
|
13040
|
+
]
|
|
13041
|
+
}
|
|
13042
|
+
) });
|
|
13043
|
+
};
|
|
13044
|
+
const schema = objectType({
|
|
13045
|
+
email: stringType().email()
|
|
13046
|
+
});
|
|
13047
13047
|
const widgetModule = { widgets: [] };
|
|
13048
13048
|
const routeModule = {
|
|
13049
13049
|
routes: [
|
|
@@ -13080,10 +13080,6 @@ const routeModule = {
|
|
|
13080
13080
|
Component: Metadata,
|
|
13081
13081
|
path: "/draft-orders/:id/metadata"
|
|
13082
13082
|
},
|
|
13083
|
-
{
|
|
13084
|
-
Component: Email,
|
|
13085
|
-
path: "/draft-orders/:id/email"
|
|
13086
|
-
},
|
|
13087
13083
|
{
|
|
13088
13084
|
Component: Promotions,
|
|
13089
13085
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13103,6 +13099,10 @@ const routeModule = {
|
|
|
13103
13099
|
{
|
|
13104
13100
|
Component: TransferOwnership,
|
|
13105
13101
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13102
|
+
},
|
|
13103
|
+
{
|
|
13104
|
+
Component: Email,
|
|
13105
|
+
path: "/draft-orders/:id/email"
|
|
13106
13106
|
}
|
|
13107
13107
|
]
|
|
13108
13108
|
}
|
|
@@ -11100,74 +11100,6 @@ function getHasUneditableRows(metadata) {
|
|
|
11100
11100
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11101
11101
|
);
|
|
11102
11102
|
}
|
|
11103
|
-
const Email = () => {
|
|
11104
|
-
const { id } = useParams();
|
|
11105
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11106
|
-
fields: "+email"
|
|
11107
|
-
});
|
|
11108
|
-
if (isError) {
|
|
11109
|
-
throw error;
|
|
11110
|
-
}
|
|
11111
|
-
const isReady = !isPending && !!order;
|
|
11112
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11113
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11114
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
11115
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11116
|
-
] }),
|
|
11117
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
11118
|
-
] });
|
|
11119
|
-
};
|
|
11120
|
-
const EmailForm = ({ order }) => {
|
|
11121
|
-
const form = useForm({
|
|
11122
|
-
defaultValues: {
|
|
11123
|
-
email: order.email ?? ""
|
|
11124
|
-
},
|
|
11125
|
-
resolver: zodResolver(schema$3)
|
|
11126
|
-
});
|
|
11127
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11128
|
-
const { handleSuccess } = useRouteModal();
|
|
11129
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11130
|
-
await mutateAsync(
|
|
11131
|
-
{ email: data.email },
|
|
11132
|
-
{
|
|
11133
|
-
onSuccess: () => {
|
|
11134
|
-
handleSuccess();
|
|
11135
|
-
},
|
|
11136
|
-
onError: (error) => {
|
|
11137
|
-
toast.error(error.message);
|
|
11138
|
-
}
|
|
11139
|
-
}
|
|
11140
|
-
);
|
|
11141
|
-
});
|
|
11142
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11143
|
-
KeyboundForm,
|
|
11144
|
-
{
|
|
11145
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11146
|
-
onSubmit,
|
|
11147
|
-
children: [
|
|
11148
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
11149
|
-
Form$2.Field,
|
|
11150
|
-
{
|
|
11151
|
-
control: form.control,
|
|
11152
|
-
name: "email",
|
|
11153
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11154
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
11155
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11156
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11157
|
-
] })
|
|
11158
|
-
}
|
|
11159
|
-
) }),
|
|
11160
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11161
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11162
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11163
|
-
] }) })
|
|
11164
|
-
]
|
|
11165
|
-
}
|
|
11166
|
-
) });
|
|
11167
|
-
};
|
|
11168
|
-
const schema$3 = objectType({
|
|
11169
|
-
email: stringType().email()
|
|
11170
|
-
});
|
|
11171
11103
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11172
11104
|
const promotionsQueryKeys = {
|
|
11173
11105
|
list: (query2) => [
|
|
@@ -11473,7 +11405,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11473
11405
|
defaultValues: {
|
|
11474
11406
|
sales_channel_id: order.sales_channel_id || ""
|
|
11475
11407
|
},
|
|
11476
|
-
resolver: zodResolver(schema$
|
|
11408
|
+
resolver: zodResolver(schema$3)
|
|
11477
11409
|
});
|
|
11478
11410
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11479
11411
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11548,7 +11480,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11548
11480
|
}
|
|
11549
11481
|
);
|
|
11550
11482
|
};
|
|
11551
|
-
const schema$
|
|
11483
|
+
const schema$3 = objectType({
|
|
11552
11484
|
sales_channel_id: stringType().min(1)
|
|
11553
11485
|
});
|
|
11554
11486
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12390,7 +12322,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12390
12322
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12391
12323
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12392
12324
|
},
|
|
12393
|
-
resolver: zodResolver(schema$
|
|
12325
|
+
resolver: zodResolver(schema$2)
|
|
12394
12326
|
});
|
|
12395
12327
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12396
12328
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12560,7 +12492,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12560
12492
|
}
|
|
12561
12493
|
) });
|
|
12562
12494
|
};
|
|
12563
|
-
const schema$
|
|
12495
|
+
const schema$2 = addressSchema;
|
|
12564
12496
|
const TransferOwnership = () => {
|
|
12565
12497
|
const { id } = useParams();
|
|
12566
12498
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12584,7 +12516,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12584
12516
|
defaultValues: {
|
|
12585
12517
|
customer_id: order.customer_id || ""
|
|
12586
12518
|
},
|
|
12587
|
-
resolver: zodResolver(schema)
|
|
12519
|
+
resolver: zodResolver(schema$1)
|
|
12588
12520
|
});
|
|
12589
12521
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12590
12522
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13034,9 +12966,77 @@ const Illustration = () => {
|
|
|
13034
12966
|
}
|
|
13035
12967
|
);
|
|
13036
12968
|
};
|
|
13037
|
-
const schema = objectType({
|
|
12969
|
+
const schema$1 = objectType({
|
|
13038
12970
|
customer_id: stringType().min(1)
|
|
13039
12971
|
});
|
|
12972
|
+
const Email = () => {
|
|
12973
|
+
const { id } = useParams();
|
|
12974
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12975
|
+
fields: "+email"
|
|
12976
|
+
});
|
|
12977
|
+
if (isError) {
|
|
12978
|
+
throw error;
|
|
12979
|
+
}
|
|
12980
|
+
const isReady = !isPending && !!order;
|
|
12981
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12982
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12983
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12984
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12985
|
+
] }),
|
|
12986
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12987
|
+
] });
|
|
12988
|
+
};
|
|
12989
|
+
const EmailForm = ({ order }) => {
|
|
12990
|
+
const form = useForm({
|
|
12991
|
+
defaultValues: {
|
|
12992
|
+
email: order.email ?? ""
|
|
12993
|
+
},
|
|
12994
|
+
resolver: zodResolver(schema)
|
|
12995
|
+
});
|
|
12996
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12997
|
+
const { handleSuccess } = useRouteModal();
|
|
12998
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12999
|
+
await mutateAsync(
|
|
13000
|
+
{ email: data.email },
|
|
13001
|
+
{
|
|
13002
|
+
onSuccess: () => {
|
|
13003
|
+
handleSuccess();
|
|
13004
|
+
},
|
|
13005
|
+
onError: (error) => {
|
|
13006
|
+
toast.error(error.message);
|
|
13007
|
+
}
|
|
13008
|
+
}
|
|
13009
|
+
);
|
|
13010
|
+
});
|
|
13011
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13012
|
+
KeyboundForm,
|
|
13013
|
+
{
|
|
13014
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13015
|
+
onSubmit,
|
|
13016
|
+
children: [
|
|
13017
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13018
|
+
Form$2.Field,
|
|
13019
|
+
{
|
|
13020
|
+
control: form.control,
|
|
13021
|
+
name: "email",
|
|
13022
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13023
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13024
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13025
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13026
|
+
] })
|
|
13027
|
+
}
|
|
13028
|
+
) }),
|
|
13029
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13030
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13031
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13032
|
+
] }) })
|
|
13033
|
+
]
|
|
13034
|
+
}
|
|
13035
|
+
) });
|
|
13036
|
+
};
|
|
13037
|
+
const schema = objectType({
|
|
13038
|
+
email: stringType().email()
|
|
13039
|
+
});
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13073,10 +13073,6 @@ const routeModule = {
|
|
|
13073
13073
|
Component: Metadata,
|
|
13074
13074
|
path: "/draft-orders/:id/metadata"
|
|
13075
13075
|
},
|
|
13076
|
-
{
|
|
13077
|
-
Component: Email,
|
|
13078
|
-
path: "/draft-orders/:id/email"
|
|
13079
|
-
},
|
|
13080
13076
|
{
|
|
13081
13077
|
Component: Promotions,
|
|
13082
13078
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13096,6 +13092,10 @@ const routeModule = {
|
|
|
13096
13092
|
{
|
|
13097
13093
|
Component: TransferOwnership,
|
|
13098
13094
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: Email,
|
|
13098
|
+
path: "/draft-orders/:id/email"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.4-preview-
|
|
3
|
+
"version": "2.11.4-preview-20251122000259",
|
|
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": "2.11.4-preview-
|
|
40
|
+
"@medusajs/js-sdk": "2.11.4-preview-20251122000259",
|
|
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,22 +48,22 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "2.11.4-preview-
|
|
52
|
-
"@medusajs/cli": "2.11.4-preview-
|
|
53
|
-
"@medusajs/framework": "2.11.4-preview-
|
|
54
|
-
"@medusajs/icons": "2.11.4-preview-
|
|
55
|
-
"@medusajs/test-utils": "2.11.4-preview-
|
|
56
|
-
"@medusajs/types": "2.11.4-preview-
|
|
57
|
-
"@medusajs/ui": "4.0.28-preview-
|
|
58
|
-
"@medusajs/ui-preset": "2.11.4-preview-
|
|
51
|
+
"@medusajs/admin-sdk": "2.11.4-preview-20251122000259",
|
|
52
|
+
"@medusajs/cli": "2.11.4-preview-20251122000259",
|
|
53
|
+
"@medusajs/framework": "2.11.4-preview-20251122000259",
|
|
54
|
+
"@medusajs/icons": "2.11.4-preview-20251122000259",
|
|
55
|
+
"@medusajs/test-utils": "2.11.4-preview-20251122000259",
|
|
56
|
+
"@medusajs/types": "2.11.4-preview-20251122000259",
|
|
57
|
+
"@medusajs/ui": "4.0.28-preview-20251122000259",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.4-preview-20251122000259"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "2.11.4-preview-
|
|
62
|
-
"@medusajs/cli": "2.11.4-preview-
|
|
63
|
-
"@medusajs/framework": "2.11.4-preview-
|
|
64
|
-
"@medusajs/icons": "2.11.4-preview-
|
|
65
|
-
"@medusajs/test-utils": "2.11.4-preview-
|
|
66
|
-
"@medusajs/ui": "4.0.28-preview-
|
|
61
|
+
"@medusajs/admin-sdk": "2.11.4-preview-20251122000259",
|
|
62
|
+
"@medusajs/cli": "2.11.4-preview-20251122000259",
|
|
63
|
+
"@medusajs/framework": "2.11.4-preview-20251122000259",
|
|
64
|
+
"@medusajs/icons": "2.11.4-preview-20251122000259",
|
|
65
|
+
"@medusajs/test-utils": "2.11.4-preview-20251122000259",
|
|
66
|
+
"@medusajs/ui": "4.0.28-preview-20251122000259",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|