@medusajs/draft-order 2.11.4-preview-20251107150138 → 2.11.4-preview-20251107210127

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.
@@ -9758,6 +9758,27 @@ const BillingAddressForm = ({ order }) => {
9758
9758
  ) });
9759
9759
  };
9760
9760
  const schema$5 = addressSchema;
9761
+ const CustomItems = () => {
9762
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9763
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9764
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9765
+ ] });
9766
+ };
9767
+ const CustomItemsForm = () => {
9768
+ const form = reactHookForm.useForm({
9769
+ resolver: zod.zodResolver(schema$4)
9770
+ });
9771
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9772
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9773
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9774
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9775
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9776
+ ] }) })
9777
+ ] }) });
9778
+ };
9779
+ const schema$4 = objectType({
9780
+ email: stringType().email()
9781
+ });
9761
9782
  const Email = () => {
9762
9783
  const { id } = reactRouterDom.useParams();
9763
9784
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9780,7 +9801,7 @@ const EmailForm = ({ order }) => {
9780
9801
  defaultValues: {
9781
9802
  email: order.email ?? ""
9782
9803
  },
9783
- resolver: zod.zodResolver(schema$4)
9804
+ resolver: zod.zodResolver(schema$3)
9784
9805
  });
9785
9806
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9786
9807
  const { handleSuccess } = useRouteModal();
@@ -9823,27 +9844,6 @@ const EmailForm = ({ order }) => {
9823
9844
  }
9824
9845
  ) });
9825
9846
  };
9826
- const schema$4 = objectType({
9827
- email: stringType().email()
9828
- });
9829
- const CustomItems = () => {
9830
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9831
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9832
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9833
- ] });
9834
- };
9835
- const CustomItemsForm = () => {
9836
- const form = reactHookForm.useForm({
9837
- resolver: zod.zodResolver(schema$3)
9838
- });
9839
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9840
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9841
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9842
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9843
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9844
- ] }) })
9845
- ] }) });
9846
- };
9847
9847
  const schema$3 = objectType({
9848
9848
  email: stringType().email()
9849
9849
  });
