@medusajs/draft-order 2.10.2-preview-20250911000329 → 2.10.2-preview-20250911060156

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,6 +9757,95 @@ const BillingAddressForm = ({ order }) => {
9757
9757
  ) });
9758
9758
  };
9759
9759
  const schema$5 = addressSchema;
9760
+ const CustomItems = () => {
9761
+ 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, {})
9764
+ ] });
9765
+ };
9766
+ const CustomItemsForm = () => {
9767
+ const form = useForm({
9768
+ resolver: zodResolver(schema$4)
9769
+ });
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
+ ] }) });
9777
+ };
9778
+ const schema$4 = objectType({
9779
+ email: stringType().email()
9780
+ });
9781
+ const Email = () => {
9782
+ const { id } = useParams();
9783
+ const { order, isPending, isError, error } = useOrder(id, {
9784
+ fields: "+email"
9785
+ });
9786
+ if (isError) {
9787
+ throw error;
9788
+ }
9789
+ const isReady = !isPending && !!order;
9790
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9791
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9792
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9793
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9794
+ ] }),
9795
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9796
+ ] });
9797
+ };
9798
+ const EmailForm = ({ order }) => {
9799
+ const form = useForm({
9800
+ defaultValues: {
9801
+ email: order.email ?? ""
9802
+ },
9803
+ resolver: zodResolver(schema$3)
9804
+ });
9805
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9806
+ const { handleSuccess } = useRouteModal();
9807
+ const onSubmit = form.handleSubmit(async (data) => {
9808
+ await mutateAsync(
9809
+ { email: data.email },
9810
+ {
9811
+ onSuccess: () => {
9812
+ handleSuccess();
9813
+ },
9814
+ onError: (error) => {
9815
+ toast.error(error.message);
9816
+ }
9817
+ }
9818
+ );
9819
+ });
9820
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9821
+ KeyboundForm,
9822
+ {
9823
+ className: "flex flex-1 flex-col overflow-hidden",
9824
+ onSubmit,
9825
+ children: [
9826
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9827
+ Form$2.Field,
9828
+ {
9829
+ control: form.control,
9830
+ name: "email",
9831
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9832
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9833
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9834
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9835
+ ] })
9836
+ }
9837
+ ) }),
9838
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9839
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9840
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9841
+ ] }) })
9842
+ ]
9843
+ }
9844
+ ) });
9845
+ };
9846
+ const schema$3 = objectType({
9847
+ email: stringType().email()
9848
+ });
9760
9849
  const NumberInput = forwardRef(
9761
9850
  ({
9762
9851
  value,
@@ -11386,7 +11475,7 @@ const SalesChannelForm = ({ order }) => {
11386
11475
  defaultValues: {
11387
11476
  sales_channel_id: order.sales_channel_id || ""
11388
11477
  },
11389
- resolver: zodResolver(schema$4)
11478
+ resolver: zodResolver(schema$2)
11390
11479
  });
11391
11480
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11392
11481
  const { handleSuccess } = useRouteModal();
@@ -11461,311 +11550,108 @@ const SalesChannelField = ({ control, order }) => {
11461
11550
  }
11462
11551
  );
11463
11552
  };
