@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.js CHANGED
@@ -72181,7 +72181,7 @@ var GPT = /*#__PURE__*/ function() {
72181
72181
  },
72182
72182
  {
72183
72183
  key: "defineSlot",
72184
- value: function defineSlot(slotId, size, containerId) {
72184
+ value: function defineSlot(slotId, size, containerId, targeting) {
72185
72185
  window.googletag.cmd.push(function() {
72186
72186
  if (window.googletag.pubads().getSlots().some(function(slot) {
72187
72187
  return slot.getSlotElementId() === containerId;
@@ -72203,6 +72203,11 @@ var GPT = /*#__PURE__*/ function() {
72203
72203
  0
72204
72204
  ], []).build();
72205
72205
  mrec1 === null || mrec1 === void 0 ? void 0 : mrec1.defineSizeMapping(mrecmapping);
72206
+ if (targeting) {
72207
+ mrec1.setConfig({
72208
+ targeting: targeting
72209
+ });
72210
+ }
72206
72211
  });
72207
72212
  }
72208
72213
  },
@@ -72232,7 +72237,6 @@ var GPT = /*#__PURE__*/ function() {
72232
72237
  ]);
72233
72238
  return GPT;
72234
72239
  }();
72235
- var displayedSlots = /* @__PURE__ */ new Set();
72236
72240
  var PrebidGAM = /*#__PURE__*/ function() {
72237
72241
  function _PrebidGAM() {
72238
72242
  _class_call_check(this, _PrebidGAM);
@@ -72376,9 +72380,14 @@ var PrebidGAM = /*#__PURE__*/ function() {
72376
72380
  var _unitDefinition_mediaTypes_banner;
72377
72381
  sizes = ((_unitDefinition_mediaTypes_banner = unitDefinition.mediaTypes.banner) === null || _unitDefinition_mediaTypes_banner === void 0 ? void 0 : _unitDefinition_mediaTypes_banner.sizes) || [];
72378
72382
  }
72379
- GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), [
72380
- sizes[0] || []
72381
- ], "".concat(containerId));
72383
+ var targeting = void 0;
72384
+ if (unitDefinition.zoneId && options.reviveId) {
72385
+ targeting = {
72386
+ brndts_rid: options.reviveId,
72387
+ brndts_zid: unitDefinition.zoneId
72388
+ };
72389
+ }
72390
+ GPT.defineSlot("/".concat(gamNetworkId, "/").concat(adName), sizes, "".concat(containerId), targeting);
72382
72391
  if (!((_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.adUnits.some(function(defUnit) {
72383
72392
  return "".concat(containerId) === "".concat(defUnit.code);
72384
72393
  }))) {
@@ -72430,17 +72439,11 @@ var PrebidGAM = /*#__PURE__*/ function() {
72430
72439
  (_window_pbjs = window.pbjs) === null || _window_pbjs === void 0 ? void 0 : _window_pbjs.setTargetingForGPTAsync([
72431
72440
  "".concat(containerId)
72432
72441
  ]);
72433
- window.googletag.cmd.push(function() {
72434
- if (!displayedSlots.has(containerId)) {
72435
- window.googletag.display(containerId);
72436
- displayedSlots.add(containerId);
72437
- }
72438
- });
72439
72442
  window.googletag.cmd.push(function() {
72440
72443
  var container = document.createElement("div");
72441
72444
  container.id = containerId;
72442
72445
  var script = document.createElement("script");
72443
- script.innerHTML = '\n window.googletag.cmd.push(function() {\n googletag.pubads().refresh(googletag.pubads().getSlots().filter(slot => slot.getSlotElementId() === "'.concat(containerId, '"));\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 });');
72444
72447
  container.appendChild(script);
72445
72448
  callback(container);
72446
72449
  });
@@ -73277,6 +73280,7 @@ var StaticAdRegion = /*#__PURE__*/ function(Region) {
73277
73280
  _this.content.view.remove();
73278
73281
  _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);
73279
73282
  _this.container.appendChild(_this.content.view);
73283
+ _this.container.style.pointerEvents = "all";
73280
73284
  if (_this.deps.provider) {
73281
73285
  _this.content.addContent(_this.deps.provider.contents());
73282
73286
  }
@@ -78818,6 +78822,7 @@ var MediaElementSizeController = /*#__PURE__*/ function(_import_events6_default)
78818
78822
  var BasicPresentationMode = /*#__PURE__*/ function() {
78819
78823
  function BasicPresentationMode(context) {
78820
78824
  _class_call_check(this, BasicPresentationMode);
78825
+ this.presenting = false;
78821
78826
  this.updatedContainerSize = functions_default.debounce(this.updatedContainerSize.bind(this), 100);
78822
78827
  this.context = context;
78823
78828
  this.mediaElementSizeController = new MediaElementSizeController(context);
@@ -78871,9 +78876,11 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78871
78876
  x: 0,
78872
78877
  y: 10
78873
78878
  });
78879
+ this.presenting = true;
78874
78880
  return {};
78875
78881
  } else {
78876
78882
  var _this_context_interface_backdrop1, _this_context_interface1;
78883
+ this.presenting = false;
78877
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();
78878
78885
  }
78879
78886
  return;
@@ -78890,6 +78897,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78890
78897
  value: function cooldown() {
78891
78898
  var _this = this;
78892
78899
  var _this_regionsRenderer;
78900
+ this.presenting = false;
78893
78901
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
78894
78902
  this.packer.reset();
78895
78903
  requestAnimationFrame(function() {
@@ -78921,6 +78929,20 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78921
78929
  {
78922
78930
  key: "updateSize",
78923
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
+ }
78924
78946
  return void 0;
78925
78947
  }
78926
78948
  },
@@ -78948,11 +78970,13 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
78948
78970
  this.packer.repack();
78949
78971
  if (this.packer.packed.length > 0) {
78950
78972
  var _this_context_interface_backdrop, _this_context_interface, _this_regionsRenderer1, _this_regionsRenderer2;
78973
+ this.presenting = true;
78951
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();
78952
78975
  (_this_regionsRenderer1 = this.regionsRenderer) === null || _this_regionsRenderer1 === void 0 ? void 0 : _this_regionsRenderer1.addAreas(this.packer.areas);
78953
78976
  (_this_regionsRenderer2 = this.regionsRenderer) === null || _this_regionsRenderer2 === void 0 ? void 0 : _this_regionsRenderer2.render(this.packer.packed);
78954
78977
  } else {
78955
78978
  var _this_regionsRenderer3, _this_mediaElementSizeController5, _this_context_interface_backdrop1, _this_context_interface1;
78979
+ this.presenting = false;
78956
78980
  (_this_regionsRenderer3 = this.regionsRenderer) === null || _this_regionsRenderer3 === void 0 ? void 0 : _this_regionsRenderer3.clear();
78957
78981
  (_this_mediaElementSizeController5 = this.mediaElementSizeController) === null || _this_mediaElementSizeController5 === void 0 ? void 0 : _this_mediaElementSizeController5.restore();
78958
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();
@@ -84635,22 +84659,6 @@ var Interface = /*#__PURE__*/ function(_import_events9_default) {
84635
84659
  return Interface;
84636
84660
  }(import_events9.default);
84637
84661
  // src/Ads/VideoAds/VideoAd.ts
84638
- function adjustSizeWithAspectRatio2(maxWidth, maxHeight, aspectRatio) {
84639
- var width = maxWidth;
84640
- var height = maxHeight;
84641
- if (aspectRatio > 0) {
84642
- width = Math.min(maxWidth, maxHeight * aspectRatio);
84643
- height = width / aspectRatio;
84644
- if (height > maxHeight) {
84645
- height = maxHeight;
84646
- width = height * aspectRatio;
84647
- }
84648
- }
84649
- return {
84650
- width: width,
84651
- height: height
84652
- };
84653
- }
84654
84662
  var PresentationManager = /*#__PURE__*/ function() {
84655
84663
  function PresentationManager(context) {
84656
84664
  _class_call_check(this, PresentationManager);
@@ -84804,11 +84812,6 @@ var PresentationManager = /*#__PURE__*/ function() {
84804
84812
  this.modes.forEach(function(mode) {
84805
84813
  mode.updateSize();
84806
84814
  });
84807
- if (this.context.media) {
84808
- var _this_context_interface;
84809
- var adjustedSize = adjustSizeWithAspectRatio2(this.context.media.viewWidth, this.context.media.viewHeight, this.context.media.aspectRatio);
84810
- (_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);
84811
- }
84812
84815
  }
84813
84816
  },
84814
84817
  {