@medusajs/draft-order 2.10.4-snapshot-20251009122659 → 2.10.4-snapshot-20251013091555

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.
@@ -9573,196 +9573,27 @@ const ID = () => {
9573
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9574
9574
  ] });
9575
9575
  };
9576
- const BillingAddress = () => {
9577
- const { id } = reactRouterDom.useParams();
9578
- const { order, isPending, isError, error } = useOrder(id, {
9579
- fields: "+billing_address"
9580
- });
9581
- if (isError) {
9582
- throw error;
9583
- }
9584
- const isReady = !isPending && !!order;
9576
+ const CustomItems = () => {
9585
9577
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9587
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9588
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9589
- ] }),
9590
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9578
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9579
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9591
9580
  ] });
9592
9581
  };
9593
- const BillingAddressForm = ({ order }) => {
9594
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9582
+ const CustomItemsForm = () => {
9595
9583
  const form = reactHookForm.useForm({
9596
- defaultValues: {
9597
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9598
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9599
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9600
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9601
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9602
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9603
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9604
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9605
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9606
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9607
- },
9608
9584
  resolver: zod.zodResolver(schema$5)
9609
9585
  });
9610
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9611
- const { handleSuccess } = useRouteModal();
9612
- const onSubmit = form.handleSubmit(async (data) => {
9613
- await mutateAsync(
9614
- { billing_address: data },
9615
- {
9616
- onSuccess: () => {
9617
- handleSuccess();
9618
- },
9619
- onError: (error) => {
9620
- ui.toast.error(error.message);
9621
- }
9622
- }
9623
- );
9624
- });
9625
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9626
- KeyboundForm,
9627
- {
9628
- className: "flex flex-1 flex-col overflow-hidden",
9629
- onSubmit,
9630
- children: [
9631
- /* @__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: [
9632
- /* @__PURE__ */ jsxRuntime.jsx(
9633
- Form$2.Field,
9634
- {
9635
- control: form.control,
9636
- name: "country_code",
9637
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9640
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
- ] })
9642
- }
9643
- ),
9644
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9645
- /* @__PURE__ */ jsxRuntime.jsx(
9646
- Form$2.Field,
9647
- {
9648
- control: form.control,
9649
- name: "first_name",
9650
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9651
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9652
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9653
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9654
- ] })
9655
- }
9656
- ),
9657
- /* @__PURE__ */ jsxRuntime.jsx(
9658
- Form$2.Field,
9659
- {
9660
- control: form.control,
9661
- name: "last_name",
9662
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
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
- ] }),
9670
- /* @__PURE__ */ jsxRuntime.jsx(
9671
- Form$2.Field,
9672
- {
9673
- control: form.control,
9674
- name: "company",
9675
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9676
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9677
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9678
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9679
- ] })
9680
- }
9681
- ),
9682
- /* @__PURE__ */ jsxRuntime.jsx(
9683
- Form$2.Field,
9684
- {
9685
- control: form.control,
9686
- name: "address_1",
9687
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9688
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9689
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9690
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9691
- ] })
9692
- }
9693
- ),
9694
- /* @__PURE__ */ jsxRuntime.jsx(
9695
- Form$2.Field,
9696
- {
9697
- control: form.control,
9698
- name: "address_2",
9699
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
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.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9707
- /* @__PURE__ */ jsxRuntime.jsx(
9708
- Form$2.Field,
9709
- {
9710
- control: form.control,
9711
- name: "postal_code",
9712
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9713
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9715
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9716
- ] })
9717
- }
9718
- ),
9719
- /* @__PURE__ */ jsxRuntime.jsx(
9720
- Form$2.Field,
9721
- {
9722
- control: form.control,
9723
- name: "city",
9724
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
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
- ] }),
9732
- /* @__PURE__ */ jsxRuntime.jsx(
9733
- Form$2.Field,
9734
- {
9735
- control: form.control,
9736
- name: "province",
9737
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9738
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9740
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9741
- ] })
9742
- }
9743
- ),
9744
- /* @__PURE__ */ jsxRuntime.jsx(
9745
- Form$2.Field,
9746
- {
9747
- control: form.control,
9748
- name: "phone",
9749
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9750
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9752
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9753
- ] })
9754
- }
9755
- )
9756
- ] }) }),
9757
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9758
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9759
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9760
- ] }) })
9761
- ]
9762
- }
9763
- ) });
9586
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9588
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9589
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9590
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9591
+ ] }) })
9592
+ ] }) });
9764
9593
  };
