Scheduling infrastructure for absolutely everyone.
feat: Add google spam warning on booking confirmation page for gmail users ( CALCOM-9247) (#9531)
GitStart-Cal.com0c06f1f6cb8c
diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsxindex b7d5c331a06..0bef2cc3fc8 100644--- a/apps/web/pages/booking/[uid].tsx+++ b/apps/web/pages/booking/[uid].tsx@@ -49,8 +49,9 @@ import type { Prisma } from "@calcom/prisma/client";import { BookingStatus } from "@calcom/prisma/enums";import { bookingMetadataSchema } from "@calcom/prisma/zod-utils";import { customInputSchema, EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";-import { Button, EmailInput, HeadSeo, Badge, useCalcomTheme } from "@calcom/ui";+import { Button, EmailInput, HeadSeo, Badge, useCalcomTheme, Alert } from "@calcom/ui";import { X, ExternalLink, ChevronLeft, Check, Calendar } from "@calcom/ui/components/icon";+import { AlertCircle } from "@calcom/ui/components/icon";import { timeZone } from "@lib/clock";import type { inferSSRProps } from "@lib/types/inferSSRProps";@@ -127,6 +128,10 @@ export default function Success(props: SuccessProps) {? props?.bookingInfo?.attendees?.[0]?.name: "Nameless";+ const attendees = props?.bookingInfo?.attendees;++ const isGmail = !!attendees.find((attendee) => attendee.email.includes("gmail.com"));+const [is24h, setIs24h] = useState(isBrowserLocale24h());const { data: session } = useSession();@@ -705,6 +710,26 @@ export default function Success(props: SuccessProps) {</>)}</div>+ {isGmail && (+ <Alert+ className="main -mb-20 mt-4 inline-block text-left sm:-mt-4 sm:mb-4 sm:w-full sm:max-w-xl sm:align-middle"+ severity="warning"+ message={+ <div>+ <p className="font-semibold">{t("google_new_spam_policy")}</p>+ <span className="underline">+ <a+ target="_blank"+ href="https://cal.com/blog/google-s-new-spam-policy-may-be-affecting-your-invitations">+ {t("resolve")}+ </a>+ </span>+ </div>+ }+ CustomIcon={AlertCircle}+ customIconColor="text-attention dark:text-orange-200"+ />+ )}</div></div></div>diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 39cb7409111..40996021b56 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1896,6 +1896,8 @@"my_profile": "My Profile","my_settings": "My Settings","sender_id_info": "Name or number shown as the sender of an SMS (some countries do not allow alphanumeric sender IDs)",+ "google_new_spam_policy": "Google’s new spam policy could prevent you from receiving any email and calendar notifications about this booking.",+ "resolve": "Resolve","no_organization_slug": "There was an error creating teams for this organization. Missing URL slug.","org_name": "Organization name","org_url": "Organization URL",diff --git a/packages/ui/components/alert/Alert.tsx b/packages/ui/components/alert/Alert.tsxindex 04efec5dfd4..4b040aa3033 100644--- a/packages/ui/components/alert/Alert.tsx+++ b/packages/ui/components/alert/Alert.tsx@@ -16,9 +16,10 @@ export interface AlertProps {// @TODO: Success and info shouldn't exist as per design?severity: "success" | "warning" | "error" | "info" | "neutral";CustomIcon?: IconType;+ customIconColor?: string;}export const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {- const { severity, iconClassName, CustomIcon } = props;+ const { severity, iconClassName, CustomIcon, customIconColor } = props;return (<div@@ -35,7 +36,10 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>((props, ref) => {<div className="relative flex md:flex-row">{CustomIcon ? (<div className="flex-shrink-0">- <CustomIcon aria-hidden="true" className={classNames("text-default h-5 w-5", iconClassName)} />+ <CustomIcon+ aria-hidden="true"+ className={classNames(`h-5 w-5`, iconClassName, customIconColor ?? "text-default")}+ /></div>) : (<div className="flex-shrink-0">