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.3 to 10.2.4

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 */

@@ -10,16 +35,15 @@ 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 = 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");
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;
/**

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

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

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

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

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

const ads = new Ads();
module.exports = ads;
var _default = ads;
exports.default = _default;
module.exports = exports.default;
"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 */

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

* @fileOverview
* ad server modukes for o-ads implementing Google publisher tags ad requests.
* ad server modules 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';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -564,2 +577,12 @@ 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

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

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

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

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

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

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

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

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

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

const config = new Config();
module.exports = config.access.bind(config);
module.exports.init = config.init.bind(config);
module.exports.clear = config.clear.bind(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;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function Api() {

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

module.exports = new Api();
var _default = new Api();
exports.default = _default;
module.exports = exports.default;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _utils = _interopRequireDefault(require("../utils"));
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 utils = require("../utils");
const config = require("../config");
const Delegate = require("dom-delegate");
/**

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

*/
function Krux() {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -153,3 +160,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.isString(container)) {
if (_utils.default.isString(container)) {
container = document.getElementById(container) || document.querySelector(`[data-o-ads-name="${container}"]`);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

function pmHandler(slots, event) {
const data = utils.messenger.parse(event.data);
const data = _utils.default.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))) {

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

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

@@ -331,10 +344,11 @@

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

@@ -345,3 +359,3 @@ }

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

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

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

@@ -377,25 +391,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 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 (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.
/* istanbul ignore else */
if ('IntersectionObserver' in window && !lazyLoadingObserver && Boolean(lazyLoadingConfig)) {
const options = {};
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 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 (slotName) {
invokeMethodOnSlots.call(this, slotName, 'render');
}
});
}
/* istanbul ignore else */
if (typeof lazyLoadingConfig === 'object') {

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

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

@@ -449,3 +463,3 @@ }

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

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

'line item id': slot.gpt.lineItemId || 'N/A',
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) {
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) {
return item.join('×');

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

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

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

};
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.extend(parameters, methods[item]());
_utils.default.extend(parameters, methods[item]());
}

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

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

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

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

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

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

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

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

@@ -96,4 +104,6 @@ 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 = {

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

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

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

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

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

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

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

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

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

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

@@ -16,4 +24,2 @@ * 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) {

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

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

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

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

@@ -74,4 +76,2 @@ 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 }; }
/**

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

const hop = Object.prototype.hasOwnProperty;
const utils = module.exports;
_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;
/**

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

/**
* 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
* 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
*/
function createIsTest(className) {
return function (obj) {
return is(obj) === className;
};
}
const isArray = function isArray(obj) {
return is(obj) === "Array";
};
/**
* 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
* 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
*/
function curryIsMethods(obj, classNames) {
classNames = classNames || ['Array', 'Object', 'String', 'Function', 'Storage'];
exports.isArray = isArray;
while (classNames.length) {
const className = classNames.pop();
obj[`is${className}`] = createIsTest(className);
}
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
*/
return obj;
}
exports.isString = isString;
const isFunction = function isFunction(obj) {
return is(obj) === "Function";
};
/**
* 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

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

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

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

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

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

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

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

module.exports.isNonEmptyString = function (str) {
return utils.isString(str) && Boolean(str.length);
exports.isPlainObject = isPlainObject;
const isNonEmptyString = function isNonEmptyString(str) {
return isString(str) && Boolean(str.length);
};
module.exports.isElement = function (element) {
exports.isNonEmptyString = isNonEmptyString;
const isElement = function isElement(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() {

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

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

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

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

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

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

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

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

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

return hash;
return hashObj;
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -430,3 +498,5 @@ 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("");

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

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

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

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

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

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

module.exports.getVersion = () => require("../version.js") || 'UNKNOWN';
exports.cookie = cookie;
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);
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;
"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 */

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

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

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

*/
function log() {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -29,2 +34,4 @@ 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;

@@ -7,10 +20,7 @@ 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) {

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

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

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

document.body.addEventListener('oViewport.resize', fire);
oViewport.listenTo('orientation');
oViewport.listenTo('resize');
_oViewport.default.listenTo('orientation');
_oViewport.default.listenTo('resize');
return getCurrent();
}
module.exports = init;
module.exports.getCurrent = getCurrent;
module.exports.setThrottleInterval = oViewport.setThrottleInterval;
const setThrottleInterval = _oViewport.default.setThrottleInterval;
exports.setThrottleInterval = setThrottleInterval;
"use strict";
// generated by genversion
module.exports = '10.2.3';
module.exports = '10.2.4';
/* eslint valid-jsdoc: 0 */
import config, { init, clear } from './src/js/config';
import slots from './src/js/slots';
import gpt from './src/js/ad-servers/gpt';
import krux from './src/js/data-providers/krux';
import api from './src/js/data-providers/api';
import moat from './src/js/data-providers/moat';
import targeting from './src/js/targeting';
import utils from './src/js/utils';

