import { getBookingUrl, getCancelLink, getRescheduleLink } from "@calcom/lib/CalEventParser"; import type { CalendarEvent, Person } from "@calcom/types/Calendar"; export function ManageLink(props: { calEvent: CalendarEvent; attendee: Person }) { // Only the original attendee can make changes to the event // Guests cannot const t = props.attendee.language.translate; const cancelLink = getCancelLink(props.calEvent, props.attendee); const rescheduleLink = getRescheduleLink({ calEvent: props.calEvent, attendee: props.attendee }); const bookingLink = getBookingUrl(props.calEvent); const isOriginalAttendee = props.attendee.email === props.calEvent.attendees[0]?.email; const isOrganizer = props.calEvent.organizer.email === props.attendee.email; const hasCancelLink = Boolean(cancelLink) && !props.calEvent.disableCancelling; const hasRescheduleLink = Boolean(rescheduleLink) && !props.calEvent.disableRescheduling; const hasBookingLink = Boolean(bookingLink); const isRecurringEvent = props.calEvent.recurringEvent; const shouldDisplayRescheduleLink = Boolean(hasRescheduleLink && !isRecurringEvent); const isTeamMember = props.calEvent.team?.members.some((member) => props.attendee.email === member.email); if ( (isOriginalAttendee || isOrganizer || isTeamMember) && (hasCancelLink || (!isRecurringEvent && hasRescheduleLink) || hasBookingLink) ) { return (

{(shouldDisplayRescheduleLink || hasCancelLink) && <>{t("need_to_make_a_change")}} {shouldDisplayRescheduleLink && ( <>{t("reschedule")} {hasCancelLink && <>{t("or_lowercase")}} )} {hasCancelLink && ( <>{t("cancel")} )} {props.calEvent.platformClientId && hasBookingLink && ( {(hasCancelLink || shouldDisplayRescheduleLink) && ( {t("or_lowercase")} )} <>{t("check_here")} )}

); } // Don't have the rights to the manage link return null; }