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

dot-store-iframe

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-store-iframe - npm Package Compare versions

Comparing version 2.6.16 to 2.6.19

390

dist/dfp.js

@@ -35,3 +35,6 @@ "use strict";

function attachDfp(store) {
function attachDfp(_ref) {
var key = _ref.key,
store = _ref.store;
if (!hasGpt) {

@@ -42,8 +45,8 @@ return;

window.googletag.cmd.push(function () {
store.set("dfp.loaded", true);
(0, _a.loadA9)();
store.set("".concat(key, ".dfp.loaded"), true);
window.googletag.pubads().addEventListener("slotRenderEnded",
/*#__PURE__*/
function () {
var _ref = (0, _asyncToGenerator2.default)(
var _ref2 = (0, _asyncToGenerator2.default)(
/*#__PURE__*/

@@ -58,3 +61,3 @@ _regenerator.default.mark(function _callee(event) {

divId = slot.getSlotElementId();
store.set("iframes.".concat(divId, ".rendered"), {
store.set("".concat(key, ".iframes.").concat(divId, ".rendered"), {
divId: divId,

@@ -74,3 +77,3 @@ isEmpty: isEmpty,

return function (_x) {
return _ref.apply(this, arguments);
return _ref2.apply(this, arguments);
};

@@ -80,3 +83,3 @@ }());

var divId = event.slot.getSlotElementId();
store.set("iframes.".concat(divId, ".loaded"), true);
store.set("".concat(key, ".iframes.").concat(divId, ".loaded"), true);
});

@@ -86,5 +89,5 @@ });

function buildSizeMap(_ref2) {
var dfp = _ref2.dfp,
unit = _ref2.unit;
function buildSizeMap(_ref3) {
var dfp = _ref3.dfp,
unit = _ref3.unit;

@@ -103,8 +106,8 @@ if (sizeMaps[unit.id]) {

for (var _iterator = (0, _getIterator2.default)(entries), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _ref5 = _step.value;
var _ref6 = _step.value;
var _ref4 = (0, _slicedToArray2.default)(_ref5, 2);
var _ref5 = (0, _slicedToArray2.default)(_ref6, 2);
var _i = _ref4[0];
var _value = _ref4[1];
var _i = _ref5[0];
var _value = _ref5[1];
map.addSize([_value[0], 0], unit.viewportSizes[_i]);

@@ -130,215 +133,232 @@ }

function createDfpSlot(_x2) {
return _createDfpSlot.apply(this, arguments);
}
function createDfpSlot(key) {
return (
/*#__PURE__*/
function () {
var _ref7 = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee2(options) {
var iframe, store, dfp, divId, _iframe$dfp, oop, path, targets, unitId, unit, slot, sizeMap, _key;
function _createDfpSlot() {
_createDfpSlot = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee2(options) {
var iframe, store, _store$get, dfp, divId, _iframe$dfp, oop, path, targets, unitId, unit, slot, sizeMap, key;
return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
iframe = options.listenValue, store = options.store;
dfp = store.get("".concat(key, ".dfp"));
return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
iframe = options.listenValue, store = options.store;
_store$get = store.get(), dfp = _store$get.dfp;
if (iframe.dfp) {
_context2.next = 4;
break;
}
if (iframe.dfp) {
_context2.next = 4;
break;
}
return _context2.abrupt("return");
return _context2.abrupt("return");
case 4:
_context2.next = 6;
return store.onceExists("".concat(key, ".dfp.loaded"));
case 4:
_context2.next = 6;
return store.onceExists("dfp.loaded");
case 6:
divId = iframe.divId;
_iframe$dfp = iframe.dfp, oop = _iframe$dfp.oop, path = _iframe$dfp.path, targets = _iframe$dfp.targets, unitId = _iframe$dfp.unitId;
unit = dfp.units[unitId];
case 6:
divId = iframe.divId;
_iframe$dfp = iframe.dfp, oop = _iframe$dfp.oop, path = _iframe$dfp.path, targets = _iframe$dfp.targets, unitId = _iframe$dfp.unitId;
unit = dfp.units[unitId];
if (oop) {
slot = window.googletag.defineOutOfPageSlot(path, divId);
} else {
sizeMap = buildSizeMap({
dfp: dfp,
iframe: iframe,
unit: unit
});
slot = window.googletag.defineSlot(path, unit.sizes, divId);
if (oop) {
slot = window.googletag.defineOutOfPageSlot(path, divId);
} else {
sizeMap = buildSizeMap({
dfp: dfp,
iframe: iframe,
unit: unit
});
slot = window.googletag.defineSlot(path, unit.sizes, divId);
if (slot) {
slot.defineSizeMapping(sizeMap);
}
}
if (slot) {
slot.defineSizeMapping(sizeMap);
}
}
if (slot && targets) {
for (_key in targets) {
slot.setTargeting(_key, targets[_key]);
}
}
if (slot && targets) {
for (key in targets) {
slot.setTargeting(key, targets[key]);
}
}
if (!(slot && iframe.dfp.a9)) {
_context2.next = 14;
break;
}
if (!iframe.dfp.a9) {
_context2.next = 14;
break;
}
_context2.next = 14;
return (0, _a.fetchA9)({
divId: divId,
path: path,
sizes: unit.sizes
});
_context2.next = 14;
return (0, _a.fetchA9)({
divId: divId,
path: path,
sizes: unit.sizes
});
case 14:
if (slot) {
slot.addService(window.googletag.pubads());
window.googletag.display(divId);
slots[divId] = slot;
}
case 14:
if (slot) {
slot.addService(window.googletag.pubads());
window.googletag.display(divId);
slots[divId] = slot;
case 15:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
case 15:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
return _createDfpSlot.apply(this, arguments);
return function (_x2) {
return _ref7.apply(this, arguments);
};
}()
);
}
function deleteDfpSlot(_x3) {
return _deleteDfpSlot.apply(this, arguments);
}
function deleteDfpSlot(key) {
return (
/*#__PURE__*/
function () {
var _ref9 = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee3(_ref8) {
var iframeId, prevState, store, iframes, iframe, valid;
return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
iframeId = _ref8.iframeId, prevState = _ref8.prevState, store = _ref8.store;
iframes = prevState[key].iframes;
iframe = iframes[iframeId];
valid = iframe && iframe.dfp;
function _deleteDfpSlot() {
_deleteDfpSlot = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee3(_ref6) {
var iframeId, prevState, store, iframes, iframe, valid;
return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
iframeId = _ref6.iframeId, prevState = _ref6.prevState, store = _ref6.store;
iframes = prevState.iframes;
iframe = iframes[iframeId];
valid = iframe && iframe.dfp;
if (valid) {
_context3.next = 6;
break;
}
if (valid) {
_context3.next = 6;
break;
}
return _context3.abrupt("return");
return _context3.abrupt("return");
case 6:
_context3.next = 8;
return store.onceExists("".concat(key, ".dfp.loaded"));
case 6:
_context3.next = 8;
return store.onceExists("dfp.loaded");
case 8:
window.googletag.destroySlots([slots[iframeId]]);
slots[iframeId] = undefined;
case 8:
window.googletag.destroySlots([slots[iframeId]]);
slots[iframeId] = undefined;
case 10:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
case 10:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
return _deleteDfpSlot.apply(this, arguments);
return function (_x3) {
return _ref9.apply(this, arguments);
};
}()
);
}
function refreshDfpSlot(_x4) {
return _refreshDfpSlot.apply(this, arguments);
}
function refreshDfpSlot(key) {
return (
/*#__PURE__*/
function () {
var _ref11 = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee4(_ref10) {
var iframeId, state, store, iframes, iframe, valid, divId;
return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
iframeId = _ref10.iframeId, state = _ref10.state, store = _ref10.store;
iframes = state.iframes;
iframe = iframes[iframeId];
valid = iframe && iframe.dfp;
function _refreshDfpSlot() {
_refreshDfpSlot = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee4(_ref7) {
var iframeId, state, store, iframes, iframe, valid, divId;
return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
iframeId = _ref7.iframeId, state = _ref7.state, store = _ref7.store;
iframes = state.iframes;
iframe = iframes[iframeId];
valid = iframe && iframe.dfp;
if (valid) {
_context4.next = 6;
break;
}
if (valid) {
_context4.next = 6;
break;
}
return _context4.abrupt("return");
return _context4.abrupt("return");
case 6:
divId = iframes[iframeId].divId;
case 6:
divId = iframes[iframeId].divId;
if (slots[divId]) {
_context4.next = 9;
break;
}
if (slots[divId]) {
_context4.next = 9;
break;
}
return _context4.abrupt("return");
return _context4.abrupt("return");
case 9:
_context4.next = 11;
return store.onceExists("".concat(key, ".dfp.loaded"));
case 9:
_context4.next = 11;
return store.onceExists("dfp.loaded");
case 11:
window.googletag.pubads().refresh([slots[divId]], {
changeCorrelator: false
});
case 11:
window.googletag.pubads().refresh([slots[divId]], {
changeCorrelator: false
});
case 12:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
case 12:
case "end":
return _context4.stop();
}
}
}, _callee4, this);
}));
return _refreshDfpSlot.apply(this, arguments);
return function (_x4) {
return _ref11.apply(this, arguments);
};
}()
);
}
function updateDfpTargets(_x5) {
return _updateDfpTargets.apply(this, arguments);
}
function updateDfpTargets(key) {
return (
/*#__PURE__*/
function () {
var _ref13 = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee5(_ref12) {
var store, targets, _key2;
function _updateDfpTargets() {
_updateDfpTargets = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee5(_ref8) {
var store, targets, key;
return _regenerator.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
store = _ref8.store;
_context5.next = 3;
return store.onceExists("dfp.loaded");
return _regenerator.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
store = _ref12.store;
_context5.next = 3;
return store.onceExists("".concat(key, ".dfp.loaded"));
case 3:
targets = store.get("dfp.targets") || {};
case 3:
targets = store.get("".concat(key, ".dfp.targets")) || {};
for (key in targets) {
window.googletag.pubads().setTargeting(key, targets[key] || "");
for (_key2 in targets) {
window.googletag.pubads().setTargeting(_key2, targets[_key2] || "");
}
case 5:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
case 5:
case "end":
return _context5.stop();
}
}
}, _callee5, this);
}));
return _updateDfpTargets.apply(this, arguments);
return function (_x5) {
return _ref13.apply(this, arguments);
};
}()
);
}
//# sourceMappingURL=dfp.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -12,137 +10,93 @@ value: true

exports.addDebug = addDebug;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
// Variables
var elements = {}; // Iframes
function createIframe(_x) {
return _createIframe.apply(this, arguments);
}
function createIframe(key) {
return function (options) {
var iframeId = options.iframeId,
listenValue = options.listenValue,
store = options.store;
function _createIframe() {
_createIframe = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee(options) {
var iframeId, listenValue, store, divId, height, url, width, loaded, onLoad, el;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
iframeId = options.iframeId, listenValue = options.listenValue, store = options.store;
if (listenValue.dfp) {
return;
}
if (!listenValue.dfp) {
_context.next = 3;
break;
}
var divId = listenValue.divId,
height = listenValue.height,
url = listenValue.url,
width = listenValue.width;
var loaded = "".concat(key, ".iframes.").concat(iframeId, ".loaded");
return _context.abrupt("return");
var onLoad = function onLoad() {
return store.set(loaded, true);
};
case 3:
divId = listenValue.divId, height = listenValue.height, url = listenValue.url, width = listenValue.width;
loaded = "iframes.".concat(iframeId, ".loaded");
onLoad = function onLoad() {
return store.set(loaded, true);
};
el = document.createElement("iframe");
el.onload = onLoad;
el.frameBorder = 0;
el.height = height ? height : 0;
el.width = width ? width : 0;
el.src = addDebug({
store: store,
url: url
});
document.getElementById(divId).appendChild(el);
elements[divId] = el;
case 14:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _createIframe.apply(this, arguments);
var el = document.createElement("iframe");
el.onload = onLoad;
el.frameBorder = 0;
el.height = height ? height : 0;
el.width = width ? width : 0;
el.src = addDebug({
store: store,
url: url
});
document.getElementById(divId).appendChild(el);
elements[divId] = el;
};
}
function deleteIframe(_x2) {
return _deleteIframe.apply(this, arguments);
}
function deleteIframe(key) {
return function (_ref) {
var iframeId = _ref.iframeId,
prevState = _ref.prevState;
var iframes = prevState[key].iframes;
var iframe = iframes[iframeId];
var valid = iframe && !iframe.dfp;
function _deleteIframe() {
_deleteIframe = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee2(_ref) {
var iframeId, prevState, iframes, iframe, valid, divId, el;
return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
iframeId = _ref.iframeId, prevState = _ref.prevState;
iframes = prevState.iframes;
iframe = iframes[iframeId];
valid = iframe && !iframe.dfp;
if (!valid) {
return;
}
if (valid) {
_context2.next = 6;
break;
}
var divId = iframe.divId;
var el = document.getElementById(divId);
return _context2.abrupt("return");
case 6:
divId = iframe.divId;
el = document.getElementById(divId);
if (el && el.parentNode) {
el.parentNode.removeChild(el);
}
case 9:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
return _deleteIframe.apply(this, arguments);
if (el && el.parentNode) {
el.parentNode.removeChild(el);
}
};
}
function iframeSize(options) {
var iframeId = options.iframeId,
state = options.state;
var iframes = state.iframes;
var iframe = iframes[iframeId];
function iframeSize(key) {
return function (_ref2) {
var iframeId = _ref2.iframeId,
store = _ref2.store;
var iframe = store.get("".concat(key, ".iframes.").concat(iframeId));
if (!iframe) {
return;
}
if (!iframe) {
return;
}
var divId = iframe.divId,
height = iframe.height,
width = iframe.width;
var el = document.getElementById(divId).firstChild;
var divId = iframe.divId,
height = iframe.height,
width = iframe.width;
var el = document.getElementById(divId).firstChild;
if (!el) {
return;
}
if (!el) {
return;
}
if (height) {
el.height = height;
}
if (height) {
el.height = height;
}
if (width) {
el.width = width;
}
if (width) {
el.width = width;
}
};
} // Helpers
function addDebug(_ref2) {
var store = _ref2.store,
url = _ref2.url;
function addDebug(_ref3) {
var store = _ref3.store,
url = _ref3.url;

@@ -149,0 +103,0 @@ if (!store.get("debugMode")) {

@@ -15,14 +15,19 @@ "use strict";

// Composers
function _default(store) {
store.onceExists("iframes.{iframeId}", _iframes.createIframe);
store.onceExists("iframes.{iframeId}", _dfp.createDfpSlot);
store.on("iframes.{iframeId}.height", _iframes.iframeSize);
store.on("iframes.{iframeId}.width", _iframes.iframeSize);
store.on("dfp.targets", _dfp.updateDfpTargets);
store.on("iframes.{iframeId}.refresh", _dfp.refreshDfpSlot);
store.on("afterDelete", "iframes.{iframeId}", _dfp.deleteDfpSlot);
store.on("afterDelete", "iframes.{iframeId}", _iframes.deleteIframe);
(0, _dfp.attachDfp)(store);
return store;
function _default(key) {
return function (store) {
store.on("".concat(key, ".dfp.targets"), (0, _dfp.updateDfpTargets)(key));
store.on("".concat(key, ".iframes.{iframeId}.height"), (0, _iframes.iframeSize)(key));
store.on("".concat(key, ".iframes.{iframeId}.width"), (0, _iframes.iframeSize)(key));
store.onceExists("".concat(key, ".iframes.{iframeId}"), (0, _dfp.createDfpSlot)(key));
store.onceExists("".concat(key, ".iframes.{iframeId}"), (0, _iframes.createIframe)(key));
store.on("".concat(key, ".iframes.{iframeId}.refresh"), (0, _dfp.refreshDfpSlot)(key));
store.on("afterDelete", "".concat(key, ".iframes.{iframeId}"), (0, _dfp.deleteDfpSlot)(key));
store.on("afterDelete", "".concat(key, ".iframes.{iframeId}"), (0, _iframes.deleteIframe)(key));
(0, _dfp.attachDfp)({
key: key,
store: store
});
return store;
};
}
//# sourceMappingURL=index.js.map
{
"name": "dot-store-iframe",
"version": "2.6.16",
"version": "2.6.19",
"description": "Iframe controller integration for dot-store",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc