@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.mjs CHANGED
@@ -68118,10 +68118,90 @@ var BASIC_SUPPORT = {
68118
68118
  audio: "canPlayType" in document.createElement("audio"),
68119
68119
  video: "canPlayType" in document.createElement("video")
68120
68120
  };
68121
+ function detectAdblock() {
68122
+ var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_timeoutMs = _ref.timeoutMs, timeoutMs = _ref_timeoutMs === void 0 ? 1500 : _ref_timeoutMs;
68123
+ return new Promise(function(resolve) {
68124
+ var maybeResolve = function maybeResolve() {
68125
+ requestAnimationFrame(function() {
68126
+ checkCSS();
68127
+ var signals = (cssHit ? 1 : 0) + (netHit ? 1 : 0) + (scriptHit ? 1 : 0);
68128
+ if (signals >= 2 || scriptLoaded && (cssHit || netHit)) {
68129
+ done(true);
68130
+ }
68131
+ });
68132
+ };
68133
+ var cleanup = function cleanup() {
68134
+ clearTimeout(t2);
68135
+ try {
68136
+ bait.remove();
68137
+ } catch (e) {}
68138
+ try {
68139
+ s2.remove();
68140
+ } catch (e) {}
68141
+ img.src = "";
68142
+ };
68143
+ var resolved = false;
68144
+ var done = function(v) {
68145
+ if (!resolved) {
68146
+ resolved = true;
68147
+ cleanup();
68148
+ resolve(v);
68149
+ }
68150
+ };
68151
+ var bait = document.createElement("div");
68152
+ bait.className = "ads ad ad-banner ad-unit adzone adsbox pub_300x250";
68153
+ bait.style.cssText = "position:absolute;left:-9999px;width:300px;height:250px;pointer-events:none;";
68154
+ document.addEventListener("DOMContentLoaded", function() {
68155
+ return document.body.appendChild(bait);
68156
+ });
68157
+ var cssHit = false;
68158
+ var checkCSS = function() {
68159
+ if (!bait.isConnected) {
68160
+ cssHit = true;
68161
+ return;
68162
+ }
68163
+ var cs = getComputedStyle(bait);
68164
+ var hidden = cs.display === "none" || cs.visibility === "hidden" || parseInt(cs.height || "0", 10) === 0 || bait.offsetParent === null;
68165
+ if (hidden) cssHit = true;
68166
+ };
68167
+ var img = new Image();
68168
+ var netHit = false;
68169
+ img.onload = function() {};
68170
+ img.onerror = function() {
68171
+ netHit = true;
68172
+ maybeResolve();
68173
+ };
68174
+ img.src = "/ads/px.gif?cb=".concat(Date.now());
68175
+ var s2 = document.createElement("script");
68176
+ var scriptHit = false;
68177
+ var scriptLoaded = false;
68178
+ window.__ab_allow = void 0;
68179
+ s2.async = true;
68180
+ s2.src = "/ads/allow.js?cb=".concat(Date.now());
68181
+ s2.onload = function() {
68182
+ scriptLoaded = true;
68183
+ if (window.__ab_allow !== true) {
68184
+ scriptHit = true;
68185
+ }
68186
+ maybeResolve();
68187
+ };
68188
+ s2.onerror = function() {
68189
+ scriptHit = true;
68190
+ maybeResolve();
68191
+ };
68192
+ document.head.appendChild(s2);
68193
+ var t2 = setTimeout(function() {
68194
+ checkCSS();
68195
+ var blocked = cssHit || netHit || scriptHit;
68196
+ done(blocked);
68197
+ }, timeoutMs);
68198
+ });
68199
+ }
68121
68200
  var Support = /*#__PURE__*/ function() {
68122
68201
  "use strict";
68123
68202
  function _Support(type, provider) {
68124
68203
  _class_call_check(this, _Support);
68204
+ this.supportAds = null;
68125
68205
  this.api = type && BASIC_SUPPORT[type] || provider !== "html5";
68126
68206
  this.ui = this.api && _Support.rangeInput;
68127
68207
  }
@@ -68170,6 +68250,35 @@ var Support = /*#__PURE__*/ function() {
68170
68250
  ui: ui
68171
68251
  };
68172
68252
  }
68253
+ },
68254
+ {
68255
+ key: "ads",
68256
+ value: function ads() {
68257
+ return _async_to_generator(function() {
68258
+ var _;
68259
+ return _ts_generator(this, function(_state) {
68260
+ switch(_state.label){
68261
+ case 0:
68262
+ if (this.supportAds !== null) {
68263
+ this.supportAds;
68264
+ }
68265
+ _ = this;
68266
+ return [
68267
+ 4,
68268
+ detectAdblock().then(function(blocked) {
68269
+ return !blocked;
68270
+ })
68271
+ ];
68272
+ case 1:
68273
+ _.supportAds = _state.sent();
68274
+ return [
68275
+ 2,
68276
+ !!this.supportAds
68277
+ ];
68278
+ }
68279
+ });
68280
+ }).call(this);
68281
+ }
68173
68282
  }
68174
68283
  ], [
68175
68284
  {
@@ -71233,6 +71342,19 @@ var BRNDTSDefaultProvider = /*#__PURE__*/ function(ContentProvider) {
71233
71342
  });
71234
71343
  }).call(this);
71235
71344
  }
71345
+ },
71346
+ {
71347
+ key: "requestInstream",
71348
+ value: function requestInstream() {
71349
+ return _async_to_generator(function() {
71350
+ return _ts_generator(this, function(_state) {
71351
+ return [
71352
+ 2,
71353
+ Promise.resolve({})
71354
+ ];
71355
+ });
71356
+ })();
71357
+ }
71236
71358
  }
71237
71359
  ]);
71238
71360
  return BRNDTSDefaultProvider;
@@ -71513,6 +71635,22 @@ var SmartyadsProvider = /*#__PURE__*/ function(ContentProvider) {
71513
71635
  });
71514
71636
  }).call(this);
71515
71637
  }
