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/esm/index.js CHANGED
@@ -30061,7 +30061,11 @@ var Storage = /** @class */ (function () {
30061
30061
  window.sessionStorage.setItem(Storage.getStorageKey(key), serializedValue);
30062
30062
  }
30063
30063
  catch (e) {
30064
- this.setCookie(key, value, 31);
30064
+ try {
30065
+ this.setCookie(key, value, 31);
30066
+ }
30067
+ catch (e) {
30068
+ }
30065
30069
  Storage.data[key] = value;
30066
30070
  }
30067
30071
  }
@@ -30081,7 +30085,12 @@ var Storage = /** @class */ (function () {
30081
30085
  }
30082
30086
  }
30083
30087
  catch (e) {
30084
- var value = Storage.getCookie(key);
30088
+ var value = null;
30089
+ try {
30090
+ value = Storage.getCookie(key);
30091
+ }
30092
+ catch (e) {
30093
+ }
30085
30094
  if (!value) {
30086
30095
  value = Storage.data[key];
30087
30096
  }
@@ -30096,9 +30105,11 @@ var Storage = /** @class */ (function () {
30096
30105
  return Storage.get('glitch_auth_token');
30097
30106
  };
30098
30107
  Storage.eraseCookie = function (name) {
30099
- document.cookie =
30100
- name +
30101
- '=; Secure; HttpOnly=false; SameSite=none; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
30108
+ if (document) {
30109
+ document.cookie =
30110
+ name +
30111
+ '=; Secure; HttpOnly=false; SameSite=none; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
30112
+ }
30102
30113
  };
30103
30114
  Storage.setCookie = function (name, value, days) {
30104
30115
  var expires = '';
@@ -30107,24 +30118,28 @@ var Storage = /** @class */ (function () {
30107
30118
  date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
30108
30119
  expires = '; expires=' + date.toUTCString();
30109
30120
  }
30110
- document.cookie =
30111
- name +
30112
- '=' +
30113
- (value || '') +
30114
- expires +
30115
- '; path=/; domain=' +
30116
- Storage.rootDomain +
30117
- '; HttpOnly=false; SameSite=none; Secure';
30121
+ if (document) {
30122
+ document.cookie =
30123
+ name +
30124
+ '=' +
30125
+ (value || '') +
30126
+ expires +
30127
+ '; path=/; domain=' +
30128
+ Storage.rootDomain +
30129
+ '; HttpOnly=false; SameSite=none; Secure';
30130
+ }
30118
30131
  };
30119
30132
  Storage.getCookie = function (name) {
30120
- var nameEQ = name + '=';
30121
- var ca = document.cookie.split(';');
30122
- for (var i = 0; i < ca.length; i++) {
30123
- var c = ca[i];
30124
- while (c.charAt(0) == ' ')
30125
- c = c.substring(1, c.length);
30126
- if (c.indexOf(nameEQ) == 0)
30127
- return c.substring(nameEQ.length, c.length);
30133
+ if (document) {
30134
+ var nameEQ = name + '=';
30135
+ var ca = document.cookie.split(';');
30136
+ for (var i = 0; i < ca.length; i++) {
30137
+ var c = ca[i];
30138
+ while (c.charAt(0) == ' ')
30139
+ c = c.substring(1, c.length);
30140
+ if (c.indexOf(nameEQ) == 0)
30141
+ return c.substring(nameEQ.length, c.length);
30142
+ }
30128
30143
  }
30129
30144
  return null;
30130
30145
  };