@brndts/brndts-ads 1.13.17 → 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) {
@@ -68313,48 +68313,329 @@ var GooglePublisherTag = /*#__PURE__*/ function() {
68313
68313
  return _GooglePublisherTag;
68314
68314
  }();
68315
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
+ };
68316
68408
  var regions = [
68317
68409
  {
68318
68410
  id: 1,
68319
68411
  w: 300,
68320
68412
  h: 250,
68413
+ name: "Top Right - 300x250",
68321
68414
  type: "medium-rectangle"
68322
68415
  },
68323
68416
  {
68324
68417
  id: 2,
68325
68418
  w: 300,
68326
68419
  h: 250,
68420
+ name: "Bottom Right - 300x250",
68327
68421
  type: "medium-rectangle"
68328
68422
  },
68329
68423
  {
68330
68424
  id: 3,
68331
68425
  w: 320,
68332
68426
  h: 50,
68427
+ name: "Top Center - 320x50",
68333
68428
  type: "smartphone-banner"
68334
68429
  },
68335
68430
  {
68336
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,
68337
68558
  w: 728,
68338
68559
  h: 90,
68560
+ name: "Top Center - 728x90",
68339
68561
  type: "leaderboard"
68340
68562
  },
68341
68563
  {
68342
- id: 5,
68564
+ id: 23,
68565
+ w: 468,
68566
+ h: 60,
68567
+ name: "Top Center - 468x60",
68568
+ type: "leaderboard"
68569
+ },
68570
+ {
68571
+ id: 24,
68343
68572
  w: 300,
68344
- h: 600,
68345
- type: "large-rectangle"
68573
+ h: 50,
68574
+ name: "Top Center - 300x50",
68575
+ type: "leaderboard"
68346
68576
  },
68347
68577
  {
68348
- id: 6,
68349
- w: 250,
68350
- h: 300,
68351
- type: ""
68578
+ id: 25,
68579
+ w: 234,
68580
+ h: 60,
68581
+ name: "Top Center - 234x60",
68582
+ type: "leaderboard"
68352
68583
  },
68353
68584
  {
68354
- 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,
68355
68621
  w: 970,
68356
68622
  h: 250,
68623
+ name: "Generic - 970x250",
68357
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: ""
68358
68639
  }
68359
68640
  ];