71638
+ },
71639
+ {
71640
+ key: "requestInstream",
71641
+ value: function requestInstream() {
71642
+ return _async_to_generator(function() {
71643
+ var params;
71644
+ var _arguments = arguments;
71645
+ return _ts_generator(this, function(_state) {
71646
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
71647
+ return [
71648
+ 2,
71649
+ Promise.resolve({})
71650
+ ];
71651
+ });
71652
+ }).apply(this, arguments);
71653
+ }
71516
71654
  }
71517
71655
  ]);
71518
71656
  return SmartyadsProvider;
@@ -71622,6 +71760,22 @@ var SmartyadsTagProvider = /*#__PURE__*/ function(ContentProvider) {
71622
71760
  });
71623
71761
  }).call(this);
71624
71762
  }
71763
+ },
71764
+ {
71765
+ key: "requestInstream",
71766
+ value: function requestInstream() {
71767
+ return _async_to_generator(function() {
71768
+ var params;
71769
+ var _arguments = arguments;
71770
+ return _ts_generator(this, function(_state) {
71771
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
71772
+ return [
71773
+ 2,
71774
+ Promise.resolve({})
71775
+ ];
71776
+ });
71777
+ }).apply(this, arguments);
71778
+ }
71625
71779
  }
71626
71780
  ]);
71627
71781
  return SmartyadsTagProvider;
@@ -71670,6 +71824,19 @@ var StaticImageProvider = /*#__PURE__*/ function(ContentProvider) {
71670
71824
  });
71671
71825
  })();
71672
71826
  }
71827
+ },
71828
+ {
71829
+ key: "requestInstream",
71830
+ value: function requestInstream() {
71831
+ return _async_to_generator(function() {
71832
+ return _ts_generator(this, function(_state) {
71833
+ return [
71834
+ 2,
71835
+ Promise.resolve({})
71836
+ ];
71837
+ });
71838
+ })();
71839
+ }
71673
71840
  }
71674
71841
  ]);
71675
71842
  return StaticImageProvider;
@@ -71885,6 +72052,19 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider) {
71885
72052
  });
71886
72053
  }).call(this);
71887
72054
  }
72055
+ },
72056
+ {
72057
+ key: "requestInstream",
72058
+ value: function requestInstream() {
72059
+ return _async_to_generator(function() {
72060
+ return _ts_generator(this, function(_state) {
72061
+ return [
72062
+ 2,
72063
+ Promise.resolve({})
72064
+ ];
72065
+ });
72066
+ })();
72067
+ }
71888
72068
  }
71889
72069
  ]);
71890
72070
  return AffiliateProvider;
@@ -71898,7 +72078,23 @@ var PrebidConfigBuilder = /*#__PURE__*/ function() {
71898
72078
  debug: false,
71899
72079
  priceGranularity: "high",
71900
72080
  enableSendAllBids: true,
71901
- enableTIDs: true
72081
+ enableTIDs: true,
72082
+ cache: {
72083
+ url: "https://afatv.com/cache",
72084
+ // still required by API; won't be used when useLocal is true
72085
+ useLocal: true
72086
+ },
72087
+ mediaTypePriceGranularity: {
72088
+ video: {
72089
+ buckets: [
72090
+ {
72091
+ min: 0,
72092
+ max: 100,
72093
+ increment: 0.1
72094
+ }
72095
+ ]
72096
+ }
72097
+ }
71902
72098
  };
71903
72099
  }
71904
72100
  _create_class(PrebidConfigBuilder, [
@@ -72445,6 +72641,22 @@ var PrebidjsProvider = /*#__PURE__*/ function(ContentProvider) {
72445
72641
  });
72446
72642
  }).call(this);
72447
72643
  }
72644
+ },
72645
+ {
72646
+ key: "requestInstream",
72647
+ value: function requestInstream() {
72648
+ return _async_to_generator(function() {
72649
+ var params;
72650
+ var _arguments = arguments;
72651
+ return _ts_generator(this, function(_state) {
72652
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
72653
+ return [
72654
+ 2,
72655
+ Promise.resolve({})
72656
+ ];
72657
+ });
72658
+ }).apply(this, arguments);
72659
+ }
72448
72660
  }
72449
72661
  ]);
72450
72662
  return PrebidjsProvider;
@@ -72765,96 +72977,169 @@ var PrebidGAM = /*#__PURE__*/ function() {
72765
72977
  }
72766
72978
  },
