diff --git a/components/dashboard/src/AppNotifications.tsx b/components/dashboard/src/AppNotifications.tsx index 528fd89e3ed82d..9eb884538d45c9 100644 --- a/components/dashboard/src/AppNotifications.tsx +++ b/components/dashboard/src/AppNotifications.tsx @@ -131,6 +131,61 @@ const INVALID_BILLING_ADDRESS = (stripePortalUrl: string | undefined) => { } as Notification; }; +const GENERAL_NOTIFICATION = ( + id: string, + message: JSX.Element, + updateUser: (user: Partial) => Promise, + eventName: string = "general_notification", +) => { + return { + id, + type: "info", + preventDismiss: true, + onClose: async () => { + let dismissSuccess = false; + try { + const updatedUser = await updateUser({ + additionalData: { + profile: { + coachmarksDismissals: { + [id]: new Date().toISOString(), + }, + }, + }, + }); + dismissSuccess = !!updatedUser; + } catch (err) { + dismissSuccess = false; + } finally { + trackEvent("coachmark_dismissed", { + name: eventName, + success: dismissSuccess, + }); + } + }, + message, + } as Notification; +}; + +const AWS_REINVENT_NOTIFICATION = (updateUser: (user: Partial) => Promise) => { + return GENERAL_NOTIFICATION( + "aws_reinvent_2024", + + See you at re:Invent! Book a demo with us, and join our developer productivity leaders roundtable (limited tickets) |{" "} + + Learn more + + , + updateUser, + "aws_reinvent_notification", + ); +}; + export function AppNotifications() { const [topNotification, setTopNotification] = useState(undefined); const { user, loading } = useUserLoader(); @@ -163,6 +218,10 @@ export function AppNotifications() { if (isGitpodIo() && !user?.profile?.coachmarksDismissals[GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY]) { notifications.push(GITPOD_FLEX_INTRODUCTION((u: Partial) => mutateAsync(u))); } + + if (isGitpodIo() && !user?.profile?.coachmarksDismissals["aws_reinvent_2024"]) { + notifications.push(AWS_REINVENT_NOTIFICATION((u: Partial) => mutateAsync(u))); + } } if (!ignore) {