diff --git a/src/criteria/default/user-account.js b/src/criteria/default/user-account.js index 0a86a190..6aa9f7af 100644 --- a/src/criteria/default/user-account.js +++ b/src/criteria/default/user-account.js @@ -2,10 +2,11 @@ import { setMatchingFunction } from '../utils'; setMatchingFunction( 'user_account', ( config, { store } ) => { + const reader = store?.get?.( 'reader' ); switch ( config.value ) { case 'with-account': - return newspackPopupsCriteria.is_non_preview_user || store.get( 'reader' )?.email; + return newspackPopupsCriteria.is_non_preview_user || ( reader?.email && reader?.authenticated ); case 'without-account': - return ! newspackPopupsCriteria.is_non_preview_user && ! store.get( 'reader' )?.email; + return ! newspackPopupsCriteria.is_non_preview_user && ( ! reader?.email || ! reader?.authenticated ); } } );