stormcloud-video-player 0.8.78 → 0.8.80

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.
Files changed (76) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.cjs +6 -0
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +2 -0
  5. package/lib/StormcloudPlayer.cjs +1143 -160
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +2 -0
  8. package/lib/index.cjs +1206 -162
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +2 -0
  11. package/lib/index.d.ts +64 -2
  12. package/lib/index.js +1206 -162
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +424 -84
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdConfigManager.cjs +738 -94
  17. package/lib/player/AdConfigManager.cjs.map +1 -1
  18. package/lib/player/AdTimingService.cjs +0 -9
  19. package/lib/player/AdTimingService.cjs.map +1 -1
  20. package/lib/player/FloorLadder.cjs +3 -0
  21. package/lib/player/FloorLadder.cjs.map +1 -1
  22. package/lib/player/HlsEngine.cjs +7 -1
  23. package/lib/player/HlsEngine.cjs.map +1 -1
  24. package/lib/player/HlsEngine.d.cts +1 -0
  25. package/lib/player/OptimizedPodRequest.cjs +4 -1
  26. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  27. package/lib/player/OptimizedPodRequest.d.cts +1 -1
  28. package/lib/player/StormcloudVideoPlayer.cjs +1143 -160
  29. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  30. package/lib/player/StormcloudVideoPlayer.d.cts +18 -1
  31. package/lib/players/HlsPlayer.cjs +1143 -160
  32. package/lib/players/HlsPlayer.cjs.map +1 -1
  33. package/lib/players/index.cjs +1143 -160
  34. package/lib/players/index.cjs.map +1 -1
  35. package/lib/props.cjs +6 -0
  36. package/lib/props.cjs.map +1 -1
  37. package/lib/props.d.cts +2 -0
  38. package/lib/sdk/hlsAdPlayer.cjs +32 -3
  39. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  40. package/lib/sdk/pal.cjs +10 -3
  41. package/lib/sdk/pal.cjs.map +1 -1
  42. package/lib/sdk/pal.d.cts +3 -0
  43. package/lib/types.d.cts +24 -1
  44. package/lib/ui/StormcloudVideoPlayer.cjs +1206 -162
  45. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  46. package/lib/ui/StormcloudVideoPlayer.d.cts +2 -0
  47. package/lib/utils/__tests__/adSignals.test.cjs +25662 -0
  48. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
  49. package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
  50. package/lib/utils/adIdentity.cjs +421 -0
  51. package/lib/utils/adIdentity.cjs.map +1 -0
  52. package/lib/utils/adIdentity.d.cts +30 -0
  53. package/lib/utils/browserCompat.cjs +13 -0
  54. package/lib/utils/browserCompat.cjs.map +1 -1
  55. package/lib/utils/browserCompat.d.cts +2 -1
  56. package/lib/utils/contentMetadata.cjs +208 -0
  57. package/lib/utils/contentMetadata.cjs.map +1 -0
  58. package/lib/utils/contentMetadata.d.cts +15 -0
  59. package/lib/utils/ctvVastSignals.cjs +250 -181
  60. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  61. package/lib/utils/deviceInfo.cjs +678 -0
  62. package/lib/utils/deviceInfo.cjs.map +1 -0
  63. package/lib/utils/deviceInfo.d.cts +43 -0
  64. package/lib/utils/screenActivity.cjs +125 -0
  65. package/lib/utils/screenActivity.cjs.map +1 -0
  66. package/lib/utils/screenActivity.d.cts +5 -0
  67. package/lib/utils/tracking.cjs +391 -57
  68. package/lib/utils/tracking.cjs.map +1 -1
  69. package/lib/utils/tracking.d.cts +1 -1
  70. package/lib/utils/vastEnvironmentSignals.cjs +255 -85
  71. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  72. package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
  73. package/lib/utils/vastMacros.cjs +7 -0
  74. package/lib/utils/vastMacros.cjs.map +1 -1
  75. package/lib/utils/vastMacros.d.cts +1 -0
  76. package/package.json +1 -1
