@zzish/sdk-js 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/zzish.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzish/sdk-js",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "SDK for Zzish API",
5
5
  "main": "zzish.js",
6
6
  "files": [
package/zzish.js CHANGED
@@ -1995,7 +1995,15 @@
1995
1995
  err = resp.responseText;
1996
1996
  }
1997
1997
  if (log) console.log("Proxy.response callback", err, res);
1998
- if (err && window._LTracker) window._LTracker.push({ location: window.location.href, err });
1998
+ // Loggly hook browser-only. Guarded with `typeof window` so the SDK
1999
+ // can be loaded inside a Node.js server (spitafields, quizalize,
2000
+ // quiz-player's SSR shim) without throwing a ReferenceError on the
2001
+ // raw `window` access. `typeof` on an undeclared identifier returns
2002
+ // "undefined" instead of throwing, which `window !== "undefined"`
2003
+ // would not.
2004
+ if (err && typeof window !== "undefined" && window._LTracker) {
2005
+ window._LTracker.push({ location: window.location.href, err });
2006
+ }
1999
2007
  if (typeof callback === "function") {
2000
2008
  callback(err, res);
2001
2009
  }