File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -55,14 +55,19 @@ export function mayWeLoadSurvicateScript() {
5555 * @returns {boolean } True if the user is on an anonymous path, false otherwise
5656 */
5757export function isUserOnAnonymousPaths ( ) {
58- return [
58+ const pathname = window . location . pathname ;
59+ const anonymousPaths = [
5960 '/log-in' ,
6061 '/setup/onboarding/user' ,
6162 '/log-in/lostpassword' ,
6263 '/account/user-social' ,
6364 '/log-in/link' ,
6465 '/log-in/qr' ,
65- ] . includes ( window . location . pathname ) ;
66+ ] ;
67+
68+ return anonymousPaths . some (
69+ ( path ) => pathname === path || pathname . startsWith ( `${ path } /` )
70+ ) ;
6671}
6772
6873export function addSurvicate ( ) {
Original file line number Diff line number Diff line change @@ -137,9 +137,11 @@ describe( 'survicate', () => {
137137 test . each ( [
138138 // Anonymous paths should return true
139139 [ '/log-in' , true ] ,
140- [ '/setup/onboarding/user' , true ] ,
141140 [ '/log-in/lostpassword' , true ] ,
142141 [ '/account/user-social' , true ] ,
142+ [ '/setup/onboarding/user' , true ] ,
143+ [ '/setup/onboarding/user/pt-br' , true ] ,
144+ [ '/log-in/two-factor' , true ] ,
143145 // Non-anonymous paths should return false
144146 [ '/sites' , false ] ,
145147 [ '/home' , false ] ,
You can’t perform that action at this time.
0 commit comments