@brndts/brndts-ads 1.14.20 → 1.14.21

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/index.js CHANGED
@@ -68090,9 +68090,89 @@ var BASIC_SUPPORT = {
68090
68090
  audio: "canPlayType" in document.createElement("audio"),
68091
68091
  video: "canPlayType" in document.createElement("video")
68092
68092
  };
68093
+ function detectAdblock() {
68094
+ var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_timeoutMs = _ref.timeoutMs, timeoutMs = _ref_timeoutMs === void 0 ? 1500 : _ref_timeoutMs;
68095
+ return new Promise(function(resolve) {
68096
+ var maybeResolve = function maybeResolve() {
68097
+ requestAnimationFrame(function() {
68098
+ checkCSS();
68099
+ var signals = (cssHit ? 1 : 0) + (netHit ? 1 : 0) + (scriptHit ? 1 : 0);
68100
+ if (signals >= 2 || scriptLoaded && (cssHit || netHit)) {
68101
+ done(true);
68102
+ }
68103
+ });
68104
+ };
68105
+ var cleanup = function cleanup() {
68106
+ clearTimeout(t2);
68107
+ try {
68108
+ bait.remove();
68109
+ } catch (e) {}
68110
+ try {
68111
+ s2.remove();
68112
+ } catch (e) {}
68113
+ img.src = "";
68114
+ };
68115
+ var resolved = false;
68116
+ var done = function(v) {
68117
+ if (!resolved) {
68118
+ resolved = true;
68119
+ cleanup();
68120
+ resolve(v);
68121
+ }
68122
+ };
68123
+ var bait = document.createElement("div");
68124
+ bait.className = "ads ad ad-banner ad-unit adzone adsbox pub_300x250";
68125
+ bait.style.cssText = "position:absolute;left:-9999px;width:300px;height:250px;pointer-events:none;";
68126
+ document.addEventListener("DOMContentLoaded", function() {
68127
+ return document.body.appendChild(bait);
68128
+ });
68129
+ var cssHit = false;
68130
+ var checkCSS = function() {
68131
+ if (!bait.isConnected) {
68132
+ cssHit = true;
68133
+ return;
68134
+ }
68135
+ var cs = getComputedStyle(bait);
68136
+ var hidden = cs.display === "none" || cs.visibility === "hidden" || parseInt(cs.height || "0", 10) === 0 || bait.offsetParent === null;
68137
+ if (hidden) cssHit = true;
68138
+ };
68139
+ var img = new Image();
68140
+ var netHit = false;
68141
+ img.onload = function() {};
68142
+ img.onerror = function() {
68143
+ netHit = true;
68144
+ maybeResolve();
68145
+ };
68146
+ img.src = "/ads/px.gif?cb=".concat(Date.now());
68147
+ var s2 = document.createElement("script");
68148
+ var scriptHit = false;
68149
+ var scriptLoaded = false;
68150
+ window.__ab_allow = void 0;
68151
+ s2.async = true;
68152
+ s2.src = "/ads/allow.js?cb=".concat(Date.now());
68153
+ s2.onload = function() {
68154
+ scriptLoaded = true;
68155
+ if (window.__ab_allow !== true) {
68156
+ scriptHit = true;
68157
+ }
68158
+ maybeResolve();
68159
+ };
68160
+ s2.onerror = function() {
68161
+ scriptHit = true;
68162
+ maybeResolve();
68163
+ };
68164
+ document.head.appendChild(s2);
68165
+ var t2 = setTimeout(function() {
68166
+ checkCSS();
68167
+ var blocked = cssHit || netHit || scriptHit;
68168
+ done(blocked);
68169
+ }, timeoutMs);
68170
+ });
68171
+ }
68093
68172
  var Support = /*#__PURE__*/ function() {
68094
68173
  function _Support(type, provider) {
68095
68174
  _class_call_check(this, _Support);
68175
+ this.supportAds = null;
68096
68176
  this.api = type && BASIC_SUPPORT[type] || provider !== "html5";
68097
68177
  this.ui = this.api && _Support.rangeInput;
68098
68178
  }
@@ -68141,6 +68221,35 @@ var Support = /*#__PURE__*/ function() {
68141
68221
  ui: ui
68142
68222
  };
68143
68223
  }
68224
+ },
68225
+ {
68226
+ key: "ads",
68227
+ value: function ads() {
68228
+ return _async_to_generator(function() {
68229
+ var _;
68230
+ return _ts_generator(this, function(_state) {
68231
+ switch(_state.label){
68232
+ case 0:
68233
+ if (this.supportAds !== null) {
68234
+ this.supportAds;
68235
+ }
68236
+ _ = this;
68237
+ return [
68238
+ 4,
68239
+ detectAdblock().then(function(blocked) {
68240
+ return !blocked;
68241
+ })
68242
+ ];
68243
+ case 1:
68244
+ _.supportAds = _state.sent();
68245
+ return [
68246
+ 2,
68247
+ !!this.supportAds
68248
+ ];
68249
+ }
68250
+ });
68251
+ }).call(this);
68252
+ }
68144
68253
  }
68145
68254
  ], [
68146
68255
  {
@@ -71175,6 +71284,19 @@ var BRNDTSDefaultProvider = /*#__PURE__*/ function(ContentProvider) {
71175
71284
  });
71176
71285
  }).call(this);
71177
71286
  }
71287
+ },
71288
+ {
71289
+ key: "requestInstream",
71290
+ value: function requestInstream() {
71291
+ return _async_to_generator(function() {
71292
+ return _ts_generator(this, function(_state) {
71293
+ return [
71294
+ 2,
71295
+ Promise.resolve({})
71296
+ ];
71297
+ });
71298
+ })();
71299
+ }
71178
71300
  }
71179
71301
  ]);
71180
71302
  return BRNDTSDefaultProvider;
@@ -71453,6 +71575,22 @@ var SmartyadsProvider = /*#__PURE__*/ function(ContentProvider) {
71453
71575
  });
71454
71576
  }).call(this);
71455
71577
  }
