I am trying to integrate the Wax Cloud Wallet into my site. https://developer.wax.io/waa/use-waxjs/
I’ve installed the NPM and followed all the instructions. I am getting the following error: “window is not defined”
When I call Wax’s login() it should pop open a new window and allow my user to sign into their wallet. I read that Wix may be preventing access to the window object so the code never goes through. I also read you can add custom code for 3rd party code. I have no clue where and what to add. The Wax GitHub has this sample html file that might help figure this out.
Here’s my code:
import * as waxjs from “@waxio/waxjs/dist” ;
const wax = new waxjs . WaxJS ( ‘https://wax.greymass.com’ , null , null , false );
$w . onReady ( function () {
login ();
});
//Normal login. Triggers a popup for non-whitelisted dapps
async function login () {
try {
const userAccount = await wax . login ();
console . log ( userAccount );
} catch ( e ) { console . log ( e . message );
}
}