@medusajs/draft-order 2.11.2-preview-20251028090156 → 2.11.2-preview-20251028100508
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 +198 -198
- package/.medusa/server/src/admin/index.mjs +198 -198
- package/package.json +16 -16
|
@@ -9571,196 +9571,6 @@ const ID = () => {
|
|
|
9571
9571
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9572
9572
|
] });
|
|
9573
9573
|
};
|
|
9574
|
-
const BillingAddress = () => {
|
|
9575
|
-
const { id } = reactRouterDom.useParams();
|
|
9576
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9577
|
-
fields: "+billing_address"
|
|
9578
|
-
});
|
|
9579
|
-
if (isError) {
|
|
9580
|
-
throw error;
|
|
9581
|
-
}
|
|
9582
|
-
const isReady = !isPending && !!order;
|
|
9583
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9584
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9585
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9586
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9587
|
-
] }),
|
|
9588
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9589
|
-
] });
|
|
9590
|
-
};
|
|
9591
|
-
const BillingAddressForm = ({ order }) => {
|
|
9592
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9593
|
-
const form = reactHookForm.useForm({
|
|
9594
|
-
defaultValues: {
|
|
9595
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9596
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9597
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9598
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9599
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9600
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9601
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9602
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9603
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9604
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9605
|
-
},
|
|
9606
|
-
resolver: zod.zodResolver(schema$5)
|
|
9607
|
-
});
|
|
9608
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9609
|
-
const { handleSuccess } = useRouteModal();
|
|
9610
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9611
|
-
await mutateAsync(
|
|
9612
|
-
{ billing_address: data },
|
|
9613
|
-
{
|
|
9614
|
-
onSuccess: () => {
|
|
9615
|
-
handleSuccess();
|
|
9616
|
-
},
|
|
9617
|
-
onError: (error) => {
|
|
9618
|
-
ui.toast.error(error.message);
|
|
9619
|
-
}
|
|
9620
|
-
}
|
|
9621
|
-
);
|
|
9622
|
-
});
|
|
9623
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9624
|
-
KeyboundForm,
|
|
9625
|
-
{
|
|
9626
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9627
|
-
onSubmit,
|
|
9628
|
-
children: [
|
|
9629
|
-
/* @__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: [
|
|
9630
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9631
|
-
Form$2.Field,
|
|
9632
|
-
{
|
|
9633
|
-
control: form.control,
|
|
9634
|
-
name: "country_code",
|
|
9635
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9636
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9637
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9639
|
-
] })
|
|
9640
|
-
}
|
|
9641
|
-
),
|
|
9642
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9643
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9644
|
-
Form$2.Field,
|
|
9645
|
-
{
|
|
9646
|
-
control: form.control,
|
|
9647
|
-
name: "first_name",
|
|
9648
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9649
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9650
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9652
|
-
] })
|
|
9653
|
-
}
|
|
9654
|
-
),
|
|
9655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9656
|
-
Form$2.Field,
|
|
9657
|
-
{
|
|
9658
|
-
control: form.control,
|
|
9659
|
-
name: "last_name",
|
|
9660
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9661
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9662
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9664
|
-
] })
|
|
9665
|
-
}
|
|
9666
|
-
)
|
|
9667
|
-
] }),
|
|
9668
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9669
|
-
Form$2.Field,
|
|
9670
|
-
{
|
|
9671
|
-
control: form.control,
|
|
9672
|
-
name: "company",
|
|
9673
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9674
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9675
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9677
|
-
] })
|
|
9678
|
-
}
|
|
9679
|
-
),
|
|
9680
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9681
|
-
Form$2.Field,
|
|
9682
|
-
{
|
|
9683
|
-
control: form.control,
|
|
9684
|
-
name: "address_1",
|
|
9685
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9686
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9687
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9689
|
-
] })
|
|
9690
|
-
}
|
|
9691
|
-
),
|
|
9692
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9693
|
-
Form$2.Field,
|
|
9694
|
-
{
|
|
9695
|
-
control: form.control,
|
|
9696
|
-
name: "address_2",
|
|
9697
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9698
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9699
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9701
|
-
] })
|
|
9702
|
-
}
|
|
9703
|
-
),
|
|
9704
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9705
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9706
|
-
Form$2.Field,
|
|
9707
|
-
{
|
|
9708
|
-
control: form.control,
|
|
9709
|
-
name: "postal_code",
|
|
9710
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9711
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9712
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9714
|
-
] })
|
|
9715
|
-
}
|
|
9716
|
-
),
|
|
9717
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9718
|
-
Form$2.Field,
|
|
9719
|
-
{
|
|
9720
|
-
control: form.control,
|
|
9721
|
-
name: "city",
|
|
9722
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9723
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9724
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9726
|
-
] })
|
|
9727
|
-
}
|
|
9728
|
-
)
|
|
9729
|
-
] }),
|
|
9730
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9731
|
-
Form$2.Field,
|
|
9732
|
-
{
|
|
9733
|
-
control: form.control,
|
|
9734
|
-
name: "province",
|
|
9735
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9736
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9737
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9739
|
-
] })
|
|
9740
|
-
}
|
|
9741
|
-
),
|
|
9742
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9743
|
-
Form$2.Field,
|
|
9744
|
-
{
|
|
9745
|
-
control: form.control,
|
|
9746
|
-
name: "phone",
|
|
9747
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9748
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9749
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9750
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9751
|
-
] })
|
|
9752
|
-
}
|
|
9753
|
-
)
|
|
9754
|
-
] }) }),
|
|
9755
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9756
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9757
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9758
|
-
] }) })
|
|
9759
|
-
]
|
|
9760
|
-
}
|
|
9761
|
-
) });
|
|
9762
|
-
};
|
|
9763
|
-
const schema$5 = addressSchema;
|
|
9764
9574
|
const CustomItems = () => {
|
|
9765
9575
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9766
9576
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9769,7 +9579,7 @@ const CustomItems = () => {
|
|
|
9769
9579
|
};
|
|
9770
9580
|
const CustomItemsForm = () => {
|
|
9771
9581
|
const form = reactHookForm.useForm({
|
|
9772
|
-
resolver: zod.zodResolver(schema$
|
|
9582
|
+
resolver: zod.zodResolver(schema$5)
|
|
9773
9583
|
});
|
|
9774
9584
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9775
9585
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
@@ -9779,7 +9589,7 @@ const CustomItemsForm = () => {
|
|
|
9779
9589
|
] }) })
|
|
9780
9590
|
] }) });
|
|
9781
9591
|
};
|
|
9782
|
-
const schema$
|
|
9592
|
+
const schema$5 = objectType({
|
|
9783
9593
|
email: stringType().email()
|
|
9784
9594
|
});
|
|
9785
9595
|
const Email = () => {
|
|
@@ -9804,7 +9614,7 @@ const EmailForm = ({ order }) => {
|
|
|
9804
9614
|
defaultValues: {
|
|
9805
9615
|
email: order.email ?? ""
|
|
9806
9616
|
},
|
|
9807
|
-
resolver: zod.zodResolver(schema$
|
|
9617
|
+
resolver: zod.zodResolver(schema$4)
|
|
9808
9618
|
});
|
|
9809
9619
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9810
9620
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9847,7 +9657,7 @@ const EmailForm = ({ order }) => {
|
|
|
9847
9657
|
}
|
|
9848
9658
|
) });
|
|
9849
9659
|
};
|
|
9850
|
-
const schema$
|
|
9660
|
+
const schema$4 = objectType({
|
|
9851
9661
|
email: stringType().email()
|
|
9852
9662
|
});
|
|
9853
9663
|
const NumberInput = React.forwardRef(
|
|
@@ -10824,6 +10634,196 @@ const customItemSchema = objectType({
|
|
|
10824
10634
|
quantity: numberType(),
|
|
10825
10635
|
unit_price: unionType([numberType(), stringType()])
|
|
10826
10636
|
});
|
|
10637
|
+
const BillingAddress = () => {
|
|
10638
|
+
const { id } = reactRouterDom.useParams();
|
|
10639
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10640
|
+
fields: "+billing_address"
|
|
10641
|
+
});
|
|
10642
|
+
if (isError) {
|
|
10643
|
+
throw error;
|
|
10644
|
+
}
|
|
10645
|
+
const isReady = !isPending && !!order;
|
|
10646
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10647
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10648
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
10649
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
10650
|
+
] }),
|
|
10651
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
10652
|
+
] });
|
|
10653
|
+
};
|
|
10654
|
+
const BillingAddressForm = ({ order }) => {
|
|
10655
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
10656
|
+
const form = reactHookForm.useForm({
|
|
10657
|
+
defaultValues: {
|
|
10658
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
10659
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
10660
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
10661
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
10662
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
10663
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
10664
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
10665
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
10666
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
10667
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
10668
|
+
},
|
|
10669
|
+
resolver: zod.zodResolver(schema$3)
|
|
10670
|
+
});
|
|
10671
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10672
|
+
const { handleSuccess } = useRouteModal();
|
|
10673
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10674
|
+
await mutateAsync(
|
|
10675
|
+
{ billing_address: data },
|
|
10676
|
+
{
|
|
10677
|
+
onSuccess: () => {
|
|
10678
|
+
handleSuccess();
|
|
10679
|
+
},
|
|
10680
|
+
onError: (error) => {
|
|
10681
|
+
ui.toast.error(error.message);
|
|
10682
|
+
}
|
|
10683
|
+
}
|
|
10684
|
+
);
|
|
10685
|
+
});
|
|
10686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10687
|
+
KeyboundForm,
|
|
10688
|
+
{
|
|
10689
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10690
|
+
onSubmit,
|
|
10691
|
+
children: [
|
|
10692
|
+
/* @__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: [
|
|
10693
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10694
|
+
Form$2.Field,
|
|
10695
|
+
{
|
|
10696
|
+
control: form.control,
|
|
10697
|
+
name: "country_code",
|
|
10698
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10699
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
10700
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
10701
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10702
|
+
] })
|
|
10703
|
+
}
|
|
10704
|
+
),
|
|
10705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10706
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10707
|
+
Form$2.Field,
|
|
10708
|
+
{
|
|
10709
|
+
control: form.control,
|
|
10710
|
+
name: "first_name",
|
|
10711
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10712
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
10713
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10714
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10715
|
+
] })
|
|
10716
|
+
}
|
|
10717
|
+
),
|
|
10718
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10719
|
+
Form$2.Field,
|
|
10720
|
+
{
|
|
10721
|
+
control: form.control,
|
|
10722
|
+
name: "last_name",
|
|
10723
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10724
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
10725
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10726
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10727
|
+
] })
|
|
10728
|
+
}
|
|
10729
|
+
)
|
|
10730
|
+
] }),
|
|
10731
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10732
|
+
Form$2.Field,
|
|
10733
|
+
{
|
|
10734
|
+
control: form.control,
|
|
10735
|
+
name: "company",
|
|
10736
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10737
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10738
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10739
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10740
|
+
] })
|
|
10741
|
+
}
|
|
10742
|
+
),
|
|
10743
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10744
|
+
Form$2.Field,
|
|
10745
|
+
{
|
|
10746
|
+
control: form.control,
|
|
10747
|
+
name: "address_1",
|
|
10748
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10749
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
10750
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10751
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10752
|
+
] })
|
|
10753
|
+
}
|
|
10754
|
+
),
|
|
10755
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10756
|
+
Form$2.Field,
|
|
10757
|
+
{
|
|
10758
|
+
control: form.control,
|
|
10759
|
+
name: "address_2",
|
|
10760
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10761
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10762
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10763
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10764
|
+
] })
|
|
10765
|
+
}
|
|
10766
|
+
),
|
|
10767
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10768
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10769
|
+
Form$2.Field,
|
|
10770
|
+
{
|
|
10771
|
+
control: form.control,
|
|
10772
|
+
name: "postal_code",
|
|
10773
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10774
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
10775
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10776
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10777
|
+
] })
|
|
10778
|
+
}
|
|
10779
|
+
),
|
|
10780
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10781
|
+
Form$2.Field,
|
|
10782
|
+
{
|
|
10783
|
+
control: form.control,
|
|
10784
|
+
name: "city",
|
|
10785
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10786
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
10787
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10788
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10789
|
+
] })
|
|
10790
|
+
}
|
|
10791
|
+
)
|
|
10792
|
+
] }),
|
|
10793
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10794
|
+
Form$2.Field,
|
|
10795
|
+
{
|
|
10796
|
+
control: form.control,
|
|
10797
|
+
name: "province",
|
|
10798
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10799
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10800
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10801
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10802
|
+
] })
|
|
10803
|
+
}
|
|
10804
|
+
),
|
|
10805
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10806
|
+
Form$2.Field,
|
|
10807
|
+
{
|
|
10808
|
+
control: form.control,
|
|
10809
|
+
name: "phone",
|
|
10810
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10811
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
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
|
+
] }) }),
|
|
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 = addressSchema;
|
|
10827
10827
|
const InlineTip = React.forwardRef(
|
|
10828
10828
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10829
10829
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13063,10 +13063,6 @@ const routeModule = {
|
|
|
13063
13063
|
handle,
|
|
13064
13064
|
loader,
|
|
13065
13065
|
children: [
|
|
13066
|
-
{
|
|
13067
|
-
Component: BillingAddress,
|
|
13068
|
-
path: "/draft-orders/:id/billing-address"
|
|
13069
|
-
},
|
|
13070
13066
|
{
|
|
13071
13067
|
Component: CustomItems,
|
|
13072
13068
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13079,6 +13075,10 @@ const routeModule = {
|
|
|
13079
13075
|
Component: Items,
|
|
13080
13076
|
path: "/draft-orders/:id/items"
|
|
13081
13077
|
},
|
|
13078
|
+
{
|
|
13079
|
+
Component: BillingAddress,
|
|
13080
|
+
path: "/draft-orders/:id/billing-address"
|
|
13081
|
+
},
|
|
13082
13082
|
{
|
|
13083
13083
|
Component: Metadata,
|
|
13084
13084
|
path: "/draft-orders/:id/metadata"
|
|
@@ -9565,196 +9565,6 @@ const ID = () => {
|
|
|
9565
9565
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9566
9566
|
] });
|
|
9567
9567
|
};
|
|
9568
|
-
const BillingAddress = () => {
|
|
9569
|
-
const { id } = useParams();
|
|
9570
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9571
|
-
fields: "+billing_address"
|
|
9572
|
-
});
|
|
9573
|
-
if (isError) {
|
|
9574
|
-
throw error;
|
|
9575
|
-
}
|
|
9576
|
-
const isReady = !isPending && !!order;
|
|
9577
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9578
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9579
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9580
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9581
|
-
] }),
|
|
9582
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9583
|
-
] });
|
|
9584
|
-
};
|
|
9585
|
-
const BillingAddressForm = ({ order }) => {
|
|
9586
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9587
|
-
const form = useForm({
|
|
9588
|
-
defaultValues: {
|
|
9589
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9590
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9591
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9592
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9593
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9594
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9595
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9596
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9597
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9598
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9599
|
-
},
|
|
9600
|
-
resolver: zodResolver(schema$5)
|
|
9601
|
-
});
|
|
9602
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9603
|
-
const { handleSuccess } = useRouteModal();
|
|
9604
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9605
|
-
await mutateAsync(
|
|
9606
|
-
{ billing_address: data },
|
|
9607
|
-
{
|
|
9608
|
-
onSuccess: () => {
|
|
9609
|
-
handleSuccess();
|
|
9610
|
-
},
|
|
9611
|
-
onError: (error) => {
|
|
9612
|
-
toast.error(error.message);
|
|
9613
|
-
}
|
|
9614
|
-
}
|
|
9615
|
-
);
|
|
9616
|
-
});
|
|
9617
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9618
|
-
KeyboundForm,
|
|
9619
|
-
{
|
|
9620
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9621
|
-
onSubmit,
|
|
9622
|
-
children: [
|
|
9623
|
-
/* @__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: [
|
|
9624
|
-
/* @__PURE__ */ jsx(
|
|
9625
|
-
Form$2.Field,
|
|
9626
|
-
{
|
|
9627
|
-
control: form.control,
|
|
9628
|
-
name: "country_code",
|
|
9629
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9630
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9631
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9632
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9633
|
-
] })
|
|
9634
|
-
}
|
|
9635
|
-
),
|
|
9636
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9637
|
-
/* @__PURE__ */ jsx(
|
|
9638
|
-
Form$2.Field,
|
|
9639
|
-
{
|
|
9640
|
-
control: form.control,
|
|
9641
|
-
name: "first_name",
|
|
9642
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9643
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9644
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9645
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9646
|
-
] })
|
|
9647
|
-
}
|
|
9648
|
-
),
|
|
9649
|
-
/* @__PURE__ */ jsx(
|
|
9650
|
-
Form$2.Field,
|
|
9651
|
-
{
|
|
9652
|
-
control: form.control,
|
|
9653
|
-
name: "last_name",
|
|
9654
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9655
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9656
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9657
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9658
|
-
] })
|
|
9659
|
-
}
|
|
9660
|
-
)
|
|
9661
|
-
] }),
|
|
9662
|
-
/* @__PURE__ */ jsx(
|
|
9663
|
-
Form$2.Field,
|
|
9664
|
-
{
|
|
9665
|
-
control: form.control,
|
|
9666
|
-
name: "company",
|
|
9667
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9668
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9669
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9670
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9671
|
-
] })
|
|
9672
|
-
}
|
|
9673
|
-
),
|
|
9674
|
-
/* @__PURE__ */ jsx(
|
|
9675
|
-
Form$2.Field,
|
|
9676
|
-
{
|
|
9677
|
-
control: form.control,
|
|
9678
|
-
name: "address_1",
|
|
9679
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9680
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9681
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9682
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9683
|
-
] })
|
|
9684
|
-
}
|
|
9685
|
-
),
|
|
9686
|
-
/* @__PURE__ */ jsx(
|
|
9687
|
-
Form$2.Field,
|
|
9688
|
-
{
|
|
9689
|
-
control: form.control,
|
|
9690
|
-
name: "address_2",
|
|
9691
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9692
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9693
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9694
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9695
|
-
] })
|
|
9696
|
-
}
|
|
9697
|
-
),
|
|
9698
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9699
|
-
/* @__PURE__ */ jsx(
|
|
9700
|
-
Form$2.Field,
|
|
9701
|
-
{
|
|
9702
|
-
control: form.control,
|
|
9703
|
-
name: "postal_code",
|
|
9704
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9705
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9706
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9707
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9708
|
-
] })
|
|
9709
|
-
}
|
|
9710
|
-
),
|
|
9711
|
-
/* @__PURE__ */ jsx(
|
|
9712
|
-
Form$2.Field,
|
|
9713
|
-
{
|
|
9714
|
-
control: form.control,
|
|
9715
|
-
name: "city",
|
|
9716
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9717
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9718
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9719
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9720
|
-
] })
|
|
9721
|
-
}
|
|
9722
|
-
)
|
|
9723
|
-
] }),
|
|
9724
|
-
/* @__PURE__ */ jsx(
|
|
9725
|
-
Form$2.Field,
|
|
9726
|
-
{
|
|
9727
|
-
control: form.control,
|
|
9728
|
-
name: "province",
|
|
9729
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9730
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9731
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9732
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9733
|
-
] })
|
|
9734
|
-
}
|
|
9735
|
-
),
|
|
9736
|
-
/* @__PURE__ */ jsx(
|
|
9737
|
-
Form$2.Field,
|
|
9738
|
-
{
|
|
9739
|
-
control: form.control,
|
|
9740
|
-
name: "phone",
|
|
9741
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9742
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9743
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9744
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9745
|
-
] })
|
|
9746
|
-
}
|
|
9747
|
-
)
|
|
9748
|
-
] }) }),
|
|
9749
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9750
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9751
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9752
|
-
] }) })
|
|
9753
|
-
]
|
|
9754
|
-
}
|
|
9755
|
-
) });
|
|
9756
|
-
};
|
|
9757
|
-
const schema$5 = addressSchema;
|
|
9758
9568
|
const CustomItems = () => {
|
|
9759
9569
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9760
9570
|
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9763,7 +9573,7 @@ const CustomItems = () => {
|
|
|
9763
9573
|
};
|
|
9764
9574
|
const CustomItemsForm = () => {
|
|
9765
9575
|
const form = useForm({
|
|
9766
|
-
resolver: zodResolver(schema$
|
|
9576
|
+
resolver: zodResolver(schema$5)
|
|
9767
9577
|
});
|
|
9768
9578
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9769
9579
|
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
@@ -9773,7 +9583,7 @@ const CustomItemsForm = () => {
|
|
|
9773
9583
|
] }) })
|
|
9774
9584
|
] }) });
|
|
9775
9585
|
};
|
|
9776
|
-
const schema$
|
|
9586
|
+
const schema$5 = objectType({
|
|
9777
9587
|
email: stringType().email()
|
|
9778
9588
|
});
|
|
9779
9589
|
const Email = () => {
|
|
@@ -9798,7 +9608,7 @@ const EmailForm = ({ order }) => {
|
|
|
9798
9608
|
defaultValues: {
|
|
9799
9609
|
email: order.email ?? ""
|
|
9800
9610
|
},
|
|
9801
|
-
resolver: zodResolver(schema$
|
|
9611
|
+
resolver: zodResolver(schema$4)
|
|
9802
9612
|
});
|
|
9803
9613
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9804
9614
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9841,7 +9651,7 @@ const EmailForm = ({ order }) => {
|
|
|
9841
9651
|
}
|
|
9842
9652
|
) });
|
|
9843
9653
|
};
|
|
9844
|
-
const schema$
|
|
9654
|
+
const schema$4 = objectType({
|
|
9845
9655
|
email: stringType().email()
|
|
9846
9656
|
});
|
|
9847
9657
|
const NumberInput = forwardRef(
|
|
@@ -10818,6 +10628,196 @@ const customItemSchema = objectType({
|
|
|
10818
10628
|
quantity: numberType(),
|
|
10819
10629
|
unit_price: unionType([numberType(), stringType()])
|
|
10820
10630
|
});
|
|
10631
|
+
const BillingAddress = () => {
|
|
10632
|
+
const { id } = useParams();
|
|
10633
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10634
|
+
fields: "+billing_address"
|
|
10635
|
+
});
|
|
10636
|
+
if (isError) {
|
|
10637
|
+
throw error;
|
|
10638
|
+
}
|
|
10639
|
+
const isReady = !isPending && !!order;
|
|
10640
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10641
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10642
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
10643
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
10644
|
+
] }),
|
|
10645
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
10646
|
+
] });
|
|
10647
|
+
};
|
|
10648
|
+
const BillingAddressForm = ({ order }) => {
|
|
10649
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
10650
|
+
const form = useForm({
|
|
10651
|
+
defaultValues: {
|
|
10652
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
10653
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
10654
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
10655
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
10656
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
10657
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
10658
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
10659
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
10660
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
10661
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
10662
|
+
},
|
|
10663
|
+
resolver: zodResolver(schema$3)
|
|
10664
|
+
});
|
|
10665
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10666
|
+
const { handleSuccess } = useRouteModal();
|
|
10667
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
10668
|
+
await mutateAsync(
|
|
10669
|
+
{ billing_address: data },
|
|
10670
|
+
{
|
|
10671
|
+
onSuccess: () => {
|
|
10672
|
+
handleSuccess();
|
|
10673
|
+
},
|
|
10674
|
+
onError: (error) => {
|
|
10675
|
+
toast.error(error.message);
|
|
10676
|
+
}
|
|
10677
|
+
}
|
|
10678
|
+
);
|
|
10679
|
+
});
|
|
10680
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
10681
|
+
KeyboundForm,
|
|
10682
|
+
{
|
|
10683
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
10684
|
+
onSubmit,
|
|
10685
|
+
children: [
|
|
10686
|
+
/* @__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: [
|
|
10687
|
+
/* @__PURE__ */ jsx(
|
|
10688
|
+
Form$2.Field,
|
|
10689
|
+
{
|
|
10690
|
+
control: form.control,
|
|
10691
|
+
name: "country_code",
|
|
10692
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10693
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
10694
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
10695
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10696
|
+
] })
|
|
10697
|
+
}
|
|
10698
|
+
),
|
|
10699
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10700
|
+
/* @__PURE__ */ jsx(
|
|
10701
|
+
Form$2.Field,
|
|
10702
|
+
{
|
|
10703
|
+
control: form.control,
|
|
10704
|
+
name: "first_name",
|
|
10705
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10706
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
10707
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10708
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10709
|
+
] })
|
|
10710
|
+
}
|
|
10711
|
+
),
|
|
10712
|
+
/* @__PURE__ */ jsx(
|
|
10713
|
+
Form$2.Field,
|
|
10714
|
+
{
|
|
10715
|
+
control: form.control,
|
|
10716
|
+
name: "last_name",
|
|
10717
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10718
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
10719
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10720
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10721
|
+
] })
|
|
10722
|
+
}
|
|
10723
|
+
)
|
|
10724
|
+
] }),
|
|
10725
|
+
/* @__PURE__ */ jsx(
|
|
10726
|
+
Form$2.Field,
|
|
10727
|
+
{
|
|
10728
|
+
control: form.control,
|
|
10729
|
+
name: "company",
|
|
10730
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10731
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10732
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10733
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10734
|
+
] })
|
|
10735
|
+
}
|
|
10736
|
+
),
|
|
10737
|
+
/* @__PURE__ */ jsx(
|
|
10738
|
+
Form$2.Field,
|
|
10739
|
+
{
|
|
10740
|
+
control: form.control,
|
|
10741
|
+
name: "address_1",
|
|
10742
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10743
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
10744
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10745
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10746
|
+
] })
|
|
10747
|
+
}
|
|
10748
|
+
),
|
|
10749
|
+
/* @__PURE__ */ jsx(
|
|
10750
|
+
Form$2.Field,
|
|
10751
|
+
{
|
|
10752
|
+
control: form.control,
|
|
10753
|
+
name: "address_2",
|
|
10754
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10755
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10756
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10757
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10758
|
+
] })
|
|
10759
|
+
}
|
|
10760
|
+
),
|
|
10761
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10762
|
+
/* @__PURE__ */ jsx(
|
|
10763
|
+
Form$2.Field,
|
|
10764
|
+
{
|
|
10765
|
+
control: form.control,
|
|
10766
|
+
name: "postal_code",
|
|
10767
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10768
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
10769
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10770
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10771
|
+
] })
|
|
10772
|
+
}
|
|
10773
|
+
),
|
|
10774
|
+
/* @__PURE__ */ jsx(
|
|
10775
|
+
Form$2.Field,
|
|
10776
|
+
{
|
|
10777
|
+
control: form.control,
|
|
10778
|
+
name: "city",
|
|
10779
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10780
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
10781
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10782
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10783
|
+
] })
|
|
10784
|
+
}
|
|
10785
|
+
)
|
|
10786
|
+
] }),
|
|
10787
|
+
/* @__PURE__ */ jsx(
|
|
10788
|
+
Form$2.Field,
|
|
10789
|
+
{
|
|
10790
|
+
control: form.control,
|
|
10791
|
+
name: "province",
|
|
10792
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10793
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10794
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10795
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10796
|
+
] })
|
|
10797
|
+
}
|
|
10798
|
+
),
|
|
10799
|
+
/* @__PURE__ */ jsx(
|
|
10800
|
+
Form$2.Field,
|
|
10801
|
+
{
|
|
10802
|
+
control: form.control,
|
|
10803
|
+
name: "phone",
|
|
10804
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10805
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10806
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10807
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10808
|
+
] })
|
|
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 = addressSchema;
|
|
10821
10821
|
const InlineTip = forwardRef(
|
|
10822
10822
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10823
10823
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -13057,10 +13057,6 @@ const routeModule = {
|
|
|
13057
13057
|
handle,
|
|
13058
13058
|
loader,
|
|
13059
13059
|
children: [
|
|
13060
|
-
{
|
|
13061
|
-
Component: BillingAddress,
|
|
13062
|
-
path: "/draft-orders/:id/billing-address"
|
|
13063
|
-
},
|
|
13064
13060
|
{
|
|
13065
13061
|
Component: CustomItems,
|
|
13066
13062
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13073,6 +13069,10 @@ const routeModule = {
|
|
|
13073
13069
|
Component: Items,
|
|
13074
13070
|
path: "/draft-orders/:id/items"
|
|
13075
13071
|
},
|
|
13072
|
+
{
|
|
13073
|
+
Component: BillingAddress,
|
|
13074
|
+
path: "/draft-orders/:id/billing-address"
|
|
13075
|
+
},
|
|
13076
13076
|
{
|
|
13077
13077
|
Component: Metadata,
|
|
13078
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.2-preview-
|
|
3
|
+
"version": "2.11.2-preview-20251028100508",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.11.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.2-preview-20251028100508",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.11.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.2-preview-
|
|
53
|
-
"@medusajs/types": "2.11.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.26-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.2-preview-20251028100508",
|
|
49
|
+
"@medusajs/cli": "2.11.2-preview-20251028100508",
|
|
50
|
+
"@medusajs/framework": "2.11.2-preview-20251028100508",
|
|
51
|
+
"@medusajs/icons": "2.11.2-preview-20251028100508",
|
|
52
|
+
"@medusajs/test-utils": "2.11.2-preview-20251028100508",
|
|
53
|
+
"@medusajs/types": "2.11.2-preview-20251028100508",
|
|
54
|
+
"@medusajs/ui": "4.0.26-preview-20251028100508",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.2-preview-20251028100508",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.11.2-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.2-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.2-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.2-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.2-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.26-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.2-preview-20251028100508",
|
|
73
|
+
"@medusajs/cli": "2.11.2-preview-20251028100508",
|
|
74
|
+
"@medusajs/framework": "2.11.2-preview-20251028100508",
|
|
75
|
+
"@medusajs/icons": "2.11.2-preview-20251028100508",
|
|
76
|
+
"@medusajs/test-utils": "2.11.2-preview-20251028100508",
|
|
77
|
+
"@medusajs/ui": "4.0.26-preview-20251028100508",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|