@@ -11554,209 +11554,6 @@ const SalesChannelField = ({ control, order }) => {
11554
11554
  const schema$2 = objectType({
11555
11555
  sales_channel_id: stringType().min(1)
11556
11556
  });
11557
- const ShippingAddress = () => {
11558
- const { id } = reactRouterDom.useParams();
11559
- const { order, isPending, isError, error } = useOrder(id, {
11560
- fields: "+shipping_address"
11561
- });
11562
- if (isError) {
11563
- throw error;
11564
- }
11565
- const isReady = !isPending && !!order;
11566
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11567
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11568
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
11569
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11570
- ] }),
11571
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
11572
- ] });
11573
- };
11574
- const ShippingAddressForm = ({ order }) => {
11575
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11576
- const form = reactHookForm.useForm({
11577
- defaultValues: {
11578
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11579
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11580
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11581
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11582
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11583
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11584
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11585
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11586
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11587
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11588
- },
11589
- resolver: zod.zodResolver(schema$1)
11590
- });
11591
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11592
- const { handleSuccess } = useRouteModal();
11593
- const onSubmit = form.handleSubmit(async (data) => {
11594
- await mutateAsync(
11595
- {
11596
- shipping_address: {
11597
- first_name: data.first_name,
11598
- last_name: data.last_name,
11599
- company: data.company,
11600
- address_1: data.address_1,
11601
- address_2: data.address_2,
11602
- city: data.city,
11603
- province: data.province,
11604
- country_code: data.country_code,
11605
- postal_code: data.postal_code,
11606
- phone: data.phone
11607
- }
11608
- },
11609
- {
11610
- onSuccess: () => {
11611
- handleSuccess();
11612
- },
11613
- onError: (error) => {
11614
- ui.toast.error(error.message);
11615
- }
11616
- }
11617
- );
11618
- });
11619
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11620
- KeyboundForm,
11621
- {
11622
- className: "flex flex-1 flex-col overflow-hidden",
11623
- onSubmit,
11624
- children: [
11625
- /* @__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: [
11626
- /* @__PURE__ */ jsxRuntime.jsx(
11627
- Form$2.Field,
11628
- {
11629
- control: form.control,
11630
- name: "country_code",
11631
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11632
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11633
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11634
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11635
- ] })
11636
- }
11637
- ),
11638
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11639
- /* @__PURE__ */ jsxRuntime.jsx(
11640
- Form$2.Field,
11641
- {
11642
- control: form.control,
11643
- name: "first_name",
11644
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11645
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11646
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11647
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11648
- ] })
11649
- }
11650
- ),
11651
- /* @__PURE__ */ jsxRuntime.jsx(
11652
- Form$2.Field,
11653
- {
11654
- control: form.control,
11655
- name: "last_name",
11656
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11657
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11658
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11659
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11660
- ] })
11661
- }
11662
- )
11663
- ] }),
11664
- /* @__PURE__ */ jsxRuntime.jsx(
11665
- Form$2.Field,
11666
- {
11667
- control: form.control,
11668
- name: "company",
11669
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11670
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11671
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11672
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11673
- ] })
11674
- }
11675
- ),
11676
- /* @__PURE__ */ jsxRuntime.jsx(
11677
- Form$2.Field,
11678
- {
11679
- control: form.control,
11680
- name: "address_1",
11681
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11682
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11683
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11684
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11685
- ] })
11686
- }
11687
- ),
11688
- /* @__PURE__ */ jsxRuntime.jsx(
11689
- Form$2.Field,
11690
- {
11691
- control: form.control,
11692
- name: "address_2",
11693
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11694
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11695
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11696
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11697
- ] })
11698
- }
11699
- ),
11700
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11701
- /* @__PURE__ */ jsxRuntime.jsx(
11702
- Form$2.Field,
11703
- {
11704
- control: form.control,
11705
- name: "postal_code",
11706
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11707
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11708
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11709
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11710
- ] })
11711
- }
11712
- ),
11713
- /* @__PURE__ */ jsxRuntime.jsx(
11714
- Form$2.Field,
11715
- {
11716
- control: form.control,
11717
- name: "city",
11718
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11719
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11720
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11721
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11722
- ] })
11723
- }
11724
- )
11725
- ] }),
11726
- /* @__PURE__ */ jsxRuntime.jsx(
11727
- Form$2.Field,
11728
- {
11729
- control: form.control,
11730
- name: "province",
11731
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11732
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11733
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11734
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11735
- ] })
11736
- }
11737
- ),
11738
- /* @__PURE__ */ jsxRuntime.jsx(
11739
- Form$2.Field,
11740
- {
11741
- control: form.control,
11742
- name: "phone",
11743
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11744
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11745
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11746
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11747
- ] })
11748
- }
11749
- )
11750
- ] }) }),
11751
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11752
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11753
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11754
- ] }) })
11755
- ]
11756
- }
11757
- ) });
11758
- };
11759
- const schema$1 = addressSchema;
11760
11557
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11761
11558
  const Shipping = () => {
11762
11559
  var _a;
@@ -12587,7 +12384,7 @@ const TransferOwnershipForm = ({ order }) => {
12587
12384
  defaultValues: {
12588
12385
  customer_id: order.customer_id || ""
12589
12386
  },
12590
- resolver: zod.zodResolver(schema)
12387
+ resolver: zod.zodResolver(schema$1)
12591
12388
  });
12592
12389
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12593
12390
  const { handleSuccess } = useRouteModal();
@@ -13037,9 +12834,212 @@ const Illustration = () => {
13037
12834
  }
13038
12835
  );
13039
12836
  };
