@medusajs/draft-order 2.11.4-preview-20251127032045 → 2.11.4-preview-20251127090135

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.
@@ -9572,6 +9572,196 @@ const ID = () => {
9572
9572
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9573
9573
  ] });
9574
9574
  };
9575
+ const BillingAddress = () => {
9576
+ const { id } = reactRouterDom.useParams();
9577
+ const { order, isPending, isError, error } = useOrder(id, {
9578
+ fields: "+billing_address"
9579
+ });
9580
+ if (isError) {
9581
+ throw error;
9582
+ }
9583
+ const isReady = !isPending && !!order;
9584
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9585
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9586
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9588
+ ] }),
9589
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9590
+ ] });
9591
+ };
9592
+ const BillingAddressForm = ({ order }) => {
9593
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9594
+ const form = reactHookForm.useForm({
9595
+ defaultValues: {
9596
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9597
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9598
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9599
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9600
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9601
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9602
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9603
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9604
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9605
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9606
+ },
9607
+ resolver: zod.zodResolver(schema$5)
9608
+ });
9609
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9610
+ const { handleSuccess } = useRouteModal();
9611
+ const onSubmit = form.handleSubmit(async (data) => {
9612
+ await mutateAsync(
9613
+ { billing_address: data },
9614
+ {
9615
+ onSuccess: () => {
9616
+ handleSuccess();
9617
+ },
9618
+ onError: (error) => {
9619
+ ui.toast.error(error.message);
9620
+ }
9621
+ }
9622
+ );
9623
+ });
9624
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9625
+ KeyboundForm,
9626
+ {
9627
+ className: "flex flex-1 flex-col overflow-hidden",
9628
+ onSubmit,
9629
+ children: [
9630
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
9631
+ /* @__PURE__ */ jsxRuntime.jsx(
9632
+ Form$2.Field,
9633
+ {
9634
+ control: form.control,
9635
+ name: "country_code",
9636
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9637
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9638
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9639
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9640
+ ] })
9641
+ }
9642
+ ),
9643
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9644
+ /* @__PURE__ */ jsxRuntime.jsx(
9645
+ Form$2.Field,
9646
+ {
9647
+ control: form.control,
9648
+ name: "first_name",
9649
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9650
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9651
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9652
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9653
+ ] })
9654
+ }
9655
+ ),
9656
+ /* @__PURE__ */ jsxRuntime.jsx(
9657
+ Form$2.Field,
9658
+ {
9659
+ control: form.control,
9660
+ name: "last_name",
9661
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9662
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9663
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9664
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9665
+ ] })
9666
+ }
9667
+ )
9668
+ ] }),
9669
+ /* @__PURE__ */ jsxRuntime.jsx(
9670
+ Form$2.Field,
9671
+ {
9672
+ control: form.control,
9673
+ name: "company",
9674
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9675
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9676
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9677
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9678
+ ] })
9679
+ }
9680
+ ),
9681
+ /* @__PURE__ */ jsxRuntime.jsx(
9682
+ Form$2.Field,
9683
+ {
9684
+ control: form.control,
9685
+ name: "address_1",
9686
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9687
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9689
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9690
+ ] })
9691
+ }
9692
+ ),
9693
+ /* @__PURE__ */ jsxRuntime.jsx(
9694
+ Form$2.Field,
9695
+ {
9696
+ control: form.control,
9697
+ name: "address_2",
9698
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9699
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9700
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9701
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9702
+ ] })
9703
+ }
9704
+ ),
9705
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9706
+ /* @__PURE__ */ jsxRuntime.jsx(
9707
+ Form$2.Field,
9708
+ {
9709
+ control: form.control,
9710
+ name: "postal_code",
9711
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9712
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9714
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9715
+ ] })
9716
+ }
9717
+ ),
9718
+ /* @__PURE__ */ jsxRuntime.jsx(
9719
+ Form$2.Field,
9720
+ {
9721
+ control: form.control,
9722
+ name: "city",
9723
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9724
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9725
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9726
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9727
+ ] })
9728
+ }
9729
+ )
9730
+ ] }),
9731
+ /* @__PURE__ */ jsxRuntime.jsx(
9732
+ Form$2.Field,
9733
+ {
9734
+ control: form.control,
9735
+ name: "province",
9736
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9737
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9739
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9740
+ ] })
9741
+ }
9742
+ ),
9743
+ /* @__PURE__ */ jsxRuntime.jsx(
9744
+ Form$2.Field,
9745
+ {
9746
+ control: form.control,
9747
+ name: "phone",
9748
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9749
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9750
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9751
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9752
+ ] })
9753
+ }
9754
+ )
9755
+ ] }) }),
9756
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9757
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9758
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9759
+ ] }) })
9760
+ ]
9761
+ }
9762
+ ) });
9763
+ };
9764
+ const schema$5 = addressSchema;
9575
9765
  const CustomItems = () => {
9576
9766
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9577
9767
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9580,7 +9770,7 @@ const CustomItems = () => {
9580
9770
  };
9581
9771
  const CustomItemsForm = () => {
9582
9772
  const form = reactHookForm.useForm({
9583
- resolver: zod.zodResolver(schema$5)
9773
+ resolver: zod.zodResolver(schema$4)
9584
9774
  });
9585
9775
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9586
9776
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -9590,45 +9780,113 @@ const CustomItemsForm = () => {
9590
9780
  ] }) })
9591
9781
  ] }) });
9592
9782
  };