71578
+ },
71579
+ {
71580
+ key: "requestInstream",
71581
+ value: function requestInstream() {
71582
+ return _async_to_generator(function() {
71583
+ var params;
71584
+ var _arguments = arguments;
71585
+ return _ts_generator(this, function(_state) {
71586
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
71587
+ return [
71588
+ 2,
71589
+ Promise.resolve({})
71590
+ ];
71591
+ });
71592
+ }).apply(this, arguments);
71593
+ }
71456
71594
  }
71457
71595
  ]);
71458
71596
  return SmartyadsProvider;
@@ -71561,6 +71699,22 @@ var SmartyadsTagProvider = /*#__PURE__*/ function(ContentProvider) {
71561
71699
  });
71562
71700
  }).call(this);
71563
71701
  }
71702
+ },
71703
+ {
71704
+ key: "requestInstream",
71705
+ value: function requestInstream() {
71706
+ return _async_to_generator(function() {
71707
+ var params;
71708
+ var _arguments = arguments;
71709
+ return _ts_generator(this, function(_state) {
71710
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
71711
+ return [
71712
+ 2,
71713
+ Promise.resolve({})
71714
+ ];
71715
+ });
71716
+ }).apply(this, arguments);
71717
+ }
71564
71718
  }
71565
71719
  ]);
71566
71720
  return SmartyadsTagProvider;
@@ -71608,6 +71762,19 @@ var StaticImageProvider = /*#__PURE__*/ function(ContentProvider) {
71608
71762
  });
71609
71763
  })();
71610
71764
  }
71765
+ },
71766
+ {
71767
+ key: "requestInstream",
71768
+ value: function requestInstream() {
71769
+ return _async_to_generator(function() {
71770
+ return _ts_generator(this, function(_state) {
71771
+ return [
71772
+ 2,
71773
+ Promise.resolve({})
71774
+ ];
71775
+ });
71776
+ })();
71777
+ }
71611
71778
  }
71612
71779
  ]);
71613
71780
  return StaticImageProvider;
@@ -71821,6 +71988,19 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider) {
71821
71988
  });
71822
71989
  }).call(this);
71823
71990
  }
71991
+ },
71992
+ {
71993
+ key: "requestInstream",
71994
+ value: function requestInstream() {
71995
+ return _async_to_generator(function() {
71996
+ return _ts_generator(this, function(_state) {
71997
+ return [
71998
+ 2,
71999
+ Promise.resolve({})
72000
+ ];
72001
+ });
72002
+ })();
72003
+ }
71824
72004
  }
71825
72005
  ]);
71826
72006
  return AffiliateProvider;
@@ -71833,7 +72013,23 @@ var PrebidConfigBuilder = /*#__PURE__*/ function() {
71833
72013
  debug: false,
71834
72014
  priceGranularity: "high",
71835
72015
  enableSendAllBids: true,
71836
- enableTIDs: true
72016
+ enableTIDs: true,
72017
+ cache: {
72018
+ url: "https://afatv.com/cache",
72019
+ // still required by API; won't be used when useLocal is true
72020
+ useLocal: true
72021
+ },
72022
+ mediaTypePriceGranularity: {
72023
+ video: {
72024
+ buckets: [
72025
+ {
72026
+ min: 0,
72027
+ max: 100,
72028
+ increment: 0.1
72029
+ }
72030
+ ]
72031
+ }
72032
+ }
71837
72033
  };
71838
72034
  }
71839
72035
  _create_class(PrebidConfigBuilder, [
@@ -72378,6 +72574,22 @@ var PrebidjsProvider = /*#__PURE__*/ function(ContentProvider) {
72378
72574
  });
72379
72575
  }).call(this);
72380
72576
  }
72577
+ },
72578
+ {
72579
+ key: "requestInstream",
72580
+ value: function requestInstream() {
72581
+ return _async_to_generator(function() {
72582
+ var params;
72583
+ var _arguments = arguments;
72584
+ return _ts_generator(this, function(_state) {
72585
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
72586
+ return [
72587
+ 2,
72588
+ Promise.resolve({})
72589
+ ];
72590
+ });
72591
+ }).apply(this, arguments);
72592
+ }
72381
72593
  }
72382
72594
  ]);
72383
72595
  return PrebidjsProvider;
@@ -72694,96 +72906,169 @@ var PrebidGAM = /*#__PURE__*/ function() {
72694
72906
  }
72695
72907
  },
