@dynamic-labs/utils 0.19.1 → 0.19.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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,22 @@
1
1
 
2
+ ### [0.19.2](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.1...v0.19.2) (2023-11-17)
3
+
4
+
5
+ ### Features
6
+
7
+ * feat: add support for forced network validation via DynamicContext setting ([#3907](https://github.com/dynamic-labs/DynamicAuth/issues/3907)) ([87e31e4](https://github.com/dynamic-labs/DynamicAuth/commit/87e31e40b0874eb344fa161defdfb36819d9019b)), closes [#3879](https://github.com/dynamic-labs/DynamicAuth/issues/3879)
8
+ * feat: add help section to sign message modal ([4e0a0c4](https://github.com/dynamic-labs/DynamicAuth/commit/4e0a0c4cde73f802bfcaa99351d295060244382f))
9
+
10
+ ### Bug Fixes
11
+
12
+ * fix(embedded wallets): allow switching primary wallet ([#3796](https://github.com/dynamic-labs/DynamicAuth/issues/3796)) ([#3797](https://github.com/dynamic-labs/DynamicAuth/issues/3797)) ([a01af71](https://github.com/dynamic-labs/DynamicAuth/commit/a01af71ce0c79a791c4c4bb7d3f3d41bd7fe8edf))
13
+ * fix(embedded wallets): improve logic to check for enabled providers ([5189b96](https://github.com/dynamic-labs/DynamicAuth/commit/5189b96d8fa82e656c916cad130619be6e3b7afd))
14
+ * fix(single wallet): improve account switching UX ([#3742](https://github.com/dynamic-labs/DynamicAuth/issues/3742)) ([#3856](https://github.com/dynamic-labs/DynamicAuth/issues/3856)) ([1efffab](https://github.com/dynamic-labs/DynamicAuth/commit/1efffabf4a668f266564ecaa4405f3fb063bbf38))
15
+ * fix(wagmi): ensure chain is defined on wallet client ([#3888](https://github.com/dynamic-labs/DynamicAuth/issues/3888)) ([#3897](https://github.com/dynamic-labs/DynamicAuth/issues/3897)) ([3ee4885](https://github.com/dynamic-labs/DynamicAuth/commit/3ee4885b129ee619bc82ce09e39a3d5934afd734))
16
+ * fix(ui): remove the coming soon label ([#3876](https://github.com/dynamic-labs/DynamicAuth/issues/3876)) ([298f777](https://github.com/dynamic-labs/DynamicAuth/commit/298f777e4c5923075856e8b47c792c1951615c0e)), closes [#3860](https://github.com/dynamic-labs/DynamicAuth/issues/3860)
17
+ * fix(ssr): add window null check to utils ([#3882](https://github.com/dynamic-labs/DynamicAuth/issues/3882)) ([#3885](https://github.com/dynamic-labs/DynamicAuth/issues/3885)) ([bc8b8e3](https://github.com/dynamic-labs/DynamicAuth/commit/bc8b8e386fd82d9ca6b53deaa3aa852d6ebdafdc))
18
+ * fix(callbacks): pass correct wallet connector onLinkSuccess ([#3904](https://github.com/dynamic-labs/DynamicAuth/issues/3904)) ([#3908](https://github.com/dynamic-labs/DynamicAuth/issues/3908)) ([f05f5f8](https://github.com/dynamic-labs/DynamicAuth/commit/f05f5f8f336c42e24a7422959ba06002aba8be02))
19
+
2
20
  ### [0.19.1](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0...v0.19.1) (2023-11-03)
3
21
 
4
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -29,7 +29,7 @@
29
29
  "viem": "^1.5.3"
30
30
  },
31
31
  "dependencies": {
32
- "@dynamic-labs/logger": "0.19.1",
33
- "@dynamic-labs/types": "0.19.1"
32
+ "@dynamic-labs/logger": "0.19.2",
33
+ "@dynamic-labs/types": "0.19.2"
34
34
  }
35
35
  }
package/src/isMobile.cjs CHANGED
@@ -47,7 +47,9 @@ const isAndroid = () => isMobile() && !isIOS();
47
47
  const isLegacySafari = () => {
48
48
  // We need to check if window.CSS exists and if it has supports function.
49
49
  // We can use it only in browsers. This prevents customer tests from failing because of that.
50
- if (!window.CSS || typeof window.CSS.supports !== 'function') {
50
+ if (typeof window === 'undefined' ||
51
+ !window.CSS ||
52
+ typeof window.CSS.supports !== 'function') {
51
53
  return false;
52
54
  }
53
55
  // Older versions of Safari <15 are not supporting aspect-ratio css property.
@@ -62,7 +64,12 @@ const isSamsungBrowser = () => {
62
64
  }
63
65
  return navigator.userAgent.includes('SamsungBrowser');
64
66
  };
65
- const isWindows = () => window.navigator.userAgent.indexOf('Windows') !== -1;
67
+ const isWindows = () => {
68
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
69
+ return false;
70
+ }
71
+ return navigator.userAgent.indexOf('Windows') !== -1;
72
+ };
66
73
  // regex from: https://github.com/matomo-org/device-detector/blob/master/regexes/device/mobiles.yml
67
74
  const iPhoneLegacyRegex = [
68
75
  {
@@ -115,6 +122,9 @@ const iPhoneLegacyRegex = [
115
122
  },
116
123
  ];
117
124
  const getAndroidVersion = () => {
125
+ if (typeof navigator === 'undefined') {
126
+ return;
127
+ }
118
128
  const androidVersionMatch = navigator.userAgent.match(/Android (\d+(\.\d+)?)/);
119
129
  if (!androidVersionMatch) {
120
130
  return;
package/src/isMobile.js CHANGED
@@ -43,7 +43,9 @@ const isAndroid = () => isMobile() && !isIOS();
43
43
  const isLegacySafari = () => {
44
44
  // We need to check if window.CSS exists and if it has supports function.
45
45
  // We can use it only in browsers. This prevents customer tests from failing because of that.
46
- if (!window.CSS || typeof window.CSS.supports !== 'function') {
46
+ if (typeof window === 'undefined' ||
47
+ !window.CSS ||
48
+ typeof window.CSS.supports !== 'function') {
47
49
  return false;
48
50
  }
49
51
  // Older versions of Safari <15 are not supporting aspect-ratio css property.
@@ -58,7 +60,12 @@ const isSamsungBrowser = () => {
58
60
  }
59
61
  return navigator.userAgent.includes('SamsungBrowser');
60
62
  };
61
- const isWindows = () => window.navigator.userAgent.indexOf('Windows') !== -1;
63
+ const isWindows = () => {
64
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
65
+ return false;
66
+ }
67
+ return navigator.userAgent.indexOf('Windows') !== -1;
68
+ };
62
69
  // regex from: https://github.com/matomo-org/device-detector/blob/master/regexes/device/mobiles.yml
63
70
  const iPhoneLegacyRegex = [
64
71
  {
@@ -111,6 +118,9 @@ const iPhoneLegacyRegex = [
111
118
  },
112
119
  ];
113
120
  const getAndroidVersion = () => {
121
+ if (typeof navigator === 'undefined') {
122
+ return;
123
+ }
114
124
  const androidVersionMatch = navigator.userAgent.match(/Android (\d+(\.\d+)?)/);
115
125
  if (!androidVersionMatch) {
116
126
  return;