@medusajs/draft-order 2.10.2-preview-20250909150158 → 2.10.2-preview-20250909180154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +194 -194
- package/.medusa/server/src/admin/index.mjs +194 -194
- package/package.json +16 -16
|
@@ -11930,6 +11930,196 @@ const Illustration = () => {
|
|
|
11930
11930
|
const schema$1 = objectType({
|
|
11931
11931
|
customer_id: stringType().min(1)
|
|
11932
11932
|
});
|
|
11933
|
+
const BillingAddress = () => {
|
|
11934
|
+
const { id } = reactRouterDom.useParams();
|
|
11935
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11936
|
+
fields: "+billing_address"
|
|
11937
|
+
});
|
|
11938
|
+
if (isError) {
|
|
11939
|
+
throw error;
|
|
11940
|
+
}
|
|
11941
|
+
const isReady = !isPending && !!order;
|
|
11942
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11943
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11944
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
11945
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11946
|
+
] }),
|
|
11947
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
11948
|
+
] });
|
|
11949
|
+
};
|
|
11950
|
+
const BillingAddressForm = ({ order }) => {
|
|
11951
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11952
|
+
const form = reactHookForm.useForm({
|
|
11953
|
+
defaultValues: {
|
|
11954
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11955
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11956
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11957
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11958
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11959
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11960
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11961
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11962
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11963
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11964
|
+
},
|
|
11965
|
+
resolver: zod.zodResolver(schema)
|
|
11966
|
+
});
|
|
11967
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11968
|
+
const { handleSuccess } = useRouteModal();
|
|
11969
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11970
|
+
await mutateAsync(
|
|
11971
|
+
{ billing_address: data },
|
|
11972
|
+
{
|
|
11973
|
+
onSuccess: () => {
|
|
11974
|
+
handleSuccess();
|
|
11975
|
+
},
|
|
11976
|
+
onError: (error) => {
|
|
11977
|
+
ui.toast.error(error.message);
|
|
11978
|
+
}
|
|
11979
|
+
}
|
|
11980
|
+
);
|
|
11981
|
+
});
|
|
11982
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11983
|
+
KeyboundForm,
|
|
11984
|
+
{
|
|
11985
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11986
|
+
onSubmit,
|
|
11987
|
+
children: [
|
|
11988
|
+
/* @__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: [
|
|
11989
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11990
|
+
Form$2.Field,
|
|
11991
|
+
{
|
|
11992
|
+
control: form.control,
|
|
11993
|
+
name: "country_code",
|
|
11994
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11995
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11996
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11997
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11998
|
+
] })
|
|
11999
|
+
}
|
|
12000
|
+
),
|
|
12001
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12002
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12003
|
+
Form$2.Field,
|
|
12004
|
+
{
|
|
12005
|
+
control: form.control,
|
|
12006
|
+
name: "first_name",
|
|
12007
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12008
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12009
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12010
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12011
|
+
] })
|
|
12012
|
+
}
|
|
12013
|
+
),
|
|
12014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12015
|
+
Form$2.Field,
|
|
12016
|
+
{
|
|
12017
|
+
control: form.control,
|
|
12018
|
+
name: "last_name",
|
|
12019
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12020
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12021
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12022
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12023
|
+
] })
|
|
12024
|
+
}
|
|
12025
|
+
)
|
|
12026
|
+
] }),
|
|
12027
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12028
|
+
Form$2.Field,
|
|
12029
|
+
{
|
|
12030
|
+
control: form.control,
|
|
12031
|
+
name: "company",
|
|
12032
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12033
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12034
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12035
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12036
|
+
] })
|
|
12037
|
+
}
|
|
12038
|
+
),
|
|
12039
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12040
|
+
Form$2.Field,
|
|
12041
|
+
{
|
|
12042
|
+
control: form.control,
|
|
12043
|
+
name: "address_1",
|
|
12044
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12045
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12046
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12047
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12048
|
+
] })
|
|
12049
|
+
}
|
|
12050
|
+
),
|
|
12051
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12052
|
+
Form$2.Field,
|
|
12053
|
+
{
|
|
12054
|
+
control: form.control,
|
|
12055
|
+
name: "address_2",
|
|
12056
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12057
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12058
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12059
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12060
|
+
] })
|
|
12061
|
+
}
|
|
12062
|
+
),
|
|
12063
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12065
|
+
Form$2.Field,
|
|
12066
|
+
{
|
|
12067
|
+
control: form.control,
|
|
12068
|
+
name: "postal_code",
|
|
12069
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12070
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12071
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12072
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12073
|
+
] })
|
|
12074
|
+
}
|
|
12075
|
+
),
|
|
12076
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12077
|
+
Form$2.Field,
|
|
12078
|
+
{
|
|
12079
|
+
control: form.control,
|
|
12080
|
+
name: "city",
|
|
12081
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12082
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12083
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12084
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12085
|
+
] })
|
|
12086
|
+
}
|
|
12087
|
+
)
|
|
12088
|
+
] }),
|
|
12089
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12090
|
+
Form$2.Field,
|
|
12091
|
+
{
|
|
12092
|
+
control: form.control,
|
|
12093
|
+
name: "province",
|
|
12094
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12095
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12096
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12097
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12098
|
+
] })
|
|
12099
|
+
}
|
|
12100
|
+
),
|
|
12101
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12102
|
+
Form$2.Field,
|
|
12103
|
+
{
|
|
12104
|
+
control: form.control,
|
|
12105
|
+
name: "phone",
|
|
12106
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12107
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12108
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12109
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12110
|
+
] })
|
|
12111
|
+
}
|
|
12112
|
+
)
|
|
12113
|
+
] }) }),
|
|
12114
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12115
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12116
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12117
|
+
] }) })
|
|
12118
|
+
]
|
|
12119
|
+
}
|
|
12120
|
+
) });
|
|
12121
|
+
};
|
|
12122
|
+
const schema = addressSchema;
|
|
11933
12123
|
const NumberInput = React.forwardRef(
|
|
11934
12124
|
({
|
|
11935
12125
|
value,
|
|
@@ -12855,196 +13045,6 @@ const customItemSchema = objectType({
|
|
|
12855
13045
|
quantity: numberType(),
|
|
12856
13046
|
unit_price: unionType([numberType(), stringType()])
|
|
12857
13047
|
});
|
|
12858
|
-
const BillingAddress = () => {
|
|
12859
|
-
const { id } = reactRouterDom.useParams();
|
|
12860
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12861
|
-
fields: "+billing_address"
|
|
12862
|
-
});
|
|
12863
|
-
if (isError) {
|
|
12864
|
-
throw error;
|
|
12865
|
-
}
|
|
12866
|
-
const isReady = !isPending && !!order;
|
|
12867
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12868
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12869
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
12870
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12871
|
-
] }),
|
|
12872
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12873
|
-
] });
|
|
12874
|
-
};
|
|
12875
|
-
const BillingAddressForm = ({ order }) => {
|
|
12876
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12877
|
-
const form = reactHookForm.useForm({
|
|
12878
|
-
defaultValues: {
|
|
12879
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12880
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12881
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12882
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12883
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12884
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12885
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12886
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12887
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12888
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12889
|
-
},
|
|
12890
|
-
resolver: zod.zodResolver(schema)
|
|
12891
|
-
});
|
|
12892
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12893
|
-
const { handleSuccess } = useRouteModal();
|
|
12894
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12895
|
-
await mutateAsync(
|
|
12896
|
-
{ billing_address: data },
|
|
12897
|
-
{
|
|
12898
|
-
onSuccess: () => {
|
|
12899
|
-
handleSuccess();
|
|
12900
|
-
},
|
|
12901
|
-
onError: (error) => {
|
|
12902
|
-
ui.toast.error(error.message);
|
|
12903
|
-
}
|
|
12904
|
-
}
|
|
12905
|
-
);
|
|
12906
|
-
});
|
|
12907
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12908
|
-
KeyboundForm,
|
|
12909
|
-
{
|
|
12910
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12911
|
-
onSubmit,
|
|
12912
|
-
children: [
|
|
12913
|
-
/* @__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: [
|
|
12914
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12915
|
-
Form$2.Field,
|
|
12916
|
-
{
|
|
12917
|
-
control: form.control,
|
|
12918
|
-
name: "country_code",
|
|
12919
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12920
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12921
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12922
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12923
|
-
] })
|
|
12924
|
-
}
|
|
12925
|
-
),
|
|
12926
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12927
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12928
|
-
Form$2.Field,
|
|
12929
|
-
{
|
|
12930
|
-
control: form.control,
|
|
12931
|
-
name: "first_name",
|
|
12932
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12933
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12934
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12935
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12936
|
-
] })
|
|
12937
|
-
}
|
|
12938
|
-
),
|
|
12939
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12940
|
-
Form$2.Field,
|
|
12941
|
-
{
|
|
12942
|
-
control: form.control,
|
|
12943
|
-
name: "last_name",
|
|
12944
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12945
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12946
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12947
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12948
|
-
] })
|
|
12949
|
-
}
|
|
12950
|
-
)
|
|
12951
|
-
] }),
|
|
12952
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12953
|
-
Form$2.Field,
|
|
12954
|
-
{
|
|
12955
|
-
control: form.control,
|
|
12956
|
-
name: "company",
|
|
12957
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12958
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12959
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12960
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12961
|
-
] })
|
|
12962
|
-
}
|
|
12963
|
-
),
|
|
12964
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12965
|
-
Form$2.Field,
|
|
12966
|
-
{
|
|
12967
|
-
control: form.control,
|
|
12968
|
-
name: "address_1",
|
|
12969
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12970
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12971
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12972
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12973
|
-
] })
|
|
12974
|
-
}
|
|
12975
|
-
),
|
|
12976
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12977
|
-
Form$2.Field,
|
|
12978
|
-
{
|
|
12979
|
-
control: form.control,
|
|
12980
|
-
name: "address_2",
|
|
12981
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12982
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12983
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12984
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12985
|
-
] })
|
|
12986
|
-
}
|
|
12987
|
-
),
|
|
12988
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12989
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12990
|
-
Form$2.Field,
|
|
12991
|
-
{
|
|
12992
|
-
control: form.control,
|
|
12993
|
-
name: "postal_code",
|
|
12994
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12995
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12996
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12997
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12998
|
-
] })
|
|
12999
|
-
}
|
|
13000
|
-
),
|
|
13001
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13002
|
-
Form$2.Field,
|
|
13003
|
-
{
|
|
13004
|
-
control: form.control,
|
|
13005
|
-
name: "city",
|
|
13006
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13007
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
13008
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13009
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13010
|
-
] })
|
|
13011
|
-
}
|
|
13012
|
-
)
|
|
13013
|
-
] }),
|
|
13014
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13015
|
-
Form$2.Field,
|
|
13016
|
-
{
|
|
13017
|
-
control: form.control,
|
|
13018
|
-
name: "province",
|
|
13019
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13020
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13021
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13022
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13023
|
-
] })
|
|
13024
|
-
}
|
|
13025
|
-
),
|
|
13026
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13027
|
-
Form$2.Field,
|
|
13028
|
-
{
|
|
13029
|
-
control: form.control,
|
|
13030
|
-
name: "phone",
|
|
13031
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13032
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13033
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13034
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13035
|
-
] })
|
|
13036
|
-
}
|
|
13037
|
-
)
|
|
13038
|
-
] }) }),
|
|
13039
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13040
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13041
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13042
|
-
] }) })
|
|
13043
|
-
]
|
|
13044
|
-
}
|
|
13045
|
-
) });
|
|
13046
|
-
};
|
|
13047
|
-
const schema = addressSchema;
|
|
13048
13048
|
const widgetModule = { widgets: [] };
|
|
13049
13049
|
const routeModule = {
|
|
13050
13050
|
routes: [
|
|
@@ -13097,13 +13097,13 @@ const routeModule = {
|
|
|
13097
13097
|
Component: TransferOwnership,
|
|
13098
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13099
13099
|
},
|
|
13100
|
-
{
|
|
13101
|
-
Component: Items,
|
|
13102
|
-
path: "/draft-orders/:id/items"
|
|
13103
|
-
},
|
|
13104
13100
|
{
|
|
13105
13101
|
Component: BillingAddress,
|
|
13106
13102
|
path: "/draft-orders/:id/billing-address"
|
|
13103
|
+
},
|
|
13104
|
+
{
|
|
13105
|
+
Component: Items,
|
|
13106
|
+
path: "/draft-orders/:id/items"
|
|
13107
13107
|
}
|
|
13108
13108
|
]
|
|
13109
13109
|
}
|
|
@@ -11924,6 +11924,196 @@ const Illustration = () => {
|
|
|
11924
11924
|
const schema$1 = objectType({
|
|
11925
11925
|
customer_id: stringType().min(1)
|
|
11926
11926
|
});
|
|
11927
|
+
const BillingAddress = () => {
|
|
11928
|
+
const { id } = useParams();
|
|
11929
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11930
|
+
fields: "+billing_address"
|
|
11931
|
+
});
|
|
11932
|
+
if (isError) {
|
|
11933
|
+
throw error;
|
|
11934
|
+
}
|
|
11935
|
+
const isReady = !isPending && !!order;
|
|
11936
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11937
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11938
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
11939
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11940
|
+
] }),
|
|
11941
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
11942
|
+
] });
|
|
11943
|
+
};
|
|
11944
|
+
const BillingAddressForm = ({ order }) => {
|
|
11945
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11946
|
+
const form = useForm({
|
|
11947
|
+
defaultValues: {
|
|
11948
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11949
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11950
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11951
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11952
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11953
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11954
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11955
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11956
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11957
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11958
|
+
},
|
|
11959
|
+
resolver: zodResolver(schema)
|
|
11960
|
+
});
|
|
11961
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11962
|
+
const { handleSuccess } = useRouteModal();
|
|
11963
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11964
|
+
await mutateAsync(
|
|
11965
|
+
{ billing_address: data },
|
|
11966
|
+
{
|
|
11967
|
+
onSuccess: () => {
|
|
11968
|
+
handleSuccess();
|
|
11969
|
+
},
|
|
11970
|
+
onError: (error) => {
|
|
11971
|
+
toast.error(error.message);
|
|
11972
|
+
}
|
|
11973
|
+
}
|
|
11974
|
+
);
|
|
11975
|
+
});
|
|
11976
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11977
|
+
KeyboundForm,
|
|
11978
|
+
{
|
|
11979
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11980
|
+
onSubmit,
|
|
11981
|
+
children: [
|
|
11982
|
+
/* @__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: [
|
|
11983
|
+
/* @__PURE__ */ jsx(
|
|
11984
|
+
Form$2.Field,
|
|
11985
|
+
{
|
|
11986
|
+
control: form.control,
|
|
11987
|
+
name: "country_code",
|
|
11988
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11989
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11990
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11991
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11992
|
+
] })
|
|
11993
|
+
}
|
|
11994
|
+
),
|
|
11995
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11996
|
+
/* @__PURE__ */ jsx(
|
|
11997
|
+
Form$2.Field,
|
|
11998
|
+
{
|
|
11999
|
+
control: form.control,
|
|
12000
|
+
name: "first_name",
|
|
12001
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12002
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12003
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12004
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12005
|
+
] })
|
|
12006
|
+
}
|
|
12007
|
+
),
|
|
12008
|
+
/* @__PURE__ */ jsx(
|
|
12009
|
+
Form$2.Field,
|
|
12010
|
+
{
|
|
12011
|
+
control: form.control,
|
|
12012
|
+
name: "last_name",
|
|
12013
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12014
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12015
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12016
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12017
|
+
] })
|
|
12018
|
+
}
|
|
12019
|
+
)
|
|
12020
|
+
] }),
|
|
12021
|
+
/* @__PURE__ */ jsx(
|
|
12022
|
+
Form$2.Field,
|
|
12023
|
+
{
|
|
12024
|
+
control: form.control,
|
|
12025
|
+
name: "company",
|
|
12026
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12027
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12028
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12029
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12030
|
+
] })
|
|
12031
|
+
}
|
|
12032
|
+
),
|
|
12033
|
+
/* @__PURE__ */ jsx(
|
|
12034
|
+
Form$2.Field,
|
|
12035
|
+
{
|
|
12036
|
+
control: form.control,
|
|
12037
|
+
name: "address_1",
|
|
12038
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12039
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12040
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12041
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12042
|
+
] })
|
|
12043
|
+
}
|
|
12044
|
+
),
|
|
12045
|
+
/* @__PURE__ */ jsx(
|
|
12046
|
+
Form$2.Field,
|
|
12047
|
+
{
|
|
12048
|
+
control: form.control,
|
|
12049
|
+
name: "address_2",
|
|
12050
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12051
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12052
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12053
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12054
|
+
] })
|
|
12055
|
+
}
|
|
12056
|
+
),
|
|
12057
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12058
|
+
/* @__PURE__ */ jsx(
|
|
12059
|
+
Form$2.Field,
|
|
12060
|
+
{
|
|
12061
|
+
control: form.control,
|
|
12062
|
+
name: "postal_code",
|
|
12063
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12064
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12065
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12066
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12067
|
+
] })
|
|
12068
|
+
}
|
|
12069
|
+
),
|
|
12070
|
+
/* @__PURE__ */ jsx(
|
|
12071
|
+
Form$2.Field,
|
|
12072
|
+
{
|
|
12073
|
+
control: form.control,
|
|
12074
|
+
name: "city",
|
|
12075
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12076
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12077
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12078
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12079
|
+
] })
|
|
12080
|
+
}
|
|
12081
|
+
)
|
|
12082
|
+
] }),
|
|
12083
|
+
/* @__PURE__ */ jsx(
|
|
12084
|
+
Form$2.Field,
|
|
12085
|
+
{
|
|
12086
|
+
control: form.control,
|
|
12087
|
+
name: "province",
|
|
12088
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12089
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12090
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12091
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12092
|
+
] })
|
|
12093
|
+
}
|
|
12094
|
+
),
|
|
12095
|
+
/* @__PURE__ */ jsx(
|
|
12096
|
+
Form$2.Field,
|
|
12097
|
+
{
|
|
12098
|
+
control: form.control,
|
|
12099
|
+
name: "phone",
|
|
12100
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12101
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12102
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12103
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12104
|
+
] })
|
|
12105
|
+
}
|
|
12106
|
+
)
|
|
12107
|
+
] }) }),
|
|
12108
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12109
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12110
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12111
|
+
] }) })
|
|
12112
|
+
]
|
|
12113
|
+
}
|
|
12114
|
+
) });
|
|
12115
|
+
};
|
|
12116
|
+
const schema = addressSchema;
|
|
11927
12117
|
const NumberInput = forwardRef(
|
|
11928
12118
|
({
|
|
11929
12119
|
value,
|
|
@@ -12849,196 +13039,6 @@ const customItemSchema = objectType({
|
|
|
12849
13039
|
quantity: numberType(),
|
|
12850
13040
|
unit_price: unionType([numberType(), stringType()])
|
|
12851
13041
|
});
|
|
12852
|
-
const BillingAddress = () => {
|
|
12853
|
-
const { id } = useParams();
|
|
12854
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12855
|
-
fields: "+billing_address"
|
|
12856
|
-
});
|
|
12857
|
-
if (isError) {
|
|
12858
|
-
throw error;
|
|
12859
|
-
}
|
|
12860
|
-
const isReady = !isPending && !!order;
|
|
12861
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12862
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12863
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12864
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12865
|
-
] }),
|
|
12866
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12867
|
-
] });
|
|
12868
|
-
};
|
|
12869
|
-
const BillingAddressForm = ({ order }) => {
|
|
12870
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12871
|
-
const form = useForm({
|
|
12872
|
-
defaultValues: {
|
|
12873
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12874
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12875
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12876
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12877
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12878
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12879
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12880
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12881
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12882
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12883
|
-
},
|
|
12884
|
-
resolver: zodResolver(schema)
|
|
12885
|
-
});
|
|
12886
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12887
|
-
const { handleSuccess } = useRouteModal();
|
|
12888
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12889
|
-
await mutateAsync(
|
|
12890
|
-
{ billing_address: data },
|
|
12891
|
-
{
|
|
12892
|
-
onSuccess: () => {
|
|
12893
|
-
handleSuccess();
|
|
12894
|
-
},
|
|
12895
|
-
onError: (error) => {
|
|
12896
|
-
toast.error(error.message);
|
|
12897
|
-
}
|
|
12898
|
-
}
|
|
12899
|
-
);
|
|
12900
|
-
});
|
|
12901
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12902
|
-
KeyboundForm,
|
|
12903
|
-
{
|
|
12904
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12905
|
-
onSubmit,
|
|
12906
|
-
children: [
|
|
12907
|
-
/* @__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: [
|
|
12908
|
-
/* @__PURE__ */ jsx(
|
|
12909
|
-
Form$2.Field,
|
|
12910
|
-
{
|
|
12911
|
-
control: form.control,
|
|
12912
|
-
name: "country_code",
|
|
12913
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12914
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12915
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12916
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12917
|
-
] })
|
|
12918
|
-
}
|
|
12919
|
-
),
|
|
12920
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12921
|
-
/* @__PURE__ */ jsx(
|
|
12922
|
-
Form$2.Field,
|
|
12923
|
-
{
|
|
12924
|
-
control: form.control,
|
|
12925
|
-
name: "first_name",
|
|
12926
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12927
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12928
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12929
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12930
|
-
] })
|
|
12931
|
-
}
|
|
12932
|
-
),
|
|
12933
|
-
/* @__PURE__ */ jsx(
|
|
12934
|
-
Form$2.Field,
|
|
12935
|
-
{
|
|
12936
|
-
control: form.control,
|
|
12937
|
-
name: "last_name",
|
|
12938
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12939
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12940
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12941
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12942
|
-
] })
|
|
12943
|
-
}
|
|
12944
|
-
)
|
|
12945
|
-
] }),
|
|
12946
|
-
/* @__PURE__ */ jsx(
|
|
12947
|
-
Form$2.Field,
|
|
12948
|
-
{
|
|
12949
|
-
control: form.control,
|
|
12950
|
-
name: "company",
|
|
12951
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12952
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12953
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12954
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12955
|
-
] })
|
|
12956
|
-
}
|
|
12957
|
-
),
|
|
12958
|
-
/* @__PURE__ */ jsx(
|
|
12959
|
-
Form$2.Field,
|
|
12960
|
-
{
|
|
12961
|
-
control: form.control,
|
|
12962
|
-
name: "address_1",
|
|
12963
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12964
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12965
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12966
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12967
|
-
] })
|
|
12968
|
-
}
|
|
12969
|
-
),
|
|
12970
|
-
/* @__PURE__ */ jsx(
|
|
12971
|
-
Form$2.Field,
|
|
12972
|
-
{
|
|
12973
|
-
control: form.control,
|
|
12974
|
-
name: "address_2",
|
|
12975
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12976
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12977
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12978
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12979
|
-
] })
|
|
12980
|
-
}
|
|
12981
|
-
),
|
|
12982
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12983
|
-
/* @__PURE__ */ jsx(
|
|
12984
|
-
Form$2.Field,
|
|
12985
|
-
{
|
|
12986
|
-
control: form.control,
|
|
12987
|
-
name: "postal_code",
|
|
12988
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12989
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12990
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12991
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12992
|
-
] })
|
|
12993
|
-
}
|
|
12994
|
-
),
|
|
12995
|
-
/* @__PURE__ */ jsx(
|
|
12996
|
-
Form$2.Field,
|
|
12997
|
-
{
|
|
12998
|
-
control: form.control,
|
|
12999
|
-
name: "city",
|
|
13000
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13001
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13002
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13003
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13004
|
-
] })
|
|
13005
|
-
}
|
|
13006
|
-
)
|
|
13007
|
-
] }),
|
|
13008
|
-
/* @__PURE__ */ jsx(
|
|
13009
|
-
Form$2.Field,
|
|
13010
|
-
{
|
|
13011
|
-
control: form.control,
|
|
13012
|
-
name: "province",
|
|
13013
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13014
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13015
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13016
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13017
|
-
] })
|
|
13018
|
-
}
|
|
13019
|
-
),
|
|
13020
|
-
/* @__PURE__ */ jsx(
|
|
13021
|
-
Form$2.Field,
|
|
13022
|
-
{
|
|
13023
|
-
control: form.control,
|
|
13024
|
-
name: "phone",
|
|
13025
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13026
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13027
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13028
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13029
|
-
] })
|
|
13030
|
-
}
|
|
13031
|
-
)
|
|
13032
|
-
] }) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13034
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13035
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13036
|
-
] }) })
|
|
13037
|
-
]
|
|
13038
|
-
}
|
|
13039
|
-
) });
|
|
13040
|
-
};
|
|
13041
|
-
const schema = addressSchema;
|
|
13042
13042
|
const widgetModule = { widgets: [] };
|
|
13043
13043
|
const routeModule = {
|
|
13044
13044
|
routes: [
|
|
@@ -13091,13 +13091,13 @@ const routeModule = {
|
|
|
13091
13091
|
Component: TransferOwnership,
|
|
13092
13092
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13093
13093
|
},
|
|
13094
|
-
{
|
|
13095
|
-
Component: Items,
|
|
13096
|
-
path: "/draft-orders/:id/items"
|
|
13097
|
-
},
|
|
13098
13094
|
{
|
|
13099
13095
|
Component: BillingAddress,
|
|
13100
13096
|
path: "/draft-orders/:id/billing-address"
|
|
13097
|
+
},
|
|
13098
|
+
{
|
|
13099
|
+
Component: Items,
|
|
13100
|
+
path: "/draft-orders/:id/items"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.10.2-preview-
|
|
3
|
+
"version": "2.10.2-preview-20250909180154",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.10.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.10.2-preview-20250909180154",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.10.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
53
|
-
"@medusajs/types": "2.10.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.10.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250909180154",
|
|
49
|
+
"@medusajs/cli": "2.10.2-preview-20250909180154",
|
|
50
|
+
"@medusajs/framework": "2.10.2-preview-20250909180154",
|
|
51
|
+
"@medusajs/icons": "2.10.2-preview-20250909180154",
|
|
52
|
+
"@medusajs/test-utils": "2.10.2-preview-20250909180154",
|
|
53
|
+
"@medusajs/types": "2.10.2-preview-20250909180154",
|
|
54
|
+
"@medusajs/ui": "4.0.22-preview-20250909180154",
|
|
55
|
+
"@medusajs/ui-preset": "2.10.2-preview-20250909180154",
|
|
56
56
|
"@mikro-orm/cli": "6.5.2",
|
|
57
57
|
"@mikro-orm/core": "6.5.2",
|
|
58
58
|
"@mikro-orm/knex": "6.5.2",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"yalc": "^1.0.0-pre.53"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@medusajs/admin-sdk": "2.10.2-preview-
|
|
80
|
-
"@medusajs/cli": "2.10.2-preview-
|
|
81
|
-
"@medusajs/framework": "2.10.2-preview-
|
|
82
|
-
"@medusajs/icons": "2.10.2-preview-
|
|
83
|
-
"@medusajs/test-utils": "2.10.2-preview-
|
|
84
|
-
"@medusajs/ui": "4.0.22-preview-
|
|
79
|
+
"@medusajs/admin-sdk": "2.10.2-preview-20250909180154",
|
|
80
|
+
"@medusajs/cli": "2.10.2-preview-20250909180154",
|
|
81
|
+
"@medusajs/framework": "2.10.2-preview-20250909180154",
|
|
82
|
+
"@medusajs/icons": "2.10.2-preview-20250909180154",
|
|
83
|
+
"@medusajs/test-utils": "2.10.2-preview-20250909180154",
|
|
84
|
+
"@medusajs/ui": "4.0.22-preview-20250909180154",
|
|
85
85
|
"@mikro-orm/cli": "6.5.2",
|
|
86
86
|
"@mikro-orm/core": "6.5.2",
|
|
87
87
|
"@mikro-orm/knex": "6.5.2",
|