72696
72908
  {
72697
- key: "defineSlot",
72698
- value: function defineSlot(options, slotId, containerId, adType) {
72909
+ key: "defineBannerAdUnit",
72910
+ value: function defineBannerAdUnit(unitDefinition, containerId, options, adType) {
72699
72911
  var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
72700
- var _window_pbjs;
72701
- var gamNetworkId = _PrebidGAM.getProperGAMNetworkId(options);
72702
- var unitDefinition = options.units.find(function(unit) {
72703
- return unit.code === "".concat(slotId);
72704
- });
72705
- var sizes = [];
72706
- var mapping = void 0;
72707
- if (!unitDefinition) {
72708
- console.error("No unit definition found for slotId: ".concat(slotId));
72709
- return;
72710
- }
72711
- if (adType) {
72712
- sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
72713
- mapping = RegionDefinitions.mapping(adType);
72714
- } else {
72715
- var _unitDefinition_mediaTypes_banner;
72716
- sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
72717
- }
72718
- var targeting = void 0;
72719
- if (unitDefinition.zoneId && options.reviveId) {
72720
- targeting = {
72721
- brndts_rid: options.reviveId,
72722
- brndts_zid: unitDefinition.zoneId
72723
- };
72724
- }
72725
- GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), {
72726
- targeting: targeting,
72727
- mapping: mapping
72728
- });
72729
- if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
72730
- return "".concat(containerId) === "".concat(defUnit.code);
72731
- }))) {
72732
- var _window_pbjs_que, _window_pbjs1;
72733
- (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs1.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
72734
- var _window_pbjs;
72735
- if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
72736
- var adUnit = _object_spread_props(_object_spread({}, unitDefinition), {
72737
- mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
72738
- banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
72739
- sizes: sizes
72740
- })
72741
- }),
72742
- code: "".concat(containerId)
72743
- });
72744
- if (mapping) {
72745
- var mappedSizes = [];
72746
- var sortedBreakpoints = Object.keys(mapping).sort(function(a, b) {
72747
- return parseInt(RegionDefinitions.BREAKPOINTS[b], 10) - parseInt(RegionDefinitions.BREAKPOINTS[a], 10);
72748
- });
72749
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
72750
- try {
72751
- for(var _iterator = sortedBreakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
72752
- var bp = _step.value;
72753
- mappedSizes.push({
72754
- minViewPort: [
72755
- RegionDefinitions.BREAKPOINTS[bp],
72756
- 0
72757
- ],
72758
- sizes: mapping[bp]
72759
- });
72760
- }
72761
- } catch (err) {
72762
- _didIteratorError = true;
72763
- _iteratorError = err;
72764
- } finally{
72912
+ return new Promise(function(resolve) {
72913
+ var _window_pbjs;
72914
+ var sizes = [];
72915
+ var mapping = void 0;
72916
+ if (adType) {
72917
+ sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
72918
+ mapping = RegionDefinitions.mapping(adType);
72919
+ } else {
72920
+ var _unitDefinition_mediaTypes_banner;
72921
+ sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
72922
+ }
72923
+ var targeting = void 0;
72924
+ if (unitDefinition.zoneId && options.reviveId) {
72925
+ targeting = {
72926
+ brndts_rid: options.reviveId,
72927
+ brndts_zid: unitDefinition.zoneId
72928
+ };
72929
+ }
72930
+ var gamNetworkId = _PrebidGAM.getProperGAMNetworkId(options);
72931
+ GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), {
72932
+ targeting: targeting,
72933
+ mapping: mapping
72934
+ });
72935
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
72936
+ return "".concat(containerId) === "".concat(defUnit.code);
72937
+ });
72938
+ if (!existingSlot) {
72939
+ var _window_pbjs_que, _window_pbjs1;
72940
+ (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs1.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
72941
+ var _window_pbjs;
72942
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
72943
+ var adUnit = {
72944
+ code: "".concat(containerId),
72945
+ mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
72946
+ banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
72947
+ sizes: sizes
72948
+ })
72949
+ }),
72950
+ bids: unitDefinition.bids,
72951
+ schain: unitDefinition.schain
72952
+ };
72953
+ if (mapping) {
72954
+ var mappedSizes = [];
72955
+ var sortedBreakpoints = Object.keys(mapping).sort(function(a, b) {
72956
+ return parseInt(RegionDefinitions.BREAKPOINTS[b], 10) - parseInt(RegionDefinitions.BREAKPOINTS[a], 10);
72957
+ });
72958
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
72765
72959
  try {
72766
- if (!_iteratorNormalCompletion && _iterator.return != null) {
72767
- _iterator.return();
72960
+ for(var _iterator = sortedBreakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
72961
+ var bp = _step.value;
72962
+ mappedSizes.push({
72963
+ minViewPort: [
72964
+ RegionDefinitions.BREAKPOINTS[bp],
72965
+ 0
72966
+ ],
72967
+ sizes: mapping[bp]
72968
+ });
72768
72969
  }
72970
+ } catch (err) {
72971
+ _didIteratorError = true;
72972
+ _iteratorError = err;
72769
72973
  } finally{
72770
- if (_didIteratorError) {
72771
- throw _iteratorError;
72974
+ try {
72975
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
72976
+ _iterator.return();
72977
+ }
72978
+ } finally{
72979
+ if (_didIteratorError) {
72980
+ throw _iteratorError;
72981
+ }
72772
72982
  }
72773
72983
  }
72984
+ adUnit.mediaTypes.banner.sizeConfig = mappedSizes;
72985
+ } else {
72986
+ adUnit.mediaTypes.banner.sizes = sizes;
72774
72987
  }
72775
- adUnit.mediaTypes.banner.sizeConfig = mappedSizes;
72988
+ window.pbjs.addAdUnits([
72989
+ adUnit
72990
+ ]);
72991
+ resolve(adUnit);
72776
72992
  } else {
72777
- adUnit.mediaTypes.banner.sizes = sizes;
72993
+ console.error("addAdUnits is not a function.");
72994
+ resolve(void 0);
72778
72995
  }
72779
- window.pbjs.addAdUnits([
72780
- adUnit
72781
- ]);
72782
- } else {
72783
- console.error("addAdUnits is not a function.");
72996
+ });
72997
+ } else {
72998
+ resolve(existingSlot);
72999
+ }
73000
+ });
73001
+ }
73002
+ },
73003
+ {
73004
+ key: "defineVideoAdUnit",
73005
+ value: function defineVideoAdUnit(unitDefinition, containerId) {
73006
+ return new Promise(function(resolve) {
73007
+ var _window_pbjs;
73008
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73009
+ return "".concat(containerId) === "".concat(defUnit.code);
73010
+ });
73011
+ if (!existingSlot) {
73012
+ var _window_pbjs_que, _window_pbjs1;
73013
+ (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs1.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
73014
+ var _window_pbjs;
73015
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73016
+ var adUnit = {
73017
+ code: "".concat(containerId),
73018
+ mediaTypes: _object_spread({}, unitDefinition.mediaTypes),
73019
+ bids: unitDefinition.bids,
73020
+ schain: unitDefinition.schain
73021
+ };
73022
+ window.pbjs.addAdUnits([
73023
+ adUnit
73024
+ ]);
73025
+ resolve(adUnit);
73026
+ } else {
73027
+ console.error("addAdUnits is not a function.");
73028
+ resolve(void 0);
73029
+ }
73030
+ });
73031
+ } else {
73032
+ resolve(existingSlot);
73033
+ }
73034
+ });
73035
+ }
73036
+ },
73037
+ {
73038
+ key: "defineSlot",
73039
+ value: function defineSlot(options, slotId, containerId, adType) {
73040
+ var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
73041
+ return _async_to_generator(function() {
73042
+ var unitDefinition;
73043
+ return _ts_generator(this, function(_state) {
73044
+ unitDefinition = options.units.find(function(unit) {
73045
+ return unit.code === "".concat(slotId);
73046
+ });
73047
+ if (!unitDefinition) {
73048
+ console.error("No unit definition found for slotId: ".concat(slotId));
73049
+ return [
73050
+ 2,
73051
+ unitDefinition
73052
+ ];
73053
+ }
73054
+ if (unitDefinition.mediaTypes.video) {
73055
+ return [
73056
+ 2,
73057
+ _PrebidGAM.defineVideoAdUnit(unitDefinition, containerId)
73058
+ ];
73059
+ } else if (unitDefinition.mediaTypes.banner) {
73060
+ return [
73061
+ 2,
73062
+ _PrebidGAM.defineBannerAdUnit(unitDefinition, containerId, options, adType, adName)
73063
+ ];
72784
73064
  }
73065
+ console.warn("No supported mediaTypes found for unit: ".concat(slotId));
73066
+ return [
73067
+ 2,
73068
+ void 0
73069
+ ];
72785
73070
  });
72786
- }
73071
+ })();
72787
73072
  }
