@medusajs/draft-order 2.10.4-preview-20250919031359 → 2.10.4-preview-20250919090202

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.
@@ -9763,27 +9763,6 @@ const BillingAddressForm = ({ order }) => {
9763
9763
  ) });
9764
9764
  };
9765
9765
  const schema$5 = addressSchema;
9766
- const CustomItems = () => {
9767
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9768
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9769
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9770
- ] });
9771
- };
9772
- const CustomItemsForm = () => {
9773
- const form = reactHookForm.useForm({
9774
- resolver: zod.zodResolver(schema$4)
9775
- });
9776
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9777
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9778
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9779
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9780
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9781
- ] }) })
9782
- ] }) });
9783
- };
9784
- const schema$4 = objectType({
9785
- email: stringType().email()
9786
- });
9787
9766
  const Email = () => {
9788
9767
  const { id } = reactRouterDom.useParams();
9789
9768
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9806,7 +9785,7 @@ const EmailForm = ({ order }) => {
9806
9785
  defaultValues: {
9807
9786
  email: order.email ?? ""
9808
9787
  },
9809
- resolver: zod.zodResolver(schema$3)
9788
+ resolver: zod.zodResolver(schema$4)
9810
9789
  });
9811
9790
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9812
9791
  const { handleSuccess } = useRouteModal();
@@ -9849,7 +9828,7 @@ const EmailForm = ({ order }) => {
9849
9828
  }
9850
9829
  ) });
9851
9830
  };
9852
- const schema$3 = objectType({
9831
+ const schema$4 = objectType({
9853
9832
  email: stringType().email()
9854
9833
  });
9855
9834
  const NumberInput = React.forwardRef(
@@ -11481,7 +11460,7 @@ const SalesChannelForm = ({ order }) => {
11481
11460
  defaultValues: {
11482
11461
  sales_channel_id: order.sales_channel_id || ""
11483
11462
  },
11484
- resolver: zod.zodResolver(schema$2)
11463
+ resolver: zod.zodResolver(schema$3)
11485
11464
  });
11486
11465
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11487
11466
  const { handleSuccess } = useRouteModal();
@@ -11556,212 +11535,9 @@ const SalesChannelField = ({ control, order }) => {
11556
11535
  }
11557
11536
  );
11558
11537
  };
