@medusajs/draft-order 2.11.1-preview-20251024000302 → 2.11.1-preview-20251024031436
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
|
@@ -11367,6 +11367,209 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11367
11367
|
const schema$3 = objectType({
|
|
11368
11368
|
sales_channel_id: stringType().min(1)
|
|
11369
11369
|
});
|
|
11370
|
+
const ShippingAddress = () => {
|
|
11371
|
+
const { id } = reactRouterDom.useParams();
|
|
11372
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11373
|
+
fields: "+shipping_address"
|
|
11374
|
+
});
|
|
11375
|
+
if (isError) {
|
|
11376
|
+
throw error;
|
|
11377
|
+
}
|
|
11378
|
+
const isReady = !isPending && !!order;
|
|
11379
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11380
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11381
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
11382
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11383
|
+
] }),
|
|
11384
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
11385
|
+
] });
|
|
11386
|
+
};
|
|
11387
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11388
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11389
|
+
const form = reactHookForm.useForm({
|
|
11390
|
+
defaultValues: {
|
|
11391
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11392
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11393
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11394
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11395
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11396
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11397
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11398
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11399
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11400
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11401
|
+
},
|
|
11402
|
+
resolver: zod.zodResolver(schema$2)
|
|
11403
|
+
});
|
|
11404
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11405
|
+
const { handleSuccess } = useRouteModal();
|
|
11406
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11407
|
+
await mutateAsync(
|
|
11408
|
+
{
|
|
11409
|
+
shipping_address: {
|
|
11410
|
+
first_name: data.first_name,
|
|
11411
|
+
last_name: data.last_name,
|
|
11412
|
+
company: data.company,
|
|
11413
|
+
address_1: data.address_1,
|
|
11414
|
+
address_2: data.address_2,
|
|
11415
|
+
city: data.city,
|
|
11416
|
+
province: data.province,
|
|
11417
|
+
country_code: data.country_code,
|
|
11418
|
+
postal_code: data.postal_code,
|
|
11419
|
+
phone: data.phone
|
|
11420
|
+
}
|
|
11421
|
+
},
|
|
11422
|
+
{
|
|
11423
|
+
onSuccess: () => {
|
|
11424
|
+
handleSuccess();
|
|
11425
|
+
},
|
|
11426
|
+
onError: (error) => {
|
|
11427
|
+
ui.toast.error(error.message);
|
|
11428
|
+
}
|
|
11429
|
+
}
|
|
11430
|
+
);
|
|
11431
|
+
});
|
|
11432
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11433
|
+
KeyboundForm,
|
|
11434
|
+
{
|
|
11435
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11436
|
+
onSubmit,
|
|
11437
|
+
children: [
|
|
11438
|
+
/* @__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: [
|
|
11439
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11440
|
+
Form$2.Field,
|
|
11441
|
+
{
|
|
11442
|
+
control: form.control,
|
|
11443
|
+
name: "country_code",
|
|
11444
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11445
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11446
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11447
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11448
|
+
] })
|
|
11449
|
+
}
|
|
11450
|
+
),
|
|
11451
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11452
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11453
|
+
Form$2.Field,
|
|
11454
|
+
{
|
|
11455
|
+
control: form.control,
|
|
11456
|
+
name: "first_name",
|
|
11457
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11458
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11459
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11460
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11461
|
+
] })
|
|
11462
|
+
}
|
|
11463
|
+
),
|
|
11464
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11465
|
+
Form$2.Field,
|
|
11466
|
+
{
|
|
11467
|
+
control: form.control,
|
|
11468
|
+
name: "last_name",
|
|
11469
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11470
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11471
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11472
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11473
|
+
] })
|
|
11474
|
+
}
|
|
11475
|
+
)
|
|
11476
|
+
] }),
|
|
11477
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11478
|
+
Form$2.Field,
|
|
11479
|
+
{
|
|
11480
|
+
control: form.control,
|
|
11481
|
+
name: "company",
|
|
11482
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11483
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11484
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11485
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11486
|
+
] })
|
|
11487
|
+
}
|
|
11488
|
+
),
|
|
11489
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11490
|
+
Form$2.Field,
|
|
11491
|
+
{
|
|
11492
|
+
control: form.control,
|
|
11493
|
+
name: "address_1",
|
|
11494
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11495
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11496
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11497
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11498
|
+
] })
|
|
11499
|
+
}
|
|
11500
|
+
),
|
|
11501
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11502
|
+
Form$2.Field,
|
|
11503
|
+
{
|
|
11504
|
+
control: form.control,
|
|
11505
|
+
name: "address_2",
|
|
11506
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11507
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11508
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11509
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11510
|
+
] })
|
|
11511
|
+
}
|
|
11512
|
+
),
|
|
11513
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11514
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11515
|
+
Form$2.Field,
|
|
11516
|
+
{
|
|
11517
|
+
control: form.control,
|
|
11518
|
+
name: "postal_code",
|
|
11519
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11520
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11521
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11522
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11523
|
+
] })
|
|
11524
|
+
}
|
|
11525
|
+
),
|
|
11526
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11527
|
+
Form$2.Field,
|
|
11528
|
+
{
|
|
11529
|
+
control: form.control,
|
|
11530
|
+
name: "city",
|
|
11531
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11532
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11533
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11534
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11535
|
+
] })
|
|
11536
|
+
}
|
|
11537
|
+
)
|
|
11538
|
+
] }),
|
|
11539
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11540
|
+
Form$2.Field,
|
|
11541
|
+
{
|
|
11542
|
+
control: form.control,
|
|
11543
|
+
name: "province",
|
|
11544
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11545
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11546
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11547
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11548
|
+
] })
|
|
11549
|
+
}
|
|
11550
|
+
),
|
|
11551
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11552
|
+
Form$2.Field,
|
|
11553
|
+
{
|
|
11554
|
+
control: form.control,
|
|
11555
|
+
name: "phone",
|
|
11556
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11557
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11558
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11559
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11560
|
+
] })
|
|
11561
|
+
}
|
|
11562
|
+
)
|
|
11563
|
+
] }) }),
|
|
11564
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11565
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11566
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11567
|
+
] }) })
|
|
11568
|
+
]
|
|
11569
|
+
}
|
|
11570
|
+
) });
|
|
11571
|
+
};
|
|
11572
|
+
const schema$2 = addressSchema;
|
|
11370
11573
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11371
11574
|
const Shipping = () => {
|
|
11372
11575
|
var _a;
|
|
@@ -12174,209 +12377,6 @@ const CustomAmountField = ({
|
|
|
12174
12377
|
}
|
|
12175
12378
|
);
|
|
12176
12379
|
};
|
|
12177
|
-
const ShippingAddress = () => {
|
|
12178
|
-
const { id } = reactRouterDom.useParams();
|
|
12179
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12180
|
-
fields: "+shipping_address"
|
|
12181
|
-
});
|
|
12182
|
-
if (isError) {
|
|
12183
|
-
throw error;
|
|
12184
|
-
}
|
|
12185
|
-
const isReady = !isPending && !!order;
|
|
12186
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12187
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12188
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
12189
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12190
|
-
] }),
|
|
12191
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
12192
|
-
] });
|
|
12193
|
-
};
|
|
12194
|
-
const ShippingAddressForm = ({ order }) => {
|
|
12195
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12196
|
-
const form = reactHookForm.useForm({
|
|
12197
|
-
defaultValues: {
|
|
12198
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12199
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12200
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12201
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12202
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12203
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12204
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12205
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12206
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12207
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12208
|
-
},
|
|
12209
|
-
resolver: zod.zodResolver(schema$2)
|
|
12210
|
-
});
|
|
12211
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12212
|
-
const { handleSuccess } = useRouteModal();
|
|
12213
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12214
|
-
await mutateAsync(
|
|
12215
|
-
{
|
|
12216
|
-
shipping_address: {
|
|
12217
|
-
first_name: data.first_name,
|
|
12218
|
-
last_name: data.last_name,
|
|
12219
|
-
company: data.company,
|
|
12220
|
-
address_1: data.address_1,
|
|
12221
|
-
address_2: data.address_2,
|
|
12222
|
-
city: data.city,
|
|
12223
|
-
province: data.province,
|
|
12224
|
-
country_code: data.country_code,
|
|
12225
|
-
postal_code: data.postal_code,
|
|
12226
|
-
phone: data.phone
|
|
12227
|
-
}
|
|
12228
|
-
},
|
|
12229
|
-
{
|
|
12230
|
-
onSuccess: () => {
|
|
12231
|
-
handleSuccess();
|
|
12232
|
-
},
|
|
12233
|
-
onError: (error) => {
|
|
12234
|
-
ui.toast.error(error.message);
|
|
12235
|
-
}
|
|
12236
|
-
}
|
|
12237
|
-
);
|
|
12238
|
-
});
|
|
12239
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12240
|
-
KeyboundForm,
|
|
12241
|
-
{
|
|
12242
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12243
|
-
onSubmit,
|
|
12244
|
-
children: [
|
|
12245
|
-
/* @__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: [
|
|
12246
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12247
|
-
Form$2.Field,
|
|
12248
|
-
{
|
|
12249
|
-
control: form.control,
|
|
12250
|
-
name: "country_code",
|
|
12251
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12252
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12253
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12254
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12255
|
-
] })
|
|
12256
|
-
}
|
|
12257
|
-
),
|
|
12258
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12259
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12260
|
-
Form$2.Field,
|
|
12261
|
-
{
|
|
12262
|
-
control: form.control,
|
|
12263
|
-
name: "first_name",
|
|
12264
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12265
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12266
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12267
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12268
|
-
] })
|
|
12269
|
-
}
|
|
12270
|
-
),
|
|
12271
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12272
|
-
Form$2.Field,
|
|
12273
|
-
{
|
|
12274
|
-
control: form.control,
|
|
12275
|
-
name: "last_name",
|
|
12276
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12277
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12278
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12279
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12280
|
-
] })
|
|
12281
|
-
}
|
|
12282
|
-
)
|
|
12283
|
-
] }),
|
|
12284
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12285
|
-
Form$2.Field,
|
|
12286
|
-
{
|
|
12287
|
-
control: form.control,
|
|
12288
|
-
name: "company",
|
|
12289
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12290
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12291
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12292
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12293
|
-
] })
|
|
12294
|
-
}
|
|
12295
|
-
),
|
|
12296
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12297
|
-
Form$2.Field,
|
|
12298
|
-
{
|
|
12299
|
-
control: form.control,
|
|
12300
|
-
name: "address_1",
|
|
12301
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12302
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12303
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12304
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12305
|
-
] })
|
|
12306
|
-
}
|
|
12307
|
-
),
|
|
12308
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12309
|
-
Form$2.Field,
|
|
12310
|
-
{
|
|
12311
|
-
control: form.control,
|
|
12312
|
-
name: "address_2",
|
|
12313
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12314
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12315
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12316
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12317
|
-
] })
|
|
12318
|
-
}
|
|
12319
|
-
),
|
|
12320
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12321
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12322
|
-
Form$2.Field,
|
|
12323
|
-
{
|
|
12324
|
-
control: form.control,
|
|
12325
|
-
name: "postal_code",
|
|
12326
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12327
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12328
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12329
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12330
|
-
] })
|
|
12331
|
-
}
|
|
12332
|
-
),
|
|
12333
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12334
|
-
Form$2.Field,
|
|
12335
|
-
{
|
|
12336
|
-
control: form.control,
|
|
12337
|
-
name: "city",
|
|
12338
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12339
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12340
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12341
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12342
|
-
] })
|
|
12343
|
-
}
|
|
12344
|
-
)
|
|
12345
|
-
] }),
|
|
12346
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12347
|
-
Form$2.Field,
|
|
12348
|
-
{
|
|
12349
|
-
control: form.control,
|
|
12350
|
-
name: "province",
|
|
12351
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12352
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12353
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12354
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12355
|
-
] })
|
|
12356
|
-
}
|
|
12357
|
-
),
|
|
12358
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12359
|
-
Form$2.Field,
|
|
12360
|
-
{
|
|
12361
|
-
control: form.control,
|
|
12362
|
-
name: "phone",
|
|
12363
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12364
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12365
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12366
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12367
|
-
] })
|
|
12368
|
-
}
|
|
12369
|
-
)
|
|
12370
|
-
] }) }),
|
|
12371
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12372
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12373
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12374
|
-
] }) })
|
|
12375
|
-
]
|
|
12376
|
-
}
|
|
12377
|
-
) });
|
|
12378
|
-
};
|
|
12379
|
-
const schema$2 = addressSchema;
|
|
12380
12380
|
const TransferOwnership = () => {
|
|
12381
12381
|
const { id } = reactRouterDom.useParams();
|
|
12382
12382
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13087,14 +13087,14 @@ const routeModule = {
|
|
|
13087
13087
|
Component: SalesChannel,
|
|
13088
13088
|
path: "/draft-orders/:id/sales-channel"
|
|
13089
13089
|
},
|
|
13090
|
-
{
|
|
13091
|
-
Component: Shipping,
|
|
13092
|
-
path: "/draft-orders/:id/shipping"
|
|
13093
|
-
},
|
|
13094
13090
|
{
|
|
13095
13091
|
Component: ShippingAddress,
|
|
13096
13092
|
path: "/draft-orders/:id/shipping-address"
|
|
13097
13093
|
},
|
|
13094
|
+
{
|
|
13095
|
+
Component: Shipping,
|
|
13096
|
+
path: "/draft-orders/:id/shipping"
|
|
13097
|
+
},
|
|
13098
13098
|
{
|
|
13099
13099
|
Component: TransferOwnership,
|
|
13100
13100
|
path: "/draft-orders/:id/transfer-ownership"
|
|
@@ -11361,6 +11361,209 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11361
11361
|
const schema$3 = objectType({
|
|
11362
11362
|
sales_channel_id: stringType().min(1)
|
|
11363
11363
|
});
|
|
11364
|
+
const ShippingAddress = () => {
|
|
11365
|
+
const { id } = useParams();
|
|
11366
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11367
|
+
fields: "+shipping_address"
|
|
11368
|
+
});
|
|
11369
|
+
if (isError) {
|
|
11370
|
+
throw error;
|
|
11371
|
+
}
|
|
11372
|
+
const isReady = !isPending && !!order;
|
|
11373
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11374
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11375
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
11376
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11377
|
+
] }),
|
|
11378
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
11379
|
+
] });
|
|
11380
|
+
};
|
|
11381
|
+
const ShippingAddressForm = ({ order }) => {
|
|
11382
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11383
|
+
const form = useForm({
|
|
11384
|
+
defaultValues: {
|
|
11385
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11386
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11387
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11388
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11389
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11390
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11391
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11392
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11393
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11394
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11395
|
+
},
|
|
11396
|
+
resolver: zodResolver(schema$2)
|
|
11397
|
+
});
|
|
11398
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11399
|
+
const { handleSuccess } = useRouteModal();
|
|
11400
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11401
|
+
await mutateAsync(
|
|
11402
|
+
{
|
|
11403
|
+
shipping_address: {
|
|
11404
|
+
first_name: data.first_name,
|
|
11405
|
+
last_name: data.last_name,
|
|
11406
|
+
company: data.company,
|
|
11407
|
+
address_1: data.address_1,
|
|
11408
|
+
address_2: data.address_2,
|
|
11409
|
+
city: data.city,
|
|
11410
|
+
province: data.province,
|
|
11411
|
+
country_code: data.country_code,
|
|
11412
|
+
postal_code: data.postal_code,
|
|
11413
|
+
phone: data.phone
|
|
11414
|
+
}
|
|
11415
|
+
},
|
|
11416
|
+
{
|
|
11417
|
+
onSuccess: () => {
|
|
11418
|
+
handleSuccess();
|
|
11419
|
+
},
|
|
11420
|
+
onError: (error) => {
|
|
11421
|
+
toast.error(error.message);
|
|
11422
|
+
}
|
|
11423
|
+
}
|
|
11424
|
+
);
|
|
11425
|
+
});
|
|
11426
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
11427
|
+
KeyboundForm,
|
|
11428
|
+
{
|
|
11429
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11430
|
+
onSubmit,
|
|
11431
|
+
children: [
|
|
11432
|
+
/* @__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: [
|
|
11433
|
+
/* @__PURE__ */ jsx(
|
|
11434
|
+
Form$2.Field,
|
|
11435
|
+
{
|
|
11436
|
+
control: form.control,
|
|
11437
|
+
name: "country_code",
|
|
11438
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11439
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
11440
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
11441
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11442
|
+
] })
|
|
11443
|
+
}
|
|
11444
|
+
),
|
|
11445
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11446
|
+
/* @__PURE__ */ jsx(
|
|
11447
|
+
Form$2.Field,
|
|
11448
|
+
{
|
|
11449
|
+
control: form.control,
|
|
11450
|
+
name: "first_name",
|
|
11451
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11452
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
11453
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11454
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11455
|
+
] })
|
|
11456
|
+
}
|
|
11457
|
+
),
|
|
11458
|
+
/* @__PURE__ */ jsx(
|
|
11459
|
+
Form$2.Field,
|
|
11460
|
+
{
|
|
11461
|
+
control: form.control,
|
|
11462
|
+
name: "last_name",
|
|
11463
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11464
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
11465
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11466
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11467
|
+
] })
|
|
11468
|
+
}
|
|
11469
|
+
)
|
|
11470
|
+
] }),
|
|
11471
|
+
/* @__PURE__ */ jsx(
|
|
11472
|
+
Form$2.Field,
|
|
11473
|
+
{
|
|
11474
|
+
control: form.control,
|
|
11475
|
+
name: "company",
|
|
11476
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11477
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11478
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11479
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11480
|
+
] })
|
|
11481
|
+
}
|
|
11482
|
+
),
|
|
11483
|
+
/* @__PURE__ */ jsx(
|
|
11484
|
+
Form$2.Field,
|
|
11485
|
+
{
|
|
11486
|
+
control: form.control,
|
|
11487
|
+
name: "address_1",
|
|
11488
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11489
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
11490
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11491
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11492
|
+
] })
|
|
11493
|
+
}
|
|
11494
|
+
),
|
|
11495
|
+
/* @__PURE__ */ jsx(
|
|
11496
|
+
Form$2.Field,
|
|
11497
|
+
{
|
|
11498
|
+
control: form.control,
|
|
11499
|
+
name: "address_2",
|
|
11500
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11501
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11502
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11503
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11504
|
+
] })
|
|
11505
|
+
}
|
|
11506
|
+
),
|
|
11507
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11508
|
+
/* @__PURE__ */ jsx(
|
|
11509
|
+
Form$2.Field,
|
|
11510
|
+
{
|
|
11511
|
+
control: form.control,
|
|
11512
|
+
name: "postal_code",
|
|
11513
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11514
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
11515
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11516
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11517
|
+
] })
|
|
11518
|
+
}
|
|
11519
|
+
),
|
|
11520
|
+
/* @__PURE__ */ jsx(
|
|
11521
|
+
Form$2.Field,
|
|
11522
|
+
{
|
|
11523
|
+
control: form.control,
|
|
11524
|
+
name: "city",
|
|
11525
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11526
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
11527
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11528
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11529
|
+
] })
|
|
11530
|
+
}
|
|
11531
|
+
)
|
|
11532
|
+
] }),
|
|
11533
|
+
/* @__PURE__ */ jsx(
|
|
11534
|
+
Form$2.Field,
|
|
11535
|
+
{
|
|
11536
|
+
control: form.control,
|
|
11537
|
+
name: "province",
|
|
11538
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11539
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11540
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11541
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11542
|
+
] })
|
|
11543
|
+
}
|
|
11544
|
+
),
|
|
11545
|
+
/* @__PURE__ */ jsx(
|
|
11546
|
+
Form$2.Field,
|
|
11547
|
+
{
|
|
11548
|
+
control: form.control,
|
|
11549
|
+
name: "phone",
|
|
11550
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
11551
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11552
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
11553
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
11554
|
+
] })
|
|
11555
|
+
}
|
|
11556
|
+
)
|
|
11557
|
+
] }) }),
|
|
11558
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11559
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11560
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11561
|
+
] }) })
|
|
11562
|
+
]
|
|
11563
|
+
}
|
|
11564
|
+
) });
|
|
11565
|
+
};
|
|
11566
|
+
const schema$2 = addressSchema;
|
|
11364
11567
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11365
11568
|
const Shipping = () => {
|
|
11366
11569
|
var _a;
|
|
@@ -12168,209 +12371,6 @@ const CustomAmountField = ({
|
|
|
12168
12371
|
}
|
|
12169
12372
|
);
|
|
12170
12373
|
};
|
|
12171
|
-
const ShippingAddress = () => {
|
|
12172
|
-
const { id } = useParams();
|
|
12173
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
12174
|
-
fields: "+shipping_address"
|
|
12175
|
-
});
|
|
12176
|
-
if (isError) {
|
|
12177
|
-
throw error;
|
|
12178
|
-
}
|
|
12179
|
-
const isReady = !isPending && !!order;
|
|
12180
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12181
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12182
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12183
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12184
|
-
] }),
|
|
12185
|
-
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12186
|
-
] });
|
|
12187
|
-
};
|
|
12188
|
-
const ShippingAddressForm = ({ order }) => {
|
|
12189
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12190
|
-
const form = useForm({
|
|
12191
|
-
defaultValues: {
|
|
12192
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12193
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12194
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12195
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12196
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12197
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12198
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12199
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12200
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12201
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12202
|
-
},
|
|
12203
|
-
resolver: zodResolver(schema$2)
|
|
12204
|
-
});
|
|
12205
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12206
|
-
const { handleSuccess } = useRouteModal();
|
|
12207
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
12208
|
-
await mutateAsync(
|
|
12209
|
-
{
|
|
12210
|
-
shipping_address: {
|
|
12211
|
-
first_name: data.first_name,
|
|
12212
|
-
last_name: data.last_name,
|
|
12213
|
-
company: data.company,
|
|
12214
|
-
address_1: data.address_1,
|
|
12215
|
-
address_2: data.address_2,
|
|
12216
|
-
city: data.city,
|
|
12217
|
-
province: data.province,
|
|
12218
|
-
country_code: data.country_code,
|
|
12219
|
-
postal_code: data.postal_code,
|
|
12220
|
-
phone: data.phone
|
|
12221
|
-
}
|
|
12222
|
-
},
|
|
12223
|
-
{
|
|
12224
|
-
onSuccess: () => {
|
|
12225
|
-
handleSuccess();
|
|
12226
|
-
},
|
|
12227
|
-
onError: (error) => {
|
|
12228
|
-
toast.error(error.message);
|
|
12229
|
-
}
|
|
12230
|
-
}
|
|
12231
|
-
);
|
|
12232
|
-
});
|
|
12233
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12234
|
-
KeyboundForm,
|
|
12235
|
-
{
|
|
12236
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
12237
|
-
onSubmit,
|
|
12238
|
-
children: [
|
|
12239
|
-
/* @__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: [
|
|
12240
|
-
/* @__PURE__ */ jsx(
|
|
12241
|
-
Form$2.Field,
|
|
12242
|
-
{
|
|
12243
|
-
control: form.control,
|
|
12244
|
-
name: "country_code",
|
|
12245
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12246
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12247
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12248
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12249
|
-
] })
|
|
12250
|
-
}
|
|
12251
|
-
),
|
|
12252
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12253
|
-
/* @__PURE__ */ jsx(
|
|
12254
|
-
Form$2.Field,
|
|
12255
|
-
{
|
|
12256
|
-
control: form.control,
|
|
12257
|
-
name: "first_name",
|
|
12258
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12259
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12260
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12261
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12262
|
-
] })
|
|
12263
|
-
}
|
|
12264
|
-
),
|
|
12265
|
-
/* @__PURE__ */ jsx(
|
|
12266
|
-
Form$2.Field,
|
|
12267
|
-
{
|
|
12268
|
-
control: form.control,
|
|
12269
|
-
name: "last_name",
|
|
12270
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12271
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12272
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12273
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12274
|
-
] })
|
|
12275
|
-
}
|
|
12276
|
-
)
|
|
12277
|
-
] }),
|
|
12278
|
-
/* @__PURE__ */ jsx(
|
|
12279
|
-
Form$2.Field,
|
|
12280
|
-
{
|
|
12281
|
-
control: form.control,
|
|
12282
|
-
name: "company",
|
|
12283
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12284
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12285
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12286
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12287
|
-
] })
|
|
12288
|
-
}
|
|
12289
|
-
),
|
|
12290
|
-
/* @__PURE__ */ jsx(
|
|
12291
|
-
Form$2.Field,
|
|
12292
|
-
{
|
|
12293
|
-
control: form.control,
|
|
12294
|
-
name: "address_1",
|
|
12295
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12296
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12297
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12298
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12299
|
-
] })
|
|
12300
|
-
}
|
|
12301
|
-
),
|
|
12302
|
-
/* @__PURE__ */ jsx(
|
|
12303
|
-
Form$2.Field,
|
|
12304
|
-
{
|
|
12305
|
-
control: form.control,
|
|
12306
|
-
name: "address_2",
|
|
12307
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12308
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12309
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12310
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12311
|
-
] })
|
|
12312
|
-
}
|
|
12313
|
-
),
|
|
12314
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12315
|
-
/* @__PURE__ */ jsx(
|
|
12316
|
-
Form$2.Field,
|
|
12317
|
-
{
|
|
12318
|
-
control: form.control,
|
|
12319
|
-
name: "postal_code",
|
|
12320
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12321
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12322
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12323
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12324
|
-
] })
|
|
12325
|
-
}
|
|
12326
|
-
),
|
|
12327
|
-
/* @__PURE__ */ jsx(
|
|
12328
|
-
Form$2.Field,
|
|
12329
|
-
{
|
|
12330
|
-
control: form.control,
|
|
12331
|
-
name: "city",
|
|
12332
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12333
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12334
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12335
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12336
|
-
] })
|
|
12337
|
-
}
|
|
12338
|
-
)
|
|
12339
|
-
] }),
|
|
12340
|
-
/* @__PURE__ */ jsx(
|
|
12341
|
-
Form$2.Field,
|
|
12342
|
-
{
|
|
12343
|
-
control: form.control,
|
|
12344
|
-
name: "province",
|
|
12345
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12346
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12347
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12348
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12349
|
-
] })
|
|
12350
|
-
}
|
|
12351
|
-
),
|
|
12352
|
-
/* @__PURE__ */ jsx(
|
|
12353
|
-
Form$2.Field,
|
|
12354
|
-
{
|
|
12355
|
-
control: form.control,
|
|
12356
|
-
name: "phone",
|
|
12357
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12358
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12359
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12360
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12361
|
-
] })
|
|
12362
|
-
}
|
|
12363
|
-
)
|
|
12364
|
-
] }) }),
|
|
12365
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12366
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12367
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12368
|
-
] }) })
|
|
12369
|
-
]
|
|
12370
|
-
}
|
|
12371
|
-
) });
|
|
12372
|
-
};
|
|
12373
|
-
const schema$2 = addressSchema;
|
|
12374
12374
|
const TransferOwnership = () => {
|
|
12375
12375
|
const { id } = useParams();
|
|
12376
12376
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13081,14 +13081,14 @@ const routeModule = {
|
|
|
13081
13081
|
Component: SalesChannel,
|
|
13082
13082
|
path: "/draft-orders/:id/sales-channel"
|
|
13083
13083
|
},
|
|
13084
|
-
{
|
|
13085
|
-
Component: Shipping,
|
|
13086
|
-
path: "/draft-orders/:id/shipping"
|
|
13087
|
-
},
|
|
13088
13084
|
{
|
|
13089
13085
|
Component: ShippingAddress,
|
|
13090
13086
|
path: "/draft-orders/:id/shipping-address"
|
|
13091
13087
|
},
|
|
13088
|
+
{
|
|
13089
|
+
Component: Shipping,
|
|
13090
|
+
path: "/draft-orders/:id/shipping"
|
|
13091
|
+
},
|
|
13092
13092
|
{
|
|
13093
13093
|
Component: TransferOwnership,
|
|
13094
13094
|
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.1-preview-
|
|
3
|
+
"version": "2.11.1-preview-20251024031436",
|
|
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.1-preview-
|
|
39
|
+
"@medusajs/js-sdk": "2.11.1-preview-20251024031436",
|
|
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.1-preview-
|
|
49
|
-
"@medusajs/cli": "2.11.1-preview-
|
|
50
|
-
"@medusajs/framework": "2.11.1-preview-
|
|
51
|
-
"@medusajs/icons": "2.11.1-preview-
|
|
52
|
-
"@medusajs/test-utils": "2.11.1-preview-
|
|
53
|
-
"@medusajs/types": "2.11.1-preview-
|
|
54
|
-
"@medusajs/ui": "4.0.25-preview-
|
|
55
|
-
"@medusajs/ui-preset": "2.11.1-preview-
|
|
48
|
+
"@medusajs/admin-sdk": "2.11.1-preview-20251024031436",
|
|
49
|
+
"@medusajs/cli": "2.11.1-preview-20251024031436",
|
|
50
|
+
"@medusajs/framework": "2.11.1-preview-20251024031436",
|
|
51
|
+
"@medusajs/icons": "2.11.1-preview-20251024031436",
|
|
52
|
+
"@medusajs/test-utils": "2.11.1-preview-20251024031436",
|
|
53
|
+
"@medusajs/types": "2.11.1-preview-20251024031436",
|
|
54
|
+
"@medusajs/ui": "4.0.25-preview-20251024031436",
|
|
55
|
+
"@medusajs/ui-preset": "2.11.1-preview-20251024031436",
|
|
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.1-preview-
|
|
73
|
-
"@medusajs/cli": "2.11.1-preview-
|
|
74
|
-
"@medusajs/framework": "2.11.1-preview-
|
|
75
|
-
"@medusajs/icons": "2.11.1-preview-
|
|
76
|
-
"@medusajs/test-utils": "2.11.1-preview-
|
|
77
|
-
"@medusajs/ui": "4.0.25-preview-
|
|
72
|
+
"@medusajs/admin-sdk": "2.11.1-preview-20251024031436",
|
|
73
|
+
"@medusajs/cli": "2.11.1-preview-20251024031436",
|
|
74
|
+
"@medusajs/framework": "2.11.1-preview-20251024031436",
|
|
75
|
+
"@medusajs/icons": "2.11.1-preview-20251024031436",
|
|
76
|
+
"@medusajs/test-utils": "2.11.1-preview-20251024031436",
|
|
77
|
+
"@medusajs/ui": "4.0.25-preview-20251024031436",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
79
|
"react-router-dom": "6.20.1"
|
|
80
80
|
},
|