@@ -1,4 +1,12 @@
1
1
  "use strict";
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_without_holes(arr) {
8
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
9
+ }
2
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
3
11
  try {
4
12
  var info = gen[key](arg);
@@ -36,6 +44,14 @@ function _define_property(obj, key, value) {
36
44
  } else obj[key] = value;
37
45
  return obj;
38
46
  }
47
+ function _iterable_to_array(iter) {
48
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
49
+ return Array.from(iter);
50
+ }
51
+ }
52
+ function _non_iterable_spread() {
53
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
+ }
39
55
  function _object_spread(target) {
40
56
  for(var i = 1; i < arguments.length; i++){
41
57
  var source = arguments[i] != null ? arguments[i] : {};
@@ -51,6 +67,32 @@ function _object_spread(target) {
51
67
  }
52
68
  return target;
53
69
  }
70
+ function ownKeys(object, enumerableOnly) {
71
+ var keys = Object.keys(object);
72
+ if (Object.getOwnPropertySymbols) {
73
+ var symbols = Object.getOwnPropertySymbols(object);
74
+ if (enumerableOnly) {
75
+ symbols = symbols.filter(function(sym) {
76
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
77
+ });
78
+ }
79
+ keys.push.apply(keys, symbols);
80
+ }
81
+ return keys;
82
+ }
83
+ function _object_spread_props(target, source) {
84
+ source = source != null ? source : {};
85
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
86
+ else {
87
+ ownKeys(Object(source)).forEach(function(key) {
88
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
89
+ });
90
+ }
91
+ return target;
92
+ }
93
+ function _to_consumable_array(arr) {
94
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
95
+ }
54
96
  function _ts_generator(thisArg, body) {
55
97
  var f, y, t, _ = {
56
98
  label: 0,
@@ -154,6 +196,14 @@ function _type_of(obj) {
154
196
  "@swc/helpers - typeof";
155
197
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
156
198
  }
199
+ function _unsupported_iterable_to_array(o, minLen) {
200
+ if (!o) return;
201
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
202
+ var n = Object.prototype.toString.call(o).slice(8, -1);
203
+ if (n === "Object" && o.constructor) n = o.constructor.name;
204
+ if (n === "Map" || n === "Set") return Array.from(n);
205
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
206
+ }
157
207
  var __defProp = Object.defineProperty;
158
208
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
159
209
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -310,6 +360,50 @@ function ingestPlayerTracking(licenseKey, channel, body) {
310
360
  });
311
361
  })();
312
362
  }
363
+ // src/utils/adIdentity.ts
364
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
365
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
366
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
367
+ "00000000-0000-0000-0000-000000000000",
368
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
369
+ ]);
370
+ var lgUdidResult;
371
+ function isUsableAdId(value) {
372
+ if (typeof value !== "string") return false;
373
+ var t = value.trim();
374
+ if (!t) return false;
375
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
376
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
377
+ return !ZEROED_IDS.has(t.toLowerCase());
378
+ }
379
+ function isZeroedAdId(value) {
380
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
381
+ }
382
+ function readSamsungTifa() {
383
+ try {
384
+ var _window_webapis;
385
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
386
+ if (!adinfo) return void 0;
387
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
388
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
389
+ if (isZeroedAdId(tifa)) return {
390
+ deviceIdType: "tifa",
391
+ limitAdTracking: true
392
+ };
393
+ if (!isUsableAdId(tifa)) return void 0;
394
+ return _object_spread({
395
+ deviceId: tifa.trim(),
396
+ deviceIdType: "tifa"
397
+ }, typeof lat === "boolean" ? {
398
+ limitAdTracking: lat
399
+ } : {});
400
+ } catch (unused) {
401
+ return void 0;
402
+ }
403
+ }
404
+ function readCachedLgUdid() {
405
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
406
+ }
313
407
  // src/utils/vastEnvironmentSignals.ts
314
408
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
315
409
  var DEVICE_ID_STORAGE_KEYS = [
@@ -350,26 +444,12 @@ var DEVICE_TYPE_HINT_ALIASES = {
350
444
  stb: DEVICE_TYPE_HINT.SET_TOP_BOX,
351
445
  settopbox: DEVICE_TYPE_HINT.SET_TOP_BOX
352
446
  };
353
- function inferDeviceIdType() {
354
- if (typeof navigator === "undefined") {
355
- return void 0;
356
- }
357
- var ua = navigator.userAgent;
358
- if (/Roku/i.test(ua)) return "rida";
359
- if (/Tizen|Samsung/i.test(ua)) return "tifa";
360
- if (/AppleTV|Apple TV/i.test(ua)) return "tvOS";
361
- if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
362
- if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return "lgudid";
363
- if (/Android|Google TV/i.test(ua)) return "aaid";
364
- if (/iPhone|iPad|iPod/i.test(ua)) return "idfa";
365
- return void 0;
366
- }
367
447
  function resolveNativeDeviceId() {
368
448
  var includeStored = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
369
449
  var bridgeSignals = readNativeBridgeSignals();
370
450
  var platformDevice = readPlatformNativeDeviceId();
371
451
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
372
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
452
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
373
453
  return void 0;
374
454
  }
375
455
  return deviceId;
@@ -473,44 +553,10 @@ function performanceNow() {
473
553
  }
474
554
  function readPlatformNativeDeviceId() {
475
555
  if (typeof window === "undefined") return {};
476
- try {
477
- var _window_webapis;
478
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
479
- if (adinfo) {
480
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
481
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
482
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
483
- return _object_spread({
484
- deviceId: tifa,
485
- deviceIdType: "tifa"
486
- }, typeof lat === "boolean" ? {
487
- limitAdTracking: lat
488
- } : {});
489
- }
490
- }
491
- } catch (unused) {}
492
- try {
493
- var webOSDev = window.webOSDev;
494
- if (webOSDev) {
495
- var _webOSDev_lgudid;
496
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
497
- if (typeof lgudid === "string" && lgudid) {
498
- if (isZeroedAdId(lgudid)) {
499
- return {
500
- deviceIdType: "lgudid",
501
- limitAdTracking: true
502
- };
503
- }
504
- if (!isMacroPlaceholder(lgudid)) {
505
- return {
506
- deviceId: lgudid,
507
- deviceIdType: "lgudid",
508
- limitAdTracking: false
509
- };
510
- }
511
- }
512
- }
513
- } catch (unused) {}
556
+ var tifa = readSamsungTifa();
557
+ if (tifa) return tifa;
558
+ var lgudid = readCachedLgUdid();
559
+ if (lgudid) return lgudid;
514
560
  try {
515
561
  var roku = window.Roku;
516
562
  if (roku) {
@@ -534,7 +580,7 @@ function isMacroPlaceholder(value) {
534
580
  var t = value.trim();
535
581
  return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
536
582
  }
537
- function isZeroedAdId(value) {
583
+ function isZeroedAdId2(value) {
538
584
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
539
585
  }
540
586
  function readNativeBridgeSignals() {
@@ -578,7 +624,7 @@ function readNativeBridgeSignals() {
578
624
  "deviceIdType",
579
625
  "advertisingIdType",
580
626
  "idType"
581
- ]) || inferDeviceIdType();
627
+ ]) || void 0;
582
628
  var limitAdTracking = readBridgeBoolean(source, [
583
629
  "is_lat",
584
630
  "limitAdTracking",
@@ -755,23 +801,309 @@ function normalizeBoolean(value) {
755
801
  }
756
802
  return void 0;
757
803
  }
804
+ // src/utils/deviceInfo.ts
805
+ var CATEGORY_CODES = {
806
+ "LG TV": "lg_tv",
807
+ "LG Set-Top Box": "lg_stb",
808
+ "Samsung TV": "samsung_tv",
809
+ Other: "other"
810
+ };
811
+ var DEVICE_CATEGORIES = [
812
+ "LG TV",
813
+ "LG Set-Top Box",
814
+ "Samsung TV",
815
+ "Other"
816
+ ];
817
+ var hostDeviceInfo;
818
+ var lgDeviceInfo;
819
+ var platformCache;
820
+ var primePromise;
821
+ function cleanString(value) {
822
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
823
+ if (typeof value !== "string") return void 0;
824
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
825
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
826
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
827
+ }
828
+ function safeCall(fn, thisArg) {
829
+ if (typeof fn !== "function") return void 0;
830
+ try {
831
+ return fn.call(thisArg);
832
+ } catch (unused) {
833
+ return void 0;
834
+ }
835
+ }
836
+ function userAgent() {
837
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
838
+ }
839
+ function bridgeSources() {
840
+ if (typeof window === "undefined") return [];
841
+ var w = window;
842
+ return [
843
+ w.__STORMCLOUD_CTV__,
844
+ w.__STORMCLOUD_CTV_AD_INFO__,
845
+ w.stormcloudCtv
846
+ ].filter(Boolean);
847
+ }
848
+ function readBridge(keys) {
849
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
850
+ try {
851
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
852
+ var source = _step.value;
853
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
854
+ try {
855
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
856
+ var key = _step1.value;
857
+ var value = void 0;
858
+ try {
859
+ value = source === null || source === void 0 ? void 0 : source[key];
860
+ if (typeof value === "function") value = value.call(source);
861
+ } catch (unused) {
862
+ value = void 0;
863
+ }
864
+ var clean = cleanString(value);
865
+ if (clean) return clean;
866
+ }
867
+ } catch (err) {
868
+ _didIteratorError1 = true;
869
+ _iteratorError1 = err;
870
+ } finally{
871
+ try {
872
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
873
+ _iterator1.return();
874
+ }
875
+ } finally{
876
+ if (_didIteratorError1) {
877
+ throw _iteratorError1;
878
+ }
879
+ }
880
+ }
881
+ }
882
+ } catch (err) {
883
+ _didIteratorError = true;
884
+ _iteratorError = err;
885
+ } finally{
886
+ try {
887
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
888
+ _iterator.return();
889
+ }
890
+ } finally{
891
+ if (_didIteratorError) {
892
+ throw _iteratorError;
893
+ }
894
+ }
895
+ }
896
+ return void 0;
897
+ }
898
+ function normalizeCategory(value) {
899
+ var v = cleanString(value);
900
+ if (!v) return void 0;
901
+ var exact = DEVICE_CATEGORIES.find(function(c) {
902
+ return c.toLowerCase() === v.toLowerCase();
903
+ });
904
+ if (exact) return exact;
905
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
906
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
907
+ return CATEGORY_CODES[c] === code;
908
+ });
909
+ return byCode;
910
+ }
911
+ function parseUserAgentDeviceInfo(ua) {
912
+ var sources = [];
913
+ var out = {
914
+ platform: "other",
915
+ sources: sources
916
+ };
917
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
918
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
919
+ if (/Web0S|webOS/i.test(ua)) {
920
+ out.platform = "webos";
921
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
922
+ if (lg && lg[1] && lg[2]) {
923
+ out.model = lg[1];
924
+ out.firmware = lg[2];
925
+ sources.push("user_agent");
926
+ }
927
+ } else if (/Tizen/i.test(ua)) {
928
+ out.platform = "tizen";
929
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
930
+ if (tizen && tizen[1]) {
931
+ out.osVersion = "Tizen ".concat(tizen[1]);
932
+ sources.push("user_agent");
933
+ }
934
+ }
935
+ return out;
936
+ }
937
+ function readSamsungProductInfo() {
938
+ var _cleanString;
939
+ var _window_webapis;
940
+ if (typeof window === "undefined") return void 0;
941
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
942
+ if (!productinfo) return void 0;
943
+ var model = (_cleanString = cleanString(safeCall(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall(productinfo.getModel, productinfo), 40);
944
+ var firmware = cleanString(safeCall(productinfo.getFirmware, productinfo), 64);
945
+ var duid = cleanString(safeCall(productinfo.getDuid, productinfo), 128);
946
+ if (!model && !firmware && !duid) return void 0;
947
+ return _object_spread({}, model ? {
948
+ model: model
949
+ } : {}, firmware ? {
950
+ firmware: firmware
951
+ } : {}, duid ? {
952
+ internalDeviceId: duid,
953
+ internalDeviceIdSource: "samsung_duid"
954
+ } : {});
955
+ }
956
+ function computePlatformInfo() {
957
+ var info = parseUserAgentDeviceInfo(userAgent());
958
+ var sources = _to_consumable_array(info.sources);
959
+ var samsung = readSamsungProductInfo();
960
+ if (samsung) {
961
+ info.platform = "tizen";
962
+ if (samsung.model) info.model = samsung.model;
963
+ if (samsung.firmware) info.firmware = samsung.firmware;
964
+ if (samsung.internalDeviceId) {
965
+ info.internalDeviceId = samsung.internalDeviceId;
966
+ info.internalDeviceIdSource = "samsung_duid";
967
+ }
968
+ sources.push("samsung_productinfo");
969
+ }
970
+ if (lgDeviceInfo) {
971
+ info.platform = "webos";
972
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
973
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
974
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
975
+ sources.push("lg_deviceinfo");
976
+ }
977
+ var lgUdid = readCachedLgUdid();
978
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
979
+ info.internalDeviceId = lgUdid.deviceId;
980
+ info.internalDeviceIdSource = "lg_udid";
981
+ sources.push("lg_udid");
982
+ }
983
+ info.sources = sources;
984
+ return info;
985
+ }
986
+ function categorize(platform, model) {
987
+ if (platform === "tizen") return "Samsung TV";
988
+ if (platform === "webos") {
989
+ var ua = userAgent();
990
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
991
+ return "LG TV";
992
+ }
993
+ return "Other";
994
+ }
995
+ function getDeviceInfo() {
996
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory;
997
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
998
+ if (primePromise && !platformCache) {} else {
999
+ platformCache = platform;
1000
+ }
1001
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
1002
+ var bridge = {
1003
+ terminalId: readBridge([
1004
+ "terminalId",
1005
+ "terminal_id"
1006
+ ]),
1007
+ internalDeviceId: readBridge([
1008
+ "internalDeviceId",
1009
+ "internal_device_id"
1010
+ ]),
1011
+ model: readBridge([
1012
+ "deviceModel"
1013
+ ]),
1014
+ firmware: readBridge([
1015
+ "firmwareVersion"
1016
+ ]),
1017
+ category: normalizeCategory(readBridge([
1018
+ "deviceCategory"
1019
+ ]))
1020
+ };
1021
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
1022
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
1023
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
1024
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
1025
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
1026
+ var sources = _to_consumable_array(platform.sources);
1027
+ var bridgeValues = [
1028
+ bridge.terminalId,
1029
+ bridge.internalDeviceId,
1030
+ bridge.model,
1031
+ bridge.firmware,
1032
+ bridge.category
1033
+ ];
1034
+ if (bridgeValues.some(function(v) {
1035
+ return v !== void 0;
1036
+ })) sources.unshift("bridge");
1037
+ if (hostDeviceInfo) sources.unshift("host");
1038
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
1039
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
1040
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
1041
+ return _object_spread_props(_object_spread({
1042
+ category: category,
1043
+ categoryCode: CATEGORY_CODES[category]
1044
+ }, model ? {
1045
+ model: model
1046
+ } : {}, sonifiModel ? {
1047
+ sonifiModel: sonifiModel
1048
+ } : {}, firmware ? {
1049
+ firmware: firmware
1050
+ } : {}, platform.osVersion ? {
1051
+ osVersion: platform.osVersion
1052
+ } : {}, platform.browserMajorVersion != null ? {
1053
+ browserMajorVersion: platform.browserMajorVersion
1054
+ } : {}, internalDeviceId ? {
1055
+ internalDeviceId: internalDeviceId
1056
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
1057
+ internalDeviceIdSource: internalDeviceIdSource
1058
+ } : {}, terminalId ? {
1059
+ terminalId: terminalId
1060
+ } : {}), {
1061
+ sources: sources
1062
+ });
1063
+ }
1064
+ function deviceInfoAnalyticsFields(info) {
1065
+ return _object_spread({
1066
+ device_category: info.category
1067
+ }, info.model ? {
1068
+ device_model: info.model
1069
+ } : {}, info.sonifiModel ? {
1070
+ sonifi_model: info.sonifiModel
1071
+ } : {}, info.firmware ? {
1072
+ firmware_version: info.firmware
1073
+ } : {}, info.osVersion ? {
1074
+ os_version: info.osVersion
1075
+ } : {}, info.browserMajorVersion != null ? {
1076
+ browser_major_version: info.browserMajorVersion
1077
+ } : {}, info.internalDeviceId ? {
1078
+ internal_device_id: info.internalDeviceId
1079
+ } : {}, info.internalDeviceIdSource ? {
1080
+ internal_device_id_source: info.internalDeviceIdSource
1081
+ } : {}, info.terminalId ? {
1082
+ terminal_id: info.terminalId
1083
+ } : {});
1084
+ }
758
1085
  // src/utils/tracking.ts
759
1086
  var cachedBrowserId = null;
760
1087
  function buildAnalyticsContext(config) {
761
- var _config_contentNetwork, _config_channelName, _config_programTitle;
1088
+ var _config_contentNetwork, _config_channelName, _config_programTitle, _config_src;
762
1089
  var context = {};
763
1090
  var contentNetwork = (_config_contentNetwork = config.contentNetwork) === null || _config_contentNetwork === void 0 ? void 0 : _config_contentNetwork.trim();
764
1091
  var contentChannel = (_config_channelName = config.channelName) === null || _config_channelName === void 0 ? void 0 : _config_channelName.trim();
765
1092
  var contentTitle = (_config_programTitle = config.programTitle) === null || _config_programTitle === void 0 ? void 0 : _config_programTitle.trim();
1093
+ var hlsUrl = (_config_src = config.src) === null || _config_src === void 0 ? void 0 : _config_src.trim();
766
1094
  if (contentNetwork) context.contentNetwork = contentNetwork;
767
1095
  if (contentChannel) context.contentChannel = contentChannel;
768
1096
  if (contentTitle) context.contentTitle = contentTitle;
1097
+ if (hlsUrl) context.hlsUrl = hlsUrl;
769
1098
  if (config.debugAdTiming) {
770
1099
  context.debugAdTiming = true;
771
1100
  }
772
1101
  if (config.isLiveStream !== void 0) {
773
1102
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
774
1103
  }
1104
+ if (config.sendDeviceInfoToAnalytics) {
1105
+ context.includeDeviceInfo = true;
1106
+ }
775
1107
  return context;
776
1108
  }
777
1109
  function getClientInfo() {
@@ -1067,7 +1399,7 @@ function buildPlayerMetricEvent() {
1067
1399
  capture_at: captureAt
1068
1400
  }, context.inputStreamType ? {
1069
1401
  input_stream_type: context.inputStreamType
1070
- } : {})
1402
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
1071
1403
  ];
1072
1404
  }
1073
1405
  });
@@ -1271,6 +1603,8 @@ function sendAdImpressionTracking(_0, _1) {
1271
1603
  content_channel: context.contentChannel
1272
1604
  } : {}, context.contentTitle ? {
1273
1605
  content_title: context.contentTitle
1606
+ } : {}, context.hlsUrl ? {
1607
+ hls_url: context.hlsUrl
1274
1608
  } : {})
1275
1609
  ]
1276
1610
  })