72767
72979
  {
72768
- key: "defineSlot",
72769
- value: function defineSlot(options, slotId, containerId, adType) {
72980
+ key: "defineBannerAdUnit",
72981
+ value: function defineBannerAdUnit(unitDefinition, containerId, options, adType) {
72770
72982
  var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
72771
- var _window_pbjs;
72772
- var gamNetworkId = _PrebidGAM.getProperGAMNetworkId(options);
72773
- var unitDefinition = options.units.find(function(unit) {
72774
- return unit.code === "".concat(slotId);
72775
- });
72776
- var sizes = [];
72777
- var mapping = void 0;
72778
- if (!unitDefinition) {
72779
- console.error("No unit definition found for slotId: ".concat(slotId));
72780
- return;
72781
- }
72782
- if (adType) {
72783
- sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
72784
- mapping = RegionDefinitions.mapping(adType);
72785
- } else {
72786
- var _unitDefinition_mediaTypes_banner;
72787
- sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
72788
- }
72789
- var targeting = void 0;
72790
- if (unitDefinition.zoneId && options.reviveId) {
72791
- targeting = {
72792
- brndts_rid: options.reviveId,
72793
- brndts_zid: unitDefinition.zoneId
72794
- };
72795
- }
72796
- GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), {
72797
- targeting: targeting,
72798
- mapping: mapping
72799
- });
72800
- if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
72801
- return "".concat(containerId) === "".concat(defUnit.code);
72802
- }))) {
72803
- var _window_pbjs_que, _window_pbjs1;
72804
- (_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() {
72805
- var _window_pbjs;
72806
- if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
72807
- var adUnit = _object_spread_props(_object_spread({}, unitDefinition), {
72808
- mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
72809
- banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
72810
- sizes: sizes
72811
- })
72812
- }),
72813
- code: "".concat(containerId)
72814
- });
72815
- if (mapping) {
72816
- var mappedSizes = [];
72817
- var sortedBreakpoints = Object.keys(mapping).sort(function(a, b) {
72818
- return parseInt(RegionDefinitions.BREAKPOINTS[b], 10) - parseInt(RegionDefinitions.BREAKPOINTS[a], 10);
72819
- });
72820
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
72821
- try {
72822
- for(var _iterator = sortedBreakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
72823
- var bp = _step.value;
72824
- mappedSizes.push({
72825
- minViewPort: [
72826
- RegionDefinitions.BREAKPOINTS[bp],
72827
- 0
72828
- ],
72829
- sizes: mapping[bp]
72830
- });
72831
- }
72832
- } catch (err) {
72833
- _didIteratorError = true;
72834
- _iteratorError = err;
72835
- } finally{
72983
+ return new Promise(function(resolve) {
72984
+ var _window_pbjs;
72985
+ var sizes = [];
72986
+ var mapping = void 0;
72987
+ if (adType) {
72988
+ sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
72989
+ mapping = RegionDefinitions.mapping(adType);
72990
+ } else {
72991
+ var _unitDefinition_mediaTypes_banner;
72992
+ sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
72993
+ }
72994
+ var targeting = void 0;
72995
+ if (unitDefinition.zoneId && options.reviveId) {
72996
+ targeting = {
72997
+ brndts_rid: options.reviveId,
72998
+ brndts_zid: unitDefinition.zoneId
72999
+ };
73000
+ }
73001
+ var gamNetworkId = _PrebidGAM.getProperGAMNetworkId(options);
73002
+ GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), {
73003
+ targeting: targeting,
73004
+ mapping: mapping
73005
+ });
73006
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73007
+ return "".concat(containerId) === "".concat(defUnit.code);
73008
+ });
73009
+ if (!existingSlot) {
73010
+ var _window_pbjs_que, _window_pbjs1;
73011
+ (_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() {
73012
+ var _window_pbjs;
73013
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73014
+ var adUnit = {
73015
+ code: "".concat(containerId),
73016
+ mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
73017
+ banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
73018
+ sizes: sizes
73019
+ })
73020
+ }),
73021
+ bids: unitDefinition.bids,
73022
+ schain: unitDefinition.schain
73023
+ };
73024
+ if (mapping) {
73025
+ var mappedSizes = [];
73026
+ var sortedBreakpoints = Object.keys(mapping).sort(function(a, b) {
73027
+ return parseInt(RegionDefinitions.BREAKPOINTS[b], 10) - parseInt(RegionDefinitions.BREAKPOINTS[a], 10);
73028
+ });
73029
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
72836
73030
  try {
72837
- if (!_iteratorNormalCompletion && _iterator.return != null) {
72838
- _iterator.return();
73031
+ for(var _iterator = sortedBreakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
73032
+ var bp = _step.value;
73033
+ mappedSizes.push({
73034
+ minViewPort: [
73035
+ RegionDefinitions.BREAKPOINTS[bp],
73036
+ 0
73037
+ ],
73038
+ sizes: mapping[bp]
73039
+ });
72839
73040
  }
73041
+ } catch (err) {
73042
+ _didIteratorError = true;
73043
+ _iteratorError = err;
72840
73044
  } finally{
72841
- if (_didIteratorError) {
72842
- throw _iteratorError;
73045
+ try {
73046
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
73047
+ _iterator.return();
73048
+ }
73049
+ } finally{
73050
+ if (_didIteratorError) {
73051
+ throw _iteratorError;
73052
+ }
72843
73053
  }
72844
73054
  }
73055
+ adUnit.mediaTypes.banner.sizeConfig = mappedSizes;
73056
+ } else {
73057
+ adUnit.mediaTypes.banner.sizes = sizes;
72845
73058
  }
72846
- adUnit.mediaTypes.banner.sizeConfig = mappedSizes;
73059
+ window.pbjs.addAdUnits([
73060
+ adUnit
73061
+ ]);
73062
+ resolve(adUnit);
72847
73063
  } else {
72848
- adUnit.mediaTypes.banner.sizes = sizes;
73064
+ console.error("addAdUnits is not a function.");
73065
+ resolve(void 0);
72849
73066
  }
72850
- window.pbjs.addAdUnits([
72851
- adUnit
72852
- ]);
72853
- } else {
72854
- console.error("addAdUnits is not a function.");
73067
+ });
73068
+ } else {
73069
+ resolve(existingSlot);
73070
+ }
73071
+ });
73072
+ }
73073
+ },
73074
+ {
73075
+ key: "defineVideoAdUnit",
73076
+ value: function defineVideoAdUnit(unitDefinition, containerId) {
73077
+ return new Promise(function(resolve) {
73078
+ var _window_pbjs;
73079
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73080
+ return "".concat(containerId) === "".concat(defUnit.code);
73081
+ });
73082
+ if (!existingSlot) {
73083
+ var _window_pbjs_que, _window_pbjs1;
73084
+ (_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() {
73085
+ var _window_pbjs;
73086
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73087
+ var adUnit = {
73088
+ code: "".concat(containerId),
73089
+ mediaTypes: _object_spread({}, unitDefinition.mediaTypes),
73090
+ bids: unitDefinition.bids,
73091
+ schain: unitDefinition.schain
73092
+ };
73093
+ window.pbjs.addAdUnits([
73094
+ adUnit
73095
+ ]);
73096
+ resolve(adUnit);
73097
+ } else {
73098
+ console.error("addAdUnits is not a function.");
73099
+ resolve(void 0);
73100
+ }
73101
+ });
73102
+ } else {
73103
+ resolve(existingSlot);
73104
+ }
73105
+ });
73106
+ }
73107
+ },
73108
+ {
73109
+ key: "defineSlot",
73110
+ value: function defineSlot(options, slotId, containerId, adType) {
73111
+ var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
73112
+ return _async_to_generator(function() {
73113
+ var unitDefinition;
73114
+ return _ts_generator(this, function(_state) {
73115
+ unitDefinition = options.units.find(function(unit) {
73116
+ return unit.code === "".concat(slotId);
73117
+ });
73118
+ if (!unitDefinition) {
73119
+ console.error("No unit definition found for slotId: ".concat(slotId));
73120
+ return [
73121
+ 2,
73122
+ unitDefinition
73123
+ ];
73124
+ }
73125
+ if (unitDefinition.mediaTypes.video) {
73126
+ return [
73127
+ 2,
73128
+ _PrebidGAM.defineVideoAdUnit(unitDefinition, containerId)
73129
+ ];
73130
+ } else if (unitDefinition.mediaTypes.banner) {
73131
+ return [
73132
+ 2,
73133
+ _PrebidGAM.defineBannerAdUnit(unitDefinition, containerId, options, adType, adName)
73134
+ ];
72855
73135
  }
73136
+ console.warn("No supported mediaTypes found for unit: ".concat(slotId));
73137
+ return [
73138
+ 2,
73139
+ void 0
73140
+ ];
72856
73141
  });
72857
- }
73142
+ })();
72858
73143
  }
