@medusajs/draft-order 2.11.2-preview-20251028060159 → 2.11.2-preview-20251028090156

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,6 +9565,196 @@ const ID = () => {
9565
9565
  /* @__PURE__ */ jsx(Outlet, {})
9566
9566
  ] });
9567
9567
  };
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;
9577
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
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 })
9583
+ ] });
9584
+ };
9585
+ const BillingAddressForm = ({ order }) => {
9586
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
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
+ },
9600
+ resolver: zodResolver(schema$5)
9601
+ });
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
+ ) });
9756
+ };
9757
+ const schema$5 = addressSchema;
9568
9758
  const CustomItems = () => {
9569
9759
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9570
9760
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9573,7 +9763,7 @@ const CustomItems = () => {
9573
9763
  };
9574
9764
  const CustomItemsForm = () => {
9575
9765
  const form = useForm({
9576
- resolver: zodResolver(schema$5)
9766
+ resolver: zodResolver(schema$4)
9577
9767
  });
9578
9768
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9579
9769
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9583,7 +9773,75 @@ const CustomItemsForm = () => {
9583
9773
  ] }) })
9584
9774
  ] }) });
9585
9775
  };
9586
- const schema$5 = objectType({
9776
+ const schema$4 = objectType({
9777
+ email: stringType().email()
9778
+ });
9779
+ const Email = () => {
9780
+ const { id } = useParams();
9781
+ const { order, isPending, isError, error } = useOrder(id, {
9782
+ fields: "+email"
9783
+ });
9784
+ if (isError) {
9785
+ throw error;
9786
+ }
9787
+ const isReady = !isPending && !!order;
9788
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9789
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9790
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9791
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9792
+ ] }),
9793
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9794
+ ] });
9795
+ };
9796
+ const EmailForm = ({ order }) => {
9797
+ const form = useForm({
9798
+ defaultValues: {
9799
+ email: order.email ?? ""
9800
+ },
9801
+ resolver: zodResolver(schema$3)
9802
+ });
9803
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9804
+ const { handleSuccess } = useRouteModal();
9805
+ const onSubmit = form.handleSubmit(async (data) => {
9806
+ await mutateAsync(
9807
+ { email: data.email },
9808
+ {
9809
+ onSuccess: () => {
9810
+ handleSuccess();
9811
+ },
9812
+ onError: (error) => {
9813
+ toast.error(error.message);
9814
+ }
9815
+ }
9816
+ );
9817
+ });
9818
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9819
+ KeyboundForm,
9820
+ {
9821
+ className: "flex flex-1 flex-col overflow-hidden",
9822
+ onSubmit,
9823
+ children: [
9824
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9825
+ Form$2.Field,
9826
+ {
9827
+ control: form.control,
9828
+ name: "email",
9829
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9830
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9831
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9832
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9833
+ ] })
9834
+ }
9835
+ ) }),
9836
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9837
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9838
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9839
+ ] }) })
9840
+ ]
9841
+ }
9842
+ ) });
9843
+ };
9844
+ const schema$3 = objectType({
9587
9845
  email: stringType().email()
9588
9846
  });
9589
9847
  const NumberInput = forwardRef(
@@ -11215,7 +11473,7 @@ const SalesChannelForm = ({ order }) => {
11215
11473
  defaultValues: {
11216
11474
  sales_channel_id: order.sales_channel_id || ""
11217
11475
  },
11218
- resolver: zodResolver(schema$4)
11476
+ resolver: zodResolver(schema$2)
11219
11477
  });
11220
11478
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11221
11479
  const { handleSuccess } = useRouteModal();
@@ -11290,7 +11548,7 @@ const SalesChannelField = ({ control, order }) => {
11290
11548
  }
11291
11549
  );
11292
11550
  };
