@medusajs/draft-order 2.11.2-preview-20251028100508 → 2.11.2-snapshot-20251028102245

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.
@@ -9565,27 +9565,196 @@ const ID = () => {
9565
9565
  /* @__PURE__ */ jsx(Outlet, {})
9566
9566
  ] });
9567
9567
  };
9568
- const CustomItems = () => {
9568
+ const BillingAddress = () => {
9569
+ const { id } = useParams();
9570
+ const { order, isPending, isError, error } = useOrder(id, {
9571
+ fields: "+billing_address"
9572
+ });
9573
+ if (isError) {
9574
+ throw error;
9575
+ }
9576
+ const isReady = !isPending && !!order;
9569
9577
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9570
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9571
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9578
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9579
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9580
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9581
+ ] }),
9582
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9572
9583
  ] });
9573
9584
  };
9574
- const CustomItemsForm = () => {
9585
+ const BillingAddressForm = ({ order }) => {
9586
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9575
9587
  const form = useForm({
9588
+ defaultValues: {
9589
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9590
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9591
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9592
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9593
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9594
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9595
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9596
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9597
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9598
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9599
+ },
9576
9600
  resolver: zodResolver(schema$5)
9577
9601
  });
9578
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9579
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9580
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9581
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9582
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9583
- ] }) })
9584
- ] }) });
9602
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9603
+ const { handleSuccess } = useRouteModal();
9604
+ const onSubmit = form.handleSubmit(async (data) => {
9605
+ await mutateAsync(
9606
+ { billing_address: data },
9607
+ {
9608
+ onSuccess: () => {
9609
+ handleSuccess();
9610
+ },
9611
+ onError: (error) => {
9612
+ toast.error(error.message);
9613
+ }
9614
+ }
9615
+ );
9616
+ });
9617
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9618
+ KeyboundForm,
9619
+ {
9620
+ className: "flex flex-1 flex-col overflow-hidden",
9621
+ onSubmit,
9622
+ children: [
9623
+ /* @__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: [
9624
+ /* @__PURE__ */ jsx(
9625
+ Form$2.Field,
9626
+ {
9627
+ control: form.control,
9628
+ name: "country_code",
9629
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9630
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9631
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9632
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9633
+ ] })
9634
+ }
9635
+ ),
9636
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9637
+ /* @__PURE__ */ jsx(
9638
+ Form$2.Field,
9639
+ {
9640
+ control: form.control,
9641
+ name: "first_name",
9642
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9643
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9644
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9645
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9646
+ ] })
9647
+ }
9648
+ ),
9649
+ /* @__PURE__ */ jsx(
9650
+ Form$2.Field,
9651
+ {
9652
+ control: form.control,
9653
+ name: "last_name",
9654
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9655
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9656
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9657
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9658
+ ] })
9659
+ }
9660
+ )
9661
+ ] }),
9662
+ /* @__PURE__ */ jsx(
9663
+ Form$2.Field,
9664
+ {
9665
+ control: form.control,
9666
+ name: "company",
9667
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9668
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9669
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9670
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9671
+ ] })
9672
+ }
9673
+ ),
9674
+ /* @__PURE__ */ jsx(
9675
+ Form$2.Field,
9676
+ {
9677
+ control: form.control,
9678
+ name: "address_1",
9679
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9680
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9681
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9682
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9683
+ ] })
9684
+ }
9685
+ ),
9686
+ /* @__PURE__ */ jsx(
9687
+ Form$2.Field,
9688
+ {
9689
+ control: form.control,
9690
+ name: "address_2",
9691
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9692
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9693
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9694
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9695
+ ] })
9696
+ }
9697
+ ),
9698
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9699
+ /* @__PURE__ */ jsx(
9700
+ Form$2.Field,
9701
+ {
9702
+ control: form.control,
9703
+ name: "postal_code",
9704
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9705
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9706
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9707
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9708
+ ] })
9709
+ }
9710
+ ),
9711
+ /* @__PURE__ */ jsx(
9712
+ Form$2.Field,
9713
+ {
9714
+ control: form.control,
9715
+ name: "city",
9716
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9717
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9718
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9719
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9720
+ ] })
9721
+ }
9722
+ )
9723
+ ] }),
9724
+ /* @__PURE__ */ jsx(
9725
+ Form$2.Field,
9726
+ {
9727
+ control: form.control,
9728
+ name: "province",
9729
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9730
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9731
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9732
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9733
+ ] })
9734
+ }
9735
+ ),
9736
+ /* @__PURE__ */ jsx(
9737
+ Form$2.Field,
9738
+ {
9739
+ control: form.control,
9740
+ name: "phone",
9741
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9742
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9743
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9744
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9745
+ ] })
9746
+ }
9747
+ )
9748
+ ] }) }),
9749
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9750
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9751
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9752
+ ] }) })
9753
+ ]
9754
+ }
9755
+ ) });
9585
9756
  };
