New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@advertol/service-google-dfp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@advertol/service-google-dfp - npm Package Compare versions

Comparing version 1.0.0-alpha.0 to 1.0.0

CHANGELOG.md

84

index.cjs.js

@@ -32,2 +32,4 @@ 'use strict';

_this = _Service.call(this) || this;
_this.slots = {};
_this.adUnitPaths = {};
_this.filledZoneCallbacks = {};

@@ -40,4 +42,4 @@ _this.emptyZoneCallbacks = {};

var _options = options,
_options$slots = _options.slots,
slots = _options$slots === void 0 ? {} : _options$slots,
_options$zones = _options.zones,
zones = _options$zones === void 0 ? [] : _options$zones,
_options$onSetup = _options.onSetup,

@@ -48,3 +50,13 @@ onSetup = _options$onSetup === void 0 ? function () {} : _options$onSetup,

_this.refreshZones = refreshZones.bind(_assertThisInitialized(_this));
_this.slots = slots;
zones.forEach(function (_ref) {
var id = _ref.id,
adUnitPath = _ref.adUnitPath,
slot = _ref.slot;
_this.addZone({
id: id,
adUnitPath: adUnitPath,
slot: slot
});
});
/* istanbul ignore next */

@@ -63,3 +75,5 @@

/**
* @param {Function} callback [description]
* @param {string} id
* @param {string} adUnitPath
* @param {Function} callback
*/

@@ -70,2 +84,19 @@

_proto.addZone = function addZone(_ref2) {
var id = _ref2.id,
adUnitPath = _ref2.adUnitPath,
slot = _ref2.slot;
if (id in this.slots && id in this.adUnitPaths) {
return;
}
this.slots[id] = slot;
this.adUnitPaths[id] = adUnitPath;
}
/**
* @param {Function} callback [description]
*/
;
_proto.cmd

@@ -104,5 +135,5 @@ /* istanbul ignore next */

window.googletag.pubads().addEventListener('slotRenderEnded', function (data) {
var zoneName = data.slot.getAdUnitPath();
var zoneResponse = data.slot.getResponseInformation();
var callback = _this2.isZoneEmpty(zoneResponse) ? _this2.emptyZoneCallbacks[zoneName] : _this2.filledZoneCallbacks[zoneName];
var adUnitPath = data.slot.getAdUnitPath();
var response = data.slot.getResponseInformation();
var callback = _this2.isZoneEmpty(response) ? _this2.emptyZoneCallbacks[adUnitPath] : _this2.filledZoneCallbacks[adUnitPath];

@@ -113,4 +144,4 @@ if (typeof callback === 'function') {

delete _this2.filledZoneCallbacks[zoneName];
delete _this2.emptyZoneCallbacks[zoneName];
delete _this2.filledZoneCallbacks[adUnitPath];
delete _this2.emptyZoneCallbacks[adUnitPath];
});

@@ -126,5 +157,5 @@ }

