@medusajs/draft-order 2.10.2-preview-20250901120156 → 2.10.2-preview-20250901150144

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.
@@ -9560,27 +9560,6 @@ const ID = () => {
9560
9560
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9561
  ] });
9562
9562
  };
9563
- const CustomItems = () => {
9564
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9565
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9566
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9567
- ] });
9568
- };
9569
- const CustomItemsForm = () => {
9570
- const form = reactHookForm.useForm({
9571
- resolver: zod.zodResolver(schema$5)
9572
- });
9573
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9574
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9575
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9576
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9577
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9578
- ] }) })
9579
- ] }) });
9580
- };
9581
- const schema$5 = objectType({
9582
- email: stringType().email()
9583
- });
9584
9563
  const Email = () => {
9585
9564
  const { id } = reactRouterDom.useParams();
9586
9565
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9603,7 +9582,7 @@ const EmailForm = ({ order }) => {
9603
9582
  defaultValues: {
9604
9583
  email: order.email ?? ""
9605
9584
  },
9606
- resolver: zod.zodResolver(schema$4)
9585
+ resolver: zod.zodResolver(schema$5)
9607
9586
  });
9608
9587
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9609
9588
  const { handleSuccess } = useRouteModal();
@@ -9646,7 +9625,7 @@ const EmailForm = ({ order }) => {
9646
9625
  }
9647
9626
  ) });
9648
9627
  };
