@glomex/integration-analytics 1.1499.0 → 1.1499.1
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,15 +1,25 @@
|
|
|
1
1
|
import { PlaybackMode } from '@glomex/integration-web-component';
|
|
2
2
|
import { BaseEventMapper } from '../base-event-mapper.js';
|
|
3
|
+
/**
|
|
4
|
+
* Strip non-printable control characters (e.g. \t, \n, \r) from a string.
|
|
5
|
+
* Keeps only printable characters (space and above).
|
|
6
|
+
*/
|
|
7
|
+
function sanitize(value) {
|
|
8
|
+
return value.replace(
|
|
9
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: intentional — strip control chars from Nielsen metadata
|
|
10
|
+
/[\u0000-\u001F\u007F]/g, '');
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* Transform metadata to Nielsen format
|
|
5
|
-
*
|
|
14
|
+
* Sanitizes control characters and adds 'p{n},' prefix to nol_c{n} values if not already prefixed
|
|
6
15
|
*/
|
|
7
16
|
function transformMetadata(data) {
|
|
8
17
|
return Object.entries(data)
|
|
9
18
|
.filter((entry) => entry[1] !== undefined && entry[1] !== null)
|
|
10
19
|
.reduce((acc, [key, value]) => {
|
|
11
|
-
const
|
|
12
|
-
|
|
20
|
+
const sanitized = sanitize(value);
|
|
21
|
+
const match = !sanitized.match(/^p\d{1,2},/) && key.match(/nol_c(\d+)/);
|
|
22
|
+
acc[key] = match ? `p${match[1]},${sanitized}` : sanitized;
|
|
13
23
|
return acc;
|
|
14
24
|
}, {});
|
|
15
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glomex/integration-analytics",
|
|
3
|
-
"version": "1.1499.
|
|
3
|
+
"version": "1.1499.1",
|
|
4
4
|
"description": "Analytics integrations for the turbo player",
|
|
5
5
|
"documentation": "https://docs.glomex.com",
|
|
6
6
|
"homepage": "https://glomex.com",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@comscore/analytics": "^7.13.2",
|
|
55
|
-
"@glomex/integration-web-component": "1.1499.
|
|
55
|
+
"@glomex/integration-web-component": "1.1499.1",
|
|
56
56
|
"npaw-plugin": "^7.3.18"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
65
|
"license": "MIT",
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "d88df84f3900959b507980a0f0af69def5f1dba7"
|
|
67
67
|
}
|