9586
- const schema$5 = objectType({
9587
- email: stringType().email()
9588
- });
9757
+ const schema$5 = addressSchema;
9589
9758
  const Email = () => {
9590
9759
  const { id } = useParams();
9591
9760
  const { order, isPending, isError, error } = useOrder(id, {
@@ -10628,10 +10797,54 @@ const customItemSchema = objectType({
10628
10797
  quantity: numberType(),
10629
10798
  unit_price: unionType([numberType(), stringType()])
10630
10799
  });
10631
- const BillingAddress = () => {
10800
+ const InlineTip = forwardRef(
10801
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
10802
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10803
+ return /* @__PURE__ */ jsxs(
10804
+ "div",
10805
+ {
10806
+ ref,
10807
+ className: clx(
10808
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10809
+ className
10810
+ ),
10811
+ ...props,
10812
+ children: [
10813
+ /* @__PURE__ */ jsx(
10814
+ "div",
10815
+ {
10816
+ role: "presentation",
10817
+ className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10818
+ "bg-ui-tag-orange-icon": variant === "warning"
10819
+ })
10820
+ }
10821
+ ),
10822
+ /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10823
+ /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10824
+ labelValue,
10825
+ ":"
10826
+ ] }),
10827
+ " ",
10828
+ children
10829
+ ] })
10830
+ ]
10831
+ }
10832
+ );
10833
+ }
10834
+ );
10835
+ InlineTip.displayName = "InlineTip";
10836
+ const MetadataFieldSchema = objectType({
10837
+ key: stringType(),
10838
+ disabled: booleanType().optional(),
10839
+ value: anyType()
10840
+ });
10841
+ const MetadataSchema = objectType({
10842
+ metadata: arrayType(MetadataFieldSchema)
10843
+ });
10844
+ const Metadata = () => {
10632
10845
  const { id } = useParams();
10633
10846
  const { order, isPending, isError, error } = useOrder(id, {
10634
- fields: "+billing_address"
10847
+ fields: "metadata"
10635
10848
  });
10636
10849
  if (isError) {
10637
10850
  throw error;
@@ -10639,244 +10852,10 @@ const BillingAddress = () => {
10639
10852
  const isReady = !isPending && !!order;
10640
10853
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10641
10854
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10642
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
10643
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10855
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10856
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10644
10857
  ] }),