9649
- const schema$4 = objectType({
9628
+ const schema$5 = objectType({
9650
9629
  email: stringType().email()
9651
9630
  });
9652
9631
  const NumberInput = React.forwardRef(
@@ -10623,6 +10602,27 @@ const customItemSchema = objectType({
10623
10602
  quantity: numberType(),
10624
10603
  unit_price: unionType([numberType(), stringType()])
10625
10604
  });
10605
+ const CustomItems = () => {
10606
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10607
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
10608
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
10609
+ ] });
10610
+ };
10611
+ const CustomItemsForm = () => {
10612
+ const form = reactHookForm.useForm({
10613
+ resolver: zod.zodResolver(schema$4)
10614
+ });
10615
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
10616
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
10617
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10618
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10619
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
10620
+ ] }) })
10621
+ ] }) });
10622
+ };
10623
+ const schema$4 = objectType({
10624
+ email: stringType().email()
10625
+ });
10626
10626
  const InlineTip = React.forwardRef(
10627
10627
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10628
10628
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11356,6 +11356,209 @@ const SalesChannelField = ({ control, order }) => {
11356
11356
  const schema$3 = objectType({
11357
11357
  sales_channel_id: stringType().min(1)
11358
11358
  });
11359
+ const ShippingAddress = () => {
11360
+ const { id } = reactRouterDom.useParams();
11361
+ const { order, isPending, isError, error } = useOrder(id, {
11362
+ fields: "+shipping_address"
11363
+ });
11364
+ if (isError) {
11365
+ throw error;
11366
+ }
11367
+ const isReady = !isPending && !!order;
11368
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11369
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11370
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
11371
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11372
+ ] }),
11373
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
11374
+ ] });
11375
+ };
11376
+ const ShippingAddressForm = ({ order }) => {
11377
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11378
+ const form = reactHookForm.useForm({
11379
+ defaultValues: {
11380
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11381
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11382
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11383
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11384
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11385
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11386
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11387
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11388
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11389
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11390
+ },
11391
+ resolver: zod.zodResolver(schema$2)
11392
+ });
11393
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11394
+ const { handleSuccess } = useRouteModal();
11395
+ const onSubmit = form.handleSubmit(async (data) => {
11396
+ await mutateAsync(
11397
+ {
11398
+ shipping_address: {
11399
+ first_name: data.first_name,
11400
+ last_name: data.last_name,
11401
+ company: data.company,
11402
+ address_1: data.address_1,
11403
+ address_2: data.address_2,
11404
+ city: data.city,
11405
+ province: data.province,
11406
+ country_code: data.country_code,
11407
+ postal_code: data.postal_code,
11408
+ phone: data.phone
11409
+ }
11410
+ },
11411
+ {
11412
+ onSuccess: () => {
11413
+ handleSuccess();
11414
+ },
11415
+ onError: (error) => {
11416
+ ui.toast.error(error.message);
11417
+ }
11418
+ }
11419
+ );
11420
+ });
11421
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11422
+ KeyboundForm,
11423
+ {
11424
+ className: "flex flex-1 flex-col overflow-hidden",
11425
+ onSubmit,
11426
+ children: [
11427
+ /* @__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: [
11428
+ /* @__PURE__ */ jsxRuntime.jsx(
11429
+ Form$2.Field,
11430
+ {
11431
+ control: form.control,
11432
+ name: "country_code",
11433
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11434
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11435
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11436
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11437
+ ] })
11438
+ }
11439
+ ),
11440
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11441
+ /* @__PURE__ */ jsxRuntime.jsx(
11442
+ Form$2.Field,
11443
+ {
11444
+ control: form.control,
11445
+ name: "first_name",
11446
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11447
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11448
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11449
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11450
+ ] })
11451
+ }
11452
+ ),
11453
+ /* @__PURE__ */ jsxRuntime.jsx(
11454
+ Form$2.Field,
11455
+ {
11456
+ control: form.control,
11457
+ name: "last_name",
11458
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11459
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11460
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11461
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11462
+ ] })
11463
+ }
11464
+ )
11465
+ ] }),
11466
+ /* @__PURE__ */ jsxRuntime.jsx(
11467
+ Form$2.Field,
11468
+ {
11469
+ control: form.control,
11470
+ name: "company",
11471
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11472
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11473
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11474
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11475
+ ] })
11476
+ }
11477
+ ),
11478
+ /* @__PURE__ */ jsxRuntime.jsx(
11479
+ Form$2.Field,
11480
+ {
11481
+ control: form.control,
11482
+ name: "address_1",
11483
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11484
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11485
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11486
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11487
+ ] })
11488
+ }
11489
+ ),
11490
+ /* @__PURE__ */ jsxRuntime.jsx(
11491
+ Form$2.Field,
11492
+ {
11493
+ control: form.control,
11494
+ name: "address_2",
11495
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11496
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11497
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11498
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11499
+ ] })
11500
+ }
11501
+ ),
11502
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11503
+ /* @__PURE__ */ jsxRuntime.jsx(
11504
+ Form$2.Field,
11505
+ {
11506
+ control: form.control,
11507
+ name: "postal_code",
11508
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11509
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11510
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11511
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11512
+ ] })
11513
+ }
11514
+ ),
11515
+ /* @__PURE__ */ jsxRuntime.jsx(
11516
+ Form$2.Field,
11517
+ {
11518
+ control: form.control,
11519
+ name: "city",
11520
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11521
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11522
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11523
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11524
+ ] })
11525
+ }
11526
+ )
11527
+ ] }),
11528
+ /* @__PURE__ */ jsxRuntime.jsx(
11529
+ Form$2.Field,
11530
+ {
11531
+ control: form.control,
11532
+ name: "province",
11533
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11534
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11535
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11536
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11537
+ ] })
11538
+ }
11539
+ ),
11540
+ /* @__PURE__ */ jsxRuntime.jsx(
11541
+ Form$2.Field,
11542
+ {
11543
+ control: form.control,
11544
+ name: "phone",
11545
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11546
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11547
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11548
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11549
+ ] })
11550
+ }
11551
+ )
11552
+ ] }) }),
11553
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11554
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11555
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11556
+ ] }) })
11557
+ ]
11558
+ }
11559
+ ) });
11560
+ };
11561
+ const schema$2 = addressSchema;
11359
11562
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11360
11563
  const Shipping = () => {
11361
11564
  var _a;
@@ -12163,209 +12366,6 @@ const CustomAmountField = ({
12163
12366
  }
12164
12367
  );
12165
12368
  };