11293
- const schema$4 = objectType({
11551
+ const schema$2 = objectType({
11294
11552
  sales_channel_id: stringType().min(1)
11295
11553
  });
11296
11554
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12132,7 +12390,7 @@ const ShippingAddressForm = ({ order }) => {
12132
12390
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12133
12391
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12134
12392
  },
12135
- resolver: zodResolver(schema$3)
12393
+ resolver: zodResolver(schema$1)
12136
12394
  });
12137
12395
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12138
12396
  const { handleSuccess } = useRouteModal();
@@ -12302,7 +12560,7 @@ const ShippingAddressForm = ({ order }) => {
12302
12560
  }
12303
12561
  ) });
12304
12562
  };
12305
- const schema$3 = addressSchema;
12563
+ const schema$1 = addressSchema;
12306
12564
  const TransferOwnership = () => {
12307
12565
  const { id } = useParams();
12308
12566
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12326,7 +12584,7 @@ const TransferOwnershipForm = ({ order }) => {
12326
12584
  defaultValues: {
12327
12585
  customer_id: order.customer_id || ""
12328
12586
  },
12329
- resolver: zodResolver(schema$2)
12587
+ resolver: zodResolver(schema)
12330
12588
  });
12331
12589
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12332
12590
  const { handleSuccess } = useRouteModal();
@@ -12705,337 +12963,79 @@ const Illustration = () => {
12705
12963
  strokeLinecap: "round",
12706
12964
  strokeLinejoin: "round"
12707
12965
  }
12708
- ) }),
12709
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsx(
12710
- "path",
12711
- {
12712
- d: "M146.894 101.198L139.51 101.155L139.486 105.365",
12713
- stroke: "#A1A1AA",
12714
- strokeWidth: "1.5",
12715
- strokeLinecap: "round",
12716
- strokeLinejoin: "round"
12717
- }
12718
- ) }),
12719
- /* @__PURE__ */ jsxs("defs", { children: [
12720
- /* @__PURE__ */ jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsx(
12721
- "rect",
12722
- {
12723
- width: "12",
12724
- height: "12",
12725
- fill: "white",
12726
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12727
- }
12728
- ) }),
12729
- /* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
12730
- "rect",
12731
- {
12732
- width: "12",
12733
- height: "12",
12734
- fill: "white",
12735
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12736
- }
12737
- ) }),
12738
- /* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
12739
- "rect",
12740
- {
12741
- width: "12",
12742
- height: "12",
12743
- fill: "white",
12744
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12745
- }
12746
- ) }),
12747
- /* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
12748
- "rect",
12749
- {
12750
- width: "12",
12751
- height: "12",
12752
- fill: "white",
12753
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12754
- }
12755
- ) }),
12756
- /* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
12757
- "rect",
12758
- {
12759
- width: "12",
12760
- height: "12",
12761
- fill: "white",
12762
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12763
- }
12764
- ) }),
12765
- /* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
12766
- "rect",
12767
- {
12768
- width: "12",
12769
- height: "12",
12770
- fill: "white",
12771
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12772
- }
12773
- ) })
12774
- ] })
12775
- ]
12776
- }
12777
- );
12778
- };
12779
- const schema$2 = objectType({
12780
- customer_id: stringType().min(1)
12781
- });
12782
- const BillingAddress = () => {
12783
- const { id } = useParams();
12784
- const { order, isPending, isError, error } = useOrder(id, {
12785
- fields: "+billing_address"
12786
- });
12787
- if (isError) {
12788
- throw error;
12789
- }
12790
- const isReady = !isPending && !!order;
12791
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12792
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12793
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12794
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12795
- ] }),
12796
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12797
- ] });
12798
- };
12799
- const BillingAddressForm = ({ order }) => {
12800
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12801
- const form = useForm({
12802
- defaultValues: {
12803
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12804
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12805
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12806
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12807
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12808
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12809
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12810
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12811
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12812
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12813
- },
12814
- resolver: zodResolver(schema$1)
12815
- });
12816
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12817
- const { handleSuccess } = useRouteModal();
12818
- const onSubmit = form.handleSubmit(async (data) => {
12819
- await mutateAsync(
12820
- { billing_address: data },
12821
- {
12822
- onSuccess: () => {
12823
- handleSuccess();
12824
- },
12825
- onError: (error) => {
12826
- toast.error(error.message);
12827
- }
12828
- }
12829
- );
12830
- });
12831
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12832
- KeyboundForm,
12833
- {
12834
- className: "flex flex-1 flex-col overflow-hidden",
12835
- onSubmit,
12836
- children: [
12837
- /* @__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: [
12838
- /* @__PURE__ */ jsx(
12839
- Form$2.Field,
12966
+ ) }),
12967
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsx(
12968
+ "path",
12969
+ {
12970
+ d: "M146.894 101.198L139.51 101.155L139.486 105.365",
12971
+ stroke: "#A1A1AA",
12972
+ strokeWidth: "1.5",
12973
+ strokeLinecap: "round",
12974
+ strokeLinejoin: "round"
12975
+ }
12976
+ ) }),
12977
+ /* @__PURE__ */ jsxs("defs", { children: [
12978
+ /* @__PURE__ */ jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsx(
12979
+ "rect",
12840
12980
  {
12841
- control: form.control,
12842
- name: "country_code",
12843
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12844
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12845
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12846
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12847
- ] })
12981
+ width: "12",
12982
+ height: "12",
12983
+ fill: "white",
12984
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12848
12985
  }
12849
- ),
12850
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12851
- /* @__PURE__ */ jsx(
12852
- Form$2.Field,
12853
- {
12854
- control: form.control,
12855
- name: "first_name",
12856
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12857
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12858
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12859
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12860
- ] })
12861
- }
12862
- ),
12863
- /* @__PURE__ */ jsx(
12864
- Form$2.Field,
12865
- {
12866
- control: form.control,
12867
- name: "last_name",
12868
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12869
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12870
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12871
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12872
- ] })
12873
- }
12874
- )
12875
- ] }),
12876
- /* @__PURE__ */ jsx(
12877
- Form$2.Field,
12986
+ ) }),
12987
+ /* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
12988
+ "rect",
12878
12989
  {
12879
- control: form.control,
12880
- name: "company",
12881
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12882
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12883
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12884
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12885
- ] })
12990
+ width: "12",
12991
+ height: "12",
12992
+ fill: "white",
12993
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12886
12994
  }
12887
- ),
12888
- /* @__PURE__ */ jsx(
12889
- Form$2.Field,
12995
+ ) }),
12996
+ /* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
12997
+ "rect",
12890
12998
  {
12891
- control: form.control,
12892
- name: "address_1",
12893
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12894
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12895
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12896
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12897
- ] })
12999
+ width: "12",
13000
+ height: "12",
13001
+ fill: "white",
13002
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12898
13003
  }
12899
- ),
12900
- /* @__PURE__ */ jsx(
12901
- Form$2.Field,
13004
+ ) }),
13005
+ /* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
13006
+ "rect",
12902
13007
  {
12903
- control: form.control,
12904
- name: "address_2",
12905
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12906
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12907
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12908
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12909
- ] })
13008
+ width: "12",
13009
+ height: "12",
13010
+ fill: "white",
13011
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12910
13012
  }
12911
- ),
12912
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12913
- /* @__PURE__ */ jsx(
12914
- Form$2.Field,
12915
- {
12916
- control: form.control,
12917
- name: "postal_code",
12918
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12919
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12920
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12921
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12922
- ] })
12923
- }
12924
- ),
12925
- /* @__PURE__ */ jsx(
12926
- Form$2.Field,
12927
- {
12928
- control: form.control,
12929
- name: "city",
12930
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12931
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12932
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12933
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12934
- ] })
12935
- }
12936
- )
12937
- ] }),
12938
- /* @__PURE__ */ jsx(
12939
- Form$2.Field,
13013
+ ) }),
13014
+ /* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
13015
+ "rect",
12940
13016
  {
12941
- control: form.control,
12942
- name: "province",
12943
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12944
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12945
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12946
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12947
- ] })
13017
+ width: "12",
13018
+ height: "12",
13019
+ fill: "white",
13020
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12948
13021
  }
12949
- ),
12950
- /* @__PURE__ */ jsx(
12951
- Form$2.Field,
13022
+ ) }),
13023
+ /* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
13024
+ "rect",
12952
13025
  {
12953
- control: form.control,
12954
- name: "phone",
12955
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12956
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12957
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12958
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12959
- ] })
13026
+ width: "12",
13027
+ height: "12",
13028
+ fill: "white",
13029
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12960
13030
  }
12961
- )
12962
- ] }) }),
12963
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12964
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12965
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12966
- ] }) })
12967
- ]
12968
- }
12969
- ) });
12970
- };
12971
- const schema$1 = addressSchema;
12972
- const Email = () => {
12973
- const { id } = useParams();
12974
- const { order, isPending, isError, error } = useOrder(id, {
12975
- fields: "+email"
12976
- });
12977
- if (isError) {
12978
- throw error;
12979
- }
12980
- const isReady = !isPending && !!order;
12981
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12982
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12983
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12984
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12985
- ] }),
12986
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
12987
- ] });
12988
- };
12989
- const EmailForm = ({ order }) => {
12990
- const form = useForm({
12991
- defaultValues: {
12992
- email: order.email ?? ""
12993
- },
12994
- resolver: zodResolver(schema)
12995
- });
12996
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12997
- const { handleSuccess } = useRouteModal();
12998
- const onSubmit = form.handleSubmit(async (data) => {
12999
- await mutateAsync(
13000
- { email: data.email },
13001
- {
13002
- onSuccess: () => {
13003
- handleSuccess();
13004
- },
13005
- onError: (error) => {
13006
- toast.error(error.message);
13007
- }
13008
- }
13009
- );
13010
- });
13011
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
13012
- KeyboundForm,
13013
- {
13014
- className: "flex flex-1 flex-col overflow-hidden",
13015
- onSubmit,
13016
- children: [
13017
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13018
- Form$2.Field,
13019
- {
13020
- control: form.control,
13021
- name: "email",
13022
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13023
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13024
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13025
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13026
- ] })
13027
- }
13028
- ) }),
13029
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13030
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13031
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13032
- ] }) })
13031
+ ) })
13032
+ ] })
13033
13033
  ]
13034
13034
  }
13035
- ) });
13035
+ );
13036
13036
  };
13037
13037
  const schema = objectType({
13038
- email: stringType().email()
13038
+ customer_id: stringType().min(1)
13039
13039
  });
13040
13040
  const widgetModule = { widgets: [] };
13041
13041
  const routeModule = {
@@ -13057,10 +13057,18 @@ const routeModule = {
13057
13057
  handle,
13058
13058
  loader,
13059
13059
  children: [
13060
+ {
13061
+ Component: BillingAddress,
13062
+ path: "/draft-orders/:id/billing-address"
13063
+ },
13060
13064
  {
13061
13065
  Component: CustomItems,
13062
13066
  path: "/draft-orders/:id/custom-items"
13063
13067
  },
13068
+ {
13069
+ Component: Email,
13070
+ path: "/draft-orders/:id/email"
13071
+ },
13064
13072
  {
13065
13073
  Component: Items,
13066
13074
  path: "/draft-orders/:id/items"
@@ -13088,14 +13096,6 @@ const routeModule = {
13088
13096
  {
13089
13097
  Component: TransferOwnership,
13090
13098
  path: "/draft-orders/:id/transfer-ownership"
13091
- },
13092
- {
13093
- Component: BillingAddress,
13094
- path: "/draft-orders/:id/billing-address"
13095
- },
13096
- {
13097
- Component: Email,
13098
- path: "/draft-orders/:id/email"
13099
13099
  }
13100
13100
  ]
13101
13101
  }