9765
- const schema$5 = addressSchema;
9594
+ const schema$5 = objectType({
9595
+ email: stringType().email()
9596
+ });
9766
9597
  const Email = () => {
9767
9598
  const { id } = reactRouterDom.useParams();
9768
9599
  const { order, isPending, isError, error } = useOrder(id, {
@@ -11155,6 +10986,196 @@ function getHasUneditableRows(metadata) {
11155
10986
  (value) => !EDITABLE_TYPES.includes(typeof value)
11156
10987
  );
11157
10988
  }
10989
+ const BillingAddress = () => {
10990
+ const { id } = reactRouterDom.useParams();
10991
+ const { order, isPending, isError, error } = useOrder(id, {
10992
+ fields: "+billing_address"
10993
+ });
10994
+ if (isError) {
10995
+ throw error;
10996
+ }
10997
+ const isReady = !isPending && !!order;
10998
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10999
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11000
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
11001
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
11002
+ ] }),
11003
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
11004
+ ] });
11005
+ };
11006
+ const BillingAddressForm = ({ order }) => {
11007
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11008
+ const form = reactHookForm.useForm({
11009
+ defaultValues: {
11010
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
11011
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
11012
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
11013
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
11014
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
11015
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
11016
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
11017
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
11018
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
11019
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
11020
+ },
11021
+ resolver: zod.zodResolver(schema$3)
11022
+ });
11023
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11024
+ const { handleSuccess } = useRouteModal();
11025
+ const onSubmit = form.handleSubmit(async (data) => {
11026
+ await mutateAsync(
11027
+ { billing_address: data },
11028
+ {
11029
+ onSuccess: () => {
11030
+ handleSuccess();
11031
+ },
11032
+ onError: (error) => {
11033
+ ui.toast.error(error.message);
11034
+ }
11035
+ }
11036
+ );
11037
+ });
11038
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11039
+ KeyboundForm,
11040
+ {
11041
+ className: "flex flex-1 flex-col overflow-hidden",
11042
+ onSubmit,
11043
+ children: [
11044
+ /* @__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: [
11045
+ /* @__PURE__ */ jsxRuntime.jsx(
11046
+ Form$2.Field,
11047
+ {
11048
+ control: form.control,
11049
+ name: "country_code",
11050
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11051
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11052
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11053
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11054
+ ] })
11055
+ }
11056
+ ),
11057
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11058
+ /* @__PURE__ */ jsxRuntime.jsx(
11059
+ Form$2.Field,
11060
+ {
11061
+ control: form.control,
11062
+ name: "first_name",
11063
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11064
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11065
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11066
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11067
+ ] })
11068
+ }
11069
+ ),
11070
+ /* @__PURE__ */ jsxRuntime.jsx(
11071
+ Form$2.Field,
11072
+ {
11073
+ control: form.control,
11074
+ name: "last_name",
11075
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11076
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
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
+ ] }),
11083
+ /* @__PURE__ */ jsxRuntime.jsx(
11084
+ Form$2.Field,
11085
+ {
11086
+ control: form.control,
11087
+ name: "company",
11088
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11089
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11090
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11091
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11092
+ ] })
11093
+ }
11094
+ ),
11095
+ /* @__PURE__ */ jsxRuntime.jsx(
11096
+ Form$2.Field,
11097
+ {
11098
+ control: form.control,
11099
+ name: "address_1",
11100
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11101
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11102
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11103
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11104
+ ] })
11105
+ }
11106
+ ),
11107
+ /* @__PURE__ */ jsxRuntime.jsx(
11108
+ Form$2.Field,
11109
+ {
11110
+ control: form.control,
11111
+ name: "address_2",
11112
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11113
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
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.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11120
+ /* @__PURE__ */ jsxRuntime.jsx(
11121
+ Form$2.Field,
11122
+ {
11123
+ control: form.control,
11124
+ name: "postal_code",
11125
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11126
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11127
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11128
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11129
+ ] })
11130
+ }
11131
+ ),
11132
+ /* @__PURE__ */ jsxRuntime.jsx(
11133
+ Form$2.Field,
11134
+ {
11135
+ control: form.control,
11136
+ name: "city",
11137
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11138
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
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
+ ] }),
11145
+ /* @__PURE__ */ jsxRuntime.jsx(
11146
+ Form$2.Field,
11147
+ {
11148
+ control: form.control,
11149
+ name: "province",
11150
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11151
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11152
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11153
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11154
+ ] })
11155
+ }
11156
+ ),
11157
+ /* @__PURE__ */ jsxRuntime.jsx(
11158
+ Form$2.Field,
11159
+ {
11160
+ control: form.control,
11161
+ name: "phone",
11162
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11163
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11164
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11165
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11166
+ ] })
11167
+ }
11168
+ )
11169
+ ] }) }),
11170
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11171
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11172
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11173
+ ] }) })
11174
+ ]
11175
+ }
11176
+ ) });
11177
+ };
11178
+ const schema$3 = addressSchema;
11158
11179
  const PROMOTION_QUERY_KEY = "promotions";