12166
- const ShippingAddress = () => {
12167
- const { id } = reactRouterDom.useParams();
12168
- const { order, isPending, isError, error } = useOrder(id, {
12169
- fields: "+shipping_address"
12170
- });
12171
- if (isError) {
12172
- throw error;
12173
- }
12174
- const isReady = !isPending && !!order;
12175
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12176
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12177
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12178
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12179
- ] }),
12180
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12181
- ] });
12182
- };
12183
- const ShippingAddressForm = ({ order }) => {
12184
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12185
- const form = reactHookForm.useForm({
12186
- defaultValues: {
12187
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12188
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12189
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12190
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12191
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12192
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12193
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12194
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12195
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12196
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12197
- },
12198
- resolver: zod.zodResolver(schema$2)
12199
- });
12200
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12201
- const { handleSuccess } = useRouteModal();
12202
- const onSubmit = form.handleSubmit(async (data) => {
12203
- await mutateAsync(
12204
- {
12205
- shipping_address: {
12206
- first_name: data.first_name,
12207
- last_name: data.last_name,
12208
- company: data.company,
12209
- address_1: data.address_1,
12210
- address_2: data.address_2,
12211
- city: data.city,
12212
- province: data.province,
12213
- country_code: data.country_code,
12214
- postal_code: data.postal_code,
12215
- phone: data.phone
12216
- }
12217
- },
12218
- {
12219
- onSuccess: () => {
12220
- handleSuccess();
12221
- },
12222
- onError: (error) => {
12223
- ui.toast.error(error.message);
12224
- }
12225
- }
12226
- );
12227
- });
12228
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12229
- KeyboundForm,
12230
- {
12231
- className: "flex flex-1 flex-col overflow-hidden",
12232
- onSubmit,
12233
- children: [
12234
- /* @__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: [
12235
- /* @__PURE__ */ jsxRuntime.jsx(
12236
- Form$2.Field,
12237
- {
12238
- control: form.control,
12239
- name: "country_code",
12240
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12241
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12242
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12243
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12244
- ] })
12245
- }
12246
- ),
12247
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12248
- /* @__PURE__ */ jsxRuntime.jsx(
12249
- Form$2.Field,
12250
- {
12251
- control: form.control,
12252
- name: "first_name",
12253
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12254
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12255
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12256
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12257
- ] })
12258
- }
12259
- ),
12260
- /* @__PURE__ */ jsxRuntime.jsx(
12261
- Form$2.Field,
12262
- {
12263
- control: form.control,
12264
- name: "last_name",
12265
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12266
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12267
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12268
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12269
- ] })
12270
- }
12271
- )
12272
- ] }),
12273
- /* @__PURE__ */ jsxRuntime.jsx(
12274
- Form$2.Field,
12275
- {
12276
- control: form.control,
12277
- name: "company",
12278
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12279
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12280
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12281
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12282
- ] })
12283
- }
12284
- ),
12285
- /* @__PURE__ */ jsxRuntime.jsx(
12286
- Form$2.Field,
12287
- {
12288
- control: form.control,
12289
- name: "address_1",
12290
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12291
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12292
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12293
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12294
- ] })
12295
- }
12296
- ),
12297
- /* @__PURE__ */ jsxRuntime.jsx(
12298
- Form$2.Field,
12299
- {
12300
- control: form.control,
12301
- name: "address_2",
12302
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12303
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12304
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12305
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12306
- ] })
12307
- }
12308
- ),
12309
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12310
- /* @__PURE__ */ jsxRuntime.jsx(
12311
- Form$2.Field,
12312
- {
12313
- control: form.control,
12314
- name: "postal_code",
12315
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12316
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12317
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12318
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12319
- ] })
12320
- }
12321
- ),
12322
- /* @__PURE__ */ jsxRuntime.jsx(
12323
- Form$2.Field,
12324
- {
12325
- control: form.control,
12326
- name: "city",
12327
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12328
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12329
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12330
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12331
- ] })
12332
- }
12333
- )
12334
- ] }),
12335
- /* @__PURE__ */ jsxRuntime.jsx(
12336
- Form$2.Field,
12337
- {
12338
- control: form.control,
12339
- name: "province",
12340
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12341
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12342
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12343
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12344
- ] })
12345
- }
12346
- ),
12347
- /* @__PURE__ */ jsxRuntime.jsx(
12348
- Form$2.Field,
12349
- {
12350
- control: form.control,
12351
- name: "phone",
12352
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12353
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12354
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12355
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12356
- ] })
12357
- }
12358
- )
12359
- ] }) }),
12360
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12361
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12362
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12363
- ] }) })
12364
- ]
12365
- }
12366
- ) });
12367
- };
12368
- const schema$2 = addressSchema;
12369
12369
  const TransferOwnership = () => {
12370
12370
  const { id } = reactRouterDom.useParams();
12371
12371
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -13052,10 +13052,6 @@ const routeModule = {
13052
13052
  handle,
13053
13053
  loader,
13054
13054
  children: [
13055
- {
13056
- Component: CustomItems,
13057
- path: "/draft-orders/:id/custom-items"
13058
- },
13059
13055
  {
13060
13056
  Component: Email,
13061
13057
  path: "/draft-orders/:id/email"
@@ -13064,6 +13060,10 @@ const routeModule = {
13064
13060
  Component: Items,
13065
13061
  path: "/draft-orders/:id/items"
13066
13062
  },
13063
+ {
13064
+ Component: CustomItems,
13065
+ path: "/draft-orders/:id/custom-items"
13066
+ },
13067
13067
  {
13068
13068
  Component: Metadata,
13069
13069
  path: "/draft-orders/:id/metadata"
@@ -13076,14 +13076,14 @@ const routeModule = {
13076
13076
  Component: SalesChannel,
13077
13077
  path: "/draft-orders/:id/sales-channel"
13078
13078
  },
13079
- {
13080
- Component: Shipping,
13081
- path: "/draft-orders/:id/shipping"
13082
- },
13083
13079
  {
13084
13080
  Component: ShippingAddress,
13085
13081
  path: "/draft-orders/:id/shipping-address"
13086
13082
  },
13083
+ {
13084
+ Component: Shipping,
13085
+ path: "/draft-orders/:id/shipping"
13086
+ },
13087
13087
  {
13088
13088
  Component: TransferOwnership,
13089
13089
  path: "/draft-orders/:id/transfer-ownership"
@@ -9554,27 +9554,6 @@ const ID = () => {
9554
9554
  /* @__PURE__ */ jsx(Outlet, {})
9555
9555
  ] });
9556
9556
  };
9557
- const CustomItems = () => {
9558
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9559
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9560
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9561
- ] });
9562
- };
9563
- const CustomItemsForm = () => {
9564
- const form = useForm({
9565
- resolver: zodResolver(schema$5)
9566
- });
9567
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9568
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9569
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9570
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9571
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9572
- ] }) })
9573
- ] }) });
9574
- };
9575
- const schema$5 = objectType({
9576
- email: stringType().email()
9577
- });
9578
9557
  const Email = () => {
9579
9558
  const { id } = useParams();
9580
9559
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9597,7 +9576,7 @@ const EmailForm = ({ order }) => {
9597
9576
  defaultValues: {
9598
9577
  email: order.email ?? ""
9599
9578
  },
9600
- resolver: zodResolver(schema$4)
9579
+ resolver: zodResolver(schema$5)
9601
9580
  });
