@brndts/brndts-ads 1.13.12 → 1.13.13

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
@@ -80082,6 +80082,10 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80082
80082
  value: function setupControls() {
80083
80083
  var _this = this;
80084
80084
  this.controls = new Controls(this.context);
80085
+ var existingControls = this.container.querySelector("#".concat(this.controls.view.id));
80086
+ if (existingControls) {
80087
+ this.container.removeChild(existingControls);
80088
+ }
80085
80089
  this.container.appendChild(this.controls.view);
80086
80090
  this.controls.events.on("TOGGLE_FULLSCREEN", function() {
80087
80091
  _this.fullscreen.toggleFullscreen();
@@ -80127,6 +80131,7 @@ var Interface = /*#__PURE__*/ function(_import_events7_default) {
80127
80131
  if (!this.context.elements.original) {
80128
80132
  var _this_context_elements_container;
80129
80133
  (_this_context_elements_container = this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.remove();
80134
+ this.context.elements.container = null;
80130
80135
  return;
80131
80136
  }
80132
80137
  (_this_container_parentElement = this.container.parentElement) === null || _this_container_parentElement === void 0 ? void 0 : _this_container_parentElement.replaceChild(this.context.elements.original, this.container);
@@ -82503,6 +82508,12 @@ var VideoAd = /*#__PURE__*/ function() {
82503
82508
  (_this_presentation = this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.updateSize();
82504
82509
  }
82505
82510
  },
82511
+ {
82512
+ key: "isBroken",
82513
+ value: function isBroken() {
82514
+ return !this.media.view || document.body.contains(this.media.view) || !this.media.view.closest("#BRNDTS_R") || !this.media.view.querySelector("#BRNDTS_R");
82515
+ }
82516
+ },
82506
82517
  {
82507
82518
  key: "destroy",
82508
82519
  value: function destroy() {
@@ -82530,39 +82541,21 @@ var VideoAds = /*#__PURE__*/ function() {
82530
82541
  var elements2 = [];
82531
82542
  for(var index = 0; index < this.videoAdElements.length; index++){
82532
82543
  var element = this.videoAdElements[index];
82533
- if (element.media.view && document.body.contains(element.media.view)) {
82534
- elements2.push(element);
82535
- } else {
82544
+ if (element.isBroken()) {
82536
82545
  element.destroy();
82546
+ } else {
82547
+ elements2.push(element);
82537
82548
  }
82538
82549
  }
82539
82550
  this.videoAdElements = elements2;
82540
82551
  var medias = MediaElementFactory.getElements(this.context.selectors.targets);
82541
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
82542
- try {
82543
- for(var _iterator = medias[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
82544
- var media = _step.value;
82545
- if (!media || media.closest("#BRNDTS_R") || media.querySelector("#BRNDTS_R") || media.dataset.b_I !== void 0) {
82546
- continue;
82547
- }
82548
- media.dataset.b_I = "".concat(this.videoAdElements.length);
82549
- var videoAd = new VideoAd(this.context, media);
82550
- this.videoAdElements.push(videoAd);
82551
- videoAd.start();
82552
- }
82553
- } catch (err) {
82554
- _didIteratorError = true;
82555
- _iteratorError = err;
82556
- } finally{
82557
- try {
82558
- if (!_iteratorNormalCompletion && _iterator.return != null) {
82559
- _iterator.return();
82560
- }
82561
- } finally{
82562
- if (_didIteratorError) {
82563
- throw _iteratorError;
82564
- }
82552
+ for(var index1 = 0; index1 < medias.length; index1++){
82553
+ if (!medias[index1] || medias[index1].closest("#BRNDTS_R") || medias[index1].querySelector("#BRNDTS_R")) {
82554
+ continue;
82565
82555
  }
82556
+ var videoAd = new VideoAd(this.context, medias[index1]);
82557
+ this.videoAdElements.push(videoAd);
82558
+ videoAd.start();
82566
82559
  }
82567
82560
  } catch (error) {
82568
82561
  if (_instanceof(error, Error)) {