@medusajs/draft-order 2.15.2 → 2.15.3-preview-20260514122911
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 +103 -103
- package/.medusa/server/src/admin/index.mjs +103 -103
- package/package.json +16 -16
|
@@ -10089,95 +10089,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
10089
10089
|
) });
|
|
10090
10090
|
};
|
|
10091
10091
|
const schema$5 = addressSchema;
|
|
10092
|
-
const CustomItems = () => {
|
|
10093
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10094
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
10095
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
10096
|
-
] });
|
|
10097
|
-
};
|
|
10098
|
-
const CustomItemsForm = () => {
|
|
10099
|
-
const form = reactHookForm.useForm({
|
|
10100
|
-
resolver: zod.zodResolver(schema$4)
|
|
10101
|
-
});
|
|
10102
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10103
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
10104
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10105
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10106
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
10107
|
-
] }) })
|
|
10108
|
-
] }) });
|
|
10109
|
-
};
|
|
10110
|
-
const schema$4 = object({
|
|
10111
|
-
email: string().email()
|
|
10112
|
-
});
|
|
10113
|
-
const Email = () => {
|
|
10114
|
-
const { id } = reactRouterDom.useParams();
|
|
10115
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10116
|
-
fields: "+email"
|
|
10117
|
-
});
|
|
10118
|
-
if (isError) {
|
|
10119
|
-
throw error;
|
|
10120
|
-
}
|
|
10121
|
-
const isReady = !isPending && !!order;
|
|
10122
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10123
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10124
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10125
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10126
|
-
] }),
|
|
10127
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10128
|
-
] });
|
|
10129
|
-
};
|
|
10130
|
-
const EmailForm = ({ order }) => {
|
|
10131
|
-
const form = reactHookForm.useForm({
|
|
10132
|
-
defaultValues: {
|
|
10133
|
-
email: order.email ?? ""
|
|
10134
|
-
},
|
|
10135
|
-
resolver: zod.zodResolver(schema$3)
|
|
10136
|
-
});
|
|
10137
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10138
|
-
const { handleSuccess } = useRouteModal();
|
|
10139
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10140
|
-
await mutateAsync(
|
|
10141
|
-
{ email: data.email },
|
|
10142
|
-
{
|
|
10143
|
-
onSuccess: () => {
|
|
10144
|
-
handleSuccess();
|
|
10145
|
-
},
|
|
10146
|
-
onError: (error) => {
|
|
10147
|
-
ui.toast.error(error.message);
|
|
10148
|
-
}
|
|
10149
|
-
}
|
|
10150
|
-
);
|
|
10151
|
-
});
|
|
10152
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10153
|
-
KeyboundForm,
|
|
10154
|
-
{
|
|
10155
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10156
|
-
onSubmit,
|
|
10157
|
-
children: [
|
|
10158
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10159
|
-
Form$2.Field,
|
|
10160
|
-
{
|
|
10161
|
-
control: form.control,
|
|
10162
|
-
name: "email",
|
|
10163
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10164
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10165
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10166
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10167
|
-
] })
|
|
10168
|
-
}
|
|
10169
|
-
) }),
|
|
10170
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10171
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10172
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10173
|
-
] }) })
|
|
10174
|
-
]
|
|
10175
|
-
}
|
|
10176
|
-
) });
|
|
10177
|
-
};
|
|
10178
|
-
const schema$3 = object({
|
|
10179
|
-
email: string().email()
|
|
10180
|
-
});
|
|
10181
10092
|
const NumberInput = React.forwardRef(
|
|
10182
10093
|
({
|
|
10183
10094
|
value,
|
|
@@ -11502,6 +11413,27 @@ function getHasUneditableRows(metadata) {
|
|
|
11502
11413
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11503
11414
|
);
|
|
11504
11415
|
}
|
|
11416
|
+
const CustomItems = () => {
|
|
11417
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11418
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
11419
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
11420
|
+
] });
|
|
11421
|
+
};
|
|
11422
|
+
const CustomItemsForm = () => {
|
|
11423
|
+
const form = reactHookForm.useForm({
|
|
11424
|
+
resolver: zod.zodResolver(schema$4)
|
|
11425
|
+
});
|
|
11426
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11427
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
11428
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11429
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11430
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
11431
|
+
] }) })
|
|
11432
|
+
] }) });
|
|
11433
|
+
};
|
|
11434
|
+
const schema$4 = object({
|
|
11435
|
+
email: string().email()
|
|
11436
|
+
});
|
|
11505
11437
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11506
11438
|
const promotionsQueryKeys = {
|
|
11507
11439
|
list: (query2) => [
|
|
@@ -11807,7 +11739,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11807
11739
|
defaultValues: {
|
|
11808
11740
|
sales_channel_id: order.sales_channel_id || ""
|
|
11809
11741
|
},
|
|
11810
|
-
resolver: zod.zodResolver(schema$
|
|
11742
|
+
resolver: zod.zodResolver(schema$3)
|
|
11811
11743
|
});
|
|
11812
11744
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11813
11745
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11882,7 +11814,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11882
11814
|
}
|
|
11883
11815
|
);
|
|
11884
11816
|
};
|
|
11885
|
-
const schema$
|
|
11817
|
+
const schema$3 = object({
|
|
11886
11818
|
sales_channel_id: string().min(1)
|
|
11887
11819
|
});
|
|
11888
11820
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12724,7 +12656,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12724
12656
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12725
12657
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12726
12658
|
},
|
|
12727
|
-
resolver: zod.zodResolver(schema$
|
|
12659
|
+
resolver: zod.zodResolver(schema$2)
|
|
12728
12660
|
});
|
|
12729
12661
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12730
12662
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12894,7 +12826,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12894
12826
|
}
|
|
12895
12827
|
) });
|
|
12896
12828
|
};
|
|
12897
|
-
const schema$
|
|
12829
|
+
const schema$2 = addressSchema;
|
|
12898
12830
|
const TransferOwnership = () => {
|
|
12899
12831
|
const { id } = reactRouterDom.useParams();
|
|
12900
12832
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12918,7 +12850,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12918
12850
|
defaultValues: {
|
|
12919
12851
|
customer_id: order.customer_id || ""
|
|
12920
12852
|
},
|
|
12921
|
-
resolver: zod.zodResolver(schema)
|
|
12853
|
+
resolver: zod.zodResolver(schema$1)
|
|
12922
12854
|
});
|
|
12923
12855
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12924
12856
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13368,9 +13300,77 @@ const Illustration = () => {
|
|
|
13368
13300
|
}
|
|
13369
13301
|
);
|
|
13370
13302
|
};
|
|
13371
|
-
const schema = object({
|
|
13303
|
+
const schema$1 = object({
|
|
13372
13304
|
customer_id: string().min(1)
|
|
13373
13305
|
});
|
|
13306
|
+
const Email = () => {
|
|
13307
|
+
const { id } = reactRouterDom.useParams();
|
|
13308
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
13309
|
+
fields: "+email"
|
|
13310
|
+
});
|
|
13311
|
+
if (isError) {
|
|
13312
|
+
throw error;
|
|
13313
|
+
}
|
|
13314
|
+
const isReady = !isPending && !!order;
|
|
13315
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
13316
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
13317
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
13318
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
13319
|
+
] }),
|
|
13320
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
13321
|
+
] });
|
|
13322
|
+
};
|
|
13323
|
+
const EmailForm = ({ order }) => {
|
|
13324
|
+
const form = reactHookForm.useForm({
|
|
13325
|
+
defaultValues: {
|
|
13326
|
+
email: order.email ?? ""
|
|
13327
|
+
},
|
|
13328
|
+
resolver: zod.zodResolver(schema)
|
|
13329
|
+
});
|
|
13330
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13331
|
+
const { handleSuccess } = useRouteModal();
|
|
13332
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
13333
|
+
await mutateAsync(
|
|
13334
|
+
{ email: data.email },
|
|
13335
|
+
{
|
|
13336
|
+
onSuccess: () => {
|
|
13337
|
+
handleSuccess();
|
|
13338
|
+
},
|
|
13339
|
+
onError: (error) => {
|
|
13340
|
+
ui.toast.error(error.message);
|
|
13341
|
+
}
|
|
13342
|
+
}
|
|
13343
|
+
);
|
|
13344
|
+
});
|
|
13345
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13346
|
+
KeyboundForm,
|
|
13347
|
+
{
|
|
13348
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13349
|
+
onSubmit,
|
|
13350
|
+
children: [
|
|
13351
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13352
|
+
Form$2.Field,
|
|
13353
|
+
{
|
|
13354
|
+
control: form.control,
|
|
13355
|
+
name: "email",
|
|
13356
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13357
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
13358
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13359
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13360
|
+
] })
|
|
13361
|
+
}
|
|
13362
|
+
) }),
|
|
13363
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13364
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13365
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13366
|
+
] }) })
|
|
13367
|
+
]
|
|
13368
|
+
}
|
|
13369
|
+
) });
|
|
13370
|
+
};
|
|
13371
|
+
const schema = object({
|
|
13372
|
+
email: string().email()
|
|
13373
|
+
});
|
|
13374
13374
|
const widgetModule = { widgets: [] };
|
|
13375
13375
|
const routeModule = {
|
|
13376
13376
|
routes: [
|
|
@@ -13395,14 +13395,6 @@ const routeModule = {
|
|
|
13395
13395
|
Component: BillingAddress,
|
|
13396
13396
|
path: "/draft-orders/:id/billing-address"
|
|
13397
13397
|
},
|
|
13398
|
-
{
|
|
13399
|
-
Component: CustomItems,
|
|
13400
|
-
path: "/draft-orders/:id/custom-items"
|
|
13401
|
-
},
|
|
13402
|
-
{
|
|
13403
|
-
Component: Email,
|
|
13404
|
-
path: "/draft-orders/:id/email"
|
|
13405
|
-
},
|
|
13406
13398
|
{
|
|
13407
13399
|
Component: Items,
|
|
13408
13400
|
path: "/draft-orders/:id/items"
|
|
@@ -13411,6 +13403,10 @@ const routeModule = {
|
|
|
13411
13403
|
Component: Metadata,
|
|
13412
13404
|
path: "/draft-orders/:id/metadata"
|
|
13413
13405
|
},
|
|
13406
|
+
{
|
|
13407
|
+
Component: CustomItems,
|
|
13408
|
+
path: "/draft-orders/:id/custom-items"
|
|
13409
|
+
},
|
|
13414
13410
|
{
|
|
13415
13411
|
Component: Promotions,
|
|
13416
13412
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13430,6 +13426,10 @@ const routeModule = {
|
|
|
13430
13426
|
{
|
|
13431
13427
|
Component: TransferOwnership,
|
|
13432
13428
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13429
|
+
},
|
|
13430
|
+
{
|
|
13431
|
+
Component: Email,
|
|
13432
|
+
path: "/draft-orders/:id/email"
|
|
13433
13433
|
}
|
|
13434
13434
|
]
|
|
13435
13435
|
}
|
|
@@ -10082,95 +10082,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
10082
10082
|
) });
|
|
10083
10083
|
};
|
|
10084
10084
|
const schema$5 = addressSchema;
|
|
10085
|
-
const CustomItems = () => {
|
|
10086
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10087
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
10088
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
10089
|
-
] });
|
|
10090
|
-
};
|
|
10091
|
-
const CustomItemsForm = () => {
|
|
10092
|
-
const form = useForm({
|
|
10093
|
-
resolver: zodResolver(schema$4)
|
|
10094
|
-
});
|
|
10095
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10096
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
10097
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10098
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10099
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
10100
|
-
] }) })
|
|
10101
|
-
] }) });
|
|
10102
|
-
};
|
|
10103
|
-
const schema$4 = object({
|
|
10104
|
-
email: string().email()
|
|
10105
|
-
});
|
|
10106
|
-
const Email = () => {
|
|
10107
|
-
const { id } = useParams();
|
|
10108
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10109
|
-
fields: "+email"
|
|
10110
|
-
});
|
|
10111
|
-
if (isError) {
|
|
10112
|
-
throw error;
|
|
10113
|
-
}
|
|
10114
|
-
const isReady = !isPending && !!order;
|
|
10115
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10116
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10117
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10118
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10119
|
-
] }),
|
|
10120
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10121
|
-
] });
|
|
10122
|
-
};
|
|
10123
|
-
const EmailForm = ({ order }) => {
|
|
10124
|
-
const form = useForm({
|
|
10125
|
-
defaultValues: {
|
|
10126
|
-
email: order.email ?? ""
|
|
10127
|
-
},
|
|
10128
|
-
resolver: zodResolver(schema$3)
|
|
10129
|
-
});
|
|
10130
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10131
|
-
const { handleSuccess } = useRouteModal();
|
|
10132
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10133
|
-
await mutateAsync(
|
|
10134
|
-
{ email: data.email },
|
|
10135
|
-
{
|
|
10136
|
-
onSuccess: () => {
|
|
10137
|
-
handleSuccess();
|
|
10138
|
-
},
|
|
10139
|
-
onError: (error) => {
|
|
10140
|
-
toast.error(error.message);
|
|
10141
|
-
}
|
|
10142
|
-
}
|
|
10143
|
-
);
|
|
10144
|
-
});
|
|
10145
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10146
|
-
KeyboundForm,
|
|
10147
|
-
{
|
|
10148
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10149
|
-
onSubmit,
|
|
10150
|
-
children: [
|
|
10151
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10152
|
-
Form$2.Field,
|
|
10153
|
-
{
|
|
10154
|
-
control: form.control,
|
|
10155
|
-
name: "email",
|
|
10156
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10157
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10158
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10159
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10160
|
-
] })
|
|
10161
|
-
}
|
|
10162
|
-
) }),
|
|
10163
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10164
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10165
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10166
|
-
] }) })
|
|
10167
|
-
]
|
|
10168
|
-
}
|
|
10169
|
-
) });
|
|
10170
|
-
};
|
|
10171
|
-
const schema$3 = object({
|
|
10172
|
-
email: string().email()
|
|
10173
|
-
});
|
|
10174
10085
|
const NumberInput = forwardRef(
|
|
10175
10086
|
({
|
|
10176
10087
|
value,
|
|
@@ -11495,6 +11406,27 @@ function getHasUneditableRows(metadata) {
|
|
|
11495
11406
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11496
11407
|
);
|
|
11497
11408
|
}
|
|
11409
|
+
const CustomItems = () => {
|
|
11410
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11411
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
11412
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
11413
|
+
] });
|
|
11414
|
+
};
|
|
11415
|
+
const CustomItemsForm = () => {
|
|
11416
|
+
const form = useForm({
|
|
11417
|
+
resolver: zodResolver(schema$4)
|
|
11418
|
+
});
|
|
11419
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11420
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
11421
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11422
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11423
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
11424
|
+
] }) })
|
|
11425
|
+
] }) });
|
|
11426
|
+
};
|
|
11427
|
+
const schema$4 = object({
|
|
11428
|
+
email: string().email()
|
|
11429
|
+
});
|
|
11498
11430
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11499
11431
|
const promotionsQueryKeys = {
|
|
11500
11432
|
list: (query2) => [
|
|
@@ -11800,7 +11732,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11800
11732
|
defaultValues: {
|
|
11801
11733
|
sales_channel_id: order.sales_channel_id || ""
|
|
11802
11734
|
},
|
|
11803
|
-
resolver: zodResolver(schema$
|
|
11735
|
+
resolver: zodResolver(schema$3)
|
|
11804
11736
|
});
|
|
11805
11737
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11806
11738
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11875,7 +11807,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11875
11807
|
}
|
|
11876
11808
|
);
|
|
11877
11809
|
};
|
|
11878
|
-
const schema$
|
|
11810
|
+
const schema$3 = object({
|
|
11879
11811
|
sales_channel_id: string().min(1)
|
|
11880
11812
|
});
|
|
11881
11813
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12717,7 +12649,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12717
12649
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12718
12650
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12719
12651
|
},
|
|
12720
|
-
resolver: zodResolver(schema$
|
|
12652
|
+
resolver: zodResolver(schema$2)
|
|
12721
12653
|
});
|
|
12722
12654
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12723
12655
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12887,7 +12819,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12887
12819
|
}
|
|
12888
12820
|
) });
|
|
12889
12821
|
};
|
|
12890
|
-
const schema$
|
|
12822
|
+
const schema$2 = addressSchema;
|
|
12891
12823
|
const TransferOwnership = () => {
|
|
12892
12824
|
const { id } = useParams();
|
|
12893
12825
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12911,7 +12843,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12911
12843
|
defaultValues: {
|
|
12912
12844
|
customer_id: order.customer_id || ""
|
|
12913
12845
|
},
|
|
12914
|
-
resolver: zodResolver(schema)
|
|
12846
|
+
resolver: zodResolver(schema$1)
|
|
12915
12847
|
});
|
|
12916
12848
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12917
12849
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13361,9 +13293,77 @@ const Illustration = () => {
|
|
|
13361
13293
|
}
|
|
13362
13294
|
);
|
|
13363
13295
|
};
|
|
13364
|
-
const schema = object({
|
|
13296
|
+
const schema$1 = object({
|
|
13365
13297
|
customer_id: string().min(1)
|
|
13366
13298
|
});
|
|
13299
|
+
const Email = () => {
|
|
13300
|
+
const { id } = useParams();
|
|
13301
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
13302
|
+
fields: "+email"
|
|
13303
|
+
});
|
|
13304
|
+
if (isError) {
|
|
13305
|
+
throw error;
|
|
13306
|
+
}
|
|
13307
|
+
const isReady = !isPending && !!order;
|
|
13308
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
13309
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
13310
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
13311
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
13312
|
+
] }),
|
|
13313
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
13314
|
+
] });
|
|
13315
|
+
};
|
|
13316
|
+
const EmailForm = ({ order }) => {
|
|
13317
|
+
const form = useForm({
|
|
13318
|
+
defaultValues: {
|
|
13319
|
+
email: order.email ?? ""
|
|
13320
|
+
},
|
|
13321
|
+
resolver: zodResolver(schema)
|
|
13322
|
+
});
|
|
13323
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13324
|
+
const { handleSuccess } = useRouteModal();
|
|
13325
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
13326
|
+
await mutateAsync(
|
|
13327
|
+
{ email: data.email },
|
|
13328
|
+
{
|
|
13329
|
+
onSuccess: () => {
|
|
13330
|
+
handleSuccess();
|
|
13331
|
+
},
|
|
13332
|
+
onError: (error) => {
|
|
13333
|
+
toast.error(error.message);
|
|
13334
|
+
}
|
|
13335
|
+
}
|
|
13336
|
+
);
|
|
13337
|
+
});
|
|
13338
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13339
|
+
KeyboundForm,
|
|
13340
|
+
{
|
|
13341
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13342
|
+
onSubmit,
|
|
13343
|
+
children: [
|
|
13344
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13345
|
+
Form$2.Field,
|
|
13346
|
+
{
|
|
13347
|
+
control: form.control,
|
|
13348
|
+
name: "email",
|
|
13349
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13350
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13351
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13352
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13353
|
+
] })
|
|
13354
|
+
}
|
|
13355
|
+
) }),
|
|
13356
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13357
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13358
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13359
|
+
] }) })
|
|
13360
|
+
]
|
|
13361
|
+
}
|
|
13362
|
+
) });
|
|
13363
|
+
};
|
|
13364
|
+
const schema = object({
|
|
13365
|
+
email: string().email()
|
|
13366
|
+
});
|
|
13367
13367
|
const widgetModule = { widgets: [] };
|
|
13368
13368
|
const routeModule = {
|
|
13369
13369
|
routes: [
|
|
@@ -13388,14 +13388,6 @@ const routeModule = {
|
|
|
13388
13388
|
Component: BillingAddress,
|
|
13389
13389
|
path: "/draft-orders/:id/billing-address"
|
|
13390
13390
|
},
|
|
13391
|
-
{
|
|
13392
|
-
Component: CustomItems,
|
|
13393
|
-
path: "/draft-orders/:id/custom-items"
|
|
13394
|
-
},
|
|
13395
|
-
{
|
|
13396
|
-
Component: Email,
|
|
13397
|
-
path: "/draft-orders/:id/email"
|
|
13398
|
-
},
|
|
13399
13391
|
{
|
|
13400
13392
|
Component: Items,
|
|
13401
13393
|
path: "/draft-orders/:id/items"
|
|
@@ -13404,6 +13396,10 @@ const routeModule = {
|
|
|
13404
13396
|
Component: Metadata,
|
|
13405
13397
|
path: "/draft-orders/:id/metadata"
|
|
13406
13398
|
},
|
|
13399
|
+
{
|
|
13400
|
+
Component: CustomItems,
|
|
13401
|
+
path: "/draft-orders/:id/custom-items"
|
|
13402
|
+
},
|
|
13407
13403
|
{
|
|
13408
13404
|
Component: Promotions,
|
|
13409
13405
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13423,6 +13419,10 @@ const routeModule = {
|
|
|
13423
13419
|
{
|
|
13424
13420
|
Component: TransferOwnership,
|
|
13425
13421
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13422
|
+
},
|
|
13423
|
+
{
|
|
13424
|
+
Component: Email,
|
|
13425
|
+
path: "/draft-orders/:id/email"
|
|
13426
13426
|
}
|
|
13427
13427
|
]
|
|
13428
13428
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.3-preview-20260514122911",
|
|
4
4
|
"description": "A draft order plugin for Medusa.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@ariakit/react": "^0.4.15",
|
|
43
43
|
"@babel/runtime": "^7.26.10",
|
|
44
44
|
"@hookform/resolvers": "3.4.2",
|
|
45
|
-
"@medusajs/js-sdk": "2.15.
|
|
45
|
+
"@medusajs/js-sdk": "2.15.3-preview-20260514122911",
|
|
46
46
|
"@tanstack/react-query": "5.64.2",
|
|
47
47
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
48
48
|
"date-fns": "^3.6.0",
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
"react-hook-form": "7.49.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@medusajs/admin-sdk": "2.15.
|
|
57
|
-
"@medusajs/cli": "2.15.
|
|
58
|
-
"@medusajs/framework": "2.15.
|
|
59
|
-
"@medusajs/icons": "2.15.
|
|
60
|
-
"@medusajs/test-utils": "2.15.
|
|
61
|
-
"@medusajs/types": "2.15.
|
|
62
|
-
"@medusajs/ui": "4.1.
|
|
63
|
-
"@medusajs/ui-preset": "2.15.
|
|
56
|
+
"@medusajs/admin-sdk": "2.15.3-preview-20260514122911",
|
|
57
|
+
"@medusajs/cli": "2.15.3-preview-20260514122911",
|
|
58
|
+
"@medusajs/framework": "2.15.3-preview-20260514122911",
|
|
59
|
+
"@medusajs/icons": "2.15.3-preview-20260514122911",
|
|
60
|
+
"@medusajs/test-utils": "2.15.3-preview-20260514122911",
|
|
61
|
+
"@medusajs/types": "2.15.3-preview-20260514122911",
|
|
62
|
+
"@medusajs/ui": "4.1.13-preview-20260514122911",
|
|
63
|
+
"@medusajs/ui-preset": "2.15.3-preview-20260514122911"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@medusajs/admin-sdk": "2.15.
|
|
67
|
-
"@medusajs/cli": "2.15.
|
|
68
|
-
"@medusajs/framework": "2.15.
|
|
69
|
-
"@medusajs/icons": "2.15.
|
|
70
|
-
"@medusajs/test-utils": "2.15.
|
|
71
|
-
"@medusajs/ui": "4.1.
|
|
66
|
+
"@medusajs/admin-sdk": "2.15.3-preview-20260514122911",
|
|
67
|
+
"@medusajs/cli": "2.15.3-preview-20260514122911",
|
|
68
|
+
"@medusajs/framework": "2.15.3-preview-20260514122911",
|
|
69
|
+
"@medusajs/icons": "2.15.3-preview-20260514122911",
|
|
70
|
+
"@medusajs/test-utils": "2.15.3-preview-20260514122911",
|
|
71
|
+
"@medusajs/ui": "4.1.13-preview-20260514122911",
|
|
72
72
|
"react": "^18.3.1",
|
|
73
73
|
"react-dom": "^18.3.1",
|
|
74
74
|
"react-router-dom": "6.30.3"
|