@medusajs/draft-order 2.11.0-preview-20251017060205 → 2.11.0-preview-20251017120203
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
|
@@ -11453,6 +11453,209 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11453
11453
|
}
|
|
11454
11454
|
return Array.from(promotionIds);
|
|
11455
11455
|
}
|
|
11456
|
+
const ShippingAddress = () => {
|
|
11457
|
+
const { id } = reactRouterDom.useParams();
|
|
11458
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11459
|
+
fields: "+shipping_address"
|
|
11460
|
+
});
|
|
11461
|
+
if (isError) {
|
|
11462
|
+
throw error;
|
|
11463
|
+
}
|
|
11464
|
+
const isReady = !isPending && !!order;
|
|
11465
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11466
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11467
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
11468
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11469
|
+
] }),
|
|
11470
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
11471
|
+
] });
|
|
11472
|
+
};
|
|
11473
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11474
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11475
|
+
const form = reactHookForm.useForm({
|
|
11476
|
+
defaultValues: {
|
|
11477
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11478
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11479
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11480
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11481
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11482
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11483
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11484
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11485
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11486
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11487
|
+
},
|
|
11488
|
+
resolver: zod.zodResolver(schema$2)
|
|
11489
|
+
});
|
|
11490
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11491
|
+
const { handleSuccess } = useRouteModal();
|
|
11492
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11493
|
+
await mutateAsync(
|
|
11494
|
+
{
|
|
11495
|
+
shipping_address: {
|
|
11496
|
+
first_name: data.first_name,
|
|
11497
|
+
last_name: data.last_name,
|
|
11498
|
+
company: data.company,
|
|
11499
|
+
address_1: data.address_1,
|
|
11500
|
+
address_2: data.address_2,
|
|
11501
|
+
city: data.city,
|
|
11502
|
+
province: data.province,
|
|
11503
|
+
country_code: data.country_code,
|
|
11504
|
+
postal_code: data.postal_code,
|
|
11505
|
+
phone: data.phone
|
|
11506
|
+
}
|
|
11507
|
+
},
|
|
11508
|
+
{
|
|
11509
|
+
onSuccess: () => {
|
|
11510
|
+
handleSuccess();
|
|
11511
|
+
},
|
|
11512
|
+
onError: (error) => {
|
|
11513
|
+
ui.toast.error(error.message);
|
|
11514
|
+
}
|
|
11515
|
+
}
|
|
11516
|
+
);
|
|
11517
|
+
});
|
|
11518
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11519
|
+
KeyboundForm,
|
|
11520
|
+
{
|
|
11521
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11522
|
+
onSubmit,
|
|
11523
|
+
children: [
|
|
11524
|
+
/* @__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: [
|
|
11525
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11526
|
+
Form$2.Field,
|
|
11527
|
+
{
|
|
11528
|
+
control: form.control,
|
|
11529
|
+
name: "country_code",
|
|
11530
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11531
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11532
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11533
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11534
|
+
] })
|
|
11535
|
+
}
|
|
11536
|
+
),
|
|
11537
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11539
|
+
Form$2.Field,
|
|
11540
|
+
{
|
|
11541
|
+
control: form.control,
|
|
11542
|
+
name: "first_name",
|
|
11543
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11544
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11545
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11546
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11547
|
+
] })
|
|
11548
|
+
}
|
|
11549
|
+
),
|
|
11550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11551
|
+
Form$2.Field,
|
|
11552
|
+
{
|
|
11553
|
+
control: form.control,
|
|
11554
|
+
name: "last_name",
|
|
11555
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11556
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11558
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11559
|
+
] })
|
|
11560
|
+
}
|
|
11561
|
+
)
|
|
11562
|
+
] }),
|
|
11563
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11564
|
+
Form$2.Field,
|
|
11565
|
+
{
|
|
11566
|
+
control: form.control,
|
|
11567
|
+
name: "company",
|
|
11568
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11569
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11570
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11571
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11572
|
+
] })
|
|
11573
|
+
}
|
|
11574
|
+
),
|
|
11575
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11576
|
+
Form$2.Field,
|
|
11577
|
+
{
|
|
11578
|
+
control: form.control,
|
|
11579
|
+
name: "address_1",
|
|
11580
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11581
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11582
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11583
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11584
|
+
] })
|
|
11585
|
+
}
|
|
11586
|
+
),
|
|
11587
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11588
|
+
Form$2.Field,
|
|
11589
|
+
{
|
|
11590
|
+
control: form.control,
|
|
11591
|
+
name: "address_2",
|
|
11592
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11593
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11594
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11595
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11596
|
+
] })
|
|
11597
|
+
}
|
|
11598
|
+
),
|
|
11599
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11600
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11601
|
+
Form$2.Field,
|
|
11602
|
+
{
|
|
11603
|
+
control: form.control,
|
|
11604
|
+
name: "postal_code",
|
|
11605
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11606
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11607
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11608
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11609
|
+
] })
|
|
11610
|
+
}
|
|
11611
|
+
),
|
|
11612
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11613
|
+
Form$2.Field,
|
|
11614
|
+
{
|
|
11615
|
+
control: form.control,
|
|
11616
|
+
name: "city",
|
|
11617
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11618
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11619
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11620
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11621
|
+
] })
|
|
11622
|
+
}
|
|
11623
|
+
)
|
|
11624
|
+
] }),
|
|
11625
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11626
|
+
Form$2.Field,
|
|
11627
|
+
{
|
|
11628
|
+
control: form.control,
|
|
11629
|
+
name: "province",
|
|
11630
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11631
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11632
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11633
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11634
|
+
] })
|
|
11635
|
+
}
|
|
11636
|
+
),
|
|
11637
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11638
|
+
Form$2.Field,
|
|
11639
|
+
{
|
|
11640
|
+
control: form.control,
|
|
11641
|
+
name: "phone",
|
|
11642
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11643
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11644
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11645
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11646
|
+
] })
|
|
11647
|
+
}
|
|
11648
|
+
)
|
|
11649
|
+
] }) }),
|
|
11650
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11651
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11652
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11653
|
+
] }) })
|
|
11654
|
+
]
|
|
11655
|
+
}
|
|
11656
|
+
) });
|
|
11657
|
+
};
|
|
11658
|
+
const schema$2 = addressSchema;
|
|
11456
11659
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11457
11660
|
const Shipping = () => {
|
|
11458
11661
|
var _a;
|
|
@@ -12260,209 +12463,6 @@ const CustomAmountField = ({
|
|
|
12260
12463
|
}
|
|
12261
12464
|
);
|
|
12262
12465
|
};
|
|
12263
|
-
const ShippingAddress = () => {
|
|
12264
|
-
const { id } = reactRouterDom.useParams();
|
|
12265
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12266
|
-
fields: "+shipping_address"
|
|
12267
|
-
});
|
|
12268
|
-
if (isError) {
|
|
12269
|
-
throw error;
|
|
12270
|
-
}
|
|
12271
|
-
const isReady = !isPending && !!order;
|
|
12272
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12273
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12274
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
12275
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12276
|
-
] }),
|
|
12277
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
12278
|
-
] });
|
|
12279
|
-
};
|
|
12280
|
-
const ShippingAddressForm = ({ order }) => {
|
|
12281
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12282
|
-
const form = reactHookForm.useForm({
|
|
12283
|
-
defaultValues: {
|
|
12284
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12285
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12286
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12287
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12288
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12289
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12290
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12291
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12292
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12293
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12294
|
-
},
|
|
12295
|
-
resolver: zod.zodResolver(schema$2)
|
|
12296
|
-
});
|
|
12297
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12298
|
-
const { handleSuccess } = useRouteModal();
|
|
12299
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12300
|
-
await mutateAsync(
|
|
12301
|
-
{
|
|
12302
|
-
shipping_address: {
|
|
12303
|
-
first_name: data.first_name,
|
|
12304
|
-
last_name: data.last_name,
|
|
12305
|
-
company: data.company,
|
|
12306
|
-
address_1: data.address_1,
|
|
12307
|
-
address_2: data.address_2,
|
|
12308
|
-
city: data.city,
|
|
12309
|
-
province: data.province,
|
|
12310
|
-
country_code: data.country_code,
|
|
12311
|
-
postal_code: data.postal_code,
|
|
12312
|
-
phone: data.phone
|
|
12313
|
-
}
|
|
12314
|
-
},
|
|
12315
|
-
{
|
|
12316
|
-
onSuccess: () => {
|
|
12317
|
-
handleSuccess();
|
|
12318
|
-
},
|
|
12319
|
-
onError: (error) => {
|
|
12320
|
-
ui.toast.error(error.message);
|
|
12321
|
-
}
|
|
12322
|
-
}
|
|
12323
|
-
);
|
|
12324
|
-
});
|
|
12325
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12326
|
-
KeyboundForm,
|
|
12327
|
-
{
|
|
12328
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12329
|
-
onSubmit,
|
|
12330
|
-
children: [
|
|
12331
|
-
/* @__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: [
|
|
12332
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12333
|
-
Form$2.Field,
|
|
12334
|
-
{
|
|
12335
|
-
control: form.control,
|
|
12336
|
-
name: "country_code",
|
|
12337
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12338
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12339
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12340
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12341
|
-
] })
|
|
12342
|
-
}
|
|
12343
|
-
),
|
|
12344
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12345
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12346
|
-
Form$2.Field,
|
|
12347
|
-
{
|
|
12348
|
-
control: form.control,
|
|
12349
|
-
name: "first_name",
|
|
12350
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12351
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12352
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12353
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12354
|
-
] })
|
|
12355
|
-
}
|
|
12356
|
-
),
|
|
12357
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12358
|
-
Form$2.Field,
|
|
12359
|
-
{
|
|
12360
|
-
control: form.control,
|
|
12361
|
-
name: "last_name",
|
|
12362
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12363
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12364
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12365
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12366
|
-
] })
|
|
12367
|
-
}
|
|
12368
|
-
)
|
|
12369
|
-
] }),
|
|
12370
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12371
|
-
Form$2.Field,
|
|
12372
|
-
{
|
|
12373
|
-
control: form.control,
|
|
12374
|
-
name: "company",
|
|
12375
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12376
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12377
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12378
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12379
|
-
] })
|
|
12380
|
-
}
|
|
12381
|
-
),
|
|
12382
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12383
|
-
Form$2.Field,
|
|
12384
|
-
{
|
|
12385
|
-
control: form.control,
|
|
12386
|
-
name: "address_1",
|
|
12387
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12388
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12389
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12390
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12391
|
-
] })
|
|
12392
|
-
}
|
|
12393
|
-
),
|
|
12394
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12395
|
-
Form$2.Field,
|
|
12396
|
-
{
|
|
12397
|
-
control: form.control,
|
|
12398
|
-
name: "address_2",
|
|
12399
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12400
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12401
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12402
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12403
|
-
] })
|
|
12404
|
-
}
|
|
12405
|
-
),
|
|
12406
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12407
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12408
|
-
Form$2.Field,
|
|
12409
|
-
{
|
|
12410
|
-
control: form.control,
|
|
12411
|
-
name: "postal_code",
|
|
12412
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12413
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12414
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12415
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12416
|
-
] })
|
|
12417
|
-
}
|
|
12418
|
-
),
|
|
12419
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12420
|
-
Form$2.Field,
|
|
12421
|
-
{
|
|
12422
|
-
control: form.control,
|
|
12423
|
-
name: "city",
|
|
12424
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12425
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12426
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12427
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12428
|
-
] })
|
|
12429
|
-
}
|
|
12430
|
-
)
|
|
12431
|
-
] }),
|
|
12432
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12433
|
-
Form$2.Field,
|
|
12434
|
-
{
|
|
12435
|
-
control: form.control,
|
|
12436
|
-
name: "province",
|
|
12437
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12438
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12439
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12440
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12441
|
-
] })
|
|
12442
|
-
}
|
|
12443
|
-
),
|
|
12444
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12445
|
-
Form$2.Field,
|
|
12446
|
-
{
|
|
12447
|
-
control: form.control,
|
|
12448
|
-
name: "phone",
|
|
12449
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12450
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12451
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12452
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12453
|
-
] })
|
|
12454
|
-
}
|
|
12455
|
-
)
|
|
12456
|
-
] }) }),
|
|
12457
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12458
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12459
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12460
|
-
] }) })
|
|
12461
|
-
]
|
|
12462
|
-
}
|
|
12463
|
-
) });
|
|
12464
|
-
};
|
|
12465
|
-
const schema$2 = addressSchema;
|
|
12466
12466
|
const TransferOwnership = () => {
|
|
12467
12467
|
const { id } = reactRouterDom.useParams();
|
|
12468
12468
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13089,14 +13089,14 @@ const routeModule = {
|
|
|
13089
13089
|
Component: Promotions,
|
|
13090
13090
|
path: "/draft-orders/:id/promotions"
|
|
13091
13091
|
},
|
|
13092
|
-
{
|
|
13093
|
-
Component: Shipping,
|
|
13094
|
-
path: "/draft-orders/:id/shipping"
|
|
13095
|
-
},
|
|
13096
13092
|
{
|
|
13097
13093
|
Component: ShippingAddress,
|
|
13098
13094
|
path: "/draft-orders/:id/shipping-address"
|
|
13099
13095
|
},
|
|
13096
|
+
{
|
|
13097
|
+
Component: Shipping,
|
|
13098
|
+
path: "/draft-orders/:id/shipping"
|
|
13099
|
+
},
|
|
13100
13100
|
{
|
|
13101
13101
|
Component: TransferOwnership,
|
|
13102
13102
|
path: "/draft-orders/:id/transfer-ownership"
|
|
@@ -11447,6 +11447,209 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11447
11447
|
}
|
|
11448
11448
|
return Array.from(promotionIds);
|
|
11449
11449
|
}
|
|
11450
|
+
const ShippingAddress = () => {
|
|
11451
|
+
const { id } = useParams();
|
|
11452
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11453
|
+
fields: "+shipping_address"
|
|
11454
|
+
});
|
|
11455
|
+
if (isError) {
|
|
11456
|
+
throw error;
|
|
11457
|
+
}
|
|
11458
|
+
const isReady = !isPending && !!order;
|
|
11459
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11460
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11461
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
11462
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11463
|
+
] }),
|
|
11464
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
11465
|
+
] });
|
|
11466
|
+
};
|
|
11467
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11468
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11469
|
+
const form = useForm({
|
|
11470
|
+
defaultValues: {
|
|
11471
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11472
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11473
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11474
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11475
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11476
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11477
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11478
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11479
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11480
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11481
|
+
},
|
|
11482
|
+
resolver: zodResolver(schema$2)
|
|
11483
|
+
});
|
|
11484
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11485
|
+
const { handleSuccess } = useRouteModal();
|
|
11486
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11487
|
+
await mutateAsync(
|
|
11488
|
+
{
|
|
11489
|
+
shipping_address: {
|
|
11490
|
+
first_name: data.first_name,
|
|
11491
|
+
last_name: data.last_name,
|
|
11492
|
+
company: data.company,
|
|
11493
|
+
address_1: data.address_1,
|
|
11494
|
+
address_2: data.address_2,
|
|
11495
|
+
city: data.city,
|
|
11496
|
+
province: data.province,
|
|
11497
|
+
country_code: data.country_code,
|
|
11498
|
+
postal_code: data.postal_code,
|
|
11499
|
+
phone: data.phone
|
|
11500
|
+
}
|
|
11501
|
+
},
|
|
11502
|
+
{
|
|
11503
|
+
onSuccess: () => {
|
|
11504
|
+
handleSuccess();
|
|
11505
|
+
},
|
|
11506
|
+
onError: (error) => {
|
|
11507
|
+
toast.error(error.message);
|
|
11508
|
+
}
|
|
11509
|
+
}
|
|
11510
|
+
);
|
|
11511
|
+
});
|
|
11512
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11513
|
+
KeyboundForm,
|
|
11514
|
+
{
|
|
11515
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11516
|
+
onSubmit,
|
|
11517
|
+
children: [
|
|
11518
|
+
/* @__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: [
|
|
11519
|
+
/* @__PURE__ */ jsx(
|
|
11520
|
+
Form$2.Field,
|
|
11521
|
+
{
|
|
11522
|
+
control: form.control,
|
|
11523
|
+
name: "country_code",
|
|
11524
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11525
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11526
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11527
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11528
|
+
] })
|
|
11529
|
+
}
|
|
11530
|
+
),
|
|
11531
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11532
|
+
/* @__PURE__ */ jsx(
|
|
11533
|
+
Form$2.Field,
|
|
11534
|
+
{
|
|
11535
|
+
control: form.control,
|
|
11536
|
+
name: "first_name",
|
|
11537
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11538
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11539
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11540
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11541
|
+
] })
|
|
11542
|
+
}
|
|
11543
|
+
),
|
|
11544
|
+
/* @__PURE__ */ jsx(
|
|
11545
|
+
Form$2.Field,
|
|
11546
|
+
{
|
|
11547
|
+
control: form.control,
|
|
11548
|
+
name: "last_name",
|
|
11549
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11550
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11551
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11552
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11553
|
+
] })
|
|
11554
|
+
}
|
|
11555
|
+
)
|
|
11556
|
+
] }),
|
|
11557
|
+
/* @__PURE__ */ jsx(
|
|
11558
|
+
Form$2.Field,
|
|
11559
|
+
{
|
|
11560
|
+
control: form.control,
|
|
11561
|
+
name: "company",
|
|
11562
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11563
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11564
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11565
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11566
|
+
] })
|
|
11567
|
+
}
|
|
11568
|
+
),
|
|
11569
|
+
/* @__PURE__ */ jsx(
|
|
11570
|
+
Form$2.Field,
|
|
11571
|
+
{
|
|
11572
|
+
control: form.control,
|
|
11573
|
+
name: "address_1",
|
|
11574
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11575
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11576
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11577
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11578
|
+
] })
|
|
11579
|
+
}
|
|
11580
|
+
),
|
|
11581
|
+
/* @__PURE__ */ jsx(
|
|
11582
|
+
Form$2.Field,
|
|
11583
|
+
{
|
|
11584
|
+
control: form.control,
|
|
11585
|
+
name: "address_2",
|
|
11586
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11587
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11588
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11589
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11590
|
+
] })
|
|
11591
|
+
}
|
|
11592
|
+
),
|
|
11593
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11594
|
+
/* @__PURE__ */ jsx(
|
|
11595
|
+
Form$2.Field,
|
|
11596
|
+
{
|
|
11597
|
+
control: form.control,
|
|
11598
|
+
name: "postal_code",
|
|
11599
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11600
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11601
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11602
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11603
|
+
] })
|
|
11604
|
+
}
|
|
11605
|
+
),
|
|
11606
|
+
/* @__PURE__ */ jsx(
|
|
11607
|
+
Form$2.Field,
|
|
11608
|
+
{
|
|
11609
|
+
control: form.control,
|
|
11610
|
+
name: "city",
|
|
11611
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11612
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11613
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11614
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11615
|
+
] })
|
|
11616
|
+
}
|
|
11617
|
+
)
|
|
11618
|
+
] }),
|
|
11619
|
+
/* @__PURE__ */ jsx(
|
|
11620
|
+
Form$2.Field,
|
|
11621
|
+
{
|
|
11622
|
+
control: form.control,
|
|
11623
|
+
name: "province",
|
|
11624
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11625
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11626
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11627
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11628
|
+
] })
|
|
11629
|
+
}
|
|
11630
|
+
),
|
|
11631
|
+
/* @__PURE__ */ jsx(
|
|
11632
|
+
Form$2.Field,
|
|
11633
|
+
{
|
|
11634
|
+
control: form.control,
|
|
11635
|
+
name: "phone",
|
|
11636
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11637
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11638
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11639
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11640
|
+
] })
|
|
11641
|
+
}
|
|
11642
|
+
)
|
|
11643
|
+
] }) }),
|
|
11644
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11645
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11646
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11647
|
+
] }) })
|
|
11648
|
+
]
|
|
11649
|
+
}
|
|
11650
|
+
) });
|
|
11651
|
+
};
|
|
11652
|
+
const schema$2 = addressSchema;
|
|
11450
11653
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11451
11654
|
const Shipping = () => {
|
|
11452
11655
|
var _a;
|
|
@@ -12254,209 +12457,6 @@ const CustomAmountField = ({
|
|
|
12254
12457
|
}
|
|
12255
12458
|
);
|
|
12256
12459
|
};
|
|
12257
|
-
const ShippingAddress = () => {
|
|
12258
|
-
const { id } = useParams();
|
|
12259
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12260
|
-
fields: "+shipping_address"
|
|
12261
|
-
});
|
|
12262
|
-
if (isError) {
|
|
12263
|
-
throw error;
|
|
12264
|
-
}
|
|
12265
|
-
const isReady = !isPending && !!order;
|
|
12266
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12267
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12268
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12269
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12270
|
-
] }),
|
|
12271
|
-
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12272
|
-
] });
|
|
12273
|
-
};
|
|
12274
|
-
const ShippingAddressForm = ({ order }) => {
|
|
12275
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12276
|
-
const form = useForm({
|
|
12277
|
-
defaultValues: {
|
|
12278
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12279
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12280
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12281
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12282
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12283
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12284
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12285
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12286
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12287
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12288
|
-
},
|
|
12289
|
-
resolver: zodResolver(schema$2)
|
|
12290
|
-
});
|
|
12291
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12292
|
-
const { handleSuccess } = useRouteModal();
|
|
12293
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12294
|
-
await mutateAsync(
|
|
12295
|
-
{
|
|
12296
|
-
shipping_address: {
|
|
12297
|
-
first_name: data.first_name,
|
|
12298
|
-
last_name: data.last_name,
|
|
12299
|
-
company: data.company,
|
|
12300
|
-
address_1: data.address_1,
|
|
12301
|
-
address_2: data.address_2,
|
|
12302
|
-
city: data.city,
|
|
12303
|
-
province: data.province,
|
|
12304
|
-
country_code: data.country_code,
|
|
12305
|
-
postal_code: data.postal_code,
|
|
12306
|
-
phone: data.phone
|
|
12307
|
-
}
|
|
12308
|
-
},
|
|
12309
|
-
{
|
|
12310
|
-
onSuccess: () => {
|
|
12311
|
-
handleSuccess();
|
|
12312
|
-
},
|
|
12313
|
-
onError: (error) => {
|
|
12314
|
-
toast.error(error.message);
|
|
12315
|
-
}
|
|
12316
|
-
}
|
|
12317
|
-
);
|
|
12318
|
-
});
|
|
12319
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12320
|
-
KeyboundForm,
|
|
12321
|
-
{
|
|
12322
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12323
|
-
onSubmit,
|
|
12324
|
-
children: [
|
|
12325
|
-
/* @__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: [
|
|
12326
|
-
/* @__PURE__ */ jsx(
|
|
12327
|
-
Form$2.Field,
|
|
12328
|
-
{
|
|
12329
|
-
control: form.control,
|
|
12330
|
-
name: "country_code",
|
|
12331
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12332
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12333
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12334
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12335
|
-
] })
|
|
12336
|
-
}
|
|
12337
|
-
),
|
|
12338
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12339
|
-
/* @__PURE__ */ jsx(
|
|
12340
|
-
Form$2.Field,
|
|
12341
|
-
{
|
|
12342
|
-
control: form.control,
|
|
12343
|
-
name: "first_name",
|
|
12344
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12345
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12346
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12347
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12348
|
-
] })
|
|
12349
|
-
}
|
|
12350
|
-
),
|
|
12351
|
-
/* @__PURE__ */ jsx(
|
|
12352
|
-
Form$2.Field,
|
|
12353
|
-
{
|
|
12354
|
-
control: form.control,
|
|
12355
|
-
name: "last_name",
|
|
12356
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12357
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12358
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12359
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12360
|
-
] })
|
|
12361
|
-
}
|
|
12362
|
-
)
|
|
12363
|
-
] }),
|
|
12364
|
-
/* @__PURE__ */ jsx(
|
|
12365
|
-
Form$2.Field,
|
|
12366
|
-
{
|
|
12367
|
-
control: form.control,
|
|
12368
|
-
name: "company",
|
|
12369
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12370
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12371
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12372
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12373
|
-
] })
|
|
12374
|
-
}
|
|
12375
|
-
),
|
|
12376
|
-
/* @__PURE__ */ jsx(
|
|
12377
|
-
Form$2.Field,
|
|
12378
|
-
{
|
|
12379
|
-
control: form.control,
|
|
12380
|
-
name: "address_1",
|
|
12381
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12382
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12383
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12384
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12385
|
-
] })
|
|
12386
|
-
}
|
|
12387
|
-
),
|
|
12388
|
-
/* @__PURE__ */ jsx(
|
|
12389
|
-
Form$2.Field,
|
|
12390
|
-
{
|
|
12391
|
-
control: form.control,
|
|
12392
|
-
name: "address_2",
|
|
12393
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12394
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12395
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12396
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12397
|
-
] })
|
|
12398
|
-
}
|
|
12399
|
-
),
|
|
12400
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12401
|
-
/* @__PURE__ */ jsx(
|
|
12402
|
-
Form$2.Field,
|
|
12403
|
-
{
|
|
12404
|
-
control: form.control,
|
|
12405
|
-
name: "postal_code",
|
|
12406
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12407
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12408
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12409
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12410
|
-
] })
|
|
12411
|
-
}
|
|
12412
|
-
),
|
|
12413
|
-
/* @__PURE__ */ jsx(
|
|
12414
|
-
Form$2.Field,
|
|
12415
|
-
{
|
|
12416
|
-
control: form.control,
|
|
12417
|
-
name: "city",
|
|
12418
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12419
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12420
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12421
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12422
|
-
] })
|
|
12423
|
-
}
|
|
12424
|
-
)
|
|
12425
|
-
] }),
|
|
12426
|
-
/* @__PURE__ */ jsx(
|
|
12427
|
-
Form$2.Field,
|
|
12428
|
-
{
|
|
12429
|
-
control: form.control,
|
|
12430
|
-
name: "province",
|
|
12431
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12432
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12433
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12434
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12435
|
-
] })
|
|
12436
|
-
}
|
|
12437
|
-
),
|
|
12438
|
-
/* @__PURE__ */ jsx(
|
|
12439
|
-
Form$2.Field,
|
|
12440
|
-
{
|
|
12441
|
-
control: form.control,
|
|
12442
|
-
name: "phone",
|
|
12443
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12444
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12445
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12446
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12447
|
-
] })
|
|
12448
|
-
}
|
|
12449
|
-
)
|
|
12450
|
-
] }) }),
|
|
12451
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12452
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12453
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12454
|
-
] }) })
|
|
12455
|
-
]
|
|
12456
|
-
}
|
|
12457
|
-
) });
|
|
12458
|
-
};
|
|
12459
|
-
const schema$2 = addressSchema;
|
|
12460
12460
|
const TransferOwnership = () => {
|
|
12461
12461
|
const { id } = useParams();
|
|
12462
12462
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13083,14 +13083,14 @@ const routeModule = {
|
|
|
13083
13083
|
Component: Promotions,
|
|
13084
13084
|
path: "/draft-orders/:id/promotions"
|
|
13085
13085
|
},
|
|
13086
|
-
{
|
|
13087
|
-
Component: Shipping,
|
|
13088
|
-
path: "/draft-orders/:id/shipping"
|
|
13089
|
-
},
|
|
13090
13086
|
{
|
|
13091
13087
|
Component: ShippingAddress,
|
|
13092
13088
|
path: "/draft-orders/:id/shipping-address"
|
|
13093
13089
|
},
|
|
13090
|
+
{
|
|
13091
|
+
Component: Shipping,
|
|
13092
|
+
path: "/draft-orders/:id/shipping"
|
|
13093
|
+
},
|
|
13094
13094
|
{
|
|
13095
13095
|
Component: TransferOwnership,
|
|
13096
13096
|
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.0-preview-
|
|
3
|
+
"version": "2.11.0-preview-20251017120203",
|
|
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.0-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.0-preview-20251017120203",
|
|
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.0-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.0-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.0-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.0-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.0-preview-
|
|
53
|
-
"@medusajs/types": "2.11.0-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.0-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.0-preview-20251017120203",
|
|
49
|
+
"@medusajs/cli": "2.11.0-preview-20251017120203",
|
|
50
|
+
"@medusajs/framework": "2.11.0-preview-20251017120203",
|
|
51
|
+
"@medusajs/icons": "2.11.0-preview-20251017120203",
|
|
52
|
+
"@medusajs/test-utils": "2.11.0-preview-20251017120203",
|
|
53
|
+
"@medusajs/types": "2.11.0-preview-20251017120203",
|
|
54
|
+
"@medusajs/ui": "4.0.24-preview-20251017120203",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.0-preview-20251017120203",
|
|
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.0-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.0-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.0-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.0-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.0-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.24-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.0-preview-20251017120203",
|
|
73
|
+
"@medusajs/cli": "2.11.0-preview-20251017120203",
|
|
74
|
+
"@medusajs/framework": "2.11.0-preview-20251017120203",
|
|
75
|
+
"@medusajs/icons": "2.11.0-preview-20251017120203",
|
|
76
|
+
"@medusajs/test-utils": "2.11.0-preview-20251017120203",
|
|
77
|
+
"@medusajs/ui": "4.0.24-preview-20251017120203",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|