11559
- const schema$2 = objectType({
11538
+ const schema$3 = objectType({
11560
11539
  sales_channel_id: stringType().min(1)
11561
11540
  });
11562
- const ShippingAddress = () => {
11563
- const { id } = reactRouterDom.useParams();
11564
- const { order, isPending, isError, error } = useOrder(id, {
11565
- fields: "+shipping_address"
11566
- });
11567
- if (isError) {
11568
- throw error;
11569
- }
11570
- const isReady = !isPending && !!order;
11571
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11572
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11573
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
11574
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11575
- ] }),
11576
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
11577
- ] });
11578
- };
11579
- const ShippingAddressForm = ({ order }) => {
11580
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11581
- const form = reactHookForm.useForm({
11582
- defaultValues: {
11583
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11584
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11585
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11586
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11587
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11588
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11589
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11590
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11591
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11592
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11593
- },
11594
- resolver: zod.zodResolver(schema$1)
11595
- });
11596
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11597
- const { handleSuccess } = useRouteModal();
11598
- const onSubmit = form.handleSubmit(async (data) => {
11599
- await mutateAsync(
11600
- {
11601
- shipping_address: {
11602
- first_name: data.first_name,
11603
- last_name: data.last_name,
11604
- company: data.company,
11605
- address_1: data.address_1,
11606
- address_2: data.address_2,
11607
- city: data.city,
11608
- province: data.province,
11609
- country_code: data.country_code,
11610
- postal_code: data.postal_code,
11611
- phone: data.phone
11612
- }
11613
- },
11614
- {
11615
- onSuccess: () => {
11616
- handleSuccess();
11617
- },
11618
- onError: (error) => {
11619
- ui.toast.error(error.message);
11620
- }
11621
- }
11622
- );
11623
- });
11624
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11625
- KeyboundForm,
11626
- {
11627
- className: "flex flex-1 flex-col overflow-hidden",
11628
- onSubmit,
11629
- children: [
11630
- /* @__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: [
11631
- /* @__PURE__ */ jsxRuntime.jsx(
11632
- Form$2.Field,
11633
- {
11634
- control: form.control,
11635
- name: "country_code",
11636
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11637
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11640
- ] })
11641
- }
11642
- ),
11643
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11644
- /* @__PURE__ */ jsxRuntime.jsx(
11645
- Form$2.Field,
11646
- {
11647
- control: form.control,
11648
- name: "first_name",
11649
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11650
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11651
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11652
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11653
- ] })
11654
- }
11655
- ),
11656
- /* @__PURE__ */ jsxRuntime.jsx(
11657
- Form$2.Field,
11658
- {
11659
- control: form.control,
11660
- name: "last_name",
11661
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11662
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11664
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11665
- ] })
11666
- }
11667
- )
11668
- ] }),
11669
- /* @__PURE__ */ jsxRuntime.jsx(
11670
- Form$2.Field,
11671
- {
11672
- control: form.control,
11673
- name: "company",
11674
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11675
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11676
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11677
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11678
- ] })
11679
- }
11680
- ),
11681
- /* @__PURE__ */ jsxRuntime.jsx(
11682
- Form$2.Field,
11683
- {
11684
- control: form.control,
11685
- name: "address_1",
11686
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11687
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11688
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11689
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11690
- ] })
11691
- }
11692
- ),
11693
- /* @__PURE__ */ jsxRuntime.jsx(
11694
- Form$2.Field,
11695
- {
11696
- control: form.control,
11697
- name: "address_2",
11698
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11699
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11702
- ] })
11703
- }
11704
- ),
11705
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11706
- /* @__PURE__ */ jsxRuntime.jsx(
11707
- Form$2.Field,
11708
- {
11709
- control: form.control,
11710
- name: "postal_code",
11711
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11712
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11713
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11715
- ] })
11716
- }
11717
- ),
11718
- /* @__PURE__ */ jsxRuntime.jsx(
11719
- Form$2.Field,
11720
- {
11721
- control: form.control,
11722
- name: "city",
11723
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11724
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11727
- ] })
11728
- }
11729
- )
11730
- ] }),
11731
- /* @__PURE__ */ jsxRuntime.jsx(
11732
- Form$2.Field,
11733
- {
11734
- control: form.control,
11735
- name: "province",
11736
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11737
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11738
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11740
- ] })
11741
- }
11742
- ),
11743
- /* @__PURE__ */ jsxRuntime.jsx(
11744
- Form$2.Field,
11745
- {
11746
- control: form.control,
11747
- name: "phone",
11748
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11749
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11750
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11752
- ] })
11753
- }
11754
- )
11755
- ] }) }),
11756
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11757
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11758
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11759
- ] }) })
11760
- ]
11761
- }
11762
- ) });
11763
- };
11764
- const schema$1 = addressSchema;
11765
11541
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11766
11542
  const Shipping = () => {
11767
11543
  var _a;
@@ -12569,6 +12345,209 @@ const CustomAmountField = ({
12569
12345
  }
12570
12346
  );
12571
12347
  };