9602
9581
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9603
9582
  const { handleSuccess } = useRouteModal();
@@ -9640,7 +9619,7 @@ const EmailForm = ({ order }) => {
9640
9619
  }
9641
9620
  ) });
9642
9621
  };
9643
- const schema$4 = objectType({
9622
+ const schema$5 = objectType({
9644
9623
  email: stringType().email()
9645
9624
  });
9646
9625
  const NumberInput = forwardRef(
@@ -10617,6 +10596,27 @@ const customItemSchema = objectType({
10617
10596
  quantity: numberType(),
10618
10597
  unit_price: unionType([numberType(), stringType()])
10619
10598
  });
10599
+ const CustomItems = () => {
10600
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10601
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
10602
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
10603
+ ] });
10604
+ };
10605
+ const CustomItemsForm = () => {
10606
+ const form = useForm({
10607
+ resolver: zodResolver(schema$4)
10608
+ });
10609
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
10610
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
10611
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10612
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10613
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
10614
+ ] }) })
10615
+ ] }) });
10616
+ };
10617
+ const schema$4 = objectType({
10618
+ email: stringType().email()
10619
+ });
10620
10620
  const InlineTip = forwardRef(
10621
10621
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10622
10622
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11350,6 +11350,209 @@ const SalesChannelField = ({ control, order }) => {
11350
11350
  const schema$3 = objectType({
11351
11351
  sales_channel_id: stringType().min(1)
11352
11352
  });
11353
+ const ShippingAddress = () => {
11354
+ const { id } = useParams();
11355
+ const { order, isPending, isError, error } = useOrder(id, {
11356
+ fields: "+shipping_address"
11357
+ });
11358
+ if (isError) {
11359
+ throw error;
11360
+ }
11361
+ const isReady = !isPending && !!order;
11362
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11363
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11364
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11365
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11366
+ ] }),
11367
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11368
+ ] });
11369
+ };
11370
+ const ShippingAddressForm = ({ order }) => {
11371
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11372
+ const form = useForm({
11373
+ defaultValues: {
11374
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11375
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11376
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11377
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11378
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11379
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11380
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11381
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11382
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11383
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11384
+ },
11385
+ resolver: zodResolver(schema$2)
11386
+ });
11387
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11388
+ const { handleSuccess } = useRouteModal();
11389
+ const onSubmit = form.handleSubmit(async (data) => {
11390
+ await mutateAsync(
11391
+ {
11392
+ shipping_address: {
11393
+ first_name: data.first_name,
11394
+ last_name: data.last_name,
11395
+ company: data.company,
11396
+ address_1: data.address_1,
11397
+ address_2: data.address_2,
11398
+ city: data.city,
11399
+ province: data.province,
11400
+ country_code: data.country_code,
11401
+ postal_code: data.postal_code,
11402
+ phone: data.phone
11403
+ }
11404
+ },
11405
+ {
11406
+ onSuccess: () => {
11407
+ handleSuccess();
11408
+ },
11409
+ onError: (error) => {
11410
+ toast.error(error.message);
11411
+ }
11412
+ }
11413
+ );
11414
+ });
11415
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11416
+ KeyboundForm,
11417
+ {
11418
+ className: "flex flex-1 flex-col overflow-hidden",
11419
+ onSubmit,
11420
+ children: [
11421
+ /* @__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: [
11422
+ /* @__PURE__ */ jsx(
11423
+ Form$2.Field,
11424
+ {
11425
+ control: form.control,
11426
+ name: "country_code",
11427
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11428
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11429
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11430
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11431
+ ] })
11432
+ }
11433
+ ),
11434
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11435
+ /* @__PURE__ */ jsx(
11436
+ Form$2.Field,
11437
+ {
11438
+ control: form.control,
11439
+ name: "first_name",
11440
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11441
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11442
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11443
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11444
+ ] })
11445
+ }
11446
+ ),
11447
+ /* @__PURE__ */ jsx(
11448
+ Form$2.Field,
11449
+ {
11450
+ control: form.control,
11451
+ name: "last_name",
11452
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11453
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11454
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11455
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11456
+ ] })
11457
+ }
11458
+ )
11459
+ ] }),
11460
+ /* @__PURE__ */ jsx(
11461
+ Form$2.Field,
11462
+ {
11463
+ control: form.control,
11464
+ name: "company",
11465
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11466
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11467
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11468
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11469
+ ] })
11470
+ }
11471
+ ),
11472
+ /* @__PURE__ */ jsx(
11473
+ Form$2.Field,
11474
+ {
11475
+ control: form.control,
11476
+ name: "address_1",
11477
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11478
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11479
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11480
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11481
+ ] })
11482
+ }
11483
+ ),
11484
+ /* @__PURE__ */ jsx(
11485
+ Form$2.Field,
11486
+ {
11487
+ control: form.control,
11488
+ name: "address_2",
11489
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11490
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11491
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11492
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11493
+ ] })
11494
+ }
11495
+ ),
11496
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11497
+ /* @__PURE__ */ jsx(
11498
+ Form$2.Field,
11499
+ {
11500
+ control: form.control,
11501
+ name: "postal_code",
11502
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11503
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11504
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11505
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11506
+ ] })
11507
+ }
11508
+ ),
11509
+ /* @__PURE__ */ jsx(
11510
+ Form$2.Field,
11511
+ {
11512
+ control: form.control,
11513
+ name: "city",
11514
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11515
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11516
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11517
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11518
+ ] })
11519
+ }
11520
+ )
11521
+ ] }),
11522
+ /* @__PURE__ */ jsx(
11523
+ Form$2.Field,
11524
+ {
11525
+ control: form.control,
11526
+ name: "province",
11527
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11528
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11529
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11530
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11531
+ ] })
11532
+ }
11533
+ ),
11534
+ /* @__PURE__ */ jsx(
11535
+ Form$2.Field,
11536
+ {
11537
+ control: form.control,
11538
+ name: "phone",
11539
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11540
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11541
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11542
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11543
+ ] })
11544
+ }
11545
+ )
11546
+ ] }) }),
11547
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11548
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11549
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11550
+ ] }) })
11551
+ ]
11552
+ }
11553
+ ) });
11554
+ };
11555
+ const schema$2 = addressSchema;
11353
11556
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11354
11557
  const Shipping = () => {
11355
11558
  var _a;
@@ -12157,209 +12360,6 @@ const CustomAmountField = ({
12157
12360
  }
12158
12361
  );
12159
12362
  };