72788
73073
  },
72789
73074
  {
@@ -72825,6 +73110,40 @@ var PrebidGAM = /*#__PURE__*/ function() {
72825
73110
  });
72826
73111
  });
72827
73112
  }
73113
+ },
73114
+ {
73115
+ key: "requestInstream",
73116
+ value: function requestInstream(options, slotId, containerId, callback) {
73117
+ var _window_pbjs;
73118
+ var PREBID_TIMEOUT = 1e3;
73119
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.que.push(function() {
73120
+ var _window_pbjs;
73121
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.requestBids({
73122
+ adUnitCodes: [
73123
+ "".concat(containerId)
73124
+ ],
73125
+ timeout: PREBID_TIMEOUT,
73126
+ bidsBackHandler: function bidsBackHandler() {
73127
+ var _window_pbjs, _window_pbjs_adServers, _window_pbjs1;
73128
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73129
+ return "".concat(containerId) === "".concat(defUnit.code);
73130
+ });
73131
+ if (!existingSlot) {
73132
+ console.warn("No ad unit found for containerId: ".concat(containerId));
73133
+ return;
73134
+ }
73135
+ var gamNetworkId = _PrebidGAM.getProperGAMNetworkId(options);
73136
+ var vastTagUrl = (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_adServers = _window_pbjs1.adServers) === null || _window_pbjs_adServers === void 0 ? void 0 : _window_pbjs_adServers.dfp.buildVideoUrl({
73137
+ adUnit: existingSlot,
73138
+ params: {
73139
+ iu: "/".concat(gamNetworkId, "/").concat(existingSlot.gamAdUnit)
73140
+ }
73141
+ });
73142
+ callback(vastTagUrl);
73143
+ }
73144
+ });
73145
+ });
73146
+ }
72828
73147
  }
72829
73148
  ]);
72830
73149
  return _PrebidGAM;
@@ -72953,6 +73272,72 @@ var PrebidGAMProvider = /*#__PURE__*/ function(ContentProvider) {
72953
73272
  });
72954
73273
  }).call(this);
72955
73274
  }
73275
+ },
73276
+ {
73277
+ key: "requestInstream",
73278
+ value: function requestInstream(params) {
73279
+ return _async_to_generator(function() {
73280
+ var _this;
73281
+ return _ts_generator(this, function(_state) {
73282
+ _this = this;
73283
+ return [
73284
+ 2,
73285
+ new Promise(function(resolve) {
73286
+ return _async_to_generator(function() {
73287
+ var adSlotId, adSlot, result;
73288
+ return _ts_generator(this, function(_state) {
73289
+ switch(_state.label){
73290
+ case 0:
73291
+ adSlotId = params.adSlot;
73292
+ if (!adSlotId && params.roles && params.roles.length > 0) {
73293
+ adSlot = this.options.units.find(function(unit) {
73294
+ var _params_roles;
73295
+ return unit._brndts_role !== void 0 && ((_params_roles = params.roles) === null || _params_roles === void 0 ? void 0 : _params_roles.includes(unit._brndts_role));
73296
+ });
73297
+ adSlotId = adSlot === null || adSlot === void 0 ? void 0 : adSlot.code;
73298
+ }
73299
+ if (!adSlotId) {
73300
+ console.warn("No adSlot or roles provided for instream ad request.");
73301
+ resolve({});
73302
+ return [
73303
+ 2
73304
+ ];
73305
+ }
73306
+ return [
73307
+ 4,
73308
+ prebidGamReady2.promise
73309
+ ];
73310
+ case 1:
73311
+ _state.sent();
73312
+ return [
73313
+ 4,
73314
+ PrebidGAM.defineSlot(this.options, adSlotId, adSlotId)
73315
+ ];
73316
+ case 2:
73317
+ result = _state.sent();
73318
+ if (!result) {
73319
+ console.warn("No ad unit found for instream adSlot: ".concat(adSlotId));
73320
+ resolve({});
73321
+ return [
73322
+ 2
73323
+ ];
73324
+ }
73325
+ PrebidGAM.requestInstream(this.options, adSlotId, adSlotId, function(content) {
73326
+ resolve({
73327
+ vastTagUrl: content
73328
+ });
73329
+ });
73330
+ return [
73331
+ 2
73332
+ ];
73333
+ }
73334
+ });
73335
+ }).call(_this);
73336
+ })
73337
+ ];
73338
+ });
73339
+ }).call(this);
73340
+ }
72956
73341
  }
72957
73342
  ]);
72958
73343
  return PrebidGAMProvider;
@@ -73048,16 +73433,29 @@ var ReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73048
73433
  });
73049
73434
  }).call(this);
73050
73435
  }
73436
+ },
73437
+ {
73438
+ key: "requestInstream",
73439
+ value: function requestInstream() {
73440
+ return _async_to_generator(function() {
73441
+ return _ts_generator(this, function(_state) {
73442
+ return [
73443
+ 2,
73444
+ Promise.resolve({})
73445
+ ];
73446
+ });
73447
+ })();
73448
+ }
73051
73449
  }
73052
73450
  ]);
73053
73451
  return ReviveProvider;
73054
73452
  }(ContentProvider);
73055
73453
  // src/Ads/Providers/Prebidjs/PrebidReviveProvider.ts