11159
11180
  const promotionsQueryKeys = {
11160
11181
  list: (query2) => [
@@ -11460,7 +11481,7 @@ const SalesChannelForm = ({ order }) => {
11460
11481
  defaultValues: {
11461
11482
  sales_channel_id: order.sales_channel_id || ""
11462
11483
  },
11463
- resolver: zod.zodResolver(schema$3)
11484
+ resolver: zod.zodResolver(schema$2)
11464
11485
  });
11465
11486
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11466
11487
  const { handleSuccess } = useRouteModal();
@@ -11535,7 +11556,7 @@ const SalesChannelField = ({ control, order }) => {
11535
11556
  }
11536
11557
  );
11537
11558
  };
11538
- const schema$3 = objectType({
11559
+ const schema$2 = objectType({
11539
11560
  sales_channel_id: stringType().min(1)
11540
11561
  });
11541
11562
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12377,7 +12398,7 @@ const ShippingAddressForm = ({ order }) => {
12377
12398
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12378
12399
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12379
12400
  },
12380
- resolver: zod.zodResolver(schema$2)
12401
+ resolver: zod.zodResolver(schema$1)
12381
12402
  });
12382
12403
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12383
12404
  const { handleSuccess } = useRouteModal();
@@ -12547,7 +12568,7 @@ const ShippingAddressForm = ({ order }) => {
12547
12568
  }
12548
12569
  ) });
12549
12570
  };
12550
- const schema$2 = addressSchema;
12571
+ const schema$1 = addressSchema;
12551
12572
  const TransferOwnership = () => {
12552
12573
  const { id } = reactRouterDom.useParams();
12553
12574
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12571,7 +12592,7 @@ const TransferOwnershipForm = ({ order }) => {
12571
12592
  defaultValues: {
12572
12593
  customer_id: order.customer_id || ""
12573
12594
  },
12574
- resolver: zod.zodResolver(schema$1)
12595
+ resolver: zod.zodResolver(schema)
12575
12596
  });
12576
12597
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12577
12598
  const { handleSuccess } = useRouteModal();
@@ -13021,29 +13042,8 @@ const Illustration = () => {
13021
13042
  }
13022
13043
  );
13023
13044
  };
13024
- const schema$1 = objectType({
13025
- customer_id: stringType().min(1)
13026
- });
13027
- const CustomItems = () => {
13028
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
13029
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
13030
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
13031
- ] });
13032
- };
13033
- const CustomItemsForm = () => {
13034
- const form = reactHookForm.useForm({
13035
- resolver: zod.zodResolver(schema)
13036
- });
13037
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13040
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13041
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
13042
- ] }) })
13043
- ] }) });
13044
- };
13045
13045
  const schema = objectType({
13046
- email: stringType().email()
13046
+ customer_id: stringType().min(1)
13047
13047
  });
13048
13048
  const widgetModule = { widgets: [] };
