@medusajs/draft-order 2.10.0-preview-20250828120155 → 2.10.0-preview-20250828150148

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.
@@ -9554,6 +9554,196 @@ const ID = () => {
9554
9554
  /* @__PURE__ */ jsx(Outlet, {})
9555
9555
  ] });
9556
9556
  };
9557
+ const BillingAddress = () => {
9558
+ const { id } = useParams();
9559
+ const { order, isPending, isError, error } = useOrder(id, {
9560
+ fields: "+billing_address"
9561
+ });
9562
+ if (isError) {
9563
+ throw error;
9564
+ }
9565
+ const isReady = !isPending && !!order;
9566
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9567
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9568
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9569
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9570
+ ] }),
9571
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9572
+ ] });
9573
+ };
9574
+ const BillingAddressForm = ({ order }) => {
9575
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9576
+ const form = useForm({
9577
+ defaultValues: {
9578
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9579
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9580
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9581
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9582
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9583
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9584
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9585
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9586
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9587
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9588
+ },
9589
+ resolver: zodResolver(schema$5)
9590
+ });
9591
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9592
+ const { handleSuccess } = useRouteModal();
9593
+ const onSubmit = form.handleSubmit(async (data) => {
9594
+ await mutateAsync(
9595
+ { billing_address: data },
9596
+ {
9597
+ onSuccess: () => {
9598
+ handleSuccess();
9599
+ },
9600
+ onError: (error) => {
9601
+ toast.error(error.message);
9602
+ }
9603
+ }
9604
+ );
9605
+ });
9606
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9607
+ KeyboundForm,
9608
+ {
9609
+ className: "flex flex-1 flex-col overflow-hidden",
9610
+ onSubmit,
9611
+ children: [
9612
+ /* @__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: [
9613
+ /* @__PURE__ */ jsx(
9614
+ Form$2.Field,
9615
+ {
9616
+ control: form.control,
9617
+ name: "country_code",
9618
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9619
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9620
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9621
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9622
+ ] })
9623
+ }
9624
+ ),
9625
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9626
+ /* @__PURE__ */ jsx(
9627
+ Form$2.Field,
9628
+ {
9629
+ control: form.control,
9630
+ name: "first_name",
9631
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9633
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9634
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
+ ] })
9636
+ }
9637
+ ),
9638
+ /* @__PURE__ */ jsx(
9639
+ Form$2.Field,
9640
+ {
9641
+ control: form.control,
9642
+ name: "last_name",
9643
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9644
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9645
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9646
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9647
+ ] })
9648
+ }
9649
+ )
9650
+ ] }),
9651
+ /* @__PURE__ */ jsx(
9652
+ Form$2.Field,
9653
+ {
9654
+ control: form.control,
9655
+ name: "company",
9656
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9658
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
+ ] })
9661
+ }
9662
+ ),
9663
+ /* @__PURE__ */ jsx(
9664
+ Form$2.Field,
9665
+ {
9666
+ control: form.control,
9667
+ name: "address_1",
9668
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9669
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9670
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9671
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9672
+ ] })
9673
+ }
9674
+ ),
9675
+ /* @__PURE__ */ jsx(
9676
+ Form$2.Field,
9677
+ {
9678
+ control: form.control,
9679
+ name: "address_2",
9680
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9681
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9682
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9683
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9684
+ ] })
9685
+ }
9686
+ ),
9687
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9688
+ /* @__PURE__ */ jsx(
9689
+ Form$2.Field,
9690
+ {
9691
+ control: form.control,
9692
+ name: "postal_code",
9693
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9695
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
+ ] })
9698
+ }
9699
+ ),
9700
+ /* @__PURE__ */ jsx(
9701
+ Form$2.Field,
9702
+ {
9703
+ control: form.control,
9704
+ name: "city",
9705
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9706
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9707
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9708
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9709
+ ] })
9710
+ }
9711
+ )
9712
+ ] }),
9713
+ /* @__PURE__ */ jsx(
9714
+ Form$2.Field,
9715
+ {
9716
+ control: form.control,
9717
+ name: "province",
9718
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9720
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
+ ] })
9723
+ }
9724
+ ),
9725
+ /* @__PURE__ */ jsx(
9726
+ Form$2.Field,
9727
+ {
9728
+ control: form.control,
9729
+ name: "phone",
9730
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9731
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9732
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9733
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9734
+ ] })
9735
+ }
9736
+ )
9737
+ ] }) }),
9738
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9739
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9740
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9741
+ ] }) })
9742
+ ]
9743
+ }
9744
+ ) });
9745
+ };
9746
+ const schema$5 = addressSchema;
9557
9747
  const CustomItems = () => {
9558
9748
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9559
9749
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9562,7 +9752,7 @@ const CustomItems = () => {
9562
9752
  };
9563
9753
  const CustomItemsForm = () => {
9564
9754
  const form = useForm({
9565
- resolver: zodResolver(schema$5)
9755
+ resolver: zodResolver(schema$4)
9566
9756
  });
9567
9757
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9568
9758
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9572,7 +9762,7 @@ const CustomItemsForm = () => {
9572
9762
  ] }) })
9573
9763
  ] }) });
9574
9764
  };
9575
- const schema$5 = objectType({
9765
+ const schema$4 = objectType({
9576
9766
  email: stringType().email()
9577
9767
  });
9578
9768
  const NumberInput = forwardRef(
@@ -10549,10 +10739,54 @@ const customItemSchema = objectType({
10549
10739
  quantity: numberType(),
10550
10740
  unit_price: unionType([numberType(), stringType()])
10551
10741
  });
10552
- const Email = () => {
10742
+ const InlineTip = forwardRef(
10743
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
10744
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10745
+ return /* @__PURE__ */ jsxs(
10746
+ "div",
10747
+ {
10748
+ ref,
10749
+ className: clx(
10750
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10751
+ className
10752
+ ),
10753
+ ...props,
10754
+ children: [
10755
+ /* @__PURE__ */ jsx(
10756
+ "div",
10757
+ {
10758
+ role: "presentation",
10759
+ className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10760
+ "bg-ui-tag-orange-icon": variant === "warning"
10761
+ })
10762
+ }
10763
+ ),
10764
+ /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10765
+ /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10766
+ labelValue,
10767
+ ":"
10768
+ ] }),
10769
+ " ",
10770
+ children
10771
+ ] })
10772
+ ]
10773
+ }
10774
+ );
10775
+ }
10776
+ );
10777
+ InlineTip.displayName = "InlineTip";
10778
+ const MetadataFieldSchema = objectType({
10779
+ key: stringType(),
10780
+ disabled: booleanType().optional(),
10781
+ value: anyType()
10782
+ });
10783
+ const MetadataSchema = objectType({
10784
+ metadata: arrayType(MetadataFieldSchema)
10785
+ });
10786
+ const Metadata = () => {
10553
10787
  const { id } = useParams();
10554
10788
  const { order, isPending, isError, error } = useOrder(id, {
10555
- fields: "+email"
10789
+ fields: "metadata"
10556
10790
  });
10557
10791
  if (isError) {
10558
10792
  throw error;
@@ -10560,323 +10794,21 @@ const Email = () => {
10560
10794
  const isReady = !isPending && !!order;
10561
10795
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10562
10796
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10563
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
10564
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
10797
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10798
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10565
10799
  ] }),
10566
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
10800
+ !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10567
10801
  ] });
10568
10802
  };