13040
- const schema = objectType({
12837
+ const schema$1 = objectType({
13041
12838
  customer_id: stringType().min(1)
13042
12839
  });
12840
+ const ShippingAddress = () => {
12841
+ const { id } = reactRouterDom.useParams();
12842
+ const { order, isPending, isError, error } = useOrder(id, {
12843
+ fields: "+shipping_address"
12844
+ });
12845
+ if (isError) {
12846
+ throw error;
12847
+ }
12848
+ const isReady = !isPending && !!order;
12849
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12850
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12851
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12852
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12853
+ ] }),
12854
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12855
+ ] });
12856
+ };
12857
+ const ShippingAddressForm = ({ order }) => {
12858
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12859
+ const form = reactHookForm.useForm({
12860
+ defaultValues: {
12861
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12862
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12863
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12864
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12865
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12866
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12867
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12868
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12869
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12870
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12871
+ },
12872
+ resolver: zod.zodResolver(schema)
12873
+ });
12874
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12875
+ const { handleSuccess } = useRouteModal();
12876
+ const onSubmit = form.handleSubmit(async (data) => {
12877
+ await mutateAsync(
12878
+ {
12879
+ shipping_address: {
12880
+ first_name: data.first_name,
12881
+ last_name: data.last_name,
12882
+ company: data.company,
12883
+ address_1: data.address_1,
12884
+ address_2: data.address_2,
12885
+ city: data.city,
12886
+ province: data.province,
12887
+ country_code: data.country_code,
12888
+ postal_code: data.postal_code,
12889
+ phone: data.phone
12890
+ }
12891
+ },
12892
+ {
12893
+ onSuccess: () => {
12894
+ handleSuccess();
12895
+ },
12896
+ onError: (error) => {
12897
+ ui.toast.error(error.message);
12898
+ }
12899
+ }
12900
+ );
12901
+ });
12902
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12903
+ KeyboundForm,
12904
+ {
12905
+ className: "flex flex-1 flex-col overflow-hidden",
12906
+ onSubmit,
12907
+ children: [
12908
+ /* @__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: [
12909
+ /* @__PURE__ */ jsxRuntime.jsx(
12910
+ Form$2.Field,
12911
+ {
12912
+ control: form.control,
12913
+ name: "country_code",
12914
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12915
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12916
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12917
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12918
+ ] })
12919
+ }
12920
+ ),
12921
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12922
+ /* @__PURE__ */ jsxRuntime.jsx(
12923
+ Form$2.Field,
12924
+ {
12925
+ control: form.control,
12926
+ name: "first_name",
12927
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12928
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12929
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12930
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12931
+ ] })
12932
+ }
12933
+ ),
12934
+ /* @__PURE__ */ jsxRuntime.jsx(
12935
+ Form$2.Field,
12936
+ {
12937
+ control: form.control,
12938
+ name: "last_name",
12939
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12940
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12941
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12942
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12943
+ ] })
12944
+ }
12945
+ )
12946
+ ] }),
12947
+ /* @__PURE__ */ jsxRuntime.jsx(
12948
+ Form$2.Field,
12949
+ {
12950
+ control: form.control,
12951
+ name: "company",
12952
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12953
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12954
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12955
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12956
+ ] })
12957
+ }
12958
+ ),
12959
+ /* @__PURE__ */ jsxRuntime.jsx(
12960
+ Form$2.Field,
12961
+ {
12962
+ control: form.control,
12963
+ name: "address_1",
12964
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12965
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12966
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12967
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12968
+ ] })
12969
+ }
12970
+ ),
12971
+ /* @__PURE__ */ jsxRuntime.jsx(
12972
+ Form$2.Field,
12973
+ {
12974
+ control: form.control,
12975
+ name: "address_2",
12976
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12977
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12978
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12979
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12980
+ ] })
12981
+ }
12982
+ ),
12983
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12984
+ /* @__PURE__ */ jsxRuntime.jsx(
12985
+ Form$2.Field,
12986
+ {
12987
+ control: form.control,
12988
+ name: "postal_code",
12989
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12990
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12991
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12992
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12993
+ ] })
12994
+ }
12995
+ ),
12996
+ /* @__PURE__ */ jsxRuntime.jsx(
12997
+ Form$2.Field,
12998
+ {
12999
+ control: form.control,
13000
+ name: "city",
13001
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13002
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13003
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13004
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13005
+ ] })
13006
+ }
13007
+ )
13008
+ ] }),
13009
+ /* @__PURE__ */ jsxRuntime.jsx(
13010
+ Form$2.Field,
13011
+ {
13012
+ control: form.control,
13013
+ name: "province",
13014
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13015
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13016
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13017
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13018
+ ] })
13019
+ }
13020
+ ),
13021
+ /* @__PURE__ */ jsxRuntime.jsx(
13022
+ Form$2.Field,
13023
+ {
13024
+ control: form.control,
13025
+ name: "phone",
13026
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13027
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13028
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13029
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13030
+ ] })
13031
+ }
13032
+ )
13033
+ ] }) }),
13034
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13035
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13036
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13037
+ ] }) })
13038
+ ]
13039
+ }
13040
+ ) });
13041
+ };
13042
+ const schema = addressSchema;
13043
13043
  const widgetModule = { widgets: [] };
