@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.mjs CHANGED
@@ -5396,13 +5396,13 @@ var require_libraries2 = __commonJS({
5396
5396
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5397
5397
  try {
5398
5398
  for(var _iterator = libraries_json_1.default[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5399
- var library2 = _step.value;
5400
- var match = user_agent_1.userAgentParser(library2.regex, userAgent2);
5399
+ var library3 = _step.value;
5400
+ var match = user_agent_1.userAgentParser(library3.regex, userAgent2);
5401
5401
  if (!match) continue;
5402
5402
  result.type = "library";
5403
- result.name = variable_replacement_1.variableReplacement(library2.name, match);
5404
- result.version = version_1.formatVersion(variable_replacement_1.variableReplacement(library2.version, match), _this.options.versionTruncation);
5405
- result.url = library2.url || "";
5403
+ result.name = variable_replacement_1.variableReplacement(library3.name, match);
5404
+ result.version = version_1.formatVersion(variable_replacement_1.variableReplacement(library3.version, match), _this.options.versionTruncation);
5405
+ result.url = library3.url || "";
5406
5406
  break;
5407
5407
  }
5408
5408
  } catch (err) {
@@ -67891,6 +67891,7 @@ var AdsConfigsClass = /*#__PURE__*/ function(BRNDTSConfig) {
67891
67891
  adStrategies: strategies
67892
67892
  };
67893
67893
  _this.merge();
67894
+ console.log("Ads strategies fetched", _this.remote.adStrategies);
67894
67895
  })
67895
67896
  ];
67896
67897
  case 1:
@@ -68312,48 +68313,329 @@ var GooglePublisherTag = /*#__PURE__*/ function() {
68312
68313
  return _GooglePublisherTag;
68313
68314
  }();
68314
68315
  // src/Ads/Providers/Provider.ts
68316
+ var typeAndDimensions = {
68317
+ "medium-rectangle": [
68318
+ [
68319
+ 300,
68320
+ 250
68321
+ ],
68322
+ [
68323
+ 250,
68324
+ 250
68325
+ ],
68326
+ [
68327
+ 200,
68328
+ 200
68329
+ ],
68330
+ [
68331
+ 180,
68332
+ 150
68333
+ ],
68334
+ [
68335
+ 150,
68336
+ 150
68337
+ ]
68338
+ ],
68339
+ "large-rectangle": [
68340
+ [
68341
+ 300,
68342
+ 600
68343
+ ],
68344
+ [
68345
+ 160,
68346
+ 600
68347
+ ],
68348
+ [
68349
+ 120,
68350
+ 600
68351
+ ]
68352
+ ],
68353
+ "billboard": [
68354
+ [
68355
+ 970,
68356
+ 250
68357
+ ],
68358
+ [
68359
+ 970,
68360
+ 90
68361
+ ],
68362
+ [
68363
+ 728,
68364
+ 90
68365
+ ],
68366
+ [
68367
+ 468,
68368
+ 60
68369
+ ]
68370
+ ],
68371
+ "leaderboard": [
68372
+ [
68373
+ 728,
68374
+ 90
68375
+ ],
68376
+ [
68377
+ 468,
68378
+ 60
68379
+ ],
68380
+ [
68381
+ 320,
68382
+ 50
68383
+ ],
68384
+ [
68385
+ 300,
68386
+ 50
68387
+ ],
68388
+ [
68389
+ 234,
68390
+ 60
68391
+ ]
68392
+ ],
68393
+ "smartphone-banner": [
68394
+ [
68395
+ 320,
68396
+ 50
68397
+ ],
68398
+ [
68399
+ 300,
68400
+ 50
68401
+ ],
68402
+ [
68403
+ 320,
68404
+ 100
68405
+ ]
68406
+ ]
68407
+ };
68315
68408
  var regions = [
68316
68409
  {
68317
68410
  id: 1,
68318
68411
  w: 300,
68319
68412
  h: 250,
68413
+ name: "Top Right - 300x250",
68320
68414
  type: "medium-rectangle"
68321
68415
  },
68322
68416
  {
68323
68417
  id: 2,
68324
68418
  w: 300,
68325
68419
  h: 250,
68420
+ name: "Bottom Right - 300x250",
68326
68421
  type: "medium-rectangle"
68327
68422
  },
68328
68423
  {
68329
68424
  id: 3,
68330
68425
  w: 320,
68331
68426
  h: 50,
68427
+ name: "Top Center - 320x50",
68332
68428
  type: "smartphone-banner"
68333
68429
  },
68334
68430
  {
68335
68431
  id: 4,
68432
+ w: 300,
68433
+ h: 250,
68434
+ name: "Top Left - 300x250",
68435
+ type: "medium-rectangle"
68436
+ },
68437
+ {
68438
+ id: 5,
68439
+ w: 250,
68440
+ h: 250,
68441
+ name: "Top Left - 250x250",
68442
+ type: "medium-rectangle"
68443
+ },
68444
+ {
68445
+ id: 6,
68446
+ w: 200,
68447
+ h: 200,
68448
+ name: "Top Left - 200x200",
68449
+ type: "medium-rectangle"
68450
+ },
68451
+ {
68452
+ id: 7,
68453
+ w: 180,
68454
+ h: 150,
68455
+ name: "Top Left - 180x150",
68456
+ type: "medium-rectangle"
68457
+ },
68458
+ {
68459
+ id: 8,
68460
+ w: 150,
68461
+ h: 150,
68462
+ name: "Top Left - 150x150",
68463
+ type: "medium-rectangle"
68464
+ },
68465
+ {
68466
+ id: 9,
68467
+ w: 250,
68468
+ h: 250,
68469
+ name: "Top Right - 250x250",
68470
+ type: "medium-rectangle"
68471
+ },
68472
+ {
68473
+ id: 10,
68474
+ w: 200,
68475
+ h: 200,
68476
+ name: "Top Right - 200x200",
68477
+ type: "medium-rectangle"
68478
+ },
68479
+ {
68480
+ id: 11,
68481
+ w: 180,
68482
+ h: 150,
68483
+ name: "Top Right - 180x150",
68484
+ type: "medium-rectangle"
68485
+ },
68486
+ {
68487
+ id: 12,
68488
+ w: 150,
68489
+ h: 150,
68490
+ name: "Top Right - 150x150",
68491
+ type: "medium-rectangle"
68492
+ },
68493
+ {
68494
+ id: 13,
68495
+ w: 300,
68496
+ h: 250,
68497
+ name: "Bottom Left - 300x250",
68498
+ type: "medium-rectangle"
68499
+ },
68500
+ {
68501
+ id: 14,
68502
+ w: 250,
68503
+ h: 250,
68504
+ name: "Bottom Left - 250x250",
68505
+ type: "medium-rectangle"
68506
+ },
68507
+ {
68508
+ id: 15,
68509
+ w: 200,
68510
+ h: 200,
68511
+ name: "Bottom Left - 200x200",
68512
+ type: "medium-rectangle"
68513
+ },
68514
+ {
68515
+ id: 16,
68516
+ w: 180,
68517
+ h: 150,
68518
+ name: "Bottom Left - 180x150",
68519
+ type: "medium-rectangle"
68520
+ },
68521
+ {
68522
+ id: 17,
68523
+ w: 150,
68524
+ h: 150,
68525
+ name: "Bottom Left - 150x150",
68526
+ type: "medium-rectangle"
68527
+ },
68528
+ {
68529
+ id: 18,
68530
+ w: 250,
68531
+ h: 250,
68532
+ name: "Bottom Right - 250x250",
68533
+ type: "medium-rectangle"
68534
+ },
68535
+ {
68536
+ id: 19,
68537
+ w: 200,
68538
+ h: 200,
68539
+ name: "Bottom Right - 200x200",
68540
+ type: "medium-rectangle"
68541
+ },
68542
+ {
68543
+ id: 20,
68544
+ w: 180,
68545
+ h: 150,
68546
+ name: "Bottom Right - 180x150",
68547
+ type: "medium-rectangle"
68548
+ },
68549
+ {
68550
+ id: 21,
68551
+ w: 150,
68552
+ h: 150,
68553
+ name: "Bottom Right - 150x150",
68554
+ type: "medium-rectangle"
68555
+ },
68556
+ {
68557
+ id: 22,
68336
68558
  w: 728,
68337
68559
  h: 90,
68560
+ name: "Top Center - 728x90",
68338
68561
  type: "leaderboard"
68339
68562
  },
68340
68563
  {
68341
- id: 5,
68564
+ id: 23,
68565
+ w: 468,
68566
+ h: 60,
68567
+ name: "Top Center - 468x60",
68568
+ type: "leaderboard"
68569
+ },
68570
+ {
68571
+ id: 24,
68342
68572
  w: 300,
68343
- h: 600,
68344
- type: "large-rectangle"
68573
+ h: 50,
68574
+ name: "Top Center - 300x50",
68575
+ type: "leaderboard"
68345
68576
  },
68346
68577
  {
68347
- id: 6,
68348
- w: 250,
68349
- h: 300,
68350
- type: ""
68578
+ id: 25,
68579
+ w: 234,
68580
+ h: 60,
68581
+ name: "Top Center - 234x60",
68582
+ type: "leaderboard"
68351
68583
  },
68352
68584
  {
68353
- id: 7,
68585
+ id: 26,
68586
+ w: 728,
68587
+ h: 90,
68588
+ name: "Bottom Center - 728x90",
68589
+ type: "leaderboard"
68590
+ },
68591
+ {
68592
+ id: 27,
68593
+ w: 468,
68594
+ h: 60,
68595
+ name: "Bottom Center - 468x60",
68596
+ type: "leaderboard"
68597
+ },
68598
+ {
68599
+ id: 28,
68600
+ w: 320,
68601
+ h: 50,
68602
+ name: "Bottom Center - 320x50",
68603
+ type: "smartphone-banner"
68604
+ },
68605
+ {
68606
+ id: 29,
68607
+ w: 300,
68608
+ h: 50,
68609
+ name: "Bottom Center - 300x50",
68610
+ type: "leaderboard"
68611
+ },
68612
+ {
68613
+ id: 30,
68614
+ w: 234,
68615
+ h: 60,
68616
+ name: "Bottom Center - 234x60",
68617
+ type: "leaderboard"
68618
+ },
68619
+ {
68620
+ id: 1e3,
68354
68621
  w: 970,
68355
68622
  h: 250,
68623
+ name: "Generic - 970x250",
68356
68624
  type: "billboard"
68625
+ },
68626
+ {
68627
+ id: 1001,
68628
+ w: 970,
68629
+ h: 90,
68630
+ name: "Generic - 970x90",
68631
+ type: "billboard"
68632
+ },
68633
+ {
68634
+ id: 1002,
68635
+ w: 250,
68636
+ h: 300,
68637
+ name: "Generic - 250x300",
68638
+ type: ""
68357
68639
  }
68358
68640
  ];
68359
68641
  var ContentProvider = /*#__PURE__*/ function() {
@@ -68408,98 +68690,7 @@ var ContentProvider = /*#__PURE__*/ function() {
68408
68690
  {
68409
68691
  key: "adSizes",
68410
68692
  get: function get() {
68411
- return {
68412
- "medium-rectangle": [
68413
- [
68414
- 300,
68415
- 250
68416
- ],
68417
- [
68418
- 250,
68419
- 250
68420
- ],
68421
- [
68422
- 200,
68423
- 200
68424
- ],
68425
- [
68426
- 180,
68427
- 150
68428
- ],
68429
- [
68430
- 150,
68431
- 150
68432
- ]
68433
- ],
68434
- "large-rectangle": [
68435
- [
68436
- 300,
68437
- 600
68438
- ],
68439
- [
68440
- 160,
68441
- 600
68442
- ],
68443
- [
68444
- 120,
68445
- 600
68446
- ]
68447
- ],
68448
- "billboard": [
68449
- [
68450
- 970,
68451
- 250
68452
- ],
68453
- [
68454
- 970,
68455
- 90
68456
- ],
68457
- [
68458
- 728,
68459
- 90
68460
- ],
68461
- [
68462
- 468,
68463
- 60
68464
- ]
68465
- ],
68466
- "leaderboard": [
68467
- [
68468
- 728,
68469
- 90
68470
- ],
68471
- [
68472
- 468,
68473
- 60
68474
- ],
68475
- [
68476
- 320,
68477
- 50
68478
- ],
68479
- [
68480
- 300,
68481
- 50
68482
- ],
68483
- [
68484
- 234,
68485
- 60
68486
- ]
68487
- ],
68488
- "smartphone-banner": [
68489
- [
68490
- 320,
68491
- 50
68492
- ],
68493
- [
68494
- 300,
68495
- 50
68496
- ],
68497
- [
68498
- 320,
68499
- 100
68500
- ]
68501
- ]
68502
- };
68693
+ return typeAndDimensions;
68503
68694
  }
68504
68695
  },
68505
68696
  {
@@ -69637,26 +69828,16 @@ var StaticImageProvider = /*#__PURE__*/ function(ContentProvider) {
69637
69828
  return StaticImageProvider;
69638
69829
  }(ContentProvider);
69639
69830
  // src/Ads/Providers/AfiliateProvider/AffiliateProvider.ts
69640
- var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69831
+ var AffiliateLibrary = /*#__PURE__*/ function() {
69641
69832
  "use strict";
69642
- _inherits(AffiliateProvider, ContentProvider1);
69643
- function AffiliateProvider(context, options) {
69644
- _class_call_check(this, AffiliateProvider);
69645
- var _this;
69646
- _this = _call_super(this, AffiliateProvider, [
69647
- context,
69648
- options
69649
- ]);
69650
- _this.manifest = [];
69651
- _this.useByRegion = {};
69652
- _this.ready = new Awaitable(false);
69653
- _this.content = {
69654
- content: [],
69655
- type: "affiliate"
69656
- };
69657
- return _this;
69833
+ function AffiliateLibrary(manifestUrl) {
69834
+ _class_call_check(this, AffiliateLibrary);
69835
+ this.ready = new Awaitable(false);
69836
+ this.loading = false;
69837
+ this.affiliates = [];
69838
+ this.manifestUrl = manifestUrl;
69658
69839
  }
69659
- _create_class(AffiliateProvider, [
69840
+ _create_class(AffiliateLibrary, [
69660
69841
  {
69661
69842
  key: "loadManifest",
69662
69843
  value: function loadManifest() {
@@ -69665,30 +69846,86 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69665
69846
  return _ts_generator(this, function(_state) {
69666
69847
  switch(_state.label){
69667
69848
  case 0:
69849
+ if (!this.ready.value && this.loading) {
69850
+ return [
69851
+ 2,
69852
+ this.ready.promise
69853
+ ];
69854
+ }
69855
+ this.loading = true;
69668
69856
  return [
69669
69857
  4,
69670
- fetch(this.options.manifest)
69858
+ fetch(this.manifestUrl)
69671
69859
  ];
69672
69860
  case 1:
69673
69861
  response = _state.sent();
69674
69862
  if (!response.ok) {
69863
+ this.ready.reject("Failed to fetch manifest: ".concat(response.statusText));
69675
69864
  throw new Error("Failed to fetch manifest: ".concat(response.statusText));
69676
69865
  }
69866
+ this.ready.resolve(true);
69867
+ this.loading = false;
69677
69868
  _ = this;
69678
69869
  return [
69679
69870
  4,
69680
69871
  response.json()
69681
69872
  ];
69682
69873
  case 2:
69683
- _.manifest = _state.sent();
69684
- this.ready.resolve(true);
69874
+ _.affiliates = _state.sent();
69685
69875
  return [
69686
- 2
69876
+ 2,
69877
+ this.ready.promise
69687
69878
  ];
69688
69879
  }
69689
69880
  });
69690
69881
  }).call(this);
69691
69882
  }
69883
+ }
69884
+ ]);
69885
+ return AffiliateLibrary;
69886
+ }();
69887
+ var library;
69888
+ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69889
+ "use strict";
69890
+ _inherits(AffiliateProvider, ContentProvider1);
69891
+ function AffiliateProvider(context, options) {
69892
+ _class_call_check(this, AffiliateProvider);
69893
+ var _this;
69894
+ _this = _call_super(this, AffiliateProvider, [
69895
+ context,
69896
+ options
69897
+ ]);
69898
+ _this.useByRegion = {};
69899
+ _this.ready = new Awaitable(false);
69900
+ if (!library) {
69901
+ library = new AffiliateLibrary(options.manifest);
69902
+ }
69903
+ _this.content = {
69904
+ content: [],
69905
+ type: "affiliate"
69906
+ };
69907
+ return _this;
69908
+ }
69909
+ _create_class(AffiliateProvider, [
69910
+ {
69911
+ key: "loadManifest",
69912
+ value: function loadManifest() {
69913
+ return _async_to_generator(function() {
69914
+ var _this;
69915
+ return _ts_generator(this, function(_state) {
69916
+ _this = this;
69917
+ return [
69918
+ 2,
69919
+ library === null || library === void 0 ? void 0 : library.loadManifest().then(function() {
69920
+ _this.ready.resolve(true);
69921
+ return true;
69922
+ }).catch(function(error) {
69923
+ _this.ready.reject(error);
69924
+ })
69925
+ ];
69926
+ });
69927
+ }).call(this);
69928
+ }
69692
69929
  },
69693
69930
  {
69694
69931
  key: "getAffiliate",
@@ -69702,7 +69939,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69702
69939
  var _this1, _loop = function() {
69703
69940
  var _step_value = _sliced_to_array(_step.value, 2), width = _step_value[0], height = _step_value[1];
69704
69941
  var identifier = "".concat(width, "x").concat(height);
69705
- var aff2 = _this1.manifest.filter(function(a) {
69942
+ var aff2 = library.affiliates.filter(function(a) {
69706
69943
  return a.size.w === width && a.size.h === height;
69707
69944
  });
69708
69945
  if (!aff2.length) {
@@ -69747,7 +69984,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69747
69984
  }
69748
69985
  if ((size === null || size === void 0 ? void 0 : size.width) && (size === null || size === void 0 ? void 0 : size.height)) {
69749
69986
  var identifier = "".concat(size.width, "x").concat(size.height);
69750
- var aff2 = this.manifest.filter(function(a) {
69987
+ var aff2 = library.affiliates.filter(function(a) {
69751
69988
  return a.size.w === (size === null || size === void 0 ? void 0 : size.width) && a.size.h === size.height;
69752
69989
  });
69753
69990
  if (!aff2.length) {
@@ -69771,7 +70008,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69771
70008
  if (!this.useByRegion[regionId]) {
69772
70009
  this.useByRegion[regionId] = /* @__PURE__ */ new Set();
69773
70010
  }
69774
- var aff = this.manifest.filter(function(a) {
70011
+ var aff = library.affiliates.filter(function(a) {
69775
70012
  return a.region.includes("".concat(regionId));
69776
70013
  });
69777
70014
  if (!aff.length) {
@@ -71435,16 +71672,20 @@ var RegionBorderPlugin = /*#__PURE__*/ function() {
71435
71672
  {
71436
71673
  key: "beforeShow",
71437
71674
  value: function beforeShow(region) {
71438
- var _this_options;
71439
- if (!region.hasContent) {
71440
- return Promise.resolve();
71441
- }
71442
- if ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.useFeather) {
71443
- region.content.view.classList.toggle("BRNDTS_R_FTH", true);
71444
- } else {
71445
- region.content.view.classList.toggle("BRNDTS_R_B", true);
71446
- }
71447
- return Promise.resolve();
71675
+ var _this = this;
71676
+ if (!region.hasContent) return Promise.resolve();
71677
+ return new Promise(function(resolve) {
71678
+ requestAnimationFrame(function() {
71679
+ var _this_options;
71680
+ var view = region.content.view;
71681
+ if ((_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.useFeather) {
71682
+ view.classList.toggle("BRNDTS_R_FTH", true);
71683
+ } else {
71684
+ view.classList.toggle("BRNDTS_R_B", true);
71685
+ }
71686
+ resolve();
71687
+ });
71688
+ });
71448
71689
  }
71449
71690
  },
71450
71691
  {
@@ -72918,10 +73159,15 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
72918
73159
  key: "assurePlaybackState",
72919
73160
  value: function assurePlaybackState(play) {
72920
73161
  if (this.media && this.media.hasPlayed) {
72921
- var _this__source;
72922
- 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) {
72923
- this._source.videoId = this.videoId;
72924
- this.emit("UPDATED_SOURCE", this._source.videoId);
73162
+ var _this_instance;
73163
+ var newVideoIndex = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.getPlaylistIndex();
73164
+ if (newVideoIndex !== this.currentVideoIndex) {
73165
+ this.currentVideoIndex = newVideoIndex;
73166
+ if (this._source && this._source.type === "playlist") {
73167
+ var _this__source;
73168
+ this._source.videoId = this.videoId;
73169
+ this.emit("UPDATED_SOURCE", (_this__source = this._source) === null || _this__source === void 0 ? void 0 : _this__source.videoId);
73170
+ }
72925
73171
  }
72926
73172
  }
72927
73173
  if (this.media && play && !this.media.hasPlayed) {
@@ -72957,11 +73203,13 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
72957
73203
  key: "handleYTPlayerReady",
72958
73204
  value: function handleYTPlayerReady(event) {
72959
73205
  var _this = this;
73206
+ var _this_instance;
72960
73207
  if (this.instance) {
72961
73208
  this.context.logger.warn("Instance already found!");
72962
73209
  return;
72963
73210
  }
72964
73211
  this.instance = event.target;
73212
+ this.currentVideoIndex = (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.getPlaylistIndex();
72965
73213
  this.ready = true;
72966
73214
  this.observeResize();
72967
73215
  this.context.store.dispatch({
@@ -75523,236 +75771,6 @@ var VideoRegionsDataManager = /*#__PURE__*/ function(_import_events4_EventEmitte
75523
75771
  ]);
75524
75772
  return VideoRegionsDataManager;
75525
75773
  }(import_events4.EventEmitter);
75526
- // src/Ads/VideoAds/VideoRegionsData/VideoRegionsDataManagerDecorator.ts
75527
- var VideoRegionsDataManagerDecorator = /*#__PURE__*/ function() {
75528
- "use strict";
75529
- function VideoRegionsDataManagerDecorator(component) {
75530
- _class_call_check(this, VideoRegionsDataManagerDecorator);
75531
- this.component = component;
75532
- }
75533
- _create_class(VideoRegionsDataManagerDecorator, [
75534
- {
75535
- key: "data",
75536
- get: function get() {
75537
- return this.component.data;
75538
- }
75539
- },
75540
- {
75541
- key: "on",
75542
- value: function on(event, handler) {
75543
- return this.component.on(event, handler);
75544
- }
75545
- },
75546
- {
75547
- key: "fetch",
75548
- value: function fetch1() {
75549
- return this.component.fetch();
75550
- }
75551
- },
75552
- {
75553
- key: "seek",
75554
- value: function seek(timestamp) {
75555
- return this.component.seek(timestamp);
75556
- }
75557
- },
75558
- {
75559
- key: "check",
75560
- value: function check(timestamp) {
75561
- return this.component.check(timestamp);
75562
- }
75563
- },
75564
- {
75565
- key: "get",
75566
- value: function get(timestamp) {
75567
- return this.component.get(timestamp);
75568
- }
75569
- },
75570
- {
75571
- key: "destroy",
75572
- value: function destroy() {
75573
- return this.component.destroy();
75574
- }
75575
- },
75576
- {
75577
- key: "dumps",
75578
- value: function dumps(from, to) {
75579
- return this.component.dumps(from, to);
75580
- }
75581
- },
75582
- {
75583
- key: "loads",
75584
- value: function loads() {
75585
- return this.component.loads();
75586
- }
75587
- }
75588
- ]);
75589
- return VideoRegionsDataManagerDecorator;
75590
- }();
75591
- // src/Ads/VideoAds/VideoRegionsDurationDecorator.ts
75592
- var VideoRegionsDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
75593
- "use strict";
75594
- _inherits(VideoRegionsDurationDecorator, VideoRegionsDataManagerDecorator);
75595
- function VideoRegionsDurationDecorator(component, params) {
75596
- _class_call_check(this, VideoRegionsDurationDecorator);
75597
- var _this;
75598
- _this = _call_super(this, VideoRegionsDurationDecorator, [
75599
- component
75600
- ]);
75601
- _this.params = params;
75602
- return _this;
75603
- }
75604
- _create_class(VideoRegionsDurationDecorator, [
75605
- {
75606
- key: "check",
75607
- value: function check(timestamp) {
75608
- var totalDuration = 0;
75609
- var last;
75610
- var result;
75611
- var workingTimestamp = timestamp;
75612
- while(totalDuration < this.params.duration){
75613
- var regions2 = this.component.get(workingTimestamp);
75614
- if (!regions2 || !regions2.regions) {
75615
- return null;
75616
- }
75617
- if (!last) {
75618
- last = regions2.regions.map(function(r3) {
75619
- return r3.id;
75620
- });
75621
- result = _to_consumable_array(regions2.regions);
75622
- return {
75623
- timestamp_start: timestamp,
75624
- timestamp_end: timestamp + totalDuration,
75625
- regions: result
75626
- };
75627
- }
75628
- var validRegions = regions2.regions.filter(function(reg) {
75629
- return last === null || last === void 0 ? void 0 : last.includes(reg.id);
75630
- });
75631
- if (validRegions.length <= 0) {
75632
- return null;
75633
- }
75634
- var duration = 0;
75635
- if (regions2.timestamp_start < workingTimestamp) {
75636
- duration = regions2.timestamp_end - workingTimestamp;
75637
- } else {
75638
- duration = regions2.timestamp_end - regions2.timestamp_start;
75639
- }
75640
- totalDuration += duration;
75641
- workingTimestamp = regions2.timestamp_end + 1e-3 + 1e3;
75642
- last = validRegions.map(function(r3) {
75643
- return r3.id;
75644
- });
75645
- result = _to_consumable_array(validRegions);
75646
- }
75647
- if (!result) {
75648
- return null;
75649
- }
75650
- return {
75651
- timestamp_start: timestamp,
75652
- timestamp_end: timestamp + totalDuration,
75653
- regions: result
75654
- };
75655
- }
75656
- }
75657
- ]);
75658
- return VideoRegionsDurationDecorator;
75659
- }(VideoRegionsDataManagerDecorator);
75660
- var VideoRegionsMaxDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
75661
- "use strict";
75662
- _inherits(VideoRegionsMaxDurationDecorator, VideoRegionsDataManagerDecorator);
75663
- function VideoRegionsMaxDurationDecorator(component, params) {
75664
- _class_call_check(this, VideoRegionsMaxDurationDecorator);
75665
- var _this;
75666
- _this = _call_super(this, VideoRegionsMaxDurationDecorator, [
75667
- component
75668
- ]);
75669
- _this.params = params;
75670
- return _this;
75671
- }
75672
- _create_class(VideoRegionsMaxDurationDecorator, [
75673
- {
75674
- key: "check",
75675
- value: function check(timestamp) {
75676
- var totalDuration = 0;
75677
- var last;
75678
- var result;
75679
- var workingTimestamp = timestamp;
75680
- var filteredRegions = [];
75681
- do {
75682
- var regions2 = this.component.get(workingTimestamp);
75683
- if (!regions2 || !regions2.regions) {
75684
- break;
75685
- }
75686
- if (!last) {
75687
- last = regions2.regions.map(function(r3) {
75688
- return r3.id;
75689
- });
75690
- result = _to_consumable_array(regions2.regions);
75691
- continue;
75692
- }
75693
- filteredRegions = regions2.regions.filter(function(reg) {
75694
- if (last.includes(reg.id)) {
75695
- return true;
75696
- }
75697
- return false;
75698
- });
75699
- if (filteredRegions.length <= 0) {
75700
- break;
75701
- }
75702
- var duration = 0;
75703
- if (regions2.timestamp_start < workingTimestamp) {
75704
- duration = regions2.timestamp_end - workingTimestamp;
75705
- } else {
75706
- duration = regions2.timestamp_end - regions2.timestamp_start;
75707
- }
75708
- totalDuration += duration;
75709
- workingTimestamp = regions2.timestamp_end + 1e-3 + 1e3;
75710
- last = filteredRegions.map(function(r3) {
75711
- return r3.id;
75712
- });
75713
- result = _to_consumable_array(filteredRegions);
75714
- }while (true);
75715
- if (!result || totalDuration < this.params.minDuration) {
75716
- return null;
75717
- }
75718
- return {
75719
- timestamp_start: timestamp,
75720
- timestamp_end: timestamp + totalDuration,
75721
- regions: result
75722
- };
75723
- }
75724
- }
75725
- ]);
75726
- return VideoRegionsMaxDurationDecorator;
75727
- }(VideoRegionsDataManagerDecorator);
75728
- var VideoRegionsDecoratorFactory = /*#__PURE__*/ function() {
75729
- "use strict";
75730
- function VideoRegionsDecoratorFactory() {
75731
- _class_call_check(this, VideoRegionsDecoratorFactory);
75732
- }
75733
- _create_class(VideoRegionsDecoratorFactory, null, [
75734
- {
75735
- key: "decorate",
75736
- value: function decorate(component, params) {
75737
- if (!params) {
75738
- return component;
75739
- }
75740
- if (params.visibility_duration) {
75741
- return new VideoRegionsDurationDecorator(component, {
75742
- duration: params.visibility_duration.value
75743
- });
75744
- }
75745
- if (params.minimum_display_time) {
75746
- return new VideoRegionsMaxDurationDecorator(component, {
75747
- minDuration: params.minimum_display_time.value
75748
- });
75749
- }
75750
- return component;
75751
- }
75752
- }
75753
- ]);
75754
- return VideoRegionsDecoratorFactory;
75755
- }();
75756
75774
  // src/Ads/VideoAds/State/Store.ts
75757
75775
  function reducer(state, action) {
75758
75776
  switch(action.type){
@@ -76286,10 +76304,9 @@ var DynamicDurationPresentation = /*#__PURE__*/ function(AbstractPresentation) {
76286
76304
  this.stopRetry();
76287
76305
  this.startPacing();
76288
76306
  if (opts.expectedDuration && !this.presentationTimer.isPaused) {
76289
- this.presentationTimer.setDuration(opts.expectedDuration);
76290
- } else {
76291
- this.presentationTimer.resume();
76307
+ this.presentationTimer.setDuration(opts.expectedDuration * 1e3);
76292
76308
  }
76309
+ this.presentationTimer.resume();
76293
76310
  }
76294
76311
  },
76295
76312
  {
@@ -77836,9 +77853,9 @@ function findIconDefinition(iconLookup) {
77836
77853
  var prefix = iconLookup.prefix || getDefaultUsablePrefix();
77837
77854
  if (!iconName) return;
77838
77855
  iconName = byAlias(prefix, iconName) || iconName;
77839
- return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77856
+ return iconFromMapping(library2.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77840
77857
  }
77841
- var library = new Library();
77858
+ var library2 = new Library();
77842
77859
  var noAuto = function() {
77843
77860
  config.autoReplaceSvg = false;
77844
77861
  config.observeMutations = false;
@@ -77912,7 +77929,7 @@ var api = {
77912
77929
  config: config,
77913
77930
  dom: dom,
77914
77931
  parse: parse,
77915
- library: library,
77932
+ library: library2,
77916
77933
  findIconDefinition: findIconDefinition,
77917
77934
  toHtml: toHtml
77918
77935
  };
@@ -79818,6 +79835,8 @@ var Controls = /*#__PURE__*/ function() {
79818
79835
  this.context = context;
79819
79836
  this.container = document.createElement("div");
79820
79837
  this.container.id = "BRNDTS_CTL";
79838
+ this.container.style.width = "100%";
79839
+ this.container.style.height = "100%";
79821
79840
  this.buildControls();
79822
79841
  }
79823
79842
  _create_class(Controls, [
@@ -79919,6 +79938,8 @@ var Backdrop = /*#__PURE__*/ function() {
79919
79938
  this.context = context;
79920
79939
  this.container = document.createElement("div");
79921
79940
  this.container.id = "BRNDTS_BKD";
79941
+ this.container.style.width = "100%";
79942
+ this.container.style.height = "100%";
79922
79943
  }
79923
79944
  _create_class(Backdrop, [
79924
79945
  {
@@ -81749,7 +81770,6 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
81749
81770
  var _this_adPresentationStrategy, _this_regionsRenderer;
81750
81771
  (_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
81751
81772
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
81752
- this.context.logger.info("NotBasicPresentationMode has been stopped.");
81753
81773
  }
81754
81774
  },
81755
81775
  {
@@ -81859,6 +81879,7 @@ var RegionFactory = /*#__PURE__*/ function() {
81859
81879
  }));
81860
81880
  }
81861
81881
  plugins2.push(new RegionMaskPlugin());
81882
+ plugins2.push(new RegionAnimationPlugin("OPACITY"));
81862
81883
  }
81863
81884
  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")) {
81864
81885
  plugins2.push(new RegionBorderPlugin(), new RegionAnimationPlugin());
@@ -82448,8 +82469,10 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
82448
82469
  expectedDuration: regions2.timestamp_end - regions2.timestamp_start
82449
82470
  });
82450
82471
  } else {
82451
- var _this_adPresentationStrategy1;
82472
+ var _this_adPresentationStrategy1, _this_regionsRenderer, _this_auxElementsRenderer;
82452
82473
  (_this_adPresentationStrategy1 = _this.adPresentationStrategy) === null || _this_adPresentationStrategy1 === void 0 ? void 0 : _this_adPresentationStrategy1.endedPresentation();
82474
+ (_this_regionsRenderer = _this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
82475
+ (_this_auxElementsRenderer = _this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
82453
82476
  }
82454
82477
  }).on("pace", function() {
82455
82478
  try {
@@ -82502,7 +82525,6 @@ var NotBasicPresentationMode = /*#__PURE__*/ function() {
82502
82525
  (_this_adPresentationStrategy = this.adPresentationStrategy) === null || _this_adPresentationStrategy === void 0 ? void 0 : _this_adPresentationStrategy.stop();
82503
82526
  (_this_regionsRenderer = this.regionsRenderer) === null || _this_regionsRenderer === void 0 ? void 0 : _this_regionsRenderer.clear();
82504
82527
  (_this_auxElementsRenderer = this.auxElementsRenderer) === null || _this_auxElementsRenderer === void 0 ? void 0 : _this_auxElementsRenderer.clear();
82505
- this.context.logger.info("NotBasicPresentationMode has been stopped.");
82506
82528
  }
82507
82529
  },
82508
82530
  {
@@ -82541,6 +82563,280 @@ var PresentationModeFactory = /*#__PURE__*/ function() {
82541
82563
  ]);
82542
82564
  return PresentationModeFactory;
82543
82565
  }();
82566
+ // src/Ads/VideoAds/VideoRegionsData/VideoRegionsDataManagerDecorator.ts
82567
+ var VideoRegionsDataManagerDecorator = /*#__PURE__*/ function() {
82568
+ "use strict";
82569
+ function VideoRegionsDataManagerDecorator(component) {
82570
+ _class_call_check(this, VideoRegionsDataManagerDecorator);
82571
+ this.component = component;
82572
+ }
82573
+ _create_class(VideoRegionsDataManagerDecorator, [
82574
+ {
82575
+ key: "data",
82576
+ get: function get() {
82577
+ return this.component.data;
82578
+ }
82579
+ },
82580
+ {
82581
+ key: "on",
82582
+ value: function on(event, handler) {
82583
+ return this.component.on(event, handler);
82584
+ }
82585
+ },
82586
+ {
82587
+ key: "fetch",
82588
+ value: function fetch1() {
82589
+ return this.component.fetch();
82590
+ }
82591
+ },
82592
+ {
82593
+ key: "seek",
82594
+ value: function seek(timestamp) {
82595
+ return this.component.seek(timestamp);
82596
+ }
82597
+ },
82598
+ {
82599
+ key: "check",
82600
+ value: function check(timestamp) {
82601
+ return this.component.check(timestamp);
82602
+ }
82603
+ },
82604
+ {
82605
+ key: "get",
82606
+ value: function get(timestamp) {
82607
+ return this.component.get(timestamp);
82608
+ }
82609
+ },
82610
+ {
82611
+ key: "destroy",
82612
+ value: function destroy() {
82613
+ return this.component.destroy();
82614
+ }
82615
+ },
82616
+ {
82617
+ key: "dumps",
82618
+ value: function dumps(from, to) {
82619
+ return this.component.dumps(from, to);
82620
+ }
82621
+ },
82622
+ {
82623
+ key: "loads",
82624
+ value: function loads() {
82625
+ return this.component.loads();
82626
+ }
82627
+ }
82628
+ ]);
82629
+ return VideoRegionsDataManagerDecorator;
82630
+ }();
82631
+ // src/Ads/VideoAds/VideoRegionsData/VideoRegionsDecorators.ts
82632
+ var VideoRegionsDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
82633
+ "use strict";
82634
+ _inherits(VideoRegionsDurationDecorator, VideoRegionsDataManagerDecorator);
82635
+ function VideoRegionsDurationDecorator(component, params) {
82636
+ _class_call_check(this, VideoRegionsDurationDecorator);
82637
+ var _this;
82638
+ _this = _call_super(this, VideoRegionsDurationDecorator, [
82639
+ component
82640
+ ]);
82641
+ _this.params = params;
82642
+ return _this;
82643
+ }
82644
+ _create_class(VideoRegionsDurationDecorator, [
82645
+ {
82646
+ key: "check",
82647
+ value: function check(timestamp) {
82648
+ var totalDuration = 0;
82649
+ var last;
82650
+ var result;
82651
+ var workingTimestamp = timestamp;
82652
+ while(totalDuration < this.params.duration){
82653
+ var regions2 = this.component.get(workingTimestamp);
82654
+ if (!regions2 || !regions2.regions) {
82655
+ return null;
82656
+ }
82657
+ if (!last) {
82658
+ last = regions2.regions.map(function(r3) {
82659
+ return r3.id;
82660
+ });
82661
+ result = _to_consumable_array(regions2.regions);
82662
+ }
82663
+ var validRegions = regions2.regions.filter(function(reg) {
82664
+ return last === null || last === void 0 ? void 0 : last.includes(reg.id);
82665
+ });
82666
+ if (validRegions.length <= 0) {
82667
+ return null;
82668
+ }
82669
+ var duration = 0;
82670
+ if (regions2.timestamp_start < workingTimestamp) {
82671
+ duration = regions2.timestamp_end - workingTimestamp;
82672
+ } else {
82673
+ duration = regions2.timestamp_end - regions2.timestamp_start;
82674
+ }
82675
+ totalDuration += duration;
82676
+ workingTimestamp = regions2.timestamp_end + 0.01;
82677
+ last = validRegions.map(function(r3) {
82678
+ return r3.id;
82679
+ });
82680
+ result = _to_consumable_array(validRegions);
82681
+ }
82682
+ if (!result) {
82683
+ return null;
82684
+ }
82685
+ return {
82686
+ timestamp_start: timestamp,
82687
+ timestamp_end: timestamp + totalDuration,
82688
+ regions: result
82689
+ };
82690
+ }
82691
+ }
82692
+ ]);
82693
+ return VideoRegionsDurationDecorator;
82694
+ }(VideoRegionsDataManagerDecorator);
82695
+ var VideoRegionsMaxDurationDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
82696
+ "use strict";
82697
+ _inherits(VideoRegionsMaxDurationDecorator, VideoRegionsDataManagerDecorator);
82698
+ function VideoRegionsMaxDurationDecorator(component, params) {
82699
+ _class_call_check(this, VideoRegionsMaxDurationDecorator);
82700
+ var _this;
82701
+ _this = _call_super(this, VideoRegionsMaxDurationDecorator, [
82702
+ component
82703
+ ]);
82704
+ _this.params = params;
82705
+ return _this;
82706
+ }
82707
+ _create_class(VideoRegionsMaxDurationDecorator, [
82708
+ {
82709
+ key: "check",
82710
+ value: function check(timestamp) {
82711
+ var totalDuration = 0;
82712
+ var last;
82713
+ var result;
82714
+ var workingTimestamp = timestamp;
82715
+ do {
82716
+ var regions2 = this.component.get(workingTimestamp);
82717
+ if (!regions2 || !regions2.regions) {
82718
+ break;
82719
+ }
82720
+ if (!last) {
82721
+ last = regions2.regions.map(function(r3) {
82722
+ return r3.id;
82723
+ });
82724
+ result = _to_consumable_array(regions2.regions);
82725
+ }
82726
+ var validRegions = regions2.regions.filter(function(reg) {
82727
+ return last === null || last === void 0 ? void 0 : last.includes(reg.id);
82728
+ });
82729
+ if (validRegions.length <= 0) {
82730
+ break;
82731
+ }
82732
+ var duration = 0;
82733
+ if (regions2.timestamp_start < workingTimestamp) {
82734
+ duration = regions2.timestamp_end - workingTimestamp;
82735
+ } else {
82736
+ duration = regions2.timestamp_end - regions2.timestamp_start;
82737
+ }
82738
+ totalDuration += duration;
82739
+ workingTimestamp = regions2.timestamp_end + 0.01;
82740
+ last = validRegions.map(function(r3) {
82741
+ return r3.id;
82742
+ });
82743
+ result = _to_consumable_array(validRegions);
82744
+ }while (true);
82745
+ if (!result || totalDuration < this.params.minDuration) {
82746
+ return null;
82747
+ }
82748
+ return {
82749
+ timestamp_start: timestamp,
82750
+ timestamp_end: timestamp + totalDuration,
82751
+ regions: result
82752
+ };
82753
+ }
82754
+ }
82755
+ ]);
82756
+ return VideoRegionsMaxDurationDecorator;
82757
+ }(VideoRegionsDataManagerDecorator);
82758
+ var VideoRegionsTypeFilterDecorator = /*#__PURE__*/ function(VideoRegionsDataManagerDecorator) {
82759
+ "use strict";
82760
+ _inherits(VideoRegionsTypeFilterDecorator, VideoRegionsDataManagerDecorator);
82761
+ function VideoRegionsTypeFilterDecorator(component, params) {
82762
+ _class_call_check(this, VideoRegionsTypeFilterDecorator);
82763
+ var _this;
82764
+ _this = _call_super(this, VideoRegionsTypeFilterDecorator, [
82765
+ component
82766
+ ]);
82767
+ if (params && params.value && Array.isArray(params.value)) {
82768
+ var _params_setting_constraints;
82769
+ var regionsMap = ((_params_setting_constraints = params.setting.constraints) === null || _params_setting_constraints === void 0 ? void 0 : _params_setting_constraints.mapped_allowed_values_ids) || {};
82770
+ _this.allowedRegions = params.value.map(function(r3) {
82771
+ return regionsMap[r3];
82772
+ }).filter(Boolean);
82773
+ }
82774
+ return _this;
82775
+ }
82776
+ _create_class(VideoRegionsTypeFilterDecorator, [
82777
+ {
82778
+ key: "check",
82779
+ value: function check(timestamp) {
82780
+ var _this = this;
82781
+ var data = this.component.check(timestamp);
82782
+ if (this.allowedRegions !== void 0 && data && data.regions) {
82783
+ data.regions = data.regions.filter(function(region) {
82784
+ var _this_allowedRegions;
82785
+ return (_this_allowedRegions = _this.allowedRegions) === null || _this_allowedRegions === void 0 ? void 0 : _this_allowedRegions.includes(region.id);
82786
+ });
82787
+ }
82788
+ return data;
82789
+ }
82790
+ },
82791
+ {
82792
+ key: "get",
82793
+ value: function get(timestamp) {
82794
+ var _this = this;
82795
+ var data = this.component.get(timestamp);
82796
+ if (this.allowedRegions !== void 0 && data && data.regions) {
82797
+ data.regions = data.regions.filter(function(region) {
82798
+ var _this_allowedRegions;
82799
+ return (_this_allowedRegions = _this.allowedRegions) === null || _this_allowedRegions === void 0 ? void 0 : _this_allowedRegions.includes(region.id);
82800
+ });
82801
+ }
82802
+ return data;
82803
+ }
82804
+ }
82805
+ ]);
82806
+ return VideoRegionsTypeFilterDecorator;
82807
+ }(VideoRegionsDataManagerDecorator);
82808
+ var VideoRegionsDecoratorFactory = /*#__PURE__*/ function() {
82809
+ "use strict";
82810
+ function VideoRegionsDecoratorFactory() {
82811
+ _class_call_check(this, VideoRegionsDecoratorFactory);
82812
+ }
82813
+ _create_class(VideoRegionsDecoratorFactory, null, [
82814
+ {
82815
+ key: "decorate",
82816
+ value: function decorate(component, params) {
82817
+ var _params_visibility_duration, _params_minimum_display_time, _params_ad_placements_and_sizes;
82818
+ var target = component;
82819
+ if (!params) {
82820
+ return target;
82821
+ }
82822
+ if ((_params_visibility_duration = params.visibility_duration) === null || _params_visibility_duration === void 0 ? void 0 : _params_visibility_duration.value) {
82823
+ target = new VideoRegionsDurationDecorator(target, {
82824
+ duration: params.visibility_duration.value
82825
+ });
82826
+ } else if ((_params_minimum_display_time = params.minimum_display_time) === null || _params_minimum_display_time === void 0 ? void 0 : _params_minimum_display_time.value) {
82827
+ target = new VideoRegionsMaxDurationDecorator(target, {
82828
+ minDuration: params.minimum_display_time.value
82829
+ });
82830
+ }
82831
+ 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) {
82832
+ target = new VideoRegionsTypeFilterDecorator(target, params.ad_placements_and_sizes);
82833
+ }
82834
+ return target;
82835
+ }
82836
+ }
82837
+ ]);
82838
+ return VideoRegionsDecoratorFactory;
82839
+ }();
82544
82840
  // src/Ads/VideoAds/VideoAd.ts
82545
82841
  var VideoAd = /*#__PURE__*/ function() {
82546
82842
  "use strict";
@@ -82618,7 +82914,8 @@ var VideoAd = /*#__PURE__*/ function() {
82618
82914
  }, {
82619
82915
  logger: this.videoAdContext.logger,
82620
82916
  // @ts-expect-error
82621
- service: this.videoAdContext.service.join("".concat(data.video, "-").concat(this.videoAdContext.config.getStrategy().code))
82917
+ service: this.videoAdContext.service.join("".concat(data.video, "-").concat(this.videoAdContext.config.getStrategy().code)),
82918
+ config: this.videoAdContext.config
82622
82919
  });
82623
82920
  this.videoAdContext.store.dispatch({
82624
82921
  type: "UPDATE_VIDEO_INFO",
@@ -82683,6 +82980,7 @@ var VideoAd = /*#__PURE__*/ function() {
82683
82980
  key: "updateRegionData",
82684
82981
  value: function updateRegionData() {
82685
82982
  var _this = this;
82983
+ var _this_presentation;
82686
82984
  if (this.videoRegions) {
82687
82985
  var _this_videoRegions;
82688
82986
  (_this_videoRegions = this.videoRegions) === null || _this_videoRegions === void 0 ? void 0 : _this_videoRegions.destroy();
@@ -82691,10 +82989,7 @@ var VideoAd = /*#__PURE__*/ function() {
82691
82989
  this.videoAdContext.recorder.destroy();
82692
82990
  this.videoAdContext.recorder = void 0;
82693
82991
  }
82694
- if (this.presentation) {
82695
- this.presentation.destroy();
82696
- this.presentation = void 0;
82697
- }
82992
+ (_this_presentation = this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.stop();
82698
82993
  this.context.service.send("hs", {
82699
82994
  source: this.videoAdContext.media.source,
82700
82995
  strategy: this.videoAdContext.config.getStrategy().code
@@ -82712,7 +83007,8 @@ var VideoAd = /*#__PURE__*/ function() {
82712
83007
  }
82713
83008
  }, {
82714
83009
  logger: _this.videoAdContext.logger,
82715
- service: _this.context.service.join("".concat(data.video, "-").concat(_this.videoAdContext.config.getStrategy().code))
83010
+ service: _this.context.service.join("".concat(data.video, "-").concat(_this.videoAdContext.config.getStrategy().code)),
83011
+ config: _this.videoAdContext.config
82716
83012
  });
82717
83013
  _this.videoAdContext.store.dispatch({
82718
83014
  type: "UPDATE_VIDEO_INFO",
@@ -82723,15 +83019,12 @@ var VideoAd = /*#__PURE__*/ function() {
82723
83019
  }
82724
83020
  });
82725
83021
  _this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, _this.videoAdContext.config.getStrategySettings());
82726
- _this.presentation = _this.presentationFactory.get({
82727
- strategy: _this.videoAdContext.config.getStrategy().code
82728
- });
82729
83022
  _this.videoAdContext.data = _this.videoRegions;
82730
83023
  _this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
82731
83024
  id: data.video,
82732
83025
  ts: 0
82733
83026
  });
82734
- (_this_presentation = _this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.setup();
83027
+ (_this_presentation = _this.presentation) === null || _this_presentation === void 0 ? void 0 : _this_presentation.start();
82735
83028
  });
82736
83029
  }
82737
83030
  },
@@ -83247,8 +83540,157 @@ var Location = /*#__PURE__*/ function() {
83247
83540
  ]);
83248
83541
  return Location;
83249
83542
  }();
83250
- // src/Service/Realtime.ts
83543
+ // src/Service/LocalRealtime.ts
83251
83544
  var import_events10 = __toESM(require_events());
83545
+ var DATA_STORE = {
83546
+ "video1": {}
83547
+ };
83548
+ var VIDEO_LIBRARY = {
83549
+ "video1": {
83550
+ source: ""
83551
+ }
83552
+ };
83553
+ var BRNDTSLocalRealtime = /*#__PURE__*/ function(_import_events10_default) {
83554
+ "use strict";
83555
+ _inherits(BRNDTSLocalRealtime, _import_events10_default);
83556
+ function BRNDTSLocalRealtime(options, deps) {
83557
+ _class_call_check(this, BRNDTSLocalRealtime);
83558
+ var _this;
83559
+ _this = _call_super(this, BRNDTSLocalRealtime);
83560
+ _this.connected = new Changeable(false);
83561
+ _this.handlers = {
83562
+ info: [],
83563
+ result: [],
83564
+ completed: [],
83565
+ aborted: []
83566
+ };
83567
+ _this.options = options;
83568
+ _this.logger = deps.logger;
83569
+ if (!_this.options.ns) {
83570
+ window.__brndts_local_realtime = _this;
83571
+ }
83572
+ return _this;
83573
+ }
83574
+ _create_class(BRNDTSLocalRealtime, [
83575
+ {
83576
+ key: "handleOpen",
83577
+ value: function handleOpen() {
83578
+ this.connected.value = true;
83579
+ this.emit("connected");
83580
+ }
83581
+ },
83582
+ {
83583
+ key: "handleClose",
83584
+ value: function handleClose() {
83585
+ this.connected.value = false;
83586
+ this.emit("disconnected");
83587
+ }
83588
+ },
83589
+ {
83590
+ key: "connect",
83591
+ value: function connect() {
83592
+ this.handleOpen();
83593
+ }
83594
+ },
83595
+ {
83596
+ key: "respond",
83597
+ value: function respond(event, payload) {
83598
+ if (this.handlers[event]) {
83599
+ this.handlers[event].forEach(function(handler) {
83600
+ handler(payload);
83601
+ });
83602
+ }
83603
+ }
83604
+ },
83605
+ {
83606
+ key: "loads",
83607
+ value: function loads(videoId) {
83608
+ var _this = this;
83609
+ var _this_logger;
83610
+ (_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Loading data for :", videoId);
83611
+ var input = document.createElement("input");
83612
+ input.type = "file";
83613
+ input === null || input === void 0 ? void 0 : input.addEventListener("change", function(event) {
83614
+ var _input_files;
83615
+ var file = input === null || input === void 0 ? void 0 : (_input_files = input.files) === null || _input_files === void 0 ? void 0 : _input_files[0];
83616
+ if (!file) {
83617
+ console.log("No file selected.");
83618
+ return;
83619
+ }
83620
+ var reader = new FileReader();
83621
+ reader.onload = function(event2) {
83622
+ var _event2_target;
83623
+ var fileContent = event2 === null || event2 === void 0 ? void 0 : (_event2_target = event2.target) === null || _event2_target === void 0 ? void 0 : _event2_target.result;
83624
+ if (fileContent) {
83625
+ var _this_logger;
83626
+ var parsedData = JSON.parse(fileContent);
83627
+ DATA_STORE[videoId] = parsedData;
83628
+ (_this_logger = _this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Loaded data for :", videoId);
83629
+ _this.respond("result", DATA_STORE[videoId]);
83630
+ }
83631
+ };
83632
+ reader.readAsText(file);
83633
+ });
83634
+ input.click();
83635
+ }
83636
+ },
83637
+ {
83638
+ key: "send",
83639
+ value: function send(event) {
83640
+ for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
83641
+ payload[_key - 1] = arguments[_key];
83642
+ }
83643
+ var _this_logger;
83644
+ (_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.log("[REALTIME LOCAL] Received event :", event, payload);
83645
+ if (event === "hs") {
83646
+ var _this_logger1;
83647
+ (_this_logger1 = this.logger) === null || _this_logger1 === void 0 ? void 0 : _this_logger1.log("[REALTIME LOCAL] handling event :", event, payload);
83648
+ var _payload = _sliced_to_array(payload, 2), data = _payload[0], cb = _payload[1];
83649
+ var videoId = "video1";
83650
+ VIDEO_LIBRARY[videoId] = {
83651
+ // @ts-expect-error
83652
+ source: data.source
83653
+ };
83654
+ cb === null || cb === void 0 ? void 0 : cb({
83655
+ video: videoId
83656
+ });
83657
+ }
83658
+ }
83659
+ },
83660
+ {
83661
+ key: "handle",
83662
+ value: function handle(event, handler) {
83663
+ if (!this.handlers[event]) {
83664
+ this.handlers[event] = [];
83665
+ }
83666
+ this.handlers[event].push(handler);
83667
+ }
83668
+ },
83669
+ {
83670
+ key: "join",
83671
+ value: function join(ns) {
83672
+ var _this = this;
83673
+ setTimeout(function() {
83674
+ var _ref = _sliced_to_array(ns.match(/^([^-]+)-(.+)$/) || [], 2), video = _ref[0], strategy = _ref[1];
83675
+ if (video && DATA_STORE[video]) {
83676
+ var regions2 = DATA_STORE[video];
83677
+ _this.respond("result", regions2);
83678
+ }
83679
+ }, 150);
83680
+ return this;
83681
+ }
83682
+ },
83683
+ {
83684
+ key: "destroy",
83685
+ value: function destroy() {
83686
+ this.handleClose();
83687
+ }
83688
+ }
83689
+ ]);
83690
+ return BRNDTSLocalRealtime;
83691
+ }(import_events10.default);
83692
+ // src/Service/Realtime.ts
83693
+ var import_events11 = __toESM(require_events());
83252
83694
  // node_modules/engine.io-parser/build/esm/commons.js
83253
83695
  var PACKET_TYPES = /* @__PURE__ */ Object.create(null);
83254
83696
  PACKET_TYPES["open"] = "0";
@@ -87113,9 +87555,9 @@ Object.assign(lookup2, {
87113
87555
  connect: lookup2
87114
87556
  });
87115
87557
  // src/Service/Realtime.ts
87116
- var BRNDTSRealtime = /*#__PURE__*/ function(_import_events10_default) {
87558
+ var BRNDTSRealtime = /*#__PURE__*/ function(_import_events11_default) {
87117
87559
  "use strict";
87118
- _inherits(_BRNDTSRealtime, _import_events10_default);
87560
+ _inherits(_BRNDTSRealtime, _import_events11_default);
87119
87561
  function _BRNDTSRealtime(options, deps) {
87120
87562
  _class_call_check(this, _BRNDTSRealtime);
87121
87563
  var _this;
@@ -87213,9 +87655,37 @@ var BRNDTSRealtime = /*#__PURE__*/ function(_import_events10_default) {
87213
87655
  }
87214
87656
  ]);
87215
87657
  return _BRNDTSRealtime;
87216
- }(import_events10.default);
87217
- // src/Service/LocalRealtime.ts
87218
- var import_events11 = __toESM(require_events());
87658
+ }(import_events11.default);
87659
+ // src/Service/ServiceFactory.ts
87660
+ var ServiceFactory = /*#__PURE__*/ function() {
87661
+ "use strict";
87662
+ function ServiceFactory() {
87663
+ _class_call_check(this, ServiceFactory);
87664
+ }
87665
+ _create_class(ServiceFactory, null, [
87666
+ {
87667
+ key: "createService",
87668
+ value: function createService(context) {
87669
+ var serviceType = "remote";
87670
+ if (serviceType === "local") {
87671
+ return new BRNDTSLocalRealtime({
87672
+ host: context.config.get("host"),
87673
+ key: context.config.get("key")
87674
+ }, {
87675
+ logger: context.logger
87676
+ });
87677
+ }
87678
+ return new BRNDTSRealtime({
87679
+ host: context.config.get("host"),
87680
+ key: context.config.get("key")
87681
+ }, {
87682
+ logger: context.logger
87683
+ });
87684
+ }
87685
+ }
87686
+ ]);
87687
+ return ServiceFactory;
87688
+ }();
87219
87689
  // src/index.ts
87220
87690
  var BrndtsAds = /*#__PURE__*/ function() {
87221
87691
  "use strict";
@@ -87268,10 +87738,16 @@ var BrndtsAds = /*#__PURE__*/ function() {
87268
87738
  case 1:
87269
87739
  _state.trys.push([
87270
87740
  1,
87271
- 3,
87741
+ 4,
87272
87742
  ,
87273
- 4
87743
+ 5
87274
87744
  ]);
87745
+ if (!this.context.config.get("enabled")) {
87746
+ this.context.logger.error("Setup failed: disabled by config");
87747
+ return [
87748
+ 2
87749
+ ];
87750
+ }
87275
87751
  this.context.location = new Location();
87276
87752
  this.context.consent = ConsentFactory.get(this.context.logger);
87277
87753
  return [
@@ -87282,35 +87758,30 @@ var BrndtsAds = /*#__PURE__*/ function() {
87282
87758
  _state.sent();
87283
87759
  this.context.user = new User(this.context.config, this.context.consent);
87284
87760
  this.context.device = new Device();
87285
- this.context.device.collect();
87286
- if (!this.context.config.get("enabled")) {
87287
- this.context.logger.error("Setup failed: disabled by config");
87288
- return [
87289
- 2
87290
- ];
87291
- }
87292
- this.context.service = new BRNDTSRealtime({
87293
- host: this.context.config.get("host"),
87294
- key: this.context.config.get("key")
87295
- }, {
87296
- logger: this.context.logger
87297
- });
87761
+ return [
87762
+ 4,
87763
+ this.context.device.collect()
87764
+ ];
87765
+ case 3:
87766
+ _state.sent();
87767
+ console.log("BRNDTS Ads Presenter started with config");
87768
+ this.context.service = ServiceFactory.createService(this.context);
87298
87769
  this.context.service.on("connected", this.handleConnected);
87299
87770
  this.context.service.connect();
87300
87771
  return [
87301
87772
  3,
87302
- 4
87773
+ 5
87303
87774
  ];
87304
- case 3:
87775
+ case 4:
87305
87776
  error = _state.sent();
87306
87777
  if (_instanceof(error, Error)) {
87307
- this.context.logger.warn("Setup failed: no media element found!");
87778
+ console.log("Error during setup: ", error);
87308
87779
  }
87309
87780
  return [
87310
87781
  3,
87311
- 4
87782
+ 5
87312
87783
  ];
87313
- case 4:
87784
+ case 5:
87314
87785
  return [
87315
87786
  2
87316
87787
  ];