@brndts/brndts-ads 1.13.9 → 1.13.11

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
@@ -73702,6 +73702,13 @@ var BradmaxMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73702
73702
  var _videoElement2_contextMediaSource;
73703
73703
  return ((_videoElement2_contextMediaSource = videoElement2.contextMediaSource) === null || _videoElement2_contextMediaSource === void 0 ? void 0 : _videoElement2_contextMediaSource.url) === _this.source;
73704
73704
  });
73705
+ if (!videoElement) {
73706
+ var _this_instance1;
73707
+ videoElement = (_this_instance1 = this.instance) === null || _this_instance1 === void 0 ? void 0 : _this_instance1.videoElementsManager.videoElementsInUse.find(function(videoElement2) {
73708
+ var _videoElement2_contextMediaSource;
73709
+ return Boolean((_videoElement2_contextMediaSource = videoElement2.contextMediaSource) === null || _videoElement2_contextMediaSource === void 0 ? void 0 : _videoElement2_contextMediaSource.url);
73710
+ });
73711
+ }
73705
73712
  if (videoElement) {
73706
73713
  return videoElement.element;
73707
73714
  }
@@ -80033,6 +80040,10 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80033
80040
  this.container = this.context.elements.container;
80034
80041
  }
80035
80042
  var backdrop = new Backdrop(this.context);
80043
+ var existingBackdrop = this.container.querySelector("#".concat(backdrop.view.id));
80044
+ if (existingBackdrop) {
80045
+ this.container.removeChild(existingBackdrop);
80046
+ }
80036
80047
  this.container.firstChild ? this.container.insertBefore(backdrop.view, this.container.firstChild) : this.container.appendChild(backdrop.view);
80037
80048
  this.migrateStyles();
80038
80049
  if (this.media.view) {
@@ -80114,6 +80125,8 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80114
80125
  value: function destroy() {
80115
80126
  var _this_container_parentElement;
80116
80127
  if (!this.context.elements.original) {
80128
+ var _this_context_elements_container;
80129
+ (_this_context_elements_container = this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.remove();
80117
80130
  return;
80118
80131
  }
80119
80132
  (_this_container_parentElement = this.container.parentElement) === null || _this_container_parentElement === void 0 ? void 0 : _this_container_parentElement.replaceChild(this.context.elements.original, this.container);
@@ -81096,6 +81109,13 @@ var RegionRenderer = /*#__PURE__*/ function() {
81096
81109
  {
81097
81110
  key: "attach",
81098
81111
  value: function attach(container, before) {
81112
+ if (!container) {
81113
+ this.context.logger.error("No container provided for regions");
81114
+ return;
81115
+ }
81116
+ if (container.querySelector("#BRNDTS_ARW")) {
81117
+ container.removeChild(container.querySelector("#BRNDTS_ARW"));
81118
+ }
81099
81119
  if (before) {
81100
81120
  container.insertBefore(this.regionsContainerView.view, before);
81101
81121
  } else {
@@ -82522,9 +82542,10 @@ var VideoAds = /*#__PURE__*/ function() {
82522
82542
  try {
82523
82543
  for(var _iterator = medias[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
82524
82544
  var media = _step.value;
82525
- if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R")) {
82545
+ if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R") || media.dataset.b_I !== void 0) {
82526
82546
  continue;
82527
82547
  }
82548
+ media.dataset.b_I = "".concat(this.videoAdElements.length);
82528
82549
  var videoAd = new VideoAd(this.context, media);
82529
82550
  this.videoAdElements.push(videoAd);
82530
82551
  videoAd.start();