@brndts/brndts-ads 1.13.13 → 1.13.14

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
@@ -71410,9 +71410,14 @@ var RegionMaskPlugin = /*#__PURE__*/ function() {
71410
71410
  {
71411
71411
  key: "afterRender",
71412
71412
  value: function afterRender(region) {
71413
- this.countours.update(region.regionContours.points);
71414
- this.mask.render(region.referencePlane, region.boundingBox, this.countours.points);
71415
- region.content.view.style.maskImage = this.mask.maskUrl;
71413
+ if (region.regionContours.points.length > 0) {
71414
+ this.countours.update(region.regionContours.points);
71415
+ this.mask.render(region.referencePlane, region.boundingBox, this.countours.points);
71416
+ region.content.view.style.maskImage = this.mask.maskUrl;
71417
+ } else {
71418
+ this.mask.clear();
71419
+ region.content.view.style.maskImage = "none";
71420
+ }
71416
71421
  return Promise.resolve();
71417
71422
  }
71418
71423
  }
@@ -71636,6 +71641,7 @@ var Region = /*#__PURE__*/ function() {
71636
71641
  this.container.classList.add("BRNDTS_R");
71637
71642
  this.container.style.position = "absolute";
71638
71643
  this.container.style.display = "none";
71644
+ this.container.style.pointerEvents = "none";
71639
71645
  if ((_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_clickability = _this_deps_config_getAdsConfig_general.clickability) === null || _this_deps_config_getAdsConfig_general_clickability === void 0 ? void 0 : _this_deps_config_getAdsConfig_general_clickability.value) {
71640
71646
  this.container.style.pointerEvents = "all";
71641
71647
  }
@@ -72764,6 +72770,49 @@ var elements = {
72764
72770
  var elements_default = elements;
72765
72771
  // src/Ads/VideoAds/Media/YoutubeMediaElements.ts
72766
72772
  var DEFAULT_SEEK_INTERVAL = 10;
72773
+ var YTAPIReady = new Awaitable(false);
72774
+ var YTAPILoading = false;
72775
+ var YoutubeIframeAPILoader = /*#__PURE__*/ function() {
72776
+ "use strict";
72777
+ function YoutubeIframeAPILoader() {
72778
+ _class_call_check(this, YoutubeIframeAPILoader);
72779
+ }
72780
+ _create_class(YoutubeIframeAPILoader, null, [
72781
+ {
72782
+ key: "isLoaded",
72783
+ value: function isLoaded() {
72784
+ return YTAPIReady;
72785
+ }
72786
+ },
72787
+ {
72788
+ key: "load",
72789
+ value: function load() {
72790
+ if (YTAPIReady.value === true) {
72791
+ return YTAPIReady;
72792
+ }
72793
+ if (is_default.object(window.YT) && is_default.function(window.YT.Player)) {
72794
+ YTAPIReady.resolve(true);
72795
+ } else {
72796
+ if (YTAPILoading) {
72797
+ return YTAPIReady;
72798
+ }
72799
+ var callback = window.onYouTubeIframeAPIReady;
72800
+ window.onYouTubeIframeAPIReady = function() {
72801
+ if (callback && is_default.function(callback)) {
72802
+ callback();
72803
+ }
72804
+ YTAPIReady.resolve(true);
72805
+ };
72806
+ loadScript("https://www.youtube.com/iframe_api").catch(function(error) {
72807
+ console.warn("YouTube API failed to load", error);
72808
+ });
72809
+ }
72810
+ return YTAPIReady;
72811
+ }
72812
+ }
72813
+ ]);
72814
+ return YoutubeIframeAPILoader;
72815
+ }();
72767
72816
  function generateId(prefix) {
72768
72817
  return "".concat(prefix, "-").concat(Math.floor(Math.random() * 1e4));
72769
72818
  }
@@ -72836,24 +72885,13 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
72836
72885
  key: "setMediaElement",
72837
72886
  value: function setMediaElement(target) {
72838
72887
  var _this = this;
72839
- this.context.logger.log("Checking YT API");
72840
- if (is_default.object(window.YT) && is_default.function(window.YT.Player)) {
72841
- this.context.logger.log("YT API is already loaded");
72842
- this.YTAPIReady(target);
72843
- } else {
72844
- var callback = window.onYouTubeIframeAPIReady;
72845
- window.onYouTubeIframeAPIReady = function() {
72846
- if (callback && is_default.function(callback)) {
72847
- callback();
72848
- }
72849
- _this.context.logger.log("YT API is loaded");
72850
- _this.YTAPIReady(target);
72851
- };
72852
- this.context.logger.log("YT API is not loaded");
72853
- loadScript("https://www.youtube.com/iframe_api").catch(function(error) {
72854
- _this.context.logger.warn("YouTube API failed to load", error);
72855
- });
72856
- }
72888
+ YoutubeIframeAPILoader.load().promise.then(function() {
72889
+ _this.YTAPIReady(target);
72890
+ }).catch(function(error) {
72891
+ _this.context.logger.error("YouTube API failed to load", error);
72892
+ _this.error = new InternalError("YouTube API failed to load");
72893
+ _this.emit("ERROR", _this.error);
72894
+ });
72857
72895
  }
72858
72896
  },
72859
72897
  {
@@ -73035,7 +73073,14 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73035
73073
  });
73036
73074
  this.context.elements.original = media;
73037
73075
  media = elements_default.replaceElement(container, media);
73038
- var ytPlayer = new window.YT.Player(media, params);
73076
+ var ytPlayer;
73077
+ try {
73078
+ ytPlayer = new window.YT.Player(media, params);
73079
+ } catch (error) {
73080
+ this.error = error;
73081
+ this.emit("ERROR", this.error);
73082
+ return;
73083
+ }
73039
73084
  this.media = ytPlayer.getIframe();
73040
73085
  }
