@brndts/brndts-ads 1.13.0 → 1.13.2

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
@@ -67785,7 +67785,38 @@ var AdsConfigsClass = /*#__PURE__*/ function(BRNDTSConfig) {
67785
67785
  key: "defaults",
67786
67786
  get: function get() {
67787
67787
  return {
67788
- general: {},
67788
+ general: {
67789
+ clickability: {
67790
+ value: true,
67791
+ setting: {
67792
+ code: "clickability",
67793
+ name: "clickability",
67794
+ description: "",
67795
+ type: "boolean",
67796
+ constraints: {}
67797
+ }
67798
+ },
67799
+ visibility_on_pause: {
67800
+ value: true,
67801
+ setting: {
67802
+ code: "visibility_on_pause",
67803
+ name: "visibility_on_pause",
67804
+ description: "",
67805
+ type: "boolean",
67806
+ constraints: {}
67807
+ }
67808
+ },
67809
+ debug_mode: {
67810
+ value: false,
67811
+ setting: {
67812
+ code: "debug_mode",
67813
+ name: "debug_mode",
67814
+ description: "",
67815
+ type: "boolean",
67816
+ constraints: {}
67817
+ }
67818
+ }
67819
+ },
67789
67820
  adStrategies: {}
67790
67821
  };
67791
67822
  }
@@ -73026,6 +73057,12 @@ var YoutubeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73026
73057
  return this.media;
73027
73058
  }
73028
73059
  },
73060
+ {
73061
+ key: "fullscreenElement",
73062
+ get: function get() {
73063
+ return this.view || void 0;
73064
+ }
73065
+ },
73029
73066
  {
73030
73067
  key: "viewWidth",
73031
73068
  get: function get() {
@@ -73472,6 +73509,12 @@ var NativeMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73472
73509
  return this.media;
73473
73510
  }
73474
73511
  },
73512
+ {
73513
+ key: "fullscreenElement",
73514
+ get: function get() {
73515
+ return this.view || void 0;
73516
+ }
73517
+ },
73475
73518
  {
73476
73519
  key: "viewWidth",
73477
73520
  get: function get() {
@@ -73842,6 +73885,13 @@ var BradmaxMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
73842
73885
  return this.actualMediaElement;
73843
73886
  }
73844
73887
  },
73888
+ {
73889
+ key: "fullscreenElement",
73890
+ get: function get() {
73891
+ var _this_view;
73892
+ return ((_this_view = this.view) === null || _this_view === void 0 ? void 0 : _this_view.closest(".bsplayer")) || void 0;
73893
+ }
73894
+ },
73845
73895
  {
73846
73896
  key: "viewWidth",
73847
73897
  get: function get() {
@@ -74304,6 +74354,12 @@ var DailymotionMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
74304
74354
  return this.rootNode;
74305
74355
  }
74306
74356
  },