72859
73144
  },
72860
73145
  {
@@ -72896,6 +73181,40 @@ var PrebidGAM = /*#__PURE__*/ function() {
72896
73181
  });
72897
73182
  });
72898
73183
  }
73184
+ },
73185
+ {
73186
+ key: "requestInstream",
73187
+ value: function requestInstream(options, slotId, containerId, callback) {
73188
+ var _window_pbjs;
73189
+ var PREBID_TIMEOUT = 1e3;
73190
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.que.push(function() {
73191
+ var _window_pbjs;
73192
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.requestBids({
73193
+ adUnitCodes: [
73194
+ "".concat(containerId)
73195
+ ],
73196
+ timeout: PREBID_TIMEOUT,
73197
+ bidsBackHandler: function bidsBackHandler() {
73198
+ var _window_pbjs, _window_pbjs_adServers, _window_pbjs1;
73199
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73200
+ return "".concat(containerId) === "".concat(defUnit.code);
73201
+ });
73202
+ if (!existingSlot) {
73203
+ console.warn("No ad unit found for containerId: ".concat(containerId));
73204
+ return;
73205
+ }
73206
+ var gamNetworkId = _PrebidGAM.getProperGAMNetworkId(options);
73207
+ 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({
73208
+ adUnit: existingSlot,
73209
+ params: {
73210
+ iu: "/".concat(gamNetworkId, "/").concat(existingSlot.gamAdUnit)
73211
+ }
73212
+ });
73213
+ callback(vastTagUrl);
73214
+ }
73215
+ });
73216
+ });
73217
+ }
72899
73218
  }
72900
73219
  ]);
72901
73220
  return _PrebidGAM;
@@ -73025,6 +73344,72 @@ var PrebidGAMProvider = /*#__PURE__*/ function(ContentProvider) {
73025
73344
  });
73026
73345
  }).call(this);
73027
73346
  }
73347
+ },
73348
+ {
73349
+ key: "requestInstream",
73350
+ value: function requestInstream(params) {
73351
+ return _async_to_generator(function() {
73352
+ var _this;
73353
+ return _ts_generator(this, function(_state) {
73354
+ _this = this;
73355
+ return [
73356
+ 2,
73357
+ new Promise(function(resolve) {
73358
+ return _async_to_generator(function() {
73359
+ var adSlotId, adSlot, result;
73360
+ return _ts_generator(this, function(_state) {
73361
+ switch(_state.label){
73362
+ case 0:
73363
+ adSlotId = params.adSlot;
73364
+ if (!adSlotId && params.roles && params.roles.length > 0) {
73365
+ adSlot = this.options.units.find(function(unit) {
73366
+ var _params_roles;
73367
+ return unit._brndts_role !== void 0 && ((_params_roles = params.roles) === null || _params_roles === void 0 ? void 0 : _params_roles.includes(unit._brndts_role));
73368
+ });
73369
+ adSlotId = adSlot === null || adSlot === void 0 ? void 0 : adSlot.code;
73370
+ }
73371
+ if (!adSlotId) {
73372
+ console.warn("No adSlot or roles provided for instream ad request.");
73373
+ resolve({});
73374
+ return [
73375
+ 2
73376
+ ];
73377
+ }
73378
+ return [
73379
+ 4,
73380
+ prebidGamReady2.promise
73381
+ ];
73382
+ case 1:
73383
+ _state.sent();
73384
+ return [
73385
+ 4,
73386
+ PrebidGAM.defineSlot(this.options, adSlotId, adSlotId)
73387
+ ];
73388
+ case 2:
73389
+ result = _state.sent();
73390
+ if (!result) {
73391
+ console.warn("No ad unit found for instream adSlot: ".concat(adSlotId));
73392
+ resolve({});
73393
+ return [
73394
+ 2
73395
+ ];
73396
+ }
73397
+ PrebidGAM.requestInstream(this.options, adSlotId, adSlotId, function(content) {
73398
+ resolve({
73399
+ vastTagUrl: content
73400
+ });
73401
+ });
73402
+ return [
73403
+ 2
73404
+ ];
73405
+ }
73406
+ });
73407
+ }).call(_this);
73408
+ })
73409
+ ];
73410
+ });
73411
+ }).call(this);
73412
+ }
73028
73413
  }
73029
73414
  ]);
73030
73415
  return PrebidGAMProvider;
@@ -73121,6 +73506,19 @@ var ReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73121
73506
  });
73122
73507
  }).call(this);
73123
73508
  }
73509
+ },
73510
+ {
73511
+ key: "requestInstream",
73512
+ value: function requestInstream() {
73513
+ return _async_to_generator(function() {
73514
+ return _ts_generator(this, function(_state) {
73515
+ return [
73516
+ 2,
73517
+ Promise.resolve({})
73518
+ ];
73519
+ });
73520
+ })();
73521
+ }
73124
73522
  }
73125
73523
  ]);
73126
73524
  return ReviveProvider;
@@ -73128,10 +73526,10 @@ var ReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73128
73526
  // src/Ads/Providers/Prebidjs/PrebidReviveProvider.ts
