@medusajs/draft-order 2.10.4-snapshot-20251013091555 → 2.10.4-snapshot-20251013095945
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 +194 -194
- package/.medusa/server/src/admin/index.mjs +194 -194
- package/package.json +16 -16
|
@@ -9662,6 +9662,196 @@ const EmailForm = ({ order }) => {
|
|
|
9662
9662
|
const schema$4 = objectType({
|
|
9663
9663
|
email: stringType().email()
|
|
9664
9664
|
});
|
|
9665
|
+
const BillingAddress = () => {
|
|
9666
|
+
const { id } = reactRouterDom.useParams();
|
|
9667
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9668
|
+
fields: "+billing_address"
|
|
9669
|
+
});
|
|
9670
|
+
if (isError) {
|
|
9671
|
+
throw error;
|
|
9672
|
+
}
|
|
9673
|
+
const isReady = !isPending && !!order;
|
|
9674
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9675
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9676
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9677
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9678
|
+
] }),
|
|
9679
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9680
|
+
] });
|
|
9681
|
+
};
|
|
9682
|
+
const BillingAddressForm = ({ order }) => {
|
|
9683
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9684
|
+
const form = reactHookForm.useForm({
|
|
9685
|
+
defaultValues: {
|
|
9686
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9687
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9688
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9689
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9690
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9691
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9692
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9693
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9694
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9695
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9696
|
+
},
|
|
9697
|
+
resolver: zod.zodResolver(schema$3)
|
|
9698
|
+
});
|
|
9699
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9700
|
+
const { handleSuccess } = useRouteModal();
|
|
9701
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9702
|
+
await mutateAsync(
|
|
9703
|
+
{ billing_address: data },
|
|
9704
|
+
{
|
|
9705
|
+
onSuccess: () => {
|
|
9706
|
+
handleSuccess();
|
|
9707
|
+
},
|
|
9708
|
+
onError: (error) => {
|
|
9709
|
+
ui.toast.error(error.message);
|
|
9710
|
+
}
|
|
9711
|
+
}
|
|
9712
|
+
);
|
|
9713
|
+
});
|
|
9714
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9715
|
+
KeyboundForm,
|
|
9716
|
+
{
|
|
9717
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9718
|
+
onSubmit,
|
|
9719
|
+
children: [
|
|
9720
|
+
/* @__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: [
|
|
9721
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9722
|
+
Form$2.Field,
|
|
9723
|
+
{
|
|
9724
|
+
control: form.control,
|
|
9725
|
+
name: "country_code",
|
|
9726
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9727
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9728
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9729
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9730
|
+
] })
|
|
9731
|
+
}
|
|
9732
|
+
),
|
|
9733
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9734
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9735
|
+
Form$2.Field,
|
|
9736
|
+
{
|
|
9737
|
+
control: form.control,
|
|
9738
|
+
name: "first_name",
|
|
9739
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9740
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9741
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9742
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9743
|
+
] })
|
|
9744
|
+
}
|
|
9745
|
+
),
|
|
9746
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9747
|
+
Form$2.Field,
|
|
9748
|
+
{
|
|
9749
|
+
control: form.control,
|
|
9750
|
+
name: "last_name",
|
|
9751
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9752
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9753
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9754
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9755
|
+
] })
|
|
9756
|
+
}
|
|
9757
|
+
)
|
|
9758
|
+
] }),
|
|
9759
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9760
|
+
Form$2.Field,
|
|
9761
|
+
{
|
|
9762
|
+
control: form.control,
|
|
9763
|
+
name: "company",
|
|
9764
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9765
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9766
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9767
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9768
|
+
] })
|
|
9769
|
+
}
|
|
9770
|
+
),
|
|
9771
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9772
|
+
Form$2.Field,
|
|
9773
|
+
{
|
|
9774
|
+
control: form.control,
|
|
9775
|
+
name: "address_1",
|
|
9776
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9777
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9778
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9779
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9780
|
+
] })
|
|
9781
|
+
}
|
|
9782
|
+
),
|
|
9783
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9784
|
+
Form$2.Field,
|
|
9785
|
+
{
|
|
9786
|
+
control: form.control,
|
|
9787
|
+
name: "address_2",
|
|
9788
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9789
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9790
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9791
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9792
|
+
] })
|
|
9793
|
+
}
|
|
9794
|
+
),
|
|
9795
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9796
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9797
|
+
Form$2.Field,
|
|
9798
|
+
{
|
|
9799
|
+
control: form.control,
|
|
9800
|
+
name: "postal_code",
|
|
9801
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9802
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9803
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9804
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9805
|
+
] })
|
|
9806
|
+
}
|
|
9807
|
+
),
|
|
9808
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9809
|
+
Form$2.Field,
|
|
9810
|
+
{
|
|
9811
|
+
control: form.control,
|
|
9812
|
+
name: "city",
|
|
9813
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9814
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9815
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9816
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9817
|
+
] })
|
|
9818
|
+
}
|
|
9819
|
+
)
|
|
9820
|
+
] }),
|
|
9821
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9822
|
+
Form$2.Field,
|
|
9823
|
+
{
|
|
9824
|
+
control: form.control,
|
|
9825
|
+
name: "province",
|
|
9826
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9827
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9828
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9829
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9830
|
+
] })
|
|
9831
|
+
}
|
|
9832
|
+
),
|
|
9833
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9834
|
+
Form$2.Field,
|
|
9835
|
+
{
|
|
9836
|
+
control: form.control,
|
|
9837
|
+
name: "phone",
|
|
9838
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9840
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9841
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9842
|
+
] })
|
|
9843
|
+
}
|
|
9844
|
+
)
|
|
9845
|
+
] }) }),
|
|
9846
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9847
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9848
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9849
|
+
] }) })
|
|
9850
|
+
]
|
|
9851
|
+
}
|
|
9852
|
+
) });
|
|
9853
|
+
};
|
|
9854
|
+
const schema$3 = addressSchema;
|
|
9665
9855
|
const NumberInput = React.forwardRef(
|
|
9666
9856
|
({
|
|
9667
9857
|
value,
|
|
@@ -10986,196 +11176,6 @@ function getHasUneditableRows(metadata) {
|
|
|
10986
11176
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10987
11177
|
);
|
|
10988
11178
|
}
|
|
10989
|
-
const BillingAddress = () => {
|
|
10990
|
-
const { id } = reactRouterDom.useParams();
|
|
10991
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10992
|
-
fields: "+billing_address"
|
|
10993
|
-
});
|
|
10994
|
-
if (isError) {
|
|
10995
|
-
throw error;
|
|
10996
|
-
}
|
|
10997
|
-
const isReady = !isPending && !!order;
|
|
10998
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10999
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11000
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
11001
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11002
|
-
] }),
|
|
11003
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
11004
|
-
] });
|
|
11005
|
-
};
|
|
11006
|
-
const BillingAddressForm = ({ order }) => {
|
|
11007
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11008
|
-
const form = reactHookForm.useForm({
|
|
11009
|
-
defaultValues: {
|
|
11010
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11011
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11012
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11013
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11014
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11015
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11016
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11017
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11018
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11019
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11020
|
-
},
|
|
11021
|
-
resolver: zod.zodResolver(schema$3)
|
|
11022
|
-
});
|
|
11023
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11024
|
-
const { handleSuccess } = useRouteModal();
|
|
11025
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11026
|
-
await mutateAsync(
|
|
11027
|
-
{ billing_address: data },
|
|
11028
|
-
{
|
|
11029
|
-
onSuccess: () => {
|
|
11030
|
-
handleSuccess();
|
|
11031
|
-
},
|
|
11032
|
-
onError: (error) => {
|
|
11033
|
-
ui.toast.error(error.message);
|
|
11034
|
-
}
|
|
11035
|
-
}
|
|
11036
|
-
);
|
|
11037
|
-
});
|
|
11038
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11039
|
-
KeyboundForm,
|
|
11040
|
-
{
|
|
11041
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11042
|
-
onSubmit,
|
|
11043
|
-
children: [
|
|
11044
|
-
/* @__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: [
|
|
11045
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11046
|
-
Form$2.Field,
|
|
11047
|
-
{
|
|
11048
|
-
control: form.control,
|
|
11049
|
-
name: "country_code",
|
|
11050
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11051
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11052
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11053
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11054
|
-
] })
|
|
11055
|
-
}
|
|
11056
|
-
),
|
|
11057
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11058
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11059
|
-
Form$2.Field,
|
|
11060
|
-
{
|
|
11061
|
-
control: form.control,
|
|
11062
|
-
name: "first_name",
|
|
11063
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11064
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11065
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11066
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11067
|
-
] })
|
|
11068
|
-
}
|
|
11069
|
-
),
|
|
11070
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11071
|
-
Form$2.Field,
|
|
11072
|
-
{
|
|
11073
|
-
control: form.control,
|
|
11074
|
-
name: "last_name",
|
|
11075
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11076
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11077
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11078
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11079
|
-
] })
|
|
11080
|
-
}
|
|
11081
|
-
)
|
|
11082
|
-
] }),
|
|
11083
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11084
|
-
Form$2.Field,
|
|
11085
|
-
{
|
|
11086
|
-
control: form.control,
|
|
11087
|
-
name: "company",
|
|
11088
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11089
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11090
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11091
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11092
|
-
] })
|
|
11093
|
-
}
|
|
11094
|
-
),
|
|
11095
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11096
|
-
Form$2.Field,
|
|
11097
|
-
{
|
|
11098
|
-
control: form.control,
|
|
11099
|
-
name: "address_1",
|
|
11100
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11101
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11102
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11103
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11104
|
-
] })
|
|
11105
|
-
}
|
|
11106
|
-
),
|
|
11107
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11108
|
-
Form$2.Field,
|
|
11109
|
-
{
|
|
11110
|
-
control: form.control,
|
|
11111
|
-
name: "address_2",
|
|
11112
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11113
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11114
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11115
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11116
|
-
] })
|
|
11117
|
-
}
|
|
11118
|
-
),
|
|
11119
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11121
|
-
Form$2.Field,
|
|
11122
|
-
{
|
|
11123
|
-
control: form.control,
|
|
11124
|
-
name: "postal_code",
|
|
11125
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11126
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11127
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11128
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11129
|
-
] })
|
|
11130
|
-
}
|
|
11131
|
-
),
|
|
11132
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11133
|
-
Form$2.Field,
|
|
11134
|
-
{
|
|
11135
|
-
control: form.control,
|
|
11136
|
-
name: "city",
|
|
11137
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11138
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11139
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11140
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11141
|
-
] })
|
|
11142
|
-
}
|
|
11143
|
-
)
|
|
11144
|
-
] }),
|
|
11145
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11146
|
-
Form$2.Field,
|
|
11147
|
-
{
|
|
11148
|
-
control: form.control,
|
|
11149
|
-
name: "province",
|
|
11150
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11151
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11152
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11153
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11154
|
-
] })
|
|
11155
|
-
}
|
|
11156
|
-
),
|
|
11157
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11158
|
-
Form$2.Field,
|
|
11159
|
-
{
|
|
11160
|
-
control: form.control,
|
|
11161
|
-
name: "phone",
|
|
11162
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11163
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11164
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11165
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11166
|
-
] })
|
|
11167
|
-
}
|
|
11168
|
-
)
|
|
11169
|
-
] }) }),
|
|
11170
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11171
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11172
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11173
|
-
] }) })
|
|
11174
|
-
]
|
|
11175
|
-
}
|
|
11176
|
-
) });
|
|
11177
|
-
};
|
|
11178
|
-
const schema$3 = addressSchema;
|
|
11179
11179
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11180
11180
|
const promotionsQueryKeys = {
|
|
11181
11181
|
list: (query2) => [
|
|
@@ -13073,6 +13073,10 @@ const routeModule = {
|
|
|
13073
13073
|
Component: Email,
|
|
13074
13074
|
path: "/draft-orders/:id/email"
|
|
13075
13075
|
},
|
|
13076
|
+
{
|
|
13077
|
+
Component: BillingAddress,
|
|
13078
|
+
path: "/draft-orders/:id/billing-address"
|
|
13079
|
+
},
|
|
13076
13080
|
{
|
|
13077
13081
|
Component: Items,
|
|
13078
13082
|
path: "/draft-orders/:id/items"
|
|
@@ -13081,10 +13085,6 @@ const routeModule = {
|
|
|
13081
13085
|
Component: Metadata,
|
|
13082
13086
|
path: "/draft-orders/:id/metadata"
|
|
13083
13087
|
},
|
|
13084
|
-
{
|
|
13085
|
-
Component: BillingAddress,
|
|
13086
|
-
path: "/draft-orders/:id/billing-address"
|
|
13087
|
-
},
|
|
13088
13088
|
{
|
|
13089
13089
|
Component: Promotions,
|
|
13090
13090
|
path: "/draft-orders/:id/promotions"
|
|
@@ -9656,6 +9656,196 @@ const EmailForm = ({ order }) => {
|
|
|
9656
9656
|
const schema$4 = objectType({
|
|
9657
9657
|
email: stringType().email()
|
|
9658
9658
|
});
|
|
9659
|
+
const BillingAddress = () => {
|
|
9660
|
+
const { id } = useParams();
|
|
9661
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9662
|
+
fields: "+billing_address"
|
|
9663
|
+
});
|
|
9664
|
+
if (isError) {
|
|
9665
|
+
throw error;
|
|
9666
|
+
}
|
|
9667
|
+
const isReady = !isPending && !!order;
|
|
9668
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9669
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9670
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9671
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9672
|
+
] }),
|
|
9673
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9674
|
+
] });
|
|
9675
|
+
};
|
|
9676
|
+
const BillingAddressForm = ({ order }) => {
|
|
9677
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9678
|
+
const form = useForm({
|
|
9679
|
+
defaultValues: {
|
|
9680
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9681
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9682
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9683
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9684
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9685
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9686
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9687
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9688
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9689
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9690
|
+
},
|
|
9691
|
+
resolver: zodResolver(schema$3)
|
|
9692
|
+
});
|
|
9693
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9694
|
+
const { handleSuccess } = useRouteModal();
|
|
9695
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9696
|
+
await mutateAsync(
|
|
9697
|
+
{ billing_address: data },
|
|
9698
|
+
{
|
|
9699
|
+
onSuccess: () => {
|
|
9700
|
+
handleSuccess();
|
|
9701
|
+
},
|
|
9702
|
+
onError: (error) => {
|
|
9703
|
+
toast.error(error.message);
|
|
9704
|
+
}
|
|
9705
|
+
}
|
|
9706
|
+
);
|
|
9707
|
+
});
|
|
9708
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9709
|
+
KeyboundForm,
|
|
9710
|
+
{
|
|
9711
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9712
|
+
onSubmit,
|
|
9713
|
+
children: [
|
|
9714
|
+
/* @__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: [
|
|
9715
|
+
/* @__PURE__ */ jsx(
|
|
9716
|
+
Form$2.Field,
|
|
9717
|
+
{
|
|
9718
|
+
control: form.control,
|
|
9719
|
+
name: "country_code",
|
|
9720
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9721
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9722
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9723
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9724
|
+
] })
|
|
9725
|
+
}
|
|
9726
|
+
),
|
|
9727
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9728
|
+
/* @__PURE__ */ jsx(
|
|
9729
|
+
Form$2.Field,
|
|
9730
|
+
{
|
|
9731
|
+
control: form.control,
|
|
9732
|
+
name: "first_name",
|
|
9733
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9734
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9735
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9736
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9737
|
+
] })
|
|
9738
|
+
}
|
|
9739
|
+
),
|
|
9740
|
+
/* @__PURE__ */ jsx(
|
|
9741
|
+
Form$2.Field,
|
|
9742
|
+
{
|
|
9743
|
+
control: form.control,
|
|
9744
|
+
name: "last_name",
|
|
9745
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9746
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9747
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9748
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9749
|
+
] })
|
|
9750
|
+
}
|
|
9751
|
+
)
|
|
9752
|
+
] }),
|
|
9753
|
+
/* @__PURE__ */ jsx(
|
|
9754
|
+
Form$2.Field,
|
|
9755
|
+
{
|
|
9756
|
+
control: form.control,
|
|
9757
|
+
name: "company",
|
|
9758
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9759
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9760
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9761
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9762
|
+
] })
|
|
9763
|
+
}
|
|
9764
|
+
),
|
|
9765
|
+
/* @__PURE__ */ jsx(
|
|
9766
|
+
Form$2.Field,
|
|
9767
|
+
{
|
|
9768
|
+
control: form.control,
|
|
9769
|
+
name: "address_1",
|
|
9770
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9771
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
9772
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9773
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9774
|
+
] })
|
|
9775
|
+
}
|
|
9776
|
+
),
|
|
9777
|
+
/* @__PURE__ */ jsx(
|
|
9778
|
+
Form$2.Field,
|
|
9779
|
+
{
|
|
9780
|
+
control: form.control,
|
|
9781
|
+
name: "address_2",
|
|
9782
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9783
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9784
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9785
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9786
|
+
] })
|
|
9787
|
+
}
|
|
9788
|
+
),
|
|
9789
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9790
|
+
/* @__PURE__ */ jsx(
|
|
9791
|
+
Form$2.Field,
|
|
9792
|
+
{
|
|
9793
|
+
control: form.control,
|
|
9794
|
+
name: "postal_code",
|
|
9795
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9796
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
9797
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9798
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9799
|
+
] })
|
|
9800
|
+
}
|
|
9801
|
+
),
|
|
9802
|
+
/* @__PURE__ */ jsx(
|
|
9803
|
+
Form$2.Field,
|
|
9804
|
+
{
|
|
9805
|
+
control: form.control,
|
|
9806
|
+
name: "city",
|
|
9807
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9808
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
9809
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9810
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9811
|
+
] })
|
|
9812
|
+
}
|
|
9813
|
+
)
|
|
9814
|
+
] }),
|
|
9815
|
+
/* @__PURE__ */ jsx(
|
|
9816
|
+
Form$2.Field,
|
|
9817
|
+
{
|
|
9818
|
+
control: form.control,
|
|
9819
|
+
name: "province",
|
|
9820
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9821
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9822
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9823
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9824
|
+
] })
|
|
9825
|
+
}
|
|
9826
|
+
),
|
|
9827
|
+
/* @__PURE__ */ jsx(
|
|
9828
|
+
Form$2.Field,
|
|
9829
|
+
{
|
|
9830
|
+
control: form.control,
|
|
9831
|
+
name: "phone",
|
|
9832
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9833
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9834
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9835
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9836
|
+
] })
|
|
9837
|
+
}
|
|
9838
|
+
)
|
|
9839
|
+
] }) }),
|
|
9840
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9841
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9842
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9843
|
+
] }) })
|
|
9844
|
+
]
|
|
9845
|
+
}
|
|
9846
|
+
) });
|
|
9847
|
+
};
|
|
9848
|
+
const schema$3 = addressSchema;
|
|
9659
9849
|
const NumberInput = forwardRef(
|
|
9660
9850
|
({
|
|
9661
9851
|
value,
|
|
@@ -10980,196 +11170,6 @@ function getHasUneditableRows(metadata) {
|
|
|
10980
11170
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10981
11171
|
);
|
|
10982
11172
|
}
|
|
10983
|
-
const BillingAddress = () => {
|
|
10984
|
-
const { id } = useParams();
|
|
10985
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10986
|
-
fields: "+billing_address"
|
|
10987
|
-
});
|
|
10988
|
-
if (isError) {
|
|
10989
|
-
throw error;
|
|
10990
|
-
}
|
|
10991
|
-
const isReady = !isPending && !!order;
|
|
10992
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10993
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10994
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
10995
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
10996
|
-
] }),
|
|
10997
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
10998
|
-
] });
|
|
10999
|
-
};
|
|
11000
|
-
const BillingAddressForm = ({ order }) => {
|
|
11001
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11002
|
-
const form = useForm({
|
|
11003
|
-
defaultValues: {
|
|
11004
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11005
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11006
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11007
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11008
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11009
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11010
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11011
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11012
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11013
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11014
|
-
},
|
|
11015
|
-
resolver: zodResolver(schema$3)
|
|
11016
|
-
});
|
|
11017
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11018
|
-
const { handleSuccess } = useRouteModal();
|
|
11019
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11020
|
-
await mutateAsync(
|
|
11021
|
-
{ billing_address: data },
|
|
11022
|
-
{
|
|
11023
|
-
onSuccess: () => {
|
|
11024
|
-
handleSuccess();
|
|
11025
|
-
},
|
|
11026
|
-
onError: (error) => {
|
|
11027
|
-
toast.error(error.message);
|
|
11028
|
-
}
|
|
11029
|
-
}
|
|
11030
|
-
);
|
|
11031
|
-
});
|
|
11032
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11033
|
-
KeyboundForm,
|
|
11034
|
-
{
|
|
11035
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11036
|
-
onSubmit,
|
|
11037
|
-
children: [
|
|
11038
|
-
/* @__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: [
|
|
11039
|
-
/* @__PURE__ */ jsx(
|
|
11040
|
-
Form$2.Field,
|
|
11041
|
-
{
|
|
11042
|
-
control: form.control,
|
|
11043
|
-
name: "country_code",
|
|
11044
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11045
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11046
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11047
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11048
|
-
] })
|
|
11049
|
-
}
|
|
11050
|
-
),
|
|
11051
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11052
|
-
/* @__PURE__ */ jsx(
|
|
11053
|
-
Form$2.Field,
|
|
11054
|
-
{
|
|
11055
|
-
control: form.control,
|
|
11056
|
-
name: "first_name",
|
|
11057
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11058
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11059
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11060
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11061
|
-
] })
|
|
11062
|
-
}
|
|
11063
|
-
),
|
|
11064
|
-
/* @__PURE__ */ jsx(
|
|
11065
|
-
Form$2.Field,
|
|
11066
|
-
{
|
|
11067
|
-
control: form.control,
|
|
11068
|
-
name: "last_name",
|
|
11069
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11070
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11071
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11072
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11073
|
-
] })
|
|
11074
|
-
}
|
|
11075
|
-
)
|
|
11076
|
-
] }),
|
|
11077
|
-
/* @__PURE__ */ jsx(
|
|
11078
|
-
Form$2.Field,
|
|
11079
|
-
{
|
|
11080
|
-
control: form.control,
|
|
11081
|
-
name: "company",
|
|
11082
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11083
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11084
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11085
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11086
|
-
] })
|
|
11087
|
-
}
|
|
11088
|
-
),
|
|
11089
|
-
/* @__PURE__ */ jsx(
|
|
11090
|
-
Form$2.Field,
|
|
11091
|
-
{
|
|
11092
|
-
control: form.control,
|
|
11093
|
-
name: "address_1",
|
|
11094
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11095
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11096
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11097
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11098
|
-
] })
|
|
11099
|
-
}
|
|
11100
|
-
),
|
|
11101
|
-
/* @__PURE__ */ jsx(
|
|
11102
|
-
Form$2.Field,
|
|
11103
|
-
{
|
|
11104
|
-
control: form.control,
|
|
11105
|
-
name: "address_2",
|
|
11106
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11107
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11108
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11109
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11110
|
-
] })
|
|
11111
|
-
}
|
|
11112
|
-
),
|
|
11113
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11114
|
-
/* @__PURE__ */ jsx(
|
|
11115
|
-
Form$2.Field,
|
|
11116
|
-
{
|
|
11117
|
-
control: form.control,
|
|
11118
|
-
name: "postal_code",
|
|
11119
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11120
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11121
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11122
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11123
|
-
] })
|
|
11124
|
-
}
|
|
11125
|
-
),
|
|
11126
|
-
/* @__PURE__ */ jsx(
|
|
11127
|
-
Form$2.Field,
|
|
11128
|
-
{
|
|
11129
|
-
control: form.control,
|
|
11130
|
-
name: "city",
|
|
11131
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11132
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11133
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11134
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11135
|
-
] })
|
|
11136
|
-
}
|
|
11137
|
-
)
|
|
11138
|
-
] }),
|
|
11139
|
-
/* @__PURE__ */ jsx(
|
|
11140
|
-
Form$2.Field,
|
|
11141
|
-
{
|
|
11142
|
-
control: form.control,
|
|
11143
|
-
name: "province",
|
|
11144
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11145
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11146
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11147
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11148
|
-
] })
|
|
11149
|
-
}
|
|
11150
|
-
),
|
|
11151
|
-
/* @__PURE__ */ jsx(
|
|
11152
|
-
Form$2.Field,
|
|
11153
|
-
{
|
|
11154
|
-
control: form.control,
|
|
11155
|
-
name: "phone",
|
|
11156
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11157
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11158
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11159
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11160
|
-
] })
|
|
11161
|
-
}
|
|
11162
|
-
)
|
|
11163
|
-
] }) }),
|
|
11164
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11165
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11166
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11167
|
-
] }) })
|
|
11168
|
-
]
|
|
11169
|
-
}
|
|
11170
|
-
) });
|
|
11171
|
-
};
|
|
11172
|
-
const schema$3 = addressSchema;
|
|
11173
11173
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11174
11174
|
const promotionsQueryKeys = {
|
|
11175
11175
|
list: (query2) => [
|
|
@@ -13067,6 +13067,10 @@ const routeModule = {
|
|
|
13067
13067
|
Component: Email,
|
|
13068
13068
|
path: "/draft-orders/:id/email"
|
|
13069
13069
|
},
|
|
13070
|
+
{
|
|
13071
|
+
Component: BillingAddress,
|
|
13072
|
+
path: "/draft-orders/:id/billing-address"
|
|
13073
|
+
},
|
|
13070
13074
|
{
|
|
13071
13075
|
Component: Items,
|
|
13072
13076
|
path: "/draft-orders/:id/items"
|
|
@@ -13075,10 +13079,6 @@ const routeModule = {
|
|
|
13075
13079
|
Component: Metadata,
|
|
13076
13080
|
path: "/draft-orders/:id/metadata"
|
|
13077
13081
|
},
|
|
13078
|
-
{
|
|
13079
|
-
Component: BillingAddress,
|
|
13080
|
-
path: "/draft-orders/:id/billing-address"
|
|
13081
|
-
},
|
|
13082
13082
|
{
|
|
13083
13083
|
Component: Promotions,
|
|
13084
13084
|
path: "/draft-orders/:id/promotions"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.4-snapshot-
|
|
3
|
+
"version": "2.10.4-snapshot-20251013095945",
|
|
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-snapshot-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.4-snapshot-20251013095945",
|
|
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-snapshot-
|
|
49
|
-
"@medusajs/cli": "2.10.4-snapshot-
|
|
50
|
-
"@medusajs/framework": "2.10.4-snapshot-
|
|
51
|
-
"@medusajs/icons": "2.10.4-snapshot-
|
|
52
|
-
"@medusajs/test-utils": "2.10.4-snapshot-
|
|
53
|
-
"@medusajs/types": "2.10.4-snapshot-
|
|
54
|
-
"@medusajs/ui": "4.0.24-snapshot-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.4-snapshot-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.4-snapshot-20251013095945",
|
|
49
|
+
"@medusajs/cli": "2.10.4-snapshot-20251013095945",
|
|
50
|
+
"@medusajs/framework": "2.10.4-snapshot-20251013095945",
|
|
51
|
+
"@medusajs/icons": "2.10.4-snapshot-20251013095945",
|
|
52
|
+
"@medusajs/test-utils": "2.10.4-snapshot-20251013095945",
|
|
53
|
+
"@medusajs/types": "2.10.4-snapshot-20251013095945",
|
|
54
|
+
"@medusajs/ui": "4.0.24-snapshot-20251013095945",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.4-snapshot-20251013095945",
|
|
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-snapshot-
|
|
73
|
-
"@medusajs/cli": "2.10.4-snapshot-
|
|
74
|
-
"@medusajs/framework": "2.10.4-snapshot-
|
|
75
|
-
"@medusajs/icons": "2.10.4-snapshot-
|
|
76
|
-
"@medusajs/test-utils": "2.10.4-snapshot-
|
|
77
|
-
"@medusajs/ui": "4.0.24-snapshot-
|
|
72
|
+
"@medusajs/admin-sdk": "2.10.4-snapshot-20251013095945",
|
|
73
|
+
"@medusajs/cli": "2.10.4-snapshot-20251013095945",
|
|
74
|
+
"@medusajs/framework": "2.10.4-snapshot-20251013095945",
|
|
75
|
+
"@medusajs/icons": "2.10.4-snapshot-20251013095945",
|
|
76
|
+
"@medusajs/test-utils": "2.10.4-snapshot-20251013095945",
|
|
77
|
+
"@medusajs/ui": "4.0.24-snapshot-20251013095945",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|