@medusajs/draft-order 2.10.4-preview-20250928180152 → 2.10.4-preview-20250928210151
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 +240 -240
- package/.medusa/server/src/admin/index.mjs +240 -240
- package/package.json +16 -16
|
@@ -9573,10 +9573,31 @@ const ID = () => {
|
|
|
9573
9573
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9574
9574
|
] });
|
|
9575
9575
|
};
|
|
9576
|
-
const
|
|
9576
|
+
const CustomItems = () => {
|
|
9577
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9578
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9579
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9580
|
+
] });
|
|
9581
|
+
};
|
|
9582
|
+
const CustomItemsForm = () => {
|
|
9583
|
+
const form = reactHookForm.useForm({
|
|
9584
|
+
resolver: zod.zodResolver(schema$5)
|
|
9585
|
+
});
|
|
9586
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9587
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9588
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9589
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9590
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9591
|
+
] }) })
|
|
9592
|
+
] }) });
|
|
9593
|
+
};
|
|
9594
|
+
const schema$5 = objectType({
|
|
9595
|
+
email: stringType().email()
|
|
9596
|
+
});
|
|
9597
|
+
const Email = () => {
|
|
9577
9598
|
const { id } = reactRouterDom.useParams();
|
|
9578
9599
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9579
|
-
fields: "+
|
|
9600
|
+
fields: "+email"
|
|
9580
9601
|
});
|
|
9581
9602
|
if (isError) {
|
|
9582
9603
|
throw error;
|
|
@@ -9584,34 +9605,24 @@ const BillingAddress = () => {
|
|
|
9584
9605
|
const isReady = !isPending && !!order;
|
|
9585
9606
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9586
9607
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9587
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit
|
|
9588
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the
|
|
9608
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9609
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9589
9610
|
] }),
|
|
9590
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9611
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9591
9612
|
] });
|
|
9592
9613
|
};
|
|
9593
|
-
const
|
|
9594
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9614
|
+
const EmailForm = ({ order }) => {
|
|
9595
9615
|
const form = reactHookForm.useForm({
|
|
9596
9616
|
defaultValues: {
|
|
9597
|
-
|
|
9598
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9599
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9600
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9601
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9602
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9603
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9604
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9605
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9606
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9617
|
+
email: order.email ?? ""
|
|
9607
9618
|
},
|
|
9608
|
-
resolver: zod.zodResolver(schema$
|
|
9619
|
+
resolver: zod.zodResolver(schema$4)
|
|
9609
9620
|
});
|
|
9610
9621
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9611
9622
|
const { handleSuccess } = useRouteModal();
|
|
9612
9623
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9613
9624
|
await mutateAsync(
|
|
9614
|
-
{
|
|
9625
|
+
{ email: data.email },
|
|
9615
9626
|
{
|
|
9616
9627
|
onSuccess: () => {
|
|
9617
9628
|
handleSuccess();
|
|
@@ -9628,132 +9639,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9628
9639
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9629
9640
|
onSubmit,
|
|
9630
9641
|
children: [
|
|
9631
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
),
|
|
9644
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9645
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9646
|
-
Form$2.Field,
|
|
9647
|
-
{
|
|
9648
|
-
control: form.control,
|
|
9649
|
-
name: "first_name",
|
|
9650
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9653
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9654
|
-
] })
|
|
9655
|
-
}
|
|
9656
|
-
),
|
|
9657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9658
|
-
Form$2.Field,
|
|
9659
|
-
{
|
|
9660
|
-
control: form.control,
|
|
9661
|
-
name: "last_name",
|
|
9662
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9664
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9665
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9666
|
-
] })
|
|
9667
|
-
}
|
|
9668
|
-
)
|
|
9669
|
-
] }),
|
|
9670
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9671
|
-
Form$2.Field,
|
|
9672
|
-
{
|
|
9673
|
-
control: form.control,
|
|
9674
|
-
name: "company",
|
|
9675
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9677
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9678
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9679
|
-
] })
|
|
9680
|
-
}
|
|
9681
|
-
),
|
|
9682
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9683
|
-
Form$2.Field,
|
|
9684
|
-
{
|
|
9685
|
-
control: form.control,
|
|
9686
|
-
name: "address_1",
|
|
9687
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9689
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9690
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9691
|
-
] })
|
|
9692
|
-
}
|
|
9693
|
-
),
|
|
9694
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9695
|
-
Form$2.Field,
|
|
9696
|
-
{
|
|
9697
|
-
control: form.control,
|
|
9698
|
-
name: "address_2",
|
|
9699
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9701
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9702
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9703
|
-
] })
|
|
9704
|
-
}
|
|
9705
|
-
),
|
|
9706
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9707
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9708
|
-
Form$2.Field,
|
|
9709
|
-
{
|
|
9710
|
-
control: form.control,
|
|
9711
|
-
name: "postal_code",
|
|
9712
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9714
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9715
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9716
|
-
] })
|
|
9717
|
-
}
|
|
9718
|
-
),
|
|
9719
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9720
|
-
Form$2.Field,
|
|
9721
|
-
{
|
|
9722
|
-
control: form.control,
|
|
9723
|
-
name: "city",
|
|
9724
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9726
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9727
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9728
|
-
] })
|
|
9729
|
-
}
|
|
9730
|
-
)
|
|
9731
|
-
] }),
|
|
9732
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9733
|
-
Form$2.Field,
|
|
9734
|
-
{
|
|
9735
|
-
control: form.control,
|
|
9736
|
-
name: "province",
|
|
9737
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9739
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9740
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9741
|
-
] })
|
|
9742
|
-
}
|
|
9743
|
-
),
|
|
9744
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9745
|
-
Form$2.Field,
|
|
9746
|
-
{
|
|
9747
|
-
control: form.control,
|
|
9748
|
-
name: "phone",
|
|
9749
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9750
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9751
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9752
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9753
|
-
] })
|
|
9754
|
-
}
|
|
9755
|
-
)
|
|
9756
|
-
] }) }),
|
|
9642
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9643
|
+
Form$2.Field,
|
|
9644
|
+
{
|
|
9645
|
+
control: form.control,
|
|
9646
|
+
name: "email",
|
|
9647
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9648
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9649
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9650
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9651
|
+
] })
|
|
9652
|
+
}
|
|
9653
|
+
) }),
|
|
9757
9654
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9758
9655
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9759
9656
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9762,25 +9659,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9659
|
}
|
|
9763
9660
|
) });
|
|
9764
9661
|
};
|
|
9765
|
-
const schema$5 = addressSchema;
|
|
9766
|
-
const CustomItems = () => {
|
|
9767
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9768
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9769
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9770
|
-
] });
|
|
9771
|
-
};
|
|
9772
|
-
const CustomItemsForm = () => {
|
|
9773
|
-
const form = reactHookForm.useForm({
|
|
9774
|
-
resolver: zod.zodResolver(schema$4)
|
|
9775
|
-
});
|
|
9776
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9779
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9780
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
9781
|
-
] }) })
|
|
9782
|
-
] }) });
|
|
9783
|
-
};
|
|
9784
9662
|
const schema$4 = objectType({
|
|
9785
9663
|
email: stringType().email()
|
|
9786
9664
|
});
|
|
@@ -10758,74 +10636,6 @@ const customItemSchema = objectType({
|
|
|
10758
10636
|
quantity: numberType(),
|
|
10759
10637
|
unit_price: unionType([numberType(), stringType()])
|
|
10760
10638
|
});
|
|
10761
|
-
const Email = () => {
|
|
10762
|
-
const { id } = reactRouterDom.useParams();
|
|
10763
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10764
|
-
fields: "+email"
|
|
10765
|
-
});
|
|
10766
|
-
if (isError) {
|
|
10767
|
-
throw error;
|
|
10768
|
-
}
|
|
10769
|
-
const isReady = !isPending && !!order;
|
|
10770
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10771
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10772
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
10773
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10774
|
-
] }),
|
|
10775
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10776
|
-
] });
|
|
10777
|
-
};
|
|
10778
|
-
const EmailForm = ({ order }) => {
|
|
10779
|
-
const form = reactHookForm.useForm({
|
|
10780
|
-
defaultValues: {
|
|
10781
|
-
email: order.email ?? ""
|
|
10782
|
-
},
|
|
10783
|
-
resolver: zod.zodResolver(schema$3)
|
|
10784
|
-
});
|
|
10785
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10786
|
-
const { handleSuccess } = useRouteModal();
|
|
10787
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10788
|
-
await mutateAsync(
|
|
10789
|
-
{ email: data.email },
|
|
10790
|
-
{
|
|
10791
|
-
onSuccess: () => {
|
|
10792
|
-
handleSuccess();
|
|
10793
|
-
},
|
|
10794
|
-
onError: (error) => {
|
|
10795
|
-
ui.toast.error(error.message);
|
|
10796
|
-
}
|
|
10797
|
-
}
|
|
10798
|
-
);
|
|
10799
|
-
});
|
|
10800
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10801
|
-
KeyboundForm,
|
|
10802
|
-
{
|
|
10803
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10804
|
-
onSubmit,
|
|
10805
|
-
children: [
|
|
10806
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10807
|
-
Form$2.Field,
|
|
10808
|
-
{
|
|
10809
|
-
control: form.control,
|
|
10810
|
-
name: "email",
|
|
10811
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10812
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
10813
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10814
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10815
|
-
] })
|
|
10816
|
-
}
|
|
10817
|
-
) }),
|
|
10818
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10819
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10820
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10821
|
-
] }) })
|
|
10822
|
-
]
|
|
10823
|
-
}
|
|
10824
|
-
) });
|
|
10825
|
-
};
|
|
10826
|
-
const schema$3 = objectType({
|
|
10827
|
-
email: stringType().email()
|
|
10828
|
-
});
|
|
10829
10639
|
const InlineTip = React.forwardRef(
|
|
10830
10640
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10831
10641
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11453,6 +11263,196 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11453
11263
|
}
|
|
11454
11264
|
return Array.from(promotionIds);
|
|
11455
11265
|
}
|
|
11266
|
+
const BillingAddress = () => {
|
|
11267
|
+
const { id } = reactRouterDom.useParams();
|
|
11268
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11269
|
+
fields: "+billing_address"
|
|
11270
|
+
});
|
|
11271
|
+
if (isError) {
|
|
11272
|
+
throw error;
|
|
11273
|
+
}
|
|
11274
|
+
const isReady = !isPending && !!order;
|
|
11275
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11276
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11277
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
11278
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11279
|
+
] }),
|
|
11280
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
11281
|
+
] });
|
|
11282
|
+
};
|
|
11283
|
+
const BillingAddressForm = ({ order }) => {
|
|
11284
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11285
|
+
const form = reactHookForm.useForm({
|
|
11286
|
+
defaultValues: {
|
|
11287
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11288
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11289
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11290
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11291
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11292
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11293
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11294
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11295
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11296
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11297
|
+
},
|
|
11298
|
+
resolver: zod.zodResolver(schema$3)
|
|
11299
|
+
});
|
|
11300
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11301
|
+
const { handleSuccess } = useRouteModal();
|
|
11302
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11303
|
+
await mutateAsync(
|
|
11304
|
+
{ billing_address: data },
|
|
11305
|
+
{
|
|
11306
|
+
onSuccess: () => {
|
|
11307
|
+
handleSuccess();
|
|
11308
|
+
},
|
|
11309
|
+
onError: (error) => {
|
|
11310
|
+
ui.toast.error(error.message);
|
|
11311
|
+
}
|
|
11312
|
+
}
|
|
11313
|
+
);
|
|
11314
|
+
});
|
|
11315
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11316
|
+
KeyboundForm,
|
|
11317
|
+
{
|
|
11318
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11319
|
+
onSubmit,
|
|
11320
|
+
children: [
|
|
11321
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
11322
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11323
|
+
Form$2.Field,
|
|
11324
|
+
{
|
|
11325
|
+
control: form.control,
|
|
11326
|
+
name: "country_code",
|
|
11327
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11328
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11329
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11330
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11331
|
+
] })
|
|
11332
|
+
}
|
|
11333
|
+
),
|
|
11334
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11335
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11336
|
+
Form$2.Field,
|
|
11337
|
+
{
|
|
11338
|
+
control: form.control,
|
|
11339
|
+
name: "first_name",
|
|
11340
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11341
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11342
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11343
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11344
|
+
] })
|
|
11345
|
+
}
|
|
11346
|
+
),
|
|
11347
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11348
|
+
Form$2.Field,
|
|
11349
|
+
{
|
|
11350
|
+
control: form.control,
|
|
11351
|
+
name: "last_name",
|
|
11352
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11353
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11354
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11355
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11356
|
+
] })
|
|
11357
|
+
}
|
|
11358
|
+
)
|
|
11359
|
+
] }),
|
|
11360
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11361
|
+
Form$2.Field,
|
|
11362
|
+
{
|
|
11363
|
+
control: form.control,
|
|
11364
|
+
name: "company",
|
|
11365
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11366
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11367
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11368
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11369
|
+
] })
|
|
11370
|
+
}
|
|
11371
|
+
),
|
|
11372
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11373
|
+
Form$2.Field,
|
|
11374
|
+
{
|
|
11375
|
+
control: form.control,
|
|
11376
|
+
name: "address_1",
|
|
11377
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11378
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11379
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11380
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11381
|
+
] })
|
|
11382
|
+
}
|
|
11383
|
+
),
|
|
11384
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11385
|
+
Form$2.Field,
|
|
11386
|
+
{
|
|
11387
|
+
control: form.control,
|
|
11388
|
+
name: "address_2",
|
|
11389
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11390
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11391
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11392
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11393
|
+
] })
|
|
11394
|
+
}
|
|
11395
|
+
),
|
|
11396
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11397
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11398
|
+
Form$2.Field,
|
|
11399
|
+
{
|
|
11400
|
+
control: form.control,
|
|
11401
|
+
name: "postal_code",
|
|
11402
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11403
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11404
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11405
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11406
|
+
] })
|
|
11407
|
+
}
|
|
11408
|
+
),
|
|
11409
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11410
|
+
Form$2.Field,
|
|
11411
|
+
{
|
|
11412
|
+
control: form.control,
|
|
11413
|
+
name: "city",
|
|
11414
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11415
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11416
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11417
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11418
|
+
] })
|
|
11419
|
+
}
|
|
11420
|
+
)
|
|
11421
|
+
] }),
|
|
11422
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11423
|
+
Form$2.Field,
|
|
11424
|
+
{
|
|
11425
|
+
control: form.control,
|
|
11426
|
+
name: "province",
|
|
11427
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11428
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11429
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11430
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11431
|
+
] })
|
|
11432
|
+
}
|
|
11433
|
+
),
|
|
11434
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11435
|
+
Form$2.Field,
|
|
11436
|
+
{
|
|
11437
|
+
control: form.control,
|
|
11438
|
+
name: "phone",
|
|
11439
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11440
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11441
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11442
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11443
|
+
] })
|
|
11444
|
+
}
|
|
11445
|
+
)
|
|
11446
|
+
] }) }),
|
|
11447
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11448
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11449
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11450
|
+
] }) })
|
|
11451
|
+
]
|
|
11452
|
+
}
|
|
11453
|
+
) });
|
|
11454
|
+
};
|
|
11455
|
+
const schema$3 = addressSchema;
|
|
11456
11456
|
const SalesChannel = () => {
|
|
11457
11457
|
const { id } = reactRouterDom.useParams();
|
|
11458
11458
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13065,22 +13065,18 @@ const routeModule = {
|
|
|
13065
13065
|
handle,
|
|
13066
13066
|
loader,
|
|
13067
13067
|
children: [
|
|
13068
|
-
{
|
|
13069
|
-
Component: BillingAddress,
|
|
13070
|
-
path: "/draft-orders/:id/billing-address"
|
|
13071
|
-
},
|
|
13072
13068
|
{
|
|
13073
13069
|
Component: CustomItems,
|
|
13074
13070
|
path: "/draft-orders/:id/custom-items"
|
|
13075
13071
|
},
|
|
13076
|
-
{
|
|
13077
|
-
Component: Items,
|
|
13078
|
-
path: "/draft-orders/:id/items"
|
|
13079
|
-
},
|
|
13080
13072
|
{
|
|
13081
13073
|
Component: Email,
|
|
13082
13074
|
path: "/draft-orders/:id/email"
|
|
13083
13075
|
},
|
|
13076
|
+
{
|
|
13077
|
+
Component: Items,
|
|
13078
|
+
path: "/draft-orders/:id/items"
|
|
13079
|
+
},
|
|
13084
13080
|
{
|
|
13085
13081
|
Component: Metadata,
|
|
13086
13082
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13089,6 +13085,10 @@ const routeModule = {
|
|
|
13089
13085
|
Component: Promotions,
|
|
13090
13086
|
path: "/draft-orders/:id/promotions"
|
|
13091
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: BillingAddress,
|
|
13090
|
+
path: "/draft-orders/:id/billing-address"
|
|
13091
|
+
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: SalesChannel,
|
|
13094
13094
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -9567,10 +9567,31 @@ const ID = () => {
|
|
|
9567
9567
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9568
9568
|
] });
|
|
9569
9569
|
};
|
|
9570
|
-
const
|
|
9570
|
+
const CustomItems = () => {
|
|
9571
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9572
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9573
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9574
|
+
] });
|
|
9575
|
+
};
|
|
9576
|
+
const CustomItemsForm = () => {
|
|
9577
|
+
const form = useForm({
|
|
9578
|
+
resolver: zodResolver(schema$5)
|
|
9579
|
+
});
|
|
9580
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9581
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9582
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9583
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9584
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9585
|
+
] }) })
|
|
9586
|
+
] }) });
|
|
9587
|
+
};
|
|
9588
|
+
const schema$5 = objectType({
|
|
9589
|
+
email: stringType().email()
|
|
9590
|
+
});
|
|
9591
|
+
const Email = () => {
|
|
9571
9592
|
const { id } = useParams();
|
|
9572
9593
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
9573
|
-
fields: "+
|
|
9594
|
+
fields: "+email"
|
|
9574
9595
|
});
|
|
9575
9596
|
if (isError) {
|
|
9576
9597
|
throw error;
|
|
@@ -9578,34 +9599,24 @@ const BillingAddress = () => {
|
|
|
9578
9599
|
const isReady = !isPending && !!order;
|
|
9579
9600
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9580
9601
|
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9581
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit
|
|
9582
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the
|
|
9602
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
9603
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9583
9604
|
] }),
|
|
9584
|
-
isReady && /* @__PURE__ */ jsx(
|
|
9605
|
+
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
9585
9606
|
] });
|
|
9586
9607
|
};
|
|
9587
|
-
const
|
|
9588
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9608
|
+
const EmailForm = ({ order }) => {
|
|
9589
9609
|
const form = useForm({
|
|
9590
9610
|
defaultValues: {
|
|
9591
|
-
|
|
9592
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9593
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9594
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9595
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9596
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9597
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9598
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9599
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9600
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9611
|
+
email: order.email ?? ""
|
|
9601
9612
|
},
|
|
9602
|
-
resolver: zodResolver(schema$
|
|
9613
|
+
resolver: zodResolver(schema$4)
|
|
9603
9614
|
});
|
|
9604
9615
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9605
9616
|
const { handleSuccess } = useRouteModal();
|
|
9606
9617
|
const onSubmit = form.handleSubmit(async (data) => {
|
|
9607
9618
|
await mutateAsync(
|
|
9608
|
-
{
|
|
9619
|
+
{ email: data.email },
|
|
9609
9620
|
{
|
|
9610
9621
|
onSuccess: () => {
|
|
9611
9622
|
handleSuccess();
|
|
@@ -9622,132 +9633,18 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9622
9633
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
9623
9634
|
onSubmit,
|
|
9624
9635
|
children: [
|
|
9625
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
),
|
|
9638
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9639
|
-
/* @__PURE__ */ jsx(
|
|
9640
|
-
Form$2.Field,
|
|
9641
|
-
{
|
|
9642
|
-
control: form.control,
|
|
9643
|
-
name: "first_name",
|
|
9644
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9646
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9647
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9648
|
-
] })
|
|
9649
|
-
}
|
|
9650
|
-
),
|
|
9651
|
-
/* @__PURE__ */ jsx(
|
|
9652
|
-
Form$2.Field,
|
|
9653
|
-
{
|
|
9654
|
-
control: form.control,
|
|
9655
|
-
name: "last_name",
|
|
9656
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9658
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9659
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9660
|
-
] })
|
|
9661
|
-
}
|
|
9662
|
-
)
|
|
9663
|
-
] }),
|
|
9664
|
-
/* @__PURE__ */ jsx(
|
|
9665
|
-
Form$2.Field,
|
|
9666
|
-
{
|
|
9667
|
-
control: form.control,
|
|
9668
|
-
name: "company",
|
|
9669
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9671
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9672
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9673
|
-
] })
|
|
9674
|
-
}
|
|
9675
|
-
),
|
|
9676
|
-
/* @__PURE__ */ jsx(
|
|
9677
|
-
Form$2.Field,
|
|
9678
|
-
{
|
|
9679
|
-
control: form.control,
|
|
9680
|
-
name: "address_1",
|
|
9681
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9683
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9684
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9685
|
-
] })
|
|
9686
|
-
}
|
|
9687
|
-
),
|
|
9688
|
-
/* @__PURE__ */ jsx(
|
|
9689
|
-
Form$2.Field,
|
|
9690
|
-
{
|
|
9691
|
-
control: form.control,
|
|
9692
|
-
name: "address_2",
|
|
9693
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9695
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9696
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9697
|
-
] })
|
|
9698
|
-
}
|
|
9699
|
-
),
|
|
9700
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9701
|
-
/* @__PURE__ */ jsx(
|
|
9702
|
-
Form$2.Field,
|
|
9703
|
-
{
|
|
9704
|
-
control: form.control,
|
|
9705
|
-
name: "postal_code",
|
|
9706
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9708
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9709
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9710
|
-
] })
|
|
9711
|
-
}
|
|
9712
|
-
),
|
|
9713
|
-
/* @__PURE__ */ jsx(
|
|
9714
|
-
Form$2.Field,
|
|
9715
|
-
{
|
|
9716
|
-
control: form.control,
|
|
9717
|
-
name: "city",
|
|
9718
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9720
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9721
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9722
|
-
] })
|
|
9723
|
-
}
|
|
9724
|
-
)
|
|
9725
|
-
] }),
|
|
9726
|
-
/* @__PURE__ */ jsx(
|
|
9727
|
-
Form$2.Field,
|
|
9728
|
-
{
|
|
9729
|
-
control: form.control,
|
|
9730
|
-
name: "province",
|
|
9731
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9733
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9734
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9735
|
-
] })
|
|
9736
|
-
}
|
|
9737
|
-
),
|
|
9738
|
-
/* @__PURE__ */ jsx(
|
|
9739
|
-
Form$2.Field,
|
|
9740
|
-
{
|
|
9741
|
-
control: form.control,
|
|
9742
|
-
name: "phone",
|
|
9743
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9744
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9745
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9746
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9747
|
-
] })
|
|
9748
|
-
}
|
|
9749
|
-
)
|
|
9750
|
-
] }) }),
|
|
9636
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
9637
|
+
Form$2.Field,
|
|
9638
|
+
{
|
|
9639
|
+
control: form.control,
|
|
9640
|
+
name: "email",
|
|
9641
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9642
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
9643
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9644
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9645
|
+
] })
|
|
9646
|
+
}
|
|
9647
|
+
) }),
|
|
9751
9648
|
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9752
9649
|
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9753
9650
|
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -9756,25 +9653,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9756
9653
|
}
|
|
9757
9654
|
) });
|
|
9758
9655
|
};
|
|
9759
|
-
const schema$5 = addressSchema;
|
|
9760
|
-
const CustomItems = () => {
|
|
9761
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9762
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9763
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9764
|
-
] });
|
|
9765
|
-
};
|
|
9766
|
-
const CustomItemsForm = () => {
|
|
9767
|
-
const form = useForm({
|
|
9768
|
-
resolver: zodResolver(schema$4)
|
|
9769
|
-
});
|
|
9770
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9772
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9773
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9774
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9775
|
-
] }) })
|
|
9776
|
-
] }) });
|
|
9777
|
-
};
|
|
9778
9656
|
const schema$4 = objectType({
|
|
9779
9657
|
email: stringType().email()
|
|
9780
9658
|
});
|
|
@@ -10752,74 +10630,6 @@ const customItemSchema = objectType({
|
|
|
10752
10630
|
quantity: numberType(),
|
|
10753
10631
|
unit_price: unionType([numberType(), stringType()])
|
|
10754
10632
|
});
|
|
10755
|
-
const Email = () => {
|
|
10756
|
-
const { id } = useParams();
|
|
10757
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10758
|
-
fields: "+email"
|
|
10759
|
-
});
|
|
10760
|
-
if (isError) {
|
|
10761
|
-
throw error;
|
|
10762
|
-
}
|
|
10763
|
-
const isReady = !isPending && !!order;
|
|
10764
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10765
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10766
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
|
|
10767
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10768
|
-
] }),
|
|
10769
|
-
isReady && /* @__PURE__ */ jsx(EmailForm, { order })
|
|
10770
|
-
] });
|
|
10771
|
-
};
|
|
10772
|
-
const EmailForm = ({ order }) => {
|
|
10773
|
-
const form = useForm({
|
|
10774
|
-
defaultValues: {
|
|
10775
|
-
email: order.email ?? ""
|
|
10776
|
-
},
|
|
10777
|
-
resolver: zodResolver(schema$3)
|
|
10778
|
-
});
|
|
10779
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10780
|
-
const { handleSuccess } = useRouteModal();
|
|
10781
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
10782
|
-
await mutateAsync(
|
|
10783
|
-
{ email: data.email },
|
|
10784
|
-
{
|
|
10785
|
-
onSuccess: () => {
|
|
10786
|
-
handleSuccess();
|
|
10787
|
-
},
|
|
10788
|
-
onError: (error) => {
|
|
10789
|
-
toast.error(error.message);
|
|
10790
|
-
}
|
|
10791
|
-
}
|
|
10792
|
-
);
|
|
10793
|
-
});
|
|
10794
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10795
|
-
KeyboundForm,
|
|
10796
|
-
{
|
|
10797
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
10798
|
-
onSubmit,
|
|
10799
|
-
children: [
|
|
10800
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
10801
|
-
Form$2.Field,
|
|
10802
|
-
{
|
|
10803
|
-
control: form.control,
|
|
10804
|
-
name: "email",
|
|
10805
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10806
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
|
|
10807
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10808
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10809
|
-
] })
|
|
10810
|
-
}
|
|
10811
|
-
) }),
|
|
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", isLoading: isPending, children: "Save" })
|
|
10815
|
-
] }) })
|
|
10816
|
-
]
|
|
10817
|
-
}
|
|
10818
|
-
) });
|
|
10819
|
-
};
|
|
10820
|
-
const schema$3 = objectType({
|
|
10821
|
-
email: stringType().email()
|
|
10822
|
-
});
|
|
10823
10633
|
const InlineTip = forwardRef(
|
|
10824
10634
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10825
10635
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11447,6 +11257,196 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11447
11257
|
}
|
|
11448
11258
|
return Array.from(promotionIds);
|
|
11449
11259
|
}
|
|
11260
|
+
const BillingAddress = () => {
|
|
11261
|
+
const { id } = useParams();
|
|
11262
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11263
|
+
fields: "+billing_address"
|
|
11264
|
+
});
|
|
11265
|
+
if (isError) {
|
|
11266
|
+
throw error;
|
|
11267
|
+
}
|
|
11268
|
+
const isReady = !isPending && !!order;
|
|
11269
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11270
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11271
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
11272
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11273
|
+
] }),
|
|
11274
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
11275
|
+
] });
|
|
11276
|
+
};
|
|
11277
|
+
const BillingAddressForm = ({ order }) => {
|
|
11278
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11279
|
+
const form = useForm({
|
|
11280
|
+
defaultValues: {
|
|
11281
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11282
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11283
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11284
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11285
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11286
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11287
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11288
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11289
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11290
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11291
|
+
},
|
|
11292
|
+
resolver: zodResolver(schema$3)
|
|
11293
|
+
});
|
|
11294
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11295
|
+
const { handleSuccess } = useRouteModal();
|
|
11296
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11297
|
+
await mutateAsync(
|
|
11298
|
+
{ billing_address: data },
|
|
11299
|
+
{
|
|
11300
|
+
onSuccess: () => {
|
|
11301
|
+
handleSuccess();
|
|
11302
|
+
},
|
|
11303
|
+
onError: (error) => {
|
|
11304
|
+
toast.error(error.message);
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
);
|
|
11308
|
+
});
|
|
11309
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11310
|
+
KeyboundForm,
|
|
11311
|
+
{
|
|
11312
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11313
|
+
onSubmit,
|
|
11314
|
+
children: [
|
|
11315
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
11316
|
+
/* @__PURE__ */ jsx(
|
|
11317
|
+
Form$2.Field,
|
|
11318
|
+
{
|
|
11319
|
+
control: form.control,
|
|
11320
|
+
name: "country_code",
|
|
11321
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11322
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11323
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11324
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11325
|
+
] })
|
|
11326
|
+
}
|
|
11327
|
+
),
|
|
11328
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11329
|
+
/* @__PURE__ */ jsx(
|
|
11330
|
+
Form$2.Field,
|
|
11331
|
+
{
|
|
11332
|
+
control: form.control,
|
|
11333
|
+
name: "first_name",
|
|
11334
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11335
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11336
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11337
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11338
|
+
] })
|
|
11339
|
+
}
|
|
11340
|
+
),
|
|
11341
|
+
/* @__PURE__ */ jsx(
|
|
11342
|
+
Form$2.Field,
|
|
11343
|
+
{
|
|
11344
|
+
control: form.control,
|
|
11345
|
+
name: "last_name",
|
|
11346
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11347
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11348
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11349
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11350
|
+
] })
|
|
11351
|
+
}
|
|
11352
|
+
)
|
|
11353
|
+
] }),
|
|
11354
|
+
/* @__PURE__ */ jsx(
|
|
11355
|
+
Form$2.Field,
|
|
11356
|
+
{
|
|
11357
|
+
control: form.control,
|
|
11358
|
+
name: "company",
|
|
11359
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11360
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11361
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11362
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11363
|
+
] })
|
|
11364
|
+
}
|
|
11365
|
+
),
|
|
11366
|
+
/* @__PURE__ */ jsx(
|
|
11367
|
+
Form$2.Field,
|
|
11368
|
+
{
|
|
11369
|
+
control: form.control,
|
|
11370
|
+
name: "address_1",
|
|
11371
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11372
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11373
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11374
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11375
|
+
] })
|
|
11376
|
+
}
|
|
11377
|
+
),
|
|
11378
|
+
/* @__PURE__ */ jsx(
|
|
11379
|
+
Form$2.Field,
|
|
11380
|
+
{
|
|
11381
|
+
control: form.control,
|
|
11382
|
+
name: "address_2",
|
|
11383
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11384
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11385
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11386
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11387
|
+
] })
|
|
11388
|
+
}
|
|
11389
|
+
),
|
|
11390
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11391
|
+
/* @__PURE__ */ jsx(
|
|
11392
|
+
Form$2.Field,
|
|
11393
|
+
{
|
|
11394
|
+
control: form.control,
|
|
11395
|
+
name: "postal_code",
|
|
11396
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11397
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11398
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11399
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11400
|
+
] })
|
|
11401
|
+
}
|
|
11402
|
+
),
|
|
11403
|
+
/* @__PURE__ */ jsx(
|
|
11404
|
+
Form$2.Field,
|
|
11405
|
+
{
|
|
11406
|
+
control: form.control,
|
|
11407
|
+
name: "city",
|
|
11408
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11409
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11410
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11411
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11412
|
+
] })
|
|
11413
|
+
}
|
|
11414
|
+
)
|
|
11415
|
+
] }),
|
|
11416
|
+
/* @__PURE__ */ jsx(
|
|
11417
|
+
Form$2.Field,
|
|
11418
|
+
{
|
|
11419
|
+
control: form.control,
|
|
11420
|
+
name: "province",
|
|
11421
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11422
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11423
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11424
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11425
|
+
] })
|
|
11426
|
+
}
|
|
11427
|
+
),
|
|
11428
|
+
/* @__PURE__ */ jsx(
|
|
11429
|
+
Form$2.Field,
|
|
11430
|
+
{
|
|
11431
|
+
control: form.control,
|
|
11432
|
+
name: "phone",
|
|
11433
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11434
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11435
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11436
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11437
|
+
] })
|
|
11438
|
+
}
|
|
11439
|
+
)
|
|
11440
|
+
] }) }),
|
|
11441
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11442
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11443
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11444
|
+
] }) })
|
|
11445
|
+
]
|
|
11446
|
+
}
|
|
11447
|
+
) });
|
|
11448
|
+
};
|
|
11449
|
+
const schema$3 = addressSchema;
|
|
11450
11450
|
const SalesChannel = () => {
|
|
11451
11451
|
const { id } = useParams();
|
|
11452
11452
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13059,22 +13059,18 @@ const routeModule = {
|
|
|
13059
13059
|
handle,
|
|
13060
13060
|
loader,
|
|
13061
13061
|
children: [
|
|
13062
|
-
{
|
|
13063
|
-
Component: BillingAddress,
|
|
13064
|
-
path: "/draft-orders/:id/billing-address"
|
|
13065
|
-
},
|
|
13066
13062
|
{
|
|
13067
13063
|
Component: CustomItems,
|
|
13068
13064
|
path: "/draft-orders/:id/custom-items"
|
|
13069
13065
|
},
|
|
13070
|
-
{
|
|
13071
|
-
Component: Items,
|
|
13072
|
-
path: "/draft-orders/:id/items"
|
|
13073
|
-
},
|
|
13074
13066
|
{
|
|
13075
13067
|
Component: Email,
|
|
13076
13068
|
path: "/draft-orders/:id/email"
|
|
13077
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: Items,
|
|
13072
|
+
path: "/draft-orders/:id/items"
|
|
13073
|
+
},
|
|
13078
13074
|
{
|
|
13079
13075
|
Component: Metadata,
|
|
13080
13076
|
path: "/draft-orders/:id/metadata"
|
|
@@ -13083,6 +13079,10 @@ const routeModule = {
|
|
|
13083
13079
|
Component: Promotions,
|
|
13084
13080
|
path: "/draft-orders/:id/promotions"
|
|
13085
13081
|
},
|
|
13082
|
+
{
|
|
13083
|
+
Component: BillingAddress,
|
|
13084
|
+
path: "/draft-orders/:id/billing-address"
|
|
13085
|
+
},
|
|
13086
13086
|
{
|
|
13087
13087
|
Component: SalesChannel,
|
|
13088
13088
|
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.10.4-preview-
|
|
3
|
+
"version": "2.10.4-preview-20250928210151",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.10.4-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.4-preview-20250928210151",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.10.4-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
53
|
-
"@medusajs/types": "2.10.4-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.4-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20250928210151",
|
|
49
|
+
"@medusajs/cli": "2.10.4-preview-20250928210151",
|
|
50
|
+
"@medusajs/framework": "2.10.4-preview-20250928210151",
|
|
51
|
+
"@medusajs/icons": "2.10.4-preview-20250928210151",
|
|
52
|
+
"@medusajs/test-utils": "2.10.4-preview-20250928210151",
|
|
53
|
+
"@medusajs/types": "2.10.4-preview-20250928210151",
|
|
54
|
+
"@medusajs/ui": "4.0.24-preview-20250928210151",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.4-preview-20250928210151",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.10.4-preview-
|
|
73
|
-
"@medusajs/cli": "2.10.4-preview-
|
|
74
|
-
"@medusajs/framework": "2.10.4-preview-
|
|
75
|
-
"@medusajs/icons": "2.10.4-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.10.4-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.10.4-preview-20250928210151",
|
|
73
|
+
"@medusajs/cli": "2.10.4-preview-20250928210151",
|
|
74
|
+
"@medusajs/framework": "2.10.4-preview-20250928210151",
|
|
75
|
+
"@medusajs/icons": "2.10.4-preview-20250928210151",
|
|
76
|
+
"@medusajs/test-utils": "2.10.4-preview-20250928210151",
|
|
77
|
+
"@medusajs/ui": "4.0.24-preview-20250928210151",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|