@medusajs/draft-order 2.14.2-preview-20260430064603 → 2.14.2
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
|
@@ -9899,6 +9899,196 @@ const ID = () => {
|
|
|
9899
9899
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
9900
9900
|
] });
|
|
9901
9901
|
};
|
|
9902
|
+
const BillingAddress = () => {
|
|
9903
|
+
const { id } = reactRouterDom.useParams();
|
|
9904
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9905
|
+
fields: "+billing_address"
|
|
9906
|
+
});
|
|
9907
|
+
if (isError) {
|
|
9908
|
+
throw error;
|
|
9909
|
+
}
|
|
9910
|
+
const isReady = !isPending && !!order;
|
|
9911
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9912
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9913
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9914
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9915
|
+
] }),
|
|
9916
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9917
|
+
] });
|
|
9918
|
+
};
|
|
9919
|
+
const BillingAddressForm = ({ order }) => {
|
|
9920
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9921
|
+
const form = reactHookForm.useForm({
|
|
9922
|
+
defaultValues: {
|
|
9923
|
+
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
9924
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9925
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9926
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9927
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9928
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9929
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9930
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9931
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9932
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9933
|
+
},
|
|
9934
|
+
resolver: zod.zodResolver(schema$5)
|
|
9935
|
+
});
|
|
9936
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9937
|
+
const { handleSuccess } = useRouteModal();
|
|
9938
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9939
|
+
await mutateAsync(
|
|
9940
|
+
{ billing_address: data },
|
|
9941
|
+
{
|
|
9942
|
+
onSuccess: () => {
|
|
9943
|
+
handleSuccess();
|
|
9944
|
+
},
|
|
9945
|
+
onError: (error) => {
|
|
9946
|
+
ui.toast.error(error.message);
|
|
9947
|
+
}
|
|
9948
|
+
}
|
|
9949
|
+
);
|
|
9950
|
+
});
|
|
9951
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9952
|
+
KeyboundForm,
|
|
9953
|
+
{
|
|
9954
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9955
|
+
onSubmit,
|
|
9956
|
+
children: [
|
|
9957
|
+
/* @__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: [
|
|
9958
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9959
|
+
Form$2.Field,
|
|
9960
|
+
{
|
|
9961
|
+
control: form.control,
|
|
9962
|
+
name: "country_code",
|
|
9963
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9964
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9965
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9966
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9967
|
+
] })
|
|
9968
|
+
}
|
|
9969
|
+
),
|
|
9970
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9971
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9972
|
+
Form$2.Field,
|
|
9973
|
+
{
|
|
9974
|
+
control: form.control,
|
|
9975
|
+
name: "first_name",
|
|
9976
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9977
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9978
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9979
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9980
|
+
] })
|
|
9981
|
+
}
|
|
9982
|
+
),
|
|
9983
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9984
|
+
Form$2.Field,
|
|
9985
|
+
{
|
|
9986
|
+
control: form.control,
|
|
9987
|
+
name: "last_name",
|
|
9988
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9989
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9990
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9991
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9992
|
+
] })
|
|
9993
|
+
}
|
|
9994
|
+
)
|
|
9995
|
+
] }),
|
|
9996
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9997
|
+
Form$2.Field,
|
|
9998
|
+
{
|
|
9999
|
+
control: form.control,
|
|
10000
|
+
name: "company",
|
|
10001
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10002
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10003
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10004
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10005
|
+
] })
|
|
10006
|
+
}
|
|
10007
|
+
),
|
|
10008
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10009
|
+
Form$2.Field,
|
|
10010
|
+
{
|
|
10011
|
+
control: form.control,
|
|
10012
|
+
name: "address_1",
|
|
10013
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10014
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
10015
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10016
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10017
|
+
] })
|
|
10018
|
+
}
|
|
10019
|
+
),
|
|
10020
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10021
|
+
Form$2.Field,
|
|
10022
|
+
{
|
|
10023
|
+
control: form.control,
|
|
10024
|
+
name: "address_2",
|
|
10025
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10026
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10027
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10028
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10029
|
+
] })
|
|
10030
|
+
}
|
|
10031
|
+
),
|
|
10032
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10033
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10034
|
+
Form$2.Field,
|
|
10035
|
+
{
|
|
10036
|
+
control: form.control,
|
|
10037
|
+
name: "postal_code",
|
|
10038
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10039
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
10040
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10041
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10042
|
+
] })
|
|
10043
|
+
}
|
|
10044
|
+
),
|
|
10045
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10046
|
+
Form$2.Field,
|
|
10047
|
+
{
|
|
10048
|
+
control: form.control,
|
|
10049
|
+
name: "city",
|
|
10050
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10051
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
10052
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10053
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10054
|
+
] })
|
|
10055
|
+
}
|
|
10056
|
+
)
|
|
10057
|
+
] }),
|
|
10058
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10059
|
+
Form$2.Field,
|
|
10060
|
+
{
|
|
10061
|
+
control: form.control,
|
|
10062
|
+
name: "province",
|
|
10063
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10064
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10065
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10066
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10067
|
+
] })
|
|
10068
|
+
}
|
|
10069
|
+
),
|
|
10070
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10071
|
+
Form$2.Field,
|
|
10072
|
+
{
|
|
10073
|
+
control: form.control,
|
|
10074
|
+
name: "phone",
|
|
10075
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10076
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10077
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10078
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10079
|
+
] })
|
|
10080
|
+
}
|
|
10081
|
+
)
|
|
10082
|
+
] }) }),
|
|
10083
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10084
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10085
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10086
|
+
] }) })
|
|
10087
|
+
]
|
|
10088
|
+
}
|
|
10089
|
+
) });
|
|
10090
|
+
};
|
|
10091
|
+
const schema$5 = addressSchema;
|
|
9902
10092
|
const CustomItems = () => {
|
|
9903
10093
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9904
10094
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9907,7 +10097,7 @@ const CustomItems = () => {
|
|
|
9907
10097
|
};
|
|
9908
10098
|
const CustomItemsForm = () => {
|
|
9909
10099
|
const form = reactHookForm.useForm({
|
|
9910
|
-
resolver: zod.zodResolver(schema$
|
|
10100
|
+
resolver: zod.zodResolver(schema$4)
|
|
9911
10101
|
});
|
|
9912
10102
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9913
10103
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
@@ -9917,7 +10107,7 @@ const CustomItemsForm = () => {
|
|
|
9917
10107
|
] }) })
|
|
9918
10108
|
] }) });
|
|
9919
10109
|
};
|
|
9920
|
-
const schema$
|
|
10110
|
+
const schema$4 = object({
|
|
9921
10111
|
email: string().email()
|
|
9922
10112
|
});
|
|
9923
10113
|
const Email = () => {
|
|
@@ -9942,7 +10132,7 @@ const EmailForm = ({ order }) => {
|
|
|
9942
10132
|
defaultValues: {
|
|
9943
10133
|
email: order.email ?? ""
|
|
9944
10134
|
},
|
|
9945
|
-
resolver: zod.zodResolver(schema$
|
|
10135
|
+
resolver: zod.zodResolver(schema$3)
|
|
9946
10136
|
});
|
|
9947
10137
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9948
10138
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9985,7 +10175,7 @@ const EmailForm = ({ order }) => {
|
|
|
9985
10175
|
}
|
|
9986
10176
|
) });
|
|
9987
10177
|
};
|
|
9988
|
-
const schema$
|
|
10178
|
+
const schema$3 = object({
|
|
9989
10179
|
email: string().email()
|
|
9990
10180
|
});
|
|
9991
10181
|
const NumberInput = React.forwardRef(
|
|
@@ -11589,196 +11779,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11589
11779
|
}
|
|
11590
11780
|
return Array.from(promotionIds);
|
|
11591
11781
|
}
|
|
11592
|
-
const BillingAddress = () => {
|
|
11593
|
-
const { id } = reactRouterDom.useParams();
|
|
11594
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11595
|
-
fields: "+billing_address"
|
|
11596
|
-
});
|
|
11597
|
-
if (isError) {
|
|
11598
|
-
throw error;
|
|
11599
|
-
}
|
|
11600
|
-
const isReady = !isPending && !!order;
|
|
11601
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11602
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11603
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
11604
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11605
|
-
] }),
|
|
11606
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
11607
|
-
] });
|
|
11608
|
-
};
|
|
11609
|
-
const BillingAddressForm = ({ order }) => {
|
|
11610
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11611
|
-
const form = reactHookForm.useForm({
|
|
11612
|
-
defaultValues: {
|
|
11613
|
-
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
11614
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11615
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11616
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11617
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11618
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11619
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11620
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11621
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11622
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11623
|
-
},
|
|
11624
|
-
resolver: zod.zodResolver(schema$3)
|
|
11625
|
-
});
|
|
11626
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11627
|
-
const { handleSuccess } = useRouteModal();
|
|
11628
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11629
|
-
await mutateAsync(
|
|
11630
|
-
{ billing_address: data },
|
|
11631
|
-
{
|
|
11632
|
-
onSuccess: () => {
|
|
11633
|
-
handleSuccess();
|
|
11634
|
-
},
|
|
11635
|
-
onError: (error) => {
|
|
11636
|
-
ui.toast.error(error.message);
|
|
11637
|
-
}
|
|
11638
|
-
}
|
|
11639
|
-
);
|
|
11640
|
-
});
|
|
11641
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11642
|
-
KeyboundForm,
|
|
11643
|
-
{
|
|
11644
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11645
|
-
onSubmit,
|
|
11646
|
-
children: [
|
|
11647
|
-
/* @__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: [
|
|
11648
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11649
|
-
Form$2.Field,
|
|
11650
|
-
{
|
|
11651
|
-
control: form.control,
|
|
11652
|
-
name: "country_code",
|
|
11653
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11654
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11655
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11656
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11657
|
-
] })
|
|
11658
|
-
}
|
|
11659
|
-
),
|
|
11660
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11661
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11662
|
-
Form$2.Field,
|
|
11663
|
-
{
|
|
11664
|
-
control: form.control,
|
|
11665
|
-
name: "first_name",
|
|
11666
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11667
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11668
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11669
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11670
|
-
] })
|
|
11671
|
-
}
|
|
11672
|
-
),
|
|
11673
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11674
|
-
Form$2.Field,
|
|
11675
|
-
{
|
|
11676
|
-
control: form.control,
|
|
11677
|
-
name: "last_name",
|
|
11678
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11679
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11680
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11681
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11682
|
-
] })
|
|
11683
|
-
}
|
|
11684
|
-
)
|
|
11685
|
-
] }),
|
|
11686
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11687
|
-
Form$2.Field,
|
|
11688
|
-
{
|
|
11689
|
-
control: form.control,
|
|
11690
|
-
name: "company",
|
|
11691
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11692
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11693
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11694
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11695
|
-
] })
|
|
11696
|
-
}
|
|
11697
|
-
),
|
|
11698
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11699
|
-
Form$2.Field,
|
|
11700
|
-
{
|
|
11701
|
-
control: form.control,
|
|
11702
|
-
name: "address_1",
|
|
11703
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11704
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11705
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11706
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11707
|
-
] })
|
|
11708
|
-
}
|
|
11709
|
-
),
|
|
11710
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11711
|
-
Form$2.Field,
|
|
11712
|
-
{
|
|
11713
|
-
control: form.control,
|
|
11714
|
-
name: "address_2",
|
|
11715
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11716
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11717
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11718
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11719
|
-
] })
|
|
11720
|
-
}
|
|
11721
|
-
),
|
|
11722
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11723
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11724
|
-
Form$2.Field,
|
|
11725
|
-
{
|
|
11726
|
-
control: form.control,
|
|
11727
|
-
name: "postal_code",
|
|
11728
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11729
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11730
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11731
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11732
|
-
] })
|
|
11733
|
-
}
|
|
11734
|
-
),
|
|
11735
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11736
|
-
Form$2.Field,
|
|
11737
|
-
{
|
|
11738
|
-
control: form.control,
|
|
11739
|
-
name: "city",
|
|
11740
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11741
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11742
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11743
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11744
|
-
] })
|
|
11745
|
-
}
|
|
11746
|
-
)
|
|
11747
|
-
] }),
|
|
11748
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11749
|
-
Form$2.Field,
|
|
11750
|
-
{
|
|
11751
|
-
control: form.control,
|
|
11752
|
-
name: "province",
|
|
11753
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11754
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11755
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11756
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11757
|
-
] })
|
|
11758
|
-
}
|
|
11759
|
-
),
|
|
11760
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11761
|
-
Form$2.Field,
|
|
11762
|
-
{
|
|
11763
|
-
control: form.control,
|
|
11764
|
-
name: "phone",
|
|
11765
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11766
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11767
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11768
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11769
|
-
] })
|
|
11770
|
-
}
|
|
11771
|
-
)
|
|
11772
|
-
] }) }),
|
|
11773
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11774
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11775
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11776
|
-
] }) })
|
|
11777
|
-
]
|
|
11778
|
-
}
|
|
11779
|
-
) });
|
|
11780
|
-
};
|
|
11781
|
-
const schema$3 = addressSchema;
|
|
11782
11782
|
const SalesChannel = () => {
|
|
11783
11783
|
const { id } = reactRouterDom.useParams();
|
|
11784
11784
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13391,6 +13391,10 @@ const routeModule = {
|
|
|
13391
13391
|
handle,
|
|
13392
13392
|
loader,
|
|
13393
13393
|
children: [
|
|
13394
|
+
{
|
|
13395
|
+
Component: BillingAddress,
|
|
13396
|
+
path: "/draft-orders/:id/billing-address"
|
|
13397
|
+
},
|
|
13394
13398
|
{
|
|
13395
13399
|
Component: CustomItems,
|
|
13396
13400
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13411,10 +13415,6 @@ const routeModule = {
|
|
|
13411
13415
|
Component: Promotions,
|
|
13412
13416
|
path: "/draft-orders/:id/promotions"
|
|
13413
13417
|
},
|
|
13414
|
-
{
|
|
13415
|
-
Component: BillingAddress,
|
|
13416
|
-
path: "/draft-orders/:id/billing-address"
|
|
13417
|
-
},
|
|
13418
13418
|
{
|
|
13419
13419
|
Component: SalesChannel,
|
|
13420
13420
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -9892,6 +9892,196 @@ const ID = () => {
|
|
|
9892
9892
|
/* @__PURE__ */ jsx(Outlet, {})
|
|
9893
9893
|
] });
|
|
9894
9894
|
};
|
|
9895
|
+
const BillingAddress = () => {
|
|
9896
|
+
const { id } = useParams();
|
|
9897
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
9898
|
+
fields: "+billing_address"
|
|
9899
|
+
});
|
|
9900
|
+
if (isError) {
|
|
9901
|
+
throw error;
|
|
9902
|
+
}
|
|
9903
|
+
const isReady = !isPending && !!order;
|
|
9904
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9905
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9906
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9907
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9908
|
+
] }),
|
|
9909
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9910
|
+
] });
|
|
9911
|
+
};
|
|
9912
|
+
const BillingAddressForm = ({ order }) => {
|
|
9913
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9914
|
+
const form = useForm({
|
|
9915
|
+
defaultValues: {
|
|
9916
|
+
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
9917
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9918
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9919
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9920
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9921
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9922
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9923
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9924
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9925
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9926
|
+
},
|
|
9927
|
+
resolver: zodResolver(schema$5)
|
|
9928
|
+
});
|
|
9929
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9930
|
+
const { handleSuccess } = useRouteModal();
|
|
9931
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
9932
|
+
await mutateAsync(
|
|
9933
|
+
{ billing_address: data },
|
|
9934
|
+
{
|
|
9935
|
+
onSuccess: () => {
|
|
9936
|
+
handleSuccess();
|
|
9937
|
+
},
|
|
9938
|
+
onError: (error) => {
|
|
9939
|
+
toast.error(error.message);
|
|
9940
|
+
}
|
|
9941
|
+
}
|
|
9942
|
+
);
|
|
9943
|
+
});
|
|
9944
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9945
|
+
KeyboundForm,
|
|
9946
|
+
{
|
|
9947
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
9948
|
+
onSubmit,
|
|
9949
|
+
children: [
|
|
9950
|
+
/* @__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: [
|
|
9951
|
+
/* @__PURE__ */ jsx(
|
|
9952
|
+
Form$2.Field,
|
|
9953
|
+
{
|
|
9954
|
+
control: form.control,
|
|
9955
|
+
name: "country_code",
|
|
9956
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9957
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9958
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9959
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9960
|
+
] })
|
|
9961
|
+
}
|
|
9962
|
+
),
|
|
9963
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9964
|
+
/* @__PURE__ */ jsx(
|
|
9965
|
+
Form$2.Field,
|
|
9966
|
+
{
|
|
9967
|
+
control: form.control,
|
|
9968
|
+
name: "first_name",
|
|
9969
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9970
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9971
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9972
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9973
|
+
] })
|
|
9974
|
+
}
|
|
9975
|
+
),
|
|
9976
|
+
/* @__PURE__ */ jsx(
|
|
9977
|
+
Form$2.Field,
|
|
9978
|
+
{
|
|
9979
|
+
control: form.control,
|
|
9980
|
+
name: "last_name",
|
|
9981
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9982
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9983
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9984
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9985
|
+
] })
|
|
9986
|
+
}
|
|
9987
|
+
)
|
|
9988
|
+
] }),
|
|
9989
|
+
/* @__PURE__ */ jsx(
|
|
9990
|
+
Form$2.Field,
|
|
9991
|
+
{
|
|
9992
|
+
control: form.control,
|
|
9993
|
+
name: "company",
|
|
9994
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9995
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9996
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9997
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9998
|
+
] })
|
|
9999
|
+
}
|
|
10000
|
+
),
|
|
10001
|
+
/* @__PURE__ */ jsx(
|
|
10002
|
+
Form$2.Field,
|
|
10003
|
+
{
|
|
10004
|
+
control: form.control,
|
|
10005
|
+
name: "address_1",
|
|
10006
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10007
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
10008
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10009
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10010
|
+
] })
|
|
10011
|
+
}
|
|
10012
|
+
),
|
|
10013
|
+
/* @__PURE__ */ jsx(
|
|
10014
|
+
Form$2.Field,
|
|
10015
|
+
{
|
|
10016
|
+
control: form.control,
|
|
10017
|
+
name: "address_2",
|
|
10018
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10019
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10020
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10021
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10022
|
+
] })
|
|
10023
|
+
}
|
|
10024
|
+
),
|
|
10025
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10026
|
+
/* @__PURE__ */ jsx(
|
|
10027
|
+
Form$2.Field,
|
|
10028
|
+
{
|
|
10029
|
+
control: form.control,
|
|
10030
|
+
name: "postal_code",
|
|
10031
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10032
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
10033
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10034
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10035
|
+
] })
|
|
10036
|
+
}
|
|
10037
|
+
),
|
|
10038
|
+
/* @__PURE__ */ jsx(
|
|
10039
|
+
Form$2.Field,
|
|
10040
|
+
{
|
|
10041
|
+
control: form.control,
|
|
10042
|
+
name: "city",
|
|
10043
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10044
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
10045
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10046
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10047
|
+
] })
|
|
10048
|
+
}
|
|
10049
|
+
)
|
|
10050
|
+
] }),
|
|
10051
|
+
/* @__PURE__ */ jsx(
|
|
10052
|
+
Form$2.Field,
|
|
10053
|
+
{
|
|
10054
|
+
control: form.control,
|
|
10055
|
+
name: "province",
|
|
10056
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10057
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10058
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10059
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10060
|
+
] })
|
|
10061
|
+
}
|
|
10062
|
+
),
|
|
10063
|
+
/* @__PURE__ */ jsx(
|
|
10064
|
+
Form$2.Field,
|
|
10065
|
+
{
|
|
10066
|
+
control: form.control,
|
|
10067
|
+
name: "phone",
|
|
10068
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10069
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10070
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10071
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10072
|
+
] })
|
|
10073
|
+
}
|
|
10074
|
+
)
|
|
10075
|
+
] }) }),
|
|
10076
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10077
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10078
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10079
|
+
] }) })
|
|
10080
|
+
]
|
|
10081
|
+
}
|
|
10082
|
+
) });
|
|
10083
|
+
};
|
|
10084
|
+
const schema$5 = addressSchema;
|
|
9895
10085
|
const CustomItems = () => {
|
|
9896
10086
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9897
10087
|
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -9900,7 +10090,7 @@ const CustomItems = () => {
|
|
|
9900
10090
|
};
|
|
9901
10091
|
const CustomItemsForm = () => {
|
|
9902
10092
|
const form = useForm({
|
|
9903
|
-
resolver: zodResolver(schema$
|
|
10093
|
+
resolver: zodResolver(schema$4)
|
|
9904
10094
|
});
|
|
9905
10095
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9906
10096
|
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
@@ -9910,7 +10100,7 @@ const CustomItemsForm = () => {
|
|
|
9910
10100
|
] }) })
|
|
9911
10101
|
] }) });
|
|
9912
10102
|
};
|
|
9913
|
-
const schema$
|
|
10103
|
+
const schema$4 = object({
|
|
9914
10104
|
email: string().email()
|
|
9915
10105
|
});
|
|
9916
10106
|
const Email = () => {
|
|
@@ -9935,7 +10125,7 @@ const EmailForm = ({ order }) => {
|
|
|
9935
10125
|
defaultValues: {
|
|
9936
10126
|
email: order.email ?? ""
|
|
9937
10127
|
},
|
|
9938
|
-
resolver: zodResolver(schema$
|
|
10128
|
+
resolver: zodResolver(schema$3)
|
|
9939
10129
|
});
|
|
9940
10130
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9941
10131
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9978,7 +10168,7 @@ const EmailForm = ({ order }) => {
|
|
|
9978
10168
|
}
|
|
9979
10169
|
) });
|
|
9980
10170
|
};
|
|
9981
|
-
const schema$
|
|
10171
|
+
const schema$3 = object({
|
|
9982
10172
|
email: string().email()
|
|
9983
10173
|
});
|
|
9984
10174
|
const NumberInput = forwardRef(
|
|
@@ -11582,196 +11772,6 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11582
11772
|
}
|
|
11583
11773
|
return Array.from(promotionIds);
|
|
11584
11774
|
}
|
|
11585
|
-
const BillingAddress = () => {
|
|
11586
|
-
const { id } = useParams();
|
|
11587
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11588
|
-
fields: "+billing_address"
|
|
11589
|
-
});
|
|
11590
|
-
if (isError) {
|
|
11591
|
-
throw error;
|
|
11592
|
-
}
|
|
11593
|
-
const isReady = !isPending && !!order;
|
|
11594
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11595
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11596
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
11597
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11598
|
-
] }),
|
|
11599
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
11600
|
-
] });
|
|
11601
|
-
};
|
|
11602
|
-
const BillingAddressForm = ({ order }) => {
|
|
11603
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11604
|
-
const form = useForm({
|
|
11605
|
-
defaultValues: {
|
|
11606
|
-
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
11607
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11608
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11609
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11610
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11611
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11612
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11613
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11614
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11615
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11616
|
-
},
|
|
11617
|
-
resolver: zodResolver(schema$3)
|
|
11618
|
-
});
|
|
11619
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11620
|
-
const { handleSuccess } = useRouteModal();
|
|
11621
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11622
|
-
await mutateAsync(
|
|
11623
|
-
{ billing_address: data },
|
|
11624
|
-
{
|
|
11625
|
-
onSuccess: () => {
|
|
11626
|
-
handleSuccess();
|
|
11627
|
-
},
|
|
11628
|
-
onError: (error) => {
|
|
11629
|
-
toast.error(error.message);
|
|
11630
|
-
}
|
|
11631
|
-
}
|
|
11632
|
-
);
|
|
11633
|
-
});
|
|
11634
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11635
|
-
KeyboundForm,
|
|
11636
|
-
{
|
|
11637
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11638
|
-
onSubmit,
|
|
11639
|
-
children: [
|
|
11640
|
-
/* @__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: [
|
|
11641
|
-
/* @__PURE__ */ jsx(
|
|
11642
|
-
Form$2.Field,
|
|
11643
|
-
{
|
|
11644
|
-
control: form.control,
|
|
11645
|
-
name: "country_code",
|
|
11646
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11647
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11648
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11649
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11650
|
-
] })
|
|
11651
|
-
}
|
|
11652
|
-
),
|
|
11653
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11654
|
-
/* @__PURE__ */ jsx(
|
|
11655
|
-
Form$2.Field,
|
|
11656
|
-
{
|
|
11657
|
-
control: form.control,
|
|
11658
|
-
name: "first_name",
|
|
11659
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11660
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11661
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11662
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11663
|
-
] })
|
|
11664
|
-
}
|
|
11665
|
-
),
|
|
11666
|
-
/* @__PURE__ */ jsx(
|
|
11667
|
-
Form$2.Field,
|
|
11668
|
-
{
|
|
11669
|
-
control: form.control,
|
|
11670
|
-
name: "last_name",
|
|
11671
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11672
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11673
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11674
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11675
|
-
] })
|
|
11676
|
-
}
|
|
11677
|
-
)
|
|
11678
|
-
] }),
|
|
11679
|
-
/* @__PURE__ */ jsx(
|
|
11680
|
-
Form$2.Field,
|
|
11681
|
-
{
|
|
11682
|
-
control: form.control,
|
|
11683
|
-
name: "company",
|
|
11684
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11685
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11686
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11687
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11688
|
-
] })
|
|
11689
|
-
}
|
|
11690
|
-
),
|
|
11691
|
-
/* @__PURE__ */ jsx(
|
|
11692
|
-
Form$2.Field,
|
|
11693
|
-
{
|
|
11694
|
-
control: form.control,
|
|
11695
|
-
name: "address_1",
|
|
11696
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11697
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11698
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11699
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11700
|
-
] })
|
|
11701
|
-
}
|
|
11702
|
-
),
|
|
11703
|
-
/* @__PURE__ */ jsx(
|
|
11704
|
-
Form$2.Field,
|
|
11705
|
-
{
|
|
11706
|
-
control: form.control,
|
|
11707
|
-
name: "address_2",
|
|
11708
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11709
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11710
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11711
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11712
|
-
] })
|
|
11713
|
-
}
|
|
11714
|
-
),
|
|
11715
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11716
|
-
/* @__PURE__ */ jsx(
|
|
11717
|
-
Form$2.Field,
|
|
11718
|
-
{
|
|
11719
|
-
control: form.control,
|
|
11720
|
-
name: "postal_code",
|
|
11721
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11722
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11723
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11724
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11725
|
-
] })
|
|
11726
|
-
}
|
|
11727
|
-
),
|
|
11728
|
-
/* @__PURE__ */ jsx(
|
|
11729
|
-
Form$2.Field,
|
|
11730
|
-
{
|
|
11731
|
-
control: form.control,
|
|
11732
|
-
name: "city",
|
|
11733
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11734
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11735
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11736
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11737
|
-
] })
|
|
11738
|
-
}
|
|
11739
|
-
)
|
|
11740
|
-
] }),
|
|
11741
|
-
/* @__PURE__ */ jsx(
|
|
11742
|
-
Form$2.Field,
|
|
11743
|
-
{
|
|
11744
|
-
control: form.control,
|
|
11745
|
-
name: "province",
|
|
11746
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11747
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11748
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11749
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11750
|
-
] })
|
|
11751
|
-
}
|
|
11752
|
-
),
|
|
11753
|
-
/* @__PURE__ */ jsx(
|
|
11754
|
-
Form$2.Field,
|
|
11755
|
-
{
|
|
11756
|
-
control: form.control,
|
|
11757
|
-
name: "phone",
|
|
11758
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11759
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11760
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11761
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11762
|
-
] })
|
|
11763
|
-
}
|
|
11764
|
-
)
|
|
11765
|
-
] }) }),
|
|
11766
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11767
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11768
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11769
|
-
] }) })
|
|
11770
|
-
]
|
|
11771
|
-
}
|
|
11772
|
-
) });
|
|
11773
|
-
};
|
|
11774
|
-
const schema$3 = addressSchema;
|
|
11775
11775
|
const SalesChannel = () => {
|
|
11776
11776
|
const { id } = useParams();
|
|
11777
11777
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -13384,6 +13384,10 @@ const routeModule = {
|
|
|
13384
13384
|
handle,
|
|
13385
13385
|
loader,
|
|
13386
13386
|
children: [
|
|
13387
|
+
{
|
|
13388
|
+
Component: BillingAddress,
|
|
13389
|
+
path: "/draft-orders/:id/billing-address"
|
|
13390
|
+
},
|
|
13387
13391
|
{
|
|
13388
13392
|
Component: CustomItems,
|
|
13389
13393
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13404,10 +13408,6 @@ const routeModule = {
|
|
|
13404
13408
|
Component: Promotions,
|
|
13405
13409
|
path: "/draft-orders/:id/promotions"
|
|
13406
13410
|
},
|
|
13407
|
-
{
|
|
13408
|
-
Component: BillingAddress,
|
|
13409
|
-
path: "/draft-orders/:id/billing-address"
|
|
13410
|
-
},
|
|
13411
13411
|
{
|
|
13412
13412
|
Component: SalesChannel,
|
|
13413
13413
|
path: "/draft-orders/:id/sales-channel"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.14.2
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"description": "A draft order plugin for Medusa.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@ariakit/react": "^0.4.15",
|
|
43
43
|
"@babel/runtime": "^7.26.10",
|
|
44
44
|
"@hookform/resolvers": "3.4.2",
|
|
45
|
-
"@medusajs/js-sdk": "2.14.2
|
|
45
|
+
"@medusajs/js-sdk": "2.14.2",
|
|
46
46
|
"@tanstack/react-query": "5.64.2",
|
|
47
47
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
48
48
|
"date-fns": "^3.6.0",
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
"react-hook-form": "7.49.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@medusajs/admin-sdk": "2.14.2
|
|
57
|
-
"@medusajs/cli": "2.14.2
|
|
58
|
-
"@medusajs/framework": "2.14.2
|
|
59
|
-
"@medusajs/icons": "2.14.2
|
|
60
|
-
"@medusajs/test-utils": "2.14.2
|
|
61
|
-
"@medusajs/types": "2.14.2
|
|
62
|
-
"@medusajs/ui": "4.1.9
|
|
63
|
-
"@medusajs/ui-preset": "2.14.2
|
|
56
|
+
"@medusajs/admin-sdk": "2.14.2",
|
|
57
|
+
"@medusajs/cli": "2.14.2",
|
|
58
|
+
"@medusajs/framework": "2.14.2",
|
|
59
|
+
"@medusajs/icons": "2.14.2",
|
|
60
|
+
"@medusajs/test-utils": "2.14.2",
|
|
61
|
+
"@medusajs/types": "2.14.2",
|
|
62
|
+
"@medusajs/ui": "4.1.9",
|
|
63
|
+
"@medusajs/ui-preset": "2.14.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@medusajs/admin-sdk": "2.14.2
|
|
67
|
-
"@medusajs/cli": "2.14.2
|
|
68
|
-
"@medusajs/framework": "2.14.2
|
|
69
|
-
"@medusajs/icons": "2.14.2
|
|
70
|
-
"@medusajs/test-utils": "2.14.2
|
|
71
|
-
"@medusajs/ui": "4.1.9
|
|
66
|
+
"@medusajs/admin-sdk": "2.14.2",
|
|
67
|
+
"@medusajs/cli": "2.14.2",
|
|
68
|
+
"@medusajs/framework": "2.14.2",
|
|
69
|
+
"@medusajs/icons": "2.14.2",
|
|
70
|
+
"@medusajs/test-utils": "2.14.2",
|
|
71
|
+
"@medusajs/ui": "4.1.9",
|
|
72
72
|
"react": "^18.3.1",
|
|
73
73
|
"react-dom": "^18.3.1",
|
|
74
74
|
"react-router-dom": "6.30.3"
|