@brndts/brndts-ads 1.14.15 → 1.14.17

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
@@ -72251,7 +72251,7 @@ var GPT = /*#__PURE__*/ function() {
72251
72251
  },
72252
72252
  {
72253
72253
  key: "defineSlot",
72254
- value: function defineSlot(slotId, size, containerId) {
72254
+ value: function defineSlot(slotId, size, containerId, targeting) {
72255
72255
  window.googletag.cmd.push(function() {
72256
72256
  if (window.googletag.pubads().getSlots().some(function(slot) {
72257
72257
  return slot.getSlotElementId() === containerId;
@@ -72273,6 +72273,11 @@ var GPT = /*#__PURE__*/ function() {
72273
72273
  0
72274
72274
  ], []).build();
72275
72275
  mrec1 === null || mrec1 === void 0 ? void 0 : mrec1.defineSizeMapping(mrecmapping);
72276
+ if (targeting) {
72277
+ mrec1.setConfig({
72278
+ targeting: targeting
72279
+ });
72280
+ }
72276
72281
  });
72277
72282
  }
72278
72283
  },
@@ -72302,7 +72307,6 @@ var GPT = /*#__PURE__*/ function() {
72302
72307
  ]);
72303
72308
  return GPT;
72304
72309
  }();
72305
- var displayedSlots = /* @__PURE__ */ new Set();
72306
72310
  var PrebidGAM = /*#__PURE__*/ function() {
72307
72311
  "use strict";
72308
72312
  function _PrebidGAM() {
@@ -72447,9 +72451,14 @@ var PrebidGAM = /*#__PURE__*/ function() {
72447
72451
  var _unitDefinition_mediaTypes_banner;
72448
72452
  sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
72449
72453
  }
72450
- GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), [
72451
- sizes[0] || []
72452
- ], "".concat(containerId));
72454
+ var targeting = void 0;
72455
+ if (unitDefinition.zoneId && options.reviveId) {
72456
+ targeting = {
72457
+ brndts_rid: options.reviveId,
72458
+ brndts_zid: unitDefinition.zoneId
72459
+ };
72460
+ }
72461
+ GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), targeting);
72453
72462
  if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
72454
72463
  return "".concat(containerId) === "".concat(defUnit.code);