73056
73454
  var PrebidRevive = /*#__PURE__*/ function() {
73057
- function PrebidRevive() {
73058
- _class_call_check(this, PrebidRevive);
73455
+ function _PrebidRevive() {
73456
+ _class_call_check(this, _PrebidRevive);
73059
73457
  }
73060
- _create_class(PrebidRevive, null, [
73458
+ _create_class(_PrebidRevive, null, [
73061
73459
  {
73062
73460
  key: "load",
73063
73461
  value: function load() {
@@ -73123,20 +73521,137 @@ var PrebidRevive = /*#__PURE__*/ function() {
73123
73521
  }
73124
73522
  },
73125
73523
  {
73126
- key: "defineSlots",
73127
- value: function defineSlots(options) {
73128
- var _window_pbjs_que, _window_pbjs;
73129
- (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
73524
+ key: "defineSlots",
73525
+ value: function defineSlots(options) {
73526
+ var _window_pbjs_que, _window_pbjs;
73527
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
73528
+ var _window_pbjs;
73529
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73530
+ window.pbjs.addAdUnits(options.units.filter(function(unit) {
73531
+ var _window_pbjs;
73532
+ return !((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
73533
+ return "".concat(unit.code) === "".concat(defUnit.code);
73534
+ }));
73535
+ }));
73536
+ } else {
73537
+ console.error("addAdUnits is not a function.");
73538
+ }
73539
+ });
73540
+ }
73541
+ },
73542
+ {
73543
+ key: "defineBannerAdUnit",
73544
+ value: function defineBannerAdUnit(unitDefinition, containerId, options, adType) {
73545
+ var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
73546
+ return new Promise(function(resolve) {
73547
+ var _window_pbjs;
73548
+ var sizes = [];
73549
+ var mapping = void 0;
73550
+ if (adType) {
73551
+ sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
73552
+ mapping = RegionDefinitions.mapping(adType);
73553
+ } else {
73554
+ var _unitDefinition_mediaTypes_banner;
73555
+ sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
73556
+ }
73557
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73558
+ return "".concat(containerId) === "".concat(defUnit.code);
73559
+ });
73560
+ if (!existingSlot) {
73561
+ var _window_pbjs_que, _window_pbjs1;
73562
+ (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs1.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
73563
+ var _window_pbjs;
73564
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73565
+ var adUnit = {
73566
+ code: "".concat(containerId),
73567
+ mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
73568
+ banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
73569
+ sizes: sizes
73570
+ })
73571
+ }),
73572
+ bids: unitDefinition.bids,
73573
+ schain: unitDefinition.schain
73574
+ };
73575
+ if (mapping) {
73576
+ var mappedSizes = [];
73577
+ var sortedBreakpoints = Object.keys(mapping).sort(function(a, b) {
73578
+ return parseInt(RegionDefinitions.BREAKPOINTS[b], 10) - parseInt(RegionDefinitions.BREAKPOINTS[a], 10);
73579
+ });
73580
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
73581
+ try {
73582
+ for(var _iterator = sortedBreakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
73583
+ var bp = _step.value;
73584
+ mappedSizes.push({
73585
+ minViewPort: [
73586
+ RegionDefinitions.BREAKPOINTS[bp],
73587
+ 0
73588
+ ],
73589
+ sizes: mapping[bp]
73590
+ });
73591
+ }
73592
+ } catch (err) {
73593
+ _didIteratorError = true;
73594
+ _iteratorError = err;
73595
+ } finally{
73596
+ try {
73597
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
73598
+ _iterator.return();
73599
+ }
73600
+ } finally{
73601
+ if (_didIteratorError) {
73602
+ throw _iteratorError;
73603
+ }
73604
+ }
73605
+ }
73606
+ adUnit.mediaTypes.banner.sizeConfig = mappedSizes;
73607
+ } else {
73608
+ adUnit.mediaTypes.banner.sizes = sizes;
73609
+ }
73610
+ window.pbjs.addAdUnits([
73611
+ adUnit
73612
+ ]);
73613
+ resolve(adUnit);
73614
+ } else {
73615
+ console.error("addAdUnits is not a function.");
73616
+ resolve(void 0);
73617
+ }
73618
+ });
73619
+ } else {
73620
+ resolve(existingSlot);
73621
+ }
73622
+ });
73623
+ }
73624
+ },
73625
+ {
73626
+ key: "defineVideoAdUnit",
73627
+ value: function defineVideoAdUnit(unitDefinition, containerId) {
73628
+ return new Promise(function(resolve) {
73130
73629
  var _window_pbjs;
73131
- if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73132
- window.pbjs.addAdUnits(options.units.filter(function(unit) {
73630
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73631
+ return "".concat(containerId) === "".concat(defUnit.code);
73632
+ });
73633
+ if (!existingSlot) {
73634
+ var _window_pbjs_que, _window_pbjs1;
73635
+ (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs1.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
73133
73636
  var _window_pbjs;
73134
- return !((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
73135
- return "".concat(unit.code) === "".concat(defUnit.code);
73136
- }));
73137
- }));
73637
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73638
+ var adUnit = {
73639
+ code: "".concat(containerId),
73640
+ mediaTypes: _object_spread({}, unitDefinition.mediaTypes),
73641
+ bids: unitDefinition.bids,
73642
+ schain: unitDefinition.schain
73643
+ };
73644
+ window.pbjs.addAdUnits([
73645
+ adUnit
73646
+ ]);
73647
+ resolve(adUnit);
73648
+ } else {
73649
+ console.error("addAdUnits is not a function.");
73650
+ resolve(void 0);
73651
+ }
73652
+ });
73138
73653
  } else {
73139
- console.error("addAdUnits is not a function.");
73654
+ resolve(existingSlot);
73140
73655
  }
73141
73656
  });
73142
73657
  }
