@medusajs/draft-order 2.10.4-preview-20251011180203 → 2.10.4-preview-20251012000322
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 +89 -89
- package/.medusa/server/src/admin/index.mjs +89 -89
- package/package.json +16 -16
|
@@ -9763,70 +9763,23 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9763
9763
|
) });
|
|
9764
9764
|
};
|
|
9765
9765
|
const schema$5 = addressSchema;
|
|
9766
|
-
const
|
|
9767
|
-
const { id } = reactRouterDom.useParams();
|
|
9768
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9769
|
-
fields: "+email"
|
|
9770
|
-
});
|
|
9771
|
-
if (isError) {
|
|
9772
|
-
throw error;
|
|
9773
|
-
}
|
|
9774
|
-
const isReady = !isPending && !!order;
|
|
9766
|
+
const CustomItems = () => {
|
|
9775
9767
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9776
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9777
|
-
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9779
|
-
] }),
|
|
9780
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
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, {})
|
|
9781
9770
|
] });
|
|
9782
9771
|
};
|
|
9783
|
-
const
|
|
9772
|
+
const CustomItemsForm = () => {
|
|
9784
9773
|
const form = reactHookForm.useForm({
|
|
9785
|
-
defaultValues: {
|
|
9786
|
-
email: order.email ?? ""
|
|
9787
|
-
},
|
|
9788
9774
|
resolver: zod.zodResolver(schema$4)
|
|
9789
9775
|
});
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
{
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
handleSuccess();
|
|
9798
|
-
},
|
|
9799
|
-
onError: (error) => {
|
|
9800
|
-
ui.toast.error(error.message);
|
|
9801
|
-
}
|
|
9802
|
-
}
|
|
9803
|
-
);
|
|
9804
|
-
});
|
|
9805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9806
|
-
KeyboundForm,
|
|
9807
|
-
{
|
|
9808
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9809
|
-
onSubmit,
|
|
9810
|
-
children: [
|
|
9811
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9812
|
-
Form$2.Field,
|
|
9813
|
-
{
|
|
9814
|
-
control: form.control,
|
|
9815
|
-
name: "email",
|
|
9816
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9817
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9818
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9819
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9820
|
-
] })
|
|
9821
|
-
}
|
|
9822
|
-
) }),
|
|
9823
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9824
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9825
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9826
|
-
] }) })
|
|
9827
|
-
]
|
|
9828
|
-
}
|
|
9829
|
-
) });
|
|
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
|
+
] }) });
|
|
9830
9783
|
};
|
|
9831
9784
|
const schema$4 = objectType({
|
|
9832
9785
|
email: stringType().email()
|
|
@@ -10805,27 +10758,6 @@ const customItemSchema = objectType({
|
|
|
10805
10758
|
quantity: numberType(),
|
|
10806
10759
|
unit_price: unionType([numberType(), stringType()])
|
|
10807
10760
|
});
|
|
10808
|
-
const CustomItems = () => {
|
|
10809
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10810
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
10811
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
10812
|
-
] });
|
|
10813
|
-
};
|
|
10814
|
-
const CustomItemsForm = () => {
|
|
10815
|
-
const form = reactHookForm.useForm({
|
|
10816
|
-
resolver: zod.zodResolver(schema$3)
|
|
10817
|
-
});
|
|
10818
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10819
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
10820
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10821
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10822
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
10823
|
-
] }) })
|
|
10824
|
-
] }) });
|
|
10825
|
-
};
|
|
10826
|
-
const schema$3 = objectType({
|
|
10827
|
-
email: stringType().email()
|
|
10828
|
-
});
|
|
10829
10761
|
const InlineTip = React.forwardRef(
|
|
10830
10762
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10831
10763
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11481,7 +11413,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11481
11413
|
defaultValues: {
|
|
11482
11414
|
sales_channel_id: order.sales_channel_id || ""
|
|
11483
11415
|
},
|
|
11484
|
-
resolver: zod.zodResolver(schema$
|
|
11416
|
+
resolver: zod.zodResolver(schema$3)
|
|
11485
11417
|
});
|
|
11486
11418
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11487
11419
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11556,7 +11488,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11556
11488
|
}
|
|
11557
11489
|
);
|
|
11558
11490
|
};
|
|
11559
|
-
const schema$
|
|
11491
|
+
const schema$3 = objectType({
|
|
11560
11492
|
sales_channel_id: stringType().min(1)
|
|
11561
11493
|
});
|
|
11562
11494
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12398,7 +12330,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12398
12330
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12399
12331
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12400
12332
|
},
|
|
12401
|
-
resolver: zod.zodResolver(schema$
|
|
12333
|
+
resolver: zod.zodResolver(schema$2)
|
|
12402
12334
|
});
|
|
12403
12335
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12404
12336
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12568,7 +12500,75 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12568
12500
|
}
|
|
12569
12501
|
) });
|
|
12570
12502
|
};
|
|
12571
|
-
const schema$
|
|
12503
|
+
const schema$2 = addressSchema;
|
|
12504
|
+
const Email = () => {
|
|
12505
|
+
const { id } = reactRouterDom.useParams();
|
|
12506
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12507
|
+
fields: "+email"
|
|
12508
|
+
});
|
|
12509
|
+
if (isError) {
|
|
12510
|
+
throw error;
|
|
12511
|
+
}
|
|
12512
|
+
const isReady = !isPending && !!order;
|
|
12513
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12514
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12515
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12516
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12517
|
+
] }),
|
|
12518
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12519
|
+
] });
|
|
12520
|
+
};
|
|
12521
|
+
const EmailForm = ({ order }) => {
|
|
12522
|
+
const form = reactHookForm.useForm({
|
|
12523
|
+
defaultValues: {
|
|
12524
|
+
email: order.email ?? ""
|
|
12525
|
+
},
|
|
12526
|
+
resolver: zod.zodResolver(schema$1)
|
|
12527
|
+
});
|
|
12528
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12529
|
+
const { handleSuccess } = useRouteModal();
|
|
12530
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12531
|
+
await mutateAsync(
|
|
12532
|
+
{ email: data.email },
|
|
12533
|
+
{
|
|
12534
|
+
onSuccess: () => {
|
|
12535
|
+
handleSuccess();
|
|
12536
|
+
},
|
|
12537
|
+
onError: (error) => {
|
|
12538
|
+
ui.toast.error(error.message);
|
|
12539
|
+
}
|
|
12540
|
+
}
|
|
12541
|
+
);
|
|
12542
|
+
});
|
|
12543
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12544
|
+
KeyboundForm,
|
|
12545
|
+
{
|
|
12546
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12547
|
+
onSubmit,
|
|
12548
|
+
children: [
|
|
12549
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12550
|
+
Form$2.Field,
|
|
12551
|
+
{
|
|
12552
|
+
control: form.control,
|
|
12553
|
+
name: "email",
|
|
12554
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12555
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
12556
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12558
|
+
] })
|
|
12559
|
+
}
|
|
12560
|
+
) }),
|
|
12561
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12562
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12563
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12564
|
+
] }) })
|
|
12565
|
+
]
|
|
12566
|
+
}
|
|
12567
|
+
) });
|
|
12568
|
+
};
|
|
12569
|
+
const schema$1 = objectType({
|
|
12570
|
+
email: stringType().email()
|
|
12571
|
+
});
|
|
12572
12572
|
const TransferOwnership = () => {
|
|
12573
12573
|
const { id } = reactRouterDom.useParams();
|
|
12574
12574
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13070,17 +13070,13 @@ const routeModule = {
|
|
|
13070
13070
|
path: "/draft-orders/:id/billing-address"
|
|
13071
13071
|
},
|
|
13072
13072
|
{
|
|
13073
|
-
Component:
|
|
13074
|
-
path: "/draft-orders/:id/
|
|
13073
|
+
Component: CustomItems,
|
|
13074
|
+
path: "/draft-orders/:id/custom-items"
|
|
13075
13075
|
},
|
|
13076
13076
|
{
|
|
13077
13077
|
Component: Items,
|
|
13078
13078
|
path: "/draft-orders/:id/items"
|
|
13079
13079
|
},
|
|
13080
|
-
{
|
|
13081
|
-
Component: CustomItems,
|
|
13082
|
-
path: "/draft-orders/:id/custom-items"
|
|
13083
|
-
},
|
|
13084
13080
|
{
|
|
13085
13081
|
Component: Metadata,
|
|
13086
13082
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13101,6 +13097,10 @@ const routeModule = {
|
|
|
13101
13097
|
Component: ShippingAddress,
|
|
13102
13098
|
path: "/draft-orders/:id/shipping-address"
|
|
13103
13099
|
},
|
|
13100
|
+
{
|
|
13101
|
+
Component: Email,
|
|
13102
|
+
path: "/draft-orders/:id/email"
|
|
13103
|
+
},
|
|
13104
13104
|
{
|
|
13105
13105
|
Component: TransferOwnership,
|
|
13106
13106
|
path: "/draft-orders/:id/transfer-ownership"
|
|
@@ -9757,70 +9757,23 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9757
9757
|
) });
|
|
9758
9758
|
};
|
|
9759
9759
|
const schema$5 = addressSchema;
|
|
9760
|
-
const
|
|
9761
|
-
const { id } = useParams();
|
|
9762
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9763
|
-
fields: "+email"
|
|
9764
|
-
});
|
|
9765
|
-
if (isError) {
|
|
9766
|
-
throw error;
|
|
9767
|
-
}
|
|
9768
|
-
const isReady = !isPending && !!order;
|
|
9760
|
+
const CustomItems = () => {
|
|
9769
9761
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9770
|
-
/* @__PURE__ */
|
|
9771
|
-
|
|
9772
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9773
|
-
] }),
|
|
9774
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9762
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9763
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9775
9764
|
] });
|
|
9776
9765
|
};
|
|
9777
|
-
const
|
|
9766
|
+
const CustomItemsForm = () => {
|
|
9778
9767
|
const form = useForm({
|
|
9779
|
-
defaultValues: {
|
|
9780
|
-
email: order.email ?? ""
|
|
9781
|
-
},
|
|
9782
9768
|
resolver: zodResolver(schema$4)
|
|
9783
9769
|
});
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
{
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
handleSuccess();
|
|
9792
|
-
},
|
|
9793
|
-
onError: (error) => {
|
|
9794
|
-
toast.error(error.message);
|
|
9795
|
-
}
|
|
9796
|
-
}
|
|
9797
|
-
);
|
|
9798
|
-
});
|
|
9799
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9800
|
-
KeyboundForm,
|
|
9801
|
-
{
|
|
9802
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9803
|
-
onSubmit,
|
|
9804
|
-
children: [
|
|
9805
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9806
|
-
Form$2.Field,
|
|
9807
|
-
{
|
|
9808
|
-
control: form.control,
|
|
9809
|
-
name: "email",
|
|
9810
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9811
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9812
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9813
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9814
|
-
] })
|
|
9815
|
-
}
|
|
9816
|
-
) }),
|
|
9817
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9818
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9819
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9820
|
-
] }) })
|
|
9821
|
-
]
|
|
9822
|
-
}
|
|
9823
|
-
) });
|
|
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
|
+
] }) });
|
|
9824
9777
|
};
|
|
9825
9778
|
const schema$4 = objectType({
|
|
9826
9779
|
email: stringType().email()
|
|
@@ -10799,27 +10752,6 @@ const customItemSchema = objectType({
|
|
|
10799
10752
|
quantity: numberType(),
|
|
10800
10753
|
unit_price: unionType([numberType(), stringType()])
|
|
10801
10754
|
});
|
|
10802
|
-
const CustomItems = () => {
|
|
10803
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10804
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
10805
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
10806
|
-
] });
|
|
10807
|
-
};
|
|
10808
|
-
const CustomItemsForm = () => {
|
|
10809
|
-
const form = useForm({
|
|
10810
|
-
resolver: zodResolver(schema$3)
|
|
10811
|
-
});
|
|
10812
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10813
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
10814
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10815
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10816
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
10817
|
-
] }) })
|
|
10818
|
-
] }) });
|
|
10819
|
-
};
|
|
10820
|
-
const schema$3 = objectType({
|
|
10821
|
-
email: stringType().email()
|
|
10822
|
-
});
|
|
10823
10755
|
const InlineTip = forwardRef(
|
|
10824
10756
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10825
10757
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11475,7 +11407,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11475
11407
|
defaultValues: {
|
|
11476
11408
|
sales_channel_id: order.sales_channel_id || ""
|
|
11477
11409
|
},
|
|
11478
|
-
resolver: zodResolver(schema$
|
|
11410
|
+
resolver: zodResolver(schema$3)
|
|
11479
11411
|
});
|
|
11480
11412
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11481
11413
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11550,7 +11482,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11550
11482
|
}
|
|
11551
11483
|
);
|
|
11552
11484
|
};
|
|
11553
|
-
const schema$
|
|
11485
|
+
const schema$3 = objectType({
|
|
11554
11486
|
sales_channel_id: stringType().min(1)
|
|
11555
11487
|
});
|
|
11556
11488
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12392,7 +12324,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12392
12324
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12393
12325
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12394
12326
|
},
|
|
12395
|
-
resolver: zodResolver(schema$
|
|
12327
|
+
resolver: zodResolver(schema$2)
|
|
12396
12328
|
});
|
|
12397
12329
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12398
12330
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12562,7 +12494,75 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12562
12494
|
}
|
|
12563
12495
|
) });
|
|
12564
12496
|
};
|
|
12565
|
-
const schema$
|
|
12497
|
+
const schema$2 = addressSchema;
|
|
12498
|
+
const Email = () => {
|
|
12499
|
+
const { id } = useParams();
|
|
12500
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12501
|
+
fields: "+email"
|
|
12502
|
+
});
|
|
12503
|
+
if (isError) {
|
|
12504
|
+
throw error;
|
|
12505
|
+
}
|
|
12506
|
+
const isReady = !isPending && !!order;
|
|
12507
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12508
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12509
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12510
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12511
|
+
] }),
|
|
12512
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12513
|
+
] });
|
|
12514
|
+
};
|
|
12515
|
+
const EmailForm = ({ order }) => {
|
|
12516
|
+
const form = useForm({
|
|
12517
|
+
defaultValues: {
|
|
12518
|
+
email: order.email ?? ""
|
|
12519
|
+
},
|
|
12520
|
+
resolver: zodResolver(schema$1)
|
|
12521
|
+
});
|
|
12522
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12523
|
+
const { handleSuccess } = useRouteModal();
|
|
12524
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12525
|
+
await mutateAsync(
|
|
12526
|
+
{ email: data.email },
|
|
12527
|
+
{
|
|
12528
|
+
onSuccess: () => {
|
|
12529
|
+
handleSuccess();
|
|
12530
|
+
},
|
|
12531
|
+
onError: (error) => {
|
|
12532
|
+
toast.error(error.message);
|
|
12533
|
+
}
|
|
12534
|
+
}
|
|
12535
|
+
);
|
|
12536
|
+
});
|
|
12537
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12538
|
+
KeyboundForm,
|
|
12539
|
+
{
|
|
12540
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12541
|
+
onSubmit,
|
|
12542
|
+
children: [
|
|
12543
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
12544
|
+
Form$2.Field,
|
|
12545
|
+
{
|
|
12546
|
+
control: form.control,
|
|
12547
|
+
name: "email",
|
|
12548
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12549
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
12550
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12551
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12552
|
+
] })
|
|
12553
|
+
}
|
|
12554
|
+
) }),
|
|
12555
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12556
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12557
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12558
|
+
] }) })
|
|
12559
|
+
]
|
|
12560
|
+
}
|
|
12561
|
+
) });
|
|
12562
|
+
};
|
|
12563
|
+
const schema$1 = objectType({
|
|
12564
|
+
email: stringType().email()
|
|
12565
|
+
});
|
|
12566
12566
|
const TransferOwnership = () => {
|
|
12567
12567
|
const { id } = useParams();
|
|
12568
12568
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13064,17 +13064,13 @@ const routeModule = {
|
|
|
13064
13064
|
path: "/draft-orders/:id/billing-address"
|
|
13065
13065
|
},
|
|
13066
13066
|
{
|
|
13067
|
-
Component:
|
|
13068
|
-
path: "/draft-orders/:id/
|
|
13067
|
+
Component: CustomItems,
|
|
13068
|
+
path: "/draft-orders/:id/custom-items"
|
|
13069
13069
|
},
|
|
13070
13070
|
{
|
|
13071
13071
|
Component: Items,
|
|
13072
13072
|
path: "/draft-orders/:id/items"
|
|
13073
13073
|
},
|
|
13074
|
-
{
|
|
13075
|
-
Component: CustomItems,
|
|
13076
|
-
path: "/draft-orders/:id/custom-items"
|
|
13077
|
-
},
|
|
13078
13074
|
{
|
|
13079
13075
|
Component: Metadata,
|
|
13080
13076
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13095,6 +13091,10 @@ const routeModule = {
|
|
|
13095
13091
|
Component: ShippingAddress,
|
|
13096
13092
|
path: "/draft-orders/:id/shipping-address"
|
|
13097
13093
|
},
|
|
13094
|
+
{
|
|
13095
|
+
Component: Email,
|
|
13096
|
+
path: "/draft-orders/:id/email"
|
|
13097
|
+
},
|
|
13098
13098
|
{
|
|
13099
13099
|
Component: TransferOwnership,
|
|
13100
13100
|
path: "/draft-orders/:id/transfer-ownership"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.4-preview-
|
|
3
|
+
"version": "2.10.4-preview-20251012000322",
|
|
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.10.4-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.4-preview-20251012000322",
|
|
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.10.4-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
53
|
-
"@medusajs/types": "2.10.4-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.4-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20251012000322",
|
|
49
|
+
"@medusajs/cli": "2.10.4-preview-20251012000322",
|
|
50
|
+
"@medusajs/framework": "2.10.4-preview-20251012000322",
|
|
51
|
+
"@medusajs/icons": "2.10.4-preview-20251012000322",
|
|
52
|
+
"@medusajs/test-utils": "2.10.4-preview-20251012000322",
|
|
53
|
+
"@medusajs/types": "2.10.4-preview-20251012000322",
|
|
54
|
+
"@medusajs/ui": "4.0.24-preview-20251012000322",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.4-preview-20251012000322",
|
|
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.10.4-preview-
|
|
73
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
74
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
75
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20251012000322",
|
|
73
|
+
"@medusajs/cli": "2.10.4-preview-20251012000322",
|
|
74
|
+
"@medusajs/framework": "2.10.4-preview-20251012000322",
|
|
75
|
+
"@medusajs/icons": "2.10.4-preview-20251012000322",
|
|
76
|
+
"@medusajs/test-utils": "2.10.4-preview-20251012000322",
|
|
77
|
+
"@medusajs/ui": "4.0.24-preview-20251012000322",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|