73129
73527
  var PrebidRevive = /*#__PURE__*/ function() {
73130
73528
  "use strict";
73131
- function PrebidRevive() {
73132
- _class_call_check(this, PrebidRevive);
73529
+ function _PrebidRevive() {
73530
+ _class_call_check(this, _PrebidRevive);
73133
73531
  }
73134
- _create_class(PrebidRevive, null, [
73532
+ _create_class(_PrebidRevive, null, [
73135
73533
  {
73136
73534
  key: "load",
73137
73535
  value: function load() {
@@ -73197,20 +73595,137 @@ var PrebidRevive = /*#__PURE__*/ function() {
73197
73595
  }
73198
73596
  },
73199
73597
  {
73200
- key: "defineSlots",
73201
- value: function defineSlots(options) {
73202
- var _window_pbjs_que, _window_pbjs;
73203
- (_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() {
73598
+ key: "defineSlots",
73599
+ value: function defineSlots(options) {
73600
+ var _window_pbjs_que, _window_pbjs;
73601
+ (_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() {
73602
+ var _window_pbjs;
73603
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73604
+ window.pbjs.addAdUnits(options.units.filter(function(unit) {
73605
+ var _window_pbjs;
73606
+ return !((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
73607
+ return "".concat(unit.code) === "".concat(defUnit.code);
73608
+ }));
73609
+ }));
73610
+ } else {
73611
+ console.error("addAdUnits is not a function.");
73612
+ }
73613
+ });
73614
+ }
73615
+ },
73616
+ {
73617
+ key: "defineBannerAdUnit",
73618
+ value: function defineBannerAdUnit(unitDefinition, containerId, options, adType) {
73619
+ var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
73620
+ return new Promise(function(resolve) {
73621
+ var _window_pbjs;
73622
+ var sizes = [];
73623
+ var mapping = void 0;
73624
+ if (adType) {
73625
+ sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
73626
+ mapping = RegionDefinitions.mapping(adType);
73627
+ } else {
73628
+ var _unitDefinition_mediaTypes_banner;
73629
+ sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
73630
+ }
73631
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73632
+ return "".concat(containerId) === "".concat(defUnit.code);
73633
+ });
73634
+ if (!existingSlot) {
73635
+ var _window_pbjs_que, _window_pbjs1;
73636
+ (_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() {
73637
+ var _window_pbjs;
73638
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73639
+ var adUnit = {
73640
+ code: "".concat(containerId),
73641
+ mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
73642
+ banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
73643
+ sizes: sizes
73644
+ })
73645
+ }),
73646
+ bids: unitDefinition.bids,
73647
+ schain: unitDefinition.schain
73648
+ };
73649
+ if (mapping) {
73650
+ var mappedSizes = [];
73651
+ var sortedBreakpoints = Object.keys(mapping).sort(function(a, b) {
73652
+ return parseInt(RegionDefinitions.BREAKPOINTS[b], 10) - parseInt(RegionDefinitions.BREAKPOINTS[a], 10);
73653
+ });
73654
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
73655
+ try {
73656
+ for(var _iterator = sortedBreakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
73657
+ var bp = _step.value;
73658
+ mappedSizes.push({
73659
+ minViewPort: [
73660
+ RegionDefinitions.BREAKPOINTS[bp],
73661
+ 0
73662
+ ],
73663
+ sizes: mapping[bp]
73664
+ });
73665
+ }
73666
+ } catch (err) {
73667
+ _didIteratorError = true;
73668
+ _iteratorError = err;
73669
+ } finally{
73670
+ try {
73671
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
73672
+ _iterator.return();
73673
+ }
73674
+ } finally{
73675
+ if (_didIteratorError) {
73676
+ throw _iteratorError;
73677
+ }
73678
+ }
73679
+ }
73680
+ adUnit.mediaTypes.banner.sizeConfig = mappedSizes;
73681
+ } else {
73682
+ adUnit.mediaTypes.banner.sizes = sizes;
73683
+ }
73684
+ window.pbjs.addAdUnits([
73685
+ adUnit
73686
+ ]);
73687
+ resolve(adUnit);
73688
+ } else {
73689
+ console.error("addAdUnits is not a function.");
73690
+ resolve(void 0);
73691
+ }
73692
+ });
73693
+ } else {
73694
+ resolve(existingSlot);
73695
+ }
73696
+ });
73697
+ }
73698
+ },
73699
+ {
73700
+ key: "defineVideoAdUnit",
73701
+ value: function defineVideoAdUnit(unitDefinition, containerId) {
73702
+ return new Promise(function(resolve) {
73204
73703
  var _window_pbjs;
73205
- if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73206
- window.pbjs.addAdUnits(options.units.filter(function(unit) {
73704
+ var existingSlot = (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.find(function(defUnit) {
73705
+ return "".concat(containerId) === "".concat(defUnit.code);
73706
+ });
73707
+ if (!existingSlot) {
73708
+ var _window_pbjs_que, _window_pbjs1;
73709
+ (_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() {
73207
73710
  var _window_pbjs;
73208
- return !((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
73209
- return "".concat(unit.code) === "".concat(defUnit.code);
73210
- }));
73211
- }));
73711
+ if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73712
+ var adUnit = {
73713
+ code: "".concat(containerId),
73714
+ mediaTypes: _object_spread({}, unitDefinition.mediaTypes),
73715
+ bids: unitDefinition.bids,
73716
+ schain: unitDefinition.schain
73717
+ };
73718
+ window.pbjs.addAdUnits([
73719
+ adUnit
73720
+ ]);
73721
+ resolve(adUnit);
73722
+ } else {
73723
+ console.error("addAdUnits is not a function.");
73724
+ resolve(void 0);
73725
+ }
73726
+ });
73212
73727
  } else {
73213
- console.error("addAdUnits is not a function.");
73728
+ resolve(existingSlot);
73214
73729
  }
73215
73730
  });
73216
73731
  }
