@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.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) {
@@ -68283,48 +68283,329 @@ var GooglePublisherTag = /*#__PURE__*/ function() {
68283
68283
  return _GooglePublisherTag;
68284
68284
  }();
68285
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
+ };
68286
68378
  var regions = [
68287
68379
  {
68288
68380
  id: 1,
68289
68381
  w: 300,
68290
68382
  h: 250,
68383
+ name: "Top Right - 300x250",
68291
68384
  type: "medium-rectangle"
68292
68385
  },
68293
68386
  {
68294
68387
  id: 2,
68295
68388
  w: 300,
68296
68389
  h: 250,
68390
+ name: "Bottom Right - 300x250",
68297
68391
  type: "medium-rectangle"
68298
68392
  },
68299
68393
  {
68300
68394
  id: 3,
68301
68395
  w: 320,
68302
68396
  h: 50,
68397
+ name: "Top Center - 320x50",
68303
68398
  type: "smartphone-banner"
68304
68399
  },
68305
68400
  {
68306
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,
68307
68528
  w: 728,
68308
68529
  h: 90,
68530
+ name: "Top Center - 728x90",
68309
68531
  type: "leaderboard"
68310
68532
  },
68311
68533
  {
68312
- id: 5,
68534
+ id: 23,
68535
+ w: 468,
68536
+ h: 60,
68537
+ name: "Top Center - 468x60",
68538
+ type: "leaderboard"
68539
+ },
68540
+ {
68541
+ id: 24,
68313
68542
  w: 300,
68314
- h: 600,
68315
- type: "large-rectangle"
68543
+ h: 50,
68544
+ name: "Top Center - 300x50",
68545
+ type: "leaderboard"
68316
68546
  },
68317
68547
  {
68318
- id: 6,
68319
- w: 250,
68320
- h: 300,
68321
- type: ""
68548
+ id: 25,
68549
+ w: 234,
68550
+ h: 60,
68551
+ name: "Top Center - 234x60",
68552
+ type: "leaderboard"
68322
68553
  },
68323
68554
  {
68324
- 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,
68325
68591
  w: 970,
68326
68592
  h: 250,
68593
+ name: "Generic - 970x250",
68327
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: ""
68328
68609
  }
68329
68610
  ];