12160
- const ShippingAddress = () => {
12161
- const { id } = useParams();
12162
- const { order, isPending, isError, error } = useOrder(id, {
12163
- fields: "+shipping_address"
12164
- });
12165
- if (isError) {
12166
- throw error;
12167
- }
12168
- const isReady = !isPending && !!order;
12169
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12170
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12171
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12172
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12173
- ] }),
12174
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12175
- ] });
12176
- };
12177
- const ShippingAddressForm = ({ order }) => {
12178
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12179
- const form = useForm({
12180
- defaultValues: {
12181
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12182
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12183
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12184
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12185
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12186
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12187
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12188
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12189
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12190
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12191
- },
12192
- resolver: zodResolver(schema$2)
12193
- });
12194
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12195
- const { handleSuccess } = useRouteModal();
12196
- const onSubmit = form.handleSubmit(async (data) => {
12197
- await mutateAsync(
12198
- {
12199
- shipping_address: {
12200
- first_name: data.first_name,
12201
- last_name: data.last_name,
12202
- company: data.company,
12203
- address_1: data.address_1,
12204
- address_2: data.address_2,
12205
- city: data.city,
12206
- province: data.province,
12207
- country_code: data.country_code,
12208
- postal_code: data.postal_code,
12209
- phone: data.phone
12210
- }
12211
- },
12212
- {
12213
- onSuccess: () => {
12214
- handleSuccess();
12215
- },
12216
- onError: (error) => {
12217
- toast.error(error.message);
12218
- }
12219
- }
12220
- );
12221
- });
12222
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12223
- KeyboundForm,
12224
- {
12225
- className: "flex flex-1 flex-col overflow-hidden",
12226
- onSubmit,
12227
- children: [
12228
- /* @__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: [
12229
- /* @__PURE__ */ jsx(
12230
- Form$2.Field,
12231
- {
12232
- control: form.control,
12233
- name: "country_code",
12234
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12235
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12236
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12237
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12238
- ] })
12239
- }
12240
- ),
12241
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12242
- /* @__PURE__ */ jsx(
12243
- Form$2.Field,
12244
- {
12245
- control: form.control,
12246
- name: "first_name",
12247
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12248
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12249
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12250
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12251
- ] })
12252
- }
12253
- ),
12254
- /* @__PURE__ */ jsx(
12255
- Form$2.Field,
12256
- {
12257
- control: form.control,
12258
- name: "last_name",
12259
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12260
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12261
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12262
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12263
- ] })
12264
- }
12265
- )
12266
- ] }),
12267
- /* @__PURE__ */ jsx(
12268
- Form$2.Field,
12269
- {
12270
- control: form.control,
12271
- name: "company",
12272
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12273
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12274
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12275
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12276
- ] })
12277
- }
12278
- ),
12279
- /* @__PURE__ */ jsx(
12280
- Form$2.Field,
12281
- {
12282
- control: form.control,
12283
- name: "address_1",
12284
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12285
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12286
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12287
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12288
- ] })
12289
- }
12290
- ),
12291
- /* @__PURE__ */ jsx(
12292
- Form$2.Field,
12293
- {
12294
- control: form.control,
12295
- name: "address_2",
12296
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12297
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12298
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12299
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12300
- ] })
12301
- }
12302
- ),
12303
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12304
- /* @__PURE__ */ jsx(
12305
- Form$2.Field,
12306
- {
12307
- control: form.control,
12308
- name: "postal_code",
12309
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12310
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12311
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12312
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12313
- ] })
12314
- }
12315
- ),
12316
- /* @__PURE__ */ jsx(
12317
- Form$2.Field,
12318
- {
12319
- control: form.control,
12320
- name: "city",
12321
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12322
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12323
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12324
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12325
- ] })
12326
- }
12327
- )
12328
- ] }),
12329
- /* @__PURE__ */ jsx(
12330
- Form$2.Field,
12331
- {
12332
- control: form.control,
12333
- name: "province",
12334
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12335
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12336
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12337
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12338
- ] })
12339
- }
12340
- ),
12341
- /* @__PURE__ */ jsx(
12342
- Form$2.Field,
12343
- {
12344
- control: form.control,
12345
- name: "phone",
12346
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12347
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12348
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12349
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12350
- ] })
12351
- }
12352
- )
12353
- ] }) }),
12354
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12355
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12356
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12357
- ] }) })
12358
- ]
12359
- }
12360
- ) });
12361
- };
12362
- const schema$2 = addressSchema;
12363
12363
  const TransferOwnership = () => {
12364
12364
  const { id } = useParams();
12365
12365
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -13046,10 +13046,6 @@ const routeModule = {
13046
13046
  handle,
13047
13047
  loader,
13048
13048
  children: [
13049
- {
13050
- Component: CustomItems,
13051
- path: "/draft-orders/:id/custom-items"
13052
- },
13053
13049
  {
13054
13050
  Component: Email,
13055
13051
  path: "/draft-orders/:id/email"
@@ -13058,6 +13054,10 @@ const routeModule = {
13058
13054
  Component: Items,
13059
13055
  path: "/draft-orders/:id/items"
13060
13056
  },
13057
+ {
13058
+ Component: CustomItems,
13059
+ path: "/draft-orders/:id/custom-items"
13060
+ },
13061
13061
  {
13062
13062
  Component: Metadata,
13063
13063
  path: "/draft-orders/:id/metadata"
@@ -13070,14 +13070,14 @@ const routeModule = {
13070
13070
  Component: SalesChannel,
13071
13071
  path: "/draft-orders/:id/sales-channel"
13072
13072
  },
13073
- {
13074
- Component: Shipping,
13075
- path: "/draft-orders/:id/shipping"
13076
- },
13077
13073
  {
13078
13074
  Component: ShippingAddress,
13079
13075
  path: "/draft-orders/:id/shipping-address"
13080
13076
  },
13077
+ {
13078
+ Component: Shipping,
13079
+ path: "/draft-orders/:id/shipping"
13080
+ },
13081
13081
  {
13082
13082
  Component: TransferOwnership,
13083
13083
  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.10.2-preview-20250901120156",
3
+ "version": "2.10.2-preview-20250901150144",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@hookform/resolvers": "3.4.2",
39
- "@medusajs/js-sdk": "2.10.2-preview-20250901120156",
39
+ "@medusajs/js-sdk": "2.10.2-preview-20250901150144",
40
40
  "@tanstack/react-query": "5.64.2",
41
41
  "@uiw/react-json-view": "^2.0.0-alpha.17",
42
42
  "date-fns": "^3.6.0",
@@ -45,14 +45,14 @@
45
45
  "react-hook-form": "7.49.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.2-preview-20250901120156",
49
- "@medusajs/cli": "2.10.2-preview-20250901120156",
50
- "@medusajs/framework": "2.10.2-preview-20250901120156",
51
- "@medusajs/icons": "2.10.2-preview-20250901120156",
52
- "@medusajs/test-utils": "2.10.2-preview-20250901120156",
53
- "@medusajs/types": "2.10.2-preview-20250901120156",
54
- "@medusajs/ui": "4.0.22-preview-20250901120156",
55
- "@medusajs/ui-preset": "2.10.2-preview-20250901120156",
48
+ "@medusajs/admin-sdk": "2.10.2-preview-20250901150144",
49
+ "@medusajs/cli": "2.10.2-preview-20250901150144",
50
+ "@medusajs/framework": "2.10.2-preview-20250901150144",
51
+ "@medusajs/icons": "2.10.2-preview-20250901150144",
52
+ "@medusajs/test-utils": "2.10.2-preview-20250901150144",
53
+ "@medusajs/types": "2.10.2-preview-20250901150144",
54
+ "@medusajs/ui": "4.0.22-preview-20250901150144",
55
+ "@medusajs/ui-preset": "2.10.2-preview-20250901150144",
56
56
  "@mikro-orm/cli": "6.4.3",
57
57
  "@mikro-orm/core": "6.4.3",
58
58
  "@mikro-orm/knex": "6.4.3",
@@ -76,12 +76,12 @@
76
76
  "yalc": "^1.0.0-pre.53"
77
77
  },
78
78
  "peerDependencies": {
79
- "@medusajs/admin-sdk": "2.10.2-preview-20250901120156",
80
- "@medusajs/cli": "2.10.2-preview-20250901120156",
81
- "@medusajs/framework": "2.10.2-preview-20250901120156",
82
- "@medusajs/icons": "2.10.2-preview-20250901120156",
83
- "@medusajs/test-utils": "2.10.2-preview-20250901120156",
84
- "@medusajs/ui": "4.0.22-preview-20250901120156",
79
+ "@medusajs/admin-sdk": "2.10.2-preview-20250901150144",
80
+ "@medusajs/cli": "2.10.2-preview-20250901150144",
81
+ "@medusajs/framework": "2.10.2-preview-20250901150144",
82
+ "@medusajs/icons": "2.10.2-preview-20250901150144",
83
+ "@medusajs/test-utils": "2.10.2-preview-20250901150144",
84
+ "@medusajs/ui": "4.0.22-preview-20250901150144",
85
85
  "@mikro-orm/cli": "6.4.3",
86
86
  "@mikro-orm/core": "6.4.3",
87
87
  "@mikro-orm/knex": "6.4.3",