9593
- const schema$5 = objectType({
9783
+ const schema$4 = objectType({
9594
9784
  email: stringType().email()
9595
9785
  });
9596
- const NumberInput = React.forwardRef(
9597
- ({
9598
- value,
9599
- onChange,
9600
- size = "base",
9601
- min = 0,
9602
- max = 100,
9603
- step = 1,
9604
- className,
9605
- disabled,
9606
- ...props
9607
- }, ref) => {
9608
- const handleChange = (event) => {
9609
- const newValue = event.target.value === "" ? min : Number(event.target.value);
9610
- if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
9611
- onChange(newValue);
9612
- }
9613
- };
9614
- const handleIncrement = () => {
9615
- const newValue = value + step;
9616
- if (max === void 0 || newValue <= max) {
9617
- onChange(newValue);
9618
- }
9619
- };
9620
- const handleDecrement = () => {
9621
- const newValue = value - step;
9622
- if (min === void 0 || newValue >= min) {
9623
- onChange(newValue);
9624
- }
9625
- };
9626
- return /* @__PURE__ */ jsxRuntime.jsxs(
9627
- "div",
9786
+ const Email = () => {
9787
+ const { id } = reactRouterDom.useParams();
9788
+ const { order, isPending, isError, error } = useOrder(id, {
9789
+ fields: "+email"
9790
+ });
9791
+ if (isError) {
9792
+ throw error;
9793
+ }
9794
+ const isReady = !isPending && !!order;
9795
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9796
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9797
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9798
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9799
+ ] }),
9800
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9801
+ ] });
9802
+ };
9803
+ const EmailForm = ({ order }) => {
9804
+ const form = reactHookForm.useForm({
9805
+ defaultValues: {
9806
+ email: order.email ?? ""
9807
+ },
9808
+ resolver: zod.zodResolver(schema$3)
9809
+ });
9810
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9811
+ const { handleSuccess } = useRouteModal();
9812
+ const onSubmit = form.handleSubmit(async (data) => {
9813
+ await mutateAsync(
9814
+ { email: data.email },
9628
9815
  {
9629
- className: ui.clx(
9630
- "inline-flex rounded-md bg-ui-bg-field shadow-borders-base overflow-hidden divide-x transition-fg",
9631
- "[&:has(input:focus)]:shadow-borders-interactive-with-active",
9816
+ onSuccess: () => {
9817
+ handleSuccess();
9818
+ },
9819
+ onError: (error) => {
9820
+ ui.toast.error(error.message);
9821
+ }
9822
+ }
9823
+ );
9824
+ });
9825
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9826
+ KeyboundForm,
9827
+ {
9828
+ className: "flex flex-1 flex-col overflow-hidden",
9829
+ onSubmit,
9830
+ children: [
9831
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9832
+ Form$2.Field,
9833
+ {
9834
+ control: form.control,
9835
+ name: "email",
9836
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9837
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9838
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9839
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9840
+ ] })
9841
+ }
9842
+ ) }),
9843
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9844
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9845
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9846
+ ] }) })
9847
+ ]
9848
+ }
9849
+ ) });
9850
+ };
9851
+ const schema$3 = objectType({
9852
+ email: stringType().email()
9853
+ });
9854
+ const NumberInput = React.forwardRef(
9855
+ ({
9856
+ value,
9857
+ onChange,
9858
+ size = "base",
9859
+ min = 0,
9860
+ max = 100,
9861
+ step = 1,
9862
+ className,
9863
+ disabled,
9864
+ ...props
9865
+ }, ref) => {
9866
+ const handleChange = (event) => {
9867
+ const newValue = event.target.value === "" ? min : Number(event.target.value);
9868
+ if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
9869
+ onChange(newValue);
9870
+ }
9871
+ };
9872
+ const handleIncrement = () => {
9873
+ const newValue = value + step;
9874
+ if (max === void 0 || newValue <= max) {
9875
+ onChange(newValue);
9876
+ }
9877
+ };
9878
+ const handleDecrement = () => {
9879
+ const newValue = value - step;
9880
+ if (min === void 0 || newValue >= min) {
9881
+ onChange(newValue);
9882
+ }
9883
+ };
9884
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9885
+ "div",
9886
+ {
9887
+ className: ui.clx(
9888
+ "inline-flex rounded-md bg-ui-bg-field shadow-borders-base overflow-hidden divide-x transition-fg",
9889
+ "[&:has(input:focus)]:shadow-borders-interactive-with-active",
9632
9890
  {
9633
9891
  "h-7": size === "small",
9634
9892
  "h-8": size === "base"
@@ -10567,74 +10825,6 @@ const customItemSchema = objectType({
10567
10825
  quantity: numberType(),
10568
10826
  unit_price: unionType([numberType(), stringType()])
10569
10827
  });
10570
- const Email = () => {
10571
- const { id } = reactRouterDom.useParams();
10572
- const { order, isPending, isError, error } = useOrder(id, {
10573
- fields: "+email"
10574
- });
10575
- if (isError) {
10576
- throw error;
10577
- }
10578
- const isReady = !isPending && !!order;
10579
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
10580
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
10581
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
10582
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
10583
- ] }),
10584
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
10585
- ] });
10586
- };
10587
- const EmailForm = ({ order }) => {
10588
- const form = reactHookForm.useForm({
10589
- defaultValues: {
10590
- email: order.email ?? ""
10591
- },
10592
- resolver: zod.zodResolver(schema$4)
10593
- });
10594
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
10595
- const { handleSuccess } = useRouteModal();
10596
- const onSubmit = form.handleSubmit(async (data) => {
10597
- await mutateAsync(
10598
- { email: data.email },
10599
- {
10600
- onSuccess: () => {
10601
- handleSuccess();
10602
- },
10603
- onError: (error) => {
10604
- ui.toast.error(error.message);
10605
- }
10606
- }
10607
- );
10608
- });
10609
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
10610
- KeyboundForm,
10611
- {
10612
- className: "flex flex-1 flex-col overflow-hidden",
10613
- onSubmit,
10614
- children: [
10615
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
10616
- Form$2.Field,
10617
- {
10618
- control: form.control,
10619
- name: "email",
10620
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
10621
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
10622
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
10623
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10624
- ] })
10625
- }
10626
- ) }),
10627
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
10628
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
10629
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10630
- ] }) })
10631
- ]
10632
- }
10633
- ) });
10634
- };
10635
- const schema$4 = objectType({
10636
- email: stringType().email()
10637
- });
10638
10828
  const InlineTip = React.forwardRef(
10639
10829
  ({ variant = "tip", label, className, children, ...props }, ref) => {
10640
10830
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -11290,7 +11480,7 @@ const SalesChannelForm = ({ order }) => {
11290
11480
  defaultValues: {
11291
11481
  sales_channel_id: order.sales_channel_id || ""
11292
11482
  },
11293
- resolver: zod.zodResolver(schema$3)
11483
+ resolver: zod.zodResolver(schema$2)
11294
11484
  });
11295
11485
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11296
11486
  const { handleSuccess } = useRouteModal();
@@ -11365,87 +11555,290 @@ const SalesChannelField = ({ control, order }) => {
11365
11555
  }
11366
11556
  );