12348
+ const ShippingAddress = () => {
12349
+ const { id } = reactRouterDom.useParams();
12350
+ const { order, isPending, isError, error } = useOrder(id, {
12351
+ fields: "+shipping_address"
12352
+ });
12353
+ if (isError) {
12354
+ throw error;
12355
+ }
12356
+ const isReady = !isPending && !!order;
12357
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12358
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12359
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12360
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12361
+ ] }),
12362
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12363
+ ] });
12364
+ };
12365
+ const ShippingAddressForm = ({ order }) => {
12366
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12367
+ const form = reactHookForm.useForm({
12368
+ defaultValues: {
12369
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12370
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12371
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12372
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12373
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12374
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12375
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12376
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12377
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12378
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12379
+ },
12380
+ resolver: zod.zodResolver(schema$2)
12381
+ });
12382
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12383
+ const { handleSuccess } = useRouteModal();
12384
+ const onSubmit = form.handleSubmit(async (data) => {
12385
+ await mutateAsync(
12386
+ {
12387
+ shipping_address: {
12388
+ first_name: data.first_name,
12389
+ last_name: data.last_name,
12390
+ company: data.company,
12391
+ address_1: data.address_1,
12392
+ address_2: data.address_2,
12393
+ city: data.city,
12394
+ province: data.province,
12395
+ country_code: data.country_code,
12396
+ postal_code: data.postal_code,
12397
+ phone: data.phone
12398
+ }
12399
+ },
12400
+ {
12401
+ onSuccess: () => {
12402
+ handleSuccess();
12403
+ },
12404
+ onError: (error) => {
12405
+ ui.toast.error(error.message);
12406
+ }
12407
+ }
12408
+ );
12409
+ });
12410
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12411
+ KeyboundForm,
12412
+ {
12413
+ className: "flex flex-1 flex-col overflow-hidden",
12414
+ onSubmit,
12415
+ children: [
12416
+ /* @__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: [
12417
+ /* @__PURE__ */ jsxRuntime.jsx(
12418
+ Form$2.Field,
12419
+ {
12420
+ control: form.control,
12421
+ name: "country_code",
12422
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12423
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12424
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12425
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12426
+ ] })
12427
+ }
12428
+ ),
12429
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12430
+ /* @__PURE__ */ jsxRuntime.jsx(
12431
+ Form$2.Field,
12432
+ {
12433
+ control: form.control,
12434
+ name: "first_name",
12435
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12436
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12437
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12438
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12439
+ ] })
12440
+ }
12441
+ ),
12442
+ /* @__PURE__ */ jsxRuntime.jsx(
12443
+ Form$2.Field,
12444
+ {
12445
+ control: form.control,
12446
+ name: "last_name",
12447
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12448
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12449
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12450
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12451
+ ] })
12452
+ }
12453
+ )
12454
+ ] }),
12455
+ /* @__PURE__ */ jsxRuntime.jsx(
12456
+ Form$2.Field,
12457
+ {
12458
+ control: form.control,
12459
+ name: "company",
12460
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12461
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12462
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12463
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12464
+ ] })
12465
+ }
12466
+ ),
12467
+ /* @__PURE__ */ jsxRuntime.jsx(
12468
+ Form$2.Field,
12469
+ {
12470
+ control: form.control,
12471
+ name: "address_1",
12472
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12473
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12474
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12475
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12476
+ ] })
12477
+ }
12478
+ ),
12479
+ /* @__PURE__ */ jsxRuntime.jsx(
12480
+ Form$2.Field,
12481
+ {
12482
+ control: form.control,
12483
+ name: "address_2",
12484
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12485
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12486
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12487
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12488
+ ] })
12489
+ }
12490
+ ),
12491
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12492
+ /* @__PURE__ */ jsxRuntime.jsx(
12493
+ Form$2.Field,
12494
+ {
12495
+ control: form.control,
12496
+ name: "postal_code",
12497
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12498
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12499
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12500
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12501
+ ] })
12502
+ }
12503
+ ),
12504
+ /* @__PURE__ */ jsxRuntime.jsx(
12505
+ Form$2.Field,
12506
+ {
12507
+ control: form.control,
12508
+ name: "city",
12509
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12510
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12511
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12512
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12513
+ ] })
12514
+ }
12515
+ )
12516
+ ] }),
12517
+ /* @__PURE__ */ jsxRuntime.jsx(
12518
+ Form$2.Field,
12519
+ {
12520
+ control: form.control,
12521
+ name: "province",
12522
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12523
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12524
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12525
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12526
+ ] })
12527
+ }
12528
+ ),
12529
+ /* @__PURE__ */ jsxRuntime.jsx(
12530
+ Form$2.Field,
12531
+ {
12532
+ control: form.control,
12533
+ name: "phone",
12534
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12535
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12536
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12537
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12538
+ ] })
12539
+ }
12540
+ )
12541
+ ] }) }),
12542
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12543
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12544
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12545
+ ] }) })
12546
+ ]
12547
+ }
12548
+ ) });
12549
+ };
12550
+ const schema$2 = addressSchema;
12572
12551
  const TransferOwnership = () => {
12573
12552
  const { id } = reactRouterDom.useParams();
12574
12553
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12592,7 +12571,7 @@ const TransferOwnershipForm = ({ order }) => {
12592
12571
  defaultValues: {
12593
12572
  customer_id: order.customer_id || ""
12594
12573
  },
12595
- resolver: zod.zodResolver(schema)
12574
+ resolver: zod.zodResolver(schema$1)
12596
12575
  });
