@medusajs/draft-order 2.11.3-preview-20251103113757 → 2.11.3-snapshot-20251103115905

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.
@@ -4654,9 +4654,6 @@ ZodReadonly.create = (type, params) => {
4654
4654
  ...processCreateParams(params)
4655
4655
  });
4656
4656
  };
4657
- ({
4658
- object: ZodObject.lazycreate
4659
- });
4660
4657
  var ZodFirstPartyTypeKind;
4661
4658
  (function(ZodFirstPartyTypeKind2) {
4662
4659
  ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
@@ -4703,7 +4700,6 @@ const anyType = ZodAny.create;
4703
4700
  ZodNever.create;
4704
4701
  const arrayType = ZodArray.create;
4705
4702
  const objectType = ZodObject.create;
4706
- ZodObject.strictCreate;
4707
4703
  const unionType = ZodUnion.create;
4708
4704
  ZodIntersection.create;
4709
4705
  ZodTuple.create;
@@ -9762,27 +9758,6 @@ const BillingAddressForm = ({ order }) => {
9762
9758
  ) });
9763
9759
  };
9764
9760
  const schema$5 = addressSchema;
9765
- const CustomItems = () => {
9766
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9767
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9768
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9769
- ] });
9770
- };
9771
- const CustomItemsForm = () => {
9772
- const form = reactHookForm.useForm({
9773
- resolver: zod.zodResolver(schema$4)
9774
- });
9775
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9776
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9777
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9778
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9779
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9780
- ] }) })
9781
- ] }) });
9782
- };
9783
- const schema$4 = objectType({
9784
- email: stringType().email()
9785
- });
9786
9761
  const Email = () => {
9787
9762
  const { id } = reactRouterDom.useParams();
9788
9763
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9805,7 +9780,7 @@ const EmailForm = ({ order }) => {
9805
9780
  defaultValues: {
9806
9781
  email: order.email ?? ""
9807
9782
  },
9808
- resolver: zod.zodResolver(schema$3)
9783
+ resolver: zod.zodResolver(schema$4)
9809
9784
  });
9810
9785
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9811
9786
  const { handleSuccess } = useRouteModal();
@@ -9848,6 +9823,27 @@ const EmailForm = ({ order }) => {
9848
9823
  }
9849
9824
  ) });
9850
9825
  };
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
+ };
9851
9847
  const schema$3 = objectType({
9852
9848
  email: stringType().email()
9853
9849
  });