11464
- const schema$4 = objectType({
11553
+ const schema$2 = objectType({
11465
11554
  sales_channel_id: stringType().min(1)
11466
11555
  });
11467
- const ShippingAddress = () => {
11556
+ const STACKED_FOCUS_MODAL_ID = "shipping-form";
11557
+ const Shipping = () => {
11558
+ var _a;
11468
11559
  const { id } = useParams();
11469
11560
  const { order, isPending, isError, error } = useOrder(id, {
11470
- fields: "+shipping_address"
11561
+ fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11471
11562
  });
11563
+ const {
11564
+ order: preview,
11565
+ isPending: isPreviewPending,
11566
+ isError: isPreviewError,
11567
+ error: previewError
11568
+ } = useOrderPreview(id);
11569
+ useInitiateOrderEdit({ preview });
11570
+ const { onCancel } = useCancelOrderEdit({ preview });
11472
11571
  if (isError) {
11473
11572
  throw error;
11474
11573
  }
11475
- const isReady = !isPending && !!order;
11476
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11477
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11478
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
11479
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11480
- ] }),
11481
- isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
11482
- ] });
11574
+ if (isPreviewError) {
11575
+ throw previewError;
11576
+ }
11577
+ const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11578
+ const isReady = preview && !isPreviewPending && order && !isPending;
11579
+ return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11580
+ /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11581
+ /* @__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: [
11582
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11583
+ /* @__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." }) })
11584
+ ] }) }) }),
11585
+ /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11586
+ ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11587
+ /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11588
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11589
+ ] }) });
11483
11590
  };
11484
- const ShippingAddressForm = ({ order }) => {
11485
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11486
- const form = useForm({
11487
- defaultValues: {
11488
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11489
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11490
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11491
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11492
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11493
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11494
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11495
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11496
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11497
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11591
+ const ShippingForm = ({ preview, order }) => {
11592
+ var _a;
11593
+ const { setIsOpen } = useStackedModal();
11594
+ const [isSubmitting, setIsSubmitting] = useState(false);
11595
+ const [data, setData] = useState(null);
11596
+ const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11597
+ const { shipping_options } = useShippingOptions(
11598
+ {
11599
+ id: appliedShippingOptionIds,
11600
+ fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11498
11601
  },
11499
- resolver: zodResolver(schema$3)
11500
- });
11501
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11602
+ {
11603
+ enabled: appliedShippingOptionIds.length > 0
11604
+ }
11605
+ );
11606
+ const uniqueShippingProfiles = useMemo(() => {
11607
+ const profiles = /* @__PURE__ */ new Map();
11608
+ getUniqueShippingProfiles(order.items).forEach((profile) => {
11609
+ profiles.set(profile.id, profile);
11610
+ });
11611
+ shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11612
+ profiles.set(option.shipping_profile_id, option.shipping_profile);
11613
+ });
11614
+ return Array.from(profiles.values());
11615
+ }, [order.items, shipping_options]);
11502
11616
  const { handleSuccess } = useRouteModal();
