| 84 | Object.values(recoveryFromReduxActionSources), |
| 85 | ); |
| 86 | function invalidSessionRecovery( |
| 87 | currentReduxState: AppState, |
| 88 | actionCurrentUserInfo: ?CurrentUserInfo, |
| 89 | authActionSource: ?AuthActionSource, |
| 90 | ): boolean { |
| 91 | if ( |
| 92 | !authActionSource || |
| 93 | !actionSourcesCheckedForInvalidSessionRecovery.has(authActionSource) |
| 94 | ) { |
| 95 | return false; |
| 96 | } |
| 97 | invariant( |
| 98 | actionCurrentUserInfo, |
| 99 | 'actionCurrentUserInfo should be passed to invalidSessionRecovery for ' + |
| 100 | `${authActionSource} login`, |
| 101 | ); |
| 102 | if (actionCurrentUserInfo.anonymous) { |
| 103 | // It's not a session recovery if the CurrentUserInfo is anonymous |
| 104 | return false; |
| 105 | } |
| 106 | return ( |
| 107 | !currentReduxState.dataLoaded || |
| 108 | currentReduxState.currentUserInfo?.id !== actionCurrentUserInfo.id |
| 109 | ); |
| 110 | } |
| 111 | |
| 112 | export { |
| 113 | invalidSessionDowngrade, |