@medusajs/draft-order 2.10.0-preview-20250827210153 → 2.10.0-preview-20250828000308

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9560,27 +9560,196 @@ const ID = () => {
9560
9560
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9561
  ] });
9562
9562
  };
9563
- const CustomItems = () => {
9563
+ const BillingAddress = () => {
9564
+ const { id } = reactRouterDom.useParams();
9565
+ const { order, isPending, isError, error } = useOrder(id, {
9566
+ fields: "+billing_address"
9567
+ });
9568
+ if (isError) {
9569
+ throw error;
9570
+ }
9571
+ const isReady = !isPending && !!order;
9564
9572
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9565
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9566
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9573
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9574
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9575
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9576
+ ] }),
9577
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9567
9578
  ] });
9568
9579
  };
9569
- const CustomItemsForm = () => {
9580
+ const BillingAddressForm = ({ order }) => {
9581
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9570
9582
  const form = reactHookForm.useForm({
9583
+ defaultValues: {
9584
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9585
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9586
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9587
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9588
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9589
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9590
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9591
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9592
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9593
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9594
+ },
9571
9595
  resolver: zod.zodResolver(schema$5)
9572
9596
  });
9573
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9574
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9575
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9576
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9577
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9578
- ] }) })
9579
- ] }) });
9597
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9598
+ const { handleSuccess } = useRouteModal();
9599
+ const onSubmit = form.handleSubmit(async (data) => {
9600
+ await mutateAsync(
9601
+ { billing_address: data },
9602
+ {
9603
+ onSuccess: () => {
9604
+ handleSuccess();
9605
+ },
9606
+ onError: (error) => {
9607
+ ui.toast.error(error.message);
9608
+ }
9609
+ }
9610
+ );
9611
+ });
9612
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9613
+ KeyboundForm,
9614
+ {
9615
+ className: "flex flex-1 flex-col overflow-hidden",
9616
+ onSubmit,
9617
+ children: [
9618
+ /* @__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: [
9619
+ /* @__PURE__ */ jsxRuntime.jsx(
9620
+ Form$2.Field,
9621
+ {
9622
+ control: form.control,
9623
+ name: "country_code",
9624
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9625
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9626
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9627
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9628
+ ] })
9629
+ }
9630
+ ),
9631
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9632
+ /* @__PURE__ */ jsxRuntime.jsx(
9633
+ Form$2.Field,
9634
+ {
9635
+ control: form.control,
9636
+ name: "first_name",
9637
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9639
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9640
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
+ ] })
9642
+ }
9643
+ ),
9644
+ /* @__PURE__ */ jsxRuntime.jsx(
9645
+ Form$2.Field,
9646
+ {
9647
+ control: form.control,
9648
+ name: "last_name",
9649
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9650
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9651
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9652
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9653
+ ] })
9654
+ }
9655
+ )
9656
+ ] }),
9657
+ /* @__PURE__ */ jsxRuntime.jsx(
9658
+ Form$2.Field,
9659
+ {
9660
+ control: form.control,
9661
+ name: "company",
9662
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9664
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
+ ] })
9667
+ }
9668
+ ),
9669
+ /* @__PURE__ */ jsxRuntime.jsx(
9670
+ Form$2.Field,
9671
+ {
9672
+ control: form.control,
9673
+ name: "address_1",
9674
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9675
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9676
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9677
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9678
+ ] })
9679
+ }
9680
+ ),
9681
+ /* @__PURE__ */ jsxRuntime.jsx(
9682
+ Form$2.Field,
9683
+ {
9684
+ control: form.control,
9685
+ name: "address_2",
9686
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9687
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9689
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9690
+ ] })
9691
+ }
9692
+ ),
9693
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9694
+ /* @__PURE__ */ jsxRuntime.jsx(
9695
+ Form$2.Field,
9696
+ {
9697
+ control: form.control,
9698
+ name: "postal_code",
9699
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9701
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
+ ] })
9704
+ }
9705
+ ),
9706
+ /* @__PURE__ */ jsxRuntime.jsx(
9707
+ Form$2.Field,
9708
+ {
9709
+ control: form.control,
9710
+ name: "city",
9711
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9712
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9714
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9715
+ ] })
9716
+ }
9717
+ )
9718
+ ] }),
9719
+ /* @__PURE__ */ jsxRuntime.jsx(
9720
+ Form$2.Field,
9721
+ {
9722
+ control: form.control,
9723
+ name: "province",
9724
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9726
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
+ ] })
9729
+ }
9730
+ ),
9731
+ /* @__PURE__ */ jsxRuntime.jsx(
9732
+ Form$2.Field,
9733
+ {
9734
+ control: form.control,
9735
+ name: "phone",
9736
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9737
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9739
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9740
+ ] })
9741
+ }
9742
+ )
9743
+ ] }) }),
9744
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9745
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9746
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9747
+ ] }) })
9748
+ ]
9749
+ }
9750
+ ) });
9580
9751
  };