13049
13049
  const routeModule = {
@@ -13066,8 +13066,8 @@ const routeModule = {
13066
13066
  loader,
13067
13067
  children: [
13068
13068
  {
13069
- Component: BillingAddress,
13070
- path: "/draft-orders/:id/billing-address"
13069
+ Component: CustomItems,
13070
+ path: "/draft-orders/:id/custom-items"
13071
13071
  },
13072
13072
  {
13073
13073
  Component: Email,
@@ -13081,6 +13081,10 @@ const routeModule = {
13081
13081
  Component: Metadata,
13082
13082
  path: "/draft-orders/:id/metadata"
13083
13083
  },
13084
+ {
13085
+ Component: BillingAddress,
13086
+ path: "/draft-orders/:id/billing-address"
13087
+ },
13084
13088
  {
13085
13089
  Component: Promotions,
13086
13090
  path: "/draft-orders/:id/promotions"
@@ -13100,10 +13104,6 @@ const routeModule = {
13100
13104
  {
13101
13105
  Component: TransferOwnership,
13102
13106
  path: "/draft-orders/:id/transfer-ownership"
13103
- },
13104
- {
13105
- Component: CustomItems,
13106
- path: "/draft-orders/:id/custom-items"
13107
13107
  }
13108
13108
  ]
13109
13109
  }
@@ -9567,196 +9567,27 @@ const ID = () => {
9567
9567
  /* @__PURE__ */ jsx(Outlet, {})
9568
9568
  ] });
9569
9569
  };
9570
- const BillingAddress = () => {
9571
- const { id } = useParams();
9572
- const { order, isPending, isError, error } = useOrder(id, {
9573
- fields: "+billing_address"
9574
- });
9575
- if (isError) {
9576
- throw error;
9577
- }
9578
- const isReady = !isPending && !!order;
9570
+ const CustomItems = () => {
9579
9571
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9580
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9581
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9582
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9583
- ] }),
9584
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9572
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9573
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9585
9574
  ] });
9586
9575
  };
9587
- const BillingAddressForm = ({ order }) => {
9588
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9576
+ const CustomItemsForm = () => {
9589
9577
  const form = useForm({
9590
- defaultValues: {
9591
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9592
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9593
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9594
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9595
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9596
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9597
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9598
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9599
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9600
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9601
- },
9602
9578
  resolver: zodResolver(schema$5)
9603
9579
  });
9604
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9605
- const { handleSuccess } = useRouteModal();
9606
- const onSubmit = form.handleSubmit(async (data) => {
9607
- await mutateAsync(
9608
- { billing_address: data },
9609
- {
9610
- onSuccess: () => {
9611
- handleSuccess();
9612
- },
9613
- onError: (error) => {
9614
- toast.error(error.message);
9615
- }
9616
- }
9617
- );
9618
- });
9619
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9620
- KeyboundForm,
9621
- {
9622
- className: "flex flex-1 flex-col overflow-hidden",
9623
- onSubmit,
9624
- children: [
9625
- /* @__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: [
9626
- /* @__PURE__ */ jsx(
9627
- Form$2.Field,
9628
- {
9629
- control: form.control,
9630
- name: "country_code",
9631
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9633
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9634
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
- ] })
9636
- }
9637
- ),
9638
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9639
- /* @__PURE__ */ jsx(
9640
- Form$2.Field,
9641
- {
9642
- control: form.control,
9643
- name: "first_name",
9644
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9645
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9646
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9647
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9648
- ] })
9649
- }
9650
- ),
9651
- /* @__PURE__ */ jsx(
9652
- Form$2.Field,
9653
- {
9654
- control: form.control,
9655
- name: "last_name",
9656
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9658
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
- ] })
9661
- }
9662
- )
9663
- ] }),
9664
- /* @__PURE__ */ jsx(
9665
- Form$2.Field,
9666
- {
9667
- control: form.control,
9668
- name: "company",
9669
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9670
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9671
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9672
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9673
- ] })
9674
- }
9675
- ),
9676
- /* @__PURE__ */ jsx(
9677
- Form$2.Field,
9678
- {
9679
- control: form.control,
9680
- name: "address_1",
9681
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9682
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9683
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9684
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9685
- ] })
9686
- }
9687
- ),
9688
- /* @__PURE__ */ jsx(
9689
- Form$2.Field,
9690
- {
9691
- control: form.control,
9692
- name: "address_2",
9693
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9695
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
- ] })
9698
- }
9699
- ),
9700
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9701
- /* @__PURE__ */ jsx(
9702
- Form$2.Field,
9703
- {
9704
- control: form.control,
9705
- name: "postal_code",
9706
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9707
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9708
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9709
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9710
- ] })
9711
- }
9712
- ),
9713
- /* @__PURE__ */ jsx(
9714
- Form$2.Field,
9715
- {
9716
- control: form.control,
9717
- name: "city",
9718
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9720
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
- ] })
9723
- }
9724
- )
9725
- ] }),
9726
- /* @__PURE__ */ jsx(
9727
- Form$2.Field,
9728
- {
9729
- control: form.control,
9730
- name: "province",
9731
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9732
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9733
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9734
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9735
- ] })
9736
- }
9737
- ),
9738
- /* @__PURE__ */ jsx(
9739
- Form$2.Field,
9740
- {
9741
- control: form.control,
9742
- name: "phone",
9743
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9744
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9745
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9746
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9747
- ] })
9748
- }
9749
- )
9750
- ] }) }),
9751
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9752
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9753
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9754
- ] }) })
9755
- ]
9756
- }
9757
- ) });
9580
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9581
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9582
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9583
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9584
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9585
+ ] }) })
9586
+ ] }) });
9758
9587
  };
