@medusajs/draft-order 2.11.2-preview-20251026000331 → 2.11.2-preview-20251026031918
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 +200 -200
- package/.medusa/server/src/admin/index.mjs +200 -200
- package/package.json +16 -16
|
@@ -10984,196 +10984,6 @@ function getHasUneditableRows(metadata) {
|
|
|
10984
10984
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10985
10985
|
);
|
|
10986
10986
|
}
|
|
10987
|
-
const BillingAddress = () => {
|
|
10988
|
-
const { id } = reactRouterDom.useParams();
|
|
10989
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10990
|
-
fields: "+billing_address"
|
|
10991
|
-
});
|
|
10992
|
-
if (isError) {
|
|
10993
|
-
throw error;
|
|
10994
|
-
}
|
|
10995
|
-
const isReady = !isPending && !!order;
|
|
10996
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10997
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
10998
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
10999
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
11000
|
-
] }),
|
|
11001
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
11002
|
-
] });
|
|
11003
|
-
};
|
|
11004
|
-
const BillingAddressForm = ({ order }) => {
|
|
11005
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11006
|
-
const form = reactHookForm.useForm({
|
|
11007
|
-
defaultValues: {
|
|
11008
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11009
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11010
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11011
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11012
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11013
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11014
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11015
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11016
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11017
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11018
|
-
},
|
|
11019
|
-
resolver: zod.zodResolver(schema$3)
|
|
11020
|
-
});
|
|
11021
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11022
|
-
const { handleSuccess } = useRouteModal();
|
|
11023
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11024
|
-
await mutateAsync(
|
|
11025
|
-
{ billing_address: data },
|
|
11026
|
-
{
|
|
11027
|
-
onSuccess: () => {
|
|
11028
|
-
handleSuccess();
|
|
11029
|
-
},
|
|
11030
|
-
onError: (error) => {
|
|
11031
|
-
ui.toast.error(error.message);
|
|
11032
|
-
}
|
|
11033
|
-
}
|
|
11034
|
-
);
|
|
11035
|
-
});
|
|
11036
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11037
|
-
KeyboundForm,
|
|
11038
|
-
{
|
|
11039
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11040
|
-
onSubmit,
|
|
11041
|
-
children: [
|
|
11042
|
-
/* @__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: [
|
|
11043
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11044
|
-
Form$2.Field,
|
|
11045
|
-
{
|
|
11046
|
-
control: form.control,
|
|
11047
|
-
name: "country_code",
|
|
11048
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11049
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11050
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11051
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11052
|
-
] })
|
|
11053
|
-
}
|
|
11054
|
-
),
|
|
11055
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11056
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11057
|
-
Form$2.Field,
|
|
11058
|
-
{
|
|
11059
|
-
control: form.control,
|
|
11060
|
-
name: "first_name",
|
|
11061
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11062
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11063
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11064
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11065
|
-
] })
|
|
11066
|
-
}
|
|
11067
|
-
),
|
|
11068
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11069
|
-
Form$2.Field,
|
|
11070
|
-
{
|
|
11071
|
-
control: form.control,
|
|
11072
|
-
name: "last_name",
|
|
11073
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11074
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11075
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11076
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11077
|
-
] })
|
|
11078
|
-
}
|
|
11079
|
-
)
|
|
11080
|
-
] }),
|
|
11081
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11082
|
-
Form$2.Field,
|
|
11083
|
-
{
|
|
11084
|
-
control: form.control,
|
|
11085
|
-
name: "company",
|
|
11086
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11087
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11088
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11089
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11090
|
-
] })
|
|
11091
|
-
}
|
|
11092
|
-
),
|
|
11093
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11094
|
-
Form$2.Field,
|
|
11095
|
-
{
|
|
11096
|
-
control: form.control,
|
|
11097
|
-
name: "address_1",
|
|
11098
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11099
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11100
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11101
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11102
|
-
] })
|
|
11103
|
-
}
|
|
11104
|
-
),
|
|
11105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11106
|
-
Form$2.Field,
|
|
11107
|
-
{
|
|
11108
|
-
control: form.control,
|
|
11109
|
-
name: "address_2",
|
|
11110
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11111
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11112
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11113
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11114
|
-
] })
|
|
11115
|
-
}
|
|
11116
|
-
),
|
|
11117
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11118
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11119
|
-
Form$2.Field,
|
|
11120
|
-
{
|
|
11121
|
-
control: form.control,
|
|
11122
|
-
name: "postal_code",
|
|
11123
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11124
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11125
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11126
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11127
|
-
] })
|
|
11128
|
-
}
|
|
11129
|
-
),
|
|
11130
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11131
|
-
Form$2.Field,
|
|
11132
|
-
{
|
|
11133
|
-
control: form.control,
|
|
11134
|
-
name: "city",
|
|
11135
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11136
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11137
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11138
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11139
|
-
] })
|
|
11140
|
-
}
|
|
11141
|
-
)
|
|
11142
|
-
] }),
|
|
11143
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11144
|
-
Form$2.Field,
|
|
11145
|
-
{
|
|
11146
|
-
control: form.control,
|
|
11147
|
-
name: "province",
|
|
11148
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11149
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11150
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11151
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11152
|
-
] })
|
|
11153
|
-
}
|
|
11154
|
-
),
|
|
11155
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11156
|
-
Form$2.Field,
|
|
11157
|
-
{
|
|
11158
|
-
control: form.control,
|
|
11159
|
-
name: "phone",
|
|
11160
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11161
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11162
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11163
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11164
|
-
] })
|
|
11165
|
-
}
|
|
11166
|
-
)
|
|
11167
|
-
] }) }),
|
|
11168
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11169
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11170
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11171
|
-
] }) })
|
|
11172
|
-
]
|
|
11173
|
-
}
|
|
11174
|
-
) });
|
|
11175
|
-
};
|
|
11176
|
-
const schema$3 = addressSchema;
|
|
11177
10987
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11178
10988
|
const promotionsQueryKeys = {
|
|
11179
10989
|
list: (query2) => [
|
|
@@ -11479,7 +11289,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11479
11289
|
defaultValues: {
|
|
11480
11290
|
sales_channel_id: order.sales_channel_id || ""
|
|
11481
11291
|
},
|
|
11482
|
-
resolver: zod.zodResolver(schema$
|
|
11292
|
+
resolver: zod.zodResolver(schema$3)
|
|
11483
11293
|
});
|
|
11484
11294
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11485
11295
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11554,7 +11364,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11554
11364
|
}
|
|
11555
11365
|
);
|
|
11556
11366
|
};
|
|
11557
|
-
const schema$
|
|
11367
|
+
const schema$3 = objectType({
|
|
11558
11368
|
sales_channel_id: stringType().min(1)
|
|
11559
11369
|
});
|
|
11560
11370
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12396,7 +12206,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12396
12206
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12397
12207
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12398
12208
|
},
|
|
12399
|
-
resolver: zod.zodResolver(schema$
|
|
12209
|
+
resolver: zod.zodResolver(schema$2)
|
|
12400
12210
|
});
|
|
12401
12211
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12402
12212
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12566,7 +12376,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12566
12376
|
}
|
|
12567
12377
|
) });
|
|
12568
12378
|
};
|
|
12569
|
-
const schema$
|
|
12379
|
+
const schema$2 = addressSchema;
|
|
12570
12380
|
const TransferOwnership = () => {
|
|
12571
12381
|
const { id } = reactRouterDom.useParams();
|
|
12572
12382
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12590,7 +12400,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12590
12400
|
defaultValues: {
|
|
12591
12401
|
customer_id: order.customer_id || ""
|
|
12592
12402
|
},
|
|
12593
|
-
resolver: zod.zodResolver(schema)
|
|
12403
|
+
resolver: zod.zodResolver(schema$1)
|
|
12594
12404
|
});
|
|
12595
12405
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12596
12406
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13040,9 +12850,199 @@ const Illustration = () => {
|
|
|
13040
12850
|
}
|
|
13041
12851
|
);
|
|
13042
12852
|
};
|
|
13043
|
-
const schema = objectType({
|
|
12853
|
+
const schema$1 = objectType({
|
|
13044
12854
|
customer_id: stringType().min(1)
|
|
13045
12855
|
});
|
|
12856
|
+
const BillingAddress = () => {
|
|
12857
|
+
const { id } = reactRouterDom.useParams();
|
|
12858
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12859
|
+
fields: "+billing_address"
|
|
12860
|
+
});
|
|
12861
|
+
if (isError) {
|
|
12862
|
+
throw error;
|
|
12863
|
+
}
|
|
12864
|
+
const isReady = !isPending && !!order;
|
|
12865
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12866
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12867
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
12868
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12869
|
+
] }),
|
|
12870
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
12871
|
+
] });
|
|
12872
|
+
};
|
|
12873
|
+
const BillingAddressForm = ({ order }) => {
|
|
12874
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12875
|
+
const form = reactHookForm.useForm({
|
|
12876
|
+
defaultValues: {
|
|
12877
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12878
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12879
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12880
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12881
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12882
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12883
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12884
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12885
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12886
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12887
|
+
},
|
|
12888
|
+
resolver: zod.zodResolver(schema)
|
|
12889
|
+
});
|
|
12890
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12891
|
+
const { handleSuccess } = useRouteModal();
|
|
12892
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12893
|
+
await mutateAsync(
|
|
12894
|
+
{ billing_address: data },
|
|
12895
|
+
{
|
|
12896
|
+
onSuccess: () => {
|
|
12897
|
+
handleSuccess();
|
|
12898
|
+
},
|
|
12899
|
+
onError: (error) => {
|
|
12900
|
+
ui.toast.error(error.message);
|
|
12901
|
+
}
|
|
12902
|
+
}
|
|
12903
|
+
);
|
|
12904
|
+
});
|
|
12905
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12906
|
+
KeyboundForm,
|
|
12907
|
+
{
|
|
12908
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12909
|
+
onSubmit,
|
|
12910
|
+
children: [
|
|
12911
|
+
/* @__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: [
|
|
12912
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12913
|
+
Form$2.Field,
|
|
12914
|
+
{
|
|
12915
|
+
control: form.control,
|
|
12916
|
+
name: "country_code",
|
|
12917
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12918
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12919
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12920
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12921
|
+
] })
|
|
12922
|
+
}
|
|
12923
|
+
),
|
|
12924
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12925
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12926
|
+
Form$2.Field,
|
|
12927
|
+
{
|
|
12928
|
+
control: form.control,
|
|
12929
|
+
name: "first_name",
|
|
12930
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12931
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12932
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12933
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12934
|
+
] })
|
|
12935
|
+
}
|
|
12936
|
+
),
|
|
12937
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12938
|
+
Form$2.Field,
|
|
12939
|
+
{
|
|
12940
|
+
control: form.control,
|
|
12941
|
+
name: "last_name",
|
|
12942
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12943
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12944
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12945
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12946
|
+
] })
|
|
12947
|
+
}
|
|
12948
|
+
)
|
|
12949
|
+
] }),
|
|
12950
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12951
|
+
Form$2.Field,
|
|
12952
|
+
{
|
|
12953
|
+
control: form.control,
|
|
12954
|
+
name: "company",
|
|
12955
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12956
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12957
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12958
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12959
|
+
] })
|
|
12960
|
+
}
|
|
12961
|
+
),
|
|
12962
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12963
|
+
Form$2.Field,
|
|
12964
|
+
{
|
|
12965
|
+
control: form.control,
|
|
12966
|
+
name: "address_1",
|
|
12967
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12968
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12969
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12970
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12971
|
+
] })
|
|
12972
|
+
}
|
|
12973
|
+
),
|
|
12974
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12975
|
+
Form$2.Field,
|
|
12976
|
+
{
|
|
12977
|
+
control: form.control,
|
|
12978
|
+
name: "address_2",
|
|
12979
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12980
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12981
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12982
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12983
|
+
] })
|
|
12984
|
+
}
|
|
12985
|
+
),
|
|
12986
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12987
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12988
|
+
Form$2.Field,
|
|
12989
|
+
{
|
|
12990
|
+
control: form.control,
|
|
12991
|
+
name: "postal_code",
|
|
12992
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12993
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12994
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12995
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12996
|
+
] })
|
|
12997
|
+
}
|
|
12998
|
+
),
|
|
12999
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13000
|
+
Form$2.Field,
|
|
13001
|
+
{
|
|
13002
|
+
control: form.control,
|
|
13003
|
+
name: "city",
|
|
13004
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13005
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
13006
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13007
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13008
|
+
] })
|
|
13009
|
+
}
|
|
13010
|
+
)
|
|
13011
|
+
] }),
|
|
13012
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13013
|
+
Form$2.Field,
|
|
13014
|
+
{
|
|
13015
|
+
control: form.control,
|
|
13016
|
+
name: "province",
|
|
13017
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13018
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13019
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13020
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13021
|
+
] })
|
|
13022
|
+
}
|
|
13023
|
+
),
|
|
13024
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13025
|
+
Form$2.Field,
|
|
13026
|
+
{
|
|
13027
|
+
control: form.control,
|
|
13028
|
+
name: "phone",
|
|
13029
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
13030
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13031
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
13032
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
13033
|
+
] })
|
|
13034
|
+
}
|
|
13035
|
+
)
|
|
13036
|
+
] }) }),
|
|
13037
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13038
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13039
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13040
|
+
] }) })
|
|
13041
|
+
]
|
|
13042
|
+
}
|
|
13043
|
+
) });
|
|
13044
|
+
};
|
|
13045
|
+
const schema = addressSchema;
|
|
13046
13046
|
const widgetModule = { widgets: [] };
|
|
13047
13047
|
const routeModule = {
|
|
13048
13048
|
routes: [
|
|
@@ -13079,10 +13079,6 @@ const routeModule = {
|
|
|
13079
13079
|
Component: Metadata,
|
|
13080
13080
|
path: "/draft-orders/:id/metadata"
|
|
13081
13081
|
},
|
|
13082
|
-
{
|
|
13083
|
-
Component: BillingAddress,
|
|
13084
|
-
path: "/draft-orders/:id/billing-address"
|
|
13085
|
-
},
|
|
13086
13082
|
{
|
|
13087
13083
|
Component: Promotions,
|
|
13088
13084
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13102,6 +13098,10 @@ const routeModule = {
|
|
|
13102
13098
|
{
|
|
13103
13099
|
Component: TransferOwnership,
|
|
13104
13100
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13101
|
+
},
|
|
13102
|
+
{
|
|
13103
|
+
Component: BillingAddress,
|
|
13104
|
+
path: "/draft-orders/:id/billing-address"
|
|
13105
13105
|
}
|
|
13106
13106
|
]
|
|
13107
13107
|
}
|
|
@@ -10978,196 +10978,6 @@ function getHasUneditableRows(metadata) {
|
|
|
10978
10978
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
10979
10979
|
);
|
|
10980
10980
|
}
|
|
10981
|
-
const BillingAddress = () => {
|
|
10982
|
-
const { id } = useParams();
|
|
10983
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10984
|
-
fields: "+billing_address"
|
|
10985
|
-
});
|
|
10986
|
-
if (isError) {
|
|
10987
|
-
throw error;
|
|
10988
|
-
}
|
|
10989
|
-
const isReady = !isPending && !!order;
|
|
10990
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10991
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10992
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
10993
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
10994
|
-
] }),
|
|
10995
|
-
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
10996
|
-
] });
|
|
10997
|
-
};
|
|
10998
|
-
const BillingAddressForm = ({ order }) => {
|
|
10999
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11000
|
-
const form = useForm({
|
|
11001
|
-
defaultValues: {
|
|
11002
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11003
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11004
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
11005
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11006
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11007
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
11008
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
11009
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11010
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11011
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
11012
|
-
},
|
|
11013
|
-
resolver: zodResolver(schema$3)
|
|
11014
|
-
});
|
|
11015
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11016
|
-
const { handleSuccess } = useRouteModal();
|
|
11017
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11018
|
-
await mutateAsync(
|
|
11019
|
-
{ billing_address: data },
|
|
11020
|
-
{
|
|
11021
|
-
onSuccess: () => {
|
|
11022
|
-
handleSuccess();
|
|
11023
|
-
},
|
|
11024
|
-
onError: (error) => {
|
|
11025
|
-
toast.error(error.message);
|
|
11026
|
-
}
|
|
11027
|
-
}
|
|
11028
|
-
);
|
|
11029
|
-
});
|
|
11030
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11031
|
-
KeyboundForm,
|
|
11032
|
-
{
|
|
11033
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11034
|
-
onSubmit,
|
|
11035
|
-
children: [
|
|
11036
|
-
/* @__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: [
|
|
11037
|
-
/* @__PURE__ */ jsx(
|
|
11038
|
-
Form$2.Field,
|
|
11039
|
-
{
|
|
11040
|
-
control: form.control,
|
|
11041
|
-
name: "country_code",
|
|
11042
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11043
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11044
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11045
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11046
|
-
] })
|
|
11047
|
-
}
|
|
11048
|
-
),
|
|
11049
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11050
|
-
/* @__PURE__ */ jsx(
|
|
11051
|
-
Form$2.Field,
|
|
11052
|
-
{
|
|
11053
|
-
control: form.control,
|
|
11054
|
-
name: "first_name",
|
|
11055
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11056
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11057
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11058
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11059
|
-
] })
|
|
11060
|
-
}
|
|
11061
|
-
),
|
|
11062
|
-
/* @__PURE__ */ jsx(
|
|
11063
|
-
Form$2.Field,
|
|
11064
|
-
{
|
|
11065
|
-
control: form.control,
|
|
11066
|
-
name: "last_name",
|
|
11067
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11068
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11069
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11070
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11071
|
-
] })
|
|
11072
|
-
}
|
|
11073
|
-
)
|
|
11074
|
-
] }),
|
|
11075
|
-
/* @__PURE__ */ jsx(
|
|
11076
|
-
Form$2.Field,
|
|
11077
|
-
{
|
|
11078
|
-
control: form.control,
|
|
11079
|
-
name: "company",
|
|
11080
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11081
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11082
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11083
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11084
|
-
] })
|
|
11085
|
-
}
|
|
11086
|
-
),
|
|
11087
|
-
/* @__PURE__ */ jsx(
|
|
11088
|
-
Form$2.Field,
|
|
11089
|
-
{
|
|
11090
|
-
control: form.control,
|
|
11091
|
-
name: "address_1",
|
|
11092
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11093
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11094
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11095
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11096
|
-
] })
|
|
11097
|
-
}
|
|
11098
|
-
),
|
|
11099
|
-
/* @__PURE__ */ jsx(
|
|
11100
|
-
Form$2.Field,
|
|
11101
|
-
{
|
|
11102
|
-
control: form.control,
|
|
11103
|
-
name: "address_2",
|
|
11104
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11105
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11106
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11107
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11108
|
-
] })
|
|
11109
|
-
}
|
|
11110
|
-
),
|
|
11111
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11112
|
-
/* @__PURE__ */ jsx(
|
|
11113
|
-
Form$2.Field,
|
|
11114
|
-
{
|
|
11115
|
-
control: form.control,
|
|
11116
|
-
name: "postal_code",
|
|
11117
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11118
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11119
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11120
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11121
|
-
] })
|
|
11122
|
-
}
|
|
11123
|
-
),
|
|
11124
|
-
/* @__PURE__ */ jsx(
|
|
11125
|
-
Form$2.Field,
|
|
11126
|
-
{
|
|
11127
|
-
control: form.control,
|
|
11128
|
-
name: "city",
|
|
11129
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11130
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11131
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11132
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11133
|
-
] })
|
|
11134
|
-
}
|
|
11135
|
-
)
|
|
11136
|
-
] }),
|
|
11137
|
-
/* @__PURE__ */ jsx(
|
|
11138
|
-
Form$2.Field,
|
|
11139
|
-
{
|
|
11140
|
-
control: form.control,
|
|
11141
|
-
name: "province",
|
|
11142
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11143
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11144
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11145
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11146
|
-
] })
|
|
11147
|
-
}
|
|
11148
|
-
),
|
|
11149
|
-
/* @__PURE__ */ jsx(
|
|
11150
|
-
Form$2.Field,
|
|
11151
|
-
{
|
|
11152
|
-
control: form.control,
|
|
11153
|
-
name: "phone",
|
|
11154
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11155
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11156
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11157
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11158
|
-
] })
|
|
11159
|
-
}
|
|
11160
|
-
)
|
|
11161
|
-
] }) }),
|
|
11162
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11163
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11164
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11165
|
-
] }) })
|
|
11166
|
-
]
|
|
11167
|
-
}
|
|
11168
|
-
) });
|
|
11169
|
-
};
|
|
11170
|
-
const schema$3 = addressSchema;
|
|
11171
10981
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
11172
10982
|
const promotionsQueryKeys = {
|
|
11173
10983
|
list: (query2) => [
|
|
@@ -11473,7 +11283,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11473
11283
|
defaultValues: {
|
|
11474
11284
|
sales_channel_id: order.sales_channel_id || ""
|
|
11475
11285
|
},
|
|
11476
|
-
resolver: zodResolver(schema$
|
|
11286
|
+
resolver: zodResolver(schema$3)
|
|
11477
11287
|
});
|
|
11478
11288
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11479
11289
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11548,7 +11358,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11548
11358
|
}
|
|
11549
11359
|
);
|
|
11550
11360
|
};
|
|
11551
|
-
const schema$
|
|
11361
|
+
const schema$3 = objectType({
|
|
11552
11362
|
sales_channel_id: stringType().min(1)
|
|
11553
11363
|
});
|
|
11554
11364
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
@@ -12390,7 +12200,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12390
12200
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12391
12201
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12392
12202
|
},
|
|
12393
|
-
resolver: zodResolver(schema$
|
|
12203
|
+
resolver: zodResolver(schema$2)
|
|
12394
12204
|
});
|
|
12395
12205
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12396
12206
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12560,7 +12370,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
12560
12370
|
}
|
|
12561
12371
|
) });
|
|
12562
12372
|
};
|
|
12563
|
-
const schema$
|
|
12373
|
+
const schema$2 = addressSchema;
|
|
12564
12374
|
const TransferOwnership = () => {
|
|
12565
12375
|
const { id } = useParams();
|
|
12566
12376
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12584,7 +12394,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12584
12394
|
defaultValues: {
|
|
12585
12395
|
customer_id: order.customer_id || ""
|
|
12586
12396
|
},
|
|
12587
|
-
resolver: zodResolver(schema)
|
|
12397
|
+
resolver: zodResolver(schema$1)
|
|
12588
12398
|
});
|
|
12589
12399
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12590
12400
|
const { handleSuccess } = useRouteModal();
|
|
@@ -13034,9 +12844,199 @@ const Illustration = () => {
|
|
|
13034
12844
|
}
|
|
13035
12845
|
);
|
|
13036
12846
|
};
|
|
13037
|
-
const schema = objectType({
|
|
12847
|
+
const schema$1 = objectType({
|
|
13038
12848
|
customer_id: stringType().min(1)
|
|
13039
12849
|
});
|
|
12850
|
+
const BillingAddress = () => {
|
|
12851
|
+
const { id } = useParams();
|
|
12852
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12853
|
+
fields: "+billing_address"
|
|
12854
|
+
});
|
|
12855
|
+
if (isError) {
|
|
12856
|
+
throw error;
|
|
12857
|
+
}
|
|
12858
|
+
const isReady = !isPending && !!order;
|
|
12859
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12860
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12861
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
|
|
12862
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
12863
|
+
] }),
|
|
12864
|
+
isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
|
|
12865
|
+
] });
|
|
12866
|
+
};
|
|
12867
|
+
const BillingAddressForm = ({ order }) => {
|
|
12868
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12869
|
+
const form = useForm({
|
|
12870
|
+
defaultValues: {
|
|
12871
|
+
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12872
|
+
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12873
|
+
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
12874
|
+
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12875
|
+
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12876
|
+
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
12877
|
+
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
12878
|
+
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12879
|
+
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12880
|
+
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
12881
|
+
},
|
|
12882
|
+
resolver: zodResolver(schema)
|
|
12883
|
+
});
|
|
12884
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12885
|
+
const { handleSuccess } = useRouteModal();
|
|
12886
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12887
|
+
await mutateAsync(
|
|
12888
|
+
{ billing_address: data },
|
|
12889
|
+
{
|
|
12890
|
+
onSuccess: () => {
|
|
12891
|
+
handleSuccess();
|
|
12892
|
+
},
|
|
12893
|
+
onError: (error) => {
|
|
12894
|
+
toast.error(error.message);
|
|
12895
|
+
}
|
|
12896
|
+
}
|
|
12897
|
+
);
|
|
12898
|
+
});
|
|
12899
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12900
|
+
KeyboundForm,
|
|
12901
|
+
{
|
|
12902
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12903
|
+
onSubmit,
|
|
12904
|
+
children: [
|
|
12905
|
+
/* @__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: [
|
|
12906
|
+
/* @__PURE__ */ jsx(
|
|
12907
|
+
Form$2.Field,
|
|
12908
|
+
{
|
|
12909
|
+
control: form.control,
|
|
12910
|
+
name: "country_code",
|
|
12911
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12912
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12913
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12914
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12915
|
+
] })
|
|
12916
|
+
}
|
|
12917
|
+
),
|
|
12918
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12919
|
+
/* @__PURE__ */ jsx(
|
|
12920
|
+
Form$2.Field,
|
|
12921
|
+
{
|
|
12922
|
+
control: form.control,
|
|
12923
|
+
name: "first_name",
|
|
12924
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12925
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12926
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12927
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12928
|
+
] })
|
|
12929
|
+
}
|
|
12930
|
+
),
|
|
12931
|
+
/* @__PURE__ */ jsx(
|
|
12932
|
+
Form$2.Field,
|
|
12933
|
+
{
|
|
12934
|
+
control: form.control,
|
|
12935
|
+
name: "last_name",
|
|
12936
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12937
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12938
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12939
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12940
|
+
] })
|
|
12941
|
+
}
|
|
12942
|
+
)
|
|
12943
|
+
] }),
|
|
12944
|
+
/* @__PURE__ */ jsx(
|
|
12945
|
+
Form$2.Field,
|
|
12946
|
+
{
|
|
12947
|
+
control: form.control,
|
|
12948
|
+
name: "company",
|
|
12949
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12950
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12951
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12952
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12953
|
+
] })
|
|
12954
|
+
}
|
|
12955
|
+
),
|
|
12956
|
+
/* @__PURE__ */ jsx(
|
|
12957
|
+
Form$2.Field,
|
|
12958
|
+
{
|
|
12959
|
+
control: form.control,
|
|
12960
|
+
name: "address_1",
|
|
12961
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12962
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12963
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12964
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12965
|
+
] })
|
|
12966
|
+
}
|
|
12967
|
+
),
|
|
12968
|
+
/* @__PURE__ */ jsx(
|
|
12969
|
+
Form$2.Field,
|
|
12970
|
+
{
|
|
12971
|
+
control: form.control,
|
|
12972
|
+
name: "address_2",
|
|
12973
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12974
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12975
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12976
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12977
|
+
] })
|
|
12978
|
+
}
|
|
12979
|
+
),
|
|
12980
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12981
|
+
/* @__PURE__ */ jsx(
|
|
12982
|
+
Form$2.Field,
|
|
12983
|
+
{
|
|
12984
|
+
control: form.control,
|
|
12985
|
+
name: "postal_code",
|
|
12986
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12987
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12988
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12989
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12990
|
+
] })
|
|
12991
|
+
}
|
|
12992
|
+
),
|
|
12993
|
+
/* @__PURE__ */ jsx(
|
|
12994
|
+
Form$2.Field,
|
|
12995
|
+
{
|
|
12996
|
+
control: form.control,
|
|
12997
|
+
name: "city",
|
|
12998
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12999
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13000
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13001
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13002
|
+
] })
|
|
13003
|
+
}
|
|
13004
|
+
)
|
|
13005
|
+
] }),
|
|
13006
|
+
/* @__PURE__ */ jsx(
|
|
13007
|
+
Form$2.Field,
|
|
13008
|
+
{
|
|
13009
|
+
control: form.control,
|
|
13010
|
+
name: "province",
|
|
13011
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13012
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13013
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13014
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13015
|
+
] })
|
|
13016
|
+
}
|
|
13017
|
+
),
|
|
13018
|
+
/* @__PURE__ */ jsx(
|
|
13019
|
+
Form$2.Field,
|
|
13020
|
+
{
|
|
13021
|
+
control: form.control,
|
|
13022
|
+
name: "phone",
|
|
13023
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13024
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13025
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13026
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13027
|
+
] })
|
|
13028
|
+
}
|
|
13029
|
+
)
|
|
13030
|
+
] }) }),
|
|
13031
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13032
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13033
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13034
|
+
] }) })
|
|
13035
|
+
]
|
|
13036
|
+
}
|
|
13037
|
+
) });
|
|
13038
|
+
};
|
|
13039
|
+
const schema = addressSchema;
|
|
13040
13040
|
const widgetModule = { widgets: [] };
|
|
13041
13041
|
const routeModule = {
|
|
13042
13042
|
routes: [
|
|
@@ -13073,10 +13073,6 @@ const routeModule = {
|
|
|
13073
13073
|
Component: Metadata,
|
|
13074
13074
|
path: "/draft-orders/:id/metadata"
|
|
13075
13075
|
},
|
|
13076
|
-
{
|
|
13077
|
-
Component: BillingAddress,
|
|
13078
|
-
path: "/draft-orders/:id/billing-address"
|
|
13079
|
-
},
|
|
13080
13076
|
{
|
|
13081
13077
|
Component: Promotions,
|
|
13082
13078
|
path: "/draft-orders/:id/promotions"
|
|
@@ -13096,6 +13092,10 @@ const routeModule = {
|
|
|
13096
13092
|
{
|
|
13097
13093
|
Component: TransferOwnership,
|
|
13098
13094
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13095
|
+
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: BillingAddress,
|
|
13098
|
+
path: "/draft-orders/:id/billing-address"
|
|
13099
13099
|
}
|
|
13100
13100
|
]
|
|
13101
13101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.2-preview-
|
|
3
|
+
"version": "2.11.2-preview-20251026031918",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@hookform/resolvers": "3.4.2",
|
|
39
|
-
"@medusajs/js-sdk": "2.11.2-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.2-preview-20251026031918",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
41
41
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
42
42
|
"date-fns": "^3.6.0",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"react-hook-form": "7.49.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@medusajs/admin-sdk": "2.11.2-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.2-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.2-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.2-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.2-preview-
|
|
53
|
-
"@medusajs/types": "2.11.2-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.26-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.2-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.2-preview-20251026031918",
|
|
49
|
+
"@medusajs/cli": "2.11.2-preview-20251026031918",
|
|
50
|
+
"@medusajs/framework": "2.11.2-preview-20251026031918",
|
|
51
|
+
"@medusajs/icons": "2.11.2-preview-20251026031918",
|
|
52
|
+
"@medusajs/test-utils": "2.11.2-preview-20251026031918",
|
|
53
|
+
"@medusajs/types": "2.11.2-preview-20251026031918",
|
|
54
|
+
"@medusajs/ui": "4.0.26-preview-20251026031918",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.2-preview-20251026031918",
|
|
56
56
|
"@swc/core": "1.5.7",
|
|
57
57
|
"@types/lodash": "^4.17.15",
|
|
58
58
|
"@types/node": "^20.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"yalc": "^1.0.0-pre.53"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@medusajs/admin-sdk": "2.11.2-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.2-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.2-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.2-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.2-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.26-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.2-preview-20251026031918",
|
|
73
|
+
"@medusajs/cli": "2.11.2-preview-20251026031918",
|
|
74
|
+
"@medusajs/framework": "2.11.2-preview-20251026031918",
|
|
75
|
+
"@medusajs/icons": "2.11.2-preview-20251026031918",
|
|
76
|
+
"@medusajs/test-utils": "2.11.2-preview-20251026031918",
|
|
77
|
+
"@medusajs/ui": "4.0.26-preview-20251026031918",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|