@brndts/brndts-ads 1.10.0 → 1.10.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.js +82 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -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,85 @@ 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.map(function(strategy) {
|
67677
|
+
var settings = {};
|
67678
|
+
var settingsKeys = Object.keys(strategy.settings);
|
67679
|
+
for(var i = 0; i < settingsKeys.length; i++){
|
67680
|
+
var key = settingsKeys[i];
|
67681
|
+
var setting = strategy.settings[key];
|
67682
|
+
if (typeof setting === "number") {
|
67683
|
+
settings[key] = {
|
67684
|
+
value: setting,
|
67685
|
+
setting: {
|
67686
|
+
code: key,
|
67687
|
+
name: key,
|
67688
|
+
description: "",
|
67689
|
+
type: "number",
|
67690
|
+
constraints: {
|
67691
|
+
min: 0
|
67692
|
+
}
|
67693
|
+
}
|
67694
|
+
};
|
67695
|
+
} else {
|
67696
|
+
settings[key] = setting;
|
67697
|
+
}
|
67698
|
+
}
|
67699
|
+
return _object_spread_props(_object_spread({}, strategy), {
|
67700
|
+
settings: settings
|
67701
|
+
});
|
67702
|
+
});
|
67703
|
+
})
|
67704
|
+
];
|
67705
|
+
case 1:
|
67706
|
+
_state.sent();
|
67707
|
+
return [
|
67708
|
+
2
|
67709
|
+
];
|
67710
|
+
}
|
67711
|
+
});
|
67712
|
+
}).call(this);
|
67713
|
+
}
|
67714
|
+
},
|
67715
|
+
{
|
67716
|
+
key: "getStrategyConfigs",
|
67717
|
+
value: function getStrategyConfigs(strategy) {
|
67718
|
+
var strategyConfig = this.strategies.find(function(s2) {
|
67719
|
+
return s2.code === strategy;
|
67720
|
+
});
|
67721
|
+
if (!strategyConfig) {
|
67722
|
+
return this.configs;
|
67723
|
+
}
|
67724
|
+
return _object_spread_props(_object_spread({}, this.configs), {
|
67725
|
+
ads: _object_spread_props(_object_spread({}, this.configs.ads), {
|
67726
|
+
presentation: _object_spread_props(_object_spread({}, this.configs.ads.presentation), {
|
67727
|
+
duration: strategyConfig.settings.visibility_duration.value,
|
67728
|
+
minDuration: strategyConfig.settings.minimum_display_time.value,
|
67729
|
+
cooldown: strategyConfig.settings.cooldown_time.value
|
67730
|
+
})
|
67731
|
+
})
|
67658
67732
|
});
|
67659
67733
|
}
|
67660
67734
|
},
|
@@ -79862,7 +79936,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
79862
79936
|
ErrorHandler.handle(new InternalError("Setup failed: no video identifier"));
|
79863
79937
|
return;
|
79864
79938
|
}
|
79865
|
-
var adsPresentation = this.videoAdContext.config.get("ads").presentation;
|
79939
|
+
var adsPresentation = this.videoAdContext.config.getStrategyConfigs(this.videoAdContext.config.get("ads").regions.strategy).ads.presentation;
|
79866
79940
|
var videoRegions = new VideoRegionsDataManager({
|
79867
79941
|
useLocalCache: this.videoAdContext.config.get("ads").useLocalCache,
|
79868
79942
|
useRemoteCache: this.videoAdContext.config.get("ads").regions.useCache,
|
@@ -79980,7 +80054,7 @@ var VideoAd = /*#__PURE__*/ function() {
|
|
79980
80054
|
source: _this.videoAdContext.media.source
|
79981
80055
|
}
|
79982
80056
|
});
|
79983
|
-
var adsPresentation = _this.videoAdContext.config.get("ads").presentation;
|
80057
|
+
var adsPresentation = _this.videoAdContext.config.getStrategyConfigs(_this.videoAdContext.config.get("ads").regions.strategy).ads.presentation;
|
79984
80058
|
_this.videoRegions = VideoRegionsDecoratorFactory.decorate(videoRegions, adsPresentation);
|
79985
80059
|
_this.videoAdContext.data = _this.videoRegions;
|
79986
80060
|
_this.videoAdContext.recorder = _this.recorderFactory.create(_this.videoAdContext.media, {
|