@medusajs/draft-order 2.11.4-snapshot-20251109191228 → 2.11.4-snapshot-20251112124414
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 -99
- package/.medusa/server/src/admin/index.mjs +103 -99
- package/package.json +16 -16
|
@@ -352,10 +352,14 @@ const DataTableAction = ({
|
|
|
352
352
|
}
|
|
353
353
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { ...buttonProps, onClick: props.onClick, children: label });
|
|
354
354
|
};
|
|
355
|
+
const backendUrl = __BACKEND_URL__ ?? "/";
|
|
356
|
+
const authType = __AUTH_TYPE__ ?? "session";
|
|
357
|
+
const jwtTokenStorageKey = __JWT_TOKEN_STORAGE_KEY__ || void 0;
|
|
355
358
|
const sdk = new Medusa__default.default({
|
|
356
|
-
baseUrl:
|
|
359
|
+
baseUrl: backendUrl,
|
|
357
360
|
auth: {
|
|
358
|
-
type:
|
|
361
|
+
type: authType,
|
|
362
|
+
jwtTokenStorageKey
|
|
359
363
|
}
|
|
360
364
|
});
|
|
361
365
|
const CUSTOMER_QUERY_KEY = "customers";
|
|
@@ -9568,6 +9572,27 @@ const ID = () => {
|
|
|
9568
9572
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9569
9573
|
] });
|
|
9570
9574
|
};
|
|
9575
|
+
const CustomItems = () => {
|
|
9576
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9577
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9578
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9579
|
+
] });
|
|
9580
|
+
};
|
|
9581
|
+
const CustomItemsForm = () => {
|
|
9582
|
+
const form = reactHookForm.useForm({
|
|
9583
|
+
resolver: zod.zodResolver(schema$5)
|
|
9584
|
+
});
|
|
9585
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9586
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9587
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9588
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9589
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9590
|
+
] }) })
|
|
9591
|
+
] }) });
|
|
9592
|
+
};
|
|
9593
|
+
const schema$5 = objectType({
|
|
9594
|
+
email: stringType().email()
|
|
9595
|
+
});
|
|
9571
9596
|
const BillingAddress = () => {
|
|
9572
9597
|
const { id } = reactRouterDom.useParams();
|
|
9573
9598
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9600,7 +9625,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9600
9625
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9601
9626
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9602
9627
|
},
|
|
9603
|
-
resolver: zod.zodResolver(schema$
|
|
9628
|
+
resolver: zod.zodResolver(schema$4)
|
|
9604
9629
|
});
|
|
9605
9630
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9606
9631
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9757,96 +9782,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9757
9782
|
}
|
|
9758
9783
|
) });
|
|
9759
9784
|
};
|
|
9760
|
-
const schema$
|
|
9761
|
-
const CustomItems = () => {
|
|
9762
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9763
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9764
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9765
|
-
] });
|
|
9766
|
-
};
|
|
9767
|
-
const CustomItemsForm = () => {
|
|
9768
|
-
const form = reactHookForm.useForm({
|
|
9769
|
-
resolver: zod.zodResolver(schema$4)
|
|
9770
|
-
});
|
|
9771
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9772
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9773
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9774
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9775
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9776
|
-
] }) })
|
|
9777
|
-
] }) });
|
|
9778
|
-
};
|
|
9779
|
-
const schema$4 = objectType({
|
|
9780
|
-
email: stringType().email()
|
|
9781
|
-
});
|
|
9782
|
-
const Email = () => {
|
|
9783
|
-
const { id } = reactRouterDom.useParams();
|
|
9784
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9785
|
-
fields: "+email"
|
|
9786
|
-
});
|
|
9787
|
-
if (isError) {
|
|
9788
|
-
throw error;
|
|
9789
|
-
}
|
|
9790
|
-
const isReady = !isPending && !!order;
|
|
9791
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9792
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9793
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9794
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9795
|
-
] }),
|
|
9796
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9797
|
-
] });
|
|
9798
|
-
};
|
|
9799
|
-
const EmailForm = ({ order }) => {
|
|
9800
|
-
const form = reactHookForm.useForm({
|
|
9801
|
-
defaultValues: {
|
|
9802
|
-
email: order.email ?? ""
|
|
9803
|
-
},
|
|
9804
|
-
resolver: zod.zodResolver(schema$3)
|
|
9805
|
-
});
|
|
9806
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9807
|
-
const { handleSuccess } = useRouteModal();
|
|
9808
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9809
|
-
await mutateAsync(
|
|
9810
|
-
{ email: data.email },
|
|
9811
|
-
{
|
|
9812
|
-
onSuccess: () => {
|
|
9813
|
-
handleSuccess();
|
|
9814
|
-
},
|
|
9815
|
-
onError: (error) => {
|
|
9816
|
-
ui.toast.error(error.message);
|
|
9817
|
-
}
|
|
9818
|
-
}
|
|
9819
|
-
);
|
|
9820
|
-
});
|
|
9821
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9822
|
-
KeyboundForm,
|
|
9823
|
-
{
|
|
9824
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9825
|
-
onSubmit,
|
|
9826
|
-
children: [
|
|
9827
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9828
|
-
Form$2.Field,
|
|
9829
|
-
{
|
|
9830
|
-
control: form.control,
|
|
9831
|
-
name: "email",
|
|
9832
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9833
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9834
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9835
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9836
|
-
] })
|
|
9837
|
-
}
|
|
9838
|
-
) }),
|
|
9839
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9840
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9841
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9842
|
-
] }) })
|
|
9843
|
-
]
|
|
9844
|
-
}
|
|
9845
|
-
) });
|
|
9846
|
-
};
|
|
9847
|
-
const schema$3 = objectType({
|
|
9848
|
-
email: stringType().email()
|
|
9849
|
-
});
|
|
9785
|
+
const schema$4 = addressSchema;
|
|
9850
9786
|
const NumberInput = React.forwardRef(
|
|
9851
9787
|
({
|
|
9852
9788
|
value,
|
|
@@ -10821,6 +10757,74 @@ const customItemSchema = objectType({
|
|
|
10821
10757
|
quantity: numberType(),
|
|
10822
10758
|
unit_price: unionType([numberType(), stringType()])
|
|
10823
10759
|
});
|
|
10760
|
+
const Email = () => {
|
|
10761
|
+
const { id } = reactRouterDom.useParams();
|
|
10762
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10763
|
+
fields: "+email"
|
|
10764
|
+
});
|
|
10765
|
+
if (isError) {
|
|
10766
|
+
throw error;
|
|
10767
|
+
}
|
|
10768
|
+
const isReady = !isPending && !!order;
|
|
10769
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10770
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10771
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10772
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10773
|
+
] }),
|
|
10774
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10775
|
+
] });
|
|
10776
|
+
};
|
|
10777
|
+
const EmailForm = ({ order }) => {
|
|
10778
|
+
const form = reactHookForm.useForm({
|
|
10779
|
+
defaultValues: {
|
|
10780
|
+
email: order.email ?? ""
|
|
10781
|
+
},
|
|
10782
|
+
resolver: zod.zodResolver(schema$3)
|
|
10783
|
+
});
|
|
10784
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10785
|
+
const { handleSuccess } = useRouteModal();
|
|
10786
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10787
|
+
await mutateAsync(
|
|
10788
|
+
{ email: data.email },
|
|
10789
|
+
{
|
|
10790
|
+
onSuccess: () => {
|
|
10791
|
+
handleSuccess();
|
|
10792
|
+
},
|
|
10793
|
+
onError: (error) => {
|
|
10794
|
+
ui.toast.error(error.message);
|
|
10795
|
+
}
|
|
10796
|
+
}
|
|
10797
|
+
);
|
|
10798
|
+
});
|
|
10799
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10800
|
+
KeyboundForm,
|
|
10801
|
+
{
|
|
10802
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10803
|
+
onSubmit,
|
|
10804
|
+
children: [
|
|
10805
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10806
|
+
Form$2.Field,
|
|
10807
|
+
{
|
|
10808
|
+
control: form.control,
|
|
10809
|
+
name: "email",
|
|
10810
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10811
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10812
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10813
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10814
|
+
] })
|
|
10815
|
+
}
|
|
10816
|
+
) }),
|
|
10817
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10818
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10819
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10820
|
+
] }) })
|
|
10821
|
+
]
|
|
10822
|
+
}
|
|
10823
|
+
) });
|
|
10824
|
+
};
|
|
10825
|
+
const schema$3 = objectType({
|
|
10826
|
+
email: stringType().email()
|
|
10827
|
+
});
|
|
10824
10828
|
const InlineTip = React.forwardRef(
|
|
10825
10829
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10826
10830
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13060,22 +13064,22 @@ const routeModule = {
|
|
|
13060
13064
|
handle,
|
|
13061
13065
|
loader,
|
|
13062
13066
|
children: [
|
|
13063
|
-
{
|
|
13064
|
-
Component: BillingAddress,
|
|
13065
|
-
path: "/draft-orders/:id/billing-address"
|
|
13066
|
-
},
|
|
13067
13067
|
{
|
|
13068
13068
|
Component: CustomItems,
|
|
13069
13069
|
path: "/draft-orders/:id/custom-items"
|
|
13070
13070
|
},
|
|
13071
13071
|
{
|
|
13072
|
-
Component:
|
|
13073
|
-
path: "/draft-orders/:id/
|
|
13072
|
+
Component: BillingAddress,
|
|
13073
|
+
path: "/draft-orders/:id/billing-address"
|
|
13074
13074
|
},
|
|
13075
13075
|
{
|
|
13076
13076
|
Component: Items,
|
|
13077
13077
|
path: "/draft-orders/:id/items"
|
|
13078
13078
|
},
|
|
13079
|
+
{
|
|
13080
|
+
Component: Email,
|
|
13081
|
+
path: "/draft-orders/:id/email"
|
|
13082
|
+
},
|
|
13079
13083
|
{
|
|
13080
13084
|
Component: Metadata,
|
|
13081
13085
|
path: "/draft-orders/:id/metadata"
|
|
@@ -345,10 +345,14 @@ const DataTableAction = ({
|
|
|
345
345
|
}
|
|
346
346
|
return /* @__PURE__ */ jsx(Button, { ...buttonProps, onClick: props.onClick, children: label });
|
|
347
347
|
};
|
|
348
|
+
const backendUrl = __BACKEND_URL__ ?? "/";
|
|
349
|
+
const authType = __AUTH_TYPE__ ?? "session";
|
|
350
|
+
const jwtTokenStorageKey = __JWT_TOKEN_STORAGE_KEY__ || void 0;
|
|
348
351
|
const sdk = new Medusa({
|
|
349
|
-
baseUrl:
|
|
352
|
+
baseUrl: backendUrl,
|
|
350
353
|
auth: {
|
|
351
|
-
type:
|
|
354
|
+
type: authType,
|
|
355
|
+
jwtTokenStorageKey
|
|
352
356
|
}
|
|
353
357
|
});
|
|
354
358
|
const CUSTOMER_QUERY_KEY = "customers";
|
|
@@ -9561,6 +9565,27 @@ const ID = () => {
|
|
|
9561
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9562
9566
|
] });
|
|
9563
9567
|
};
|
|
9568
|
+
const CustomItems = () => {
|
|
9569
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9570
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9571
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9572
|
+
] });
|
|
9573
|
+
};
|
|
9574
|
+
const CustomItemsForm = () => {
|
|
9575
|
+
const form = useForm({
|
|
9576
|
+
resolver: zodResolver(schema$5)
|
|
9577
|
+
});
|
|
9578
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9579
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9580
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9581
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9582
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9583
|
+
] }) })
|
|
9584
|
+
] }) });
|
|
9585
|
+
};
|
|
9586
|
+
const schema$5 = objectType({
|
|
9587
|
+
email: stringType().email()
|
|
9588
|
+
});
|
|
9564
9589
|
const BillingAddress = () => {
|
|
9565
9590
|
const { id } = useParams();
|
|
9566
9591
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9593,7 +9618,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9593
9618
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9594
9619
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9595
9620
|
},
|
|
9596
|
-
resolver: zodResolver(schema$
|
|
9621
|
+
resolver: zodResolver(schema$4)
|
|
9597
9622
|
});
|
|
9598
9623
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9599
9624
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9750,96 +9775,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9750
9775
|
}
|
|
9751
9776
|
) });
|
|
9752
9777
|
};
|
|
9753
|
-
const schema$
|
|
9754
|
-
const CustomItems = () => {
|
|
9755
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9756
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9757
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9758
|
-
] });
|
|
9759
|
-
};
|
|
9760
|
-
const CustomItemsForm = () => {
|
|
9761
|
-
const form = useForm({
|
|
9762
|
-
resolver: zodResolver(schema$4)
|
|
9763
|
-
});
|
|
9764
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9765
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9766
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9767
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9768
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9769
|
-
] }) })
|
|
9770
|
-
] }) });
|
|
9771
|
-
};
|
|
9772
|
-
const schema$4 = objectType({
|
|
9773
|
-
email: stringType().email()
|
|
9774
|
-
});
|
|
9775
|
-
const Email = () => {
|
|
9776
|
-
const { id } = useParams();
|
|
9777
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9778
|
-
fields: "+email"
|
|
9779
|
-
});
|
|
9780
|
-
if (isError) {
|
|
9781
|
-
throw error;
|
|
9782
|
-
}
|
|
9783
|
-
const isReady = !isPending && !!order;
|
|
9784
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9785
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9786
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9787
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9788
|
-
] }),
|
|
9789
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9790
|
-
] });
|
|
9791
|
-
};
|
|
9792
|
-
const EmailForm = ({ order }) => {
|
|
9793
|
-
const form = useForm({
|
|
9794
|
-
defaultValues: {
|
|
9795
|
-
email: order.email ?? ""
|
|
9796
|
-
},
|
|
9797
|
-
resolver: zodResolver(schema$3)
|
|
9798
|
-
});
|
|
9799
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9800
|
-
const { handleSuccess } = useRouteModal();
|
|
9801
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9802
|
-
await mutateAsync(
|
|
9803
|
-
{ email: data.email },
|
|
9804
|
-
{
|
|
9805
|
-
onSuccess: () => {
|
|
9806
|
-
handleSuccess();
|
|
9807
|
-
},
|
|
9808
|
-
onError: (error) => {
|
|
9809
|
-
toast.error(error.message);
|
|
9810
|
-
}
|
|
9811
|
-
}
|
|
9812
|
-
);
|
|
9813
|
-
});
|
|
9814
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9815
|
-
KeyboundForm,
|
|
9816
|
-
{
|
|
9817
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9818
|
-
onSubmit,
|
|
9819
|
-
children: [
|
|
9820
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9821
|
-
Form$2.Field,
|
|
9822
|
-
{
|
|
9823
|
-
control: form.control,
|
|
9824
|
-
name: "email",
|
|
9825
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9826
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9827
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9828
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9829
|
-
] })
|
|
9830
|
-
}
|
|
9831
|
-
) }),
|
|
9832
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9833
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9834
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9835
|
-
] }) })
|
|
9836
|
-
]
|
|
9837
|
-
}
|
|
9838
|
-
) });
|
|
9839
|
-
};
|
|
9840
|
-
const schema$3 = objectType({
|
|
9841
|
-
email: stringType().email()
|
|
9842
|
-
});
|
|
9778
|
+
const schema$4 = addressSchema;
|
|
9843
9779
|
const NumberInput = forwardRef(
|
|
9844
9780
|
({
|
|
9845
9781
|
value,
|
|
@@ -10814,6 +10750,74 @@ const customItemSchema = objectType({
|
|
|
10814
10750
|
quantity: numberType(),
|
|
10815
10751
|
unit_price: unionType([numberType(), stringType()])
|
|
10816
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
|
+
});
|
|
10817
10821
|
const InlineTip = forwardRef(
|
|
10818
10822
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10819
10823
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13053,22 +13057,22 @@ const routeModule = {
|
|
|
13053
13057
|
handle,
|
|
13054
13058
|
loader,
|
|
13055
13059
|
children: [
|
|
13056
|
-
{
|
|
13057
|
-
Component: BillingAddress,
|
|
13058
|
-
path: "/draft-orders/:id/billing-address"
|
|
13059
|
-
},
|
|
13060
13060
|
{
|
|
13061
13061
|
Component: CustomItems,
|
|
13062
13062
|
path: "/draft-orders/:id/custom-items"
|
|
13063
13063
|
},
|
|
13064
13064
|
{
|
|
13065
|
-
Component:
|
|
13066
|
-
path: "/draft-orders/:id/
|
|
13065
|
+
Component: BillingAddress,
|
|
13066
|
+
path: "/draft-orders/:id/billing-address"
|
|
13067
13067
|
},
|
|
13068
13068
|
{
|
|
13069
13069
|
Component: Items,
|
|
13070
13070
|
path: "/draft-orders/:id/items"
|
|
13071
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: Email,
|
|
13074
|
+
path: "/draft-orders/:id/email"
|
|
13075
|
+
},
|
|
13072
13076
|
{
|
|
13073
13077
|
Component: Metadata,
|
|
13074
13078
|
path: "/draft-orders/:id/metadata"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.4-snapshot-
|
|
3
|
+
"version": "2.11.4-snapshot-20251112124414",
|
|
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-snapshot-
|
|
40
|
+
"@medusajs/js-sdk": "2.11.4-snapshot-20251112124414",
|
|
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-snapshot-
|
|
52
|
-
"@medusajs/cli": "2.11.4-snapshot-
|
|
53
|
-
"@medusajs/framework": "2.11.4-snapshot-
|
|
54
|
-
"@medusajs/icons": "2.11.4-snapshot-
|
|
55
|
-
"@medusajs/test-utils": "2.11.4-snapshot-
|
|
56
|
-
"@medusajs/types": "2.11.4-snapshot-
|
|
57
|
-
"@medusajs/ui": "4.0.28-snapshot-
|
|
58
|
-
"@medusajs/ui-preset": "2.11.4-snapshot-
|
|
51
|
+
"@medusajs/admin-sdk": "2.11.4-snapshot-20251112124414",
|
|
52
|
+
"@medusajs/cli": "2.11.4-snapshot-20251112124414",
|
|
53
|
+
"@medusajs/framework": "2.11.4-snapshot-20251112124414",
|
|
54
|
+
"@medusajs/icons": "2.11.4-snapshot-20251112124414",
|
|
55
|
+
"@medusajs/test-utils": "2.11.4-snapshot-20251112124414",
|
|
56
|
+
"@medusajs/types": "2.11.4-snapshot-20251112124414",
|
|
57
|
+
"@medusajs/ui": "4.0.28-snapshot-20251112124414",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.4-snapshot-20251112124414"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@medusajs/admin-sdk": "2.11.4-snapshot-
|
|
62
|
-
"@medusajs/cli": "2.11.4-snapshot-
|
|
63
|
-
"@medusajs/framework": "2.11.4-snapshot-
|
|
64
|
-
"@medusajs/icons": "2.11.4-snapshot-
|
|
65
|
-
"@medusajs/test-utils": "2.11.4-snapshot-
|
|
66
|
-
"@medusajs/ui": "4.0.28-snapshot-
|
|
61
|
+
"@medusajs/admin-sdk": "2.11.4-snapshot-20251112124414",
|
|
62
|
+
"@medusajs/cli": "2.11.4-snapshot-20251112124414",
|
|
63
|
+
"@medusajs/framework": "2.11.4-snapshot-20251112124414",
|
|
64
|
+
"@medusajs/icons": "2.11.4-snapshot-20251112124414",
|
|
65
|
+
"@medusajs/test-utils": "2.11.4-snapshot-20251112124414",
|
|
66
|
+
"@medusajs/ui": "4.0.28-snapshot-20251112124414",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|