@medusajs/draft-order 2.11.2-preview-20251029060154 → 2.11.2-preview-20251029150203
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 +99 -99
- package/.medusa/server/src/admin/index.mjs +99 -99
- package/package.json +16 -16
|
@@ -9571,74 +9571,6 @@ const ID = () => {
|
|
|
9571
9571
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9572
9572
|
] });
|
|
9573
9573
|
};
|
|
9574
|
-
const Email = () => {
|
|
9575
|
-
const { id } = reactRouterDom.useParams();
|
|
9576
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9577
|
-
fields: "+email"
|
|
9578
|
-
});
|
|
9579
|
-
if (isError) {
|
|
9580
|
-
throw error;
|
|
9581
|
-
}
|
|
9582
|
-
const isReady = !isPending && !!order;
|
|
9583
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9584
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9585
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9586
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9587
|
-
] }),
|
|
9588
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9589
|
-
] });
|
|
9590
|
-
};
|
|
9591
|
-
const EmailForm = ({ order }) => {
|
|
9592
|
-
const form = reactHookForm.useForm({
|
|
9593
|
-
defaultValues: {
|
|
9594
|
-
email: order.email ?? ""
|
|
9595
|
-
},
|
|
9596
|
-
resolver: zod.zodResolver(schema$5)
|
|
9597
|
-
});
|
|
9598
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9599
|
-
const { handleSuccess } = useRouteModal();
|
|
9600
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9601
|
-
await mutateAsync(
|
|
9602
|
-
{ email: data.email },
|
|
9603
|
-
{
|
|
9604
|
-
onSuccess: () => {
|
|
9605
|
-
handleSuccess();
|
|
9606
|
-
},
|
|
9607
|
-
onError: (error) => {
|
|
9608
|
-
ui.toast.error(error.message);
|
|
9609
|
-
}
|
|
9610
|
-
}
|
|
9611
|
-
);
|
|
9612
|
-
});
|
|
9613
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9614
|
-
KeyboundForm,
|
|
9615
|
-
{
|
|
9616
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9617
|
-
onSubmit,
|
|
9618
|
-
children: [
|
|
9619
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9620
|
-
Form$2.Field,
|
|
9621
|
-
{
|
|
9622
|
-
control: form.control,
|
|
9623
|
-
name: "email",
|
|
9624
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9625
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9626
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9627
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9628
|
-
] })
|
|
9629
|
-
}
|
|
9630
|
-
) }),
|
|
9631
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9632
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9633
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9634
|
-
] }) })
|
|
9635
|
-
]
|
|
9636
|
-
}
|
|
9637
|
-
) });
|
|
9638
|
-
};
|
|
9639
|
-
const schema$5 = objectType({
|
|
9640
|
-
email: stringType().email()
|
|
9641
|
-
});
|
|
9642
9574
|
const BillingAddress = () => {
|
|
9643
9575
|
const { id } = reactRouterDom.useParams();
|
|
9644
9576
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9671,7 +9603,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9671
9603
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9672
9604
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9673
9605
|
},
|
|
9674
|
-
resolver: zod.zodResolver(schema$
|
|
9606
|
+
resolver: zod.zodResolver(schema$5)
|
|
9675
9607
|
});
|
|
9676
9608
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9677
9609
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9828,7 +9760,96 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9828
9760
|
}
|
|
9829
9761
|
) });
|
|
9830
9762
|
};
|
|
9831
|
-
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
|
+
});
|
|
9832
9853
|
const NumberInput = React.forwardRef(
|
|
9833
9854
|
({
|
|
9834
9855
|
value,
|
|
@@ -11430,27 +11451,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11430
11451
|
}
|
|
11431
11452
|
return Array.from(promotionIds);
|
|
11432
11453
|
}
|
|
11433
|
-
const CustomItems = () => {
|
|
11434
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11435
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
11436
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
11437
|
-
] });
|
|
11438
|
-
};
|
|
11439
|
-
const CustomItemsForm = () => {
|
|
11440
|
-
const form = reactHookForm.useForm({
|
|
11441
|
-
resolver: zod.zodResolver(schema$3)
|
|
11442
|
-
});
|
|
11443
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11444
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
11445
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11446
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11447
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
11448
|
-
] }) })
|
|
11449
|
-
] }) });
|
|
11450
|
-
};
|
|
11451
|
-
const schema$3 = objectType({
|
|
11452
|
-
email: stringType().email()
|
|
11453
|
-
});
|
|
11454
11454
|
const SalesChannel = () => {
|
|
11455
11455
|
const { id } = reactRouterDom.useParams();
|
|
11456
11456
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13063,14 +13063,18 @@ const routeModule = {
|
|
|
13063
13063
|
handle,
|
|
13064
13064
|
loader,
|
|
13065
13065
|
children: [
|
|
13066
|
-
{
|
|
13067
|
-
Component: Email,
|
|
13068
|
-
path: "/draft-orders/:id/email"
|
|
13069
|
-
},
|
|
13070
13066
|
{
|
|
13071
13067
|
Component: BillingAddress,
|
|
13072
13068
|
path: "/draft-orders/:id/billing-address"
|
|
13073
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: CustomItems,
|
|
13072
|
+
path: "/draft-orders/:id/custom-items"
|
|
13073
|
+
},
|
|
13074
|
+
{
|
|
13075
|
+
Component: Email,
|
|
13076
|
+
path: "/draft-orders/:id/email"
|
|
13077
|
+
},
|
|
13074
13078
|
{
|
|
13075
13079
|
Component: Items,
|
|
13076
13080
|
path: "/draft-orders/:id/items"
|
|
@@ -13083,10 +13087,6 @@ const routeModule = {
|
|
|
13083
13087
|
Component: Promotions,
|
|
13084
13088
|
path: "/draft-orders/:id/promotions"
|
|
13085
13089
|
},
|
|
13086
|
-
{
|
|
13087
|
-
Component: CustomItems,
|
|
13088
|
-
path: "/draft-orders/:id/custom-items"
|
|
13089
|
-
},
|
|
13090
13090
|
{
|
|
13091
13091
|
Component: SalesChannel,
|
|
13092
13092
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -9565,74 +9565,6 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const Email = () => {
|
|
9569
|
-
const { id } = useParams();
|
|
9570
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9571
|
-
fields: "+email"
|
|
9572
|
-
});
|
|
9573
|
-
if (isError) {
|
|
9574
|
-
throw error;
|
|
9575
|
-
}
|
|
9576
|
-
const isReady = !isPending && !!order;
|
|
9577
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9578
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9579
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9580
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9581
|
-
] }),
|
|
9582
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9583
|
-
] });
|
|
9584
|
-
};
|
|
9585
|
-
const EmailForm = ({ order }) => {
|
|
9586
|
-
const form = useForm({
|
|
9587
|
-
defaultValues: {
|
|
9588
|
-
email: order.email ?? ""
|
|
9589
|
-
},
|
|
9590
|
-
resolver: zodResolver(schema$5)
|
|
9591
|
-
});
|
|
9592
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9593
|
-
const { handleSuccess } = useRouteModal();
|
|
9594
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9595
|
-
await mutateAsync(
|
|
9596
|
-
{ email: data.email },
|
|
9597
|
-
{
|
|
9598
|
-
onSuccess: () => {
|
|
9599
|
-
handleSuccess();
|
|
9600
|
-
},
|
|
9601
|
-
onError: (error) => {
|
|
9602
|
-
toast.error(error.message);
|
|
9603
|
-
}
|
|
9604
|
-
}
|
|
9605
|
-
);
|
|
9606
|
-
});
|
|
9607
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9608
|
-
KeyboundForm,
|
|
9609
|
-
{
|
|
9610
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9611
|
-
onSubmit,
|
|
9612
|
-
children: [
|
|
9613
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9614
|
-
Form$2.Field,
|
|
9615
|
-
{
|
|
9616
|
-
control: form.control,
|
|
9617
|
-
name: "email",
|
|
9618
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9619
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9620
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9621
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9622
|
-
] })
|
|
9623
|
-
}
|
|
9624
|
-
) }),
|
|
9625
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9626
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9627
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9628
|
-
] }) })
|
|
9629
|
-
]
|
|
9630
|
-
}
|
|
9631
|
-
) });
|
|
9632
|
-
};
|
|
9633
|
-
const schema$5 = objectType({
|
|
9634
|
-
email: stringType().email()
|
|
9635
|
-
});
|
|
9636
9568
|
const BillingAddress = () => {
|
|
9637
9569
|
const { id } = useParams();
|
|
9638
9570
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9665,7 +9597,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9665
9597
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9666
9598
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9667
9599
|
},
|
|
9668
|
-
resolver: zodResolver(schema$
|
|
9600
|
+
resolver: zodResolver(schema$5)
|
|
9669
9601
|
});
|
|
9670
9602
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9671
9603
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9822,7 +9754,96 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9822
9754
|
}
|
|
9823
9755
|
) });
|
|
9824
9756
|
};
|
|
9825
|
-
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
|
+
});
|
|
9826
9847
|
const NumberInput = forwardRef(
|
|
9827
9848
|
({
|
|
9828
9849
|
value,
|
|
@@ -11424,27 +11445,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11424
11445
|
}
|
|
11425
11446
|
return Array.from(promotionIds);
|
|
11426
11447
|
}
|
|
11427
|
-
const CustomItems = () => {
|
|
11428
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11429
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
11430
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
11431
|
-
] });
|
|
11432
|
-
};
|
|
11433
|
-
const CustomItemsForm = () => {
|
|
11434
|
-
const form = useForm({
|
|
11435
|
-
resolver: zodResolver(schema$3)
|
|
11436
|
-
});
|
|
11437
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11438
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
11439
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11440
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11441
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
11442
|
-
] }) })
|
|
11443
|
-
] }) });
|
|
11444
|
-
};
|
|
11445
|
-
const schema$3 = objectType({
|
|
11446
|
-
email: stringType().email()
|
|
11447
|
-
});
|
|
11448
11448
|
const SalesChannel = () => {
|
|
11449
11449
|
const { id } = useParams();
|
|
11450
11450
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13057,14 +13057,18 @@ const routeModule = {
|
|
|
13057
13057
|
handle,
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
|
-
{
|
|
13061
|
-
Component: Email,
|
|
13062
|
-
path: "/draft-orders/:id/email"
|
|
13063
|
-
},
|
|
13064
13060
|
{
|
|
13065
13061
|
Component: BillingAddress,
|
|
13066
13062
|
path: "/draft-orders/:id/billing-address"
|
|
13067
13063
|
},
|
|
13064
|
+
{
|
|
13065
|
+
Component: CustomItems,
|
|
13066
|
+
path: "/draft-orders/:id/custom-items"
|
|
13067
|
+
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: Email,
|
|
13070
|
+
path: "/draft-orders/:id/email"
|
|
13071
|
+
},
|
|
13068
13072
|
{
|
|
13069
13073
|
Component: Items,
|
|
13070
13074
|
path: "/draft-orders/:id/items"
|
|
@@ -13077,10 +13081,6 @@ const routeModule = {
|
|
|
13077
13081
|
Component: Promotions,
|
|
13078
13082
|
path: "/draft-orders/:id/promotions"
|
|
13079
13083
|
},
|
|
13080
|
-
{
|
|
13081
|
-
Component: CustomItems,
|
|
13082
|
-
path: "/draft-orders/:id/custom-items"
|
|
13083
|
-
},
|
|
13084
13084
|
{
|
|
13085
13085
|
Component: SalesChannel,
|
|
13086
13086
|
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.11.2-preview-
|
|
3
|
+
"version": "2.11.2-preview-20251029150203",
|
|
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.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.2-preview-20251029150203",
|
|
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.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.2-preview-
|
|
53
|
-
"@medusajs/types": "2.11.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.26-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.2-preview-20251029150203",
|
|
49
|
+
"@medusajs/cli": "2.11.2-preview-20251029150203",
|
|
50
|
+
"@medusajs/framework": "2.11.2-preview-20251029150203",
|
|
51
|
+
"@medusajs/icons": "2.11.2-preview-20251029150203",
|
|
52
|
+
"@medusajs/test-utils": "2.11.2-preview-20251029150203",
|
|
53
|
+
"@medusajs/types": "2.11.2-preview-20251029150203",
|
|
54
|
+
"@medusajs/ui": "4.0.26-preview-20251029150203",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.2-preview-20251029150203",
|
|
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.2-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.2-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.2-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.2-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.2-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.26-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.2-preview-20251029150203",
|
|
73
|
+
"@medusajs/cli": "2.11.2-preview-20251029150203",
|
|
74
|
+
"@medusajs/framework": "2.11.2-preview-20251029150203",
|
|
75
|
+
"@medusajs/icons": "2.11.2-preview-20251029150203",
|
|
76
|
+
"@medusajs/test-utils": "2.11.2-preview-20251029150203",
|
|
77
|
+
"@medusajs/ui": "4.0.26-preview-20251029150203",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|