diff --git a/apps/web/modules/event-types/views/event-types-listing-view.tsx b/apps/web/modules/event-types/views/event-types-listing-view.tsx index 893ecca8f8..d54d3d0f1e 100644 --- a/apps/web/modules/event-types/views/event-types-listing-view.tsx +++ b/apps/web/modules/event-types/views/event-types-listing-view.tsx @@ -18,8 +18,9 @@ import { InfiniteSkeletonLoader } from "@calcom/features/eventtypes/components/S import { getTeamsFiltersFromQuery } from "@calcom/features/filters/lib/getTeamsFiltersFromQuery"; import Shell from "@calcom/features/shell/Shell"; import { parseEventTypeColor } from "@calcom/lib"; -import { APP_NAME } from "@calcom/lib/constants"; +import { APP_NAME, WEBSITE_URL } from "@calcom/lib/constants"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; +import { useCopy } from "@calcom/lib/hooks/useCopy"; import { useDebounce } from "@calcom/lib/hooks/useDebounce"; import { useInViewObserver } from "@calcom/lib/hooks/useInViewObserver"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -257,6 +258,7 @@ export const InfiniteEventTypeList = ({ const router = useRouter(); const pathname = usePathname(); const searchParams = useCompatSearchParams(); + const { copyToClipboard } = useCopy(); const [parent] = useAutoAnimate(); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const [deleteDialogTypeId, setDeleteDialogTypeId] = useState(0); @@ -566,7 +568,7 @@ export const InfiniteEventTypeList = ({ StartIcon="link" onClick={() => { showToast(t("link_copied"), "success"); - navigator.clipboard.writeText(calLink); + copyToClipboard(calLink); }} /> @@ -579,7 +581,7 @@ export const InfiniteEventTypeList = ({ StartIcon="venetian-mask" onClick={() => { showToast(t("private_link_copied"), "success"); - navigator.clipboard.writeText(placeholderHashedLink); + copyToClipboard(placeholderHashedLink); setPrivateLinkCopyIndices((prev) => { const prevIndex = prev[type.slug] ?? 0; prev[type.slug] = (prevIndex + 1) % type.hashedLink.length; @@ -893,6 +895,7 @@ const InfiniteScrollMain = ({ }) => { const searchParams = useCompatSearchParams(); const { data } = useTypedQuery(querySchema); + const orgBranding = useOrgBranding(); if (status === "error") { return ; @@ -911,6 +914,18 @@ const InfiniteScrollMain = ({ const activeEventTypeGroup = eventTypeGroups.filter((item) => item.teamId === data.teamId) ?? eventTypeGroups[0]; + const bookerUrl = orgBranding ? orgBranding?.fullDomain : WEBSITE_URL; + + // If the event type group is the same as the org branding team, or the parent team, set the bookerUrl to the org branding URL + // This is to ensure that the bookerUrl is always the same as the one in the org branding settings + // This keeps the app working for personal event types that were not migrated to the org (rare) + if ( + activeEventTypeGroup[0].teamId === orgBranding?.id || + activeEventTypeGroup[0].parentId === orgBranding?.id + ) { + activeEventTypeGroup[0].bookerUrl = bookerUrl; + } + return ( <> {eventTypeGroups.length >= 1 && ( diff --git a/packages/platform/atoms/event-types/wrappers/EventTypeWebWrapper.tsx b/packages/platform/atoms/event-types/wrappers/EventTypeWebWrapper.tsx index dbf89036af..004d3212ee 100644 --- a/packages/platform/atoms/event-types/wrappers/EventTypeWebWrapper.tsx +++ b/packages/platform/atoms/event-types/wrappers/EventTypeWebWrapper.tsx @@ -10,6 +10,7 @@ import type { NextRouter as NextPageRouter } from "next/router"; import { useEffect, useRef, useState } from "react"; import { z } from "zod"; +import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; import type { ChildrenEventType } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect"; import { EventType as EventTypeComponent } from "@calcom/features/eventtypes/components/EventType"; import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types"; @@ -224,9 +225,13 @@ const EventTypeWeb = ({ }, }); - const permalink = `${WEBSITE_URL}/${team ? `team/${team.slug}` : eventType.users[0].username}/${ + const orgBranding = useOrgBranding(); + + const bookerUrl = orgBranding ? orgBranding?.fullDomain : WEBSITE_URL; + const permalink = `${bookerUrl}/${team ? `team/${team.slug}` : eventType.users[0].username}/${ eventType.slug }`; + const tabMap = { setup: (