9581
- const schema$5 = objectType({
9582
- email: stringType().email()
9583
- });
9752
+ const schema$5 = addressSchema;
9584
9753
  const Email = () => {
9585
9754
  const { id } = reactRouterDom.useParams();
9586
9755
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9649,6 +9818,27 @@ const EmailForm = ({ order }) => {
9649
9818
  const schema$4 = objectType({
9650
9819
  email: stringType().email()
9651
9820
  });
9821
+ const CustomItems = () => {
9822
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9823
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9824
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9825
+ ] });
9826
+ };
9827
+ const CustomItemsForm = () => {
9828
+ const form = reactHookForm.useForm({
9829
+ resolver: zod.zodResolver(schema$3)
9830
+ });
9831
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9832
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9833
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9834
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9835
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9836
+ ] }) })
9837
+ ] }) });
9838
+ };
9839
+ const schema$3 = objectType({
9840
+ email: stringType().email()
9841
+ });
9652
9842
  const NumberInput = React.forwardRef(
9653
9843
  ({
9654
9844
  value,
@@ -10973,196 +11163,6 @@ function getHasUneditableRows(metadata) {
10973
11163
  (value) => !EDITABLE_TYPES.includes(typeof value)
10974
11164
  );
10975
11165
  }
10976
- const BillingAddress = () => {
10977
- const { id } = reactRouterDom.useParams();
10978
- const { order, isPending, isError, error } = useOrder(id, {
10979
- fields: "+billing_address"
10980
- });
10981
- if (isError) {
10982
- throw error;
10983
- }
10984
- const isReady = !isPending && !!order;
10985
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10986
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10987
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
10988
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10989
- ] }),
10990
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
10991
- ] });
10992
- };
10993
- const BillingAddressForm = ({ order }) => {
10994
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10995
- const form = reactHookForm.useForm({
10996
- defaultValues: {
10997
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10998
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10999
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
11000
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
11001
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
11002
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
11003
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
11004
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
11005
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
11006
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
11007
- },
11008
- resolver: zod.zodResolver(schema$3)
11009
- });
11010
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11011
- const { handleSuccess } = useRouteModal();
11012
- const onSubmit = form.handleSubmit(async (data) => {
11013
- await mutateAsync(
11014
- { billing_address: data },
11015
- {
11016
- onSuccess: () => {
11017
- handleSuccess();
11018
- },
11019
- onError: (error) => {
11020
- ui.toast.error(error.message);
11021
- }
11022
- }
11023
- );
11024
- });
11025
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11026
- KeyboundForm,
11027
- {
11028
- className: "flex flex-1 flex-col overflow-hidden",
11029
- onSubmit,
11030
- children: [
11031
- /* @__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: [
11032
- /* @__PURE__ */ jsxRuntime.jsx(
11033
- Form$2.Field,
11034
- {
11035
- control: form.control,
11036
- name: "country_code",
11037
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11038
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11039
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11040
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11041
- ] })
11042
- }
11043
- ),
11044
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11045
- /* @__PURE__ */ jsxRuntime.jsx(
11046
- Form$2.Field,
11047
- {
11048
- control: form.control,
11049
- name: "first_name",
11050
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11051
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11052
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11053
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11054
- ] })
11055
- }
11056
- ),
11057
- /* @__PURE__ */ jsxRuntime.jsx(
11058
- Form$2.Field,
11059
- {
11060
- control: form.control,
11061
- name: "last_name",
11062
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11063
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11064
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11065
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11066
- ] })
11067
- }
11068
- )
11069
- ] }),
11070
- /* @__PURE__ */ jsxRuntime.jsx(
11071
- Form$2.Field,
11072
- {
11073
- control: form.control,
11074
- name: "company",
11075
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11076
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11077
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11078
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11079
- ] })
11080
- }
11081
- ),
11082
- /* @__PURE__ */ jsxRuntime.jsx(
11083
- Form$2.Field,
11084
- {
11085
- control: form.control,
11086
- name: "address_1",
11087
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11088
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11089
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11090
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11091
- ] })
11092
- }
11093
- ),
11094
- /* @__PURE__ */ jsxRuntime.jsx(
11095
- Form$2.Field,
11096
- {
11097
- control: form.control,
11098
- name: "address_2",
11099
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11100
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11101
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11102
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11103
- ] })
11104
- }
11105
- ),
11106
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11107
- /* @__PURE__ */ jsxRuntime.jsx(
11108
- Form$2.Field,
11109
- {
11110
- control: form.control,
11111
- name: "postal_code",
11112
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11113
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11114
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11115
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11116
- ] })
11117
- }
11118
- ),
11119
- /* @__PURE__ */ jsxRuntime.jsx(
11120
- Form$2.Field,
11121
- {
11122
- control: form.control,
11123
- name: "city",
11124
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11125
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11126
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11127
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11128
- ] })
11129
- }
11130
- )
11131
- ] }),
11132
- /* @__PURE__ */ jsxRuntime.jsx(
11133
- Form$2.Field,
11134
- {
11135
- control: form.control,
11136
- name: "province",
11137
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11138
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11139
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11140
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11141
- ] })
11142
- }
11143
- ),
11144
- /* @__PURE__ */ jsxRuntime.jsx(
11145
- Form$2.Field,
11146
- {
11147
- control: form.control,
11148
- name: "phone",
11149
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11150
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11151
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11152
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11153
- ] })
11154
- }
11155
- )
11156
- ] }) }),
11157
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11158
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11159
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11160
- ] }) })
11161
- ]
11162
- }
11163
- ) });
11164
- };
11165
- const schema$3 = addressSchema;
11166
11166
  const PROMOTION_QUERY_KEY = "promotions";
