@medusajs/draft-order 2.10.4-snapshot-20251001130744 → 2.10.4-snapshot-20251001150229

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,10 +9573,10 @@ const ID = () => {
9573
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9574
9574
  ] });
9575
9575
  };
9576
- const Email = () => {
9576
+ const BillingAddress = () => {
9577
9577
  const { id } = reactRouterDom.useParams();
9578
9578
  const { order, isPending, isError, error } = useOrder(id, {
9579
- fields: "+email"
9579
+ fields: "+billing_address"
9580
9580
  });
9581
9581
  if (isError) {
9582
9582
  throw error;
@@ -9584,16 +9584,26 @@ const Email = () => {
9584
9584
  const isReady = !isPending && !!order;
9585
9585
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9586
9586
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9587
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9588
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
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
9589
  ] }),
9590
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9590
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9591
9591
  ] });
9592
9592
  };
9593
- const EmailForm = ({ order }) => {
9593
+ const BillingAddressForm = ({ order }) => {
9594
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9594
9595
  const form = reactHookForm.useForm({
9595
9596
  defaultValues: {
9596
- email: order.email ?? ""
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) ?? ""
9597
9607
  },
9598
9608
  resolver: zod.zodResolver(schema$5)
9599
9609
  });
@@ -9601,7 +9611,7 @@ const EmailForm = ({ order }) => {
9601
9611
  const { handleSuccess } = useRouteModal();
9602
9612
  const onSubmit = form.handleSubmit(async (data) => {
9603
9613
  await mutateAsync(
9604
- { email: data.email },
9614
+ { billing_address: data },
9605
9615
  {
9606
9616
  onSuccess: () => {
9607
9617
  handleSuccess();
@@ -9618,18 +9628,132 @@ const EmailForm = ({ order }) => {
9618
9628
  className: "flex flex-1 flex-col overflow-hidden",
9619
9629
  onSubmit,
9620
9630
  children: [
9621
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9622
- Form$2.Field,
9623
- {
9624
- control: form.control,
9625
- name: "email",
9626
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9627
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9628
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9629
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9630
- ] })
9631
- }
9632
- ) }),
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
+ ] }) }),
9633
9757
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9634
9758
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9635
9759
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -9638,9 +9762,7 @@ const EmailForm = ({ order }) => {
9638
9762
  }
9639
9763
  ) });
9640
9764
  };
