From b1db534fbab7031fbe5a39389c9eefec2558778b Mon Sep 17 00:00:00 2001 From: Rasmy Nguyen Date: Mon, 4 Nov 2024 17:05:52 -0500 Subject: [PATCH] fix(segmentation): account for unauthenticated ras state --- src/criteria/default/user-account.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 ); } } );