@@ -73145,48 +73660,86 @@ var PrebidRevive = /*#__PURE__*/ function() {
73145
73660
  key: "defineSlot",
73146
73661
  value: function defineSlot(options, slotId, containerId, adType) {
73147
73662
  var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
73148
- var _window_pbjs;
73149
- var unitDefinition = options.units.find(function(unit) {
73150
- return unit.code === "".concat(slotId);
73151
- });
73152
- var sizes = [];
73153
- if (!unitDefinition) {
73154
- console.error("No unit definition found for slotId: ".concat(slotId));
73155
- return;
73156
- }
73157
- if (adType) {
73158
- sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
73159
- } else {
73160
- var _unitDefinition_mediaTypes_banner;
73161
- sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
73162
- }
73163
- if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
73164
- return "".concat(containerId) === "".concat(defUnit.code);
73165
- }))) {
73166
- var _window_pbjs_que, _window_pbjs1;
73167
- (_window_pbjs1 = window.pbjs) === null || _window_pbjs1 === void 0 ? void 0 : (_window_pbjs_que = _window_pbjs1.que) === null || _window_pbjs_que === void 0 ? void 0 : _window_pbjs_que.push(function() {
73168
- var _window_pbjs;
73169
- if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73170
- window.pbjs.addAdUnits([
73171
- _object_spread_props(_object_spread({}, unitDefinition), {
73172
- mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
73173
- banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
73174
- sizes: sizes
73175
- })
73176
- }),
73177
- code: "".concat(containerId)
73178
- })
73179
- ]);
73180
- } else {
73181
- console.error("addAdUnits is not a function.");
73663
+ return _async_to_generator(function() {
73664
+ var unitDefinition;
73665
+ return _ts_generator(this, function(_state) {
73666
+ unitDefinition = options.units.find(function(unit) {
73667
+ return unit.code === "".concat(slotId);
73668
+ });
73669
+ if (!unitDefinition) {
73670
+ console.error("No unit definition found for slotId: ".concat(slotId));
73671
+ return [
73672
+ 2,
73673
+ unitDefinition
73674
+ ];
73675
+ }
73676
+ if (unitDefinition.mediaTypes.video) {
73677
+ return [
73678
+ 2,
73679
+ _PrebidRevive.defineVideoAdUnit(unitDefinition, containerId)
73680
+ ];
73681
+ } else if (unitDefinition.mediaTypes.banner) {
73682
+ return [
73683
+ 2,
73684
+ _PrebidRevive.defineBannerAdUnit(unitDefinition, containerId, options, adType, adName)
73685
+ ];
73182
73686
  }
73687
+ console.warn("No supported mediaTypes found for unit: ".concat(slotId));
73688
+ return [
73689
+ 2,
73690
+ void 0
73691
+ ];
73183
73692
  });
73184
- }
73693
+ })();
73185
73694
  }
73186
73695
  },
73187
73696
  {
73188
73697
  key: "onSlotRenderEnded",
73189
- value: function onSlotRenderEnded(slotId, cb) {}
73698
+ value: // static defineSlot(
73699
+ // options: PrebidjsProviderOptions,
73700
+ // slotId: string,
73701
+ // containerId: string,
73702
+ // adType: Ads.AdSizeType,
73703
+ // adName: string = "banner",
73704
+ // ) {
73705
+ // // let gamNetworkId: string = PrebidGAM.getProperGAMNetworkId(options);
73706
+ // const unitDefinition = options.units.find((unit) => unit.code === `${slotId}`);
73707
+ // let sizes: [number, number][] = [];
73708
+ // if (!unitDefinition) {
73709
+ // console.error(`No unit definition found for slotId: ${slotId}`);
73710
+ // return;
73711
+ // }
73712
+ // if (adType) {
73713
+ // sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
73714
+ // } else {
73715
+ // sizes = unitDefinition.mediaTypes.banner?.sizes || [];
73716
+ // }
73717
+ // // GPT.defineSlot(`/${gamNetworkId}/${adName}`, [sizes[0] || []], `${containerId}`);
73718
+ // if (
73719
+ // !window.pbjs?.adUnits.some((defUnit) => `${containerId}` === `${defUnit.code}`)
73720
+ // ) {
73721
+ // window.pbjs?.que?.push(() => {
73722
+ // if (window.pbjs?.addAdUnits) {
73723
+ // window.pbjs.addAdUnits([
73724
+ // {
73725
+ // ...unitDefinition,
73726
+ // mediaTypes: {
73727
+ // ...(unitDefinition.mediaTypes || {}),
73728
+ // banner: {
73729
+ // ...(unitDefinition.mediaTypes.banner || {}),
73730
+ // sizes: sizes,
73731
+ // },
73732
+ // },
73733
+ // code: `${containerId}`,
73734
+ // },
73735
+ // ]);
73736
+ // } else {
73737
+ // console.error("addAdUnits is not a function.");
73738
+ // }
73739
+ // });
73740
+ // }
73741
+ // }
73742
+ function onSlotRenderEnded(slotId, cb) {}
73190
73743
  },
73191
73744
  {
73192
73745
  key: "start",
@@ -73237,9 +73790,65 @@ var PrebidRevive = /*#__PURE__*/ function() {
73237
73790
  });
73238
73791
  });
73239
73792
  }
73793
+ },
73794
+ {
73795
+ key: "requestInstream",
73796
+ value: function requestInstream(options, slotId, containerId, callback) {
73797
+ var _window_pbjs;
73798
+ var PREBID_TIMEOUT = 1e3;
73799
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.que.push(function() {
73800
+ var _window_pbjs;
73801
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.requestBids({
73802
+ adUnitCodes: [
73803
+ "".concat(containerId)
73804
+ ],
73805
+ timeout: PREBID_TIMEOUT,
73806
+ bidsBackHandler: function bidsBackHandler(bids) {
73807
+ var winners = Object.values(bids).reduce(function(acc, unit) {
73808
+ if (unit.bids) {
73809
+ var _acc;
73810
+ (_acc = acc).push.apply(_acc, _to_consumable_array(unit.bids));
73811
+ }
73812
+ return acc;
73813
+ }, []).sort(function(a, b) {
73814
+ return b.cpm - a.cpm;
73815
+ });
73816
+ if (winners.length > 0) {
73817
+ var winner = winners[0];
73818
+ var content = {
73819
+ asStr: winner.ad,
73820
+ content: [],
73821
+ extra: {
73822
+ region: winner.adUnitCode,
73823
+ sz: {
73824
+ w: winner.width,
73825
+ h: winner.height
73826
+ },
73827
+ cpm: winner.cpm
73828
+ }
73829
+ };
73830
+ if (winner.vastUrl) {
73831
+ callback(winner.vastUrl);
73832
+ return;
73833
+ }
73834
+ ;
73835
+ if (winner.vastXml) {
73836
+ callback(winner.vastXml);
73837
+ return;
73838
+ }
73839
+ ;
73840
+ }
73841
+ if (winners.length === 0) {
73842
+ callback(null);
73843
+ }
73844
+ callback(null);
73845
+ }
73846
+ });
73847
+ });
73848
+ }
73240
73849
  }