74357
+ {
74358
+ key: "fullscreenElement",
74359
+ get: function get() {
74360
+ return this.view || void 0;
74361
+ }
74362
+ },
74307
74363
  {
74308
74364
  key: "viewWidth",
74309
74365
  get: function get() {
@@ -74603,6 +74659,12 @@ var VideoJSMediaElement = /*#__PURE__*/ function(GenericMediaElement) {
74603
74659
  return this.media;
74604
74660
  }
74605
74661
  },
74662
+ {
74663
+ key: "fullscreenElement",
74664
+ get: function get() {
74665
+ return this.view || void 0;
74666
+ }
74667
+ },
74606
74668
  {
74607
74669
  key: "viewWidth",
74608
74670
  get: function get() {
@@ -79779,7 +79841,7 @@ var Fullscreen = /*#__PURE__*/ function() {
79779
79841
  this.context = context;
79780
79842
  this.container = this.context.elements.container;
79781
79843
  document.addEventListener("fullscreenchange", function() {
79782
- if (document.fullscreenElement === _this.context.media.view || document.fullscreenElement === _this.context.elements.container) {
79844
+ if (document.fullscreenElement === _this.context.media.fullscreenElement || document.fullscreenElement === _this.context.elements.container) {
79783
79845
  _this.context.elements.fullscreen = document.fullscreenElement;
79784
79846
  _this.container.dataset.fullscreen = "true";
79785
79847
  _this.container.style.paddingBottom = "0";
@@ -80214,6 +80276,89 @@ var TYPES = {
80214
80276
  ]
80215
80277
  ]
80216
80278
  };
80279
+ var DefaultTemplate = /*#__PURE__*/ function() {
80280
+ "use strict";
80281
+ function DefaultTemplate() {
80282
+ _class_call_check(this, DefaultTemplate);
80283
+ }
80284
+ _create_class(DefaultTemplate, [
80285
+ {
80286
+ key: "get",
80287
+ value: function get(plane, cutout) {
80288
+ var areas = [];
80289
+ if (plane.width - (cutout.x + cutout.width) > 0) {
80290
+ areas.push({
80291
+ dimensions: new Dimensions({
80292
+ x: cutout.x + cutout.width,
80293
+ y: 0
80294
+ }, {
80295
+ width: plane.width - (cutout.x + cutout.width),
80296
+ height: cutout.y + cutout.height
80297
+ }),
80298
+ name: "A"
80299
+ });
80300
+ }
80301
+ if (plane.height - (cutout.y + cutout.height) > 0) {
80302
+ areas.push({
80303
+ dimensions: new Dimensions({
80304
+ x: 0,
80305
+ y: cutout.y + cutout.height
80306
+ }, {
80307
+ width: plane.width,
80308
+ height: plane.height - (cutout.y + cutout.height)
80309
+ }),
80310
+ name: "B"
80311
+ });
80312
+ }
80313
+ return areas;
80314
+ }
80315
+ }
80316
+ ]);
80317
+ return DefaultTemplate;
80318
+ }();
80319
+ var FullscreenTemplate = /*#__PURE__*/ function() {
80320
+ "use strict";
80321
+ function FullscreenTemplate() {
80322
+ _class_call_check(this, FullscreenTemplate);
80323
+ }
80324
+ _create_class(FullscreenTemplate, [
80325
+ {
80326
+ key: "get",
80327
+ value: function get(plane, cutout) {
80328
+ var areas = [];
80329
+ if (plane.width - (cutout.x + cutout.width) > 0) {
80330
+ areas.push({
80331
+ dimensions: new Dimensions({
80332
+ x: cutout.x + cutout.width,
80333
+ y: 0
80334
+ }, {
80335
+ width: plane.width - (cutout.x + cutout.width),
80336
+ height: plane.height
80337
+ }),
80338
+ name: "A"
80339
+ });
80340
+ }
80341
+ if (plane.height - (cutout.y + cutout.height) > 0) {
80342
+ areas.push({
80343
+ dimensions: new Dimensions({
80344
+ x: 0,
80345
+ y: cutout.y + cutout.height
80346
+ }, {
80347
+ width: cutout.x + cutout.width,
80348
+ height: plane.height - (cutout.y + cutout.height)
80349
+ }),
80350
+ available: {
80351
+ w: 0.7
80352
+ },
80353
+ name: "B"
80354
+ });
80355
+ }
80356
+ return areas;
80357
+ }
80358
+ }
80359
+ ]);
80360
+ return FullscreenTemplate;
80361
+ }();
80217
80362
  var RegionPacker = /*#__PURE__*/ function(_import_events8_default) {
80218
80363
  "use strict";
80219
80364
  _inherits(RegionPacker, _import_events8_default);
@@ -80227,6 +80372,7 @@ var RegionPacker = /*#__PURE__*/ function(_import_events8_default) {
80227
80372
  _this.mapped = [];
80228
80373
  _this.areas = [];
80229
80374
  _this.packed = [];
80375
+ _this.templates = {};
80230
80376
  _this.context = context;
80231
80377
  _this.plane = {
80232
80378
  width: ((_this_context_elements_container = _this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.getBoundingClientRect().width) || 0,
@@ -80235,12 +80381,17 @@ var RegionPacker = /*#__PURE__*/ function(_import_events8_default) {
80235
80381
  _this.mapped = transformData(TYPES).sort(function(a, b) {
80236
80382
  return b.area - a.area;
80237
80383
  });
80384
+ _this.templates = {
80385
+ "default": new DefaultTemplate(),
80386
+ "fullscreen": new FullscreenTemplate()
80387
+ };
80238
80388
  return _this;
80239
80389
  }
80240
80390
  _create_class(RegionPacker, [
80241
80391
  {
80242
80392
  key: "setCutout",
80243
80393
  value: function setCutout(cutout) {
80394
+ var template = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
80244
80395
  var _this_context_elements_container, _this_context_elements_container1;
80245
80396
  this.cutout = cutout;
80246
80397
  this.areas = [];
@@ -80248,30 +80399,7 @@ var RegionPacker = /*#__PURE__*/ function(_import_events8_default) {
80248
80399
  width: ((_this_context_elements_container = this.context.elements.container) === null || _this_context_elements_container === void 0 ? void 0 : _this_context_elements_container.getBoundingClientRect().width) || 0,
80249
80400
  height: ((_this_context_elements_container1 = this.context.elements.container) === null || _this_context_elements_container1 === void 0 ? void 0 : _this_context_elements_container1.getBoundingClientRect().height) || 0
80250
80401
  };
80251
- if (this.plane.width - (this.cutout.x + this.cutout.width) > 0) {
80252
- this.areas.push({
80253
- dimensions: new Dimensions({
80254
- x: this.cutout.x + this.cutout.width,
80255
- y: 0
80256
- }, {
80257
- width: this.plane.width - (this.cutout.x + this.cutout.width),
80258
- height: this.plane.height
80259
- }),
80260
- name: "A"
80261
- });
80262
- }
80263
- if (this.plane.height - (this.cutout.y + this.cutout.height) > 0) {
80264
- this.areas.push({
80265
- dimensions: new Dimensions({
80266
- x: 0,
80267
- y: this.cutout.y + this.cutout.height
80268
- }, {
80269
- width: this.cutout.x + this.cutout.width,
80270
- height: this.plane.height - (this.cutout.y + this.cutout.height)
80271
- }),
80272
- name: "B"
80273
- });
80274
- }
80402
+ this.areas = this.templates[template].get(this.plane, cutout);
80275
80403
  return this;
80276
80404
  }
80277
80405
  },
@@ -80294,9 +80422,10 @@ var RegionPacker = /*#__PURE__*/ function(_import_events8_default) {
80294
80422
  {
80295
80423
  key: "fillRegion",
80296
80424
  value: function fillRegion(region) {
80425
+ var _region_available, _region_available1, _region_available2, _region_available3;
80297
80426
  var result = [];
80298
- var availableWidth = region.name === "B" ? region.dimensions.size.width * 0.7 : region.dimensions.size.width;
80299
- var availableHeight = region.name === "A" ? region.dimensions.size.height * 0.7 : region.dimensions.size.height;
80427
+ var availableWidth = ((_region_available = region.available) === null || _region_available === void 0 ? void 0 : _region_available.w) ? region.dimensions.size.width * ((_region_available1 = region.available) === null || _region_available1 === void 0 ? void 0 : _region_available1.w) : region.dimensions.size.width;
80428
+ var availableHeight = ((_region_available2 = region.available) === null || _region_available2 === void 0 ? void 0 : _region_available2.h) ? region.dimensions.size.height * ((_region_available3 = region.available) === null || _region_available3 === void 0 ? void 0 : _region_available3.h) : region.dimensions.size.height;
80300
80429
  var regionX = region.dimensions.position.x;
80301
80430
  var regionY = region.dimensions.position.y;
80302
80431
  var usableTypes = this.mapped.filter(function(type) {
@@ -80927,27 +81056,33 @@ var AdRegionsArea = /*#__PURE__*/ function() {
80927
81056
  var diffLeft = getDifferenceLeft(visibleRegions, regions2);
80928
81057
  var diffRight = getDifferenceRight(visibleRegions, regions2);
80929
81058
  var common = getIntersection(visibleRegions, regions2);
81059
+ for(var index = 0; index < diffLeft.length; index++){
81060
+ var existingObject = this.regionsObjects.getById(diffLeft[index].id);
81061
+ if (existingObject) {
81062
+ existingObject.clear();
81063
+ }
81064
+ }
80930
81065
  if (common.length) {
80931
- for(var index = 0; index < common.length; index++){
80932
- if (index < this.maxRegions) {
80933
- var pack = mapped.getById(common[index].id);
81066
+ for(var index1 = 0; index1 < common.length; index1++){
81067
+ if (index1 < this.maxRegions) {
81068
+ var pack = mapped.getById(common[index1].id);
80934
81069
  if (pack) {
80935
- common[index].updateSize(pack.width, pack.height);
81070
+ common[index1].updateSize(pack.width, pack.height);
80936
81071
  }
80937
81072
  } else {
80938
- common[index].clear();
81073
+ common[index1].clear();
80939
81074
  }
80940
81075
  }
80941
81076
  } else {
80942
- for(var index1 = 0; index1 < diffRight.length && index1 < this.maxRegions; index1++){
80943
- var existingObject = this.regionsObjects.getById(diffRight[index1].id);
80944
- if (existingObject) {
80945
- var pack1 = mapped.getById(diffRight[index1].id);
81077
+ for(var index2 = 0; index2 < diffRight.length && index2 < this.maxRegions; index2++){
81078
+ var existingObject1 = this.regionsObjects.getById(diffRight[index2].id);
81079
+ if (existingObject1) {
81080
+ var pack1 = mapped.getById(diffRight[index2].id);
80946
81081
  if (pack1) {
80947
- existingObject.updateSize(pack1.width, pack1.height);
81082
+ existingObject1.updateSize(pack1.width, pack1.height);
80948
81083
  }
80949
81084
  } else {
80950
- var region = diffRight[index1];
81085
+ var region = diffRight[index2];
80951
81086
  var provider = ContentProviderFactory.getProvider(this.context, this.context.config.get("ads").provider);
80952
81087
  var plugins2 = [
80953
81088
  new RegionBorderPlugin(),
@@ -80972,18 +81107,21 @@ var AdRegionsArea = /*#__PURE__*/ function() {
80972
81107
  }
80973
81108
  }
80974
81109
  }
80975
- for(var index2 = 0; index2 < diffLeft.length; index2++){
80976
- var existingObject1 = this.regionsObjects.getById(diffLeft[index2].id);
80977
- if (existingObject1) {
80978
- existingObject1.clear();
80979
- }
80980
- }
80981
81110
  }
80982
81111
  },
80983
81112
  {
80984
81113
  key: "clear",
80985
81114
  value: function clear() {
81115
+ var _this = this;
80986
81116
  this.regionsObjects.forEach(function(region) {
81117
+ _this.updateSize({
81118
+ width: 0,
81119
+ height: 0
81120
+ }, _this.context.media.aspectRatio);
81121
+ _this.updatePosition({
81122
+ x: 0,
81123
+ y: 0
81124
+ });
80987
81125
  region.clear();
80988
81126
  });
80989
81127
  }
@@ -81376,7 +81514,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
81376
81514
  y: (expected === null || expected === void 0 ? void 0 : expected.position.y) || 0,
81377
81515
  width: (expected === null || expected === void 0 ? void 0 : expected.size.width) || 0,
81378
81516
  height: (expected === null || expected === void 0 ? void 0 : expected.size.height) || 0
81379
- });
81517
+ }, _this.context.store.getState().fullscreen ? "fullscreen" : "default");
81380
81518
  _this.packer.pack();
81381
81519
  if (_this.packer.packed.length > 0) {
81382
81520
  var _this_adPresentationStrategy, _this_regionsRenderer, _this_regionsRenderer1, _this_mediaElementSizeController1;
@@ -81403,10 +81541,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
81403
81541
  {
81404
81542
  key: "enteredFullscreen",
81405
81543
  value: function enteredFullscreen() {
81406
- var _this = this;
81407
- setTimeout(function() {
81408
- _this.updatedContainerSize(true);
81409
- }, 0);
81544
+ this.updatedContainerSize(true);
81410
81545
  }
81411
81546
  },
81412
81547
  {
@@ -81431,7 +81566,7 @@ var BasicPresentationMode = /*#__PURE__*/ function() {
81431
81566
  y: ((_this_mediaElementSizeController2 = this.mediaElementSizeController) === null || _this_mediaElementSizeController2 === void 0 ? void 0 : _this_mediaElementSizeController2.position.y) || 0,
81432
81567
  width: ((_this_mediaElementSizeController3 = this.mediaElementSizeController) === null || _this_mediaElementSizeController3 === void 0 ? void 0 : _this_mediaElementSizeController3.size.width) || 0,
81433
81568
  height: ((_this_mediaElementSizeController4 = this.mediaElementSizeController) === null || _this_mediaElementSizeController4 === void 0 ? void 0 : _this_mediaElementSizeController4.size.height) || 0
81434
- });
81569
+ }, fullscreen ? "fullscreen" : "default");
81435
81570
  var updated = this.packer.repack();
81436
81571
  if (updated) {
81437
81572
  var _this_regionsRenderer1, _this_regionsRenderer2;