@medusajs/draft-order 2.11.3-preview-20251102060143 → 2.11.3-preview-20251102090139
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 +207 -207
- package/.medusa/server/src/admin/index.mjs +207 -207
- package/package.json +16 -16
|
@@ -11558,209 +11558,6 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11558
11558
|
const schema$2 = objectType({
|
|
11559
11559
|
sales_channel_id: stringType().min(1)
|
|
11560
11560
|
});
|
|
11561
|
-
const ShippingAddress = () => {
|
|
11562
|
-
const { id } = reactRouterDom.useParams();
|
|
11563
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11564
|
-
fields: "+shipping_address"
|
|
11565
|
-
});
|
|
11566
|
-
if (isError) {
|
|
11567
|
-
throw error;
|
|
11568
|
-
}
|
|
11569
|
-
const isReady = !isPending && !!order;
|
|
11570
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11571
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11572
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
11573
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11574
|
-
] }),
|
|
11575
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
11576
|
-
] });
|
|
11577
|
-
};
|
|
11578
|
-
const ShippingAddressForm = ({ order }) => {
|
|
11579
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11580
|
-
const form = reactHookForm.useForm({
|
|
11581
|
-
defaultValues: {
|
|
11582
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11583
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11584
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11585
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11586
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11587
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11588
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11589
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11590
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11591
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11592
|
-
},
|
|
11593
|
-
resolver: zod.zodResolver(schema$1)
|
|
11594
|
-
});
|
|
11595
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11596
|
-
const { handleSuccess } = useRouteModal();
|
|
11597
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11598
|
-
await mutateAsync(
|
|
11599
|
-
{
|
|
11600
|
-
shipping_address: {
|
|
11601
|
-
first_name: data.first_name,
|
|
11602
|
-
last_name: data.last_name,
|
|
11603
|
-
company: data.company,
|
|
11604
|
-
address_1: data.address_1,
|
|
11605
|
-
address_2: data.address_2,
|
|
11606
|
-
city: data.city,
|
|
11607
|
-
province: data.province,
|
|
11608
|
-
country_code: data.country_code,
|
|
11609
|
-
postal_code: data.postal_code,
|
|
11610
|
-
phone: data.phone
|
|
11611
|
-
}
|
|
11612
|
-
},
|
|
11613
|
-
{
|
|
11614
|
-
onSuccess: () => {
|
|
11615
|
-
handleSuccess();
|
|
11616
|
-
},
|
|
11617
|
-
onError: (error) => {
|
|
11618
|
-
ui.toast.error(error.message);
|
|
11619
|
-
}
|
|
11620
|
-
}
|
|
11621
|
-
);
|
|
11622
|
-
});
|
|
11623
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11624
|
-
KeyboundForm,
|
|
11625
|
-
{
|
|
11626
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11627
|
-
onSubmit,
|
|
11628
|
-
children: [
|
|
11629
|
-
/* @__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: [
|
|
11630
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11631
|
-
Form$2.Field,
|
|
11632
|
-
{
|
|
11633
|
-
control: form.control,
|
|
11634
|
-
name: "country_code",
|
|
11635
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11636
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11637
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11639
|
-
] })
|
|
11640
|
-
}
|
|
11641
|
-
),
|
|
11642
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11643
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11644
|
-
Form$2.Field,
|
|
11645
|
-
{
|
|
11646
|
-
control: form.control,
|
|
11647
|
-
name: "first_name",
|
|
11648
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11649
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11650
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11652
|
-
] })
|
|
11653
|
-
}
|
|
11654
|
-
),
|
|
11655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11656
|
-
Form$2.Field,
|
|
11657
|
-
{
|
|
11658
|
-
control: form.control,
|
|
11659
|
-
name: "last_name",
|
|
11660
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11661
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11662
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11664
|
-
] })
|
|
11665
|
-
}
|
|
11666
|
-
)
|
|
11667
|
-
] }),
|
|
11668
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11669
|
-
Form$2.Field,
|
|
11670
|
-
{
|
|
11671
|
-
control: form.control,
|
|
11672
|
-
name: "company",
|
|
11673
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11674
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11675
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11677
|
-
] })
|
|
11678
|
-
}
|
|
11679
|
-
),
|
|
11680
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11681
|
-
Form$2.Field,
|
|
11682
|
-
{
|
|
11683
|
-
control: form.control,
|
|
11684
|
-
name: "address_1",
|
|
11685
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11686
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11687
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11689
|
-
] })
|
|
11690
|
-
}
|
|
11691
|
-
),
|
|
11692
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11693
|
-
Form$2.Field,
|
|
11694
|
-
{
|
|
11695
|
-
control: form.control,
|
|
11696
|
-
name: "address_2",
|
|
11697
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11698
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11699
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11701
|
-
] })
|
|
11702
|
-
}
|
|
11703
|
-
),
|
|
11704
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11705
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11706
|
-
Form$2.Field,
|
|
11707
|
-
{
|
|
11708
|
-
control: form.control,
|
|
11709
|
-
name: "postal_code",
|
|
11710
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11711
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11712
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11714
|
-
] })
|
|
11715
|
-
}
|
|
11716
|
-
),
|
|
11717
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11718
|
-
Form$2.Field,
|
|
11719
|
-
{
|
|
11720
|
-
control: form.control,
|
|
11721
|
-
name: "city",
|
|
11722
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11723
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11724
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11726
|
-
] })
|
|
11727
|
-
}
|
|
11728
|
-
)
|
|
11729
|
-
] }),
|
|
11730
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11731
|
-
Form$2.Field,
|
|
11732
|
-
{
|
|
11733
|
-
control: form.control,
|
|
11734
|
-
name: "province",
|
|
11735
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11736
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11737
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11739
|
-
] })
|
|
11740
|
-
}
|
|
11741
|
-
),
|
|
11742
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11743
|
-
Form$2.Field,
|
|
11744
|
-
{
|
|
11745
|
-
control: form.control,
|
|
11746
|
-
name: "phone",
|
|
11747
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11748
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11749
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11750
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11751
|
-
] })
|
|
11752
|
-
}
|
|
11753
|
-
)
|
|
11754
|
-
] }) }),
|
|
11755
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11756
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11757
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11758
|
-
] }) })
|
|
11759
|
-
]
|
|
11760
|
-
}
|
|
11761
|
-
) });
|
|
11762
|
-
};
|
|
11763
|
-
const schema$1 = addressSchema;
|
|
11764
11561
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11765
11562
|
const Shipping = () => {
|
|
11766
11563
|
var _a;
|
|
@@ -12568,6 +12365,209 @@ const CustomAmountField = ({
|
|
|
12568
12365
|
}
|
|
12569
12366
|
);
|
|
12570
12367
|
};
|
|
12368
|
+
const ShippingAddress = () => {
|
|
12369
|
+
const { id } = reactRouterDom.useParams();
|
|
12370
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12371
|
+
fields: "+shipping_address"
|
|
12372
|
+
});
|
|
12373
|
+
if (isError) {
|
|
12374
|
+
throw error;
|
|
12375
|
+
}
|
|
12376
|
+
const isReady = !isPending && !!order;
|
|
12377
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12378
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12379
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
12380
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12381
|
+
] }),
|
|
12382
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
12383
|
+
] });
|
|
12384
|
+
};
|
|
12385
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12386
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12387
|
+
const form = reactHookForm.useForm({
|
|
12388
|
+
defaultValues: {
|
|
12389
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12390
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12391
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12392
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12393
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12394
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12395
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12396
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12397
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12398
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12399
|
+
},
|
|
12400
|
+
resolver: zod.zodResolver(schema$1)
|
|
12401
|
+
});
|
|
12402
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12403
|
+
const { handleSuccess } = useRouteModal();
|
|
12404
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12405
|
+
await mutateAsync(
|
|
12406
|
+
{
|
|
12407
|
+
shipping_address: {
|
|
12408
|
+
first_name: data.first_name,
|
|
12409
|
+
last_name: data.last_name,
|
|
12410
|
+
company: data.company,
|
|
12411
|
+
address_1: data.address_1,
|
|
12412
|
+
address_2: data.address_2,
|
|
12413
|
+
city: data.city,
|
|
12414
|
+
province: data.province,
|
|
12415
|
+
country_code: data.country_code,
|
|
12416
|
+
postal_code: data.postal_code,
|
|
12417
|
+
phone: data.phone
|
|
12418
|
+
}
|
|
12419
|
+
},
|
|
12420
|
+
{
|
|
12421
|
+
onSuccess: () => {
|
|
12422
|
+
handleSuccess();
|
|
12423
|
+
},
|
|
12424
|
+
onError: (error) => {
|
|
12425
|
+
ui.toast.error(error.message);
|
|
12426
|
+
}
|
|
12427
|
+
}
|
|
12428
|
+
);
|
|
12429
|
+
});
|
|
12430
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12431
|
+
KeyboundForm,
|
|
12432
|
+
{
|
|
12433
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12434
|
+
onSubmit,
|
|
12435
|
+
children: [
|
|
12436
|
+
/* @__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: [
|
|
12437
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12438
|
+
Form$2.Field,
|
|
12439
|
+
{
|
|
12440
|
+
control: form.control,
|
|
12441
|
+
name: "country_code",
|
|
12442
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12443
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12444
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12445
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12446
|
+
] })
|
|
12447
|
+
}
|
|
12448
|
+
),
|
|
12449
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12450
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12451
|
+
Form$2.Field,
|
|
12452
|
+
{
|
|
12453
|
+
control: form.control,
|
|
12454
|
+
name: "first_name",
|
|
12455
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12456
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12457
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12458
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12459
|
+
] })
|
|
12460
|
+
}
|
|
12461
|
+
),
|
|
12462
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12463
|
+
Form$2.Field,
|
|
12464
|
+
{
|
|
12465
|
+
control: form.control,
|
|
12466
|
+
name: "last_name",
|
|
12467
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12468
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12469
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12470
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12471
|
+
] })
|
|
12472
|
+
}
|
|
12473
|
+
)
|
|
12474
|
+
] }),
|
|
12475
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12476
|
+
Form$2.Field,
|
|
12477
|
+
{
|
|
12478
|
+
control: form.control,
|
|
12479
|
+
name: "company",
|
|
12480
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12481
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12482
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12483
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12484
|
+
] })
|
|
12485
|
+
}
|
|
12486
|
+
),
|
|
12487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12488
|
+
Form$2.Field,
|
|
12489
|
+
{
|
|
12490
|
+
control: form.control,
|
|
12491
|
+
name: "address_1",
|
|
12492
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12493
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12494
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12495
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12496
|
+
] })
|
|
12497
|
+
}
|
|
12498
|
+
),
|
|
12499
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12500
|
+
Form$2.Field,
|
|
12501
|
+
{
|
|
12502
|
+
control: form.control,
|
|
12503
|
+
name: "address_2",
|
|
12504
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12505
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12506
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12507
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12508
|
+
] })
|
|
12509
|
+
}
|
|
12510
|
+
),
|
|
12511
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12512
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12513
|
+
Form$2.Field,
|
|
12514
|
+
{
|
|
12515
|
+
control: form.control,
|
|
12516
|
+
name: "postal_code",
|
|
12517
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12518
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12519
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12520
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12521
|
+
] })
|
|
12522
|
+
}
|
|
12523
|
+
),
|
|
12524
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12525
|
+
Form$2.Field,
|
|
12526
|
+
{
|
|
12527
|
+
control: form.control,
|
|
12528
|
+
name: "city",
|
|
12529
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12530
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12531
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12532
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12533
|
+
] })
|
|
12534
|
+
}
|
|
12535
|
+
)
|
|
12536
|
+
] }),
|
|
12537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12538
|
+
Form$2.Field,
|
|
12539
|
+
{
|
|
12540
|
+
control: form.control,
|
|
12541
|
+
name: "province",
|
|
12542
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12543
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12544
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12545
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12546
|
+
] })
|
|
12547
|
+
}
|
|
12548
|
+
),
|
|
12549
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12550
|
+
Form$2.Field,
|
|
12551
|
+
{
|
|
12552
|
+
control: form.control,
|
|
12553
|
+
name: "phone",
|
|
12554
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12555
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12556
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12558
|
+
] })
|
|
12559
|
+
}
|
|
12560
|
+
)
|
|
12561
|
+
] }) }),
|
|
12562
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12563
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12564
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12565
|
+
] }) })
|
|
12566
|
+
]
|
|
12567
|
+
}
|
|
12568
|
+
) });
|
|
12569
|
+
};
|
|
12570
|
+
const schema$1 = addressSchema;
|
|
12571
12571
|
const TransferOwnership = () => {
|
|
12572
12572
|
const { id } = reactRouterDom.useParams();
|
|
12573
12573
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13092,14 +13092,14 @@ const routeModule = {
|
|
|
13092
13092
|
Component: SalesChannel,
|
|
13093
13093
|
path: "/draft-orders/:id/sales-channel"
|
|
13094
13094
|
},
|
|
13095
|
-
{
|
|
13096
|
-
Component: ShippingAddress,
|
|
13097
|
-
path: "/draft-orders/:id/shipping-address"
|
|
13098
|
-
},
|
|
13099
13095
|
{
|
|
13100
13096
|
Component: Shipping,
|
|
13101
13097
|
path: "/draft-orders/:id/shipping"
|
|
13102
13098
|
},
|
|
13099
|
+
{
|
|
13100
|
+
Component: ShippingAddress,
|
|
13101
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13102
|
+
},
|
|
13103
13103
|
{
|
|
13104
13104
|
Component: TransferOwnership,
|
|
13105
13105
|
path: "/draft-orders/:id/transfer-ownership"
|
|
@@ -11551,209 +11551,6 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11551
11551
|
const schema$2 = objectType({
|
|
11552
11552
|
sales_channel_id: stringType().min(1)
|
|
11553
11553
|
});
|
|
11554
|
-
const ShippingAddress = () => {
|
|
11555
|
-
const { id } = useParams();
|
|
11556
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11557
|
-
fields: "+shipping_address"
|
|
11558
|
-
});
|
|
11559
|
-
if (isError) {
|
|
11560
|
-
throw error;
|
|
11561
|
-
}
|
|
11562
|
-
const isReady = !isPending && !!order;
|
|
11563
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11564
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11565
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
11566
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11567
|
-
] }),
|
|
11568
|
-
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
11569
|
-
] });
|
|
11570
|
-
};
|
|
11571
|
-
const ShippingAddressForm = ({ order }) => {
|
|
11572
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11573
|
-
const form = useForm({
|
|
11574
|
-
defaultValues: {
|
|
11575
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11576
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11577
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11578
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11579
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11580
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11581
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11582
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11583
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11584
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11585
|
-
},
|
|
11586
|
-
resolver: zodResolver(schema$1)
|
|
11587
|
-
});
|
|
11588
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11589
|
-
const { handleSuccess } = useRouteModal();
|
|
11590
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11591
|
-
await mutateAsync(
|
|
11592
|
-
{
|
|
11593
|
-
shipping_address: {
|
|
11594
|
-
first_name: data.first_name,
|
|
11595
|
-
last_name: data.last_name,
|
|
11596
|
-
company: data.company,
|
|
11597
|
-
address_1: data.address_1,
|
|
11598
|
-
address_2: data.address_2,
|
|
11599
|
-
city: data.city,
|
|
11600
|
-
province: data.province,
|
|
11601
|
-
country_code: data.country_code,
|
|
11602
|
-
postal_code: data.postal_code,
|
|
11603
|
-
phone: data.phone
|
|
11604
|
-
}
|
|
11605
|
-
},
|
|
11606
|
-
{
|
|
11607
|
-
onSuccess: () => {
|
|
11608
|
-
handleSuccess();
|
|
11609
|
-
},
|
|
11610
|
-
onError: (error) => {
|
|
11611
|
-
toast.error(error.message);
|
|
11612
|
-
}
|
|
11613
|
-
}
|
|
11614
|
-
);
|
|
11615
|
-
});
|
|
11616
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11617
|
-
KeyboundForm,
|
|
11618
|
-
{
|
|
11619
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11620
|
-
onSubmit,
|
|
11621
|
-
children: [
|
|
11622
|
-
/* @__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: [
|
|
11623
|
-
/* @__PURE__ */ jsx(
|
|
11624
|
-
Form$2.Field,
|
|
11625
|
-
{
|
|
11626
|
-
control: form.control,
|
|
11627
|
-
name: "country_code",
|
|
11628
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11629
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11630
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11631
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11632
|
-
] })
|
|
11633
|
-
}
|
|
11634
|
-
),
|
|
11635
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11636
|
-
/* @__PURE__ */ jsx(
|
|
11637
|
-
Form$2.Field,
|
|
11638
|
-
{
|
|
11639
|
-
control: form.control,
|
|
11640
|
-
name: "first_name",
|
|
11641
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11642
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11643
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11644
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11645
|
-
] })
|
|
11646
|
-
}
|
|
11647
|
-
),
|
|
11648
|
-
/* @__PURE__ */ jsx(
|
|
11649
|
-
Form$2.Field,
|
|
11650
|
-
{
|
|
11651
|
-
control: form.control,
|
|
11652
|
-
name: "last_name",
|
|
11653
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11654
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11655
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11656
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11657
|
-
] })
|
|
11658
|
-
}
|
|
11659
|
-
)
|
|
11660
|
-
] }),
|
|
11661
|
-
/* @__PURE__ */ jsx(
|
|
11662
|
-
Form$2.Field,
|
|
11663
|
-
{
|
|
11664
|
-
control: form.control,
|
|
11665
|
-
name: "company",
|
|
11666
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11667
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11668
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11669
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11670
|
-
] })
|
|
11671
|
-
}
|
|
11672
|
-
),
|
|
11673
|
-
/* @__PURE__ */ jsx(
|
|
11674
|
-
Form$2.Field,
|
|
11675
|
-
{
|
|
11676
|
-
control: form.control,
|
|
11677
|
-
name: "address_1",
|
|
11678
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11679
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11680
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11681
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11682
|
-
] })
|
|
11683
|
-
}
|
|
11684
|
-
),
|
|
11685
|
-
/* @__PURE__ */ jsx(
|
|
11686
|
-
Form$2.Field,
|
|
11687
|
-
{
|
|
11688
|
-
control: form.control,
|
|
11689
|
-
name: "address_2",
|
|
11690
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11691
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11692
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11693
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11694
|
-
] })
|
|
11695
|
-
}
|
|
11696
|
-
),
|
|
11697
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11698
|
-
/* @__PURE__ */ jsx(
|
|
11699
|
-
Form$2.Field,
|
|
11700
|
-
{
|
|
11701
|
-
control: form.control,
|
|
11702
|
-
name: "postal_code",
|
|
11703
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11704
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11705
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11706
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11707
|
-
] })
|
|
11708
|
-
}
|
|
11709
|
-
),
|
|
11710
|
-
/* @__PURE__ */ jsx(
|
|
11711
|
-
Form$2.Field,
|
|
11712
|
-
{
|
|
11713
|
-
control: form.control,
|
|
11714
|
-
name: "city",
|
|
11715
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11716
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11717
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11718
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11719
|
-
] })
|
|
11720
|
-
}
|
|
11721
|
-
)
|
|
11722
|
-
] }),
|
|
11723
|
-
/* @__PURE__ */ jsx(
|
|
11724
|
-
Form$2.Field,
|
|
11725
|
-
{
|
|
11726
|
-
control: form.control,
|
|
11727
|
-
name: "province",
|
|
11728
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11729
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11730
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11731
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11732
|
-
] })
|
|
11733
|
-
}
|
|
11734
|
-
),
|
|
11735
|
-
/* @__PURE__ */ jsx(
|
|
11736
|
-
Form$2.Field,
|
|
11737
|
-
{
|
|
11738
|
-
control: form.control,
|
|
11739
|
-
name: "phone",
|
|
11740
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11741
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11742
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11743
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11744
|
-
] })
|
|
11745
|
-
}
|
|
11746
|
-
)
|
|
11747
|
-
] }) }),
|
|
11748
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11749
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11750
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11751
|
-
] }) })
|
|
11752
|
-
]
|
|
11753
|
-
}
|
|
11754
|
-
) });
|
|
11755
|
-
};
|
|
11756
|
-
const schema$1 = addressSchema;
|
|
11757
11554
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11758
11555
|
const Shipping = () => {
|
|
11759
11556
|
var _a;
|
|
@@ -12561,6 +12358,209 @@ const CustomAmountField = ({
|
|
|
12561
12358
|
}
|
|
12562
12359
|
);
|
|
12563
12360
|
};
|
|
12361
|
+
const ShippingAddress = () => {
|
|
12362
|
+
const { id } = useParams();
|
|
12363
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12364
|
+
fields: "+shipping_address"
|
|
12365
|
+
});
|
|
12366
|
+
if (isError) {
|
|
12367
|
+
throw error;
|
|
12368
|
+
}
|
|
12369
|
+
const isReady = !isPending && !!order;
|
|
12370
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12371
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12372
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12373
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12374
|
+
] }),
|
|
12375
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12376
|
+
] });
|
|
12377
|
+
};
|
|
12378
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12379
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12380
|
+
const form = useForm({
|
|
12381
|
+
defaultValues: {
|
|
12382
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12383
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12384
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12385
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12386
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12387
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12388
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12389
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12390
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12391
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12392
|
+
},
|
|
12393
|
+
resolver: zodResolver(schema$1)
|
|
12394
|
+
});
|
|
12395
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12396
|
+
const { handleSuccess } = useRouteModal();
|
|
12397
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12398
|
+
await mutateAsync(
|
|
12399
|
+
{
|
|
12400
|
+
shipping_address: {
|
|
12401
|
+
first_name: data.first_name,
|
|
12402
|
+
last_name: data.last_name,
|
|
12403
|
+
company: data.company,
|
|
12404
|
+
address_1: data.address_1,
|
|
12405
|
+
address_2: data.address_2,
|
|
12406
|
+
city: data.city,
|
|
12407
|
+
province: data.province,
|
|
12408
|
+
country_code: data.country_code,
|
|
12409
|
+
postal_code: data.postal_code,
|
|
12410
|
+
phone: data.phone
|
|
12411
|
+
}
|
|
12412
|
+
},
|
|
12413
|
+
{
|
|
12414
|
+
onSuccess: () => {
|
|
12415
|
+
handleSuccess();
|
|
12416
|
+
},
|
|
12417
|
+
onError: (error) => {
|
|
12418
|
+
toast.error(error.message);
|
|
12419
|
+
}
|
|
12420
|
+
}
|
|
12421
|
+
);
|
|
12422
|
+
});
|
|
12423
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12424
|
+
KeyboundForm,
|
|
12425
|
+
{
|
|
12426
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12427
|
+
onSubmit,
|
|
12428
|
+
children: [
|
|
12429
|
+
/* @__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: [
|
|
12430
|
+
/* @__PURE__ */ jsx(
|
|
12431
|
+
Form$2.Field,
|
|
12432
|
+
{
|
|
12433
|
+
control: form.control,
|
|
12434
|
+
name: "country_code",
|
|
12435
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12436
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12437
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12438
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12439
|
+
] })
|
|
12440
|
+
}
|
|
12441
|
+
),
|
|
12442
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12443
|
+
/* @__PURE__ */ jsx(
|
|
12444
|
+
Form$2.Field,
|
|
12445
|
+
{
|
|
12446
|
+
control: form.control,
|
|
12447
|
+
name: "first_name",
|
|
12448
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12449
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12450
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12451
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12452
|
+
] })
|
|
12453
|
+
}
|
|
12454
|
+
),
|
|
12455
|
+
/* @__PURE__ */ jsx(
|
|
12456
|
+
Form$2.Field,
|
|
12457
|
+
{
|
|
12458
|
+
control: form.control,
|
|
12459
|
+
name: "last_name",
|
|
12460
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12461
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12462
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12463
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12464
|
+
] })
|
|
12465
|
+
}
|
|
12466
|
+
)
|
|
12467
|
+
] }),
|
|
12468
|
+
/* @__PURE__ */ jsx(
|
|
12469
|
+
Form$2.Field,
|
|
12470
|
+
{
|
|
12471
|
+
control: form.control,
|
|
12472
|
+
name: "company",
|
|
12473
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12474
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12475
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12476
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12477
|
+
] })
|
|
12478
|
+
}
|
|
12479
|
+
),
|
|
12480
|
+
/* @__PURE__ */ jsx(
|
|
12481
|
+
Form$2.Field,
|
|
12482
|
+
{
|
|
12483
|
+
control: form.control,
|
|
12484
|
+
name: "address_1",
|
|
12485
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12486
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12487
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12488
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12489
|
+
] })
|
|
12490
|
+
}
|
|
12491
|
+
),
|
|
12492
|
+
/* @__PURE__ */ jsx(
|
|
12493
|
+
Form$2.Field,
|
|
12494
|
+
{
|
|
12495
|
+
control: form.control,
|
|
12496
|
+
name: "address_2",
|
|
12497
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12498
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12499
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12500
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12501
|
+
] })
|
|
12502
|
+
}
|
|
12503
|
+
),
|
|
12504
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12505
|
+
/* @__PURE__ */ jsx(
|
|
12506
|
+
Form$2.Field,
|
|
12507
|
+
{
|
|
12508
|
+
control: form.control,
|
|
12509
|
+
name: "postal_code",
|
|
12510
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12511
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12512
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12513
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12514
|
+
] })
|
|
12515
|
+
}
|
|
12516
|
+
),
|
|
12517
|
+
/* @__PURE__ */ jsx(
|
|
12518
|
+
Form$2.Field,
|
|
12519
|
+
{
|
|
12520
|
+
control: form.control,
|
|
12521
|
+
name: "city",
|
|
12522
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12523
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12524
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12525
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12526
|
+
] })
|
|
12527
|
+
}
|
|
12528
|
+
)
|
|
12529
|
+
] }),
|
|
12530
|
+
/* @__PURE__ */ jsx(
|
|
12531
|
+
Form$2.Field,
|
|
12532
|
+
{
|
|
12533
|
+
control: form.control,
|
|
12534
|
+
name: "province",
|
|
12535
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12536
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12537
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12538
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12539
|
+
] })
|
|
12540
|
+
}
|
|
12541
|
+
),
|
|
12542
|
+
/* @__PURE__ */ jsx(
|
|
12543
|
+
Form$2.Field,
|
|
12544
|
+
{
|
|
12545
|
+
control: form.control,
|
|
12546
|
+
name: "phone",
|
|
12547
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12548
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12549
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12550
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12551
|
+
] })
|
|
12552
|
+
}
|
|
12553
|
+
)
|
|
12554
|
+
] }) }),
|
|
12555
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12556
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12557
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12558
|
+
] }) })
|
|
12559
|
+
]
|
|
12560
|
+
}
|
|
12561
|
+
) });
|
|
12562
|
+
};
|
|
12563
|
+
const schema$1 = addressSchema;
|
|
12564
12564
|
const TransferOwnership = () => {
|
|
12565
12565
|
const { id } = useParams();
|
|
12566
12566
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13085,14 +13085,14 @@ const routeModule = {
|
|
|
13085
13085
|
Component: SalesChannel,
|
|
13086
13086
|
path: "/draft-orders/:id/sales-channel"
|
|
13087
13087
|
},
|
|
13088
|
-
{
|
|
13089
|
-
Component: ShippingAddress,
|
|
13090
|
-
path: "/draft-orders/:id/shipping-address"
|
|
13091
|
-
},
|
|
13092
13088
|
{
|
|
13093
13089
|
Component: Shipping,
|
|
13094
13090
|
path: "/draft-orders/:id/shipping"
|
|
13095
13091
|
},
|
|
13092
|
+
{
|
|
13093
|
+
Component: ShippingAddress,
|
|
13094
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13095
|
+
},
|
|
13096
13096
|
{
|
|
13097
13097
|
Component: TransferOwnership,
|
|
13098
13098
|
path: "/draft-orders/:id/transfer-ownership"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/draft-order",
|
|
3
|
-
"version": "2.11.3-preview-
|
|
3
|
+
"version": "2.11.3-preview-20251102090139",
|
|
4
4
|
"description": "A starter for Medusa plugins.",
|
|
5
5
|
"author": "Medusa (https://medusajs.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@ariakit/react": "^0.4.15",
|
|
38
38
|
"@babel/runtime": "^7.26.10",
|
|
39
39
|
"@hookform/resolvers": "3.4.2",
|
|
40
|
-
"@medusajs/js-sdk": "2.11.3-preview-
|
|
40
|
+
"@medusajs/js-sdk": "2.11.3-preview-20251102090139",
|
|
41
41
|
"@tanstack/react-query": "5.64.2",
|
|
42
42
|
"@uiw/react-json-view": "^2.0.0-alpha.17",
|
|
43
43
|
"date-fns": "^3.6.0",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"react-hook-form": "7.49.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@medusajs/admin-sdk": "2.11.3-preview-
|
|
52
|
-
"@medusajs/cli": "2.11.3-preview-
|
|
53
|
-
"@medusajs/framework": "2.11.3-preview-
|
|
54
|
-
"@medusajs/icons": "2.11.3-preview-
|
|
55
|
-
"@medusajs/test-utils": "2.11.3-preview-
|
|
56
|
-
"@medusajs/types": "2.11.3-preview-
|
|
57
|
-
"@medusajs/ui": "4.0.27-preview-
|
|
58
|
-
"@medusajs/ui-preset": "2.11.3-preview-
|
|
51
|
+
"@medusajs/admin-sdk": "2.11.3-preview-20251102090139",
|
|
52
|
+
"@medusajs/cli": "2.11.3-preview-20251102090139",
|
|
53
|
+
"@medusajs/framework": "2.11.3-preview-20251102090139",
|
|
54
|
+
"@medusajs/icons": "2.11.3-preview-20251102090139",
|
|
55
|
+
"@medusajs/test-utils": "2.11.3-preview-20251102090139",
|
|
56
|
+
"@medusajs/types": "2.11.3-preview-20251102090139",
|
|
57
|
+
"@medusajs/ui": "4.0.27-preview-20251102090139",
|
|
58
|
+
"@medusajs/ui-preset": "2.11.3-preview-20251102090139",
|
|
59
59
|
"@swc/core": "^1.7.28",
|
|
60
60
|
"@types/lodash": "^4.17.15",
|
|
61
61
|
"@types/lodash.debounce": "^4.0.9",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
"yalc": "^1.0.0-pre.53"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@medusajs/admin-sdk": "2.11.3-preview-
|
|
77
|
-
"@medusajs/cli": "2.11.3-preview-
|
|
78
|
-
"@medusajs/framework": "2.11.3-preview-
|
|
79
|
-
"@medusajs/icons": "2.11.3-preview-
|
|
80
|
-
"@medusajs/test-utils": "2.11.3-preview-
|
|
81
|
-
"@medusajs/ui": "4.0.27-preview-
|
|
76
|
+
"@medusajs/admin-sdk": "2.11.3-preview-20251102090139",
|
|
77
|
+
"@medusajs/cli": "2.11.3-preview-20251102090139",
|
|
78
|
+
"@medusajs/framework": "2.11.3-preview-20251102090139",
|
|
79
|
+
"@medusajs/icons": "2.11.3-preview-20251102090139",
|
|
80
|
+
"@medusajs/test-utils": "2.11.3-preview-20251102090139",
|
|
81
|
+
"@medusajs/ui": "4.0.27-preview-20251102090139",
|
|
82
82
|
"react": "^18.3.1",
|
|
83
83
|
"react-dom": "^18.3.1",
|
|
84
84
|
"react-router-dom": "6.20.1"
|