@@ -42,6 +42,7 @@ export const initializeNewUser = async ({
4242 }
4343
4444 actions . internal . showUserSurveyIfNeeded ( ) ;
45+ actions . internal . showUpdatedToSIfNeeded ( ) ;
4546 await effects . live . getSocket ( ) ;
4647 actions . userNotifications . internal . initialize ( ) ;
4748 actions . internal . setStoredSettings ( ) ;
@@ -146,6 +147,41 @@ export const showUserSurveyIfNeeded = ({
146147 }
147148} ;
148149
150+ export const showUpdatedToSIfNeeded = ( { state, effects } : Context ) => {
151+ const registrationDate = state . user ?. insertedAt
152+ ? new Date ( state . user . insertedAt )
153+ : new Date ( ) ;
154+
155+ if ( registrationDate >= new Date ( '2024-03-10' ) ) {
156+ // This means that the user has registered before we updated the ToS, and we need to notify
157+ // them that the ToS has changed.
158+ return ;
159+ }
160+
161+ const hasShownToS = effects . browser . storage . get ( 'TOS_1_SHOWN' ) ;
162+ if ( hasShownToS ) {
163+ return ;
164+ }
165+
166+ effects . browser . storage . set ( 'TOS_1_SHOWN' , true ) ;
167+
168+ effects . notificationToast . add ( {
169+ title : 'Terms of Service Updated' ,
170+ message : "We've updated our Terms of Service." ,
171+ status : NotificationStatus . NOTICE ,
172+ sticky : true ,
173+
174+ actions : {
175+ primary : {
176+ label : 'Open Terms of Service' ,
177+ run : ( ) => {
178+ window . open ( 'https://codesandbox.io/legal/terms' , '_blank' ) ;
179+ } ,
180+ } ,
181+ } ,
182+ } ) ;
183+ } ;
184+
149185/**
150186 * @deprecated
151187 */
0 commit comments