11167
11167
  const promotionsQueryKeys = {
11168
11168
  list: (query2) => [
@@ -13053,13 +13053,17 @@ const routeModule = {
13053
13053
  loader,
13054
13054
  children: [
13055
13055
  {
13056
- Component: CustomItems,
13057
- path: "/draft-orders/:id/custom-items"
13056
+ Component: BillingAddress,
13057
+ path: "/draft-orders/:id/billing-address"
13058
13058
  },
13059
13059
  {
13060
13060
  Component: Email,
13061
13061
  path: "/draft-orders/:id/email"
13062
13062
  },
13063
+ {
13064
+ Component: CustomItems,
13065
+ path: "/draft-orders/:id/custom-items"
13066
+ },
13063
13067
  {
13064
13068
  Component: Items,
13065
13069
  path: "/draft-orders/:id/items"
@@ -13068,10 +13072,6 @@ const routeModule = {
13068
13072
  Component: Metadata,
13069
13073
  path: "/draft-orders/:id/metadata"
13070
13074
  },
13071
- {
13072
- Component: BillingAddress,
13073
- path: "/draft-orders/:id/billing-address"
13074
- },
13075
13075
  {
13076
13076
  Component: Promotions,
13077
13077
  path: "/draft-orders/:id/promotions"
@@ -9554,27 +9554,196 @@ const ID = () => {
9554
9554
  /* @__PURE__ */ jsx(Outlet, {})
9555
9555
  ] });
9556
9556
  };
9557
- const CustomItems = () => {
9557
+ const BillingAddress = () => {
9558
+ const { id } = useParams();
9559
+ const { order, isPending, isError, error } = useOrder(id, {
9560
+ fields: "+billing_address"
9561
+ });
9562
+ if (isError) {
9563
+ throw error;
9564
+ }
9565
+ const isReady = !isPending && !!order;
9558
9566
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9559
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9560
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9567
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9568
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9569
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9570
+ ] }),
9571
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9561
9572
  ] });
9562
9573
  };