@@ -11558,6 +11554,209 @@ const SalesChannelField = ({ control, order }) => {
11558
11554
  const schema$2 = objectType({
11559
11555
  sales_channel_id: stringType().min(1)
11560
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;
11561
11760
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11562
11761
  const Shipping = () => {
11563
11762
  var _a;
@@ -12388,7 +12587,7 @@ const TransferOwnershipForm = ({ order }) => {
12388
12587
  defaultValues: {
12389
12588
  customer_id: order.customer_id || ""
12390
12589
  },
12391
- resolver: zod.zodResolver(schema$1)
12590
+ resolver: zod.zodResolver(schema)
12392
12591
  });
12393
12592
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12394
12593
  const { handleSuccess } = useRouteModal();
@@ -12838,212 +13037,9 @@ const Illustration = () => {
12838
13037
  }
12839
13038
  );
12840
13039
  };
12841
- const schema$1 = objectType({
13040
+ const schema = objectType({
12842
13041
  customer_id: stringType().min(1)
12843
13042
  });
12844
- const ShippingAddress = () => {
12845
- const { id } = reactRouterDom.useParams();
12846
- const { order, isPending, isError, error } = useOrder(id, {
12847
- fields: "+shipping_address"
12848
- });
12849
- if (isError) {
12850
- throw error;
12851
- }
12852
- const isReady = !isPending && !!order;
12853
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12854
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12855
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12856
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12857
- ] }),
12858
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12859
- ] });
12860
- };
12861
- const ShippingAddressForm = ({ order }) => {
12862
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12863
- const form = reactHookForm.useForm({
12864
- defaultValues: {
12865
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12866
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12867
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12868
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12869
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12870
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12871
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12872
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12873
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12874
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12875
- },
12876
- resolver: zod.zodResolver(schema)
12877
- });
12878
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12879
- const { handleSuccess } = useRouteModal();
12880
- const onSubmit = form.handleSubmit(async (data) => {
12881
- await mutateAsync(
12882
- {
12883
- shipping_address: {
12884
- first_name: data.first_name,
12885
- last_name: data.last_name,
12886
- company: data.company,
12887
- address_1: data.address_1,
12888
- address_2: data.address_2,
12889
- city: data.city,
12890
- province: data.province,
12891
- country_code: data.country_code,
12892
- postal_code: data.postal_code,
12893
- phone: data.phone
12894
- }
12895
- },
12896
- {
12897
- onSuccess: () => {
12898
- handleSuccess();
12899
- },
12900
- onError: (error) => {
12901
- ui.toast.error(error.message);
12902
- }
12903
- }
12904
- );
12905
- });
12906
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12907
- KeyboundForm,
12908
- {
12909
- className: "flex flex-1 flex-col overflow-hidden",
12910
- onSubmit,
12911
- children: [
12912
- /* @__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: [
12913
- /* @__PURE__ */ jsxRuntime.jsx(
12914
- Form$2.Field,
12915
- {
12916
- control: form.control,
12917
- name: "country_code",
12918
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12919
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12922
- ] })
12923
- }
12924
- ),
12925
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12926
- /* @__PURE__ */ jsxRuntime.jsx(
12927
- Form$2.Field,
12928
- {
12929
- control: form.control,
12930
- name: "first_name",
12931
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
- ] })
12936
- }
12937
- ),
12938
- /* @__PURE__ */ jsxRuntime.jsx(
12939
- Form$2.Field,
12940
- {
12941
- control: form.control,
12942
- name: "last_name",
12943
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12944
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12946
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12947
- ] })
12948
- }
12949
- )
12950
- ] }),
12951
- /* @__PURE__ */ jsxRuntime.jsx(
12952
- Form$2.Field,
12953
- {
12954
- control: form.control,
12955
- name: "company",
12956
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
- ] })
12961
- }
12962
- ),
12963
- /* @__PURE__ */ jsxRuntime.jsx(
12964
- Form$2.Field,
12965
- {
12966
- control: form.control,
12967
- name: "address_1",
12968
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
- ] })
12973
- }
12974
- ),
12975
- /* @__PURE__ */ jsxRuntime.jsx(
12976
- Form$2.Field,
12977
- {
12978
- control: form.control,
12979
- name: "address_2",
12980
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12981
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12984
- ] })
12985
- }
12986
- ),
12987
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12988
- /* @__PURE__ */ jsxRuntime.jsx(
12989
- Form$2.Field,
12990
- {
12991
- control: form.control,
12992
- name: "postal_code",
12993
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
- ] })
12998
- }
12999
- ),
13000
- /* @__PURE__ */ jsxRuntime.jsx(
13001
- Form$2.Field,
13002
- {
13003
- control: form.control,
13004
- name: "city",
13005
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13006
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13008
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13009
- ] })
13010
- }
13011
- )
13012
- ] }),
13013
- /* @__PURE__ */ jsxRuntime.jsx(
13014
- Form$2.Field,
13015
- {
13016
- control: form.control,
13017
- name: "province",
13018
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
- ] })
13023
- }
13024
- ),
13025
- /* @__PURE__ */ jsxRuntime.jsx(
13026
- Form$2.Field,
13027
- {
13028
- control: form.control,
13029
- name: "phone",
13030
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13033
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13034
- ] })
13035
- }
13036
- )
13037
- ] }) }),
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13040
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13041
- ] }) })
13042
- ]
13043
- }
13044
- ) });
13045
- };
13046
- const schema = addressSchema;
13047
13043
  const widgetModule = { widgets: [] };
