Scheduling infrastructure for absolutely everyone.
feat: added Rating Template to Workflows (#14215)
Peer Richelsen9bd3a362a21c
diff --git a/apps/web/modules/bookings/views/bookings-single-view.tsx b/apps/web/modules/bookings/views/bookings-single-view.tsxindex d4932d94d67..3d1367bb02a 100644--- a/apps/web/modules/bookings/views/bookings-single-view.tsx+++ b/apps/web/modules/bookings/views/bookings-single-view.tsx@@ -7,6 +7,7 @@ import { useSession } from "next-auth/react";import Link from "next/link";import { usePathname, useRouter } from "next/navigation";import { useEffect, useState } from "react";+import { Toaster } from "react-hot-toast";import { RRule } from "rrule";import { z } from "zod";@@ -45,7 +46,19 @@ import { getIs24hClockFromLocalStorage, isBrowserLocale24h } from "@calcom/lib/timport { localStorage } from "@calcom/lib/webstorage";import { BookingStatus } from "@calcom/prisma/enums";import { bookingMetadataSchema } from "@calcom/prisma/zod-utils";-import { Alert, Badge, Button, EmailInput, HeadSeo, Icon, useCalcomTheme } from "@calcom/ui";+import { trpc } from "@calcom/trpc/react";+import {+ Alert,+ Badge,+ Button,+ EmailInput,+ HeadSeo,+ useCalcomTheme,+ TextArea,+ showToast,+ EmptyScreen,+ Icon,+} from "@calcom/ui";import { timeZone } from "@lib/clock";@@ -71,6 +84,8 @@ const querySchema = z.object({isSuccessBookingPage: stringToBoolean,formerTime: z.string().optional(),seatReferenceUid: z.string().optional(),+ rating: z.string().optional(),+ noShow: stringToBoolean,});const useBrandColors = ({@@ -102,10 +117,12 @@ export default function Success(props: PageProps) {formerTime,email,seatReferenceUid,+ noShow,+ rating,} = querySchema.parse(routerQuery);-const attendeeTimeZone = bookingInfo?.attendees.find((attendee) => attendee.email === email)?.timeZone;+ const isFeedbackMode = !!(noShow || rating);const tz = props.tz ? props.tz : isSuccessBookingPage && attendeeTimeZone ? attendeeTimeZone : timeZone();const location = bookingInfo.location as ReturnType<typeof getEventLocationValue>;@@ -141,6 +158,42 @@ export default function Success(props: PageProps) {const shouldAlignCentrallyInEmbed = useEmbedNonStylesConfig("align") !== "left";const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;const [calculatedDuration, setCalculatedDuration] = useState<number | undefined>(undefined);+ const [comment, setComment] = useState("");+ const parsedRating = rating ? parseInt(rating, 10) : 3;++ const defaultRating = isNaN(parsedRating) ? 3 : parsedRating > 5 ? 5 : parsedRating < 1 ? 1 : parsedRating;+ const [rateValue, setRateValue] = useState<number>(defaultRating);+ const [isFeedbackSubmitted, setIsFeedbackSubmitted] = useState(false);++ const mutation = trpc.viewer.public.submitRating.useMutation({+ onSuccess: async () => {+ setIsFeedbackSubmitted(true);+ showToast("Thank you, feedback submitted", "success");+ },+ onError: (err) => {+ showToast(err.message, "error");+ },+ });++ const noShowMutation = trpc.viewer.public.noShow.useMutation({+ onSuccess: async () => {+ showToast("Thank you, feedback submitted", "success");+ },+ onError: (err) => {+ showToast(err.message, "error");+ },+ });++ useEffect(() => {+ if (noShow) {+ noShowMutation.mutate({ bookingUid: bookingInfo.uid });+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);++ const sendFeedback = async (rating: string, comment: string) => {+ mutation.mutate({ bookingUid: bookingInfo.uid, rating: rateValue, comment: comment });+ };function setIsCancellationMode(value: boolean) {const _searchParams = new URLSearchParams(searchParams ?? undefined);@@ -293,7 +346,7 @@ export default function Success(props: PageProps) {return (<div className={isEmbed ? "" : "h-screen"} data-testid="success-page">- {!isEmbed && (+ {!isEmbed && !isFeedbackMode && (<EventReservationSchemareservationId={bookingInfo.uid}eventName={eventName}@@ -306,7 +359,7 @@ export default function Success(props: PageProps) {status={status}/>)}- {isLoggedIn && !isEmbed && (+ {isLoggedIn && !isEmbed && !isFeedbackMode && (<div className="-mb-4 ml-4 mt-2"><Linkhref={allRemainingBookings ? "/bookings/recurring" : "/bookings/upcoming"}@@ -340,436 +393,558 @@ export default function Success(props: PageProps) {role="dialog"aria-modal="true"aria-labelledby="modal-headline">- <div- className={classNames(- "mx-auto flex items-center justify-center",- !giphyImage && !isCancelled && !needsConfirmation- ? "bg-success h-12 w-12 rounded-full"- : "",- !giphyImage && !isCancelled && needsConfirmation- ? "bg-subtle h-12 w-12 rounded-full"- : "",- isCancelled ? "bg-error h-12 w-12 rounded-full " : ""- )}>- {giphyImage && !needsConfirmation && !isCancelled && (- // eslint-disable-next-line @next/next/no-img-element- <img src={giphyImage} alt="Gif from Giphy" />- )}- {!giphyImage && !needsConfirmation && !isCancelled && (- <Icon name="check" className="h-5 w-5 text-green-600 dark:text-green-400" />- )}- {needsConfirmation && !isCancelled && (- <Icon name="calendar" className="text-emphasis h-5 w-5" />- )}- {isCancelled && <Icon name="x" className="h-5 w-5 text-red-600 dark:text-red-200" />}- </div>- <div className="mb-8 mt-6 text-center last:mb-0">- <h3- className="text-emphasis text-2xl font-semibold leading-6"- data-testid={isCancelled ? "cancelled-headline" : ""}- id="modal-headline">- {needsConfirmation && !isCancelled- ? props.recurringBookings- ? t("booking_submitted_recurring")- : t("booking_submitted")- : isCancelled- ? seatReferenceUid- ? t("no_longer_attending")- : t("event_cancelled")- : props.recurringBookings- ? t("meeting_is_scheduled_recurring")- : t("meeting_is_scheduled")}- </h3>- <div className="mt-3">- <p className="text-default">{getTitle()}</p>- </div>- {props.paymentStatus &&- (bookingInfo.status === BookingStatus.CANCELLED ||- bookingInfo.status === BookingStatus.REJECTED) && (- <h4>- {!props.paymentStatus.success &&- !props.paymentStatus.refunded &&- t("booking_with_payment_cancelled")}- {props.paymentStatus.success &&- !props.paymentStatus.refunded &&- t("booking_with_payment_cancelled_already_paid")}- {props.paymentStatus.refunded && t("booking_with_payment_cancelled_refunded")}- </h4>- )}+ {!isFeedbackMode && (+ <>+ <div+ className={classNames(+ "mx-auto flex items-center justify-center",+ !giphyImage && !isCancelled && !needsConfirmation+ ? "bg-success h-12 w-12 rounded-full"+ : "",+ !giphyImage && !isCancelled && needsConfirmation+ ? "bg-subtle h-12 w-12 rounded-full"+ : "",+ isCancelled ? "bg-error h-12 w-12 rounded-full " : ""+ )}>+ {giphyImage && !needsConfirmation && !isCancelled && (+ // eslint-disable-next-line @next/next/no-img-element+ <img src={giphyImage} alt="Gif from Giphy" />+ )}+ {!giphyImage && !needsConfirmation && !isCancelled && (+ <Icon name="check" className="h-5 w-5 text-green-600 dark:text-green-400" />+ )}+ {needsConfirmation && !isCancelled && (+ <Icon name="calendar" className="text-emphasis h-5 w-5" />+ )}+ {isCancelled && <Icon name="x" className="h-5 w-5 text-red-600 dark:text-red-200" />}+ </div>+ <div className="mb-8 mt-6 text-center last:mb-0">+ <h3+ className="text-emphasis text-2xl font-semibold leading-6"+ data-testid={isCancelled ? "cancelled-headline" : ""}+ id="modal-headline">+ {needsConfirmation && !isCancelled+ ? props.recurringBookings+ ? t("booking_submitted_recurring")+ : t("booking_submitted")+ : isCancelled+ ? seatReferenceUid+ ? t("no_longer_attending")+ : t("event_cancelled")+ : props.recurringBookings+ ? t("meeting_is_scheduled_recurring")+ : t("meeting_is_scheduled")}+ </h3>+ <div className="mt-3">+ <p className="text-default">{getTitle()}</p>+ </div>+ {props.paymentStatus &&+ (bookingInfo.status === BookingStatus.CANCELLED ||+ bookingInfo.status === BookingStatus.REJECTED) && (+ <h4>+ {!props.paymentStatus.success &&+ !props.paymentStatus.refunded &&+ t("booking_with_payment_cancelled")}+ {props.paymentStatus.success &&+ !props.paymentStatus.refunded &&+ t("booking_with_payment_cancelled_already_paid")}+ {props.paymentStatus.refunded && t("booking_with_payment_cancelled_refunded")}+ </h4>+ )}- <div className="border-subtle text-default mt-8 grid grid-cols-3 border-t pt-8 text-left rtl:text-right">- {(isCancelled || reschedule) && cancellationReason && (- <>- <div className="font-medium">- {isCancelled ? t("reason") : t("reschedule_reason")}+ <div className="border-subtle text-default mt-8 grid grid-cols-3 border-t pt-8 text-left rtl:text-right">+ {(isCancelled || reschedule) && cancellationReason && (+ <>+ <div className="font-medium">+ {isCancelled ? t("reason") : t("reschedule_reason")}+ </div>+ <div className="col-span-2 mb-6 last:mb-0">{cancellationReason}</div>+ </>+ )}+ <div className="font-medium">{t("what")}</div>+ <div className="col-span-2 mb-6 last:mb-0" data-testid="booking-title">+ {eventName}</div>- <div className="col-span-2 mb-6 last:mb-0">{cancellationReason}</div>- </>- )}- <div className="font-medium">{t("what")}</div>- <div className="col-span-2 mb-6 last:mb-0" data-testid="booking-title">- {eventName}- </div>- <div className="font-medium">{t("when")}</div>- <div className="col-span-2 mb-6 last:mb-0">- {reschedule && !!formerTime && (- <p className="line-through">+ <div className="font-medium">{t("when")}</div>+ <div className="col-span-2 mb-6 last:mb-0">+ {reschedule && !!formerTime && (+ <p className="line-through">+ <RecurringBookings+ eventType={eventType}+ duration={calculatedDuration}+ recurringBookings={props.recurringBookings}+ allRemainingBookings={allRemainingBookings}+ date={dayjs(formerTime)}+ is24h={is24h}+ isCancelled={isCancelled}+ tz={tz}+ />+ </p>+ )}<RecurringBookingseventType={eventType}duration={calculatedDuration}recurringBookings={props.recurringBookings}allRemainingBookings={allRemainingBookings}- date={dayjs(formerTime)}+ date={date}is24h={is24h}isCancelled={isCancelled}tz={tz}/>- </p>- )}- <RecurringBookings- eventType={eventType}- duration={calculatedDuration}- recurringBookings={props.recurringBookings}- allRemainingBookings={allRemainingBookings}- date={date}- is24h={is24h}- isCancelled={isCancelled}- tz={tz}- />- </div>- {(bookingInfo?.user || bookingInfo?.attendees) && (- <>- <div className="font-medium">{t("who")}</div>- <div className="col-span-2 last:mb-0">- {bookingInfo?.user && (- <div className="mb-3">- <div>- <span data-testid="booking-host-name" className="mr-2">- {bookingInfo.user.name}- </span>- <Badge variant="blue">{t("Host")}</Badge>- </div>- <p className="text-default">- {bookingInfo?.userPrimaryEmail ?? bookingInfo.user.email}- </p>- </div>- )}- {bookingInfo?.attendees.map((attendee) => (- <div key={attendee.name + attendee.email} className="mb-3 last:mb-0">- {attendee.name && (- <p data-testid={`attendee-name-${attendee.name}`}>{attendee.name}</p>+ </div>+ {(bookingInfo?.user || bookingInfo?.attendees) && (+ <>+ <div className="font-medium">{t("who")}</div>+ <div className="col-span-2 last:mb-0">+ {bookingInfo?.user && (+ <div className="mb-3">+ <div>+ <span data-testid="booking-host-name" className="mr-2">+ {bookingInfo.user.name}+ </span>+ <Badge variant="blue">{t("Host")}</Badge>+ </div>+ <p className="text-default">+ {bookingInfo?.userPrimaryEmail ?? bookingInfo.user.email}+ </p>+ </div>)}- <p data-testid={`attendee-email-${attendee.email}`}>{attendee.email}</p>+ {bookingInfo?.attendees.map((attendee) => (+ <div key={attendee.name + attendee.email} className="mb-3 last:mb-0">+ {attendee.name && (+ <p data-testid={`attendee-name-${attendee.name}`}>{attendee.name}</p>+ )}+ <p data-testid={`attendee-email-${attendee.email}`}>{attendee.email}</p>+ </div>+ ))}</div>- ))}- </div>- </>- )}- {locationToDisplay && !isCancelled && (- <>- <div className="mt-3 font-medium">{t("where")}</div>- <div className="col-span-2 mt-3" data-testid="where">- {!rescheduleLocation || locationToDisplay === rescheduleLocationToDisplay ? (- <DisplayLocation- locationToDisplay={locationToDisplay}- providerName={providerName}- />- ) : (- <>- {!!formerTime && (+ </>+ )}+ {locationToDisplay && !isCancelled && (+ <>+ <div className="mt-3 font-medium">{t("where")}</div>+ <div className="col-span-2 mt-3" data-testid="where">+ {!rescheduleLocation || locationToDisplay === rescheduleLocationToDisplay ? (<DisplayLocationlocationToDisplay={locationToDisplay}providerName={providerName}- className="line-through"/>- )}+ ) : (+ <>+ {!!formerTime && (+ <DisplayLocation+ locationToDisplay={locationToDisplay}+ providerName={providerName}+ className="line-through"+ />+ )}- <DisplayLocation- locationToDisplay={rescheduleLocationToDisplay}- providerName={rescheduleProviderName}+ <DisplayLocation+ locationToDisplay={rescheduleLocationToDisplay}+ providerName={rescheduleProviderName}+ />+ </>+ )}+ </div>+ </>+ )}+ {props.paymentStatus && (+ <>+ <div className="mt-3 font-medium">+ {props.paymentStatus.paymentOption === "HOLD"+ ? t("complete_your_booking")+ : t("payment")}+ </div>+ <div className="col-span-2 mb-2 mt-3">+ <Price+ currency={props.paymentStatus.currency}+ price={props.paymentStatus.amount}/>+ </div>+ </>+ )}+ {bookingInfo?.description && (+ <>+ <div className="mt-9 font-medium">{t("additional_notes")}</div>+ <div className="col-span-2 mb-2 mt-9">+ <p className="break-words">{bookingInfo.description}</p>+ </div>+ </>+ )}+ </div>+ <div className="text-bookingdark dark:border-darkgray-200 mt-8 text-left dark:text-gray-300">+ {Object.entries(bookingInfo.responses).map(([name, response]) => {+ const field = eventType.bookingFields.find((field) => field.name === name);+ // We show location in the "where" section+ // We show Booker Name, Emails and guests in Who section+ // We show notes in additional notes section+ // We show rescheduleReason at the top+ if (!field) return null;+ const isSystemField = SystemField.safeParse(field.name);+ // SMS_REMINDER_NUMBER_FIELD is a system field but doesn't have a dedicated place in the UI. So, it would be shown through the following responses list+ // TITLE is also an identifier for booking question "What is this meeting about?"+ if (+ isSystemField.success &&+ field.name !== SMS_REMINDER_NUMBER_FIELD &&+ field.name !== TITLE_FIELD+ )+ return null;++ const label = field.label || t(field.defaultLabel || "");++ return (+ <>+ <div className="text-emphasis mt-4 font-medium">{label}</div>+ <p+ className="text-default break-words"+ data-testid="field-response"+ data-fob-field={field.name}>+ {field.type === "boolean"+ ? response+ ? t("yes")+ : t("no")+ : response.toString()}+ </p></>- )}- </div>- </>- )}- {props.paymentStatus && (+ );+ })}+ </div>+ </div>+ {requiresLoginToUpdate && (<>- <div className="mt-3 font-medium">- {props.paymentStatus.paymentOption === "HOLD"- ? t("complete_your_booking")- : t("payment")}- </div>- <div className="col-span-2 mb-2 mt-3">- <Price currency={props.paymentStatus.currency} price={props.paymentStatus.amount} />+ <hr className="border-subtle mb-8" />+ <div className="text-center">+ <span className="text-emphasis ltr:mr-2 rtl:ml-2">+ {t("need_to_make_a_change")}+ </span>+ {/* Login button but redirect to here */}+ <span className="text-default inline">+ <span className="underline" data-testid="reschedule-link">+ <Link+ href={`/auth/login?callbackUrl=${encodeURIComponent(+ `/booking/${bookingInfo?.uid}`+ )}`}+ legacyBehavior>+ {t("login")}+ </Link>+ </span>+ </span></div></>)}- {bookingInfo?.description && (+ {!requiresLoginToUpdate &&+ (!needsConfirmation || !userIsOwner) &&+ !isCancelled &&+ (!isCancellationMode ? (+ <>+ <hr className="border-subtle mb-8" />+ <div className="text-center last:pb-0">+ <span className="text-emphasis ltr:mr-2 rtl:ml-2">+ {t("need_to_make_a_change")}+ </span>++ <>+ {!props.recurringBookings && (+ <span className="text-default inline">+ <span className="underline" data-testid="reschedule-link">+ <Link+ href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}`}+ legacyBehavior>+ {t("reschedule")}+ </Link>+ </span>+ <span className="mx-2">{t("or_lowercase")}</span>+ </span>+ )}++ <button+ data-testid="cancel"+ className={classNames(+ "text-default underline",+ props.recurringBookings && "ltr:mr-2 rtl:ml-2"+ )}+ onClick={() => setIsCancellationMode(true)}>+ {t("cancel")}+ </button>+ </>+ </div>+ </>+ ) : (+ <>+ <hr className="border-subtle" />+ <CancelBooking+ booking={{+ uid: bookingInfo?.uid,+ title: bookingInfo?.title,+ id: bookingInfo?.id,+ }}+ profile={{ name: props.profile.name, slug: props.profile.slug }}+ recurringEvent={eventType.recurringEvent}+ team={eventType?.team?.name}+ setIsCancellationMode={setIsCancellationMode}+ theme={isSuccessBookingPage ? props.profile.theme : "light"}+ allRemainingBookings={allRemainingBookings}+ seatReferenceUid={seatReferenceUid}+ bookingCancelledEventProps={bookingCancelledEventProps}+ />+ </>+ ))}+ {userIsOwner &&+ !needsConfirmation &&+ !isCancellationMode &&+ !isCancelled &&+ !!calculatedDuration && (+ <>+ <hr className="border-subtle mt-8" />+ <div className="text-default align-center flex flex-row justify-center pt-8">+ <span className="text-default flex self-center font-medium ltr:mr-2 rtl:ml-2 ">+ {t("add_to_calendar")}+ </span>+ <div className="justify-left mt-1 flex text-left sm:mt-0">+ <Link+ href={`https://calendar.google.com/calendar/r/eventedit?dates=${date+ .utc()+ .format("YYYYMMDDTHHmmss[Z]")}/${date+ .add(calculatedDuration, "minute")+ .utc()+ .format("YYYYMMDDTHHmmss[Z]")}&text=${eventName}&details=${+ eventType.description+ }${+ typeof locationVideoCallUrl === "string"+ ? `&location=${encodeURIComponent(locationVideoCallUrl)}`+ : ""+ }${+ eventType.recurringEvent+ ? `&recur=${encodeURIComponent(+ new RRule(eventType.recurringEvent).toString()+ )}`+ : ""+ }`}+ className="text-default border-subtle h-10 w-10 rounded-sm border px-3 py-2 ltr:mr-2 rtl:ml-2">+ <svg+ className="-mt-1.5 inline-block h-4 w-4"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24">+ <title>Google</title>+ <path d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z" />+ </svg>+ </Link>+ <Link+ href={+ encodeURI(+ `https://outlook.live.com/calendar/0/deeplink/compose?body=${+ eventType.description+ }&enddt=${date+ .add(calculatedDuration, "minute")+ .utc()+ .format()}&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=${date+ .utc()+ .format()}&subject=${eventName}`+ ) ++ (locationVideoCallUrl+ ? `&location=${encodeURIComponent(locationVideoCallUrl)}`+ : "")+ }+ className="border-subtle text-default mx-2 h-10 w-10 rounded-sm border px-3 py-2"+ target="_blank">+ <svg+ className="-mt-1.5 mr-1 inline-block h-4 w-4"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24">+ <title>Microsoft Outlook</title>+ <path d="M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V10.85l1.24.72h.01q.1.07.18.18.07.12.07.25zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.8v-2.73zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z" />+ </svg>+ </Link>+ <Link+ href={+ encodeURI(+ `https://outlook.office.com/calendar/0/deeplink/compose?body=${+ eventType.description+ }&enddt=${date+ .add(calculatedDuration, "minute")+ .utc()+ .format()}&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=${date+ .utc()+ .format()}&subject=${eventName}`+ ) ++ (locationVideoCallUrl+ ? `&location=${encodeURIComponent(locationVideoCallUrl)}`+ : "")+ }+ className="text-default border-subtle mx-2 h-10 w-10 rounded-sm border px-3 py-2"+ target="_blank">+ <svg+ className="-mt-1.5 mr-1 inline-block h-4 w-4"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 24 24">+ <title>Microsoft Office</title>+ <path d="M21.53 4.306v15.363q0 .807-.472 1.433-.472.627-1.253.85l-6.888 1.974q-.136.037-.29.055-.156.019-.293.019-.396 0-.72-.105-.321-.106-.656-.292l-4.505-2.544q-.248-.137-.391-.366-.143-.23-.143-.515 0-.434.304-.738.304-.305.739-.305h5.831V4.964l-4.38 1.563q-.533.187-.856.658-.322.472-.322 1.03v8.078q0 .496-.248.912-.25.416-.683.651l-2.072 1.13q-.286.148-.571.148-.497 0-.844-.347-.348-.347-.348-.844V6.563q0-.62.33-1.19.328-.571.874-.881L11.07.285q.248-.136.534-.21.285-.075.57-.075.211 0 .38.031.166.031.364.093l6.888 1.899q.384.11.7.329.317.217.547.52.23.305.353.67.125.367.125.764zm-1.588 15.363V4.306q0-.273-.16-.478-.163-.204-.423-.28l-3.388-.93q-.397-.111-.794-.23-.397-.117-.794-.216v19.68l4.976-1.427q.26-.074.422-.28.161-.204.161-.477z" />+ </svg>+ </Link>+ <Link+ href={`data:text/calendar,${eventLink()}`}+ className="border-subtle text-default mx-2 h-10 w-10 rounded-sm border px-3 py-2"+ download={`${eventType.title}.ics`}>+ <svg+ version="1.1"+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 1000 1000"+ className="-mt-1.5 mr-1 inline-block h-4 w-4">+ <title>{t("other")}</title>+ <path d="M971.3,154.9c0-34.7-28.2-62.9-62.9-62.9H611.7c-1.3,0-2.6,0.1-3.9,0.2V10L28.7,87.3v823.4L607.8,990v-84.6c1.3,0.1,2.6,0.2,3.9,0.2h296.7c34.7,0,62.9-28.2,62.9-62.9V154.9z M607.8,636.1h44.6v-50.6h-44.6v-21.9h44.6v-50.6h-44.6v-92h277.9v230.2c0,3.8-3.1,7-7,7H607.8V636.1z M117.9,644.7l-50.6-2.4V397.5l50.6-2.2V644.7z M288.6,607.3c17.6,0.6,37.3-2.8,49.1-7.2l9.1,48c-11,5.1-35.6,9.9-66.9,8.3c-85.4-4.3-127.5-60.7-127.5-132.6c0-86.2,57.8-136.7,133.2-140.1c30.3-1.3,53.7,4,64.3,9.2l-12.2,48.9c-12.1-4.9-28.8-9.2-49.5-8.6c-45.3,1.2-79.5,30.1-79.5,87.4C208.8,572.2,237.8,605.7,288.6,607.3z M455.5,665.2c-32.4-1.6-63.7-11.3-79.1-20.5l12.6-50.7c16.8,9.1,42.9,18.5,70.4,19.4c30.1,1,46.3-10.7,46.3-29.3c0-17.8-14-28.1-48.8-40.6c-46.9-16.4-76.8-41.7-76.8-81.5c0-46.6,39.3-84.1,106.8-87.1c33.3-1.5,58.3,4.2,76.5,11.2l-15.4,53.3c-12.1-5.3-33.5-12.8-62.3-12c-28.3,0.8-41.9,13.6-41.9,28.1c0,17.8,16.1,25.5,53.6,39c52.9,18.5,78.4,45.3,78.4,86.4C575.6,629.7,536.2,669.2,455.5,665.2z M935.3,842.7c0,14.9-12.1,27-27,27H611.7c-1.3,0-2.6-0.2-3.9-0.4V686.2h270.9c19.2,0,34.9-15.6,34.9-34.9V398.4c0-19.2-15.6-34.9-34.9-34.9h-47.1v-32.3H808v32.3h-44.8v-32.3h-22.7v32.3h-43.3v-32.3h-22.7v32.3H628v-32.3h-20.2v-203c1.31.2,2.6-0.4,3.9-0.4h296.7c14.9,0,27,12.1,27,27L935.3,842.7L935.3,842.7z" />+ </svg>+ </Link>+ </div>+ </div>+ </>+ )}++ {session === null && !(userIsOwner || props.hideBranding) && (<>- <div className="mt-9 font-medium">{t("additional_notes")}</div>- <div className="col-span-2 mb-2 mt-9">- <p className="break-words">{bookingInfo.description}</p>+ <hr className="border-subtle mt-8" />+ <div className="text-default pt-8 text-center text-xs">+ <a href="https://cal.com/signup">+ {t("create_booking_link_with_calcom", { appName: APP_NAME })}+ </a>++ <form+ onSubmit={(e) => {+ e.preventDefault();+ const target = e.target as typeof e.target & {+ email: { value: string };+ };+ router.push(`https://cal.com/signup?email=${target.email.value}`);+ }}+ className="mt-4 flex">+ <EmailInput+ name="email"+ id="email"+ defaultValue={email}+ className="mr- focus:border-brand-default border-default text-default mt-0 block w-full rounded-none rounded-l-md shadow-sm focus:ring-black sm:text-sm"+ placeholder="[email protected]"+ />+ <Button+ size="lg"+ type="submit"+ className="min-w-max rounded-none rounded-r-md"+ color="primary">+ {t("try_for_free")}+ </Button>+ </form></div></>)}- </div>- <div className="text-bookingdark dark:border-darkgray-200 mt-8 text-left dark:text-gray-300">- {Object.entries(bookingInfo.responses).map(([name, response]) => {- const field = eventType.bookingFields.find((field) => field.name === name);- // We show location in the "where" section- // We show Booker Name, Emails and guests in Who section- // We show notes in additional notes section- // We show rescheduleReason at the top- if (!field) return null;- const isSystemField = SystemField.safeParse(field.name);- // SMS_REMINDER_NUMBER_FIELD is a system field but doesn't have a dedicated place in the UI. So, it would be shown through the following responses list- // TITLE is also an identifier for booking question "What is this meeting about?"- if (- isSystemField.success &&- field.name !== SMS_REMINDER_NUMBER_FIELD &&- field.name !== TITLE_FIELD- )- return null;-- const label = field.label || t(field.defaultLabel || "");-- return (- <>- <div className="text-emphasis mt-4 font-medium">{label}</div>- <p- className="text-default break-words"- data-testid="field-response"- data-fob-field={field.name}>- {field.type === "boolean" ? (response ? t("yes") : t("no")) : response.toString()}- </p>- </>- );- })}- </div>- </div>- {requiresLoginToUpdate && (- <>- <hr className="border-subtle mb-8" />- <div className="text-center">- <span className="text-emphasis ltr:mr-2 rtl:ml-2">{t("need_to_make_a_change")}</span>- {/* Login button but redirect to here */}- <span className="text-default inline">- <span className="underline" data-testid="reschedule-link">- <Link- href={`/auth/login?callbackUrl=${encodeURIComponent(- `/booking/${bookingInfo?.uid}`- )}`}- legacyBehavior>- {t("login")}- </Link>- </span>- </span>- </div></>)}- {!requiresLoginToUpdate &&- (!needsConfirmation || !userIsOwner) &&- !isCancelled &&- (!isCancellationMode ? (+ {isFeedbackMode &&+ (noShow ? (<>- <hr className="border-subtle mb-8" />- <div className="text-center last:pb-0">- <span className="text-emphasis ltr:mr-2 rtl:ml-2">{t("need_to_make_a_change")}</span>-- <>- {!props.recurringBookings && (- <span className="text-default inline">- <span className="underline" data-testid="reschedule-link">- <Link- href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}`}- legacyBehavior>- {t("reschedule")}- </Link>- </span>- <span className="mx-2">{t("or_lowercase")}</span>- </span>- )}-- <button- data-testid="cancel"- className={classNames(- "text-default underline",- props.recurringBookings && "ltr:mr-2 rtl:ml-2"- )}- onClick={() => setIsCancellationMode(true)}>- {t("cancel")}- </button>- </>- </div>+ <EmptyScreen+ Icon="user-x"+ iconClassName="text-error"+ iconWrapperClassName="bg-error"+ headline={t("host_no_show")}+ description={t("no_show_description")}+ buttonRaw={+ !props.recurringBookings ? (+ <Button href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}`}>+ {t("reschedule")}+ </Button>+ ) : undefined+ }+ /></>) : (<>- <hr className="border-subtle" />- <CancelBooking- booking={{ uid: bookingInfo?.uid, title: bookingInfo?.title, id: bookingInfo?.id }}- profile={{ name: props.profile.name, slug: props.profile.slug }}- recurringEvent={eventType.recurringEvent}- team={eventType?.team?.name}- setIsCancellationMode={setIsCancellationMode}- theme={isSuccessBookingPage ? props.profile.theme : "light"}- allRemainingBookings={allRemainingBookings}- seatReferenceUid={seatReferenceUid}- bookingCancelledEventProps={bookingCancelledEventProps}+ <div className="my-3 flex justify-end">+ <button+ className={classNames(+ "m-1 items-center justify-center rounded-full border p-1 text-2xl hover:opacity-100",+ rateValue === 1+ ? "border-focus bg-emphasis"+ : "border-muted bg-default opacity-50"+ )}+ disabled={isFeedbackSubmitted}+ onClick={() => setRateValue(1)}>+ π+ </button>+ <button+ className={classNames(+ "m-1 items-center justify-center rounded-full border p-1 text-2xl hover:opacity-100",+ rateValue === 2+ ? "border-focus bg-emphasis"+ : "border-muted bg-default opacity-50"+ )}+ disabled={isFeedbackSubmitted}+ onClick={() => setRateValue(2)}>+ π+ </button>+ <button+ className={classNames(+ "m-1 items-center justify-center rounded-full border p-1 text-2xl hover:opacity-100",+ rateValue === 3+ ? "border-focus bg-emphasis"+ : " border-muted bg-default opacity-50"+ )}+ disabled={isFeedbackSubmitted}+ onClick={() => setRateValue(3)}>+ π+ </button>+ <button+ className={classNames(+ "m-1 items-center justify-center rounded-full border p-1 text-2xl hover:opacity-100",+ rateValue === 4+ ? "border-focus bg-emphasis"+ : "border-muted bg-default opacity-50"+ )}+ disabled={isFeedbackSubmitted}+ onClick={() => setRateValue(4)}>+ π+ </button>+ <button+ className={classNames(+ "m-1 items-center justify-center rounded-full border p-1 text-2xl hover:opacity-100",+ rateValue === 5+ ? "border-focus bg-emphasis"+ : "border-muted bg-default opacity-50"+ )}+ disabled={isFeedbackSubmitted}+ onClick={() => setRateValue(5)}>+ π+ </button>+ </div>+ <div className="my-4 space-y-1 text-center">+ <h2 className="font-cal text-lg">{t("submitted_feedback")}</h2>+ <p className="text-sm">{rateValue < 4 ? t("how_can_we_improve") : t("most_liked")}</p>+ </div>+ <TextArea+ id="comment"+ name="comment"+ placeholder="Next time I would like to ..."+ rows={3}+ disabled={isFeedbackSubmitted}+ onChange={(event) => setComment(event.target.value)}/>- </>- ))}- {userIsOwner &&- !needsConfirmation &&- !isCancellationMode &&- !isCancelled &&- !!calculatedDuration && (- <>- <hr className="border-subtle mt-8" />- <div className="text-default align-center flex flex-row justify-center pt-8">- <span className="text-default flex self-center font-medium ltr:mr-2 rtl:ml-2 ">- {t("add_to_calendar")}- </span>- <div className="justify-left mt-1 flex text-left sm:mt-0">- <Link- href={`https://calendar.google.com/calendar/r/eventedit?dates=${date- .utc()- .format("YYYYMMDDTHHmmss[Z]")}/${date- .add(calculatedDuration, "minute")- .utc()- .format("YYYYMMDDTHHmmss[Z]")}&text=${eventName}&details=${- eventType.description- }${- typeof locationVideoCallUrl === "string"- ? `&location=${encodeURIComponent(locationVideoCallUrl)}`- : ""- }${- eventType.recurringEvent- ? `&recur=${encodeURIComponent(- new RRule(eventType.recurringEvent).toString()- )}`- : ""- }`}- className="text-default border-subtle h-10 w-10 rounded-sm border px-3 py-2 ltr:mr-2 rtl:ml-2">- <svg- className="-mt-1.5 inline-block h-4 w-4"- fill="currentColor"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24">- <title>Google</title>- <path d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z" />- </svg>- </Link>- <Link- href={- encodeURI(- `https://outlook.live.com/calendar/0/deeplink/compose?body=${- eventType.description- }&enddt=${date- .add(calculatedDuration, "minute")- .utc()- .format()}&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=${date- .utc()- .format()}&subject=${eventName}`- ) +- (locationVideoCallUrl- ? `&location=${encodeURIComponent(locationVideoCallUrl)}`- : "")- }- className="border-subtle text-default mx-2 h-10 w-10 rounded-sm border px-3 py-2"- target="_blank">- <svg- className="-mt-1.5 mr-1 inline-block h-4 w-4"- fill="currentColor"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24">- <title>Microsoft Outlook</title>- <path d="M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V10.85l1.24.72h.01q.1.07.18.18.07.12.07.25zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.8v-2.73zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z" />- </svg>- </Link>- <Link- href={- encodeURI(- `https://outlook.office.com/calendar/0/deeplink/compose?body=${- eventType.description- }&enddt=${date- .add(calculatedDuration, "minute")- .utc()- .format()}&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=${date- .utc()- .format()}&subject=${eventName}`- ) +- (locationVideoCallUrl- ? `&location=${encodeURIComponent(locationVideoCallUrl)}`- : "")+ <div className="my-4 flex justify-start">+ <Button+ loading={mutation.isPending}+ disabled={isFeedbackSubmitted}+ onClick={async () => {+ if (rating) {+ await sendFeedback(rating, comment);}- className="text-default border-subtle mx-2 h-10 w-10 rounded-sm border px-3 py-2"- target="_blank">- <svg- className="-mt-1.5 mr-1 inline-block h-4 w-4"- fill="currentColor"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24">- <title>Microsoft Office</title>- <path d="M21.53 4.306v15.363q0 .807-.472 1.433-.472.627-1.253.85l-6.888 1.974q-.136.037-.29.055-.156.019-.293.019-.396 0-.72-.105-.321-.106-.656-.292l-4.505-2.544q-.248-.137-.391-.366-.143-.23-.143-.515 0-.434.304-.738.304-.305.739-.305h5.831V4.964l-4.38 1.563q-.533.187-.856.658-.322.472-.322 1.03v8.078q0 .496-.248.912-.25.416-.683.651l-2.072 1.13q-.286.148-.571.148-.497 0-.844-.347-.348-.347-.348-.844V6.563q0-.62.33-1.19.328-.571.874-.881L11.07.285q.248-.136.534-.21.285-.075.57-.075.211 0 .38.031.166.031.364.093l6.888 1.899q.384.11.7.329.317.217.547.52.23.305.353.67.125.367.125.764zm-1.588 15.363V4.306q0-.273-.16-.478-.163-.204-.423-.28l-3.388-.93q-.397-.111-.794-.23-.397-.117-.794-.216v19.68l4.976-1.427q.26-.074.422-.28.161-.204.161-.477z" />- </svg>- </Link>- <Link- href={`data:text/calendar,${eventLink()}`}- className="border-subtle text-default mx-2 h-10 w-10 rounded-sm border px-3 py-2"- download={`${eventType.title}.ics`}>- <svg- version="1.1"- fill="currentColor"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 1000 1000"- className="-mt-1.5 mr-1 inline-block h-4 w-4">- <title>{t("other")}</title>- <path d="M971.3,154.9c0-34.7-28.2-62.9-62.9-62.9H611.7c-1.3,0-2.6,0.1-3.9,0.2V10L28.7,87.3v823.4L607.8,990v-84.6c1.3,0.1,2.6,0.2,3.9,0.2h296.7c34.7,0,62.9-28.2,62.9-62.9V154.9z M607.8,636.1h44.6v-50.6h-44.6v-21.9h44.6v-50.6h-44.6v-92h277.9v230.2c0,3.8-3.1,7-7,7H607.8V636.1z M117.9,644.7l-50.6-2.4V397.5l50.6-2.2V644.7z M288.6,607.3c17.6,0.6,37.3-2.8,49.1-7.2l9.1,48c-11,5.1-35.6,9.9-66.9,8.3c-85.4-4.3-127.5-60.7-127.5-132.6c0-86.2,57.8-136.7,133.2-140.1c30.3-1.3,53.7,4,64.3,9.2l-12.2,48.9c-12.1-4.9-28.8-9.2-49.5-8.6c-45.3,1.2-79.5,30.1-79.5,87.4C208.8,572.2,237.8,605.7,288.6,607.3z M455.5,665.2c-32.4-1.6-63.7-11.3-79.1-20.5l12.6-50.7c16.8,9.1,42.9,18.5,70.4,19.4c30.1,1,46.3-10.7,46.3-29.3c0-17.8-14-28.1-48.8-40.6c-46.9-16.4-76.8-41.7-76.8-81.5c0-46.6,39.3-84.1,106.8-87.1c33.3-1.5,58.3,4.2,76.5,11.2l-15.4,53.3c-12.1-5.3-33.5-12.8-62.3-12c-28.3,0.8-41.9,13.6-41.9,28.1c0,17.8,16.1,25.5,53.6,39c52.9,18.5,78.4,45.3,78.4,86.4C575.6,629.7,536.2,669.2,455.5,665.2z M935.3,842.7c0,14.9-12.1,27-27,27H611.7c-1.3,0-2.6-0.2-3.9-0.4V686.2h270.9c19.2,0,34.9-15.6,34.9-34.9V398.4c0-19.2-15.6-34.9-34.9-34.9h-47.1v-32.3H808v32.3h-44.8v-32.3h-22.7v32.3h-43.3v-32.3h-22.7v32.3H628v-32.3h-20.2v-203c1.31.2,2.6-0.4,3.9-0.4h296.7c14.9,0,27,12.1,27,27L935.3,842.7L935.3,842.7z" />- </svg>- </Link>- </div>+ }}>+ {t("submit_feedback")}+ </Button></div></>- )}-- {session === null && !(userIsOwner || props.hideBranding) && (- <>- <hr className="border-subtle mt-8" />- <div className="text-default pt-8 text-center text-xs">- <a href="https://cal.com/signup">- {t("create_booking_link_with_calcom", { appName: APP_NAME })}- </a>-- <form- onSubmit={(e) => {- e.preventDefault();- const target = e.target as typeof e.target & {- email: { value: string };- };- router.push(`https://cal.com/signup?email=${target.email.value}`);- }}- className="mt-4 flex">- <EmailInput- name="email"- id="email"- defaultValue={email}- className="mr- focus:border-brand-default border-default text-default mt-0 block w-full rounded-none rounded-l-md shadow-sm focus:ring-black sm:text-sm"- placeholder="[email protected]"- />- <Button- size="lg"- type="submit"- className="min-w-max rounded-none rounded-r-md"- color="primary">- {t("try_for_free")}- </Button>- </form>- </div>- </>- )}+ ))}</div>- {isGmail && (+ {isGmail && !isFeedbackMode && (<AlertclassName="main -mb-20 mt-4 inline-block ltr:text-left rtl:text-right sm:-mt-4 sm:mb-4 sm:w-full sm:max-w-xl sm:align-middle"severity="warning"@@ -793,6 +968,7 @@ export default function Success(props: PageProps) {</div></div></main>+ <Toaster position="bottom-right" /></div>);}diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 4b8c99e5b2b..4cb55dc7f06 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1247,6 +1247,7 @@"reminder": "Reminder","rescheduled": "Rescheduled","completed": "Completed",+ "rating": "Rating","reminder_email": "Reminder: {{eventType}} with {{name}} at {{date}}","not_triggering_existing_bookings": "Won't trigger for already existing bookings as user will be asked for phone number when booking the event.","minute_one": "{{count}} minute",@@ -2364,8 +2365,15 @@"lock_org_users_eventtypes_description": "Prevent members from creating their own event types.","cookie_consent_checkbox": "I consent to our privacy policy and cookie usage","make_a_call": "Make a Call",+ "submit_feedback": "Submit Feedback",+ "host_no_show": "Your host didn't show up",+ "no_show_description": "You can reschedule another meeting with them",+ "how_can_we_improve": "How can we improve our service?",+ "most_liked": "What did you like the most?","review": "Review","reviewed": "Reviewed","unreviewed": "Unreviewed",+ "rating_url_info":"The URL for Rating Feedback Form",+ "no_show_url_info":"The URL for No Show Feedback","ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "βββββββββββββ Add your new strings above here ββββββββββββββββββββ"}diff --git a/apps/web/styles/globals.css b/apps/web/styles/globals.cssindex 96369637dc1..b913516e3cd 100644--- a/apps/web/styles/globals.css+++ b/apps/web/styles/globals.css@@ -27,6 +27,7 @@--cal-border-booker: #e5e7eb;--cal-border-muted: hsla(220, 14%, 96%, 1);--cal-border-error: hsla(4, 63%, 41%, 1);+ --cal-border-focus: hsla(0, 0%, 10%, 1);/* Content/Text */--cal-text-emphasis: hsla(217, 19%, 27%, 1);@@ -71,6 +72,7 @@--cal-border-booker: hsla(0, 0%, 22%, 1);--cal-border-muted: hsla(0, 0%, 18%, 1);--cal-border-error: hsla(4, 63%, 41%, 1);+ --cal-border-focus: hsla(0, 0%, 100%, 1);/* Content/Text */--cal-text-emphasis: hsla(240, 20%, 99%, 1);diff --git a/packages/config/tailwind-preset.js b/packages/config/tailwind-preset.jsindex 64391df41f4..c186db13dff 100644--- a/packages/config/tailwind-preset.js+++ b/packages/config/tailwind-preset.js@@ -66,6 +66,7 @@ module.exports = {muted: "var(--cal-border-muted, #F3F4F6)",booker: `var(--cal-border-booker, ${subtleColor})`,error: "var(--cal-border-error, #AA2E26)",+ focus: "var(--cal-border-focus, #1A1A1A)",},textColor: {emphasis: "var(--cal-text-emphasis, #111827)",diff --git a/packages/features/ee/workflows/api/scheduleEmailReminders.ts b/packages/features/ee/workflows/api/scheduleEmailReminders.tsindex 25596d1becc..151e160acc0 100644--- a/packages/features/ee/workflows/api/scheduleEmailReminders.ts+++ b/packages/features/ee/workflows/api/scheduleEmailReminders.ts@@ -27,6 +27,7 @@ import {} from "../lib/reminders/providers/sendgridProvider";import type { VariablesType } from "../lib/reminders/templates/customTemplate";import customTemplate from "../lib/reminders/templates/customTemplate";+import emailRatingTemplate from "../lib/reminders/templates/emailRatingTemplate";import emailReminderTemplate from "../lib/reminders/templates/emailReminderTemplate";async function handler(req: NextApiRequest, res: NextApiResponse) {@@ -188,6 +189,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {meetingUrl: bookingMetadataSchema.parse(reminder.booking.metadata || {})?.videoCallUrl,cancelLink: `${bookerUrl}/booking/${reminder.booking.uid}?cancel=true`,rescheduleLink: `${bookerUrl}/reschedule/${reminder.booking.uid}`,+ ratingUrl: `${bookerUrl}/booking/${reminder.booking.uid}?rating`,+ noShowUrl: `${bookerUrl}/booking/${reminder.booking.uid}?noShow=true`,};const emailLocale = locale || "en";const emailSubject = customTemplate(@@ -226,6 +229,30 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {name || "",!!reminder.booking.user?.hideBranding);+ } else if (reminder.workflowStep.template === WorkflowTemplates.RATING) {+ const organizerOrganizationProfile = await prisma.profile.findFirst({+ where: {+ userId: reminder.booking.user?.id,+ },+ });++ const organizerOrganizationId = organizerOrganizationProfile?.organizationId;+ const bookerUrl = await getBookerBaseUrl(+ reminder.booking.eventType?.team?.parentId ?? organizerOrganizationId ?? null+ );+ emailContent = emailRatingTemplate({+ isEditingMode: true,+ action: reminder.workflowStep.action || WorkflowActions.EMAIL_ADDRESS,+ timeFormat: getTimeFormatStringFromUserTimeFormat(reminder.booking.user?.timeFormat),+ startTime: reminder.booking.startTime.toISOString() || "",+ endTime: reminder.booking.endTime.toISOString() || "",+ eventName: reminder.booking.eventType?.title || "",+ timeZone: timeZone || "",+ organizer: reminder.booking.user?.name || "",+ name: name || "",+ ratingUrl: `${bookerUrl}/booking/${reminder.booking.uid}?rating` || "",+ noShowUrl: `${bookerUrl}/booking/${reminder.booking.uid}?noShow=true` || "",+ });}if (emailContent.emailSubject.length > 0 && !emailBodyEmpty && sendTo) {diff --git a/packages/features/ee/workflows/components/WorkflowStepContainer.tsx b/packages/features/ee/workflows/components/WorkflowStepContainer.tsxindex 547b0730558..d747cc6b213 100644--- a/packages/features/ee/workflows/components/WorkflowStepContainer.tsx+++ b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx@@ -50,6 +50,7 @@ import {} from "../lib/actionHelperFunctions";import { DYNAMIC_TEXT_VARIABLES } from "../lib/constants";import { getWorkflowTemplateOptions, getWorkflowTriggerOptions } from "../lib/getOptions";+import emailRatingTemplate from "../lib/reminders/templates/emailRatingTemplate";import emailReminderTemplate from "../lib/reminders/templates/emailReminderTemplate";import smsReminderTemplate from "../lib/reminders/templates/smsReminderTemplate";import { whatsappReminderTemplate } from "../lib/reminders/templates/whatsapp";@@ -739,6 +740,15 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {emailReminderTemplate(true, action, timeFormat).emailSubject);}+ } else if (val.value === WorkflowTemplates.RATING) {+ form.setValue(+ `steps.${step.stepNumber - 1}.reminderBody`,+ emailRatingTemplate({ isEditingMode: true, action, timeFormat }).emailBody+ );+ form.setValue(+ `steps.${step.stepNumber - 1}.emailSubject`,+ emailRatingTemplate({ isEditingMode: true, action, timeFormat }).emailSubject+ );} else {if (isWhatsappAction(action)) {form.setValue(diff --git a/packages/features/ee/workflows/lib/actionHelperFunctions.ts b/packages/features/ee/workflows/lib/actionHelperFunctions.tsindex a4c8b80250f..b66f2b77344 100644--- a/packages/features/ee/workflows/lib/actionHelperFunctions.ts+++ b/packages/features/ee/workflows/lib/actionHelperFunctions.ts@@ -38,6 +38,10 @@ export function isAttendeeAction(action: WorkflowActions) {);}+export function isEmailToAttendeeAction(action: WorkflowActions) {+ return action === WorkflowActions.EMAIL_ATTENDEE;+}+export function isTextMessageToAttendeeAction(action?: WorkflowActions) {return action === WorkflowActions.SMS_ATTENDEE || action === WorkflowActions.WHATSAPP_ATTENDEE;}diff --git a/packages/features/ee/workflows/lib/constants.ts b/packages/features/ee/workflows/lib/constants.tsindex 618cc6fd522..c127b471353 100644--- a/packages/features/ee/workflows/lib/constants.ts+++ b/packages/features/ee/workflows/lib/constants.ts@@ -23,6 +23,7 @@ export const TIME_UNIT = [TimeUnit.DAY, TimeUnit.HOUR, TimeUnit.MINUTE] as constexport const WORKFLOW_TEMPLATES = [WorkflowTemplates.CUSTOM,WorkflowTemplates.REMINDER,+ WorkflowTemplates.RATING,WorkflowTemplates.CANCELLED,WorkflowTemplates.COMPLETED,WorkflowTemplates.RESCHEDULED,@@ -30,6 +31,12 @@ export const WORKFLOW_TEMPLATES = [export const BASIC_WORKFLOW_TEMPLATES = [WorkflowTemplates.CUSTOM, WorkflowTemplates.REMINDER] as const;+export const ATTENDEE_WORKFLOW_TEMPLATES = [+ WorkflowTemplates.CUSTOM,+ WorkflowTemplates.REMINDER,+ WorkflowTemplates.RATING,+] as const;+export const WHATSAPP_WORKFLOW_TEMPLATES = [WorkflowTemplates.REMINDER,WorkflowTemplates.COMPLETED,@@ -53,6 +60,8 @@ export const DYNAMIC_TEXT_VARIABLES = ["meeting_url","cancel_url","reschedule_url",+ "rating_url",+ "no_show_url",];export const FORMATTED_DYNAMIC_TEXT_VARIABLES = ["event_date_", "event_time_", "event_end_time_"];diff --git a/packages/features/ee/workflows/lib/getOptions.ts b/packages/features/ee/workflows/lib/getOptions.tsindex 28f199eae02..a1d80149ecf 100644--- a/packages/features/ee/workflows/lib/getOptions.ts+++ b/packages/features/ee/workflows/lib/getOptions.ts@@ -6,6 +6,7 @@ import {isTextMessageToAttendeeAction,isSMSOrWhatsappAction,isWhatsappAction,+ isEmailToAttendeeAction,} from "./actionHelperFunctions";import {TIME_UNIT,@@ -13,6 +14,7 @@ import {WORKFLOW_ACTIONS,BASIC_WORKFLOW_TEMPLATES,WORKFLOW_TRIGGER_EVENTS,+ ATTENDEE_WORKFLOW_TEMPLATES,} from "./constants";export function getWorkflowActionOptions(t: TFunction, isTeamsPlan?: boolean, isOrgsPlan?: boolean) {@@ -46,7 +48,11 @@ export function getWorkflowTimeUnitOptions(t: TFunction) {export function getWorkflowTemplateOptions(t: TFunction, action: WorkflowActions | undefined) {const TEMPLATES =- action && isWhatsappAction(action) ? WHATSAPP_WORKFLOW_TEMPLATES : BASIC_WORKFLOW_TEMPLATES;+ action && isWhatsappAction(action)+ ? WHATSAPP_WORKFLOW_TEMPLATES+ : action && isEmailToAttendeeAction(action)+ ? ATTENDEE_WORKFLOW_TEMPLATES+ : BASIC_WORKFLOW_TEMPLATES;return TEMPLATES.map((template) => {return { label: t(`${template.toLowerCase()}`), value: template };}) as { label: string; value: any }[];diff --git a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts b/packages/features/ee/workflows/lib/reminders/emailReminderManager.tsindex 5e02f8ac76d..0e6b0d87bb1 100644--- a/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts+++ b/packages/features/ee/workflows/lib/reminders/emailReminderManager.ts@@ -23,6 +23,7 @@ import { getBatchId, sendSendgridMail } from "./providers/sendgridProvider";import type { AttendeeInBookingInfo, BookingInfo, timeUnitLowerCase } from "./smsReminderManager";import type { VariablesType } from "./templates/customTemplate";import customTemplate from "./templates/customTemplate";+import emailRatingTemplate from "./templates/emailRatingTemplate";import emailReminderTemplate from "./templates/emailReminderTemplate";const log = logger.getSubLogger({ prefix: ["[emailReminderManager]"] });@@ -200,6 +201,8 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl,cancelLink: `${evt.bookerUrl}/booking/${evt.uid}?cancel=true`,rescheduleLink: `${evt.bookerUrl}/reschedule/${evt.uid}`,+ ratingUrl: `${evt.bookerUrl}/booking/${evt.uid}?rating`,+ noShowUrl: `${evt.bookerUrl}/booking/${evt.uid}?noShow=true`,};const locale =@@ -228,6 +231,20 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>attendeeName,name);+ } else if (template === WorkflowTemplates.RATING) {+ emailContent = emailRatingTemplate({+ isEditingMode: true,+ action,+ timeFormat: evt.organizer.timeFormat,+ startTime,+ endTime,+ eventName: evt.title,+ timeZone,+ organizer: evt.organizer.name,+ name,+ ratingUrl: `${evt.bookerUrl}/booking/${evt.uid}?rating`,+ noShowUrl: `${evt.bookerUrl}/booking/${evt.uid}?noShow=true`,+ });}// Allows debugging generated email content without waiting for sendgrid to send emailsdiff --git a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.tsindex 86c5ddcb26c..e63a0a2b5f9 100644--- a/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts+++ b/packages/features/ee/workflows/lib/reminders/templates/customTemplate.ts@@ -21,6 +21,8 @@ export type VariablesType = {meetingUrl?: string;cancelLink?: string;rescheduleLink?: string;+ ratingUrl?: string;+ noShowUrl?: string;};const customTemplate = (@@ -79,7 +81,9 @@ const customTemplate = (.replaceAll("{TIMEZONE}", variables.timeZone || "").replaceAll("{CANCEL_URL}", cancelLink).replaceAll("{RESCHEDULE_URL}", rescheduleLink)- .replaceAll("{MEETING_URL}", variables.meetingUrl || "");+ .replaceAll("{MEETING_URL}", variables.meetingUrl || "")+ .replaceAll("{RATING_URL}", variables.ratingUrl || "")+ .replaceAll("{NO_SHOW_URL}", variables.noShowUrl || "");const customInputvariables = dynamicText.match(/\{(.+?)}/g)?.map((variable) => {return variable.replace("{", "").replace("}", "");diff --git a/packages/features/ee/workflows/lib/reminders/templates/emailRatingTemplate.ts b/packages/features/ee/workflows/lib/reminders/templates/emailRatingTemplate.tsnew file mode 100644index 00000000000..bd33798d414--- /dev/null+++ b/packages/features/ee/workflows/lib/reminders/templates/emailRatingTemplate.ts@@ -0,0 +1,79 @@+import dayjs from "@calcom/dayjs";+import { APP_NAME } from "@calcom/lib/constants";+import { TimeFormat } from "@calcom/lib/timeFormat";+import { WorkflowActions } from "@calcom/prisma/enums";++const emailRatingTemplate = ({+ isEditingMode,+ action,+ timeFormat,+ startTime,+ endTime,+ eventName,+ timeZone,+ organizer,+ name,+ isBrandingDisabled,+ ratingUrl,+ noShowUrl,+}: {+ isEditingMode: boolean;+ action: WorkflowActions;+ timeFormat?: TimeFormat;+ startTime?: string;+ endTime?: string;+ eventName?: string;+ timeZone?: string;+ organizer?: string;+ name?: string;+ isBrandingDisabled?: boolean;+ ratingUrl?: string;+ noShowUrl?: string;+}) => {+ const currentTimeFormat = timeFormat || TimeFormat.TWELVE_HOUR;+ const dateTimeFormat = `ddd, MMM D, YYYY ${currentTimeFormat}`;++ let eventDate = "";++ if (isEditingMode) {+ endTime = "{EVENT_END_TIME}";+ eventName = "{EVENT_NAME}";+ timeZone = "{TIMEZONE}";+ organizer = "{ORGANIZER}";+ name = action === WorkflowActions.EMAIL_ATTENDEE ? "{ATTENDEE}" : "{ORGANIZER}";+ eventDate = `{EVENT_DATE_${dateTimeFormat}}`;+ ratingUrl = "{RATING_URL}";+ noShowUrl = "{NO_SHOW_URL}";+ } else {+ eventDate = dayjs(startTime).tz(timeZone).format(dateTimeFormat);++ endTime = dayjs(endTime).tz(timeZone).format(currentTimeFormat);+ }++ const emailSubject = `How was your recent experience?: ${eventName}`;++ const introHtml = `<body>Hi${+ name ? ` ${name}` : ""+ },<br><br>We're always looking to improve our customer's experience. How satisfied were you with your recent meeting?<br><br>`;++ const ratingHtml = `<a href="${ratingUrl}=1">π </a> <a href="${ratingUrl}=2">π</a> <a href="${ratingUrl}=3">π</a> <a href="${ratingUrl}=4">π</a> <a href="${ratingUrl}=5">π</a><br><br>`;++ const noShowHtml = `<div><a href="${noShowUrl}">${organizer} didn't join the meeting</a></div><br><br>`;++ const eventHtml = `<div><strong class="editor-text-bold">Event: </strong></div>${eventName}<br><br>`;++ const dateTimeHtml = `<div><strong class="editor-text-bold">Date & Time: </strong></div>${eventDate} - ${endTime} (${timeZone})<br><br>`;++ const attendeeHtml = `<div><strong class="editor-text-bold">Attendees: </strong></div>You & ${organizer}<br><br>`;++ const branding = !isBrandingDisabled && !isEditingMode ? `<br><br>_<br><br>Scheduling by ${APP_NAME}` : "";++ const endingHtml = `This survey was triggered by a Workflow in Cal.${branding}</body>`;++ const emailBody =+ introHtml + ratingHtml + noShowHtml + eventHtml + dateTimeHtml + attendeeHtml + endingHtml;++ return { emailSubject, emailBody };+};++export default emailRatingTemplate;diff --git a/packages/lib/test/builder.ts b/packages/lib/test/builder.tsindex ddf6a45a291..088e933df03 100644--- a/packages/lib/test/builder.ts+++ b/packages/lib/test/builder.ts@@ -65,6 +65,9 @@ export const buildBooking = (booking?: Partial<Booking>): Booking => {isRecorded: false,iCalUID: getICalUID({ uid }),iCalSequence: 0,+ rating: null,+ noShowHost: null,+ ratingFeedback: null,...booking,};};diff --git a/packages/prisma/migrations/20240327121006_added_rating_workflow_template/migration.sql b/packages/prisma/migrations/20240327121006_added_rating_workflow_template/migration.sqlnew file mode 100644index 00000000000..2adf39efe31--- /dev/null+++ b/packages/prisma/migrations/20240327121006_added_rating_workflow_template/migration.sql@@ -0,0 +1,2 @@+-- AlterEnum+ALTER TYPE "WorkflowTemplates" ADD VALUE 'RATING';diff --git a/packages/prisma/migrations/20240327130910_added_rating_feedback_and_noshowhost_for_booking/migration.sql b/packages/prisma/migrations/20240327130910_added_rating_feedback_and_noshowhost_for_booking/migration.sqlnew file mode 100644index 00000000000..6b83066632c--- /dev/null+++ b/packages/prisma/migrations/20240327130910_added_rating_feedback_and_noshowhost_for_booking/migration.sql@@ -0,0 +1,4 @@+-- AlterTable+ALTER TABLE "Booking" ADD COLUMN "noShowHost" BOOLEAN,+ADD COLUMN "rating" INTEGER,+ADD COLUMN "ratingFeedback" TEXT;diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prismaindex dd63a2cfd0e..7b961a62d31 100644--- a/packages/prisma/schema.prisma+++ b/packages/prisma/schema.prisma@@ -547,6 +547,9 @@ model Booking {iCalUID String? @default("")iCalSequence Int @default(0)instantMeetingToken InstantMeetingToken?+ rating Int?+ ratingFeedback String?+ noShowHost Boolean?@@index([eventTypeId])@@index([userId])@@ -994,6 +997,7 @@ enum WorkflowTemplates {CANCELLEDRESCHEDULEDCOMPLETED+ RATING}enum WorkflowMethods {diff --git a/packages/trpc/server/routers/publicViewer/_router.tsx b/packages/trpc/server/routers/publicViewer/_router.tsxindex 1d806431782..417a37d94cd 100644--- a/packages/trpc/server/routers/publicViewer/_router.tsx+++ b/packages/trpc/server/routers/publicViewer/_router.tsx@@ -2,10 +2,12 @@ import publicProcedure from "../../procedures/publicProcedure";import { importHandler, router } from "../../trpc";import { slotsRouter } from "../viewer/slots/_router";import { i18nInputSchema } from "./i18n.schema";+import { ZNoShowInputSchema } from "./noShow.schema";import { event } from "./procedures/event";import { session } from "./procedures/session";import { ZSamlTenantProductInputSchema } from "./samlTenantProduct.schema";import { ZStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema";+import { ZSubmitRatingInputSchema } from "./submitRating.schema";const NAMESPACE = "publicViewer";@@ -22,6 +24,14 @@ export const publicViewerRouter = router({const handler = await importHandler(namespaced("countryCode"), () => import("./countryCode.handler"));return handler(opts);}),+ submitRating: publicProcedure.input(ZSubmitRatingInputSchema).mutation(async (opts) => {+ const handler = await importHandler(namespaced("submitRating"), () => import("./submitRating.handler"));+ return handler(opts);+ }),+ noShow: publicProcedure.input(ZNoShowInputSchema).mutation(async (opts) => {+ const handler = await importHandler(namespaced("noShow"), () => import("./noShow.handler"));+ return handler(opts);+ }),samlTenantProduct: publicProcedure.input(ZSamlTenantProductInputSchema).mutation(async (opts) => {const handler = await importHandler(namespaced("samlTenantProduct"),diff --git a/packages/trpc/server/routers/publicViewer/noShow.handler.ts b/packages/trpc/server/routers/publicViewer/noShow.handler.tsnew file mode 100644index 00000000000..d6585b34333--- /dev/null+++ b/packages/trpc/server/routers/publicViewer/noShow.handler.ts@@ -0,0 +1,21 @@+import { prisma } from "@calcom/prisma";++import type { TNoShowInputSchema } from "./noShow.schema";++type NoShowOptions = {+ input: TNoShowInputSchema;+};++export const noShowHandler = async ({ input }: NoShowOptions) => {+ const { bookingUid } = input;+ await prisma.booking.update({+ where: {+ uid: bookingUid,+ },+ data: {+ noShowHost: true,+ },+ });+};++export default noShowHandler;diff --git a/packages/trpc/server/routers/publicViewer/noShow.schema.ts b/packages/trpc/server/routers/publicViewer/noShow.schema.tsnew file mode 100644index 00000000000..56e59d0f1fc--- /dev/null+++ b/packages/trpc/server/routers/publicViewer/noShow.schema.ts@@ -0,0 +1,7 @@+import { z } from "zod";++export const ZNoShowInputSchema = z.object({+ bookingUid: z.string(),+});++export type TNoShowInputSchema = z.infer<typeof ZNoShowInputSchema>;diff --git a/packages/trpc/server/routers/publicViewer/submitRating.handler.ts b/packages/trpc/server/routers/publicViewer/submitRating.handler.tsnew file mode 100644index 00000000000..a210b804aa4--- /dev/null+++ b/packages/trpc/server/routers/publicViewer/submitRating.handler.ts@@ -0,0 +1,22 @@+import { prisma } from "@calcom/prisma";++import type { TSubmitRatingInputSchema } from "./submitRating.schema";++type SubmitRatingOptions = {+ input: TSubmitRatingInputSchema;+};++export const submitRatingHandler = async ({ input }: SubmitRatingOptions) => {+ const { bookingUid, rating, comment } = input;+ await prisma.booking.update({+ where: {+ uid: bookingUid,+ },+ data: {+ rating: rating,+ ratingFeedback: comment,+ },+ });+};++export default submitRatingHandler;diff --git a/packages/trpc/server/routers/publicViewer/submitRating.schema.ts b/packages/trpc/server/routers/publicViewer/submitRating.schema.tsnew file mode 100644index 00000000000..cb163c8646f--- /dev/null+++ b/packages/trpc/server/routers/publicViewer/submitRating.schema.ts@@ -0,0 +1,9 @@+import { z } from "zod";++export const ZSubmitRatingInputSchema = z.object({+ bookingUid: z.string(),+ rating: z.number(),+ comment: z.string().optional(),+});++export type TSubmitRatingInputSchema = z.infer<typeof ZSubmitRatingInputSchema>;diff --git a/packages/ui/components/empty-screen/EmptyScreen.tsx b/packages/ui/components/empty-screen/EmptyScreen.tsxindex 3537be1b029..c562e9ee0bc 100644--- a/packages/ui/components/empty-screen/EmptyScreen.tsx+++ b/packages/ui/components/empty-screen/EmptyScreen.tsx@@ -18,6 +18,8 @@ export function EmptyScreen({border = true,dashedBorder = true,className,+ iconClassName,+ iconWrapperClassName,}: {Icon?: IconName;avatar?: React.ReactElement;@@ -28,6 +30,8 @@ export function EmptyScreen({buttonRaw?: ReactNode; // Used incase you want to provide your own button.border?: boolean;dashedBorder?: boolean;+ iconWrapperClassName?: string;+ iconClassName?: string;} & React.HTMLAttributes<HTMLDivElement>) {return (<>@@ -42,9 +46,17 @@ export function EmptyScreen({{!avatar ? null : (<div className="flex h-[72px] w-[72px] items-center justify-center rounded-full">{avatar}</div>)}+{!icon ? null : (- <div className="bg-emphasis flex h-[72px] w-[72px] items-center justify-center rounded-full ">- <Icon name={icon} className="text-default inline-block h-10 w-10 stroke-[1.3px]" />+ <div+ className={classNames(+ "bg-emphasis flex h-[72px] w-[72px] items-center justify-center rounded-full ",+ iconWrapperClassName+ )}>+ <Icon+ name={icon}+ className={classNames("text-default inline-block h-10 w-10 stroke-[1.3px]", iconClassName)}+ /></div>)}<div className="flex max-w-[420px] flex-col items-center">