9641
- const schema$5 = objectType({
9642
- email: stringType().email()
9643
- });
9765
+ const schema$5 = addressSchema;
9644
9766
  const CustomItems = () => {
9645
9767
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9646
9768
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9662,6 +9784,74 @@ const CustomItemsForm = () => {
9662
9784
  const schema$4 = objectType({
9663
9785
  email: stringType().email()
9664
9786
  });
9787
+ const Email = () => {
9788
+ const { id } = reactRouterDom.useParams();
9789
+ const { order, isPending, isError, error } = useOrder(id, {
9790
+ fields: "+email"
9791
+ });
9792
+ if (isError) {
9793
+ throw error;
9794
+ }
9795
+ const isReady = !isPending && !!order;
9796
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9797
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9798
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9799
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9800
+ ] }),
9801
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9802
+ ] });
9803
+ };
9804
+ const EmailForm = ({ order }) => {
9805
+ const form = reactHookForm.useForm({
9806
+ defaultValues: {
9807
+ email: order.email ?? ""
9808
+ },
9809
+ resolver: zod.zodResolver(schema$3)
9810
+ });
9811
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9812
+ const { handleSuccess } = useRouteModal();
9813
+ const onSubmit = form.handleSubmit(async (data) => {
9814
+ await mutateAsync(
9815
+ { email: data.email },
9816
+ {
9817
+ onSuccess: () => {
9818
+ handleSuccess();
9819
+ },
9820
+ onError: (error) => {
9821
+ ui.toast.error(error.message);
9822
+ }
9823
+ }
9824
+ );
9825
+ });
9826
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9827
+ KeyboundForm,
9828
+ {
9829
+ className: "flex flex-1 flex-col overflow-hidden",
9830
+ onSubmit,
9831
+ children: [
9832
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9833
+ Form$2.Field,
9834
+ {
9835
+ control: form.control,
9836
+ name: "email",
9837
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9838
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9839
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9840
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9841
+ ] })
9842
+ }
9843
+ ) }),
9844
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9845
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9846
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9847
+ ] }) })
9848
+ ]
9849
+ }
9850
+ ) });
9851
+ };
9852
+ const schema$3 = objectType({
9853
+ email: stringType().email()
9854
+ });
9665
9855
  const NumberInput = React.forwardRef(
9666
9856
  ({
9667
9857
  value,
@@ -10636,196 +10826,6 @@ const customItemSchema = objectType({
10636
10826
  quantity: numberType(),
10637
10827
  unit_price: unionType([numberType(), stringType()])
10638
10828
  });
10639
- const BillingAddress = () => {
10640
- const { id } = reactRouterDom.useParams();
10641
- const { order, isPending, isError, error } = useOrder(id, {
10642
- fields: "+billing_address"
10643
- });
10644
- if (isError) {
10645
- throw error;
10646
- }
10647
- const isReady = !isPending && !!order;
10648
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10649
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10650
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
10651
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10652
- ] }),
10653
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
10654
- ] });
10655
- };
10656
- const BillingAddressForm = ({ order }) => {
10657
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10658
- const form = reactHookForm.useForm({
10659
- defaultValues: {
10660
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10661
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10662
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10663
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10664
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10665
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10666
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10667
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10668
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
10669
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
10670
- },
10671
- resolver: zod.zodResolver(schema$3)
10672
- });
10673
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10674
- const { handleSuccess } = useRouteModal();
10675
- const onSubmit = form.handleSubmit(async (data) => {
10676
- await mutateAsync(
10677
- { billing_address: data },
10678
- {
10679
- onSuccess: () => {
10680
- handleSuccess();
10681
- },
10682
- onError: (error) => {
10683
- ui.toast.error(error.message);
10684
- }
10685
- }
10686
- );
10687
- });
10688
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10689
- KeyboundForm,
10690
- {
10691
- className: "flex flex-1 flex-col overflow-hidden",
10692
- onSubmit,
10693
- children: [
10694
- /* @__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: [
10695
- /* @__PURE__ */ jsxRuntime.jsx(
10696
- Form$2.Field,
10697
- {
10698
- control: form.control,
10699
- name: "country_code",
10700
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
10702
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
10703
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10704
- ] })
10705
- }
10706
- ),
10707
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10708
- /* @__PURE__ */ jsxRuntime.jsx(
10709
- Form$2.Field,
10710
- {
10711
- control: form.control,
10712
- name: "first_name",
10713
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
10715
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10716
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10717
- ] })
10718
- }
10719
- ),
10720
- /* @__PURE__ */ jsxRuntime.jsx(
10721
- Form$2.Field,
10722
- {
10723
- control: form.control,
10724
- name: "last_name",
10725
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
10727
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10728
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10729
- ] })
10730
- }
10731
- )
10732
- ] }),
10733
- /* @__PURE__ */ jsxRuntime.jsx(
10734
- Form$2.Field,
10735
- {
10736
- control: form.control,
10737
- name: "company",
10738
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
10740
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10741
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10742
- ] })
10743
- }
10744
- ),
10745
- /* @__PURE__ */ jsxRuntime.jsx(
10746
- Form$2.Field,
10747
- {
10748
- control: form.control,
10749
- name: "address_1",
10750
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
10752
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10753
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10754
- ] })
10755
- }
10756
- ),
10757
- /* @__PURE__ */ jsxRuntime.jsx(
10758
- Form$2.Field,
10759
- {
10760
- control: form.control,
10761
- name: "address_2",
10762
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10763
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
10764
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10765
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10766
- ] })
10767
- }
10768
- ),
10769
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10770
- /* @__PURE__ */ jsxRuntime.jsx(
10771
- Form$2.Field,
10772
- {
10773
- control: form.control,
10774
- name: "postal_code",
10775
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10776
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
10777
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10778
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10779
- ] })
10780
- }
10781
- ),
10782
- /* @__PURE__ */ jsxRuntime.jsx(
10783
- Form$2.Field,
10784
- {
10785
- control: form.control,
10786
- name: "city",
10787
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10788
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
10789
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10790
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10791
- ] })
10792
- }
10793
- )
10794
- ] }),
10795
- /* @__PURE__ */ jsxRuntime.jsx(
10796
- Form$2.Field,
10797
- {
10798
- control: form.control,
10799
- name: "province",
10800
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10801
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
10802
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10803
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10804
- ] })
10805
- }
10806
- ),
10807
- /* @__PURE__ */ jsxRuntime.jsx(
10808
- Form$2.Field,
10809
- {
10810
- control: form.control,
10811
- name: "phone",
10812
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10813
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
10814
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10815
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10816
- ] })
10817
- }
10818
- )
10819
- ] }) }),
10820
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10821
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10822
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10823
- ] }) })
10824
- ]
10825
- }
10826
- ) });
10827
- };
10828
- const schema$3 = addressSchema;
10829
10829
  const InlineTip = React.forwardRef(
10830
10830
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10831
10831
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -13066,20 +13066,20 @@ const routeModule = {
13066
13066
  loader,
13067
13067
  children: [
13068
13068
  {
13069
- Component: Email,
13070
- path: "/draft-orders/:id/email"
13069
+ Component: BillingAddress,
13070
+ path: "/draft-orders/:id/billing-address"
13071
13071
  },
13072
13072
  {
13073
13073
  Component: CustomItems,
13074
13074
  path: "/draft-orders/:id/custom-items"
13075
13075
  },
13076
13076
  {
13077
- Component: Items,
13078
- path: "/draft-orders/:id/items"
13077
+ Component: Email,
13078
+ path: "/draft-orders/:id/email"
13079
13079
  },
13080
13080
  {
13081
- Component: BillingAddress,
13082
- path: "/draft-orders/:id/billing-address"
13081
+ Component: Items,
13082
+ path: "/draft-orders/:id/items"
13083
13083
  },
13084
13084
  {
13085
13085
  Component: Metadata,
@@ -9567,10 +9567,10 @@ const ID = () => {
9567
9567
  /* @__PURE__ */ jsx(Outlet, {})
9568
9568
  ] });
9569
9569
  };
9570
- const Email = () => {
9570
+ const BillingAddress = () => {
9571
9571
  const { id } = useParams();
9572
9572
  const { order, isPending, isError, error } = useOrder(id, {
9573
- fields: "+email"
9573
+ fields: "+billing_address"
9574
9574
  });
9575
9575
  if (isError) {
9576
9576
  throw error;
@@ -9578,16 +9578,26 @@ const Email = () => {
9578
9578
  const isReady = !isPending && !!order;
9579
9579
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9580
9580
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9581
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9582
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
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
9583
  ] }),
9584
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9584
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9585
9585
  ] });
