@brndts/brndts-ads 1.13.14 → 1.13.16

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
@@ -73049,7 +73049,7 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73049
73049
  throw new InternalError("Invalid YouTube URL");
73050
73050
  }
73051
73051
  var params = {
73052
- videoId: this._source.videoId || void 0,
73052
+ videoId: this._source.videoId || "",
73053
73053
  host: getHost(config2),
73054
73054
  playerVars: {
73055
73055
  enablejsapi: 1,
@@ -75460,6 +75460,56 @@ var VideoRegionsDataManager = /*#__PURE__*/ function(_import_events4_EventEmitte
75460
75460
  input.click();
75461
75461
  }
75462
75462
  },
75463
+ {
75464
+ key: "findRegionAppearancePeriods",
75465
+ value: function findRegionAppearancePeriods(regionId, minDurationSeconds) {
75466
+ var data = this.regionsData.data;
75467
+ var appearanceTimestamps = Object.values(data).filter(function(info) {
75468
+ return info.regions.some(function(region) {
75469
+ return region.id === regionId;
75470
+ });
75471
+ }).map(function(info) {
75472
+ return {
75473
+ start: info.timestamp_start,
75474
+ end: info.timestamp_end
75475
+ };
75476
+ }).sort(function(a, b) {
75477
+ return a.start - b.start;
75478
+ });
75479
+ if (appearanceTimestamps.length === 0) {
75480
+ return [];
75481
+ }
75482
+ var validPeriods = [];
75483
+ var currentPeriodStart = appearanceTimestamps[0].start;
75484
+ var currentPeriodEnd = appearanceTimestamps[0].end;
75485
+ for(var i = 1; i < appearanceTimestamps.length; i++){
75486
+ var current = appearanceTimestamps[i];
75487
+ if (current.start <= currentPeriodEnd) {
75488
+ currentPeriodEnd = Math.max(currentPeriodEnd, current.end);
75489
+ } else {
75490
+ var duration = currentPeriodEnd - currentPeriodStart;
75491
+ if (duration >= minDurationSeconds) {
75492
+ validPeriods.push({
75493
+ start: currentPeriodStart,
75494
+ end: currentPeriodEnd,
75495
+ duration: duration
75496
+ });
75497
+ }
75498
+ currentPeriodStart = current.start;
75499
+ currentPeriodEnd = current.end;
75500
+ }
75501
+ }
75502
+ var finalDuration = currentPeriodEnd - currentPeriodStart;
75503
+ if (finalDuration >= minDurationSeconds) {
75504
+ validPeriods.push({
75505
+ start: currentPeriodStart,
75506
+ end: currentPeriodEnd,
75507
+ duration: finalDuration
75508
+ });
75509
+ }
75510
+ return validPeriods;
75511
+ }
75512
+ },
75463
75513
  {
75464
75514
  key: "destroy",
75465
75515
  value: function destroy() {
@@ -82458,10 +82508,10 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
82458
82508
  {
82459
82509
  key: "destroy",
82460
82510
  value: function destroy() {
82461
- var _this_adPresentationStrategy, _this_regionsRenderer, _this_context_interface;
82511
+ var _this_adPresentationStrategy, _this_regionsRenderer, _this_context_recorder, _this_context_interface;
82462
82512
  (_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.destroy();
82463
82513
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.destroy();
82464
- this.context.recorder.destroy();
82514
+ (_this_context_recorder = this.context.recorder) === null || _this_context_recorder === void 0 ? void 0 : _this_context_recorder.destroy();
82465
82515
  (_this_context_interface = this.context.interface) === null || _this_context_interface === void 0 ? void 0 : _this_context_interface.destroy();
82466
82516
  }
82467
82517
  }