@medusajs/draft-order 3.0.0-snapshot-20251216135612 → 3.0.0-snapshot-20260102125810

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.
@@ -9,6 +9,7 @@ const icons = require("@medusajs/icons");
9
9
  const Medusa = require("@medusajs/js-sdk");
10
10
  const dateFns = require("date-fns");
11
11
  const locale = require("date-fns/locale");
12
+ const reactI18next = require("react-i18next");
12
13
  const zod = require("@hookform/resolvers/zod");
13
14
  const reactHookForm = require("react-hook-form");
14
15
  const radixUi = require("radix-ui");
@@ -944,6 +945,7 @@ const handle$1 = {
944
945
  breadcrumb: () => "Draft Orders"
945
946
  };
946
947
  const List = () => {
948
+ const { t } = reactI18next.useTranslation();
947
949
  const queryParams = useDraftOrderTableQuery({
948
950
  pageSize: PAGE_SIZE
949
951
  });
@@ -973,20 +975,20 @@ const List = () => {
973
975
  isLoading: isPending,
974
976
  pageSize: PAGE_SIZE,
975
977
  rowCount: count,
976
- heading: "Draft Orders",
978
+ heading: t("draftOrders.domain"),
977
979
  action: {
978
- label: "Create",
980
+ label: t("actions.create"),
979
981
  to: "create"
980
982
  },
981
983
  rowHref: (row) => `${row.id}`,
982
984
  emptyState: {
983
985
  empty: {
984
- heading: "No draft orders found",
985
- description: "Create a new draft order to get started."
986
+ heading: t("draftOrders.list.noRecordsMessage"),
987
+ description: t("draftOrders.list.description")
986
988
  },
987
989
  filtered: {
988
- heading: "No results found",
989
- description: "No draft orders match your filter criteria."
990
+ heading: t("draftOrders.list.filtered.heading"),
991
+ description: t("draftOrders.list.filtered.description")
990
992
  }
991
993
  }
992
994
  }
@@ -9572,196 +9574,6 @@ const ID = () => {
9572
9574
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9573
9575
  ] });
9574
9576
  };
9575
- const BillingAddress = () => {
9576
- const { id } = reactRouterDom.useParams();
9577
- const { order, isPending, isError, error } = useOrder(id, {
9578
- fields: "+billing_address"
9579
- });
9580
- if (isError) {
9581
- throw error;
9582
- }
9583
- const isReady = !isPending && !!order;
9584
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9585
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9586
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9587
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9588
- ] }),
9589
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9590
- ] });
9591
- };
9592
- const BillingAddressForm = ({ order }) => {
9593
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9594
- const form = reactHookForm.useForm({
9595
- defaultValues: {
9596
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9597
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9598
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9599
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9600
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9601
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9602
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9603
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9604
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9605
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9606
- },
9607
- resolver: zod.zodResolver(schema$5)
9608
- });
9609
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9610
- const { handleSuccess } = useRouteModal();
9611
- const onSubmit = form.handleSubmit(async (data) => {
9612
- await mutateAsync(
9613
- { billing_address: data },
9614
- {
9615
- onSuccess: () => {
9616
- handleSuccess();
9617
- },
9618
- onError: (error) => {
9619
- ui.toast.error(error.message);
9620
- }
9621
- }
9622
- );
9623
- });
9624
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9625
- KeyboundForm,
9626
- {
9627
- className: "flex flex-1 flex-col overflow-hidden",
9628
- onSubmit,
9629
- children: [
9630
- /* @__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: [
9631
- /* @__PURE__ */ jsxRuntime.jsx(
9632
- Form$2.Field,
9633
- {
9634
- control: form.control,
9635
- name: "country_code",
9636
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9637
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9638
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9639
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9640
- ] })
9641
- }
9642
- ),
9643
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9644
- /* @__PURE__ */ jsxRuntime.jsx(
9645
- Form$2.Field,
9646
- {
9647
- control: form.control,
9648
- name: "first_name",
9649
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9650
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First 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
- /* @__PURE__ */ jsxRuntime.jsx(
9657
- Form$2.Field,
9658
- {
9659
- control: form.control,
9660
- name: "last_name",
9661
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9662
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9663
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9664
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9665
- ] })
9666
- }
9667
- )
9668
- ] }),
9669
- /* @__PURE__ */ jsxRuntime.jsx(
9670
- Form$2.Field,
9671
- {
9672
- control: form.control,
9673
- name: "company",
9674
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9675
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
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_1",
9686
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9687
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
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.jsx(
9694
- Form$2.Field,
9695
- {
9696
- control: form.control,
9697
- name: "address_2",
9698
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9699
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9700
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9701
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9702
- ] })
9703
- }
9704
- ),
9705
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9706
- /* @__PURE__ */ jsxRuntime.jsx(
9707
- Form$2.Field,
9708
- {
9709
- control: form.control,
9710
- name: "postal_code",
9711
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9712
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
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
- /* @__PURE__ */ jsxRuntime.jsx(
9719
- Form$2.Field,
9720
- {
9721
- control: form.control,
9722
- name: "city",
9723
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9724
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9725
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9726
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9727
- ] })
9728
- }
9729
- )
9730
- ] }),
9731
- /* @__PURE__ */ jsxRuntime.jsx(
9732
- Form$2.Field,
9733
- {
9734
- control: form.control,
9735
- name: "province",
9736
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9737
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
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
- /* @__PURE__ */ jsxRuntime.jsx(
9744
- Form$2.Field,
9745
- {
9746
- control: form.control,
9747
- name: "phone",
9748
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9749
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9750
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9751
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9752
- ] })
9753
- }
9754
- )
9755
- ] }) }),
9756
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9757
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9758
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9759
- ] }) })
9760
- ]
9761
- }
9762
- ) });
9763
- };
9764
- const schema$5 = addressSchema;
9765
9577
  const CustomItems = () => {
9766
9578
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9767
9579
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9770,7 +9582,7 @@ const CustomItems = () => {
9770
9582
  };
9771
9583
  const CustomItemsForm = () => {
9772
9584
  const form = reactHookForm.useForm({
9773
- resolver: zod.zodResolver(schema$4)
9585
+ resolver: zod.zodResolver(schema$5)
9774
9586
  });
9775
9587
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9776
9588
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -9780,75 +9592,7 @@ const CustomItemsForm = () => {
9780
9592
  ] }) })