72455
72464
  }))) {
@@ -72501,17 +72510,11 @@ var PrebidGAM = /*#__PURE__*/ function() {
72501
72510
  (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.setTargetingForGPTAsync([
72502
72511
  "".concat(containerId)
72503
72512
  ]);
72504
- window.googletag.cmd.push(function() {
72505
- if (!displayedSlots.has(containerId)) {
72506
- window.googletag.display(containerId);
72507
- displayedSlots.add(containerId);
72508
- }
72509
- });
72510
72513
  window.googletag.cmd.push(function() {
72511
72514
  var container = document.createElement("div");
72512
72515
  container.id = containerId;
72513
72516
  var script = document.createElement("script");
72514
- script.innerHTML = '\n window.googletag.cmd.push(function() {\n googletag.pubads().refresh(googletag.pubads().getSlots().filter(slot => slot.getSlotElementId() === "'.concat(containerId, '"));\n });');
72517
+ script.innerHTML = '\n window.googletag.cmd.push(function() {\n googletag.pubads().refresh(googletag.pubads().getSlots().filter(slot => slot.getSlotElementId() === "'.concat(containerId, '"), { changeCorrelator: false });\n });');
72515
72518
  container.appendChild(script);
72516
72519
  callback(container);
72517
72520
  });
@@ -73357,6 +73360,7 @@ var StaticAdRegion = /*#__PURE__*/ function(Region) {
73357
73360
  _this.content.view.remove();
73358
73361
  _this.content = new StaticRegionContent(_this.id, _this.plane, _this.box, ((_this_deps_config = _this.deps.config) === null || _this_deps_config === void 0 ? void 0 : (_this_deps_config_getAdsConfig_general = _this_deps_config.getAdsConfig().general) === null || _this_deps_config_getAdsConfig_general === void 0 ? void 0 : (_this_deps_config_getAdsConfig_general_debug_mode = _this_deps_config_getAdsConfig_general.debug_mode) === null || _this_deps_config_getAdsConfig_general_debug_mode === void 0 ? void 0 : _this_deps_config_getAdsConfig_general_debug_mode.value) ? _this.regionDescriptor.ctx : void 0);
73359
73362
  _this.container.appendChild(_this.content.view);
73363
+ _this.container.style.pointerEvents = "all";
73360
73364
  if (_this.deps.provider) {
73361
73365
  _this.content.addContent(_this.deps.provider.contents());
73362
73366
  }
@@ -78923,6 +78927,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78923
78927
  "use strict";
78924
78928
  function BasicPresentationMode(context) {
78925
78929
  _class_call_check(this, BasicPresentationMode);
78930
+ this.presenting = false;
78926
78931
  this.updatedContainerSize = functions_default.debounce(this.updatedContainerSize.bind(this), 100);
78927
78932
  this.context = context;
78928
78933
  this.mediaElementSizeController = new MediaElementSizeController(context);
@@ -78976,9 +78981,11 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78976
78981
  x: 0,
78977
78982
  y: 10
78978
78983
  });
78984
+ this.presenting = true;
78979
78985
  return {};
78980
78986
  } else {
78981
78987
  var _this_context_interface_backdrop1, _this_context_interface1;
78988
+ this.presenting = false;
78982
78989
  (_this_context_interface1 = this.context.interface) === null || _this_context_interface1 === void 0 ? void 0 : (_this_context_interface_backdrop1 = _this_context_interface1.backdrop) === null || _this_context_interface_backdrop1 === void 0 ? void 0 : _this_context_interface_backdrop1.hide();
78983
78990
  }
78984
78991
  return;
@@ -78995,6 +79002,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78995
79002
  value: function cooldown() {
78996
79003
  var _this = this;
78997
79004
  var _this_regionsRenderer;
79005
+ this.presenting = false;
78998
79006
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
78999
79007
  this.packer.reset();
79000
79008
  requestAnimationFrame(function() {
@@ -79026,6 +79034,20 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
79026
79034
  {
79027
79035
  key: "updateSize",
79028
79036
  value: function updateSize() {
79037
+ if (this.context.media) {
79038
+ var _this_context_interface;
79039
+ var adjustedSize;
79040
+ if (this.presenting) {
79041
+ adjustedSize = adjustSizeWithAspectRatio(this.context.media.viewWidth, this.context.media.viewHeight, this.context.media.aspectRatio);
79042
+ } else {
79043
+ var _this_context_elements_container, _this_context_elements_container1;
79044
+ adjustedSize = {
79045
+ width: ((_this_context_elements_container = this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.getBoundingClientRect().width) || 0,
79046
+ height: ((_this_context_elements_container1 = this.context.elements.container) === null || _this_context_elements_container1 === void 0 ? void 0 : _this_context_elements_container1.getBoundingClientRect().height) || 0
79047
+ };
79048
+ }
79049
+ (_this_context_interface = this.context.interface) === null || _this_context_interface === void 0 ? void 0 : _this_context_interface.updateSize(adjustedSize.width, adjustedSize.height, this.context.media.aspectRatio);
79050
+ }
79029
79051
  return void 0;
79030
79052
  }
79031
79053
  },
@@ -79053,11 +79075,13 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
79053
79075
  this.packer.repack();
79054
79076
  if (this.packer.packed.length > 0) {
79055
79077
  var _this_context_interface_backdrop, _this_context_interface, _this_regionsRenderer1, _this_regionsRenderer2;
79078
+ this.presenting = true;
79056
79079
  (_this_context_interface = this.context.interface) === null || _this_context_interface === void 0 ? void 0 : (_this_context_interface_backdrop = _this_context_interface.backdrop) === null || _this_context_interface_backdrop === void 0 ? void 0 : _this_context_interface_backdrop.show();
79057
79080
  (_this_regionsRenderer1 = this.regionsRenderer) === null || _this_regionsRenderer1 === void 0 ? void 0 : _this_regionsRenderer1.addAreas(this.packer.areas);
79058
79081
  (_this_regionsRenderer2 = this.regionsRenderer) === null || _this_regionsRenderer2 === void 0 ? void 0 : _this_regionsRenderer2.render(this.packer.packed);
79059
79082
  } else {
79060
79083
  var _this_regionsRenderer3, _this_mediaElementSizeController5, _this_context_interface_backdrop1, _this_context_interface1;
79084
+ this.presenting = false;
79061
79085
  (_this_regionsRenderer3 = this.regionsRenderer) === null || _this_regionsRenderer3 === void 0 ? void 0 : _this_regionsRenderer3.clear();
79062
79086
  (_this_mediaElementSizeController5 = this.mediaElementSizeController) === null || _this_mediaElementSizeController5 === void 0 ? void 0 : _this_mediaElementSizeController5.restore();
79063
79087
  (_this_context_interface1 = this.context.interface) === null || _this_context_interface1 === void 0 ? void 0 : (_this_context_interface_backdrop1 = _this_context_interface1.backdrop) === null || _this_context_interface_backdrop1 === void 0 ? void 0 : _this_context_interface_backdrop1.hide();
@@ -84774,22 +84798,6 @@ var Interface = /*#__PURE__*/ function(_import_events9_default) {
84774
84798
  return Interface;
84775
84799
  }(import_events9.default);
84776
84800
  // src/Ads/VideoAds/VideoAd.ts
84777
- function adjustSizeWithAspectRatio2(maxWidth, maxHeight, aspectRatio) {
84778
- var width = maxWidth;
84779
- var height = maxHeight;
84780
- if (aspectRatio > 0) {
84781
- width = Math.min(maxWidth, maxHeight * aspectRatio);
84782
- height = width / aspectRatio;
84783
- if (height > maxHeight) {
84784
- height = maxHeight;
84785
- width = height * aspectRatio;
84786
- }
84787
- }
84788
- return {
84789
- width: width,
84790
- height: height
84791
- };
84792
- }
84793
84801
  var PresentationManager = /*#__PURE__*/ function() {
84794
84802
  "use strict";
84795
84803
  function PresentationManager(context) {
@@ -84944,11 +84952,6 @@ var PresentationManager = /*#__PURE__*/ function() {
84944
84952
  this.modes.forEach(function(mode) {
84945
84953
  mode.updateSize();
84946
84954
  });
84947
- if (this.context.media) {
84948
- var _this_context_interface;
84949
- var adjustedSize = adjustSizeWithAspectRatio2(this.context.media.viewWidth, this.context.media.viewHeight, this.context.media.aspectRatio);
84950
- (_this_context_interface = this.context.interface) === null || _this_context_interface === void 0 ? void 0 : _this_context_interface.updateSize(adjustedSize.width, adjustedSize.height, this.context.media.aspectRatio);
84951
- }
84952
84955
  }
84953
84956
  },
84954
84957
  {