11367
11557
  };
11368
- const schema$3 = objectType({
11558
+ const schema$2 = objectType({
11369
11559
  sales_channel_id: stringType().min(1)
11370
11560
  });
11371
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11372
- const Shipping = () => {
11373
- var _a;
11561
+ const ShippingAddress = () => {
11374
11562
  const { id } = reactRouterDom.useParams();
11375
11563
  const { order, isPending, isError, error } = useOrder(id, {
11376
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11564
+ fields: "+shipping_address"
11377
11565
  });
11378
- const {
11379
- order: preview,
11380
- isPending: isPreviewPending,
11381
- isError: isPreviewError,
11382
- error: previewError
11383
- } = useOrderPreview(id);
11384
- useInitiateOrderEdit({ preview });
11385
- const { onCancel } = useCancelOrderEdit({ preview });
11386
11566
  if (isError) {
11387
11567
  throw error;
11388
11568
  }
11389
- if (isPreviewError) {
11390
- throw previewError;
11391
- }
11392
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11393
- const isReady = preview && !isPreviewPending && order && !isPending;
11394
- return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11395
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
11396
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
11397
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
11398
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11399
- ] }) }) }),
11400
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11401
- ] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11402
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11403
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11404
- ] }) });
11569
+ const isReady = !isPending && !!order;
11570
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11571
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11572
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
11573
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11574
+ ] }),
11575
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
11576
+ ] });
11405
11577
  };