/* istanbul ignore next */
= function displayZone(_ref) {
var element = _ref.element,
id = _ref.id;
= function displayZone(_ref3) {
var element = _ref3.element,
id = _ref3.id;

@@ -164,7 +195,7 @@ if (typeof window.googletag === 'undefined') {

zones.filter(function (_ref2) {
var id = _ref2.id;
zones.filter(function (_ref4) {
var id = _ref4.id;
return _this3.slotResolvedZones.indexOf(id) === -1 && id in _this3.slots === true;
}).forEach(function (_ref3) {
var id = _ref3.id;
}).forEach(function (_ref5) {
var id = _ref5.id;

@@ -190,7 +221,7 @@ _this3.slotResolvedZones.push(id);

var slots = zones.filter(function (_ref4) {
var id = _ref4.id;
var slots = zones.filter(function (_ref6) {
var id = _ref6.id;
return _this4.refreshedZones.indexOf(id) === -1 && id in _this4.slots === true;
}).map(function (_ref5) {
var id = _ref5.id;
}).map(function (_ref7) {
var id = _ref7.id;

@@ -217,13 +248,15 @@ _this4.refreshedZones.push(id);

_proto.writeZone = function writeZone(_ref6) {
_proto.writeZone = function writeZone(_ref8) {
var _this5 = this;
var element = _ref6.element,
id = _ref6.id;
var element = _ref8.element,
id = _ref8.id;
return new Promise(function (resolve) {
_this5.filledZoneCallbacks[id] = function () {
var adUnitPath = _this5.adUnitPaths[id];
_this5.filledZoneCallbacks[adUnitPath] = function () {
return resolve(true);
};
_this5.emptyZoneCallbacks[id] = function () {
_this5.emptyZoneCallbacks[adUnitPath] = function () {
return resolve(false);

@@ -259,1 +292,2 @@ };

module.exports = GoogleDfpService;
//# sourceMappingURL=index.cjs.js.map

@@ -30,2 +30,4 @@ import { Service } from '@advertol/core';

_this = _Service.call(this) || this;
_this.slots = {};
_this.adUnitPaths = {};
_this.filledZoneCallbacks = {};

@@ -38,4 +40,4 @@ _this.emptyZoneCallbacks = {};

var _options = options,
_options$slots = _options.slots,
slots = _options$slots === void 0 ? {} : _options$slots,
_options$zones = _options.zones,
zones = _options$zones === void 0 ? [] : _options$zones,
_options$onSetup = _options.onSetup,

@@ -46,3 +48,13 @@ onSetup = _options$onSetup === void 0 ? function () {} : _options$onSetup,

_this.refreshZones = refreshZones.bind(_assertThisInitialized(_this));
_this.slots = slots;
zones.forEach(function (_ref) {
var id = _ref.id,
adUnitPath = _ref.adUnitPath,
slot = _ref.slot;
_this.addZone({
id: id,
adUnitPath: adUnitPath,
slot: slot
});
});
/* istanbul ignore next */

@@ -61,3 +73,5 @@

/**
* @param {Function} callback [description]
* @param {string} id
* @param {string} adUnitPath
* @param {Function} callback
*/

@@ -68,2 +82,19 @@

_proto.addZone = function addZone(_ref2) {
var id = _ref2.id,
adUnitPath = _ref2.adUnitPath,
slot = _ref2.slot;
if (id in this.slots && id in this.adUnitPaths) {
return;
}
this.slots[id] = slot;
this.adUnitPaths[id] = adUnitPath;
}
/**
* @param {Function} callback [description]
*/
;
_proto.cmd

@@ -102,5 +133,5 @@ /* istanbul ignore next */

window.googletag.pubads().addEventListener('slotRenderEnded', function (data) {
var zoneName = data.slot.getAdUnitPath();
var zoneResponse = data.slot.getResponseInformation();
var callback = _this2.isZoneEmpty(zoneResponse) ? _this2.emptyZoneCallbacks[zoneName] : _this2.filledZoneCallbacks[zoneName];
var adUnitPath = data.slot.getAdUnitPath();
var response = data.slot.getResponseInformation();
var callback = _this2.isZoneEmpty(response) ? _this2.emptyZoneCallbacks[adUnitPath] : _this2.filledZoneCallbacks[adUnitPath];

@@ -111,4 +142,4 @@ if (typeof callback === 'function') {

delete _this2.filledZoneCallbacks[zoneName];
delete _this2.emptyZoneCallbacks[zoneName];
delete _this2.filledZoneCallbacks[adUnitPath];
delete _this2.emptyZoneCallbacks[adUnitPath];
});

@@ -124,5 +155,5 @@ }

/* istanbul ignore next */
= function displayZone(_ref) {
var element = _ref.element,
id = _ref.id;
= function displayZone(_ref3) {
var element = _ref3.element,
id = _ref3.id;

@@ -162,7 +193,7 @@ if (typeof window.googletag === 'undefined') {

zones.filter(function (_ref2) {
var id = _ref2.id;
zones.filter(function (_ref4) {
var id = _ref4.id;
return _this3.slotResolvedZones.indexOf(id) === -1 && id in _this3.slots === true;
}).forEach(function (_ref3) {
var id = _ref3.id;
}).forEach(function (_ref5) {
var id = _ref5.id;

@@ -188,7 +219,7 @@ _this3.slotResolvedZones.push(id);

var slots = zones.filter(function (_ref4) {
var id = _ref4.id;
var slots = zones.filter(function (_ref6) {
var id = _ref6.id;
return _this4.refreshedZones.indexOf(id) === -1 && id in _this4.slots === true;
}).map(function (_ref5) {
var id = _ref5.id;
}).map(function (_ref7) {
var id = _ref7.id;

@@ -215,13 +246,15 @@ _this4.refreshedZones.push(id);

_proto.writeZone = function writeZone(_ref6) {
_proto.writeZone = function writeZone(_ref8) {
var _this5 = this;
var element = _ref6.element,
id = _ref6.id;
var element = _ref8.element,
id = _ref8.id;
return new Promise(function (resolve) {
_this5.filledZoneCallbacks[id] = function () {
var adUnitPath = _this5.adUnitPaths[id];
_this5.filledZoneCallbacks[adUnitPath] = function () {
return resolve(true);
};
_this5.emptyZoneCallbacks[id] = function () {
_this5.emptyZoneCallbacks[adUnitPath] = function () {
return resolve(false);

@@ -257,1 +290,2 @@ };

export default GoogleDfpService;
//# sourceMappingURL=index.esm.js.map
{
"name": "@advertol/service-google-dfp",
"version": "1.0.0-alpha.0",
"version": "1.0.0",
"description": "Google DFP/Ad Manager service.",

@@ -10,4 +10,5 @@ "main": "index.cjs.js",

"files": [
"index.cjs.js",
"index.esm.js",
"index.cjs.{js,js.map}",
"index.esm.{js,js.map}",
"CHANGELOG.md",
"LICENSE.md",

@@ -23,2 +24,3 @@ "README.md"

"lint": "eslint '{index,lib/**/*,test/**/*}.js'",
"postpublish": "GITHUB_TOKEN=$GITHUB_RELEASE_TOKEN github-release-from-changelog",
"prepublishOnly": "npm run build",

@@ -28,6 +30,7 @@ "release": "np",

"test:automated": "BABEL_ENV=test karma start",
"test:automated:watch": "npm run test:automated -- --auto-watch --no-single-run"
"test:automated:watch": "npm run test:automated -- --auto-watch --no-single-run",
"version": "version-changelog CHANGELOG.md && changelog-verify CHANGELOG.md && git add CHANGELOG.md"
},
"dependencies": {
"@advertol/core": "^1.0.0-alpha.0"
"@advertol/core": "^1.0.0"
},

@@ -42,2 +45,4 @@ "devDependencies": {

"babel-preset-niksy": "^4.1.0",
"changelog-verify": "^1.1.2",
"core-js": "^2.6.5",
"eslint": "^5.4.0",

@@ -52,6 +57,7 @@ "eslint-config-niksy": "^6.1.0",

"esm": "^3.0.51",
"github-release-from-changelog": "^1.3.2",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^1.1.0",
"karma": "^4.0.1",
"karma-browserstack-launcher": "^1.0.0",
"karma-chrome-launcher": "^1.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.1",

@@ -69,2 +75,3 @@ "karma-fixture": "^0.2.6",

"sinon": "^2.4.1",
"version-changelog": "^3.1.1",
"webpack": "^4.12.0"

@@ -89,9 +96,8 @@ },

"type": "git",
"url": "git+https://github.com/niksy/advertol.git"
"url": "git+https://github.com/niksy/advertol-service-google-dfp.git"
},
"bugs": {
"url": "https://github.com/niksy/advertol/issues"
"url": "https://github.com/niksy/advertol-service-google-dfp/issues"
},
"homepage": "https://github.com/niksy/advertol#readme",
"gitHead": "e83640d93effb6e4c14d54bb504351e9d98097db"
"homepage": "https://github.com/niksy/advertol-service-google-dfp#readme"
}

@@ -39,5 +39,7 @@ # @advertol/service-google-dfp

new GoogleDfpService({
slots: {
'becky': () => window.googletag.defineSlot('/0/becky', ['fluid'], 'zone-becky').addService(window.googletag.pubads())
}
zones: [{
id: 'becky',
adUnitPath: '/42/becky',
slot: () => window.googletag.defineSlot('/42/becky', ['fluid'], 'zone-becky').addService(window.googletag.pubads())
}]
})

@@ -52,15 +54,16 @@ ]

### googleDfpService({ slots, onSetup, refreshZones })
### googleDfpService({ zones, onSetup, refreshZones })
#### slots
#### zones
Type: `Object`
Type: `Object[]`
Service slots.
List of zones with their slot callback.
Each object property has:
| Property | Type | Description |
| --- | --- | --- |
| `slot` | `Function` | Function which returns [`googletag.defineSlot`][googletag-define-slot] or [`googletag.defineOutOfPageSlot`][googletag-define-outofpage-slot] instance. |
| `adUnitPath` | `string` | Full path of the ad unit with the network code and unit code. |
| `id` | `string` | Zone ID. |
* Key, which is zone ID
* Value, which is function which returns [`googletag.defineSlot`][googletag-define-slot] or [`googletag.defineOutOfPageSlot`][googletag-define-outofpage-slot] instance
#### onSetup

@@ -86,2 +89,12 @@

### instance.addZone({ slot, adUnitPath, id })
Add new zone with slot callback.
| Property | Type | Description |
| --- | --- | --- |
| `slot` | `Function` | Function which returns [`googletag.defineSlot`][googletag-define-slot] or [`googletag.defineOutOfPageSlot`][googletag-define-outofpage-slot] instance. |
| `adUnitPath` | `string` | Full path of the ad unit with the network code and unit code. |
| `id` | `string` | Zone ID. |
## Browser support

@@ -99,8 +112,8 @@

[ci]: https://travis-ci.com/niksy/service-google-dfp
[ci-img]: https://travis-ci.com/niksy/service-google-dfp.svg?branch=master
[ci]: https://travis-ci.com/niksy/advertol-service-google-dfp
[ci-img]: https://travis-ci.com/niksy/advertol-service-google-dfp.svg?branch=master
[browserstack]: https://www.browserstack.com/
[browserstack-img]: https://www.browserstack.com/automate/badge.svg?badge_key=OEoyeTlOV05LL25aemN4WU5kN3VGQzBFT3lrc0FZcjhSeDJNS0hwWDU5RT0tLTI3blFyU3d2a3dCT2xGb1NBczZtVXc9PQ==--e720201c13e584cd0b47e31366072e08d7d87710
[browserstack-img]: https://www.browserstack.com/automate/badge.svg?badge_key=WnJmTGFCek5KWFRxMjhrOE1wdE9CYUNkK3B3Y1U4cVl3SndsQjVEbmV4MD0tLWNzajBEdG1neHZROS94K0NpMW1qbWc9PQ==--70b8da2c741fdc30f6011a0ade9d36429c8b8f52
[googletag-define-slot]: https://developers.google.com/doubleclick-gpt/reference#googletag.defineSlot
[googletag-define-outofpage-slot]: https://developers.google.com/doubleclick-gpt/reference#googletag.defineOutOfPageSlot
[googletag-refresh]: https://developers.google.com/doubleclick-gpt/reference#googletag.PubAdsService_refresh
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc