Skip to content

Commit

Permalink
fix(segmentation): account for unauthenticated ras state
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenn00dle committed Nov 4, 2024
1 parent 7fc45ea commit b1db534
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/criteria/default/user-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
} );

0 comments on commit b1db534

Please sign in to comment.