9759
- const schema$5 = addressSchema;
9588
+ const schema$5 = objectType({
9589
+ email: stringType().email()
9590
+ });
9760
9591
  const Email = () => {
9761
9592
  const { id } = useParams();
9762
9593
  const { order, isPending, isError, error } = useOrder(id, {
@@ -11149,6 +10980,196 @@ function getHasUneditableRows(metadata) {
11149
10980
  (value) => !EDITABLE_TYPES.includes(typeof value)
11150
10981
  );
11151
10982
  }
10983
+ const BillingAddress = () => {
10984
+ const { id } = useParams();
10985
+ const { order, isPending, isError, error } = useOrder(id, {
10986
+ fields: "+billing_address"
10987
+ });
10988
+ if (isError) {
10989
+ throw error;
10990
+ }
10991
+ const isReady = !isPending && !!order;
10992
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10993
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10994
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
10995
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10996
+ ] }),
10997
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
10998
+ ] });
10999
+ };
11000
+ const BillingAddressForm = ({ order }) => {
11001
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11002
+ const form = useForm({
11003
+ defaultValues: {
11004
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
11005
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
11006
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
11007
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
11008
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
11009
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
11010
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
11011
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
11012
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
11013
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
11014
+ },
11015
+ resolver: zodResolver(schema$3)
11016
+ });
11017
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11018
+ const { handleSuccess } = useRouteModal();
11019
+ const onSubmit = form.handleSubmit(async (data) => {
11020
+ await mutateAsync(
11021
+ { billing_address: data },
11022
+ {
11023
+ onSuccess: () => {
11024
+ handleSuccess();
11025
+ },
11026
+ onError: (error) => {
11027
+ toast.error(error.message);
11028
+ }
11029
+ }
11030
+ );
11031
+ });
11032
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11033
+ KeyboundForm,
11034
+ {
11035
+ className: "flex flex-1 flex-col overflow-hidden",
11036
+ onSubmit,
11037
+ children: [
11038
+ /* @__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: [
11039
+ /* @__PURE__ */ jsx(
11040
+ Form$2.Field,
11041
+ {
11042
+ control: form.control,
11043
+ name: "country_code",
11044
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11045
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11046
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11047
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11048
+ ] })
11049
+ }
11050
+ ),
11051
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11052
+ /* @__PURE__ */ jsx(
11053
+ Form$2.Field,
11054
+ {
11055
+ control: form.control,
11056
+ name: "first_name",
11057
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11058
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11059
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11060
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11061
+ ] })
11062
+ }
11063
+ ),
11064
+ /* @__PURE__ */ jsx(
11065
+ Form$2.Field,
11066
+ {
11067
+ control: form.control,
11068
+ name: "last_name",
11069
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11070
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11071
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11072
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11073
+ ] })
11074
+ }
11075
+ )
11076
+ ] }),
11077
+ /* @__PURE__ */ jsx(
11078
+ Form$2.Field,
11079
+ {
11080
+ control: form.control,
11081
+ name: "company",
11082
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11083
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11084
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11085
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11086
+ ] })
11087
+ }
11088
+ ),
11089
+ /* @__PURE__ */ jsx(
11090
+ Form$2.Field,
11091
+ {
11092
+ control: form.control,
11093
+ name: "address_1",
11094
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11095
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11096
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11097
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11098
+ ] })
11099
+ }
11100
+ ),
11101
+ /* @__PURE__ */ jsx(
11102
+ Form$2.Field,
11103
+ {
11104
+ control: form.control,
11105
+ name: "address_2",
11106
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11107
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11108
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11109
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11110
+ ] })
11111
+ }
11112
+ ),
11113
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11114
+ /* @__PURE__ */ jsx(
11115
+ Form$2.Field,
11116
+ {
11117
+ control: form.control,
11118
+ name: "postal_code",
11119
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11120
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11121
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11122
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11123
+ ] })
11124
+ }
11125
+ ),
11126
+ /* @__PURE__ */ jsx(
11127
+ Form$2.Field,
11128
+ {
11129
+ control: form.control,
11130
+ name: "city",
11131
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11132
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11133
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11134
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11135
+ ] })
11136
+ }
11137
+ )
11138
+ ] }),
11139
+ /* @__PURE__ */ jsx(
11140
+ Form$2.Field,
11141
+ {
11142
+ control: form.control,
11143
+ name: "province",
11144
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11145
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11146
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11147
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11148
+ ] })
11149
+ }
11150
+ ),
11151
+ /* @__PURE__ */ jsx(
11152
+ Form$2.Field,
11153
+ {
11154
+ control: form.control,
11155
+ name: "phone",
11156
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11157
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11158
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11159
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11160
+ ] })
11161
+ }
11162
+ )
11163
+ ] }) }),
11164
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11165
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11166
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11167
+ ] }) })
11168
+ ]
11169
+ }
11170
+ ) });
11171
+ };
11172
+ const schema$3 = addressSchema;
11152
11173
  const PROMOTION_QUERY_KEY = "promotions";
