If logged in, open file. Else open pop up - Please help

I am trying to code a page on my site so that if a user is not logged in and they click on a text element, a pop up appears, pushing them towards the sales page.

If the user is logged in, when they click on the element, the page opens the document saved in the content manager.

I have identical code for each text item but only one works. The links were generated by using the copy url function in the content manager.
Is anyone able to explain where I am going wrong?

Here is the code:

import wixUsers from “wix-users” ;
import wixWindow from ‘wix-window’ ;
import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {

});

export function ForcesandNewtonslaws_click ( event ) {

if  ( wixUsers.currentUser.loggedIn ) { 

    wixLocation . to ( "https://355eb508-bb55-4840-a02f-ed73b18f90d7.filesusr.com/ugd/4475bb_b321a02d82af4bb9bcaadb50429403ce.pdf" ); 
    
}  **else**  { 
    wixWindow . openLightbox ( "popup" ); 

} 

}

export function MotionGraphs_click ( event ) {

if  ( wixUsers.currentUser.loggedIn ) { 

    wixLocation . to ( "https://4475bb58-2e88-4928-8a17-c6e18f0e87d7.usrfiles.com/ugd/4475bb_b321a02d82af4bb9bcaadb50429403ce.pdf" ); 
    
}  **else**  { 
    wixWindow . openLightbox ( "popup" ); 

} 

}

Don’t use WixUsers-API.
Instead use the new → WixMembers-API…

https://www.wix.com/velo/reference/wix-members
https://www.wix.com/velo/reference/wix-members-backend