@brndts/brndts-ads 1.14.16 → 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.js CHANGED
@@ -72387,9 +72387,7 @@ var PrebidGAM = /*#__PURE__*/ function() {
72387
72387
  brndts_zid: unitDefinition.zoneId
72388
72388
  };
72389
72389
  }
72390
- GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), [
72391
- sizes[0] || []
72392
- ], "".concat(containerId), targeting);
72390
+ GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), targeting);
72393
72391
  if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
72394
72392
  return "".concat(containerId) === "".concat(defUnit.code);
72395
72393
  }))) {
@@ -72445,7 +72443,7 @@ var PrebidGAM = /*#__PURE__*/ function() {
72445
72443
  var container = document.createElement("div");
72446
72444
  container.id = containerId;
72447
72445
  var script = document.createElement("script");
72448
- script.innerHTML = '\n window.googletag.cmd.push(function() {\n googletag.pubads().refresh(googletag.pubads().getSlots().filter(slot => slot.getSlotElementId() === "'.concat(containerId, '"), { changeCorrelator: true });\n });');
72446
+ script.innerHTML = '\n window.googletag.cmd.push(function() {\n googletag.pubads().refresh(googletag.pubads().getSlots().filter(slot => slot.getSlotElementId() === "'.concat(containerId, '"), { changeCorrelator: false });\n });');
72449
72447
  container.appendChild(script);
72450
72448
  callback(container);
72451
72449
  });
@@ -78824,6 +78822,7 @@ var MediaElementSizeController = /*#__PURE__*/ function(_import_events6_default)
78824
78822
  var BasicPresentationMode = /*#__PURE__*/ function() {
78825
78823
  function BasicPresentationMode(context) {
78826
78824
  _class_call_check(this, BasicPresentationMode);
78825
+ this.presenting = false;
78827
78826
  this.updatedContainerSize = functions_default.debounce(this.updatedContainerSize.bind(this), 100);
78828
78827
  this.context = context;
78829
78828
  this.mediaElementSizeController = new MediaElementSizeController(context);
@@ -78877,9 +78876,11 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78877
78876
  x: 0,
78878
78877
  y: 10
78879
78878
  });
78879
+ this.presenting = true;
78880
78880
  return {};
78881
78881
  } else {
78882
78882
  var _this_context_interface_backdrop1, _this_context_interface1;
78883
+ this.presenting = false;
78883
78884
  (_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();
78884
78885
  }
78885
78886
  return;
@@ -78896,6 +78897,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78896
78897
  value: function cooldown() {
78897
78898
  var _this = this;
78898
78899
  var _this_regionsRenderer;
78900
+ this.presenting = false;
78899
78901
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
78900
78902
  this.packer.reset();
78901
78903
  requestAnimationFrame(function() {
@@ -78927,6 +78929,20 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78927
78929
  {
78928
78930
  key: "updateSize",
78929
78931
  value: function updateSize() {
78932
+ if (this.context.media) {
78933
+ var _this_context_interface;
78934
+ var adjustedSize;
78935
+ if (this.presenting) {
78936
+ adjustedSize = adjustSizeWithAspectRatio(this.context.media.viewWidth, this.context.media.viewHeight, this.context.media.aspectRatio);
78937
+ } else {
78938
+ var _this_context_elements_container, _this_context_elements_container1;
78939
+ adjustedSize = {
78940
+ 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,
78941
+ 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
78942
+ };
78943
+ }
78944
+ (_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);
78945
+ }
78930
78946
  return void 0;
78931
78947
  }
78932
78948
  },
@@ -78954,11 +78970,13 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78954
78970
  this.packer.repack();
78955
78971
  if (this.packer.packed.length > 0) {
78956
78972
  var _this_context_interface_backdrop, _this_context_interface, _this_regionsRenderer1, _this_regionsRenderer2;
78973
+ this.presenting = true;
78957
78974
  (_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();
78958
78975
  (_this_regionsRenderer1 = this.regionsRenderer) === null || _this_regionsRenderer1 === void 0 ? void 0 : _this_regionsRenderer1.addAreas(this.packer.areas);
78959
78976
  (_this_regionsRenderer2 = this.regionsRenderer) === null || _this_regionsRenderer2 === void 0 ? void 0 : _this_regionsRenderer2.render(this.packer.packed);
78960
78977
  } else {
78961
78978
  var _this_regionsRenderer3, _this_mediaElementSizeController5, _this_context_interface_backdrop1, _this_context_interface1;
78979
+ this.presenting = false;
78962
78980
  (_this_regionsRenderer3 = this.regionsRenderer) === null || _this_regionsRenderer3 === void 0 ? void 0 : _this_regionsRenderer3.clear();
78963
78981
  (_this_mediaElementSizeController5 = this.mediaElementSizeController) === null || _this_mediaElementSizeController5 === void 0 ? void 0 : _this_mediaElementSizeController5.restore();
78964
78982
  (_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();
@@ -84641,22 +84659,6 @@ var Interface = /*#__PURE__*/ function(_import_events9_default) {
84641
84659
  return Interface;
84642
84660
  }(import_events9.default);
84643
84661
  // src/Ads/VideoAds/VideoAd.ts
84644
- function adjustSizeWithAspectRatio2(maxWidth, maxHeight, aspectRatio) {
84645
- var width = maxWidth;
84646
- var height = maxHeight;
84647
- if (aspectRatio > 0) {
84648
- width = Math.min(maxWidth, maxHeight * aspectRatio);
84649
- height = width / aspectRatio;
84650
- if (height > maxHeight) {
84651
- height = maxHeight;
84652
- width = height * aspectRatio;
84653
- }
84654
- }
84655
- return {
84656
- width: width,
84657
- height: height
84658
- };
84659
- }
84660
84662
  var PresentationManager = /*#__PURE__*/ function() {
84661
84663
  function PresentationManager(context) {
84662
84664
  _class_call_check(this, PresentationManager);
@@ -84810,11 +84812,6 @@ var PresentationManager = /*#__PURE__*/ function() {
84810
84812
  this.modes.forEach(function(mode) {
84811
84813
  mode.updateSize();
84812
84814
  });
84813
- if (this.context.media) {
84814
- var _this_context_interface;
84815
- var adjustedSize = adjustSizeWithAspectRatio2(this.context.media.viewWidth, this.context.media.viewHeight, this.context.media.aspectRatio);
84816
- (_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);
84817
- }
84818
84815
  }
84819
84816
  },
84820
84817
  {