10569
- const EmailForm = ({ order }) => {
10803
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10804
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10805
+ const MetadataForm = ({ orderId, metadata }) => {
10806
+ const { handleSuccess } = useRouteModal();
10807
+ const hasUneditableRows = getHasUneditableRows(metadata);
10808
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10570
10809
  const form = useForm({
10571
10810
  defaultValues: {
10572
- email: order.email ?? ""
10573
- },
10574
- resolver: zodResolver(schema$4)
10575
- });
10576
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10577
- const { handleSuccess } = useRouteModal();
10578
- const onSubmit = form.handleSubmit(async (data) => {
10579
- await mutateAsync(
10580
- { email: data.email },
10581
- {
10582
- onSuccess: () => {
10583
- handleSuccess();
10584
- },
10585
- onError: (error) => {
10586
- toast.error(error.message);
10587
- }
10588
- }
10589
- );
10590
- });
10591
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10592
- KeyboundForm,
10593
- {
10594
- className: "flex flex-1 flex-col overflow-hidden",
10595
- onSubmit,
10596
- children: [
10597
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
10598
- Form$2.Field,
10599
- {
10600
- control: form.control,
10601
- name: "email",
10602
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10603
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
10604
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10605
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10606
- ] })
10607
- }
10608
- ) }),
10609
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10610
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10611
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10612
- ] }) })
10613
- ]
10614
- }
10615
- ) });
10616
- };
10617
- const schema$4 = objectType({
10618
- email: stringType().email()
10619
- });
10620
- const BillingAddress = () => {
10621
- const { id } = useParams();
10622
- const { order, isPending, isError, error } = useOrder(id, {
10623
- fields: "+billing_address"
10624
- });
10625
- if (isError) {
10626
- throw error;
10627
- }
10628
- const isReady = !isPending && !!order;
10629
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10630
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10631
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
10632
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
10633
- ] }),
10634
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
10635
- ] });
10636
- };
10637
- const BillingAddressForm = ({ order }) => {
10638
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10639
- const form = useForm({
10640
- defaultValues: {
10641
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
10642
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
10643
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
10644
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
10645
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
10646
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
10647
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
10648
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
10649
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
10650
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
10651
- },
10652
- resolver: zodResolver(schema$3)
10653
- });
10654
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10655
- const { handleSuccess } = useRouteModal();
10656
- const onSubmit = form.handleSubmit(async (data) => {
10657
- await mutateAsync(
10658
- { billing_address: data },
10659
- {
10660
- onSuccess: () => {
10661
- handleSuccess();
10662
- },
10663
- onError: (error) => {
10664
- toast.error(error.message);
10665
- }
10666
- }
10667
- );
10668
- });
10669
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10670
- KeyboundForm,
10671
- {
10672
- className: "flex flex-1 flex-col overflow-hidden",
10673
- onSubmit,
10674
- children: [
10675
- /* @__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: [
10676
- /* @__PURE__ */ jsx(
10677
- Form$2.Field,
10678
- {
10679
- control: form.control,
10680
- name: "country_code",
10681
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10682
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
10683
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
10684
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10685
- ] })
10686
- }
10687
- ),
10688
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10689
- /* @__PURE__ */ jsx(
10690
- Form$2.Field,
10691
- {
10692
- control: form.control,
10693
- name: "first_name",
10694
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10695
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
10696
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10697
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10698
- ] })
10699
- }
10700
- ),
10701
- /* @__PURE__ */ jsx(
10702
- Form$2.Field,
10703
- {
10704
- control: form.control,
10705
- name: "last_name",
10706
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10707
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
10708
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10709
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10710
- ] })
10711
- }
10712
- )
10713
- ] }),
10714
- /* @__PURE__ */ jsx(
10715
- Form$2.Field,
10716
- {
10717
- control: form.control,
10718
- name: "company",
10719
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10720
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
10721
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10722
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10723
- ] })
10724
- }
10725
- ),
10726
- /* @__PURE__ */ jsx(
10727
- Form$2.Field,
10728
- {
10729
- control: form.control,
10730
- name: "address_1",
10731
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10732
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
10733
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10734
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10735
- ] })
10736
- }
10737
- ),
10738
- /* @__PURE__ */ jsx(
10739
- Form$2.Field,
10740
- {
10741
- control: form.control,
10742
- name: "address_2",
10743
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10744
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
10745
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10746
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10747
- ] })
10748
- }
10749
- ),
10750
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
10751
- /* @__PURE__ */ jsx(
10752
- Form$2.Field,
10753
- {
10754
- control: form.control,
10755
- name: "postal_code",
10756
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10757
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
10758
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10759
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10760
- ] })
10761
- }
10762
- ),
10763
- /* @__PURE__ */ jsx(
10764
- Form$2.Field,
10765
- {
10766
- control: form.control,
10767
- name: "city",
10768
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10769
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
10770
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10771
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10772
- ] })
10773
- }
10774
- )
10775
- ] }),
10776
- /* @__PURE__ */ jsx(
10777
- Form$2.Field,
10778
- {
10779
- control: form.control,
10780
- name: "province",
10781
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10782
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
10783
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10784
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10785
- ] })
10786
- }
10787
- ),
10788
- /* @__PURE__ */ jsx(
10789
- Form$2.Field,
10790
- {
10791
- control: form.control,
10792
- name: "phone",
10793
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
10794
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
10795
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
10796
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10797
- ] })
10798
- }
10799
- )
10800
- ] }) }),
10801
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
10802
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10803
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10804
- ] }) })
10805
- ]
10806
- }
10807
- ) });
10808
- };
10809
- const schema$3 = addressSchema;
10810
- const InlineTip = forwardRef(
10811
- ({ variant = "tip", label, className, children, ...props }, ref) => {
10812
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10813
- return /* @__PURE__ */ jsxs(
10814
- "div",
10815
- {
10816
- ref,
10817
- className: clx(
10818
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10819
- className
10820
- ),
10821
- ...props,
10822
- children: [
10823
- /* @__PURE__ */ jsx(
10824
- "div",
10825
- {
10826
- role: "presentation",
10827
- className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10828
- "bg-ui-tag-orange-icon": variant === "warning"
10829
- })
10830
- }
10831
- ),
10832
- /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10833
- /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10834
- labelValue,
10835
- ":"
10836
- ] }),
10837
- " ",
10838
- children
10839
- ] })
10840
- ]
10841
- }
10842
- );
10843
- }
10844
- );
10845
- InlineTip.displayName = "InlineTip";
10846
- const MetadataFieldSchema = objectType({
10847
- key: stringType(),
10848
- disabled: booleanType().optional(),
10849
- value: anyType()
10850
- });
10851
- const MetadataSchema = objectType({
10852
- metadata: arrayType(MetadataFieldSchema)
10853
- });
10854
- const Metadata = () => {
10855
- const { id } = useParams();
10856
- const { order, isPending, isError, error } = useOrder(id, {
10857
- fields: "metadata"
10858
- });
10859
- if (isError) {
10860
- throw error;
10861
- }
10862
- const isReady = !isPending && !!order;
10863
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10864
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10865
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10866
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10867
- ] }),
10868
- !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10869
- ] });
10870
- };
10871
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10872
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10873
- const MetadataForm = ({ orderId, metadata }) => {
10874
- const { handleSuccess } = useRouteModal();
10875
- const hasUneditableRows = getHasUneditableRows(metadata);
10876
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10877
- const form = useForm({
10878
- defaultValues: {
10879
- metadata: getDefaultValues(metadata)
10811
+ metadata: getDefaultValues(metadata)
10880
10812
  },
10881
10813
  resolver: zodResolver(MetadataSchema)
10882
10814
  });
@@ -11462,7 +11394,7 @@ const SalesChannelForm = ({ order }) => {
11462
11394
  defaultValues: {
11463
11395
  sales_channel_id: order.sales_channel_id || ""
11464
11396
  },
11465
- resolver: zodResolver(schema$2)
11397
+ resolver: zodResolver(schema$3)
11466
11398
  });