11153
11174
  const promotionsQueryKeys = {
11154
11175
  list: (query2) => [
@@ -11454,7 +11475,7 @@ const SalesChannelForm = ({ order }) => {
11454
11475
  defaultValues: {
11455
11476
  sales_channel_id: order.sales_channel_id || ""
11456
11477
  },
11457
- resolver: zodResolver(schema$3)
11478
+ resolver: zodResolver(schema$2)
11458
11479
  });
11459
11480
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11460
11481
  const { handleSuccess } = useRouteModal();
@@ -11529,7 +11550,7 @@ const SalesChannelField = ({ control, order }) => {
11529
11550
  }
11530
11551
  );
11531
11552
  };
11532
- const schema$3 = objectType({
11553
+ const schema$2 = objectType({
11533
11554
  sales_channel_id: stringType().min(1)
11534
11555
  });
11535
11556
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12371,7 +12392,7 @@ const ShippingAddressForm = ({ order }) => {
12371
12392
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12372
12393
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12373
12394
  },
12374
- resolver: zodResolver(schema$2)
12395
+ resolver: zodResolver(schema$1)
12375
12396
  });
12376
12397
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12377
12398
  const { handleSuccess } = useRouteModal();
@@ -12541,7 +12562,7 @@ const ShippingAddressForm = ({ order }) => {
12541
12562
  }
12542
12563
  ) });
12543
12564
  };
12544
- const schema$2 = addressSchema;
12565
+ const schema$1 = addressSchema;
12545
12566
  const TransferOwnership = () => {
12546
12567
  const { id } = useParams();
12547
12568
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12565,7 +12586,7 @@ const TransferOwnershipForm = ({ order }) => {
12565
12586
  defaultValues: {
12566
12587
  customer_id: order.customer_id || ""
12567
12588
  },
12568
- resolver: zodResolver(schema$1)
12589
+ resolver: zodResolver(schema)
12569
12590
  });
12570
12591
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12571
12592
  const { handleSuccess } = useRouteModal();
@@ -13015,29 +13036,8 @@ const Illustration = () => {
13015
13036
  }
13016
13037
  );
13017
13038
  };