10645
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
10646
- ] });
10647
- };
10648
- const BillingAddressForm = ({ order }) => {
10649
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10650
- const form = useForm({
10651
- defaultValues: {
10652
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10653
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10654
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10655
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10656
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10657
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10658
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10659
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10660
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
10661
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
10662
- },
10663
- resolver: zodResolver(schema$3)
10664
- });
10665
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10666
- const { handleSuccess } = useRouteModal();
10667
- const onSubmit = form.handleSubmit(async (data) => {
10668
- await mutateAsync(
10669
- { billing_address: data },
10670
- {
10671
- onSuccess: () => {
10672
- handleSuccess();
10673
- },
10674
- onError: (error) => {
10675
- toast.error(error.message);
10676
- }
10677
- }
10678
- );
10679
- });
10680
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10681
- KeyboundForm,
10682
- {
10683
- className: "flex flex-1 flex-col overflow-hidden",
10684
- onSubmit,
10685
- children: [
10686
- /* @__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: [
10687
- /* @__PURE__ */ jsx(
10688
- Form$2.Field,
10689
- {
10690
- control: form.control,
10691
- name: "country_code",
10692
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10693
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
10694
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
10695
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10696
- ] })
10697
- }
10698
- ),
10699
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10700
- /* @__PURE__ */ jsx(
10701
- Form$2.Field,
10702
- {
10703
- control: form.control,
10704
- name: "first_name",
10705
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10706
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
10707
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10708
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10709
- ] })
10710
- }
10711
- ),
10712
- /* @__PURE__ */ jsx(
10713
- Form$2.Field,
10714
- {
10715
- control: form.control,
10716
- name: "last_name",
10717
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10718
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
10719
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10720
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10721
- ] })
10722
- }
10723
- )
10724
- ] }),
10725
- /* @__PURE__ */ jsx(
10726
- Form$2.Field,
10727
- {
10728
- control: form.control,
10729
- name: "company",
10730
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10731
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
10732
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10733
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10734
- ] })
10735
- }
10736
- ),
10737
- /* @__PURE__ */ jsx(
10738
- Form$2.Field,
10739
- {
10740
- control: form.control,
10741
- name: "address_1",
10742
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10743
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
10744
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10745
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10746
- ] })
10747
- }
10748
- ),
10749
- /* @__PURE__ */ jsx(
10750
- Form$2.Field,
10751
- {
10752
- control: form.control,
10753
- name: "address_2",
10754
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10755
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
10756
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10757
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10758
- ] })
10759
- }
10760
- ),
10761
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10762
- /* @__PURE__ */ jsx(
10763
- Form$2.Field,
10764
- {
10765
- control: form.control,
10766
- name: "postal_code",
10767
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10768
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
10769
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10770
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10771
- ] })
10772
- }
10773
- ),
10774
- /* @__PURE__ */ jsx(
10775
- Form$2.Field,
10776
- {
10777
- control: form.control,
10778
- name: "city",
10779
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10780
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
10781
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10782
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10783
- ] })
10784
- }
10785
- )
10786
- ] }),
10787
- /* @__PURE__ */ jsx(
10788
- Form$2.Field,
10789
- {
10790
- control: form.control,
10791
- name: "province",
10792
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10793
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
10794
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10795
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10796
- ] })
10797
- }
10798
- ),
10799
- /* @__PURE__ */ jsx(
10800
- Form$2.Field,
10801
- {
10802
- control: form.control,
10803
- name: "phone",
10804
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10805
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
10806
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10807
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10808
- ] })
10809
- }
10810
- )
10811
- ] }) }),
10812
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10813
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10814
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10815
- ] }) })
10816
- ]
10817
- }
10818
- ) });
10819
- };
10820
- const schema$3 = addressSchema;
10821
- const InlineTip = forwardRef(
10822
- ({ variant = "tip", label, className, children, ...props }, ref) => {
10823
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10824
- return /* @__PURE__ */ jsxs(
10825
- "div",
10826
- {
10827
- ref,
10828
- className: clx(
10829
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10830
- className
10831
- ),
10832
- ...props,
10833
- children: [
10834
- /* @__PURE__ */ jsx(
10835
- "div",
10836
- {
10837
- role: "presentation",
10838
- className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10839
- "bg-ui-tag-orange-icon": variant === "warning"
10840
- })
10841
- }
10842
- ),
10843
- /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10844
- /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10845
- labelValue,
10846
- ":"
10847
- ] }),
10848
- " ",
10849
- children
10850
- ] })
10851
- ]
10852
- }
10853
- );
10854
- }
10855
- );
10856
- InlineTip.displayName = "InlineTip";
10857
- const MetadataFieldSchema = objectType({
10858
- key: stringType(),
10859
- disabled: booleanType().optional(),
10860
- value: anyType()
10861
- });
10862
- const MetadataSchema = objectType({
10863
- metadata: arrayType(MetadataFieldSchema)
10864
- });
10865
- const Metadata = () => {
10866
- const { id } = useParams();
10867
- const { order, isPending, isError, error } = useOrder(id, {
10868
- fields: "metadata"
10869
- });
10870
- if (isError) {
10871
- throw error;
10872
- }
10873
- const isReady = !isPending && !!order;
10874
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10875
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10876
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10877
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10878
- ] }),
10879
- !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10858
+ !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10880
10859
  ] });
10881
10860
  };
10882
10861
  const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
@@ -11473,7 +11452,7 @@ const SalesChannelForm = ({ order }) => {
11473
11452
  defaultValues: {
11474
11453
  sales_channel_id: order.sales_channel_id || ""
11475
11454
  },
11476
- resolver: zodResolver(schema$2)
11455
+ resolver: zodResolver(schema$3)
11477
11456
  });
11478
11457
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11479
11458
  const { handleSuccess } = useRouteModal();