11503
- const onSubmit = form.handleSubmit(async (data) => {
11504
- await mutateAsync(
11505
- {
11506
- shipping_address: {
11507
- first_name: data.first_name,
11508
- last_name: data.last_name,
11509
- company: data.company,
11510
- address_1: data.address_1,
11511
- address_2: data.address_2,
11512
- city: data.city,
11513
- province: data.province,
11514
- country_code: data.country_code,
11515
- postal_code: data.postal_code,
11516
- phone: data.phone
11517
- }
11617
+ const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11618
+ const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11619
+ const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11620
+ const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11621
+ const onSubmit = async () => {
11622
+ setIsSubmitting(true);
11623
+ let requestSucceeded = false;
11624
+ await requestOrderEdit(void 0, {
11625
+ onError: (e) => {
11626
+ toast.error(`Failed to request order edit: ${e.message}`);
11518
11627
  },
11519
- {
11520
- onSuccess: () => {
11521
- handleSuccess();
11522
- },
11523
- onError: (error) => {
11524
- toast.error(error.message);
11628
+ onSuccess: () => {
11629
+ requestSucceeded = true;
11630
+ }
11631
+ });
11632
+ if (!requestSucceeded) {
11633
+ setIsSubmitting(false);
11634
+ return;
11635
+ }
11636
+ await confirmOrderEdit(void 0, {
11637
+ onError: (e) => {
11638
+ toast.error(`Failed to confirm order edit: ${e.message}`);
11639
+ },
11640
+ onSuccess: () => {
11641
+ handleSuccess();
11642
+ },
11643
+ onSettled: () => {
11644
+ setIsSubmitting(false);
11645
+ }
11646
+ });
11647
+ };
11648
+ const onKeydown = useCallback(
11649
+ (e) => {
11650
+ if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11651
+ if (data || isSubmitting) {
11652
+ return;
11525
11653
  }
11526
- }
11527
- );
11528
- });
11529
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11530
- KeyboundForm,
11531
- {
11532
- className: "flex flex-1 flex-col overflow-hidden",
11533
- onSubmit,
11534
- children: [
11535
- /* @__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: [
11536
- /* @__PURE__ */ jsx(
11537
- Form$2.Field,
11538
- {
11539
- control: form.control,
11540
- name: "country_code",
11541
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11542
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
11543
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
11544
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11545
- ] })
11546
- }
11547
- ),
11548
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11549
- /* @__PURE__ */ jsx(
11550
- Form$2.Field,
11551
- {
11552
- control: form.control,
11553
- name: "first_name",
11554
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11555
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
11556
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11557
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11558
- ] })
11559
- }
11560
- ),
11561
- /* @__PURE__ */ jsx(
11562
- Form$2.Field,
11563
- {
11564
- control: form.control,
11565
- name: "last_name",
11566
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11567
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
11568
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11569
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11570
- ] })
11571
- }
11572
- )
11573
- ] }),
11574
- /* @__PURE__ */ jsx(
11575
- Form$2.Field,
11576
- {
11577
- control: form.control,
11578
- name: "company",
11579
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11580
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
11581
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11582
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11583
- ] })
11584
- }
11585
- ),
11586
- /* @__PURE__ */ jsx(
11587
- Form$2.Field,
11588
- {
11589
- control: form.control,
11590
- name: "address_1",
11591
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11592
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
11593
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11594
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11595
- ] })
11596
- }
11597
- ),
11598
- /* @__PURE__ */ jsx(
11599
- Form$2.Field,
11600
- {
11601
- control: form.control,
11602
- name: "address_2",
11603
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11604
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11605
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11606
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11607
- ] })
11608
- }
11609
- ),
11610
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11611
- /* @__PURE__ */ jsx(
11612
- Form$2.Field,
11613
- {
11614
- control: form.control,
11615
- name: "postal_code",
11616
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11617
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
11618
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11619
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11620
- ] })
11621
- }
11622
- ),
11623
- /* @__PURE__ */ jsx(
11624
- Form$2.Field,
11625
- {
11626
- control: form.control,
11627
- name: "city",
11628
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11629
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
11630
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11631
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11632
- ] })
11633
- }
11634
- )
11635
- ] }),
11636
- /* @__PURE__ */ jsx(
11637
- Form$2.Field,
11638
- {
11639
- control: form.control,
11640
- name: "province",
11641
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11642
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11643
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11644
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11645
- ] })
11646
- }
11647
- ),
11648
- /* @__PURE__ */ jsx(
11649
- Form$2.Field,
11650
- {
11651
- control: form.control,
11652
- name: "phone",
11653
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11654
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
11655
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
11656
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11657
- ] })
11658
- }
11659
- )
11660
- ] }) }),
11661
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11662
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11663
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11664
- ] }) })
11665
- ]
11666
- }
11667
- ) });
11668
- };
11669
- const schema$3 = addressSchema;
11670
- const STACKED_FOCUS_MODAL_ID = "shipping-form";
11671
- const Shipping = () => {
11672
- var _a;
11673
- const { id } = useParams();
11674
- const { order, isPending, isError, error } = useOrder(id, {
11675
- fields: "+items.*,+items.variant.*,+items.variant.product.*,+items.variant.product.shipping_profile.*,+currency_code"
11676
- });
11677
- const {
11678
- order: preview,
11679
- isPending: isPreviewPending,
11680
- isError: isPreviewError,
11681
- error: previewError
11682
- } = useOrderPreview(id);
11683
- useInitiateOrderEdit({ preview });
11684
- const { onCancel } = useCancelOrderEdit({ preview });
11685
- if (isError) {
11686
- throw error;
11687
- }
11688
- if (isPreviewError) {
11689
- throw previewError;
11690
- }
11691
- const orderHasItems = (((_a = order == null ? void 0 : order.items) == null ? void 0 : _a.length) || 0) > 0;
11692
- const isReady = preview && !isPreviewPending && order && !isPending;
11693
- return /* @__PURE__ */ jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
11694
- /* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
11695
- /* @__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: [
11696
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shipping" }) }),
11697
- /* @__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." }) })
11698
- ] }) }) }),
11699
- /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }) })
11700
- ] }) : isReady ? /* @__PURE__ */ jsx(ShippingForm, { preview, order }) : /* @__PURE__ */ jsxs("div", { children: [
11701
- /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit Shipping" }) }),
11702
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading data for the draft order, please wait..." }) })
11703
- ] }) });
11704
- };
11705
- const ShippingForm = ({ preview, order }) => {
11706
- var _a;
11707
- const { setIsOpen } = useStackedModal();
11708
- const [isSubmitting, setIsSubmitting] = useState(false);
11709
- const [data, setData] = useState(null);
11710
- const appliedShippingOptionIds = (_a = preview.shipping_methods) == null ? void 0 : _a.map((method) => method.shipping_option_id).filter(Boolean);
11711
- const { shipping_options } = useShippingOptions(
11712
- {
11713
- id: appliedShippingOptionIds,
11714
- fields: "+service_zone.*,+service_zone.fulfillment_set.*,+service_zone.fulfillment_set.location.*"
11715
- },
11716
- {
11717
- enabled: appliedShippingOptionIds.length > 0
11718
- }
11719
- );
11720
- const uniqueShippingProfiles = useMemo(() => {
11721
- const profiles = /* @__PURE__ */ new Map();
11722
- getUniqueShippingProfiles(order.items).forEach((profile) => {
11723
- profiles.set(profile.id, profile);
11724
- });
11725
- shipping_options == null ? void 0 : shipping_options.forEach((option) => {
11726
- profiles.set(option.shipping_profile_id, option.shipping_profile);
11727
- });
11728
- return Array.from(profiles.values());
11729
- }, [order.items, shipping_options]);
11730
- const { handleSuccess } = useRouteModal();
11731
- const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
11732
- const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
11733
- const { mutateAsync: removeShippingMethod } = useDraftOrderRemoveShippingMethod(preview.id);
11734
- const { mutateAsync: removeActionShippingMethod } = useDraftOrderRemoveActionShippingMethod(preview.id);
11735
- const onSubmit = async () => {
11736
- setIsSubmitting(true);
11737
- let requestSucceeded = false;
11738
- await requestOrderEdit(void 0, {
11739
- onError: (e) => {
11740
- toast.error(`Failed to request order edit: ${e.message}`);
11741
- },
11742
- onSuccess: () => {
11743
- requestSucceeded = true;
11744
- }
11745
- });
11746
- if (!requestSucceeded) {
11747
- setIsSubmitting(false);
11748
- return;
11749
- }
11750
- await confirmOrderEdit(void 0, {
11751
- onError: (e) => {
11752
- toast.error(`Failed to confirm order edit: ${e.message}`);
11753
- },
11754
- onSuccess: () => {
11755
- handleSuccess();
11756
- },
11757
- onSettled: () => {
11758
- setIsSubmitting(false);
11759
- }
11760
- });
11761
- };
11762
- const onKeydown = useCallback(
11763
- (e) => {
11764
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
11765
- if (data || isSubmitting) {
11766
- return;
11767
- }
11768
- onSubmit();
11654
+ onSubmit();
11769
11655
  }
11770
11656
  },
11771
11657
  [data, isSubmitting, onSubmit]
@@ -12474,47 +12360,250 @@ const CustomAmountField = ({
12474
12360
  }
12475
12361
  );
12476
12362
  };