9781
9593
  ] }) });
9782
9594
  };
9783
- const schema$4 = objectType({
9784
- email: stringType().email()
9785
- });
9786
- const Email = () => {
9787
- const { id } = reactRouterDom.useParams();
9788
- const { order, isPending, isError, error } = useOrder(id, {
9789
- fields: "+email"
9790
- });
9791
- if (isError) {
9792
- throw error;
9793
- }
9794
- const isReady = !isPending && !!order;
9795
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9796
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9797
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9798
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9799
- ] }),
9800
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9801
- ] });
9802
- };
9803
- const EmailForm = ({ order }) => {
9804
- const form = reactHookForm.useForm({
9805
- defaultValues: {
9806
- email: order.email ?? ""
9807
- },
9808
- resolver: zod.zodResolver(schema$3)
9809
- });
9810
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9811
- const { handleSuccess } = useRouteModal();
9812
- const onSubmit = form.handleSubmit(async (data) => {
9813
- await mutateAsync(
9814
- { email: data.email },
9815
- {
9816
- onSuccess: () => {
9817
- handleSuccess();
9818
- },
9819
- onError: (error) => {
9820
- ui.toast.error(error.message);
9821
- }
9822
- }
9823
- );
9824
- });
9825
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9826
- KeyboundForm,
9827
- {
9828
- className: "flex flex-1 flex-col overflow-hidden",
9829
- onSubmit,
9830
- children: [
9831
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9832
- Form$2.Field,
9833
- {
9834
- control: form.control,
9835
- name: "email",
9836
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9837
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9838
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9839
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9840
- ] })
9841
- }
9842
- ) }),
9843
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9844
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9845
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9846
- ] }) })
9847
- ]
9848
- }
9849
- ) });
9850
- };
9851
- const schema$3 = objectType({
9595
+ const schema$5 = objectType({
9852
9596
  email: stringType().email()
9853
9597
  });
9854
9598
  const NumberInput = React.forwardRef(
@@ -10721,110 +10465,368 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
10721
10465
  quantity: 1,
10722
10466
  unit_price: ""
10723
10467
  },
10724
- resolver: zod.zodResolver(customItemSchema)
10468
+ resolver: zod.zodResolver(customItemSchema)
10469
+ });
10470
+ const onSubmit = form.handleSubmit(async (data) => {
10471
+ await addItems(
10472
+ {
10473
+ items: [
10474
+ {
10475
+ title: data.title,
10476
+ quantity: data.quantity,
10477
+ unit_price: convertNumber(data.unit_price)
10478
+ }
10479
+ ]
10480
+ },
10481
+ {
10482
+ onSuccess: () => {
10483
+ setIsOpen(STACKED_MODAL_ID, false);
10484
+ },
10485
+ onError: (e) => {
10486
+ ui.toast.error(e.message);
10487
+ }
10488
+ }
10489
+ );
10490
+ });
10491
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx(KeyboundForm, { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs(StackedFocusModal.Content, { children: [
10492
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Header, {}),
10493
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-2 py-16", children: [
10494
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10495
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Add custom item" }) }),
10496
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a custom item to the order. This will add a new line item that is not associated with an existing product." }) })
10497
+ ] }),
10498
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
10499
+ /* @__PURE__ */ jsxRuntime.jsx(
10500
+ Form$2.Field,
10501
+ {
10502
+ control: form.control,
10503
+ name: "title",
10504
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10505
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10506
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Title" }),
10507
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the title of the item" })
10508
+ ] }),
10509
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10510
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10511
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10512
+ ] })
10513
+ ] }) })
10514
+ }
10515
+ ),
10516
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
10517
+ /* @__PURE__ */ jsxRuntime.jsx(
10518
+ Form$2.Field,
10519
+ {
10520
+ control: form.control,
10521
+ name: "unit_price",
10522
+ render: ({ field: { onChange, ...field } }) => /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10523
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10524
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Unit price" }),
10525
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the unit price of the item" })
10526
+ ] }),
10527
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10528
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
10529
+ ui.CurrencyInput,
10530
+ {
10531
+ symbol: getNativeSymbol(currencyCode),
10532
+ code: currencyCode,
10533
+ onValueChange: (_value, _name, values) => onChange(values == null ? void 0 : values.value),
10534
+ ...field
10535
+ }
10536
+ ) }),
10537
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10538
+ ] })
10539
+ ] }) })
10540
+ }
10541
+ ),
10542
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
10543
+ /* @__PURE__ */ jsxRuntime.jsx(
10544
+ Form$2.Field,
10545
+ {
10546
+ control: form.control,
10547
+ name: "quantity",
10548
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10549
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10550
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Quantity" }),
10551
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
10552
+ ] }),
10553
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex-1", children: [
10554
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10555
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10556
+ ] })
10557
+ ] }) })
10558
+ }
10559
+ )
10560
+ ] }) }) }),
10561
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10562
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10563
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10564
+ ] }) })
10565
+ ] }) }) });
10566
+ };
10567
+ const customItemSchema = objectType({
10568
+ title: stringType().min(1),
10569
+ quantity: numberType(),
10570
+ unit_price: unionType([numberType(), stringType()])
10571
+ });
10572
+ const Email = () => {
10573
+ const { id } = reactRouterDom.useParams();
10574
+ const { order, isPending, isError, error } = useOrder(id, {
10575
+ fields: "+email"
10576
+ });
10577
+ if (isError) {
10578
+ throw error;
10579
+ }
10580
+ const isReady = !isPending && !!order;
10581
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10582
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10583
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
10584
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
10585
+ ] }),
10586
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
10587
+ ] });
10588
+ };
10589
+ const EmailForm = ({ order }) => {
10590
+ const form = reactHookForm.useForm({
10591
+ defaultValues: {
10592
+ email: order.email ?? ""
10593
+ },
10594
+ resolver: zod.zodResolver(schema$4)
10595
+ });
10596
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10597
+ const { handleSuccess } = useRouteModal();
10598
+ const onSubmit = form.handleSubmit(async (data) => {
10599
+ await mutateAsync(
10600
+ { email: data.email },
10601
+ {
10602
+ onSuccess: () => {
10603
+ handleSuccess();
10604
+ },
10605
+ onError: (error) => {
10606
+ ui.toast.error(error.message);
10607
+ }
10608
+ }
10609
+ );
10610
+ });
10611
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10612
+ KeyboundForm,
10613
+ {
10614
+ className: "flex flex-1 flex-col overflow-hidden",
10615
+ onSubmit,
10616
+ children: [
10617
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
10618
+ Form$2.Field,
10619
+ {
10620
+ control: form.control,
10621
+ name: "email",
10622
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10623
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
10624
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10625
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10626
+ ] })
10627
+ }
10628
+ ) }),
10629
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10630
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10631
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10632
+ ] }) })
10633
+ ]
10634
+ }
10635
+ ) });
10636
+ };
10637
+ const schema$4 = objectType({
10638
+ email: stringType().email()
10639
+ });
10640
+ const BillingAddress = () => {
10641
+ const { id } = reactRouterDom.useParams();
10642
+ const { order, isPending, isError, error } = useOrder(id, {
10643
+ fields: "+billing_address"
10644
+ });
10645
+ if (isError) {
10646
+ throw error;
10647
+ }
10648
+ const isReady = !isPending && !!order;
10649
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10650
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10651
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
10652
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10653
+ ] }),
10654
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
10655
+ ] });
10656
+ };
10657
+ const BillingAddressForm = ({ order }) => {
10658
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10659
+ const form = reactHookForm.useForm({
10660
+ defaultValues: {
10661
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10662
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10663
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10664
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10665
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10666
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10667
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10668
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10669
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
10670
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
10671
+ },
10672
+ resolver: zod.zodResolver(schema$3)
10725
10673
  });
10674
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10675
+ const { handleSuccess } = useRouteModal();
10726
10676
  const onSubmit = form.handleSubmit(async (data) => {
10727
- await addItems(
10728
- {
10729
- items: [
10730
- {
10731
- title: data.title,
10732
- quantity: data.quantity,
10733
- unit_price: convertNumber(data.unit_price)
10734
- }
10735
- ]
10736
- },
10677
+ await mutateAsync(
10678
+ { billing_address: data },
10737
10679
  {
10738
10680
  onSuccess: () => {
10739
- setIsOpen(STACKED_MODAL_ID, false);
10681
+ handleSuccess();
10740
10682
  },
10741
- onError: (e) => {
10742
- ui.toast.error(e.message);
10683
+ onError: (error) => {
10684
+ ui.toast.error(error.message);
10743
10685
  }
10744
10686
  }
10745
10687
  );
10746
10688
  });
10747
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx(KeyboundForm, { onSubmit, children: /* @__PURE__ */ jsxRuntime.jsxs(StackedFocusModal.Content, { children: [
10748
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Header, {}),
10749
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-2 py-16", children: [
10750
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10751
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Add custom item" }) }),
10752
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a custom item to the order. This will add a new line item that is not associated with an existing product." }) })
10753
- ] }),
10754
- /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
10755
- /* @__PURE__ */ jsxRuntime.jsx(
10756
- Form$2.Field,
10757
- {
10758
- control: form.control,
10759
- name: "title",
10760
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10761
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10762
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Title" }),
10763
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the title of the item" })
10764
- ] }),
10765
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10766
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10767
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10768
- ] })
10769
- ] }) })
10770
- }
10771
- ),
10772
- /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
10773
- /* @__PURE__ */ jsxRuntime.jsx(
10774
- Form$2.Field,
10775
- {
10776
- control: form.control,
10777
- name: "unit_price",
10778
- render: ({ field: { onChange, ...field } }) => /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10779
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10780
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Unit price" }),
10781
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the unit price of the item" })
10782
- ] }),
10783
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10784
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
10785
- ui.CurrencyInput,
10786
- {
10787
- symbol: getNativeSymbol(currencyCode),
10788
- code: currencyCode,
10789
- onValueChange: (_value, _name, values) => onChange(values == null ? void 0 : values.value),
10790
- ...field
10791
- }
10792
- ) }),
10793
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10794
- ] })
10795
- ] }) })
10796
- }
10797
- ),
10798
- /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
10799
- /* @__PURE__ */ jsxRuntime.jsx(
10800
- Form$2.Field,
10801
- {
10802
- control: form.control,
10803
- name: "quantity",
10804
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
10805
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10806
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Quantity" }),
10807
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
10808
- ] }),
10809
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex-1", children: [
10810
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10811
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10812
- ] })
10813
- ] }) })
10814
- }
10815
- )
10816
- ] }) }) }),
10817
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10818
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10819
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10820
- ] }) })
10821
- ] }) }) });
10689
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10690
+ KeyboundForm,
10691
+ {
10692
+ className: "flex flex-1 flex-col overflow-hidden",
10693
+ onSubmit,
10694
+ children: [
10695
+ /* @__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: [
10696
+ /* @__PURE__ */ jsxRuntime.jsx(
10697
+ Form$2.Field,
10698
+ {
10699
+ control: form.control,
10700
+ name: "country_code",
10701
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10702
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
10703
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
10704
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10705
+ ] })
10706
+ }
10707
+ ),
10708
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10709
+ /* @__PURE__ */ jsxRuntime.jsx(
10710
+ Form$2.Field,
10711
+ {
10712
+ control: form.control,
10713
+ name: "first_name",
10714
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10715
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
10716
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10717
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10718
+ ] })
10719
+ }
10720
+ ),
10721
+ /* @__PURE__ */ jsxRuntime.jsx(
10722
+ Form$2.Field,
10723
+ {
10724
+ control: form.control,
10725
+ name: "last_name",
10726
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10727
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
10728
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10729
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10730
+ ] })
10731
+ }
10732
+ )
10733
+ ] }),
10734
+ /* @__PURE__ */ jsxRuntime.jsx(
10735
+ Form$2.Field,
10736
+ {
10737
+ control: form.control,
10738
+ name: "company",
10739
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10740
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
10741
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10742
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10743
+ ] })
10744
+ }
10745
+ ),
10746
+ /* @__PURE__ */ jsxRuntime.jsx(
10747
+ Form$2.Field,
10748
+ {
10749
+ control: form.control,
10750
+ name: "address_1",
10751
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10752
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
10753
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10754
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10755
+ ] })
10756
+ }
10757
+ ),
10758
+ /* @__PURE__ */ jsxRuntime.jsx(
10759
+ Form$2.Field,
10760
+ {
10761
+ control: form.control,
10762
+ name: "address_2",
10763
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10764
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
10765
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10766
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10767
+ ] })
10768
+ }
10769
+ ),
10770
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10771
+ /* @__PURE__ */ jsxRuntime.jsx(
10772
+ Form$2.Field,
10773
+ {
10774
+ control: form.control,
10775
+ name: "postal_code",
10776
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10777
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
10778
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10779
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10780
+ ] })
10781
+ }
10782
+ ),
10783
+ /* @__PURE__ */ jsxRuntime.jsx(
10784
+ Form$2.Field,
10785
+ {
10786
+ control: form.control,
10787
+ name: "city",
10788
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10789
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
10790
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10791
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10792
+ ] })
10793
+ }
10794
+ )
10795
+ ] }),
10796
+ /* @__PURE__ */ jsxRuntime.jsx(
10797
+ Form$2.Field,
10798
+ {
10799
+ control: form.control,
10800
+ name: "province",
10801
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10802
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
10803
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10804
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10805
+ ] })
10806
+ }
10807
+ ),
10808
+ /* @__PURE__ */ jsxRuntime.jsx(
10809
+ Form$2.Field,
10810
+ {
10811
+ control: form.control,
10812
+ name: "phone",
10813
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10814
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
10815
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10816
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10817
+ ] })
10818
+ }
10819
+ )
10820
+ ] }) }),
10821
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10822
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10823
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10824
+ ] }) })
10825
+ ]
10826
+ }
10827
+ ) });
10822
10828
  };