@@ -11546,11 +11525,214 @@ const SalesChannelField = ({ control, order }) => {
11546
11525
  ] });
11547
11526
  }
11548
11527
  }
11549
- );
11528
+ );
11529
+ };
11530
+ const schema$3 = objectType({
11531
+ sales_channel_id: stringType().min(1)
11532
+ });
11533
+ const ShippingAddress = () => {
11534
+ const { id } = useParams();
11535
+ const { order, isPending, isError, error } = useOrder(id, {
11536
+ fields: "+shipping_address"
11537
+ });
11538
+ if (isError) {
11539
+ throw error;
11540
+ }
11541
+ const isReady = !isPending && !!order;
11542
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11543
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11544
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11545
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11546
+ ] }),
11547
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11548
+ ] });
11549
+ };
11550
+ const ShippingAddressForm = ({ order }) => {
11551
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11552
+ const form = useForm({
11553
+ defaultValues: {
11554
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11555
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11556
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11557
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11558
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11559
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11560
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11561
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11562
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11563
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11564
+ },
11565
+ resolver: zodResolver(schema$2)
11566
+ });
11567
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11568
+ const { handleSuccess } = useRouteModal();
11569
+ const onSubmit = form.handleSubmit(async (data) => {
11570
+ await mutateAsync(
11571
+ {
11572
+ shipping_address: {
11573
+ first_name: data.first_name,
11574
+ last_name: data.last_name,
11575
+ company: data.company,
11576
+ address_1: data.address_1,
11577
+ address_2: data.address_2,
11578
+ city: data.city,
11579
+ province: data.province,
11580
+ country_code: data.country_code,
11581
+ postal_code: data.postal_code,
11582
+ phone: data.phone
11583
+ }
11584
+ },
11585
+ {
11586
+ onSuccess: () => {
11587
+ handleSuccess();
11588
+ },
11589
+ onError: (error) => {
11590
+ toast.error(error.message);
11591
+ }
11592
+ }
11593
+ );
11594
+ });
11595
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11596
+ KeyboundForm,
11597
+ {
11598
+ className: "flex flex-1 flex-col overflow-hidden",
11599
+ onSubmit,
11600
+ children: [
11601
+ /* @__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: [
11602
+ /* @__PURE__ */ jsx(
11603
+ Form$2.Field,
11604
+ {
11605
+ control: form.control,
11606
+ name: "country_code",
11607
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11608
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11609
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11610
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11611
+ ] })
11612
+ }
11613
+ ),
11614
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11615
+ /* @__PURE__ */ jsx(
11616
+ Form$2.Field,
11617
+ {
11618
+ control: form.control,
11619
+ name: "first_name",
11620
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11621
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11622
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11623
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11624
+ ] })
11625
+ }
11626
+ ),
11627
+ /* @__PURE__ */ jsx(
11628
+ Form$2.Field,
11629
+ {
11630
+ control: form.control,
11631
+ name: "last_name",
11632
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11633
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11634
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11635
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11636
+ ] })
11637
+ }
11638
+ )
11639
+ ] }),
11640
+ /* @__PURE__ */ jsx(
11641
+ Form$2.Field,
11642
+ {
11643
+ control: form.control,
11644
+ name: "company",
11645
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11646
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11647
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11648
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11649
+ ] })
11650
+ }
11651
+ ),
11652
+ /* @__PURE__ */ jsx(
11653
+ Form$2.Field,
11654
+ {
11655
+ control: form.control,
11656
+ name: "address_1",
11657
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11658
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11659
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11660
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11661
+ ] })
11662
+ }
11663
+ ),
11664
+ /* @__PURE__ */ jsx(
11665
+ Form$2.Field,
11666
+ {
11667
+ control: form.control,
11668
+ name: "address_2",
11669
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11670
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11671
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11672
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11673
+ ] })
11674
+ }
11675
+ ),
11676
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11677
+ /* @__PURE__ */ jsx(
11678
+ Form$2.Field,
11679
+ {
11680
+ control: form.control,
11681
+ name: "postal_code",
11682
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11683
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11684
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11685
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11686
+ ] })
11687
+ }
11688
+ ),
11689
+ /* @__PURE__ */ jsx(
11690
+ Form$2.Field,
11691
+ {
11692
+ control: form.control,
11693
+ name: "city",
11694
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11695
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11696
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11697
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11698
+ ] })
11699
+ }
11700
+ )
11701
+ ] }),
11702
+ /* @__PURE__ */ jsx(
11703
+ Form$2.Field,
11704
+ {
11705
+ control: form.control,
11706
+ name: "province",
11707
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11708
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11709
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11710
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11711
+ ] })
11712
+ }
11713
+ ),
11714
+ /* @__PURE__ */ jsx(
11715
+ Form$2.Field,
11716
+ {
11717
+ control: form.control,
11718
+ name: "phone",
11719
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11720
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11721
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11722
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11723
+ ] })
11724
+ }
11725
+ )
11726
+ ] }) }),
11727
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11728
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11729
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11730
+ ] }) })
11731
+ ]
11732
+ }
11733
+ ) });
11550
11734
  };
