@brndts/brndts-ads 1.10.0 → 1.10.1
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 +56 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -67634,6 +67634,7 @@ var Config = /*#__PURE__*/ function() {
|
|
67634
67634
|
function Config(providedConfigs) {
|
67635
67635
|
_class_call_check(this, Config);
|
67636
67636
|
var _providedConfigs_auth;
|
67637
|
+
this.strategies = [];
|
67637
67638
|
if (!((_providedConfigs_auth = providedConfigs.auth) === null || _providedConfigs_auth === void 0 ? void 0 : _providedConfigs_auth.host)) {
|
67638
67639
|
throw new InternalError("No authority configuration provided!");
|
67639
67640
|
}
|
@@ -67673,12 +67674,59 @@ var Config = /*#__PURE__*/ function() {
|
|
67673
67674
|
{
|
67674
67675
|
key: "fetch",
|
67675
67676
|
value: function fetch1() {
|
67676
|
-
|
67677
|
-
|
67678
|
-
return
|
67679
|
-
|
67680
|
-
|
67681
|
-
|
67677
|
+
return _async_to_generator(function() {
|
67678
|
+
var _this;
|
67679
|
+
return _ts_generator(this, function(_state) {
|
67680
|
+
switch(_state.label){
|
67681
|
+
case 0:
|
67682
|
+
_this = this;
|
67683
|
+
return [
|
67684
|
+
4,
|
67685
|
+
fetch("".concat(this.configs.auth.host, "/authority/tenant/bap/").concat(this.configs.key, "/configs")).then(function(response) {
|
67686
|
+
return response.json();
|
67687
|
+
}).then(function(data) {
|
67688
|
+
_this.remote = data;
|
67689
|
+
_this.merge();
|
67690
|
+
}).then(function() {
|
67691
|
+
return fetch("".concat(_this.configs.auth.host, "/authority/ad-strategies"), {
|
67692
|
+
headers: {
|
67693
|
+
"Content-Type": "application/json",
|
67694
|
+
"x-tenant": window.location.hostname
|
67695
|
+
}
|
67696
|
+
});
|
67697
|
+
}).then(function(response) {
|
67698
|
+
return response.json();
|
67699
|
+
}).then(function(data) {
|
67700
|
+
_this.strategies = data;
|
67701
|
+
})
|
67702
|
+
];
|
67703
|
+
case 1:
|
67704
|
+
_state.sent();
|
67705
|
+
return [
|
67706
|
+
2
|
67707
|
+
];
|
67708
|
+
}
|
67709
|
+
});
|
67710
|
+
}).call(this);
|
67711
|
+
}
|
67712
|
+
},
|
67713
|
+
{
|
67714
|
+
key: "getStrategyConfigs",
|
67715
|
+
value: function getStrategyConfigs(strategy) {
|
67716
|
+
var strategyConfig = this.strategies.find(function(s2) {
|
67717
|
+
return s2.code === strategy;
|
67718
|
+
});
|
67719
|
+
if (!strategyConfig) {
|
67720
|
+
return this.configs;
|
67721
|
+
}
|
67722
|
+
return _object_spread_props(_object_spread({}, this.configs), {
|
67723
|
+
ads: _object_spread_props(_object_spread({}, this.configs.ads), {
|
67724
|
+
presentation: _object_spread_props(_object_spread({}, this.configs.ads.presentation), {
|
67725
|
+
duration: strategyConfig.settings.visibility_duration,
|
67726
|
+
minDuration: strategyConfig.settings.minimum_display_time,
|
67727
|
+
cooldown: strategyConfig.settings.cooldown_time
|
67728
|
+
})
|
67729
|
+
})
|
67682
67730
|
});
|
67683
67731
|
}
|
67684
67732
|
},
|
@@ -79971,7 +80019,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
79971
80019
|
ErrorHandler.handle(new InternalError("Setup failed: no video identifier"));
|
79972
80020
|
return;
|
79973
80021
|
}
|
79974
|
-
var adsPresentation = this.videoAdContext.config.get("ads").presentation;
|
80022
|
+
var adsPresentation = this.videoAdContext.config.getStrategyConfigs(this.videoAdContext.config.get("ads").regions.strategy).ads.presentation;
|
79975
80023
|
var videoRegions = new VideoRegionsDataManager({
|
79976
80024
|
useLocalCache: this.videoAdContext.config.get("ads").useLocalCache,
|
79977
80025
|
useRemoteCache: this.videoAdContext.config.get("ads").regions.useCache,
|
@@ -80089,7 +80137,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
80089
80137
|
source: _this.videoAdContext.media.source
|
80090
80138
|
}
|
80091
80139
|
});
|
80092
|
-
var adsPresentation = _this.videoAdContext.config.get("ads").presentation;
|
80140
|
+
var adsPresentation = _this.videoAdContext.config.getStrategyConfigs(_this.videoAdContext.config.get("ads").regions.strategy).ads.presentation;
|
80093
80141
|
_this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, adsPresentation);
|
80094
80142
|
_this.videoAdContext.data = _this.videoRegions;
|
80095
80143
|
_this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
|