73241
73850
  ]);
73242
- return PrebidRevive;
73851
+ return _PrebidRevive;
73243
73852
  }();
73244
73853
  var prebidReviveConfig = false;
73245
73854
  var prebidReviveReady = new Awaitable(false);
@@ -73299,7 +73908,7 @@ var PrebidReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73299
73908
  key: "request",
73300
73909
  value: function request(params) {
73301
73910
  return _async_to_generator(function() {
73302
- var _this, adType, adName, regionId, regionInfo;
73911
+ var _this, adType, adName, regionId, regionInfo, result;
73303
73912
  return _ts_generator(this, function(_state) {
73304
73913
  switch(_state.label){
73305
73914
  case 0:
@@ -73335,7 +73944,19 @@ var PrebidReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73335
73944
  ];
73336
73945
  case 2:
73337
73946
  _state.sent();
73338
- PrebidRevive.defineSlot(this.options, regionId, this.workingSlotId, adType, adName);
73947
+ return [
73948
+ 4,
73949
+ PrebidRevive.defineSlot(this.options, regionId, this.workingSlotId, adType, adName)
73950
+ ];
73951
+ case 3:
73952
+ result = _state.sent();
73953
+ if (!result) {
73954
+ this.context.logger.warn("No ad unit found for regionId: ".concat(regionId));
73955
+ this.notify();
73956
+ return [
73957
+ 2
73958
+ ];
73959
+ }
73339
73960
  PrebidRevive.request(regionId, this.workingSlotId, function(content) {
73340
73961
  return _async_to_generator(function() {
73341
73962
  var content2;
@@ -73400,6 +74021,76 @@ var PrebidReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73400
74021
  });
73401
74022
  }).call(this);
73402
74023
  }
74024
+ },
74025
+ {
74026
+ key: "requestInstream",
74027
+ value: function requestInstream(params) {
74028
+ return _async_to_generator(function() {
74029
+ var _this;
74030
+ return _ts_generator(this, function(_state) {
74031
+ _this = this;
74032
+ return [
74033
+ 2,
74034
+ new Promise(function(resolve) {
74035
+ return _async_to_generator(function() {
74036
+ var adSlotId, adSlot, result;
74037
+ return _ts_generator(this, function(_state) {
74038
+ switch(_state.label){
74039
+ case 0:
74040
+ adSlotId = params.adSlot;
74041
+ if (!adSlotId && params.roles && params.roles.length > 0) {
74042
+ adSlot = this.options.units.find(function(unit) {
74043
+ var _params_roles;
74044
+ return unit._brndts_role !== void 0 && ((_params_roles = params.roles) === null || _params_roles === void 0 ? void 0 : _params_roles.includes(unit._brndts_role));
74045
+ });
74046
+ adSlotId = adSlot === null || adSlot === void 0 ? void 0 : adSlot.code;
74047
+ }
74048
+ if (!adSlotId) {
74049
+ console.warn("No adSlot or roles provided for instream ad request.");
74050
+ resolve({});
74051
+ return [
74052
+ 2
74053
+ ];
74054
+ }
74055
+ return [
74056
+ 4,
74057
+ prebidReviveReady.promise
74058
+ ];
74059
+ case 1:
74060
+ _state.sent();
74061
+ return [
74062
+ 4,
74063
+ PrebidRevive.defineSlot(this.options, adSlotId, adSlotId)
74064
+ ];
74065
+ case 2:
74066
+ result = _state.sent();
74067
+ if (!result) {
74068
+ console.warn("No ad unit found for instream adSlot: ".concat(adSlotId));
74069
+ resolve({});
74070
+ return [
74071
+ 2
74072
+ ];
74073
+ }
74074
+ PrebidRevive.requestInstream(this.options, adSlotId, adSlotId, function(content) {
74075
+ if (content === null) {
74076
+ resolve({});
74077
+ return;
74078
+ }
74079
+ resolve({
74080
+ vastTagUrl: content
74081
+ });
74082
+ });
74083
+ return [
74084
+ 2
74085
+ ];
74086
+ }
74087
+ });
74088
+ }).call(_this);
74089
+ })
74090
+ ];
74091
+ });
74092
+ }).call(this);
74093
+ }
73403
74094
  }
73404
74095
  ]);
73405
74096
  return PrebidReviveProvider;
@@ -73452,6 +74143,22 @@ var GPTProvider = /*#__PURE__*/ function(ContentProvider) {
73452
74143
  });
73453
74144
  }).call(this);
73454
74145
  }
74146
+ },
74147
+ {
74148
+ key: "requestInstream",
74149
+ value: function requestInstream() {
74150
+ return _async_to_generator(function() {
74151
+ var params;
74152
+ var _arguments = arguments;
74153
+ return _ts_generator(this, function(_state) {
74154
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
74155
+ return [
74156
+ 2,
74157
+ Promise.resolve({})
74158
+ ];
74159
+ });
74160
+ }).apply(this, arguments);
74161
+ }
73455
74162
  }
73456
74163
  ]);
73457
74164
  return GPTProvider;
@@ -73525,6 +74232,22 @@ var DebugProvider = /*#__PURE__*/ function(ContentProvider) {
73525
74232
  });
73526
74233
  }).call(this);
73527
74234
  }
74235
+ },
74236
+ {
74237
+ key: "requestInstream",
74238
+ value: function requestInstream() {
74239
+ return _async_to_generator(function() {
74240
+ var params;
74241
+ var _arguments = arguments;
74242
+ return _ts_generator(this, function(_state) {
74243
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
74244
+ return [
74245
+ 2,
74246
+ Promise.resolve({})
74247
+ ];
74248
+ });
74249
+ }).apply(this, arguments);
74250
+ }
73528
74251
  }
73529
74252
  ]);
73530
74253
  return DebugProvider;
