@medusajs/draft-order 2.11.0-preview-20251018180153 → 2.11.0-preview-20251019000333

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.
@@ -9757,23 +9757,70 @@ const BillingAddressForm = ({ order }) => {
9757
9757
  ) });
9758
9758
  };
9759
9759
  const schema$5 = addressSchema;
9760
- const CustomItems = () => {
9760
+ const Email = () => {
9761
+ const { id } = useParams();
9762
+ const { order, isPending, isError, error } = useOrder(id, {
9763
+ fields: "+email"
9764
+ });
9765
+ if (isError) {
9766
+ throw error;
9767
+ }
9768
+ const isReady = !isPending && !!order;
9761
9769
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9762
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9763
- /* @__PURE__ */ jsx(CustomItemsForm, {})
9770
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9771
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9772
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9773
+ ] }),
9774
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9764
9775
  ] });
9765
9776
  };
9766
- const CustomItemsForm = () => {
9777
+ const EmailForm = ({ order }) => {
9767
9778
  const form = useForm({
9779
+ defaultValues: {
9780
+ email: order.email ?? ""
9781
+ },
9768
9782
  resolver: zodResolver(schema$4)
9769
9783
  });
9770
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9771
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9772
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9773
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9774
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9775
- ] }) })
9776
- ] }) });
9784
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9785
+ const { handleSuccess } = useRouteModal();
9786
+ const onSubmit = form.handleSubmit(async (data) => {
9787
+ await mutateAsync(
9788
+ { email: data.email },
9789
+ {
9790
+ onSuccess: () => {
9791
+ handleSuccess();
9792
+ },
9793
+ onError: (error) => {
9794
+ toast.error(error.message);
9795
+ }
9796
+ }
9797
+ );
9798
+ });
9799
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9800
+ KeyboundForm,
9801
+ {
9802
+ className: "flex flex-1 flex-col overflow-hidden",
9803
+ onSubmit,
9804
+ children: [
9805
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9806
+ Form$2.Field,
9807
+ {
9808
+ control: form.control,
9809
+ name: "email",
9810
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9811
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9812
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9813
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9814
+ ] })
9815
+ }
9816
+ ) }),
9817
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9818
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9819
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9820
+ ] }) })
9821
+ ]
9822
+ }
9823
+ ) });
9777
9824
  };
9778
9825
  const schema$4 = objectType({
9779
9826
  email: stringType().email()
@@ -11485,331 +11532,128 @@ const SalesChannelField = ({ control, order }) => {
11485
11532
  const schema$3 = objectType({
11486
11533
  sales_channel_id: stringType().min(1)
11487
11534
  });
11488
- const ShippingAddress = () => {
11535
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11536
+ const Shipping = () => {
11537
+ var _a;
11489
11538
  const { id } = useParams();
11490
11539
  const { order, isPending, isError, error } = useOrder(id, {
11491
- fields: "+shipping_address"
11540
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11492
11541
  });
11542
+ const {
11543
+ order: preview,
11544
+ isPending: isPreviewPending,
11545
+ isError: isPreviewError,
11546
+ error: previewError
11547
+ } = useOrderPreview(id);
11548
+ useInitiateOrderEdit({ preview });
11549
+ const { onCancel } = useCancelOrderEdit({ preview });
11493
11550
  if (isError) {
11494
11551
  throw error;
11495
11552
  }
11496
- const isReady = !isPending && !!order;
11497
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11498
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11499
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11500
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11501
- ] }),
11502
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11503
- ] });
11553
+ if (isPreviewError) {
11554
+ throw previewError;
11555
+ }
11556
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11557
+ const isReady = preview && !isPreviewPending && order && !isPending;
11558
+ return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11559
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11560
+ /* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
11561
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11562
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11563
+ ] }) }) }),
11564
+ /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11565
+ ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11566
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11567
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11568
+ ] }) });
11504
11569
  };
11505
- const ShippingAddressForm = ({ order }) => {
11506
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11507
- const form = useForm({
11508
- defaultValues: {
11509
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11510
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11511
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11512
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11513
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11514
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11515
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11516
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11517
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11518
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11570
+ const ShippingForm = ({ preview, order }) => {
11571
+ var _a;
11572
+ const { setIsOpen } = useStackedModal();
11573
+ const [isSubmitting, setIsSubmitting] = useState(false);
11574
+ const [data, setData] = useState(null);
11575
+ const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11576
+ const { shipping_options } = useShippingOptions(
11577
+ {
11578
+ id: appliedShippingOptionIds,
11579
+ fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11519
11580
  },
11520
- resolver: zodResolver(schema$2)
11521
- });
11522
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11581
+ {
11582
+ enabled: appliedShippingOptionIds.length > 0
11583
+ }
11584
+ );
11585
+ const uniqueShippingProfiles = useMemo(() => {
11586
+ const profiles = /* @__PURE__ */ new Map();
11587
+ getUniqueShippingProfiles(order.items).forEach((profile) => {
11588
+ profiles.set(profile.id, profile);
11589
+ });
11590
+ shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11591
+ profiles.set(option.shipping_profile_id, option.shipping_profile);
11592
+ });
11593
+ return Array.from(profiles.values());
11594
+ }, [order.items, shipping_options]);
11523
11595
  const { handleSuccess } = useRouteModal();
11524
- const onSubmit = form.handleSubmit(async (data) => {
11525
- await mutateAsync(
11526
- {
11527
- shipping_address: {
11528
- first_name: data.first_name,
11529
- last_name: data.last_name,
11530
- company: data.company,
11531
- address_1: data.address_1,
11532
- address_2: data.address_2,
11533
- city: data.city,
11534
- province: data.province,
11535
- country_code: data.country_code,
11536
- postal_code: data.postal_code,
11537
- phone: data.phone
11538
- }
11596
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11597
+ const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11598
+ const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11599
+ const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11600
+ const onSubmit = async () => {
11601
+ setIsSubmitting(true);
11602
+ let requestSucceeded = false;
11603
+ await requestOrderEdit(void 0, {
11604
+ onError: (e) => {
11605
+ toast.error(`Failed to request order edit: ${e.message}`);
11539
11606
  },
11540
- {
11541
- onSuccess: () => {
11542
- handleSuccess();
11543
- },
11544
- onError: (error) => {
11545
- toast.error(error.message);
11607
+ onSuccess: () => {
11608
+ requestSucceeded = true;
11609
+ }
11610
+ });
11611
+ if (!requestSucceeded) {
11612
+ setIsSubmitting(false);
11613
+ return;
11614
+ }
11615
+ await confirmOrderEdit(void 0, {
11616
+ onError: (e) => {
11617
+ toast.error(`Failed to confirm order edit: ${e.message}`);
11618
+ },
11619
+ onSuccess: () => {
11620
+ handleSuccess();
11621
+ },
11622
+ onSettled: () => {
11623
+ setIsSubmitting(false);
11624
+ }
11625
+ });
11626
+ };
11627
+ const onKeydown = useCallback(
11628
+ (e) => {
11629
+ if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11630
+ if (data || isSubmitting) {
11631
+ return;
11546
11632
  }
11633
+ onSubmit();
11547
11634
  }
11548
- );
11549
- });
11550
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11551
- KeyboundForm,
11552
- {
11553
- className: "flex flex-1 flex-col overflow-hidden",
11554
- onSubmit,
11555
- children: [
11556
- /* @__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: [
11557
- /* @__PURE__ */ jsx(
11558
- Form$2.Field,
11559
- {
11560
- control: form.control,
11561
- name: "country_code",
11562
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11563
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11564
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11565
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11566
- ] })
11567
- }
11568
- ),
11569
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11635
+ },
11636
+ [data, isSubmitting, onSubmit]
11637
+ );
11638
+ useEffect(() => {
11639
+ document.addEventListener("keydown", onKeydown);
11640
+ return () => {
11641
+ document.removeEventListener("keydown", onKeydown);
11642
+ };
11643
+ }, [onKeydown]);
11644
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
11645
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11646
+ /* @__PURE__ */ jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
11647
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
11648
+ /* @__PURE__ */ jsxs("div", { children: [
11649
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11650
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
11651
+ ] }),
11652
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11653
+ /* @__PURE__ */ jsx(Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle rounded-xl shadow-elevation-card-rest", children: [
11654
+ /* @__PURE__ */ jsxs("div", { className: "px-4 py-2 flex items-center justify-between", children: [
11570
11655
  /* @__PURE__ */ jsx(
11571
- Form$2.Field,
11572
- {
11573
- control: form.control,
11574
- name: "first_name",
11575
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11576
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11577
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11578
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11579
- ] })
11580
- }
11581
- ),
11582
- /* @__PURE__ */ jsx(
11583
- Form$2.Field,
11584
- {
11585
- control: form.control,
11586
- name: "last_name",
11587
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11588
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11589
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11590
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11591
- ] })
11592
- }
11593
- )
11594
- ] }),
11595
- /* @__PURE__ */ jsx(
11596
- Form$2.Field,
11597
- {
11598
- control: form.control,
11599
- name: "company",
11600
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11601
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11602
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11603
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11604
- ] })
11605
- }
11606
- ),
11607
- /* @__PURE__ */ jsx(
11608
- Form$2.Field,
11609
- {
11610
- control: form.control,
11611
- name: "address_1",
11612
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11613
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11614
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11615
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11616
- ] })
11617
- }
11618
- ),
11619
- /* @__PURE__ */ jsx(
11620
- Form$2.Field,
11621
- {
11622
- control: form.control,
11623
- name: "address_2",
11624
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11625
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11626
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11627
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11628
- ] })
11629
- }
11630
- ),
11631
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11632
- /* @__PURE__ */ jsx(
11633
- Form$2.Field,
11634
- {
11635
- control: form.control,
11636
- name: "postal_code",
11637
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11638
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11639
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11640
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11641
- ] })
11642
- }
11643
- ),
11644
- /* @__PURE__ */ jsx(
11645
- Form$2.Field,
11646
- {
11647
- control: form.control,
11648
- name: "city",
11649
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11650
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11651
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11652
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11653
- ] })
11654
- }
11655
- )
11656
- ] }),
11657
- /* @__PURE__ */ jsx(
11658
- Form$2.Field,
11659
- {
11660
- control: form.control,
11661
- name: "province",
11662
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11663
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11664
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11665
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11666
- ] })
11667
- }
11668
- ),
11669
- /* @__PURE__ */ jsx(
11670
- Form$2.Field,
11671
- {
11672
- control: form.control,
11673
- name: "phone",
11674
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11675
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11676
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11677
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11678
- ] })
11679
- }
11680
- )
11681
- ] }) }),
11682
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11683
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11684
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11685
- ] }) })
11686
- ]
11687
- }
11688
- ) });
11689
- };
11690
- const schema$2 = addressSchema;
11691
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11692
- const Shipping = () => {
11693
- var _a;
11694
- const { id } = useParams();
11695
- const { order, isPending, isError, error } = useOrder(id, {
11696
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11697
- });
11698
- const {
11699
- order: preview,
11700
- isPending: isPreviewPending,
11701
- isError: isPreviewError,
11702
- error: previewError
11703
- } = useOrderPreview(id);
11704
- useInitiateOrderEdit({ preview });
11705
- const { onCancel } = useCancelOrderEdit({ preview });
11706
- if (isError) {
11707
- throw error;
11708
- }
11709
- if (isPreviewError) {
11710
- throw previewError;
11711
- }
11712
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11713
- const isReady = preview && !isPreviewPending && order && !isPending;
11714
- return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11715
- /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11716
- /* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
11717
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11718
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
11719
- ] }) }) }),
11720
- /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11721
- ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11722
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11723
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11724
- ] }) });
11725
- };
11726
- const ShippingForm = ({ preview, order }) => {
11727
- var _a;
11728
- const { setIsOpen } = useStackedModal();
11729
- const [isSubmitting, setIsSubmitting] = useState(false);
11730
- const [data, setData] = useState(null);
11731
- const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11732
- const { shipping_options } = useShippingOptions(
11733
- {
11734
- id: appliedShippingOptionIds,
11735
- fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11736
- },
11737
- {
11738
- enabled: appliedShippingOptionIds.length > 0
11739
- }
11740
- );
11741
- const uniqueShippingProfiles = useMemo(() => {
11742
- const profiles = /* @__PURE__ */ new Map();
11743
- getUniqueShippingProfiles(order.items).forEach((profile) => {
11744
- profiles.set(profile.id, profile);
11745
- });
11746
- shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11747
- profiles.set(option.shipping_profile_id, option.shipping_profile);
11748
- });
11749
- return Array.from(profiles.values());
11750
- }, [order.items, shipping_options]);
11751
- const { handleSuccess } = useRouteModal();
11752
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11753
- const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11754
- const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11755
- const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11756
- const onSubmit = async () => {
11757
- setIsSubmitting(true);
11758
- let requestSucceeded = false;
11759
- await requestOrderEdit(void 0, {
11760
- onError: (e) => {
11761
- toast.error(`Failed to request order edit: ${e.message}`);
11762
- },
11763
- onSuccess: () => {
11764
- requestSucceeded = true;
11765
- }
11766
- });
11767
- if (!requestSucceeded) {
11768
- setIsSubmitting(false);
11769
- return;
11770
- }
11771
- await confirmOrderEdit(void 0, {
11772
- onError: (e) => {
11773
- toast.error(`Failed to confirm order edit: ${e.message}`);
11774
- },
11775
- onSuccess: () => {
11776
- handleSuccess();
11777
- },
11778
- onSettled: () => {
11779
- setIsSubmitting(false);
11780
- }
11781
- });
11782
- };
11783
- const onKeydown = useCallback(
11784
- (e) => {
11785
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11786
- if (data || isSubmitting) {
11787
- return;
11788
- }
11789
- onSubmit();
11790
- }
11791
- },
11792
- [data, isSubmitting, onSubmit]
11793
- );
11794
- useEffect(() => {
11795
- document.addEventListener("keydown", onKeydown);
11796
- return () => {
11797
- document.removeEventListener("keydown", onKeydown);
11798
- };
11799
- }, [onKeydown]);
11800
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
11801
- /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11802
- /* @__PURE__ */ jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
11803
- /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 py-16 px-6", children: [
11804
- /* @__PURE__ */ jsxs("div", { children: [
11805
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11806
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
11807
- ] }),
11808
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
11809
- /* @__PURE__ */ jsx(Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle rounded-xl shadow-elevation-card-rest", children: [
11810
- /* @__PURE__ */ jsxs("div", { className: "px-4 py-2 flex items-center justify-between", children: [
11811
- /* @__PURE__ */ jsx(
11812
- Text,
11656
+ Text,
11813
11657
  {
11814
11658
  size: "xsmall",
11815
11659
  weight: "plus",
@@ -12495,31 +12339,234 @@ const CustomAmountField = ({
12495
12339
  }
12496
12340
  );
12497
12341
  };
12498
- const TransferOwnership = () => {
12342
+ const ShippingAddress = () => {
12499
12343
  const { id } = useParams();
12500
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12501
- fields: "id,customer_id,customer.*"
12344
+ const { order, isPending, isError, error } = useOrder(id, {
12345
+ fields: "+shipping_address"
12502
12346
  });
12503
12347
  if (isError) {
12504
12348
  throw error;
12505
12349
  }
12506
- const isReady = !isPending && !!draft_order;
12350
+ const isReady = !isPending && !!order;
12507
12351
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12508
12352
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12509
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12510
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12353
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12354
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12511
12355
  ] }),
12512
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12356
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12513
12357
  ] });
12514
12358
  };
12515
- const TransferOwnershipForm = ({ order }) => {
12516
- var _a, _b;
12359
+ const ShippingAddressForm = ({ order }) => {
12360
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12517
12361
  const form = useForm({
12518
12362
  defaultValues: {
12519
- customer_id: order.customer_id || ""
12520
- },
12521
- resolver: zodResolver(schema$1)
12522
- });
12363
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12364
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12365
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12366
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12367
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12368
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12369
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12370
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12371
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12372
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12373
+ },
12374
+ resolver: zodResolver(schema$2)
12375
+ });
12376
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12377
+ const { handleSuccess } = useRouteModal();
12378
+ const onSubmit = form.handleSubmit(async (data) => {
12379
+ await mutateAsync(
12380
+ {
12381
+ shipping_address: {
12382
+ first_name: data.first_name,
12383
+ last_name: data.last_name,
12384
+ company: data.company,
12385
+ address_1: data.address_1,
12386
+ address_2: data.address_2,
12387
+ city: data.city,
12388
+ province: data.province,
12389
+ country_code: data.country_code,
12390
+ postal_code: data.postal_code,
12391
+ phone: data.phone
12392
+ }
12393
+ },
12394
+ {
12395
+ onSuccess: () => {
12396
+ handleSuccess();
12397
+ },
12398
+ onError: (error) => {
12399
+ toast.error(error.message);
12400
+ }
12401
+ }
12402
+ );
12403
+ });
12404
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12405
+ KeyboundForm,
12406
+ {
12407
+ className: "flex flex-1 flex-col overflow-hidden",
12408
+ onSubmit,
12409
+ children: [
12410
+ /* @__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: [
12411
+ /* @__PURE__ */ jsx(
12412
+ Form$2.Field,
12413
+ {
12414
+ control: form.control,
12415
+ name: "country_code",
12416
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12417
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12418
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12419
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12420
+ ] })
12421
+ }
12422
+ ),
12423
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12424
+ /* @__PURE__ */ jsx(
12425
+ Form$2.Field,
12426
+ {
12427
+ control: form.control,
12428
+ name: "first_name",
12429
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12430
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12431
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12432
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12433
+ ] })
12434
+ }
12435
+ ),
12436
+ /* @__PURE__ */ jsx(
12437
+ Form$2.Field,
12438
+ {
12439
+ control: form.control,
12440
+ name: "last_name",
12441
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12442
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12443
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12444
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12445
+ ] })
12446
+ }
12447
+ )
12448
+ ] }),
12449
+ /* @__PURE__ */ jsx(
12450
+ Form$2.Field,
12451
+ {
12452
+ control: form.control,
12453
+ name: "company",
12454
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12455
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12456
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12457
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12458
+ ] })
12459
+ }
12460
+ ),
12461
+ /* @__PURE__ */ jsx(
12462
+ Form$2.Field,
12463
+ {
12464
+ control: form.control,
12465
+ name: "address_1",
12466
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12467
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12468
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12469
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12470
+ ] })
12471
+ }
12472
+ ),
12473
+ /* @__PURE__ */ jsx(
12474
+ Form$2.Field,
12475
+ {
12476
+ control: form.control,
12477
+ name: "address_2",
12478
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12479
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12480
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12481
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12482
+ ] })
12483
+ }
12484
+ ),
12485
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12486
+ /* @__PURE__ */ jsx(
12487
+ Form$2.Field,
12488
+ {
12489
+ control: form.control,
12490
+ name: "postal_code",
12491
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12492
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12493
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12494
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12495
+ ] })
12496
+ }
12497
+ ),
12498
+ /* @__PURE__ */ jsx(
12499
+ Form$2.Field,
12500
+ {
12501
+ control: form.control,
12502
+ name: "city",
12503
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12504
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12505
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12506
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12507
+ ] })
12508
+ }
12509
+ )
12510
+ ] }),
12511
+ /* @__PURE__ */ jsx(
12512
+ Form$2.Field,
12513
+ {
12514
+ control: form.control,
12515
+ name: "province",
12516
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12517
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12518
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12519
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12520
+ ] })
12521
+ }
12522
+ ),
12523
+ /* @__PURE__ */ jsx(
12524
+ Form$2.Field,
12525
+ {
12526
+ control: form.control,
12527
+ name: "phone",
12528
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12529
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12530
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12531
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12532
+ ] })
12533
+ }
12534
+ )
12535
+ ] }) }),
12536
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12537
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12538
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12539
+ ] }) })
12540
+ ]
12541
+ }
12542
+ ) });
12543
+ };
12544
+ const schema$2 = addressSchema;
12545
+ const TransferOwnership = () => {
12546
+ const { id } = useParams();
12547
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12548
+ fields: "id,customer_id,customer.*"
12549
+ });
12550
+ if (isError) {
12551
+ throw error;
12552
+ }
12553
+ const isReady = !isPending && !!draft_order;
12554
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12555
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12556
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12557
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Transfer the ownership of this draft order to a new customer" }) })
12558
+ ] }),
12559
+ isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12560
+ ] });
12561
+ };
12562
+ const TransferOwnershipForm = ({ order }) => {
12563
+ var _a, _b;
12564
+ const form = useForm({
12565
+ defaultValues: {
12566
+ customer_id: order.customer_id || ""
12567
+ },
12568
+ resolver: zodResolver(schema$1)
12569
+ });
12523
12570
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12524
12571
  const { handleSuccess } = useRouteModal();
12525
12572
  const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
@@ -12971,70 +13018,23 @@ const Illustration = () => {
12971
13018
  const schema$1 = objectType({
12972
13019
  customer_id: stringType().min(1)
12973
13020
  });
12974
- const Email = () => {
12975
- const { id } = useParams();
12976
- const { order, isPending, isError, error } = useOrder(id, {
12977
- fields: "+email"
12978
- });
12979
- if (isError) {
12980
- throw error;
12981
- }
12982
- const isReady = !isPending && !!order;
13021
+ const CustomItems = () => {
12983
13022
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12984
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12985
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12986
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12987
- ] }),
12988
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
13023
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
13024
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
12989
13025
  ] });
12990
13026
  };
12991
- const EmailForm = ({ order }) => {
13027
+ const CustomItemsForm = () => {
12992
13028
  const form = useForm({
12993
- defaultValues: {
12994
- email: order.email ?? ""
12995
- },
12996
13029
  resolver: zodResolver(schema)
12997
13030
  });
12998
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12999
- const { handleSuccess } = useRouteModal();
13000
- const onSubmit = form.handleSubmit(async (data) => {
13001
- await mutateAsync(
13002
- { email: data.email },
13003
- {
13004
- onSuccess: () => {
13005
- handleSuccess();
13006
- },
13007
- onError: (error) => {
13008
- toast.error(error.message);
13009
- }
13010
- }
13011
- );
13012
- });
13013
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
13014
- KeyboundForm,
13015
- {
13016
- className: "flex flex-1 flex-col overflow-hidden",
13017
- onSubmit,
13018
- children: [
13019
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13020
- Form$2.Field,
13021
- {
13022
- control: form.control,
13023
- name: "email",
13024
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13025
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13026
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13027
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13028
- ] })
13029
- }
13030
- ) }),
13031
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13032
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13033
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13034
- ] }) })
13035
- ]
13036
- }
13037
- ) });
13031
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
13032
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
13033
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13034
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13035
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
13036
+ ] }) })
13037
+ ] }) });
13038
13038
  };
13039
13039
  const schema = objectType({
13040
13040
  email: stringType().email()
@@ -13064,8 +13064,8 @@ const routeModule = {
13064
13064
  path: "/draft-orders/:id/billing-address"
13065
13065
  },
13066
13066
  {
13067
- Component: CustomItems,
13068
- path: "/draft-orders/:id/custom-items"
13067
+ Component: Email,
13068
+ path: "/draft-orders/:id/email"
13069
13069
  },
13070
13070
  {
13071
13071
  Component: Items,
@@ -13083,21 +13083,21 @@ const routeModule = {
13083
13083
  Component: SalesChannel,
13084
13084
  path: "/draft-orders/:id/sales-channel"
13085
13085
  },
13086
- {
13087
- Component: ShippingAddress,
13088
- path: "/draft-orders/:id/shipping-address"
13089
- },
13090
13086
  {
13091
13087
  Component: Shipping,
13092
13088
  path: "/draft-orders/:id/shipping"
13093
13089
  },
13090
+ {
13091
+ Component: ShippingAddress,
13092
+ path: "/draft-orders/:id/shipping-address"
13093
+ },
13094
13094
  {
13095
13095
  Component: TransferOwnership,
13096
13096
  path: "/draft-orders/:id/transfer-ownership"
13097
13097
  },
13098
13098
  {
13099
- Component: Email,
13100
- path: "/draft-orders/:id/email"
13099
+ Component: CustomItems,
13100
+ path: "/draft-orders/:id/custom-items"
13101
13101
  }
13102
13102
  ]
13103
13103
  }