@brndts/brndts-ads 1.13.8 → 1.13.10

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
@@ -73774,7 +73774,8 @@ var BradmaxMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73774
73774
  var _this = this;
73775
73775
  var _this_instance;
73776
73776
  var videoElement = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.videoElementsManager.videoElementsInUse.find(function(videoElement2) {
73777
- return videoElement2.contextMediaSource.url === _this.source;
73777
+ var _videoElement2_contextMediaSource;
73778
+ return ((_videoElement2_contextMediaSource = videoElement2.contextMediaSource) === null || _videoElement2_contextMediaSource === void 0 ? void 0 : _videoElement2_contextMediaSource.url) === _this.source;
73778
73779
  });
73779
73780
  if (videoElement) {
73780
73781
  return videoElement.element;
@@ -80137,6 +80138,10 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80137
80138
  this.container = this.context.elements.container;
80138
80139
  }
80139
80140
  var backdrop = new Backdrop(this.context);
80141
+ var existingBackdrop = this.container.querySelector("#".concat(backdrop.view.id));
80142
+ if (existingBackdrop) {
80143
+ this.container.removeChild(existingBackdrop);
80144
+ }
80140
80145
  this.container.firstChild ? this.container.insertBefore(backdrop.view, this.container.firstChild) : this.container.appendChild(backdrop.view);
80141
80146
  this.migrateStyles();
80142
80147
  if (this.media.view) {
@@ -80218,6 +80223,8 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80218
80223
  value: function destroy() {
80219
80224
  var _this_container_parentElement;
80220
80225
  if (!this.context.elements.original) {
80226
+ var _this_context_elements_container;
80227
+ (_this_context_elements_container = this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.remove();
80221
80228
  return;
80222
80229
  }
80223
80230
  (_this_container_parentElement = this.container.parentElement) === null || _this_container_parentElement === void 0 ? void 0 : _this_container_parentElement.replaceChild(this.context.elements.original, this.container);
@@ -81210,6 +81217,13 @@ var RegionRenderer = /*#__PURE__*/ function() {
81210
81217
  {
81211
81218
  key: "attach",
81212
81219
  value: function attach(container, before) {
81220
+ if (!container) {
81221
+ this.context.logger.error("No container provided for regions");
81222
+ return;
81223
+ }
81224
+ if (container.querySelector("#BRNDTS_ARW")) {
81225
+ container.removeChild(container.querySelector("#BRNDTS_ARW"));
81226
+ }
81213
81227
  if (before) {
81214
81228
  container.insertBefore(this.regionsContainerView.view, before);
81215
81229
  } else {
@@ -82651,9 +82665,10 @@ var VideoAds = /*#__PURE__*/ function() {
82651
82665
  try {
82652
82666
  for(var _iterator = medias[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
82653
82667
  var media = _step.value;
82654
- if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R")) {
82668
+ if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R") || media.dataset.b_I !== void 0) {
82655
82669
  continue;
82656
82670
  }
82671
+ media.dataset.b_I = "".concat(this.videoAdElements.length);
82657
82672
  var videoAd = new VideoAd(this.context, media);
82658
82673
  this.videoAdElements.push(videoAd);
82659
82674
  videoAd.start();