@medusajs/draft-order 2.11.4-preview-20251115120134 → 2.11.4-preview-20251115180132
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
|
@@ -9572,6 +9572,27 @@ const ID = () => {
|
|
|
9572
9572
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9573
9573
|
] });
|
|
9574
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
|
+
});
|
|
9575
9596
|
const BillingAddress = () => {
|
|
9576
9597
|
const { id } = reactRouterDom.useParams();
|
|
9577
9598
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9604,7 +9625,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9604
9625
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9605
9626
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9606
9627
|
},
|
|
9607
|
-
resolver: zod.zodResolver(schema$
|
|
9628
|
+
resolver: zod.zodResolver(schema$4)
|
|
9608
9629
|
});
|
|
9609
9630
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9610
9631
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9761,26 +9782,73 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9761
9782
|
}
|
|
9762
9783
|
) });
|
|
9763
9784
|
};
|
|
9764
|
-
const schema$
|
|
9765
|
-
const
|
|
9785
|
+
const schema$4 = addressSchema;
|
|
9786
|
+
const Email = () => {
|
|
9787
|
+
const { id } = reactRouterDom.useParams();
|
|
9788
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9789
|
+
fields: "+email"
|
|
9790
|
+
});
|
|
9791
|
+
if (isError) {
|
|
9792
|
+
throw error;
|
|
9793
|
+
}
|
|
9794
|
+
const isReady = !isPending && !!order;
|
|
9766
9795
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9767
|
-
/* @__PURE__ */ jsxRuntime.
|
|
9768
|
-
|
|
9796
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9797
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9798
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9799
|
+
] }),
|
|
9800
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9769
9801
|
] });
|
|
9770
9802
|
};
|
|
9771
|
-
const
|
|
9803
|
+
const EmailForm = ({ order }) => {
|
|
9772
9804
|
const form = reactHookForm.useForm({
|
|
9773
|
-
|
|
9805
|
+
defaultValues: {
|
|
9806
|
+
email: order.email ?? ""
|
|
9807
|
+
},
|
|
9808
|
+
resolver: zod.zodResolver(schema$3)
|
|
9774
9809
|
});
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9810
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9811
|
+
const { handleSuccess } = useRouteModal();
|
|
9812
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9813
|
+
await mutateAsync(
|
|
9814
|
+
{ email: data.email },
|
|
9815
|
+
{
|
|
9816
|
+
onSuccess: () => {
|
|
9817
|
+
handleSuccess();
|
|
9818
|
+
},
|
|
9819
|
+
onError: (error) => {
|
|
9820
|
+
ui.toast.error(error.message);
|
|
9821
|
+
}
|
|
9822
|
+
}
|
|
9823
|
+
);
|
|
9824
|
+
});
|
|
9825
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9826
|
+
KeyboundForm,
|
|
9827
|
+
{
|
|
9828
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9829
|
+
onSubmit,
|
|
9830
|
+
children: [
|
|
9831
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9832
|
+
Form$2.Field,
|
|
9833
|
+
{
|
|
9834
|
+
control: form.control,
|
|
9835
|
+
name: "email",
|
|
9836
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9837
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9838
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9840
|
+
] })
|
|
9841
|
+
}
|
|
9842
|
+
) }),
|
|
9843
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9844
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9845
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9846
|
+
] }) })
|
|
9847
|
+
]
|
|
9848
|
+
}
|
|
9849
|
+
) });
|
|
9782
9850
|
};
|
|
9783
|
-
const schema$
|
|
9851
|
+
const schema$3 = objectType({
|
|
9784
9852
|
email: stringType().email()
|
|
9785
9853
|
});
|
|
9786
9854
|
const NumberInput = React.forwardRef(
|
|
@@ -11384,74 +11452,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11384
11452
|
}
|
|
11385
11453
|
return Array.from(promotionIds);
|
|
11386
11454
|
}
|
|
11387
|
-
const Email = () => {
|
|
11388
|
-
const { id } = reactRouterDom.useParams();
|
|
11389
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11390
|
-
fields: "+email"
|
|
11391
|
-
});
|
|
11392
|
-
if (isError) {
|
|
11393
|
-
throw error;
|
|
11394
|
-
}
|
|
11395
|
-
const isReady = !isPending && !!order;
|
|
11396
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11397
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11398
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
11399
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11400
|
-
] }),
|
|
11401
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
11402
|
-
] });
|
|
11403
|
-
};
|
|
11404
|
-
const EmailForm = ({ order }) => {
|
|
11405
|
-
const form = reactHookForm.useForm({
|
|
11406
|
-
defaultValues: {
|
|
11407
|
-
email: order.email ?? ""
|
|
11408
|
-
},
|
|
11409
|
-
resolver: zod.zodResolver(schema$3)
|
|
11410
|
-
});
|
|
11411
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11412
|
-
const { handleSuccess } = useRouteModal();
|
|
11413
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11414
|
-
await mutateAsync(
|
|
11415
|
-
{ email: data.email },
|
|
11416
|
-
{
|
|
11417
|
-
onSuccess: () => {
|
|
11418
|
-
handleSuccess();
|
|
11419
|
-
},
|
|
11420
|
-
onError: (error) => {
|
|
11421
|
-
ui.toast.error(error.message);
|
|
11422
|
-
}
|
|
11423
|
-
}
|
|
11424
|
-
);
|
|
11425
|
-
});
|
|
11426
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11427
|
-
KeyboundForm,
|
|
11428
|
-
{
|
|
11429
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11430
|
-
onSubmit,
|
|
11431
|
-
children: [
|
|
11432
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11433
|
-
Form$2.Field,
|
|
11434
|
-
{
|
|
11435
|
-
control: form.control,
|
|
11436
|
-
name: "email",
|
|
11437
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11438
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
11439
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11440
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11441
|
-
] })
|
|
11442
|
-
}
|
|
11443
|
-
) }),
|
|
11444
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11445
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11446
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11447
|
-
] }) })
|
|
11448
|
-
]
|
|
11449
|
-
}
|
|
11450
|
-
) });
|
|
11451
|
-
};
|
|
11452
|
-
const schema$3 = objectType({
|
|
11453
|
-
email: stringType().email()
|
|
11454
|
-
});
|
|
11455
11455
|
const SalesChannel = () => {
|
|
11456
11456
|
const { id } = reactRouterDom.useParams();
|
|
11457
11457
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13064,13 +13064,17 @@ const routeModule = {
|
|
|
13064
13064
|
handle,
|
|
13065
13065
|
loader,
|
|
13066
13066
|
children: [
|
|
13067
|
+
{
|
|
13068
|
+
Component: CustomItems,
|
|
13069
|
+
path: "/draft-orders/:id/custom-items"
|
|
13070
|
+
},
|
|
13067
13071
|
{
|
|
13068
13072
|
Component: BillingAddress,
|
|
13069
13073
|
path: "/draft-orders/:id/billing-address"
|
|
13070
13074
|
},
|
|
13071
13075
|
{
|
|
13072
|
-
Component:
|
|
13073
|
-
path: "/draft-orders/:id/
|
|
13076
|
+
Component: Email,
|
|
13077
|
+
path: "/draft-orders/:id/email"
|
|
13074
13078
|
},
|
|
13075
13079
|
{
|
|
13076
13080
|
Component: Items,
|
|
@@ -13084,10 +13088,6 @@ const routeModule = {
|
|
|
13084
13088
|
Component: Promotions,
|
|
13085
13089
|
path: "/draft-orders/:id/promotions"
|
|
13086
13090
|
},
|
|
13087
|
-
{
|
|
13088
|
-
Component: Email,
|
|
13089
|
-
path: "/draft-orders/:id/email"
|
|
13090
|
-
},
|
|
13091
13091
|
{
|
|
13092
13092
|
Component: SalesChannel,
|
|
13093
13093
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -9565,6 +9565,27 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
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
|
+
});
|
|
9568
9589
|
const BillingAddress = () => {
|
|
9569
9590
|
const { id } = useParams();
|
|
9570
9591
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9597,7 +9618,7 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9597
9618
|
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
9619
|
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
9620
|
},
|
|
9600
|
-
resolver: zodResolver(schema$
|
|
9621
|
+
resolver: zodResolver(schema$4)
|
|
9601
9622
|
});
|
|
9602
9623
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9603
9624
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9754,26 +9775,73 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9754
9775
|
}
|
|
9755
9776
|
) });
|
|
9756
9777
|
};
|
|
9757
|
-
const schema$
|
|
9758
|
-
const
|
|
9778
|
+
const schema$4 = addressSchema;
|
|
9779
|
+
const Email = () => {
|
|
9780
|
+
const { id } = useParams();
|
|
9781
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9782
|
+
fields: "+email"
|
|
9783
|
+
});
|
|
9784
|
+
if (isError) {
|
|
9785
|
+
throw error;
|
|
9786
|
+
}
|
|
9787
|
+
const isReady = !isPending && !!order;
|
|
9759
9788
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
|
-
/* @__PURE__ */
|
|
9761
|
-
|
|
9789
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9790
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9791
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9792
|
+
] }),
|
|
9793
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9762
9794
|
] });
|
|
9763
9795
|
};
|
|
9764
|
-
const
|
|
9796
|
+
const EmailForm = ({ order }) => {
|
|
9765
9797
|
const form = useForm({
|
|
9766
|
-
|
|
9798
|
+
defaultValues: {
|
|
9799
|
+
email: order.email ?? ""
|
|
9800
|
+
},
|
|
9801
|
+
resolver: zodResolver(schema$3)
|
|
9767
9802
|
});
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9803
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9804
|
+
const { handleSuccess } = useRouteModal();
|
|
9805
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9806
|
+
await mutateAsync(
|
|
9807
|
+
{ email: data.email },
|
|
9808
|
+
{
|
|
9809
|
+
onSuccess: () => {
|
|
9810
|
+
handleSuccess();
|
|
9811
|
+
},
|
|
9812
|
+
onError: (error) => {
|
|
9813
|
+
toast.error(error.message);
|
|
9814
|
+
}
|
|
9815
|
+
}
|
|
9816
|
+
);
|
|
9817
|
+
});
|
|
9818
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9819
|
+
KeyboundForm,
|
|
9820
|
+
{
|
|
9821
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9822
|
+
onSubmit,
|
|
9823
|
+
children: [
|
|
9824
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9825
|
+
Form$2.Field,
|
|
9826
|
+
{
|
|
9827
|
+
control: form.control,
|
|
9828
|
+
name: "email",
|
|
9829
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9830
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9831
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9832
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9833
|
+
] })
|
|
9834
|
+
}
|
|
9835
|
+
) }),
|
|
9836
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9837
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9838
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9839
|
+
] }) })
|
|
9840
|
+
]
|
|
9841
|
+
}
|
|
9842
|
+
) });
|
|
9775
9843
|
};
|
|
9776
|
-
const schema$
|
|
9844
|
+
const schema$3 = objectType({
|
|
9777
9845
|
email: stringType().email()
|
|
9778
9846
|
});
|
|
9779
9847
|
const NumberInput = forwardRef(
|
|
@@ -11377,74 +11445,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11377
11445
|
}
|
|
11378
11446
|
return Array.from(promotionIds);
|
|
11379
11447
|
}
|
|
11380
|
-
const Email = () => {
|
|
11381
|
-
const { id } = useParams();
|
|
11382
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11383
|
-
fields: "+email"
|
|
11384
|
-
});
|
|
11385
|
-
if (isError) {
|
|
11386
|
-
throw error;
|
|
11387
|
-
}
|
|
11388
|
-
const isReady = !isPending && !!order;
|
|
11389
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11390
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11391
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
11392
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11393
|
-
] }),
|
|
11394
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
11395
|
-
] });
|
|
11396
|
-
};
|
|
11397
|
-
const EmailForm = ({ order }) => {
|
|
11398
|
-
const form = useForm({
|
|
11399
|
-
defaultValues: {
|
|
11400
|
-
email: order.email ?? ""
|
|
11401
|
-
},
|
|
11402
|
-
resolver: zodResolver(schema$3)
|
|
11403
|
-
});
|
|
11404
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11405
|
-
const { handleSuccess } = useRouteModal();
|
|
11406
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11407
|
-
await mutateAsync(
|
|
11408
|
-
{ email: data.email },
|
|
11409
|
-
{
|
|
11410
|
-
onSuccess: () => {
|
|
11411
|
-
handleSuccess();
|
|
11412
|
-
},
|
|
11413
|
-
onError: (error) => {
|
|
11414
|
-
toast.error(error.message);
|
|
11415
|
-
}
|
|
11416
|
-
}
|
|
11417
|
-
);
|
|
11418
|
-
});
|
|
11419
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11420
|
-
KeyboundForm,
|
|
11421
|
-
{
|
|
11422
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11423
|
-
onSubmit,
|
|
11424
|
-
children: [
|
|
11425
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
11426
|
-
Form$2.Field,
|
|
11427
|
-
{
|
|
11428
|
-
control: form.control,
|
|
11429
|
-
name: "email",
|
|
11430
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11431
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
11432
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11433
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11434
|
-
] })
|
|
11435
|
-
}
|
|
11436
|
-
) }),
|
|
11437
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11438
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11439
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11440
|
-
] }) })
|
|
11441
|
-
]
|
|
11442
|
-
}
|
|
11443
|
-
) });
|
|
11444
|
-
};
|
|
11445
|
-
const schema$3 = objectType({
|
|
11446
|
-
email: stringType().email()
|
|
11447
|
-
});
|
|
11448
11448
|
const SalesChannel = () => {
|
|
11449
11449
|
const { id } = useParams();
|
|
11450
11450
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13057,13 +13057,17 @@ const routeModule = {
|
|
|
13057
13057
|
handle,
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
|
+
{
|
|
13061
|
+
Component: CustomItems,
|
|
13062
|
+
path: "/draft-orders/:id/custom-items"
|
|
13063
|
+
},
|
|
13060
13064
|
{
|
|
13061
13065
|
Component: BillingAddress,
|
|
13062
13066
|
path: "/draft-orders/:id/billing-address"
|
|
13063
13067
|
},
|
|
13064
13068
|
{
|
|
13065
|
-
Component:
|
|
13066
|
-
path: "/draft-orders/:id/
|
|
13069
|
+
Component: Email,
|
|
13070
|
+
path: "/draft-orders/:id/email"
|
|
13067
13071
|
},
|
|
13068
13072
|
{
|
|
13069
13073
|
Component: Items,
|
|
@@ -13077,10 +13081,6 @@ const routeModule = {
|
|
|
13077
13081
|
Component: Promotions,
|
|
13078
13082
|
path: "/draft-orders/:id/promotions"
|
|
13079
13083
|
},
|
|
13080
|
-
{
|
|
13081
|
-
Component: Email,
|
|
13082
|
-
path: "/draft-orders/:id/email"
|
|
13083
|
-
},
|
|
13084
13084
|
{
|
|
13085
13085
|
Component: SalesChannel,
|
|
13086
13086
|
path: "/draft-orders/:id/sales-channel"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.4-preview-
|
|
3
|
+
"version": "2.11.4-preview-20251115180132",
|
|
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-20251115180132",
|
|
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-20251115180132",
|
|
52
|
+
"@medusajs/cli": "2.11.4-preview-20251115180132",
|
|
53
|
+
"@medusajs/framework": "2.11.4-preview-20251115180132",
|
|
54
|
+
"@medusajs/icons": "2.11.4-preview-20251115180132",
|
|
55
|
+
"@medusajs/test-utils": "2.11.4-preview-20251115180132",
|
|
56
|
+
"@medusajs/types": "2.11.4-preview-20251115180132",
|
|
57
|
+
"@medusajs/ui": "4.0.28-preview-20251115180132",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.4-preview-20251115180132"
|
|
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-20251115180132",
|
|
62
|
+
"@medusajs/cli": "2.11.4-preview-20251115180132",
|
|
63
|
+
"@medusajs/framework": "2.11.4-preview-20251115180132",
|
|
64
|
+
"@medusajs/icons": "2.11.4-preview-20251115180132",
|
|
65
|
+
"@medusajs/test-utils": "2.11.4-preview-20251115180132",
|
|
66
|
+
"@medusajs/ui": "4.0.28-preview-20251115180132",
|
|
67
67
|
"react": "^18.3.1",
|
|
68
68
|
"react-dom": "^18.3.1",
|
|
69
69
|
"react-router-dom": "6.20.1"
|