12597
12576
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12598
12577
  const { handleSuccess } = useRouteModal();
@@ -13042,9 +13021,30 @@ const Illustration = () => {
13042
13021
  }
13043
13022
  );
13044
13023
  };
13045
- const schema = objectType({
13024
+ const schema$1 = objectType({
13046
13025
  customer_id: stringType().min(1)
13047
13026
  });
13027
+ const CustomItems = () => {
13028
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
13029
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
13030
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
13031
+ ] });
13032
+ };
13033
+ const CustomItemsForm = () => {
13034
+ const form = reactHookForm.useForm({
13035
+ resolver: zod.zodResolver(schema)
13036
+ });
13037
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13038
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13039
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13042
+ ] }) })
13043
+ ] }) });
13044
+ };
13045
+ const schema = objectType({
13046
+ email: stringType().email()
13047
+ });
13048
13048
  const widgetModule = { widgets: [] };
13049
13049
  const routeModule = {
13050
13050
  routes: [
@@ -13069,10 +13069,6 @@ const routeModule = {
13069
13069
  Component: BillingAddress,
13070
13070
  path: "/draft-orders/:id/billing-address"
13071
13071
  },
13072
- {
13073
- Component: CustomItems,
13074
- path: "/draft-orders/:id/custom-items"
13075
- },
13076
13072
  {
13077
13073
  Component: Email,
13078
13074
  path: "/draft-orders/:id/email"
@@ -13093,17 +13089,21 @@ const routeModule = {
13093
13089
  Component: SalesChannel,
13094
13090
  path: "/draft-orders/:id/sales-channel"
13095
13091
  },
13096
- {
13097
- Component: ShippingAddress,
13098
- path: "/draft-orders/:id/shipping-address"
13099
- },
13100
13092
  {
13101
13093
  Component: Shipping,
13102
13094
  path: "/draft-orders/:id/shipping"
13103
13095
  },
13096
+ {
13097
+ Component: ShippingAddress,
13098
+ path: "/draft-orders/:id/shipping-address"
13099
+ },
13104
13100
  {
13105
13101
  Component: TransferOwnership,
13106
13102
  path: "/draft-orders/:id/transfer-ownership"
13103
+ },
13104
+ {
13105
+ Component: CustomItems,
13106
+ path: "/draft-orders/:id/custom-items"
13107
13107
  }
13108
13108
  ]
13109
13109
  }
@@ -9757,27 +9757,6 @@ const BillingAddressForm = ({ order }) => {
9757
9757
  ) });
9758
9758
  };
9759
9759
  const schema$5 = addressSchema;
9760
- const CustomItems = () => {
9761
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9762
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9763
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9764
- ] });
9765
- };
9766
- const CustomItemsForm = () => {
9767
- const form = useForm({
9768
- resolver: zodResolver(schema$4)
9769
- });
9770
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9771
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9772
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9773
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9774
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9775
- ] }) })
9776
- ] }) });
9777
- };
9778
- const schema$4 = objectType({
9779
- email: stringType().email()
9780
- });
9781
9760
  const Email = () => {
9782
9761
  const { id } = useParams();
9783
9762
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9800,7 +9779,7 @@ const EmailForm = ({ order }) => {
9800
9779
  defaultValues: {
9801
9780
  email: order.email ?? ""
9802
9781
  },
9803
- resolver: zodResolver(schema$3)
9782
+ resolver: zodResolver(schema$4)
9804
9783
  });
