swell-js 4.2.0 → 4.2.2

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.
@@ -10033,7 +10033,7 @@
10033
10033
  }
10034
10034
 
10035
10035
  function isServer() {
10036
- return !(typeof window !== 'undefined' && window && window.document);
10036
+ return !(typeof window !== 'undefined' && window?.document);
10037
10037
  }
10038
10038
 
10039
10039
  function isFunction(func) {
@@ -10406,7 +10406,7 @@
10406
10406
  return undefined;
10407
10407
  }
10408
10408
 
10409
- const matches = document.cookie.match(
10409
+ const matches = window.document.cookie?.match(
10410
10410
  new RegExp(
10411
10411
  '(?:^|; )' + name.replace(/([.$?*|{}()[]\\\/\+^])/g, '\\$1') + '=([^;]*)',
10412
10412
  ),
@@ -15602,7 +15602,7 @@
15602
15602
  };
15603
15603
 
15604
15604
  const api = {
15605
- version: '4.2.0',
15605
+ version: '4.2.2',
15606
15606
  options,
15607
15607
  request,
15608
15608
 
@@ -15751,8 +15751,13 @@
15751
15751
  method: reqMethod,
15752
15752
  headers: reqHeaders,
15753
15753
  body: reqBody,
15754
- credentials: 'include',
15755
- mode: 'cors',
15754
+ // Credentials and mode are only available in the browser
15755
+ ...(!isServer()
15756
+ ? {
15757
+ credentials: 'include',
15758
+ mode: 'cors',
15759
+ }
15760
+ : undefined),
15756
15761
  });
15757
15762
 
15758
15763
  const responseSession = response.headers.get('X-Session');