12477
- const TransferOwnership = () => {
12363
+ const ShippingAddress = () => {
12478
12364
  const { id } = useParams();
12479
- const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12480
- fields: "id,customer_id,customer.*"
12365
+ const { order, isPending, isError, error } = useOrder(id, {
12366
+ fields: "+shipping_address"
12481
12367
  });
12482
12368
  if (isError) {
12483
12369
  throw error;
12484
12370
  }
12485
- const isReady = !isPending && !!draft_order;
12371
+ const isReady = !isPending && !!order;
12486
12372
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12487
12373
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12488
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12489
- /* @__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" }) })
12374
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
12375
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12490
12376
  ] }),
12491
- isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12377
+ isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
12492
12378
  ] });
12493
12379
  };
12494
- const TransferOwnershipForm = ({ order }) => {
12495
- var _a, _b;
12380
+ const ShippingAddressForm = ({ order }) => {
12381
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12496
12382
  const form = useForm({
12497
12383
  defaultValues: {
12498
- customer_id: order.customer_id || ""
12384
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12385
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12386
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12387
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12388
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12389
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12390
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12391
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12392
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12393
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12499
12394
  },
12500
- resolver: zodResolver(schema$2)
12395
+ resolver: zodResolver(schema$1)
12501
12396
  });
12502
12397
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12503
12398
  const { handleSuccess } = useRouteModal();
12504
- const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12505
- const currentCustomer = order.customer ? {
12506
- label: name ? `${name} (${order.customer.email})` : order.customer.email,
12507
- value: order.customer.id
12508
- } : null;
12509
12399
  const onSubmit = form.handleSubmit(async (data) => {
12510
12400
  await mutateAsync(
12511
- { customer_id: data.customer_id },
12512
12401
  {
12513
- onSuccess: () => {
12514
- toast.success("Customer updated");
12515
- handleSuccess();
12516
- },
12517
- onError: (error) => {
12402
+ shipping_address: {
12403
+ first_name: data.first_name,
12404
+ last_name: data.last_name,
12405
+ company: data.company,
12406
+ address_1: data.address_1,
12407
+ address_2: data.address_2,
12408
+ city: data.city,
12409
+ province: data.province,
12410
+ country_code: data.country_code,
12411
+ postal_code: data.postal_code,
12412
+ phone: data.phone
12413
+ }
12414
+ },
12415
+ {
12416
+ onSuccess: () => {
12417
+ handleSuccess();
12418
+ },
12419
+ onError: (error) => {
12420
+ toast.error(error.message);
12421
+ }
12422
+ }
12423
+ );
12424
+ });
12425
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12426
+ KeyboundForm,
12427
+ {
12428
+ className: "flex flex-1 flex-col overflow-hidden",
12429
+ onSubmit,
12430
+ children: [
12431
+ /* @__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: [
12432
+ /* @__PURE__ */ jsx(
12433
+ Form$2.Field,
12434
+ {
12435
+ control: form.control,
12436
+ name: "country_code",
12437
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12438
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12439
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12440
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12441
+ ] })
12442
+ }
12443
+ ),
12444
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12445
+ /* @__PURE__ */ jsx(
12446
+ Form$2.Field,
12447
+ {
12448
+ control: form.control,
12449
+ name: "first_name",
12450
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12451
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12452
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12453
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12454
+ ] })
12455
+ }
12456
+ ),
12457
+ /* @__PURE__ */ jsx(
12458
+ Form$2.Field,
12459
+ {
12460
+ control: form.control,
12461
+ name: "last_name",
12462
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12463
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12464
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12465
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12466
+ ] })
12467
+ }
12468
+ )
12469
+ ] }),
12470
+ /* @__PURE__ */ jsx(
12471
+ Form$2.Field,
12472
+ {
12473
+ control: form.control,
12474
+ name: "company",
12475
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12476
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12477
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12478
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12479
+ ] })
12480
+ }
12481
+ ),
12482
+ /* @__PURE__ */ jsx(
12483
+ Form$2.Field,
12484
+ {
12485
+ control: form.control,
12486
+ name: "address_1",
12487
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12488
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12489
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12490
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12491
+ ] })
12492
+ }
12493
+ ),
12494
+ /* @__PURE__ */ jsx(
12495
+ Form$2.Field,
12496
+ {
12497
+ control: form.control,
12498
+ name: "address_2",
12499
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12500
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12501
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12502
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12503
+ ] })
12504
+ }
12505
+ ),
12506
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12507
+ /* @__PURE__ */ jsx(
12508
+ Form$2.Field,
12509
+ {
12510
+ control: form.control,
12511
+ name: "postal_code",
12512
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12513
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12514
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12515
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12516
+ ] })
12517
+ }
12518
+ ),
12519
+ /* @__PURE__ */ jsx(
12520
+ Form$2.Field,
12521
+ {
12522
+ control: form.control,
12523
+ name: "city",
12524
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12525
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12526
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12527
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12528
+ ] })
12529
+ }
12530
+ )
12531
+ ] }),
12532
+ /* @__PURE__ */ jsx(
12533
+ Form$2.Field,
12534
+ {
12535
+ control: form.control,
12536
+ name: "province",
12537
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12538
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12539
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12540
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12541
+ ] })
12542
+ }
12543
+ ),
12544
+ /* @__PURE__ */ jsx(
12545
+ Form$2.Field,
12546
+ {
12547
+ control: form.control,
12548
+ name: "phone",
12549
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12550
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12551
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12552
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12553
+ ] })
12554
+ }
12555
+ )
12556
+ ] }) }),
12557
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12558
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12559
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12560
+ ] }) })
12561
+ ]
12562
+ }
12563
+ ) });
12564
+ };
12565
+ const schema$1 = addressSchema;
12566
+ const TransferOwnership = () => {
12567
+ const { id } = useParams();
12568
+ const { draft_order, isPending, isError, error } = useDraftOrder(id, {
12569
+ fields: "id,customer_id,customer.*"
12570
+ });
12571
+ if (isError) {
12572
+ throw error;
12573
+ }
12574
+ const isReady = !isPending && !!draft_order;
12575
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12576
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12577
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Transfer Ownership" }) }),
12578
+ /* @__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" }) })
12579
+ ] }),
12580
+ isReady && /* @__PURE__ */ jsx(TransferOwnershipForm, { order: draft_order })
12581
+ ] });
12582
+ };
12583
+ const TransferOwnershipForm = ({ order }) => {
12584
+ var _a, _b;
12585
+ const form = useForm({
12586
+ defaultValues: {
12587
+ customer_id: order.customer_id || ""
12588
+ },
12589
+ resolver: zodResolver(schema)
12590
+ });
12591
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12592
+ const { handleSuccess } = useRouteModal();
12593
+ const name = [(_a = order.customer) == null ? void 0 : _a.first_name, (_b = order.customer) == null ? void 0 : _b.last_name].filter(Boolean).join(" ");
12594
+ const currentCustomer = order.customer ? {
12595
+ label: name ? `${name} (${order.customer.email})` : order.customer.email,
12596
+ value: order.customer.id
12597
+ } : null;
12598
+ const onSubmit = form.handleSubmit(async (data) => {
12599
+ await mutateAsync(
12600
+ { customer_id: data.customer_id },
12601
+ {
12602
+ onSuccess: () => {
12603
+ toast.success("Customer updated");
12604
+ handleSuccess();
12605
+ },
12606
+ onError: (error) => {
12518
12607
  toast.error(error.message);
12519
12608
  }
12520
12609
  }
@@ -12947,97 +13036,8 @@ const Illustration = () => {
12947
13036
  }
12948
13037
  );
12949
13038
  };
12950
- const schema$2 = objectType({
12951
- customer_id: stringType().min(1)
12952
- });
12953
- const CustomItems = () => {
12954
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12955
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
12956
- /* @__PURE__ */ jsx(CustomItemsForm, {})
12957
- ] });
12958
- };
12959
- const CustomItemsForm = () => {
12960
- const form = useForm({
12961
- resolver: zodResolver(schema$1)
12962
- });
12963
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12964
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
12965
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12966
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12967
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
12968
- ] }) })
12969
- ] }) });
12970
- };
12971
- const schema$1 = objectType({
12972
- email: stringType().email()
12973
- });
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;
12983
- 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 })
12989
- ] });
12990
- };
12991
- const EmailForm = ({ order }) => {
12992
- const form = useForm({
12993
- defaultValues: {
12994
- email: order.email ?? ""
12995
- },
12996
- resolver: zodResolver(schema)
12997
- });
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
- ) });
13038
- };
13039
13039
  const schema = objectType({
13040
- email: stringType().email()
13040
+ customer_id: stringType().min(1)
13041
13041
  });