@@ -73219,48 +73734,86 @@ var PrebidRevive = /*#__PURE__*/ function() {
73219
73734
  key: "defineSlot",
73220
73735
  value: function defineSlot(options, slotId, containerId, adType) {
73221
73736
  var adName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "banner";
73222
- var _window_pbjs;
73223
- var unitDefinition = options.units.find(function(unit) {
73224
- return unit.code === "".concat(slotId);
73225
- });
73226
- var sizes = [];
73227
- if (!unitDefinition) {
73228
- console.error("No unit definition found for slotId: ".concat(slotId));
73229
- return;
73230
- }
73231
- if (adType) {
73232
- sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
73233
- } else {
73234
- var _unitDefinition_mediaTypes_banner;
73235
- sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
73236
- }
73237
- if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
73238
- return "".concat(containerId) === "".concat(defUnit.code);
73239
- }))) {
73240
- var _window_pbjs_que, _window_pbjs1;
73241
- (_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() {
73242
- var _window_pbjs;
73243
- if ((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.addAdUnits) {
73244
- window.pbjs.addAdUnits([
73245
- _object_spread_props(_object_spread({}, unitDefinition), {
73246
- mediaTypes: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes || {}), {
73247
- banner: _object_spread_props(_object_spread({}, unitDefinition.mediaTypes.banner || {}), {
73248
- sizes: sizes
73249
- })
73250
- }),
73251
- code: "".concat(containerId)
73252
- })
73253
- ]);
73254
- } else {
73255
- console.error("addAdUnits is not a function.");
73737
+ return _async_to_generator(function() {
73738
+ var unitDefinition;
73739
+ return _ts_generator(this, function(_state) {
73740
+ unitDefinition = options.units.find(function(unit) {
73741
+ return unit.code === "".concat(slotId);
73742
+ });
73743
+ if (!unitDefinition) {
73744
+ console.error("No unit definition found for slotId: ".concat(slotId));
73745
+ return [
73746
+ 2,
73747
+ unitDefinition
73748
+ ];
73749
+ }
73750
+ if (unitDefinition.mediaTypes.video) {
73751
+ return [
73752
+ 2,
73753
+ _PrebidRevive.defineVideoAdUnit(unitDefinition, containerId)
73754
+ ];
73755
+ } else if (unitDefinition.mediaTypes.banner) {
73756
+ return [
73757
+ 2,
73758
+ _PrebidRevive.defineBannerAdUnit(unitDefinition, containerId, options, adType, adName)
73759
+ ];
73256
73760
  }
73761
+ console.warn("No supported mediaTypes found for unit: ".concat(slotId));
73762
+ return [
73763
+ 2,
73764
+ void 0
73765
+ ];
73257
73766
  });
73258
- }
73767
+ })();
73259
73768
  }
73260
73769
  },
73261
73770
  {
73262
73771
  key: "onSlotRenderEnded",
73263
- value: function onSlotRenderEnded(slotId, cb) {}
73772
+ value: // static defineSlot(
73773
+ // options: PrebidjsProviderOptions,
73774
+ // slotId: string,
73775
+ // containerId: string,
73776
+ // adType: Ads.AdSizeType,
73777
+ // adName: string = "banner",
73778
+ // ) {
73779
+ // // let gamNetworkId: string = PrebidGAM.getProperGAMNetworkId(options);
73780
+ // const unitDefinition = options.units.find((unit) => unit.code === `${slotId}`);
73781
+ // let sizes: [number, number][] = [];
73782
+ // if (!unitDefinition) {
73783
+ // console.error(`No unit definition found for slotId: ${slotId}`);
73784
+ // return;
73785
+ // }
73786
+ // if (adType) {
73787
+ // sizes = RegionDefinitions.TYPE_AND_DIMENSIONS[adType];
73788
+ // } else {
73789
+ // sizes = unitDefinition.mediaTypes.banner?.sizes || [];
73790
+ // }
73791
+ // // GPT.defineSlot(`/${gamNetworkId}/${adName}`, [sizes[0] || []], `${containerId}`);
73792
+ // if (
73793
+ // !window.pbjs?.adUnits.some((defUnit) => `${containerId}` === `${defUnit.code}`)
73794
+ // ) {
73795
+ // window.pbjs?.que?.push(() => {
73796
+ // if (window.pbjs?.addAdUnits) {
73797
+ // window.pbjs.addAdUnits([
73798
+ // {
73799
+ // ...unitDefinition,
73800
+ // mediaTypes: {
73801
+ // ...(unitDefinition.mediaTypes || {}),
73802
+ // banner: {
73803
+ // ...(unitDefinition.mediaTypes.banner || {}),
73804
+ // sizes: sizes,
73805
+ // },
73806
+ // },
73807
+ // code: `${containerId}`,
73808
+ // },
73809
+ // ]);
73810
+ // } else {
73811
+ // console.error("addAdUnits is not a function.");
73812
+ // }
73813
+ // });
73814
+ // }
73815
+ // }
73816
+ function onSlotRenderEnded(slotId, cb) {}
73264
73817
  },
73265
73818
  {
73266
73819
  key: "start",
@@ -73311,9 +73864,65 @@ var PrebidRevive = /*#__PURE__*/ function() {
73311
73864
  });
73312
73865
  });
73313
73866
  }
73867
+ },
73868
+ {
73869
+ key: "requestInstream",
73870
+ value: function requestInstream(options, slotId, containerId, callback) {
73871
+ var _window_pbjs;
73872
+ var PREBID_TIMEOUT = 1e3;
73873
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.que.push(function() {
73874
+ var _window_pbjs;
73875
+ (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.requestBids({
73876
+ adUnitCodes: [
73877
+ "".concat(containerId)
73878
+ ],
73879
+ timeout: PREBID_TIMEOUT,
73880
+ bidsBackHandler: function bidsBackHandler(bids) {
73881
+ var winners = Object.values(bids).reduce(function(acc, unit) {
73882
+ if (unit.bids) {
73883
+ var _acc;
73884
+ (_acc = acc).push.apply(_acc, _to_consumable_array(unit.bids));
73885
+ }
73886
+ return acc;
73887
+ }, []).sort(function(a, b) {
73888
+ return b.cpm - a.cpm;
73889
+ });
73890
+ if (winners.length > 0) {
73891
+ var winner = winners[0];
73892
+ var content = {
73893
+ asStr: winner.ad,
73894
+ content: [],
73895
+ extra: {
73896
+ region: winner.adUnitCode,
73897
+ sz: {
73898
+ w: winner.width,
73899
+ h: winner.height
73900
+ },
73901
+ cpm: winner.cpm
73902
+ }
73903
+ };
73904
+ if (winner.vastUrl) {
73905
+ callback(winner.vastUrl);
73906
+ return;
73907
+ }
73908
+ ;
73909
+ if (winner.vastXml) {
73910
+ callback(winner.vastXml);
73911
+ return;
73912
+ }
73913
+ ;
73914
+ }
73915
+ if (winners.length === 0) {
73916
+ callback(null);
73917
+ }
73918
+ callback(null);
73919
+ }
73920
+ });
73921
+ });
73922
+ }
73314
73923
  }
73315
73924
  ]);