10823
- const customItemSchema = objectType({
10824
- title: stringType().min(1),
10825
- quantity: numberType(),
10826
- unit_price: unionType([numberType(), stringType()])
10827
- });
10829
+ const schema$3 = addressSchema;
10828
10830
  const InlineTip = React.forwardRef(
10829
10831
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10830
10832
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -13064,21 +13066,21 @@ const routeModule = {
13064
13066
  handle,
13065
13067
  loader,
13066
13068
  children: [
13067
- {
13068
- Component: BillingAddress,
13069
- path: "/draft-orders/:id/billing-address"
13070
- },
13071
13069
  {
13072
13070
  Component: CustomItems,
13073
13071
  path: "/draft-orders/:id/custom-items"
13074
13072
  },
13073
+ {
13074
+ Component: Items,
13075
+ path: "/draft-orders/:id/items"
13076
+ },
13075
13077
  {
13076
13078
  Component: Email,
13077
13079
  path: "/draft-orders/:id/email"
13078
13080
  },
13079
13081
  {
13080
- Component: Items,
13081
- path: "/draft-orders/:id/items"
13082
+ Component: BillingAddress,
13083
+ path: "/draft-orders/:id/billing-address"
13082
13084
  },
13083
13085
  {
13084
13086
  Component: Metadata,