@tramvai/module-client-hints 5.10.0 → 5.14.9
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.
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { parse, parseClientHintsUserAgentData } from '@tinkoff/user-agent';
|
|
2
2
|
|
|
3
3
|
const getFromUserAgentData = () => {
|
|
4
|
-
var _a;
|
|
5
4
|
try {
|
|
6
5
|
// eslint-disable-next-line compat/compat
|
|
7
|
-
const values =
|
|
6
|
+
const values = window.__TRAMVAI_USER_AGENT_DATA ?? window.navigator.userAgentData;
|
|
8
7
|
if (values === undefined) {
|
|
9
8
|
return null;
|
|
10
9
|
}
|
|
@@ -22,7 +21,7 @@ const getFromUserAgentData = () => {
|
|
|
22
21
|
};
|
|
23
22
|
function loadUserAgent() {
|
|
24
23
|
const fromUserAgentData = getFromUserAgentData();
|
|
25
|
-
return fromUserAgentData
|
|
24
|
+
return fromUserAgentData ?? parse(navigator.userAgent);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export { loadUserAgent };
|
|
@@ -29,8 +29,7 @@ const SUPPOSED_MEDIA = {
|
|
|
29
29
|
};
|
|
30
30
|
const readMediaCommand = ({ context, cookieManager, }) => {
|
|
31
31
|
return function readMedia() {
|
|
32
|
-
|
|
33
|
-
const mediaInfo = safeParseJSON((_a = cookieManager.get(COOKIE_NAME_MEDIA_INFO)) !== null && _a !== void 0 ? _a : '');
|
|
32
|
+
const mediaInfo = safeParseJSON(cookieManager.get(COOKIE_NAME_MEDIA_INFO) ?? '');
|
|
34
33
|
if (mediaInfo) {
|
|
35
34
|
return context.dispatch(setMedia({
|
|
36
35
|
...mediaInfo,
|
package/lib/server/readMedia.js
CHANGED
|
@@ -37,8 +37,7 @@ const SUPPOSED_MEDIA = {
|
|
|
37
37
|
};
|
|
38
38
|
const readMediaCommand = ({ context, cookieManager, }) => {
|
|
39
39
|
return function readMedia() {
|
|
40
|
-
|
|
41
|
-
const mediaInfo = safeStrings.safeParseJSON((_a = cookieManager.get(constants.COOKIE_NAME_MEDIA_INFO)) !== null && _a !== void 0 ? _a : '');
|
|
40
|
+
const mediaInfo = safeStrings.safeParseJSON(cookieManager.get(constants.COOKIE_NAME_MEDIA_INFO) ?? '');
|
|
42
41
|
if (mediaInfo) {
|
|
43
42
|
return context.dispatch(media.setMedia({
|
|
44
43
|
...mediaInfo,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-client-hints",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.14.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/server.js",
|
|
6
6
|
"module": "lib/server.es.js",
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
"watch": "tsc -w"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tinkoff/user-agent": "0.7.
|
|
22
|
+
"@tinkoff/user-agent": "0.7.46",
|
|
23
23
|
"@tinkoff/utils": "^2.1.2",
|
|
24
24
|
"@tinkoff/env-validators": "0.4.2",
|
|
25
|
-
"@tramvai/safe-strings": "0.8.
|
|
26
|
-
"@tramvai/module-metrics": "5.
|
|
27
|
-
"@tramvai/tokens-child-app": "5.
|
|
28
|
-
"@tramvai/tokens-common": "5.
|
|
29
|
-
"@tramvai/tokens-cookie": "5.
|
|
30
|
-
"@tramvai/tokens-render": "5.
|
|
25
|
+
"@tramvai/safe-strings": "0.8.4",
|
|
26
|
+
"@tramvai/module-metrics": "5.14.9",
|
|
27
|
+
"@tramvai/tokens-child-app": "5.14.9",
|
|
28
|
+
"@tramvai/tokens-common": "5.14.9",
|
|
29
|
+
"@tramvai/tokens-cookie": "5.14.9",
|
|
30
|
+
"@tramvai/tokens-render": "5.14.9",
|
|
31
31
|
"user-agent-data-types": "^0.3.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@tinkoff/dippy": "0.11.3",
|
|
35
|
-
"@tinkoff/logger": "0.10.
|
|
36
|
-
"@tramvai/core": "5.
|
|
37
|
-
"@tramvai/state": "5.
|
|
35
|
+
"@tinkoff/logger": "0.10.505",
|
|
36
|
+
"@tramvai/core": "5.14.9",
|
|
37
|
+
"@tramvai/state": "5.14.9",
|
|
38
38
|
"react": ">=16.14.0",
|
|
39
39
|
"react-dom": ">=16.14.0",
|
|
40
40
|
"tslib": "^2.4.0"
|