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
14
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 10.2.4 to 10.2.5

59

browser.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _config = _interopRequireWildcard(require("./dist/js/config"));
var _slots = _interopRequireDefault(require("./dist/js/slots"));
var _gpt = _interopRequireDefault(require("./dist/js/ad-servers/gpt"));
var _krux = _interopRequireDefault(require("./dist/js/data-providers/krux"));
var _api = _interopRequireDefault(require("./dist/js/data-providers/api"));
var _moat = _interopRequireDefault(require("./dist/js/data-providers/moat"));
var _targeting = _interopRequireDefault(require("./dist/js/targeting"));
var _utils = _interopRequireDefault(require("./dist/js/utils"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
/* eslint valid-jsdoc: 0 */

@@ -35,15 +10,16 @@ function Ads() {

}
}
} // bung all our modules on the protoype
_config.default.init = _config.init;
_config.default.clear = _config.clear; // bung all our modules on the protoype
Ads.prototype.config = _config.default;
Ads.prototype.slots = _slots.default;
Ads.prototype.gpt = _gpt.default;
Ads.prototype.krux = _krux.default;
Ads.prototype.api = _api.default;
Ads.prototype.moat = _moat.default;
Ads.prototype.targeting = _targeting.default;
Ads.prototype.utils = _utils.default;
Ads.prototype.config = require("./dist/js/config");
Ads.prototype.slots = require("./dist/js/slots");
Ads.prototype.gpt = require("./dist/js/ad-servers/gpt");
Ads.prototype.krux = require("./dist/js/data-providers/krux");
Ads.prototype.api = require("./dist/js/data-providers/api");
Ads.prototype.moat = require("./dist/js/data-providers/moat");
const targeting = require("./dist/js/targeting");
Ads.prototype.targeting = targeting;
Ads.prototype.utils = require("./dist/js/utils");
/**

@@ -57,6 +33,5 @@ * Initialises the ads library and all sub modules

this.config.init();
const configOptions = Object.assign(options, {
this.config(Object.assign(options, {
nonPersonalized: !options.disableConsentCookie
});
this.config(configOptions);
}));

@@ -127,3 +102,3 @@ if (options.disableConsentCookie) {

this.gpt.init();
this.krux.init(_targeting.default);
this.krux.init(targeting);

@@ -212,4 +187,2 @@ if (this.consents.behavioral) {

const ads = new Ads();
var _default = ads;
exports.default = _default;
module.exports = exports.default;
module.exports = ads;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _config = _interopRequireDefault(require("../config"));
var _utils = _interopRequireDefault(require("../utils"));
var _targeting = _interopRequireDefault(require("../targeting"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*globals googletag: true */

@@ -22,6 +9,12 @@

* @fileOverview
* ad server modules for o-ads implementing Google publisher tags ad requests.
* ad server modukes for o-ads implementing Google publisher tags ad requests.
*
* @author Robin Marr, robin.marr@ft.com
*/
const config = require("../config");
const utils = require("../utils");
const targeting = require("../targeting");
const DEFAULT_COLLAPSE_MODE = 'never';

@@ -40,14 +33,9 @@ let breakpoints = false;

function init() {
const gptConfig = (0, _config.default)('gpt') || {};
breakpoints = (0, _config.default)('responsive');
const gptConfig = config('gpt') || {};
breakpoints = config('responsive');
initGoogleTag();
_utils.default.on('ready', onReady.bind(null, slotMethods));
_utils.default.on('render', onRender);
_utils.default.on('refresh', onRefresh);
_utils.default.on('resize', onResize);
utils.on('ready', onReady.bind(null, slotMethods));
utils.on('render', onRender);
utils.on('refresh', onRefresh);
utils.on('resize', onResize);
googletag.cmd.push(setup.bind(null, gptConfig));

@@ -70,4 +58,4 @@ }