11467
11399
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11468
11400
  const { handleSuccess } = useRouteModal();
@@ -11537,7 +11469,7 @@ const SalesChannelField = ({ control, order }) => {
11537
11469
  }
11538
11470
  );
11539
11471
  };
11540
- const schema$2 = objectType({
11472
+ const schema$3 = objectType({
11541
11473
  sales_channel_id: stringType().min(1)
11542
11474
  });
11543
11475
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12333,20 +12265,223 @@ const CustomAmountField = ({
12333
12265
  /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
12334
12266
  /* @__PURE__ */ jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
12335
12267
  ] }),
12336
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12337
- CurrencyInput,
12268
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
12269
+ CurrencyInput,
12270
+ {
12271
+ ...field,
12272
+ onValueChange: (value) => onChange(value),
12273
+ symbol: getNativeSymbol(currencyCode),
12274
+ code: currencyCode
12275
+ }
12276
+ ) })
12277
+ ] });
12278
+ }
12279
+ }
12280
+ );
12281
+ };
12282
+ const ShippingAddress = () => {
12283
+ const { id } = useParams();
12284
+ const { order, isPending, isError, error } = useOrder(id, {
12285
+ fields: "+shipping_address"
12286
+ });
12287
+ if (isError) {
12288
+ throw error;
12289
+ }
12290
+ const isReady = !isPending && !!order;
12291
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12292
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12293
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12294
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12295
+ ] }),
12296
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12297
+ ] });
12298
+ };
12299
+ const ShippingAddressForm = ({ order }) => {
12300
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12301
+ const form = useForm({
12302
+ defaultValues: {
12303
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12304
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12305
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12306
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12307
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12308
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12309
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12310
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12311
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12312
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12313
+ },
12314
+ resolver: zodResolver(schema$2)
12315
+ });
12316
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12317
+ const { handleSuccess } = useRouteModal();
12318
+ const onSubmit = form.handleSubmit(async (data) => {
12319
+ await mutateAsync(
12320
+ {
12321
+ shipping_address: {
12322
+ first_name: data.first_name,
12323
+ last_name: data.last_name,
12324
+ company: data.company,
12325
+ address_1: data.address_1,
12326
+ address_2: data.address_2,
12327
+ city: data.city,
12328
+ province: data.province,
12329
+ country_code: data.country_code,
12330
+ postal_code: data.postal_code,
12331
+ phone: data.phone
12332
+ }
12333
+ },
12334
+ {
12335
+ onSuccess: () => {
12336
+ handleSuccess();
12337
+ },
12338
+ onError: (error) => {
12339
+ toast.error(error.message);
12340
+ }
12341
+ }
12342
+ );
12343
+ });
12344
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12345
+ KeyboundForm,
12346
+ {
12347
+ className: "flex flex-1 flex-col overflow-hidden",
12348
+ onSubmit,
12349
+ children: [
12350
+ /* @__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: [
12351
+ /* @__PURE__ */ jsx(
12352
+ Form$2.Field,
12353
+ {
12354
+ control: form.control,
12355
+ name: "country_code",
12356
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12357
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12358
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12359
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12360
+ ] })
12361
+ }
12362
+ ),
12363
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12364
+ /* @__PURE__ */ jsx(
12365
+ Form$2.Field,
12366
+ {
12367
+ control: form.control,
12368
+ name: "first_name",
12369
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12370
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12371
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12372
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12373
+ ] })
12374
+ }
12375
+ ),
12376
+ /* @__PURE__ */ jsx(
12377
+ Form$2.Field,
12378
+ {
12379
+ control: form.control,
12380
+ name: "last_name",
12381
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12382
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12383
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12384
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12385
+ ] })
12386
+ }
12387
+ )
12388
+ ] }),
12389
+ /* @__PURE__ */ jsx(
12390
+ Form$2.Field,
12391
+ {
12392
+ control: form.control,
12393
+ name: "company",
12394
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12395
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12396
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12397
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12398
+ ] })
12399
+ }
12400
+ ),
12401
+ /* @__PURE__ */ jsx(
12402
+ Form$2.Field,
12403
+ {
12404
+ control: form.control,
12405
+ name: "address_1",
12406
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12407
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12408
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12409
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12410
+ ] })
12411
+ }
12412
+ ),
12413
+ /* @__PURE__ */ jsx(
12414
+ Form$2.Field,
12415
+ {
12416
+ control: form.control,
12417
+ name: "address_2",
12418
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12419
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12420
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12421
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12422
+ ] })
12423
+ }
12424
+ ),
12425
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12426
+ /* @__PURE__ */ jsx(
12427
+ Form$2.Field,
12428
+ {
12429
+ control: form.control,
12430
+ name: "postal_code",
12431
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12432
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12433
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12434
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12435
+ ] })
12436
+ }
12437
+ ),
12438
+ /* @__PURE__ */ jsx(
12439
+ Form$2.Field,
12440
+ {
12441
+ control: form.control,
12442
+ name: "city",
12443
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12444
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12445
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12446
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12447
+ ] })
12448
+ }
12449
+ )
12450
+ ] }),
12451
+ /* @__PURE__ */ jsx(
12452
+ Form$2.Field,
12338
12453
  {
12339
- ...field,
12340
- onValueChange: (value) => onChange(value),
12341
- symbol: getNativeSymbol(currencyCode),
12342
- code: currencyCode
12454
+ control: form.control,
12455
+ name: "province",
12456
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12457
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12458
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12459
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12460
+ ] })
12343
12461
  }