11406
- const ShippingForm = ({ preview, order }) => {
11407
- var _a;
11408
- const { setIsOpen } = useStackedModal();
11409
- const [isSubmitting, setIsSubmitting] = React.useState(false);
11410
- const [data, setData] = React.useState(null);
11411
- const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11412
- const { shipping_options } = useShippingOptions(
11413
- {
11414
- id: appliedShippingOptionIds,
11415
- fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11578
+ const ShippingAddressForm = ({ order }) => {
11579
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11580
+ const form = reactHookForm.useForm({
11581
+ defaultValues: {
11582
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11583
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11584
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11585
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11586
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11587
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11588
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11589
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11590
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11591
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11416
11592
  },
11417
- {
11418
- enabled: appliedShippingOptionIds.length > 0
11419
- }
11420
- );
11421
- const uniqueShippingProfiles = React.useMemo(() => {
11422
- const profiles = /* @__PURE__ */ new Map();
11423
- getUniqueShippingProfiles(order.items).forEach((profile) => {
11424
- profiles.set(profile.id, profile);
11425
- });
11426
- shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11427
- profiles.set(option.shipping_profile_id, option.shipping_profile);
11428
- });
11429
- return Array.from(profiles.values());
11430
- }, [order.items, shipping_options]);
11593
+ resolver: zod.zodResolver(schema$1)
11594
+ });
11595
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11431
11596
  const { handleSuccess } = useRouteModal();
11432
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11433
- const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11434
- const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11435
- const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11436
- const onSubmit = async () => {
11437
- setIsSubmitting(true);
11438
- let requestSucceeded = false;
11439
- await requestOrderEdit(void 0, {
11440
- onError: (e) => {
11441
- ui.toast.error(`Failed to request order edit: ${e.message}`);
11597
+ const onSubmit = form.handleSubmit(async (data) => {
11598
+ await mutateAsync(
11599
+ {
11600
+ shipping_address: {
11601
+ first_name: data.first_name,
11602
+ last_name: data.last_name,
11603
+ company: data.company,
11604
+ address_1: data.address_1,
11605
+ address_2: data.address_2,
11606
+ city: data.city,
11607
+ province: data.province,
11608
+ country_code: data.country_code,
11609
+ postal_code: data.postal_code,
11610
+ phone: data.phone
11611
+ }
11442
11612
  },
11443
- onSuccess: () => {
11444
- requestSucceeded = true;
11445
- }
11446
- });
11447
- if (!requestSucceeded) {
11448
- setIsSubmitting(false);
11613
+ {
11614
+ onSuccess: () => {
11615
+ handleSuccess();
11616
+ },
11617
+ onError: (error) => {
11618
+ ui.toast.error(error.message);
11619
+ }
11620
+ }
11621
+ );
11622
+ });
11623
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11624
+ KeyboundForm,
11625
+ {
11626
+ className: "flex flex-1 flex-col overflow-hidden",
11627
+ onSubmit,
11628
+ children: [
11629
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
11630
+ /* @__PURE__ */ jsxRuntime.jsx(
11631
+ Form$2.Field,
11632
+ {
11633
+ control: form.control,
11634
+ name: "country_code",
11635
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11636
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11637
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11638
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11639
+ ] })
11640
+ }
11641
+ ),
11642
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11643
+ /* @__PURE__ */ jsxRuntime.jsx(
11644
+ Form$2.Field,
11645
+ {
11646
+ control: form.control,
11647
+ name: "first_name",
11648
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11649
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11650
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11651
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11652
+ ] })
11653
+ }
11654
+ ),
11655
+ /* @__PURE__ */ jsxRuntime.jsx(
11656
+ Form$2.Field,
11657
+ {
11658
+ control: form.control,
11659
+ name: "last_name",
11660
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11661
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11662
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11663
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11664
+ ] })
11665
+ }
11666
+ )
11667
+ ] }),
11668
+ /* @__PURE__ */ jsxRuntime.jsx(
11669
+ Form$2.Field,
11670
+ {
11671
+ control: form.control,
11672
+ name: "company",
11673
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11674
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11675
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11676
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11677
+ ] })
11678
+ }
11679
+ ),
11680
+ /* @__PURE__ */ jsxRuntime.jsx(
11681
+ Form$2.Field,
11682
+ {
11683
+ control: form.control,
11684
+ name: "address_1",
11685
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11686
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11687
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11689
+ ] })
11690
+ }
11691
+ ),
11692
+ /* @__PURE__ */ jsxRuntime.jsx(
11693
+ Form$2.Field,
11694
+ {
11695
+ control: form.control,
11696
+ name: "address_2",
11697
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11698
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11699
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11700
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11701
+ ] })
11702
+ }
11703
+ ),
11704
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11705
+ /* @__PURE__ */ jsxRuntime.jsx(
11706
+ Form$2.Field,
11707
+ {
11708
+ control: form.control,
11709
+ name: "postal_code",
11710
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11711
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11712
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11714
+ ] })
11715
+ }
11716
+ ),
11717
+ /* @__PURE__ */ jsxRuntime.jsx(
11718
+ Form$2.Field,
11719
+ {
11720
+ control: form.control,
11721
+ name: "city",
11722
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11723
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11724
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11725
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11726
+ ] })
11727
+ }
11728
+ )
11729
+ ] }),
11730
+ /* @__PURE__ */ jsxRuntime.jsx(
11731
+ Form$2.Field,
11732
+ {
11733
+ control: form.control,
11734
+ name: "province",
11735
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11736
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11737
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11739
+ ] })
11740
+ }
11741
+ ),
11742
+ /* @__PURE__ */ jsxRuntime.jsx(
11743
+ Form$2.Field,
11744
+ {
11745
+ control: form.control,
11746
+ name: "phone",
11747
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11748
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11749
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11750
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11751
+ ] })
11752
+ }
11753
+ )
11754
+ ] }) }),
11755
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11756
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11757
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11758
+ ] }) })
11759
+ ]
11760
+ }
11761
+ ) });
11762
+ };
11763
+ const schema$1 = addressSchema;
11764
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11765
+ const Shipping = () => {
11766
+ var _a;
11767
+ const { id } = reactRouterDom.useParams();
11768
+ const { order, isPending, isError, error } = useOrder(id, {
11769
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11770
+ });
11771
+ const {
11772
+ order: preview,
11773
+ isPending: isPreviewPending,
11774
+ isError: isPreviewError,
11775
+ error: previewError
11776
+ } = useOrderPreview(id);
11777
+ useInitiateOrderEdit({ preview });
11778
+ const { onCancel } = useCancelOrderEdit({ preview });
11779
+ if (isError) {
11780
+ throw error;
11781
+ }
11782
+ if (isPreviewError) {
11783
+ throw previewError;
11784
+ }
11785
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11786
+ const isReady = preview && !isPreviewPending && order && !isPending;
11787
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11788
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
11789
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
11790
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
11791
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11792
+ ] }) }) }),
11793
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11794
+ ] }) : isReady ? /* @__PURE__ */ jsxRuntime.jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11795
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11796
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11797
+ ] }) });
11798
+ };
11799
+ const ShippingForm = ({ preview, order }) => {
11800
+ var _a;
11801
+ const { setIsOpen } = useStackedModal();
11802
+ const [isSubmitting, setIsSubmitting] = React.useState(false);
11803
+ const [data, setData] = React.useState(null);
11804
+ const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11805
+ const { shipping_options } = useShippingOptions(
11806
+ {
11807
+ id: appliedShippingOptionIds,
11808
+ fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11809
+ },
11810
+ {
11811
+ enabled: appliedShippingOptionIds.length > 0
11812
+ }
11813
+ );
11814
+ const uniqueShippingProfiles = React.useMemo(() => {
11815
+ const profiles = /* @__PURE__ */ new Map();
11816
+ getUniqueShippingProfiles(order.items).forEach((profile) => {
11817
+ profiles.set(profile.id, profile);
11818
+ });
11819
+ shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11820
+ profiles.set(option.shipping_profile_id, option.shipping_profile);
11821
+ });
11822
+ return Array.from(profiles.values());
11823
+ }, [order.items, shipping_options]);
11824
+ const { handleSuccess } = useRouteModal();
11825
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11826
+ const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11827
+ const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11828
+ const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11829
+ const onSubmit = async () => {
11830
+ setIsSubmitting(true);
11831
+ let requestSucceeded = false;
11832
+ await requestOrderEdit(void 0, {
11833
+ onError: (e) => {
11834
+ ui.toast.error(`Failed to request order edit: ${e.message}`);
11835
+ },
11836
+ onSuccess: () => {
11837
+ requestSucceeded = true;
11838
+ }
11839
+ });
11840
+ if (!requestSucceeded) {
11841
+ setIsSubmitting(false);
11449
11842
  return;
11450
11843
  }
11451
11844
  await confirmOrderEdit(void 0, {
@@ -12198,7 +12591,7 @@ const TransferOwnershipForm = ({ order }) => {
12198
12591
  defaultValues: {
12199
12592
  customer_id: order.customer_id || ""
12200
12593
  },
12201
- resolver: zod.zodResolver(schema$2)
12594
+ resolver: zod.zodResolver(schema)
12202
12595
  });
12203
12596
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12204
12597
  const { handleSuccess } = useRouteModal();
@@ -12519,531 +12912,138 @@ const Illustration = () => {
12519
12912
  rx: "1.5",
12520
12913
  transform: "matrix(0.865865 0.500278 -0.871576 0.490261 105.4 62.5457)",
12521
12914
  fill: "#A1A1AA"
12522
- }
12523
- ),
12524
- /* @__PURE__ */ jsxRuntime.jsx(
12525
- "path",
12526
- {
12527
- d: "M104.562 57.0927C103.13 56.265 100.792 56.2515 99.3501 57.0626C97.9081 57.8738 97.9004 59.2065 99.333 60.0343C100.766 60.862 103.103 60.8754 104.545 60.0643C105.987 59.2532 105.995 57.9204 104.562 57.0927ZM103.858 58.8972L100.815 59.1265C100.683 59.1367 100.55 59.1134 100.449 59.063C100.44 59.0585 100.432 59.0545 100.425 59.05C100.339 59.0005 100.29 58.9336 100.291 58.8637L100.294 58.1201C100.294 57.9752 100.501 57.8585 100.756 57.86C101.01 57.8615 101.217 57.98 101.216 58.1256L101.214 58.5669L103.732 58.3769C103.984 58.3578 104.217 58.4584 104.251 58.603C104.286 58.7468 104.11 58.8788 103.858 58.8977L103.858 58.8972Z",
12528
- fill: "#52525B"
12529
- }
12530
- ),
12531
- /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12532
- "path",
12533
- {
12534
- d: "M133.106 81.8022L140.49 81.8447L140.515 77.6349",
12535
- stroke: "#A1A1AA",
12536
- strokeWidth: "1.5",
12537
- strokeLinecap: "round",
12538
- strokeLinejoin: "round"
12539
- }
12540
- ) }),
12541
- /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip1_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12542
- "path",
12543
- {
12544
- d: "M143.496 87.8055L150.881 87.8481L150.905 83.6383",
12545
- stroke: "#A1A1AA",
12546
- strokeWidth: "1.5",
12547
- strokeLinecap: "round",
12548
- strokeLinejoin: "round"
12549
- }
12550
- ) }),
12551
- /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip2_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12552
- "path",
12553
- {
12554
- d: "M153.887 93.8088L161.271 93.8514L161.295 89.6416",
12555
- stroke: "#A1A1AA",
12556
- strokeWidth: "1.5",
12557
- strokeLinecap: "round",
12558
- strokeLinejoin: "round"
12559
- }
12560
- ) }),
12561
- /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip3_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12562
- "path",
12563
- {
12564
- d: "M126.114 89.1912L118.729 89.1486L118.705 93.3584",
12565
- stroke: "#A1A1AA",
12566
- strokeWidth: "1.5",
12567
- strokeLinecap: "round",
12568
- strokeLinejoin: "round"
12569
- }
12570
- ) }),
12571
- /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip4_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12572
- "path",
12573
- {
12574
- d: "M136.504 95.1945L129.12 95.1519L129.095 99.3617",
12575
- stroke: "#A1A1AA",
12576
- strokeWidth: "1.5",
12577
- strokeLinecap: "round",
12578
- strokeLinejoin: "round"
12579
- }
12580
- ) }),
12581
- /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12582
- "path",
12583
- {
12584
- d: "M146.894 101.198L139.51 101.155L139.486 105.365",
12585
- stroke: "#A1A1AA",
12586
- strokeWidth: "1.5",
12587
- strokeLinecap: "round",
12588
- strokeLinejoin: "round"
12589
- }
12590
- ) }),
12591
- /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
12592
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12593
- "rect",
12594
- {
12595
- width: "12",
12596
- height: "12",
12597
- fill: "white",
12598
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12599
- }
12600
- ) }),
12601
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12602
- "rect",
12603
- {
12604
- width: "12",
12605
- height: "12",
12606
- fill: "white",
12607
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12608
- }
12609
- ) }),
12610
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12611
- "rect",
12612
- {
12613
- width: "12",
12614
- height: "12",
12615
- fill: "white",
12616
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12617
- }
12618
- ) }),
12619
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12620
- "rect",
12621
- {
12622
- width: "12",
12623
- height: "12",
12624
- fill: "white",
12625
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12626
- }
12627
- ) }),
12628
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12629
- "rect",
12630
- {
12631
- width: "12",
12632
- height: "12",
12633
- fill: "white",
12634
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12635
- }
12636
- ) }),
12637
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12638
- "rect",
12639
- {
12640
- width: "12",
12641
- height: "12",
12642
- fill: "white",
12643
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12644
- }
12645
- ) })
12646
- ] })
12647
- ]
12648
- }
12649
- );
12650
- };
12651
- const schema$2 = objectType({
12652
- customer_id: stringType().min(1)
12653
- });
12654
- const ShippingAddress = () => {
12655
- const { id } = reactRouterDom.useParams();
12656
- const { order, isPending, isError, error } = useOrder(id, {
12657
- fields: "+shipping_address"
12658
- });
12659
- if (isError) {
12660
- throw error;
12661
- }
12662
- const isReady = !isPending && !!order;
12663
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12664
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12665
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12666
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12667
- ] }),
12668
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12669
- ] });
12670
- };
12671
- const ShippingAddressForm = ({ order }) => {
12672
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12673
- const form = reactHookForm.useForm({
12674
- defaultValues: {
12675
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12676
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12677
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12678
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12679
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12680
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12681
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12682
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12683
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12684
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12685
- },
12686
- resolver: zod.zodResolver(schema$1)
12687
- });
12688
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12689
- const { handleSuccess } = useRouteModal();
12690
- const onSubmit = form.handleSubmit(async (data) => {
12691
- await mutateAsync(
12692
- {
12693
- shipping_address: {
12694
- first_name: data.first_name,
12695
- last_name: data.last_name,
12696
- company: data.company,
12697
- address_1: data.address_1,
12698
- address_2: data.address_2,
12699
- city: data.city,
12700
- province: data.province,
12701
- country_code: data.country_code,
12702
- postal_code: data.postal_code,
12703
- phone: data.phone
12704
- }
12705
- },
12706
- {
12707
- onSuccess: () => {
12708
- handleSuccess();
12709
- },
12710
- onError: (error) => {
12711
- ui.toast.error(error.message);
12712
- }
12713
- }
12714
- );
12715
- });
12716
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12717
- KeyboundForm,
12718
- {
12719
- className: "flex flex-1 flex-col overflow-hidden",
12720
- onSubmit,
12721
- children: [
12722
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12723
- /* @__PURE__ */ jsxRuntime.jsx(
12724
- Form$2.Field,
12725
- {
12726
- control: form.control,
12727
- name: "country_code",
12728
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12729
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12730
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12731
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12732
- ] })
12733
- }
12734
- ),
12735
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12736
- /* @__PURE__ */ jsxRuntime.jsx(
12737
- Form$2.Field,
12738
- {
12739
- control: form.control,
12740
- name: "first_name",
12741
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12742
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12743
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12744
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12745
- ] })
12746
- }
12747
- ),
12748
- /* @__PURE__ */ jsxRuntime.jsx(
12749
- Form$2.Field,
12750
- {
12751
- control: form.control,
12752
- name: "last_name",
12753
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12754
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12755
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12756
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12757
- ] })
12758
- }
12759
- )
12760
- ] }),
12761
- /* @__PURE__ */ jsxRuntime.jsx(
12762
- Form$2.Field,
12763
- {
12764
- control: form.control,
12765
- name: "company",
12766
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12767
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12768
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12769
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12770
- ] })
12771
- }
12772
- ),
12773
- /* @__PURE__ */ jsxRuntime.jsx(
12774
- Form$2.Field,
12775
- {
12776
- control: form.control,
12777
- name: "address_1",
12778
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12779
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12780
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12781
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12782
- ] })
12783
- }
12784
- ),
12785
- /* @__PURE__ */ jsxRuntime.jsx(
12786
- Form$2.Field,
12787
- {
12788
- control: form.control,
12789
- name: "address_2",
12790
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12791
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12792
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12793
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12794
- ] })
12795
- }
12796
- ),
12797
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12798
- /* @__PURE__ */ jsxRuntime.jsx(
12799
- Form$2.Field,
12800
- {
12801
- control: form.control,
12802
- name: "postal_code",
12803
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12804
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12805
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12806
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12807
- ] })
12808
- }
12809
- ),
12810
- /* @__PURE__ */ jsxRuntime.jsx(
12811
- Form$2.Field,
12812
- {
12813
- control: form.control,
12814
- name: "city",
12815
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12816
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12817
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12818
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12819
- ] })
12820
- }
12821
- )
12822
- ] }),
12823
- /* @__PURE__ */ jsxRuntime.jsx(
12824
- Form$2.Field,
12825
- {
12826
- control: form.control,
12827
- name: "province",
12828
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12829
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12830
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12831
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12832
- ] })
12833
- }
12834
- ),
12835
- /* @__PURE__ */ jsxRuntime.jsx(
12836
- Form$2.Field,
12837
- {
12838
- control: form.control,
12839
- name: "phone",
12840
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12841
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12842
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12843
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12844
- ] })
12845
- }
12846
- )
12847
- ] }) }),
12848
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12849
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12850
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12851
- ] }) })
12852
- ]
12853
- }
12854
- ) });
12855
- };
12856
- const schema$1 = addressSchema;
12857
- const BillingAddress = () => {
12858
- const { id } = reactRouterDom.useParams();
12859
- const { order, isPending, isError, error } = useOrder(id, {
12860
- fields: "+billing_address"
12861
- });
12862
- if (isError) {
12863
- throw error;
12864
- }
12865
- const isReady = !isPending && !!order;
12866
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12867
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12868
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12869
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12870
- ] }),
12871
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
12872
- ] });
12873
- };
12874
- const BillingAddressForm = ({ order }) => {
12875
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12876
- const form = reactHookForm.useForm({
12877
- defaultValues: {
12878
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12879
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12880
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12881
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12882
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12883
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12884
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12885
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12886
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12887
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12888
- },
12889
- resolver: zod.zodResolver(schema)
12890
- });
12891
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12892
- const { handleSuccess } = useRouteModal();
12893
- const onSubmit = form.handleSubmit(async (data) => {
12894
- await mutateAsync(
12895
- { billing_address: data },
12896
- {
12897
- onSuccess: () => {
12898
- handleSuccess();
12899
- },
12900
- onError: (error) => {
12901
- ui.toast.error(error.message);
12902
- }
12903
- }
12904
- );
12905
- });
12906
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12907
- KeyboundForm,
12908
- {
12909
- className: "flex flex-1 flex-col overflow-hidden",
12910
- onSubmit,
12911
- children: [
12912
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12913
- /* @__PURE__ */ jsxRuntime.jsx(
12914
- Form$2.Field,
12915
+ }
12916
+ ),
12917
+ /* @__PURE__ */ jsxRuntime.jsx(
12918
+ "path",
12919
+ {
12920
+ d: "M104.562 57.0927C103.13 56.265 100.792 56.2515 99.3501 57.0626C97.9081 57.8738 97.9004 59.2065 99.333 60.0343C100.766 60.862 103.103 60.8754 104.545 60.0643C105.987 59.2532 105.995 57.9204 104.562 57.0927ZM103.858 58.8972L100.815 59.1265C100.683 59.1367 100.55 59.1134 100.449 59.063C100.44 59.0585 100.432 59.0545 100.425 59.05C100.339 59.0005 100.29 58.9336 100.291 58.8637L100.294 58.1201C100.294 57.9752 100.501 57.8585 100.756 57.86C101.01 57.8615 101.217 57.98 101.216 58.1256L101.214 58.5669L103.732 58.3769C103.984 58.3578 104.217 58.4584 104.251 58.603C104.286 58.7468 104.11 58.8788 103.858 58.8977L103.858 58.8972Z",
12921
+ fill: "#52525B"
12922
+ }
12923
+ ),
12924
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip0_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12925
+ "path",
12926
+ {
12927
+ d: "M133.106 81.8022L140.49 81.8447L140.515 77.6349",
12928
+ stroke: "#A1A1AA",
12929
+ strokeWidth: "1.5",
12930
+ strokeLinecap: "round",
12931
+ strokeLinejoin: "round"
12932
+ }
12933
+ ) }),
12934
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip1_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12935
+ "path",
12936
+ {
12937
+ d: "M143.496 87.8055L150.881 87.8481L150.905 83.6383",
12938
+ stroke: "#A1A1AA",
12939
+ strokeWidth: "1.5",
12940
+ strokeLinecap: "round",
12941
+ strokeLinejoin: "round"
12942
+ }
12943
+ ) }),
12944
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip2_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12945
+ "path",
12946
+ {
12947
+ d: "M153.887 93.8088L161.271 93.8514L161.295 89.6416",
12948
+ stroke: "#A1A1AA",
12949
+ strokeWidth: "1.5",
12950
+ strokeLinecap: "round",
12951
+ strokeLinejoin: "round"
12952
+ }
12953
+ ) }),
12954
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip3_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12955
+ "path",
12956
+ {
12957
+ d: "M126.114 89.1912L118.729 89.1486L118.705 93.3584",
12958
+ stroke: "#A1A1AA",
12959
+ strokeWidth: "1.5",
12960
+ strokeLinecap: "round",
12961
+ strokeLinejoin: "round"
12962
+ }
12963
+ ) }),
12964
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip4_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12965
+ "path",
12966
+ {
12967
+ d: "M136.504 95.1945L129.12 95.1519L129.095 99.3617",
12968
+ stroke: "#A1A1AA",
12969
+ strokeWidth: "1.5",
12970
+ strokeLinecap: "round",
12971
+ strokeLinejoin: "round"
12972
+ }
12973
+ ) }),
12974
+ /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: "url(#clip5_20915_38670)", children: /* @__PURE__ */ jsxRuntime.jsx(
12975
+ "path",
12976
+ {
12977
+ d: "M146.894 101.198L139.51 101.155L139.486 105.365",
12978
+ stroke: "#A1A1AA",
12979
+ strokeWidth: "1.5",
12980
+ strokeLinecap: "round",
12981
+ strokeLinejoin: "round"
12982
+ }
12983
+ ) }),
12984
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
12985
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12986
+ "rect",
12915
12987
  {
12916
- control: form.control,
12917
- name: "country_code",
12918
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12919
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12922
- ] })
12988
+ width: "12",
12989
+ height: "12",
12990
+ fill: "white",
12991
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12923
12992
  }
