@medusajs/draft-order 2.11.4-preview-20251121150135 → 2.11.4-preview-20251121210133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +97 -97
- package/.medusa/server/src/admin/index.mjs +97 -97
- package/package.json +16 -16
|
@@ -9762,6 +9762,27 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9762
|
) });
|
|
9763
9763
|
};
|
|
9764
9764
|
const schema$5 = addressSchema;
|
|
9765
|
+
const CustomItems = () => {
|
|
9766
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9767
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9768
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9769
|
+
] });
|
|
9770
|
+
};
|
|
9771
|
+
const CustomItemsForm = () => {
|
|
9772
|
+
const form = reactHookForm.useForm({
|
|
9773
|
+
resolver: zod.zodResolver(schema$4)
|
|
9774
|
+
});
|
|
9775
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9776
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9777
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9778
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9779
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9780
|
+
] }) })
|
|
9781
|
+
] }) });
|
|
9782
|
+
};
|
|
9783
|
+
const schema$4 = objectType({
|
|
9784
|
+
email: stringType().email()
|
|
9785
|
+
});
|
|
9765
9786
|
const NumberInput = React.forwardRef(
|
|
9766
9787
|
({
|
|
9767
9788
|
value,
|
|
@@ -10736,95 +10757,6 @@ const customItemSchema = objectType({
|
|
|
10736
10757
|
quantity: numberType(),
|
|
10737
10758
|
unit_price: unionType([numberType(), stringType()])
|
|
10738
10759
|
});
|
|
10739
|
-
const Email = () => {
|
|
10740
|
-
const { id } = reactRouterDom.useParams();
|
|
10741
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10742
|
-
fields: "+email"
|
|
10743
|
-
});
|
|
10744
|
-
if (isError) {
|
|
10745
|
-
throw error;
|
|
10746
|
-
}
|
|
10747
|
-
const isReady = !isPending && !!order;
|
|
10748
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10749
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10750
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10751
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10752
|
-
] }),
|
|
10753
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10754
|
-
] });
|
|
10755
|
-
};
|
|
10756
|
-
const EmailForm = ({ order }) => {
|
|
10757
|
-
const form = reactHookForm.useForm({
|
|
10758
|
-
defaultValues: {
|
|
10759
|
-
email: order.email ?? ""
|
|
10760
|
-
},
|
|
10761
|
-
resolver: zod.zodResolver(schema$4)
|
|
10762
|
-
});
|
|
10763
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10764
|
-
const { handleSuccess } = useRouteModal();
|
|
10765
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10766
|
-
await mutateAsync(
|
|
10767
|
-
{ email: data.email },
|
|
10768
|
-
{
|
|
10769
|
-
onSuccess: () => {
|
|
10770
|
-
handleSuccess();
|
|
10771
|
-
},
|
|
10772
|
-
onError: (error) => {
|
|
10773
|
-
ui.toast.error(error.message);
|
|
10774
|
-
}
|
|
10775
|
-
}
|
|
10776
|
-
);
|
|
10777
|
-
});
|
|
10778
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10779
|
-
KeyboundForm,
|
|
10780
|
-
{
|
|
10781
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10782
|
-
onSubmit,
|
|
10783
|
-
children: [
|
|
10784
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10785
|
-
Form$2.Field,
|
|
10786
|
-
{
|
|
10787
|
-
control: form.control,
|
|
10788
|
-
name: "email",
|
|
10789
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10790
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10791
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10792
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10793
|
-
] })
|
|
10794
|
-
}
|
|
10795
|
-
) }),
|
|
10796
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10797
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10798
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10799
|
-
] }) })
|
|
10800
|
-
]
|
|
10801
|
-
}
|
|
10802
|
-
) });
|
|
10803
|
-
};
|
|
10804
|
-
const schema$4 = objectType({
|
|
10805
|
-
email: stringType().email()
|
|
10806
|
-
});
|
|
10807
|
-
const CustomItems = () => {
|
|
10808
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10809
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
10810
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
10811
|
-
] });
|
|
10812
|
-
};
|
|
10813
|
-
const CustomItemsForm = () => {
|
|
10814
|
-
const form = reactHookForm.useForm({
|
|
10815
|
-
resolver: zod.zodResolver(schema$3)
|
|
10816
|
-
});
|
|
10817
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10818
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
10819
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10820
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10821
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
10822
|
-
] }) })
|
|
10823
|
-
] }) });
|
|
10824
|
-
};
|
|
10825
|
-
const schema$3 = objectType({
|
|
10826
|
-
email: stringType().email()
|
|
10827
|
-
});
|
|
10828
10760
|
const InlineTip = React.forwardRef(
|
|
10829
10761
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10830
10762
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11175,6 +11107,74 @@ function getHasUneditableRows(metadata) {
|
|
|
11175
11107
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11176
11108
|
);
|
|
11177
11109
|
}
|
|
11110
|
+
const Email = () => {
|
|
11111
|
+
const { id } = reactRouterDom.useParams();
|
|
11112
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11113
|
+
fields: "+email"
|
|
11114
|
+
});
|
|
11115
|
+
if (isError) {
|
|
11116
|
+
throw error;
|
|
11117
|
+
}
|
|
11118
|
+
const isReady = !isPending && !!order;
|
|
11119
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11120
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11121
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
11122
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11123
|
+
] }),
|
|
11124
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
11125
|
+
] });
|
|
11126
|
+
};
|
|
11127
|
+
const EmailForm = ({ order }) => {
|
|
11128
|
+
const form = reactHookForm.useForm({
|
|
11129
|
+
defaultValues: {
|
|
11130
|
+
email: order.email ?? ""
|
|
11131
|
+
},
|
|
11132
|
+
resolver: zod.zodResolver(schema$3)
|
|
11133
|
+
});
|
|
11134
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11135
|
+
const { handleSuccess } = useRouteModal();
|
|
11136
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11137
|
+
await mutateAsync(
|
|
11138
|
+
{ email: data.email },
|
|
11139
|
+
{
|
|
11140
|
+
onSuccess: () => {
|
|
11141
|
+
handleSuccess();
|
|
11142
|
+
},
|
|
11143
|
+
onError: (error) => {
|
|
11144
|
+
ui.toast.error(error.message);
|
|
11145
|
+
}
|
|
11146
|
+
}
|
|
11147
|
+
);
|
|
11148
|
+
});
|
|
11149
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11150
|
+
KeyboundForm,
|
|
11151
|
+
{
|
|
11152
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11153
|
+
onSubmit,
|
|
11154
|
+
children: [
|
|
11155
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11156
|
+
Form$2.Field,
|
|
11157
|
+
{
|
|
11158
|
+
control: form.control,
|
|
11159
|
+
name: "email",
|
|
11160
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11161
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
11162
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11163
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11164
|
+
] })
|
|
11165
|
+
}
|
|
11166
|
+
) }),
|
|
11167
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11168
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11169
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11170
|
+
] }) })
|
|
11171
|
+
]
|
|
11172
|
+
}
|
|
11173
|
+
) });
|
|
11174
|
+
};
|
|
11175
|
+
const schema$3 = objectType({
|
|
11176
|
+
email: stringType().email()
|
|
11177
|
+
});
|
|
11178
11178
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11179
11179
|
const promotionsQueryKeys = {
|
|
11180
11180
|
list: (query2) => [
|
|
@@ -13068,22 +13068,22 @@ const routeModule = {
|
|
|
13068
13068
|
Component: BillingAddress,
|
|
13069
13069
|
path: "/draft-orders/:id/billing-address"
|
|
13070
13070
|
},
|
|
13071
|
-
{
|
|
13072
|
-
Component: Items,
|
|
13073
|
-
path: "/draft-orders/:id/items"
|
|
13074
|
-
},
|
|
13075
|
-
{
|
|
13076
|
-
Component: Email,
|
|
13077
|
-
path: "/draft-orders/:id/email"
|
|
13078
|
-
},
|
|
13079
13071
|
{
|
|
13080
13072
|
Component: CustomItems,
|
|
13081
13073
|
path: "/draft-orders/:id/custom-items"
|
|
13082
13074
|
},
|
|
13075
|
+
{
|
|
13076
|
+
Component: Items,
|
|
13077
|
+
path: "/draft-orders/:id/items"
|
|
13078
|
+
},
|
|
13083
13079
|
{
|
|
13084
13080
|
Component: Metadata,
|
|
13085
13081
|
path: "/draft-orders/:id/metadata"
|
|
13086
13082
|
},
|
|
13083
|
+
{
|
|
13084
|
+
Component: Email,
|
|
13085
|
+
path: "/draft-orders/:id/email"
|
|
13086
|
+
},
|
|
13087
13087
|
{
|
|
13088
13088
|
Component: Promotions,
|
|
13089
13089
|
path: "/draft-orders/:id/promotions"
|
|
@@ -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,95 +10750,6 @@ const customItemSchema = objectType({
|
|
|
10729
10750
|
quantity: numberType(),
|
|
10730
10751
|
unit_price: unionType([numberType(), stringType()])
|
|
10731
10752
|
});
|
|
10732
|
-
const Email = () => {
|
|
10733
|
-
const { id } = useParams();
|
|
10734
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10735
|
-
fields: "+email"
|
|
10736
|
-
});
|
|
10737
|
-
if (isError) {
|
|
10738
|
-
throw error;
|
|
10739
|
-
}
|
|
10740
|
-
const isReady = !isPending && !!order;
|
|
10741
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10742
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10743
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10744
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10745
|
-
] }),
|
|
10746
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10747
|
-
] });
|
|
10748
|
-
};
|
|
10749
|
-
const EmailForm = ({ order }) => {
|
|
10750
|
-
const form = useForm({
|
|
10751
|
-
defaultValues: {
|
|
10752
|
-
email: order.email ?? ""
|
|
10753
|
-
},
|
|
10754
|
-
resolver: zodResolver(schema$4)
|
|
10755
|
-
});
|
|
10756
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10757
|
-
const { handleSuccess } = useRouteModal();
|
|
10758
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10759
|
-
await mutateAsync(
|
|
10760
|
-
{ email: data.email },
|
|
10761
|
-
{
|
|
10762
|
-
onSuccess: () => {
|
|
10763
|
-
handleSuccess();
|
|
10764
|
-
},
|
|
10765
|
-
onError: (error) => {
|
|
10766
|
-
toast.error(error.message);
|
|
10767
|
-
}
|
|
10768
|
-
}
|
|
10769
|
-
);
|
|
10770
|
-
});
|
|
10771
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10772
|
-
KeyboundForm,
|
|
10773
|
-
{
|
|
10774
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10775
|
-
onSubmit,
|
|
10776
|
-
children: [
|
|
10777
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10778
|
-
Form$2.Field,
|
|
10779
|
-
{
|
|
10780
|
-
control: form.control,
|
|
10781
|
-
name: "email",
|
|
10782
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10783
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10784
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10785
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10786
|
-
] })
|
|
10787
|
-
}
|
|
10788
|
-
) }),
|
|
10789
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10790
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10791
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10792
|
-
] }) })
|
|
10793
|
-
]
|
|
10794
|
-
}
|
|
10795
|
-
) });
|
|
10796
|
-
};
|
|
10797
|
-
const schema$4 = objectType({
|
|
10798
|
-
email: stringType().email()
|
|
10799
|
-
});
|
|
10800
|
-
const CustomItems = () => {
|
|
10801
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10802
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
10803
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
10804
|
-
] });
|
|
10805
|
-
};
|
|
10806
|
-
const CustomItemsForm = () => {
|
|
10807
|
-
const form = useForm({
|
|
10808
|
-
resolver: zodResolver(schema$3)
|
|
10809
|
-
});
|
|
10810
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10811
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
10812
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10813
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10814
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
10815
|
-
] }) })
|
|
10816
|
-
] }) });
|
|
10817
|
-
};
|
|
10818
|
-
const schema$3 = objectType({
|
|
10819
|
-
email: stringType().email()
|
|
10820
|
-
});
|
|
10821
10753
|
const InlineTip = forwardRef(
|
|
10822
10754
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10823
10755
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11168,6 +11100,74 @@ function getHasUneditableRows(metadata) {
|
|
|
11168
11100
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11169
11101
|
);
|
|
11170
11102
|
}
|
|
11103
|
+
const Email = () => {
|
|
11104
|
+
const { id } = useParams();
|
|
11105
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11106
|
+
fields: "+email"
|
|
11107
|
+
});
|
|
11108
|
+
if (isError) {
|
|
11109
|
+
throw error;
|
|
11110
|
+
}
|
|
11111
|
+
const isReady = !isPending && !!order;
|
|
11112
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11113
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11114
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
11115
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11116
|
+
] }),
|
|
11117
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
11118
|
+
] });
|
|
11119
|
+
};
|
|
11120
|
+
const EmailForm = ({ order }) => {
|
|
11121
|
+
const form = useForm({
|
|
11122
|
+
defaultValues: {
|
|
11123
|
+
email: order.email ?? ""
|
|
11124
|
+
},
|
|
11125
|
+
resolver: zodResolver(schema$3)
|
|
11126
|
+
});
|
|
11127
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11128
|
+
const { handleSuccess } = useRouteModal();
|
|
11129
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11130
|
+
await mutateAsync(
|
|
11131
|
+
{ email: data.email },
|
|
11132
|
+
{
|
|
11133
|
+
onSuccess: () => {
|
|
11134
|
+
handleSuccess();
|
|
11135
|
+
},
|
|
11136
|
+
onError: (error) => {
|
|
11137
|
+
toast.error(error.message);
|
|
11138
|
+
}
|
|
11139
|
+
}
|
|
11140
|
+
);
|
|
11141
|
+
});
|
|
11142
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11143
|
+
KeyboundForm,
|
|
11144
|
+
{
|
|
11145
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11146
|
+
onSubmit,
|
|
11147
|
+
children: [
|
|
11148
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
11149
|
+
Form$2.Field,
|
|
11150
|
+
{
|
|
11151
|
+
control: form.control,
|
|
11152
|
+
name: "email",
|
|
11153
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11154
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
11155
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11156
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11157
|
+
] })
|
|
11158
|
+
}
|
|
11159
|
+
) }),
|
|
11160
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11161
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11162
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11163
|
+
] }) })
|
|
11164
|
+
]
|
|
11165
|
+
}
|
|
11166
|
+
) });
|
|
11167
|
+
};
|
|
11168
|
+
const schema$3 = objectType({
|
|
11169
|
+
email: stringType().email()
|
|
11170
|
+
});
|
|
11171
11171
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11172
11172
|
const promotionsQueryKeys = {
|
|
11173
11173
|
list: (query2) => [
|
|
@@ -13061,22 +13061,22 @@ const routeModule = {
|
|
|
13061
13061
|
Component: BillingAddress,
|
|
13062
13062
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13063
|
},
|
|
13064
|
-
{
|
|
13065
|
-
Component: Items,
|
|
13066
|
-
path: "/draft-orders/:id/items"
|
|
13067
|
-
},
|
|
13068
|
-
{
|
|
13069
|
-
Component: Email,
|
|
13070
|
-
path: "/draft-orders/:id/email"
|
|
13071
|
-
},
|
|
13072
13064
|
{
|
|
13073
13065
|
Component: CustomItems,
|
|
13074
13066
|
path: "/draft-orders/:id/custom-items"
|
|
13075
13067
|
},
|
|
13068
|
+
{
|
|
13069
|
+
Component: Items,
|
|
13070
|
+
path: "/draft-orders/:id/items"
|
|
13071
|
+
},
|
|
13076
13072
|
{
|
|
13077
13073
|
Component: Metadata,
|
|
13078
13074
|
path: "/draft-orders/:id/metadata"
|
|
13079
13075
|
},
|
|
13076
|
+
{
|
|
13077
|
+
Component: Email,
|
|
13078
|
+
path: "/draft-orders/:id/email"
|
|
13079
|
+
},
|
|
13080
13080
|
{
|
|
13081
13081
|
Component: Promotions,
|
|
13082
13082
|
path: "/draft-orders/:id/promotions"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.4-preview-
|
|
3
|
+
"version": "2.11.4-preview-20251121210133",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@babel/runtime": "^7.26.10",
|
|
39
39
|
"@hookform/resolvers": "3.4.2",
|
|
40
|
-
"@medusajs/js-sdk": "2.11.4-preview-
|
|
40
|
+
"@medusajs/js-sdk": "2.11.4-preview-20251121210133",
|
|
41
41
|
"@tanstack/react-query": "5.64.2",
|
|
42
42
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
43
43
|
"date-fns": "^3.6.0",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "2.11.4-preview-
|
|
52
|
-
"@medusajs/cli": "2.11.4-preview-
|
|
53
|
-
"@medusajs/framework": "2.11.4-preview-
|
|
54
|
-
"@medusajs/icons": "2.11.4-preview-
|
|
55
|
-
"@medusajs/test-utils": "2.11.4-preview-
|
|
56
|
-
"@medusajs/types": "2.11.4-preview-
|
|
57
|
-
"@medusajs/ui": "4.0.28-preview-
|
|
58
|
-
"@medusajs/ui-preset": "2.11.4-preview-
|
|
51
|
+
"@medusajs/admin-sdk": "2.11.4-preview-20251121210133",
|
|
52
|
+
"@medusajs/cli": "2.11.4-preview-20251121210133",
|
|
53
|
+
"@medusajs/framework": "2.11.4-preview-20251121210133",
|
|
54
|
+
"@medusajs/icons": "2.11.4-preview-20251121210133",
|
|
55
|
+
"@medusajs/test-utils": "2.11.4-preview-20251121210133",
|
|
56
|
+
"@medusajs/types": "2.11.4-preview-20251121210133",
|
|
57
|
+
"@medusajs/ui": "4.0.28-preview-20251121210133",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.4-preview-20251121210133"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "2.11.4-preview-
|
|
62
|
-
"@medusajs/cli": "2.11.4-preview-
|
|
63
|
-
"@medusajs/framework": "2.11.4-preview-
|
|
64
|
-
"@medusajs/icons": "2.11.4-preview-
|
|
65
|
-
"@medusajs/test-utils": "2.11.4-preview-
|
|
66
|
-
"@medusajs/ui": "4.0.28-preview-
|
|
61
|
+
"@medusajs/admin-sdk": "2.11.4-preview-20251121210133",
|
|
62
|
+
"@medusajs/cli": "2.11.4-preview-20251121210133",
|
|
63
|
+
"@medusajs/framework": "2.11.4-preview-20251121210133",
|
|
64
|
+
"@medusajs/icons": "2.11.4-preview-20251121210133",
|
|
65
|
+
"@medusajs/test-utils": "2.11.4-preview-20251121210133",
|
|
66
|
+
"@medusajs/ui": "4.0.28-preview-20251121210133",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|