13048
13044
  const routeModule = {
13049
13045
  routes: [
@@ -13068,14 +13064,14 @@ const routeModule = {
13068
13064
  Component: BillingAddress,
13069
13065
  path: "/draft-orders/:id/billing-address"
13070
13066
  },
13071
- {
13072
- Component: CustomItems,
13073
- path: "/draft-orders/:id/custom-items"
13074
- },
13075
13067
  {
13076
13068
  Component: Email,
13077
13069
  path: "/draft-orders/:id/email"
13078
13070
  },
13071
+ {
13072
+ Component: CustomItems,
13073
+ path: "/draft-orders/:id/custom-items"
13074
+ },
13079
13075
  {
13080
13076
  Component: Items,
13081
13077
  path: "/draft-orders/:id/items"
@@ -13092,6 +13088,10 @@ const routeModule = {
13092
13088
  Component: SalesChannel,
13093
13089
  path: "/draft-orders/:id/sales-channel"
13094
13090
  },
13091
+ {
13092
+ Component: ShippingAddress,
13093
+ path: "/draft-orders/:id/shipping-address"
13094
+ },
13095
13095
  {
13096
13096
  Component: Shipping,
13097
13097
  path: "/draft-orders/:id/shipping"
@@ -13099,10 +13099,6 @@ const routeModule = {
13099
13099
  {
13100
13100
  Component: TransferOwnership,
13101
13101
  path: "/draft-orders/:id/transfer-ownership"
13102
- },
13103
- {
13104
- Component: ShippingAddress,
13105
- path: "/draft-orders/:id/shipping-address"
13106
13102
  }
13107
13103
  ]
13108
13104
  }
@@ -9,7 +9,7 @@ import Medusa from "@medusajs/js-sdk";
9
9
  import { format, formatDistance, sub, subDays, subMonths } from "date-fns";
10
10
  import { enUS } from "date-fns/locale";
11
11
  import { zodResolver } from "@hookform/resolvers/zod";
12
- import { FormProvider, Controller, useFormContext, useFormState, useForm, useWatch, useFieldArray } from "react-hook-form";
12
+ import { FormProvider, useFormContext, useFormState, Controller, useForm, useWatch, useFieldArray } from "react-hook-form";
13
13
  import { Slot, Collapsible, Accordion } from "radix-ui";
14
14
  import { ComboboxProvider, Combobox as Combobox$1, ComboboxDisclosure, ComboboxPopover, ComboboxItem, ComboboxItemCheck, ComboboxItemValue, Separator } from "@ariakit/react";
15
15
  import { matchSorter } from "match-sorter";
@@ -4647,9 +4647,6 @@ ZodReadonly.create = (type, params) => {
4647
4647
  ...processCreateParams(params)
4648
4648
  });
4649
4649
  };
4650
- ({
4651
- object: ZodObject.lazycreate
4652
- });
4653
4650
  var ZodFirstPartyTypeKind;
4654
4651
  (function(ZodFirstPartyTypeKind2) {
4655
4652
  ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
@@ -4696,7 +4693,6 @@ const anyType = ZodAny.create;
4696
4693
  ZodNever.create;
4697
4694
  const arrayType = ZodArray.create;
4698
4695
  const objectType = ZodObject.create;
4699
- ZodObject.strictCreate;
4700
4696
  const unionType = ZodUnion.create;
4701
4697
  ZodIntersection.create;
4702
4698
  ZodTuple.create;
@@ -9755,27 +9751,6 @@ const BillingAddressForm = ({ order }) => {
9755
9751
  ) });
9756
9752
  };
9757
9753
  const schema$5 = addressSchema;