12924
- ),
12925
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12926
- /* @__PURE__ */ jsxRuntime.jsx(
12927
- Form$2.Field,
12928
- {
12929
- control: form.control,
12930
- name: "first_name",
12931
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
- ] })
12936
- }
12937
- ),
12938
- /* @__PURE__ */ jsxRuntime.jsx(
12939
- Form$2.Field,
12940
- {
12941
- control: form.control,
12942
- name: "last_name",
12943
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12944
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12946
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12947
- ] })
12948
- }
12949
- )
12950
- ] }),
12951
- /* @__PURE__ */ jsxRuntime.jsx(
12952
- Form$2.Field,
12993
+ ) }),
12994
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12995
+ "rect",
12953
12996
  {
12954
- control: form.control,
12955
- name: "company",
12956
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
- ] })
12997
+ width: "12",
12998
+ height: "12",
12999
+ fill: "white",
13000
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12961
13001
  }
12962
- ),
12963
- /* @__PURE__ */ jsxRuntime.jsx(
12964
- Form$2.Field,
13002
+ ) }),
13003
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13004
+ "rect",
12965
13005
  {
12966
- control: form.control,
12967
- name: "address_1",
12968
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
- ] })
13006
+ width: "12",
13007
+ height: "12",
13008
+ fill: "white",
13009
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12973
13010
  }
12974
- ),
12975
- /* @__PURE__ */ jsxRuntime.jsx(
12976
- Form$2.Field,
13011
+ ) }),
13012
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13013
+ "rect",
12977
13014
  {
12978
- control: form.control,
12979
- name: "address_2",
12980
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12981
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12984
- ] })
13015
+ width: "12",
13016
+ height: "12",
13017
+ fill: "white",
13018
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12985
13019
  }
12986
- ),
12987
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12988
- /* @__PURE__ */ jsxRuntime.jsx(
12989
- Form$2.Field,
12990
- {
12991
- control: form.control,
12992
- name: "postal_code",
12993
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
- ] })
12998
- }
12999
- ),
13000
- /* @__PURE__ */ jsxRuntime.jsx(
13001
- Form$2.Field,
13002
- {
13003
- control: form.control,
13004
- name: "city",
13005
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13006
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13008
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13009
- ] })
13010
- }
13011
- )
13012
- ] }),
13013
- /* @__PURE__ */ jsxRuntime.jsx(
13014
- Form$2.Field,
13020
+ ) }),
13021
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13022
+ "rect",
13015
13023
  {
13016
- control: form.control,
13017
- name: "province",
13018
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
- ] })
13024
+ width: "12",
13025
+ height: "12",
13026
+ fill: "white",
13027
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
13023
13028
  }
