@brndts/brndts-ads 1.13.15 → 1.13.17
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.css +0 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +580 -298
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +581 -296
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
@@ -67865,6 +67865,7 @@ var AdsConfigsClass = /*#__PURE__*/ function(BRNDTSConfig) {
|
|
67865
67865
|
adStrategies: strategies
|
67866
67866
|
};
|
67867
67867
|
_this.merge();
|
67868
|
+
console.log("Ads strategies fetched", _this.remote.adStrategies);
|
67868
67869
|
})
|
67869
67870
|
];
|
67870
67871
|
case 1:
|
@@ -71371,16 +71372,20 @@ var RegionBorderPlugin = /*#__PURE__*/ function() {
|
|
71371
71372
|
{
|
71372
71373
|
key: "beforeShow",
|
71373
71374
|
value: function beforeShow(region) {
|
71374
|
-
var
|
71375
|
-
if (!region.hasContent)
|
71376
|
-
|
71377
|
-
|
71378
|
-
|
71379
|
-
|
71380
|
-
|
71381
|
-
|
71382
|
-
|
71383
|
-
|
71375
|
+
var _this = this;
|
71376
|
+
if (!region.hasContent) return Promise.resolve();
|
71377
|
+
return new Promise(function(resolve) {
|
71378
|
+
requestAnimationFrame(function() {
|
71379
|
+
var _this_options;
|
71380
|
+
var view = region.content.view;
|
71381
|
+
if ((_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.useFeather) {
|
71382
|
+
view.classList.toggle("BRNDTS_R_FTH", true);
|
71383
|
+
} else {
|
71384
|
+
view.classList.toggle("BRNDTS_R_B", true);
|
71385
|
+
}
|
71386
|
+
resolve();
|
71387
|
+
});
|
71388
|
+
});
|
71384
71389
|
}
|
71385
71390
|
},
|
71386
71391
|
{
|
@@ -72844,10 +72849,15 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
|
|
72844
72849
|
key: "assurePlaybackState",
|
72845
72850
|
value: function assurePlaybackState(play) {
|
72846
72851
|
if (this.media && this.media.hasPlayed) {
|
72847
|
-
var
|
72848
|
-
|
72849
|
-
|
72850
|
-
this.
|
72852
|
+
var _this_instance;
|
72853
|
+
var newVideoIndex = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.getPlaylistIndex();
|
72854
|
+
if (newVideoIndex !== this.currentVideoIndex) {
|
72855
|
+
this.currentVideoIndex = newVideoIndex;
|
72856
|
+
if (this._source && this._source.type === "playlist") {
|
72857
|
+
var _this__source;
|
72858
|
+
this._source.videoId = this.videoId;
|
72859
|
+
this.emit("UPDATED_SOURCE", (_this__source = this._source) === null || _this__source === void 0 ? void 0 : _this__source.videoId);
|
72860
|
+
}
|
72851
72861
|
}
|
72852
72862
|
}
|
72853
72863
|
if (this.media && play && !this.media.hasPlayed) {
|
@@ -72883,11 +72893,13 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
|
|
72883
72893
|
key: "handleYTPlayerReady",
|
72884
72894
|
value: function handleYTPlayerReady(event) {
|
72885
72895
|
var _this = this;
|
72896
|
+
var _this_instance;
|
72886
72897
|
if (this.instance) {
|
72887
72898
|
this.context.logger.warn("Instance already found!");
|
72888
72899
|
return;
|
72889
72900
|
}
|
72890
72901
|
this.instance = event.target;
|
72902
|
+
this.currentVideoIndex = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.getPlaylistIndex();
|
72891
72903
|
this.ready = true;
|
72892
72904
|
this.observeResize();
|
72893
72905
|
this.context.store.dispatch({
|
@@ -75379,6 +75391,56 @@ var VideoRegionsDataManager = /*#__PURE__*/ function(_import_events4_EventEmitte
|
|
75379
75391
|
input.click();
|
75380
75392
|
}
|
75381
75393
|
},
|
75394
|
+
{
|
75395
|
+
key: "findRegionAppearancePeriods",
|
75396
|
+
value: function findRegionAppearancePeriods(regionId, minDurationSeconds) {
|
75397
|
+
var data = this.regionsData.data;
|
75398
|
+
var appearanceTimestamps = Object.values(data).filter(function(info) {
|
75399
|
+
return info.regions.some(function(region) {
|
75400
|
+
return region.id === regionId;
|
75401
|
+
});
|
75402
|
+
}).map(function(info) {
|
75403
|
+
return {
|
75404
|
+
start: info.timestamp_start,
|
75405
|
+
end: info.timestamp_end
|
75406
|
+
};
|
75407
|
+
}).sort(function(a, b) {
|
75408
|
+
return a.start - b.start;
|
75409
|
+
});
|
75410
|
+
if (appearanceTimestamps.length === 0) {
|
75411
|
+
return [];
|
75412
|
+
}
|
75413
|
+
var validPeriods = [];
|
75414
|
+
var currentPeriodStart = appearanceTimestamps[0].start;
|
75415
|
+
var currentPeriodEnd = appearanceTimestamps[0].end;
|
75416
|
+
for(var i = 1; i < appearanceTimestamps.length; i++){
|
75417
|
+
var current = appearanceTimestamps[i];
|
75418
|
+
if (current.start <= currentPeriodEnd) {
|
75419
|
+
currentPeriodEnd = Math.max(currentPeriodEnd, current.end);
|
75420
|
+
} else {
|
75421
|
+
var duration = currentPeriodEnd - currentPeriodStart;
|
75422
|
+
if (duration >= minDurationSeconds) {
|
75423
|
+
validPeriods.push({
|
75424
|
+
start: currentPeriodStart,
|
75425
|
+
end: currentPeriodEnd,
|
75426
|
+
duration: duration
|
75427
|
+
});
|
75428
|
+
}
|
75429
|
+
currentPeriodStart = current.start;
|
75430
|
+
currentPeriodEnd = current.end;
|
75431
|
+
}
|
75432
|
+
}
|
75433
|
+
var finalDuration = currentPeriodEnd - currentPeriodStart;
|
75434
|
+
if (finalDuration >= minDurationSeconds) {
|
75435
|
+
validPeriods.push({
|
75436
|
+
start: currentPeriodStart,
|
75437
|
+
end: currentPeriodEnd,
|
75438
|
+
duration: finalDuration
|
75439
|
+
});
|
75440
|
+
}
|
75441
|
+
return validPeriods;
|
75442
|
+
}
|
75443
|
+
},
|
75382
75444
|
{
|
75383
75445
|
key: "destroy",
|
75384
75446
|
value: function destroy() {
|
@@ -75392,232 +75454,6 @@ var VideoRegionsDataManager = /*#__PURE__*/ function(_import_events4_EventEmitte
|
|
75392
75454
|
]);
|
75393
75455
|
return VideoRegionsDataManager;
|
75394
75456
|
}(import_events4.EventEmitter);
|
75395
|
-
// src/Ads/VideoAds/VideoRegionsData/VideoRegionsDataManagerDecorator.ts
|
75396
|
-
var VideoRegionsDataManagerDecorator = /*#__PURE__*/ function() {
|
75397
|
-
function VideoRegionsDataManagerDecorator(component) {
|
75398
|
-
_class_call_check(this, VideoRegionsDataManagerDecorator);
|
75399
|
-
this.component = component;
|
75400
|
-
}
|
75401
|
-
_create_class(VideoRegionsDataManagerDecorator, [
|
75402
|
-
{
|
75403
|
-
key: "data",
|
75404
|
-
get: function get() {
|
75405
|
-
return this.component.data;
|
75406
|
-
}
|
75407
|
-
},
|
75408
|
-
{
|
75409
|
-
key: "on",
|
75410
|
-
value: function on(event, handler) {
|
75411
|
-
return this.component.on(event, handler);
|
75412
|
-
}
|
75413
|
-
},
|
75414
|
-
{
|
75415
|
-
key: "fetch",
|
75416
|
-
value: function fetch1() {
|
75417
|
-
return this.component.fetch();
|
75418
|
-
}
|
75419
|
-
},
|
75420
|
-
{
|
75421
|
-
key: "seek",
|
75422
|
-
value: function seek(timestamp) {
|
75423
|
-
return this.component.seek(timestamp);
|
75424
|
-
}
|
75425
|
-
},
|
75426
|
-
{
|
75427
|
-
key: "check",
|
75428
|
-
value: function check(timestamp) {
|
75429
|
-
return this.component.check(timestamp);
|
75430
|
-
}
|
75431
|
-
},
|
75432
|
-
{
|
75433
|
-
key: "get",
|
75434
|
-
value: function get(timestamp) {
|
75435
|
-
return this.component.get(timestamp);
|
75436
|
-
}
|
75437
|
-
},
|
75438
|
-
{
|
75439
|
-
key: "destroy",
|
75440
|
-
value: function destroy() {
|
75441
|
-
return this.component.destroy();
|
75442
|
-
}
|
75443
|
-
},
|
75444
|
-
{
|
75445
|
-
key: "dumps",
|
75446
|
-
value: function dumps(from, to) {
|
75447
|
-
return this.component.dumps(from, to);
|
75448
|
-
}
|
75449
|
-
},
|
75450
|
-
{
|
75451
|
-
key: "loads",
|
75452
|
-
value: function loads() {
|
75453
|
-
return this.component.loads();
|
75454
|
-
}
|
75455
|
-
}
|
75456
|
-
]);
|
75457
|
-
return VideoRegionsDataManagerDecorator;
|
75458
|
-
}();
|
75459
|
-
// src/Ads/VideoAds/VideoRegionsDurationDecorator.ts
|
75460
|
-
var VideoRegionsDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
75461
|
-
_inherits(VideoRegionsDurationDecorator, VideoRegionsDataManagerDecorator);
|
75462
|
-
function VideoRegionsDurationDecorator(component, params) {
|
75463
|
-
_class_call_check(this, VideoRegionsDurationDecorator);
|
75464
|
-
var _this;
|
75465
|
-
_this = _call_super(this, VideoRegionsDurationDecorator, [
|
75466
|
-
component
|
75467
|
-
]);
|
75468
|
-
_this.params = params;
|
75469
|
-
return _this;
|
75470
|
-
}
|
75471
|
-
_create_class(VideoRegionsDurationDecorator, [
|
75472
|
-
{
|
75473
|
-
key: "check",
|
75474
|
-
value: function check(timestamp) {
|
75475
|
-
var totalDuration = 0;
|
75476
|
-
var last;
|
75477
|
-
var result;
|
75478
|
-
var workingTimestamp = timestamp;
|
75479
|
-
while(totalDuration < this.params.duration){
|
75480
|
-
var regions2 = this.component.get(workingTimestamp);
|
75481
|
-
if (!regions2 || !regions2.regions) {
|
75482
|
-
return null;
|
75483
|
-
}
|
75484
|
-
if (!last) {
|
75485
|
-
last = regions2.regions.map(function(r3) {
|
75486
|
-
return r3.id;
|
75487
|
-
});
|
75488
|
-
result = _to_consumable_array(regions2.regions);
|
75489
|
-
return {
|
75490
|
-
timestamp_start: timestamp,
|
75491
|
-
timestamp_end: timestamp + totalDuration,
|
75492
|
-
regions: result
|
75493
|
-
};
|
75494
|
-
}
|
75495
|
-
var validRegions = regions2.regions.filter(function(reg) {
|
75496
|
-
return last === null || last === void 0 ? void 0 : last.includes(reg.id);
|
75497
|
-
});
|
75498
|
-
if (validRegions.length <= 0) {
|
75499
|
-
return null;
|
75500
|
-
}
|
75501
|
-
var duration = 0;
|
75502
|
-
if (regions2.timestamp_start < workingTimestamp) {
|
75503
|
-
duration = regions2.timestamp_end - workingTimestamp;
|
75504
|
-
} else {
|
75505
|
-
duration = regions2.timestamp_end - regions2.timestamp_start;
|
75506
|
-
}
|
75507
|
-
totalDuration += duration;
|
75508
|
-
workingTimestamp = regions2.timestamp_end + 1e-3 + 1e3;
|
75509
|
-
last = validRegions.map(function(r3) {
|
75510
|
-
return r3.id;
|
75511
|
-
});
|
75512
|
-
result = _to_consumable_array(validRegions);
|
75513
|
-
}
|
75514
|
-
if (!result) {
|
75515
|
-
return null;
|
75516
|
-
}
|
75517
|
-
return {
|
75518
|
-
timestamp_start: timestamp,
|
75519
|
-
timestamp_end: timestamp + totalDuration,
|
75520
|
-
regions: result
|
75521
|
-
};
|
75522
|
-
}
|
75523
|
-
}
|
75524
|
-
]);
|
75525
|
-
return VideoRegionsDurationDecorator;
|
75526
|
-
}(VideoRegionsDataManagerDecorator);
|
75527
|
-
var VideoRegionsMaxDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
75528
|
-
_inherits(VideoRegionsMaxDurationDecorator, VideoRegionsDataManagerDecorator);
|
75529
|
-
function VideoRegionsMaxDurationDecorator(component, params) {
|
75530
|
-
_class_call_check(this, VideoRegionsMaxDurationDecorator);
|
75531
|
-
var _this;
|
75532
|
-
_this = _call_super(this, VideoRegionsMaxDurationDecorator, [
|
75533
|
-
component
|
75534
|
-
]);
|
75535
|
-
_this.params = params;
|
75536
|
-
return _this;
|
75537
|
-
}
|
75538
|
-
_create_class(VideoRegionsMaxDurationDecorator, [
|
75539
|
-
{
|
75540
|
-
key: "check",
|
75541
|
-
value: function check(timestamp) {
|
75542
|
-
var totalDuration = 0;
|
75543
|
-
var last;
|
75544
|
-
var result;
|
75545
|
-
var workingTimestamp = timestamp;
|
75546
|
-
var filteredRegions = [];
|
75547
|
-
do {
|
75548
|
-
var regions2 = this.component.get(workingTimestamp);
|
75549
|
-
if (!regions2 || !regions2.regions) {
|
75550
|
-
break;
|
75551
|
-
}
|
75552
|
-
if (!last) {
|
75553
|
-
last = regions2.regions.map(function(r3) {
|
75554
|
-
return r3.id;
|
75555
|
-
});
|
75556
|
-
result = _to_consumable_array(regions2.regions);
|
75557
|
-
continue;
|
75558
|
-
}
|
75559
|
-
filteredRegions = regions2.regions.filter(function(reg) {
|
75560
|
-
if (last.includes(reg.id)) {
|
75561
|
-
return true;
|
75562
|
-
}
|
75563
|
-
return false;
|
75564
|
-
});
|
75565
|
-
if (filteredRegions.length <= 0) {
|
75566
|
-
break;
|
75567
|
-
}
|
75568
|
-
var duration = 0;
|
75569
|
-
if (regions2.timestamp_start < workingTimestamp) {
|
75570
|
-
duration = regions2.timestamp_end - workingTimestamp;
|
75571
|
-
} else {
|
75572
|
-
duration = regions2.timestamp_end - regions2.timestamp_start;
|
75573
|
-
}
|
75574
|
-
totalDuration += duration;
|
75575
|
-
workingTimestamp = regions2.timestamp_end + 1e-3 + 1e3;
|
75576
|
-
last = filteredRegions.map(function(r3) {
|
75577
|
-
return r3.id;
|
75578
|
-
});
|
75579
|
-
result = _to_consumable_array(filteredRegions);
|
75580
|
-
}while (true);
|
75581
|
-
if (!result || totalDuration < this.params.minDuration) {
|
75582
|
-
return null;
|
75583
|
-
}
|
75584
|
-
return {
|
75585
|
-
timestamp_start: timestamp,
|
75586
|
-
timestamp_end: timestamp + totalDuration,
|
75587
|
-
regions: result
|
75588
|
-
};
|
75589
|
-
}
|
75590
|
-
}
|
75591
|
-
]);
|
75592
|
-
return VideoRegionsMaxDurationDecorator;
|
75593
|
-
}(VideoRegionsDataManagerDecorator);
|
75594
|
-
var VideoRegionsDecoratorFactory = /*#__PURE__*/ function() {
|
75595
|
-
function VideoRegionsDecoratorFactory() {
|
75596
|
-
_class_call_check(this, VideoRegionsDecoratorFactory);
|
75597
|
-
}
|
75598
|
-
_create_class(VideoRegionsDecoratorFactory, null, [
|
75599
|
-
{
|
75600
|
-
key: "decorate",
|
75601
|
-
value: function decorate(component, params) {
|
75602
|
-
if (!params) {
|
75603
|
-
return component;
|
75604
|
-
}
|
75605
|
-
if (params.visibility_duration) {
|
75606
|
-
return new VideoRegionsDurationDecorator(component, {
|
75607
|
-
duration: params.visibility_duration.value
|
75608
|
-
});
|
75609
|
-
}
|
75610
|
-
if (params.minimum_display_time) {
|
75611
|
-
return new VideoRegionsMaxDurationDecorator(component, {
|
75612
|
-
minDuration: params.minimum_display_time.value
|
75613
|
-
});
|
75614
|
-
}
|
75615
|
-
return component;
|
75616
|
-
}
|
75617
|
-
}
|
75618
|
-
]);
|
75619
|
-
return VideoRegionsDecoratorFactory;
|
75620
|
-
}();
|
75621
75457
|
// src/Ads/VideoAds/State/Store.ts
|
75622
75458
|
function reducer(state, action) {
|
75623
75459
|
switch(action.type){
|
@@ -76145,10 +75981,9 @@ var DynamicDurationPresentation = /*#__PURE__*/ function(AbstractPresentation) {
|
|
76145
75981
|
this.stopRetry();
|
76146
75982
|
this.startPacing();
|
76147
75983
|
if (opts.expectedDuration && !this.presentationTimer.isPaused) {
|
76148
|
-
this.presentationTimer.setDuration(opts.expectedDuration);
|
76149
|
-
} else {
|
76150
|
-
this.presentationTimer.resume();
|
75984
|
+
this.presentationTimer.setDuration(opts.expectedDuration * 1e3);
|
76151
75985
|
}
|
75986
|
+
this.presentationTimer.resume();
|
76152
75987
|
}
|
76153
75988
|
},
|
76154
75989
|
{
|
@@ -79665,6 +79500,8 @@ var Controls = /*#__PURE__*/ function() {
|
|
79665
79500
|
this.context = context;
|
79666
79501
|
this.container = document.createElement("div");
|
79667
79502
|
this.container.id = "BRNDTS_CTL";
|
79503
|
+
this.container.style.width = "100%";
|
79504
|
+
this.container.style.height = "100%";
|
79668
79505
|
this.buildControls();
|
79669
79506
|
}
|
79670
79507
|
_create_class(Controls, [
|
@@ -79765,6 +79602,8 @@ var Backdrop = /*#__PURE__*/ function() {
|
|
79765
79602
|
this.context = context;
|
79766
79603
|
this.container = document.createElement("div");
|
79767
79604
|
this.container.id = "BRNDTS_BKD";
|
79605
|
+
this.container.style.width = "100%";
|
79606
|
+
this.container.style.height = "100%";
|
79768
79607
|
}
|
79769
79608
|
_create_class(Backdrop, [
|
79770
79609
|
{
|
@@ -81581,7 +81420,6 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
|
|
81581
81420
|
var _this_adPresentationStrategy, _this_regionsRenderer;
|
81582
81421
|
(_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
|
81583
81422
|
(_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
|
81584
|
-
this.context.logger.info("NotBasicPresentationMode has been stopped.");
|
81585
81423
|
}
|
81586
81424
|
},
|
81587
81425
|
{
|
@@ -81688,6 +81526,7 @@ var RegionFactory = /*#__PURE__*/ function() {
|
|
81688
81526
|
}));
|
81689
81527
|
}
|
81690
81528
|
plugins2.push(new RegionMaskPlugin());
|
81529
|
+
plugins2.push(new RegionAnimationPlugin("OPACITY"));
|
81691
81530
|
}
|
81692
81531
|
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")) {
|
81693
81532
|
plugins2.push(new RegionBorderPlugin(), new RegionAnimationPlugin());
|
@@ -82270,8 +82109,10 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
|
|
82270
82109
|
expectedDuration: regions2.timestamp_end - regions2.timestamp_start
|
82271
82110
|
});
|
82272
82111
|
} else {
|
82273
|
-
var _this_adPresentationStrategy1;
|
82112
|
+
var _this_adPresentationStrategy1, _this_regionsRenderer, _this_auxElementsRenderer;
|
82274
82113
|
(_this_adPresentationStrategy1 = _this.adPresentationStrategy) === null || _this_adPresentationStrategy1 === void 0 ? void 0 : _this_adPresentationStrategy1.endedPresentation();
|
82114
|
+
(_this_regionsRenderer = _this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
|
82115
|
+
(_this_auxElementsRenderer = _this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
|
82275
82116
|
}
|
82276
82117
|
}).on("pace", function() {
|
82277
82118
|
try {
|
@@ -82324,16 +82165,15 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
|
|
82324
82165
|
(_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
|
82325
82166
|
(_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
|
82326
82167
|
(_this_auxElementsRenderer = this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
|
82327
|
-
this.context.logger.info("NotBasicPresentationMode has been stopped.");
|
82328
82168
|
}
|
82329
82169
|
},
|
82330
82170
|
{
|
82331
82171
|
key: "destroy",
|
82332
82172
|
value: function destroy() {
|
82333
|
-
var _this_adPresentationStrategy, _this_regionsRenderer, _this_context_interface;
|
82173
|
+
var _this_adPresentationStrategy, _this_regionsRenderer, _this_context_recorder, _this_context_interface;
|
82334
82174
|
(_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.destroy();
|
82335
82175
|
(_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.destroy();
|
82336
|
-
this.context.recorder.destroy();
|
82176
|
+
(_this_context_recorder = this.context.recorder) === null || _this_context_recorder === void 0 ? void 0 : _this_context_recorder.destroy();
|
82337
82177
|
(_this_context_interface = this.context.interface) === null || _this_context_interface === void 0 ? void 0 : _this_context_interface.destroy();
|
82338
82178
|
}
|
82339
82179
|
}
|
@@ -82362,20 +82202,289 @@ var PresentationModeFactory = /*#__PURE__*/ function() {
|
|
82362
82202
|
]);
|
82363
82203
|
return PresentationModeFactory;
|
82364
82204
|
}();
|
82365
|
-
// src/Ads/VideoAds/
|
82366
|
-
var
|
82367
|
-
function
|
82368
|
-
_class_call_check(this,
|
82369
|
-
this.
|
82370
|
-
|
82371
|
-
|
82372
|
-
|
82373
|
-
|
82374
|
-
|
82375
|
-
|
82376
|
-
|
82377
|
-
|
82378
|
-
|
82205
|
+
// src/Ads/VideoAds/VideoRegionsData/VideoRegionsDataManagerDecorator.ts
|
82206
|
+
var VideoRegionsDataManagerDecorator = /*#__PURE__*/ function() {
|
82207
|
+
function VideoRegionsDataManagerDecorator(component) {
|
82208
|
+
_class_call_check(this, VideoRegionsDataManagerDecorator);
|
82209
|
+
this.component = component;
|
82210
|
+
}
|
82211
|
+
_create_class(VideoRegionsDataManagerDecorator, [
|
82212
|
+
{
|
82213
|
+
key: "data",
|
82214
|
+
get: function get() {
|
82215
|
+
return this.component.data;
|
82216
|
+
}
|
82217
|
+
},
|
82218
|
+
{
|
82219
|
+
key: "on",
|
82220
|
+
value: function on(event, handler) {
|
82221
|
+
return this.component.on(event, handler);
|
82222
|
+
}
|
82223
|
+
},
|
82224
|
+
{
|
82225
|
+
key: "fetch",
|
82226
|
+
value: function fetch1() {
|
82227
|
+
return this.component.fetch();
|
82228
|
+
}
|
82229
|
+
},
|
82230
|
+
{
|
82231
|
+
key: "seek",
|
82232
|
+
value: function seek(timestamp) {
|
82233
|
+
return this.component.seek(timestamp);
|
82234
|
+
}
|
82235
|
+
},
|
82236
|
+
{
|
82237
|
+
key: "check",
|
82238
|
+
value: function check(timestamp) {
|
82239
|
+
return this.component.check(timestamp);
|
82240
|
+
}
|
82241
|
+
},
|
82242
|
+
{
|
82243
|
+
key: "get",
|
82244
|
+
value: function get(timestamp) {
|
82245
|
+
return this.component.get(timestamp);
|
82246
|
+
}
|
82247
|
+
},
|
82248
|
+
{
|
82249
|
+
key: "destroy",
|
82250
|
+
value: function destroy() {
|
82251
|
+
return this.component.destroy();
|
82252
|
+
}
|
82253
|
+
},
|
82254
|
+
{
|
82255
|
+
key: "dumps",
|
82256
|
+
value: function dumps(from, to) {
|
82257
|
+
return this.component.dumps(from, to);
|
82258
|
+
}
|
82259
|
+
},
|
82260
|
+
{
|
82261
|
+
key: "loads",
|
82262
|
+
value: function loads() {
|
82263
|
+
return this.component.loads();
|
82264
|
+
}
|
82265
|
+
}
|
82266
|
+
]);
|
82267
|
+
return VideoRegionsDataManagerDecorator;
|
82268
|
+
}();
|
82269
|
+
// src/Ads/VideoAds/VideoRegionsData/VideoRegionsDecorators.ts
|
82270
|
+
var VideoRegionsDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
82271
|
+
_inherits(VideoRegionsDurationDecorator, VideoRegionsDataManagerDecorator);
|
82272
|
+
function VideoRegionsDurationDecorator(component, params) {
|
82273
|
+
_class_call_check(this, VideoRegionsDurationDecorator);
|
82274
|
+
var _this;
|
82275
|
+
_this = _call_super(this, VideoRegionsDurationDecorator, [
|
82276
|
+
component
|
82277
|
+
]);
|
82278
|
+
_this.params = params;
|
82279
|
+
return _this;
|
82280
|
+
}
|
82281
|
+
_create_class(VideoRegionsDurationDecorator, [
|
82282
|
+
{
|
82283
|
+
key: "check",
|
82284
|
+
value: function check(timestamp) {
|
82285
|
+
var totalDuration = 0;
|
82286
|
+
var last;
|
82287
|
+
var result;
|
82288
|
+
var workingTimestamp = timestamp;
|
82289
|
+
while(totalDuration < this.params.duration){
|
82290
|
+
var regions2 = this.component.get(workingTimestamp);
|
82291
|
+
if (!regions2 || !regions2.regions) {
|
82292
|
+
return null;
|
82293
|
+
}
|
82294
|
+
if (!last) {
|
82295
|
+
last = regions2.regions.map(function(r3) {
|
82296
|
+
return r3.id;
|
82297
|
+
});
|
82298
|
+
result = _to_consumable_array(regions2.regions);
|
82299
|
+
}
|
82300
|
+
var validRegions = regions2.regions.filter(function(reg) {
|
82301
|
+
return last === null || last === void 0 ? void 0 : last.includes(reg.id);
|
82302
|
+
});
|
82303
|
+
if (validRegions.length <= 0) {
|
82304
|
+
return null;
|
82305
|
+
}
|
82306
|
+
var duration = 0;
|
82307
|
+
if (regions2.timestamp_start < workingTimestamp) {
|
82308
|
+
duration = regions2.timestamp_end - workingTimestamp;
|
82309
|
+
} else {
|
82310
|
+
duration = regions2.timestamp_end - regions2.timestamp_start;
|
82311
|
+
}
|
82312
|
+
totalDuration += duration;
|
82313
|
+
workingTimestamp = regions2.timestamp_end + 0.01;
|
82314
|
+
last = validRegions.map(function(r3) {
|
82315
|
+
return r3.id;
|
82316
|
+
});
|
82317
|
+
result = _to_consumable_array(validRegions);
|
82318
|
+
}
|
82319
|
+
if (!result) {
|
82320
|
+
return null;
|
82321
|
+
}
|
82322
|
+
return {
|
82323
|
+
timestamp_start: timestamp,
|
82324
|
+
timestamp_end: timestamp + totalDuration,
|
82325
|
+
regions: result
|
82326
|
+
};
|
82327
|
+
}
|
82328
|
+
}
|
82329
|
+
]);
|
82330
|
+
return VideoRegionsDurationDecorator;
|
82331
|
+
}(VideoRegionsDataManagerDecorator);
|
82332
|
+
var VideoRegionsMaxDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
82333
|
+
_inherits(VideoRegionsMaxDurationDecorator, VideoRegionsDataManagerDecorator);
|
82334
|
+
function VideoRegionsMaxDurationDecorator(component, params) {
|
82335
|
+
_class_call_check(this, VideoRegionsMaxDurationDecorator);
|
82336
|
+
var _this;
|
82337
|
+
_this = _call_super(this, VideoRegionsMaxDurationDecorator, [
|
82338
|
+
component
|
82339
|
+
]);
|
82340
|
+
_this.params = params;
|
82341
|
+
return _this;
|
82342
|
+
}
|
82343
|
+
_create_class(VideoRegionsMaxDurationDecorator, [
|
82344
|
+
{
|
82345
|
+
key: "check",
|
82346
|
+
value: function check(timestamp) {
|
82347
|
+
var totalDuration = 0;
|
82348
|
+
var last;
|
82349
|
+
var result;
|
82350
|
+
var workingTimestamp = timestamp;
|
82351
|
+
do {
|
82352
|
+
var regions2 = this.component.get(workingTimestamp);
|
82353
|
+
if (!regions2 || !regions2.regions) {
|
82354
|
+
break;
|
82355
|
+
}
|
82356
|
+
if (!last) {
|
82357
|
+
last = regions2.regions.map(function(r3) {
|
82358
|
+
return r3.id;
|
82359
|
+
});
|
82360
|
+
result = _to_consumable_array(regions2.regions);
|
82361
|
+
}
|
82362
|
+
var validRegions = regions2.regions.filter(function(reg) {
|
82363
|
+
return last === null || last === void 0 ? void 0 : last.includes(reg.id);
|
82364
|
+
});
|
82365
|
+
if (validRegions.length <= 0) {
|
82366
|
+
break;
|
82367
|
+
}
|
82368
|
+
var duration = 0;
|
82369
|
+
if (regions2.timestamp_start < workingTimestamp) {
|
82370
|
+
duration = regions2.timestamp_end - workingTimestamp;
|
82371
|
+
} else {
|
82372
|
+
duration = regions2.timestamp_end - regions2.timestamp_start;
|
82373
|
+
}
|
82374
|
+
totalDuration += duration;
|
82375
|
+
workingTimestamp = regions2.timestamp_end + 0.01;
|
82376
|
+
last = validRegions.map(function(r3) {
|
82377
|
+
return r3.id;
|
82378
|
+
});
|
82379
|
+
result = _to_consumable_array(validRegions);
|
82380
|
+
}while (true);
|
82381
|
+
if (!result || totalDuration < this.params.minDuration) {
|
82382
|
+
return null;
|
82383
|
+
}
|
82384
|
+
return {
|
82385
|
+
timestamp_start: timestamp,
|
82386
|
+
timestamp_end: timestamp + totalDuration,
|
82387
|
+
regions: result
|
82388
|
+
};
|
82389
|
+
}
|
82390
|
+
}
|
82391
|
+
]);
|
82392
|
+
return VideoRegionsMaxDurationDecorator;
|
82393
|
+
}(VideoRegionsDataManagerDecorator);
|
82394
|
+
var VideoRegionsTypeFilterDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
82395
|
+
_inherits(VideoRegionsTypeFilterDecorator, VideoRegionsDataManagerDecorator);
|
82396
|
+
function VideoRegionsTypeFilterDecorator(component, params) {
|
82397
|
+
_class_call_check(this, VideoRegionsTypeFilterDecorator);
|
82398
|
+
var _this;
|
82399
|
+
_this = _call_super(this, VideoRegionsTypeFilterDecorator, [
|
82400
|
+
component
|
82401
|
+
]);
|
82402
|
+
if (params && params.value && Array.isArray(params.value)) {
|
82403
|
+
var _params_setting_constraints;
|
82404
|
+
var regionsMap = ((_params_setting_constraints = params.setting.constraints) === null || _params_setting_constraints === void 0 ? void 0 : _params_setting_constraints.mapped_allowed_values_ids) || {};
|
82405
|
+
_this.allowedRegions = params.value.map(function(r3) {
|
82406
|
+
return regionsMap[r3];
|
82407
|
+
}).filter(Boolean);
|
82408
|
+
}
|
82409
|
+
return _this;
|
82410
|
+
}
|
82411
|
+
_create_class(VideoRegionsTypeFilterDecorator, [
|
82412
|
+
{
|
82413
|
+
key: "check",
|
82414
|
+
value: function check(timestamp) {
|
82415
|
+
var _this = this;
|
82416
|
+
var data = this.component.check(timestamp);
|
82417
|
+
if (this.allowedRegions !== void 0 && data && data.regions) {
|
82418
|
+
data.regions = data.regions.filter(function(region) {
|
82419
|
+
var _this_allowedRegions;
|
82420
|
+
return (_this_allowedRegions = _this.allowedRegions) === null || _this_allowedRegions === void 0 ? void 0 : _this_allowedRegions.includes(region.id);
|
82421
|
+
});
|
82422
|
+
}
|
82423
|
+
return data;
|
82424
|
+
}
|
82425
|
+
},
|
82426
|
+
{
|
82427
|
+
key: "get",
|
82428
|
+
value: function get(timestamp) {
|
82429
|
+
var _this = this;
|
82430
|
+
var data = this.component.get(timestamp);
|
82431
|
+
if (this.allowedRegions !== void 0 && data && data.regions) {
|
82432
|
+
data.regions = data.regions.filter(function(region) {
|
82433
|
+
var _this_allowedRegions;
|
82434
|
+
return (_this_allowedRegions = _this.allowedRegions) === null || _this_allowedRegions === void 0 ? void 0 : _this_allowedRegions.includes(region.id);
|
82435
|
+
});
|
82436
|
+
}
|
82437
|
+
return data;
|
82438
|
+
}
|
82439
|
+
}
|
82440
|
+
]);
|
82441
|
+
return VideoRegionsTypeFilterDecorator;
|
82442
|
+
}(VideoRegionsDataManagerDecorator);
|
82443
|
+
var VideoRegionsDecoratorFactory = /*#__PURE__*/ function() {
|
82444
|
+
function VideoRegionsDecoratorFactory() {
|
82445
|
+
_class_call_check(this, VideoRegionsDecoratorFactory);
|
82446
|
+
}
|
82447
|
+
_create_class(VideoRegionsDecoratorFactory, null, [
|
82448
|
+
{
|
82449
|
+
key: "decorate",
|
82450
|
+
value: function decorate(component, params) {
|
82451
|
+
var _params_visibility_duration, _params_minimum_display_time, _params_ad_placements_and_sizes;
|
82452
|
+
var target = component;
|
82453
|
+
if (!params) {
|
82454
|
+
return target;
|
82455
|
+
}
|
82456
|
+
if ((_params_visibility_duration = params.visibility_duration) === null || _params_visibility_duration === void 0 ? void 0 : _params_visibility_duration.value) {
|
82457
|
+
target = new VideoRegionsDurationDecorator(target, {
|
82458
|
+
duration: params.visibility_duration.value
|
82459
|
+
});
|
82460
|
+
} else if ((_params_minimum_display_time = params.minimum_display_time) === null || _params_minimum_display_time === void 0 ? void 0 : _params_minimum_display_time.value) {
|
82461
|
+
target = new VideoRegionsMaxDurationDecorator(target, {
|
82462
|
+
minDuration: params.minimum_display_time.value
|
82463
|
+
});
|
82464
|
+
}
|
82465
|
+
if ((_params_ad_placements_and_sizes = params.ad_placements_and_sizes) === null || _params_ad_placements_and_sizes === void 0 ? void 0 : _params_ad_placements_and_sizes.value) {
|
82466
|
+
target = new VideoRegionsTypeFilterDecorator(target, params.ad_placements_and_sizes);
|
82467
|
+
}
|
82468
|
+
return target;
|
82469
|
+
}
|
82470
|
+
}
|
82471
|
+
]);
|
82472
|
+
return VideoRegionsDecoratorFactory;
|
82473
|
+
}();
|
82474
|
+
// src/Ads/VideoAds/VideoAd.ts
|
82475
|
+
var VideoAd = /*#__PURE__*/ function() {
|
82476
|
+
function VideoAd(context, target) {
|
82477
|
+
_class_call_check(this, VideoAd);
|
82478
|
+
this.handleInfo = this.handleInfo.bind(this);
|
82479
|
+
this.context = context;
|
82480
|
+
var videoAdContext = {
|
82481
|
+
config: context.config,
|
82482
|
+
elements: {
|
82483
|
+
container: null,
|
82484
|
+
original: null,
|
82485
|
+
fullscreen: null
|
82486
|
+
},
|
82487
|
+
store: new Store(void 0, this.context.logger),
|
82379
82488
|
user: context.user,
|
82380
82489
|
location: context.location,
|
82381
82490
|
device: context.device,
|
@@ -82438,7 +82547,8 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82438
82547
|
}, {
|
82439
82548
|
logger: this.videoAdContext.logger,
|
82440
82549
|
// @ts-expect-error
|
82441
|
-
service: this.videoAdContext.service.join("".concat(data.video, "-").concat(this.videoAdContext.config.getStrategy().code))
|
82550
|
+
service: this.videoAdContext.service.join("".concat(data.video, "-").concat(this.videoAdContext.config.getStrategy().code)),
|
82551
|
+
config: this.videoAdContext.config
|
82442
82552
|
});
|
82443
82553
|
this.videoAdContext.store.dispatch({
|
82444
82554
|
type: "UPDATE_VIDEO_INFO",
|
@@ -82503,6 +82613,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82503
82613
|
key: "updateRegionData",
|
82504
82614
|
value: function updateRegionData() {
|
82505
82615
|
var _this = this;
|
82616
|
+
var _this_presentation;
|
82506
82617
|
if (this.videoRegions) {
|
82507
82618
|
var _this_videoRegions;
|
82508
82619
|
(_this_videoRegions = this.videoRegions) === null || _this_videoRegions === void 0 ? void 0 : _this_videoRegions.destroy();
|
@@ -82511,10 +82622,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82511
82622
|
this.videoAdContext.recorder.destroy();
|
82512
82623
|
this.videoAdContext.recorder = void 0;
|
82513
82624
|
}
|
82514
|
-
|
82515
|
-
this.presentation.destroy();
|
82516
|
-
this.presentation = void 0;
|
82517
|
-
}
|
82625
|
+
(_this_presentation = this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.stop();
|
82518
82626
|
this.context.service.send("hs", {
|
82519
82627
|
source: this.videoAdContext.media.source,
|
82520
82628
|
strategy: this.videoAdContext.config.getStrategy().code
|
@@ -82532,7 +82640,8 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82532
82640
|
}
|
82533
82641
|
}, {
|
82534
82642
|
logger: _this.videoAdContext.logger,
|
82535
|
-
service: _this.context.service.join("".concat(data.video, "-").concat(_this.videoAdContext.config.getStrategy().code))
|
82643
|
+
service: _this.context.service.join("".concat(data.video, "-").concat(_this.videoAdContext.config.getStrategy().code)),
|
82644
|
+
config: _this.videoAdContext.config
|
82536
82645
|
});
|
82537
82646
|
_this.videoAdContext.store.dispatch({
|
82538
82647
|
type: "UPDATE_VIDEO_INFO",
|
@@ -82543,15 +82652,12 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82543
82652
|
}
|
82544
82653
|
});
|
82545
82654
|
_this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, _this.videoAdContext.config.getStrategySettings());
|
82546
|
-
_this.presentation = _this.presentationFactory.get({
|
82547
|
-
strategy: _this.videoAdContext.config.getStrategy().code
|
82548
|
-
});
|
82549
82655
|
_this.videoAdContext.data = _this.videoRegions;
|
82550
82656
|
_this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
|
82551
82657
|
id: data.video,
|
82552
82658
|
ts: 0
|
82553
82659
|
});
|
82554
|
-
(_this_presentation = _this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.
|
82660
|
+
(_this_presentation = _this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.start();
|
82555
82661
|
});
|
82556
82662
|
}
|
82557
82663
|
},
|
@@ -83059,8 +83165,156 @@ var Location = /*#__PURE__*/ function() {
|
|
83059
83165
|
]);
|
83060
83166
|
return Location;
|
83061
83167
|
}();
|
83062
|
-
// src/Service/
|
83168
|
+
// src/Service/LocalRealtime.ts
|
83063
83169
|
var import_events10 = __toESM(require_events());
|
83170
|
+
var DATA_STORE = {
|
83171
|
+
"video1": {}
|
83172
|
+
};
|
83173
|
+
var VIDEO_LIBRARY = {
|
83174
|
+
"video1": {
|
83175
|
+
source: ""
|
83176
|
+
}
|
83177
|
+
};
|
83178
|
+
var BRNDTSLocalRealtime = /*#__PURE__*/ function(_import_events10_default) {
|
83179
|
+
_inherits(BRNDTSLocalRealtime, _import_events10_default);
|
83180
|
+
function BRNDTSLocalRealtime(options, deps) {
|
83181
|
+
_class_call_check(this, BRNDTSLocalRealtime);
|
83182
|
+
var _this;
|
83183
|
+
_this = _call_super(this, BRNDTSLocalRealtime);
|
83184
|
+
_this.connected = new Changeable(false);
|
83185
|
+
_this.handlers = {
|
83186
|
+
info: [],
|
83187
|
+
result: [],
|
83188
|
+
completed: [],
|
83189
|
+
aborted: []
|
83190
|
+
};
|
83191
|
+
_this.options = options;
|
83192
|
+
_this.logger = deps.logger;
|
83193
|
+
if (!_this.options.ns) {
|
83194
|
+
window.__brndts_local_realtime = _this;
|
83195
|
+
}
|
83196
|
+
return _this;
|
83197
|
+
}
|
83198
|
+
_create_class(BRNDTSLocalRealtime, [
|
83199
|
+
{
|
83200
|
+
key: "handleOpen",
|
83201
|
+
value: function handleOpen() {
|
83202
|
+
this.connected.value = true;
|
83203
|
+
this.emit("connected");
|
83204
|
+
}
|
83205
|
+
},
|
83206
|
+
{
|
83207
|
+
key: "handleClose",
|
83208
|
+
value: function handleClose() {
|
83209
|
+
this.connected.value = false;
|
83210
|
+
this.emit("disconnected");
|
83211
|
+
}
|
83212
|
+
},
|
83213
|
+
{
|
83214
|
+
key: "connect",
|
83215
|
+
value: function connect() {
|
83216
|
+
this.handleOpen();
|
83217
|
+
}
|
83218
|
+
},
|
83219
|
+
{
|
83220
|
+
key: "respond",
|
83221
|
+
value: function respond(event, payload) {
|
83222
|
+
if (this.handlers[event]) {
|
83223
|
+
this.handlers[event].forEach(function(handler) {
|
83224
|
+
handler(payload);
|
83225
|
+
});
|
83226
|
+
}
|
83227
|
+
}
|
83228
|
+
},
|
83229
|
+
{
|
83230
|
+
key: "loads",
|
83231
|
+
value: function loads(videoId) {
|
83232
|
+
var _this = this;
|
83233
|
+
var _this_logger;
|
83234
|
+
(_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Loading data for :", videoId);
|
83235
|
+
var input = document.createElement("input");
|
83236
|
+
input.type = "file";
|
83237
|
+
input === null || input === void 0 ? void 0 : input.addEventListener("change", function(event) {
|
83238
|
+
var _input_files;
|
83239
|
+
var file = input === null || input === void 0 ? void 0 : (_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files[0];
|
83240
|
+
if (!file) {
|
83241
|
+
console.log("No file selected.");
|
83242
|
+
return;
|
83243
|
+
}
|
83244
|
+
var reader = new FileReader();
|
83245
|
+
reader.onload = function(event2) {
|
83246
|
+
var _event2_target;
|
83247
|
+
var fileContent = event2 === null || event2 === void 0 ? void 0 : (_event2_target = event2.target) === null || _event2_target === void 0 ? void 0 : _event2_target.result;
|
83248
|
+
if (fileContent) {
|
83249
|
+
var _this_logger;
|
83250
|
+
var parsedData = JSON.parse(fileContent);
|
83251
|
+
DATA_STORE[videoId] = parsedData;
|
83252
|
+
(_this_logger = _this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Loaded data for :", videoId);
|
83253
|
+
_this.respond("result", DATA_STORE[videoId]);
|
83254
|
+
}
|
83255
|
+
};
|
83256
|
+
reader.readAsText(file);
|
83257
|
+
});
|
83258
|
+
input.click();
|
83259
|
+
}
|
83260
|
+
},
|
83261
|
+
{
|
83262
|
+
key: "send",
|
83263
|
+
value: function send(event) {
|
83264
|
+
for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
83265
|
+
payload[_key - 1] = arguments[_key];
|
83266
|
+
}
|
83267
|
+
var _this_logger;
|
83268
|
+
(_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Received event :", event, payload);
|
83269
|
+
if (event === "hs") {
|
83270
|
+
var _this_logger1;
|
83271
|
+
(_this_logger1 = this.logger) === null || _this_logger1 === void 0 ? void 0 : _this_logger1.log("[REALTIME LOCAL] handling event :", event, payload);
|
83272
|
+
var _payload = _sliced_to_array(payload, 2), data = _payload[0], cb = _payload[1];
|
83273
|
+
var videoId = "video1";
|
83274
|
+
VIDEO_LIBRARY[videoId] = {
|
83275
|
+
// @ts-expect-error
|
83276
|
+
source: data.source
|
83277
|
+
};
|
83278
|
+
cb === null || cb === void 0 ? void 0 : cb({
|
83279
|
+
video: videoId
|
83280
|
+
});
|
83281
|
+
}
|
83282
|
+
}
|
83283
|
+
},
|
83284
|
+
{
|
83285
|
+
key: "handle",
|
83286
|
+
value: function handle(event, handler) {
|
83287
|
+
if (!this.handlers[event]) {
|
83288
|
+
this.handlers[event] = [];
|
83289
|
+
}
|
83290
|
+
this.handlers[event].push(handler);
|
83291
|
+
}
|
83292
|
+
},
|
83293
|
+
{
|
83294
|
+
key: "join",
|
83295
|
+
value: function join(ns) {
|
83296
|
+
var _this = this;
|
83297
|
+
setTimeout(function() {
|
83298
|
+
var _ref = _sliced_to_array(ns.match(/^([^-]+)-(.+)$/) || [], 2), video = _ref[0], strategy = _ref[1];
|
83299
|
+
if (video && DATA_STORE[video]) {
|
83300
|
+
var regions2 = DATA_STORE[video];
|
83301
|
+
_this.respond("result", regions2);
|
83302
|
+
}
|
83303
|
+
}, 150);
|
83304
|
+
return this;
|
83305
|
+
}
|
83306
|
+
},
|
83307
|
+
{
|
83308
|
+
key: "destroy",
|
83309
|
+
value: function destroy() {
|
83310
|
+
this.handleClose();
|
83311
|
+
}
|
83312
|
+
}
|
83313
|
+
]);
|
83314
|
+
return BRNDTSLocalRealtime;
|
83315
|
+
}(import_events10.default);
|
83316
|
+
// src/Service/Realtime.ts
|
83317
|
+
var import_events11 = __toESM(require_events());
|
83064
83318
|
// node_modules/engine.io-parser/build/esm/commons.js
|
83065
83319
|
var PACKET_TYPES = /* @__PURE__ */ Object.create(null);
|
83066
83320
|
PACKET_TYPES["open"] = "0";
|
@@ -86908,8 +87162,8 @@ Object.assign(lookup2, {
|
|
86908
87162
|
connect: lookup2
|
86909
87163
|
});
|
86910
87164
|
// src/Service/Realtime.ts
|
86911
|
-
var BRNDTSRealtime = /*#__PURE__*/ function(
|
86912
|
-
_inherits(_BRNDTSRealtime,
|
87165
|
+
var BRNDTSRealtime = /*#__PURE__*/ function(_import_events11_default) {
|
87166
|
+
_inherits(_BRNDTSRealtime, _import_events11_default);
|
86913
87167
|
function _BRNDTSRealtime(options, deps) {
|
86914
87168
|
_class_call_check(this, _BRNDTSRealtime);
|
86915
87169
|
var _this;
|
@@ -87007,9 +87261,36 @@ var BRNDTSRealtime = /*#__PURE__*/ function(_import_events10_default) {
|
|
87007
87261
|
}
|
87008
87262
|
]);
|
87009
87263
|
return _BRNDTSRealtime;
|
87010
|
-
}(
|
87011
|
-
// src/Service/
|
87012
|
-
var
|
87264
|
+
}(import_events11.default);
|
87265
|
+
// src/Service/ServiceFactory.ts
|
87266
|
+
var ServiceFactory = /*#__PURE__*/ function() {
|
87267
|
+
function ServiceFactory() {
|
87268
|
+
_class_call_check(this, ServiceFactory);
|
87269
|
+
}
|
87270
|
+
_create_class(ServiceFactory, null, [
|
87271
|
+
{
|
87272
|
+
key: "createService",
|
87273
|
+
value: function createService(context) {
|
87274
|
+
var serviceType = "remote";
|
87275
|
+
if (serviceType === "local") {
|
87276
|
+
return new BRNDTSLocalRealtime({
|
87277
|
+
host: context.config.get("host"),
|
87278
|
+
key: context.config.get("key")
|
87279
|
+
}, {
|
87280
|
+
logger: context.logger
|
87281
|
+
});
|
87282
|
+
}
|
87283
|
+
return new BRNDTSRealtime({
|
87284
|
+
host: context.config.get("host"),
|
87285
|
+
key: context.config.get("key")
|
87286
|
+
}, {
|
87287
|
+
logger: context.logger
|
87288
|
+
});
|
87289
|
+
}
|
87290
|
+
}
|
87291
|
+
]);
|
87292
|
+
return ServiceFactory;
|
87293
|
+
}();
|
87013
87294
|
// src/index.ts
|
87014
87295
|
var BrndtsAds = /*#__PURE__*/ function() {
|
87015
87296
|
function BrndtsAds(targets, options, adsOptions) {
|
@@ -87061,10 +87342,16 @@ var BrndtsAds = /*#__PURE__*/ function() {
|
|
87061
87342
|
case 1:
|
87062
87343
|
_state.trys.push([
|
87063
87344
|
1,
|
87064
|
-
|
87345
|
+
4,
|
87065
87346
|
,
|
87066
|
-
|
87347
|
+
5
|
87067
87348
|
]);
|
87349
|
+
if (!this.context.config.get("enabled")) {
|
87350
|
+
this.context.logger.error("Setup failed: disabled by config");
|
87351
|
+
return [
|
87352
|
+
2
|
87353
|
+
];
|
87354
|
+
}
|
87068
87355
|
this.context.location = new Location();
|
87069
87356
|
this.context.consent = ConsentFactory.get(this.context.logger);
|
87070
87357
|
return [
|
@@ -87075,35 +87362,30 @@ var BrndtsAds = /*#__PURE__*/ function() {
|
|
87075
87362
|
_state.sent();
|
87076
87363
|
this.context.user = new User(this.context.config, this.context.consent);
|
87077
87364
|
this.context.device = new Device();
|
87078
|
-
|
87079
|
-
|
87080
|
-
this.context.
|
87081
|
-
|
87082
|
-
|
87083
|
-
|
87084
|
-
|
87085
|
-
this.context.service =
|
87086
|
-
host: this.context.config.get("host"),
|
87087
|
-
key: this.context.config.get("key")
|
87088
|
-
}, {
|
87089
|
-
logger: this.context.logger
|
87090
|
-
});
|
87365
|
+
return [
|
87366
|
+
4,
|
87367
|
+
this.context.device.collect()
|
87368
|
+
];
|
87369
|
+
case 3:
|
87370
|
+
_state.sent();
|
87371
|
+
console.log("BRNDTS Ads Presenter started with config");
|
87372
|
+
this.context.service = ServiceFactory.createService(this.context);
|
87091
87373
|
this.context.service.on("connected", this.handleConnected);
|
87092
87374
|
this.context.service.connect();
|
87093
87375
|
return [
|
87094
87376
|
3,
|
87095
|
-
|
87377
|
+
5
|
87096
87378
|
];
|
87097
|
-
case
|
87379
|
+
case 4:
|
87098
87380
|
error = _state.sent();
|
87099
87381
|
if (_instanceof(error, Error)) {
|
87100
|
-
|
87382
|
+
console.log("Error during setup: ", error);
|
87101
87383
|
}
|
87102
87384
|
return [
|
87103
87385
|
3,
|
87104
|
-
|
87386
|
+
5
|
87105
87387
|
];
|
87106
|
-
case
|
87388
|
+
case 5:
|
87107
87389
|
return [
|
87108
87390
|
2
|
87109
87391
|
];
|