Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@financial-times/o-ads

Package Overview
Dependencies
Maintainers
18
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@financial-times/o-ads - npm Package Compare versions

Comparing version 18.3.3 to 19.0.0-beta.0

8

browser.js

@@ -8,3 +8,3 @@ "use strict";

var _config = _interopRequireWildcard(require("./dist/js/config.js"));
var _adsConfig = _interopRequireWildcard(require("@financial-times/ads-config"));

@@ -34,6 +34,6 @@ var _slots = _interopRequireDefault(require("./dist/js/slots.js"));

_config.default.init = _config.init;
_config.default.clear = _config.clear; // bung all our modules on the protoype
_adsConfig.default.init = _adsConfig.init;
_adsConfig.default.clear = _adsConfig.clear; // bung all our modules on the protoype
Ads.prototype.config = _config.default;
Ads.prototype.config = _adsConfig.default;
Ads.prototype.slots = _slots.default;

@@ -40,0 +40,0 @@ Ads.prototype.gpt = _gpt.default;

@@ -8,3 +8,3 @@ "use strict";

var _config = _interopRequireDefault(require("../config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -48,4 +48,4 @@ var _index = _interopRequireDefault(require("../utils/index.js"));

function init() {
var gptConfig = (0, _config.default)('gpt') || {};
breakpoints = (0, _config.default)('responsive');
var gptConfig = (0, _adsConfig.default)('gpt') || {};
breakpoints = (0, _adsConfig.default)('responsive');
loadGPT();

@@ -98,3 +98,3 @@

function setup(gptConfig) {
var nonPersonalized = (0, _config.default)('nonPersonalized') ? 1 : 0;
var nonPersonalized = (0, _adsConfig.default)('nonPersonalized') ? 1 : 0;
googletag.pubads().addEventListener('slotRenderEnded', onRenderEnded);

@@ -227,3 +227,3 @@ enableCompanions(gptConfig);

function setPageCollapseEmpty() {
var mode = (0, _config.default)('collapseEmpty');
var mode = (0, _adsConfig.default)('collapseEmpty');

@@ -460,3 +460,3 @@ if (mode === 'before') {

var unitName;
var gpt = (0, _config.default)('gpt') || {};
var gpt = (0, _adsConfig.default)('gpt') || {};
var attr = this.container.getAttribute('data-o-ads-gpt-unit-name');

@@ -487,3 +487,3 @@

window.googletag.cmd.push(() => {
var gpt = (0, _config.default)('gpt') || {};
var gpt = (0, _adsConfig.default)('gpt') || {};
gptSlot = gptSlot || this.gpt.slot;

@@ -505,3 +505,3 @@ gptSlot.addService(googletag.pubads());

window.googletag.cmd.push(() => {
var mode = this.collapseEmpty || (0, _config.default)('collapseEmpty') || DEFAULT_COLLAPSE_MODE;
var mode = this.collapseEmpty || (0, _adsConfig.default)('collapseEmpty') || DEFAULT_COLLAPSE_MODE;

@@ -555,3 +555,3 @@ if (mode === 'before') {

gptSlot = gptSlot || this.gpt.slot;
var canonical = (0, _config.default)('canonical');
var canonical = (0, _adsConfig.default)('canonical');
gptSlot.set('page_url', canonical ? canonical : _index.default.getLocation());

@@ -629,3 +629,3 @@ });

var log = _index.default.log;
var conf = (0, _config.default)('gpt');
var conf = (0, _adsConfig.default)('gpt');

@@ -632,0 +632,0 @@ if (!conf) {

@@ -10,3 +10,3 @@ "use strict";

var _config = _interopRequireDefault(require("./config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -42,3 +42,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

} else {
var mapping = (0, _config.default)().formats;
var mapping = (0, _adsConfig.default)().formats;
var formats = _index.default.isArray(value) ? value : value.split(',');

@@ -145,4 +145,4 @@ formats.forEach(format => {

var renderEvent = 'slotRenderStart';
var cfg = (0, _config.default)();
var slotConfig = (0, _config.default)('slots') || {}; // store the container
var cfg = (0, _adsConfig.default)();
var slotConfig = (0, _adsConfig.default)('slots') || {}; // store the container

@@ -194,3 +194,3 @@ this.container = container; // the current responsive screensize

} else {
this.lazyLoad = (0, _config.default)('lazyLoad') || false;
this.lazyLoad = (0, _adsConfig.default)('lazyLoad') || false;
}

@@ -518,3 +518,3 @@

if (className && !(0, _config.default)('displayLabelWithBorders')) {
if (className && !(0, _adsConfig.default)('displayLabelWithBorders')) {
this.container.classList.add("o-ads--".concat(className));

@@ -521,0 +521,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

var _config = _interopRequireDefault(require("./config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -78,3 +78,3 @@ var _slot = _interopRequireDefault(require("./slot.js"));

var formats = (0, _config.default)('formats');
var formats = (0, _adsConfig.default)('formats');

@@ -190,4 +190,4 @@ for (var prop in formats) {

Slots.prototype.initRefresh = function () {
if ((0, _config.default)('flags').refresh && (0, _config.default)('refresh')) {
var data = (0, _config.default)('refresh');
if ((0, _adsConfig.default)('flags').refresh && (0, _adsConfig.default)('refresh')) {
var data = (0, _adsConfig.default)('refresh');
this.refreshCount = 0;

@@ -242,3 +242,3 @@ /* istanbul ignore else */

Slots.prototype.initResponsive = function () {
var breakpoints = (0, _config.default)('responsive');
var breakpoints = (0, _adsConfig.default)('responsive');
/* istanbul ignore else */

@@ -335,3 +335,3 @@

Slots.prototype.initLazyLoading = function (slotConfig) {
var lazyLoadingConfig = (0, _config.default)('lazyLoad') || slotConfig | {};
var lazyLoadingConfig = (0, _adsConfig.default)('lazyLoad') || slotConfig | {};
this.lazyLoadingObservers = this.lazyLoadingObservers || [];

@@ -338,0 +338,0 @@ this.flushLazyLoading(); // find any pre-existing observers

@@ -8,3 +8,3 @@ "use strict";

var _config = _interopRequireDefault(require("./config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -58,3 +58,3 @@ var _index = _interopRequireDefault(require("./utils/index.js"));

Targeting.prototype.getVersion = function () {
if ((0, _config.default)('passOAdsVersion')) {
if ((0, _adsConfig.default)('passOAdsVersion')) {
return {

@@ -130,3 +130,3 @@ OADS_VERSION: _index.default.getVersion()

Targeting.prototype.responsive = function () {
return (0, _config.default)('responsive') ? {
return (0, _adsConfig.default)('responsive') ? {
res: _index.default.responsive.getCurrent()

@@ -133,0 +133,0 @@ } : {};

@@ -8,3 +8,3 @@ "use strict";

var _config = _interopRequireDefault(require("../config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -48,4 +48,4 @@ var _index = _interopRequireDefault(require("../utils/index.js"));

function init() {
var gptConfig = (0, _config.default)('gpt') || {};
breakpoints = (0, _config.default)('responsive');
var gptConfig = (0, _adsConfig.default)('gpt') || {};
breakpoints = (0, _adsConfig.default)('responsive');
loadGPT();

@@ -98,3 +98,3 @@

function setup(gptConfig) {
var nonPersonalized = (0, _config.default)('nonPersonalized') ? 1 : 0;
var nonPersonalized = (0, _adsConfig.default)('nonPersonalized') ? 1 : 0;
googletag.pubads().addEventListener('slotRenderEnded', onRenderEnded);

@@ -227,3 +227,3 @@ enableCompanions(gptConfig);

function setPageCollapseEmpty() {
var mode = (0, _config.default)('collapseEmpty');
var mode = (0, _adsConfig.default)('collapseEmpty');

@@ -460,3 +460,3 @@ if (mode === 'before') {

var unitName;
var gpt = (0, _config.default)('gpt') || {};
var gpt = (0, _adsConfig.default)('gpt') || {};
var attr = this.container.getAttribute('data-o-ads-gpt-unit-name');

@@ -487,3 +487,3 @@

window.googletag.cmd.push(() => {
var gpt = (0, _config.default)('gpt') || {};
var gpt = (0, _adsConfig.default)('gpt') || {};
gptSlot = gptSlot || this.gpt.slot;

@@ -505,3 +505,3 @@ gptSlot.addService(googletag.pubads());

window.googletag.cmd.push(() => {
var mode = this.collapseEmpty || (0, _config.default)('collapseEmpty') || DEFAULT_COLLAPSE_MODE;
var mode = this.collapseEmpty || (0, _adsConfig.default)('collapseEmpty') || DEFAULT_COLLAPSE_MODE;

@@ -555,3 +555,3 @@ if (mode === 'before') {

gptSlot = gptSlot || this.gpt.slot;
var canonical = (0, _config.default)('canonical');
var canonical = (0, _adsConfig.default)('canonical');
gptSlot.set('page_url', canonical ? canonical : _index.default.getLocation());

@@ -629,3 +629,3 @@ });

var log = _index.default.log;
var conf = (0, _config.default)('gpt');
var conf = (0, _adsConfig.default)('gpt');

@@ -632,0 +632,0 @@ if (!conf) {

@@ -10,3 +10,3 @@ "use strict";

var _config = _interopRequireDefault(require("./config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -42,3 +42,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

} else {
var mapping = (0, _config.default)().formats;
var mapping = (0, _adsConfig.default)().formats;
var formats = _index.default.isArray(value) ? value : value.split(',');

@@ -145,4 +145,4 @@ formats.forEach(format => {

var renderEvent = 'slotRenderStart';
var cfg = (0, _config.default)();
var slotConfig = (0, _config.default)('slots') || {}; // store the container
var cfg = (0, _adsConfig.default)();
var slotConfig = (0, _adsConfig.default)('slots') || {}; // store the container

@@ -194,3 +194,3 @@ this.container = container; // the current responsive screensize

} else {
this.lazyLoad = (0, _config.default)('lazyLoad') || false;
this.lazyLoad = (0, _adsConfig.default)('lazyLoad') || false;
}

@@ -518,3 +518,3 @@

if (className && !(0, _config.default)('displayLabelWithBorders')) {
if (className && !(0, _adsConfig.default)('displayLabelWithBorders')) {
this.container.classList.add("o-ads--".concat(className));

@@ -521,0 +521,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

var _config = _interopRequireDefault(require("./config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -78,3 +78,3 @@ var _slot = _interopRequireDefault(require("./slot.js"));

var formats = (0, _config.default)('formats');
var formats = (0, _adsConfig.default)('formats');

@@ -190,4 +190,4 @@ for (var prop in formats) {

Slots.prototype.initRefresh = function () {
if ((0, _config.default)('flags').refresh && (0, _config.default)('refresh')) {
var data = (0, _config.default)('refresh');
if ((0, _adsConfig.default)('flags').refresh && (0, _adsConfig.default)('refresh')) {
var data = (0, _adsConfig.default)('refresh');
this.refreshCount = 0;

@@ -242,3 +242,3 @@ /* istanbul ignore else */

Slots.prototype.initResponsive = function () {
var breakpoints = (0, _config.default)('responsive');
var breakpoints = (0, _adsConfig.default)('responsive');
/* istanbul ignore else */

@@ -335,3 +335,3 @@

Slots.prototype.initLazyLoading = function (slotConfig) {
var lazyLoadingConfig = (0, _config.default)('lazyLoad') || slotConfig | {};
var lazyLoadingConfig = (0, _adsConfig.default)('lazyLoad') || slotConfig | {};
this.lazyLoadingObservers = this.lazyLoadingObservers || [];

@@ -338,0 +338,0 @@ this.flushLazyLoading(); // find any pre-existing observers

@@ -8,3 +8,3 @@ "use strict";

var _config = _interopRequireDefault(require("./config.js"));
var _adsConfig = _interopRequireDefault(require("@financial-times/ads-config"));

@@ -58,3 +58,3 @@ var _index = _interopRequireDefault(require("./utils/index.js"));

Targeting.prototype.getVersion = function () {
if ((0, _config.default)('passOAdsVersion')) {
if ((0, _adsConfig.default)('passOAdsVersion')) {
return {

@@ -130,3 +130,3 @@ OADS_VERSION: _index.default.getVersion()

Targeting.prototype.responsive = function () {
return (0, _config.default)('responsive') ? {
return (0, _adsConfig.default)('responsive') ? {
res: _index.default.responsive.getCurrent()

@@ -133,0 +133,0 @@ } : {};

@@ -169,8 +169,8 @@ // For a detailed explanation regarding each configuration property, visit:

'^.+\\.jsx?$': 'babel-jest'
}
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/"
// ],
transformIgnorePatterns: [
"/node_modules/(?!@financial-times/ads-config).+(js|jsx)$"
],

@@ -177,0 +177,0 @@ // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them

/* eslint valid-jsdoc: 0 */
import config, { init, clear } from './src/js/config.js';
import config, { init, clear } from '@financial-times/ads-config';
import slots from './src/js/slots.js';

@@ -6,0 +6,0 @@ import gpt from './src/js/ad-servers/gpt.js';

@@ -8,3 +8,3 @@ "use strict";

var _config = _interopRequireWildcard(require("./dist-esm/js/config.js"));
var _adsConfig = _interopRequireWildcard(require("@financial-times/ads-config"));

@@ -34,6 +34,6 @@ var _slots = _interopRequireDefault(require("./dist-esm/js/slots.js"));

_config.default.init = _config.init;
_config.default.clear = _config.clear; // bung all our modules on the protoype
_adsConfig.default.init = _adsConfig.init;
_adsConfig.default.clear = _adsConfig.clear; // bung all our modules on the protoype
Ads.prototype.config = _config.default;
Ads.prototype.config = _adsConfig.default;
Ads.prototype.slots = _slots.default;

@@ -40,0 +40,0 @@ Ads.prototype.gpt = _gpt.default;

@@ -16,4 +16,5 @@ {

"name": "@financial-times/o-ads",
"version": "18.3.3",
"version": "19.0.0-beta.0",
"dependencies": {
"@financial-times/ads-config": "^1.3.0-beta.5",
"@financial-times/o-viewport": "^4.0.0",

@@ -56,47 +57,47 @@ "@financial-times/o-grid": "^5.0.0",

"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@cypress/webpack-preprocessor": "^5.4.5",
"@financial-times/secret-squirrel": "^2.15.0",
"@testing-library/jest-dom": "^5.11.0",
"@types/doubleclick-gpt": "2019041801.0.3",
"@types/jest": "26.0.14",
"@types/jsdom": "16.2.3",
"babel-jest": "^26.0.0",
"babel-plugin-rewire": "^1.2.0",
"bower-resolve-webpack-plugin": "^1.0.5",
"browserstack-local": "^1.4.5",
"bundlesize": "^0.18.0",
"cypress": "^5.1.0",
"dotenv": "^8.2.0",
"eslint": "^7.9.0",
"eslint-plugin-jest": "^24.0.2",
"eslint-plugin-qunit": "^5.0.0",
"geckodriver": "^1.20.0",
"genversion": "^2.2.1",
"isomorphic-fetch": "^2.0.0",
"istanbul": "^0.4.2",
"istanbul-instrumenter-loader": "^3.0.1",
"jest": "^25.0.0",
"jest-environment-jsdom": "26.3.0",
"@babel/core": "7.12.9",
"@babel/preset-env": "7.12.7",
"@cypress/webpack-preprocessor": "5.4.11",
"@financial-times/secret-squirrel": "2.17.0",
"@testing-library/jest-dom": "5.11.6",
"@types/doubleclick-gpt": "2019041801.0.4",
"@types/jest": "26.0.15",
"@types/jsdom": "16.2.5",
"babel-jest": "26.6.3",
"babel-plugin-rewire": "1.2.0",
"bower-resolve-webpack-plugin": "1.0.5",
"browserstack-local": "1.4.8",
"bundlesize": "0.18.0",
"cypress": "6.0.0",
"dotenv": "8.2.0",
"eslint": "7.14.0",
"eslint-plugin-jest": "24.1.3",
"eslint-plugin-qunit": "5.1.0",
"geckodriver": "1.21.0",
"genversion": "2.2.1",
"isomorphic-fetch": "3.0.0",
"istanbul": "0.4.5",
"istanbul-instrumenter-loader": "3.0.1",
"jest": "25.5.4",
"jest-environment-jsdom": "26.6.2",
"jest-environment-jsdom-global": "2.0.4",
"jest-puppeteer": "^4.4.0",
"karma": "^5.2.3",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage": "^2.0.0",
"karma-coverage-istanbul-reporter": "^3.0.0",
"karma-qunit": "^4.0.0",
"karma-webpack": "^4.0.0",
"jest-puppeteer": "4.4.0",
"karma": "5.2.3",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-coverage": "2.0.3",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-qunit": "4.1.1",
"karma-webpack": "4.0.2",
"nightwatch": "git@github.com:Financial-Times/nightwatch.git",
"origami-build-tools": "^9.0.13",
"pre-git": "^3.17.1",
"puppeteer": "^5.2.1",
"qunit": "^2.11.2",
"release-it": "^14.0.2",
"snyk": "^1.169.1",
"start-server-and-test": "^1.11.3",
"watchify": "^3.11.0",
"webpack": "^4.43.0"
"origami-build-tools": "9.0.13",
"pre-git": "3.17.1",
"puppeteer": "5.5.0",
"qunit": "2.12.0",
"release-it": "14.2.2",
"snyk": "1.431.2",
"start-server-and-test": "1.11.6",
"watchify": "3.11.1",
"webpack": "4.44.2"
}
}

@@ -24,13 +24,15 @@ # @financial-times/o-ads [![CircleCI](https://circleci.com/gh/Financial-Times/o-ads/tree/master.svg?style=svg&circle-token=ff0caeb981693cbbbab6b70ab0ac99c9314bfc4f)](https://circleci.com/gh/Financial-Times/o-ads/tree/master)

**[8. Events](#events)**
**[8. Collapsing](#collapsing)**
**[9. Metrics & Monitoring](#metrics--monitoring)**
**[9. Events](#events)**
**[10. Misc](#misc)**
**[10. Metrics & Monitoring](#metrics--monitoring)**
**[11. Developing](#developing)**
**[11. Misc](#misc)**
**[12. Migration](https://github.com/financial-times/o-ads/blob/master/MIGRATION.md)**
**[12. Developing](#developing)**
**[13. Migration](https://github.com/financial-times/o-ads/blob/master/MIGRATION.md)**
## Install

@@ -300,2 +302,54 @@

## Collapsing
A creative may not be served under one of the following circumstances:
1. **A bug in the creative** - The ad server served an ad correctly, but some bug in the creative causes it not to display anything. A common example of this would be if the ad’s assets were insecure. This needs to be reported to AdOps as soon as possible - ideally with the creative Id or line item Id
2. **Collapsed ad** - This is when AdOps explicitly send instructions to an ad slot not to show anything, maybe because an advertiser wants exclusivity on the page, but might not have assets with all the correct sizes. This is done via a particular creative that contains some code implemented throught o-ads-embed telling it to collapse itself. It should then append the class o-ads--empty to the ad slot.
3. No ad This is when the ad server fails to return any ad. This could be caused by an ad call that is missing the correct targeting parameters and ad unit. However, it should be rare, as AdOps usually fall back to either programmatic advertising or House Ads
### Collapsing of empty ad slots
There are three options available for how the ad slot should react to the absence of an ad.
1. **before:** The ad slot will be collapsed before the ad request until an ad is found.
2. **after:** The ad slot will be collapsed if no ad is found after the ad request.
3. **never:** The ad slot never collapses, even if no ad is found.
By default, collapsing of empty ads is disabled (never).
Via config for page level:
```javascript
oAds.config({
collapseEmpty: "before",
...
});
```
Via config for a specific slot
```javascript
oAds.config({
slots: {
outstream: {
collapseEmpty: "before"
}
},
...
});
```
```html
<!-- view.html -->
<div class="o-ads" data-o-ads-name="outstream"></div>
```
Via component
```html
<div class="o-ads" data-o-ads-collapse-empty="before"></div>
```
## Events

@@ -302,0 +356,0 @@

{
"extends": ["github>financial-times/renovate-config-next"]
"extends": [
"config:base"
]
}

@@ -10,3 +10,3 @@ /*globals googletag: true */

*/
import config from '../config.js';
import config from '@financial-times/ads-config';
import utils from '../utils/index.js';

@@ -13,0 +13,0 @@ import targeting from '../targeting.js';

import utils from './utils/index.js';
import config from './config.js';
import config from '@financial-times/ads-config';

@@ -4,0 +4,0 @@ const VALID_SIZE_STRINGS = ['fluid'];

/* eslint no-inner-declarations: 1 */
import utils from './utils/index.js';
import config from './config.js';
import config from '@financial-times/ads-config';
import Slot from './slot.js';

@@ -5,0 +5,0 @@

@@ -1,2 +0,2 @@

import config from './config.js';
import config from '@financial-times/ads-config';
import utils from './utils/index.js';

@@ -3,0 +3,0 @@ let parameters = {};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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