@medusajs/draft-order 2.11.2-preview-20251027000324 → 2.11.2-preview-20251027060158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +103 -103
- package/.medusa/server/src/admin/index.mjs +103 -103
- package/package.json +16 -16
|
@@ -9761,6 +9761,27 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9761
9761
|
) });
|
|
9762
9762
|
};
|
|
9763
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
|
+
});
|
|
9764
9785
|
const NumberInput = React.forwardRef(
|
|
9765
9786
|
({
|
|
9766
9787
|
value,
|
|
@@ -10735,6 +10756,74 @@ const customItemSchema = objectType({
|
|
|
10735
10756
|
quantity: numberType(),
|
|
10736
10757
|
unit_price: unionType([numberType(), stringType()])
|
|
10737
10758
|
});
|
|
10759
|
+
const Email = () => {
|
|
10760
|
+
const { id } = reactRouterDom.useParams();
|
|
10761
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10762
|
+
fields: "+email"
|
|
10763
|
+
});
|
|
10764
|
+
if (isError) {
|
|
10765
|
+
throw error;
|
|
10766
|
+
}
|
|
10767
|
+
const isReady = !isPending && !!order;
|
|
10768
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10769
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10770
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10771
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10772
|
+
] }),
|
|
10773
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10774
|
+
] });
|
|
10775
|
+
};
|
|
10776
|
+
const EmailForm = ({ order }) => {
|
|
10777
|
+
const form = reactHookForm.useForm({
|
|
10778
|
+
defaultValues: {
|
|
10779
|
+
email: order.email ?? ""
|
|
10780
|
+
},
|
|
10781
|
+
resolver: zod.zodResolver(schema$3)
|
|
10782
|
+
});
|
|
10783
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10784
|
+
const { handleSuccess } = useRouteModal();
|
|
10785
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10786
|
+
await mutateAsync(
|
|
10787
|
+
{ email: data.email },
|
|
10788
|
+
{
|
|
10789
|
+
onSuccess: () => {
|
|
10790
|
+
handleSuccess();
|
|
10791
|
+
},
|
|
10792
|
+
onError: (error) => {
|
|
10793
|
+
ui.toast.error(error.message);
|
|
10794
|
+
}
|
|
10795
|
+
}
|
|
10796
|
+
);
|
|
10797
|
+
});
|
|
10798
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10799
|
+
KeyboundForm,
|
|
10800
|
+
{
|
|
10801
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10802
|
+
onSubmit,
|
|
10803
|
+
children: [
|
|
10804
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10805
|
+
Form$2.Field,
|
|
10806
|
+
{
|
|
10807
|
+
control: form.control,
|
|
10808
|
+
name: "email",
|
|
10809
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10810
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10811
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10812
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10813
|
+
] })
|
|
10814
|
+
}
|
|
10815
|
+
) }),
|
|
10816
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10817
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10818
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10819
|
+
] }) })
|
|
10820
|
+
]
|
|
10821
|
+
}
|
|
10822
|
+
) });
|
|
10823
|
+
};
|
|
10824
|
+
const schema$3 = objectType({
|
|
10825
|
+
email: stringType().email()
|
|
10826
|
+
});
|
|
10738
10827
|
const InlineTip = React.forwardRef(
|
|
10739
10828
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10740
10829
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -12197,7 +12286,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12197
12286
|
defaultValues: {
|
|
12198
12287
|
sales_channel_id: order.sales_channel_id || ""
|
|
12199
12288
|
},
|
|
12200
|
-
resolver: zod.zodResolver(schema$
|
|
12289
|
+
resolver: zod.zodResolver(schema$2)
|
|
12201
12290
|
});
|
|
12202
12291
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12203
12292
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12272,7 +12361,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
12272
12361
|
}
|
|
12273
12362
|
);
|
|
12274
12363
|
};
|
|
12275
|
-
const schema$
|
|
12364
|
+
const schema$2 = objectType({
|
|
12276
12365
|
sales_channel_id: stringType().min(1)
|
|
12277
12366
|
});
|
|
12278
12367
|
const ShippingAddress = () => {
|
|
@@ -12307,7 +12396,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12307
12396
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12308
12397
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12309
12398
|
},
|
|
12310
|
-
resolver: zod.zodResolver(schema$
|
|
12399
|
+
resolver: zod.zodResolver(schema$1)
|
|
12311
12400
|
});
|
|
12312
12401
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12313
12402
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12477,7 +12566,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12477
12566
|
}
|
|
12478
12567
|
) });
|
|
12479
12568
|
};
|
|
12480
|
-
const schema$
|
|
12569
|
+
const schema$1 = addressSchema;
|
|
12481
12570
|
const TransferOwnership = () => {
|
|
12482
12571
|
const { id } = reactRouterDom.useParams();
|
|
12483
12572
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12501,7 +12590,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12501
12590
|
defaultValues: {
|
|
12502
12591
|
customer_id: order.customer_id || ""
|
|
12503
12592
|
},
|
|
12504
|
-
resolver: zod.zodResolver(schema
|
|
12593
|
+
resolver: zod.zodResolver(schema)
|
|
12505
12594
|
});
|
|
12506
12595
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12507
12596
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12951,97 +13040,8 @@ const Illustration = () => {
|
|
|
12951
13040
|
}
|
|
12952
13041
|
);
|
|
12953
13042
|
};
|
|
12954
|
-
const schema$2 = objectType({
|
|
12955
|
-
customer_id: stringType().min(1)
|
|
12956
|
-
});
|
|
12957
|
-
const CustomItems = () => {
|
|
12958
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12959
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
12960
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
12961
|
-
] });
|
|
12962
|
-
};
|
|
12963
|
-
const CustomItemsForm = () => {
|
|
12964
|
-
const form = reactHookForm.useForm({
|
|
12965
|
-
resolver: zod.zodResolver(schema$1)
|
|
12966
|
-
});
|
|
12967
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
12968
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
12969
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12970
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12971
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
12972
|
-
] }) })
|
|
12973
|
-
] }) });
|
|
12974
|
-
};
|
|
12975
|
-
const schema$1 = objectType({
|
|
12976
|
-
email: stringType().email()
|
|
12977
|
-
});
|
|
12978
|
-
const Email = () => {
|
|
12979
|
-
const { id } = reactRouterDom.useParams();
|
|
12980
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12981
|
-
fields: "+email"
|
|
12982
|
-
});
|
|
12983
|
-
if (isError) {
|
|
12984
|
-
throw error;
|
|
12985
|
-
}
|
|
12986
|
-
const isReady = !isPending && !!order;
|
|
12987
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12988
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12989
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
12990
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12991
|
-
] }),
|
|
12992
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
12993
|
-
] });
|
|
12994
|
-
};
|
|
12995
|
-
const EmailForm = ({ order }) => {
|
|
12996
|
-
const form = reactHookForm.useForm({
|
|
12997
|
-
defaultValues: {
|
|
12998
|
-
email: order.email ?? ""
|
|
12999
|
-
},
|
|
13000
|
-
resolver: zod.zodResolver(schema)
|
|
13001
|
-
});
|
|
13002
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13003
|
-
const { handleSuccess } = useRouteModal();
|
|
13004
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
13005
|
-
await mutateAsync(
|
|
13006
|
-
{ email: data.email },
|
|
13007
|
-
{
|
|
13008
|
-
onSuccess: () => {
|
|
13009
|
-
handleSuccess();
|
|
13010
|
-
},
|
|
13011
|
-
onError: (error) => {
|
|
13012
|
-
ui.toast.error(error.message);
|
|
13013
|
-
}
|
|
13014
|
-
}
|
|
13015
|
-
);
|
|
13016
|
-
});
|
|
13017
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13018
|
-
KeyboundForm,
|
|
13019
|
-
{
|
|
13020
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
13021
|
-
onSubmit,
|
|
13022
|
-
children: [
|
|
13023
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13024
|
-
Form$2.Field,
|
|
13025
|
-
{
|
|
13026
|
-
control: form.control,
|
|
13027
|
-
name: "email",
|
|
13028
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13029
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
13030
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13031
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13032
|
-
] })
|
|
13033
|
-
}
|
|
13034
|
-
) }),
|
|
13035
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13036
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13037
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13038
|
-
] }) })
|
|
13039
|
-
]
|
|
13040
|
-
}
|
|
13041
|
-
) });
|
|
13042
|
-
};
|
|
13043
13043
|
const schema = objectType({
|
|
13044
|
-
|
|
13044
|
+
customer_id: stringType().min(1)
|
|
13045
13045
|
});
|
|
13046
13046
|
const widgetModule = { widgets: [] };
|
|
13047
13047
|
const routeModule = {
|
|
@@ -13067,10 +13067,18 @@ const routeModule = {
|
|
|
13067
13067
|
Component: BillingAddress,
|
|
13068
13068
|
path: "/draft-orders/:id/billing-address"
|
|
13069
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: CustomItems,
|
|
13072
|
+
path: "/draft-orders/:id/custom-items"
|
|
13073
|
+
},
|
|
13070
13074
|
{
|
|
13071
13075
|
Component: Items,
|
|
13072
13076
|
path: "/draft-orders/:id/items"
|
|
13073
13077
|
},
|
|
13078
|
+
{
|
|
13079
|
+
Component: Email,
|
|
13080
|
+
path: "/draft-orders/:id/email"
|
|
13081
|
+
},
|
|
13074
13082
|
{
|
|
13075
13083
|
Component: Metadata,
|
|
13076
13084
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13094,14 +13102,6 @@ const routeModule = {
|
|
|
13094
13102
|
{
|
|
13095
13103
|
Component: TransferOwnership,
|
|
13096
13104
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
|
-
},
|
|
13098
|
-
{
|
|
13099
|
-
Component: CustomItems,
|
|
13100
|
-
path: "/draft-orders/:id/custom-items"
|
|
13101
|
-
},
|
|
13102
|
-
{
|
|
13103
|
-
Component: Email,
|
|
13104
|
-
path: "/draft-orders/:id/email"
|
|
13105
13105
|
}
|
|
13106
13106
|
]
|
|
13107
13107
|
}
|
|
@@ -9755,6 +9755,27 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9755
9755
|
) });
|
|
9756
9756
|
};
|
|
9757
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
|
+
});
|
|
9758
9779
|
const NumberInput = forwardRef(
|
|
9759
9780
|
({
|
|
9760
9781
|
value,
|
|
@@ -10729,6 +10750,74 @@ const customItemSchema = objectType({
|
|
|
10729
10750
|
quantity: numberType(),
|
|
10730
10751
|
unit_price: unionType([numberType(), stringType()])
|
|
10731
10752
|
});
|
|
10753
|
+
const Email = () => {
|
|
10754
|
+
const { id } = useParams();
|
|
10755
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10756
|
+
fields: "+email"
|
|
10757
|
+
});
|
|
10758
|
+
if (isError) {
|
|
10759
|
+
throw error;
|
|
10760
|
+
}
|
|
10761
|
+
const isReady = !isPending && !!order;
|
|
10762
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10763
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10764
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10765
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10766
|
+
] }),
|
|
10767
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10768
|
+
] });
|
|
10769
|
+
};
|
|
10770
|
+
const EmailForm = ({ order }) => {
|
|
10771
|
+
const form = useForm({
|
|
10772
|
+
defaultValues: {
|
|
10773
|
+
email: order.email ?? ""
|
|
10774
|
+
},
|
|
10775
|
+
resolver: zodResolver(schema$3)
|
|
10776
|
+
});
|
|
10777
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10778
|
+
const { handleSuccess } = useRouteModal();
|
|
10779
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10780
|
+
await mutateAsync(
|
|
10781
|
+
{ email: data.email },
|
|
10782
|
+
{
|
|
10783
|
+
onSuccess: () => {
|
|
10784
|
+
handleSuccess();
|
|
10785
|
+
},
|
|
10786
|
+
onError: (error) => {
|
|
10787
|
+
toast.error(error.message);
|
|
10788
|
+
}
|
|
10789
|
+
}
|
|
10790
|
+
);
|
|
10791
|
+
});
|
|
10792
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10793
|
+
KeyboundForm,
|
|
10794
|
+
{
|
|
10795
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10796
|
+
onSubmit,
|
|
10797
|
+
children: [
|
|
10798
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10799
|
+
Form$2.Field,
|
|
10800
|
+
{
|
|
10801
|
+
control: form.control,
|
|
10802
|
+
name: "email",
|
|
10803
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10804
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10805
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10806
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10807
|
+
] })
|
|
10808
|
+
}
|
|
10809
|
+
) }),
|
|
10810
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10811
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10812
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10813
|
+
] }) })
|
|
10814
|
+
]
|
|
10815
|
+
}
|
|
10816
|
+
) });
|
|
10817
|
+
};
|
|
10818
|
+
const schema$3 = objectType({
|
|
10819
|
+
email: stringType().email()
|
|
10820
|
+
});
|
|
10732
10821
|
const InlineTip = forwardRef(
|
|
10733
10822
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10734
10823
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -12191,7 +12280,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
12191
12280
|
defaultValues: {
|
|
12192
12281
|
sales_channel_id: order.sales_channel_id || ""
|
|
12193
12282
|
},
|
|
12194
|
-
resolver: zodResolver(schema$
|
|
12283
|
+
resolver: zodResolver(schema$2)
|
|
12195
12284
|
});
|
|
12196
12285
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12197
12286
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12266,7 +12355,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
12266
12355
|
}
|
|
12267
12356
|
);
|
|
12268
12357
|
};
|
|
12269
|
-
const schema$
|
|
12358
|
+
const schema$2 = objectType({
|
|
12270
12359
|
sales_channel_id: stringType().min(1)
|
|
12271
12360
|
});
|
|
12272
12361
|
const ShippingAddress = () => {
|
|
@@ -12301,7 +12390,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12301
12390
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12302
12391
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12303
12392
|
},
|
|
12304
|
-
resolver: zodResolver(schema$
|
|
12393
|
+
resolver: zodResolver(schema$1)
|
|
12305
12394
|
});
|
|
12306
12395
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12307
12396
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12471,7 +12560,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12471
12560
|
}
|
|
12472
12561
|
) });
|
|
12473
12562
|
};
|
|
12474
|
-
const schema$
|
|
12563
|
+
const schema$1 = addressSchema;
|
|
12475
12564
|
const TransferOwnership = () => {
|
|
12476
12565
|
const { id } = useParams();
|
|
12477
12566
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12495,7 +12584,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12495
12584
|
defaultValues: {
|
|
12496
12585
|
customer_id: order.customer_id || ""
|
|
12497
12586
|
},
|
|
12498
|
-
resolver: zodResolver(schema
|
|
12587
|
+
resolver: zodResolver(schema)
|
|
12499
12588
|
});
|
|
12500
12589
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12501
12590
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12945,97 +13034,8 @@ const Illustration = () => {
|
|
|
12945
13034
|
}
|
|
12946
13035
|
);
|
|
12947
13036
|
};
|
|
12948
|
-
const schema$2 = objectType({
|
|
12949
|
-
customer_id: stringType().min(1)
|
|
12950
|
-
});
|
|
12951
|
-
const CustomItems = () => {
|
|
12952
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12953
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
12954
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
12955
|
-
] });
|
|
12956
|
-
};
|
|
12957
|
-
const CustomItemsForm = () => {
|
|
12958
|
-
const form = useForm({
|
|
12959
|
-
resolver: zodResolver(schema$1)
|
|
12960
|
-
});
|
|
12961
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
12962
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
12963
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12964
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12965
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
12966
|
-
] }) })
|
|
12967
|
-
] }) });
|
|
12968
|
-
};
|
|
12969
|
-
const schema$1 = objectType({
|
|
12970
|
-
email: stringType().email()
|
|
12971
|
-
});
|
|
12972
|
-
const Email = () => {
|
|
12973
|
-
const { id } = useParams();
|
|
12974
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12975
|
-
fields: "+email"
|
|
12976
|
-
});
|
|
12977
|
-
if (isError) {
|
|
12978
|
-
throw error;
|
|
12979
|
-
}
|
|
12980
|
-
const isReady = !isPending && !!order;
|
|
12981
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12982
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12983
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
12984
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
12985
|
-
] }),
|
|
12986
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
12987
|
-
] });
|
|
12988
|
-
};
|
|
12989
|
-
const EmailForm = ({ order }) => {
|
|
12990
|
-
const form = useForm({
|
|
12991
|
-
defaultValues: {
|
|
12992
|
-
email: order.email ?? ""
|
|
12993
|
-
},
|
|
12994
|
-
resolver: zodResolver(schema)
|
|
12995
|
-
});
|
|
12996
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12997
|
-
const { handleSuccess } = useRouteModal();
|
|
12998
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12999
|
-
await mutateAsync(
|
|
13000
|
-
{ email: data.email },
|
|
13001
|
-
{
|
|
13002
|
-
onSuccess: () => {
|
|
13003
|
-
handleSuccess();
|
|
13004
|
-
},
|
|
13005
|
-
onError: (error) => {
|
|
13006
|
-
toast.error(error.message);
|
|
13007
|
-
}
|
|
13008
|
-
}
|
|
13009
|
-
);
|
|
13010
|
-
});
|
|
13011
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13012
|
-
KeyboundForm,
|
|
13013
|
-
{
|
|
13014
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
13015
|
-
onSubmit,
|
|
13016
|
-
children: [
|
|
13017
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
13018
|
-
Form$2.Field,
|
|
13019
|
-
{
|
|
13020
|
-
control: form.control,
|
|
13021
|
-
name: "email",
|
|
13022
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13023
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
13024
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13025
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13026
|
-
] })
|
|
13027
|
-
}
|
|
13028
|
-
) }),
|
|
13029
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13030
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13031
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13032
|
-
] }) })
|
|
13033
|
-
]
|
|
13034
|
-
}
|
|
13035
|
-
) });
|
|
13036
|
-
};
|
|
13037
13037
|
const schema = objectType({
|
|
13038
|
-
|
|
13038
|
+
customer_id: stringType().min(1)
|
|
13039
13039
|
});
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
@@ -13061,10 +13061,18 @@ const routeModule = {
|
|
|
13061
13061
|
Component: BillingAddress,
|
|
13062
13062
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13063
|
},
|
|
13064
|
+
{
|
|
13065
|
+
Component: CustomItems,
|
|
13066
|
+
path: "/draft-orders/:id/custom-items"
|
|
13067
|
+
},
|
|
13064
13068
|
{
|
|
13065
13069
|
Component: Items,
|
|
13066
13070
|
path: "/draft-orders/:id/items"
|
|
13067
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: Email,
|
|
13074
|
+
path: "/draft-orders/:id/email"
|
|
13075
|
+
},
|
|
13068
13076
|
{
|
|
13069
13077
|
Component: Metadata,
|
|
13070
13078
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13088,14 +13096,6 @@ const routeModule = {
|
|
|
13088
13096
|
{
|
|
13089
13097
|
Component: TransferOwnership,
|
|
13090
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13091
|
-
},
|
|
13092
|
-
{
|
|
13093
|
-
Component: CustomItems,
|
|
13094
|
-
path: "/draft-orders/:id/custom-items"
|
|
13095
|
-
},
|
|
13096
|
-
{
|
|
13097
|
-
Component: Email,
|
|
13098
|
-
path: "/draft-orders/:id/email"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|
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-20251027060158",
|
|
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-20251027060158",
|
|
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-20251027060158",
|
|
49
|
+
"@medusajs/cli": "2.11.2-preview-20251027060158",
|
|
50
|
+
"@medusajs/framework": "2.11.2-preview-20251027060158",
|
|
51
|
+
"@medusajs/icons": "2.11.2-preview-20251027060158",
|
|
52
|
+
"@medusajs/test-utils": "2.11.2-preview-20251027060158",
|
|
53
|
+
"@medusajs/types": "2.11.2-preview-20251027060158",
|
|
54
|
+
"@medusajs/ui": "4.0.26-preview-20251027060158",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.2-preview-20251027060158",
|
|
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-20251027060158",
|
|
73
|
+
"@medusajs/cli": "2.11.2-preview-20251027060158",
|
|
74
|
+
"@medusajs/framework": "2.11.2-preview-20251027060158",
|
|
75
|
+
"@medusajs/icons": "2.11.2-preview-20251027060158",
|
|
76
|
+
"@medusajs/test-utils": "2.11.2-preview-20251027060158",
|
|
77
|
+
"@medusajs/ui": "4.0.26-preview-20251027060158",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|