9805
9784
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9806
9785
  const { handleSuccess } = useRouteModal();
@@ -9843,7 +9822,7 @@ const EmailForm = ({ order }) => {
9843
9822
  }
9844
9823
  ) });
9845
9824
  };
9846
- const schema$3 = objectType({
9825
+ const schema$4 = objectType({
9847
9826
  email: stringType().email()
9848
9827
  });
9849
9828
  const NumberInput = forwardRef(
@@ -11475,7 +11454,7 @@ const SalesChannelForm = ({ order }) => {
11475
11454
  defaultValues: {
11476
11455
  sales_channel_id: order.sales_channel_id || ""
11477
11456
  },
11478
- resolver: zodResolver(schema$2)
11457
+ resolver: zodResolver(schema$3)
11479
11458
  });
11480
11459
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11481
11460
  const { handleSuccess } = useRouteModal();
@@ -11550,212 +11529,9 @@ const SalesChannelField = ({ control, order }) => {
11550
11529
  }
11551
11530
  );
11552
11531
  };
11553
- const schema$2 = objectType({
11532
+ const schema$3 = objectType({
11554
11533
  sales_channel_id: stringType().min(1)
11555
11534
  });
11556
- const ShippingAddress = () => {
11557
- const { id } = useParams();
11558
- const { order, isPending, isError, error } = useOrder(id, {
11559
- fields: "+shipping_address"
11560
- });
11561
- if (isError) {
11562
- throw error;
11563
- }
11564
- const isReady = !isPending && !!order;
11565
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11566
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11567
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11568
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11569
- ] }),
11570
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11571
- ] });
11572
- };
11573
- const ShippingAddressForm = ({ order }) => {
11574
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11575
- const form = useForm({
11576
- defaultValues: {
11577
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11578
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11579
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11580
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11581
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11582
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11583
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11584
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11585
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11586
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11587
- },
11588
- resolver: zodResolver(schema$1)
11589
- });
11590
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11591
- const { handleSuccess } = useRouteModal();
11592
- const onSubmit = form.handleSubmit(async (data) => {
11593
- await mutateAsync(
11594
- {
11595
- shipping_address: {
11596
- first_name: data.first_name,
11597
- last_name: data.last_name,
11598
- company: data.company,
11599
- address_1: data.address_1,
11600
- address_2: data.address_2,
11601
- city: data.city,
11602
- province: data.province,
11603
- country_code: data.country_code,
11604
- postal_code: data.postal_code,
11605
- phone: data.phone
11606
- }
11607
- },
11608
- {
11609
- onSuccess: () => {
11610
- handleSuccess();
11611
- },
11612
- onError: (error) => {
11613
- toast.error(error.message);
11614
- }
11615
- }
11616
- );
11617
- });
11618
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11619
- KeyboundForm,
11620
- {
11621
- className: "flex flex-1 flex-col overflow-hidden",
11622
- onSubmit,
11623
- children: [
11624
- /* @__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: [
11625
- /* @__PURE__ */ jsx(
11626
- Form$2.Field,
11627
- {
11628
- control: form.control,
11629
- name: "country_code",
11630
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11631
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11632
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11633
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11634
- ] })
11635
- }
11636
- ),
11637
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11638
- /* @__PURE__ */ jsx(
11639
- Form$2.Field,
11640
- {
11641
- control: form.control,
11642
- name: "first_name",
11643
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11644
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11645
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11646
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11647
- ] })
11648
- }
11649
- ),
11650
- /* @__PURE__ */ jsx(
11651
- Form$2.Field,
11652
- {
11653
- control: form.control,
11654
- name: "last_name",
11655
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11656
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11657
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11658
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11659
- ] })
11660
- }
11661
- )
11662
- ] }),
11663
- /* @__PURE__ */ jsx(
11664
- Form$2.Field,
11665
- {
11666
- control: form.control,
11667
- name: "company",
11668
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11669
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11670
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11671
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11672
- ] })
11673
- }
11674
- ),
11675
- /* @__PURE__ */ jsx(
11676
- Form$2.Field,
11677
- {
11678
- control: form.control,
11679
- name: "address_1",
11680
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11681
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11682
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11683
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11684
- ] })
11685
- }
11686
- ),
11687
- /* @__PURE__ */ jsx(
11688
- Form$2.Field,
11689
- {
11690
- control: form.control,
11691
- name: "address_2",
11692
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11693
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11694
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11695
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11696
- ] })
11697
- }
11698
- ),
11699
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11700
- /* @__PURE__ */ jsx(
11701
- Form$2.Field,
11702
- {
11703
- control: form.control,
11704
- name: "postal_code",
11705
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11706
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11707
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11708
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11709
- ] })
11710
- }
11711
- ),
11712
- /* @__PURE__ */ jsx(
11713
- Form$2.Field,
11714
- {
11715
- control: form.control,
11716
- name: "city",
11717
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11718
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11719
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11720
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11721
- ] })
11722
- }
11723
- )
11724
- ] }),
11725
- /* @__PURE__ */ jsx(
11726
- Form$2.Field,
11727
- {
11728
- control: form.control,
11729
- name: "province",
11730
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11731
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11732
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11733
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11734
- ] })
11735
- }
11736
- ),
11737
- /* @__PURE__ */ jsx(
11738
- Form$2.Field,
11739
- {
11740
- control: form.control,
11741
- name: "phone",
11742
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11743
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11744
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11745
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11746
- ] })
11747
- }
11748
- )
11749
- ] }) }),
11750
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11751
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11752
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11753
- ] }) })
11754
- ]
11755
- }
11756
- ) });
11757
- };
11758
- const schema$1 = addressSchema;
11759
11535
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11760
11536
  const Shipping = () => {
11761
11537
  var _a;
@@ -12563,6 +12339,209 @@ const CustomAmountField = ({
12563
12339
  }
12564
12340
  );
12565
12341
  };