68330
68611
  var ContentProvider = /*#__PURE__*/ function() {
@@ -68378,98 +68659,7 @@ var ContentProvider = /*#__PURE__*/ function() {
68378
68659
  {
68379
68660
  key: "adSizes",
68380
68661
  get: function get() {
68381
- return {
68382
- "medium-rectangle": [
68383
- [
68384
- 300,
68385
- 250
68386
- ],
68387
- [
68388
- 250,
68389
- 250
68390
- ],
68391
- [
68392
- 200,
68393
- 200
68394
- ],
68395
- [
68396
- 180,
68397
- 150
68398
- ],
68399
- [
68400
- 150,
68401
- 150
68402
- ]
68403
- ],
68404
- "large-rectangle": [
68405
- [
68406
- 300,
68407
- 600
68408
- ],
68409
- [
68410
- 160,
68411
- 600
68412
- ],
68413
- [
68414
- 120,
68415
- 600
68416
- ]
68417
- ],
68418
- "billboard": [
68419
- [
68420
- 970,
68421
- 250
68422
- ],
68423
- [
68424
- 970,
68425
- 90
68426
- ],
68427
- [
68428
- 728,
68429
- 90
68430
- ],
68431
- [
68432
- 468,
68433
- 60
68434
- ]
68435
- ],
68436
- "leaderboard": [
68437
- [
68438
- 728,
68439
- 90
68440
- ],
68441
- [
68442
- 468,
68443
- 60
68444
- ],
68445
- [
68446
- 320,
68447
- 50
68448
- ],
68449
- [
68450
- 300,
68451
- 50
68452
- ],
68453
- [
68454
- 234,
68455
- 60
68456
- ]
68457
- ],
68458
- "smartphone-banner": [
68459
- [
68460
- 320,
68461
- 50
68462
- ],
68463
- [
68464
- 300,
68465
- 50
68466
- ],
68467
- [
68468
- 320,
68469
- 100
68470
- ]
68471
- ]
68472
- };
68662
+ return typeAndDimensions;
68473
68663
  }
68474
68664
  },
68475
68665
  {
@@ -69593,25 +69783,15 @@ var StaticImageProvider = /*#__PURE__*/ function(ContentProvider) {
69593
69783
  return StaticImageProvider;
69594
69784
  }(ContentProvider);
69595
69785
  // src/Ads/Providers/AfiliateProvider/AffiliateProvider.ts
69596
- var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69597
- _inherits(AffiliateProvider, ContentProvider1);
69598
- function AffiliateProvider(context, options) {
69599
- _class_call_check(this, AffiliateProvider);
69600
- var _this;
69601
- _this = _call_super(this, AffiliateProvider, [
69602
- context,
69603
- options
69604
- ]);
69605
- _this.manifest = [];
69606
- _this.useByRegion = {};
69607
- _this.ready = new Awaitable(false);
69608
- _this.content = {
69609
- content: [],
69610
- type: "affiliate"
69611
- };
69612
- 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;
69613
69793
  }
69614
- _create_class(AffiliateProvider, [
69794
+ _create_class(AffiliateLibrary, [
69615
69795
  {
69616
69796
  key: "loadManifest",
69617
69797
  value: function loadManifest() {
@@ -69620,30 +69800,85 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69620
69800
  return _ts_generator(this, function(_state) {
69621
69801
  switch(_state.label){
69622
69802
  case 0:
69803
+ if (!this.ready.value && this.loading) {
69804
+ return [
69805
+ 2,
69806
+ this.ready.promise
69807
+ ];
69808
+ }
69809
+ this.loading = true;
69623
69810
  return [
69624
69811
  4,
69625
- fetch(this.options.manifest)
69812
+ fetch(this.manifestUrl)
69626
69813
  ];
69627
69814
  case 1:
69628
69815
  response = _state.sent();
69629
69816
  if (!response.ok) {
69817
+ this.ready.reject("Failed to fetch manifest: ".concat(response.statusText));
69630
69818
  throw new Error("Failed to fetch manifest: ".concat(response.statusText));
69631
69819
  }
69820
+ this.ready.resolve(true);
69821
+ this.loading = false;
69632
69822
  _ = this;
69633
69823
  return [
69634
69824
  4,
69635
69825
  response.json()
69636
69826
  ];
69637
69827
  case 2:
69638
- _.manifest = _state.sent();
69639
- this.ready.resolve(true);
69828
+ _.affiliates = _state.sent();
69640
69829
  return [
69641
- 2
69830
+ 2,
69831
+ this.ready.promise
69642
69832
  ];
69643
69833
  }
69644
69834
  });
69645
69835
  }).call(this);
69646
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
+ }
69647
69882
  },
69648
69883
  {
69649
69884
  key: "getAffiliate",
@@ -69657,7 +69892,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69657
69892
  var _this1, _loop = function() {
69658
69893
  var _step_value = _sliced_to_array(_step.value, 2), width = _step_value[0], height = _step_value[1];
69659
69894
  var identifier = "".concat(width, "x").concat(height);
69660
- var aff2 = _this1.manifest.filter(function(a) {
69895
+ var aff2 = library.affiliates.filter(function(a) {
69661
69896
  return a.size.w === width && a.size.h === height;
69662
69897
  });
69663
69898
  if (!aff2.length) {
@@ -69702,7 +69937,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69702
69937
  }
69703
69938
  if ((size === null || size === void 0 ? void 0 : size.width) && (size === null || size === void 0 ? void 0 : size.height)) {
69704
69939
  var identifier = "".concat(size.width, "x").concat(size.height);
69705
- var aff2 = this.manifest.filter(function(a) {
69940
+ var aff2 = library.affiliates.filter(function(a) {
69706
69941
  return a.size.w === (size === null || size === void 0 ? void 0 : size.width) && a.size.h === size.height;
69707
69942
  });
69708
69943
  if (!aff2.length) {
@@ -69726,7 +69961,7 @@ var AffiliateProvider = /*#__PURE__*/ function(ContentProvider1) {
69726
69961
  if (!this.useByRegion[regionId]) {
69727
69962
  this.useByRegion[regionId] = /* @__PURE__ */ new Set();
69728
69963
  }
69729
- var aff = this.manifest.filter(function(a) {
69964
+ var aff = library.affiliates.filter(function(a) {
69730
69965
  return a.region.includes("".concat(regionId));
69731
69966
  });
69732
69967
  if (!aff.length) {
@@ -77527,9 +77762,9 @@ function findIconDefinition(iconLookup) {
77527
77762
  var prefix = iconLookup.prefix || getDefaultUsablePrefix();
77528
77763
  if (!iconName) return;
77529
77764
  iconName = byAlias(prefix, iconName) || iconName;
77530
- return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77765
+ return iconFromMapping(library2.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
77531
77766
  }
77532
- var library = new Library();
77767
+ var library2 = new Library();
77533
77768
  var noAuto = function() {
77534
77769
  config.autoReplaceSvg = false;
77535
77770
  config.observeMutations = false;
@@ -77603,7 +77838,7 @@ var api = {
77603
77838
  config: config,
77604
77839
  dom: dom,
77605
77840
  parse: parse,
77606
- library: library,
77841
+ library: library2,
77607
77842
  findIconDefinition: findIconDefinition,
77608
77843
  toHtml: toHtml
77609
77844
  };