@@ -11,14 +19,15 @@ function Ads() {

config.init = init;
config.clear = clear;
// bung all our modules on the protoype
Ads.prototype.config = require('./src/js/config');
Ads.prototype.slots = require('./src/js/slots');
Ads.prototype.gpt = require('./src/js/ad-servers/gpt');
Ads.prototype.krux = require('./src/js/data-providers/krux');
Ads.prototype.api = require('./src/js/data-providers/api');
Ads.prototype.moat = require('./src/js/data-providers/moat');
const targeting = require('./src/js/targeting');
Ads.prototype.config = config;
Ads.prototype.slots = slots;
Ads.prototype.gpt = gpt;
Ads.prototype.krux = krux;
Ads.prototype.api = api;
Ads.prototype.moat = moat;
Ads.prototype.targeting = targeting;
Ads.prototype.utils = require('./src/js/utils');
Ads.prototype.utils = utils;

@@ -33,5 +42,6 @@

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

@@ -175,2 +185,2 @@ if (options.disableConsentCookie) {

const ads = new Ads();
module.exports = ads;
export default ads;

@@ -25,3 +25,3 @@ {

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

@@ -28,0 +28,0 @@ "dom-delegate": "^2.0.3",

@@ -6,9 +6,9 @@ /*globals googletag: true */

* @fileOverview
* ad server modukes for o-ads implementing Google publisher tags ad requests.
* ad server modules 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');
import config from '../config';
import utils from '../utils';
import targeting from '../targeting';
const DEFAULT_COLLAPSE_MODE = 'never';

@@ -408,12 +408,12 @@ let breakpoints = false;

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

@@ -499,8 +499,3 @@ /* istanbul ignore else */

module.exports.init = init;
module.exports.updateCorrelator = updateCorrelator;
module.exports.updatePageTargeting = updatePageTargeting;
module.exports.clearPageTargetingForKey = clearPageTargetingForKey;
module.exports.debug = () => {
function debug() {
const log = utils.log;

@@ -515,2 +510,9 @@ const conf = config('gpt');

log.end();
}
export default {
init,
updateCorrelator,
updatePageTargeting,
clearPageTargetingForKey,
debug
};

@@ -24,3 +24,4 @@ //TODO remove all ft.com specific stuff so we can remove this as a global

*/
const utils = require('./utils');
import utils from './utils';
/**

@@ -125,4 +126,4 @@ * Default configuration set in the constructor.

const config = new Config();
module.exports = config.access.bind(config);
module.exports.init = config.init.bind(config);
module.exports.clear = config.clear.bind(config);
export default config.access.bind(config);
export const init = config.init.bind(config);
export const clear = config.clear.bind(config);

@@ -85,2 +85,2 @@

module.exports = new Api();
export default new Api();
/* eslint new-cap: 0 */
const utils = require('../utils');
const config = require('../config');
const Delegate = require('ftdomdelegate');
import utils from '../utils';
import config from '../config';
import { Delegate } from 'ftdomdelegate';

@@ -303,2 +303,2 @@ /**

module.exports = new Krux();
export default new Krux();

@@ -27,2 +27,2 @@ /**

module.exports = new Moat();
export default new Moat();

@@ -1,3 +0,3 @@

const utils = require('./utils');
const config = require('./config');
import utils from './utils';
import config from './config';

@@ -468,2 +468,2 @@ const VALID_SIZE_STRINGS = ['fluid'];

module.exports = Slot;
export default Slot;
/* eslint no-inner-declarations: 1 */
const utils = require('./utils');
const config = require('./config');
const Slot = require('./slot');
import utils from './utils';
import config from './config';
import Slot from './slot';

@@ -287,3 +287,2 @@ let screensize = null;

utils.log.error('Message received from unidentified slot');
utils.messenger.post(messageToSend, event.source);
}

@@ -330,2 +329,16 @@ } else {

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 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(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.

@@ -336,16 +349,2 @@ /* istanbul ignore else */

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 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(slotName) {
invokeMethodOnSlots.call(this, slotName, 'render');
}
});
}
/* istanbul ignore else */

@@ -415,2 +414,2 @@ if(typeof lazyLoadingConfig === 'object') {

module.exports = new Slots();
export default new Slots();

@@ -1,4 +0,3 @@

const config = require('./config');
const utils = require('./utils');
import config from './config';
import utils from './utils';
let parameters = {};

@@ -142,2 +141,2 @@ function Targeting() {} //eslint-disable-line no-empty-function

module.exports = new Targeting();
export default new Targeting();

@@ -14,4 +14,3 @@ /**

*/
module.exports.broadcast = broadcast;
function broadcast(name, data, target) {
export function broadcast(name, data, target) {
/* istanbul ignore next: ignore the final fallback as hard trigger */

@@ -34,5 +33,3 @@ target = target || document.body || document.documentElement;

*/
module.exports.on = on;
function on(name, callback, target) {
export function on(name, callback, target) {
name = `oAds.${name}`;

@@ -50,4 +47,3 @@ /* istanbul ignore next: ignore the final fallback as hard trigger */

*/
module.exports.off = off;
function off(name, callback, target) {
export function off(name, callback, target) {
name = `oAds.${name}`;

@@ -65,4 +61,3 @@ /* istanbul ignore next: ignore the final fallback as hard trigger */

*/
module.exports.once = once;
function once(name, callback, target) {
export function once(name, callback, target) {
const handler = function(event) {

@@ -69,0 +64,0 @@ /* istanbul ignore next: ignore the final fallback as hard trigger */

@@ -0,1 +1,7 @@

import { on, off, once, broadcast } from './events';
import messenger from './messenger';
import responsive, { getCurrent } from './responsive';
import log, { isOn, start, end, info, warn, error, table, attributeTable} from './log';
import version from '../version';
/**

@@ -8,3 +14,14 @@ * Utility methods for the advertising library.

const utils = module.exports;
responsive.getCurrent = getCurrent;
log.start = start;
log.end = end;
log.isOn = isOn;
log.info = info;
log.warn = warn;
log.error = error;
log.table = table;
log.attributeTable = attributeTable;
/**

@@ -31,40 +48,53 @@ * Uses object prototype toString method to get at the type of object we are dealing,

/**
* 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
* 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
*/
function createIsTest(className) {
return function(obj) {
return is(obj) === className;
};
}
export const isArray = function(obj) {
return is(obj) === "Array";
};
/**
* 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
* 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
*/
function curryIsMethods(obj, classNames) {
classNames = classNames || [
'Array',
'Object',
'String',
'Function',
'Storage'
];
export const isString = function(obj) {
return is(obj) === "String";
};
while (classNames.length) {
const className = classNames.pop();
obj[`is${className}`] = createIsTest(className);
}
return obj;
}
/**
* 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
*/
export const isFunction = function(obj) {
return is(obj) === "Function";
};
/**
* 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
*/
export const isStorage = function(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
*/
export const isObject = function(obj) {
return is(obj) === "Object";
};
/**
* Test if an object is the global window object

@@ -74,3 +104,3 @@ * @param {object} obj The object to be tested

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

@@ -86,3 +116,3 @@ };

*/
module.exports.isPlainObject = function(obj) {
export const isPlainObject = function(obj) {
const hop = Object.prototype.hasOwnProperty;

@@ -93,3 +123,3 @@

// Make sure that DOM nodes and window objects don't pass through, as well
if (!obj || !utils.isObject(obj) || obj.nodeType || utils.isWindow(obj)) {
if (!obj || !isObject(obj) || obj.nodeType || isWindow(obj)) {
return false;

@@ -122,21 +152,11 @@ }

*/
module.exports.isNonEmptyString = function(str) {
return utils.isString(str) && Boolean(str.length);
export const isNonEmptyString = function(str) {
return isString(str) && Boolean(str.length);
};
module.exports.isElement = function(element) {
export const 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
*/
module.exports.extend = extend;
function extend() {
export function extend() {
/* jshint forin: false */

@@ -165,3 +185,3 @@ /* when doing a deep copy we want to copy prototype properties */

/* istanbul ignore else */
if (typeof target !== "object" && !utils.isFunction(target)) {
if (typeof target !== "object" && !isFunction(target)) {
target = {};

@@ -192,9 +212,9 @@ }

// Recurse if we're merging arrays
if (deep && copy && (utils.isPlainObject(copy) || utils.isArray(copy))) {
copyIsArray = utils.isArray(copy);
if (deep && copy && (isPlainObject(copy) || isArray(copy))) {
copyIsArray = isArray(copy);
if (copyIsArray) {
copyIsArray = false;
clone = src && utils.isArray(src) ? src : [];
clone = src && isArray(src) ? src : [];
} else {
clone = src && utils.isObject(src) ? src : {};
clone = src && isObject(src) ? src : {};
}

@@ -227,6 +247,6 @@

*/
module.exports.hash = function(str, delimiter, pairing) {
export const hash = function(str, delimiter, pairing) {
let pair;
let value;
const hash = {};
const hashObj = {};
if (str && str.split) {

@@ -239,3 +259,3 @@ str = str.split(delimiter);

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

@@ -245,3 +265,3 @@ }

return hash;
return hashObj;
};

@@ -259,3 +279,3 @@

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

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

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

@@ -301,3 +321,3 @@ if (hop.call(tag, 'onreadystatechange')) {

/* istanbul ignore else */
if (utils.isFunction(errorcb)) {
if (isFunction(errorcb)) {
tag.onerror = function() {

@@ -318,3 +338,3 @@ processCallback(errorcb);

/* istanbul ignore next - cannot reliably test value of referer */
module.exports.getReferrer = function() {
export const getReferrer = function() {
return document.referrer || '';

@@ -328,3 +348,3 @@ };

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

@@ -340,5 +360,5 @@ return letter.toUpperCase();

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

@@ -352,3 +372,3 @@

/* istanbul ignore next - cannot reliably test value of location */
module.exports.getLocation = function() {
export const getLocation = function() {
return document.location.href || '';

@@ -363,7 +383,6 @@ };

*/
module.exports.getQueryString = function() {
export const getQueryString = function() {
return document.location.search.substring(1) || '';
};
/**

@@ -375,3 +394,3 @@ * Get a query string parameter by name from a url

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

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

*/
module.exports.getTimestamp = function() {
export const getTimestamp = function() {
const now = new Date();

@@ -410,3 +429,3 @@ return [

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

@@ -443,3 +462,3 @@ const iframes = document.getElementsByTagName('iframe');

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

@@ -451,3 +470,3 @@ prev[data.key] = data.value;

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

@@ -457,8 +476,35 @@ return val ? val.pop() : null;

module.exports.getVersion = () => require('../version.js') || 'UNKNOWN';
export const getVersion = () => version || 'UNKNOWN';
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);
export default {
on,
off,
once,
broadcast,
messenger,
responsive,
log,
isArray,
isString,
isFunction,
isStorage,
isObject,
isWindow,
isPlainObject,
isNonEmptyString,
isElement,
extend,
hash,
attach,
getReferrer,
dehyphenise,
parseAttributeName,
getLocation,
getQueryString,
getQueryParamByName,
getTimestamp,
iframeToSlotName,
buildObjectFromArray,
cookie,
getVersion
};
/* eslint no-console: 0 */
import { isArray, isObject } from './index';

@@ -12,4 +13,2 @@ /**

module.exports = log;
/**

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

*/
function log() {
export default function log() {
let type;

@@ -44,3 +43,3 @@ let argsIndex;

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

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

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

@@ -63,3 +62,3 @@ log.apply(null, args);

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

@@ -72,3 +71,3 @@ log.apply(null, args);

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

@@ -82,3 +81,3 @@ log.apply(null, args);

*/
module.exports.start = function(group) {
export const start = function(group) {
if (!log.isOn('groupCollapsed')) {

@@ -94,3 +93,3 @@ return;

*/
module.exports.end = function() {
export const end = function() {
if (!log.isOn('groupEnd')) {

@@ -103,3 +102,3 @@ return;

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

@@ -114,4 +113,3 @@ if(console.table) {

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

@@ -121,3 +119,3 @@ if (object && console.table) {

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

@@ -124,0 +122,0 @@ } else {

@@ -7,3 +7,3 @@ /**

module.exports.messenger = {
export default {
post: function(message, source) {

@@ -10,0 +10,0 @@ message = typeof message === 'string' ? message : JSON.stringify(message);

let callback;
let breakpoints;
let current;
const utils = require('./index.js');
const oViewport = require('o-viewport');
import utils from './index';
import oViewport from 'o-viewport';

@@ -37,7 +37,7 @@ function getNearestBreakpoint() {

function getCurrent() {
export function getCurrent() {
return current;
}
function init(brps, cb) {
export default function init(brps, cb) {

@@ -61,4 +61,2 @@ if (!utils.isFunction(cb)) {

module.exports = init;
module.exports.getCurrent = getCurrent;
module.exports.setThrottleInterval = oViewport.setThrottleInterval;
export const setThrottleInterval = oViewport.setThrottleInterval;
// generated by genversion
module.exports = '10.2.3';
module.exports = '10.2.4';
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