73316
- return PrebidRevive;
73925
+ return _PrebidRevive;
73317
73926
  }();
73318
73927
  var prebidReviveConfig = false;
73319
73928
  var prebidReviveReady = new Awaitable(false);
@@ -73374,7 +73983,7 @@ var PrebidReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73374
73983
  key: "request",
73375
73984
  value: function request(params) {
73376
73985
  return _async_to_generator(function() {
73377
- var _this, adType, adName, regionId, regionInfo;
73986
+ var _this, adType, adName, regionId, regionInfo, result;
73378
73987
  return _ts_generator(this, function(_state) {
73379
73988
  switch(_state.label){
73380
73989
  case 0:
@@ -73410,7 +74019,19 @@ var PrebidReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73410
74019
  ];
73411
74020
  case 2:
73412
74021
  _state.sent();
73413
- PrebidRevive.defineSlot(this.options, regionId, this.workingSlotId, adType, adName);
74022
+ return [
74023
+ 4,
74024
+ PrebidRevive.defineSlot(this.options, regionId, this.workingSlotId, adType, adName)
74025
+ ];
74026
+ case 3:
74027
+ result = _state.sent();
74028
+ if (!result) {
74029
+ this.context.logger.warn("No ad unit found for regionId: ".concat(regionId));
74030
+ this.notify();
74031
+ return [
74032
+ 2
74033
+ ];
74034
+ }
73414
74035
  PrebidRevive.request(regionId, this.workingSlotId, function(content) {
73415
74036
  return _async_to_generator(function() {
73416
74037
  var content2;
@@ -73475,6 +74096,76 @@ var PrebidReviveProvider = /*#__PURE__*/ function(ContentProvider) {
73475
74096
  });
73476
74097
  }).call(this);
73477
74098
  }
74099
+ },
74100
+ {
74101
+ key: "requestInstream",
74102
+ value: function requestInstream(params) {
74103
+ return _async_to_generator(function() {
74104
+ var _this;
74105
+ return _ts_generator(this, function(_state) {
74106
+ _this = this;
74107
+ return [
74108
+ 2,
74109
+ new Promise(function(resolve) {
74110
+ return _async_to_generator(function() {
74111
+ var adSlotId, adSlot, result;
74112
+ return _ts_generator(this, function(_state) {
74113
+ switch(_state.label){
74114
+ case 0:
74115
+ adSlotId = params.adSlot;
74116
+ if (!adSlotId && params.roles && params.roles.length > 0) {
74117
+ adSlot = this.options.units.find(function(unit) {
74118
+ var _params_roles;
74119
+ return unit._brndts_role !== void 0 && ((_params_roles = params.roles) === null || _params_roles === void 0 ? void 0 : _params_roles.includes(unit._brndts_role));
74120
+ });
74121
+ adSlotId = adSlot === null || adSlot === void 0 ? void 0 : adSlot.code;
74122
+ }
74123
+ if (!adSlotId) {
74124
+ console.warn("No adSlot or roles provided for instream ad request.");
74125
+ resolve({});
74126
+ return [
74127
+ 2
74128
+ ];
74129
+ }
74130
+ return [
74131
+ 4,
74132
+ prebidReviveReady.promise
74133
+ ];
74134
+ case 1:
74135
+ _state.sent();
74136
+ return [
74137
+ 4,
74138
+ PrebidRevive.defineSlot(this.options, adSlotId, adSlotId)
74139
+ ];
74140
+ case 2:
74141
+ result = _state.sent();
74142
+ if (!result) {
74143
+ console.warn("No ad unit found for instream adSlot: ".concat(adSlotId));
74144
+ resolve({});
74145
+ return [
74146
+ 2
74147
+ ];
74148
+ }
74149
+ PrebidRevive.requestInstream(this.options, adSlotId, adSlotId, function(content) {
74150
+ if (content === null) {
74151
+ resolve({});
74152
+ return;
74153
+ }
74154
+ resolve({
74155
+ vastTagUrl: content
74156
+ });
74157
+ });
74158
+ return [
74159
+ 2
74160
+ ];
74161
+ }
74162
+ });
74163
+ }).call(_this);
74164
+ })
74165
+ ];
74166
+ });
74167
+ }).call(this);
74168
+ }
73478
74169
  }
73479
74170
  ]);
73480
74171
  return PrebidReviveProvider;
@@ -73528,6 +74219,22 @@ var GPTProvider = /*#__PURE__*/ function(ContentProvider) {
73528
74219
  });
73529
74220
  }).call(this);
73530
74221
  }
74222
+ },
74223
+ {
74224
+ key: "requestInstream",
74225
+ value: function requestInstream() {
74226
+ return _async_to_generator(function() {
74227
+ var params;
74228
+ var _arguments = arguments;
74229
+ return _ts_generator(this, function(_state) {
74230
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
74231
+ return [
74232
+ 2,
74233
+ Promise.resolve({})
74234
+ ];
74235
+ });
74236
+ }).apply(this, arguments);
74237
+ }
73531
74238
  }
73532
74239
  ]);
73533
74240
  return GPTProvider;
@@ -73602,6 +74309,22 @@ var DebugProvider = /*#__PURE__*/ function(ContentProvider) {
73602
74309
  });
73603
74310
  }).call(this);
73604
74311
  }
74312
+ },
74313
+ {
74314
+ key: "requestInstream",
74315
+ value: function requestInstream() {
74316
+ return _async_to_generator(function() {
74317
+ var params;
74318
+ var _arguments = arguments;
74319
+ return _ts_generator(this, function(_state) {
74320
+ params = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
74321
+ return [
74322
+ 2,
74323
+ Promise.resolve({})
74324
+ ];
74325
+ });
74326
+ }).apply(this, arguments);
74327
+ }
73605
74328
  }
73606
74329
  ]);
73607
74330
  return DebugProvider;