13044
13044
  const routeModule = {
13045
13045
  routes: [
@@ -13064,14 +13064,14 @@ const routeModule = {
13064
13064
  Component: BillingAddress,
13065
13065
  path: "/draft-orders/:id/billing-address"
13066
13066
  },
13067
- {
13068
- Component: Email,
13069
- path: "/draft-orders/:id/email"
13070
- },
13071
13067
  {
13072
13068
  Component: CustomItems,
13073
13069
  path: "/draft-orders/:id/custom-items"
13074
13070
  },
13071
+ {
13072
+ Component: Email,
13073
+ path: "/draft-orders/:id/email"
13074
+ },
13075
13075
  {
13076
13076
  Component: Items,
13077
13077
  path: "/draft-orders/:id/items"
@@ -13088,10 +13088,6 @@ const routeModule = {
13088
13088
  Component: SalesChannel,
13089
13089
  path: "/draft-orders/:id/sales-channel"
13090
13090
  },
13091
- {
13092
- Component: ShippingAddress,
13093
- path: "/draft-orders/:id/shipping-address"
13094
- },
13095
13091
  {
13096
13092
  Component: Shipping,
13097
13093
  path: "/draft-orders/:id/shipping"
@@ -13099,6 +13095,10 @@ const routeModule = {
13099
13095
  {
13100
13096
  Component: TransferOwnership,
13101
13097
  path: "/draft-orders/:id/transfer-ownership"
13098
+ },
13099
+ {
13100
+ Component: ShippingAddress,
13101
+ path: "/draft-orders/:id/shipping-address"
13102
13102
  }
13103
13103
  ]
13104
13104
  }
@@ -13111,6 +13111,7 @@ const menuItemModule = {
13111
13111
  icon: void 0,
13112
13112
  path: "/draft-orders",
13113
13113
  nested: "/orders",
13114
+ rank: void 0,
13114
13115
  translationNs: void 0
13115
13116
  }
13116
13117
  ]
@@ -9751,6 +9751,27 @@ const BillingAddressForm = ({ order }) => {
9751
9751
  ) });
9752
9752
  };
9753
9753
  const schema$5 = addressSchema;
9754
+ const CustomItems = () => {
9755
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9756
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9757
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9758
+ ] });
9759
+ };
9760
+ const CustomItemsForm = () => {
9761
+ const form = useForm({
9762
+ resolver: zodResolver(schema$4)
9763
+ });
9764
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9765
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9766
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9767
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9768
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9769
+ ] }) })
9770
+ ] }) });
9771
+ };
9772
+ const schema$4 = objectType({
9773
+ email: stringType().email()
9774
+ });
9754
9775
  const Email = () => {
9755
9776
  const { id } = useParams();
9756
9777
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9773,7 +9794,7 @@ const EmailForm = ({ order }) => {
9773
9794
  defaultValues: {
9774
9795
  email: order.email ?? ""
9775
9796
  },
9776
- resolver: zodResolver(schema$4)
9797
+ resolver: zodResolver(schema$3)
9777
9798
  });
9778
9799
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9779
9800
  const { handleSuccess } = useRouteModal();
