stormcloud-video-player 0.8.79 → 0.8.81
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/dist/stormcloud-vp.min.js +2 -2
- package/lib/Player.cjs +6 -0
- package/lib/Player.cjs.map +1 -1
- package/lib/Player.d.cts +4 -1
- package/lib/StormcloudPlayer.cjs +1459 -167
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/StormcloudPlayer.d.cts +3 -0
- package/lib/index.cjs +1547 -169
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -0
- package/lib/index.d.ts +89 -3
- package/lib/index.js +1547 -169
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +452 -88
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/AdConfigManager.cjs +1024 -97
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +2 -0
- package/lib/player/AdTimingService.cjs +0 -9
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/AdTimingService.d.cts +1 -0
- package/lib/player/EdgePodRequest.d.cts +1 -0
- package/lib/player/FloorLadder.cjs +3 -0
- package/lib/player/FloorLadder.cjs.map +1 -1
- package/lib/player/FloorLadder.d.cts +1 -0
- package/lib/player/HlsEngine.cjs +7 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +2 -0
- package/lib/player/OptimizedPodRequest.cjs +21 -6
- package/lib/player/OptimizedPodRequest.cjs.map +1 -1
- package/lib/player/OptimizedPodRequest.d.cts +1 -1
- package/lib/player/PlayerControls.d.cts +1 -0
- package/lib/player/Scte35CueManager.d.cts +1 -0
- package/lib/player/Scte35Parser.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +1459 -167
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +19 -1
- package/lib/player/playerTypes.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +1459 -167
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -0
- package/lib/players/index.cjs +1459 -167
- package/lib/players/index.cjs.map +1 -1
- package/lib/props.cjs +6 -0
- package/lib/props.cjs.map +1 -1
- package/lib/props.d.cts +3 -0
- package/lib/sdk/hlsAdPlayer.cjs +32 -3
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -0
- package/lib/sdk/pal.cjs +10 -3
- package/lib/sdk/pal.cjs.map +1 -1
- package/lib/sdk/pal.d.cts +3 -0
- package/lib/types.d.cts +29 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +1547 -169
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +3 -0
- package/lib/utils/__tests__/adSignals.test.cjs +25817 -0
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
- package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
- package/lib/utils/adIdentity.cjs +421 -0
- package/lib/utils/adIdentity.cjs.map +1 -0
- package/lib/utils/adIdentity.d.cts +30 -0
- package/lib/utils/browserCompat.cjs +13 -0
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +2 -1
- package/lib/utils/contentMetadata.cjs +324 -0
- package/lib/utils/contentMetadata.cjs.map +1 -0
- package/lib/utils/contentMetadata.d.cts +51 -0
- package/lib/utils/ctvVastSignals.cjs +250 -181
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/deviceInfo.cjs +698 -0
- package/lib/utils/deviceInfo.cjs.map +1 -0
- package/lib/utils/deviceInfo.d.cts +46 -0
- package/lib/utils/partnerSignals.cjs +294 -0
- package/lib/utils/partnerSignals.cjs.map +1 -0
- package/lib/utils/partnerSignals.d.cts +12 -0
- package/lib/utils/screenActivity.cjs +125 -0
- package/lib/utils/screenActivity.cjs.map +1 -0
- package/lib/utils/screenActivity.d.cts +5 -0
- package/lib/utils/tracking.cjs +406 -56
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +2 -1
- package/lib/utils/vastEnvironmentSignals.cjs +255 -85
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
- package/lib/utils/vastMacros.cjs +58 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else obj[key] = value;
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
function _object_spread(target) {
|
|
14
|
+
for(var i = 1; i < arguments.length; i++){
|
|
15
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
16
|
+
var ownKeys = Object.keys(source);
|
|
17
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
18
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
19
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
ownKeys.forEach(function(key) {
|
|
23
|
+
_define_property(target, key, source[key]);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
function _type_of(obj) {
|
|
29
|
+
"@swc/helpers - typeof";
|
|
30
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
31
|
+
}
|
|
32
|
+
var __defProp = Object.defineProperty;
|
|
33
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
34
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
35
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
36
|
+
var __export = function __export(target, all) {
|
|
37
|
+
for(var name in all)__defProp(target, name, {
|
|
38
|
+
get: all[name],
|
|
39
|
+
enumerable: true
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
43
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
44
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
45
|
+
try {
|
|
46
|
+
var _loop = function() {
|
|
47
|
+
var key = _step.value;
|
|
48
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
49
|
+
get: function get() {
|
|
50
|
+
return from[key];
|
|
51
|
+
},
|
|
52
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
56
|
+
} catch (err) {
|
|
57
|
+
_didIteratorError = true;
|
|
58
|
+
_iteratorError = err;
|
|
59
|
+
} finally{
|
|
60
|
+
try {
|
|
61
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
62
|
+
_iterator.return();
|
|
63
|
+
}
|
|
64
|
+
} finally{
|
|
65
|
+
if (_didIteratorError) {
|
|
66
|
+
throw _iteratorError;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return to;
|
|
72
|
+
};
|
|
73
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
74
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
75
|
+
value: true
|
|
76
|
+
}), mod);
|
|
77
|
+
};
|
|
78
|
+
// src/utils/contentMetadata.ts
|
|
79
|
+
var contentMetadata_exports = {};
|
|
80
|
+
__export(contentMetadata_exports, {
|
|
81
|
+
appendMissingContentParams: function appendMissingContentParams1() {
|
|
82
|
+
return appendMissingContentParams;
|
|
83
|
+
},
|
|
84
|
+
applyContentMetadataUpdate: function applyContentMetadataUpdate1() {
|
|
85
|
+
return applyContentMetadataUpdate;
|
|
86
|
+
},
|
|
87
|
+
normalizeContentDuration: function normalizeContentDuration1() {
|
|
88
|
+
return normalizeContentDuration;
|
|
89
|
+
},
|
|
90
|
+
normalizeContentLanguage: function normalizeContentLanguage1() {
|
|
91
|
+
return normalizeContentLanguage;
|
|
92
|
+
},
|
|
93
|
+
readBridgeValue: function readBridgeValue1() {
|
|
94
|
+
return readBridgeValue;
|
|
95
|
+
},
|
|
96
|
+
resolveContentMetadata: function resolveContentMetadata1() {
|
|
97
|
+
return resolveContentMetadata;
|
|
98
|
+
},
|
|
99
|
+
sanitizeContentValue: function sanitizeContentValue1() {
|
|
100
|
+
return sanitizeContentValue;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
module.exports = __toCommonJS(contentMetadata_exports);
|
|
104
|
+
var MAX_CONTENT_VALUE_LENGTH = 128;
|
|
105
|
+
var BRIDGE_KEYS = {
|
|
106
|
+
channelName: [
|
|
107
|
+
"channelName",
|
|
108
|
+
"ct_ch"
|
|
109
|
+
],
|
|
110
|
+
programTitle: [
|
|
111
|
+
"programTitle",
|
|
112
|
+
"ct_ti"
|
|
113
|
+
],
|
|
114
|
+
contentNetwork: [
|
|
115
|
+
"contentNetwork",
|
|
116
|
+
"ct_ne"
|
|
117
|
+
],
|
|
118
|
+
contentType: [
|
|
119
|
+
"contentType",
|
|
120
|
+
"ctt"
|
|
121
|
+
],
|
|
122
|
+
contentCategory: [
|
|
123
|
+
"contentCategory",
|
|
124
|
+
"ctc"
|
|
125
|
+
],
|
|
126
|
+
contentGenre: [
|
|
127
|
+
"contentGenre",
|
|
128
|
+
"ctgr"
|
|
129
|
+
],
|
|
130
|
+
contentLanguage: [
|
|
131
|
+
"contentLanguage",
|
|
132
|
+
"ctlg"
|
|
133
|
+
],
|
|
134
|
+
contentDuration: [
|
|
135
|
+
"contentDuration",
|
|
136
|
+
"ctd"
|
|
137
|
+
],
|
|
138
|
+
contentSeason: [
|
|
139
|
+
"contentSeason",
|
|
140
|
+
"cts"
|
|
141
|
+
],
|
|
142
|
+
contentEpisode: [
|
|
143
|
+
"contentEpisode",
|
|
144
|
+
"cte"
|
|
145
|
+
],
|
|
146
|
+
contentRating: [
|
|
147
|
+
"contentRating",
|
|
148
|
+
"ctr"
|
|
149
|
+
],
|
|
150
|
+
contentId: [
|
|
151
|
+
"contentId",
|
|
152
|
+
"ctid"
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
function sanitizeContentValue(value) {
|
|
156
|
+
if (typeof value !== "string") return void 0;
|
|
157
|
+
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
158
|
+
if (!cleaned) return void 0;
|
|
159
|
+
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
160
|
+
if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
|
|
161
|
+
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
162
|
+
}
|
|
163
|
+
function sanitizeContentScalar(value) {
|
|
164
|
+
if (typeof value === "number") {
|
|
165
|
+
return Number.isFinite(value) ? String(value) : void 0;
|
|
166
|
+
}
|
|
167
|
+
return sanitizeContentValue(value);
|
|
168
|
+
}
|
|
169
|
+
function normalizeContentLanguage(value) {
|
|
170
|
+
var cleaned = sanitizeContentValue(value);
|
|
171
|
+
if (!cleaned) return void 0;
|
|
172
|
+
var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
|
|
173
|
+
return match && match[1] ? match[1].toLowerCase() : void 0;
|
|
174
|
+
}
|
|
175
|
+
function normalizeContentDuration(value) {
|
|
176
|
+
var raw = sanitizeContentScalar(value);
|
|
177
|
+
if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
|
|
178
|
+
var seconds = Number(raw);
|
|
179
|
+
if (seconds === -1) return -1;
|
|
180
|
+
return seconds > 0 ? Math.round(seconds) : void 0;
|
|
181
|
+
}
|
|
182
|
+
function bridgeSources() {
|
|
183
|
+
if (typeof window === "undefined") return [];
|
|
184
|
+
var w = window;
|
|
185
|
+
return [
|
|
186
|
+
w.__STORMCLOUD_CTV__,
|
|
187
|
+
w.__STORMCLOUD_CTV_AD_INFO__,
|
|
188
|
+
w.stormcloudCtv
|
|
189
|
+
].filter(Boolean);
|
|
190
|
+
}
|
|
191
|
+
function readBridgeValue(keys, sanitize) {
|
|
192
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
193
|
+
try {
|
|
194
|
+
for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
195
|
+
var source = _step.value;
|
|
196
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
197
|
+
try {
|
|
198
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
199
|
+
var key = _step1.value;
|
|
200
|
+
var value = void 0;
|
|
201
|
+
try {
|
|
202
|
+
value = source === null || source === void 0 ? void 0 : source[key];
|
|
203
|
+
if (typeof value === "function") value = value.call(source);
|
|
204
|
+
} catch (unused) {
|
|
205
|
+
value = void 0;
|
|
206
|
+
}
|
|
207
|
+
var sanitized = sanitize(value);
|
|
208
|
+
if (sanitized != null) return sanitized;
|
|
209
|
+
}
|
|
210
|
+
} catch (err) {
|
|
211
|
+
_didIteratorError1 = true;
|
|
212
|
+
_iteratorError1 = err;
|
|
213
|
+
} finally{
|
|
214
|
+
try {
|
|
215
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
216
|
+
_iterator1.return();
|
|
217
|
+
}
|
|
218
|
+
} finally{
|
|
219
|
+
if (_didIteratorError1) {
|
|
220
|
+
throw _iteratorError1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
} catch (err) {
|
|
226
|
+
_didIteratorError = true;
|
|
227
|
+
_iteratorError = err;
|
|
228
|
+
} finally{
|
|
229
|
+
try {
|
|
230
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
231
|
+
_iterator.return();
|
|
232
|
+
}
|
|
233
|
+
} finally{
|
|
234
|
+
if (_didIteratorError) {
|
|
235
|
+
throw _iteratorError;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return void 0;
|
|
240
|
+
}
|
|
241
|
+
function readBridgeContentValue(keys) {
|
|
242
|
+
return readBridgeValue(keys, sanitizeContentValue);
|
|
243
|
+
}
|
|
244
|
+
function resolveContentMetadata(config) {
|
|
245
|
+
var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
|
|
246
|
+
var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
|
|
247
|
+
var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
|
|
248
|
+
var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
|
|
249
|
+
var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
|
|
250
|
+
var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
|
|
251
|
+
var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
|
|
252
|
+
var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
|
|
253
|
+
var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
|
|
254
|
+
var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
|
|
255
|
+
var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
|
|
256
|
+
var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
|
|
257
|
+
var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
|
|
258
|
+
var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
|
|
259
|
+
return _object_spread({}, channelName ? {
|
|
260
|
+
channelName: channelName
|
|
261
|
+
} : {}, programTitle ? {
|
|
262
|
+
programTitle: programTitle
|
|
263
|
+
} : {}, contentNetwork ? {
|
|
264
|
+
contentNetwork: contentNetwork
|
|
265
|
+
} : {}, contentType ? {
|
|
266
|
+
contentType: contentType
|
|
267
|
+
} : {}, contentCategory ? {
|
|
268
|
+
contentCategory: contentCategory
|
|
269
|
+
} : {}, contentGenre ? {
|
|
270
|
+
contentGenre: contentGenre
|
|
271
|
+
} : {}, contentLanguage ? {
|
|
272
|
+
contentLanguage: contentLanguage
|
|
273
|
+
} : {}, contentDurationSeconds != null ? {
|
|
274
|
+
contentDurationSeconds: contentDurationSeconds
|
|
275
|
+
} : {}, contentSeason ? {
|
|
276
|
+
contentSeason: contentSeason
|
|
277
|
+
} : {}, contentEpisode ? {
|
|
278
|
+
contentEpisode: contentEpisode
|
|
279
|
+
} : {}, contentRating ? {
|
|
280
|
+
contentRating: contentRating
|
|
281
|
+
} : {}, contentId ? {
|
|
282
|
+
contentId: contentId
|
|
283
|
+
} : {});
|
|
284
|
+
}
|
|
285
|
+
function applyContentMetadataUpdate(target, meta) {
|
|
286
|
+
var apply = function apply(key, value) {
|
|
287
|
+
if (value === void 0) return;
|
|
288
|
+
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
289
|
+
if (clean) target[key] = clean;
|
|
290
|
+
else delete target[key];
|
|
291
|
+
};
|
|
292
|
+
apply("channelName", meta.channelName);
|
|
293
|
+
apply("programTitle", meta.programTitle);
|
|
294
|
+
apply("contentNetwork", meta.contentNetwork);
|
|
295
|
+
if (meta.details === void 0) return;
|
|
296
|
+
if (meta.details === null) delete target.contentDetails;
|
|
297
|
+
else target.contentDetails = _object_spread({}, meta.details);
|
|
298
|
+
}
|
|
299
|
+
function appendMissingContentParams(url, meta) {
|
|
300
|
+
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
301
|
+
try {
|
|
302
|
+
var parsed = new URL(url);
|
|
303
|
+
var add = function add(key, value) {
|
|
304
|
+
if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
|
|
305
|
+
};
|
|
306
|
+
add("ct_ch", meta.channelName);
|
|
307
|
+
add("ct_ti", meta.programTitle);
|
|
308
|
+
add("ct_ne", meta.contentNetwork);
|
|
309
|
+
return parsed.toString();
|
|
310
|
+
} catch (unused) {
|
|
311
|
+
return url;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
315
|
+
0 && (module.exports = {
|
|
316
|
+
appendMissingContentParams: appendMissingContentParams,
|
|
317
|
+
applyContentMetadataUpdate: applyContentMetadataUpdate,
|
|
318
|
+
normalizeContentDuration: normalizeContentDuration,
|
|
319
|
+
normalizeContentLanguage: normalizeContentLanguage,
|
|
320
|
+
readBridgeValue: readBridgeValue,
|
|
321
|
+
resolveContentMetadata: resolveContentMetadata,
|
|
322
|
+
sanitizeContentValue: sanitizeContentValue
|
|
323
|
+
});
|
|
324
|
+
//# sourceMappingURL=contentMetadata.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["d:\\project\\stormcloud-vp\\lib\\utils\\contentMetadata.cjs"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","contentMetadata_exports","appendMissingContentParams","applyContentMetadataUpdate","normalizeContentDuration","normalizeContentLanguage","readBridgeValue","resolveContentMetadata","sanitizeContentValue","module","exports","MAX_CONTENT_VALUE_LENGTH","BRIDGE_KEYS","channelName","programTitle","contentNetwork","contentType","contentCategory","contentGenre","contentLanguage","contentDuration","contentSeason","contentEpisode","contentRating","contentId","cleaned","replace","trim","test","length","slice","sanitizeContentScalar","Number","isFinite","String","match","toLowerCase","raw","seconds","Math","round","bridgeSources","window","w","__STORMCLOUD_CTV__","__STORMCLOUD_CTV_AD_INFO__","stormcloudCtv","filter","Boolean","keys","sanitize","source","sanitized","readBridgeContentValue","config","details","contentDetails","category","genre","language","contentDurationSeconds","durationSeconds","season","episode","rating","meta","apply","clean","url","parsed","URL","add","searchParams","has","set","toString"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,YAAYC,OAAOC,cAAc;AACrC,IAAIC,mBAAmBF,OAAOG,wBAAwB;AACtD,IAAIC,oBAAoBJ,OAAOK,mBAAmB;AAClD,IAAIC,eAAeN,OAAOO,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,kBAACC,QAAQC;IACtB,IAAK,IAAIC,QAAQD,IACfZ,UAAUW,QAAQE,MAAM;QAAEC,KAAKF,GAAG,CAACC,KAAK;QAAEE,YAAY;IAAK;AAC/D;AACA,IAAIC,cAAc,qBAACC,IAAIC,MAAMC,QAAQC;IACnC,IAAIF,QAAQ,CAAA,OAAOA,qCAAP,SAAOA,KAAG,MAAM,YAAY,OAAOA,SAAS,YAAY;YAC7D,kCAAA,2BAAA;;;gBAAA,IAAIG,MAAJ;gBACH,IAAI,CAACd,aAAae,IAAI,CAACL,IAAII,QAAQA,QAAQF,QACzCnB,UAAUiB,IAAII,KAAK;oBAAEP,KAAK,SAALA;+BAAWI,IAAI,CAACG,IAAI;;oBAAEN,YAAY,CAAEK,CAAAA,OAAOjB,iBAAiBe,MAA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C9ByD,IAAI,SAASN,KAAKlD,cAAc;QAChC,OAAOsD,OAAOM,QAAQ;IACxB,EAAE,eAAM;QACN,OAAOP;IACT;AACF;AACA,6DAA6D;AAC7D,KAAM3D,CAAAA,OAAOC,OAAO,GAAG;IACrBR,4BAAAA;IACAC,4BAAAA;IACAC,0BAAAA;IACAC,0BAAAA;IACAC,iBAAAA;IACAC,wBAAAA;IACAC,sBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/utils/contentMetadata.ts\nvar contentMetadata_exports = {};\n__export(contentMetadata_exports, {\n appendMissingContentParams: () => appendMissingContentParams,\n applyContentMetadataUpdate: () => applyContentMetadataUpdate,\n normalizeContentDuration: () => normalizeContentDuration,\n normalizeContentLanguage: () => normalizeContentLanguage,\n readBridgeValue: () => readBridgeValue,\n resolveContentMetadata: () => resolveContentMetadata,\n sanitizeContentValue: () => sanitizeContentValue\n});\nmodule.exports = __toCommonJS(contentMetadata_exports);\nvar MAX_CONTENT_VALUE_LENGTH = 128;\nvar BRIDGE_KEYS = {\n channelName: [\"channelName\", \"ct_ch\"],\n programTitle: [\"programTitle\", \"ct_ti\"],\n contentNetwork: [\"contentNetwork\", \"ct_ne\"],\n contentType: [\"contentType\", \"ctt\"],\n contentCategory: [\"contentCategory\", \"ctc\"],\n contentGenre: [\"contentGenre\", \"ctgr\"],\n contentLanguage: [\"contentLanguage\", \"ctlg\"],\n contentDuration: [\"contentDuration\", \"ctd\"],\n contentSeason: [\"contentSeason\", \"cts\"],\n contentEpisode: [\"contentEpisode\", \"cte\"],\n contentRating: [\"contentRating\", \"ctr\"],\n contentId: [\"contentId\", \"ctid\"]\n};\nfunction sanitizeContentValue(value) {\n if (typeof value !== \"string\") return void 0;\n const cleaned = value.replace(/[\\u0000-\\u001f\\u007f]/g, \" \").replace(/\\s+/g, \" \").trim();\n if (!cleaned) return void 0;\n if (/^(\\[[^\\]]*\\]|\\{[^}]*\\}|%%[^%]*%%|\\$\\{[^}]+\\})$/.test(cleaned)) return void 0;\n if (/^(unknown|null|undefined|none|n\\/a|-)$/i.test(cleaned)) return void 0;\n return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;\n}\nfunction sanitizeContentScalar(value) {\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? String(value) : void 0;\n }\n return sanitizeContentValue(value);\n}\nfunction normalizeContentLanguage(value) {\n const cleaned = sanitizeContentValue(value);\n if (!cleaned) return void 0;\n const match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);\n return match && match[1] ? match[1].toLowerCase() : void 0;\n}\nfunction normalizeContentDuration(value) {\n const raw = sanitizeContentScalar(value);\n if (raw == null || !/^-?\\d+(\\.\\d+)?$/.test(raw)) return void 0;\n const seconds = Number(raw);\n if (seconds === -1) return -1;\n return seconds > 0 ? Math.round(seconds) : void 0;\n}\nfunction bridgeSources() {\n if (typeof window === \"undefined\") return [];\n const w = window;\n return [w.__STORMCLOUD_CTV__, w.__STORMCLOUD_CTV_AD_INFO__, w.stormcloudCtv].filter(Boolean);\n}\nfunction readBridgeValue(keys, sanitize) {\n for (const source of bridgeSources()) {\n for (const key of keys) {\n let value;\n try {\n value = source?.[key];\n if (typeof value === \"function\") value = value.call(source);\n } catch {\n value = void 0;\n }\n const sanitized = sanitize(value);\n if (sanitized != null) return sanitized;\n }\n }\n return void 0;\n}\nfunction readBridgeContentValue(keys) {\n return readBridgeValue(keys, sanitizeContentValue);\n}\nfunction resolveContentMetadata(config) {\n const channelName = sanitizeContentValue(config.channelName) ?? readBridgeContentValue(BRIDGE_KEYS.channelName);\n const programTitle = sanitizeContentValue(config.programTitle) ?? readBridgeContentValue(BRIDGE_KEYS.programTitle);\n const contentNetwork = sanitizeContentValue(config.contentNetwork) ?? readBridgeContentValue(BRIDGE_KEYS.contentNetwork);\n const details = config.contentDetails ?? {};\n const contentType = sanitizeContentValue(details.contentType) ?? readBridgeContentValue(BRIDGE_KEYS.contentType);\n const contentCategory = sanitizeContentValue(details.category) ?? readBridgeContentValue(BRIDGE_KEYS.contentCategory);\n const contentGenre = sanitizeContentValue(details.genre) ?? readBridgeContentValue(BRIDGE_KEYS.contentGenre);\n const contentLanguage = normalizeContentLanguage(details.language) ?? readBridgeValue(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);\n const contentDurationSeconds = normalizeContentDuration(details.durationSeconds) ?? readBridgeValue(BRIDGE_KEYS.contentDuration, normalizeContentDuration);\n const contentSeason = sanitizeContentScalar(details.season) ?? readBridgeValue(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);\n const contentEpisode = sanitizeContentScalar(details.episode) ?? readBridgeValue(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);\n const contentRating = sanitizeContentValue(details.rating) ?? readBridgeContentValue(BRIDGE_KEYS.contentRating);\n const contentId = sanitizeContentValue(details.contentId) ?? readBridgeContentValue(BRIDGE_KEYS.contentId);\n return {\n ...channelName ? { channelName } : {},\n ...programTitle ? { programTitle } : {},\n ...contentNetwork ? { contentNetwork } : {},\n ...contentType ? { contentType } : {},\n ...contentCategory ? { contentCategory } : {},\n ...contentGenre ? { contentGenre } : {},\n ...contentLanguage ? { contentLanguage } : {},\n ...contentDurationSeconds != null ? { contentDurationSeconds } : {},\n ...contentSeason ? { contentSeason } : {},\n ...contentEpisode ? { contentEpisode } : {},\n ...contentRating ? { contentRating } : {},\n ...contentId ? { contentId } : {}\n };\n}\nfunction applyContentMetadataUpdate(target, meta) {\n const apply = (key, value) => {\n if (value === void 0) return;\n const clean = value === null ? void 0 : sanitizeContentValue(value);\n if (clean) target[key] = clean;\n else delete target[key];\n };\n apply(\"channelName\", meta.channelName);\n apply(\"programTitle\", meta.programTitle);\n apply(\"contentNetwork\", meta.contentNetwork);\n if (meta.details === void 0) return;\n if (meta.details === null) delete target.contentDetails;\n else target.contentDetails = { ...meta.details };\n}\nfunction appendMissingContentParams(url, meta) {\n if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;\n try {\n const parsed = new URL(url);\n const add = (key, value) => {\n if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);\n };\n add(\"ct_ch\", meta.channelName);\n add(\"ct_ti\", meta.programTitle);\n add(\"ct_ne\", meta.contentNetwork);\n return parsed.toString();\n } catch {\n return url;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n appendMissingContentParams,\n applyContentMetadataUpdate,\n normalizeContentDuration,\n normalizeContentLanguage,\n readBridgeValue,\n resolveContentMetadata,\n sanitizeContentValue\n});\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface ContentDetails {
|
|
2
|
+
contentType?: string | undefined;
|
|
3
|
+
category?: string | undefined;
|
|
4
|
+
genre?: string | undefined;
|
|
5
|
+
language?: string | undefined;
|
|
6
|
+
durationSeconds?: number | undefined;
|
|
7
|
+
season?: string | number | undefined;
|
|
8
|
+
episode?: string | number | undefined;
|
|
9
|
+
rating?: string | undefined;
|
|
10
|
+
contentId?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
interface ContentMetadata {
|
|
13
|
+
channelName?: string;
|
|
14
|
+
programTitle?: string;
|
|
15
|
+
contentNetwork?: string;
|
|
16
|
+
contentType?: string;
|
|
17
|
+
contentCategory?: string;
|
|
18
|
+
contentGenre?: string;
|
|
19
|
+
contentLanguage?: string;
|
|
20
|
+
contentDurationSeconds?: number;
|
|
21
|
+
contentSeason?: string;
|
|
22
|
+
contentEpisode?: string;
|
|
23
|
+
contentRating?: string;
|
|
24
|
+
contentId?: string;
|
|
25
|
+
}
|
|
26
|
+
interface ContentMetadataConfig {
|
|
27
|
+
channelName?: string | undefined;
|
|
28
|
+
programTitle?: string | undefined;
|
|
29
|
+
contentNetwork?: string | undefined;
|
|
30
|
+
contentDetails?: ContentDetails | undefined;
|
|
31
|
+
}
|
|
32
|
+
interface ContentMetadataUpdate {
|
|
33
|
+
channelName?: string | null | undefined;
|
|
34
|
+
programTitle?: string | null | undefined;
|
|
35
|
+
contentNetwork?: string | null | undefined;
|
|
36
|
+
details?: ContentDetails | null | undefined;
|
|
37
|
+
}
|
|
38
|
+
declare function sanitizeContentValue(value: unknown): string | undefined;
|
|
39
|
+
declare function normalizeContentLanguage(value: unknown): string | undefined;
|
|
40
|
+
declare function normalizeContentDuration(value: unknown): number | undefined;
|
|
41
|
+
declare function readBridgeValue<T>(keys: readonly string[], sanitize: (value: unknown) => T | undefined): T | undefined;
|
|
42
|
+
declare function resolveContentMetadata(config: ContentMetadataConfig): ContentMetadata;
|
|
43
|
+
declare function applyContentMetadataUpdate(target: {
|
|
44
|
+
channelName?: string;
|
|
45
|
+
programTitle?: string;
|
|
46
|
+
contentNetwork?: string;
|
|
47
|
+
contentDetails?: ContentDetails;
|
|
48
|
+
}, meta: ContentMetadataUpdate): void;
|
|
49
|
+
declare function appendMissingContentParams(url: string, meta: ContentMetadata): string;
|
|
50
|
+
|
|
51
|
+
export { type ContentDetails, type ContentMetadata, type ContentMetadataConfig, type ContentMetadataUpdate, appendMissingContentParams, applyContentMetadataUpdate, normalizeContentDuration, normalizeContentLanguage, readBridgeValue, resolveContentMetadata, sanitizeContentValue };
|