@cloud-ru/uikit-product-utils 8.0.1 → 8.0.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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 8.0.2 (2025-12-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-7187:** add SSR safety checks for localStorage and navigator usage ([c2c7561](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/c2c7561c9a2f5e3b1bd897b696b33ea309f39dfa))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 8.0.1 (2025-11-24)
7
18
 
8
19
 
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUserAgentInfo = getUserAgentInfo;
4
4
  const ua_parser_js_1 = require("ua-parser-js");
5
+ const utils_1 = require("@snack-uikit/utils");
5
6
  const DEVICE_TYPE = {
6
7
  Console: 'console',
7
8
  Mobile: 'mobile',
@@ -14,7 +15,7 @@ const DEVICE_TYPE = {
14
15
  const DEVICE_TYPES = Object.values(DEVICE_TYPE);
15
16
  const getDeviceType = (type) => DEVICE_TYPES.find(value => value === type) || DEVICE_TYPE.Desktop;
16
17
  function getUserAgentInfo() {
17
- const parser = new ua_parser_js_1.UAParser(globalThis.navigator.userAgent);
18
+ const parser = new ua_parser_js_1.UAParser((0, utils_1.isBrowser)() ? globalThis.navigator.userAgent : undefined);
18
19
  const device = parser.getDevice();
19
20
  const browser = parser.getBrowser();
20
21
  const os = parser.getOS();
@@ -1,4 +1,5 @@
1
1
  import { UAParser } from 'ua-parser-js';
2
+ import { isBrowser } from '@snack-uikit/utils';
2
3
  const DEVICE_TYPE = {
3
4
  Console: 'console',
4
5
  Mobile: 'mobile',
@@ -11,7 +12,7 @@ const DEVICE_TYPE = {
11
12
  const DEVICE_TYPES = Object.values(DEVICE_TYPE);
12
13
  const getDeviceType = (type) => DEVICE_TYPES.find(value => value === type) || DEVICE_TYPE.Desktop;
13
14
  export function getUserAgentInfo() {
14
- const parser = new UAParser(globalThis.navigator.userAgent);
15
+ const parser = new UAParser(isBrowser() ? globalThis.navigator.userAgent : undefined);
15
16
  const device = parser.getDevice();
16
17
  const browser = parser.getBrowser();
17
18
  const os = parser.getOS();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloud-ru/uikit-product-utils",
3
3
  "title": "Utils",
4
- "version": "8.0.1",
4
+ "version": "8.0.2",
5
5
  "sideEffects": [
6
6
  "*.css",
7
7
  "*.woff",
@@ -84,5 +84,5 @@
84
84
  "optional": true
85
85
  }
86
86
  },
87
- "gitHead": "8968606769e5da46db696dfa70d7ad999564388d"
87
+ "gitHead": "ab61e93fe6f723c522e95a7c5540b3080de6b2de"
88
88
  }
@@ -1,6 +1,6 @@
1
1
  import { UAParser } from 'ua-parser-js';
2
2
 
3
- import { ValueOf } from '@snack-uikit/utils';
3
+ import { isBrowser, ValueOf } from '@snack-uikit/utils';
4
4
 
5
5
  const DEVICE_TYPE = {
6
6
  Console: 'console',
@@ -20,7 +20,7 @@ const getDeviceType = (type: string | undefined): DeviceType =>
20
20
  DEVICE_TYPES.find(value => value === type) || DEVICE_TYPE.Desktop;
21
21
 
22
22
  export function getUserAgentInfo() {
23
- const parser = new UAParser(globalThis.navigator.userAgent);
23
+ const parser = new UAParser(isBrowser() ? globalThis.navigator.userAgent : undefined);
24
24
  const device = parser.getDevice();
25
25
  const browser = parser.getBrowser();
26
26
  const os = parser.getOS();