@@ -9816,27 +9837,6 @@ const EmailForm = ({ order }) => {
9816
9837
  }
9817
9838
  ) });
9818
9839
  };
9819
- const schema$4 = objectType({
9820
- email: stringType().email()
9821
- });
9822
- const CustomItems = () => {
9823
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9824
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9825
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9826
- ] });
9827
- };
9828
- const CustomItemsForm = () => {
9829
- const form = useForm({
9830
- resolver: zodResolver(schema$3)
9831
- });
9832
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9833
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9834
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9835
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9836
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9837
- ] }) })
9838
- ] }) });
9839
- };
9840
9840
  const schema$3 = objectType({
9841
9841
  email: stringType().email()
9842
9842
  });
@@ -11547,209 +11547,6 @@ const SalesChannelField = ({ control, order }) => {
11547
11547
  const schema$2 = objectType({
11548
11548
  sales_channel_id: stringType().min(1)
11549
11549
  });
11550
- const ShippingAddress = () => {
11551
- const { id } = useParams();
11552
- const { order, isPending, isError, error } = useOrder(id, {
11553
- fields: "+shipping_address"
11554
- });
11555
- if (isError) {
11556
- throw error;
11557
- }
11558
- const isReady = !isPending && !!order;
11559
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11560
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11561
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11562
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11563
- ] }),
11564
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11565
- ] });
11566
- };
11567
- const ShippingAddressForm = ({ order }) => {
11568
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11569
- const form = useForm({
11570
- defaultValues: {
11571
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11572
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11573
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11574
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11575
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11576
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11577
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11578
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11579
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11580
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11581
- },
11582
- resolver: zodResolver(schema$1)
11583
- });
11584
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11585
- const { handleSuccess } = useRouteModal();
11586
- const onSubmit = form.handleSubmit(async (data) => {
11587
- await mutateAsync(
11588
- {
11589
- shipping_address: {
11590
- first_name: data.first_name,
11591
- last_name: data.last_name,
11592
- company: data.company,
11593
- address_1: data.address_1,
11594
- address_2: data.address_2,
11595
- city: data.city,
11596
- province: data.province,
11597
- country_code: data.country_code,
11598
- postal_code: data.postal_code,
11599
- phone: data.phone
11600
- }
11601
- },
11602
- {
11603
- onSuccess: () => {
11604
- handleSuccess();
11605
- },
11606
- onError: (error) => {
11607
- toast.error(error.message);
11608
- }
11609
- }
11610
- );
11611
- });
11612
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11613
- KeyboundForm,
11614
- {
11615
- className: "flex flex-1 flex-col overflow-hidden",
11616
- onSubmit,
11617
- children: [
11618
- /* @__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: [
11619
- /* @__PURE__ */ jsx(
11620
- Form$2.Field,
11621
- {
11622
- control: form.control,
11623
- name: "country_code",
11624
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11625
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11626
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11627
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11628
- ] })
11629
- }
11630
- ),
11631
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11632
- /* @__PURE__ */ jsx(
11633
- Form$2.Field,
11634
- {
11635
- control: form.control,
11636
- name: "first_name",
11637
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11638
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11639
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11640
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11641
- ] })
11642
- }
11643
- ),
11644
- /* @__PURE__ */ jsx(
11645
- Form$2.Field,
11646
- {
11647
- control: form.control,
11648
- name: "last_name",
11649
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11650
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11651
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11652
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11653
- ] })
11654
- }
11655
- )
11656
- ] }),
11657
- /* @__PURE__ */ jsx(
11658
- Form$2.Field,
11659
- {
11660
- control: form.control,
11661
- name: "company",
11662
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11663
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11664
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11665
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11666
- ] })
11667
- }
11668
- ),
11669
- /* @__PURE__ */ jsx(
11670
- Form$2.Field,
11671
- {
11672
- control: form.control,
11673
- name: "address_1",
11674
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11675
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11676
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11677
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11678
- ] })
11679
- }
11680
- ),
11681
- /* @__PURE__ */ jsx(
11682
- Form$2.Field,
11683
- {
11684
- control: form.control,
11685
- name: "address_2",
11686
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11687
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11688
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11689
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11690
- ] })
11691
- }
11692
- ),
11693
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11694
- /* @__PURE__ */ jsx(
11695
- Form$2.Field,
11696
- {
11697
- control: form.control,
11698
- name: "postal_code",
11699
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11700
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11701
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11702
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11703
- ] })
11704
- }
11705
- ),
11706
- /* @__PURE__ */ jsx(
11707
- Form$2.Field,
11708
- {
11709
- control: form.control,
11710
- name: "city",
11711
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11712
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11713
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11714
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11715
- ] })
11716
- }
11717
- )
11718
- ] }),
11719
- /* @__PURE__ */ jsx(
11720
- Form$2.Field,
11721
- {
11722
- control: form.control,
11723
- name: "province",
11724
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11725
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11726
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11727
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11728
- ] })
11729
- }
11730
- ),
11731
- /* @__PURE__ */ jsx(
11732
- Form$2.Field,
11733
- {
11734
- control: form.control,
11735
- name: "phone",
11736
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11737
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11738
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11739
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11740
- ] })
11741
- }
11742
- )
11743
- ] }) }),
11744
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11745
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11746
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11747
- ] }) })
11748
- ]
11749
- }
11750
- ) });
11751
- };
11752
- const schema$1 = addressSchema;
11753
11550
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11754
11551
  const Shipping = () => {
11755
11552
  var _a;
@@ -12580,7 +12377,7 @@ const TransferOwnershipForm = ({ order }) => {
12580
12377
  defaultValues: {
12581
12378
  customer_id: order.customer_id || ""
12582
12379
  },
12583
- resolver: zodResolver(schema)
12380
+ resolver: zodResolver(schema$1)
12584
12381
  });