11551
- const schema$2 = objectType({
11552
- sales_channel_id: stringType().min(1)
11553
- });
11735
+ const schema$2 = addressSchema;
11554
11736
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11555
11737
  const Shipping = () => {
11556
11738
  var _a;
@@ -12358,209 +12540,6 @@ const CustomAmountField = ({
12358
12540
  }
12359
12541
  );
12360
12542
  };
12361
- const ShippingAddress = () => {
12362
- const { id } = useParams();
12363
- const { order, isPending, isError, error } = useOrder(id, {
12364
- fields: "+shipping_address"
12365
- });
12366
- if (isError) {
12367
- throw error;
12368
- }
12369
- const isReady = !isPending && !!order;
12370
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12371
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12372
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12373
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12374
- ] }),
12375
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12376
- ] });
12377
- };
12378
- const ShippingAddressForm = ({ order }) => {
12379
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12380
- const form = useForm({
12381
- defaultValues: {
12382
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12383
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12384
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12385
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12386
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12387
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12388
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12389
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12390
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12391
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12392
- },
12393
- resolver: zodResolver(schema$1)
12394
- });
12395
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12396
- const { handleSuccess } = useRouteModal();
12397
- const onSubmit = form.handleSubmit(async (data) => {
12398
- await mutateAsync(
12399
- {
12400
- shipping_address: {
12401
- first_name: data.first_name,
12402
- last_name: data.last_name,
12403
- company: data.company,
12404
- address_1: data.address_1,
12405
- address_2: data.address_2,
12406
- city: data.city,
12407
- province: data.province,
12408
- country_code: data.country_code,
12409
- postal_code: data.postal_code,
12410
- phone: data.phone
12411
- }
12412
- },
12413
- {
12414
- onSuccess: () => {
12415
- handleSuccess();
12416
- },
12417
- onError: (error) => {
12418
- toast.error(error.message);
12419
- }
12420
- }
12421
- );
12422
- });
12423
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12424
- KeyboundForm,
12425
- {
12426
- className: "flex flex-1 flex-col overflow-hidden",
12427
- onSubmit,
12428
- children: [
12429
- /* @__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: [
12430
- /* @__PURE__ */ jsx(
12431
- Form$2.Field,
12432
- {
12433
- control: form.control,
12434
- name: "country_code",
12435
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12436
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12437
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12438
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12439
- ] })
12440
- }
12441
- ),
12442
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12443
- /* @__PURE__ */ jsx(
12444
- Form$2.Field,
12445
- {
12446
- control: form.control,
12447
- name: "first_name",
12448
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12449
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12450
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12451
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12452
- ] })
12453
- }
12454
- ),
12455
- /* @__PURE__ */ jsx(
12456
- Form$2.Field,
12457
- {
12458
- control: form.control,
12459
- name: "last_name",
12460
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12461
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12462
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12463
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12464
- ] })
12465
- }
12466
- )
12467
- ] }),
12468
- /* @__PURE__ */ jsx(
12469
- Form$2.Field,
12470
- {
12471
- control: form.control,
12472
- name: "company",
12473
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12474
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12475
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12476
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12477
- ] })
12478
- }
12479
- ),
12480
- /* @__PURE__ */ jsx(
12481
- Form$2.Field,
12482
- {
12483
- control: form.control,
12484
- name: "address_1",
12485
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12486
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12487
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12488
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12489
- ] })
12490
- }
12491
- ),
12492
- /* @__PURE__ */ jsx(
12493
- Form$2.Field,
12494
- {
12495
- control: form.control,
12496
- name: "address_2",
12497
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12498
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12499
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12500
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12501
- ] })
12502
- }
12503
- ),
12504
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12505
- /* @__PURE__ */ jsx(
12506
- Form$2.Field,
12507
- {
12508
- control: form.control,
12509
- name: "postal_code",
12510
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12511
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12512
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12513
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12514
- ] })
12515
- }
12516
- ),
12517
- /* @__PURE__ */ jsx(
12518
- Form$2.Field,
12519
- {
12520
- control: form.control,
12521
- name: "city",
12522
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12523
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12524
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12525
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12526
- ] })
12527
- }
12528
- )
12529
- ] }),
12530
- /* @__PURE__ */ jsx(
12531
- Form$2.Field,
12532
- {
12533
- control: form.control,
12534
- name: "province",
12535
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12536
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12537
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12538
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12539
- ] })
12540
- }
12541
- ),
12542
- /* @__PURE__ */ jsx(
12543
- Form$2.Field,
12544
- {
12545
- control: form.control,
12546
- name: "phone",
12547
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12548
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12549
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12550
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12551
- ] })
12552
- }
12553
- )
12554
- ] }) }),
12555
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12556
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12557
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12558
- ] }) })
12559
- ]
12560
- }
12561
- ) });
12562
- };
12563
- const schema$1 = addressSchema;
12564
12543
  const TransferOwnership = () => {
12565
12544
  const { id } = useParams();
12566
12545
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12584,7 +12563,7 @@ const TransferOwnershipForm = ({ order }) => {
12584
12563
  defaultValues: {
12585
12564
  customer_id: order.customer_id || ""
12586
12565
  },
12587
- resolver: zodResolver(schema)
12566
+ resolver: zodResolver(schema$1)
12588
12567
  });
