2023-10-06 16:17:15 +00:00
|
|
|
import type { GetBookingType } from "@calcom/features/bookings/lib/get-booking";
|
2023-05-11 16:02:13 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
|
|
import { trpc } from "@calcom/trpc/react";
|
|
|
|
import { HeadSeo } from "@calcom/ui";
|
|
|
|
|
|
|
|
interface BookerSeoProps {
|
|
|
|
username: string;
|
|
|
|
eventSlug: string;
|
|
|
|
rescheduleUid: string | undefined;
|
|
|
|
hideBranding?: boolean;
|
2023-08-15 00:44:09 +00:00
|
|
|
isSEOIndexable?: boolean;
|
2023-06-28 14:47:28 +00:00
|
|
|
isTeamEvent?: boolean;
|
2023-07-31 20:27:22 +00:00
|
|
|
entity: {
|
|
|
|
orgSlug?: string | null;
|
|
|
|
teamSlug?: string | null;
|
|
|
|
name?: string | null;
|
|
|
|
};
|
2023-10-06 16:17:15 +00:00
|
|
|
bookingData?: GetBookingType | null;
|
2023-05-11 16:02:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const BookerSeo = (props: BookerSeoProps) => {
|
2023-10-06 16:17:15 +00:00
|
|
|
const {
|
|
|
|
eventSlug,
|
|
|
|
username,
|
|
|
|
rescheduleUid,
|
|
|
|
hideBranding,
|
|
|
|
isTeamEvent,
|
|
|
|
entity,
|
|
|
|
isSEOIndexable,
|
|
|
|
bookingData,
|
|
|
|
} = props;
|
2023-05-11 16:02:13 +00:00
|
|
|
const { t } = useLocale();
|
|
|
|
const { data: event } = trpc.viewer.public.event.useQuery(
|
2023-07-31 20:27:22 +00:00
|
|
|
{ username, eventSlug, isTeamEvent, org: entity.orgSlug ?? null },
|
2023-05-11 16:02:13 +00:00
|
|
|
{ refetchOnWindowFocus: false }
|
|
|
|
);
|
|
|
|
|
|
|
|
const profileName = event?.profile?.name ?? "";
|
|
|
|
const profileImage = event?.profile?.image;
|
|
|
|
const title = event?.title ?? "";
|
|
|
|
return (
|
|
|
|
<HeadSeo
|
2023-10-06 16:17:15 +00:00
|
|
|
title={`${rescheduleUid && !!bookingData ? t("reschedule") : ""} ${title} | ${profileName}`}
|
2023-05-11 16:02:13 +00:00
|
|
|
description={`${rescheduleUid ? t("reschedule") : ""} ${title}`}
|
|
|
|
meeting={{
|
|
|
|
title: title,
|
|
|
|
profile: { name: profileName, image: profileImage },
|
|
|
|
users: [
|
|
|
|
...(event?.users || []).map((user) => ({
|
|
|
|
name: `${user.name}`,
|
|
|
|
username: `${user.username}`,
|
|
|
|
})),
|
|
|
|
],
|
|
|
|
}}
|
|
|
|
nextSeoProps={{
|
2023-08-15 00:44:09 +00:00
|
|
|
nofollow: event?.hidden || !isSEOIndexable,
|
|
|
|
noindex: event?.hidden || !isSEOIndexable,
|
2023-05-11 16:02:13 +00:00
|
|
|
}}
|
|
|
|
isBrandingHidden={hideBranding}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|