@@ -131,6 +131,61 @@ const INVALID_BILLING_ADDRESS = (stripePortalUrl: string | undefined) => {
131131 } as Notification ;
132132} ;
133133
134+ const GENERAL_NOTIFICATION = (
135+ id : string ,
136+ message : JSX . Element ,
137+ updateUser : ( user : Partial < UserProtocol > ) => Promise < User > ,
138+ eventName : string = "general_notification" ,
139+ ) => {
140+ return {
141+ id,
142+ type : "info" ,
143+ preventDismiss : true ,
144+ onClose : async ( ) => {
145+ let dismissSuccess = false ;
146+ try {
147+ const updatedUser = await updateUser ( {
148+ additionalData : {
149+ profile : {
150+ coachmarksDismissals : {
151+ [ id ] : new Date ( ) . toISOString ( ) ,
152+ } ,
153+ } ,
154+ } ,
155+ } ) ;
156+ dismissSuccess = ! ! updatedUser ;
157+ } catch ( err ) {
158+ dismissSuccess = false ;
159+ } finally {
160+ trackEvent ( "coachmark_dismissed" , {
161+ name : eventName ,
162+ success : dismissSuccess ,
163+ } ) ;
164+ }
165+ } ,
166+ message,
167+ } as Notification ;
168+ } ;
169+
170+ const AWS_REINVENT_NOTIFICATION = ( updateUser : ( user : Partial < UserProtocol > ) => Promise < User > ) => {
171+ return GENERAL_NOTIFICATION (
172+ "aws_reinvent_2024" ,
173+ < span className = "text-md" >
174+ < b > AWS re:Invent:</ b > Book a demo during re:Invent or join our exclusive dinner for Engineering Executives |{ " " }
175+ < a
176+ className = "text-kumquat-ripe font-bold"
177+ href = "https://www.gitpod.io/aws-reinvent-24"
178+ target = "_blank"
179+ rel = "noreferrer"
180+ >
181+ Learn more
182+ </ a >
183+ </ span > ,
184+ updateUser ,
185+ "aws_reinvent_notification" ,
186+ ) ;
187+ } ;
188+
134189export function AppNotifications ( ) {
135190 const [ topNotification , setTopNotification ] = useState < Notification | undefined > ( undefined ) ;
136191 const { user, loading } = useUserLoader ( ) ;
@@ -163,6 +218,10 @@ export function AppNotifications() {
163218 if ( isGitpodIo ( ) && ! user ?. profile ?. coachmarksDismissals [ GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY ] ) {
164219 notifications . push ( GITPOD_FLEX_INTRODUCTION ( ( u : Partial < UserProtocol > ) => mutateAsync ( u ) ) ) ;
165220 }
221+
222+ if ( isGitpodIo ( ) && ! user ?. profile ?. coachmarksDismissals [ "aws_reinvent_2024" ] ) {
223+ notifications . push ( AWS_REINVENT_NOTIFICATION ( ( u : Partial < UserProtocol > ) => mutateAsync ( u ) ) ) ;
224+ }
166225 }
167226
168227 if ( ! ignore ) {
0 commit comments