@@ -79548,9 +80271,7 @@ var AuxElementsRenderer = /*#__PURE__*/ function() {
79548
80271
  }, {
79549
80272
  width: this.regionsContainerView.width,
79550
80273
  height: this.regionsContainerView.height
79551
- }, {}, {
79552
- provider: ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider)
79553
- });
80274
+ }, {}, {});
79554
80275
  this.auxElementsData.push({
79555
80276
  box: {
79556
80277
  x1: 0,
@@ -84212,6 +84933,7 @@ var ControlTopBar = /*#__PURE__*/ function() {
84212
84933
  });
84213
84934
  this.context.store.subscribe(this.handleStateChange.bind(this));
84214
84935
  if ((_this_context_config_get = this.context.config.get("controls")) === null || _this_context_config_get === void 0 ? void 0 : (_this_context_config_get_elements = _this_context_config_get.elements) === null || _this_context_config_get_elements === void 0 ? void 0 : _this_context_config_get_elements.progress_ind) {
84936
+ var _this_context_data, _this_context_media;
84215
84937
  var ind = new ProgressBanner({
84216
84938
  indicators: [
84217
84939
  {
@@ -84224,10 +84946,10 @@ var ControlTopBar = /*#__PURE__*/ function() {
84224
84946
  }
84225
84947
  ]
84226
84948
  });
84227
- this.context.data.on("UPDATE", function() {
84949
+ (_this_context_data = this.context.data) === null || _this_context_data === void 0 ? void 0 : _this_context_data.on("UPDATE", function() {
84228
84950
  ind.setValue("BRNDTS_LOADING", _this.context.data.progress());
84229
84951
  });
84230
- this.context.media.on("TIME_UPDATE", function(param) {
84952
+ (_this_context_media = this.context.media) === null || _this_context_media === void 0 ? void 0 : _this_context_media.on("TIME_UPDATE", function(param) {
84231
84953
  var time = param.time, duration = param.duration;
84232
84954
  ind.setValue("PLAYER_TIME", time / duration * 100);
84233
84955
  });
@@ -85670,6 +86392,64 @@ var VideoAds = /*#__PURE__*/ function() {
85670
86392
  return entry.inst;
85671
86393
  }
85672
86394
  },
86395
+ {
86396
+ key: "getDetachedInstreamAds",
86397
+ value: function getDetachedInstreamAds() {
86398
+ return _async_to_generator(function() {
86399
+ var provider, instreamInfo, e2;
86400
+ return _ts_generator(this, function(_state) {
86401
+ switch(_state.label){
86402
+ case 0:
86403
+ provider = ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider);
86404
+ _state.label = 1;
86405
+ case 1:
86406
+ _state.trys.push([
86407
+ 1,
86408
+ 3,
86409
+ ,
86410
+ 4
86411
+ ]);
86412
+ return [
86413
+ 4,
86414
+ provider.requestInstream({
86415
+ roles: [
86416
+ "pre-roll"
86417
+ ]
86418
+ })
86419
+ ];
86420
+ case 2:
86421
+ instreamInfo = _state.sent();
86422
+ if (!instreamInfo.vastTagUrl) {
86423
+ return [
86424
+ 2,
86425
+ []
86426
+ ];
86427
+ }
86428
+ return [
86429
+ 2,
86430
+ [
86431
+ {
86432
+ timeOffset: "00:00:00",
86433
+ vast: instreamInfo.vastTagUrl
86434
+ }
86435
+ ]
86436
+ ];
86437
+ case 3:
86438
+ e2 = _state.sent();
86439
+ ErrorHandler.handle(e2);
86440
+ return [
86441
+ 2,
86442
+ []
86443
+ ];
86444
+ case 4:
86445
+ return [
86446
+ 2
86447
+ ];
86448
+ }
86449
+ });
86450
+ }).call(this);
86451
+ }
86452
+ },
85673
86453
  {
85674
86454
  key: "destroy",
85675
86455
  value: function destroy() {
@@ -85723,6 +86503,12 @@ var Ads = /*#__PURE__*/ function() {
85723
86503
  });
85724
86504
  }
85725
86505
  },
86506
+ {
86507
+ key: "getDetachedInstreamAds",
86508
+ value: function getDetachedInstreamAds() {
86509
+ return this.videoAds.getDetachedInstreamAds();
86510
+ }
86511
+ },
85726
86512
  {
85727
86513
  key: "updateSize",
85728
86514
  value: function updateSize() {
@@ -90304,10 +91090,17 @@ var BrndtsAds = /*#__PURE__*/ function() {
90304
91090
  {
90305
91091
  key: "handleConnected",
90306
91092
  value: function handleConnected() {
90307
- this.ready.resolve(true);
90308
- this.context.logger.log("connected to service");
90309
- this.context.ads = new Ads_default(this.context);
90310
- this.context.ads.start();
91093
+ return _async_to_generator(function() {
91094
+ return _ts_generator(this, function(_state) {
91095
+ this.context.logger.log("connected to service");
91096
+ this.context.ads = new Ads_default(this.context);
91097
+ this.context.ads.start();
91098
+ this.ready.resolve(true);
91099
+ return [
91100
+ 2
91101
+ ];
91102
+ });
91103
+ }).call(this);
90311
91104
  }
90312
91105
  },
90313
91106
  {
@@ -90355,6 +91148,16 @@ var BrndtsAds = /*#__PURE__*/ function() {
90355
91148
  this.context.config.set("controls", controlsConfig);
90356
91149
  }
90357
91150
  },
91151
+ {
91152
+ key: "getDetachedInstreamAds",
91153
+ value: function getDetachedInstreamAds() {
91154
+ if (!this.ready.value || this.context.ads === void 0) {
91155
+ console.warn("Ads not ready yet!");
91156
+ return Promise.resolve([]);
91157
+ }
91158
+ return this.context.ads.getDetachedInstreamAds();
91159
+ }
91160
+ },
90358
91161
  {
90359
91162
  key: "rewind",
90360
91163
  value: function rewind(value2) {
@@ -90386,7 +91189,9 @@ var BrndtsAds = /*#__PURE__*/ function() {
90386
91189
  }
90387
91190
  ]);
90388
91191
  return BrndtsAds;
90389
- }(); /*! Bundled license information:
91192
+ }(); //! TEST
91193
+ //!
91194
+ /*! Bundled license information:
90390
91195
 
90391
91196
  @fortawesome/fontawesome-svg-core/index.mjs:
90392
91197
  @fortawesome/free-solid-svg-icons/index.mjs: