stormcloud-video-player 0.8.26 → 0.8.28

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.
@@ -1934,38 +1934,108 @@ function getOrCreateStoredUuid(storageKey) {
1934
1934
  if (typeof window === "undefined") {
1935
1935
  return void 0;
1936
1936
  }
1937
- var existing = readStoredString(storageKey);
1937
+ var existing = readPersistentId(storageKey);
1938
1938
  if (existing) {
1939
+ writePersistentId(storageKey, existing);
1939
1940
  return existing;
1940
1941
  }
1941
1942
  var id = createUuid();
1942
- try {
1943
- var _window_localStorage;
1944
- (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
1945
- } catch (unused) {}
1943
+ writePersistentId(storageKey, id);
1946
1944
  return id;
1947
1945
  }
1948
1946
  function getOrCreateCtvSessionId() {
1949
- var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
1947
+ var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
1950
1948
  if (existing) {
1949
+ writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
1951
1950
  return existing;
1952
1951
  }
1953
1952
  var sessionId = createUuid();
1953
+ writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
1954
+ return sessionId;
1955
+ }
1956
+ function readPersistentId(storageKey) {
1957
+ return readStoredString(storageKey) || readCookie(storageKey);
1958
+ }
1959
+ function writePersistentId(storageKey, value) {
1954
1960
  try {
1955
1961
  var _window_localStorage;
1956
- (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
1962
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
1963
+ } catch (unused) {}
1964
+ writeCookie(storageKey, value);
1965
+ }
1966
+ var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
1967
+ function readCookie(name) {
1968
+ if (typeof document === "undefined") {
1969
+ return void 0;
1970
+ }
1971
+ try {
1972
+ var prefix = encodeURIComponent(name) + "=";
1973
+ var parts = document.cookie ? document.cookie.split(";") : [];
1974
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1975
+ try {
1976
+ for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1977
+ var part = _step.value;
1978
+ var entry = part.trim();
1979
+ if (entry.startsWith(prefix)) {
1980
+ return decodeURIComponent(entry.slice(prefix.length)) || void 0;
1981
+ }
1982
+ }
1983
+ } catch (err) {
1984
+ _didIteratorError = true;
1985
+ _iteratorError = err;
1986
+ } finally{
1987
+ try {
1988
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1989
+ _iterator.return();
1990
+ }
1991
+ } finally{
1992
+ if (_didIteratorError) {
1993
+ throw _iteratorError;
1994
+ }
1995
+ }
1996
+ }
1997
+ } catch (unused) {}
1998
+ return void 0;
1999
+ }
2000
+ function writeCookie(name, value) {
2001
+ if (typeof document === "undefined") {
2002
+ return;
2003
+ }
2004
+ try {
2005
+ document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
1957
2006
  } catch (unused) {}
1958
- return sessionId;
1959
2007
  }
1960
2008
  function createUuid() {
2009
+ var _bytes_, _bytes_1;
1961
2010
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
1962
2011
  return crypto.randomUUID();
1963
2012
  }
1964
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
1965
- var value = Math.floor(Math.random() * 16);
1966
- var nibble = char === "x" ? value : value & 3 | 8;
1967
- return nibble.toString(16);
1968
- });
2013
+ var bytes = new Uint8Array(16);
2014
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
2015
+ crypto.getRandomValues(bytes);
2016
+ } else {
2017
+ var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
2018
+ for(var i = 0; i < 16; i++){
2019
+ seed = seed * 1103515245 + 12345 & 2147483647;
2020
+ bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
2021
+ }
2022
+ }
2023
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
2024
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
2025
+ var hex = "";
2026
+ for(var i1 = 0; i1 < 16; i1++){
2027
+ var _bytes_i;
2028
+ hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
2029
+ }
2030
+ return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
2031
+ }
2032
+ function performanceNow() {
2033
+ try {
2034
+ if (typeof performance !== "undefined" && typeof performance.now === "function") {
2035
+ return performance.now();
2036
+ }
2037
+ } catch (unused) {}
2038
+ return 0;
1969
2039
  }
1970
2040
  function readPlatformNativeDeviceId() {
1971
2041
  if (typeof window === "undefined") return {};
@@ -4733,6 +4803,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
4733
4803
  this.vmapBreaks = [];
4734
4804
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
4735
4805
  this.streamCorrelator = generateCorrelator();
4806
+ this.viewCorrelator = generateCorrelator();
4736
4807
  this.consentSignals = {};
4737
4808
  this.podCounter = 0;
4738
4809
  this.podAssignedByPrefetch = false;
@@ -5168,7 +5239,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5168
5239
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5169
5240
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5170
5241
  var urlWithMacros = applyVastMacros(baseUrl, {
5171
- correlator: generateCorrelator(),
5242
+ correlator: this.viewCorrelator,
5172
5243
  streamCorrelator: this.streamCorrelator,
5173
5244
  pod: this.podCounter > 0 ? this.podCounter : void 0,
5174
5245
  adPosition: this.adRequestPositionInBreak,
@@ -5214,7 +5285,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
5214
5285
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
5215
5286
  var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
5216
5287
  var urlWithMacros = applyVastMacros(baseUrl, {
5217
- correlator: generateCorrelator(),
5288
+ correlator: this.viewCorrelator,
5218
5289
  streamCorrelator: this.streamCorrelator,
5219
5290
  pod: this.podCounter > 0 ? this.podCounter : void 0,
5220
5291
  podMaxAds: podParams.maxAds,
@@ -7065,7 +7136,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
7065
7136
  // IMA event listeners
7066
7137
  // ───────────────────────────────────────────────────────────────
7067
7138
  function get() {
7068
- return !!this.host.config.optimizedPods;
7139
+ return this.host.config.optimizedPods !== false;
7069
7140
  }
7070
7141
  },
7071
7142
  {
@@ -9205,7 +9276,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
9205
9276
  }
9206
9277
  this.adConfig.beginNewAdPod();
9207
9278
  this.adConfig.podAssignedByPrefetch = true;
9208
- var optimizedPods = !!this.config.optimizedPods;
9279
+ var optimizedPods = this.config.optimizedPods !== false;
9209
9280
  var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
9210
9281
  var generatedUrls = optimizedPods ? [
9211
9282
  this.generatePodVastUrl(baseVastUrl, breakDurationMs)