12344
- ) })
12345
- ] });
12346
- }
12462
+ ),
12463
+ /* @__PURE__ */ jsx(
12464
+ Form$2.Field,
12465
+ {
12466
+ control: form.control,
12467
+ name: "phone",
12468
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12469
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12470
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12471
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12472
+ ] })
12473
+ }
12474
+ )
12475
+ ] }) }),
12476
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12477
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12478
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12479
+ ] }) })
12480
+ ]
12347
12481
  }
12348
- );
12482
+ ) });
12349
12483
  };
12484
+ const schema$2 = addressSchema;
12350
12485
  const TransferOwnership = () => {
12351
12486
  const { id } = useParams();
12352
12487
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12823,10 +12958,10 @@ const Illustration = () => {
12823
12958
  const schema$1 = objectType({
12824
12959
  customer_id: stringType().min(1)
12825
12960
  });
12826
- const ShippingAddress = () => {
12961
+ const Email = () => {
12827
12962
  const { id } = useParams();
12828
12963
  const { order, isPending, isError, error } = useOrder(id, {
12829
- fields: "+shipping_address"
12964
+ fields: "+email"
12830
12965
  });
12831
12966
  if (isError) {
12832
12967
  throw error;
@@ -12834,26 +12969,16 @@ const ShippingAddress = () => {
12834
12969
  const isReady = !isPending && !!order;
12835
12970
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12836
12971
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12837
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12838
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12972
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12973
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12839
12974
  ] }),
12840
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12975
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
12841
12976
  ] });