9586
9586
  };
9587
- const EmailForm = ({ order }) => {
9587
+ const BillingAddressForm = ({ order }) => {
9588
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9588
9589
  const form = useForm({
9589
9590
  defaultValues: {
9590
- email: order.email ?? ""
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) ?? ""
9591
9601
  },
9592
9602
  resolver: zodResolver(schema$5)
9593
9603
  });
@@ -9595,7 +9605,7 @@ const EmailForm = ({ order }) => {
9595
9605
  const { handleSuccess } = useRouteModal();
9596
9606
  const onSubmit = form.handleSubmit(async (data) => {
9597
9607
  await mutateAsync(
9598
- { email: data.email },
9608
+ { billing_address: data },
9599
9609
  {
9600
9610
  onSuccess: () => {
9601
9611
  handleSuccess();
@@ -9612,18 +9622,132 @@ const EmailForm = ({ order }) => {
9612
9622
  className: "flex flex-1 flex-col overflow-hidden",
9613
9623
  onSubmit,
9614
9624
  children: [
9615
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9616
- Form$2.Field,
9617
- {
9618
- control: form.control,
9619
- name: "email",
9620
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9621
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9622
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9623
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9624
- ] })
9625
- }
9626
- ) }),
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
+ ] }) }),
9627
9751
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9628
9752
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9629
9753
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -9632,9 +9756,7 @@ const EmailForm = ({ order }) => {
9632
9756
  }
9633
9757
  ) });
9634
9758
  };
9635
- const schema$5 = objectType({
9636
- email: stringType().email()
9637
- });
9759
+ const schema$5 = addressSchema;
9638
9760
  const CustomItems = () => {
9639
9761
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9640
9762
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9656,6 +9778,74 @@ const CustomItemsForm = () => {
9656
9778
  const schema$4 = objectType({
9657
9779
  email: stringType().email()
9658
9780
  });
9781
+ const Email = () => {
9782
+ const { id } = useParams();
9783
+ const { order, isPending, isError, error } = useOrder(id, {
9784
+ fields: "+email"
9785
+ });
9786
+ if (isError) {
9787
+ throw error;
9788
+ }
9789
+ const isReady = !isPending && !!order;
9790
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9791
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9792
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9793
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9794
+ ] }),
9795
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9796
+ ] });
9797
+ };
9798
+ const EmailForm = ({ order }) => {
9799
+ const form = useForm({
9800
+ defaultValues: {
9801
+ email: order.email ?? ""
9802
+ },
9803
+ resolver: zodResolver(schema$3)
9804
+ });
9805
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9806
+ const { handleSuccess } = useRouteModal();
9807
+ const onSubmit = form.handleSubmit(async (data) => {
9808
+ await mutateAsync(
9809
+ { email: data.email },
9810
+ {
9811
+ onSuccess: () => {
9812
+ handleSuccess();
9813
+ },
9814
+ onError: (error) => {
9815
+ toast.error(error.message);
9816
+ }
9817
+ }
9818
+ );
9819
+ });
9820
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9821
+ KeyboundForm,
9822
+ {
9823
+ className: "flex flex-1 flex-col overflow-hidden",
9824
+ onSubmit,
9825
+ children: [
9826
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9827
+ Form$2.Field,
9828
+ {
9829
+ control: form.control,
9830
+ name: "email",
9831
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9832
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9833
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9834
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9835
+ ] })
9836
+ }
9837
+ ) }),
9838
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9839
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9840
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9841
+ ] }) })
9842
+ ]
9843
+ }
9844
+ ) });
9845
+ };
9846
+ const schema$3 = objectType({
9847
+ email: stringType().email()
9848
+ });
9659
9849
  const NumberInput = forwardRef(
9660
9850
  ({
9661
9851
  value,
@@ -10630,196 +10820,6 @@ const customItemSchema = objectType({
10630
10820
  quantity: numberType(),
10631
10821
  unit_price: unionType([numberType(), stringType()])
10632
10822
  });
10633
- const BillingAddress = () => {
10634
- const { id } = useParams();
10635
- const { order, isPending, isError, error } = useOrder(id, {
10636
- fields: "+billing_address"
10637
- });
10638
- if (isError) {
10639
- throw error;
10640
- }
10641
- const isReady = !isPending && !!order;
10642
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10643
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10644
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
10645
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10646
- ] }),
10647
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
10648
- ] });
10649
- };
10650
- const BillingAddressForm = ({ order }) => {
10651
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10652
- const form = useForm({
10653
- defaultValues: {
10654
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10655
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10656
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10657
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10658
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10659
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10660
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10661
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10662
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
10663
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
10664
- },
10665
- resolver: zodResolver(schema$3)
10666
- });
10667
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10668
- const { handleSuccess } = useRouteModal();
10669
- const onSubmit = form.handleSubmit(async (data) => {
10670
- await mutateAsync(
10671
- { billing_address: data },
10672
- {
10673
- onSuccess: () => {
10674
- handleSuccess();
10675
- },
10676
- onError: (error) => {
10677
- toast.error(error.message);
10678
- }
10679
- }
10680
- );
10681
- });
10682
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10683
- KeyboundForm,
10684
- {
10685
- className: "flex flex-1 flex-col overflow-hidden",
10686
- onSubmit,
10687
- children: [
10688
- /* @__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: [
10689
- /* @__PURE__ */ jsx(
10690
- Form$2.Field,
10691
- {
10692
- control: form.control,
10693
- name: "country_code",
10694
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10695
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
10696
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
10697
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10698
- ] })
10699
- }
10700
- ),
10701
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10702
- /* @__PURE__ */ jsx(
10703
- Form$2.Field,
10704
- {
10705
- control: form.control,
10706
- name: "first_name",
10707
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10708
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
10709
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10710
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10711
- ] })
10712
- }
10713
- ),
10714
- /* @__PURE__ */ jsx(
10715
- Form$2.Field,
10716
- {
10717
- control: form.control,
10718
- name: "last_name",
10719
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10720
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
10721
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10722
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10723
- ] })
10724
- }
10725
- )
10726
- ] }),
10727
- /* @__PURE__ */ jsx(
10728
- Form$2.Field,
10729
- {
10730
- control: form.control,
10731
- name: "company",
10732
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10733
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
10734
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10735
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10736
- ] })
10737
- }
10738
- ),
10739
- /* @__PURE__ */ jsx(
10740
- Form$2.Field,
10741
- {
10742
- control: form.control,
10743
- name: "address_1",
10744
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10745
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
10746
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10747
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10748
- ] })
10749
- }
10750
- ),
10751
- /* @__PURE__ */ jsx(
10752
- Form$2.Field,
10753
- {
10754
- control: form.control,
10755
- name: "address_2",
10756
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10757
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
10758
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10759
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10760
- ] })
10761
- }
10762
- ),
10763
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10764
- /* @__PURE__ */ jsx(
10765
- Form$2.Field,
10766
- {
10767
- control: form.control,
10768
- name: "postal_code",
10769
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10770
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
10771
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10772
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10773
- ] })
10774
- }
10775
- ),
10776
- /* @__PURE__ */ jsx(
10777
- Form$2.Field,
10778
- {
10779
- control: form.control,
10780
- name: "city",
10781
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10782
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
10783
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10784
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10785
- ] })
10786
- }
10787
- )
10788
- ] }),
10789
- /* @__PURE__ */ jsx(
10790
- Form$2.Field,
10791
- {
10792
- control: form.control,
10793
- name: "province",
10794
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10795
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
10796
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10797
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10798
- ] })
10799
- }
10800
- ),
10801
- /* @__PURE__ */ jsx(
10802
- Form$2.Field,
10803
- {
10804
- control: form.control,
10805
- name: "phone",
10806
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10807
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
10808
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10809
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10810
- ] })
10811
- }
10812
- )
10813
- ] }) }),
10814
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10815
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10816
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10817
- ] }) })
10818
- ]
10819
- }
10820
- ) });
10821
- };
10822
- const schema$3 = addressSchema;
10823
10823
  const InlineTip = forwardRef(
10824
10824
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10825
10825
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -13060,20 +13060,20 @@ const routeModule = {
13060
13060
  loader,
13061
13061
  children: [
13062
13062
  {
13063
- Component: Email,
13064
- path: "/draft-orders/:id/email"
13063
+ Component: BillingAddress,
13064
+ path: "/draft-orders/:id/billing-address"
13065
13065
  },
13066
13066
  {
13067
13067
  Component: CustomItems,
13068
13068
  path: "/draft-orders/:id/custom-items"
13069
13069
  },
13070
13070
  {
13071
- Component: Items,
13072
- path: "/draft-orders/:id/items"
13071
+ Component: Email,
13072
+ path: "/draft-orders/:id/email"
13073
13073
  },
13074
13074
  {
13075
- Component: BillingAddress,
13076
- path: "/draft-orders/:id/billing-address"
13075
+ Component: Items,
13076
+ path: "/draft-orders/:id/items"
13077
13077
  },
13078
13078
  {
13079
13079
  Component: Metadata,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/draft-order",
3
- "version": "2.10.4-snapshot-20251001130744",
3
+ "version": "2.10.4-snapshot-20251001150229",
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-20251001130744",
39
+ "@medusajs/js-sdk": "2.10.4-snapshot-20251001150229",
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-20251001130744",
49
- "@medusajs/cli": "2.10.4-snapshot-20251001130744",
50
- "@medusajs/framework": "2.10.4-snapshot-20251001130744",
51
- "@medusajs/icons": "2.10.4-snapshot-20251001130744",
52
- "@medusajs/test-utils": "2.10.4-snapshot-20251001130744",
53
- "@medusajs/types": "2.10.4-snapshot-20251001130744",
54
- "@medusajs/ui": "4.0.24-snapshot-20251001130744",
55
- "@medusajs/ui-preset": "2.10.4-snapshot-20251001130744",
48
+ "@medusajs/admin-sdk": "2.10.4-snapshot-20251001150229",
49
+ "@medusajs/cli": "2.10.4-snapshot-20251001150229",
50
+ "@medusajs/framework": "2.10.4-snapshot-20251001150229",
51
+ "@medusajs/icons": "2.10.4-snapshot-20251001150229",
52
+ "@medusajs/test-utils": "2.10.4-snapshot-20251001150229",
53
+ "@medusajs/types": "2.10.4-snapshot-20251001150229",
54
+ "@medusajs/ui": "4.0.24-snapshot-20251001150229",
55
+ "@medusajs/ui-preset": "2.10.4-snapshot-20251001150229",
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-20251001130744",
73
- "@medusajs/cli": "2.10.4-snapshot-20251001130744",
74
- "@medusajs/framework": "2.10.4-snapshot-20251001130744",
75
- "@medusajs/icons": "2.10.4-snapshot-20251001130744",
76
- "@medusajs/test-utils": "2.10.4-snapshot-20251001130744",
77
- "@medusajs/ui": "4.0.24-snapshot-20251001130744",
72
+ "@medusajs/admin-sdk": "2.10.4-snapshot-20251001150229",
73
+ "@medusajs/cli": "2.10.4-snapshot-20251001150229",
74
+ "@medusajs/framework": "2.10.4-snapshot-20251001150229",
75
+ "@medusajs/icons": "2.10.4-snapshot-20251001150229",
76
+ "@medusajs/test-utils": "2.10.4-snapshot-20251001150229",
77
+ "@medusajs/ui": "4.0.24-snapshot-20251001150229",
78
78
  "lodash": "^4.17.21",
79
79
  "react-router-dom": "6.20.1"
80
80
  },