@medusajs/draft-order 3.0.0-preview-20260630154621 → 3.0.0-preview-20260630183121
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 +214 -214
- package/.medusa/server/src/admin/index.mjs +214 -214
- package/package.json +18 -18
|
@@ -971,7 +971,7 @@ const List = () => {
|
|
|
971
971
|
widgetsZonePrefix: "draft_order.list",
|
|
972
972
|
preferredLayoutId: "core:single-column",
|
|
973
973
|
sections: {
|
|
974
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
974
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "DraftOrderListTable", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
975
975
|
DataTable,
|
|
976
976
|
{
|
|
977
977
|
data: draft_orders,
|
|
@@ -998,7 +998,7 @@ const List = () => {
|
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
|
-
) })
|
|
1001
|
+
) }) })
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
1004
|
);
|
|
@@ -9890,211 +9890,21 @@ const ID = () => {
|
|
|
9890
9890
|
data: order,
|
|
9891
9891
|
sections: {
|
|
9892
9892
|
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9893
|
-
/* @__PURE__ */ jsxRuntime.jsx(ActiveOrderChange, { orderId: order.id }),
|
|
9894
|
-
/* @__PURE__ */ jsxRuntime.jsx(GeneralSection, { order }),
|
|
9895
|
-
/* @__PURE__ */ jsxRuntime.jsx(SummarySection, { order }),
|
|
9896
|
-
/* @__PURE__ */ jsxRuntime.jsx(ShippingSection, { order }),
|
|
9897
|
-
/* @__PURE__ */ jsxRuntime.jsx(MetadataSection, { order }),
|
|
9898
|
-
/* @__PURE__ */ jsxRuntime.jsx(JsonViewSection, { data: order })
|
|
9893
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "ActiveOrderChange", children: /* @__PURE__ */ jsxRuntime.jsx(ActiveOrderChange, { orderId: order.id }) }),
|
|
9894
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GeneralSection", children: /* @__PURE__ */ jsxRuntime.jsx(GeneralSection, { order }) }),
|
|
9895
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "SummarySection", children: /* @__PURE__ */ jsxRuntime.jsx(SummarySection, { order }) }),
|
|
9896
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "ShippingSection", children: /* @__PURE__ */ jsxRuntime.jsx(ShippingSection, { order }) }),
|
|
9897
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "MetadataSection", children: /* @__PURE__ */ jsxRuntime.jsx(MetadataSection, { order }) }),
|
|
9898
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "JsonViewSection", children: /* @__PURE__ */ jsxRuntime.jsx(JsonViewSection, { data: order }) })
|
|
9899
9899
|
] }),
|
|
9900
9900
|
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9901
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomerSection, { order }),
|
|
9902
|
-
/* @__PURE__ */ jsxRuntime.jsx(ActivitySection, { order, changes: order_changes })
|
|
9901
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "CustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(CustomerSection, { order }) }),
|
|
9902
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "ActivitySection", children: /* @__PURE__ */ jsxRuntime.jsx(ActivitySection, { order, changes: order_changes }) })
|
|
9903
9903
|
] })
|
|
9904
9904
|
}
|
|
9905
9905
|
}
|
|
9906
9906
|
);
|
|
9907
9907
|
};
|
|
9908
|
-
const BillingAddress = () => {
|
|
9909
|
-
const { id } = reactRouterDom.useParams();
|
|
9910
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9911
|
-
fields: "+billing_address"
|
|
9912
|
-
});
|
|
9913
|
-
if (isError) {
|
|
9914
|
-
throw error;
|
|
9915
|
-
}
|
|
9916
|
-
const isReady = !isPending && !!order;
|
|
9917
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9918
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9919
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9920
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9921
|
-
] }),
|
|
9922
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9923
|
-
] });
|
|
9924
|
-
};
|
|
9925
|
-
const BillingAddressForm = ({ order }) => {
|
|
9926
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9927
|
-
const form = reactHookForm.useForm({
|
|
9928
|
-
defaultValues: {
|
|
9929
|
-
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
9930
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9931
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9932
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9933
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9934
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9935
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9936
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9937
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9938
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9939
|
-
},
|
|
9940
|
-
resolver: zod.zodResolver(schema$5)
|
|
9941
|
-
});
|
|
9942
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9943
|
-
const { handleSuccess } = useRouteModal();
|
|
9944
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9945
|
-
await mutateAsync(
|
|
9946
|
-
{ billing_address: data },
|
|
9947
|
-
{
|
|
9948
|
-
onSuccess: () => {
|
|
9949
|
-
handleSuccess();
|
|
9950
|
-
},
|
|
9951
|
-
onError: (error) => {
|
|
9952
|
-
ui.toast.error(error.message);
|
|
9953
|
-
}
|
|
9954
|
-
}
|
|
9955
|
-
);
|
|
9956
|
-
});
|
|
9957
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9958
|
-
KeyboundForm,
|
|
9959
|
-
{
|
|
9960
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9961
|
-
onSubmit,
|
|
9962
|
-
children: [
|
|
9963
|
-
/* @__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: [
|
|
9964
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9965
|
-
Form$2.Field,
|
|
9966
|
-
{
|
|
9967
|
-
control: form.control,
|
|
9968
|
-
name: "country_code",
|
|
9969
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9970
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9971
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9972
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9973
|
-
] })
|
|
9974
|
-
}
|
|
9975
|
-
),
|
|
9976
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9977
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9978
|
-
Form$2.Field,
|
|
9979
|
-
{
|
|
9980
|
-
control: form.control,
|
|
9981
|
-
name: "first_name",
|
|
9982
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9983
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9984
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9985
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9986
|
-
] })
|
|
9987
|
-
}
|
|
9988
|
-
),
|
|
9989
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9990
|
-
Form$2.Field,
|
|
9991
|
-
{
|
|
9992
|
-
control: form.control,
|
|
9993
|
-
name: "last_name",
|
|
9994
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9995
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9996
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9997
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9998
|
-
] })
|
|
9999
|
-
}
|
|
10000
|
-
)
|
|
10001
|
-
] }),
|
|
10002
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10003
|
-
Form$2.Field,
|
|
10004
|
-
{
|
|
10005
|
-
control: form.control,
|
|
10006
|
-
name: "company",
|
|
10007
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10008
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10009
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10010
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10011
|
-
] })
|
|
10012
|
-
}
|
|
10013
|
-
),
|
|
10014
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10015
|
-
Form$2.Field,
|
|
10016
|
-
{
|
|
10017
|
-
control: form.control,
|
|
10018
|
-
name: "address_1",
|
|
10019
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10020
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
10021
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10022
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10023
|
-
] })
|
|
10024
|
-
}
|
|
10025
|
-
),
|
|
10026
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10027
|
-
Form$2.Field,
|
|
10028
|
-
{
|
|
10029
|
-
control: form.control,
|
|
10030
|
-
name: "address_2",
|
|
10031
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10032
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10033
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10034
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10035
|
-
] })
|
|
10036
|
-
}
|
|
10037
|
-
),
|
|
10038
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10039
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10040
|
-
Form$2.Field,
|
|
10041
|
-
{
|
|
10042
|
-
control: form.control,
|
|
10043
|
-
name: "postal_code",
|
|
10044
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10045
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
10046
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10047
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10048
|
-
] })
|
|
10049
|
-
}
|
|
10050
|
-
),
|
|
10051
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10052
|
-
Form$2.Field,
|
|
10053
|
-
{
|
|
10054
|
-
control: form.control,
|
|
10055
|
-
name: "city",
|
|
10056
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10057
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
10058
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10059
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10060
|
-
] })
|
|
10061
|
-
}
|
|
10062
|
-
)
|
|
10063
|
-
] }),
|
|
10064
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10065
|
-
Form$2.Field,
|
|
10066
|
-
{
|
|
10067
|
-
control: form.control,
|
|
10068
|
-
name: "province",
|
|
10069
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10070
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10071
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10072
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10073
|
-
] })
|
|
10074
|
-
}
|
|
10075
|
-
),
|
|
10076
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10077
|
-
Form$2.Field,
|
|
10078
|
-
{
|
|
10079
|
-
control: form.control,
|
|
10080
|
-
name: "phone",
|
|
10081
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
10082
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10083
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
10084
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
10085
|
-
] })
|
|
10086
|
-
}
|
|
10087
|
-
)
|
|
10088
|
-
] }) }),
|
|
10089
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10090
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10091
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10092
|
-
] }) })
|
|
10093
|
-
]
|
|
10094
|
-
}
|
|
10095
|
-
) });
|
|
10096
|
-
};
|
|
10097
|
-
const schema$5 = addressSchema;
|
|
10098
9908
|
const CustomItems = () => {
|
|
10099
9909
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10100
9910
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -10103,7 +9913,7 @@ const CustomItems = () => {
|
|
|
10103
9913
|
};
|
|
10104
9914
|
const CustomItemsForm = () => {
|
|
10105
9915
|
const form = reactHookForm.useForm({
|
|
10106
|
-
resolver: zod.zodResolver(schema$
|
|
9916
|
+
resolver: zod.zodResolver(schema$5)
|
|
10107
9917
|
});
|
|
10108
9918
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10109
9919
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
@@ -10113,7 +9923,7 @@ const CustomItemsForm = () => {
|
|
|
10113
9923
|
] }) })
|
|
10114
9924
|
] }) });
|
|
10115
9925
|
};
|
|
10116
|
-
const schema$
|
|
9926
|
+
const schema$5 = object({
|
|
10117
9927
|
email: string().email()
|
|
10118
9928
|
});
|
|
10119
9929
|
const Email = () => {
|
|
@@ -10138,7 +9948,7 @@ const EmailForm = ({ order }) => {
|
|
|
10138
9948
|
defaultValues: {
|
|
10139
9949
|
email: order.email ?? ""
|
|
10140
9950
|
},
|
|
10141
|
-
resolver: zod.zodResolver(schema$
|
|
9951
|
+
resolver: zod.zodResolver(schema$4)
|
|
10142
9952
|
});
|
|
10143
9953
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10144
9954
|
const { handleSuccess } = useRouteModal();
|
|
@@ -10181,7 +9991,7 @@ const EmailForm = ({ order }) => {
|
|
|
10181
9991
|
}
|
|
10182
9992
|
) });
|
|
10183
9993
|
};
|
|
10184
|
-
const schema$
|
|
9994
|
+
const schema$4 = object({
|
|
10185
9995
|
email: string().email()
|
|
10186
9996
|
});
|
|
10187
9997
|
const NumberInput = React.forwardRef(
|
|
@@ -11813,7 +11623,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11813
11623
|
defaultValues: {
|
|
11814
11624
|
sales_channel_id: order.sales_channel_id || ""
|
|
11815
11625
|
},
|
|
11816
|
-
resolver: zod.zodResolver(schema$
|
|
11626
|
+
resolver: zod.zodResolver(schema$3)
|
|
11817
11627
|
});
|
|
11818
11628
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11819
11629
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11888,7 +11698,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11888
11698
|
}
|
|
11889
11699
|
);
|
|
11890
11700
|
};
|
|
11891
|
-
const schema$
|
|
11701
|
+
const schema$3 = object({
|
|
11892
11702
|
sales_channel_id: string().min(1)
|
|
11893
11703
|
});
|
|
11894
11704
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12730,7 +12540,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12730
12540
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12731
12541
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12732
12542
|
},
|
|
12733
|
-
resolver: zod.zodResolver(schema$
|
|
12543
|
+
resolver: zod.zodResolver(schema$2)
|
|
12734
12544
|
});
|
|
12735
12545
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12736
12546
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12900,7 +12710,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12900
12710
|
}
|
|
12901
12711
|
) });
|
|
12902
12712
|
};
|
|
12903
|
-
const schema$
|
|
12713
|
+
const schema$2 = addressSchema;
|
|
12904
12714
|
const TransferOwnership = () => {
|
|
12905
12715
|
const { id } = reactRouterDom.useParams();
|
|
12906
12716
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12924,7 +12734,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12924
12734
|
defaultValues: {
|
|
12925
12735
|
customer_id: order.customer_id || ""
|
|
12926
12736
|
},
|
|
12927
|
-
resolver: zod.zodResolver(schema)
|
|
12737
|
+
resolver: zod.zodResolver(schema$1)
|
|
12928
12738
|
});
|
|
12929
12739
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12930
12740
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13374,9 +13184,199 @@ const Illustration = () => {
|
|
|
13374
13184
|
}
|
|
13375
13185
|
);
|
|
13376
13186
|
};
|
|
13377
|
-
const schema = object({
|
|
13187
|
+
const schema$1 = object({
|
|
13378
13188
|
customer_id: string().min(1)
|
|
13379
13189
|
});
|
|
13190
|
+
const BillingAddress = () => {
|
|
13191
|
+
const { id } = reactRouterDom.useParams();
|
|
13192
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
13193
|
+
fields: "+billing_address"
|
|
13194
|
+
});
|
|
13195
|
+
if (isError) {
|
|
13196
|
+
throw error;
|
|
13197
|
+
}
|
|
13198
|
+
const isReady = !isPending && !!order;
|
|
13199
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
13200
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
13201
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
13202
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
13203
|
+
] }),
|
|
13204
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
13205
|
+
] });
|
|
13206
|
+
};
|
|
13207
|
+
const BillingAddressForm = ({ order }) => {
|
|
13208
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
13209
|
+
const form = reactHookForm.useForm({
|
|
13210
|
+
defaultValues: {
|
|
13211
|
+
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
13212
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
13213
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
13214
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
13215
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
13216
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
13217
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
13218
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
13219
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
13220
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
13221
|
+
},
|
|
13222
|
+
resolver: zod.zodResolver(schema)
|
|
13223
|
+
});
|
|
13224
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13225
|
+
const { handleSuccess } = useRouteModal();
|
|
13226
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
13227
|
+
await mutateAsync(
|
|
13228
|
+
{ billing_address: data },
|
|
13229
|
+
{
|
|
13230
|
+
onSuccess: () => {
|
|
13231
|
+
handleSuccess();
|
|
13232
|
+
},
|
|
13233
|
+
onError: (error) => {
|
|
13234
|
+
ui.toast.error(error.message);
|
|
13235
|
+
}
|
|
13236
|
+
}
|
|
13237
|
+
);
|
|
13238
|
+
});
|
|
13239
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13240
|
+
KeyboundForm,
|
|
13241
|
+
{
|
|
13242
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13243
|
+
onSubmit,
|
|
13244
|
+
children: [
|
|
13245
|
+
/* @__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: [
|
|
13246
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13247
|
+
Form$2.Field,
|
|
13248
|
+
{
|
|
13249
|
+
control: form.control,
|
|
13250
|
+
name: "country_code",
|
|
13251
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13252
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
13253
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
13254
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13255
|
+
] })
|
|
13256
|
+
}
|
|
13257
|
+
),
|
|
13258
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
13259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13260
|
+
Form$2.Field,
|
|
13261
|
+
{
|
|
13262
|
+
control: form.control,
|
|
13263
|
+
name: "first_name",
|
|
13264
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13265
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
13266
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13267
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13268
|
+
] })
|
|
13269
|
+
}
|
|
13270
|
+
),
|
|
13271
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13272
|
+
Form$2.Field,
|
|
13273
|
+
{
|
|
13274
|
+
control: form.control,
|
|
13275
|
+
name: "last_name",
|
|
13276
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13277
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
13278
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13279
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13280
|
+
] })
|
|
13281
|
+
}
|
|
13282
|
+
)
|
|
13283
|
+
] }),
|
|
13284
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13285
|
+
Form$2.Field,
|
|
13286
|
+
{
|
|
13287
|
+
control: form.control,
|
|
13288
|
+
name: "company",
|
|
13289
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13290
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
13291
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13292
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13293
|
+
] })
|
|
13294
|
+
}
|
|
13295
|
+
),
|
|
13296
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13297
|
+
Form$2.Field,
|
|
13298
|
+
{
|
|
13299
|
+
control: form.control,
|
|
13300
|
+
name: "address_1",
|
|
13301
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13302
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
13303
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13304
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13305
|
+
] })
|
|
13306
|
+
}
|
|
13307
|
+
),
|
|
13308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13309
|
+
Form$2.Field,
|
|
13310
|
+
{
|
|
13311
|
+
control: form.control,
|
|
13312
|
+
name: "address_2",
|
|
13313
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13314
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
13315
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13316
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13317
|
+
] })
|
|
13318
|
+
}
|
|
13319
|
+
),
|
|
13320
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
13321
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13322
|
+
Form$2.Field,
|
|
13323
|
+
{
|
|
13324
|
+
control: form.control,
|
|
13325
|
+
name: "postal_code",
|
|
13326
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13327
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
13328
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13329
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13330
|
+
] })
|
|
13331
|
+
}
|
|
13332
|
+
),
|
|
13333
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13334
|
+
Form$2.Field,
|
|
13335
|
+
{
|
|
13336
|
+
control: form.control,
|
|
13337
|
+
name: "city",
|
|
13338
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13339
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
13340
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13341
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13342
|
+
] })
|
|
13343
|
+
}
|
|
13344
|
+
)
|
|
13345
|
+
] }),
|
|
13346
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13347
|
+
Form$2.Field,
|
|
13348
|
+
{
|
|
13349
|
+
control: form.control,
|
|
13350
|
+
name: "province",
|
|
13351
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13352
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13353
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13354
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13355
|
+
] })
|
|
13356
|
+
}
|
|
13357
|
+
),
|
|
13358
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13359
|
+
Form$2.Field,
|
|
13360
|
+
{
|
|
13361
|
+
control: form.control,
|
|
13362
|
+
name: "phone",
|
|
13363
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13364
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13365
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13366
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13367
|
+
] })
|
|
13368
|
+
}
|
|
13369
|
+
)
|
|
13370
|
+
] }) }),
|
|
13371
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13372
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13373
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13374
|
+
] }) })
|
|
13375
|
+
]
|
|
13376
|
+
}
|
|
13377
|
+
) });
|
|
13378
|
+
};
|
|
13379
|
+
const schema = addressSchema;
|
|
13380
13380
|
const widgetModule = { widgets: [] };
|
|
13381
13381
|
const routeModule = {
|
|
13382
13382
|
routes: [
|
|
@@ -13397,10 +13397,6 @@ const routeModule = {
|
|
|
13397
13397
|
handle,
|
|
13398
13398
|
loader,
|
|
13399
13399
|
children: [
|
|
13400
|
-
{
|
|
13401
|
-
Component: BillingAddress,
|
|
13402
|
-
path: "/draft-orders/:id/billing-address"
|
|
13403
|
-
},
|
|
13404
13400
|
{
|
|
13405
13401
|
Component: CustomItems,
|
|
13406
13402
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13436,6 +13432,10 @@ const routeModule = {
|
|
|
13436
13432
|
{
|
|
13437
13433
|
Component: TransferOwnership,
|
|
13438
13434
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13435
|
+
},
|
|
13436
|
+
{
|
|
13437
|
+
Component: BillingAddress,
|
|
13438
|
+
path: "/draft-orders/:id/billing-address"
|
|
13439
13439
|
}
|
|
13440
13440
|
]
|
|
13441
13441
|
}
|
|
@@ -964,7 +964,7 @@ const List = () => {
|
|
|
964
964
|
widgetsZonePrefix: "draft_order.list",
|
|
965
965
|
preferredLayoutId: "core:single-column",
|
|
966
966
|
sections: {
|
|
967
|
-
main: /* @__PURE__ */ jsx(Container, { className: "p-0", children: /* @__PURE__ */ jsx(
|
|
967
|
+
main: /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "DraftOrderListTable", children: /* @__PURE__ */ jsx(Container, { className: "p-0", children: /* @__PURE__ */ jsx(
|
|
968
968
|
DataTable,
|
|
969
969
|
{
|
|
970
970
|
data: draft_orders,
|
|
@@ -991,7 +991,7 @@ const List = () => {
|
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
|
-
) })
|
|
994
|
+
) }) })
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
997
|
);
|
|
@@ -9883,211 +9883,21 @@ const ID = () => {
|
|
|
9883
9883
|
data: order,
|
|
9884
9884
|
sections: {
|
|
9885
9885
|
main: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9886
|
-
/* @__PURE__ */ jsx(ActiveOrderChange, { orderId: order.id }),
|
|
9887
|
-
/* @__PURE__ */ jsx(GeneralSection, { order }),
|
|
9888
|
-
/* @__PURE__ */ jsx(SummarySection, { order }),
|
|
9889
|
-
/* @__PURE__ */ jsx(ShippingSection, { order }),
|
|
9890
|
-
/* @__PURE__ */ jsx(MetadataSection, { order }),
|
|
9891
|
-
/* @__PURE__ */ jsx(JsonViewSection, { data: order })
|
|
9886
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "ActiveOrderChange", children: /* @__PURE__ */ jsx(ActiveOrderChange, { orderId: order.id }) }),
|
|
9887
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "GeneralSection", children: /* @__PURE__ */ jsx(GeneralSection, { order }) }),
|
|
9888
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "SummarySection", children: /* @__PURE__ */ jsx(SummarySection, { order }) }),
|
|
9889
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "ShippingSection", children: /* @__PURE__ */ jsx(ShippingSection, { order }) }),
|
|
9890
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "MetadataSection", children: /* @__PURE__ */ jsx(MetadataSection, { order }) }),
|
|
9891
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "JsonViewSection", children: /* @__PURE__ */ jsx(JsonViewSection, { data: order }) })
|
|
9892
9892
|
] }),
|
|
9893
9893
|
side: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9894
|
-
/* @__PURE__ */ jsx(CustomerSection, { order }),
|
|
9895
|
-
/* @__PURE__ */ jsx(ActivitySection, { order, changes: order_changes })
|
|
9894
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "CustomerSection", children: /* @__PURE__ */ jsx(CustomerSection, { order }) }),
|
|
9895
|
+
/* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "ActivitySection", children: /* @__PURE__ */ jsx(ActivitySection, { order, changes: order_changes }) })
|
|
9896
9896
|
] })
|
|
9897
9897
|
}
|
|
9898
9898
|
}
|
|
9899
9899
|
);
|
|
9900
9900
|
};
|
|
9901
|
-
const BillingAddress = () => {
|
|
9902
|
-
const { id } = useParams();
|
|
9903
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9904
|
-
fields: "+billing_address"
|
|
9905
|
-
});
|
|
9906
|
-
if (isError) {
|
|
9907
|
-
throw error;
|
|
9908
|
-
}
|
|
9909
|
-
const isReady = !isPending && !!order;
|
|
9910
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9911
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
9912
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
9913
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9914
|
-
] }),
|
|
9915
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
9916
|
-
] });
|
|
9917
|
-
};
|
|
9918
|
-
const BillingAddressForm = ({ order }) => {
|
|
9919
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9920
|
-
const form = useForm({
|
|
9921
|
-
defaultValues: {
|
|
9922
|
-
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
9923
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9924
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9925
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9926
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9927
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9928
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9929
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9930
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9931
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9932
|
-
},
|
|
9933
|
-
resolver: zodResolver(schema$5)
|
|
9934
|
-
});
|
|
9935
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9936
|
-
const { handleSuccess } = useRouteModal();
|
|
9937
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9938
|
-
await mutateAsync(
|
|
9939
|
-
{ billing_address: data },
|
|
9940
|
-
{
|
|
9941
|
-
onSuccess: () => {
|
|
9942
|
-
handleSuccess();
|
|
9943
|
-
},
|
|
9944
|
-
onError: (error) => {
|
|
9945
|
-
toast.error(error.message);
|
|
9946
|
-
}
|
|
9947
|
-
}
|
|
9948
|
-
);
|
|
9949
|
-
});
|
|
9950
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
9951
|
-
KeyboundForm,
|
|
9952
|
-
{
|
|
9953
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9954
|
-
onSubmit,
|
|
9955
|
-
children: [
|
|
9956
|
-
/* @__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: [
|
|
9957
|
-
/* @__PURE__ */ jsx(
|
|
9958
|
-
Form$2.Field,
|
|
9959
|
-
{
|
|
9960
|
-
control: form.control,
|
|
9961
|
-
name: "country_code",
|
|
9962
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9963
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
9964
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
9965
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9966
|
-
] })
|
|
9967
|
-
}
|
|
9968
|
-
),
|
|
9969
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9970
|
-
/* @__PURE__ */ jsx(
|
|
9971
|
-
Form$2.Field,
|
|
9972
|
-
{
|
|
9973
|
-
control: form.control,
|
|
9974
|
-
name: "first_name",
|
|
9975
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9976
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
9977
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9978
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9979
|
-
] })
|
|
9980
|
-
}
|
|
9981
|
-
),
|
|
9982
|
-
/* @__PURE__ */ jsx(
|
|
9983
|
-
Form$2.Field,
|
|
9984
|
-
{
|
|
9985
|
-
control: form.control,
|
|
9986
|
-
name: "last_name",
|
|
9987
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
9988
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
9989
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
9990
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
9991
|
-
] })
|
|
9992
|
-
}
|
|
9993
|
-
)
|
|
9994
|
-
] }),
|
|
9995
|
-
/* @__PURE__ */ jsx(
|
|
9996
|
-
Form$2.Field,
|
|
9997
|
-
{
|
|
9998
|
-
control: form.control,
|
|
9999
|
-
name: "company",
|
|
10000
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10001
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
10002
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10003
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10004
|
-
] })
|
|
10005
|
-
}
|
|
10006
|
-
),
|
|
10007
|
-
/* @__PURE__ */ jsx(
|
|
10008
|
-
Form$2.Field,
|
|
10009
|
-
{
|
|
10010
|
-
control: form.control,
|
|
10011
|
-
name: "address_1",
|
|
10012
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10013
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
10014
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10015
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10016
|
-
] })
|
|
10017
|
-
}
|
|
10018
|
-
),
|
|
10019
|
-
/* @__PURE__ */ jsx(
|
|
10020
|
-
Form$2.Field,
|
|
10021
|
-
{
|
|
10022
|
-
control: form.control,
|
|
10023
|
-
name: "address_2",
|
|
10024
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10025
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
10026
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10027
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10028
|
-
] })
|
|
10029
|
-
}
|
|
10030
|
-
),
|
|
10031
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10032
|
-
/* @__PURE__ */ jsx(
|
|
10033
|
-
Form$2.Field,
|
|
10034
|
-
{
|
|
10035
|
-
control: form.control,
|
|
10036
|
-
name: "postal_code",
|
|
10037
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10038
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
10039
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10040
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10041
|
-
] })
|
|
10042
|
-
}
|
|
10043
|
-
),
|
|
10044
|
-
/* @__PURE__ */ jsx(
|
|
10045
|
-
Form$2.Field,
|
|
10046
|
-
{
|
|
10047
|
-
control: form.control,
|
|
10048
|
-
name: "city",
|
|
10049
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10050
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
10051
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10052
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10053
|
-
] })
|
|
10054
|
-
}
|
|
10055
|
-
)
|
|
10056
|
-
] }),
|
|
10057
|
-
/* @__PURE__ */ jsx(
|
|
10058
|
-
Form$2.Field,
|
|
10059
|
-
{
|
|
10060
|
-
control: form.control,
|
|
10061
|
-
name: "province",
|
|
10062
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10063
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
10064
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10065
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10066
|
-
] })
|
|
10067
|
-
}
|
|
10068
|
-
),
|
|
10069
|
-
/* @__PURE__ */ jsx(
|
|
10070
|
-
Form$2.Field,
|
|
10071
|
-
{
|
|
10072
|
-
control: form.control,
|
|
10073
|
-
name: "phone",
|
|
10074
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
10075
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
10076
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
10077
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
10078
|
-
] })
|
|
10079
|
-
}
|
|
10080
|
-
)
|
|
10081
|
-
] }) }),
|
|
10082
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10083
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10084
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10085
|
-
] }) })
|
|
10086
|
-
]
|
|
10087
|
-
}
|
|
10088
|
-
) });
|
|
10089
|
-
};
|
|
10090
|
-
const schema$5 = addressSchema;
|
|
10091
9901
|
const CustomItems = () => {
|
|
10092
9902
|
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10093
9903
|
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
@@ -10096,7 +9906,7 @@ const CustomItems = () => {
|
|
|
10096
9906
|
};
|
|
10097
9907
|
const CustomItemsForm = () => {
|
|
10098
9908
|
const form = useForm({
|
|
10099
|
-
resolver: zodResolver(schema$
|
|
9909
|
+
resolver: zodResolver(schema$5)
|
|
10100
9910
|
});
|
|
10101
9911
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
10102
9912
|
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
@@ -10106,7 +9916,7 @@ const CustomItemsForm = () => {
|
|
|
10106
9916
|
] }) })
|
|
10107
9917
|
] }) });
|
|
10108
9918
|
};
|
|
10109
|
-
const schema$
|
|
9919
|
+
const schema$5 = object({
|
|
10110
9920
|
email: string().email()
|
|
10111
9921
|
});
|
|
10112
9922
|
const Email = () => {
|
|
@@ -10131,7 +9941,7 @@ const EmailForm = ({ order }) => {
|
|
|
10131
9941
|
defaultValues: {
|
|
10132
9942
|
email: order.email ?? ""
|
|
10133
9943
|
},
|
|
10134
|
-
resolver: zodResolver(schema$
|
|
9944
|
+
resolver: zodResolver(schema$4)
|
|
10135
9945
|
});
|
|
10136
9946
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10137
9947
|
const { handleSuccess } = useRouteModal();
|
|
@@ -10174,7 +9984,7 @@ const EmailForm = ({ order }) => {
|
|
|
10174
9984
|
}
|
|
10175
9985
|
) });
|
|
10176
9986
|
};
|
|
10177
|
-
const schema$
|
|
9987
|
+
const schema$4 = object({
|
|
10178
9988
|
email: string().email()
|
|
10179
9989
|
});
|
|
10180
9990
|
const NumberInput = forwardRef(
|
|
@@ -11806,7 +11616,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11806
11616
|
defaultValues: {
|
|
11807
11617
|
sales_channel_id: order.sales_channel_id || ""
|
|
11808
11618
|
},
|
|
11809
|
-
resolver: zodResolver(schema$
|
|
11619
|
+
resolver: zodResolver(schema$3)
|
|
11810
11620
|
});
|
|
11811
11621
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11812
11622
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11881,7 +11691,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11881
11691
|
}
|
|
11882
11692
|
);
|
|
11883
11693
|
};
|
|
11884
|
-
const schema$
|
|
11694
|
+
const schema$3 = object({
|
|
11885
11695
|
sales_channel_id: string().min(1)
|
|
11886
11696
|
});
|
|
11887
11697
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12723,7 +12533,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12723
12533
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12724
12534
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12725
12535
|
},
|
|
12726
|
-
resolver: zodResolver(schema$
|
|
12536
|
+
resolver: zodResolver(schema$2)
|
|
12727
12537
|
});
|
|
12728
12538
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12729
12539
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12893,7 +12703,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12893
12703
|
}
|
|
12894
12704
|
) });
|
|
12895
12705
|
};
|
|
12896
|
-
const schema$
|
|
12706
|
+
const schema$2 = addressSchema;
|
|
12897
12707
|
const TransferOwnership = () => {
|
|
12898
12708
|
const { id } = useParams();
|
|
12899
12709
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12917,7 +12727,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12917
12727
|
defaultValues: {
|
|
12918
12728
|
customer_id: order.customer_id || ""
|
|
12919
12729
|
},
|
|
12920
|
-
resolver: zodResolver(schema)
|
|
12730
|
+
resolver: zodResolver(schema$1)
|
|
12921
12731
|
});
|
|
12922
12732
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12923
12733
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13367,9 +13177,199 @@ const Illustration = () => {
|
|
|
13367
13177
|
}
|
|
13368
13178
|
);
|
|
13369
13179
|
};
|
|
13370
|
-
const schema = object({
|
|
13180
|
+
const schema$1 = object({
|
|
13371
13181
|
customer_id: string().min(1)
|
|
13372
13182
|
});
|
|
13183
|
+
const BillingAddress = () => {
|
|
13184
|
+
const { id } = useParams();
|
|
13185
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
13186
|
+
fields: "+billing_address"
|
|
13187
|
+
});
|
|
13188
|
+
if (isError) {
|
|
13189
|
+
throw error;
|
|
13190
|
+
}
|
|
13191
|
+
const isReady = !isPending && !!order;
|
|
13192
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
13193
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
13194
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
13195
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
13196
|
+
] }),
|
|
13197
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
13198
|
+
] });
|
|
13199
|
+
};
|
|
13200
|
+
const BillingAddressForm = ({ order }) => {
|
|
13201
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
13202
|
+
const form = useForm({
|
|
13203
|
+
defaultValues: {
|
|
13204
|
+
first_name: ((_a2 = order.billing_address) == null ? void 0 : _a2.first_name) ?? "",
|
|
13205
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
13206
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
13207
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
13208
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
13209
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
13210
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
13211
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
13212
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
13213
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
13214
|
+
},
|
|
13215
|
+
resolver: zodResolver(schema)
|
|
13216
|
+
});
|
|
13217
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
13218
|
+
const { handleSuccess } = useRouteModal();
|
|
13219
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
13220
|
+
await mutateAsync(
|
|
13221
|
+
{ billing_address: data },
|
|
13222
|
+
{
|
|
13223
|
+
onSuccess: () => {
|
|
13224
|
+
handleSuccess();
|
|
13225
|
+
},
|
|
13226
|
+
onError: (error) => {
|
|
13227
|
+
toast.error(error.message);
|
|
13228
|
+
}
|
|
13229
|
+
}
|
|
13230
|
+
);
|
|
13231
|
+
});
|
|
13232
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
13233
|
+
KeyboundForm,
|
|
13234
|
+
{
|
|
13235
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
13236
|
+
onSubmit,
|
|
13237
|
+
children: [
|
|
13238
|
+
/* @__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: [
|
|
13239
|
+
/* @__PURE__ */ jsx(
|
|
13240
|
+
Form$2.Field,
|
|
13241
|
+
{
|
|
13242
|
+
control: form.control,
|
|
13243
|
+
name: "country_code",
|
|
13244
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13245
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
13246
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
13247
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13248
|
+
] })
|
|
13249
|
+
}
|
|
13250
|
+
),
|
|
13251
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
13252
|
+
/* @__PURE__ */ jsx(
|
|
13253
|
+
Form$2.Field,
|
|
13254
|
+
{
|
|
13255
|
+
control: form.control,
|
|
13256
|
+
name: "first_name",
|
|
13257
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13258
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
13259
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13260
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13261
|
+
] })
|
|
13262
|
+
}
|
|
13263
|
+
),
|
|
13264
|
+
/* @__PURE__ */ jsx(
|
|
13265
|
+
Form$2.Field,
|
|
13266
|
+
{
|
|
13267
|
+
control: form.control,
|
|
13268
|
+
name: "last_name",
|
|
13269
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13270
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
13271
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13272
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13273
|
+
] })
|
|
13274
|
+
}
|
|
13275
|
+
)
|
|
13276
|
+
] }),
|
|
13277
|
+
/* @__PURE__ */ jsx(
|
|
13278
|
+
Form$2.Field,
|
|
13279
|
+
{
|
|
13280
|
+
control: form.control,
|
|
13281
|
+
name: "company",
|
|
13282
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13283
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
13284
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13285
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13286
|
+
] })
|
|
13287
|
+
}
|
|
13288
|
+
),
|
|
13289
|
+
/* @__PURE__ */ jsx(
|
|
13290
|
+
Form$2.Field,
|
|
13291
|
+
{
|
|
13292
|
+
control: form.control,
|
|
13293
|
+
name: "address_1",
|
|
13294
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13295
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
13296
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13297
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13298
|
+
] })
|
|
13299
|
+
}
|
|
13300
|
+
),
|
|
13301
|
+
/* @__PURE__ */ jsx(
|
|
13302
|
+
Form$2.Field,
|
|
13303
|
+
{
|
|
13304
|
+
control: form.control,
|
|
13305
|
+
name: "address_2",
|
|
13306
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13307
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
13308
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13309
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13310
|
+
] })
|
|
13311
|
+
}
|
|
13312
|
+
),
|
|
13313
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
13314
|
+
/* @__PURE__ */ jsx(
|
|
13315
|
+
Form$2.Field,
|
|
13316
|
+
{
|
|
13317
|
+
control: form.control,
|
|
13318
|
+
name: "postal_code",
|
|
13319
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13320
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
13321
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13322
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13323
|
+
] })
|
|
13324
|
+
}
|
|
13325
|
+
),
|
|
13326
|
+
/* @__PURE__ */ jsx(
|
|
13327
|
+
Form$2.Field,
|
|
13328
|
+
{
|
|
13329
|
+
control: form.control,
|
|
13330
|
+
name: "city",
|
|
13331
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13332
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13333
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13334
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13335
|
+
] })
|
|
13336
|
+
}
|
|
13337
|
+
)
|
|
13338
|
+
] }),
|
|
13339
|
+
/* @__PURE__ */ jsx(
|
|
13340
|
+
Form$2.Field,
|
|
13341
|
+
{
|
|
13342
|
+
control: form.control,
|
|
13343
|
+
name: "province",
|
|
13344
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13345
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13346
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13347
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13348
|
+
] })
|
|
13349
|
+
}
|
|
13350
|
+
),
|
|
13351
|
+
/* @__PURE__ */ jsx(
|
|
13352
|
+
Form$2.Field,
|
|
13353
|
+
{
|
|
13354
|
+
control: form.control,
|
|
13355
|
+
name: "phone",
|
|
13356
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13357
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13358
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13359
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13360
|
+
] })
|
|
13361
|
+
}
|
|
13362
|
+
)
|
|
13363
|
+
] }) }),
|
|
13364
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13365
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13366
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13367
|
+
] }) })
|
|
13368
|
+
]
|
|
13369
|
+
}
|
|
13370
|
+
) });
|
|
13371
|
+
};
|
|
13372
|
+
const schema = addressSchema;
|
|
13373
13373
|
const widgetModule = { widgets: [] };
|
|
13374
13374
|
const routeModule = {
|
|
13375
13375
|
routes: [
|
|
@@ -13390,10 +13390,6 @@ const routeModule = {
|
|
|
13390
13390
|
handle,
|
|
13391
13391
|
loader,
|
|
13392
13392
|
children: [
|
|
13393
|
-
{
|
|
13394
|
-
Component: BillingAddress,
|
|
13395
|
-
path: "/draft-orders/:id/billing-address"
|
|
13396
|
-
},
|
|
13397
13393
|
{
|
|
13398
13394
|
Component: CustomItems,
|
|
13399
13395
|
path: "/draft-orders/:id/custom-items"
|
|
@@ -13429,6 +13425,10 @@ const routeModule = {
|
|
|
13429
13425
|
{
|
|
13430
13426
|
Component: TransferOwnership,
|
|
13431
13427
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13428
|
+
},
|
|
13429
|
+
{
|
|
13430
|
+
Component: BillingAddress,
|
|
13431
|
+
path: "/draft-orders/:id/billing-address"
|
|
13432
13432
|
}
|
|
13433
13433
|
]
|
|
13434
13434
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "3.0.0-preview-
|
|
3
|
+
"version": "3.0.0-preview-20260630183121",
|
|
4
4
|
"description": "A draft order plugin for Medusa.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@ariakit/react": "^0.4.15",
|
|
47
47
|
"@babel/runtime": "^7.26.10",
|
|
48
48
|
"@hookform/resolvers": "3.4.2",
|
|
49
|
-
"@medusajs/js-sdk": "3.0.0-preview-
|
|
49
|
+
"@medusajs/js-sdk": "3.0.0-preview-20260630183121",
|
|
50
50
|
"@tanstack/react-query": "5.64.2",
|
|
51
51
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
52
52
|
"date-fns": "^3.6.0",
|
|
@@ -57,24 +57,24 @@
|
|
|
57
57
|
"react-hook-form": "7.49.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@medusajs/admin-sdk": "3.0.0-preview-
|
|
61
|
-
"@medusajs/cli": "3.0.0-preview-
|
|
62
|
-
"@medusajs/dashboard": "3.0.0-preview-
|
|
63
|
-
"@medusajs/framework": "3.0.0-preview-
|
|
64
|
-
"@medusajs/icons": "3.0.0-preview-
|
|
65
|
-
"@medusajs/test-utils": "3.0.0-preview-
|
|
66
|
-
"@medusajs/types": "3.0.0-preview-
|
|
67
|
-
"@medusajs/ui": "4.1.19-preview-
|
|
68
|
-
"@medusajs/ui-preset": "3.0.0-preview-
|
|
60
|
+
"@medusajs/admin-sdk": "3.0.0-preview-20260630183121",
|
|
61
|
+
"@medusajs/cli": "3.0.0-preview-20260630183121",
|
|
62
|
+
"@medusajs/dashboard": "3.0.0-preview-20260630183121",
|
|
63
|
+
"@medusajs/framework": "3.0.0-preview-20260630183121",
|
|
64
|
+
"@medusajs/icons": "3.0.0-preview-20260630183121",
|
|
65
|
+
"@medusajs/test-utils": "3.0.0-preview-20260630183121",
|
|
66
|
+
"@medusajs/types": "3.0.0-preview-20260630183121",
|
|
67
|
+
"@medusajs/ui": "4.1.19-preview-20260630183121",
|
|
68
|
+
"@medusajs/ui-preset": "3.0.0-preview-20260630183121"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@medusajs/admin-sdk": "3.0.0-preview-
|
|
72
|
-
"@medusajs/cli": "3.0.0-preview-
|
|
73
|
-
"@medusajs/dashboard": "3.0.0-preview-
|
|
74
|
-
"@medusajs/framework": "3.0.0-preview-
|
|
75
|
-
"@medusajs/icons": "3.0.0-preview-
|
|
76
|
-
"@medusajs/test-utils": "3.0.0-preview-
|
|
77
|
-
"@medusajs/ui": "4.1.19-preview-
|
|
71
|
+
"@medusajs/admin-sdk": "3.0.0-preview-20260630183121",
|
|
72
|
+
"@medusajs/cli": "3.0.0-preview-20260630183121",
|
|
73
|
+
"@medusajs/dashboard": "3.0.0-preview-20260630183121",
|
|
74
|
+
"@medusajs/framework": "3.0.0-preview-20260630183121",
|
|
75
|
+
"@medusajs/icons": "3.0.0-preview-20260630183121",
|
|
76
|
+
"@medusajs/test-utils": "3.0.0-preview-20260630183121",
|
|
77
|
+
"@medusajs/ui": "4.1.19-preview-20260630183121",
|
|
78
78
|
"react": "^18.3.1",
|
|
79
79
|
"react-dom": "^18.3.1",
|
|
80
80
|
"react-router-dom": "6.30.4"
|