12585
12382
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12586
12383
  const { handleSuccess } = useRouteModal();
@@ -13030,9 +12827,212 @@ const Illustration = () => {
13030
12827
  }
13031
12828
  );
13032
12829
  };
13033
- const schema = objectType({
12830
+ const schema$1 = objectType({
13034
12831
  customer_id: stringType().min(1)
13035
12832
  });
12833
+ const ShippingAddress = () => {
12834
+ const { id } = useParams();
12835
+ const { order, isPending, isError, error } = useOrder(id, {
12836
+ fields: "+shipping_address"
12837
+ });
12838
+ if (isError) {
12839
+ throw error;
12840
+ }
12841
+ const isReady = !isPending && !!order;
12842
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12843
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12844
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12845
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12846
+ ] }),
12847
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12848
+ ] });
12849
+ };
12850
+ const ShippingAddressForm = ({ order }) => {
12851
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12852
+ const form = useForm({
12853
+ defaultValues: {
12854
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12855
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12856
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12857
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12858
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12859
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12860
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12861
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12862
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12863
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12864
+ },
12865
+ resolver: zodResolver(schema)
12866
+ });
12867
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12868
+ const { handleSuccess } = useRouteModal();
12869
+ const onSubmit = form.handleSubmit(async (data) => {
12870
+ await mutateAsync(
12871
+ {
12872
+ shipping_address: {
12873
+ first_name: data.first_name,
12874
+ last_name: data.last_name,
12875
+ company: data.company,
12876
+ address_1: data.address_1,
12877
+ address_2: data.address_2,
12878
+ city: data.city,
12879
+ province: data.province,
12880
+ country_code: data.country_code,
12881
+ postal_code: data.postal_code,
12882
+ phone: data.phone
12883
+ }
12884
+ },
12885
+ {
12886
+ onSuccess: () => {
12887
+ handleSuccess();
12888
+ },
12889
+ onError: (error) => {
12890
+ toast.error(error.message);
12891
+ }
12892
+ }
12893
+ );
12894
+ });
12895
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12896
+ KeyboundForm,
12897
+ {
12898
+ className: "flex flex-1 flex-col overflow-hidden",
12899
+ onSubmit,
12900
+ children: [
12901
+ /* @__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: [
12902
+ /* @__PURE__ */ jsx(
12903
+ Form$2.Field,
12904
+ {
12905
+ control: form.control,
12906
+ name: "country_code",
12907
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12908
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12909
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12910
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12911
+ ] })
12912
+ }
12913
+ ),
12914
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12915
+ /* @__PURE__ */ jsx(
12916
+ Form$2.Field,
12917
+ {
12918
+ control: form.control,
12919
+ name: "first_name",
12920
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12921
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12922
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12923
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12924
+ ] })
12925
+ }
12926
+ ),
12927
+ /* @__PURE__ */ jsx(
12928
+ Form$2.Field,
12929
+ {
12930
+ control: form.control,
12931
+ name: "last_name",
12932
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12933
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12934
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12935
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12936
+ ] })
12937
+ }
12938
+ )
12939
+ ] }),
12940
+ /* @__PURE__ */ jsx(
12941
+ Form$2.Field,
12942
+ {
12943
+ control: form.control,
12944
+ name: "company",
12945
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12946
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12947
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12948
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12949
+ ] })
12950
+ }
12951
+ ),
12952
+ /* @__PURE__ */ jsx(
12953
+ Form$2.Field,
12954
+ {
12955
+ control: form.control,
12956
+ name: "address_1",
12957
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12958
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12959
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12960
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12961
+ ] })
12962
+ }
12963
+ ),
12964
+ /* @__PURE__ */ jsx(
12965
+ Form$2.Field,
12966
+ {
12967
+ control: form.control,
12968
+ name: "address_2",
12969
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12970
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12971
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12972
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12973
+ ] })
12974
+ }
12975
+ ),
12976
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12977
+ /* @__PURE__ */ jsx(
12978
+ Form$2.Field,
12979
+ {
12980
+ control: form.control,
12981
+ name: "postal_code",
12982
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12983
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12984
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12985
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12986
+ ] })
12987
+ }
12988
+ ),
12989
+ /* @__PURE__ */ jsx(
12990
+ Form$2.Field,
12991
+ {
12992
+ control: form.control,
12993
+ name: "city",
12994
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12995
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12996
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12997
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12998
+ ] })
12999
+ }
13000
+ )
13001
+ ] }),
13002
+ /* @__PURE__ */ jsx(
13003
+ Form$2.Field,
13004
+ {
13005
+ control: form.control,
13006
+ name: "province",
13007
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13008
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13009
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13010
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13011
+ ] })
13012
+ }
13013
+ ),
13014
+ /* @__PURE__ */ jsx(
13015
+ Form$2.Field,
13016
+ {
13017
+ control: form.control,
13018
+ name: "phone",
13019
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13020
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13021
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13022
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13023
+ ] })
13024
+ }
13025
+ )
13026
+ ] }) }),
13027
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13028
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13029
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13030
+ ] }) })
13031
+ ]
13032
+ }
13033
+ ) });
13034
+ };
13035
+ const schema = addressSchema;
13036
13036
  const widgetModule = { widgets: [] };