9758
- const CustomItems = () => {
9759
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9760
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9761
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9762
- ] });
9763
- };
9764
- const CustomItemsForm = () => {
9765
- const form = useForm({
9766
- resolver: zodResolver(schema$4)
9767
- });
9768
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9769
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9770
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9771
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9772
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9773
- ] }) })
9774
- ] }) });
9775
- };
9776
- const schema$4 = objectType({
9777
- email: stringType().email()
9778
- });
9779
9754
  const Email = () => {
9780
9755
  const { id } = useParams();
9781
9756
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9798,7 +9773,7 @@ const EmailForm = ({ order }) => {
9798
9773
  defaultValues: {
9799
9774
  email: order.email ?? ""
9800
9775
  },
9801
- resolver: zodResolver(schema$3)
9776
+ resolver: zodResolver(schema$4)
9802
9777
  });
9803
9778
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9804
9779
  const { handleSuccess } = useRouteModal();
@@ -9841,6 +9816,27 @@ const EmailForm = ({ order }) => {
9841
9816
  }
9842
9817
  ) });
9843
9818
  };
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
+ };
9844
9840
  const schema$3 = objectType({
9845
9841
  email: stringType().email()
9846
9842
  });
@@ -11551,6 +11547,209 @@ const SalesChannelField = ({ control, order }) => {
11551
11547
  const schema$2 = objectType({
11552
11548
  sales_channel_id: stringType().min(1)
11553
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;
11554
11753
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11555
11754
  const Shipping = () => {
11556
11755
  var _a;
@@ -12381,7 +12580,7 @@ const TransferOwnershipForm = ({ order }) => {
12381
12580
  defaultValues: {
12382
12581
  customer_id: order.customer_id || ""
12383
12582
  },
12384
- resolver: zodResolver(schema$1)
12583
+ resolver: zodResolver(schema)
12385
12584
  });
12386
12585
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12387
12586
  const { handleSuccess } = useRouteModal();
@@ -12831,212 +13030,9 @@ const Illustration = () => {
12831
13030
  }
12832
13031
  );
12833
13032
  };
12834
- const schema$1 = objectType({
13033
+ const schema = objectType({
12835
13034
  customer_id: stringType().min(1)
12836
13035
  });
12837
- const ShippingAddress = () => {
12838
- const { id } = useParams();
12839
- const { order, isPending, isError, error } = useOrder(id, {
12840
- fields: "+shipping_address"
12841
- });
12842
- if (isError) {
12843
- throw error;
12844
- }
12845
- const isReady = !isPending && !!order;
12846
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12847
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12848
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12849
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12850
- ] }),
12851
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12852
- ] });
12853
- };
12854
- const ShippingAddressForm = ({ order }) => {
12855
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12856
- const form = useForm({
12857
- defaultValues: {
12858
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12859
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12860
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12861
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12862
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12863
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12864
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12865
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12866
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12867
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12868
- },
12869
- resolver: zodResolver(schema)
12870
- });
12871
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12872
- const { handleSuccess } = useRouteModal();
12873
- const onSubmit = form.handleSubmit(async (data) => {
12874
- await mutateAsync(
12875
- {
12876
- shipping_address: {
12877
- first_name: data.first_name,
12878
- last_name: data.last_name,
12879
- company: data.company,
12880
- address_1: data.address_1,
12881
- address_2: data.address_2,
12882
- city: data.city,
12883
- province: data.province,
12884
- country_code: data.country_code,
12885
- postal_code: data.postal_code,
12886
- phone: data.phone
12887
- }
12888
- },
12889
- {
12890
- onSuccess: () => {
12891
- handleSuccess();
12892
- },
12893
- onError: (error) => {
12894
- toast.error(error.message);
12895
- }
12896
- }
12897
- );
12898
- });
12899
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12900
- KeyboundForm,
12901
- {
12902
- className: "flex flex-1 flex-col overflow-hidden",
12903
- onSubmit,
12904
- children: [
12905
- /* @__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: [
12906
- /* @__PURE__ */ jsx(
12907
- Form$2.Field,
12908
- {
12909
- control: form.control,
12910
- name: "country_code",
12911
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12912
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12913
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12914
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12915
- ] })
12916
- }
12917
- ),
12918
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12919
- /* @__PURE__ */ jsx(
12920
- Form$2.Field,
12921
- {
12922
- control: form.control,
12923
- name: "first_name",
12924
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12925
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12926
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12927
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12928
- ] })
12929
- }
12930
- ),
12931
- /* @__PURE__ */ jsx(
12932
- Form$2.Field,
12933
- {
12934
- control: form.control,
12935
- name: "last_name",
12936
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12937
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12938
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12939
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12940
- ] })
12941
- }
12942
- )
12943
- ] }),
12944
- /* @__PURE__ */ jsx(
12945
- Form$2.Field,
12946
- {
12947
- control: form.control,
12948
- name: "company",
12949
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12950
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12951
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12952
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12953
- ] })
12954
- }
12955
- ),
12956
- /* @__PURE__ */ jsx(
12957
- Form$2.Field,
12958
- {
12959
- control: form.control,
12960
- name: "address_1",
12961
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12962
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12963
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12964
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12965
- ] })
12966
- }
12967
- ),
12968
- /* @__PURE__ */ jsx(
12969
- Form$2.Field,
12970
- {
12971
- control: form.control,
12972
- name: "address_2",
12973
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12974
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12975
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12976
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12977
- ] })
12978
- }
12979
- ),
12980
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12981
- /* @__PURE__ */ jsx(
12982
- Form$2.Field,
12983
- {
12984
- control: form.control,
12985
- name: "postal_code",
12986
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12987
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12988
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12989
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12990
- ] })
12991
- }
12992
- ),
12993
- /* @__PURE__ */ jsx(
12994
- Form$2.Field,
12995
- {
12996
- control: form.control,
12997
- name: "city",
12998
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12999
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
13000
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13001
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13002
- ] })
13003
- }
13004
- )
13005
- ] }),
13006
- /* @__PURE__ */ jsx(
13007
- Form$2.Field,
13008
- {
13009
- control: form.control,
13010
- name: "province",
13011
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13012
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13013
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13014
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13015
- ] })
13016
- }
13017
- ),
13018
- /* @__PURE__ */ jsx(
13019
- Form$2.Field,
13020
- {
13021
- control: form.control,
13022
- name: "phone",
13023
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13024
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13025
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13026
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13027
- ] })
13028
- }
13029
- )
13030
- ] }) }),
13031
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13034
- ] }) })
13035
- ]
13036
- }
13037
- ) });
13038
- };
13039
- const schema = addressSchema;
13040
13036
  const widgetModule = { widgets: [] };
