From 0c06f1f6cb8cde3463a2ad384e74c4fd7921e9eb Mon Sep 17 00:00:00 2001 From: "GitStart-Cal.com" <121884634+gitstart-calcom@users.noreply.github.com> Date: Sat, 24 Jun 2023 01:13:16 +0800 Subject: [PATCH] feat: Add google spam warning on booking confirmation page for gmail users ( CALCOM-9247) (#9531) * feat: Add google spam warning on booking confirmation page for gmail users * Update apps/web/pages/booking/[uid].tsx Co-authored-by: alannnc --------- Co-authored-by: gitstart-calcom Co-authored-by: Peer Richelsen Co-authored-by: alannnc --- apps/web/pages/booking/[uid].tsx | 27 ++++++++++++++++++- apps/web/public/static/locales/en/common.json | 2 ++ packages/ui/components/alert/Alert.tsx | 8 ++++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx index b7d5c331a0..0bef2cc3fc 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) { )} + {isGmail && ( + +

{t("google_new_spam_policy")}

+ + + {t("resolve")} + + + + } + CustomIcon={AlertCircle} + customIconColor="text-attention dark:text-orange-200" + /> + )} diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 39cb740911..40996021b5 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.tsx index 04efec5dfd..4b040aa303 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((props, ref) => { - const { severity, iconClassName, CustomIcon } = props; + const { severity, iconClassName, CustomIcon, customIconColor } = props; return (
((props, ref) => {
{CustomIcon ? (
-
) : (