13042
13042
  const widgetModule = { widgets: [] };
13043
13043
  const routeModule = {
@@ -13063,6 +13063,14 @@ const routeModule = {
13063
13063
  Component: BillingAddress,
13064
13064
  path: "/draft-orders/:id/billing-address"
13065
13065
  },
13066
+ {
13067
+ Component: CustomItems,
13068
+ path: "/draft-orders/:id/custom-items"
13069
+ },
13070
+ {
13071
+ Component: Email,
13072
+ path: "/draft-orders/:id/email"
13073
+ },
13066
13074
  {
13067
13075
  Component: Items,
13068
13076
  path: "/draft-orders/:id/items"
@@ -13079,25 +13087,17 @@ const routeModule = {
13079
13087
  Component: SalesChannel,
13080
13088
  path: "/draft-orders/:id/sales-channel"
13081
13089
  },
13082
- {
13083
- Component: ShippingAddress,
13084
- path: "/draft-orders/:id/shipping-address"
13085
- },
13086
13090
  {
13087
13091
  Component: Shipping,
13088
13092
  path: "/draft-orders/:id/shipping"
13089
13093
  },
13090
13094
  {
13091
- Component: TransferOwnership,
13092
- path: "/draft-orders/:id/transfer-ownership"
13093
- },
13094
- {
13095
- Component: CustomItems,
13096
- path: "/draft-orders/:id/custom-items"
13095
+ Component: ShippingAddress,
13096
+ path: "/draft-orders/:id/shipping-address"
13097
13097
  },
13098
13098
  {
13099
- Component: Email,
13100
- path: "/draft-orders/:id/email"
13099
+ Component: TransferOwnership,
13100
+ path: "/draft-orders/:id/transfer-ownership"
13101
13101
  }
13102
13102
  ]
13103
13103
  }