13041
13037
  const routeModule = {
13042
13038
  routes: [
@@ -13061,14 +13057,14 @@ const routeModule = {
13061
13057
  Component: BillingAddress,
13062
13058
  path: "/draft-orders/:id/billing-address"
13063
13059
  },
13064
- {
13065
- Component: CustomItems,
13066
- path: "/draft-orders/:id/custom-items"
13067
- },
13068
13060
  {
13069
13061
  Component: Email,
13070
13062
  path: "/draft-orders/:id/email"
13071
13063
  },
13064
+ {
13065
+ Component: CustomItems,
13066
+ path: "/draft-orders/:id/custom-items"
13067
+ },
13072
13068
  {
13073
13069
  Component: Items,
13074
13070
  path: "/draft-orders/:id/items"
@@ -13085,6 +13081,10 @@ const routeModule = {
13085
13081
  Component: SalesChannel,
13086
13082
  path: "/draft-orders/:id/sales-channel"
13087
13083
  },
13084
+ {
13085
+ Component: ShippingAddress,
13086
+ path: "/draft-orders/:id/shipping-address"
13087
+ },
13088
13088
  {
13089
13089
  Component: Shipping,
13090
13090
  path: "/draft-orders/:id/shipping"
@@ -13092,10 +13092,6 @@ const routeModule = {
13092
13092
  {
13093
13093
  Component: TransferOwnership,
13094
13094
  path: "/draft-orders/:id/transfer-ownership"
13095
- },
13096
- {
13097
- Component: ShippingAddress,
13098
- path: "/draft-orders/:id/shipping-address"
13099
13095
  }
13100
13096
  ]
13101
13097
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.11.3-preview-20251103113757",
3
+ "version": "2.11.3-snapshot-20251103115905",
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.3-preview-20251103113757",
40
+ "@medusajs/js-sdk": "2.11.3-snapshot-20251103115905",
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,37 +48,22 @@
48
48
  "react-hook-form": "7.49.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@medusajs/admin-sdk": "2.11.3-preview-20251103113757",
52
- "@medusajs/cli": "2.11.3-preview-20251103113757",
53
- "@medusajs/framework": "2.11.3-preview-20251103113757",
54
- "@medusajs/icons": "2.11.3-preview-20251103113757",
55
- "@medusajs/test-utils": "2.11.3-preview-20251103113757",
56
- "@medusajs/types": "2.11.3-preview-20251103113757",
57
- "@medusajs/ui": "4.0.27-preview-20251103113757",
58
- "@medusajs/ui-preset": "2.11.3-preview-20251103113757",
59
- "@swc/core": "^1.7.28",
60
- "@types/lodash": "^4.17.15",
61
- "@types/lodash.debounce": "^4.0.9",
62
- "@types/lodash.isequal": "^4.5.8",
63
- "@types/node": "^20.12.11",
64
- "@types/react": "^18.3.2",
65
- "@types/react-dom": "^18.2.25",
66
- "react": "^18.3.1",
67
- "react-dom": "^18.3.1",
68
- "react-router-dom": "6.20.1",
69
- "ts-node": "^10.9.2",
70
- "tsup": "^8.4.0",
71
- "typescript": "^5.6.2",
72
- "vite": "^5.4.14",
73
- "yalc": "^1.0.0-pre.53"
51
+ "@medusajs/admin-sdk": "2.11.3-snapshot-20251103115905",
52
+ "@medusajs/cli": "2.11.3-snapshot-20251103115905",
53
+ "@medusajs/framework": "2.11.3-snapshot-20251103115905",
54
+ "@medusajs/icons": "2.11.3-snapshot-20251103115905",
55
+ "@medusajs/test-utils": "2.11.3-snapshot-20251103115905",
56
+ "@medusajs/types": "2.11.3-snapshot-20251103115905",
57
+ "@medusajs/ui": "4.0.27-snapshot-20251103115905",
58
+ "@medusajs/ui-preset": "2.11.3-snapshot-20251103115905"
74
59
  },
75
60
  "peerDependencies": {
76
- "@medusajs/admin-sdk": "2.11.3-preview-20251103113757",
77
- "@medusajs/cli": "2.11.3-preview-20251103113757",
78
- "@medusajs/framework": "2.11.3-preview-20251103113757",
79
- "@medusajs/icons": "2.11.3-preview-20251103113757",
80
- "@medusajs/test-utils": "2.11.3-preview-20251103113757",
81
- "@medusajs/ui": "4.0.27-preview-20251103113757",
61
+ "@medusajs/admin-sdk": "2.11.3-snapshot-20251103115905",
62
+ "@medusajs/cli": "2.11.3-snapshot-20251103115905",
63
+ "@medusajs/framework": "2.11.3-snapshot-20251103115905",
64
+ "@medusajs/icons": "2.11.3-snapshot-20251103115905",
65
+ "@medusajs/test-utils": "2.11.3-snapshot-20251103115905",
66
+ "@medusajs/ui": "4.0.27-snapshot-20251103115905",
82
67
  "react": "^18.3.1",
83
68
  "react-dom": "^18.3.1",
84
69
  "react-router-dom": "6.20.1"