@medusajs/draft-order 2.11.1-preview-20251023180201 → 2.11.1-preview-20251023210200
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 +98 -96
- package/.medusa/server/src/admin/index.mjs +98 -96
- package/package.json +16 -16
|
@@ -9571,95 +9571,6 @@ const ID = () => {
|
|
|
9571
9571
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9572
9572
|
] });
|
|
9573
9573
|
};
|
|
9574
|
-
const CustomItems = () => {
|
|
9575
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9576
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9577
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9578
|
-
] });
|
|
9579
|
-
};
|
|
9580
|
-
const CustomItemsForm = () => {
|
|
9581
|
-
const form = reactHookForm.useForm({
|
|
9582
|
-
resolver: zod.zodResolver(schema$5)
|
|
9583
|
-
});
|
|
9584
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9585
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9586
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9587
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9588
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9589
|
-
] }) })
|
|
9590
|
-
] }) });
|
|
9591
|
-
};
|
|
9592
|
-
const schema$5 = objectType({
|
|
9593
|
-
email: stringType().email()
|
|
9594
|
-
});
|
|
9595
|
-
const Email = () => {
|
|
9596
|
-
const { id } = reactRouterDom.useParams();
|
|
9597
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9598
|
-
fields: "+email"
|
|
9599
|
-
});
|
|
9600
|
-
if (isError) {
|
|
9601
|
-
throw error;
|
|
9602
|
-
}
|
|
9603
|
-
const isReady = !isPending && !!order;
|
|
9604
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9605
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9606
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9607
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9608
|
-
] }),
|
|
9609
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9610
|
-
] });
|
|
9611
|
-
};
|
|
9612
|
-
const EmailForm = ({ order }) => {
|
|
9613
|
-
const form = reactHookForm.useForm({
|
|
9614
|
-
defaultValues: {
|
|
9615
|
-
email: order.email ?? ""
|
|
9616
|
-
},
|
|
9617
|
-
resolver: zod.zodResolver(schema$4)
|
|
9618
|
-
});
|
|
9619
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9620
|
-
const { handleSuccess } = useRouteModal();
|
|
9621
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9622
|
-
await mutateAsync(
|
|
9623
|
-
{ email: data.email },
|
|
9624
|
-
{
|
|
9625
|
-
onSuccess: () => {
|
|
9626
|
-
handleSuccess();
|
|
9627
|
-
},
|
|
9628
|
-
onError: (error) => {
|
|
9629
|
-
ui.toast.error(error.message);
|
|
9630
|
-
}
|
|
9631
|
-
}
|
|
9632
|
-
);
|
|
9633
|
-
});
|
|
9634
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9635
|
-
KeyboundForm,
|
|
9636
|
-
{
|
|
9637
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9638
|
-
onSubmit,
|
|
9639
|
-
children: [
|
|
9640
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9641
|
-
Form$2.Field,
|
|
9642
|
-
{
|
|
9643
|
-
control: form.control,
|
|
9644
|
-
name: "email",
|
|
9645
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9646
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9647
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9648
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9649
|
-
] })
|
|
9650
|
-
}
|
|
9651
|
-
) }),
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9653
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9654
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9655
|
-
] }) })
|
|
9656
|
-
]
|
|
9657
|
-
}
|
|
9658
|
-
) });
|
|
9659
|
-
};
|
|
9660
|
-
const schema$4 = objectType({
|
|
9661
|
-
email: stringType().email()
|
|
9662
|
-
});
|
|
9663
9574
|
const BillingAddress = () => {
|
|
9664
9575
|
const { id } = reactRouterDom.useParams();
|
|
9665
9576
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9692,7 +9603,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9692
9603
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9693
9604
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9694
9605
|
},
|
|
9695
|
-
resolver: zod.zodResolver(schema$
|
|
9606
|
+
resolver: zod.zodResolver(schema$5)
|
|
9696
9607
|
});
|
|
9697
9608
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9698
9609
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9849,7 +9760,96 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9849
9760
|
}
|
|
9850
9761
|
) });
|
|
9851
9762
|
};
|
|
9852
|
-
const schema$
|
|
9763
|
+
const schema$5 = addressSchema;
|
|
9764
|
+
const CustomItems = () => {
|
|
9765
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9766
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9767
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9768
|
+
] });
|
|
9769
|
+
};
|
|
9770
|
+
const CustomItemsForm = () => {
|
|
9771
|
+
const form = reactHookForm.useForm({
|
|
9772
|
+
resolver: zod.zodResolver(schema$4)
|
|
9773
|
+
});
|
|
9774
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9775
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9776
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9777
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9778
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9779
|
+
] }) })
|
|
9780
|
+
] }) });
|
|
9781
|
+
};
|
|
9782
|
+
const schema$4 = objectType({
|
|
9783
|
+
email: stringType().email()
|
|
9784
|
+
});
|
|
9785
|
+
const Email = () => {
|
|
9786
|
+
const { id } = reactRouterDom.useParams();
|
|
9787
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9788
|
+
fields: "+email"
|
|
9789
|
+
});
|
|
9790
|
+
if (isError) {
|
|
9791
|
+
throw error;
|
|
9792
|
+
}
|
|
9793
|
+
const isReady = !isPending && !!order;
|
|
9794
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9795
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9796
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9797
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9798
|
+
] }),
|
|
9799
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9800
|
+
] });
|
|
9801
|
+
};
|
|
9802
|
+
const EmailForm = ({ order }) => {
|
|
9803
|
+
const form = reactHookForm.useForm({
|
|
9804
|
+
defaultValues: {
|
|
9805
|
+
email: order.email ?? ""
|
|
9806
|
+
},
|
|
9807
|
+
resolver: zod.zodResolver(schema$3)
|
|
9808
|
+
});
|
|
9809
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9810
|
+
const { handleSuccess } = useRouteModal();
|
|
9811
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9812
|
+
await mutateAsync(
|
|
9813
|
+
{ email: data.email },
|
|
9814
|
+
{
|
|
9815
|
+
onSuccess: () => {
|
|
9816
|
+
handleSuccess();
|
|
9817
|
+
},
|
|
9818
|
+
onError: (error) => {
|
|
9819
|
+
ui.toast.error(error.message);
|
|
9820
|
+
}
|
|
9821
|
+
}
|
|
9822
|
+
);
|
|
9823
|
+
});
|
|
9824
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9825
|
+
KeyboundForm,
|
|
9826
|
+
{
|
|
9827
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9828
|
+
onSubmit,
|
|
9829
|
+
children: [
|
|
9830
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9831
|
+
Form$2.Field,
|
|
9832
|
+
{
|
|
9833
|
+
control: form.control,
|
|
9834
|
+
name: "email",
|
|
9835
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9836
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9837
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9838
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9839
|
+
] })
|
|
9840
|
+
}
|
|
9841
|
+
) }),
|
|
9842
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9843
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9844
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9845
|
+
] }) })
|
|
9846
|
+
]
|
|
9847
|
+
}
|
|
9848
|
+
) });
|
|
9849
|
+
};
|
|
9850
|
+
const schema$3 = objectType({
|
|
9851
|
+
email: stringType().email()
|
|
9852
|
+
});
|
|
9853
9853
|
const NumberInput = React.forwardRef(
|
|
9854
9854
|
({
|
|
9855
9855
|
value,
|
|
@@ -13063,6 +13063,10 @@ const routeModule = {
|
|
|
13063
13063
|
handle,
|
|
13064
13064
|
loader,
|
|
13065
13065
|
children: [
|
|
13066
|
+
{
|
|
13067
|
+
Component: BillingAddress,
|
|
13068
|
+
path: "/draft-orders/:id/billing-address"
|
|
13069
|
+
},
|
|
13066
13070
|
{
|
|
13067
13071
|
Component: CustomItems,
|
|
13068
13072
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13071,10 +13075,6 @@ const routeModule = {
|
|
|
13071
13075
|
Component: Email,
|
|
13072
13076
|
path: "/draft-orders/:id/email"
|
|
13073
13077
|
},
|
|
13074
|
-
{
|
|
13075
|
-
Component: BillingAddress,
|
|
13076
|
-
path: "/draft-orders/:id/billing-address"
|
|
13077
|
-
},
|
|
13078
13078
|
{
|
|
13079
13079
|
Component: Items,
|
|
13080
13080
|
path: "/draft-orders/:id/items"
|
|
@@ -13121,11 +13121,13 @@ const formModule = { customFields: {} };
|
|
|
13121
13121
|
const displayModule = {
|
|
13122
13122
|
displays: {}
|
|
13123
13123
|
};
|
|
13124
|
+
const i18nModule = { resources: {} };
|
|
13124
13125
|
const plugin = {
|
|
13125
13126
|
widgetModule,
|
|
13126
13127
|
routeModule,
|
|
13127
13128
|
menuItemModule,
|
|
13128
13129
|
formModule,
|
|
13129
|
-
displayModule
|
|
13130
|
+
displayModule,
|
|
13131
|
+
i18nModule
|
|
13130
13132
|
};
|
|
13131
13133
|
module.exports = plugin;
|
|
@@ -9565,95 +9565,6 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const CustomItems = () => {
|
|
9569
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9570
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9571
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9572
|
-
] });
|
|
9573
|
-
};
|
|
9574
|
-
const CustomItemsForm = () => {
|
|
9575
|
-
const form = useForm({
|
|
9576
|
-
resolver: zodResolver(schema$5)
|
|
9577
|
-
});
|
|
9578
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9579
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9580
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9581
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9582
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9583
|
-
] }) })
|
|
9584
|
-
] }) });
|
|
9585
|
-
};
|
|
9586
|
-
const schema$5 = objectType({
|
|
9587
|
-
email: stringType().email()
|
|
9588
|
-
});
|
|
9589
|
-
const Email = () => {
|
|
9590
|
-
const { id } = useParams();
|
|
9591
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9592
|
-
fields: "+email"
|
|
9593
|
-
});
|
|
9594
|
-
if (isError) {
|
|
9595
|
-
throw error;
|
|
9596
|
-
}
|
|
9597
|
-
const isReady = !isPending && !!order;
|
|
9598
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9599
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9600
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9601
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9602
|
-
] }),
|
|
9603
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9604
|
-
] });
|
|
9605
|
-
};
|
|
9606
|
-
const EmailForm = ({ order }) => {
|
|
9607
|
-
const form = useForm({
|
|
9608
|
-
defaultValues: {
|
|
9609
|
-
email: order.email ?? ""
|
|
9610
|
-
},
|
|
9611
|
-
resolver: zodResolver(schema$4)
|
|
9612
|
-
});
|
|
9613
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9614
|
-
const { handleSuccess } = useRouteModal();
|
|
9615
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9616
|
-
await mutateAsync(
|
|
9617
|
-
{ email: data.email },
|
|
9618
|
-
{
|
|
9619
|
-
onSuccess: () => {
|
|
9620
|
-
handleSuccess();
|
|
9621
|
-
},
|
|
9622
|
-
onError: (error) => {
|
|
9623
|
-
toast.error(error.message);
|
|
9624
|
-
}
|
|
9625
|
-
}
|
|
9626
|
-
);
|
|
9627
|
-
});
|
|
9628
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9629
|
-
KeyboundForm,
|
|
9630
|
-
{
|
|
9631
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9632
|
-
onSubmit,
|
|
9633
|
-
children: [
|
|
9634
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9635
|
-
Form$2.Field,
|
|
9636
|
-
{
|
|
9637
|
-
control: form.control,
|
|
9638
|
-
name: "email",
|
|
9639
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9640
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9641
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9642
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9643
|
-
] })
|
|
9644
|
-
}
|
|
9645
|
-
) }),
|
|
9646
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9647
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9648
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9649
|
-
] }) })
|
|
9650
|
-
]
|
|
9651
|
-
}
|
|
9652
|
-
) });
|
|
9653
|
-
};
|
|
9654
|
-
const schema$4 = objectType({
|
|
9655
|
-
email: stringType().email()
|
|
9656
|
-
});
|
|
9657
9568
|
const BillingAddress = () => {
|
|
9658
9569
|
const { id } = useParams();
|
|
9659
9570
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9686,7 +9597,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9686
9597
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9687
9598
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9688
9599
|
},
|
|
9689
|
-
resolver: zodResolver(schema$
|
|
9600
|
+
resolver: zodResolver(schema$5)
|
|
9690
9601
|
});
|
|
9691
9602
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9692
9603
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9843,7 +9754,96 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9843
9754
|
}
|
|
9844
9755
|
) });
|
|
9845
9756
|
};
|
|
9846
|
-
const schema$
|
|
9757
|
+
const schema$5 = addressSchema;
|
|
9758
|
+
const CustomItems = () => {
|
|
9759
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9761
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9762
|
+
] });
|
|
9763
|
+
};
|
|
9764
|
+
const CustomItemsForm = () => {
|
|
9765
|
+
const form = useForm({
|
|
9766
|
+
resolver: zodResolver(schema$4)
|
|
9767
|
+
});
|
|
9768
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9769
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9770
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9771
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9772
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9773
|
+
] }) })
|
|
9774
|
+
] }) });
|
|
9775
|
+
};
|
|
9776
|
+
const schema$4 = objectType({
|
|
9777
|
+
email: stringType().email()
|
|
9778
|
+
});
|
|
9779
|
+
const Email = () => {
|
|
9780
|
+
const { id } = useParams();
|
|
9781
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9782
|
+
fields: "+email"
|
|
9783
|
+
});
|
|
9784
|
+
if (isError) {
|
|
9785
|
+
throw error;
|
|
9786
|
+
}
|
|
9787
|
+
const isReady = !isPending && !!order;
|
|
9788
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9789
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9790
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9791
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9792
|
+
] }),
|
|
9793
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9794
|
+
] });
|
|
9795
|
+
};
|
|
9796
|
+
const EmailForm = ({ order }) => {
|
|
9797
|
+
const form = useForm({
|
|
9798
|
+
defaultValues: {
|
|
9799
|
+
email: order.email ?? ""
|
|
9800
|
+
},
|
|
9801
|
+
resolver: zodResolver(schema$3)
|
|
9802
|
+
});
|
|
9803
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9804
|
+
const { handleSuccess } = useRouteModal();
|
|
9805
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9806
|
+
await mutateAsync(
|
|
9807
|
+
{ email: data.email },
|
|
9808
|
+
{
|
|
9809
|
+
onSuccess: () => {
|
|
9810
|
+
handleSuccess();
|
|
9811
|
+
},
|
|
9812
|
+
onError: (error) => {
|
|
9813
|
+
toast.error(error.message);
|
|
9814
|
+
}
|
|
9815
|
+
}
|
|
9816
|
+
);
|
|
9817
|
+
});
|
|
9818
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9819
|
+
KeyboundForm,
|
|
9820
|
+
{
|
|
9821
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9822
|
+
onSubmit,
|
|
9823
|
+
children: [
|
|
9824
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9825
|
+
Form$2.Field,
|
|
9826
|
+
{
|
|
9827
|
+
control: form.control,
|
|
9828
|
+
name: "email",
|
|
9829
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9830
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9831
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9832
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9833
|
+
] })
|
|
9834
|
+
}
|
|
9835
|
+
) }),
|
|
9836
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9837
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9838
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9839
|
+
] }) })
|
|
9840
|
+
]
|
|
9841
|
+
}
|
|
9842
|
+
) });
|
|
9843
|
+
};
|
|
9844
|
+
const schema$3 = objectType({
|
|
9845
|
+
email: stringType().email()
|
|
9846
|
+
});
|
|
9847
9847
|
const NumberInput = forwardRef(
|
|
9848
9848
|
({
|
|
9849
9849
|
value,
|
|
@@ -13057,6 +13057,10 @@ const routeModule = {
|
|
|
13057
13057
|
handle,
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
|
+
{
|
|
13061
|
+
Component: BillingAddress,
|
|
13062
|
+
path: "/draft-orders/:id/billing-address"
|
|
13063
|
+
},
|
|
13060
13064
|
{
|
|
13061
13065
|
Component: CustomItems,
|
|
13062
13066
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13065,10 +13069,6 @@ const routeModule = {
|
|
|
13065
13069
|
Component: Email,
|
|
13066
13070
|
path: "/draft-orders/:id/email"
|
|
13067
13071
|
},
|
|
13068
|
-
{
|
|
13069
|
-
Component: BillingAddress,
|
|
13070
|
-
path: "/draft-orders/:id/billing-address"
|
|
13071
|
-
},
|
|
13072
13072
|
{
|
|
13073
13073
|
Component: Items,
|
|
13074
13074
|
path: "/draft-orders/:id/items"
|
|
@@ -13115,12 +13115,14 @@ const formModule = { customFields: {} };
|
|
|
13115
13115
|
const displayModule = {
|
|
13116
13116
|
displays: {}
|
|
13117
13117
|
};
|
|
13118
|
+
const i18nModule = { resources: {} };
|
|
13118
13119
|
const plugin = {
|
|
13119
13120
|
widgetModule,
|
|
13120
13121
|
routeModule,
|
|
13121
13122
|
menuItemModule,
|
|
13122
13123
|
formModule,
|
|
13123
|
-
displayModule
|
|
13124
|
+
displayModule,
|
|
13125
|
+
i18nModule
|
|
13124
13126
|
};
|
|
13125
13127
|
export {
|
|
13126
13128
|
plugin as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.1-preview-
|
|
3
|
+
"version": "2.11.1-preview-20251023210200",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.11.1-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.1-preview-20251023210200",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.11.1-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.1-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.1-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.1-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.1-preview-
|
|
53
|
-
"@medusajs/types": "2.11.1-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.25-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.1-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.1-preview-20251023210200",
|
|
49
|
+
"@medusajs/cli": "2.11.1-preview-20251023210200",
|
|
50
|
+
"@medusajs/framework": "2.11.1-preview-20251023210200",
|
|
51
|
+
"@medusajs/icons": "2.11.1-preview-20251023210200",
|
|
52
|
+
"@medusajs/test-utils": "2.11.1-preview-20251023210200",
|
|
53
|
+
"@medusajs/types": "2.11.1-preview-20251023210200",
|
|
54
|
+
"@medusajs/ui": "4.0.25-preview-20251023210200",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.1-preview-20251023210200",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.11.1-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.1-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.1-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.1-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.1-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.25-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.1-preview-20251023210200",
|
|
73
|
+
"@medusajs/cli": "2.11.1-preview-20251023210200",
|
|
74
|
+
"@medusajs/framework": "2.11.1-preview-20251023210200",
|
|
75
|
+
"@medusajs/icons": "2.11.1-preview-20251023210200",
|
|
76
|
+
"@medusajs/test-utils": "2.11.1-preview-20251023210200",
|
|
77
|
+
"@medusajs/ui": "4.0.25-preview-20251023210200",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|