12842
12977
  };
12843
- const ShippingAddressForm = ({ order }) => {
12844
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12978
+ const EmailForm = ({ order }) => {
12845
12979
  const form = useForm({
12846
12980
  defaultValues: {
12847
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12848
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12849
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12850
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12851
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12852
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12853
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12854
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12855
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12856
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12981
+ email: order.email ?? ""
12857
12982
  },
12858
12983
  resolver: zodResolver(schema)
12859
12984
  });
@@ -12861,20 +12986,7 @@ const ShippingAddressForm = ({ order }) => {
12861
12986
  const { handleSuccess } = useRouteModal();
12862
12987
  const onSubmit = form.handleSubmit(async (data) => {
12863
12988
  await mutateAsync(
12864
- {
12865
- shipping_address: {
12866
- first_name: data.first_name,
12867
- last_name: data.last_name,
12868
- company: data.company,
12869
- address_1: data.address_1,
12870
- address_2: data.address_2,
12871
- city: data.city,
12872
- province: data.province,
12873
- country_code: data.country_code,
12874
- postal_code: data.postal_code,
12875
- phone: data.phone
12876
- }
12877
- },
12989
+ { email: data.email },
12878
12990
  {
12879
12991
  onSuccess: () => {
12880
12992
  handleSuccess();
@@ -12891,132 +13003,18 @@ const ShippingAddressForm = ({ order }) => {
12891
13003
  className: "flex flex-1 flex-col overflow-hidden",
12892
13004
  onSubmit,
12893
13005
  children: [
12894
- /* @__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: [
12895
- /* @__PURE__ */ jsx(
12896
- Form$2.Field,
12897
- {
12898
- control: form.control,
12899
- name: "country_code",
12900
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12901
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12902
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12903
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12904
- ] })
12905
- }
12906
- ),
12907
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12908
- /* @__PURE__ */ jsx(
12909
- Form$2.Field,
12910
- {
12911
- control: form.control,
12912
- name: "first_name",
12913
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12915
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12916
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
- ] })
12918
- }
12919
- ),
12920
- /* @__PURE__ */ jsx(
12921
- Form$2.Field,
12922
- {
12923
- control: form.control,
12924
- name: "last_name",
12925
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12926
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12927
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12928
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12929
- ] })
12930
- }
12931
- )
12932
- ] }),
12933
- /* @__PURE__ */ jsx(
12934
- Form$2.Field,
12935
- {
12936
- control: form.control,
12937
- name: "company",
12938
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12940
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
- ] })
12943
- }
12944
- ),
12945
- /* @__PURE__ */ jsx(
12946
- Form$2.Field,
12947
- {
12948
- control: form.control,
12949
- name: "address_1",
12950
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12951
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12952
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12953
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12954
- ] })
12955
- }
12956
- ),
12957
- /* @__PURE__ */ jsx(
12958
- Form$2.Field,
12959
- {
12960
- control: form.control,
12961
- name: "address_2",
12962
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12963
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12964
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12965
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12966
- ] })
12967
- }
12968
- ),
12969
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12970
- /* @__PURE__ */ jsx(
12971
- Form$2.Field,
12972
- {
12973
- control: form.control,
12974
- name: "postal_code",
12975
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12977
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
- ] })
12980
- }
12981
- ),
12982
- /* @__PURE__ */ jsx(
12983
- Form$2.Field,
12984
- {
12985
- control: form.control,
12986
- name: "city",
12987
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12988
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12989
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12990
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12991
- ] })
12992
- }
12993
- )
12994
- ] }),
12995
- /* @__PURE__ */ jsx(
12996
- Form$2.Field,
12997
- {
12998
- control: form.control,
12999
- name: "province",
13000
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13002
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
- ] })
13005
- }
13006
- ),
13007
- /* @__PURE__ */ jsx(
13008
- Form$2.Field,
13009
- {
13010
- control: form.control,
13011
- name: "phone",
13012
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13013
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13014
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13015
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13016
- ] })
13017
- }
13018
- )
13019
- ] }) }),
13006
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13007
+ Form$2.Field,
13008
+ {
13009
+ control: form.control,
13010
+ name: "email",
13011
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13012
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13013
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13014
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13015
+ ] })
13016
+ }
13017
+ ) }),
13020
13018
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13021
13019
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13022
13020
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -13025,7 +13023,9 @@ const ShippingAddressForm = ({ order }) => {
13025
13023
  }