12589
12568
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12590
12569
  const { handleSuccess } = useRouteModal();
@@ -13034,9 +13013,30 @@ const Illustration = () => {
13034
13013
  }
13035
13014
  );
13036
13015
  };
13037
- const schema = objectType({
13016
+ const schema$1 = objectType({
13038
13017
  customer_id: stringType().min(1)
13039
13018
  });
13019
+ const CustomItems = () => {
13020
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
13021
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13022
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
13023
+ ] });
13024
+ };
13025
+ const CustomItemsForm = () => {
13026
+ const form = useForm({
13027
+ resolver: zodResolver(schema)
13028
+ });
13029
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13030
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13031
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13034
+ ] }) })
13035
+ ] }) });
13036
+ };
13037
+ const schema = objectType({
13038
+ email: stringType().email()
13039
+ });
13040
13040
  const widgetModule = { widgets: [] };
13041
13041
  const routeModule = {
13042
13042
  routes: [
@@ -13058,8 +13058,8 @@ const routeModule = {
13058
13058
  loader,
13059
13059
  children: [
13060
13060
  {
13061
- Component: CustomItems,
13062
- path: "/draft-orders/:id/custom-items"
13061
+ Component: BillingAddress,
13062
+ path: "/draft-orders/:id/billing-address"
13063
13063
  },
13064
13064
  {
13065
13065
  Component: Email,
@@ -13069,10 +13069,6 @@ const routeModule = {
13069
13069
  Component: Items,
13070
13070
  path: "/draft-orders/:id/items"
13071
13071
  },
13072
- {
13073
- Component: BillingAddress,
13074
- path: "/draft-orders/:id/billing-address"
13075
- },
13076
13072
  {
13077
13073
  Component: Metadata,
13078
13074
  path: "/draft-orders/:id/metadata"
@@ -13085,17 +13081,21 @@ const routeModule = {
13085
13081
  Component: SalesChannel,
13086
13082
  path: "/draft-orders/:id/sales-channel"
13087
13083
  },
13088
- {
13089
- Component: Shipping,
13090
- path: "/draft-orders/:id/shipping"
13091
- },
13092
13084
  {
13093
13085
  Component: ShippingAddress,
13094
13086
  path: "/draft-orders/:id/shipping-address"
13095
13087
  },
13088
+ {
13089
+ Component: Shipping,
13090
+ path: "/draft-orders/:id/shipping"
13091
+ },
13096
13092
  {
13097
13093
  Component: TransferOwnership,
13098
13094
  path: "/draft-orders/:id/transfer-ownership"
13095
+ },
13096
+ {
13097
+ Component: CustomItems,
13098
+ path: "/draft-orders/:id/custom-items"
13099
13099
  }
13100
13100
  ]
13101
13101
  }