Trying to integrate the web sdk into a nextjs app but the snippet from the docs already throws syntax errors.

I've also tried integrating with the npm package but when I try to init then I get a window is not defined error even though I'm initializing in a useEffect hook. Any clues as to what's happening?