_utils.default.attach('//www.googletagservices.com/tag/js/gpt.js', true, null, function (err) {
_utils.default.broadcast('adServerLoadError', err);
utils.attach('//www.googletagservices.com/tag/js/gpt.js', true, null, function (err) {
utils.broadcast('adServerLoadError', err);
});

@@ -89,7 +77,7 @@ }

function setup(gptConfig) {
const nonPersonalized = (0, _config.default)('nonPersonalized') ? 1 : 0;
const nonPersonalized = config('nonPersonalized') ? 1 : 0;
googletag.pubads().addEventListener('slotRenderEnded', onRenderEnded);
enableCompanions(gptConfig);
setRenderingMode(gptConfig);
setPageTargeting(_targeting.default.get());
setPageTargeting(targeting.get());
setPageCollapseEmpty();

@@ -127,3 +115,3 @@ googletag.enableServices();

function setPageTargeting(targetingData) {
if (_utils.default.isPlainObject(targetingData)) {
if (utils.isPlainObject(targetingData)) {
googletag.cmd.push(() => {

@@ -136,3 +124,3 @@ const pubads = googletag.pubads();

} else {
_utils.default.log.warn('invalid targeting object passed', targetingData);
utils.log.warn('invalid targeting object passed', targetingData);
}

@@ -149,4 +137,3 @@

if (!window.googletag) {
_utils.default.log.warn('Attempting to clear page targeting before the GPT library has initialized');
utils.log.warn('Attempting to clear page targeting before the GPT library has initialized');
return;

@@ -156,4 +143,3 @@ }

if (!key) {
_utils.default.log.warn('Refusing to unset all keys - a key must be specified');
utils.log.warn('Refusing to unset all keys - a key must be specified');
return;

@@ -175,3 +161,3 @@ }

function setPageCollapseEmpty() {
const mode = (0, _config.default)('collapseEmpty');
const mode = config('collapseEmpty');

@@ -216,5 +202,4 @@ if (mode === 'before') {

_utils.default.extend(slot, slotMethods); // setup the gpt configuration the ad
utils.extend(slot, slotMethods); // setup the gpt configuration the ad
googletag.cmd.push(() => {

@@ -238,3 +223,3 @@ slot.defineSlot().addServices().setCollapseEmpty().setTargeting().setURL();

if (_utils.default.isFunction(slot.display)) {
if (utils.isFunction(slot.display)) {
slot.display();

@@ -252,3 +237,3 @@ }

if (_utils.default.isPlainObject(targeting)) {
if (utils.isPlainObject(targeting)) {
Object.keys(targeting).forEach(name => {

@@ -299,6 +284,6 @@ event.detail.slot.gpt.slot.setTargeting(name, targeting[name]);

} else {
_utils.default.log.warn('No iFrame found matching GPT SlotID');
utils.log.warn('No iFrame found matching GPT SlotID');
}
_utils.default.broadcast('rendered', data);
utils.broadcast('rendered', data);
}

@@ -324,3 +309,3 @@ /*

if (!this.outOfPage) {
if (breakpoints && _utils.default.isObject(this.sizes)) {
if (breakpoints && utils.isObject(this.sizes)) {
this.initResponsive();

@@ -347,3 +332,3 @@ this.gpt.slot = googletag.defineSlot(this.gpt.unitName, [], this.gpt.id).defineSizeMapping(this.gpt.sizes);

window.googletag.cmd.push(() => {
_utils.default.on('breakpoint', event => {
utils.on('breakpoint', event => {
const slot = event.detail.slot;

@@ -364,3 +349,2 @@ const screensize = event.detail.screensize;

}, this.container);
const mapping = googletag.sizeMapping();

@@ -394,4 +378,3 @@ Object.keys(breakpoints).forEach(breakpoint => {

window.googletag.cmd.push(() => {
_utils.default.broadcast('gptDisplay');
utils.broadcast('gptDisplay');
googletag.display(this.gpt.id);

@@ -408,8 +391,8 @@ });

let unitName;
const gpt = (0, _config.default)('gpt') || {};
const gpt = config('gpt') || {};
const attr = this.container.getAttribute('data-o-ads-gpt-unit-name');
if (_utils.default.isNonEmptyString(attr)) {
if (utils.isNonEmptyString(attr)) {
unitName = attr;
} else if (_utils.default.isNonEmptyString(gpt.unitName)) {
} else if (utils.isNonEmptyString(gpt.unitName)) {
unitName = gpt.unitName;

@@ -421,4 +404,4 @@ } else {

unitName = `/${network}`;
unitName += _utils.default.isNonEmptyString(site) ? `/${site}` : '';
unitName += _utils.default.isNonEmptyString(zone) ? `/${zone}` : '';
unitName += utils.isNonEmptyString(site) ? `/${site}` : '';
unitName += utils.isNonEmptyString(zone) ? `/${zone}` : '';
}

@@ -436,3 +419,3 @@

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

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

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

@@ -468,15 +451,14 @@ if (mode === 'before') {

submitGptImpression: function submitGptImpression() {
function getImpressionURL(iframe) {
const trackingUrlElement = iframe.contentWindow.document.querySelector('[data-o-ads-impression-url]');
if (this.outOfPage && this.gpt.iframe) {
function getImpressionURL(iframe) {
const trackingUrlElement = iframe.contentWindow.document.querySelector('[data-o-ads-impression-url]');
if (trackingUrlElement) {
return trackingUrlElement.dataset.oAdsImpressionUrl;
} else {
_utils.default.log.warn('Impression URL not found, this is set via a creative template.');
return false;
if (trackingUrlElement) {
return trackingUrlElement.dataset.oAdsImpressionUrl;
} else {
utils.log.warn('Impression URL not found, this is set via a creative template.');
return false;
}
}
}
if (this.outOfPage && this.gpt.iframe) {
const impressionURL = getImpressionURL(this.gpt.iframe);

@@ -486,10 +468,10 @@ /* istanbul ignore else */

if (impressionURL) {
_utils.default.attach(impressionURL, true, () => {
_utils.default.log.info('Impression Url requested');
utils.attach(impressionURL, true, () => {
utils.log.info('Impression Url requested');
}, () => {
_utils.default.log.info('CORS request to submit an impression failed');
utils.log.info('CORS request to submit an impression failed');
}, true);
}
} else {
_utils.default.log.warn('Attempting to call submitImpression on a non-oop slot');
utils.log.warn('Attempting to call submitImpression on a non-oop slot');
}

@@ -505,4 +487,4 @@ },

gptSlot = gptSlot || this.gpt.slot;
const canonical = (0, _config.default)('canonical');
gptSlot.set('page_url', canonical ? canonical : _utils.default.getLocation());
const canonical = config('canonical');
gptSlot.set('page_url', canonical ? canonical : utils.getLocation());
});

@@ -520,3 +502,3 @@ return this;

if (_utils.default.isPlainObject(this.targeting)) {
if (utils.isPlainObject(this.targeting)) {
Object.keys(this.targeting).forEach(param => {

@@ -550,3 +532,3 @@ gptSlot.setTargeting(param, this.targeting[param]);

if (window.googletag) {
const params = _utils.default.isPlainObject(override) ? override : _targeting.default.get();
const params = utils.isPlainObject(override) ? override : targeting.get();

@@ -561,10 +543,15 @@ if (!override) {

} else {
_utils.default.log.warn('Attempting to set page targeting before the GPT library has initialized');
utils.log.warn('Attempting to set page targeting before the GPT library has initialized');
}
}
function debug() {
const log = _utils.default.log;
const conf = (0, _config.default)('gpt');
module.exports.init = init;
module.exports.updateCorrelator = updateCorrelator;
module.exports.updatePageTargeting = updatePageTargeting;
module.exports.clearPageTargetingForKey = clearPageTargetingForKey;
module.exports.debug = () => {
const log = utils.log;
const conf = config('gpt');
if (!conf) {

@@ -577,12 +564,2 @@ return;

log.end();
}
var _default = {
init,
updateCorrelator,
updatePageTargeting,
clearPageTargetingForKey,
debug
};
exports.default = _default;
module.exports = exports.default;
};
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clear = exports.init = exports.default = void 0;
var _utils = _interopRequireDefault(require("./utils"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//TODO remove all ft.com specific stuff so we can remove this as a global

@@ -35,6 +26,8 @@ // currently all FT specific stuff is wrapped in an if window.FT

*/
const utils = require("./utils");
/**
* Default configuration set in the constructor.
*/
const defaults = {

@@ -100,3 +93,3 @@ formats: {

scripts.forEach(script => {
results = window.JSON ? _utils.default.extend(results, JSON.parse(script.innerHTML)) : 'UNSUPPORTED';
results = window.JSON ? utils.extend(results, JSON.parse(script.innerHTML)) : 'UNSUPPORTED';
});

@@ -138,5 +131,4 @@ return results;

if (_utils.default.isPlainObject(k)) {
_utils.default.extend(true, this.store, k);
if (utils.isPlainObject(k)) {
utils.extend(true, this.store, k);
result = this.store;

@@ -166,3 +158,3 @@ } else if (typeof v === 'undefined') {

Config.prototype.init = function () {
this.store = _utils.default.extend(true, {}, defaults, fetchCanonicalURL(), fetchDeclaritiveConfig());
this.store = utils.extend(true, {}, defaults, fetchCanonicalURL(), fetchDeclaritiveConfig());
return this.store;

@@ -172,9 +164,4 @@ };

const config = new Config();
var _default = config.access.bind(config);
exports.default = _default;
const init = config.init.bind(config);
exports.init = init;
const clear = config.clear.bind(config);
exports.clear = clear;
module.exports = config.access.bind(config);
module.exports.init = config.init.bind(config);
module.exports.clear = config.clear.bind(config);
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function Api() {

@@ -90,5 +85,2 @@ this.data = [];

var _default = new Api();
exports.default = _default;
module.exports = exports.default;
module.exports = new Api();
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/* eslint new-cap: 0 */
const utils = require("../utils");
var _utils = _interopRequireDefault(require("../utils"));
const config = require("../config");
var _config = _interopRequireDefault(require("../config"));
var _domDelegate = require("dom-delegate");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint new-cap: 0 */
const Delegate = require("dom-delegate");
/**

@@ -23,2 +14,4 @@ * The Krux class defines an FT.ads.krux instance

*/
function Krux() {

@@ -29,3 +22,3 @@ this.customAttributes = {};

Krux.prototype.add = function (target) {
_utils.default.extend(true, this.customAttributes, target);
utils.extend(true, this.customAttributes, target);
};

@@ -47,3 +40,3 @@

Krux.prototype.init = function (targeting) {
this.config = (0, _config.default)('krux');
this.config = config('krux');

@@ -67,5 +60,4 @@ if (this.config && this.config.id) {

let src;
const m = utils.getLocation().match(/\bkxsrc=([^&]+)/);
const m = _utils.default.getLocation().match(/\bkxsrc=([^&]+)/);
if (m) {

@@ -78,4 +70,4 @@ src = decodeURIComponent(m[1]);

const loadKruxScript = () => {
this.kruxScript = _utils.default.attach(finalSrc, true, () => {
_utils.default.broadcast('kruxScriptLoaded');
this.kruxScript = utils.attach(finalSrc, true, () => {
utils.broadcast('kruxScriptLoaded');
});

@@ -93,4 +85,3 @@ this.events.init();

targeting.add(this.targeting());
_utils.default.on('kruxScriptLoaded', this.consents);
utils.on('kruxScriptLoaded', this.consents);
} else {// can't initialize Krux because no Krux ID is configured, please add it as key id in krux config.

@@ -114,4 +105,4 @@ }

value = localStorage.getItem(name);
} else if (_utils.default.cookie(name)) {
value = _utils.default.cookie(name);
} else if (utils.cookie(name)) {
value = utils.cookie(name);
}

@@ -149,4 +140,4 @@

if ((0, _config.default)('krux').limit) {
segs = segs.slice(0, (0, _config.default)('krux').limit);
if (config('krux').limit) {
segs = segs.slice(0, config('krux').limit);
}

@@ -188,3 +179,3 @@ }

window.addEventListener('load', function () {
const delEvnt = new _domDelegate.Delegate(document.body);
const delEvnt = new Delegate(document.body);

@@ -207,3 +198,3 @@ for (const kEvnt in config) {

if (id) {
attrs = _utils.default.isPlainObject(attrs) ? attrs : {};
attrs = utils.isPlainObject(attrs) ? attrs : {};
return window.Krux('admEvent', id, attrs); // eslint-disable-line new-cap

@@ -217,11 +208,11 @@ }

let event;
const configured = (0, _config.default)('krux') && (0, _config.default)('krux').events;
const configured = config('krux') && config('krux').events;
/* istanbul ignore else */
if (_utils.default.isPlainObject(configured)) {
if (utils.isPlainObject(configured)) {
for (event in configured) {
/* istanbul ignore else */
if (_utils.default.isFunction(this[event])) {
if (utils.isFunction(this[event])) {
this[event](configured[event]);
} else if (_utils.default.isFunction(configured[event].fn)) {
} else if (utils.isFunction(configured[event].fn)) {
configured[event].fn(configured[event]);

@@ -263,3 +254,3 @@ }

Krux.prototype.consents = function () {
if ((0, _config.default)('krux') && (0, _config.default)('krux').consentState) {
if (config('krux') && config('krux').consentState) {
const kuid = localStorage && localStorage.getItem('kxkuid');

@@ -271,3 +262,3 @@

timeout: 2000
}).catch(() => Promise.resolve(_utils.default.log.warn('Fetch request failed to GET krux consent api')));
}).catch(() => Promise.resolve(utils.log.warn('Fetch request failed to GET krux consent api')));
} else {

@@ -289,3 +280,3 @@ window.setTimeout(Krux.prototype.consents.bind(Krux), 1000);

Krux.prototype.debug = function () {
const log = _utils.default.log;
const log = utils.log;

@@ -303,4 +294,3 @@ if (!this.config) {

const attrs = _utils.default.extend(true, this.config.attributes, this.customAttributes);
const attrs = utils.extend(true, this.config.attributes, this.customAttributes);
const keys = Object.keys(attrs);

@@ -344,5 +334,2 @@

var _default = new Krux();
exports.default = _default;
module.exports = exports.default;
module.exports = new Krux();
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**

@@ -35,5 +30,2 @@ * we use a third party script from moat to determine invalid traffic.

var _default = new Moat();
exports.default = _default;
module.exports = exports.default;
module.exports = new Moat();
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const utils = require("./utils");
var _utils = _interopRequireDefault(require("./utils"));
const config = require("./config");
var _config = _interopRequireDefault(require("./config"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const VALID_SIZE_STRINGS = ['fluid'];

@@ -22,3 +15,3 @@ const VALID_COLLAPSE_MODES = ['before', 'after', 'never'];

/* istanbul ignore else */
else if (_utils.default.isArray(_sizes)) {
else if (utils.isArray(_sizes)) {
const regex = /(\d+)x(\d+)/;

@@ -42,4 +35,4 @@ value.split(',').filter(size => size.length).forEach(size => {

} else {
const mapping = (0, _config.default)().formats;
const formats = _utils.default.isArray(value) ? value : value.split(',');
const mapping = config().formats;
const formats = utils.isArray(value) ? value : value.split(',');
formats.forEach(format => {

@@ -49,3 +42,3 @@ if (mapping && mapping[format]) {

if (_utils.default.isArray(format.sizes[0]) || VALID_SIZE_STRINGS.indexOf(format.sizes[0]) >= 0) {
if (utils.isArray(format.sizes[0]) || VALID_SIZE_STRINGS.indexOf(format.sizes[0]) >= 0) {
format.sizes.forEach(size => {

@@ -58,3 +51,3 @@ sizes.push(size);

} else {
_utils.default.log.error(`Slot configured with unknown format ${format}`);
utils.log.error(`Slot configured with unknown format ${format}`);
}

@@ -70,3 +63,3 @@ });

if (!_utils.default.isPlainObject(sizes)) {
if (!utils.isPlainObject(sizes)) {
sizes = {};

@@ -82,3 +75,3 @@ }

if (!_utils.default.isPlainObject(sizes)) {
if (!utils.isPlainObject(sizes)) {
sizes = {};

@@ -94,6 +87,4 @@ }

targeting: function targeting(value, _targeting) {
value = _utils.default.hash(value, ';', '=');
_utils.default.extend(_targeting, value);
value = utils.hash(value, ';', '=');
utils.extend(_targeting, value);
return _targeting;

@@ -115,4 +106,3 @@ },

if (isUnknownAttribute) {
_utils.default.log.warn(`Invalid attribute ${value} used for collapse-empty attribute, please use 'before', 'after' or 'never'`);
utils.log.warn(`Invalid attribute ${value} used for collapse-empty attribute, please use 'before', 'after' or 'never'`);
return undefined;

@@ -151,5 +141,5 @@ }

const renderEvent = 'rendered';
const cfg = (0, _config.default)();
let slotConfig = (0, _config.default)('slots') || {};
const disableSwipeDefault = (0, _config.default)('disableSwipeDefault') || false; // store the container
const cfg = config();
let slotConfig = config('slots') || {};
const disableSwipeDefault = config('disableSwipeDefault') || false; // store the container

@@ -189,5 +179,5 @@ this.container = container; // the current responsive screensize

if (_utils.default.isArray(slotConfig.formats)) {
if (utils.isArray(slotConfig.formats)) {
attributeParsers.formats(slotConfig.formats, this.sizes);
} else if (_utils.default.isPlainObject(slotConfig.formats)) {
} else if (utils.isPlainObject(slotConfig.formats)) {
this.sizes = {};

@@ -202,3 +192,3 @@ Object.keys(slotConfig.formats).forEach(screenName => {

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

@@ -209,3 +199,3 @@

if (outerEl && cfg.displayLabelWithBorders && this.container.getAttribute('data-o-ads-label')) {
_utils.default.once(renderEvent, () => {
utils.once(renderEvent, () => {
outerEl.classList.add('o-ads--label-with-borders');

@@ -219,5 +209,4 @@ });

if (!this.sizes.length && !_utils.default.isPlainObject(this.sizes)) {
_utils.default.log.error('slot %s has no configured sizes!', this.name);
if (!this.sizes.length && !utils.isPlainObject(this.sizes)) {
utils.log.error('slot %s has no configured sizes!', this.name);
return false;

@@ -240,4 +229,3 @@ } // Either retrieve the existing IntersectionObserver, or tell slots.js to create a new one.

Array.from(this.container.attributes).forEach(attribute => {
const name = _utils.default.parseAttributeName(attribute.name);
const name = utils.parseAttributeName(attribute.name);
const value = attribute.value;

@@ -270,3 +258,3 @@

Array.from(this.container.attributes).forEach(attribute => {
attributes[_utils.default.parseAttributeName(attribute)] = attribute.value;
attributes[utils.parseAttributeName(attribute)] = attribute.value;
});

@@ -290,3 +278,3 @@ this.attributes = attributes;

if (this.companion) {
_utils.default.once('masterLoaded', () => {
utils.once('masterLoaded', () => {
if (this.hasValidSize()) {

@@ -318,3 +306,3 @@ this.render();

/* istanbul ignore else */
if (_utils.default.isPlainObject(this.sizes)) {
if (utils.isPlainObject(this.sizes)) {
/* istanbul ignore else */

@@ -325,3 +313,3 @@ if (!this.hasValidSize()) {

_utils.default.on('breakpoint', onChangeBreakpoint, this.container);
utils.on('breakpoint', onChangeBreakpoint, this.container);
}

@@ -376,5 +364,3 @@

document.body.classList.add(`o-ads-no-${this.name}`);
_utils.default.broadcast('collapsed', this);
utils.broadcast('collapsed', this);
return this;

@@ -408,3 +394,3 @@ };

/* istanbul ignore else */
if (_utils.default.isFunction(this['clearSlot'])) {
if (utils.isFunction(this['clearSlot'])) {
this.clearSlot();

@@ -422,5 +408,4 @@ }

/* istanbul ignore else */
if (_utils.default.isFunction(this['destroySlot'])) {
_utils.default.off('breakpoint', onChangeBreakpoint, this.container);
if (utils.isFunction(this['destroySlot'])) {
utils.off('breakpoint', onChangeBreakpoint, this.container);
this.destroySlot();

@@ -439,3 +424,3 @@ this.container.removeChild(this.outer);

/* istanbul ignore else */
if (_utils.default.isFunction(this['submitGptImpression'])) {
if (utils.isFunction(this['submitGptImpression'])) {
this.submitGptImpression();

@@ -457,8 +442,7 @@ }

if (_utils.default.isPlainObject(data)) {
_utils.default.extend(details, data);
if (utils.isPlainObject(data)) {
utils.extend(details, data);
}
_utils.default.broadcast(name, details, this.container);
utils.broadcast(name, details, this.container);
return this;

@@ -490,3 +474,3 @@ };

if (screensize && _utils.default.isPlainObject(this.sizes)) {
if (screensize && utils.isPlainObject(this.sizes)) {
return this.sizes[screensize] !== false;

@@ -523,3 +507,3 @@ }

if (className && !(0, _config.default)('displayLabelWithBorders')) {
if (className && !config('displayLabelWithBorders')) {
this.container.classList.add(`o-ads--${className}`);

@@ -531,4 +515,2 @@ }

var _default = Slot;
exports.default = _default;
module.exports = exports.default;
module.exports = Slot;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/* eslint no-inner-declarations: 1 */
const utils = require("./utils");
var _utils = _interopRequireDefault(require("./utils"));
const config = require("./config");
var _config = _interopRequireDefault(require("./config"));
const Slot = require("./slot");
var _slot = _interopRequireDefault(require("./slot"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint no-inner-declarations: 1 */
let screensize = null;

@@ -33,5 +26,5 @@ /**

if (_utils.default.isNonEmptyString(names)) {
if (utils.isNonEmptyString(names)) {
slots.push(names);
} else if (_utils.default.isArray(names)) {
} else if (utils.isArray(names)) {
slots = names;

@@ -42,3 +35,3 @@ }

if (_utils.default.isFunction(callback)) {
if (utils.isFunction(callback)) {
callback.call(this, slots);

@@ -60,13 +53,13 @@ }

if (slot) {
if (_utils.default.isFunction(slot[action])) {
if (utils.isFunction(slot[action])) {
slot[action]();
} else {
if (_utils.default.isFunction(slot.fire)) {
if (utils.isFunction(slot.fire)) {
slot.fire(action);
} else {
_utils.default.log.warn('Attempted to %s on a non-slot %s', action, name);
utils.log.warn('Attempted to %s on a non-slot %s', action, name);
}
}
} else {
_utils.default.log.warn('Attempted to %s non-existant slot %s', action, name);
utils.log.warn('Attempted to %s non-existant slot %s', action, name);
}

@@ -80,3 +73,3 @@ }

const formats = (0, _config.default)('formats');
const formats = config('formats');

@@ -87,3 +80,3 @@ for (const prop in formats) {

let sizes = formats[prop].sizes;
sizes = _utils.default.isArray(sizes[0]) ? sizes : [sizes];
sizes = utils.isArray(sizes[0]) ? sizes : [sizes];
const match = sizes.filter(function (s) {

@@ -160,3 +153,3 @@ return s[0] === parseInt(size[0], 10) && s[1] === parseInt(size[1], 10);

// find the element and remove the ID in favour of a data attribute
if (_utils.default.isString(container)) {
if (utils.isString(container)) {
container = document.getElementById(container) || document.querySelector(`[data-o-ads-name="${container}"]`);

@@ -171,5 +164,4 @@

if (!_utils.default.isElement(container)) {
_utils.default.log.error('slot container must be an element!', container);
if (!utils.isElement(container)) {
utils.log.error('slot container must be an element!', container);
return false;

@@ -181,3 +173,3 @@ } // add the aria hidden attribute

const slot = new _slot.default(container, screensize, this.initLazyLoading.bind(this));
const slot = new Slot(container, screensize, this.initLazyLoading.bind(this));
/* istanbul ignore else */

@@ -189,3 +181,3 @@

} else if (this[slot.name]) {
_utils.default.log.error('slot %s is already defined!', slot.name);
utils.log.error('slot %s is already defined!', slot.name);
}

@@ -197,4 +189,4 @@

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

@@ -226,3 +218,3 @@ /* istanbul ignore else */

Slots.prototype.initRendered = function () {
_utils.default.on('rendered', function (slots, event) {
utils.on('rendered', function (slots, event) {
const slot = slots[event.detail.name];

@@ -232,4 +224,3 @@ /* istanbul ignore else */

if (slot) {
_utils.default.extend(slot[slot.server], event.detail[slot.server]);
utils.extend(slot[slot.server], event.detail[slot.server]);
const size = event.detail.gpt.size;

@@ -242,3 +233,2 @@ const format = findFormatBySize(size);

}.bind(null, this));
return this;

@@ -252,7 +242,7 @@ };

Slots.prototype.initResponsive = function () {
const breakpoints = (0, _config.default)('responsive');
const breakpoints = config('responsive');
/* istanbul ignore else */
if (_utils.default.isObject(breakpoints)) {
screensize = _utils.default.responsive(breakpoints, onBreakpointChange.bind(null, this));
if (utils.isObject(breakpoints)) {
screensize = utils.responsive(breakpoints, onBreakpointChange.bind(null, this));
}

@@ -298,6 +288,5 @@

function pmHandler(slots, event) {
const data = _utils.default.messenger.parse(event.data);
const data = utils.messenger.parse(event.data);
/* istanbul ignore else don't process messages with a non oAds type*/
if (data.type && (/^oAds\./.test(data.type) || /^touch/.test(data.type))) {

@@ -312,5 +301,3 @@ const type = data.type.replace('oAds\.', '');

};
const slotName = _utils.default.iframeToSlotName(event.source.window);
const slotName = utils.iframeToSlotName(event.source.window);
slot = slots[slotName] || false;

@@ -344,11 +331,9 @@

messageToSend.sizes = slot.sizes;
_utils.default.messenger.post(messageToSend, event.source);
utils.messenger.post(messageToSend, event.source);
} else {
_utils.default.log.error('Message received from unidentified slot');
utils.log.error('Message received from unidentified slot');
}
} else {
if (!slot) {
_utils.default.log.error('Message received from unidentified slot');
utils.log.error('Message received from unidentified slot');
return;

@@ -359,3 +344,3 @@ }

slot.setResponsiveCreative(true);
} else if (_utils.default.isFunction(slot[type])) {
} else if (utils.isFunction(slot[type])) {
slot[type]();

@@ -383,3 +368,3 @@ } else if (/^touch/.test(data.type)) {

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

@@ -391,25 +376,25 @@ this.flushLazyLoading(); // find any pre-existing observers

return lazyLoadingConfig.root == observer.root; // eslint-disable-line eqeqeq
});
}); // If we don't already have an instance of the observer, and it is enabled globally or on a slot (force), then create one.
function onChange(changes) {
//Execute the changes in the order they appear on the page. This is because the top slot often determines what the lower slots display.
/* istanbul ignore else */
/* istanbul ignore next */
changes.filter(a => a.intersectionRect.height || a.intersectionRect.width || a.intersectionRect.top || a.intersectionRect.left).sort((a, b) => a.intersectionRect.top - b.intersectionRect.top).forEach(change => {
const slotName = change.target.getAttribute('data-o-ads-name');
/* istanbul ignore else */
if ('IntersectionObserver' in window && !lazyLoadingObserver && Boolean(lazyLoadingConfig)) {
const options = {};
if (slotName) {
invokeMethodOnSlots.call(this, slotName, 'render');
}
});
} // If we don't already have an instance of the observer, and it is enabled globally or on a slot (force), then create one.
function onChange(changes) {
//Execute the changes in the order they appear on the page. This is because the top slot often determines what the lower slots display.
/* istanbul ignore else */
/* istanbul ignore next */
changes.filter(a => a.intersectionRect.height || a.intersectionRect.width || a.intersectionRect.top || a.intersectionRect.left).sort((a, b) => a.intersectionRect.top - b.intersectionRect.top).forEach(change => {
const slotName = change.target.getAttribute('data-o-ads-name');
/* istanbul ignore else */
if ('IntersectionObserver' in window && !lazyLoadingObserver && Boolean(lazyLoadingConfig)) {
const options = {};
if (slotName) {
invokeMethodOnSlots.call(this, slotName, 'render');
}
});
}
/* istanbul ignore else */
if (typeof lazyLoadingConfig === 'object') {

@@ -442,3 +427,3 @@ /* istanbul ignore else */

if (slot instanceof _slot.default) {
if (slot instanceof Slot) {
fn.call(this, slot);

@@ -463,3 +448,3 @@ }

Slots.prototype.debug = function () {
const log = _utils.default.log;
const log = utils.log;
const data = [];

@@ -472,4 +457,4 @@ this.forEach(function (slot) {

'line item id': slot.gpt.lineItemId || 'N/A',
size: _utils.default.isArray(slot.gpt.size) && slot.gpt.size.join('×') || slot.gpt.isEmpty && 'empty' || 'N/A',
sizes: _utils.default.isArray(slot.sizes) && slot.sizes.map(function (item) {
size: utils.isArray(slot.gpt.size) && slot.gpt.size.join('×') || slot.gpt.isEmpty && 'empty' || 'N/A',
sizes: utils.isArray(slot.sizes) && slot.sizes.map(function (item) {
return item.join('×');

@@ -488,5 +473,2 @@ }).join(', ') || 'responsive slot',

var _default = new Slots();
exports.default = _default;
module.exports = exports.default;
module.exports = new Slots();
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const config = require("./config");
var _config = _interopRequireDefault(require("./config"));
const utils = require("./utils");
var _utils = _interopRequireDefault(require("./utils"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let parameters = {};

@@ -25,9 +18,8 @@

};
utils.extend(parameters, this.getFromConfig(), this.searchTerm(), this.socialFlow(), this.getVersion());
_utils.default.extend(parameters, this.getFromConfig(), this.searchTerm(), this.socialFlow(), this.getVersion());
for (const item in methods) {
/* istanbul ignore else */
if (methods.hasOwnProperty(item)) {
_utils.default.extend(parameters, methods[item]());
utils.extend(parameters, methods[item]());
}

@@ -41,4 +33,4 @@ }

/* istanbul ignore else */
if (_utils.default.isPlainObject(obj)) {
_utils.default.extend(parameters, obj);
if (utils.isPlainObject(obj)) {
utils.extend(parameters, obj);
}

@@ -64,8 +56,8 @@ };

Targeting.prototype.getFromConfig = function () {
let targeting = (0, _config.default)('dfp_targeting') || {};
let targeting = config('dfp_targeting') || {};
if (!_utils.default.isPlainObject(targeting)) {
if (!utils.isPlainObject(targeting)) {
/* istanbul ignore else */
if (_utils.default.isString(targeting)) {
targeting = _utils.default.hash(targeting, ';', '=');
if (utils.isString(targeting)) {
targeting = utils.hash(targeting, ';', '=');
}

@@ -78,5 +70,5 @@ }

Targeting.prototype.getVersion = function () {
if ((0, _config.default)('passOAdsVersion')) {
if (config('passOAdsVersion')) {
return {
OADS_VERSION: _utils.default.getVersion()
OADS_VERSION: utils.getVersion()
};

@@ -92,3 +84,3 @@ }

Targeting.prototype.socialFlow = function () {
const sf = _utils.default.getQueryParamByName('socialflow');
const sf = utils.getQueryParamByName('socialflow');

@@ -104,6 +96,4 @@ if (sf) {

let codedValue;
const referrer = utils.getReferrer(); // TODO: add on.ft.com
const referrer = _utils.default.getReferrer(); // TODO: add on.ft.com
const lookup = {

@@ -131,4 +121,3 @@ 't.co': 'twi',

Targeting.prototype.searchTerm = function () {
const qs = _utils.default.hash(_utils.default.getQueryString(), /\&|\;/, '=');
const qs = utils.hash(utils.getQueryString(), /\&|\;/, '=');
let keywords = qs.q || qs.s || qs.query || qs.queryText || qs.searchField || undefined;

@@ -148,3 +137,3 @@ /* istanbul ignore else */

return {
ts: _utils.default.getTimestamp()
ts: utils.getTimestamp()
};

@@ -154,4 +143,4 @@ };

Targeting.prototype.responsive = function () {
return (0, _config.default)('responsive') ? {
res: _utils.default.responsive.getCurrent()
return config('responsive') ? {
res: utils.responsive.getCurrent()
} : {};

@@ -161,3 +150,3 @@ };

Targeting.prototype.debug = function () {
const log = _utils.default.log;
const log = utils.log;
const parameters = this.get();

@@ -173,5 +162,2 @@ /* istanbul ignore else */

var _default = new Targeting();
exports.default = _default;
module.exports = exports.default;
module.exports = new Targeting();
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.broadcast = broadcast;
exports.on = on;
exports.off = off;
exports.once = once;
/**

@@ -24,2 +16,4 @@ * Utility methods for o-ads events. Methods defined here are added to the utils object not the utils.event object.

*/
module.exports.broadcast = broadcast;
function broadcast(name, data, target) {

@@ -44,2 +38,4 @@ /* istanbul ignore next: ignore the final fallback as hard trigger */

module.exports.on = on;
function on(name, callback, target) {

@@ -60,2 +56,4 @@ name = `oAds.${name}`;

module.exports.off = off;
function off(name, callback, target) {

@@ -76,2 +74,4 @@ name = `oAds.${name}`;

module.exports.once = once;
function once(name, callback, target) {

@@ -78,0 +78,0 @@ const handler = function handler(event) {

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.extend = extend;
exports.default = exports.getVersion = exports.cookie = exports.buildObjectFromArray = exports.iframeToSlotName = exports.getTimestamp = exports.getQueryParamByName = exports.getQueryString = exports.getLocation = exports.parseAttributeName = exports.dehyphenise = exports.getReferrer = exports.attach = exports.hash = exports.isElement = exports.isNonEmptyString = exports.isPlainObject = exports.isWindow = exports.isObject = exports.isStorage = exports.isFunction = exports.isString = exports.isArray = void 0;
var _events = require("./events");
var _messenger = _interopRequireDefault(require("./messenger"));
var _responsive = _interopRequireWildcard(require("./responsive"));
var _log = _interopRequireWildcard(require("./log"));
var _version = _interopRequireDefault(require("../version"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -29,11 +9,3 @@ * Utility methods for the advertising library.

const hop = Object.prototype.hasOwnProperty;
_responsive.default.getCurrent = _responsive.getCurrent;
_log.default.start = _log.start;
_log.default.end = _log.end;
_log.default.isOn = _log.isOn;
_log.default.info = _log.info;
_log.default.warn = _log.warn;
_log.default.error = _log.error;
_log.default.table = _log.table;
_log.default.attributeTable = _log.attributeTable;
const utils = module.exports;
/**

@@ -60,60 +32,35 @@ * Uses object prototype toString method to get at the type of object we are dealing,

/**
* Test if an object is an Array
* @param {object} obj The object to be tested
* @returns {boolean} true if the object is of type Array, otherwise false
* Creates a method for testing the type of an Object
* @private
* @param {string} The name of the object type to be tested e.g. Array
* @returns a method that takes any javascript object and tests if it is of
* the supplied className
*/
const isArray = function isArray(obj) {
return is(obj) === "Array";
};
function createIsTest(className) {
return function (obj) {
return is(obj) === className;
};
}
/**
* Test if an object is a String
* @param {object} obj The object to be tested
* @returns {boolean} true if the object is of type String, otherwise false
* Curries some useful is{ClassName} methods into the supplied Object
* @private
* @param {object} The object to add the methods too
* @param {array} A list of types to create methods for defaults to "Array", "Object", "String", "Function"
* @returns The object supplied in the first param with is{ClassName} Methods Added
*/
exports.isArray = isArray;
function curryIsMethods(obj, classNames) {
classNames = classNames || ['Array', 'Object', 'String', 'Function', 'Storage'];
const isString = function isString(obj) {
return is(obj) === "String";
};
/**
* Test if an object is a Function
* @param {object} obj The object to be tested
* @returns {boolean} true if the object is of type Function, otherwise false
*/
while (classNames.length) {
const className = classNames.pop();
obj[`is${className}`] = createIsTest(className);
}
exports.isString = isString;
const isFunction = function isFunction(obj) {
return is(obj) === "Function";
};
return obj;
}
/**
* Test if an object is a Storage object
* @param {object} obj The object to be tested
* @returns {boolean} true if the object is of type Storage, otherwise false
*/
exports.isFunction = isFunction;
const isStorage = function isStorage(obj) {
return is(obj) === "Storage";
};
/**
* Test if an object is an Object
* @param {object} obj The object to be tested
* @returns {boolean} true if the object is of type Object, otherwise false
*/
exports.isStorage = isStorage;
const isObject = function isObject(obj) {
return is(obj) === "Object";
};
/**
* Test if an object is the global window object

@@ -125,5 +72,3 @@ * @param {object} obj The object to be tested

exports.isObject = isObject;
const isWindow = function isWindow(obj) {
module.exports.isWindow = function (obj) {
return obj && obj !== null && obj === window;

@@ -140,5 +85,3 @@ };

exports.isWindow = isWindow;
const isPlainObject = function isPlainObject(obj) {
module.exports.isPlainObject = function (obj) {
const hop = Object.prototype.hasOwnProperty; // Must be an Object.

@@ -148,3 +91,3 @@ // Because of IE, we also have to check the presence of the constructor property.

if (!obj || !isObject(obj) || obj.nodeType || isWindow(obj)) {
if (!obj || !utils.isObject(obj) || obj.nodeType || utils.isWindow(obj)) {
return false;

@@ -180,16 +123,21 @@ }

exports.isPlainObject = isPlainObject;
const isNonEmptyString = function isNonEmptyString(str) {
return isString(str) && Boolean(str.length);
module.exports.isNonEmptyString = function (str) {
return utils.isString(str) && Boolean(str.length);
};
exports.isNonEmptyString = isNonEmptyString;
const isElement = function isElement(element) {
module.exports.isElement = function (element) {
return element && element.nodeType === 1 && element.tagName || false;
};
/**
* Merge or clone objects
* @function
* @param {boolean/object} deep/target If boolean specifies if this should be a deep copy or not, otherwise is the target object for the copy
* @param {object} target If deep copy is true will be the target object of the copy
* @param {object} objects All other params are objects to be merged into the target
* @returns {object} The target object extended with the other params
*/
exports.isElement = isElement;
module.exports.extend = extend;
function extend() {

@@ -219,3 +167,3 @@ /* jshint forin: false */

if (typeof target !== "object" && !isFunction(target)) {
if (typeof target !== "object" && !utils.isFunction(target)) {
target = {};

@@ -246,10 +194,10 @@ } // do nothing if only one argument is passed (or 2 for a deep copy)

if (deep && copy && (isPlainObject(copy) || isArray(copy))) {
copyIsArray = isArray(copy);
if (deep && copy && (utils.isPlainObject(copy) || utils.isArray(copy))) {
copyIsArray = utils.isArray(copy);
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
clone = src && utils.isArray(src) ? src : [];
} else {
clone = src && isObject(src) ? src : {};
clone = src && utils.isObject(src) ? src : {};
} // Never move original objects, clone them

@@ -281,6 +229,6 @@

const hash = function hash(str, delimiter, pairing) {
module.exports.hash = function (str, delimiter, pairing) {
let pair;
let value;
const hashObj = {};
const hash = {};

@@ -295,3 +243,3 @@ if (str && str.split) {

if (pair.length > 1) {
hashObj[pair[0].trim()] = pair.slice(1).join(pairing);
hash[pair[0].trim()] = pair.slice(1).join(pairing);
}

@@ -301,3 +249,3 @@ }

return hashObj;
return hash;
};

@@ -316,5 +264,3 @@ /**

exports.hash = hash;
const attach = function attach(scriptUrl, async, callback, errorcb, autoRemove) {
module.exports.attach = function (scriptUrl, async, callback, errorcb, autoRemove) {
const tag = document.createElement('script');

@@ -347,3 +293,3 @@ const node = document.getElementsByTagName('script')[0];

if (isFunction(callback)) {
if (utils.isFunction(callback)) {
/* istanbul ignore if - legacy IE code, won't test */

@@ -365,3 +311,3 @@ if (hop.call(tag, 'onreadystatechange')) {

if (isFunction(errorcb)) {
if (utils.isFunction(errorcb)) {
tag.onerror = function () {

@@ -385,5 +331,3 @@ processCallback(errorcb);

exports.attach = attach;
const getReferrer = function getReferrer() {
module.exports.getReferrer = function () {
return document.referrer || '';

@@ -398,5 +342,3 @@ };

exports.getReferrer = getReferrer;
const dehyphenise = function dehyphenise(string) {
module.exports.dehyphenise = function (string) {
return string.replace(/(-)([a-z])/g, function (match, hyphen, letter) {

@@ -413,7 +355,5 @@ return letter.toUpperCase();

exports.dehyphenise = dehyphenise;
const parseAttributeName = function parseAttributeName(attribute) {
const name = isString(attribute) ? attribute : attribute.name;
return dehyphenise(name.replace(/(data-)?o-ads-/, ''));
module.exports.parseAttributeName = function (attribute) {
const name = utils.isString(attribute) ? attribute : attribute.name;
return utils.dehyphenise(name.replace(/(data-)?o-ads-/, ''));
};

@@ -429,5 +369,3 @@ /**

exports.parseAttributeName = parseAttributeName;
const getLocation = function getLocation() {
module.exports.getLocation = function () {
return document.location.href || '';

@@ -443,5 +381,3 @@ };

exports.getLocation = getLocation;
const getQueryString = function getQueryString() {
module.exports.getQueryString = function () {
return document.location.search.substring(1) || '';

@@ -457,5 +393,3 @@ };

exports.getQueryString = getQueryString;
const getQueryParamByName = function getQueryParamByName(name, url) {
module.exports.getQueryParamByName = function (name, url) {
url = url || window.location.href;

@@ -482,5 +416,3 @@ name = name.replace(/[\[\]]/g, "\\$&");

exports.getQueryParamByName = getQueryParamByName;
const getTimestamp = function getTimestamp() {
module.exports.getTimestamp = function () {
const now = new Date();

@@ -498,5 +430,3 @@ return [now.getFullYear(), `0${now.getMonth() + 1}`.slice(-2), `0${now.getDate()}`.slice(-2), `0${now.getHours()}`.slice(-2), `0${now.getMinutes()}`.slice(-2), `0${now.getSeconds()}`.slice(-2)].join("");

exports.getTimestamp = getTimestamp;
const iframeToSlotName = function iframeToSlotName(iframeWindow) {
module.exports.iframeToSlotName = function (iframeWindow) {
// capture all iframes in the page in a live node list

@@ -535,5 +465,3 @@ const iframes = document.getElementsByTagName('iframe');

exports.iframeToSlotName = iframeToSlotName;
const buildObjectFromArray = function buildObjectFromArray(targetObject) {
module.exports.buildObjectFromArray = function buildObjectFromArray(targetObject) {
return targetObject.reduce((prev, data) => {

@@ -545,5 +473,3 @@ prev[data.key] = data.value;

exports.buildObjectFromArray = buildObjectFromArray;
const cookie = function cookie(name) {
module.exports.cookie = function (name) {
const val = document.cookie.match(`(^|;)\\s*${name}\\s*=\\s*([^;]+)`);

@@ -553,39 +479,8 @@ return val ? val.pop() : null;

exports.cookie = cookie;
module.exports.getVersion = () => require("../version.js") || 'UNKNOWN';
const getVersion = () => _version.default || 'UNKNOWN';
exports.getVersion = getVersion;
var _default = {
on: _events.on,
off: _events.off,
once: _events.once,
broadcast: _events.broadcast,
messenger: _messenger.default,
responsive: _responsive.default,
log: _log.default,
isArray,
isString,
isFunction,
isStorage,
isObject,
isWindow,
isPlainObject,
isNonEmptyString,
isElement,
extend,
hash,
attach,
getReferrer,
dehyphenise,
parseAttributeName,
getLocation,
getQueryString,
getQueryParamByName,
getTimestamp,
iframeToSlotName,
buildObjectFromArray,
cookie,
getVersion
};
exports.default = _default;
extend(module.exports, require("./events.js"));
extend(module.exports, require("./messenger.js"));
module.exports.responsive = require("./responsive.js");
module.exports.log = require("./log");
curryIsMethods(module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = log;
exports.attributeTable = exports.table = exports.end = exports.start = exports.info = exports.error = exports.warn = exports.isOn = void 0;
var _index = require("./index");
/* eslint no-console: 0 */

@@ -21,3 +13,3 @@

/* jshint devel: true */
module.exports = log;
/**

@@ -29,2 +21,3 @@ * Safe logger for the browser

*/
function log() {

@@ -54,3 +47,3 @@ let type;

const isOn = function isOn(type) {
module.exports.isOn = function (type) {
/* istanbul ignore else */

@@ -65,5 +58,3 @@ const debug = localStorage && localStorage.getItem('oAds') || location.search.indexOf('DEBUG=OADS') !== -1;

exports.isOn = isOn;
const warn = function warn() {
module.exports.warn = function () {
const args = ['warn'].concat([].slice.call(arguments, 0));

@@ -77,5 +68,3 @@ log.apply(null, args);

exports.warn = warn;
const error = function error() {
module.exports.error = function () {
const args = ['error'].concat([].slice.call(arguments, 0));

@@ -89,5 +78,3 @@ log.apply(null, args);

exports.error = error;
const info = function info() {
module.exports.info = function () {
const args = ['info'].concat([].slice.call(arguments, 0));

@@ -102,5 +89,3 @@ log.apply(null, args);

exports.info = info;
const start = function start(group) {
module.exports.start = function (group) {
if (!log.isOn('groupCollapsed')) {

@@ -117,5 +102,3 @@ return;

exports.start = start;
const end = function end() {
module.exports.end = function () {
if (!log.isOn('groupEnd')) {

@@ -128,5 +111,3 @@ return;

exports.end = end;
const table = function table(data, columns) {
module.exports.table = function (data, columns) {
if (log.isOn('log') && window.console) {

@@ -141,5 +122,5 @@ if (console.table) {

exports.table = table;
module.exports.attributeTable = function (object, columns) {
const utils = require("../utils");
const attributeTable = function attributeTable(object, columns) {
if (log.isOn('log') && window.console) {

@@ -150,3 +131,3 @@ if (object && console.table) {

if ((0, _index.isArray)(object[item]) || (0, _index.isObject)(object[item])) {
if (utils.isArray(object[item]) || utils.isObject(object[item])) {
val = JSON.stringify(object[item]);

@@ -167,4 +148,2 @@ } else {

}
};
exports.attributeTable = attributeTable;
};
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**

@@ -13,3 +8,3 @@ * Utility methods for postMessage api.

*/
var _default = {
module.exports.messenger = {
post: function post(message, source) {

@@ -34,4 +29,2 @@ message = typeof message === 'string' ? message : JSON.stringify(message);

}
};
exports.default = _default;
module.exports = exports.default;
};
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCurrent = getCurrent;
exports.default = init;
exports.setThrottleInterval = void 0;
var _index = _interopRequireDefault(require("./index"));
var _oViewport = _interopRequireDefault(require("@financial-times/o-viewport"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let callback;

@@ -20,7 +7,10 @@ let breakpoints;

const utils = require("./index.js");
const oViewport = require("@financial-times/o-viewport");
function getNearestBreakpoint() {
let winner;
const dims = oViewport.getSize(true);
const dims = _oViewport.default.getSize(true);
function findCurrentBreakpoint(breakpoint) {

@@ -58,3 +48,3 @@ const breakpointDims = breakpoints[breakpoint];

function init(brps, cb) {
if (!_index.default.isFunction(cb)) {
if (!utils.isFunction(cb)) {
// must have a call back function

@@ -69,11 +59,9 @@ return false;

document.body.addEventListener('oViewport.resize', fire);
_oViewport.default.listenTo('orientation');
_oViewport.default.listenTo('resize');
oViewport.listenTo('orientation');
oViewport.listenTo('resize');
return getCurrent();
}
const setThrottleInterval = _oViewport.default.setThrottleInterval;
exports.setThrottleInterval = setThrottleInterval;
module.exports = init;
module.exports.getCurrent = getCurrent;
module.exports.setThrottleInterval = oViewport.setThrottleInterval;
"use strict";
// generated by genversion
module.exports = '10.2.4';
module.exports = '10.2.5';

@@ -6,5 +6,6 @@ {

"dist/",
"index.js",
"browser.js",
"src/",
"main*",
"!src/**/*.js",
"main.scss",
"img",

@@ -26,3 +27,3 @@ "*.json",

"name": "@financial-times/o-ads",
"version": "10.2.4",
"version": "10.2.5",
"dependencies": {

@@ -85,4 +86,3 @@ "dom-delegate": "^2.0.3",

"webpack": "^4.26.1"
},
"main": "main.js"
}
}
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