@@ -64,6 +64,50 @@ const UPDATED_PRIVACY_POLICY = (updateUser: (user: Partial<UserProtocol>) => Pro
64
64
} as Notification ;
65
65
} ;
66
66
67
+ const GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY = "gitpod_flex_introduction" ;
68
+ const GITPOD_FLEX_INTRODUCTION = ( updateUser : ( user : Partial < UserProtocol > ) => Promise < User > ) => {
69
+ return {
70
+ id : GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY ,
71
+ type : "info" ,
72
+ preventDismiss : true ,
73
+ onClose : async ( ) => {
74
+ let dismissSuccess = false ;
75
+ try {
76
+ const updatedUser = await updateUser ( {
77
+ additionalData : {
78
+ profile : {
79
+ coachmarksDismissals : {
80
+ [ GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY ] : new Date ( ) . toISOString ( ) ,
81
+ } ,
82
+ } ,
83
+ } ,
84
+ } ) ;
85
+ dismissSuccess = ! ! updatedUser ;
86
+ } catch ( err ) {
87
+ dismissSuccess = false ;
88
+ } finally {
89
+ trackEvent ( "coachmark_dismissed" , {
90
+ name : "gitpod-flex-introduction" ,
91
+ success : dismissSuccess ,
92
+ } ) ;
93
+ }
94
+ } ,
95
+ message : (
96
+ < span className = "text-md" >
97
+ < b > Introducing Gitpod Flex:</ b > self-host for free in 3 min or run locally using Gitpod Desktop |{ " " }
98
+ < a
99
+ className = "text-kumquat-ripe font-bold"
100
+ href = "https://app.gitpod.io"
101
+ target = "_blank"
102
+ rel = "noreferrer"
103
+ >
104
+ Try now
105
+ </ a >
106
+ </ span >
107
+ ) ,
108
+ } as Notification ;
109
+ } ;
110
+
67
111
const INVALID_BILLING_ADDRESS = ( stripePortalUrl : string | undefined ) => {
68
112
return {
69
113
id : "invalid-billing-address" ,
@@ -115,6 +159,10 @@ export function AppNotifications() {
115
159
notifications . push ( notification ) ;
116
160
}
117
161
}
162
+
163
+ if ( isGitpodIo ( ) && ! user ?. profile ?. coachmarksDismissals [ GITPOD_FLEX_INTRODUCTION_COACHMARK_KEY ] ) {
164
+ notifications . push ( GITPOD_FLEX_INTRODUCTION ( ( u : Partial < UserProtocol > ) => mutateAsync ( u ) ) ) ;
165
+ }
118
166
}
119
167
120
168
if ( ! ignore ) {
0 commit comments