13037
13037
  const routeModule = {
13038
13038
  routes: [
@@ -13057,14 +13057,14 @@ const routeModule = {
13057
13057
  Component: BillingAddress,
13058
13058
  path: "/draft-orders/:id/billing-address"
13059
13059
  },
13060
- {
13061
- Component: Email,
13062
- path: "/draft-orders/:id/email"
13063
- },
13064
13060
  {
13065
13061
  Component: CustomItems,
13066
13062
  path: "/draft-orders/:id/custom-items"
13067
13063
  },
13064
+ {
13065
+ Component: Email,
13066
+ path: "/draft-orders/:id/email"
13067
+ },
13068
13068
  {
13069
13069
  Component: Items,
13070
13070
  path: "/draft-orders/:id/items"
@@ -13081,10 +13081,6 @@ const routeModule = {
13081
13081
  Component: SalesChannel,
13082
13082
  path: "/draft-orders/:id/sales-channel"
13083
13083
  },
13084
- {
13085
- Component: ShippingAddress,
13086
- path: "/draft-orders/:id/shipping-address"
13087
- },
13088
13084
  {
13089
13085
  Component: Shipping,
13090
13086
  path: "/draft-orders/:id/shipping"
@@ -13092,6 +13088,10 @@ const routeModule = {
13092
13088
  {
13093
13089
  Component: TransferOwnership,
13094
13090
  path: "/draft-orders/:id/transfer-ownership"
13091
+ },
13092
+ {
13093
+ Component: ShippingAddress,
13094
+ path: "/draft-orders/:id/shipping-address"
13095
13095
  }
13096
13096
  ]
13097
13097
  }
@@ -13104,6 +13104,7 @@ const menuItemModule = {
13104
13104
  icon: void 0,
13105
13105
  path: "/draft-orders",
13106
13106
  nested: "/orders",
13107
+ rank: void 0,
13107
13108
  translationNs: void 0
13108
13109
  }
13109
13110
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.11.4-preview-20251107150138",
3
+ "version": "2.11.4-preview-20251107210127",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@babel/runtime": "^7.26.10",
39
39
  "@hookform/resolvers": "3.4.2",
40
- "@medusajs/js-sdk": "2.11.4-preview-20251107150138",
40
+ "@medusajs/js-sdk": "2.11.4-preview-20251107210127",
41
41
  "@tanstack/react-query": "5.64.2",
42
42
  "@uiw/react-json-view": "^2.0.0-alpha.17",
43
43
  "date-fns": "^3.6.0",
@@ -48,22 +48,22 @@
48
48
  "react-hook-form": "7.49.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@medusajs/admin-sdk": "2.11.4-preview-20251107150138",
52
- "@medusajs/cli": "2.11.4-preview-20251107150138",
53
- "@medusajs/framework": "2.11.4-preview-20251107150138",
54
- "@medusajs/icons": "2.11.4-preview-20251107150138",
55
- "@medusajs/test-utils": "2.11.4-preview-20251107150138",
56
- "@medusajs/types": "2.11.4-preview-20251107150138",
57
- "@medusajs/ui": "4.0.28-preview-20251107150138",
58
- "@medusajs/ui-preset": "2.11.4-preview-20251107150138"
51
+ "@medusajs/admin-sdk": "2.11.4-preview-20251107210127",
52
+ "@medusajs/cli": "2.11.4-preview-20251107210127",
53
+ "@medusajs/framework": "2.11.4-preview-20251107210127",
54
+ "@medusajs/icons": "2.11.4-preview-20251107210127",
55
+ "@medusajs/test-utils": "2.11.4-preview-20251107210127",
56
+ "@medusajs/types": "2.11.4-preview-20251107210127",
57
+ "@medusajs/ui": "4.0.28-preview-20251107210127",
58
+ "@medusajs/ui-preset": "2.11.4-preview-20251107210127"
59
59
  },
60
60
  "peerDependencies": {
61
- "@medusajs/admin-sdk": "2.11.4-preview-20251107150138",
62
- "@medusajs/cli": "2.11.4-preview-20251107150138",
63
- "@medusajs/framework": "2.11.4-preview-20251107150138",
64
- "@medusajs/icons": "2.11.4-preview-20251107150138",
65
- "@medusajs/test-utils": "2.11.4-preview-20251107150138",
66
- "@medusajs/ui": "4.0.28-preview-20251107150138",
61
+ "@medusajs/admin-sdk": "2.11.4-preview-20251107210127",
62
+ "@medusajs/cli": "2.11.4-preview-20251107210127",
63
+ "@medusajs/framework": "2.11.4-preview-20251107210127",
64
+ "@medusajs/icons": "2.11.4-preview-20251107210127",
65
+ "@medusajs/test-utils": "2.11.4-preview-20251107210127",
66
+ "@medusajs/ui": "4.0.28-preview-20251107210127",
67
67
  "react": "^18.3.1",
68
68
  "react-dom": "^18.3.1",
69
69
  "react-router-dom": "6.20.1"