68360
68641
  var ContentProvider = /*#__PURE__*/ function() {
@@ -68409,98 +68690,7 @@ var ContentProvider = /*#__PURE__*/ function() {
68409
68690
  {
68410
68691
  key: "adSizes",
68411
68692
  get: function get() {
68412
- return {
68413
- "medium-rectangle": [
68414
- [
68415
- 300,
68416
- 250
68417
- ],
68418
- [
68419
- 250,
68420
- 250
68421
- ],
68422
- [
68423
- 200,
68424
- 200
68425
- ],
68426
- [
68427
- 180,
68428
- 150
68429
- ],
68430
- [
68431
- 150,
68432
- 150
68433
- ]
68434
- ],
68435
- "large-rectangle": [
68436
- [
68437
- 300,
68438
- 600
68439
- ],
68440
- [
68441
- 160,
68442
- 600
68443
- ],
68444
- [
68445
- 120,
68446
- 600
68447
- ]
68448
- ],
68449
- "billboard": [
68450
- [
68451
- 970,
68452
- 250
68453
- ],
68454
- [
68455
- 970,
68456
- 90
68457
- ],
68458
- [
68459
- 728,
68460
- 90
68461
- ],
68462
- [
68463
- 468,
68464
- 60
68465
- ]
68466
- ],
68467
- "leaderboard": [
68468
- [
68469
- 728,
68470
- 90
68471
- ],
68472
- [
68473
- 468,
68474
- 60
68475
- ],
68476
- [
68477
- 320,
68478
- 50
68479
- ],
68480
- [
68481
- 300,
68482
- 50
68483
- ],
68484
- [
68485
- 234,
68486
- 60
68487
- ]
68488
- ],
68489
- "smartphone-banner": [
68490
- [
68491
- 320,
68492
- 50
68493
- ],
68494
- [
68495
- 300,
68496
- 50
68497
- ],
68498
- [
68499
- 320,
68500
- 100
68501
- ]
68502
- ]
68503
- };
68693
+ return typeAndDimensions;
68504
68694
  }
68505
68695
  },
68506
68696
  {
@@ -69638,26 +69828,16 @@ var StaticImageProvider = /*#__PURE__*/ function(ContentProvider) {
69638
69828
  return StaticImageProvider;
69639
69829
  }(ContentProvider);
69640
69830
  // src/Ads/Providers/AfiliateProvider/AffiliateProvider.ts
69641
- var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69831
+ var AffiliateLibrary = /*#__PURE__*/ function() {
69642
69832
  "use strict";
69643
- _inherits(AffiliateProvider, ContentProvider1);
69644
- function AffiliateProvider(context, options) {
69645
- _class_call_check(this, AffiliateProvider);
69646
- var _this;
69647
- _this = _call_super(this, AffiliateProvider, [
69648
- context,
69649
- options
69650
- ]);
69651
- _this.manifest = [];
69652
- _this.useByRegion = {};
69653
- _this.ready = new Awaitable(false);
69654
- _this.content = {
69655
- content: [],
69656
- type: "affiliate"
69657
- };
69658
- 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;
69659
69839
  }
69660
- _create_class(AffiliateProvider, [
69840
+ _create_class(AffiliateLibrary, [
69661
69841
  {
69662
69842
  key: "loadManifest",
69663
69843
  value: function loadManifest() {
@@ -69666,30 +69846,86 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69666
69846
  return _ts_generator(this, function(_state) {
69667
69847
  switch(_state.label){
69668
69848
  case 0:
69849
+ if (!this.ready.value && this.loading) {
69850
+ return [
69851
+ 2,
69852
+ this.ready.promise
69853
+ ];
69854
+ }
69855
+ this.loading = true;
69669
69856
  return [
69670
69857
  4,
69671
- fetch(this.options.manifest)
69858
+ fetch(this.manifestUrl)
69672
69859
  ];
69673
69860
  case 1:
69674
69861
  response = _state.sent();
69675
69862
  if (!response.ok) {
69863
+ this.ready.reject("Failed to fetch manifest: ".concat(response.statusText));
69676
69864
  throw new Error("Failed to fetch manifest: ".concat(response.statusText));
69677
69865
  }
69866
+ this.ready.resolve(true);
69867
+ this.loading = false;
69678
69868
  _ = this;
69679
69869
  return [
69680
69870
  4,
69681
69871
  response.json()
69682
69872
  ];
69683
69873
  case 2:
69684
- _.manifest = _state.sent();
69685
- this.ready.resolve(true);
69874
+ _.affiliates = _state.sent();
69686
69875
  return [
69687
- 2
69876
+ 2,
69877
+ this.ready.promise
69688
69878
  ];
69689
69879
  }
69690
69880
  });
69691
69881
  }).call(this);
69692
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
+ }
69693
69929
  },
69694
69930
  {
69695
69931
  key: "getAffiliate",
@@ -69703,7 +69939,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69703
69939
  var _this1, _loop = function() {
69704
69940
  var _step_value = _sliced_to_array(_step.value, 2), width = _step_value[0], height = _step_value[1];
69705
69941
  var identifier = "".concat(width, "x").concat(height);
69706
- var aff2 = _this1.manifest.filter(function(a) {
69942
+ var aff2 = library.affiliates.filter(function(a) {
69707
69943
  return a.size.w === width && a.size.h === height;
69708
69944
  });
69709
69945
  if (!aff2.length) {
@@ -69748,7 +69984,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69748
69984
  }
69749
69985
  if ((size === null || size === void 0 ? void 0 : size.width) && (size === null || size === void 0 ? void 0 : size.height)) {
69750
69986
  var identifier = "".concat(size.width, "x").concat(size.height);
69751
- var aff2 = this.manifest.filter(function(a) {
69987
+ var aff2 = library.affiliates.filter(function(a) {
69752
69988
  return a.size.w === (size === null || size === void 0 ? void 0 : size.width) && a.size.h === size.height;
69753
69989
  });
69754
69990
  if (!aff2.length) {
@@ -69772,7 +70008,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69772
70008
  if (!this.useByRegion[regionId]) {
69773
70009
  this.useByRegion[regionId] = /* @__PURE__ */ new Set();
69774
70010
  }
69775
- var aff = this.manifest.filter(function(a) {
70011
+ var aff = library.affiliates.filter(function(a) {
69776
70012
  return a.region.includes("".concat(regionId));
69777
70013
  });
69778
70014
  if (!aff.length) {
@@ -77617,9 +77853,9 @@ function findIconDefinition(iconLookup) {
77617
77853
  var prefix = iconLookup.prefix || getDefaultUsablePrefix();
77618
77854
  if (!iconName) return;
77619
77855
  iconName = byAlias(prefix, iconName) || iconName;
77620
- return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77856
+ return iconFromMapping(library2.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77621
77857
  }
77622
- var library = new Library();
77858
+ var library2 = new Library();
77623
77859
  var noAuto = function() {
77624
77860
  config.autoReplaceSvg = false;
77625
77861
  config.observeMutations = false;
@@ -77693,7 +77929,7 @@ var api = {
77693
77929
  config: config,
77694
77930
  dom: dom,
77695
77931
  parse: parse,
77696
- library: library,
77932
+ library: library2,
77697
77933
  findIconDefinition: findIconDefinition,
77698
77934
  toHtml: toHtml
77699
77935
  };