glitch-javascript-sdk 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.
package/dist/cjs/index.js CHANGED
@@ -15839,7 +15839,11 @@ var Storage = /** @class */ (function () {
15839
15839
  window.sessionStorage.setItem(Storage.getStorageKey(key), serializedValue);
15840
15840
  }
15841
15841
  catch (e) {
15842
- this.setCookie(key, value, 31);
15842
+ try {
15843
+ this.setCookie(key, value, 31);
15844
+ }
15845
+ catch (e) {
15846
+ }
15843
15847
  Storage.data[key] = value;
15844
15848
  }
15845
15849
  }
@@ -15859,7 +15863,12 @@ var Storage = /** @class */ (function () {
15859
15863
  }
15860
15864
  }
15861
15865
  catch (e) {
15862
- var value = Storage.getCookie(key);
15866
+ var value = null;
15867
+ try {
15868
+ value = Storage.getCookie(key);
15869
+ }
15870
+ catch (e) {
15871
+ }
15863
15872
  if (!value) {
15864
15873
  value = Storage.data[key];
15865
15874
  }
@@ -15874,9 +15883,11 @@ var Storage = /** @class */ (function () {
15874
15883
  return Storage.get('glitch_auth_token');
15875
15884
  };
15876
15885
  Storage.eraseCookie = function (name) {
15877
- document.cookie =
15878
- name +
15879
- '=; Secure; HttpOnly=false; SameSite=none; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
15886
+ if (document) {
15887
+ document.cookie =
15888
+ name +
15889
+ '=; Secure; HttpOnly=false; SameSite=none; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
15890
+ }
15880
15891
  };
15881
15892
  Storage.setCookie = function (name, value, days) {
15882
15893
  var expires = '';
@@ -15885,24 +15896,28 @@ var Storage = /** @class */ (function () {
15885
15896
  date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
15886
15897
  expires = '; expires=' + date.toUTCString();
15887
15898
  }
15888
- document.cookie =
15889
- name +
15890
- '=' +
15891
- (value || '') +
15892
- expires +
15893
- '; path=/; domain=' +
15894
- Storage.rootDomain +
15895
- '; HttpOnly=false; SameSite=none; Secure';
15899
+ if (document) {
15900
+ document.cookie =
15901
+ name +
15902
+ '=' +
15903
+ (value || '') +
15904
+ expires +
15905
+ '; path=/; domain=' +
15906
+ Storage.rootDomain +
15907
+ '; HttpOnly=false; SameSite=none; Secure';
15908
+ }
15896
15909
  };
15897
15910
  Storage.getCookie = function (name) {
15898
- var nameEQ = name + '=';
15899
- var ca = document.cookie.split(';');
15900
- for (var i = 0; i < ca.length; i++) {
15901
- var c = ca[i];
15902
- while (c.charAt(0) == ' ')
15903
- c = c.substring(1, c.length);
15904
- if (c.indexOf(nameEQ) == 0)
15905
- return c.substring(nameEQ.length, c.length);
15911
+ if (document) {
15912
+ var nameEQ = name + '=';
15913
+ var ca = document.cookie.split(';');
15914
+ for (var i = 0; i < ca.length; i++) {
15915
+ var c = ca[i];
15916
+ while (c.charAt(0) == ' ')
15917
+ c = c.substring(1, c.length);
15918
+ if (c.indexOf(nameEQ) == 0)
15919
+ return c.substring(nameEQ.length, c.length);
15920
+ }
15906
15921
  }
15907
15922
  return null;
15908
15923
  };