@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.js
CHANGED
@@ -67610,6 +67610,7 @@ var Config = /*#__PURE__*/ function() {
|
|
67610
67610
|
function Config(providedConfigs) {
|
67611
67611
|
_class_call_check(this, Config);
|
67612
67612
|
var _providedConfigs_auth;
|
67613
|
+
this.strategies = [];
|
67613
67614
|
if (!((_providedConfigs_auth = providedConfigs.auth) === null || _providedConfigs_auth === void 0 ? void 0 : _providedConfigs_auth.host)) {
|
67614
67615
|
throw new InternalError("No authority configuration provided!");
|
67615
67616
|
}
|
@@ -67649,12 +67650,59 @@ var Config = /*#__PURE__*/ function() {
|
|
67649
67650
|
{
|
67650
67651
|
key: "fetch",
|
67651
67652
|
value: function fetch1() {
|
67652
|
-
|
67653
|
-
|
67654
|
-
return
|
67655
|
-
|
67656
|
-
|
67657
|
-
|
67653
|
+
return _async_to_generator(function() {
|
67654
|
+
var _this;
|
67655
|
+
return _ts_generator(this, function(_state) {
|
67656
|
+
switch(_state.label){
|
67657
|
+
case 0:
|
67658
|
+
_this = this;
|
67659
|
+
return [
|
67660
|
+
4,
|
67661
|
+
fetch("".concat(this.configs.auth.host, "/authority/tenant/bap/").concat(this.configs.key, "/configs")).then(function(response) {
|
67662
|
+
return response.json();
|
67663
|
+
}).then(function(data) {
|
67664
|
+
_this.remote = data;
|
67665
|
+
_this.merge();
|
67666
|
+
}).then(function() {
|
67667
|
+
return fetch("".concat(_this.configs.auth.host, "/authority/ad-strategies"), {
|
67668
|
+
headers: {
|
67669
|
+
"Content-Type": "application/json",
|
67670
|
+
"x-tenant": window.location.hostname
|
67671
|
+
}
|
67672
|
+
});
|
67673
|
+
}).then(function(response) {
|
67674
|
+
return response.json();
|
67675
|
+
}).then(function(data) {
|
67676
|
+
_this.strategies = data;
|
67677
|
+
})
|
67678
|
+
];
|
67679
|
+
case 1:
|
67680
|
+
_state.sent();
|
67681
|
+
return [
|
67682
|
+
2
|
67683
|
+
];
|
67684
|
+
}
|
67685
|
+
});
|
67686
|
+
}).call(this);
|
67687
|
+
}
|
67688
|
+
},
|
67689
|
+
{
|
67690
|
+
key: "getStrategyConfigs",
|
67691
|
+
value: function getStrategyConfigs(strategy) {
|
67692
|
+
var strategyConfig = this.strategies.find(function(s2) {
|
67693
|
+
return s2.code === strategy;
|
67694
|
+
});
|
67695
|
+
if (!strategyConfig) {
|
67696
|
+
return this.configs;
|
67697
|
+
}
|
67698
|
+
return _object_spread_props(_object_spread({}, this.configs), {
|
67699
|
+
ads: _object_spread_props(_object_spread({}, this.configs.ads), {
|
67700
|
+
presentation: _object_spread_props(_object_spread({}, this.configs.ads.presentation), {
|
67701
|
+
duration: strategyConfig.settings.visibility_duration,
|
67702
|
+
minDuration: strategyConfig.settings.minimum_display_time,
|
67703
|
+
cooldown: strategyConfig.settings.cooldown_time
|
67704
|
+
})
|
67705
|
+
})
|
67658
67706
|
});
|
67659
67707
|
}
|
67660
67708
|
},
|
@@ -79862,7 +79910,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
79862
79910
|
ErrorHandler.handle(new InternalError("Setup failed: no video identifier"));
|
79863
79911
|
return;
|
79864
79912
|
}
|
79865
|
-
var adsPresentation = this.videoAdContext.config.get("ads").presentation;
|
79913
|
+
var adsPresentation = this.videoAdContext.config.getStrategyConfigs(this.videoAdContext.config.get("ads").regions.strategy).ads.presentation;
|
79866
79914
|
var videoRegions = new VideoRegionsDataManager({
|
79867
79915
|
useLocalCache: this.videoAdContext.config.get("ads").useLocalCache,
|
79868
79916
|
useRemoteCache: this.videoAdContext.config.get("ads").regions.useCache,
|
@@ -79980,7 +80028,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
79980
80028
|
source: _this.videoAdContext.media.source
|
79981
80029
|
}
|
79982
80030
|
});
|
79983
|
-
var adsPresentation = _this.videoAdContext.config.get("ads").presentation;
|
80031
|
+
var adsPresentation = _this.videoAdContext.config.getStrategyConfigs(_this.videoAdContext.config.get("ads").regions.strategy).ads.presentation;
|
79984
80032
|
_this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, adsPresentation);
|
79985
80033
|
_this.videoAdContext.data = _this.videoRegions;
|
79986
80034
|
_this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
|