@medusajs/draft-order 2.10.2-preview-20250901060152 → 2.10.2-preview-20250901090155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9560,196 +9560,6 @@ const ID = () => {
9560
9560
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9561
  ] });
9562
9562
  };
9563
- const BillingAddress = () => {
9564
- const { id } = reactRouterDom.useParams();
9565
- const { order, isPending, isError, error } = useOrder(id, {
9566
- fields: "+billing_address"
9567
- });
9568
- if (isError) {
9569
- throw error;
9570
- }
9571
- const isReady = !isPending && !!order;
9572
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9573
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9574
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9575
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9576
- ] }),
9577
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9578
- ] });
9579
- };
9580
- const BillingAddressForm = ({ order }) => {
9581
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9582
- const form = reactHookForm.useForm({
9583
- defaultValues: {
9584
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9585
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9586
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9587
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9588
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9589
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9590
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9591
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9592
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9593
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9594
- },
9595
- resolver: zod.zodResolver(schema$5)
9596
- });
9597
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9598
- const { handleSuccess } = useRouteModal();
9599
- const onSubmit = form.handleSubmit(async (data) => {
9600
- await mutateAsync(
9601
- { billing_address: data },
9602
- {
9603
- onSuccess: () => {
9604
- handleSuccess();
9605
- },
9606
- onError: (error) => {
9607
- ui.toast.error(error.message);
9608
- }
9609
- }
9610
- );
9611
- });
9612
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9613
- KeyboundForm,
9614
- {
9615
- className: "flex flex-1 flex-col overflow-hidden",
9616
- onSubmit,
9617
- children: [
9618
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
9619
- /* @__PURE__ */ jsxRuntime.jsx(
9620
- Form$2.Field,
9621
- {
9622
- control: form.control,
9623
- name: "country_code",
9624
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9625
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9626
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9627
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9628
- ] })
9629
- }
9630
- ),
9631
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9632
- /* @__PURE__ */ jsxRuntime.jsx(
9633
- Form$2.Field,
9634
- {
9635
- control: form.control,
9636
- name: "first_name",
9637
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9640
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
- ] })
9642
- }
9643
- ),
9644
- /* @__PURE__ */ jsxRuntime.jsx(
9645
- Form$2.Field,
9646
- {
9647
- control: form.control,
9648
- name: "last_name",
9649
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9650
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9651
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9652
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9653
- ] })
9654
- }
9655
- )
9656
- ] }),
9657
- /* @__PURE__ */ jsxRuntime.jsx(
9658
- Form$2.Field,
9659
- {
9660
- control: form.control,
9661
- name: "company",
9662
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9664
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
- ] })
9667
- }
9668
- ),
9669
- /* @__PURE__ */ jsxRuntime.jsx(
9670
- Form$2.Field,
9671
- {
9672
- control: form.control,
9673
- name: "address_1",
9674
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9675
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9676
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9677
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9678
- ] })
9679
- }
9680
- ),
9681
- /* @__PURE__ */ jsxRuntime.jsx(
9682
- Form$2.Field,
9683
- {
9684
- control: form.control,
9685
- name: "address_2",
9686
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9687
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9688
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9689
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9690
- ] })
9691
- }
9692
- ),
9693
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9694
- /* @__PURE__ */ jsxRuntime.jsx(
9695
- Form$2.Field,
9696
- {
9697
- control: form.control,
9698
- name: "postal_code",
9699
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
- ] })
9704
- }
9705
- ),
9706
- /* @__PURE__ */ jsxRuntime.jsx(
9707
- Form$2.Field,
9708
- {
9709
- control: form.control,
9710
- name: "city",
9711
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9712
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9713
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9714
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9715
- ] })
9716
- }
9717
- )
9718
- ] }),
9719
- /* @__PURE__ */ jsxRuntime.jsx(
9720
- Form$2.Field,
9721
- {
9722
- control: form.control,
9723
- name: "province",
9724
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
- ] })
9729
- }
9730
- ),
9731
- /* @__PURE__ */ jsxRuntime.jsx(
9732
- Form$2.Field,
9733
- {
9734
- control: form.control,
9735
- name: "phone",
9736
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9737
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9738
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9739
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9740
- ] })
9741
- }
9742
- )
9743
- ] }) }),
9744
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9745
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9746
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9747
- ] }) })
9748
- ]
9749
- }
9750
- ) });
9751
- };
9752
- const schema$5 = addressSchema;
9753
9563
  const CustomItems = () => {
9754
9564
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9755
9565
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9758,7 +9568,7 @@ const CustomItems = () => {
9758
9568
  };
9759
9569
  const CustomItemsForm = () => {
9760
9570
  const form = reactHookForm.useForm({
9761
- resolver: zod.zodResolver(schema$4)
9571
+ resolver: zod.zodResolver(schema$5)
9762
9572
  });
9763
9573
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9764
9574
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -9768,7 +9578,7 @@ const CustomItemsForm = () => {
9768
9578
  ] }) })