13026
13024
  ) });
13027
13025
  };
13028
- const schema = addressSchema;
13026
+ const schema = objectType({
13027
+ email: stringType().email()
13028
+ });
13029
13029
  const widgetModule = { widgets: [] };
13030
13030
  const routeModule = {
13031
13031
  routes: [
@@ -13046,6 +13046,10 @@ const routeModule = {
13046
13046
  handle,
13047
13047
  loader,
13048
13048
  children: [
13049
+ {
13050
+ Component: BillingAddress,
13051
+ path: "/draft-orders/:id/billing-address"
13052
+ },
13049
13053
  {
13050
13054
  Component: CustomItems,
13051
13055
  path: "/draft-orders/:id/custom-items"
@@ -13054,14 +13058,6 @@ const routeModule = {
13054
13058
  Component: Items,
13055
13059
  path: "/draft-orders/:id/items"
13056
13060
  },
13057
- {
13058
- Component: Email,
13059
- path: "/draft-orders/:id/email"
13060
- },
13061
- {
13062
- Component: BillingAddress,
13063
- path: "/draft-orders/:id/billing-address"
13064
- },
13065
13061
  {
13066
13062
  Component: Metadata,
13067
13063
  path: "/draft-orders/:id/metadata"
@@ -13078,13 +13074,17 @@ const routeModule = {
13078
13074
  Component: Shipping,
13079
13075
  path: "/draft-orders/:id/shipping"
13080
13076
  },
13077
+ {
13078
+ Component: ShippingAddress,
13079
+ path: "/draft-orders/:id/shipping-address"
13080
+ },
13081
13081
  {
13082
13082
  Component: TransferOwnership,
13083
13083
  path: "/draft-orders/:id/transfer-ownership"
13084
13084
  },
13085
13085
  {
13086
- Component: ShippingAddress,
13087
- path: "/draft-orders/:id/shipping-address"
13086
+ Component: Email,
13087
+ path: "/draft-orders/:id/email"
13088
13088
  }
13089
13089
  ]
13090
13090
  }