Skip to content

Commit

Permalink
bump version and push new build. (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaanauati authored Mar 5, 2021
1 parent 126d4fe commit 48402ff
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions lib/dfpslotsprovider.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ function (_React$Component) {
_manager.default.setAdSenseAttributes(this.props.adSenseAttributes);

_manager.default.setCollapseEmptyDivs(this.props.collapseEmptyDivs);

_manager.default.configureLimitedAds(this.props.limitedAds);
}
}, {
key: "attachLoadCallback",
Expand Down Expand Up @@ -271,7 +273,8 @@ _defineProperty(DFPSlotsProvider, "propTypes", {
fetchMarginPercent: _propTypes.default.number,
renderMarginPercent: _propTypes.default.number,
mobileScaling: _propTypes.default.number
})])
})]),
limitedAds: _propTypes.default.bool
});

_defineProperty(DFPSlotsProvider, "defaultProps", {
Expand All @@ -294,7 +297,8 @@ _defineProperty(DFPSlotsProvider, "defaultProps", {
singleRequest: true,
disableInitialLoad: false,
collapseEmptyDivs: null,
lazyLoad: false
lazyLoad: false,
limitedAds: false
});

if (Context === null) {
Expand Down
9 changes: 8 additions & 1 deletion lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var registeredSlots = {};
var managerAlreadyInitialized = false;
var globalTargetingArguments = {};
var globalAdSenseAttributes = {};
var limitedAds = false;
var DFPManager = Object.assign(new _events.EventEmitter().setMaxListeners(0), {
singleRequestIsEnabled: function singleRequestIsEnabled() {
return singleRequestEnabled;
Expand Down Expand Up @@ -57,6 +58,12 @@ var DFPManager = Object.assign(new _events.EventEmitter().setMaxListeners(0), {
lazyLoadIsEnabled: function lazyLoadIsEnabled() {
return lazyLoadEnabled;
},
limitedAdsIsEnabled: function limitedAdsIsEnabled() {
return limitedAds;
},
configureLimitedAds: function configureLimitedAds(value) {
limitedAds = !!value;
},
getLazyLoadConfig: function getLazyLoadConfig() {
return lazyLoadConfig;
},
Expand Down Expand Up @@ -172,7 +179,7 @@ var DFPManager = Object.assign(new _events.EventEmitter().setMaxListeners(0), {
},
getGoogletag: function getGoogletag() {
if (googleGPTScriptLoadPromise === null) {
googleGPTScriptLoadPromise = Utils.loadGPTScript();
googleGPTScriptLoadPromise = Utils.loadGPTScript(limitedAds);
}

return googleGPTScriptLoadPromise;
Expand Down
11 changes: 8 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.loadGPTScript = loadGPTScript;
var GPT_SRC = {
standard: 'securepubads.g.doubleclick.net',
limitedAds: 'pagead2.googlesyndication.com'
};

function doloadGPTScript(resolve, reject) {
function doloadGPTScript(resolve, reject, limitedAds) {
window.googletag = window.googletag || {};
window.googletag.cmd = window.googletag.cmd || [];
var scriptTag = document.createElement('script');
scriptTag.src = "".concat(document.location.protocol, "//securepubads.g.doubleclick.net/tag/js/gpt.js");
scriptTag.src = "".concat(document.location.protocol, "//").concat(limitedAds ? GPT_SRC.limitedAds : GPT_SRC.standard, "/tag/js/gpt.js");
scriptTag.async = true;
scriptTag.type = 'text/javascript';

Expand All @@ -25,7 +29,8 @@ function doloadGPTScript(resolve, reject) {
}

function loadGPTScript() {
var limitedAds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return new Promise(function (resolve, reject) {
doloadGPTScript(resolve, reject);
doloadGPTScript(resolve, reject, limitedAds);
});
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-dfp",
"version": "0.19.0",
"version": "0.20.0",
"homepage": "https://github.com/jaanauati/react-dfp/",
"author": {
"name": "Jonatan Alexis Anauati",
Expand Down

0 comments on commit 48402ff

Please sign in to comment.