@brndts/brndts-ads 1.13.16 → 1.13.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5402,13 +5402,13 @@ var require_libraries2 = __commonJS({
5402
5402
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5403
5403
  try {
5404
5404
  for(var _iterator = libraries_json_1.default[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5405
- var library2 = _step.value;
5406
- var match = user_agent_1.userAgentParser(library2.regex, userAgent2);
5405
+ var library3 = _step.value;
5406
+ var match = user_agent_1.userAgentParser(library3.regex, userAgent2);
5407
5407
  if (!match) continue;
5408
5408
  result.type = "library";
5409
- result.name = variable_replacement_1.variableReplacement(library2.name, match);
5410
- result.version = version_1.formatVersion(variable_replacement_1.variableReplacement(library2.version, match), _this.options.versionTruncation);
5411
- result.url = library2.url || "";
5409
+ result.name = variable_replacement_1.variableReplacement(library3.name, match);
5410
+ result.version = version_1.formatVersion(variable_replacement_1.variableReplacement(library3.version, match), _this.options.versionTruncation);
5411
+ result.url = library3.url || "";
5412
5412
  break;
5413
5413
  }
5414
5414
  } catch (err) {
@@ -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:
@@ -68282,48 +68283,329 @@ var GooglePublisherTag = /*#__PURE__*/ function() {
68282
68283
  return _GooglePublisherTag;
68283
68284
  }();
68284
68285
  // src/Ads/Providers/Provider.ts
68286
+ var typeAndDimensions = {
68287
+ "medium-rectangle": [
68288
+ [
68289
+ 300,
68290
+ 250
68291
+ ],
68292
+ [
68293
+ 250,
68294
+ 250
68295
+ ],
68296
+ [
68297
+ 200,
68298
+ 200
68299
+ ],
68300
+ [
68301
+ 180,
68302
+ 150
68303
+ ],
68304
+ [
68305
+ 150,
68306
+ 150
68307
+ ]
68308
+ ],
68309
+ "large-rectangle": [
68310
+ [
68311
+ 300,
68312
+ 600
68313
+ ],
68314
+ [
68315
+ 160,
68316
+ 600
68317
+ ],
68318
+ [
68319
+ 120,
68320
+ 600
68321
+ ]
68322
+ ],
68323
+ "billboard": [
68324
+ [
68325
+ 970,
68326
+ 250
68327
+ ],
68328
+ [
68329
+ 970,
68330
+ 90
68331
+ ],
68332
+ [
68333
+ 728,
68334
+ 90
68335
+ ],
68336
+ [
68337
+ 468,
68338
+ 60
68339
+ ]
68340
+ ],
68341
+ "leaderboard": [
68342
+ [
68343
+ 728,
68344
+ 90
68345
+ ],
68346
+ [
68347
+ 468,
68348
+ 60
68349
+ ],
68350
+ [
68351
+ 320,
68352
+ 50
68353
+ ],
68354
+ [
68355
+ 300,
68356
+ 50
68357
+ ],
68358
+ [
68359
+ 234,
68360
+ 60
68361
+ ]
68362
+ ],
68363
+ "smartphone-banner": [
68364
+ [
68365
+ 320,
68366
+ 50
68367
+ ],
68368
+ [
68369
+ 300,
68370
+ 50
68371
+ ],
68372
+ [
68373
+ 320,
68374
+ 100
68375
+ ]
68376
+ ]
68377
+ };
68285
68378
  var regions = [
68286
68379
  {
68287
68380
  id: 1,
68288
68381
  w: 300,
68289
68382
  h: 250,
68383
+ name: "Top Right - 300x250",
68290
68384
  type: "medium-rectangle"
68291
68385
  },
68292
68386
  {
68293
68387
  id: 2,
68294
68388
  w: 300,
68295
68389
  h: 250,
68390
+ name: "Bottom Right - 300x250",
68296
68391
  type: "medium-rectangle"
68297
68392
  },
68298
68393
  {
68299
68394
  id: 3,
68300
68395
  w: 320,
68301
68396
  h: 50,
68397
+ name: "Top Center - 320x50",
68302
68398
  type: "smartphone-banner"
68303
68399
  },
68304
68400
  {
68305
68401
  id: 4,
68402
+ w: 300,
68403
+ h: 250,
68404
+ name: "Top Left - 300x250",
68405
+ type: "medium-rectangle"
68406
+ },
68407
+ {
68408
+ id: 5,
68409
+ w: 250,
68410
+ h: 250,
68411
+ name: "Top Left - 250x250",
68412
+ type: "medium-rectangle"
68413
+ },
68414
+ {
68415
+ id: 6,
68416
+ w: 200,
68417
+ h: 200,
68418
+ name: "Top Left - 200x200",
68419
+ type: "medium-rectangle"
68420
+ },
68421
+ {
68422
+ id: 7,
68423
+ w: 180,
68424
+ h: 150,
68425
+ name: "Top Left - 180x150",
68426
+ type: "medium-rectangle"
68427
+ },
68428
+ {
68429
+ id: 8,
68430
+ w: 150,
68431
+ h: 150,
68432
+ name: "Top Left - 150x150",
68433
+ type: "medium-rectangle"
68434
+ },
68435
+ {
68436
+ id: 9,
68437
+ w: 250,
68438
+ h: 250,
68439
+ name: "Top Right - 250x250",
68440
+ type: "medium-rectangle"
68441
+ },
68442
+ {
68443
+ id: 10,
68444
+ w: 200,
68445
+ h: 200,
68446
+ name: "Top Right - 200x200",
68447
+ type: "medium-rectangle"
68448
+ },
68449
+ {
68450
+ id: 11,
68451
+ w: 180,
68452
+ h: 150,
68453
+ name: "Top Right - 180x150",
68454
+ type: "medium-rectangle"
68455
+ },
68456
+ {
68457
+ id: 12,
68458
+ w: 150,
68459
+ h: 150,
68460
+ name: "Top Right - 150x150",
68461
+ type: "medium-rectangle"
68462
+ },
68463
+ {
68464
+ id: 13,
68465
+ w: 300,
68466
+ h: 250,
68467
+ name: "Bottom Left - 300x250",
68468
+ type: "medium-rectangle"
68469
+ },
68470
+ {
68471
+ id: 14,
68472
+ w: 250,
68473
+ h: 250,
68474
+ name: "Bottom Left - 250x250",
68475
+ type: "medium-rectangle"
68476
+ },
68477
+ {
68478
+ id: 15,
68479
+ w: 200,
68480
+ h: 200,
68481
+ name: "Bottom Left - 200x200",
68482
+ type: "medium-rectangle"
68483
+ },
68484
+ {
68485
+ id: 16,
68486
+ w: 180,
68487
+ h: 150,
68488
+ name: "Bottom Left - 180x150",
68489
+ type: "medium-rectangle"
68490
+ },
68491
+ {
68492
+ id: 17,
68493
+ w: 150,
68494
+ h: 150,
68495
+ name: "Bottom Left - 150x150",
68496
+ type: "medium-rectangle"
68497
+ },
68498
+ {
68499
+ id: 18,
68500
+ w: 250,
68501
+ h: 250,
68502
+ name: "Bottom Right - 250x250",
68503
+ type: "medium-rectangle"
68504
+ },
68505
+ {
68506
+ id: 19,
68507
+ w: 200,
68508
+ h: 200,
68509
+ name: "Bottom Right - 200x200",
68510
+ type: "medium-rectangle"
68511
+ },
68512
+ {
68513
+ id: 20,
68514
+ w: 180,
68515
+ h: 150,
68516
+ name: "Bottom Right - 180x150",
68517
+ type: "medium-rectangle"
68518
+ },
68519
+ {
68520
+ id: 21,
68521
+ w: 150,
68522
+ h: 150,
68523
+ name: "Bottom Right - 150x150",
68524
+ type: "medium-rectangle"
68525
+ },
68526
+ {
68527
+ id: 22,
68306
68528
  w: 728,
68307
68529
  h: 90,
68530
+ name: "Top Center - 728x90",
68308
68531
  type: "leaderboard"
68309
68532
  },
68310
68533
  {
68311
- id: 5,
68534
+ id: 23,
68535
+ w: 468,
68536
+ h: 60,
68537
+ name: "Top Center - 468x60",
68538
+ type: "leaderboard"
68539
+ },
68540
+ {
68541
+ id: 24,
68312
68542
  w: 300,
68313
- h: 600,
68314
- type: "large-rectangle"
68543
+ h: 50,
68544
+ name: "Top Center - 300x50",
68545
+ type: "leaderboard"
68315
68546
  },
68316
68547
  {
68317
- id: 6,
68318
- w: 250,
68319
- h: 300,
68320
- type: ""
68548
+ id: 25,
68549
+ w: 234,
68550
+ h: 60,
68551
+ name: "Top Center - 234x60",
68552
+ type: "leaderboard"
68321
68553
  },
68322
68554
  {
68323
- id: 7,
68555
+ id: 26,
68556
+ w: 728,
68557
+ h: 90,
68558
+ name: "Bottom Center - 728x90",
68559
+ type: "leaderboard"
68560
+ },
68561
+ {
68562
+ id: 27,
68563
+ w: 468,
68564
+ h: 60,
68565
+ name: "Bottom Center - 468x60",
68566
+ type: "leaderboard"
68567
+ },
68568
+ {
68569
+ id: 28,
68570
+ w: 320,
68571
+ h: 50,
68572
+ name: "Bottom Center - 320x50",
68573
+ type: "smartphone-banner"
68574
+ },
68575
+ {
68576
+ id: 29,
68577
+ w: 300,
68578
+ h: 50,
68579
+ name: "Bottom Center - 300x50",
68580
+ type: "leaderboard"
68581
+ },
68582
+ {
68583
+ id: 30,
68584
+ w: 234,
68585
+ h: 60,
68586
+ name: "Bottom Center - 234x60",
68587
+ type: "leaderboard"
68588
+ },
68589
+ {
68590
+ id: 1e3,
68324
68591
  w: 970,
68325
68592
  h: 250,
68593
+ name: "Generic - 970x250",
68326
68594
  type: "billboard"
68595
+ },
68596
+ {
68597
+ id: 1001,
68598
+ w: 970,
68599
+ h: 90,
68600
+ name: "Generic - 970x90",
68601
+ type: "billboard"
68602
+ },
68603
+ {
68604
+ id: 1002,
68605
+ w: 250,
68606
+ h: 300,
68607
+ name: "Generic - 250x300",
68608
+ type: ""
68327
68609
  }
68328
68610
  ];
68329
68611
  var ContentProvider = /*#__PURE__*/ function() {
@@ -68377,98 +68659,7 @@ var ContentProvider = /*#__PURE__*/ function() {
68377
68659
  {
68378
68660
  key: "adSizes",
68379
68661
  get: function get() {
68380
- return {
68381
- "medium-rectangle": [
68382
- [
68383
- 300,
68384
- 250
68385
- ],
68386
- [
68387
- 250,
68388
- 250
68389
- ],
68390
- [
68391
- 200,
68392
- 200
68393
- ],
68394
- [
68395
- 180,
68396
- 150
68397
- ],
68398
- [
68399
- 150,
68400
- 150
68401
- ]
68402
- ],
68403
- "large-rectangle": [
68404
- [
68405
- 300,
68406
- 600
68407
- ],
68408
- [
68409
- 160,
68410
- 600
68411
- ],
68412
- [
68413
- 120,
68414
- 600
68415
- ]
68416
- ],
68417
- "billboard": [
68418
- [
68419
- 970,
68420
- 250
68421
- ],
68422
- [
68423
- 970,
68424
- 90
68425
- ],
68426
- [
68427
- 728,
68428
- 90
68429
- ],
68430
- [
68431
- 468,
68432
- 60
68433
- ]
68434
- ],
68435
- "leaderboard": [
68436
- [
68437
- 728,
68438
- 90
68439
- ],
68440
- [
68441
- 468,
68442
- 60
68443
- ],
68444
- [
68445
- 320,
68446
- 50
68447
- ],
68448
- [
68449
- 300,
68450
- 50
68451
- ],
68452
- [
68453
- 234,
68454
- 60
68455
- ]
68456
- ],
68457
- "smartphone-banner": [
68458
- [
68459
- 320,
68460
- 50
68461
- ],
68462
- [
68463
- 300,
68464
- 50
68465
- ],
68466
- [
68467
- 320,
68468
- 100
68469
- ]
68470
- ]
68471
- };
68662
+ return typeAndDimensions;
68472
68663
  }
68473
68664
  },
68474
68665
  {
@@ -69592,25 +69783,15 @@ var StaticImageProvider = /*#__PURE__*/ function(ContentProvider) {
69592
69783
  return StaticImageProvider;
69593
69784
  }(ContentProvider);
69594
69785
  // src/Ads/Providers/AfiliateProvider/AffiliateProvider.ts
69595
- var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69596
- _inherits(AffiliateProvider, ContentProvider1);
69597
- function AffiliateProvider(context, options) {
69598
- _class_call_check(this, AffiliateProvider);
69599
- var _this;
69600
- _this = _call_super(this, AffiliateProvider, [
69601
- context,
69602
- options
69603
- ]);
69604
- _this.manifest = [];
69605
- _this.useByRegion = {};
69606
- _this.ready = new Awaitable(false);
69607
- _this.content = {
69608
- content: [],
69609
- type: "affiliate"
69610
- };
69611
- return _this;
69786
+ var AffiliateLibrary = /*#__PURE__*/ function() {
69787
+ function AffiliateLibrary(manifestUrl) {
69788
+ _class_call_check(this, AffiliateLibrary);
69789
+ this.ready = new Awaitable(false);
69790
+ this.loading = false;
69791
+ this.affiliates = [];
69792
+ this.manifestUrl = manifestUrl;
69612
69793
  }
69613
- _create_class(AffiliateProvider, [
69794
+ _create_class(AffiliateLibrary, [
69614
69795
  {
69615
69796
  key: "loadManifest",
69616
69797
  value: function loadManifest() {
@@ -69619,30 +69800,85 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69619
69800
  return _ts_generator(this, function(_state) {
69620
69801
  switch(_state.label){
69621
69802
  case 0:
69803
+ if (!this.ready.value && this.loading) {
69804
+ return [
69805
+ 2,
69806
+ this.ready.promise
69807
+ ];
69808
+ }
69809
+ this.loading = true;
69622
69810
  return [
69623
69811
  4,
69624
- fetch(this.options.manifest)
69812
+ fetch(this.manifestUrl)
69625
69813
  ];
69626
69814
  case 1:
69627
69815
  response = _state.sent();
69628
69816
  if (!response.ok) {
69817
+ this.ready.reject("Failed to fetch manifest: ".concat(response.statusText));
69629
69818
  throw new Error("Failed to fetch manifest: ".concat(response.statusText));
69630
69819
  }
69820
+ this.ready.resolve(true);
69821
+ this.loading = false;
69631
69822
  _ = this;
69632
69823
  return [
69633
69824
  4,
69634
69825
  response.json()
69635
69826
  ];
69636
69827
  case 2:
69637
- _.manifest = _state.sent();
69638
- this.ready.resolve(true);
69828
+ _.affiliates = _state.sent();
69639
69829
  return [
69640
- 2
69830
+ 2,
69831
+ this.ready.promise
69641
69832
  ];
69642
69833
  }
69643
69834
  });
69644
69835
  }).call(this);
69645
69836
  }
69837
+ }
69838
+ ]);
69839
+ return AffiliateLibrary;
69840
+ }();
69841
+ var library;
69842
+ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69843
+ _inherits(AffiliateProvider, ContentProvider1);
69844
+ function AffiliateProvider(context, options) {
69845
+ _class_call_check(this, AffiliateProvider);
69846
+ var _this;
69847
+ _this = _call_super(this, AffiliateProvider, [
69848
+ context,
69849
+ options
69850
+ ]);
69851
+ _this.useByRegion = {};
69852
+ _this.ready = new Awaitable(false);
69853
+ if (!library) {
69854
+ library = new AffiliateLibrary(options.manifest);
69855
+ }
69856
+ _this.content = {
69857
+ content: [],
69858
+ type: "affiliate"
69859
+ };
69860
+ return _this;
69861
+ }
69862
+ _create_class(AffiliateProvider, [
69863
+ {
69864
+ key: "loadManifest",
69865
+ value: function loadManifest() {
69866
+ return _async_to_generator(function() {
69867
+ var _this;
69868
+ return _ts_generator(this, function(_state) {
69869
+ _this = this;
69870
+ return [
69871
+ 2,
69872
+ library === null || library === void 0 ? void 0 : library.loadManifest().then(function() {
69873
+ _this.ready.resolve(true);
69874
+ return true;
69875
+ }).catch(function(error) {
69876
+ _this.ready.reject(error);
69877
+ })
69878
+ ];
69879
+ });
69880
+ }).call(this);
69881
+ }
69646
69882
  },
69647
69883
  {
69648
69884
  key: "getAffiliate",
@@ -69656,7 +69892,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69656
69892
  var _this1, _loop = function() {
69657
69893
  var _step_value = _sliced_to_array(_step.value, 2), width = _step_value[0], height = _step_value[1];
69658
69894
  var identifier = "".concat(width, "x").concat(height);
69659
- var aff2 = _this1.manifest.filter(function(a) {
69895
+ var aff2 = library.affiliates.filter(function(a) {
69660
69896
  return a.size.w === width && a.size.h === height;
69661
69897
  });
69662
69898
  if (!aff2.length) {
@@ -69701,7 +69937,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69701
69937
  }
69702
69938
  if ((size === null || size === void 0 ? void 0 : size.width) && (size === null || size === void 0 ? void 0 : size.height)) {
69703
69939
  var identifier = "".concat(size.width, "x").concat(size.height);
69704
- var aff2 = this.manifest.filter(function(a) {
69940
+ var aff2 = library.affiliates.filter(function(a) {
69705
69941
  return a.size.w === (size === null || size === void 0 ? void 0 : size.width) && a.size.h === size.height;
69706
69942
  });
69707
69943
  if (!aff2.length) {
@@ -69725,7 +69961,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69725
69961
  if (!this.useByRegion[regionId]) {
69726
69962
  this.useByRegion[regionId] = /* @__PURE__ */ new Set();
69727
69963
  }
69728
- var aff = this.manifest.filter(function(a) {
69964
+ var aff = library.affiliates.filter(function(a) {
69729
69965
  return a.region.includes("".concat(regionId));
69730
69966
  });
69731
69967
  if (!aff.length) {
@@ -71371,16 +71607,20 @@ var RegionBorderPlugin = /*#__PURE__*/ function() {
71371
71607
  {
71372
71608
  key: "beforeShow",
71373
71609
  value: function beforeShow(region) {
71374
- var _this_options;
71375
- if (!region.hasContent) {
71376
- return Promise.resolve();
71377
- }
71378
- if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.useFeather) {
71379
- region.content.view.classList.toggle("BRNDTS_R_FTH", true);
71380
- } else {
71381
- region.content.view.classList.toggle("BRNDTS_R_B", true);
71382
- }
71383
- return Promise.resolve();
71610
+ var _this = this;
71611
+ if (!region.hasContent) return Promise.resolve();
71612
+ return new Promise(function(resolve) {
71613
+ requestAnimationFrame(function() {
71614
+ var _this_options;
71615
+ var view = region.content.view;
71616
+ if ((_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.useFeather) {
71617
+ view.classList.toggle("BRNDTS_R_FTH", true);
71618
+ } else {
71619
+ view.classList.toggle("BRNDTS_R_B", true);
71620
+ }
71621
+ resolve();
71622
+ });
71623
+ });
71384
71624
  }
71385
71625
  },
71386
71626
  {
@@ -72844,10 +73084,15 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
72844
73084
  key: "assurePlaybackState",
72845
73085
  value: function assurePlaybackState(play) {
72846
73086
  if (this.media && this.media.hasPlayed) {
72847
- var _this__source;
72848
- if (((_this__source = this._source) === null || _this__source === void 0 ? void 0 : _this__source.videoId) && this.videoId && this.videoId.length > 0 && this._source.videoId !== this.videoId) {
72849
- this._source.videoId = this.videoId;
72850
- this.emit("UPDATED_SOURCE", this._source.videoId);
73087
+ var _this_instance;
73088
+ var newVideoIndex = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.getPlaylistIndex();
73089
+ if (newVideoIndex !== this.currentVideoIndex) {
73090
+ this.currentVideoIndex = newVideoIndex;
73091
+ if (this._source && this._source.type === "playlist") {
73092
+ var _this__source;
73093
+ this._source.videoId = this.videoId;
73094
+ this.emit("UPDATED_SOURCE", (_this__source = this._source) === null || _this__source === void 0 ? void 0 : _this__source.videoId);
73095
+ }
72851
73096
  }
72852
73097
  }
72853
73098
  if (this.media && play && !this.media.hasPlayed) {
@@ -72883,11 +73128,13 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
72883
73128
  key: "handleYTPlayerReady",
72884
73129
  value: function handleYTPlayerReady(event) {
72885
73130
  var _this = this;
73131
+ var _this_instance;
72886
73132
  if (this.instance) {
72887
73133
  this.context.logger.warn("Instance already found!");
72888
73134
  return;
72889
73135
  }
72890
73136
  this.instance = event.target;
73137
+ this.currentVideoIndex = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.getPlaylistIndex();
72891
73138
  this.ready = true;
72892
73139
  this.observeResize();
72893
73140
  this.context.store.dispatch({
@@ -75442,232 +75689,6 @@ var VideoRegionsDataManager = /*#__PURE__*/ function(_import_events4_EventEmitte
75442
75689
  ]);
75443
75690
  return VideoRegionsDataManager;
75444
75691
  }(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
75692
  // src/Ads/VideoAds/State/Store.ts
75672
75693
  function reducer(state, action) {
75673
75694
  switch(action.type){
@@ -76195,10 +76216,9 @@ var DynamicDurationPresentation = /*#__PURE__*/ function(AbstractPresentation) {
76195
76216
  this.stopRetry();
76196
76217
  this.startPacing();
76197
76218
  if (opts.expectedDuration && !this.presentationTimer.isPaused) {
76198
- this.presentationTimer.setDuration(opts.expectedDuration);
76199
- } else {
76200
- this.presentationTimer.resume();
76219
+ this.presentationTimer.setDuration(opts.expectedDuration * 1e3);
76201
76220
  }
76221
+ this.presentationTimer.resume();
76202
76222
  }
76203
76223
  },
76204
76224
  {
@@ -77742,9 +77762,9 @@ function findIconDefinition(iconLookup) {
77742
77762
  var prefix = iconLookup.prefix || getDefaultUsablePrefix();
77743
77763
  if (!iconName) return;
77744
77764
  iconName = byAlias(prefix, iconName) || iconName;
77745
- return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77765
+ return iconFromMapping(library2.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77746
77766
  }
77747
- var library = new Library();
77767
+ var library2 = new Library();
77748
77768
  var noAuto = function() {
77749
77769
  config.autoReplaceSvg = false;
77750
77770
  config.observeMutations = false;
@@ -77818,7 +77838,7 @@ var api = {
77818
77838
  config: config,
77819
77839
  dom: dom,
77820
77840
  parse: parse,
77821
- library: library,
77841
+ library: library2,
77822
77842
  findIconDefinition: findIconDefinition,
77823
77843
  toHtml: toHtml
77824
77844
  };
@@ -79715,6 +79735,8 @@ var Controls = /*#__PURE__*/ function() {
79715
79735
  this.context = context;
79716
79736
  this.container = document.createElement("div");
79717
79737
  this.container.id = "BRNDTS_CTL";
79738
+ this.container.style.width = "100%";
79739
+ this.container.style.height = "100%";
79718
79740
  this.buildControls();
79719
79741
  }
79720
79742
  _create_class(Controls, [
@@ -79815,6 +79837,8 @@ var Backdrop = /*#__PURE__*/ function() {
79815
79837
  this.context = context;
79816
79838
  this.container = document.createElement("div");
79817
79839
  this.container.id = "BRNDTS_BKD";
79840
+ this.container.style.width = "100%";
79841
+ this.container.style.height = "100%";
79818
79842
  }
79819
79843
  _create_class(Backdrop, [
79820
79844
  {
@@ -81631,7 +81655,6 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
81631
81655
  var _this_adPresentationStrategy, _this_regionsRenderer;
81632
81656
  (_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
81633
81657
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
81634
- this.context.logger.info("NotBasicPresentationMode has been stopped.");
81635
81658
  }
81636
81659
  },
81637
81660
  {
@@ -81738,6 +81761,7 @@ var RegionFactory = /*#__PURE__*/ function() {
81738
81761
  }));
81739
81762
  }
81740
81763
  plugins2.push(new RegionMaskPlugin());
81764
+ plugins2.push(new RegionAnimationPlugin("OPACITY"));
81741
81765
  }
81742
81766
  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
81767
  plugins2.push(new RegionBorderPlugin(), new RegionAnimationPlugin());
@@ -82320,8 +82344,10 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
82320
82344
  expectedDuration: regions2.timestamp_end - regions2.timestamp_start
82321
82345
  });
82322
82346
  } else {
82323
- var _this_adPresentationStrategy1;
82347
+ var _this_adPresentationStrategy1, _this_regionsRenderer, _this_auxElementsRenderer;
82324
82348
  (_this_adPresentationStrategy1 = _this.adPresentationStrategy) === null || _this_adPresentationStrategy1 === void 0 ? void 0 : _this_adPresentationStrategy1.endedPresentation();
82349
+ (_this_regionsRenderer = _this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
82350
+ (_this_auxElementsRenderer = _this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
82325
82351
  }
82326
82352
  }).on("pace", function() {
82327
82353
  try {
@@ -82374,7 +82400,6 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
82374
82400
  (_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
82375
82401
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
82376
82402
  (_this_auxElementsRenderer = this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
82377
- this.context.logger.info("NotBasicPresentationMode has been stopped.");
82378
82403
  }
82379
82404
  },
82380
82405
  {
@@ -82412,6 +82437,275 @@ var PresentationModeFactory = /*#__PURE__*/ function() {
82412
82437
  ]);
82413
82438
  return PresentationModeFactory;
82414
82439
  }();
82440
+ // src/Ads/VideoAds/VideoRegionsData/VideoRegionsDataManagerDecorator.ts
82441
+ var VideoRegionsDataManagerDecorator = /*#__PURE__*/ function() {
82442
+ function VideoRegionsDataManagerDecorator(component) {
82443
+ _class_call_check(this, VideoRegionsDataManagerDecorator);
82444
+ this.component = component;
82445
+ }
82446
+ _create_class(VideoRegionsDataManagerDecorator, [
82447
+ {
82448
+ key: "data",
82449
+ get: function get() {
82450
+ return this.component.data;
82451
+ }
82452
+ },
82453
+ {
82454
+ key: "on",
82455
+ value: function on(event, handler) {
82456
+ return this.component.on(event, handler);
82457
+ }
82458
+ },
82459
+ {
82460
+ key: "fetch",
82461
+ value: function fetch1() {
82462
+ return this.component.fetch();
82463
+ }
82464
+ },
82465
+ {
82466
+ key: "seek",
82467
+ value: function seek(timestamp) {
82468
+ return this.component.seek(timestamp);
82469
+ }
82470
+ },
82471
+ {
82472
+ key: "check",
82473
+ value: function check(timestamp) {
82474
+ return this.component.check(timestamp);
82475
+ }
82476
+ },
82477
+ {
82478
+ key: "get",
82479
+ value: function get(timestamp) {
82480
+ return this.component.get(timestamp);
82481
+ }
82482
+ },
82483
+ {
82484
+ key: "destroy",
82485
+ value: function destroy() {
82486
+ return this.component.destroy();
82487
+ }
82488
+ },
82489
+ {
82490
+ key: "dumps",
82491
+ value: function dumps(from, to) {
82492
+ return this.component.dumps(from, to);
82493
+ }
82494
+ },
82495
+ {
82496
+ key: "loads",
82497
+ value: function loads() {
82498
+ return this.component.loads();
82499
+ }
82500
+ }
82501
+ ]);
82502
+ return VideoRegionsDataManagerDecorator;
82503
+ }();
82504
+ // src/Ads/VideoAds/VideoRegionsData/VideoRegionsDecorators.ts
82505
+ var VideoRegionsDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
82506
+ _inherits(VideoRegionsDurationDecorator, VideoRegionsDataManagerDecorator);
82507
+ function VideoRegionsDurationDecorator(component, params) {
82508
+ _class_call_check(this, VideoRegionsDurationDecorator);
82509
+ var _this;
82510
+ _this = _call_super(this, VideoRegionsDurationDecorator, [
82511
+ component
82512
+ ]);
82513
+ _this.params = params;
82514
+ return _this;
82515
+ }
82516
+ _create_class(VideoRegionsDurationDecorator, [
82517
+ {
82518
+ key: "check",
82519
+ value: function check(timestamp) {
82520
+ var totalDuration = 0;
82521
+ var last;
82522
+ var result;
82523
+ var workingTimestamp = timestamp;
82524
+ while(totalDuration < this.params.duration){
82525
+ var regions2 = this.component.get(workingTimestamp);
82526
+ if (!regions2 || !regions2.regions) {
82527
+ return null;
82528
+ }
82529
+ if (!last) {
82530
+ last = regions2.regions.map(function(r3) {
82531
+ return r3.id;
82532
+ });
82533
+ result = _to_consumable_array(regions2.regions);
82534
+ }
82535
+ var validRegions = regions2.regions.filter(function(reg) {
82536
+ return last === null || last === void 0 ? void 0 : last.includes(reg.id);
82537
+ });
82538
+ if (validRegions.length <= 0) {
82539
+ return null;
82540
+ }
82541
+ var duration = 0;
82542
+ if (regions2.timestamp_start < workingTimestamp) {
82543
+ duration = regions2.timestamp_end - workingTimestamp;
82544
+ } else {
82545
+ duration = regions2.timestamp_end - regions2.timestamp_start;
82546
+ }
82547
+ totalDuration += duration;
82548
+ workingTimestamp = regions2.timestamp_end + 0.01;
82549
+ last = validRegions.map(function(r3) {
82550
+ return r3.id;
82551
+ });
82552
+ result = _to_consumable_array(validRegions);
82553
+ }
82554
+ if (!result) {
82555
+ return null;
82556
+ }
82557
+ return {
82558
+ timestamp_start: timestamp,
82559
+ timestamp_end: timestamp + totalDuration,
82560
+ regions: result
82561
+ };
82562
+ }
82563
+ }
82564
+ ]);
82565
+ return VideoRegionsDurationDecorator;
82566
+ }(VideoRegionsDataManagerDecorator);
82567
+ var VideoRegionsMaxDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
82568
+ _inherits(VideoRegionsMaxDurationDecorator, VideoRegionsDataManagerDecorator);
82569
+ function VideoRegionsMaxDurationDecorator(component, params) {
82570
+ _class_call_check(this, VideoRegionsMaxDurationDecorator);
82571
+ var _this;
82572
+ _this = _call_super(this, VideoRegionsMaxDurationDecorator, [
82573
+ component
82574
+ ]);
82575
+ _this.params = params;
82576
+ return _this;
82577
+ }
82578
+ _create_class(VideoRegionsMaxDurationDecorator, [
82579
+ {
82580
+ key: "check",
82581
+ value: function check(timestamp) {
82582
+ var totalDuration = 0;
82583
+ var last;
82584
+ var result;
82585
+ var workingTimestamp = timestamp;
82586
+ do {
82587
+ var regions2 = this.component.get(workingTimestamp);
82588
+ if (!regions2 || !regions2.regions) {
82589
+ break;
82590
+ }
82591
+ if (!last) {
82592
+ last = regions2.regions.map(function(r3) {
82593
+ return r3.id;
82594
+ });
82595
+ result = _to_consumable_array(regions2.regions);
82596
+ }
82597
+ var validRegions = regions2.regions.filter(function(reg) {
82598
+ return last === null || last === void 0 ? void 0 : last.includes(reg.id);
82599
+ });
82600
+ if (validRegions.length <= 0) {
82601
+ break;
82602
+ }
82603
+ var duration = 0;
82604
+ if (regions2.timestamp_start < workingTimestamp) {
82605
+ duration = regions2.timestamp_end - workingTimestamp;
82606
+ } else {
82607
+ duration = regions2.timestamp_end - regions2.timestamp_start;
82608
+ }
82609
+ totalDuration += duration;
82610
+ workingTimestamp = regions2.timestamp_end + 0.01;
82611
+ last = validRegions.map(function(r3) {
82612
+ return r3.id;
82613
+ });
82614
+ result = _to_consumable_array(validRegions);
82615
+ }while (true);
82616
+ if (!result || totalDuration < this.params.minDuration) {
82617
+ return null;
82618
+ }
82619
+ return {
82620
+ timestamp_start: timestamp,
82621
+ timestamp_end: timestamp + totalDuration,
82622
+ regions: result
82623
+ };
82624
+ }
82625
+ }
82626
+ ]);
82627
+ return VideoRegionsMaxDurationDecorator;
82628
+ }(VideoRegionsDataManagerDecorator);
82629
+ var VideoRegionsTypeFilterDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
82630
+ _inherits(VideoRegionsTypeFilterDecorator, VideoRegionsDataManagerDecorator);
82631
+ function VideoRegionsTypeFilterDecorator(component, params) {
82632
+ _class_call_check(this, VideoRegionsTypeFilterDecorator);
82633
+ var _this;
82634
+ _this = _call_super(this, VideoRegionsTypeFilterDecorator, [
82635
+ component
82636
+ ]);
82637
+ if (params && params.value && Array.isArray(params.value)) {
82638
+ var _params_setting_constraints;
82639
+ var regionsMap = ((_params_setting_constraints = params.setting.constraints) === null || _params_setting_constraints === void 0 ? void 0 : _params_setting_constraints.mapped_allowed_values_ids) || {};
82640
+ _this.allowedRegions = params.value.map(function(r3) {
82641
+ return regionsMap[r3];
82642
+ }).filter(Boolean);
82643
+ }
82644
+ return _this;
82645
+ }
82646
+ _create_class(VideoRegionsTypeFilterDecorator, [
82647
+ {
82648
+ key: "check",
82649
+ value: function check(timestamp) {
82650
+ var _this = this;
82651
+ var data = this.component.check(timestamp);
82652
+ if (this.allowedRegions !== void 0 && data && data.regions) {
82653
+ data.regions = data.regions.filter(function(region) {
82654
+ var _this_allowedRegions;
82655
+ return (_this_allowedRegions = _this.allowedRegions) === null || _this_allowedRegions === void 0 ? void 0 : _this_allowedRegions.includes(region.id);
82656
+ });
82657
+ }
82658
+ return data;
82659
+ }
82660
+ },
82661
+ {
82662
+ key: "get",
82663
+ value: function get(timestamp) {
82664
+ var _this = this;
82665
+ var data = this.component.get(timestamp);
82666
+ if (this.allowedRegions !== void 0 && data && data.regions) {
82667
+ data.regions = data.regions.filter(function(region) {
82668
+ var _this_allowedRegions;
82669
+ return (_this_allowedRegions = _this.allowedRegions) === null || _this_allowedRegions === void 0 ? void 0 : _this_allowedRegions.includes(region.id);
82670
+ });
82671
+ }
82672
+ return data;
82673
+ }
82674
+ }
82675
+ ]);
82676
+ return VideoRegionsTypeFilterDecorator;
82677
+ }(VideoRegionsDataManagerDecorator);
82678
+ var VideoRegionsDecoratorFactory = /*#__PURE__*/ function() {
82679
+ function VideoRegionsDecoratorFactory() {
82680
+ _class_call_check(this, VideoRegionsDecoratorFactory);
82681
+ }
82682
+ _create_class(VideoRegionsDecoratorFactory, null, [
82683
+ {
82684
+ key: "decorate",
82685
+ value: function decorate(component, params) {
82686
+ var _params_visibility_duration, _params_minimum_display_time, _params_ad_placements_and_sizes;
82687
+ var target = component;
82688
+ if (!params) {
82689
+ return target;
82690
+ }
82691
+ if ((_params_visibility_duration = params.visibility_duration) === null || _params_visibility_duration === void 0 ? void 0 : _params_visibility_duration.value) {
82692
+ target = new VideoRegionsDurationDecorator(target, {
82693
+ duration: params.visibility_duration.value
82694
+ });
82695
+ } else if ((_params_minimum_display_time = params.minimum_display_time) === null || _params_minimum_display_time === void 0 ? void 0 : _params_minimum_display_time.value) {
82696
+ target = new VideoRegionsMaxDurationDecorator(target, {
82697
+ minDuration: params.minimum_display_time.value
82698
+ });
82699
+ }
82700
+ 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) {
82701
+ target = new VideoRegionsTypeFilterDecorator(target, params.ad_placements_and_sizes);
82702
+ }
82703
+ return target;
82704
+ }
82705
+ }
82706
+ ]);
82707
+ return VideoRegionsDecoratorFactory;
82708
+ }();
82415
82709
  // src/Ads/VideoAds/VideoAd.ts
82416
82710
  var VideoAd = /*#__PURE__*/ function() {
82417
82711
  function VideoAd(context, target) {
@@ -82488,7 +82782,8 @@ var VideoAd = /*#__PURE__*/ function() {
82488
82782
  }, {
82489
82783
  logger: this.videoAdContext.logger,
82490
82784
  // @ts-expect-error
82491
- service: this.videoAdContext.service.join("".concat(data.video, "-").concat(this.videoAdContext.config.getStrategy().code))
82785
+ service: this.videoAdContext.service.join("".concat(data.video, "-").concat(this.videoAdContext.config.getStrategy().code)),
82786
+ config: this.videoAdContext.config
82492
82787
  });
82493
82788
  this.videoAdContext.store.dispatch({
82494
82789
  type: "UPDATE_VIDEO_INFO",
@@ -82553,6 +82848,7 @@ var VideoAd = /*#__PURE__*/ function() {
82553
82848
  key: "updateRegionData",
82554
82849
  value: function updateRegionData() {
82555
82850
  var _this = this;
82851
+ var _this_presentation;
82556
82852
  if (this.videoRegions) {
82557
82853
  var _this_videoRegions;
82558
82854
  (_this_videoRegions = this.videoRegions) === null || _this_videoRegions === void 0 ? void 0 : _this_videoRegions.destroy();
@@ -82561,10 +82857,7 @@ var VideoAd = /*#__PURE__*/ function() {
82561
82857
  this.videoAdContext.recorder.destroy();
82562
82858
  this.videoAdContext.recorder = void 0;
82563
82859
  }
82564
- if (this.presentation) {
82565
- this.presentation.destroy();
82566
- this.presentation = void 0;
82567
- }
82860
+ (_this_presentation = this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.stop();
82568
82861
  this.context.service.send("hs", {
82569
82862
  source: this.videoAdContext.media.source,
82570
82863
  strategy: this.videoAdContext.config.getStrategy().code
@@ -82582,7 +82875,8 @@ var VideoAd = /*#__PURE__*/ function() {
82582
82875
  }
82583
82876
  }, {
82584
82877
  logger: _this.videoAdContext.logger,
82585
- service: _this.context.service.join("".concat(data.video, "-").concat(_this.videoAdContext.config.getStrategy().code))
82878
+ service: _this.context.service.join("".concat(data.video, "-").concat(_this.videoAdContext.config.getStrategy().code)),
82879
+ config: _this.videoAdContext.config
82586
82880
  });
82587
82881
  _this.videoAdContext.store.dispatch({
82588
82882
  type: "UPDATE_VIDEO_INFO",
@@ -82593,15 +82887,12 @@ var VideoAd = /*#__PURE__*/ function() {
82593
82887
  }
82594
82888
  });
82595
82889
  _this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, _this.videoAdContext.config.getStrategySettings());
82596
- _this.presentation = _this.presentationFactory.get({
82597
- strategy: _this.videoAdContext.config.getStrategy().code
82598
- });
82599
82890
  _this.videoAdContext.data = _this.videoRegions;
82600
82891
  _this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
82601
82892
  id: data.video,
82602
82893
  ts: 0
82603
82894
  });
82604
- (_this_presentation = _this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.setup();
82895
+ (_this_presentation = _this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.start();
82605
82896
  });
82606
82897
  }
82607
82898
  },
@@ -83109,8 +83400,156 @@ var Location = /*#__PURE__*/ function() {
83109
83400
  ]);
83110
83401
  return Location;
83111
83402
  }();
83112
- // src/Service/Realtime.ts
83403
+ // src/Service/LocalRealtime.ts
83113
83404
  var import_events10 = __toESM(require_events());
83405
+ var DATA_STORE = {
83406
+ "video1": {}
83407
+ };
83408
+ var VIDEO_LIBRARY = {
83409
+ "video1": {
83410
+ source: ""
83411
+ }
83412
+ };
83413
+ var BRNDTSLocalRealtime = /*#__PURE__*/ function(_import_events10_default) {
83414
+ _inherits(BRNDTSLocalRealtime, _import_events10_default);
83415
+ function BRNDTSLocalRealtime(options, deps) {
83416
+ _class_call_check(this, BRNDTSLocalRealtime);
83417
+ var _this;
83418
+ _this = _call_super(this, BRNDTSLocalRealtime);
83419
+ _this.connected = new Changeable(false);
83420
+ _this.handlers = {
83421
+ info: [],
83422
+ result: [],
83423
+ completed: [],
83424
+ aborted: []
83425
+ };
83426
+ _this.options = options;
83427
+ _this.logger = deps.logger;
83428
+ if (!_this.options.ns) {
83429
+ window.__brndts_local_realtime = _this;
83430
+ }
83431
+ return _this;
83432
+ }
83433
+ _create_class(BRNDTSLocalRealtime, [
83434
+ {
83435
+ key: "handleOpen",
83436
+ value: function handleOpen() {
83437
+ this.connected.value = true;
83438
+ this.emit("connected");
83439
+ }
83440
+ },
83441
+ {
83442
+ key: "handleClose",
83443
+ value: function handleClose() {
83444
+ this.connected.value = false;
83445
+ this.emit("disconnected");
83446
+ }
83447
+ },
83448
+ {
83449
+ key: "connect",
83450
+ value: function connect() {
83451
+ this.handleOpen();
83452
+ }
83453
+ },
83454
+ {
83455
+ key: "respond",
83456
+ value: function respond(event, payload) {
83457
+ if (this.handlers[event]) {
83458
+ this.handlers[event].forEach(function(handler) {
83459
+ handler(payload);
83460
+ });
83461
+ }
83462
+ }
83463
+ },
83464
+ {
83465
+ key: "loads",
83466
+ value: function loads(videoId) {
83467
+ var _this = this;
83468
+ var _this_logger;
83469
+ (_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Loading data for :", videoId);
83470
+ var input = document.createElement("input");
83471
+ input.type = "file";
83472
+ input === null || input === void 0 ? void 0 : input.addEventListener("change", function(event) {
83473
+ var _input_files;
83474
+ var file = input === null || input === void 0 ? void 0 : (_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files[0];
83475
+ if (!file) {
83476
+ console.log("No file selected.");
83477
+ return;
83478
+ }
83479
+ var reader = new FileReader();
83480
+ reader.onload = function(event2) {
83481
+ var _event2_target;
83482
+ var fileContent = event2 === null || event2 === void 0 ? void 0 : (_event2_target = event2.target) === null || _event2_target === void 0 ? void 0 : _event2_target.result;
83483
+ if (fileContent) {
83484
+ var _this_logger;
83485
+ var parsedData = JSON.parse(fileContent);
83486
+ DATA_STORE[videoId] = parsedData;
83487
+ (_this_logger = _this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Loaded data for :", videoId);
83488
+ _this.respond("result", DATA_STORE[videoId]);
83489
+ }
83490
+ };
83491
+ reader.readAsText(file);
83492
+ });
83493
+ input.click();
83494
+ }
83495
+ },
83496
+ {
83497
+ key: "send",
83498
+ value: function send(event) {
83499
+ for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
83500
+ payload[_key - 1] = arguments[_key];
83501
+ }
83502
+ var _this_logger;
83503
+ (_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Received event :", event, payload);
83504
+ if (event === "hs") {
83505
+ var _this_logger1;
83506
+ (_this_logger1 = this.logger) === null || _this_logger1 === void 0 ? void 0 : _this_logger1.log("[REALTIME LOCAL] handling event :", event, payload);
83507
+ var _payload = _sliced_to_array(payload, 2), data = _payload[0], cb = _payload[1];
83508
+ var videoId = "video1";
83509
+ VIDEO_LIBRARY[videoId] = {
83510
+ // @ts-expect-error
83511
+ source: data.source
83512
+ };
83513
+ cb === null || cb === void 0 ? void 0 : cb({
83514
+ video: videoId
83515
+ });
83516
+ }
83517
+ }
83518
+ },
83519
+ {
83520
+ key: "handle",
83521
+ value: function handle(event, handler) {
83522
+ if (!this.handlers[event]) {
83523
+ this.handlers[event] = [];
83524
+ }
83525
+ this.handlers[event].push(handler);
83526
+ }
83527
+ },
83528
+ {
83529
+ key: "join",
83530
+ value: function join(ns) {
83531
+ var _this = this;
83532
+ setTimeout(function() {
83533
+ var _ref = _sliced_to_array(ns.match(/^([^-]+)-(.+)$/) || [], 2), video = _ref[0], strategy = _ref[1];
83534
+ if (video && DATA_STORE[video]) {
83535
+ var regions2 = DATA_STORE[video];
83536
+ _this.respond("result", regions2);
83537
+ }
83538
+ }, 150);
83539
+ return this;
83540
+ }
83541
+ },
83542
+ {
83543
+ key: "destroy",
83544
+ value: function destroy() {
83545
+ this.handleClose();
83546
+ }
83547
+ }
83548
+ ]);
83549
+ return BRNDTSLocalRealtime;
83550
+ }(import_events10.default);
83551
+ // src/Service/Realtime.ts
83552
+ var import_events11 = __toESM(require_events());
83114
83553
  // node_modules/engine.io-parser/build/esm/commons.js
83115
83554
  var PACKET_TYPES = /* @__PURE__ */ Object.create(null);
83116
83555
  PACKET_TYPES["open"] = "0";
@@ -86958,8 +87397,8 @@ Object.assign(lookup2, {
86958
87397
  connect: lookup2
86959
87398
  });
86960
87399
  // src/Service/Realtime.ts
86961
- var BRNDTSRealtime = /*#__PURE__*/ function(_import_events10_default) {
86962
- _inherits(_BRNDTSRealtime, _import_events10_default);
87400
+ var BRNDTSRealtime = /*#__PURE__*/ function(_import_events11_default) {
87401
+ _inherits(_BRNDTSRealtime, _import_events11_default);
86963
87402
  function _BRNDTSRealtime(options, deps) {
86964
87403
  _class_call_check(this, _BRNDTSRealtime);
86965
87404
  var _this;
@@ -87057,9 +87496,36 @@ var BRNDTSRealtime = /*#__PURE__*/ function(_import_events10_default) {
87057
87496
  }
87058
87497
  ]);
87059
87498
  return _BRNDTSRealtime;
87060
- }(import_events10.default);
87061
- // src/Service/LocalRealtime.ts
87062
- var import_events11 = __toESM(require_events());
87499
+ }(import_events11.default);
87500
+ // src/Service/ServiceFactory.ts
87501
+ var ServiceFactory = /*#__PURE__*/ function() {
87502
+ function ServiceFactory() {
87503
+ _class_call_check(this, ServiceFactory);
87504
+ }
87505
+ _create_class(ServiceFactory, null, [
87506
+ {
87507
+ key: "createService",
87508
+ value: function createService(context) {
87509
+ var serviceType = "remote";
87510
+ if (serviceType === "local") {
87511
+ return new BRNDTSLocalRealtime({
87512
+ host: context.config.get("host"),
87513
+ key: context.config.get("key")
87514
+ }, {
87515
+ logger: context.logger
87516
+ });
87517
+ }
87518
+ return new BRNDTSRealtime({
87519
+ host: context.config.get("host"),
87520
+ key: context.config.get("key")
87521
+ }, {
87522
+ logger: context.logger
87523
+ });
87524
+ }
87525
+ }
87526
+ ]);
87527
+ return ServiceFactory;
87528
+ }();
87063
87529
  // src/index.ts
87064
87530
  var BrndtsAds = /*#__PURE__*/ function() {
87065
87531
  function BrndtsAds(targets, options, adsOptions) {
@@ -87111,10 +87577,16 @@ var BrndtsAds = /*#__PURE__*/ function() {
87111
87577
  case 1:
87112
87578
  _state.trys.push([
87113
87579
  1,
87114
- 3,
87580
+ 4,
87115
87581
  ,
87116
- 4
87582
+ 5
87117
87583
  ]);
87584
+ if (!this.context.config.get("enabled")) {
87585
+ this.context.logger.error("Setup failed: disabled by config");
87586
+ return [
87587
+ 2
87588
+ ];
87589
+ }
87118
87590
  this.context.location = new Location();
87119
87591
  this.context.consent = ConsentFactory.get(this.context.logger);
87120
87592
  return [
@@ -87125,35 +87597,30 @@ var BrndtsAds = /*#__PURE__*/ function() {
87125
87597
  _state.sent();
87126
87598
  this.context.user = new User(this.context.config, this.context.consent);
87127
87599
  this.context.device = new Device();
87128
- this.context.device.collect();
87129
- if (!this.context.config.get("enabled")) {
87130
- this.context.logger.error("Setup failed: disabled by config");
87131
- return [
87132
- 2
87133
- ];
87134
- }
87135
- this.context.service = new BRNDTSRealtime({
87136
- host: this.context.config.get("host"),
87137
- key: this.context.config.get("key")
87138
- }, {
87139
- logger: this.context.logger
87140
- });
87600
+ return [
87601
+ 4,
87602
+ this.context.device.collect()
87603
+ ];
87604
+ case 3:
87605
+ _state.sent();
87606
+ console.log("BRNDTS Ads Presenter started with config");
87607
+ this.context.service = ServiceFactory.createService(this.context);
87141
87608
  this.context.service.on("connected", this.handleConnected);
87142
87609
  this.context.service.connect();
87143
87610
  return [
87144
87611
  3,
87145
- 4
87612
+ 5
87146
87613
  ];
87147
- case 3:
87614
+ case 4:
87148
87615
  error = _state.sent();
87149
87616
  if (_instanceof(error, Error)) {
87150
- this.context.logger.warn("Setup failed: no media element found!");
87617
+ console.log("Error during setup: ", error);
87151
87618
  }
87152
87619
  return [
87153
87620
  3,
87154
- 4
87621
+ 5
87155
87622
  ];
87156
- case 4:
87623
+ case 5:
87157
87624
  return [
87158
87625
  2
87159
87626
  ];