@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.mjs CHANGED
@@ -73777,6 +73777,13 @@ var BradmaxMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73777
73777
  var _videoElement2_contextMediaSource;
73778
73778
  return ((_videoElement2_contextMediaSource = videoElement2.contextMediaSource) === null || _videoElement2_contextMediaSource === void 0 ? void 0 : _videoElement2_contextMediaSource.url) === _this.source;
73779
73779
  });
73780
+ if (!videoElement) {
73781
+ var _this_instance1;
73782
+ videoElement = (_this_instance1 = this.instance) === null || _this_instance1 === void 0 ? void 0 : _this_instance1.videoElementsManager.videoElementsInUse.find(function(videoElement2) {
73783
+ var _videoElement2_contextMediaSource;
73784
+ return Boolean((_videoElement2_contextMediaSource = videoElement2.contextMediaSource) === null || _videoElement2_contextMediaSource === void 0 ? void 0 : _videoElement2_contextMediaSource.url);
73785
+ });
73786
+ }
73780
73787
  if (videoElement) {
73781
73788
  return videoElement.element;
73782
73789
  }
@@ -80138,6 +80145,10 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80138
80145
  this.container = this.context.elements.container;
80139
80146
  }
80140
80147
  var backdrop = new Backdrop(this.context);
80148
+ var existingBackdrop = this.container.querySelector("#".concat(backdrop.view.id));
80149
+ if (existingBackdrop) {
80150
+ this.container.removeChild(existingBackdrop);
80151
+ }
80141
80152
  this.container.firstChild ? this.container.insertBefore(backdrop.view, this.container.firstChild) : this.container.appendChild(backdrop.view);
80142
80153
  this.migrateStyles();
80143
80154
  if (this.media.view) {
@@ -80219,6 +80230,8 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80219
80230
  value: function destroy() {
80220
80231
  var _this_container_parentElement;
80221
80232
  if (!this.context.elements.original) {
80233
+ var _this_context_elements_container;
80234
+ (_this_context_elements_container = this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.remove();
80222
80235
  return;
80223
80236
  }
80224
80237
  (_this_container_parentElement = this.container.parentElement) === null || _this_container_parentElement === void 0 ? void 0 : _this_container_parentElement.replaceChild(this.context.elements.original, this.container);
@@ -81211,6 +81224,13 @@ var RegionRenderer = /*#__PURE__*/ function() {
81211
81224
  {
81212
81225
  key: "attach",
81213
81226
  value: function attach(container, before) {
81227
+ if (!container) {
81228
+ this.context.logger.error("No container provided for regions");
81229
+ return;
81230
+ }
81231
+ if (container.querySelector("#BRNDTS_ARW")) {
81232
+ container.removeChild(container.querySelector("#BRNDTS_ARW"));
81233
+ }
81214
81234
  if (before) {
81215
81235
  container.insertBefore(this.regionsContainerView.view, before);
81216
81236
  } else {
@@ -82652,9 +82672,10 @@ var VideoAds = /*#__PURE__*/ function() {
82652
82672
  try {
82653
82673
  for(var _iterator = medias[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
82654
82674
  var media = _step.value;
82655
- if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R")) {
82675
+ if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R") || media.dataset.b_I !== void 0) {
82656
82676
  continue;
82657
82677
  }
82678
+ media.dataset.b_I = "".concat(this.videoAdElements.length);
82658
82679
  var videoAd = new VideoAd(this.context, media);
82659
82680
  this.videoAdElements.push(videoAd);
82660
82681
  videoAd.start();