9769
9579
  ] }) });
9770
9580
  };
9771
- const schema$4 = objectType({
9581
+ const schema$5 = objectType({
9772
9582
  email: stringType().email()
9773
9583
  });
9774
9584
  const Email = () => {
@@ -9793,7 +9603,7 @@ const EmailForm = ({ order }) => {
9793
9603
  defaultValues: {
9794
9604
  email: order.email ?? ""
9795
9605
  },
9796
- resolver: zod.zodResolver(schema$3)
9606
+ resolver: zod.zodResolver(schema$4)
9797
9607
  });
9798
9608
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9799
9609
  const { handleSuccess } = useRouteModal();
@@ -9836,7 +9646,7 @@ const EmailForm = ({ order }) => {
9836
9646
  }
9837
9647
  ) });
9838
9648
  };
9839
- const schema$3 = objectType({
9649
+ const schema$4 = objectType({
9840
9650
  email: stringType().email()
9841
9651
  });
9842
9652
  const NumberInput = React.forwardRef(
@@ -10808,11 +10618,201 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
10808
10618
  ] }) })
10809
10619
  ] }) }) });
10810
10620
  };
10811
- const customItemSchema = objectType({
10812
- title: stringType().min(1),
10813
- quantity: numberType(),
10814
- unit_price: unionType([numberType(), stringType()])
10815
- });
10621
+ const customItemSchema = objectType({
10622
+ title: stringType().min(1),
10623
+ quantity: numberType(),
10624
+ unit_price: unionType([numberType(), stringType()])
10625
+ });
10626
+ const BillingAddress = () => {
10627
+ const { id } = reactRouterDom.useParams();
10628
+ const { order, isPending, isError, error } = useOrder(id, {
10629
+ fields: "+billing_address"
10630
+ });
10631
+ if (isError) {
10632
+ throw error;
10633
+ }
10634
+ const isReady = !isPending && !!order;
10635
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10636
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10637
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
10638
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10639
+ ] }),
10640
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
10641
+ ] });
10642
+ };
10643
+ const BillingAddressForm = ({ order }) => {
10644
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10645
+ const form = reactHookForm.useForm({
10646
+ defaultValues: {
10647
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10648
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10649
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10650
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10651
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10652
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10653
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10654
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10655
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
10656
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
10657
+ },
10658
+ resolver: zod.zodResolver(schema$3)
10659
+ });
10660
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10661
+ const { handleSuccess } = useRouteModal();
10662
+ const onSubmit = form.handleSubmit(async (data) => {
10663
+ await mutateAsync(
10664
+ { billing_address: data },
10665
+ {
10666
+ onSuccess: () => {
10667
+ handleSuccess();
10668
+ },
10669
+ onError: (error) => {
10670
+ ui.toast.error(error.message);
10671
+ }
10672
+ }
10673
+ );
10674
+ });
10675
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10676
+ KeyboundForm,
10677
+ {
10678
+ className: "flex flex-1 flex-col overflow-hidden",
10679
+ onSubmit,
10680
+ children: [
10681
+ /* @__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: [
10682
+ /* @__PURE__ */ jsxRuntime.jsx(
10683
+ Form$2.Field,
10684
+ {
10685
+ control: form.control,
10686
+ name: "country_code",
10687
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
10689
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
10690
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10691
+ ] })
10692
+ }
10693
+ ),
10694
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10695
+ /* @__PURE__ */ jsxRuntime.jsx(
10696
+ Form$2.Field,
10697
+ {
10698
+ control: form.control,
10699
+ name: "first_name",
10700
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10701
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
10702
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10703
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10704
+ ] })
10705
+ }
10706
+ ),
10707
+ /* @__PURE__ */ jsxRuntime.jsx(
10708
+ Form$2.Field,
10709
+ {
10710
+ control: form.control,
10711
+ name: "last_name",
10712
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
10714
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10715
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10716
+ ] })
10717
+ }
10718
+ )
10719
+ ] }),
10720
+ /* @__PURE__ */ jsxRuntime.jsx(
10721
+ Form$2.Field,
10722
+ {
10723
+ control: form.control,
10724
+ name: "company",
10725
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10726
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
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
+ /* @__PURE__ */ jsxRuntime.jsx(
10733
+ Form$2.Field,
10734
+ {
10735
+ control: form.control,
10736
+ name: "address_1",
10737
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
10739
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10740
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10741
+ ] })
10742
+ }
10743
+ ),
10744
+ /* @__PURE__ */ jsxRuntime.jsx(
10745
+ Form$2.Field,
10746
+ {
10747
+ control: form.control,
10748
+ name: "address_2",
10749
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10750
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
10751
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10752
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10753
+ ] })
10754
+ }
10755
+ ),
10756
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10757
+ /* @__PURE__ */ jsxRuntime.jsx(
10758
+ Form$2.Field,
10759
+ {
10760
+ control: form.control,
10761
+ name: "postal_code",
10762
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10763
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
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.jsx(
10770
+ Form$2.Field,
10771
+ {
10772
+ control: form.control,
10773
+ name: "city",
10774
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10775
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
10776
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10777
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10778
+ ] })
10779
+ }
10780
+ )
10781
+ ] }),
10782
+ /* @__PURE__ */ jsxRuntime.jsx(
10783
+ Form$2.Field,
10784
+ {
10785
+ control: form.control,
10786
+ name: "province",
10787
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10788
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
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
+ /* @__PURE__ */ jsxRuntime.jsx(
10795
+ Form$2.Field,
10796
+ {
10797
+ control: form.control,
10798
+ name: "phone",
10799
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10800
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
10801
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10802
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10803
+ ] })
10804
+ }
10805
+ )
10806
+ ] }) }),
10807
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10808
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10809
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10810
+ ] }) })
10811
+ ]
10812
+ }
10813
+ ) });
10814
+ };
10815
+ const schema$3 = addressSchema;
10816
10816
  const InlineTip = React.forwardRef(
10817
10817
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10818
10818
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11440,112 +11440,6 @@ function getPromotionCodes(items, shippingMethods) {
11440
11440
  }
11441
11441
  return Array.from(codes);
11442
11442
  }
11443
- const SalesChannel = () => {
11444
- const { id } = reactRouterDom.useParams();
11445
- const { draft_order, isPending, isError, error } = useDraftOrder(
11446
- id,
11447
- {
11448
- fields: "+sales_channel_id"
11449
- },
11450
- {
11451
- enabled: !!id
11452
- }
11453
- );
11454
- if (isError) {
11455
- throw error;
11456
- }
11457
- const ISrEADY = !!draft_order && !isPending;
11458
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11459
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11460
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11461
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11462
- ] }),
11463
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11464
- ] });
11465
- };
11466
- const SalesChannelForm = ({ order }) => {
11467
- const form = reactHookForm.useForm({
11468
- defaultValues: {
11469
- sales_channel_id: order.sales_channel_id || ""
11470
- },
11471
- resolver: zod.zodResolver(schema$2)
11472
- });
11473
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11474
- const { handleSuccess } = useRouteModal();
11475
- const onSubmit = form.handleSubmit(async (data) => {
11476
- await mutateAsync(
11477
- {
11478
- sales_channel_id: data.sales_channel_id
11479
- },
11480
- {
11481
- onSuccess: () => {
11482
- ui.toast.success("Sales channel updated");
11483
- handleSuccess();
11484
- },
11485
- onError: (error) => {
11486
- ui.toast.error(error.message);
11487
- }
11488
- }
11489
- );
11490
- });
11491
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11492
- KeyboundForm,
11493
- {
11494
- className: "flex flex-1 flex-col overflow-hidden",
11495
- onSubmit,
11496
- children: [
11497
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11498
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11499
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11500
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11501
- ] }) })
11502
- ]
11503
- }
11504
- ) });
11505
- };
11506
- const SalesChannelField = ({ control, order }) => {
11507
- const salesChannels = useComboboxData({
11508
- queryFn: async (params) => {
11509
- return await sdk.admin.salesChannel.list(params);
11510
- },
11511
- queryKey: ["sales-channels"],
11512
- getOptions: (data) => {
11513
- return data.sales_channels.map((salesChannel) => ({
11514
- label: salesChannel.name,
11515
- value: salesChannel.id
11516
- }));
11517
- },
11518
- defaultValue: order.sales_channel_id || void 0
11519
- });
11520
- return /* @__PURE__ */ jsxRuntime.jsx(
11521
- Form$2.Field,
11522
- {
11523
- control,
11524
- name: "sales_channel_id",
11525
- render: ({ field }) => {
11526
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11527
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11528
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11529
- Combobox,
11530
- {
11531
- options: salesChannels.options,
11532
- fetchNextPage: salesChannels.fetchNextPage,
11533
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11534
- searchValue: salesChannels.searchValue,
11535
- onSearchValueChange: salesChannels.onSearchValueChange,
11536
- placeholder: "Select sales channel",
11537
- ...field
11538
- }
11539
- ) }),
11540
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11541
- ] });
11542
- }
11543
- }
11544
- );
11545
- };
11546
- const schema$2 = objectType({
11547
- sales_channel_id: stringType().min(1)
11548
- });
11549
11443
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11550
11444
  const Shipping = () => {
11551
11445
  var _a;
@@ -12353,6 +12247,112 @@ const CustomAmountField = ({
12353
12247
  }
12354
12248
  );
12355
12249
  };
12250
+ const SalesChannel = () => {
12251
+ const { id } = reactRouterDom.useParams();
12252
+ const { draft_order, isPending, isError, error } = useDraftOrder(
12253
+ id,
12254
+ {
12255
+ fields: "+sales_channel_id"
12256
+ },
12257
+ {
12258
+ enabled: !!id
12259
+ }
12260
+ );
12261
+ if (isError) {
12262
+ throw error;
12263
+ }
12264
+ const ISrEADY = !!draft_order && !isPending;
12265
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12266
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12267
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
12268
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12269
+ ] }),
12270
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
12271
+ ] });
12272
+ };
12273
+ const SalesChannelForm = ({ order }) => {
12274
+ const form = reactHookForm.useForm({
12275
+ defaultValues: {
12276
+ sales_channel_id: order.sales_channel_id || ""
12277
+ },
12278
+ resolver: zod.zodResolver(schema$2)
12279
+ });
12280
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12281
+ const { handleSuccess } = useRouteModal();
12282
+ const onSubmit = form.handleSubmit(async (data) => {
12283
+ await mutateAsync(
12284
+ {
12285
+ sales_channel_id: data.sales_channel_id
12286
+ },
12287
+ {
12288
+ onSuccess: () => {
12289
+ ui.toast.success("Sales channel updated");
12290
+ handleSuccess();
12291
+ },
12292
+ onError: (error) => {
12293
+ ui.toast.error(error.message);
12294
+ }
12295
+ }
12296
+ );
12297
+ });
12298
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12299
+ KeyboundForm,
12300
+ {
12301
+ className: "flex flex-1 flex-col overflow-hidden",
12302
+ onSubmit,
12303
+ children: [
12304
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
12305
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12306
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12307
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12308
+ ] }) })
12309
+ ]
12310
+ }
12311
+ ) });
12312
+ };
12313
+ const SalesChannelField = ({ control, order }) => {
12314
+ const salesChannels = useComboboxData({
12315
+ queryFn: async (params) => {
12316
+ return await sdk.admin.salesChannel.list(params);
12317
+ },
12318
+ queryKey: ["sales-channels"],
12319
+ getOptions: (data) => {
12320
+ return data.sales_channels.map((salesChannel) => ({
12321
+ label: salesChannel.name,
12322
+ value: salesChannel.id
12323
+ }));
12324
+ },
12325
+ defaultValue: order.sales_channel_id || void 0
12326
+ });
12327
+ return /* @__PURE__ */ jsxRuntime.jsx(
12328
+ Form$2.Field,
12329
+ {
12330
+ control,
12331
+ name: "sales_channel_id",
12332
+ render: ({ field }) => {
12333
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12334
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
12335
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12336
+ Combobox,
12337
+ {
12338
+ options: salesChannels.options,
12339
+ fetchNextPage: salesChannels.fetchNextPage,
12340
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
12341
+ searchValue: salesChannels.searchValue,
12342
+ onSearchValueChange: salesChannels.onSearchValueChange,
12343
+ placeholder: "Select sales channel",
12344
+ ...field
12345
+ }
12346
+ ) }),
12347
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12348
+ ] });
12349
+ }
12350
+ }
12351
+ );
12352
+ };
12353
+ const schema$2 = objectType({
12354
+ sales_channel_id: stringType().min(1)
12355
+ });
12356
12356
  const ShippingAddress = () => {
12357
12357
  const { id } = reactRouterDom.useParams();
12358
12358
  const { order, isPending, isError, error } = useOrder(id, {
@@ -13052,10 +13052,6 @@ const routeModule = {
13052
13052
  handle,
13053
13053
  loader,
13054
13054
  children: [
13055
- {
13056
- Component: BillingAddress,
13057
- path: "/draft-orders/:id/billing-address"
13058
- },
13059
13055
  {
13060
13056
  Component: CustomItems,
13061
13057
  path: "/draft-orders/:id/custom-items"
@@ -13068,6 +13064,10 @@ const routeModule = {
13068
13064
  Component: Items,
13069
13065
  path: "/draft-orders/:id/items"
13070
13066
  },
13067
+ {
13068
+ Component: BillingAddress,
13069
+ path: "/draft-orders/:id/billing-address"
13070
+ },
13071
13071
  {
13072
13072
  Component: Metadata,
13073
13073
  path: "/draft-orders/:id/metadata"
@@ -13076,14 +13076,14 @@ const routeModule = {
13076
13076
  Component: Promotions,
13077
13077
  path: "/draft-orders/:id/promotions"
13078
13078
  },
13079
- {
13080
- Component: SalesChannel,
13081
- path: "/draft-orders/:id/sales-channel"
13082
- },
13083
13079
  {
13084
13080
  Component: Shipping,
13085
13081
  path: "/draft-orders/:id/shipping"
13086
13082
  },
13083
+ {
13084
+ Component: SalesChannel,
13085
+ path: "/draft-orders/:id/sales-channel"
13086
+ },
13087
13087
  {
13088
13088
  Component: ShippingAddress,
13089
13089
  path: "/draft-orders/:id/shipping-address"