13018
- const schema$1 = objectType({
13019
- customer_id: stringType().min(1)
13020
- });
13021
- const CustomItems = () => {
13022
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
13023
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13024
- /* @__PURE__ */ jsx(CustomItemsForm, {})
13025
- ] });
13026
- };
13027
- const CustomItemsForm = () => {
13028
- const form = useForm({
13029
- resolver: zodResolver(schema)
13030
- });
13031
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13032
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13033
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13034
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13035
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13036
- ] }) })
13037
- ] }) });
13038
- };
13039
13039
  const schema = objectType({
13040
- email: stringType().email()
13040
+ customer_id: stringType().min(1)
13041
13041
  });
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
@@ -13060,8 +13060,8 @@ const routeModule = {
13060
13060
  loader,
13061
13061
  children: [
13062
13062
  {
13063
- Component: BillingAddress,
13064
- path: "/draft-orders/:id/billing-address"
13063
+ Component: CustomItems,
13064
+ path: "/draft-orders/:id/custom-items"
13065
13065
  },
13066
13066
  {
13067
13067
  Component: Email,
@@ -13075,6 +13075,10 @@ const routeModule = {
13075
13075
  Component: Metadata,
13076
13076
  path: "/draft-orders/:id/metadata"
13077
13077
  },
13078
+ {
13079
+ Component: BillingAddress,
13080
+ path: "/draft-orders/:id/billing-address"
13081
+ },
13078
13082
  {
13079
13083
  Component: Promotions,
13080
13084
  path: "/draft-orders/:id/promotions"
@@ -13094,10 +13098,6 @@ const routeModule = {
13094
13098
  {
13095
13099
  Component: TransferOwnership,
13096
13100
  path: "/draft-orders/:id/transfer-ownership"
13097
- },
13098
- {
13099
- Component: CustomItems,
13100
- path: "/draft-orders/:id/custom-items"
13101
13101
  }
13102
13102
  ]
13103
13103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.4-snapshot-20251009122659",
3
+ "version": "2.10.4-snapshot-20251013091555",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@ariakit/react": "^0.4.15",
38
38
  "@hookform/resolvers": "3.4.2",
39
- "@medusajs/js-sdk": "2.10.4-snapshot-20251009122659",
39
+ "@medusajs/js-sdk": "2.10.4-snapshot-20251013091555",
40
40
  "@tanstack/react-query": "5.64.2",
41
41
  "@uiw/react-json-view": "^2.0.0-alpha.17",
42
42
  "date-fns": "^3.6.0",
@@ -45,14 +45,14 @@
45
45
  "react-hook-form": "7.49.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@medusajs/admin-sdk": "2.10.4-snapshot-20251009122659",
49
- "@medusajs/cli": "2.10.4-snapshot-20251009122659",
50
- "@medusajs/framework": "2.10.4-snapshot-20251009122659",
51
- "@medusajs/icons": "2.10.4-snapshot-20251009122659",
52
- "@medusajs/test-utils": "2.10.4-snapshot-20251009122659",
53
- "@medusajs/types": "2.10.4-snapshot-20251009122659",
54
- "@medusajs/ui": "4.0.24-snapshot-20251009122659",
55
- "@medusajs/ui-preset": "2.10.4-snapshot-20251009122659",
48
+ "@medusajs/admin-sdk": "2.10.4-snapshot-20251013091555",
49
+ "@medusajs/cli": "2.10.4-snapshot-20251013091555",
50
+ "@medusajs/framework": "2.10.4-snapshot-20251013091555",
51
+ "@medusajs/icons": "2.10.4-snapshot-20251013091555",
52
+ "@medusajs/test-utils": "2.10.4-snapshot-20251013091555",
53
+ "@medusajs/types": "2.10.4-snapshot-20251013091555",
54
+ "@medusajs/ui": "4.0.24-snapshot-20251013091555",
55
+ "@medusajs/ui-preset": "2.10.4-snapshot-20251013091555",
56
56
  "@swc/core": "1.5.7",
57
57
  "@types/lodash": "^4.17.15",
58
58
  "@types/node": "^20.0.0",
@@ -69,12 +69,12 @@
69
69
  "yalc": "^1.0.0-pre.53"
70
70
  },
71
71
  "peerDependencies": {
72
- "@medusajs/admin-sdk": "2.10.4-snapshot-20251009122659",
73
- "@medusajs/cli": "2.10.4-snapshot-20251009122659",
74
- "@medusajs/framework": "2.10.4-snapshot-20251009122659",
75
- "@medusajs/icons": "2.10.4-snapshot-20251009122659",
76
- "@medusajs/test-utils": "2.10.4-snapshot-20251009122659",
77
- "@medusajs/ui": "4.0.24-snapshot-20251009122659",
72
+ "@medusajs/admin-sdk": "2.10.4-snapshot-20251013091555",
73
+ "@medusajs/cli": "2.10.4-snapshot-20251013091555",
74
+ "@medusajs/framework": "2.10.4-snapshot-20251013091555",
75
+ "@medusajs/icons": "2.10.4-snapshot-20251013091555",
76
+ "@medusajs/test-utils": "2.10.4-snapshot-20251013091555",
77
+ "@medusajs/ui": "4.0.24-snapshot-20251013091555",
78
78
  "lodash": "^4.17.21",
79
79
  "react-router-dom": "6.20.1"
80
80
  },