73041
73086
  },
@@ -81156,7 +81201,8 @@ var AdRegionsArea = /*#__PURE__*/ function() {
81156
81201
  }, {
81157
81202
  provider: provider,
81158
81203
  plugins: plugins2,
81159
- recorder: this.context.recorder
81204
+ recorder: this.context.recorder,
81205
+ config: this.context.config
81160
81206
  });
81161
81207
  this.regionsObjects.push(newRegion);
81162
81208
  this.regionsContainerView.append(newRegion.view);
@@ -81177,6 +81223,14 @@ var AdRegionsArea = /*#__PURE__*/ function() {
81177
81223
  key: "clear",
81178
81224
  value: function clear() {
81179
81225
  var _this = this;
81226
+ this.updateSize({
81227
+ width: 0,
81228
+ height: 0
81229
+ }, this.context.media.aspectRatio);
81230
+ this.updatePosition({
81231
+ x: 0,
81232
+ y: 0
81233
+ });
81180
81234
  this.regionsObjects.forEach(function(region) {
81181
81235
  region.clear();
81182
81236
  });
@@ -81748,12 +81802,13 @@ var RegionFactory = /*#__PURE__*/ function() {
81748
81802
  ];
81749
81803
  }
81750
81804
  if (this.deps.strategy === "blend_with_similarity") {
81751
- return [
81752
- new RegionMaskPlugin(),
81753
- new RegionBorderPlugin({
81805
+ var _this_deps_config_getAdsConfig_general_debug_mode2, _this_deps_config_getAdsConfig_general2, _this_deps_config2, _this_deps3;
81806
+ if (!((_this_deps3 = this.deps) === null || _this_deps3 === void 0 ? void 0 : (_this_deps_config2 = _this_deps3.config) === null || _this_deps_config2 === void 0 ? void 0 : (_this_deps_config_getAdsConfig_general2 = _this_deps_config2.getAdsConfig().general) === null || _this_deps_config_getAdsConfig_general2 === void 0 ? void 0 : (_this_deps_config_getAdsConfig_general_debug_mode2 = _this_deps_config_getAdsConfig_general2.debug_mode) === null || _this_deps_config_getAdsConfig_general_debug_mode2 === void 0 ? void 0 : _this_deps_config_getAdsConfig_general_debug_mode2.value)) {
81807
+ plugins2.push(new RegionBorderPlugin({
81754
81808
  useFeather: true
81755
- })
81756
- ];
81809
+ }));
81810
+ }
81811
+ plugins2.push(new RegionMaskPlugin());
81757
81812
  }
81758
81813
  if (!((_this_deps2 = this.deps) === null || _this_deps2 === void 0 ? void 0 : (_this_deps_config1 = _this_deps2.config) === null || _this_deps_config1 === void 0 ? void 0 : (_this_deps_config_getAdsConfig_general1 = _this_deps_config1.getAdsConfig().general) === null || _this_deps_config_getAdsConfig_general1 === void 0 ? void 0 : (_this_deps_config_getAdsConfig_general_debug_mode1 = _this_deps_config_getAdsConfig_general1.debug_mode) === null || _this_deps_config_getAdsConfig_general_debug_mode1 === void 0 ? void 0 : _this_deps_config_getAdsConfig_general_debug_mode1.value) && (this.deps.strategy === "banner" || this.deps.strategy === "bannerv2" || this.deps.strategy === "bannerv2_ocr" || this.deps.strategy === "test")) {
81759
81814
  plugins2.push(new RegionBorderPlugin(), new RegionAnimationPlugin());
@@ -82706,9 +82761,7 @@ var VideoAds = /*#__PURE__*/ function() {
82706
82761
  },
82707
82762
  {
82708
82763
  key: "handlePageMutation",
82709
- value: function handlePageMutation() {
82710
- this.handleMedias();
82711
- }
82764
+ value: function handlePageMutation() {}
82712
82765
  },
82713
82766
  {
82714
82767
  key: "updateSize",