9563
- const CustomItemsForm = () => {
9574
+ const BillingAddressForm = ({ order }) => {
9575
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9564
9576
  const form = useForm({
9577
+ defaultValues: {
9578
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9579
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9580
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9581
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9582
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9583
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9584
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9585
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9586
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9587
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9588
+ },
9565
9589
  resolver: zodResolver(schema$5)
9566
9590
  });
9567
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9568
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9569
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9570
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9571
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9572
- ] }) })
9573
- ] }) });
9591
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9592
+ const { handleSuccess } = useRouteModal();
9593
+ const onSubmit = form.handleSubmit(async (data) => {
9594
+ await mutateAsync(
9595
+ { billing_address: data },
9596
+ {
9597
+ onSuccess: () => {
9598
+ handleSuccess();
9599
+ },
9600
+ onError: (error) => {
9601
+ toast.error(error.message);
9602
+ }
9603
+ }
9604
+ );
9605
+ });
9606
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9607
+ KeyboundForm,
9608
+ {
9609
+ className: "flex flex-1 flex-col overflow-hidden",
9610
+ onSubmit,
9611
+ children: [
9612
+ /* @__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: [
9613
+ /* @__PURE__ */ jsx(
9614
+ Form$2.Field,
9615
+ {
9616
+ control: form.control,
9617
+ name: "country_code",
9618
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9619
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9620
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9621
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9622
+ ] })
9623
+ }
9624
+ ),
9625
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9626
+ /* @__PURE__ */ jsx(
9627
+ Form$2.Field,
9628
+ {
9629
+ control: form.control,
9630
+ name: "first_name",
9631
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9633
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9634
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
+ ] })
9636
+ }
9637
+ ),
9638
+ /* @__PURE__ */ jsx(
9639
+ Form$2.Field,
9640
+ {
9641
+ control: form.control,
9642
+ name: "last_name",
9643
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9644
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9645
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9646
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9647
+ ] })
9648
+ }
9649
+ )
9650
+ ] }),
9651
+ /* @__PURE__ */ jsx(
9652
+ Form$2.Field,
9653
+ {
9654
+ control: form.control,
9655
+ name: "company",
9656
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9658
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
+ ] })
9661
+ }
9662
+ ),
9663
+ /* @__PURE__ */ jsx(
9664
+ Form$2.Field,
9665
+ {
9666
+ control: form.control,
9667
+ name: "address_1",
9668
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9669
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9670
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9671
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9672
+ ] })
9673
+ }
9674
+ ),
9675
+ /* @__PURE__ */ jsx(
9676
+ Form$2.Field,
9677
+ {
9678
+ control: form.control,
9679
+ name: "address_2",
9680
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9681
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9682
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9683
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9684
+ ] })
9685
+ }
9686
+ ),
9687
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9688
+ /* @__PURE__ */ jsx(
9689
+ Form$2.Field,
9690
+ {
9691
+ control: form.control,
9692
+ name: "postal_code",
9693
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9695
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
+ ] })
9698
+ }
9699
+ ),
9700
+ /* @__PURE__ */ jsx(
9701
+ Form$2.Field,
9702
+ {
9703
+ control: form.control,
9704
+ name: "city",
9705
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9706
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9707
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9708
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9709
+ ] })
9710
+ }
9711
+ )
9712
+ ] }),
9713
+ /* @__PURE__ */ jsx(
9714
+ Form$2.Field,
9715
+ {
9716
+ control: form.control,
9717
+ name: "province",
9718
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9720
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
+ ] })
9723
+ }
9724
+ ),
9725
+ /* @__PURE__ */ jsx(
9726
+ Form$2.Field,
9727
+ {
9728
+ control: form.control,
9729
+ name: "phone",
9730
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9731
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9732
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9733
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9734
+ ] })
9735
+ }
9736
+ )
9737
+ ] }) }),
9738
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9739
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9740
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9741
+ ] }) })
9742
+ ]
9743
+ }
9744
+ ) });
9574
9745
  };
9575
- const schema$5 = objectType({
9576
- email: stringType().email()
9577
- });
9746
+ const schema$5 = addressSchema;
9578
9747
  const Email = () => {
9579
9748
  const { id } = useParams();
9580
9749
  const { order, isPending, isError, error } = useOrder(id, {
@@ -9643,6 +9812,27 @@ const EmailForm = ({ order }) => {
9643
9812
  const schema$4 = objectType({
9644
9813
  email: stringType().email()
9645
9814
  });
9815
+ const CustomItems = () => {
9816
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9817
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9818
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9819
+ ] });
9820
+ };
9821
+ const CustomItemsForm = () => {
9822
+ const form = useForm({
9823
+ resolver: zodResolver(schema$3)
9824
+ });
9825
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9826
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9827
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9828
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9829
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9830
+ ] }) })
9831
+ ] }) });
9832
+ };
9833
+ const schema$3 = objectType({
9834
+ email: stringType().email()
9835
+ });
9646
9836
  const NumberInput = forwardRef(
9647
9837
  ({
9648
9838
  value,
@@ -10967,196 +11157,6 @@ function getHasUneditableRows(metadata) {
10967
11157
  (value) => !EDITABLE_TYPES.includes(typeof value)
10968
11158
  );
10969
11159
  }
10970
- const BillingAddress = () => {
10971
- const { id } = useParams();
10972
- const { order, isPending, isError, error } = useOrder(id, {
10973
- fields: "+billing_address"
10974
- });
10975
- if (isError) {
10976
- throw error;
10977
- }
10978
- const isReady = !isPending && !!order;
10979
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10980
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10981
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
10982
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10983
- ] }),
10984
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
10985
- ] });
10986
- };
10987
- const BillingAddressForm = ({ order }) => {
10988
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10989
- const form = useForm({
10990
- defaultValues: {
10991
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10992
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10993
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10994
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10995
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10996
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10997
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10998
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10999
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
11000
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
11001
- },
11002
- resolver: zodResolver(schema$3)
11003
- });
11004
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11005
- const { handleSuccess } = useRouteModal();
11006
- const onSubmit = form.handleSubmit(async (data) => {
11007
- await mutateAsync(
11008
- { billing_address: data },
11009
- {
11010
- onSuccess: () => {
11011
- handleSuccess();
11012
- },
11013
- onError: (error) => {
11014
- toast.error(error.message);
11015
- }
11016
- }
11017
- );
11018
- });
11019
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11020
- KeyboundForm,
11021
- {
11022
- className: "flex flex-1 flex-col overflow-hidden",
11023
- onSubmit,
11024
- children: [
11025
- /* @__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: [
11026
- /* @__PURE__ */ jsx(
11027
- Form$2.Field,
11028
- {
11029
- control: form.control,
11030
- name: "country_code",
11031
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11032
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11033
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11034
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11035
- ] })
11036
- }
11037
- ),
11038
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11039
- /* @__PURE__ */ jsx(
11040
- Form$2.Field,
11041
- {
11042
- control: form.control,
11043
- name: "first_name",
11044
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11045
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11046
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11047
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11048
- ] })
11049
- }
11050
- ),
11051
- /* @__PURE__ */ jsx(
11052
- Form$2.Field,
11053
- {
11054
- control: form.control,
11055
- name: "last_name",
11056
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11057
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11058
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11059
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11060
- ] })
11061
- }
11062
- )
11063
- ] }),
11064
- /* @__PURE__ */ jsx(
11065
- Form$2.Field,
11066
- {
11067
- control: form.control,
11068
- name: "company",
11069
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11070
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11071
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11072
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11073
- ] })
11074
- }
11075
- ),
11076
- /* @__PURE__ */ jsx(
11077
- Form$2.Field,
11078
- {
11079
- control: form.control,
11080
- name: "address_1",
11081
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11082
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11083
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11084
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11085
- ] })
11086
- }
11087
- ),
11088
- /* @__PURE__ */ jsx(
11089
- Form$2.Field,
11090
- {
11091
- control: form.control,
11092
- name: "address_2",
11093
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11094
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11095
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11096
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11097
- ] })
11098
- }
11099
- ),
11100
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11101
- /* @__PURE__ */ jsx(
11102
- Form$2.Field,
11103
- {
11104
- control: form.control,
11105
- name: "postal_code",
11106
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11107
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11108
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11109
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11110
- ] })
11111
- }
11112
- ),
11113
- /* @__PURE__ */ jsx(
11114
- Form$2.Field,
11115
- {
11116
- control: form.control,
11117
- name: "city",
11118
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11119
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11120
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11121
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11122
- ] })
11123
- }
11124
- )
11125
- ] }),
11126
- /* @__PURE__ */ jsx(
11127
- Form$2.Field,
11128
- {
11129
- control: form.control,
11130
- name: "province",
11131
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11132
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11133
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11134
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11135
- ] })
11136
- }
11137
- ),
11138
- /* @__PURE__ */ jsx(
11139
- Form$2.Field,
11140
- {
11141
- control: form.control,
11142
- name: "phone",
11143
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11144
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11145
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11146
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11147
- ] })
11148
- }
11149
- )
11150
- ] }) }),
11151
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11152
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11153
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11154
- ] }) })
11155
- ]
11156
- }
11157
- ) });
11158
- };
11159
- const schema$3 = addressSchema;
11160
11160
  const PROMOTION_QUERY_KEY = "promotions";
11161
11161
  const promotionsQueryKeys = {
11162
11162
  list: (query2) => [
@@ -13047,13 +13047,17 @@ const routeModule = {
13047
13047
  loader,
13048
13048
  children: [
13049
13049
  {
13050
- Component: CustomItems,
13051
- path: "/draft-orders/:id/custom-items"
13050
+ Component: BillingAddress,
13051
+ path: "/draft-orders/:id/billing-address"
13052
13052
  },
13053
13053
  {
13054
13054
  Component: Email,
13055
13055
  path: "/draft-orders/:id/email"
13056
13056
  },
13057
+ {
13058
+ Component: CustomItems,
13059
+ path: "/draft-orders/:id/custom-items"
13060
+ },
13057
13061
  {
13058
13062
  Component: Items,
13059
13063
  path: "/draft-orders/:id/items"
@@ -13062,10 +13066,6 @@ const routeModule = {
13062
13066
  Component: Metadata,
13063
13067
  path: "/draft-orders/:id/metadata"
13064
13068
  },
13065
- {
13066
- Component: BillingAddress,
13067
- path: "/draft-orders/:id/billing-address"
13068
- },
13069
13069
  {
13070
13070
  Component: Promotions,
13071
13071
  path: "/draft-orders/:id/promotions"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.0-preview-20250827210153",
3
+ "version": "2.10.0-preview-20250828000308",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@hookform/resolvers": "3.4.2",
39
- "@medusajs/js-sdk": "2.10.0-preview-20250827210153",
39
+ "@medusajs/js-sdk": "2.10.0-preview-20250828000308",
40
40
  "@tanstack/react-query": "5.64.2",
41
41
  "@uiw/react-json-view": "^2.0.0-alpha.17",
42
42
  "date-fns": "^3.6.0",
@@ -45,15 +45,15 @@
45
45
  "react-hook-form": "7.49.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.0-preview-20250827210153",
49
- "@medusajs/cli": "2.10.0-preview-20250827210153",
50
- "@medusajs/framework": "2.10.0-preview-20250827210153",
51
- "@medusajs/icons": "2.10.0-preview-20250827210153",
52
- "@medusajs/medusa": "2.10.0-preview-20250827210153",
53
- "@medusajs/test-utils": "2.10.0-preview-20250827210153",
54
- "@medusajs/types": "2.10.0-preview-20250827210153",
55
- "@medusajs/ui": "4.0.20-preview-20250827210153",
56
- "@medusajs/ui-preset": "2.10.0-preview-20250827210153",
48
+ "@medusajs/admin-sdk": "2.10.0-preview-20250828000308",
49
+ "@medusajs/cli": "2.10.0-preview-20250828000308",
50
+ "@medusajs/framework": "2.10.0-preview-20250828000308",
51
+ "@medusajs/icons": "2.10.0-preview-20250828000308",
52
+ "@medusajs/medusa": "2.10.0-preview-20250828000308",
53
+ "@medusajs/test-utils": "2.10.0-preview-20250828000308",
54
+ "@medusajs/types": "2.10.0-preview-20250828000308",
55
+ "@medusajs/ui": "4.0.20-preview-20250828000308",
56
+ "@medusajs/ui-preset": "2.10.0-preview-20250828000308",
57
57
  "@mikro-orm/cli": "6.4.3",
58
58
  "@mikro-orm/core": "6.4.3",
59
59
  "@mikro-orm/knex": "6.4.3",
@@ -77,13 +77,13 @@
77
77
  "yalc": "^1.0.0-pre.53"
78
78
  },
79
79
  "peerDependencies": {
80
- "@medusajs/admin-sdk": "2.10.0-preview-20250827210153",
81
- "@medusajs/cli": "2.10.0-preview-20250827210153",
82
- "@medusajs/framework": "2.10.0-preview-20250827210153",
83
- "@medusajs/icons": "2.10.0-preview-20250827210153",
84
- "@medusajs/medusa": "2.10.0-preview-20250827210153",
85
- "@medusajs/test-utils": "2.10.0-preview-20250827210153",
86
- "@medusajs/ui": "4.0.20-preview-20250827210153",
80
+ "@medusajs/admin-sdk": "2.10.0-preview-20250828000308",
81
+ "@medusajs/cli": "2.10.0-preview-20250828000308",
82
+ "@medusajs/framework": "2.10.0-preview-20250828000308",
83
+ "@medusajs/icons": "2.10.0-preview-20250828000308",
84
+ "@medusajs/medusa": "2.10.0-preview-20250828000308",
85
+ "@medusajs/test-utils": "2.10.0-preview-20250828000308",
86
+ "@medusajs/ui": "4.0.20-preview-20250828000308",
87
87
  "@mikro-orm/cli": "6.4.3",
88
88
  "@mikro-orm/core": "6.4.3",
89
89
  "@mikro-orm/knex": "6.4.3",