@medusajs/draft-order 2.10.2 → 2.10.3-preview-20250912210150
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 +97 -97
- package/.medusa/server/src/admin/index.mjs +97 -97
- package/package.json +24 -23
|
@@ -9763,6 +9763,95 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9763
9763
|
) });
|
|
9764
9764
|
};
|
|
9765
9765
|
const schema$5 = addressSchema;
|
|
9766
|
+
const CustomItems = () => {
|
|
9767
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9768
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9769
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9770
|
+
] });
|
|
9771
|
+
};
|
|
9772
|
+
const CustomItemsForm = () => {
|
|
9773
|
+
const form = reactHookForm.useForm({
|
|
9774
|
+
resolver: zod.zodResolver(schema$4)
|
|
9775
|
+
});
|
|
9776
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9777
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9778
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9779
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9780
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9781
|
+
] }) })
|
|
9782
|
+
] }) });
|
|
9783
|
+
};
|
|
9784
|
+
const schema$4 = objectType({
|
|
9785
|
+
email: stringType().email()
|
|
9786
|
+
});
|
|
9787
|
+
const Email = () => {
|
|
9788
|
+
const { id } = reactRouterDom.useParams();
|
|
9789
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9790
|
+
fields: "+email"
|
|
9791
|
+
});
|
|
9792
|
+
if (isError) {
|
|
9793
|
+
throw error;
|
|
9794
|
+
}
|
|
9795
|
+
const isReady = !isPending && !!order;
|
|
9796
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9797
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9798
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9799
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9800
|
+
] }),
|
|
9801
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9802
|
+
] });
|
|
9803
|
+
};
|
|
9804
|
+
const EmailForm = ({ order }) => {
|
|
9805
|
+
const form = reactHookForm.useForm({
|
|
9806
|
+
defaultValues: {
|
|
9807
|
+
email: order.email ?? ""
|
|
9808
|
+
},
|
|
9809
|
+
resolver: zod.zodResolver(schema$3)
|
|
9810
|
+
});
|
|
9811
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9812
|
+
const { handleSuccess } = useRouteModal();
|
|
9813
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9814
|
+
await mutateAsync(
|
|
9815
|
+
{ email: data.email },
|
|
9816
|
+
{
|
|
9817
|
+
onSuccess: () => {
|
|
9818
|
+
handleSuccess();
|
|
9819
|
+
},
|
|
9820
|
+
onError: (error) => {
|
|
9821
|
+
ui.toast.error(error.message);
|
|
9822
|
+
}
|
|
9823
|
+
}
|
|
9824
|
+
);
|
|
9825
|
+
});
|
|
9826
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9827
|
+
KeyboundForm,
|
|
9828
|
+
{
|
|
9829
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9830
|
+
onSubmit,
|
|
9831
|
+
children: [
|
|
9832
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9833
|
+
Form$2.Field,
|
|
9834
|
+
{
|
|
9835
|
+
control: form.control,
|
|
9836
|
+
name: "email",
|
|
9837
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9838
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9840
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9841
|
+
] })
|
|
9842
|
+
}
|
|
9843
|
+
) }),
|
|
9844
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9845
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9846
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9847
|
+
] }) })
|
|
9848
|
+
]
|
|
9849
|
+
}
|
|
9850
|
+
) });
|
|
9851
|
+
};
|
|
9852
|
+
const schema$3 = objectType({
|
|
9853
|
+
email: stringType().email()
|
|
9854
|
+
});
|
|
9766
9855
|
const NumberInput = React.forwardRef(
|
|
9767
9856
|
({
|
|
9768
9857
|
value,
|
|
@@ -11364,95 +11453,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11364
11453
|
}
|
|
11365
11454
|
return Array.from(promotionIds);
|
|
11366
11455
|
}
|
|
11367
|
-
const Email = () => {
|
|
11368
|
-
const { id } = reactRouterDom.useParams();
|
|
11369
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11370
|
-
fields: "+email"
|
|
11371
|
-
});
|
|
11372
|
-
if (isError) {
|
|
11373
|
-
throw error;
|
|
11374
|
-
}
|
|
11375
|
-
const isReady = !isPending && !!order;
|
|
11376
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11377
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11378
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
11379
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11380
|
-
] }),
|
|
11381
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
11382
|
-
] });
|
|
11383
|
-
};
|
|
11384
|
-
const EmailForm = ({ order }) => {
|
|
11385
|
-
const form = reactHookForm.useForm({
|
|
11386
|
-
defaultValues: {
|
|
11387
|
-
email: order.email ?? ""
|
|
11388
|
-
},
|
|
11389
|
-
resolver: zod.zodResolver(schema$4)
|
|
11390
|
-
});
|
|
11391
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11392
|
-
const { handleSuccess } = useRouteModal();
|
|
11393
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11394
|
-
await mutateAsync(
|
|
11395
|
-
{ email: data.email },
|
|
11396
|
-
{
|
|
11397
|
-
onSuccess: () => {
|
|
11398
|
-
handleSuccess();
|
|
11399
|
-
},
|
|
11400
|
-
onError: (error) => {
|
|
11401
|
-
ui.toast.error(error.message);
|
|
11402
|
-
}
|
|
11403
|
-
}
|
|
11404
|
-
);
|
|
11405
|
-
});
|
|
11406
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11407
|
-
KeyboundForm,
|
|
11408
|
-
{
|
|
11409
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11410
|
-
onSubmit,
|
|
11411
|
-
children: [
|
|
11412
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11413
|
-
Form$2.Field,
|
|
11414
|
-
{
|
|
11415
|
-
control: form.control,
|
|
11416
|
-
name: "email",
|
|
11417
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11418
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
11419
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11420
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11421
|
-
] })
|
|
11422
|
-
}
|
|
11423
|
-
) }),
|
|
11424
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11425
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11426
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11427
|
-
] }) })
|
|
11428
|
-
]
|
|
11429
|
-
}
|
|
11430
|
-
) });
|
|
11431
|
-
};
|
|
11432
|
-
const schema$4 = objectType({
|
|
11433
|
-
email: stringType().email()
|
|
11434
|
-
});
|
|
11435
|
-
const CustomItems = () => {
|
|
11436
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11437
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
11438
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
11439
|
-
] });
|
|
11440
|
-
};
|
|
11441
|
-
const CustomItemsForm = () => {
|
|
11442
|
-
const form = reactHookForm.useForm({
|
|
11443
|
-
resolver: zod.zodResolver(schema$3)
|
|
11444
|
-
});
|
|
11445
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11446
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
11447
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11448
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11449
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
11450
|
-
] }) })
|
|
11451
|
-
] }) });
|
|
11452
|
-
};
|
|
11453
|
-
const schema$3 = objectType({
|
|
11454
|
-
email: stringType().email()
|
|
11455
|
-
});
|
|
11456
11456
|
const SalesChannel = () => {
|
|
11457
11457
|
const { id } = reactRouterDom.useParams();
|
|
11458
11458
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13069,6 +13069,14 @@ const routeModule = {
|
|
|
13069
13069
|
Component: BillingAddress,
|
|
13070
13070
|
path: "/draft-orders/:id/billing-address"
|
|
13071
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: CustomItems,
|
|
13074
|
+
path: "/draft-orders/:id/custom-items"
|
|
13075
|
+
},
|
|
13076
|
+
{
|
|
13077
|
+
Component: Email,
|
|
13078
|
+
path: "/draft-orders/:id/email"
|
|
13079
|
+
},
|
|
13072
13080
|
{
|
|
13073
13081
|
Component: Items,
|
|
13074
13082
|
path: "/draft-orders/:id/items"
|
|
@@ -13081,14 +13089,6 @@ const routeModule = {
|
|
|
13081
13089
|
Component: Promotions,
|
|
13082
13090
|
path: "/draft-orders/:id/promotions"
|
|
13083
13091
|
},
|
|
13084
|
-
{
|
|
13085
|
-
Component: Email,
|
|
13086
|
-
path: "/draft-orders/:id/email"
|
|
13087
|
-
},
|
|
13088
|
-
{
|
|
13089
|
-
Component: CustomItems,
|
|
13090
|
-
path: "/draft-orders/:id/custom-items"
|
|
13091
|
-
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: SalesChannel,
|
|
13094
13094
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -9757,6 +9757,95 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9757
9757
|
) });
|
|
9758
9758
|
};
|
|
9759
9759
|
const schema$5 = addressSchema;
|
|
9760
|
+
const CustomItems = () => {
|
|
9761
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9762
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9763
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9764
|
+
] });
|
|
9765
|
+
};
|
|
9766
|
+
const CustomItemsForm = () => {
|
|
9767
|
+
const form = useForm({
|
|
9768
|
+
resolver: zodResolver(schema$4)
|
|
9769
|
+
});
|
|
9770
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9771
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9772
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9773
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9774
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9775
|
+
] }) })
|
|
9776
|
+
] }) });
|
|
9777
|
+
};
|
|
9778
|
+
const schema$4 = objectType({
|
|
9779
|
+
email: stringType().email()
|
|
9780
|
+
});
|
|
9781
|
+
const Email = () => {
|
|
9782
|
+
const { id } = useParams();
|
|
9783
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9784
|
+
fields: "+email"
|
|
9785
|
+
});
|
|
9786
|
+
if (isError) {
|
|
9787
|
+
throw error;
|
|
9788
|
+
}
|
|
9789
|
+
const isReady = !isPending && !!order;
|
|
9790
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9791
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9792
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9793
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9794
|
+
] }),
|
|
9795
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9796
|
+
] });
|
|
9797
|
+
};
|
|
9798
|
+
const EmailForm = ({ order }) => {
|
|
9799
|
+
const form = useForm({
|
|
9800
|
+
defaultValues: {
|
|
9801
|
+
email: order.email ?? ""
|
|
9802
|
+
},
|
|
9803
|
+
resolver: zodResolver(schema$3)
|
|
9804
|
+
});
|
|
9805
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9806
|
+
const { handleSuccess } = useRouteModal();
|
|
9807
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9808
|
+
await mutateAsync(
|
|
9809
|
+
{ email: data.email },
|
|
9810
|
+
{
|
|
9811
|
+
onSuccess: () => {
|
|
9812
|
+
handleSuccess();
|
|
9813
|
+
},
|
|
9814
|
+
onError: (error) => {
|
|
9815
|
+
toast.error(error.message);
|
|
9816
|
+
}
|
|
9817
|
+
}
|
|
9818
|
+
);
|
|
9819
|
+
});
|
|
9820
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9821
|
+
KeyboundForm,
|
|
9822
|
+
{
|
|
9823
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9824
|
+
onSubmit,
|
|
9825
|
+
children: [
|
|
9826
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9827
|
+
Form$2.Field,
|
|
9828
|
+
{
|
|
9829
|
+
control: form.control,
|
|
9830
|
+
name: "email",
|
|
9831
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9832
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9833
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9834
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9835
|
+
] })
|
|
9836
|
+
}
|
|
9837
|
+
) }),
|
|
9838
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9839
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9840
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9841
|
+
] }) })
|
|
9842
|
+
]
|
|
9843
|
+
}
|
|
9844
|
+
) });
|
|
9845
|
+
};
|
|
9846
|
+
const schema$3 = objectType({
|
|
9847
|
+
email: stringType().email()
|
|
9848
|
+
});
|
|
9760
9849
|
const NumberInput = forwardRef(
|
|
9761
9850
|
({
|
|
9762
9851
|
value,
|
|
@@ -11358,95 +11447,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11358
11447
|
}
|
|
11359
11448
|
return Array.from(promotionIds);
|
|
11360
11449
|
}
|
|
11361
|
-
const Email = () => {
|
|
11362
|
-
const { id } = useParams();
|
|
11363
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11364
|
-
fields: "+email"
|
|
11365
|
-
});
|
|
11366
|
-
if (isError) {
|
|
11367
|
-
throw error;
|
|
11368
|
-
}
|
|
11369
|
-
const isReady = !isPending && !!order;
|
|
11370
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11371
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11372
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
11373
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11374
|
-
] }),
|
|
11375
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
11376
|
-
] });
|
|
11377
|
-
};
|
|
11378
|
-
const EmailForm = ({ order }) => {
|
|
11379
|
-
const form = useForm({
|
|
11380
|
-
defaultValues: {
|
|
11381
|
-
email: order.email ?? ""
|
|
11382
|
-
},
|
|
11383
|
-
resolver: zodResolver(schema$4)
|
|
11384
|
-
});
|
|
11385
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11386
|
-
const { handleSuccess } = useRouteModal();
|
|
11387
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11388
|
-
await mutateAsync(
|
|
11389
|
-
{ email: data.email },
|
|
11390
|
-
{
|
|
11391
|
-
onSuccess: () => {
|
|
11392
|
-
handleSuccess();
|
|
11393
|
-
},
|
|
11394
|
-
onError: (error) => {
|
|
11395
|
-
toast.error(error.message);
|
|
11396
|
-
}
|
|
11397
|
-
}
|
|
11398
|
-
);
|
|
11399
|
-
});
|
|
11400
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11401
|
-
KeyboundForm,
|
|
11402
|
-
{
|
|
11403
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11404
|
-
onSubmit,
|
|
11405
|
-
children: [
|
|
11406
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
11407
|
-
Form$2.Field,
|
|
11408
|
-
{
|
|
11409
|
-
control: form.control,
|
|
11410
|
-
name: "email",
|
|
11411
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11412
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
11413
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11414
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11415
|
-
] })
|
|
11416
|
-
}
|
|
11417
|
-
) }),
|
|
11418
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11419
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11420
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11421
|
-
] }) })
|
|
11422
|
-
]
|
|
11423
|
-
}
|
|
11424
|
-
) });
|
|
11425
|
-
};
|
|
11426
|
-
const schema$4 = objectType({
|
|
11427
|
-
email: stringType().email()
|
|
11428
|
-
});
|
|
11429
|
-
const CustomItems = () => {
|
|
11430
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11431
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
11432
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
11433
|
-
] });
|
|
11434
|
-
};
|
|
11435
|
-
const CustomItemsForm = () => {
|
|
11436
|
-
const form = useForm({
|
|
11437
|
-
resolver: zodResolver(schema$3)
|
|
11438
|
-
});
|
|
11439
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11440
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
11441
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11442
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11443
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
11444
|
-
] }) })
|
|
11445
|
-
] }) });
|
|
11446
|
-
};
|
|
11447
|
-
const schema$3 = objectType({
|
|
11448
|
-
email: stringType().email()
|
|
11449
|
-
});
|
|
11450
11450
|
const SalesChannel = () => {
|
|
11451
11451
|
const { id } = useParams();
|
|
11452
11452
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13063,6 +13063,14 @@ const routeModule = {
|
|
|
13063
13063
|
Component: BillingAddress,
|
|
13064
13064
|
path: "/draft-orders/:id/billing-address"
|
|
13065
13065
|
},
|
|
13066
|
+
{
|
|
13067
|
+
Component: CustomItems,
|
|
13068
|
+
path: "/draft-orders/:id/custom-items"
|
|
13069
|
+
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: Email,
|
|
13072
|
+
path: "/draft-orders/:id/email"
|
|
13073
|
+
},
|
|
13066
13074
|
{
|
|
13067
13075
|
Component: Items,
|
|
13068
13076
|
path: "/draft-orders/:id/items"
|
|
@@ -13075,14 +13083,6 @@ const routeModule = {
|
|
|
13075
13083
|
Component: Promotions,
|
|
13076
13084
|
path: "/draft-orders/:id/promotions"
|
|
13077
13085
|
},
|
|
13078
|
-
{
|
|
13079
|
-
Component: Email,
|
|
13080
|
-
path: "/draft-orders/:id/email"
|
|
13081
|
-
},
|
|
13082
|
-
{
|
|
13083
|
-
Component: CustomItems,
|
|
13084
|
-
path: "/draft-orders/:id/custom-items"
|
|
13085
|
-
},
|
|
13086
13086
|
{
|
|
13087
13087
|
Component: SalesChannel,
|
|
13088
13088
|
path: "/draft-orders/:id/sales-channel"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.3-preview-20250912210150",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,10 +27,16 @@
|
|
|
27
27
|
"medusa-plugin",
|
|
28
28
|
"medusa-v2"
|
|
29
29
|
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "medusa plugin:build",
|
|
32
|
+
"dev": "medusa plugin:develop",
|
|
33
|
+
"prepare": "cross-env NODE_ENV=production yarn run build",
|
|
34
|
+
"link:watch": "medusa plugin:publish && medusa plugin:develop"
|
|
35
|
+
},
|
|
30
36
|
"dependencies": {
|
|
31
37
|
"@ariakit/react": "^0.4.15",
|
|
32
38
|
"@hookform/resolvers": "3.4.2",
|
|
33
|
-
"@medusajs/js-sdk": "2.10.
|
|
39
|
+
"@medusajs/js-sdk": "2.10.3-preview-20250912210150",
|
|
34
40
|
"@tanstack/react-query": "5.64.2",
|
|
35
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
36
42
|
"date-fns": "^3.6.0",
|
|
@@ -39,14 +45,14 @@
|
|
|
39
45
|
"react-hook-form": "7.49.1"
|
|
40
46
|
},
|
|
41
47
|
"devDependencies": {
|
|
42
|
-
"@medusajs/admin-sdk": "2.10.
|
|
43
|
-
"@medusajs/cli": "2.10.
|
|
44
|
-
"@medusajs/framework": "2.10.
|
|
45
|
-
"@medusajs/icons": "2.10.
|
|
46
|
-
"@medusajs/test-utils": "2.10.
|
|
47
|
-
"@medusajs/types": "2.10.
|
|
48
|
-
"@medusajs/ui": "4.0.
|
|
49
|
-
"@medusajs/ui-preset": "2.10.
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.3-preview-20250912210150",
|
|
49
|
+
"@medusajs/cli": "2.10.3-preview-20250912210150",
|
|
50
|
+
"@medusajs/framework": "2.10.3-preview-20250912210150",
|
|
51
|
+
"@medusajs/icons": "2.10.3-preview-20250912210150",
|
|
52
|
+
"@medusajs/test-utils": "2.10.3-preview-20250912210150",
|
|
53
|
+
"@medusajs/types": "2.10.3-preview-20250912210150",
|
|
54
|
+
"@medusajs/ui": "4.0.23-preview-20250912210150",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.3-preview-20250912210150",
|
|
50
56
|
"@mikro-orm/cli": "6.4.3",
|
|
51
57
|
"@mikro-orm/core": "6.4.3",
|
|
52
58
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -70,12 +76,12 @@
|
|
|
70
76
|
"yalc": "^1.0.0-pre.53"
|
|
71
77
|
},
|
|
72
78
|
"peerDependencies": {
|
|
73
|
-
"@medusajs/admin-sdk": "2.10.
|
|
74
|
-
"@medusajs/cli": "2.10.
|
|
75
|
-
"@medusajs/framework": "2.10.
|
|
76
|
-
"@medusajs/icons": "2.10.
|
|
77
|
-
"@medusajs/test-utils": "2.10.
|
|
78
|
-
"@medusajs/ui": "4.0.
|
|
79
|
+
"@medusajs/admin-sdk": "2.10.3-preview-20250912210150",
|
|
80
|
+
"@medusajs/cli": "2.10.3-preview-20250912210150",
|
|
81
|
+
"@medusajs/framework": "2.10.3-preview-20250912210150",
|
|
82
|
+
"@medusajs/icons": "2.10.3-preview-20250912210150",
|
|
83
|
+
"@medusajs/test-utils": "2.10.3-preview-20250912210150",
|
|
84
|
+
"@medusajs/ui": "4.0.23-preview-20250912210150",
|
|
79
85
|
"@mikro-orm/cli": "6.4.3",
|
|
80
86
|
"@mikro-orm/core": "6.4.3",
|
|
81
87
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -89,10 +95,5 @@
|
|
|
89
95
|
"engines": {
|
|
90
96
|
"node": ">=20"
|
|
91
97
|
},
|
|
92
|
-
"packageManager": "yarn@3.2.1"
|
|
93
|
-
|
|
94
|
-
"build": "medusa plugin:build",
|
|
95
|
-
"dev": "medusa plugin:develop",
|
|
96
|
-
"link:watch": "medusa plugin:publish && medusa plugin:develop"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
98
|
+
"packageManager": "yarn@3.2.1"
|
|
99
|
+
}
|