13024
- ),
13025
- /* @__PURE__ */ jsxRuntime.jsx(
13026
- Form$2.Field,
13029
+ ) }),
13030
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13031
+ "rect",
13027
13032
  {
13028
- control: form.control,
13029
- name: "phone",
13030
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13033
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13034
- ] })
13033
+ width: "12",
13034
+ height: "12",
13035
+ fill: "white",
13036
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
13035
13037
  }
13036
- )
13037
- ] }) }),
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13039
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13040
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13041
- ] }) })
13038
+ ) })
13039
+ ] })
13042
13040
  ]
13043
13041
  }
13044
- ) });
13042
+ );
13045
13043
  };
13046
- const schema = addressSchema;
13044
+ const schema = objectType({
13045
+ customer_id: stringType().min(1)
13046
+ });
13047
13047
  const widgetModule = { widgets: [] };
13048
13048
  const routeModule = {
13049
13049
  routes: [
@@ -13065,17 +13065,21 @@ const routeModule = {
13065
13065
  loader,
13066
13066
  children: [
13067
13067
  {
13068
- Component: CustomItems,
13069
- path: "/draft-orders/:id/custom-items"
13068
+ Component: BillingAddress,
13069
+ path: "/draft-orders/:id/billing-address"
13070
13070
  },
13071
13071
  {
13072
- Component: Items,
13073
- path: "/draft-orders/:id/items"
13072
+ Component: CustomItems,
13073
+ path: "/draft-orders/:id/custom-items"
13074
13074
  },
13075
13075
  {
13076
13076
  Component: Email,
13077
13077
  path: "/draft-orders/:id/email"
13078
13078
  },
13079
+ {
13080
+ Component: Items,
13081
+ path: "/draft-orders/:id/items"
13082
+ },
13079
13083
  {
13080
13084
  Component: Metadata,
13081
13085
  path: "/draft-orders/:id/metadata"
@@ -13088,6 +13092,10 @@ const routeModule = {
13088
13092
  Component: SalesChannel,
13089
13093
  path: "/draft-orders/:id/sales-channel"
13090
13094
  },
13095
+ {
13096
+ Component: ShippingAddress,
13097
+ path: "/draft-orders/:id/shipping-address"
13098
+ },
13091
13099
  {
13092
13100
  Component: Shipping,
13093
13101
  path: "/draft-orders/:id/shipping"
@@ -13095,14 +13103,6 @@ const routeModule = {
13095
13103
  {
13096
13104
  Component: TransferOwnership,
13097
13105
  path: "/draft-orders/:id/transfer-ownership"
13098
- },
13099
- {
13100
- Component: ShippingAddress,
13101
- path: "/draft-orders/:id/shipping-address"
13102
- },
13103
- {
13104
- Component: BillingAddress,
13105
- path: "/draft-orders/:id/billing-address"
13106
13106
  }
13107
13107
  ]
13108
13108
  }