@brndts/brndts-ads 1.13.16 → 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 +543 -311
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +544 -309
- 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({
|
@@ -75442,232 +75454,6 @@ var VideoRegionsDataManager = /*#__PURE__*/ function(_import_events4_EventEmitte
|
|
75442
75454
|
]);
|
75443
75455
|
return VideoRegionsDataManager;
|
75444
75456
|
}(import_events4.EventEmitter);
|
75445
|
-
// src/Ads/VideoAds/VideoRegionsData/VideoRegionsDataManagerDecorator.ts
|
75446
|
-
var VideoRegionsDataManagerDecorator = /*#__PURE__*/ function() {
|
75447
|
-
function VideoRegionsDataManagerDecorator(component) {
|
75448
|
-
_class_call_check(this, VideoRegionsDataManagerDecorator);
|
75449
|
-
this.component = component;
|
75450
|
-
}
|
75451
|
-
_create_class(VideoRegionsDataManagerDecorator, [
|
75452
|
-
{
|
75453
|
-
key: "data",
|
75454
|
-
get: function get() {
|
75455
|
-
return this.component.data;
|
75456
|
-
}
|
75457
|
-
},
|
75458
|
-
{
|
75459
|
-
key: "on",
|
75460
|
-
value: function on(event, handler) {
|
75461
|
-
return this.component.on(event, handler);
|
75462
|
-
}
|
75463
|
-
},
|
75464
|
-
{
|
75465
|
-
key: "fetch",
|
75466
|
-
value: function fetch1() {
|
75467
|
-
return this.component.fetch();
|
75468
|
-
}
|
75469
|
-
},
|
75470
|
-
{
|
75471
|
-
key: "seek",
|
75472
|
-
value: function seek(timestamp) {
|
75473
|
-
return this.component.seek(timestamp);
|
75474
|
-
}
|
75475
|
-
},
|
75476
|
-
{
|
75477
|
-
key: "check",
|
75478
|
-
value: function check(timestamp) {
|
75479
|
-
return this.component.check(timestamp);
|
75480
|
-
}
|
75481
|
-
},
|
75482
|
-
{
|
75483
|
-
key: "get",
|
75484
|
-
value: function get(timestamp) {
|
75485
|
-
return this.component.get(timestamp);
|
75486
|
-
}
|
75487
|
-
},
|
75488
|
-
{
|
75489
|
-
key: "destroy",
|
75490
|
-
value: function destroy() {
|
75491
|
-
return this.component.destroy();
|
75492
|
-
}
|
75493
|
-
},
|
75494
|
-
{
|
75495
|
-
key: "dumps",
|
75496
|
-
value: function dumps(from, to) {
|
75497
|
-
return this.component.dumps(from, to);
|
75498
|
-
}
|
75499
|
-
},
|
75500
|
-
{
|
75501
|
-
key: "loads",
|
75502
|
-
value: function loads() {
|
75503
|
-
return this.component.loads();
|
75504
|
-
}
|
75505
|
-
}
|
75506
|
-
]);
|
75507
|
-
return VideoRegionsDataManagerDecorator;
|
75508
|
-
}();
|
75509
|
-
// src/Ads/VideoAds/VideoRegionsDurationDecorator.ts
|
75510
|
-
var VideoRegionsDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
75511
|
-
_inherits(VideoRegionsDurationDecorator, VideoRegionsDataManagerDecorator);
|
75512
|
-
function VideoRegionsDurationDecorator(component, params) {
|
75513
|
-
_class_call_check(this, VideoRegionsDurationDecorator);
|
75514
|
-
var _this;
|
75515
|
-
_this = _call_super(this, VideoRegionsDurationDecorator, [
|
75516
|
-
component
|
75517
|
-
]);
|
75518
|
-
_this.params = params;
|
75519
|
-
return _this;
|
75520
|
-
}
|
75521
|
-
_create_class(VideoRegionsDurationDecorator, [
|
75522
|
-
{
|
75523
|
-
key: "check",
|
75524
|
-
value: function check(timestamp) {
|
75525
|
-
var totalDuration = 0;
|
75526
|
-
var last;
|
75527
|
-
var result;
|
75528
|
-
var workingTimestamp = timestamp;
|
75529
|
-
while(totalDuration < this.params.duration){
|
75530
|
-
var regions2 = this.component.get(workingTimestamp);
|
75531
|
-
if (!regions2 || !regions2.regions) {
|
75532
|
-
return null;
|
75533
|
-
}
|
75534
|
-
if (!last) {
|
75535
|
-
last = regions2.regions.map(function(r3) {
|
75536
|
-
return r3.id;
|
75537
|
-
});
|
75538
|
-
result = _to_consumable_array(regions2.regions);
|
75539
|
-
return {
|
75540
|
-
timestamp_start: timestamp,
|
75541
|
-
timestamp_end: timestamp + totalDuration,
|
75542
|
-
regions: result
|
75543
|
-
};
|
75544
|
-
}
|
75545
|
-
var validRegions = regions2.regions.filter(function(reg) {
|
75546
|
-
return last === null || last === void 0 ? void 0 : last.includes(reg.id);
|
75547
|
-
});
|
75548
|
-
if (validRegions.length <= 0) {
|
75549
|
-
return null;
|
75550
|
-
}
|
75551
|
-
var duration = 0;
|
75552
|
-
if (regions2.timestamp_start < workingTimestamp) {
|
75553
|
-
duration = regions2.timestamp_end - workingTimestamp;
|
75554
|
-
} else {
|
75555
|
-
duration = regions2.timestamp_end - regions2.timestamp_start;
|
75556
|
-
}
|
75557
|
-
totalDuration += duration;
|
75558
|
-
workingTimestamp = regions2.timestamp_end + 1e-3 + 1e3;
|
75559
|
-
last = validRegions.map(function(r3) {
|
75560
|
-
return r3.id;
|
75561
|
-
});
|
75562
|
-
result = _to_consumable_array(validRegions);
|
75563
|
-
}
|
75564
|
-
if (!result) {
|
75565
|
-
return null;
|
75566
|
-
}
|
75567
|
-
return {
|
75568
|
-
timestamp_start: timestamp,
|
75569
|
-
timestamp_end: timestamp + totalDuration,
|
75570
|
-
regions: result
|
75571
|
-
};
|
75572
|
-
}
|
75573
|
-
}
|
75574
|
-
]);
|
75575
|
-
return VideoRegionsDurationDecorator;
|
75576
|
-
}(VideoRegionsDataManagerDecorator);
|
75577
|
-
var VideoRegionsMaxDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
|
75578
|
-
_inherits(VideoRegionsMaxDurationDecorator, VideoRegionsDataManagerDecorator);
|
75579
|
-
function VideoRegionsMaxDurationDecorator(component, params) {
|
75580
|
-
_class_call_check(this, VideoRegionsMaxDurationDecorator);
|
75581
|
-
var _this;
|
75582
|
-
_this = _call_super(this, VideoRegionsMaxDurationDecorator, [
|
75583
|
-
component
|
75584
|
-
]);
|
75585
|
-
_this.params = params;
|
75586
|
-
return _this;
|
75587
|
-
}
|
75588
|
-
_create_class(VideoRegionsMaxDurationDecorator, [
|
75589
|
-
{
|
75590
|
-
key: "check",
|
75591
|
-
value: function check(timestamp) {
|
75592
|
-
var totalDuration = 0;
|
75593
|
-
var last;
|
75594
|
-
var result;
|
75595
|
-
var workingTimestamp = timestamp;
|
75596
|
-
var filteredRegions = [];
|
75597
|
-
do {
|
75598
|
-
var regions2 = this.component.get(workingTimestamp);
|
75599
|
-
if (!regions2 || !regions2.regions) {
|
75600
|
-
break;
|
75601
|
-
}
|
75602
|
-
if (!last) {
|
75603
|
-
last = regions2.regions.map(function(r3) {
|
75604
|
-
return r3.id;
|
75605
|
-
});
|
75606
|
-
result = _to_consumable_array(regions2.regions);
|
75607
|
-
continue;
|
75608
|
-
}
|
75609
|
-
filteredRegions = regions2.regions.filter(function(reg) {
|
75610
|
-
if (last.includes(reg.id)) {
|
75611
|
-
return true;
|
75612
|
-
}
|
75613
|
-
return false;
|
75614
|
-
});
|
75615
|
-
if (filteredRegions.length <= 0) {
|
75616
|
-
break;
|
75617
|
-
}
|
75618
|
-
var duration = 0;
|
75619
|
-
if (regions2.timestamp_start < workingTimestamp) {
|
75620
|
-
duration = regions2.timestamp_end - workingTimestamp;
|
75621
|
-
} else {
|
75622
|
-
duration = regions2.timestamp_end - regions2.timestamp_start;
|
75623
|
-
}
|
75624
|
-
totalDuration += duration;
|
75625
|
-
workingTimestamp = regions2.timestamp_end + 1e-3 + 1e3;
|
75626
|
-
last = filteredRegions.map(function(r3) {
|
75627
|
-
return r3.id;
|
75628
|
-
});
|
75629
|
-
result = _to_consumable_array(filteredRegions);
|
75630
|
-
}while (true);
|
75631
|
-
if (!result || totalDuration < this.params.minDuration) {
|
75632
|
-
return null;
|
75633
|
-
}
|
75634
|
-
return {
|
75635
|
-
timestamp_start: timestamp,
|
75636
|
-
timestamp_end: timestamp + totalDuration,
|
75637
|
-
regions: result
|
75638
|
-
};
|
75639
|
-
}
|
75640
|
-
}
|
75641
|
-
]);
|
75642
|
-
return VideoRegionsMaxDurationDecorator;
|
75643
|
-
}(VideoRegionsDataManagerDecorator);
|
75644
|
-
var VideoRegionsDecoratorFactory = /*#__PURE__*/ function() {
|
75645
|
-
function VideoRegionsDecoratorFactory() {
|
75646
|
-
_class_call_check(this, VideoRegionsDecoratorFactory);
|
75647
|
-
}
|
75648
|
-
_create_class(VideoRegionsDecoratorFactory, null, [
|
75649
|
-
{
|
75650
|
-
key: "decorate",
|
75651
|
-
value: function decorate(component, params) {
|
75652
|
-
if (!params) {
|
75653
|
-
return component;
|
75654
|
-
}
|
75655
|
-
if (params.visibility_duration) {
|
75656
|
-
return new VideoRegionsDurationDecorator(component, {
|
75657
|
-
duration: params.visibility_duration.value
|
75658
|
-
});
|
75659
|
-
}
|
75660
|
-
if (params.minimum_display_time) {
|
75661
|
-
return new VideoRegionsMaxDurationDecorator(component, {
|
75662
|
-
minDuration: params.minimum_display_time.value
|
75663
|
-
});
|
75664
|
-
}
|
75665
|
-
return component;
|
75666
|
-
}
|
75667
|
-
}
|
75668
|
-
]);
|
75669
|
-
return VideoRegionsDecoratorFactory;
|
75670
|
-
}();
|
75671
75457
|
// src/Ads/VideoAds/State/Store.ts
|
75672
75458
|
function reducer(state, action) {
|
75673
75459
|
switch(action.type){
|
@@ -76195,10 +75981,9 @@ var DynamicDurationPresentation = /*#__PURE__*/ function(AbstractPresentation) {
|
|
76195
75981
|
this.stopRetry();
|
76196
75982
|
this.startPacing();
|
76197
75983
|
if (opts.expectedDuration && !this.presentationTimer.isPaused) {
|
76198
|
-
this.presentationTimer.setDuration(opts.expectedDuration);
|
76199
|
-
} else {
|
76200
|
-
this.presentationTimer.resume();
|
75984
|
+
this.presentationTimer.setDuration(opts.expectedDuration * 1e3);
|
76201
75985
|
}
|
75986
|
+
this.presentationTimer.resume();
|
76202
75987
|
}
|
76203
75988
|
},
|
76204
75989
|
{
|
@@ -79715,6 +79500,8 @@ var Controls = /*#__PURE__*/ function() {
|
|
79715
79500
|
this.context = context;
|
79716
79501
|
this.container = document.createElement("div");
|
79717
79502
|
this.container.id = "BRNDTS_CTL";
|
79503
|
+
this.container.style.width = "100%";
|
79504
|
+
this.container.style.height = "100%";
|
79718
79505
|
this.buildControls();
|
79719
79506
|
}
|
79720
79507
|
_create_class(Controls, [
|
@@ -79815,6 +79602,8 @@ var Backdrop = /*#__PURE__*/ function() {
|
|
79815
79602
|
this.context = context;
|
79816
79603
|
this.container = document.createElement("div");
|
79817
79604
|
this.container.id = "BRNDTS_BKD";
|
79605
|
+
this.container.style.width = "100%";
|
79606
|
+
this.container.style.height = "100%";
|
79818
79607
|
}
|
79819
79608
|
_create_class(Backdrop, [
|
79820
79609
|
{
|
@@ -81631,7 +81420,6 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
|
|
81631
81420
|
var _this_adPresentationStrategy, _this_regionsRenderer;
|
81632
81421
|
(_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
|
81633
81422
|
(_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
|
81634
|
-
this.context.logger.info("NotBasicPresentationMode has been stopped.");
|
81635
81423
|
}
|
81636
81424
|
},
|
81637
81425
|
{
|
@@ -81738,6 +81526,7 @@ var RegionFactory = /*#__PURE__*/ function() {
|
|
81738
81526
|
}));
|
81739
81527
|
}
|
81740
81528
|
plugins2.push(new RegionMaskPlugin());
|
81529
|
+
plugins2.push(new RegionAnimationPlugin("OPACITY"));
|
81741
81530
|
}
|
81742
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")) {
|
81743
81532
|
plugins2.push(new RegionBorderPlugin(), new RegionAnimationPlugin());
|
@@ -82320,8 +82109,10 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
|
|
82320
82109
|
expectedDuration: regions2.timestamp_end - regions2.timestamp_start
|
82321
82110
|
});
|
82322
82111
|
} else {
|
82323
|
-
var _this_adPresentationStrategy1;
|
82112
|
+
var _this_adPresentationStrategy1, _this_regionsRenderer, _this_auxElementsRenderer;
|
82324
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();
|
82325
82116
|
}
|
82326
82117
|
}).on("pace", function() {
|
82327
82118
|
try {
|
@@ -82374,7 +82165,6 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
|
|
82374
82165
|
(_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
|
82375
82166
|
(_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
|
82376
82167
|
(_this_auxElementsRenderer = this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
|
82377
|
-
this.context.logger.info("NotBasicPresentationMode has been stopped.");
|
82378
82168
|
}
|
82379
82169
|
},
|
82380
82170
|
{
|
@@ -82412,35 +82202,304 @@ var PresentationModeFactory = /*#__PURE__*/ function() {
|
|
82412
82202
|
]);
|
82413
82203
|
return PresentationModeFactory;
|
82414
82204
|
}();
|
82415
|
-
// src/Ads/VideoAds/
|
82416
|
-
var
|
82417
|
-
function
|
82418
|
-
_class_call_check(this,
|
82419
|
-
this.
|
82420
|
-
|
82421
|
-
|
82422
|
-
|
82423
|
-
|
82424
|
-
|
82425
|
-
|
82426
|
-
|
82427
|
-
|
82428
|
-
|
82429
|
-
|
82430
|
-
|
82431
|
-
|
82432
|
-
|
82433
|
-
|
82434
|
-
|
82435
|
-
|
82436
|
-
|
82437
|
-
|
82438
|
-
|
82439
|
-
}
|
82440
|
-
|
82441
|
-
|
82442
|
-
|
82443
|
-
|
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),
|
82488
|
+
user: context.user,
|
82489
|
+
location: context.location,
|
82490
|
+
device: context.device,
|
82491
|
+
consent: context.consent,
|
82492
|
+
logger: context.logger,
|
82493
|
+
service: context.service
|
82494
|
+
};
|
82495
|
+
var media = MediaElementFactory.get(videoAdContext, target);
|
82496
|
+
if (!media) {
|
82497
|
+
throw new Error("No media element found!");
|
82498
|
+
}
|
82499
|
+
videoAdContext.media = media;
|
82500
|
+
videoAdContext.elements.original = target.cloneNode(true);
|
82501
|
+
this.recorderFactory = new RecorderFactory(this.context);
|
82502
|
+
this.videoAdContext = videoAdContext;
|
82444
82503
|
this.presentationFactory = new PresentationModeFactory(this.videoAdContext);
|
82445
82504
|
}
|
82446
82505
|
_create_class(VideoAd, [
|
@@ -82488,7 +82547,8 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82488
82547
|
}, {
|
82489
82548
|
logger: this.videoAdContext.logger,
|
82490
82549
|
// @ts-expect-error
|
82491
|
-
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
|
82492
82552
|
});
|
82493
82553
|
this.videoAdContext.store.dispatch({
|
82494
82554
|
type: "UPDATE_VIDEO_INFO",
|
@@ -82553,6 +82613,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82553
82613
|
key: "updateRegionData",
|
82554
82614
|
value: function updateRegionData() {
|
82555
82615
|
var _this = this;
|
82616
|
+
var _this_presentation;
|
82556
82617
|
if (this.videoRegions) {
|
82557
82618
|
var _this_videoRegions;
|
82558
82619
|
(_this_videoRegions = this.videoRegions) === null || _this_videoRegions === void 0 ? void 0 : _this_videoRegions.destroy();
|
@@ -82561,10 +82622,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82561
82622
|
this.videoAdContext.recorder.destroy();
|
82562
82623
|
this.videoAdContext.recorder = void 0;
|
82563
82624
|
}
|
82564
|
-
|
82565
|
-
this.presentation.destroy();
|
82566
|
-
this.presentation = void 0;
|
82567
|
-
}
|
82625
|
+
(_this_presentation = this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.stop();
|
82568
82626
|
this.context.service.send("hs", {
|
82569
82627
|
source: this.videoAdContext.media.source,
|
82570
82628
|
strategy: this.videoAdContext.config.getStrategy().code
|
@@ -82582,7 +82640,8 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82582
82640
|
}
|
82583
82641
|
}, {
|
82584
82642
|
logger: _this.videoAdContext.logger,
|
82585
|
-
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
|
82586
82645
|
});
|
82587
82646
|
_this.videoAdContext.store.dispatch({
|
82588
82647
|
type: "UPDATE_VIDEO_INFO",
|
@@ -82593,15 +82652,12 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
82593
82652
|
}
|
82594
82653
|
});
|
82595
82654
|
_this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, _this.videoAdContext.config.getStrategySettings());
|
82596
|
-
_this.presentation = _this.presentationFactory.get({
|
82597
|
-
strategy: _this.videoAdContext.config.getStrategy().code
|
82598
|
-
});
|
82599
82655
|
_this.videoAdContext.data = _this.videoRegions;
|
82600
82656
|
_this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
|
82601
82657
|
id: data.video,
|
82602
82658
|
ts: 0
|
82603
82659
|
});
|
82604
|
-
(_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();
|
82605
82661
|
});
|
82606
82662
|
}
|
82607
82663
|
},
|
@@ -83109,8 +83165,156 @@ var Location = /*#__PURE__*/ function() {
|
|
83109
83165
|
]);
|
83110
83166
|
return Location;
|
83111
83167
|
}();
|
83112
|
-
// src/Service/
|
83168
|
+
// src/Service/LocalRealtime.ts
|
83113
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());
|
83114
83318
|
// node_modules/engine.io-parser/build/esm/commons.js
|
83115
83319
|
var PACKET_TYPES = /* @__PURE__ */ Object.create(null);
|
83116
83320
|
PACKET_TYPES["open"] = "0";
|
@@ -86958,8 +87162,8 @@ Object.assign(lookup2, {
|
|
86958
87162
|
connect: lookup2
|
86959
87163
|
});
|
86960
87164
|
// src/Service/Realtime.ts
|
86961
|
-
var BRNDTSRealtime = /*#__PURE__*/ function(
|
86962
|
-
_inherits(_BRNDTSRealtime,
|
87165
|
+
var BRNDTSRealtime = /*#__PURE__*/ function(_import_events11_default) {
|
87166
|
+
_inherits(_BRNDTSRealtime, _import_events11_default);
|
86963
87167
|
function _BRNDTSRealtime(options, deps) {
|
86964
87168
|
_class_call_check(this, _BRNDTSRealtime);
|
86965
87169
|
var _this;
|
@@ -87057,9 +87261,36 @@ var BRNDTSRealtime = /*#__PURE__*/ function(_import_events10_default) {
|
|
87057
87261
|
}
|
87058
87262
|
]);
|
87059
87263
|
return _BRNDTSRealtime;
|
87060
|
-
}(
|
87061
|
-
// src/Service/
|
87062
|
-
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
|
+
}();
|
87063
87294
|
// src/index.ts
|
87064
87295
|
var BrndtsAds = /*#__PURE__*/ function() {
|
87065
87296
|
function BrndtsAds(targets, options, adsOptions) {
|
@@ -87111,10 +87342,16 @@ var BrndtsAds = /*#__PURE__*/ function() {
|
|
87111
87342
|
case 1:
|
87112
87343
|
_state.trys.push([
|
87113
87344
|
1,
|
87114
|
-
|
87345
|
+
4,
|
87115
87346
|
,
|
87116
|
-
|
87347
|
+
5
|
87117
87348
|
]);
|
87349
|
+
if (!this.context.config.get("enabled")) {
|
87350
|
+
this.context.logger.error("Setup failed: disabled by config");
|
87351
|
+
return [
|
87352
|
+
2
|
87353
|
+
];
|
87354
|
+
}
|
87118
87355
|
this.context.location = new Location();
|
87119
87356
|
this.context.consent = ConsentFactory.get(this.context.logger);
|
87120
87357
|
return [
|
@@ -87125,35 +87362,30 @@ var BrndtsAds = /*#__PURE__*/ function() {
|
|
87125
87362
|
_state.sent();
|
87126
87363
|
this.context.user = new User(this.context.config, this.context.consent);
|
87127
87364
|
this.context.device = new Device();
|
87128
|
-
|
87129
|
-
|
87130
|
-
this.context.
|
87131
|
-
|
87132
|
-
|
87133
|
-
|
87134
|
-
|
87135
|
-
this.context.service =
|
87136
|
-
host: this.context.config.get("host"),
|
87137
|
-
key: this.context.config.get("key")
|
87138
|
-
}, {
|
87139
|
-
logger: this.context.logger
|
87140
|
-
});
|
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);
|
87141
87373
|
this.context.service.on("connected", this.handleConnected);
|
87142
87374
|
this.context.service.connect();
|
87143
87375
|
return [
|
87144
87376
|
3,
|
87145
|
-
|
87377
|
+
5
|
87146
87378
|
];
|
87147
|
-
case
|
87379
|
+
case 4:
|
87148
87380
|
error = _state.sent();
|
87149
87381
|
if (_instanceof(error, Error)) {
|
87150
|
-
|
87382
|
+
console.log("Error during setup: ", error);
|
87151
87383
|
}
|
87152
87384
|
return [
|
87153
87385
|
3,
|
87154
|
-
|
87386
|
+
5
|
87155
87387
|
];
|
87156
|
-
case
|
87388
|
+
case 5:
|
87157
87389
|
return [
|
87158
87390
|
2
|
87159
87391
|
];
|