12342
+ const ShippingAddress = () => {
12343
+ const { id } = useParams();
12344
+ const { order, isPending, isError, error } = useOrder(id, {
12345
+ fields: "+shipping_address"
12346
+ });
12347
+ if (isError) {
12348
+ throw error;
12349
+ }
12350
+ const isReady = !isPending && !!order;
12351
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12352
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12353
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12354
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12355
+ ] }),
12356
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12357
+ ] });
12358
+ };
12359
+ const ShippingAddressForm = ({ order }) => {
12360
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12361
+ const form = useForm({
12362
+ defaultValues: {
12363
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12364
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12365
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12366
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12367
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12368
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12369
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12370
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12371
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12372
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12373
+ },
12374
+ resolver: zodResolver(schema$2)
12375
+ });
12376
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12377
+ const { handleSuccess } = useRouteModal();
12378
+ const onSubmit = form.handleSubmit(async (data) => {
12379
+ await mutateAsync(
12380
+ {
12381
+ shipping_address: {
12382
+ first_name: data.first_name,
12383
+ last_name: data.last_name,
12384
+ company: data.company,
12385
+ address_1: data.address_1,
12386
+ address_2: data.address_2,
12387
+ city: data.city,
12388
+ province: data.province,
12389
+ country_code: data.country_code,
12390
+ postal_code: data.postal_code,
12391
+ phone: data.phone
12392
+ }
12393
+ },
12394
+ {
12395
+ onSuccess: () => {
12396
+ handleSuccess();
12397
+ },
12398
+ onError: (error) => {
12399
+ toast.error(error.message);
12400
+ }
12401
+ }
12402
+ );
12403
+ });
12404
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12405
+ KeyboundForm,
12406
+ {
12407
+ className: "flex flex-1 flex-col overflow-hidden",
12408
+ onSubmit,
12409
+ children: [
12410
+ /* @__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: [
12411
+ /* @__PURE__ */ jsx(
12412
+ Form$2.Field,
12413
+ {
12414
+ control: form.control,
12415
+ name: "country_code",
12416
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12417
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12418
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12419
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12420
+ ] })
12421
+ }
12422
+ ),
12423
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12424
+ /* @__PURE__ */ jsx(
12425
+ Form$2.Field,
12426
+ {
12427
+ control: form.control,
12428
+ name: "first_name",
12429
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12430
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12431
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12432
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12433
+ ] })
12434
+ }
12435
+ ),
12436
+ /* @__PURE__ */ jsx(
12437
+ Form$2.Field,
12438
+ {
12439
+ control: form.control,
12440
+ name: "last_name",
12441
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12442
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12443
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12444
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12445
+ ] })
12446
+ }
12447
+ )
12448
+ ] }),
12449
+ /* @__PURE__ */ jsx(
12450
+ Form$2.Field,
12451
+ {
12452
+ control: form.control,
12453
+ name: "company",
12454
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12455
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12456
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12457
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12458
+ ] })
12459
+ }
12460
+ ),
12461
+ /* @__PURE__ */ jsx(
12462
+ Form$2.Field,
12463
+ {
12464
+ control: form.control,
12465
+ name: "address_1",
12466
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12467
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12468
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12469
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12470
+ ] })
12471
+ }
12472
+ ),
12473
+ /* @__PURE__ */ jsx(
12474
+ Form$2.Field,
12475
+ {
12476
+ control: form.control,
12477
+ name: "address_2",
12478
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12479
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12480
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12481
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12482
+ ] })
12483
+ }
12484
+ ),
12485
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12486
+ /* @__PURE__ */ jsx(
12487
+ Form$2.Field,
12488
+ {
12489
+ control: form.control,
12490
+ name: "postal_code",
12491
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12492
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12493
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12494
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12495
+ ] })
12496
+ }
12497
+ ),
12498
+ /* @__PURE__ */ jsx(
12499
+ Form$2.Field,
12500
+ {
12501
+ control: form.control,
12502
+ name: "city",
12503
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12504
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12505
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12506
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12507
+ ] })
12508
+ }
12509
+ )
12510
+ ] }),
12511
+ /* @__PURE__ */ jsx(
12512
+ Form$2.Field,
12513
+ {
12514
+ control: form.control,
12515
+ name: "province",
12516
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12517
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12518
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12519
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12520
+ ] })
12521
+ }
12522
+ ),
12523
+ /* @__PURE__ */ jsx(
12524
+ Form$2.Field,
12525
+ {
12526
+ control: form.control,
12527
+ name: "phone",
12528
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12529
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12530
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12531
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12532
+ ] })
12533
+ }
12534
+ )
12535
+ ] }) }),
12536
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12537
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12538
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12539
+ ] }) })
12540
+ ]
12541
+ }
12542
+ ) });
12543
+ };
12544
+ const schema$2 = addressSchema;
12566
12545
  const TransferOwnership = () => {
12567
12546
  const { id } = useParams();
12568
12547
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12586,7 +12565,7 @@ const TransferOwnershipForm = ({ order }) => {
12586
12565
  defaultValues: {
12587
12566
  customer_id: order.customer_id || ""
12588
12567
  },
12589
- resolver: zodResolver(schema)
12568
+ resolver: zodResolver(schema$1)
12590
12569
  });
12591
12570
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12592
12571
  const { handleSuccess } = useRouteModal();
@@ -13036,9 +13015,30 @@ const Illustration = () => {
13036
13015
  }
13037
13016
  );
13038
13017
  };
13039
- const schema = objectType({
13018
+ const schema$1 = objectType({
13040
13019
  customer_id: stringType().min(1)
13041
13020
  });
13021
+ const CustomItems = () => {
13022
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
13023
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13024
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
13025
+ ] });
13026
+ };
13027
+ const CustomItemsForm = () => {
13028
+ const form = useForm({
13029
+ resolver: zodResolver(schema)
13030
+ });
13031
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13032
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13033
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13034
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13035
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13036
+ ] }) })
13037
+ ] }) });
13038
+ };
13039
+ const schema = objectType({
13040
+ email: stringType().email()
13041
+ });
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
13044
13044
  routes: [
@@ -13063,10 +13063,6 @@ const routeModule = {
13063
13063
  Component: BillingAddress,
13064
13064
  path: "/draft-orders/:id/billing-address"
13065
13065
  },
13066
- {
13067
- Component: CustomItems,
13068
- path: "/draft-orders/:id/custom-items"
13069
- },
13070
13066
  {
13071
13067
  Component: Email,
13072
13068
  path: "/draft-orders/:id/email"
@@ -13087,17 +13083,21 @@ const routeModule = {
13087
13083
  Component: SalesChannel,
13088
13084
  path: "/draft-orders/:id/sales-channel"
13089
13085
  },
13090
- {
13091
- Component: ShippingAddress,
13092
- path: "/draft-orders/:id/shipping-address"
13093
- },
13094
13086
  {
13095
13087
  Component: Shipping,
13096
13088
  path: "/draft-orders/:id/shipping"
13097
13089
  },
13090
+ {
13091
+ Component: ShippingAddress,
13092
+ path: "/draft-orders/:id/shipping-address"
13093
+ },
13098
13094
  {
13099
13095
  Component: TransferOwnership,
13100
13096
  path: "/draft-orders/:id/transfer-ownership"
13097
+ },
13098
+ {
13099
+ Component: CustomItems,
13100
+ path: "/draft-orders/:id/custom-items"
13101
13101
  }
13102
13102
  ]
13103
13103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.4-preview-20250919031359",
3
+ "version": "2.10.4-preview-20250919090202",
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.4-preview-20250919031359",
39
+ "@medusajs/js-sdk": "2.10.4-preview-20250919090202",
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.4-preview-20250919031359",
49
- "@medusajs/cli": "2.10.4-preview-20250919031359",
50
- "@medusajs/framework": "2.10.4-preview-20250919031359",
51
- "@medusajs/icons": "2.10.4-preview-20250919031359",
52
- "@medusajs/test-utils": "2.10.4-preview-20250919031359",
53
- "@medusajs/types": "2.10.4-preview-20250919031359",
54
- "@medusajs/ui": "4.0.24-preview-20250919031359",
55
- "@medusajs/ui-preset": "2.10.4-preview-20250919031359",
48
+ "@medusajs/admin-sdk": "2.10.4-preview-20250919090202",
49
+ "@medusajs/cli": "2.10.4-preview-20250919090202",
50
+ "@medusajs/framework": "2.10.4-preview-20250919090202",
51
+ "@medusajs/icons": "2.10.4-preview-20250919090202",
52
+ "@medusajs/test-utils": "2.10.4-preview-20250919090202",
53
+ "@medusajs/types": "2.10.4-preview-20250919090202",
54
+ "@medusajs/ui": "4.0.24-preview-20250919090202",
55
+ "@medusajs/ui-preset": "2.10.4-preview-20250919090202",
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.4-preview-20250919031359",
80
- "@medusajs/cli": "2.10.4-preview-20250919031359",
81
- "@medusajs/framework": "2.10.4-preview-20250919031359",
82
- "@medusajs/icons": "2.10.4-preview-20250919031359",
83
- "@medusajs/test-utils": "2.10.4-preview-20250919031359",
84
- "@medusajs/ui": "4.0.24-preview-20250919031359",
79
+ "@medusajs/admin-sdk": "2.10.4-preview-20250919090202",
80
+ "@medusajs/cli": "2.10.4-preview-20250919090202",
81
+ "@medusajs/framework": "2.10.4-preview-20250919090202",
82
+ "@medusajs/icons": "2.10.4-preview-20250919090202",
83
+ "@medusajs/test-utils": "2.10.4-preview-20250919090202",
84
+ "@medusajs/ui": "4.0.24-preview-20250919090202",
85
85
  "@mikro-orm/cli": "6.4.3",
86
86
  "@mikro-orm/core": "6.4.3",
87
87
  "@mikro-orm/knex": "6.4.3",