@@ -79656,9 +80379,7 @@ var AuxElementsRenderer = /*#__PURE__*/ function() {
79656
80379
  }, {
79657
80380
  width: this.regionsContainerView.width,
79658
80381
  height: this.regionsContainerView.height
79659
- }, {}, {
79660
- provider: ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider)
79661
- });
80382
+ }, {}, {});
79662
80383
  this.auxElementsData.push({
79663
80384
  box: {
79664
80385
  x1: 0,
@@ -84342,6 +85063,7 @@ var ControlTopBar = /*#__PURE__*/ function() {
84342
85063
  });
84343
85064
  this.context.store.subscribe(this.handleStateChange.bind(this));
84344
85065
  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) {
85066
+ var _this_context_data, _this_context_media;
84345
85067
  var ind = new ProgressBanner({
84346
85068
  indicators: [
84347
85069
  {
@@ -84354,10 +85076,10 @@ var ControlTopBar = /*#__PURE__*/ function() {
84354
85076
  }
84355
85077
  ]
84356
85078
  });
84357
- this.context.data.on("UPDATE", function() {
85079
+ (_this_context_data = this.context.data) === null || _this_context_data === void 0 ? void 0 : _this_context_data.on("UPDATE", function() {
84358
85080
  ind.setValue("BRNDTS_LOADING", _this.context.data.progress());
84359
85081
  });
84360
- this.context.media.on("TIME_UPDATE", function(param) {
85082
+ (_this_context_media = this.context.media) === null || _this_context_media === void 0 ? void 0 : _this_context_media.on("TIME_UPDATE", function(param) {
84361
85083
  var time = param.time, duration = param.duration;
84362
85084
  ind.setValue("PLAYER_TIME", time / duration * 100);
84363
85085
  });
@@ -85812,6 +86534,64 @@ var VideoAds = /*#__PURE__*/ function() {
85812
86534
  return entry.inst;
85813
86535
  }
85814
86536
  },
86537
+ {
86538
+ key: "getDetachedInstreamAds",
86539
+ value: function getDetachedInstreamAds() {
86540
+ return _async_to_generator(function() {
86541
+ var provider, instreamInfo, e2;
86542
+ return _ts_generator(this, function(_state) {
86543
+ switch(_state.label){
86544
+ case 0:
86545
+ provider = ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider);
86546
+ _state.label = 1;
86547
+ case 1:
86548
+ _state.trys.push([
86549
+ 1,
86550
+ 3,
86551
+ ,
86552
+ 4
86553
+ ]);
86554
+ return [
86555
+ 4,
86556
+ provider.requestInstream({
86557
+ roles: [
86558
+ "pre-roll"
86559
+ ]
86560
+ })
86561
+ ];
86562
+ case 2:
86563
+ instreamInfo = _state.sent();
86564
+ if (!instreamInfo.vastTagUrl) {
86565
+ return [
86566
+ 2,
86567
+ []
86568
+ ];
86569
+ }
86570
+ return [
86571
+ 2,
86572
+ [
86573
+ {
86574
+ timeOffset: "00:00:00",
86575
+ vast: instreamInfo.vastTagUrl
86576
+ }
86577
+ ]
86578
+ ];
86579
+ case 3:
86580
+ e2 = _state.sent();
86581
+ ErrorHandler.handle(e2);
86582
+ return [
86583
+ 2,
86584
+ []
86585
+ ];
86586
+ case 4:
86587
+ return [
86588
+ 2
86589
+ ];
86590
+ }
86591
+ });
86592
+ }).call(this);
86593
+ }
86594
+ },
85815
86595
  {
85816
86596
  key: "destroy",
85817
86597
  value: function destroy() {
@@ -85866,6 +86646,12 @@ var Ads = /*#__PURE__*/ function() {
85866
86646
  });
85867
86647
  }
85868
86648
  },
86649
+ {
86650
+ key: "getDetachedInstreamAds",
86651
+ value: function getDetachedInstreamAds() {
86652
+ return this.videoAds.getDetachedInstreamAds();
86653
+ }
86654
+ },
85869
86655
  {
85870
86656
  key: "updateSize",
85871
86657
  value: function updateSize() {
@@ -90474,10 +91260,17 @@ var BrndtsAds = /*#__PURE__*/ function() {
90474
91260
  {
90475
91261
  key: "handleConnected",
90476
91262
  value: function handleConnected() {
90477
- this.ready.resolve(true);
90478
- this.context.logger.log("connected to service");
90479
- this.context.ads = new Ads_default(this.context);
90480
- this.context.ads.start();
91263
+ return _async_to_generator(function() {
91264
+ return _ts_generator(this, function(_state) {
91265
+ this.context.logger.log("connected to service");
91266
+ this.context.ads = new Ads_default(this.context);
91267
+ this.context.ads.start();
91268
+ this.ready.resolve(true);
91269
+ return [
91270
+ 2
91271
+ ];
91272
+ });
91273
+ }).call(this);
90481
91274
  }
90482
91275
  },
90483
91276
  {
@@ -90525,6 +91318,16 @@ var BrndtsAds = /*#__PURE__*/ function() {
90525
91318
  this.context.config.set("controls", controlsConfig);
90526
91319
  }
90527
91320
  },
91321
+ {
91322
+ key: "getDetachedInstreamAds",
91323
+ value: function getDetachedInstreamAds() {
91324
+ if (!this.ready.value || this.context.ads === void 0) {
91325
+ console.warn("Ads not ready yet!");
91326
+ return Promise.resolve([]);
91327
+ }
91328
+ return this.context.ads.getDetachedInstreamAds();
91329
+ }
91330
+ },
90528
91331
  {
90529
91332
  key: "rewind",
90530
91333
  value: function rewind(value2) {
@@ -90557,7 +91360,9 @@ var BrndtsAds = /*#__PURE__*/ function() {
90557
91360
  ]);
90558
91361
  return BrndtsAds;
90559
91362
  }();
90560
- export { BrndtsAds as default }; /*! Bundled license information:
91363
+ export { BrndtsAds as default }; //! TEST
91364
+ //!
91365
+ /*! Bundled license information:
90561
91366
 
90562
91367
  @fortawesome/fontawesome-svg-core/index.mjs:
90563
91368
  @fortawesome/free-solid-svg-icons/index.mjs: