diff --git a/dist/dfp.es6.js b/dist/dfp.es6.js index 2dfd173..96ab015 100644 --- a/dist/dfp.es6.js +++ b/dist/dfp.es6.js @@ -2052,7 +2052,9 @@ var AdManager = function () { // Targeting check (userType vs. slotTargeting) this.doesUserTypeMatchBannerTargeting(adSlot$$1) && // Impressions Manager check (limits number of impressions per slot) - this.user.impressionManager.reachedQuota(adSlot$$1.id) === false; + this.user.impressionManager.reachedQuota(adSlot$$1.id) === false && + // if the app promotion interstitial DOES NOT pop - SHOW MAAVARON + this.shouldAppPromotionElementPop() === false; } }, { key: 'printShouldSendRequestToDfp', @@ -2109,6 +2111,18 @@ var AdManager = function () { return shouldDisplay; } + /** + * Check if the app promotion interstitial should pop + * when it does, the maavaron should not show up + * @returns {boolean} true if the interstitial element should pop + */ + + }, { + key: 'shouldAppPromotionElementPop', + value: function shouldAppPromotionElementPop() { + return typeof window.appPromotionElement !== 'undefined' && typeof window.appPromotionElement.getShouldPop === 'function' ? window.appPromotionElement.getShouldPop() : false; + } + /** * Check whether or not an ad slot should appear for the current user type * @param {String} adSlotOrTarget the adSlot to check or the target as a string @@ -2644,7 +2658,7 @@ var DFP$1 = function () { }(); // generated by genversion -var version$1 = '2.6.5'; +var version$1 = '2.6.6'; // DFP version is based on the package.json DFP$1.version = version$1 || 'VERSION'; diff --git a/dist/dfp.es6.js.map b/dist/dfp.es6.js.map index 14edc29..1c2df93 100644 --- a/dist/dfp.es6.js.map +++ b/dist/dfp.es6.js.map @@ -1 +1 @@ -{"version":3,"sources":["../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/classCallCheck.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/createClass.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/toConsumableArray.js","../src/utils/cookieUtils.js","../src/globalConfig.js","../src/utils/time.js","../src/utils/breakpoints.js","../src/objects/impressionsManager.js","../src/objects/user.js","../src/objects/conflictResolver.js","../src/utils/arrays.js","../src/objects/adSlot.js","../src/objects/adManager.js","../src/dfp.js","../src/version.js","../src/index.js"],"names":["instance","Constructor","TypeError","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","defineProperty","key","protoProps","staticProps","prototype","arr","Array","isArray","arr2","from","globalConfig","userTypes","ImpressionManager","ssoKey","arraysEqual","adSlot","AdSlot","DFP","version","v"],"mappings":"AAAA,uBAAgB,UAAUA,QAAV,EAAoBC,WAApB,EAAiC;MAC3C,EAAED,oBAAoBC,WAAtB,CAAJ,EAAwC;UAChC,IAAIC,SAAJ,CAAc,mCAAd,CAAN;;CAFJ;;ACAA,mBAAe,CAAC,YAAY;WACjBC,gBAAT,CAA0BC,MAA1B,EAAkCC,KAAlC,EAAyC;SAClC,IAAIC,IAAI,CAAb,EAAgBA,IAAID,MAAME,MAA1B,EAAkCD,GAAlC,EAAuC;UACjCE,aAAaH,MAAMC,CAAN,CAAjB;iBACWG,UAAX,GAAwBD,WAAWC,UAAX,IAAyB,KAAjD;iBACWC,YAAX,GAA0B,IAA1B;UACI,WAAWF,UAAf,EAA2BA,WAAWG,QAAX,GAAsB,IAAtB;aACpBC,cAAP,CAAsBR,MAAtB,EAA8BI,WAAWK,GAAzC,EAA8CL,UAA9C;;;;SAIG,UAAUP,WAAV,EAAuBa,UAAvB,EAAmCC,WAAnC,EAAgD;QACjDD,UAAJ,EAAgBX,iBAAiBF,YAAYe,SAA7B,EAAwCF,UAAxC;QACZC,WAAJ,EAAiBZ,iBAAiBF,WAAjB,EAA8Bc,WAA9B;WACVd,WAAP;GAHF;CAXa,GAAf;;ACAA,0BAAgB,UAAUgB,GAAV,EAAe;MACzBC,MAAMC,OAAN,CAAcF,GAAd,CAAJ,EAAwB;SACjB,IAAIX,IAAI,CAAR,EAAWc,OAAOF,MAAMD,IAAIV,MAAV,CAAvB,EAA0CD,IAAIW,IAAIV,MAAlD,EAA0DD,GAA1D;WAAoEA,CAAL,IAAUW,IAAIX,CAAJ,CAAV;KAE/D,OAAOc,IAAP;GAHF,MAI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BACA,IAAA,KAAmB,YAAM;wBACvB,iBAAA;wBAED;;;gBAEH,iBAAA,SAA8B,UAAA,OAAW;sBACvC,iBAAA;qBACA;;iBAEF,WAAA,aAAA,KAAA;;;OAnCC;;;;;;;;;;uCA6CU;UACb,KAAA,mBAAA,QAAiC,OAAA,aAAoB,OAAA,UAAzD,UAAqF;aACnF,iBAAA;;aAEK,KAAP;;;;;;;;;+CAMyB;UACnB,UAAN;eACA,WAAoB;YACZ,oBAAN;YACI,QAAA,eAAJ,mBAA8C;kBAC5C,aAAA;cACI,QAAJ,WAAuB;oBACrB,UAAA;iBAEG;kBACG,IAAA,MAAN;;;;UAIA,oBAAoB,SAAA,UAA1B;aACA,WAAA;;;;;;;AC5GJ;AACA,AAAO,IAAMC,YAAU;;ACGvB;AACAD,MAAI,UAAUE,aAAK;;;;;;;;;AASnB,AAAO,IAAM,SAAST;AACtB,AAAO,IAAMQ,aAAUD,MAAI,QAC3B","file":"dfp.es6.js","sourcesContent":["export default (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n});","export default (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();","export default (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n});","/**\n * Htz-cookie-util\n * @module htzCookieUtil\n * @author Elia Grady elia.grady@haaretz.co.il\n * @license MIT\n */\n\n/**\n * Translates Key-Value string into a convenient map.\n * @param {String} string String in format of \"keyvalue.....\"\n * @param {object} options object for overriding defaults:\n * options.separator is a String or regExp that separates between each key value pairs\n * (default is ';'). options.operator is a String or regExp that separates between each key\n * and value within a pair (default is '=').\n * @returns {object} a map object, with key-value mapping according to the passed configuration.\n */\nfunction stringToMap(string,\n { separator = ';', operator = '=' } = {}) {\n const map = {};\n const itemsArr = string.split(separator);\n itemsArr.forEach(element => {\n if (typeof element === 'string') {\n const keyValue = element.split(operator);\n if (keyValue.length === 2) {\n try {\n map[keyValue[0]] = decodeURIComponent(keyValue[1]);\n }\n catch (e) {\n // Do nothing, malformed URI\n }\n }\n }\n });\n return map;\n}\nexport const ssoKey = window.location.hostname.indexOf('haaretz.com') > -1 ? 'engsso' : 'tmsso';\n\n// Translates Cookie string into a convenient map.\nexport default function getCookieAsMap() {\n const map = stringToMap(document.cookie, { separator: /;\\s?/ });\n if (typeof map.tmsso === 'string') {\n map.tmsso = stringToMap(map.tmsso, { separator: ':' });\n }\n if (typeof map.engsso === 'string') {\n map.engsso = stringToMap(map.engsso, { separator: ':' });\n }\n return map;\n}\n","/* global dfpConfig */\nimport getCookieAsMap, { ssoKey } from './utils/cookieUtils';\n// globalConfig for DFP\nlet dfpBaseConf;\ntry {\n dfpBaseConf = window.JSON.parse(document.getElementById('dfpConfig').textContent);\n}\ncatch (err) {\n dfpBaseConf = window.dfpConfig;\n}\nconst dfpConfig = Object.assign({\n get referrer() {\n return document.referrer ? document.referrer : '';\n },\n get isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n },\n /**\n * Returns true iff the loaded page is the homepage (no inner path)\n * @returns {boolean}\n */\n get isHomepage() {\n return window.location.pathname === '/' || this.environment === 3; // 'prod'\n },\n get department() {\n return this.isHomepage ? '_homepage' : '_section';\n },\n /**\n * returns the domain the page was loaded to. i.e: 'haaretz.co.il', 'haaretz.com'\n * @returns {string} the domain name from the windows's location hostname property\n */\n get domain() {\n const regexMatch = /([\\d|\\w]+)(\\.co\\.il|\\.com)(.*)?/.exec(window.location.hostname);\n const result = regexMatch ? regexMatch[0] : window.location.hostname;\n return result;\n },\n /**\n * Returns an array of concatenated paths, separated by a dot.\n * For example, for the URL:\n * http://www.haaretz.co.il/news/world/america/us-election-2016/LIVE-1.2869045\n * the path is '/news/world/america/us-election-2016/LIVE-1.2869045'.\n * This function takes the directories ['news', 'world', 'america', 'us-election-2016']\n * and converts it to the following format:\n * ['.news', '.news.world', '.news.world.america', '.news.world.america.us-election-2016']\n * This denotes the path configuration for the given adSlot\n * non articles (sections) will be given a '0' - no articleId value for targeting purposes)\n * @returns {Array.} an array of path names\n */\n get path() {\n let sectionArray = this.articleId && this.articleId !== '0' ?\n window.location.pathname.split('/').slice(1, -1) :\n window.location.pathname.split('/').slice(1);\n sectionArray = sectionArray.filter(path =>\n path !== 'wwwMobileSite' && path !== 'whtzMobileSite');\n return sectionArray\n .map(section => `.${section}`)\n .map((section, index, arr) => arr.slice(0, index + 1)\n .reduce((last, current) => last.concat(current)));\n },\n /**\n * Returns a string representation for the name of the site\n * @return {*|string}\n */\n get site() {\n let site;\n if (window.location.hostname.indexOf('haaretz.co.il') > -1) {\n site = 'haaretz';\n }\n else if (window.location.hostname.indexOf('themarker.com') > -1) {\n site = 'themarker';\n }\n else if (window.location.hostname.indexOf('mouse.co.il') > -1) {\n site = 'mouse';\n }\n return site || 'haaretz';\n },\n /**\n * Returns the current environment targeting param, if such is defined.\n * @returns {number} targeting param, 1 for local development, 2 for test servers and 3 for prod.\n * May return undefined if no targeting is specified.\n */\n get environment() {\n const env = {\n dev: 1,\n test: 2,\n prod: 3,\n };\n return window.location.port === '8080' ? env.dev :\n (window.location.hostname.indexOf('pre.haaretz.co.il') > -1\n || window.location.hostname.indexOf('tmtest.themarker.com') > -1\n || window.location.hostname.indexOf('pre.haaretz.com') > -1\n || window.location.hostname.indexOf('prodmouse.mouse.co.il') > -1) ? env.test :\n (window.location.pathname.indexOf('/cmlink/Haaretz.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/TheMarker.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/Mouse.HomePage') > -1)\n ? env.prod : undefined;\n },\n /**\n * Returns the articleIf if on an article page, or null otherwise\n * @returns {string} an articleId string from the pathname, or 0 if not found\n */\n get articleId() {\n const articleIdMatch = /\\d\\.\\d+/g.exec(window.location.pathname);\n let articleId = '0';\n if (articleIdMatch) {\n articleId = articleIdMatch.pop(); // Converts [\"1.23145\"] to \"1.23145\"\n }\n return articleId;\n },\n utm_: {\n get content() {\n return this.getUrlParam('utm_content');\n },\n get source() {\n return this.getUrlParam('utm_source');\n },\n get medium() {\n return this.getUrlParam('utm_medium');\n },\n get campaign() {\n return this.getUrlParam('utm_campaign');\n },\n getUrlParam(key) {\n const results = RegExp(`(${key})(=)([^&\"]+)`).exec(window.location.search);\n return results && results[3] ? results[3] : undefined;\n },\n },\n get adBlockRemoved() {\n let adBlockRemoved = false;\n try {\n if (localStorage.getItem('adblock_removed')) {\n adBlockRemoved = true;\n }\n }\n catch (err) {\n // do nothing\n }\n return adBlockRemoved;\n },\n get ssoGroupKey() {\n return window.localStorage.getItem('_SsoGroupKey');\n },\n get anonymousId() {\n const cookieName = 'anonymousId';\n const cookieMap = getCookieAsMap();\n let anonymousId = '';\n if (cookieMap && cookieMap[cookieName]) {\n anonymousId = cookieMap[cookieName];\n }\n return anonymousId;\n },\n get isWriterAlerts() {\n return (location.search.indexOf('writerAlerts=true') > -1);\n },\n get wifiLocation() {\n let wifiLocation;\n const cookieName = '_htzwif'; // eslint-disable-line no-underscore-dangle\n const cookieMap = getCookieAsMap();\n try {\n if (cookieMap && cookieMap[cookieName]) {\n if (cookieMap[cookieName].toLowerCase() === 'arcaffe') {\n wifiLocation = 'ArCafe';\n }\n if (cookieMap[cookieName].toLowerCase() === 'university') {\n wifiLocation = 'university';\n }\n }\n if (cookieMap && cookieMap.fairs) {\n wifiLocation = 'fairs';\n }\n }\n catch (err) {\n // do nothing\n }\n return wifiLocation;\n },\n get isValidForsmartPhone() {\n let validForAds = true;\n const PageUrl = window.location.href;\n const isSmartphoneapp = PageUrl.match('haaretzsmartphoneapp');\n const cookieMap = getCookieAsMap();\n try {\n if (isSmartphoneapp) {\n // eslint-disable-line no-underscore-dangle\n if (cookieMap && cookieMap.HtzPusr &&\n (cookieMap.tmsso === undefined || cookieMap.tmsso.userName !== 'pilosmadar@gmail.com')) {\n validForAds = false;\n }\n }\n }\n catch (err) {\n // do nothing\n }\n return validForAds;\n },\n get gStatCampaignNumber() {\n let gstatCampaign;\n try {\n gstatCampaign = localStorage.getItem('GstatCampaign') ?\n JSON.parse(localStorage.getItem('GstatCampaign')) : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n gstatCampaign = undefined;\n }\n return gstatCampaign ? gstatCampaign.CampaignNumber : undefined;\n },\n get pageType() {\n let type = '';\n try {\n const htmlclassList = document.querySelector('html').classList;\n switch (true) {\n case /mouse_location/.test(htmlclassList):\n type = 'mouse_location';\n break;\n case /mouse_event/.test(htmlclassList):\n type = 'mouse_event';\n break;\n case /contentType-story/.test(htmlclassList):\n type = 'mouse_article';\n break;\n default:\n if (this.articleId !== '0') {\n switch (this.domain) {\n case 'haaretz.co.il':\n type = 'htz_article';\n break;\n case 'haaretz.com':\n type = 'hdc_article';\n break;\n case 'themarker.com':\n type = 'tm_article';\n break;\n default:\n type = '';\n }\n }\n else {\n type = '';\n }\n }\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n type = '';\n }\n return type;\n },\n get proposalNumber() {\n let proposal;\n try {\n proposal = localStorage.getItem('proposaltype') ?\n localStorage.getItem('proposaltype') : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n proposal = undefined;\n }\n return proposal;\n },\n adSlotConfig: {\n 'haaretz.co.il.example.slot': {\n id: 'slotId',\n // path : \"/network/base/slotId/slotId_subsection\", Will be calculated from AdManager\n responsive: true,\n adSizeMapping: [['width1', 'height1'], ...['widthN', 'heightN']],\n priority: 'normal',\n fluid: false,\n responsiveAdSizeMapping: {\n xxs: [['width1', 'height1'], ...['widthN', 'heightN']],\n xs: [['width1', 'height1'], ...['widthN', 'heightN']],\n s: [['width1', 'height1'], ...['widthN', 'heightN']],\n m: [['width1', 'height1'], ...['widthN', 'heightN']],\n l: [['width1', 'height1'], ...['widthN', 'heightN']],\n xl: [['width1', 'height1'], ...['widthN', 'heightN']],\n xxl: [['width1', 'height1'], ...['widthN', 'heightN']],\n },\n blacklistReferrers: 'comma, delimited, blacklisted, referrer, list',\n whitelistReferrers: 'comma, delimited, referrer, list',\n },\n },\n adManagerConfig: {\n network: '9401',\n adUnitBase: 'haaretz.co.il_Web',\n },\n breakpointsConfig: {\n get breakpoints() {\n // Override in VM from backend to control this toggle.\n let breakpoints;\n switch (dfpConfig.googleGlobalSettings.breakpointType) {\n case 'type1': breakpoints = this.breakpoints1; break;\n case 'type2': breakpoints = this.breakpoints2; break;\n case 'type3': breakpoints = this.breakpoints3; break;\n case 'type4': breakpoints = this.breakpoints4; break;\n default: breakpoints = this.breakpoints1;\n }\n return breakpoints;\n },\n // Type 1\n breakpoints1: {\n xxs: 600,\n xs: 761,\n s: 993,\n m: 1009,\n l: 1291,\n xl: 1600,\n xxl: 1900,\n },\n // Type 2\n breakpoints2: {\n xxs: 600,\n xs: 1000,\n s: 1150,\n m: 1281,\n l: 1600,\n xl: 1920,\n xxl: 1920,\n },\n // Type 3\n breakpoints3: {\n xxs: 100,\n xs: 480,\n s: 600,\n m: 768,\n l: 1024,\n xl: 1280,\n xxl: 1900,\n },\n // Type 4\n breakpoints4: {\n xxs: 600,\n xs: 768,\n s: 1024,\n m: 1280,\n l: 1900,\n xl: 1900,\n xxl: 1900,\n },\n },\n userConfig: {\n type: undefined,\n age: undefined,\n gender: undefined,\n },\n conflictManagementConfig: {\n 'blocking.ad.unit.name': [\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n ],\n },\n impressionManagerConfig: {\n 'ad.unit.name': {\n target: 'all|section|homepage',\n frequency: '$1/$2(day|hour)',\n exposed: 0,\n expires: (new Date()).getTime(),\n },\n },\n googleGlobalSettings: {\n enableSingleRequest: true,\n enableAsyncRendering: true,\n refreshIntervalTime: 1000,\n breakpointType: 'type1',\n },\n sso: ssoKey,\n\n}, dfpBaseConf);\n\nexport default dfpConfig;\n","/**\n * Helper function. Adds N hours to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Number} hours - the amount of hours to add, in whole numbers\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'hours' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given hours\n */\nexport function addHours(date, hours) {\n if (!date) {\n throw new SyntaxError('addHours called without a required \\'date\\' parameter!');\n }\n if (!hours) {\n throw new SyntaxError('addHours called without a required \\'hours\\' parameter!');\n }\n else if (isNaN(parseInt(hours, 10))) {\n throw new TypeError('addHours called with an invalid integer \\'hours\\' parameter!');\n }\n const result = new Date(date);\n result.setHours(result.getHours() + parseInt(hours, 10));\n return result;\n}\n\n/**\n * Helper function. Adds N days to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Integer} days - the amount of days to add\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'days' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given days\n */\nexport function addDays(date, days) {\n if (!date) {\n throw new SyntaxError('addDays called without a required \\'date\\' parameter!');\n }\n if (!days) {\n throw new SyntaxError('addDays called without a required \\'days\\' parameter!');\n }\n else if (isNaN(parseInt(days, 10))) {\n throw new TypeError('addDays called with an invalid integer \\'days\\' parameter!');\n }\n const result = new Date(date);\n result.setDate(result.getDate() + parseInt(days, 10));\n return result;\n}\n","import globalConfig from '../globalConfig';\n\nconst breakpoints = globalConfig.breakpointsConfig.breakpoints;\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param { function } func - the function to run\n * @param { number } wait - the timeout period to avoid running the function\n * @param { boolean } immediate - leading edge modifier\n * @returns {function } the debounced function\n */\nexport function debounce(func, wait = 100, immediate) {\n let timeout;\n return function debounced() {\n const context = this;\n const args = arguments;// eslint-disable-line prefer-rest-params\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @returns {number} the break that the current width represents\n */\nexport function getBreakpoint() {\n let breakpoint;\n const windowWidth = window.innerWidth\n || document.documentElement.clientWidth\n || document.body.clientWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: breakpoint = breakpoints.xxs; break;\n case windowWidth < breakpoints.s: breakpoint = breakpoints.xs; break;\n case windowWidth < breakpoints.m: breakpoint = breakpoints.s; break;\n case windowWidth < breakpoints.l: breakpoint = breakpoints.m; break;\n case windowWidth < breakpoints.xl: breakpoint = breakpoints.l; break;\n case windowWidth < breakpoints.xxl: breakpoint = breakpoints.xl; break;\n default: breakpoint = breakpoints.xxl;\n }\n return breakpoint;\n}\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @param {number} breakpoint - the breakpoint label enumerator that the current width represents\n * (yield with a getBreakpoint() call or passed manually )\n * @returns {string} breakpoint - the breakpoint label that the current width represents,\n * as a string\n */\nexport function getBreakpointName(breakpoint) {\n let resultBreakpoint;\n const windowWidth = breakpoint || window.innerWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: resultBreakpoint = 'xxs'; break;\n case windowWidth < breakpoints.s: resultBreakpoint = 'xs'; break;\n case windowWidth < breakpoints.m: resultBreakpoint = 's'; break;\n case windowWidth < breakpoints.l: resultBreakpoint = 'm'; break;\n case windowWidth < breakpoints.xl: resultBreakpoint = 'l'; break;\n case windowWidth < breakpoints.xxl: resultBreakpoint = 'xl'; break;\n default: resultBreakpoint = 'xxl';\n }\n return resultBreakpoint;\n}\n","import globalConfig from '../globalConfig';\nimport { addHours, addDays } from '../utils/time';\nimport { debounce } from '../utils/breakpoints';\n\nexport const keys = {\n impressions: 'impressions',\n frequency: 'frequency',\n /**\n * [0] - full match\n * [1] - impression count i.e: \"1\" | \"22\"\n * [2] - impression expiry range quantifier i.e: \"1\" | \"22\"\n * [3] - impression expiry range unit i.e: \"day\" | \"hour\"\n */\n frequencyRegex: /(\\d+)\\/(\\d+)(day|hour)/,\n expires: 'expires',\n exposed: 'exposed',\n target: 'target',\n maxImpressions: 'maxImpressions',\n hours: 'hour',\n days: 'day',\n adSlotId: 'id',\n};\n\nexport default class ImpressionsManager {\n\n constructor(impressionManagerConfig) {\n this.now = (new Date()).getTime(); // this date is used for comparisons only\n this.config = Object.assign({}, impressionManagerConfig);\n this.impressions = this.retrieveImpressionsData();\n this.initImpressionMap();\n }\n\n retrieveImpressionsData() {\n const impressions = this.migrateImpressionsData();\n /*\n Merge migrated data with new data\n console.log('Migrated: ',impressions);\n */\n Object.keys(impressions).map((key, index) => {\n impressions[key] = Object.assign({}, impressions[key], this.config[key]);\n return this;\n });\n /*\n console.log('Merged: ',impressions);\n Filter out entries without frequency\n */\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (!impressions[key][keys.frequency]) {\n // console.log(`Removing ${key} - since it does not have a frequency`,impressions[key]);\n delete impressions[key];\n }\n }\n }\n // console.log('Filtered: ',impressions);\n return impressions;\n }\n\n migrateImpressionsData() {\n let impressions;\n let impressionsData;\n try {\n impressionsData = window.localStorage.getItem(keys.impressions);\n }\n catch (err) {\n // In case of thrown 'SecurityError' or 'QuotaExceededError', the variable should be undefined\n impressionsData = undefined;\n }\n try {\n impressions = JSON.parse(impressionsData);\n }\n catch (err) {\n // Here is where old impression data is converted to new format\n impressions = {};\n const oldImpressionsArray = impressionsData.split(';').filter(e => e);\n\n oldImpressionsArray.forEach((impression) => {\n try {\n const adUnitImpression = impression.split(' = ');\n const name = adUnitImpression[0];\n const data = adUnitImpression[1];\n const tmp = name.split('.');\n let target = tmp.pop();\n if (target && target === 'hp') {\n target = 'homepage';\n }\n const slotId = tmp.join('.');\n const id = `${slotId}_${target}`;\n const exposed = parseInt(data.split('/')[0], 10) || 0;\n const expires = parseInt(data.split('/')[1], 10) || this.now;\n impressions[id] = {};\n impressions[id][keys.adSlotId] = slotId;\n impressions[id][keys.target] = target;\n impressions[id][keys.exposed] = exposed;\n impressions[id][keys.expires] = expires;\n }\n catch (err1) {\n // console.log(`Failed converting impression: ${impression}`, err1);\n }\n });\n }\n return impressions || {};\n }\n\n /**\n * Define the debounced version of the local storage save\n */\n saveImpressionsToLocalStorage() {\n if (this.debouncedSave && typeof this.debouncedSave === 'function') {\n this.debouncedSave();\n }\n else {\n this.debouncedSave = debounce(this.saveImpressionsToLocalStorageImpl, 250, false);\n this.debouncedSave();\n }\n }\n\n /**\n * Implementation of saving the impression map to localstorage\n */\n saveImpressionsToLocalStorageImpl() {\n try {\n localStorage.setItem(keys.impressions, JSON.stringify(this.impressions));\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the operation should not break*/\n console.error('localStorage isn\\'t available:', err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Initializes the impression map based on the retrieved impressions and the global\n * configuration.\n */\n initImpressionMap() {\n Object.keys(this.config).map((key, index) => {\n const adSlotId = key;\n const slot = this.impressions[adSlotId];\n let shouldUpdateExpiryDate = false;\n // Case I: Existing slot (update)\n if (slot) {\n // Case I.I Existing slot, frequency has changed\n if (this.config[adSlotId][keys.frequency] !== slot[keys.frequency]) {\n // Updating the frequency will trigger a new expiry date\n shouldUpdateExpiryDate = true;\n this.impressions[adSlotId][keys.frequency] = this.config[adSlotId][keys.frequency];\n } // Case I.II Existing slot, old expiry date\n else if (this.now > slot[keys.expires]) {\n // Old value that should trigger a new expiry date\n shouldUpdateExpiryDate = true;\n }\n } // Case II: Non-existing slot (create new slot)\n else {\n this.initSlotFromConfig(adSlotId);\n } // Finally, updates the expiry date (cases I.I and I.II)\n if (shouldUpdateExpiryDate) {\n this.updateExpiryDate(adSlotId);\n }\n return this;\n });\n }\n\n /**\n * Updates the expiry date of a slotName based on the configured slot frequency\n * @param {String} slotName - the slotName to update.\n */\n updateExpiryDate(slotName) {\n const now = new Date();\n if (!(this.impressions[slotName] && this.impressions[slotName][keys.frequency])) {\n throw new Error(`Unable to update expiry date for slot: ${slotName}\n - this.impressions[slotName]:`, this.impressions[slotName]);\n }\n const frequencyMap = this.impressions[slotName][keys.frequency].match(keys.frequencyRegex);\n now.setMilliseconds(0);\n now.setSeconds(0);\n now.setMinutes(0);\n if (frequencyMap.indexOf(keys.days) > -1) {\n now.setHours(0);\n }\n this.impressions[slotName][keys.expires] = (frequencyMap.indexOf(keys.days) > -1 ?\n addDays(now, frequencyMap[2]) : addHours(now, frequencyMap[2])).getTime();\n\n // Set max impressions:\n this.impressions[slotName][keys.maxImpressions] = parseInt(frequencyMap[1], 10);\n // Reset exposed\n this.impressions[slotName][keys.exposed] = 0;\n }\n\n /**\n * Initializes a non-existing slot from the passed global configuration for the slot\n * @param {String} slotName - the name of the slot to create\n */\n initSlotFromConfig(slotName) {\n const slot = this.impressions[slotName] || {};\n slot[keys.frequency] = this.config[slotName][keys.frequency];\n slot[keys.target] = this.config[slotName][keys.target];\n slot[keys.exposed] = 0;\n this.impressions[slotName] = slot;\n this.updateExpiryDate(slotName);\n }\n\n /**\n * Registers an impression for a given adSlot.\n * @param {String} adSlotId - the adSlot id to register an impression for\n * @returns {boolean} returns true iff the impression has been registered\n */\n registerImpression(adSlotId) {\n if (adSlotId) {\n const slot = this.impressions[adSlotId];\n if (slot) {\n const exposed = slot[keys.exposed];\n if (isNaN(parseInt(exposed, 10)) === false) {\n this.impressions[adSlotId][keys.exposed] += 1;\n try {\n this.saveImpressionsToLocalStorage();\n }\n catch (err) {\n // console.log('Error saving ad impressions to localStorage!', err);\n }\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Checks whether an adSlot has reached it's allocated impressions count.\n * @param {String} adSlotId - the adSlot to check\n * @returns {boolean} true iff there is a quota for the adSlot, and it has been reached\n */\n reachedQuota(adSlotId) {\n // An adSlotId is suffixed with _homepage | _section if it's targeting is different\n // between the two. If there is no difference, an _all suffix can be used.\n const slotName = this.impressions[`${adSlotId}${globalConfig.department}`] ?\n `${adSlotId}${globalConfig.department}` : `${adSlotId}_all`;\n\n const slot = this.impressions[slotName];\n let atQuota = false;\n if (slot) {\n const now = (new Date()).getTime();\n // Second element of 2/4day matches '2'\n const expires = this.impressions[slotName][keys.expires];\n if (expires < now) {\n this.updateExpiryDate(slotName);\n }\n else {\n const maxImpressions = this.impressions[slotName][keys.maxImpressions];\n // Not expired, did reach max impressions?\n if (maxImpressions) {\n atQuota = this.impressions[slotName][keys.exposed] >= maxImpressions;\n }\n }\n }\n return atQuota;\n }\n\n\n /**\n * Clears the impression map from 'exposed' impressions\n */\n resetImpressions() {\n const impressions = this.impressions;\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (impressions[key][keys.exposed]) {\n impressions[key][keys.exposed] = 0;\n }\n }\n }\n this.saveImpressionsToLocalStorage();\n }\n}\n","import getCookieAsMap from '../utils/cookieUtils';\nimport ImpressionManager from './impressionsManager';\nimport globalConfig from '../globalConfig';\n\nexport const userTypes = {\n payer: 'payer',\n registered: 'registered',\n anonymous: 'anonymous',\n trial: 'trial',\n guest: 'reg_guest',\n};\n\nexport const productTypes = {\n htz: 243,\n tm: 273,\n hdc: 239,\n htz_tm: 274,\n};\n\nexport default class User {\n constructor(config) {\n this.config = Object.assign({}, config.userConfig);\n const cookieMap = getCookieAsMap();\n this.ssoKey = globalConfig.sso;\n if (!cookieMap[this.ssoKey]) {\n // Flips the ssoKey, since cookieMap.ssoKey cannot be used to retrieve data\n this.ssoKey = this.ssoKey === 'tmsso' ? 'engsso' : 'tmsso';\n }\n this.type = this.getUserType(cookieMap);\n this.htz_type = this.getUserTypeByProduct(cookieMap, productTypes.htz, 'tmsso');\n this.tm_type = this.getUserTypeByProduct(cookieMap, productTypes.tm, 'tmsso');\n this.hdc_type = this.getUserTypeByProduct(cookieMap, productTypes.hdc, 'engsso');\n this.impressionManager = new ImpressionManager(config.impressionManagerConfig);\n this.age = this.getUserAge(cookieMap);\n this.gender = this.getUserGender(cookieMap);\n this.sso = this.getUserSSO(cookieMap, this.ssoKey);\n this.country = this.getUserCountry();\n }\n\n getUserType(cookieMap) {\n let userType;\n if (cookieMap && cookieMap[this.ssoKey]) {\n userType = (cookieMap.HtzPusr || cookieMap.TmPusr || cookieMap.HdcPusr) ?\n userTypes.payer : userTypes.registered;\n }\n else {\n userType = userTypes.anonymous;\n }\n return userType;\n }\n\n\n getUserTypeByProduct(cookieMap, productType, ssoKey) {\n let userType = userTypes.anonymous;\n if (cookieMap && cookieMap[ssoKey]) {\n if (cookieMap.userProducts) {\n let userProducts = decodeURIComponent(cookieMap.userProducts);\n userProducts = JSON.parse(userProducts);\n if (productType === productTypes.hdc) {\n userType = this.getHdcUserType(userProducts);\n }\n else {\n userType = this.getHtzTmUserType(userProducts, productType);\n }\n if (userType === userTypes.registered &&\n cookieMap[ssoKey].firstName === 'guest' &&\n cookieMap[ssoKey].lastName === 'guest') {\n userType = userTypes.guest;\n }\n }\n }\n return userType;\n }\n\n getHdcUserType(userProducts) {\n // user has hdc paying product\n if (this.userHasProduct(userProducts, productTypes.hdc, false)) {\n return userTypes.payer;\n }\n // user has hdc trial product\n else if (this.userHasProduct(userProducts, productTypes.hdc, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n getHtzTmUserType(userProducts, productType) {\n // user has htz/tm paying product\n if (this.userHasProduct(userProducts, productType, false) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, false)) {\n return userTypes.payer;\n }\n // user has htz/tm trial product\n else if (this.userHasProduct(userProducts, productType, true) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n userHasProduct(userProducts, productType, trial) {\n return userProducts.products\n .filter(product => product.prodNum === productType && product.trial === trial)\n .length > 0;\n }\n\n getUserAge(cookieMap) {\n let age;\n const usrae = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].usrae;\n if (usrae) {\n age = parseInt(cookieMap[this.ssoKey].usrae, 10);\n age = age > 0 ? age : undefined;\n }\n return age;\n }\n\n getUserGender(cookieMap) {\n let gender;\n const urgdr = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].urgdr;\n if (urgdr) {\n gender = parseInt(cookieMap[this.ssoKey].urgdr, 10);\n gender = gender === 2 || gender === 1 ? gender : undefined;\n }\n return gender;\n }\n\n getUserSSO(cookieMap, ssoKey) {\n return cookieMap[ssoKey];\n }\n\n getUserCountry() {\n const country = window.localStorage.getItem('country');\n if (!country) {\n fetch('https://ms-apps.haaretz.co.il/ms-ip2country/get', {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/jsonp',\n },\n }).then(resp => resp.json())\n .then(data => {\n window.localStorage.setItem('country', data.code);\n },\n err => {}\n );\n return null;\n }\n return country;\n }\n\n}\n","class ConflictResolver {\n constructor(conflictManagementConfig) {\n this.dependencyMap = this.initializeDependencyMap(conflictManagementConfig);\n this.deferredSlots = new Set();\n }\n initializeDependencyMap(conflictManagementJson) {\n const queue = new Map();\n Object.keys(conflictManagementJson).map((key, value) => {\n let rules = conflictManagementJson[key];\n if (rules) {\n rules = rules.filter((item) => item.onsize && item.avoid);\n }\n queue.set(key, {\n id: key,\n rules,\n resolvedWith: null,\n });\n return this;\n });\n return queue;\n }\n\n updateResolvedSlot(adSlotId, resolvedSize) {\n if (!adSlotId) {\n throw new Error('updateResolvedSlot must be called with an adSlotId!');\n }\n if (!resolvedSize) {\n throw new Error('updateResolvedSlot must be called with a resolved size!');\n }\n if (this.dependencyMap.has(adSlotId)) {\n this.dependencyMap.get(adSlotId).resolvedWith = resolvedSize;\n }\n }\n\n\n isBlocked(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocked must be called with an adSlotId!');\n }\n let isBlocked = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n const adSlot = this.dependencyMap.get(adSlotKey);\n for (const adSlotRule of adSlot.rules) {\n // Found rule specific to our target\n if (adSlotRule.avoid === adSlotId) {\n const parentResolvedWith = adSlot.resolvedWith;\n if (parentResolvedWith && adSlotRule.onsize.split(',').find(sizeString => { // eslint-disable-line\n const size = sizeString.split('x').map(numberStr => parseInt(numberStr, 10));\n return this.arraysEqual(size, parentResolvedWith);\n })) {\n // Block found\n this.deferredSlots.add(adSlotId);\n isBlocked = true;\n }\n }\n }\n }\n return isBlocked;\n }\n\n isBlocking(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocking must be called with an adSlotId!');\n }\n let isBlocking = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n if (adSlotKey === adSlotId) {\n isBlocking = true;\n }\n }\n return isBlocking;\n }\n\n /**\n * Gets an array of adSlot Ids for a given adSlotId, that are dependent on (blocked by)\n * @param {String} adSlotId - the blocking slot id\n * @return {Array} an array of blocked slot, that has a dependency on the given slot\n */\n getBlockedSlotsIds(adSlotId) {\n let result;\n if (this.dependencyMap.has(adSlotId)) {\n result = Array.from(this.dependencyMap.get(adSlotId).rules.map(adSlot => adSlot.avoid));\n }\n return result || [];\n }\n\n arraysEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n}\nConflictResolver.EMPTY_SIZE = [];\nexport default ConflictResolver;\n","/**\n * Checks whether two arrays are equal\n * @param {Array} a - the first array to check\n * @param {Array} b - the second array to check\n * @returns {Boolean} true iff both a and b are arrays, with equal values\n */\nexport function arraysEqual(a, b) {\n if (!a || !b) return false;\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (Array.isArray(a[i]) && Array.isArray(b[i])) {\n if (!arraysEqual(a[i], b[i])) return false;\n }\n else if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\nexport default arraysEqual;\n","/* global googletag */\nimport { adTypes } from '../objects/adManager';\nimport globalConfig from '../globalConfig';\nimport { arraysEqual } from '../utils/arrays';\n\nconst hiddenClass = globalConfig.site.indexOf('mouse') > -1 ? 'u-is-hidden' : 'h-hidden';\n\nexport default class adSlot {\n\n constructor(adSlotConfig) {\n this.config = Object.assign({}, adSlotConfig);\n\n // Part I : Markup configuration - passed from AdManager\n this.id = this.config.id;\n if (!this.config.id) {\n throw new Error('an adSlot requires an id!');\n }\n this.target = this.config.target;\n this.type = this.config.type;\n this.responsive = this.config.responsive;\n this.fluid = this.config.fluid;\n this.user = this.config.user;\n this.adManager = this.config.adManager;\n this.htmlElement = this.config.htmlElement;\n this.priority = this.config.priority;\n this.deferredSlot = this.config.deferredSlot;\n\n // Part II : Global, general ad configuration - passed from AdManager\n this.department = this.config.department;\n this.network = this.config.network;\n this.adUnitBase = this.config.adUnitBase;\n\n // Part III : ad specific configuration - passed from globalConfig.adSlotConfig\n this.adSizeMapping = this.config.adSizeMapping;\n this.responsiveAdSizeMapping = this.config.responsiveAdSizeMapping;\n this.blacklistReferrers = this.config.blacklistReferrers ?\n this.config.blacklistReferrers.split(',') : [];\n this.whitelistReferrers = this.config.whitelistReferrers ?\n this.config.whitelistReferrers.split(',') : [];\n\n\n // Part IV : Runtime configuration - calculated data - only present in runtime\n this.lastResolvedSize = undefined; // Initialized in 'slotRenderEnded' callback\n this.lastResolvedWithBreakpoint = undefined; // Initialized in 'slotRenderEnded' callback\n this.slot = undefined; // Holds a googletag.Slot object\n // [https://developers.google.com/doubleclick-gpt/reference#googletag.Slot]\n try {\n if (!this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Checks whether this adSlot is an 'Out-of-page' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isOutOfPage() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n case adTypes.popunder: return true;\n case adTypes.talkback: return false;\n case adTypes.regular: return false;\n default: return false;\n }\n }\n\n /**\n * Checks whether this adSlot is a 'maavaron' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isMaavaron() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n default: return false;\n }\n }\n\n isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n }\n /**\n * Checks whether or not this adSlot has a non-empty whitelist, and if so, that the current\n * referrer appears in the whitelist.\n * Should return false iff there is a whitelist for the current adSlot, but the referrer is not\n * mentioned in the whitelist.\n * @returns {boolean} true iff the ad can be displayed.\n */\n isWhitelisted() {\n let whitelisted = false;\n if (this.whitelistReferrers.length !== 0) {\n for (const referrer of this.whitelistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n whitelisted = true;\n break;\n }\n }\n }\n else {\n whitelisted = true;\n }\n return whitelisted;\n }\n\n /**\n * Checks whether or not this adSlot has a non-empty blacklist, and if so, that the current\n * referrer does not appear in the blacklist.\n * Should return true iff there is a blacklist for the current adSlot, and the referrer is\n * mentioned in the blacklist - to indicate that the adSlot is 'blocked'.\n * @returns {boolean} true iff the ad cannot be displayed.\n */\n isBlacklisted() {\n let blacklisted = false;\n if (this.blacklistReferrers.length !== 0) {\n for (const referrer of this.blacklistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n blacklisted = true;\n break;\n }\n }\n }\n return blacklisted;\n }\n\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n show() {\n if (!this.shown === true) {\n this.shown = true; // Ensure show will be called once per adSlot\n googletag.cmd.push(() => {\n if (this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n // console.log('calling show for slot',this.id,' called @',window.performance.now());\n document.getElementById(this.id).classList.remove(hiddenClass);\n googletag.display(this.id);\n });\n }\n }\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n hide() {\n googletag.cmd.push(() => {\n document.getElementById(this.id).classList.add(hiddenClass);\n });\n }\n\n /**\n * Initializes page-level slot definition for the current slot\n * @return {Slot} slot - the Google Slot that was defined from this AdSlot configuration\n */\n defineSlot() {\n if (this.isMaavaron()) {\n const maavaronSlot = this.defineMaavaron();\n if (this.adManager.shouldSendRequestToDfp(this)) {\n if (!this.shown) {\n this.shown = true; // Ensure show will be called once\n maavaronSlot.display();\n }\n }\n return maavaronSlot;\n }\n const googletag = window.googletag;\n const pubads = googletag.pubads();\n const args = [];\n const defineFn = this.isOutOfPage() ? googletag.defineOutOfPageSlot : googletag.defineSlot;\n // 3 or 2 params according to the function that we want to activate.\n args.push(this.getPath());\n if (this.isOutOfPage() === false) {\n if (this.fluid) {\n args.push('fluid');\n }\n else {\n args.push(this.adSizeMapping);\n }\n }\n args.push(this.id);\n let slot = defineFn.apply(defineFn, args);\n if (slot) {\n // Responsive size Mapping\n if (this.responsive) {\n let responsiveSlotSizeMapping = googletag.sizeMapping();\n const breakpoints = globalConfig.breakpointsConfig.breakpoints;\n const keys = Object.keys(this.responsiveAdSizeMapping);\n for (const key of keys) { // ['xxs','xs',...]\n responsiveSlotSizeMapping.addSize(\n [breakpoints[key], 100], // 100 is a default height, since it is height agnostic\n !arraysEqual(this.responsiveAdSizeMapping[key], [[0, 0]]) ?\n this.responsiveAdSizeMapping[key] : []);\n }\n responsiveSlotSizeMapping = responsiveSlotSizeMapping.build();\n slot = slot.defineSizeMapping(responsiveSlotSizeMapping);\n }\n slot = slot.addService(pubads);\n if (this.isOutOfPage() === false) {\n slot.setCollapseEmptyDiv(true);\n }\n }\n return slot;\n }\n\n /**\n * Returns the current path calculated for the adSlot\n * @returns {String} a formatted string that represent the path for the slot definition\n */\n getPath() {\n /* eslint-disable no-shadow */\n let path = globalConfig.path || [];\n path = path.filter(path => path !== '.');\n path = path.map(section => `${this.id}${this.department}${section}`).join('/');\n // If a path exist, it will be preceded with a forward slash\n path = path && this.config.department !== '_homepage' ? `/${path}` : '';\n /* eslint-enable no-shadow */\n const calculatedPath = `/${this.config.network}/${this.config.adUnitBase}/${this.id}/${this.id}${this.department}${path}`; // eslint-disable-line max-len\n return calculatedPath.toLowerCase();\n }\n\n /* eslint-disable */\n slotRendered(event) {\n const id = event.slot.getAdUnitPath().split('/')[3]; // Convention: [0]/[1]network/[2]base/[3]id\n const isEmpty = event.isEmpty; // Did the ad return as empty?\n const resolvedSize = event.size; // What 'creative' size did the ad return with?\n // Empty or onload callback should be called next?\n }\n /* eslint-enable */\n\n /**\n * Refresh this adSlot\n */\n refresh() {\n googletag.cmd.push(() => {\n googletag.pubads().refresh([this.slot]);\n });\n }\n\n /**\n * Shows 'Maavaron' type adSlot using Passback definition\n * @return {Slot} slot - the Google Slot that was defined for Maavaron\n */\n defineMaavaron() {\n if (!document.referrer.match('loc.haaretz')) {\n const adUnitMaavaronPath = this.getPath();\n const adUnitMaavaronSize = [\n [2, 1],\n ];\n const slot = googletag.pubads().definePassback(adUnitMaavaronPath, adUnitMaavaronSize)\n .setTargeting('UserType', [this.user.type])\n .setTargeting('age', [this.user.age])\n .setTargeting('urgdr', [this.user.gender])\n .setTargeting('articleId', [globalConfig.articleId])\n .setTargeting('stg', [globalConfig.environment]);\n return slot;\n }\n return null;\n }\n}\n","/* global googletag */\nimport User from '../objects/user';\nimport ConflictResolver from '../objects/conflictResolver';\nimport AdSlot from '../objects/adSlot';\nimport { getBreakpoint, getBreakpointName } from '../utils/breakpoints';\nimport { arraysEqual } from '../utils/arrays';\nimport getCookieAsMap from '../utils/cookieUtils';\n\n// There are a total of 7 adTargets:\n// \"all\",\"nonPaying\",\"anonymous\",\"registered\",\"paying\",\"digitalOnly\" and \"digitalAndPrint\"\nexport const adPriorities = {\n high: 'high',\n normal: 'normal',\n low: 'low',\n};\n\nexport const adTargets = {\n all: 'all',\n nonPaying: 'nonPaying',\n anonymous: 'anonymous',\n registered: 'registered',\n paying: 'paying',\n digitalOnly: 'digitalOnly',\n digitalAndPrint: 'digitalAndPrint',\n};\n\n// There are a total of 3 userTypes: \"anonymous\", \"registered\" and \"payer\"\nexport const userTypes = {\n anonymous: 'anonymous',\n registered: 'registered',\n payer: 'payer',\n};\n\nexport const adTypes = {\n maavaron: '.maavaron',\n popunder: '.popunder',\n talkback: '.talkback',\n regular: '',\n};\n\n\nexport default class AdManager {\n\n constructor(config) {\n this.config = Object.assign({}, config);\n this.user = new User(config);\n this.conflictResolver = new ConflictResolver(config.conflictManagementConfig);\n /**\n * Avoid race conditions by making sure to respect the usual timing of GPT.\n * This DFP implementation uses Enable-Define-Display:\n * Define page-level settings\n * enableServices()\n * Define slots\n * Display slots\n */\n try {\n googletag.cmd.push(() => {\n this.initGoogleTargetingParams(); // Define page-level settings\n this.initGoogleGlobalSettings(); // enableServices()\n this.initSlotRenderedCallback(); // Define callbacks\n });\n // Mouse special treatment to base path on mobile breakpoints\n const currentBreakpointName = getBreakpointName(getBreakpoint());\n if (this.config.adManagerConfig.adUnitBase.indexOf('mouse.co.il') > -1 &&\n currentBreakpointName.indexOf('xs') > -1) {\n this.config.adManagerConfig.adUnitBase = 'mouse.co.il.mobile_web';\n }\n // Holds adSlot objects as soon as possible.\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n });\n // Once DOM ready, add more adSlots.\n const onDomLoaded = () => { // eslint-disable-line no-inner-declarations\n try {\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.normal);\n });\n });\n }\n catch (err) {\n console.log(err); // eslint-disable-line no-console\n }\n };\n // Once window was loaded, add the rest of the adSlots.\n const onWindowLoaded = () => { // eslint-disable-line no-inner-declarations\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.low);\n // Clean blocking adSlots that are not defined on this page\n for (const blockingAdSlotKey of this.conflictResolver.dependencyMap.keys()) {\n if (!this.adSlots.has(blockingAdSlotKey)) {\n this.conflictResolver.dependencyMap.delete(blockingAdSlotKey);\n }\n }\n this.showAllDeferredSlots();\n });\n };\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', onDomLoaded);\n window.addEventListener('load', onWindowLoaded);\n break;\n case 'interactive':\n onDomLoaded();\n window.addEventListener('load', onWindowLoaded);\n break;\n default: // 'complete' - no need for event listeners.\n onDomLoaded();\n onWindowLoaded();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Shows all of the adSlots that can be displayed.\n */\n showAllSlots() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.type !== adTypes.talkback && this.shouldSendRequestToDfp(adSlot)) {\n adSlot.show();\n }\n }\n }\n\n /**\n * Gets all adSlots that has a certain priority\n * @param {adPriority} priority - the priority of the ad {high, normal, low}\n * @return {Array} adSlots - all of the defined adSlots that matches\n * the given priority\n */\n getAdSlotsByPriority(priority) {\n function priorityFilter(adSlot) {\n return adSlot.priority === priority;\n }\n return Array.from(this.adSlots.values()).filter(priorityFilter);\n }\n\n showAllDeferredSlots() {\n for (const deferredSlotId of this.conflictResolver.deferredSlots) {\n if (this.adSlots.has(deferredSlotId)) {\n if (!this.conflictResolver.isBlocked(deferredSlotId)) {\n const deferredAdSlot = this.adSlots.get(deferredSlotId);\n if (this.shouldSendRequestToDfp(deferredAdSlot)) {\n deferredAdSlot.show();\n }\n }\n }\n }\n }\n\n /**\n * Refreshes all responsive adSlots\n */\n refreshAllSlots() {\n const currentBreakpoint = getBreakpoint();\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive && adSlot.type !== adTypes.maavaron) {\n if (adSlot.lastResolvedWithBreakpoint !== currentBreakpoint &&\n this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n }\n\n /**\n * Refreshes all adSlots\n */\n refreshAllSlotsInPage() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n\n /**\n * Refreshes adSlot\n */\n\n refreshSlot(adUnitName) {\n const adSlot = this.adSlots.get(adUnitName);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n\n\n /**\n * Initializes adSlots based on the currently found slot markup (HTML page specific),\n * and the predefined configuration for the slots.\n * @param {Object} adSlotConfig - the AdSlots configuration object (see: globalConfig)\n * @param {String} filteredPriority - filters out all adSlots that does not match\n * a given adPriority. This is used to cherry pick the init process of ads.\n * @returns {Map}\n */\n initAdSlots(adSlotConfig, filteredPriority) {\n const adSlots = new Map(this.adSlots);\n let adSlotPlaceholders = Array.from(document.getElementsByClassName('js-dfp-ad'));\n adSlotPlaceholders = adSlotPlaceholders.filter(node => node.id); // only nodes with an id\n const adSlotNodeSet = new Set();\n adSlotPlaceholders = Array.prototype.filter.call(adSlotPlaceholders, node => {\n if (adSlotNodeSet.has(node.id) === false) { // first occurrence of Node\n adSlotNodeSet.add(node.id);\n return true;\n }\n return false;\n });\n // adSlotPlaceholders = adSlotPlaceholders.sort((a, b) => a.offsetTop - b.offsetTop);\n adSlotPlaceholders.forEach(adSlot => {\n const adSlotPriority = adSlotConfig[adSlot.id] ?\n adSlotConfig[adSlot.id].priority || adPriorities.normal : undefined;\n if (adSlotConfig[adSlot.id] && adSlots.has(adSlot.id) === false &&\n adSlotPriority === filteredPriority) {\n // The markup has a matching configuration from adSlotConfig AND was not already defined\n try {\n // adSlotConfig is built from globalConfig, but can be overridden by markup\n const computedAdSlotConfig = Object.assign({}, adSlotConfig[adSlot.id], {\n id: adSlot.id,\n target: adSlot.attributes['data-audtarget'] ?\n adSlot.attributes['data-audtarget'].value : adTargets.all,\n type: this.getAdType(adSlot.id),\n responsive: adSlotConfig[adSlot.id].responsive,\n fluid: adSlotConfig[adSlot.id].fluid || false,\n user: this.user,\n adManager: this,\n htmlElement: adSlot,\n department: this.config.department,\n network: this.config.adManagerConfig.network,\n adUnitBase: this.config.adManagerConfig.adUnitBase,\n deferredSlot: this.conflictResolver.isBlocked(adSlot.id),\n priority: adSlotPriority,\n });\n const adSlotInstance = new AdSlot(computedAdSlotConfig);\n adSlots.set(adSlot.id, adSlotInstance);\n if (adSlotInstance.type !== adTypes.talkback &&\n adSlotInstance.priority === adPriorities.high &&\n this.shouldSendRequestToDfp(adSlotInstance)) {\n /*\n console.log('calling show for high priority slot', adSlotInstance.id, ' called @',\n window.performance.now());\n */\n adSlotInstance.show();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n });\n return adSlots;\n }\n\n isPriority(adSlotId) {\n return (typeof adSlotId === 'string' &&\n (adSlotId.indexOf('plazma') > 0 ||\n adSlotId.indexOf('maavaron') > 0 ||\n adSlotId.indexOf('popunder') > 0));\n }\n\n /**\n * Returns the adType based on the adSlot name.\n * @param {String} adSlotId - the adSlot's identifier.\n * @returns {*} enumerated export 'adTypes'\n */\n getAdType(adSlotId) {\n if (!adSlotId) {\n throw new Error('Missing argument: a call to getAdType must have an adSlotId');\n }\n if (adSlotId.indexOf(adTypes.maavaron) > -1) return adTypes.maavaron;\n if (adSlotId.indexOf(adTypes.popunder) > -1) return adTypes.popunder;\n if (adSlotId.indexOf(adTypes.talkback) > -1) return adTypes.talkback;\n return adTypes.regular;\n }\n\n /**\n * @param {object} adSlot the AdSlot\n * @returns {boolean|*}\n */\n shouldSendRequestToDfp(adSlot) {\n // Conflict management check\n return this.conflictResolver.isBlocked(adSlot.id) === false &&\n // Valid Referrer check\n adSlot.isWhitelisted() &&\n // Not in referrer Blacklist\n adSlot.isBlacklisted() === false &&\n this.shouldDisplayAdAfterAdBlockRemoval(adSlot) &&\n // if a paywall pop-up is shown And the number is 12 or more - SHOW MAAVRON\n this.shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) &&\n // Responsive: breakpoint contains ad?\n this.doesBreakpointContainAd(adSlot) &&\n // check in case of Smartphoneapp\n this.haveValidCookieForSmartphoneapp() &&\n // Targeting check (userType vs. slotTargeting)\n this.doesUserTypeMatchBannerTargeting(adSlot) &&\n // Impressions Manager check (limits number of impressions per slot)\n this.user.impressionManager.reachedQuota(adSlot.id) === false;\n }\n\n printShouldSendRequestToDfp(id) {\n let res = '';\n if (!this.adSlots.has(id)) {\n res = `id not exist: ${id}`;\n }\n else {\n const a = this.adSlots.get(id);\n res += this.conflictResolver.isBlocked(a.id) === !1 ? '' : 'isBlocked,';\n res += a.isWhitelisted() ? '' : 'isWhitelisted,';\n res += a.isBlacklisted() === !1 ? '' : 'isBlacklisted,';\n res += this.shouldDisplayAdAfterAdBlockRemoval(a) ? '' : 'AdBlockRemoval,';\n res += this.shouldDisplayAdMaavaronAfterPayWallBanner(a) ? '' : 'PayWallBanner,';\n res += this.doesBreakpointContainAd(a) ? '' : 'Breakpoint,';\n res += this.haveValidCookieForSmartphoneapp() ? '' : 'Smartphoneapp,';\n res += this.doesUserTypeMatchBannerTargeting(a) ? '' : 'Targeting,';\n res += this.user.impressionManager.reachedQuota(a.id) === !1 ? '' : 'reachedQuota,';\n res = `
${id}
${res}
`;\n }\n document.write(res);\n return res;\n }\n\n testShouldSendRequestToDfp(id) {\n // leave the old name for ios legacy\n let cookieMap = getCookieAsMap();\n cookieMap = JSON.stringify(cookieMap);\n cookieMap = cookieMap.replace(/,/g, '
');\n const res = `
${cookieMap}
`;\n document.write(res);\n return res;\n }\n\n shouldDisplayAdAfterAdBlockRemoval(adSlot) {\n return !(this.config.adBlockRemoved === true &&\n (adSlot.type === adTypes.maavaron ||\n adSlot.type === adTypes.popunder));\n }\n\n shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) {\n let shouldDisplay = true;\n if (this.config.site === 'haaretz' && adSlot.type === adTypes.maavaron) {\n try {\n const paywallBanner = JSON.parse(window.localStorage.getItem('_cobj'));\n shouldDisplay = !paywallBanner || ((paywallBanner.mc && paywallBanner.mc >= 12) ||\n (paywallBanner.nextslotLocation &&\n !paywallBanner.nextslotLocation.includes('pop')));\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error('ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner');\n /* eslint-enable no-console*/\n }\n }\n return shouldDisplay;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n\n haveValidCookieForSmartphoneapp() {\n return this.config.isValidForsmartPhone;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n doesUserTypeMatchBannerTargeting(adSlotOrTarget) {\n // if the user is smadar show her all the banners\n const cookieMap = getCookieAsMap();\n if (cookieMap.login === 'pilosmadar@gmail.com') {\n return true;\n }\n if (cookieMap.tmsso !== undefined && cookieMap.tmsso.userName === 'pilosmadar@gmail.com') {\n return true;\n }\n const userType = this.user.type;\n const adTarget = typeof adSlotOrTarget === 'string' ? adSlotOrTarget : adSlotOrTarget.target;\n\n switch (adTarget) {\n case adTargets.all : return true;\n case adTargets.nonPaying :\n return userType === userTypes.anonymous || userType === userTypes.registered;\n case adTargets.anonymous : return userType === userTypes.anonymous;\n case adTargets.registered : return userType === userTypes.registered;\n case adTargets.paying : return userType === userTypes.payer;\n case adTargets.digitalOnly : return userType === userTypes.payer;\n case adTargets.digitalAndPrint : return userType === userTypes.payer;\n default: return false;\n }\n }\n\n /**\n * Report to the AdManager that a breakpoint has been switched (passed from one break to\n * another). Should there be a responsive slot with a\n * @param {Breakpoint} breakpoint - the breakpoint that is currently being displayed\n * @returns {Integer} affected - the number of adSlots affected by the change\n */\n switchedToBreakpoint(breakpoint) {\n if (!breakpoint) {\n throw new Error('Missing argument: a call to switchedToBreakpoint must have an breakpoint');\n }\n let count = 0;\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive === true && adSlot.lastResolvedWithBreakpoint) {\n if (adSlot.lastResolvedWithBreakpoint !== breakpoint) {\n adSlot.refresh();\n count++;\n }\n }\n }\n return count;\n }\n\n /**\n * Checks whether an adSlot is defined for a given breakpoint (Default: current breakpoint)\n * @param {AdSlot} adSlot - the adSlot to check.\n * @param {Breakpoint} [breakpoint=currentBreakpoint] - the breakpoint to check this ad in.\n * @returns {boolean} true iff the adSlot is defined for the given breakpoint.\n */\n doesBreakpointContainAd(adSlot, breakpoint = getBreakpoint()) {\n if (!adSlot) {\n throw new Error('Missing argument: a call to doesBreakpointContainAd must have an adSlot');\n }\n let containsBreakpoint = true;\n if (adSlot.responsive === true) {\n const mapping = adSlot.responsiveAdSizeMapping[getBreakpointName(breakpoint)];\n if (Array.isArray(mapping) === false) {\n throw new Error(`Invalid argument: breakpoint:${breakpoint} doesn't exist!`, this);\n }\n containsBreakpoint = mapping.length > 0 && !arraysEqual(mapping, [[0, 0]]);\n }\n return containsBreakpoint;\n }\n\n /**\n * Initializes the callback from the 'slotRenderEnded' event for each slot\n */\n initSlotRenderedCallback() {\n if (window.googletag && window.googletag.apiReady) {\n const pubads = window.googletag.pubads();\n pubads.addEventListener('slotRenderEnded', event => {\n const id = event.slot.getAdUnitPath().split('/')[3];\n const isEmpty = event.isEmpty;\n const resolvedSize = event.size;\n // console.log('slotRenderEnded for slot',id,' called @',window.performance.now());\n if (this.adSlots.has(id)) {\n const adSlot = this.adSlots.get(id);\n adSlot.lastResolvedSize = resolvedSize;\n adSlot.lastResolvedWithBreakpoint = getBreakpoint();\n if (isEmpty) {\n adSlot.lastResolvedSize = ConflictResolver.EMPTY_SIZE;\n adSlot.hide();\n this.releaseSlotDependencies(adSlot);\n }\n else {\n this.releaseSlotDependencies(adSlot, adSlot.lastResolvedSize);\n }\n this.user.impressionManager.registerImpression(`${adSlot.id}${this.config.department}`);\n this.user.impressionManager.registerImpression(`${adSlot.id}_all`);\n }\n else {\n /*\n console.error(`Cannot find an adSlot with id: ${id} - Ad Unit path is\n ${event.slot.getAdUnitPath()}`);\n */\n }\n });\n }\n else {\n throw new Error('googletag api was not ready when \\'initSlotRenderedCallback\\' was called!');\n }\n }\n\n releaseSlotDependencies(adSlot) {\n try {\n const id = adSlot.id;\n this.conflictResolver.updateResolvedSlot(id, adSlot.lastResolvedSize);\n if (this.conflictResolver.isBlocking(id)) {\n // Hide all blocked adSlots\n for (const blockedSlot of this.conflictResolver.getBlockedSlotsIds(id)) {\n if (this.conflictResolver.isBlocked(blockedSlot)) {\n if (this.adSlots.has(blockedSlot)) {\n this.adSlots.get(blockedSlot).hide();\n }\n }\n }\n // Show the non blocked\n for (const deferredSlotKey of this.conflictResolver.deferredSlots.keys()) {\n const deferredAdSlot = this.adSlots.get(deferredSlotKey);\n if (deferredAdSlot && this.shouldSendRequestToDfp(deferredAdSlot)) {\n this.conflictResolver.deferredSlots.delete(deferredSlotKey);\n if (deferredAdSlot.deferredSlot) {\n deferredAdSlot.defineSlot();\n deferredAdSlot.deferredSlot = false;\n }\n deferredAdSlot.show();\n }\n }\n }\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error(`Cannot updateSlotDependencies for adSlot: ${adSlot.id}`);\n /* eslint-enable no-console*/\n }\n }\n\n setSsoGroupKey() {\n fetch(`/ssoGroupKey?value=${this.user.sso.userId}`, {\n method: 'GET',\n cache: 'no-cache',\n }).then(value => {\n if (value) {\n value.json().then(data => {\n if (data && data.result && data.result !== 'item not found'\n && data.result !== 'value is empty') {\n localStorage.setItem('_SsoGroupKey', data.result);\n }\n });\n }\n });\n }\n\n /**\n * Initializes page-level targeting params.\n */\n initGoogleTargetingParams() {\n if (window.googletag && window.googletag.apiReady) {\n // Returns a reference to the pubads service.\n let SsoGroupKey = null;\n try {\n SsoGroupKey = localStorage.getItem('_SsoGroupKey');\n if (!SsoGroupKey && this.user.sso.userId) {\n this.setSsoGroupKey();\n }\n }\n catch (e) {\n SsoGroupKey = null;\n }\n const pubads = googletag.pubads();\n // Environment targeting (dev, test, prod)\n if (this.config.environment) {\n pubads.setTargeting('stg', [this.config.environment]);\n }\n // App targeting\n // User targeting\n if (this.user.htz_type) {\n pubads.setTargeting('htz_user_type', [this.user.htz_type]);\n }\n if (this.user.tm_type) {\n pubads.setTargeting('tm_user_type', [this.user.tm_type]);\n }\n if (this.user.hdc_type) {\n pubads.setTargeting('hdc_user_type', [this.user.hdc_type]);\n }\n // Context targeting\n if (this.config.section) {\n pubads.setTargeting('section', [this.config.section]);\n }\n if (this.config.sub_section) {\n pubads.setTargeting('sub_section', [this.config.sub_section]);\n }\n if (this.config.articleId) {\n pubads.setTargeting('articleId', [this.config.articleId]);\n pubads.setTargeting('react', ['false']);\n }\n if (this.config.gStatCampaignNumber && this.config.gStatCampaignNumber !== -1) {\n pubads.setTargeting('gstat_campaign_id', [this.config.gStatCampaignNumber]);\n }\n if (this.config.proposalNumber) {\n pubads.setTargeting('proposaltype', [this.config.proposalNumber]);\n }\n if (this.config.pageType) {\n pubads.setTargeting('pageType', [this.config.pageType]);\n }\n if (this.config.isWriterAlerts) {\n pubads.setTargeting('WriterAlerts', ['true']);\n }\n // AdBlock removal\n if (this.config.adBlockRemoved) {\n pubads.setTargeting('adblock_removed', [this.config.adBlockRemoved]);\n }\n // University targeting - triggered via cookie\n if (this.config.wifiLocation) {\n pubads.setTargeting('wifi', [this.config.wifiLocation]);\n }\n if (this.config.tags && Array.isArray(this.config.tags)) {\n pubads.setTargeting('tags', [...this.config.tags]);\n }\n\n if (this.user.sso && this.user.sso.userId && SsoGroupKey) {\n pubads.setTargeting(SsoGroupKey, this.user.sso.userId);\n }\n if (this.config.anonymousId) {\n const anonymousIdKeyName = 'anonymousIdKey';\n pubads.setTargeting(anonymousIdKeyName, this.config.anonymousId);\n }\n if (this.user.country) {\n pubads.setTargeting('country', this.user.country);\n }\n\n const cityNames = this.getCityNames();\n if (cityNames) {\n pubads.setTargeting('cityName', [...cityNames]);\n }\n\n // Ads Centering\n pubads.setCentering(true);\n }\n else {\n throw new Error('googletag api was not ready when \\'initGoogleTargetingParams\\' was called!');\n }\n }\n\n /**\n * Initializes googletag services.\n */\n initGoogleGlobalSettings() {\n if (window.googletag && window.googletag.apiReady) {\n const googleGlobalSettings = this.config.googleGlobalSettings;\n // Enable GET parameter overrides\n if (window.location.search) {\n const search = window.location.search;\n if (search.indexOf('sraon') > 0) {\n console.log('Single Request Mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = true;\n }\n else if (search.indexOf('sraoff') > 0) {\n console.log('Single Request Mode: disabled');// eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = false;\n }\n if (search.indexOf('asyncrenderingon') > 0) {\n console.log('Async rendering mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = true;\n }\n else if (search.indexOf('asyncrenderingonoff') > 0) {\n console.log('Sync rendering mode: active');// eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = false;\n }\n }\n // Google services activation\n if (googleGlobalSettings.enableSingleRequest === true) {\n googletag.pubads().enableSingleRequest();\n }\n // if (googleGlobalSettings.enableAsyncRendering === true) {\n // googletag.pubads().enableAsyncRendering();\n // }\n // else {\n // googletag.pubads().enableSyncRendering();\n // }\n // Enables all GPT services that have been defined for ad slots on the page.\n googletag.enableServices();\n }\n else {\n throw new Error('googletag api wasn\\'t ready when \\'initGoogleGlobalSettings\\' was called!');\n }\n }\n\n\n getCityNames() {\n const cityNames = [];\n document.querySelectorAll('[data-location-city-name]').forEach((element) => {\n if (!cityNames.includes(element.dataset.locationCityName)) {\n cityNames.push(element.dataset.locationCityName);\n }\n });\n return cityNames.length > 0 ? cityNames : null;\n }\n\n}\n","/* globals googletag */\nimport AdManager from '../src/objects/adManager';\nimport globalConfig from './globalConfig';\nimport { getBreakpoint, debounce } from '../src/utils/breakpoints';\n\nconst defaultConfig = globalConfig || {};\nconst resizeTimeout = 250;\n\nexport default class DFP {\n\n constructor(config) {\n this.config = Object.assign({}, defaultConfig, config);\n this.wasInitialized = false;\n this.initStarted = false;\n this.breakpoint = getBreakpoint();\n this.initWindowResizeListener();\n }\n\n /**\n * This part of the object's construction is dependent on the call to 'init'\n */\n resumeInit() {\n try {\n this.adManager = this.adManager || new AdManager(this.config);\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * initializes the 'googletag' global namespace and add the\n * google publish tags library to the page\n * @returns {Promise} that resolves to true once the googletag api is ready to use\n * (googletag.apiReady = true)\n */\n initGoogleTag() {\n const dfpThis = this;\n return new Promise((resolve, reject) => {\n if (dfpThis.initStarted === true) {\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(dfpThis);\n });\n }\n else {\n dfpThis.initStarted = true;\n // set up a place holder for the gpt code downloaded from google\n window.googletag = window.googletag || {};\n\n // this is a command queue used by GPT any methods added to it will be\n // executed when GPT code is available, if GPT is already available they\n // will be executed immediately\n window.googletag.cmd = window.googletag.cmd || [];\n // load google tag services JavaScript\n (() => {\n const tag = window.document.createElement('script');\n tag.async = true;\n tag.type = 'text/javascript';\n // Supports both https and http\n tag.setAttribute('src', '//www.googletagservices.com/tag/js/gpt.js');\n const node = window.document.getElementsByTagName('script')[0];\n tag.addEventListener('load', () => {\n dfpThis.resumeInit();\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(this);\n });\n });\n tag.addEventListener('error', (error) => {\n dfpThis.wasInitialized = false;\n reject(error);\n });\n node.parentNode.insertBefore(tag, node);\n })();\n }\n });\n }\n\n /**\n * Returns true iff googletag was properly initialized on the page\n * @returns {boolean}\n */\n isGoogleTagReady() {\n if (this.wasInitialized === true || (window.googletag && window.googletag.apiReady)) {\n this.wasInitialized = true;\n }\n return this.wasInitialized;\n }\n\n /**\n * Initializes the window resize listener to support responsive ad refreshes\n */\n initWindowResizeListener() {\n const dfpThis = this;\n function onResize() {\n const currentBreakpoint = getBreakpoint();\n if (dfpThis.breakpoint !== currentBreakpoint) {\n dfpThis.breakpoint = currentBreakpoint;\n if (dfpThis.adManager) {\n dfpThis.adManager.refreshAllSlots();\n }\n else {\n throw new Error('initWindowResizeListener error - adManager instance is not available');\n }\n }\n }\n const debouncedFunction = debounce(onResize, resizeTimeout);\n window.onresize = debouncedFunction;\n }\n}\n","// generated by genversion\nexport const version = '2.6.5';\n","import DFP from './dfp';\nimport globalConfig from './globalConfig';\nimport { version as v } from './version';\n\n// DFP version is based on the package.json\nDFP.version = v || 'VERSION';\n\n/*\n // Only for development mode\n if ( process.env.NODE_ENV !== 'production' ) {\n DFP.dev = '123';\n }\n */\n\nexport const config = globalConfig;\nexport const version = DFP.version;\nexport default DFP;\n"]} \ No newline at end of file +{"version":3,"sources":["../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/classCallCheck.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/createClass.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/toConsumableArray.js","../src/utils/cookieUtils.js","../src/globalConfig.js","../src/utils/time.js","../src/utils/breakpoints.js","../src/objects/impressionsManager.js","../src/objects/user.js","../src/objects/conflictResolver.js","../src/utils/arrays.js","../src/objects/adSlot.js","../src/objects/adManager.js","../src/dfp.js","../src/version.js","../src/index.js"],"names":["instance","Constructor","TypeError","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","defineProperty","key","protoProps","staticProps","prototype","arr","Array","isArray","arr2","from","globalConfig","userTypes","ImpressionManager","ssoKey","arraysEqual","adSlot","AdSlot","DFP","version","v"],"mappings":"AAAA,uBAAgB,UAAUA,QAAV,EAAoBC,WAApB,EAAiC;MAC3C,EAAED,oBAAoBC,WAAtB,CAAJ,EAAwC;UAChC,IAAIC,SAAJ,CAAc,mCAAd,CAAN;;CAFJ;;ACAA,mBAAe,CAAC,YAAY;WACjBC,gBAAT,CAA0BC,MAA1B,EAAkCC,KAAlC,EAAyC;SAClC,IAAIC,IAAI,CAAb,EAAgBA,IAAID,MAAME,MAA1B,EAAkCD,GAAlC,EAAuC;UACjCE,aAAaH,MAAMC,CAAN,CAAjB;iBACWG,UAAX,GAAwBD,WAAWC,UAAX,IAAyB,KAAjD;iBACWC,YAAX,GAA0B,IAA1B;UACI,WAAWF,UAAf,EAA2BA,WAAWG,QAAX,GAAsB,IAAtB;aACpBC,cAAP,CAAsBR,MAAtB,EAA8BI,WAAWK,GAAzC,EAA8CL,UAA9C;;;;SAIG,UAAUP,WAAV,EAAuBa,UAAvB,EAAmCC,WAAnC,EAAgD;QACjDD,UAAJ,EAAgBX,iBAAiBF,YAAYe,SAA7B,EAAwCF,UAAxC;QACZC,WAAJ,EAAiBZ,iBAAiBF,WAAjB,EAA8Bc,WAA9B;WACVd,W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WE;kBACd;;UAAM,UAAN;iBACO,QAAY,UAAA,SAAA,QAAqB;YAClC,QAAA,gBAAJ,MAAkC;oBAChC,IAAA,KAAmB,YAAM;oBACvB,iBAAA;oBACA;;eAGC;kBACH,cAAA;;iBAEA,YAAmB,OAAA,aAAnB;;;;;iBAKA,UAAA,MAAuB,OAAA,UAAA,OAAvB;;WAEC,YAAM;gBACC,MAAM,OAAA,SAAA,cAAZ;gBACA,QAAA;gBACA,OAAA;;gBAEA,aAAA,OAAA;gBACM,OAAO,OAAA,SAAA,qBAAA,UAAb;gBACA,iBAAA,QAA6B,YAAM;sBACjC;wBACA,IAAA,KAAmB,YAAM;wBACvB,iBAAA;wBAED;;;gBAEH,iBAAA,SAA8B,UAAA,OAAW;sBACvC,iBAAA;qBACA;;iBAEF,WAAA,aAAA,KAAA;;;OAnCC;;;;;;;;;;uCA6CU;UACb,KAAA,mBAAA,QAAiC,OAAA,aAAoB,OAAA,UAAzD,UAAqF;aACnF,iBAAA;;aAEK,KAAP;;;;;;;;;+CAMyB;UACnB,UAAN;eACA,WAAoB;YACZ,oBAAN;YACI,QAAA,eAAJ,mBAA8C;kBAC5C,aAAA;cACI,QAAJ,WAAuB;oBACrB,UAAA;iBAEG;kBACG,IAAA,MAAN;;;;UAIA,oBAAoB,SAAA,UAA1B;aACA,WAAA;;;;;;;AC5GJ;AACA,AAAO,IAAMC,YAAU;;ACGvB;AACAD,MAAI,UAAUE,aAAK;;;;;;;;;AASnB,AAAO,IAAM,SAAST;AACtB,AAAO,IAAMQ,aAAUD,MAAI,QAC3B","file":"dfp.es6.js","sourcesContent":["export default (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n});","export default (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();","export default (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n});","/**\n * Htz-cookie-util\n * @module htzCookieUtil\n * @author Elia Grady elia.grady@haaretz.co.il\n * @license MIT\n */\n\n/**\n * Translates Key-Value string into a convenient map.\n * @param {String} string String in format of \"keyvalue.....\"\n * @param {object} options object for overriding defaults:\n * options.separator is a String or regExp that separates between each key value pairs\n * (default is ';'). options.operator is a String or regExp that separates between each key\n * and value within a pair (default is '=').\n * @returns {object} a map object, with key-value mapping according to the passed configuration.\n */\nfunction stringToMap(string,\n { separator = ';', operator = '=' } = {}) {\n const map = {};\n const itemsArr = string.split(separator);\n itemsArr.forEach(element => {\n if (typeof element === 'string') {\n const keyValue = element.split(operator);\n if (keyValue.length === 2) {\n try {\n map[keyValue[0]] = decodeURIComponent(keyValue[1]);\n }\n catch (e) {\n // Do nothing, malformed URI\n }\n }\n }\n });\n return map;\n}\nexport const ssoKey = window.location.hostname.indexOf('haaretz.com') > -1 ? 'engsso' : 'tmsso';\n\n// Translates Cookie string into a convenient map.\nexport default function getCookieAsMap() {\n const map = stringToMap(document.cookie, { separator: /;\\s?/ });\n if (typeof map.tmsso === 'string') {\n map.tmsso = stringToMap(map.tmsso, { separator: ':' });\n }\n if (typeof map.engsso === 'string') {\n map.engsso = stringToMap(map.engsso, { separator: ':' });\n }\n return map;\n}\n","/* global dfpConfig */\nimport getCookieAsMap, { ssoKey } from './utils/cookieUtils';\n// globalConfig for DFP\nlet dfpBaseConf;\ntry {\n dfpBaseConf = window.JSON.parse(document.getElementById('dfpConfig').textContent);\n}\ncatch (err) {\n dfpBaseConf = window.dfpConfig;\n}\nconst dfpConfig = Object.assign({\n get referrer() {\n return document.referrer ? document.referrer : '';\n },\n get isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n },\n /**\n * Returns true iff the loaded page is the homepage (no inner path)\n * @returns {boolean}\n */\n get isHomepage() {\n return window.location.pathname === '/' || this.environment === 3; // 'prod'\n },\n get department() {\n return this.isHomepage ? '_homepage' : '_section';\n },\n /**\n * returns the domain the page was loaded to. i.e: 'haaretz.co.il', 'haaretz.com'\n * @returns {string} the domain name from the windows's location hostname property\n */\n get domain() {\n const regexMatch = /([\\d|\\w]+)(\\.co\\.il|\\.com)(.*)?/.exec(window.location.hostname);\n const result = regexMatch ? regexMatch[0] : window.location.hostname;\n return result;\n },\n /**\n * Returns an array of concatenated paths, separated by a dot.\n * For example, for the URL:\n * http://www.haaretz.co.il/news/world/america/us-election-2016/LIVE-1.2869045\n * the path is '/news/world/america/us-election-2016/LIVE-1.2869045'.\n * This function takes the directories ['news', 'world', 'america', 'us-election-2016']\n * and converts it to the following format:\n * ['.news', '.news.world', '.news.world.america', '.news.world.america.us-election-2016']\n * This denotes the path configuration for the given adSlot\n * non articles (sections) will be given a '0' - no articleId value for targeting purposes)\n * @returns {Array.} an array of path names\n */\n get path() {\n let sectionArray = this.articleId && this.articleId !== '0' ?\n window.location.pathname.split('/').slice(1, -1) :\n window.location.pathname.split('/').slice(1);\n sectionArray = sectionArray.filter(path =>\n path !== 'wwwMobileSite' && path !== 'whtzMobileSite');\n return sectionArray\n .map(section => `.${section}`)\n .map((section, index, arr) => arr.slice(0, index + 1)\n .reduce((last, current) => last.concat(current)));\n },\n /**\n * Returns a string representation for the name of the site\n * @return {*|string}\n */\n get site() {\n let site;\n if (window.location.hostname.indexOf('haaretz.co.il') > -1) {\n site = 'haaretz';\n }\n else if (window.location.hostname.indexOf('themarker.com') > -1) {\n site = 'themarker';\n }\n else if (window.location.hostname.indexOf('mouse.co.il') > -1) {\n site = 'mouse';\n }\n return site || 'haaretz';\n },\n /**\n * Returns the current environment targeting param, if such is defined.\n * @returns {number} targeting param, 1 for local development, 2 for test servers and 3 for prod.\n * May return undefined if no targeting is specified.\n */\n get environment() {\n const env = {\n dev: 1,\n test: 2,\n prod: 3,\n };\n return window.location.port === '8080' ? env.dev :\n (window.location.hostname.indexOf('pre.haaretz.co.il') > -1\n || window.location.hostname.indexOf('tmtest.themarker.com') > -1\n || window.location.hostname.indexOf('pre.haaretz.com') > -1\n || window.location.hostname.indexOf('prodmouse.mouse.co.il') > -1) ? env.test :\n (window.location.pathname.indexOf('/cmlink/Haaretz.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/TheMarker.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/Mouse.HomePage') > -1)\n ? env.prod : undefined;\n },\n /**\n * Returns the articleIf if on an article page, or null otherwise\n * @returns {string} an articleId string from the pathname, or 0 if not found\n */\n get articleId() {\n const articleIdMatch = /\\d\\.\\d+/g.exec(window.location.pathname);\n let articleId = '0';\n if (articleIdMatch) {\n articleId = articleIdMatch.pop(); // Converts [\"1.23145\"] to \"1.23145\"\n }\n return articleId;\n },\n utm_: {\n get content() {\n return this.getUrlParam('utm_content');\n },\n get source() {\n return this.getUrlParam('utm_source');\n },\n get medium() {\n return this.getUrlParam('utm_medium');\n },\n get campaign() {\n return this.getUrlParam('utm_campaign');\n },\n getUrlParam(key) {\n const results = RegExp(`(${key})(=)([^&\"]+)`).exec(window.location.search);\n return results && results[3] ? results[3] : undefined;\n },\n },\n get adBlockRemoved() {\n let adBlockRemoved = false;\n try {\n if (localStorage.getItem('adblock_removed')) {\n adBlockRemoved = true;\n }\n }\n catch (err) {\n // do nothing\n }\n return adBlockRemoved;\n },\n get ssoGroupKey() {\n return window.localStorage.getItem('_SsoGroupKey');\n },\n get anonymousId() {\n const cookieName = 'anonymousId';\n const cookieMap = getCookieAsMap();\n let anonymousId = '';\n if (cookieMap && cookieMap[cookieName]) {\n anonymousId = cookieMap[cookieName];\n }\n return anonymousId;\n },\n get isWriterAlerts() {\n return (location.search.indexOf('writerAlerts=true') > -1);\n },\n get wifiLocation() {\n let wifiLocation;\n const cookieName = '_htzwif'; // eslint-disable-line no-underscore-dangle\n const cookieMap = getCookieAsMap();\n try {\n if (cookieMap && cookieMap[cookieName]) {\n if (cookieMap[cookieName].toLowerCase() === 'arcaffe') {\n wifiLocation = 'ArCafe';\n }\n if (cookieMap[cookieName].toLowerCase() === 'university') {\n wifiLocation = 'university';\n }\n }\n if (cookieMap && cookieMap.fairs) {\n wifiLocation = 'fairs';\n }\n }\n catch (err) {\n // do nothing\n }\n return wifiLocation;\n },\n get isValidForsmartPhone() {\n let validForAds = true;\n const PageUrl = window.location.href;\n const isSmartphoneapp = PageUrl.match('haaretzsmartphoneapp');\n const cookieMap = getCookieAsMap();\n try {\n if (isSmartphoneapp) {\n // eslint-disable-line no-underscore-dangle\n if (cookieMap && cookieMap.HtzPusr &&\n (cookieMap.tmsso === undefined || cookieMap.tmsso.userName !== 'pilosmadar@gmail.com')) {\n validForAds = false;\n }\n }\n }\n catch (err) {\n // do nothing\n }\n return validForAds;\n },\n get gStatCampaignNumber() {\n let gstatCampaign;\n try {\n gstatCampaign = localStorage.getItem('GstatCampaign') ?\n JSON.parse(localStorage.getItem('GstatCampaign')) : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n gstatCampaign = undefined;\n }\n return gstatCampaign ? gstatCampaign.CampaignNumber : undefined;\n },\n get pageType() {\n let type = '';\n try {\n const htmlclassList = document.querySelector('html').classList;\n switch (true) {\n case /mouse_location/.test(htmlclassList):\n type = 'mouse_location';\n break;\n case /mouse_event/.test(htmlclassList):\n type = 'mouse_event';\n break;\n case /contentType-story/.test(htmlclassList):\n type = 'mouse_article';\n break;\n default:\n if (this.articleId !== '0') {\n switch (this.domain) {\n case 'haaretz.co.il':\n type = 'htz_article';\n break;\n case 'haaretz.com':\n type = 'hdc_article';\n break;\n case 'themarker.com':\n type = 'tm_article';\n break;\n default:\n type = '';\n }\n }\n else {\n type = '';\n }\n }\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n type = '';\n }\n return type;\n },\n get proposalNumber() {\n let proposal;\n try {\n proposal = localStorage.getItem('proposaltype') ?\n localStorage.getItem('proposaltype') : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n proposal = undefined;\n }\n return proposal;\n },\n adSlotConfig: {\n 'haaretz.co.il.example.slot': {\n id: 'slotId',\n // path : \"/network/base/slotId/slotId_subsection\", Will be calculated from AdManager\n responsive: true,\n adSizeMapping: [['width1', 'height1'], ...['widthN', 'heightN']],\n priority: 'normal',\n fluid: false,\n responsiveAdSizeMapping: {\n xxs: [['width1', 'height1'], ...['widthN', 'heightN']],\n xs: [['width1', 'height1'], ...['widthN', 'heightN']],\n s: [['width1', 'height1'], ...['widthN', 'heightN']],\n m: [['width1', 'height1'], ...['widthN', 'heightN']],\n l: [['width1', 'height1'], ...['widthN', 'heightN']],\n xl: [['width1', 'height1'], ...['widthN', 'heightN']],\n xxl: [['width1', 'height1'], ...['widthN', 'heightN']],\n },\n blacklistReferrers: 'comma, delimited, blacklisted, referrer, list',\n whitelistReferrers: 'comma, delimited, referrer, list',\n },\n },\n adManagerConfig: {\n network: '9401',\n adUnitBase: 'haaretz.co.il_Web',\n },\n breakpointsConfig: {\n get breakpoints() {\n // Override in VM from backend to control this toggle.\n let breakpoints;\n switch (dfpConfig.googleGlobalSettings.breakpointType) {\n case 'type1': breakpoints = this.breakpoints1; break;\n case 'type2': breakpoints = this.breakpoints2; break;\n case 'type3': breakpoints = this.breakpoints3; break;\n case 'type4': breakpoints = this.breakpoints4; break;\n default: breakpoints = this.breakpoints1;\n }\n return breakpoints;\n },\n // Type 1\n breakpoints1: {\n xxs: 600,\n xs: 761,\n s: 993,\n m: 1009,\n l: 1291,\n xl: 1600,\n xxl: 1900,\n },\n // Type 2\n breakpoints2: {\n xxs: 600,\n xs: 1000,\n s: 1150,\n m: 1281,\n l: 1600,\n xl: 1920,\n xxl: 1920,\n },\n // Type 3\n breakpoints3: {\n xxs: 100,\n xs: 480,\n s: 600,\n m: 768,\n l: 1024,\n xl: 1280,\n xxl: 1900,\n },\n // Type 4\n breakpoints4: {\n xxs: 600,\n xs: 768,\n s: 1024,\n m: 1280,\n l: 1900,\n xl: 1900,\n xxl: 1900,\n },\n },\n userConfig: {\n type: undefined,\n age: undefined,\n gender: undefined,\n },\n conflictManagementConfig: {\n 'blocking.ad.unit.name': [\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n ],\n },\n impressionManagerConfig: {\n 'ad.unit.name': {\n target: 'all|section|homepage',\n frequency: '$1/$2(day|hour)',\n exposed: 0,\n expires: (new Date()).getTime(),\n },\n },\n googleGlobalSettings: {\n enableSingleRequest: true,\n enableAsyncRendering: true,\n refreshIntervalTime: 1000,\n breakpointType: 'type1',\n },\n sso: ssoKey,\n\n}, dfpBaseConf);\n\nexport default dfpConfig;\n","/**\n * Helper function. Adds N hours to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Number} hours - the amount of hours to add, in whole numbers\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'hours' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given hours\n */\nexport function addHours(date, hours) {\n if (!date) {\n throw new SyntaxError('addHours called without a required \\'date\\' parameter!');\n }\n if (!hours) {\n throw new SyntaxError('addHours called without a required \\'hours\\' parameter!');\n }\n else if (isNaN(parseInt(hours, 10))) {\n throw new TypeError('addHours called with an invalid integer \\'hours\\' parameter!');\n }\n const result = new Date(date);\n result.setHours(result.getHours() + parseInt(hours, 10));\n return result;\n}\n\n/**\n * Helper function. Adds N days to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Integer} days - the amount of days to add\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'days' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given days\n */\nexport function addDays(date, days) {\n if (!date) {\n throw new SyntaxError('addDays called without a required \\'date\\' parameter!');\n }\n if (!days) {\n throw new SyntaxError('addDays called without a required \\'days\\' parameter!');\n }\n else if (isNaN(parseInt(days, 10))) {\n throw new TypeError('addDays called with an invalid integer \\'days\\' parameter!');\n }\n const result = new Date(date);\n result.setDate(result.getDate() + parseInt(days, 10));\n return result;\n}\n","import globalConfig from '../globalConfig';\n\nconst breakpoints = globalConfig.breakpointsConfig.breakpoints;\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param { function } func - the function to run\n * @param { number } wait - the timeout period to avoid running the function\n * @param { boolean } immediate - leading edge modifier\n * @returns {function } the debounced function\n */\nexport function debounce(func, wait = 100, immediate) {\n let timeout;\n return function debounced() {\n const context = this;\n const args = arguments;// eslint-disable-line prefer-rest-params\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @returns {number} the break that the current width represents\n */\nexport function getBreakpoint() {\n let breakpoint;\n const windowWidth = window.innerWidth\n || document.documentElement.clientWidth\n || document.body.clientWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: breakpoint = breakpoints.xxs; break;\n case windowWidth < breakpoints.s: breakpoint = breakpoints.xs; break;\n case windowWidth < breakpoints.m: breakpoint = breakpoints.s; break;\n case windowWidth < breakpoints.l: breakpoint = breakpoints.m; break;\n case windowWidth < breakpoints.xl: breakpoint = breakpoints.l; break;\n case windowWidth < breakpoints.xxl: breakpoint = breakpoints.xl; break;\n default: breakpoint = breakpoints.xxl;\n }\n return breakpoint;\n}\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @param {number} breakpoint - the breakpoint label enumerator that the current width represents\n * (yield with a getBreakpoint() call or passed manually )\n * @returns {string} breakpoint - the breakpoint label that the current width represents,\n * as a string\n */\nexport function getBreakpointName(breakpoint) {\n let resultBreakpoint;\n const windowWidth = breakpoint || window.innerWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: resultBreakpoint = 'xxs'; break;\n case windowWidth < breakpoints.s: resultBreakpoint = 'xs'; break;\n case windowWidth < breakpoints.m: resultBreakpoint = 's'; break;\n case windowWidth < breakpoints.l: resultBreakpoint = 'm'; break;\n case windowWidth < breakpoints.xl: resultBreakpoint = 'l'; break;\n case windowWidth < breakpoints.xxl: resultBreakpoint = 'xl'; break;\n default: resultBreakpoint = 'xxl';\n }\n return resultBreakpoint;\n}\n","import globalConfig from '../globalConfig';\nimport { addHours, addDays } from '../utils/time';\nimport { debounce } from '../utils/breakpoints';\n\nexport const keys = {\n impressions: 'impressions',\n frequency: 'frequency',\n /**\n * [0] - full match\n * [1] - impression count i.e: \"1\" | \"22\"\n * [2] - impression expiry range quantifier i.e: \"1\" | \"22\"\n * [3] - impression expiry range unit i.e: \"day\" | \"hour\"\n */\n frequencyRegex: /(\\d+)\\/(\\d+)(day|hour)/,\n expires: 'expires',\n exposed: 'exposed',\n target: 'target',\n maxImpressions: 'maxImpressions',\n hours: 'hour',\n days: 'day',\n adSlotId: 'id',\n};\n\nexport default class ImpressionsManager {\n\n constructor(impressionManagerConfig) {\n this.now = (new Date()).getTime(); // this date is used for comparisons only\n this.config = Object.assign({}, impressionManagerConfig);\n this.impressions = this.retrieveImpressionsData();\n this.initImpressionMap();\n }\n\n retrieveImpressionsData() {\n const impressions = this.migrateImpressionsData();\n /*\n Merge migrated data with new data\n console.log('Migrated: ',impressions);\n */\n Object.keys(impressions).map((key, index) => {\n impressions[key] = Object.assign({}, impressions[key], this.config[key]);\n return this;\n });\n /*\n console.log('Merged: ',impressions);\n Filter out entries without frequency\n */\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (!impressions[key][keys.frequency]) {\n // console.log(`Removing ${key} - since it does not have a frequency`,impressions[key]);\n delete impressions[key];\n }\n }\n }\n // console.log('Filtered: ',impressions);\n return impressions;\n }\n\n migrateImpressionsData() {\n let impressions;\n let impressionsData;\n try {\n impressionsData = window.localStorage.getItem(keys.impressions);\n }\n catch (err) {\n // In case of thrown 'SecurityError' or 'QuotaExceededError', the variable should be undefined\n impressionsData = undefined;\n }\n try {\n impressions = JSON.parse(impressionsData);\n }\n catch (err) {\n // Here is where old impression data is converted to new format\n impressions = {};\n const oldImpressionsArray = impressionsData.split(';').filter(e => e);\n\n oldImpressionsArray.forEach((impression) => {\n try {\n const adUnitImpression = impression.split(' = ');\n const name = adUnitImpression[0];\n const data = adUnitImpression[1];\n const tmp = name.split('.');\n let target = tmp.pop();\n if (target && target === 'hp') {\n target = 'homepage';\n }\n const slotId = tmp.join('.');\n const id = `${slotId}_${target}`;\n const exposed = parseInt(data.split('/')[0], 10) || 0;\n const expires = parseInt(data.split('/')[1], 10) || this.now;\n impressions[id] = {};\n impressions[id][keys.adSlotId] = slotId;\n impressions[id][keys.target] = target;\n impressions[id][keys.exposed] = exposed;\n impressions[id][keys.expires] = expires;\n }\n catch (err1) {\n // console.log(`Failed converting impression: ${impression}`, err1);\n }\n });\n }\n return impressions || {};\n }\n\n /**\n * Define the debounced version of the local storage save\n */\n saveImpressionsToLocalStorage() {\n if (this.debouncedSave && typeof this.debouncedSave === 'function') {\n this.debouncedSave();\n }\n else {\n this.debouncedSave = debounce(this.saveImpressionsToLocalStorageImpl, 250, false);\n this.debouncedSave();\n }\n }\n\n /**\n * Implementation of saving the impression map to localstorage\n */\n saveImpressionsToLocalStorageImpl() {\n try {\n localStorage.setItem(keys.impressions, JSON.stringify(this.impressions));\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the operation should not break*/\n console.error('localStorage isn\\'t available:', err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Initializes the impression map based on the retrieved impressions and the global\n * configuration.\n */\n initImpressionMap() {\n Object.keys(this.config).map((key, index) => {\n const adSlotId = key;\n const slot = this.impressions[adSlotId];\n let shouldUpdateExpiryDate = false;\n // Case I: Existing slot (update)\n if (slot) {\n // Case I.I Existing slot, frequency has changed\n if (this.config[adSlotId][keys.frequency] !== slot[keys.frequency]) {\n // Updating the frequency will trigger a new expiry date\n shouldUpdateExpiryDate = true;\n this.impressions[adSlotId][keys.frequency] = this.config[adSlotId][keys.frequency];\n } // Case I.II Existing slot, old expiry date\n else if (this.now > slot[keys.expires]) {\n // Old value that should trigger a new expiry date\n shouldUpdateExpiryDate = true;\n }\n } // Case II: Non-existing slot (create new slot)\n else {\n this.initSlotFromConfig(adSlotId);\n } // Finally, updates the expiry date (cases I.I and I.II)\n if (shouldUpdateExpiryDate) {\n this.updateExpiryDate(adSlotId);\n }\n return this;\n });\n }\n\n /**\n * Updates the expiry date of a slotName based on the configured slot frequency\n * @param {String} slotName - the slotName to update.\n */\n updateExpiryDate(slotName) {\n const now = new Date();\n if (!(this.impressions[slotName] && this.impressions[slotName][keys.frequency])) {\n throw new Error(`Unable to update expiry date for slot: ${slotName}\n - this.impressions[slotName]:`, this.impressions[slotName]);\n }\n const frequencyMap = this.impressions[slotName][keys.frequency].match(keys.frequencyRegex);\n now.setMilliseconds(0);\n now.setSeconds(0);\n now.setMinutes(0);\n if (frequencyMap.indexOf(keys.days) > -1) {\n now.setHours(0);\n }\n this.impressions[slotName][keys.expires] = (frequencyMap.indexOf(keys.days) > -1 ?\n addDays(now, frequencyMap[2]) : addHours(now, frequencyMap[2])).getTime();\n\n // Set max impressions:\n this.impressions[slotName][keys.maxImpressions] = parseInt(frequencyMap[1], 10);\n // Reset exposed\n this.impressions[slotName][keys.exposed] = 0;\n }\n\n /**\n * Initializes a non-existing slot from the passed global configuration for the slot\n * @param {String} slotName - the name of the slot to create\n */\n initSlotFromConfig(slotName) {\n const slot = this.impressions[slotName] || {};\n slot[keys.frequency] = this.config[slotName][keys.frequency];\n slot[keys.target] = this.config[slotName][keys.target];\n slot[keys.exposed] = 0;\n this.impressions[slotName] = slot;\n this.updateExpiryDate(slotName);\n }\n\n /**\n * Registers an impression for a given adSlot.\n * @param {String} adSlotId - the adSlot id to register an impression for\n * @returns {boolean} returns true iff the impression has been registered\n */\n registerImpression(adSlotId) {\n if (adSlotId) {\n const slot = this.impressions[adSlotId];\n if (slot) {\n const exposed = slot[keys.exposed];\n if (isNaN(parseInt(exposed, 10)) === false) {\n this.impressions[adSlotId][keys.exposed] += 1;\n try {\n this.saveImpressionsToLocalStorage();\n }\n catch (err) {\n // console.log('Error saving ad impressions to localStorage!', err);\n }\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Checks whether an adSlot has reached it's allocated impressions count.\n * @param {String} adSlotId - the adSlot to check\n * @returns {boolean} true iff there is a quota for the adSlot, and it has been reached\n */\n reachedQuota(adSlotId) {\n // An adSlotId is suffixed with _homepage | _section if it's targeting is different\n // between the two. If there is no difference, an _all suffix can be used.\n const slotName = this.impressions[`${adSlotId}${globalConfig.department}`] ?\n `${adSlotId}${globalConfig.department}` : `${adSlotId}_all`;\n\n const slot = this.impressions[slotName];\n let atQuota = false;\n if (slot) {\n const now = (new Date()).getTime();\n // Second element of 2/4day matches '2'\n const expires = this.impressions[slotName][keys.expires];\n if (expires < now) {\n this.updateExpiryDate(slotName);\n }\n else {\n const maxImpressions = this.impressions[slotName][keys.maxImpressions];\n // Not expired, did reach max impressions?\n if (maxImpressions) {\n atQuota = this.impressions[slotName][keys.exposed] >= maxImpressions;\n }\n }\n }\n return atQuota;\n }\n\n\n /**\n * Clears the impression map from 'exposed' impressions\n */\n resetImpressions() {\n const impressions = this.impressions;\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (impressions[key][keys.exposed]) {\n impressions[key][keys.exposed] = 0;\n }\n }\n }\n this.saveImpressionsToLocalStorage();\n }\n}\n","import getCookieAsMap from '../utils/cookieUtils';\nimport ImpressionManager from './impressionsManager';\nimport globalConfig from '../globalConfig';\n\nexport const userTypes = {\n payer: 'payer',\n registered: 'registered',\n anonymous: 'anonymous',\n trial: 'trial',\n guest: 'reg_guest',\n};\n\nexport const productTypes = {\n htz: 243,\n tm: 273,\n hdc: 239,\n htz_tm: 274,\n};\n\nexport default class User {\n constructor(config) {\n this.config = Object.assign({}, config.userConfig);\n const cookieMap = getCookieAsMap();\n this.ssoKey = globalConfig.sso;\n if (!cookieMap[this.ssoKey]) {\n // Flips the ssoKey, since cookieMap.ssoKey cannot be used to retrieve data\n this.ssoKey = this.ssoKey === 'tmsso' ? 'engsso' : 'tmsso';\n }\n this.type = this.getUserType(cookieMap);\n this.htz_type = this.getUserTypeByProduct(cookieMap, productTypes.htz, 'tmsso');\n this.tm_type = this.getUserTypeByProduct(cookieMap, productTypes.tm, 'tmsso');\n this.hdc_type = this.getUserTypeByProduct(cookieMap, productTypes.hdc, 'engsso');\n this.impressionManager = new ImpressionManager(config.impressionManagerConfig);\n this.age = this.getUserAge(cookieMap);\n this.gender = this.getUserGender(cookieMap);\n this.sso = this.getUserSSO(cookieMap, this.ssoKey);\n this.country = this.getUserCountry();\n }\n\n getUserType(cookieMap) {\n let userType;\n if (cookieMap && cookieMap[this.ssoKey]) {\n userType = (cookieMap.HtzPusr || cookieMap.TmPusr || cookieMap.HdcPusr) ?\n userTypes.payer : userTypes.registered;\n }\n else {\n userType = userTypes.anonymous;\n }\n return userType;\n }\n\n\n getUserTypeByProduct(cookieMap, productType, ssoKey) {\n let userType = userTypes.anonymous;\n if (cookieMap && cookieMap[ssoKey]) {\n if (cookieMap.userProducts) {\n let userProducts = decodeURIComponent(cookieMap.userProducts);\n userProducts = JSON.parse(userProducts);\n if (productType === productTypes.hdc) {\n userType = this.getHdcUserType(userProducts);\n }\n else {\n userType = this.getHtzTmUserType(userProducts, productType);\n }\n if (userType === userTypes.registered &&\n cookieMap[ssoKey].firstName === 'guest' &&\n cookieMap[ssoKey].lastName === 'guest') {\n userType = userTypes.guest;\n }\n }\n }\n return userType;\n }\n\n getHdcUserType(userProducts) {\n // user has hdc paying product\n if (this.userHasProduct(userProducts, productTypes.hdc, false)) {\n return userTypes.payer;\n }\n // user has hdc trial product\n else if (this.userHasProduct(userProducts, productTypes.hdc, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n getHtzTmUserType(userProducts, productType) {\n // user has htz/tm paying product\n if (this.userHasProduct(userProducts, productType, false) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, false)) {\n return userTypes.payer;\n }\n // user has htz/tm trial product\n else if (this.userHasProduct(userProducts, productType, true) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n userHasProduct(userProducts, productType, trial) {\n return userProducts.products\n .filter(product => product.prodNum === productType && product.trial === trial)\n .length > 0;\n }\n\n getUserAge(cookieMap) {\n let age;\n const usrae = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].usrae;\n if (usrae) {\n age = parseInt(cookieMap[this.ssoKey].usrae, 10);\n age = age > 0 ? age : undefined;\n }\n return age;\n }\n\n getUserGender(cookieMap) {\n let gender;\n const urgdr = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].urgdr;\n if (urgdr) {\n gender = parseInt(cookieMap[this.ssoKey].urgdr, 10);\n gender = gender === 2 || gender === 1 ? gender : undefined;\n }\n return gender;\n }\n\n getUserSSO(cookieMap, ssoKey) {\n return cookieMap[ssoKey];\n }\n\n getUserCountry() {\n const country = window.localStorage.getItem('country');\n if (!country) {\n fetch('https://ms-apps.haaretz.co.il/ms-ip2country/get', {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/jsonp',\n },\n }).then(resp => resp.json())\n .then(data => {\n window.localStorage.setItem('country', data.code);\n },\n err => {}\n );\n return null;\n }\n return country;\n }\n\n}\n","class ConflictResolver {\n constructor(conflictManagementConfig) {\n this.dependencyMap = this.initializeDependencyMap(conflictManagementConfig);\n this.deferredSlots = new Set();\n }\n initializeDependencyMap(conflictManagementJson) {\n const queue = new Map();\n Object.keys(conflictManagementJson).map((key, value) => {\n let rules = conflictManagementJson[key];\n if (rules) {\n rules = rules.filter((item) => item.onsize && item.avoid);\n }\n queue.set(key, {\n id: key,\n rules,\n resolvedWith: null,\n });\n return this;\n });\n return queue;\n }\n\n updateResolvedSlot(adSlotId, resolvedSize) {\n if (!adSlotId) {\n throw new Error('updateResolvedSlot must be called with an adSlotId!');\n }\n if (!resolvedSize) {\n throw new Error('updateResolvedSlot must be called with a resolved size!');\n }\n if (this.dependencyMap.has(adSlotId)) {\n this.dependencyMap.get(adSlotId).resolvedWith = resolvedSize;\n }\n }\n\n\n isBlocked(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocked must be called with an adSlotId!');\n }\n let isBlocked = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n const adSlot = this.dependencyMap.get(adSlotKey);\n for (const adSlotRule of adSlot.rules) {\n // Found rule specific to our target\n if (adSlotRule.avoid === adSlotId) {\n const parentResolvedWith = adSlot.resolvedWith;\n if (parentResolvedWith && adSlotRule.onsize.split(',').find(sizeString => { // eslint-disable-line\n const size = sizeString.split('x').map(numberStr => parseInt(numberStr, 10));\n return this.arraysEqual(size, parentResolvedWith);\n })) {\n // Block found\n this.deferredSlots.add(adSlotId);\n isBlocked = true;\n }\n }\n }\n }\n return isBlocked;\n }\n\n isBlocking(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocking must be called with an adSlotId!');\n }\n let isBlocking = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n if (adSlotKey === adSlotId) {\n isBlocking = true;\n }\n }\n return isBlocking;\n }\n\n /**\n * Gets an array of adSlot Ids for a given adSlotId, that are dependent on (blocked by)\n * @param {String} adSlotId - the blocking slot id\n * @return {Array} an array of blocked slot, that has a dependency on the given slot\n */\n getBlockedSlotsIds(adSlotId) {\n let result;\n if (this.dependencyMap.has(adSlotId)) {\n result = Array.from(this.dependencyMap.get(adSlotId).rules.map(adSlot => adSlot.avoid));\n }\n return result || [];\n }\n\n arraysEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n}\nConflictResolver.EMPTY_SIZE = [];\nexport default ConflictResolver;\n","/**\n * Checks whether two arrays are equal\n * @param {Array} a - the first array to check\n * @param {Array} b - the second array to check\n * @returns {Boolean} true iff both a and b are arrays, with equal values\n */\nexport function arraysEqual(a, b) {\n if (!a || !b) return false;\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (Array.isArray(a[i]) && Array.isArray(b[i])) {\n if (!arraysEqual(a[i], b[i])) return false;\n }\n else if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\nexport default arraysEqual;\n","/* global googletag */\nimport { adTypes } from '../objects/adManager';\nimport globalConfig from '../globalConfig';\nimport { arraysEqual } from '../utils/arrays';\n\nconst hiddenClass = globalConfig.site.indexOf('mouse') > -1 ? 'u-is-hidden' : 'h-hidden';\n\nexport default class adSlot {\n\n constructor(adSlotConfig) {\n this.config = Object.assign({}, adSlotConfig);\n\n // Part I : Markup configuration - passed from AdManager\n this.id = this.config.id;\n if (!this.config.id) {\n throw new Error('an adSlot requires an id!');\n }\n this.target = this.config.target;\n this.type = this.config.type;\n this.responsive = this.config.responsive;\n this.fluid = this.config.fluid;\n this.user = this.config.user;\n this.adManager = this.config.adManager;\n this.htmlElement = this.config.htmlElement;\n this.priority = this.config.priority;\n this.deferredSlot = this.config.deferredSlot;\n\n // Part II : Global, general ad configuration - passed from AdManager\n this.department = this.config.department;\n this.network = this.config.network;\n this.adUnitBase = this.config.adUnitBase;\n\n // Part III : ad specific configuration - passed from globalConfig.adSlotConfig\n this.adSizeMapping = this.config.adSizeMapping;\n this.responsiveAdSizeMapping = this.config.responsiveAdSizeMapping;\n this.blacklistReferrers = this.config.blacklistReferrers ?\n this.config.blacklistReferrers.split(',') : [];\n this.whitelistReferrers = this.config.whitelistReferrers ?\n this.config.whitelistReferrers.split(',') : [];\n\n\n // Part IV : Runtime configuration - calculated data - only present in runtime\n this.lastResolvedSize = undefined; // Initialized in 'slotRenderEnded' callback\n this.lastResolvedWithBreakpoint = undefined; // Initialized in 'slotRenderEnded' callback\n this.slot = undefined; // Holds a googletag.Slot object\n // [https://developers.google.com/doubleclick-gpt/reference#googletag.Slot]\n try {\n if (!this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Checks whether this adSlot is an 'Out-of-page' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isOutOfPage() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n case adTypes.popunder: return true;\n case adTypes.talkback: return false;\n case adTypes.regular: return false;\n default: return false;\n }\n }\n\n /**\n * Checks whether this adSlot is a 'maavaron' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isMaavaron() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n default: return false;\n }\n }\n\n isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n }\n /**\n * Checks whether or not this adSlot has a non-empty whitelist, and if so, that the current\n * referrer appears in the whitelist.\n * Should return false iff there is a whitelist for the current adSlot, but the referrer is not\n * mentioned in the whitelist.\n * @returns {boolean} true iff the ad can be displayed.\n */\n isWhitelisted() {\n let whitelisted = false;\n if (this.whitelistReferrers.length !== 0) {\n for (const referrer of this.whitelistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n whitelisted = true;\n break;\n }\n }\n }\n else {\n whitelisted = true;\n }\n return whitelisted;\n }\n\n /**\n * Checks whether or not this adSlot has a non-empty blacklist, and if so, that the current\n * referrer does not appear in the blacklist.\n * Should return true iff there is a blacklist for the current adSlot, and the referrer is\n * mentioned in the blacklist - to indicate that the adSlot is 'blocked'.\n * @returns {boolean} true iff the ad cannot be displayed.\n */\n isBlacklisted() {\n let blacklisted = false;\n if (this.blacklistReferrers.length !== 0) {\n for (const referrer of this.blacklistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n blacklisted = true;\n break;\n }\n }\n }\n return blacklisted;\n }\n\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n show() {\n if (!this.shown === true) {\n this.shown = true; // Ensure show will be called once per adSlot\n googletag.cmd.push(() => {\n if (this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n // console.log('calling show for slot',this.id,' called @',window.performance.now());\n document.getElementById(this.id).classList.remove(hiddenClass);\n googletag.display(this.id);\n });\n }\n }\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n hide() {\n googletag.cmd.push(() => {\n document.getElementById(this.id).classList.add(hiddenClass);\n });\n }\n\n /**\n * Initializes page-level slot definition for the current slot\n * @return {Slot} slot - the Google Slot that was defined from this AdSlot configuration\n */\n defineSlot() {\n if (this.isMaavaron()) {\n const maavaronSlot = this.defineMaavaron();\n if (this.adManager.shouldSendRequestToDfp(this)) {\n if (!this.shown) {\n this.shown = true; // Ensure show will be called once\n maavaronSlot.display();\n }\n }\n return maavaronSlot;\n }\n const googletag = window.googletag;\n const pubads = googletag.pubads();\n const args = [];\n const defineFn = this.isOutOfPage() ? googletag.defineOutOfPageSlot : googletag.defineSlot;\n // 3 or 2 params according to the function that we want to activate.\n args.push(this.getPath());\n if (this.isOutOfPage() === false) {\n if (this.fluid) {\n args.push('fluid');\n }\n else {\n args.push(this.adSizeMapping);\n }\n }\n args.push(this.id);\n let slot = defineFn.apply(defineFn, args);\n if (slot) {\n // Responsive size Mapping\n if (this.responsive) {\n let responsiveSlotSizeMapping = googletag.sizeMapping();\n const breakpoints = globalConfig.breakpointsConfig.breakpoints;\n const keys = Object.keys(this.responsiveAdSizeMapping);\n for (const key of keys) { // ['xxs','xs',...]\n responsiveSlotSizeMapping.addSize(\n [breakpoints[key], 100], // 100 is a default height, since it is height agnostic\n !arraysEqual(this.responsiveAdSizeMapping[key], [[0, 0]]) ?\n this.responsiveAdSizeMapping[key] : []);\n }\n responsiveSlotSizeMapping = responsiveSlotSizeMapping.build();\n slot = slot.defineSizeMapping(responsiveSlotSizeMapping);\n }\n slot = slot.addService(pubads);\n if (this.isOutOfPage() === false) {\n slot.setCollapseEmptyDiv(true);\n }\n }\n return slot;\n }\n\n /**\n * Returns the current path calculated for the adSlot\n * @returns {String} a formatted string that represent the path for the slot definition\n */\n getPath() {\n /* eslint-disable no-shadow */\n let path = globalConfig.path || [];\n path = path.filter(path => path !== '.');\n path = path.map(section => `${this.id}${this.department}${section}`).join('/');\n // If a path exist, it will be preceded with a forward slash\n path = path && this.config.department !== '_homepage' ? `/${path}` : '';\n /* eslint-enable no-shadow */\n const calculatedPath = `/${this.config.network}/${this.config.adUnitBase}/${this.id}/${this.id}${this.department}${path}`; // eslint-disable-line max-len\n return calculatedPath.toLowerCase();\n }\n\n /* eslint-disable */\n slotRendered(event) {\n const id = event.slot.getAdUnitPath().split('/')[3]; // Convention: [0]/[1]network/[2]base/[3]id\n const isEmpty = event.isEmpty; // Did the ad return as empty?\n const resolvedSize = event.size; // What 'creative' size did the ad return with?\n // Empty or onload callback should be called next?\n }\n /* eslint-enable */\n\n /**\n * Refresh this adSlot\n */\n refresh() {\n googletag.cmd.push(() => {\n googletag.pubads().refresh([this.slot]);\n });\n }\n\n /**\n * Shows 'Maavaron' type adSlot using Passback definition\n * @return {Slot} slot - the Google Slot that was defined for Maavaron\n */\n defineMaavaron() {\n if (!document.referrer.match('loc.haaretz')) {\n const adUnitMaavaronPath = this.getPath();\n const adUnitMaavaronSize = [\n [2, 1],\n ];\n const slot = googletag.pubads().definePassback(adUnitMaavaronPath, adUnitMaavaronSize)\n .setTargeting('UserType', [this.user.type])\n .setTargeting('age', [this.user.age])\n .setTargeting('urgdr', [this.user.gender])\n .setTargeting('articleId', [globalConfig.articleId])\n .setTargeting('stg', [globalConfig.environment]);\n return slot;\n }\n return null;\n }\n}\n","/* global googletag */\nimport User from '../objects/user';\nimport ConflictResolver from '../objects/conflictResolver';\nimport AdSlot from '../objects/adSlot';\nimport { getBreakpoint, getBreakpointName } from '../utils/breakpoints';\nimport { arraysEqual } from '../utils/arrays';\nimport getCookieAsMap from '../utils/cookieUtils';\n\n// There are a total of 7 adTargets:\n// \"all\",\"nonPaying\",\"anonymous\",\"registered\",\"paying\",\"digitalOnly\" and \"digitalAndPrint\"\nexport const adPriorities = {\n high: 'high',\n normal: 'normal',\n low: 'low',\n};\n\nexport const adTargets = {\n all: 'all',\n nonPaying: 'nonPaying',\n anonymous: 'anonymous',\n registered: 'registered',\n paying: 'paying',\n digitalOnly: 'digitalOnly',\n digitalAndPrint: 'digitalAndPrint',\n};\n\n// There are a total of 3 userTypes: \"anonymous\", \"registered\" and \"payer\"\nexport const userTypes = {\n anonymous: 'anonymous',\n registered: 'registered',\n payer: 'payer',\n};\n\nexport const adTypes = {\n maavaron: '.maavaron',\n popunder: '.popunder',\n talkback: '.talkback',\n regular: '',\n};\n\n\nexport default class AdManager {\n\n constructor(config) {\n this.config = Object.assign({}, config);\n this.user = new User(config);\n this.conflictResolver = new ConflictResolver(config.conflictManagementConfig);\n /**\n * Avoid race conditions by making sure to respect the usual timing of GPT.\n * This DFP implementation uses Enable-Define-Display:\n * Define page-level settings\n * enableServices()\n * Define slots\n * Display slots\n */\n try {\n googletag.cmd.push(() => {\n this.initGoogleTargetingParams(); // Define page-level settings\n this.initGoogleGlobalSettings(); // enableServices()\n this.initSlotRenderedCallback(); // Define callbacks\n });\n // Mouse special treatment to base path on mobile breakpoints\n const currentBreakpointName = getBreakpointName(getBreakpoint());\n if (this.config.adManagerConfig.adUnitBase.indexOf('mouse.co.il') > -1 &&\n currentBreakpointName.indexOf('xs') > -1) {\n this.config.adManagerConfig.adUnitBase = 'mouse.co.il.mobile_web';\n }\n // Holds adSlot objects as soon as possible.\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n });\n // Once DOM ready, add more adSlots.\n const onDomLoaded = () => { // eslint-disable-line no-inner-declarations\n try {\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.normal);\n });\n });\n }\n catch (err) {\n console.log(err); // eslint-disable-line no-console\n }\n };\n // Once window was loaded, add the rest of the adSlots.\n const onWindowLoaded = () => { // eslint-disable-line no-inner-declarations\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.low);\n // Clean blocking adSlots that are not defined on this page\n for (const blockingAdSlotKey of this.conflictResolver.dependencyMap.keys()) {\n if (!this.adSlots.has(blockingAdSlotKey)) {\n this.conflictResolver.dependencyMap.delete(blockingAdSlotKey);\n }\n }\n this.showAllDeferredSlots();\n });\n };\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', onDomLoaded);\n window.addEventListener('load', onWindowLoaded);\n break;\n case 'interactive':\n onDomLoaded();\n window.addEventListener('load', onWindowLoaded);\n break;\n default: // 'complete' - no need for event listeners.\n onDomLoaded();\n onWindowLoaded();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Shows all of the adSlots that can be displayed.\n */\n showAllSlots() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.type !== adTypes.talkback && this.shouldSendRequestToDfp(adSlot)) {\n adSlot.show();\n }\n }\n }\n\n /**\n * Gets all adSlots that has a certain priority\n * @param {adPriority} priority - the priority of the ad {high, normal, low}\n * @return {Array} adSlots - all of the defined adSlots that matches\n * the given priority\n */\n getAdSlotsByPriority(priority) {\n function priorityFilter(adSlot) {\n return adSlot.priority === priority;\n }\n return Array.from(this.adSlots.values()).filter(priorityFilter);\n }\n\n showAllDeferredSlots() {\n for (const deferredSlotId of this.conflictResolver.deferredSlots) {\n if (this.adSlots.has(deferredSlotId)) {\n if (!this.conflictResolver.isBlocked(deferredSlotId)) {\n const deferredAdSlot = this.adSlots.get(deferredSlotId);\n if (this.shouldSendRequestToDfp(deferredAdSlot)) {\n deferredAdSlot.show();\n }\n }\n }\n }\n }\n\n /**\n * Refreshes all responsive adSlots\n */\n refreshAllSlots() {\n const currentBreakpoint = getBreakpoint();\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive && adSlot.type !== adTypes.maavaron) {\n if (adSlot.lastResolvedWithBreakpoint !== currentBreakpoint &&\n this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n }\n\n /**\n * Refreshes all adSlots\n */\n refreshAllSlotsInPage() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n\n /**\n * Refreshes adSlot\n */\n\n refreshSlot(adUnitName) {\n const adSlot = this.adSlots.get(adUnitName);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n\n\n /**\n * Initializes adSlots based on the currently found slot markup (HTML page specific),\n * and the predefined configuration for the slots.\n * @param {Object} adSlotConfig - the AdSlots configuration object (see: globalConfig)\n * @param {String} filteredPriority - filters out all adSlots that does not match\n * a given adPriority. This is used to cherry pick the init process of ads.\n * @returns {Map}\n */\n initAdSlots(adSlotConfig, filteredPriority) {\n const adSlots = new Map(this.adSlots);\n let adSlotPlaceholders = Array.from(document.getElementsByClassName('js-dfp-ad'));\n adSlotPlaceholders = adSlotPlaceholders.filter(node => node.id); // only nodes with an id\n const adSlotNodeSet = new Set();\n adSlotPlaceholders = Array.prototype.filter.call(adSlotPlaceholders, node => {\n if (adSlotNodeSet.has(node.id) === false) { // first occurrence of Node\n adSlotNodeSet.add(node.id);\n return true;\n }\n return false;\n });\n // adSlotPlaceholders = adSlotPlaceholders.sort((a, b) => a.offsetTop - b.offsetTop);\n adSlotPlaceholders.forEach(adSlot => {\n const adSlotPriority = adSlotConfig[adSlot.id] ?\n adSlotConfig[adSlot.id].priority || adPriorities.normal : undefined;\n if (adSlotConfig[adSlot.id] && adSlots.has(adSlot.id) === false &&\n adSlotPriority === filteredPriority) {\n // The markup has a matching configuration from adSlotConfig AND was not already defined\n try {\n // adSlotConfig is built from globalConfig, but can be overridden by markup\n const computedAdSlotConfig = Object.assign({}, adSlotConfig[adSlot.id], {\n id: adSlot.id,\n target: adSlot.attributes['data-audtarget'] ?\n adSlot.attributes['data-audtarget'].value : adTargets.all,\n type: this.getAdType(adSlot.id),\n responsive: adSlotConfig[adSlot.id].responsive,\n fluid: adSlotConfig[adSlot.id].fluid || false,\n user: this.user,\n adManager: this,\n htmlElement: adSlot,\n department: this.config.department,\n network: this.config.adManagerConfig.network,\n adUnitBase: this.config.adManagerConfig.adUnitBase,\n deferredSlot: this.conflictResolver.isBlocked(adSlot.id),\n priority: adSlotPriority,\n });\n const adSlotInstance = new AdSlot(computedAdSlotConfig);\n adSlots.set(adSlot.id, adSlotInstance);\n if (adSlotInstance.type !== adTypes.talkback &&\n adSlotInstance.priority === adPriorities.high &&\n this.shouldSendRequestToDfp(adSlotInstance)) {\n /*\n console.log('calling show for high priority slot', adSlotInstance.id, ' called @',\n window.performance.now());\n */\n adSlotInstance.show();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n });\n return adSlots;\n }\n\n isPriority(adSlotId) {\n return (typeof adSlotId === 'string' &&\n (adSlotId.indexOf('plazma') > 0 ||\n adSlotId.indexOf('maavaron') > 0 ||\n adSlotId.indexOf('popunder') > 0));\n }\n\n /**\n * Returns the adType based on the adSlot name.\n * @param {String} adSlotId - the adSlot's identifier.\n * @returns {*} enumerated export 'adTypes'\n */\n getAdType(adSlotId) {\n if (!adSlotId) {\n throw new Error('Missing argument: a call to getAdType must have an adSlotId');\n }\n if (adSlotId.indexOf(adTypes.maavaron) > -1) return adTypes.maavaron;\n if (adSlotId.indexOf(adTypes.popunder) > -1) return adTypes.popunder;\n if (adSlotId.indexOf(adTypes.talkback) > -1) return adTypes.talkback;\n return adTypes.regular;\n }\n\n /**\n * @param {object} adSlot the AdSlot\n * @returns {boolean|*}\n */\n shouldSendRequestToDfp(adSlot) {\n // Conflict management check\n return this.conflictResolver.isBlocked(adSlot.id) === false &&\n // Valid Referrer check\n adSlot.isWhitelisted() &&\n // Not in referrer Blacklist\n adSlot.isBlacklisted() === false &&\n this.shouldDisplayAdAfterAdBlockRemoval(adSlot) &&\n // if a paywall pop-up is shown And the number is 12 or more - SHOW MAAVRON\n this.shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) &&\n // Responsive: breakpoint contains ad?\n this.doesBreakpointContainAd(adSlot) &&\n // check in case of Smartphoneapp\n this.haveValidCookieForSmartphoneapp() &&\n // Targeting check (userType vs. slotTargeting)\n this.doesUserTypeMatchBannerTargeting(adSlot) &&\n // Impressions Manager check (limits number of impressions per slot)\n this.user.impressionManager.reachedQuota(adSlot.id) === false &&\n // if the app promotion interstitial DOES NOT pop - SHOW MAAVARON\n this.shouldAppPromotionElementPop() === false;\n }\n\n printShouldSendRequestToDfp(id) {\n let res = '';\n if (!this.adSlots.has(id)) {\n res = `id not exist: ${id}`;\n }\n else {\n const a = this.adSlots.get(id);\n res += this.conflictResolver.isBlocked(a.id) === !1 ? '' : 'isBlocked,';\n res += a.isWhitelisted() ? '' : 'isWhitelisted,';\n res += a.isBlacklisted() === !1 ? '' : 'isBlacklisted,';\n res += this.shouldDisplayAdAfterAdBlockRemoval(a) ? '' : 'AdBlockRemoval,';\n res += this.shouldDisplayAdMaavaronAfterPayWallBanner(a) ? '' : 'PayWallBanner,';\n res += this.doesBreakpointContainAd(a) ? '' : 'Breakpoint,';\n res += this.haveValidCookieForSmartphoneapp() ? '' : 'Smartphoneapp,';\n res += this.doesUserTypeMatchBannerTargeting(a) ? '' : 'Targeting,';\n res += this.user.impressionManager.reachedQuota(a.id) === !1 ? '' : 'reachedQuota,';\n res = `
${id}
${res}
`;\n }\n document.write(res);\n return res;\n }\n\n testShouldSendRequestToDfp(id) {\n // leave the old name for ios legacy\n let cookieMap = getCookieAsMap();\n cookieMap = JSON.stringify(cookieMap);\n cookieMap = cookieMap.replace(/,/g, '
');\n const res = `
${cookieMap}
`;\n document.write(res);\n return res;\n }\n\n shouldDisplayAdAfterAdBlockRemoval(adSlot) {\n return !(this.config.adBlockRemoved === true &&\n (adSlot.type === adTypes.maavaron ||\n adSlot.type === adTypes.popunder));\n }\n\n shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) {\n let shouldDisplay = true;\n if (this.config.site === 'haaretz' && adSlot.type === adTypes.maavaron) {\n try {\n const paywallBanner = JSON.parse(window.localStorage.getItem('_cobj'));\n shouldDisplay = !paywallBanner || ((paywallBanner.mc && paywallBanner.mc >= 12) ||\n (paywallBanner.nextslotLocation &&\n !paywallBanner.nextslotLocation.includes('pop')));\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error('ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner');\n /* eslint-enable no-console*/\n }\n }\n return shouldDisplay;\n }\n\n /**\n * Check if the app promotion interstitial should pop\n * when it does, the maavaron should not show up\n * @returns {boolean} true if the interstitial element should pop\n */\n shouldAppPromotionElementPop() {\n return typeof window.appPromotionElement !== 'undefined' &&\n typeof window.appPromotionElement.getShouldPop === 'function' ?\n window.appPromotionElement.getShouldPop() : false;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n\n haveValidCookieForSmartphoneapp() {\n return this.config.isValidForsmartPhone;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n doesUserTypeMatchBannerTargeting(adSlotOrTarget) {\n // if the user is smadar show her all the banners\n const cookieMap = getCookieAsMap();\n if (cookieMap.login === 'pilosmadar@gmail.com') {\n return true;\n }\n if (cookieMap.tmsso !== undefined && cookieMap.tmsso.userName === 'pilosmadar@gmail.com') {\n return true;\n }\n const userType = this.user.type;\n const adTarget = typeof adSlotOrTarget === 'string' ? adSlotOrTarget : adSlotOrTarget.target;\n\n switch (adTarget) {\n case adTargets.all : return true;\n case adTargets.nonPaying :\n return userType === userTypes.anonymous || userType === userTypes.registered;\n case adTargets.anonymous : return userType === userTypes.anonymous;\n case adTargets.registered : return userType === userTypes.registered;\n case adTargets.paying : return userType === userTypes.payer;\n case adTargets.digitalOnly : return userType === userTypes.payer;\n case adTargets.digitalAndPrint : return userType === userTypes.payer;\n default: return false;\n }\n }\n\n /**\n * Report to the AdManager that a breakpoint has been switched (passed from one break to\n * another). Should there be a responsive slot with a\n * @param {Breakpoint} breakpoint - the breakpoint that is currently being displayed\n * @returns {Integer} affected - the number of adSlots affected by the change\n */\n switchedToBreakpoint(breakpoint) {\n if (!breakpoint) {\n throw new Error('Missing argument: a call to switchedToBreakpoint must have an breakpoint');\n }\n let count = 0;\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive === true && adSlot.lastResolvedWithBreakpoint) {\n if (adSlot.lastResolvedWithBreakpoint !== breakpoint) {\n adSlot.refresh();\n count++;\n }\n }\n }\n return count;\n }\n\n /**\n * Checks whether an adSlot is defined for a given breakpoint (Default: current breakpoint)\n * @param {AdSlot} adSlot - the adSlot to check.\n * @param {Breakpoint} [breakpoint=currentBreakpoint] - the breakpoint to check this ad in.\n * @returns {boolean} true iff the adSlot is defined for the given breakpoint.\n */\n doesBreakpointContainAd(adSlot, breakpoint = getBreakpoint()) {\n if (!adSlot) {\n throw new Error('Missing argument: a call to doesBreakpointContainAd must have an adSlot');\n }\n let containsBreakpoint = true;\n if (adSlot.responsive === true) {\n const mapping = adSlot.responsiveAdSizeMapping[getBreakpointName(breakpoint)];\n if (Array.isArray(mapping) === false) {\n throw new Error(`Invalid argument: breakpoint:${breakpoint} doesn't exist!`, this);\n }\n containsBreakpoint = mapping.length > 0 && !arraysEqual(mapping, [[0, 0]]);\n }\n return containsBreakpoint;\n }\n\n /**\n * Initializes the callback from the 'slotRenderEnded' event for each slot\n */\n initSlotRenderedCallback() {\n if (window.googletag && window.googletag.apiReady) {\n const pubads = window.googletag.pubads();\n pubads.addEventListener('slotRenderEnded', event => {\n const id = event.slot.getAdUnitPath().split('/')[3];\n const isEmpty = event.isEmpty;\n const resolvedSize = event.size;\n // console.log('slotRenderEnded for slot',id,' called @',window.performance.now());\n if (this.adSlots.has(id)) {\n const adSlot = this.adSlots.get(id);\n adSlot.lastResolvedSize = resolvedSize;\n adSlot.lastResolvedWithBreakpoint = getBreakpoint();\n if (isEmpty) {\n adSlot.lastResolvedSize = ConflictResolver.EMPTY_SIZE;\n adSlot.hide();\n this.releaseSlotDependencies(adSlot);\n }\n else {\n this.releaseSlotDependencies(adSlot, adSlot.lastResolvedSize);\n }\n this.user.impressionManager.registerImpression(`${adSlot.id}${this.config.department}`);\n this.user.impressionManager.registerImpression(`${adSlot.id}_all`);\n }\n else {\n /*\n console.error(`Cannot find an adSlot with id: ${id} - Ad Unit path is\n ${event.slot.getAdUnitPath()}`);\n */\n }\n });\n }\n else {\n throw new Error('googletag api was not ready when \\'initSlotRenderedCallback\\' was called!');\n }\n }\n\n releaseSlotDependencies(adSlot) {\n try {\n const id = adSlot.id;\n this.conflictResolver.updateResolvedSlot(id, adSlot.lastResolvedSize);\n if (this.conflictResolver.isBlocking(id)) {\n // Hide all blocked adSlots\n for (const blockedSlot of this.conflictResolver.getBlockedSlotsIds(id)) {\n if (this.conflictResolver.isBlocked(blockedSlot)) {\n if (this.adSlots.has(blockedSlot)) {\n this.adSlots.get(blockedSlot).hide();\n }\n }\n }\n // Show the non blocked\n for (const deferredSlotKey of this.conflictResolver.deferredSlots.keys()) {\n const deferredAdSlot = this.adSlots.get(deferredSlotKey);\n if (deferredAdSlot && this.shouldSendRequestToDfp(deferredAdSlot)) {\n this.conflictResolver.deferredSlots.delete(deferredSlotKey);\n if (deferredAdSlot.deferredSlot) {\n deferredAdSlot.defineSlot();\n deferredAdSlot.deferredSlot = false;\n }\n deferredAdSlot.show();\n }\n }\n }\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error(`Cannot updateSlotDependencies for adSlot: ${adSlot.id}`);\n /* eslint-enable no-console*/\n }\n }\n\n setSsoGroupKey() {\n fetch(`/ssoGroupKey?value=${this.user.sso.userId}`, {\n method: 'GET',\n cache: 'no-cache',\n }).then(value => {\n if (value) {\n value.json().then(data => {\n if (data && data.result && data.result !== 'item not found'\n && data.result !== 'value is empty') {\n localStorage.setItem('_SsoGroupKey', data.result);\n }\n });\n }\n });\n }\n\n /**\n * Initializes page-level targeting params.\n */\n initGoogleTargetingParams() {\n if (window.googletag && window.googletag.apiReady) {\n // Returns a reference to the pubads service.\n let SsoGroupKey = null;\n try {\n SsoGroupKey = localStorage.getItem('_SsoGroupKey');\n if (!SsoGroupKey && this.user.sso.userId) {\n this.setSsoGroupKey();\n }\n }\n catch (e) {\n SsoGroupKey = null;\n }\n const pubads = googletag.pubads();\n // Environment targeting (dev, test, prod)\n if (this.config.environment) {\n pubads.setTargeting('stg', [this.config.environment]);\n }\n // App targeting\n // User targeting\n if (this.user.htz_type) {\n pubads.setTargeting('htz_user_type', [this.user.htz_type]);\n }\n if (this.user.tm_type) {\n pubads.setTargeting('tm_user_type', [this.user.tm_type]);\n }\n if (this.user.hdc_type) {\n pubads.setTargeting('hdc_user_type', [this.user.hdc_type]);\n }\n // Context targeting\n if (this.config.section) {\n pubads.setTargeting('section', [this.config.section]);\n }\n if (this.config.sub_section) {\n pubads.setTargeting('sub_section', [this.config.sub_section]);\n }\n if (this.config.articleId) {\n pubads.setTargeting('articleId', [this.config.articleId]);\n pubads.setTargeting('react', ['false']);\n }\n if (this.config.gStatCampaignNumber && this.config.gStatCampaignNumber !== -1) {\n pubads.setTargeting('gstat_campaign_id', [this.config.gStatCampaignNumber]);\n }\n if (this.config.proposalNumber) {\n pubads.setTargeting('proposaltype', [this.config.proposalNumber]);\n }\n if (this.config.pageType) {\n pubads.setTargeting('pageType', [this.config.pageType]);\n }\n if (this.config.isWriterAlerts) {\n pubads.setTargeting('WriterAlerts', ['true']);\n }\n // AdBlock removal\n if (this.config.adBlockRemoved) {\n pubads.setTargeting('adblock_removed', [this.config.adBlockRemoved]);\n }\n // University targeting - triggered via cookie\n if (this.config.wifiLocation) {\n pubads.setTargeting('wifi', [this.config.wifiLocation]);\n }\n if (this.config.tags && Array.isArray(this.config.tags)) {\n pubads.setTargeting('tags', [...this.config.tags]);\n }\n\n if (this.user.sso && this.user.sso.userId && SsoGroupKey) {\n pubads.setTargeting(SsoGroupKey, this.user.sso.userId);\n }\n if (this.config.anonymousId) {\n const anonymousIdKeyName = 'anonymousIdKey';\n pubads.setTargeting(anonymousIdKeyName, this.config.anonymousId);\n }\n if (this.user.country) {\n pubads.setTargeting('country', this.user.country);\n }\n\n const cityNames = this.getCityNames();\n if (cityNames) {\n pubads.setTargeting('cityName', [...cityNames]);\n }\n\n // Ads Centering\n pubads.setCentering(true);\n }\n else {\n throw new Error('googletag api was not ready when \\'initGoogleTargetingParams\\' was called!');\n }\n }\n\n /**\n * Initializes googletag services.\n */\n initGoogleGlobalSettings() {\n if (window.googletag && window.googletag.apiReady) {\n const googleGlobalSettings = this.config.googleGlobalSettings;\n // Enable GET parameter overrides\n if (window.location.search) {\n const search = window.location.search;\n if (search.indexOf('sraon') > 0) {\n console.log('Single Request Mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = true;\n }\n else if (search.indexOf('sraoff') > 0) {\n console.log('Single Request Mode: disabled');// eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = false;\n }\n if (search.indexOf('asyncrenderingon') > 0) {\n console.log('Async rendering mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = true;\n }\n else if (search.indexOf('asyncrenderingonoff') > 0) {\n console.log('Sync rendering mode: active');// eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = false;\n }\n }\n // Google services activation\n if (googleGlobalSettings.enableSingleRequest === true) {\n googletag.pubads().enableSingleRequest();\n }\n // if (googleGlobalSettings.enableAsyncRendering === true) {\n // googletag.pubads().enableAsyncRendering();\n // }\n // else {\n // googletag.pubads().enableSyncRendering();\n // }\n // Enables all GPT services that have been defined for ad slots on the page.\n googletag.enableServices();\n }\n else {\n throw new Error('googletag api wasn\\'t ready when \\'initGoogleGlobalSettings\\' was called!');\n }\n }\n\n\n getCityNames() {\n const cityNames = [];\n document.querySelectorAll('[data-location-city-name]').forEach((element) => {\n if (!cityNames.includes(element.dataset.locationCityName)) {\n cityNames.push(element.dataset.locationCityName);\n }\n });\n return cityNames.length > 0 ? cityNames : null;\n }\n\n}\n","/* globals googletag */\nimport AdManager from '../src/objects/adManager';\nimport globalConfig from './globalConfig';\nimport { getBreakpoint, debounce } from '../src/utils/breakpoints';\n\nconst defaultConfig = globalConfig || {};\nconst resizeTimeout = 250;\n\nexport default class DFP {\n\n constructor(config) {\n this.config = Object.assign({}, defaultConfig, config);\n this.wasInitialized = false;\n this.initStarted = false;\n this.breakpoint = getBreakpoint();\n this.initWindowResizeListener();\n }\n\n /**\n * This part of the object's construction is dependent on the call to 'init'\n */\n resumeInit() {\n try {\n this.adManager = this.adManager || new AdManager(this.config);\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * initializes the 'googletag' global namespace and add the\n * google publish tags library to the page\n * @returns {Promise} that resolves to true once the googletag api is ready to use\n * (googletag.apiReady = true)\n */\n initGoogleTag() {\n const dfpThis = this;\n return new Promise((resolve, reject) => {\n if (dfpThis.initStarted === true) {\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(dfpThis);\n });\n }\n else {\n dfpThis.initStarted = true;\n // set up a place holder for the gpt code downloaded from google\n window.googletag = window.googletag || {};\n\n // this is a command queue used by GPT any methods added to it will be\n // executed when GPT code is available, if GPT is already available they\n // will be executed immediately\n window.googletag.cmd = window.googletag.cmd || [];\n // load google tag services JavaScript\n (() => {\n const tag = window.document.createElement('script');\n tag.async = true;\n tag.type = 'text/javascript';\n // Supports both https and http\n tag.setAttribute('src', '//www.googletagservices.com/tag/js/gpt.js');\n const node = window.document.getElementsByTagName('script')[0];\n tag.addEventListener('load', () => {\n dfpThis.resumeInit();\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(this);\n });\n });\n tag.addEventListener('error', (error) => {\n dfpThis.wasInitialized = false;\n reject(error);\n });\n node.parentNode.insertBefore(tag, node);\n })();\n }\n });\n }\n\n /**\n * Returns true iff googletag was properly initialized on the page\n * @returns {boolean}\n */\n isGoogleTagReady() {\n if (this.wasInitialized === true || (window.googletag && window.googletag.apiReady)) {\n this.wasInitialized = true;\n }\n return this.wasInitialized;\n }\n\n /**\n * Initializes the window resize listener to support responsive ad refreshes\n */\n initWindowResizeListener() {\n const dfpThis = this;\n function onResize() {\n const currentBreakpoint = getBreakpoint();\n if (dfpThis.breakpoint !== currentBreakpoint) {\n dfpThis.breakpoint = currentBreakpoint;\n if (dfpThis.adManager) {\n dfpThis.adManager.refreshAllSlots();\n }\n else {\n throw new Error('initWindowResizeListener error - adManager instance is not available');\n }\n }\n }\n const debouncedFunction = debounce(onResize, resizeTimeout);\n window.onresize = debouncedFunction;\n }\n}\n","// generated by genversion\nexport const version = '2.6.6';\n","import DFP from './dfp';\nimport globalConfig from './globalConfig';\nimport { version as v } from './version';\n\n// DFP version is based on the package.json\nDFP.version = v || 'VERSION';\n\n/*\n // Only for development mode\n if ( process.env.NODE_ENV !== 'production' ) {\n DFP.dev = '123';\n }\n */\n\nexport const config = globalConfig;\nexport const version = DFP.version;\nexport default DFP;\n"]} \ No newline at end of file diff --git a/dist/dfp.js b/dist/dfp.js index 6c55e66..9202637 100644 --- a/dist/dfp.js +++ b/dist/dfp.js @@ -2055,7 +2055,9 @@ var AdManager = function () { // Targeting check (userType vs. slotTargeting) this.doesUserTypeMatchBannerTargeting(adSlot$$1) && // Impressions Manager check (limits number of impressions per slot) - this.user.impressionManager.reachedQuota(adSlot$$1.id) === false; + this.user.impressionManager.reachedQuota(adSlot$$1.id) === false && + // if the app promotion interstitial DOES NOT pop - SHOW MAAVARON + this.shouldAppPromotionElementPop() === false; } }, { key: 'printShouldSendRequestToDfp', @@ -2112,6 +2114,18 @@ var AdManager = function () { return shouldDisplay; } + /** + * Check if the app promotion interstitial should pop + * when it does, the maavaron should not show up + * @returns {boolean} true if the interstitial element should pop + */ + + }, { + key: 'shouldAppPromotionElementPop', + value: function shouldAppPromotionElementPop() { + return typeof window.appPromotionElement !== 'undefined' && typeof window.appPromotionElement.getShouldPop === 'function' ? window.appPromotionElement.getShouldPop() : false; + } + /** * Check whether or not an ad slot should appear for the current user type * @param {String} adSlotOrTarget the adSlot to check or the target as a string @@ -2647,7 +2661,7 @@ var DFP$1 = function () { }(); // generated by genversion -var version$1 = '2.6.5'; +var version$1 = '2.6.6'; // DFP version is based on the package.json DFP$1.version = version$1 || 'VERSION'; diff --git a/dist/dfp.js.map b/dist/dfp.js.map index fea1331..ea69eb7 100644 --- a/dist/dfp.js.map +++ b/dist/dfp.js.map @@ -1 +1 @@ -{"version":3,"sources":["../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/classCallCheck.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/createClass.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/toConsumableArray.js","../src/utils/cookieUtils.js","../src/globalConfig.js","../src/utils/time.js","../src/utils/breakpoints.js","../src/objects/impressionsManager.js","../src/objects/user.js","../src/objects/conflictResolver.js","../src/utils/arrays.js","../src/objects/adSlot.js","../src/objects/adManager.js","../src/dfp.js","../src/version.js","../src/index.js"],"names":["instance","Constructor","TypeError","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","defineProperty","key","protoProps","staticProps","prototype","arr","Array","isArray","arr2","from","globalConfig","userTypes","ImpressionManager","ssoKey","arraysEqual","adSlot","AdSlot","DFP","version","v"],"mappings":";;;AAAA,uBAAgB,UAAUA,QAAV,EAAoBC,WAApB,EAAiC;MAC3C,EAAED,oBAAoBC,WAAtB,CAAJ,EAAwC;UAChC,IAAIC,SAAJ,CAAc,mCAAd,CAAN;;CAFJ;;ACAA,mBAAe,CAAC,YAAY;WACjBC,gBAAT,CAA0BC,MAA1B,EAAkCC,KAAlC,EAAyC;SAClC,IAAIC,IAAI,CAAb,EAAgBA,IAAID,MAAME,MAA1B,EAAkCD,GAAlC,EAAuC;UACjCE,aAAaH,MAAMC,CAAN,CAAjB;iBACWG,UAAX,GAAwBD,WAAWC,UAAX,IAAyB,KAAjD;iBACWC,YAAX,GAA0B,IAA1B;UACI,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EnB;eAAA,QAAoB;0BAClB;;SAAA,SAAc,OAAA,OAAA,IAAA,eAAd;SACA,iBAAA;SACA,cAAA;SACA,aAAA;SACA;;;;;;;;;iCAMW;UACP;aACF,YAAiB,KAAA,aAAkB,IAAA,UAAc,KAAjD;QAEF,OAAA,KAAY;gBACV,MADU;;;;;;;;;;;;;oCAWE;kBACd;;UAAM,UAAN;iBACO,QAAY,UAAA,SAAA,QAAqB;YAClC,QAAA,gBAAJ,MAAkC;oBAChC,IAAA,KAAmB,YAAM;oBACvB,iBAAA;oBACA;;eAGC;kBACH,cAAA;;iBAEA,YAAmB,OAAA,aAAnB;;;;;iBAKA,UAAA,MAAuB,OAAA,UAAA,OAAvB;;WAEC,YAAM;gBACC,MAAM,OAAA,SAAA,cAAZ;gBACA,QAAA;gBACA,OAAA;;gBAEA,aAAA,OAAA;gBACM,OAAO,OAAA,SAAA,qBAAA,UAAb;gBACA,iBAAA,QAA6B,YAAM;sBACjC;wBACA,IAAA,KAAmB,YAAM;wBACvB,iBAAA;wBAED;;;gBAEH,iBAAA,SAA8B,UAAA,OAAW;sBACvC,iBAAA;qBACA;;iBAEF,WAAA,aAAA,KAAA;;;OAnCC;;;;;;;;;;uCA6CU;UACb,KAAA,mBAAA,QAAiC,OAAA,aAAoB,OAAA,UAAzD,UAAqF;aACnF,iBAAA;;aAEK,KAAP;;;;;;;;;+CAMyB;UACnB,UAAN;eACA,WAAoB;YACZ,oBAAN;YACI,QAAA,eAAJ,mBAA8C;kBAC5C,aAAA;cACI,QAAJ,WAAuB;oBACrB,UAAA;iBAEG;kBACG,IAAA,MAAN;;;;UAIA,oBAAoB,SAAA,UAA1B;aACA,WAAA;;;;;;;AC5GJ;AACA,AAAO,IAAMC,YAAU;;ACGvB;AACAD,MAAI,UAAUE,aAAK;;;;;;;;;AASnB,AAAO,IAAM,SAAST;AACtB,AAAO,IAAMQ,aAAUD,MAAI,QAC3B","file":"dfp.js","sourcesContent":["export default (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n});","export default (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();","export default (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n});","/**\n * Htz-cookie-util\n * @module htzCookieUtil\n * @author Elia Grady elia.grady@haaretz.co.il\n * @license MIT\n */\n\n/**\n * Translates Key-Value string into a convenient map.\n * @param {String} string String in format of \"keyvalue.....\"\n * @param {object} options object for overriding defaults:\n * options.separator is a String or regExp that separates between each key value pairs\n * (default is ';'). options.operator is a String or regExp that separates between each key\n * and value within a pair (default is '=').\n * @returns {object} a map object, with key-value mapping according to the passed configuration.\n */\nfunction stringToMap(string,\n { separator = ';', operator = '=' } = {}) {\n const map = {};\n const itemsArr = string.split(separator);\n itemsArr.forEach(element => {\n if (typeof element === 'string') {\n const keyValue = element.split(operator);\n if (keyValue.length === 2) {\n try {\n map[keyValue[0]] = decodeURIComponent(keyValue[1]);\n }\n catch (e) {\n // Do nothing, malformed URI\n }\n }\n }\n });\n return map;\n}\nexport const ssoKey = window.location.hostname.indexOf('haaretz.com') > -1 ? 'engsso' : 'tmsso';\n\n// Translates Cookie string into a convenient map.\nexport default function getCookieAsMap() {\n const map = stringToMap(document.cookie, { separator: /;\\s?/ });\n if (typeof map.tmsso === 'string') {\n map.tmsso = stringToMap(map.tmsso, { separator: ':' });\n }\n if (typeof map.engsso === 'string') {\n map.engsso = stringToMap(map.engsso, { separator: ':' });\n }\n return map;\n}\n","/* global dfpConfig */\nimport getCookieAsMap, { ssoKey } from './utils/cookieUtils';\n// globalConfig for DFP\nlet dfpBaseConf;\ntry {\n dfpBaseConf = window.JSON.parse(document.getElementById('dfpConfig').textContent);\n}\ncatch (err) {\n dfpBaseConf = window.dfpConfig;\n}\nconst dfpConfig = Object.assign({\n get referrer() {\n return document.referrer ? document.referrer : '';\n },\n get isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n },\n /**\n * Returns true iff the loaded page is the homepage (no inner path)\n * @returns {boolean}\n */\n get isHomepage() {\n return window.location.pathname === '/' || this.environment === 3; // 'prod'\n },\n get department() {\n return this.isHomepage ? '_homepage' : '_section';\n },\n /**\n * returns the domain the page was loaded to. i.e: 'haaretz.co.il', 'haaretz.com'\n * @returns {string} the domain name from the windows's location hostname property\n */\n get domain() {\n const regexMatch = /([\\d|\\w]+)(\\.co\\.il|\\.com)(.*)?/.exec(window.location.hostname);\n const result = regexMatch ? regexMatch[0] : window.location.hostname;\n return result;\n },\n /**\n * Returns an array of concatenated paths, separated by a dot.\n * For example, for the URL:\n * http://www.haaretz.co.il/news/world/america/us-election-2016/LIVE-1.2869045\n * the path is '/news/world/america/us-election-2016/LIVE-1.2869045'.\n * This function takes the directories ['news', 'world', 'america', 'us-election-2016']\n * and converts it to the following format:\n * ['.news', '.news.world', '.news.world.america', '.news.world.america.us-election-2016']\n * This denotes the path configuration for the given adSlot\n * non articles (sections) will be given a '0' - no articleId value for targeting purposes)\n * @returns {Array.} an array of path names\n */\n get path() {\n let sectionArray = this.articleId && this.articleId !== '0' ?\n window.location.pathname.split('/').slice(1, -1) :\n window.location.pathname.split('/').slice(1);\n sectionArray = sectionArray.filter(path =>\n path !== 'wwwMobileSite' && path !== 'whtzMobileSite');\n return sectionArray\n .map(section => `.${section}`)\n .map((section, index, arr) => arr.slice(0, index + 1)\n .reduce((last, current) => last.concat(current)));\n },\n /**\n * Returns a string representation for the name of the site\n * @return {*|string}\n */\n get site() {\n let site;\n if (window.location.hostname.indexOf('haaretz.co.il') > -1) {\n site = 'haaretz';\n }\n else if (window.location.hostname.indexOf('themarker.com') > -1) {\n site = 'themarker';\n }\n else if (window.location.hostname.indexOf('mouse.co.il') > -1) {\n site = 'mouse';\n }\n return site || 'haaretz';\n },\n /**\n * Returns the current environment targeting param, if such is defined.\n * @returns {number} targeting param, 1 for local development, 2 for test servers and 3 for prod.\n * May return undefined if no targeting is specified.\n */\n get environment() {\n const env = {\n dev: 1,\n test: 2,\n prod: 3,\n };\n return window.location.port === '8080' ? env.dev :\n (window.location.hostname.indexOf('pre.haaretz.co.il') > -1\n || window.location.hostname.indexOf('tmtest.themarker.com') > -1\n || window.location.hostname.indexOf('pre.haaretz.com') > -1\n || window.location.hostname.indexOf('prodmouse.mouse.co.il') > -1) ? env.test :\n (window.location.pathname.indexOf('/cmlink/Haaretz.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/TheMarker.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/Mouse.HomePage') > -1)\n ? env.prod : undefined;\n },\n /**\n * Returns the articleIf if on an article page, or null otherwise\n * @returns {string} an articleId string from the pathname, or 0 if not found\n */\n get articleId() {\n const articleIdMatch = /\\d\\.\\d+/g.exec(window.location.pathname);\n let articleId = '0';\n if (articleIdMatch) {\n articleId = articleIdMatch.pop(); // Converts [\"1.23145\"] to \"1.23145\"\n }\n return articleId;\n },\n utm_: {\n get content() {\n return this.getUrlParam('utm_content');\n },\n get source() {\n return this.getUrlParam('utm_source');\n },\n get medium() {\n return this.getUrlParam('utm_medium');\n },\n get campaign() {\n return this.getUrlParam('utm_campaign');\n },\n getUrlParam(key) {\n const results = RegExp(`(${key})(=)([^&\"]+)`).exec(window.location.search);\n return results && results[3] ? results[3] : undefined;\n },\n },\n get adBlockRemoved() {\n let adBlockRemoved = false;\n try {\n if (localStorage.getItem('adblock_removed')) {\n adBlockRemoved = true;\n }\n }\n catch (err) {\n // do nothing\n }\n return adBlockRemoved;\n },\n get ssoGroupKey() {\n return window.localStorage.getItem('_SsoGroupKey');\n },\n get anonymousId() {\n const cookieName = 'anonymousId';\n const cookieMap = getCookieAsMap();\n let anonymousId = '';\n if (cookieMap && cookieMap[cookieName]) {\n anonymousId = cookieMap[cookieName];\n }\n return anonymousId;\n },\n get isWriterAlerts() {\n return (location.search.indexOf('writerAlerts=true') > -1);\n },\n get wifiLocation() {\n let wifiLocation;\n const cookieName = '_htzwif'; // eslint-disable-line no-underscore-dangle\n const cookieMap = getCookieAsMap();\n try {\n if (cookieMap && cookieMap[cookieName]) {\n if (cookieMap[cookieName].toLowerCase() === 'arcaffe') {\n wifiLocation = 'ArCafe';\n }\n if (cookieMap[cookieName].toLowerCase() === 'university') {\n wifiLocation = 'university';\n }\n }\n if (cookieMap && cookieMap.fairs) {\n wifiLocation = 'fairs';\n }\n }\n catch (err) {\n // do nothing\n }\n return wifiLocation;\n },\n get isValidForsmartPhone() {\n let validForAds = true;\n const PageUrl = window.location.href;\n const isSmartphoneapp = PageUrl.match('haaretzsmartphoneapp');\n const cookieMap = getCookieAsMap();\n try {\n if (isSmartphoneapp) {\n // eslint-disable-line no-underscore-dangle\n if (cookieMap && cookieMap.HtzPusr &&\n (cookieMap.tmsso === undefined || cookieMap.tmsso.userName !== 'pilosmadar@gmail.com')) {\n validForAds = false;\n }\n }\n }\n catch (err) {\n // do nothing\n }\n return validForAds;\n },\n get gStatCampaignNumber() {\n let gstatCampaign;\n try {\n gstatCampaign = localStorage.getItem('GstatCampaign') ?\n JSON.parse(localStorage.getItem('GstatCampaign')) : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n gstatCampaign = undefined;\n }\n return gstatCampaign ? gstatCampaign.CampaignNumber : undefined;\n },\n get pageType() {\n let type = '';\n try {\n const htmlclassList = document.querySelector('html').classList;\n switch (true) {\n case /mouse_location/.test(htmlclassList):\n type = 'mouse_location';\n break;\n case /mouse_event/.test(htmlclassList):\n type = 'mouse_event';\n break;\n case /contentType-story/.test(htmlclassList):\n type = 'mouse_article';\n break;\n default:\n if (this.articleId !== '0') {\n switch (this.domain) {\n case 'haaretz.co.il':\n type = 'htz_article';\n break;\n case 'haaretz.com':\n type = 'hdc_article';\n break;\n case 'themarker.com':\n type = 'tm_article';\n break;\n default:\n type = '';\n }\n }\n else {\n type = '';\n }\n }\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n type = '';\n }\n return type;\n },\n get proposalNumber() {\n let proposal;\n try {\n proposal = localStorage.getItem('proposaltype') ?\n localStorage.getItem('proposaltype') : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n proposal = undefined;\n }\n return proposal;\n },\n adSlotConfig: {\n 'haaretz.co.il.example.slot': {\n id: 'slotId',\n // path : \"/network/base/slotId/slotId_subsection\", Will be calculated from AdManager\n responsive: true,\n adSizeMapping: [['width1', 'height1'], ...['widthN', 'heightN']],\n priority: 'normal',\n fluid: false,\n responsiveAdSizeMapping: {\n xxs: [['width1', 'height1'], ...['widthN', 'heightN']],\n xs: [['width1', 'height1'], ...['widthN', 'heightN']],\n s: [['width1', 'height1'], ...['widthN', 'heightN']],\n m: [['width1', 'height1'], ...['widthN', 'heightN']],\n l: [['width1', 'height1'], ...['widthN', 'heightN']],\n xl: [['width1', 'height1'], ...['widthN', 'heightN']],\n xxl: [['width1', 'height1'], ...['widthN', 'heightN']],\n },\n blacklistReferrers: 'comma, delimited, blacklisted, referrer, list',\n whitelistReferrers: 'comma, delimited, referrer, list',\n },\n },\n adManagerConfig: {\n network: '9401',\n adUnitBase: 'haaretz.co.il_Web',\n },\n breakpointsConfig: {\n get breakpoints() {\n // Override in VM from backend to control this toggle.\n let breakpoints;\n switch (dfpConfig.googleGlobalSettings.breakpointType) {\n case 'type1': breakpoints = this.breakpoints1; break;\n case 'type2': breakpoints = this.breakpoints2; break;\n case 'type3': breakpoints = this.breakpoints3; break;\n case 'type4': breakpoints = this.breakpoints4; break;\n default: breakpoints = this.breakpoints1;\n }\n return breakpoints;\n },\n // Type 1\n breakpoints1: {\n xxs: 600,\n xs: 761,\n s: 993,\n m: 1009,\n l: 1291,\n xl: 1600,\n xxl: 1900,\n },\n // Type 2\n breakpoints2: {\n xxs: 600,\n xs: 1000,\n s: 1150,\n m: 1281,\n l: 1600,\n xl: 1920,\n xxl: 1920,\n },\n // Type 3\n breakpoints3: {\n xxs: 100,\n xs: 480,\n s: 600,\n m: 768,\n l: 1024,\n xl: 1280,\n xxl: 1900,\n },\n // Type 4\n breakpoints4: {\n xxs: 600,\n xs: 768,\n s: 1024,\n m: 1280,\n l: 1900,\n xl: 1900,\n xxl: 1900,\n },\n },\n userConfig: {\n type: undefined,\n age: undefined,\n gender: undefined,\n },\n conflictManagementConfig: {\n 'blocking.ad.unit.name': [\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n ],\n },\n impressionManagerConfig: {\n 'ad.unit.name': {\n target: 'all|section|homepage',\n frequency: '$1/$2(day|hour)',\n exposed: 0,\n expires: (new Date()).getTime(),\n },\n },\n googleGlobalSettings: {\n enableSingleRequest: true,\n enableAsyncRendering: true,\n refreshIntervalTime: 1000,\n breakpointType: 'type1',\n },\n sso: ssoKey,\n\n}, dfpBaseConf);\n\nexport default dfpConfig;\n","/**\n * Helper function. Adds N hours to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Number} hours - the amount of hours to add, in whole numbers\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'hours' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given hours\n */\nexport function addHours(date, hours) {\n if (!date) {\n throw new SyntaxError('addHours called without a required \\'date\\' parameter!');\n }\n if (!hours) {\n throw new SyntaxError('addHours called without a required \\'hours\\' parameter!');\n }\n else if (isNaN(parseInt(hours, 10))) {\n throw new TypeError('addHours called with an invalid integer \\'hours\\' parameter!');\n }\n const result = new Date(date);\n result.setHours(result.getHours() + parseInt(hours, 10));\n return result;\n}\n\n/**\n * Helper function. Adds N days to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Integer} days - the amount of days to add\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'days' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given days\n */\nexport function addDays(date, days) {\n if (!date) {\n throw new SyntaxError('addDays called without a required \\'date\\' parameter!');\n }\n if (!days) {\n throw new SyntaxError('addDays called without a required \\'days\\' parameter!');\n }\n else if (isNaN(parseInt(days, 10))) {\n throw new TypeError('addDays called with an invalid integer \\'days\\' parameter!');\n }\n const result = new Date(date);\n result.setDate(result.getDate() + parseInt(days, 10));\n return result;\n}\n","import globalConfig from '../globalConfig';\n\nconst breakpoints = globalConfig.breakpointsConfig.breakpoints;\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param { function } func - the function to run\n * @param { number } wait - the timeout period to avoid running the function\n * @param { boolean } immediate - leading edge modifier\n * @returns {function } the debounced function\n */\nexport function debounce(func, wait = 100, immediate) {\n let timeout;\n return function debounced() {\n const context = this;\n const args = arguments;// eslint-disable-line prefer-rest-params\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @returns {number} the break that the current width represents\n */\nexport function getBreakpoint() {\n let breakpoint;\n const windowWidth = window.innerWidth\n || document.documentElement.clientWidth\n || document.body.clientWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: breakpoint = breakpoints.xxs; break;\n case windowWidth < breakpoints.s: breakpoint = breakpoints.xs; break;\n case windowWidth < breakpoints.m: breakpoint = breakpoints.s; break;\n case windowWidth < breakpoints.l: breakpoint = breakpoints.m; break;\n case windowWidth < breakpoints.xl: breakpoint = breakpoints.l; break;\n case windowWidth < breakpoints.xxl: breakpoint = breakpoints.xl; break;\n default: breakpoint = breakpoints.xxl;\n }\n return breakpoint;\n}\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @param {number} breakpoint - the breakpoint label enumerator that the current width represents\n * (yield with a getBreakpoint() call or passed manually )\n * @returns {string} breakpoint - the breakpoint label that the current width represents,\n * as a string\n */\nexport function getBreakpointName(breakpoint) {\n let resultBreakpoint;\n const windowWidth = breakpoint || window.innerWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: resultBreakpoint = 'xxs'; break;\n case windowWidth < breakpoints.s: resultBreakpoint = 'xs'; break;\n case windowWidth < breakpoints.m: resultBreakpoint = 's'; break;\n case windowWidth < breakpoints.l: resultBreakpoint = 'm'; break;\n case windowWidth < breakpoints.xl: resultBreakpoint = 'l'; break;\n case windowWidth < breakpoints.xxl: resultBreakpoint = 'xl'; break;\n default: resultBreakpoint = 'xxl';\n }\n return resultBreakpoint;\n}\n","import globalConfig from '../globalConfig';\nimport { addHours, addDays } from '../utils/time';\nimport { debounce } from '../utils/breakpoints';\n\nexport const keys = {\n impressions: 'impressions',\n frequency: 'frequency',\n /**\n * [0] - full match\n * [1] - impression count i.e: \"1\" | \"22\"\n * [2] - impression expiry range quantifier i.e: \"1\" | \"22\"\n * [3] - impression expiry range unit i.e: \"day\" | \"hour\"\n */\n frequencyRegex: /(\\d+)\\/(\\d+)(day|hour)/,\n expires: 'expires',\n exposed: 'exposed',\n target: 'target',\n maxImpressions: 'maxImpressions',\n hours: 'hour',\n days: 'day',\n adSlotId: 'id',\n};\n\nexport default class ImpressionsManager {\n\n constructor(impressionManagerConfig) {\n this.now = (new Date()).getTime(); // this date is used for comparisons only\n this.config = Object.assign({}, impressionManagerConfig);\n this.impressions = this.retrieveImpressionsData();\n this.initImpressionMap();\n }\n\n retrieveImpressionsData() {\n const impressions = this.migrateImpressionsData();\n /*\n Merge migrated data with new data\n console.log('Migrated: ',impressions);\n */\n Object.keys(impressions).map((key, index) => {\n impressions[key] = Object.assign({}, impressions[key], this.config[key]);\n return this;\n });\n /*\n console.log('Merged: ',impressions);\n Filter out entries without frequency\n */\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (!impressions[key][keys.frequency]) {\n // console.log(`Removing ${key} - since it does not have a frequency`,impressions[key]);\n delete impressions[key];\n }\n }\n }\n // console.log('Filtered: ',impressions);\n return impressions;\n }\n\n migrateImpressionsData() {\n let impressions;\n let impressionsData;\n try {\n impressionsData = window.localStorage.getItem(keys.impressions);\n }\n catch (err) {\n // In case of thrown 'SecurityError' or 'QuotaExceededError', the variable should be undefined\n impressionsData = undefined;\n }\n try {\n impressions = JSON.parse(impressionsData);\n }\n catch (err) {\n // Here is where old impression data is converted to new format\n impressions = {};\n const oldImpressionsArray = impressionsData.split(';').filter(e => e);\n\n oldImpressionsArray.forEach((impression) => {\n try {\n const adUnitImpression = impression.split(' = ');\n const name = adUnitImpression[0];\n const data = adUnitImpression[1];\n const tmp = name.split('.');\n let target = tmp.pop();\n if (target && target === 'hp') {\n target = 'homepage';\n }\n const slotId = tmp.join('.');\n const id = `${slotId}_${target}`;\n const exposed = parseInt(data.split('/')[0], 10) || 0;\n const expires = parseInt(data.split('/')[1], 10) || this.now;\n impressions[id] = {};\n impressions[id][keys.adSlotId] = slotId;\n impressions[id][keys.target] = target;\n impressions[id][keys.exposed] = exposed;\n impressions[id][keys.expires] = expires;\n }\n catch (err1) {\n // console.log(`Failed converting impression: ${impression}`, err1);\n }\n });\n }\n return impressions || {};\n }\n\n /**\n * Define the debounced version of the local storage save\n */\n saveImpressionsToLocalStorage() {\n if (this.debouncedSave && typeof this.debouncedSave === 'function') {\n this.debouncedSave();\n }\n else {\n this.debouncedSave = debounce(this.saveImpressionsToLocalStorageImpl, 250, false);\n this.debouncedSave();\n }\n }\n\n /**\n * Implementation of saving the impression map to localstorage\n */\n saveImpressionsToLocalStorageImpl() {\n try {\n localStorage.setItem(keys.impressions, JSON.stringify(this.impressions));\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the operation should not break*/\n console.error('localStorage isn\\'t available:', err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Initializes the impression map based on the retrieved impressions and the global\n * configuration.\n */\n initImpressionMap() {\n Object.keys(this.config).map((key, index) => {\n const adSlotId = key;\n const slot = this.impressions[adSlotId];\n let shouldUpdateExpiryDate = false;\n // Case I: Existing slot (update)\n if (slot) {\n // Case I.I Existing slot, frequency has changed\n if (this.config[adSlotId][keys.frequency] !== slot[keys.frequency]) {\n // Updating the frequency will trigger a new expiry date\n shouldUpdateExpiryDate = true;\n this.impressions[adSlotId][keys.frequency] = this.config[adSlotId][keys.frequency];\n } // Case I.II Existing slot, old expiry date\n else if (this.now > slot[keys.expires]) {\n // Old value that should trigger a new expiry date\n shouldUpdateExpiryDate = true;\n }\n } // Case II: Non-existing slot (create new slot)\n else {\n this.initSlotFromConfig(adSlotId);\n } // Finally, updates the expiry date (cases I.I and I.II)\n if (shouldUpdateExpiryDate) {\n this.updateExpiryDate(adSlotId);\n }\n return this;\n });\n }\n\n /**\n * Updates the expiry date of a slotName based on the configured slot frequency\n * @param {String} slotName - the slotName to update.\n */\n updateExpiryDate(slotName) {\n const now = new Date();\n if (!(this.impressions[slotName] && this.impressions[slotName][keys.frequency])) {\n throw new Error(`Unable to update expiry date for slot: ${slotName}\n - this.impressions[slotName]:`, this.impressions[slotName]);\n }\n const frequencyMap = this.impressions[slotName][keys.frequency].match(keys.frequencyRegex);\n now.setMilliseconds(0);\n now.setSeconds(0);\n now.setMinutes(0);\n if (frequencyMap.indexOf(keys.days) > -1) {\n now.setHours(0);\n }\n this.impressions[slotName][keys.expires] = (frequencyMap.indexOf(keys.days) > -1 ?\n addDays(now, frequencyMap[2]) : addHours(now, frequencyMap[2])).getTime();\n\n // Set max impressions:\n this.impressions[slotName][keys.maxImpressions] = parseInt(frequencyMap[1], 10);\n // Reset exposed\n this.impressions[slotName][keys.exposed] = 0;\n }\n\n /**\n * Initializes a non-existing slot from the passed global configuration for the slot\n * @param {String} slotName - the name of the slot to create\n */\n initSlotFromConfig(slotName) {\n const slot = this.impressions[slotName] || {};\n slot[keys.frequency] = this.config[slotName][keys.frequency];\n slot[keys.target] = this.config[slotName][keys.target];\n slot[keys.exposed] = 0;\n this.impressions[slotName] = slot;\n this.updateExpiryDate(slotName);\n }\n\n /**\n * Registers an impression for a given adSlot.\n * @param {String} adSlotId - the adSlot id to register an impression for\n * @returns {boolean} returns true iff the impression has been registered\n */\n registerImpression(adSlotId) {\n if (adSlotId) {\n const slot = this.impressions[adSlotId];\n if (slot) {\n const exposed = slot[keys.exposed];\n if (isNaN(parseInt(exposed, 10)) === false) {\n this.impressions[adSlotId][keys.exposed] += 1;\n try {\n this.saveImpressionsToLocalStorage();\n }\n catch (err) {\n // console.log('Error saving ad impressions to localStorage!', err);\n }\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Checks whether an adSlot has reached it's allocated impressions count.\n * @param {String} adSlotId - the adSlot to check\n * @returns {boolean} true iff there is a quota for the adSlot, and it has been reached\n */\n reachedQuota(adSlotId) {\n // An adSlotId is suffixed with _homepage | _section if it's targeting is different\n // between the two. If there is no difference, an _all suffix can be used.\n const slotName = this.impressions[`${adSlotId}${globalConfig.department}`] ?\n `${adSlotId}${globalConfig.department}` : `${adSlotId}_all`;\n\n const slot = this.impressions[slotName];\n let atQuota = false;\n if (slot) {\n const now = (new Date()).getTime();\n // Second element of 2/4day matches '2'\n const expires = this.impressions[slotName][keys.expires];\n if (expires < now) {\n this.updateExpiryDate(slotName);\n }\n else {\n const maxImpressions = this.impressions[slotName][keys.maxImpressions];\n // Not expired, did reach max impressions?\n if (maxImpressions) {\n atQuota = this.impressions[slotName][keys.exposed] >= maxImpressions;\n }\n }\n }\n return atQuota;\n }\n\n\n /**\n * Clears the impression map from 'exposed' impressions\n */\n resetImpressions() {\n const impressions = this.impressions;\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (impressions[key][keys.exposed]) {\n impressions[key][keys.exposed] = 0;\n }\n }\n }\n this.saveImpressionsToLocalStorage();\n }\n}\n","import getCookieAsMap from '../utils/cookieUtils';\nimport ImpressionManager from './impressionsManager';\nimport globalConfig from '../globalConfig';\n\nexport const userTypes = {\n payer: 'payer',\n registered: 'registered',\n anonymous: 'anonymous',\n trial: 'trial',\n guest: 'reg_guest',\n};\n\nexport const productTypes = {\n htz: 243,\n tm: 273,\n hdc: 239,\n htz_tm: 274,\n};\n\nexport default class User {\n constructor(config) {\n this.config = Object.assign({}, config.userConfig);\n const cookieMap = getCookieAsMap();\n this.ssoKey = globalConfig.sso;\n if (!cookieMap[this.ssoKey]) {\n // Flips the ssoKey, since cookieMap.ssoKey cannot be used to retrieve data\n this.ssoKey = this.ssoKey === 'tmsso' ? 'engsso' : 'tmsso';\n }\n this.type = this.getUserType(cookieMap);\n this.htz_type = this.getUserTypeByProduct(cookieMap, productTypes.htz, 'tmsso');\n this.tm_type = this.getUserTypeByProduct(cookieMap, productTypes.tm, 'tmsso');\n this.hdc_type = this.getUserTypeByProduct(cookieMap, productTypes.hdc, 'engsso');\n this.impressionManager = new ImpressionManager(config.impressionManagerConfig);\n this.age = this.getUserAge(cookieMap);\n this.gender = this.getUserGender(cookieMap);\n this.sso = this.getUserSSO(cookieMap, this.ssoKey);\n this.country = this.getUserCountry();\n }\n\n getUserType(cookieMap) {\n let userType;\n if (cookieMap && cookieMap[this.ssoKey]) {\n userType = (cookieMap.HtzPusr || cookieMap.TmPusr || cookieMap.HdcPusr) ?\n userTypes.payer : userTypes.registered;\n }\n else {\n userType = userTypes.anonymous;\n }\n return userType;\n }\n\n\n getUserTypeByProduct(cookieMap, productType, ssoKey) {\n let userType = userTypes.anonymous;\n if (cookieMap && cookieMap[ssoKey]) {\n if (cookieMap.userProducts) {\n let userProducts = decodeURIComponent(cookieMap.userProducts);\n userProducts = JSON.parse(userProducts);\n if (productType === productTypes.hdc) {\n userType = this.getHdcUserType(userProducts);\n }\n else {\n userType = this.getHtzTmUserType(userProducts, productType);\n }\n if (userType === userTypes.registered &&\n cookieMap[ssoKey].firstName === 'guest' &&\n cookieMap[ssoKey].lastName === 'guest') {\n userType = userTypes.guest;\n }\n }\n }\n return userType;\n }\n\n getHdcUserType(userProducts) {\n // user has hdc paying product\n if (this.userHasProduct(userProducts, productTypes.hdc, false)) {\n return userTypes.payer;\n }\n // user has hdc trial product\n else if (this.userHasProduct(userProducts, productTypes.hdc, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n getHtzTmUserType(userProducts, productType) {\n // user has htz/tm paying product\n if (this.userHasProduct(userProducts, productType, false) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, false)) {\n return userTypes.payer;\n }\n // user has htz/tm trial product\n else if (this.userHasProduct(userProducts, productType, true) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n userHasProduct(userProducts, productType, trial) {\n return userProducts.products\n .filter(product => product.prodNum === productType && product.trial === trial)\n .length > 0;\n }\n\n getUserAge(cookieMap) {\n let age;\n const usrae = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].usrae;\n if (usrae) {\n age = parseInt(cookieMap[this.ssoKey].usrae, 10);\n age = age > 0 ? age : undefined;\n }\n return age;\n }\n\n getUserGender(cookieMap) {\n let gender;\n const urgdr = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].urgdr;\n if (urgdr) {\n gender = parseInt(cookieMap[this.ssoKey].urgdr, 10);\n gender = gender === 2 || gender === 1 ? gender : undefined;\n }\n return gender;\n }\n\n getUserSSO(cookieMap, ssoKey) {\n return cookieMap[ssoKey];\n }\n\n getUserCountry() {\n const country = window.localStorage.getItem('country');\n if (!country) {\n fetch('https://ms-apps.haaretz.co.il/ms-ip2country/get', {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/jsonp',\n },\n }).then(resp => resp.json())\n .then(data => {\n window.localStorage.setItem('country', data.code);\n },\n err => {}\n );\n return null;\n }\n return country;\n }\n\n}\n","class ConflictResolver {\n constructor(conflictManagementConfig) {\n this.dependencyMap = this.initializeDependencyMap(conflictManagementConfig);\n this.deferredSlots = new Set();\n }\n initializeDependencyMap(conflictManagementJson) {\n const queue = new Map();\n Object.keys(conflictManagementJson).map((key, value) => {\n let rules = conflictManagementJson[key];\n if (rules) {\n rules = rules.filter((item) => item.onsize && item.avoid);\n }\n queue.set(key, {\n id: key,\n rules,\n resolvedWith: null,\n });\n return this;\n });\n return queue;\n }\n\n updateResolvedSlot(adSlotId, resolvedSize) {\n if (!adSlotId) {\n throw new Error('updateResolvedSlot must be called with an adSlotId!');\n }\n if (!resolvedSize) {\n throw new Error('updateResolvedSlot must be called with a resolved size!');\n }\n if (this.dependencyMap.has(adSlotId)) {\n this.dependencyMap.get(adSlotId).resolvedWith = resolvedSize;\n }\n }\n\n\n isBlocked(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocked must be called with an adSlotId!');\n }\n let isBlocked = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n const adSlot = this.dependencyMap.get(adSlotKey);\n for (const adSlotRule of adSlot.rules) {\n // Found rule specific to our target\n if (adSlotRule.avoid === adSlotId) {\n const parentResolvedWith = adSlot.resolvedWith;\n if (parentResolvedWith && adSlotRule.onsize.split(',').find(sizeString => { // eslint-disable-line\n const size = sizeString.split('x').map(numberStr => parseInt(numberStr, 10));\n return this.arraysEqual(size, parentResolvedWith);\n })) {\n // Block found\n this.deferredSlots.add(adSlotId);\n isBlocked = true;\n }\n }\n }\n }\n return isBlocked;\n }\n\n isBlocking(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocking must be called with an adSlotId!');\n }\n let isBlocking = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n if (adSlotKey === adSlotId) {\n isBlocking = true;\n }\n }\n return isBlocking;\n }\n\n /**\n * Gets an array of adSlot Ids for a given adSlotId, that are dependent on (blocked by)\n * @param {String} adSlotId - the blocking slot id\n * @return {Array} an array of blocked slot, that has a dependency on the given slot\n */\n getBlockedSlotsIds(adSlotId) {\n let result;\n if (this.dependencyMap.has(adSlotId)) {\n result = Array.from(this.dependencyMap.get(adSlotId).rules.map(adSlot => adSlot.avoid));\n }\n return result || [];\n }\n\n arraysEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n}\nConflictResolver.EMPTY_SIZE = [];\nexport default ConflictResolver;\n","/**\n * Checks whether two arrays are equal\n * @param {Array} a - the first array to check\n * @param {Array} b - the second array to check\n * @returns {Boolean} true iff both a and b are arrays, with equal values\n */\nexport function arraysEqual(a, b) {\n if (!a || !b) return false;\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (Array.isArray(a[i]) && Array.isArray(b[i])) {\n if (!arraysEqual(a[i], b[i])) return false;\n }\n else if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\nexport default arraysEqual;\n","/* global googletag */\nimport { adTypes } from '../objects/adManager';\nimport globalConfig from '../globalConfig';\nimport { arraysEqual } from '../utils/arrays';\n\nconst hiddenClass = globalConfig.site.indexOf('mouse') > -1 ? 'u-is-hidden' : 'h-hidden';\n\nexport default class adSlot {\n\n constructor(adSlotConfig) {\n this.config = Object.assign({}, adSlotConfig);\n\n // Part I : Markup configuration - passed from AdManager\n this.id = this.config.id;\n if (!this.config.id) {\n throw new Error('an adSlot requires an id!');\n }\n this.target = this.config.target;\n this.type = this.config.type;\n this.responsive = this.config.responsive;\n this.fluid = this.config.fluid;\n this.user = this.config.user;\n this.adManager = this.config.adManager;\n this.htmlElement = this.config.htmlElement;\n this.priority = this.config.priority;\n this.deferredSlot = this.config.deferredSlot;\n\n // Part II : Global, general ad configuration - passed from AdManager\n this.department = this.config.department;\n this.network = this.config.network;\n this.adUnitBase = this.config.adUnitBase;\n\n // Part III : ad specific configuration - passed from globalConfig.adSlotConfig\n this.adSizeMapping = this.config.adSizeMapping;\n this.responsiveAdSizeMapping = this.config.responsiveAdSizeMapping;\n this.blacklistReferrers = this.config.blacklistReferrers ?\n this.config.blacklistReferrers.split(',') : [];\n this.whitelistReferrers = this.config.whitelistReferrers ?\n this.config.whitelistReferrers.split(',') : [];\n\n\n // Part IV : Runtime configuration - calculated data - only present in runtime\n this.lastResolvedSize = undefined; // Initialized in 'slotRenderEnded' callback\n this.lastResolvedWithBreakpoint = undefined; // Initialized in 'slotRenderEnded' callback\n this.slot = undefined; // Holds a googletag.Slot object\n // [https://developers.google.com/doubleclick-gpt/reference#googletag.Slot]\n try {\n if (!this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Checks whether this adSlot is an 'Out-of-page' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isOutOfPage() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n case adTypes.popunder: return true;\n case adTypes.talkback: return false;\n case adTypes.regular: return false;\n default: return false;\n }\n }\n\n /**\n * Checks whether this adSlot is a 'maavaron' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isMaavaron() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n default: return false;\n }\n }\n\n isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n }\n /**\n * Checks whether or not this adSlot has a non-empty whitelist, and if so, that the current\n * referrer appears in the whitelist.\n * Should return false iff there is a whitelist for the current adSlot, but the referrer is not\n * mentioned in the whitelist.\n * @returns {boolean} true iff the ad can be displayed.\n */\n isWhitelisted() {\n let whitelisted = false;\n if (this.whitelistReferrers.length !== 0) {\n for (const referrer of this.whitelistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n whitelisted = true;\n break;\n }\n }\n }\n else {\n whitelisted = true;\n }\n return whitelisted;\n }\n\n /**\n * Checks whether or not this adSlot has a non-empty blacklist, and if so, that the current\n * referrer does not appear in the blacklist.\n * Should return true iff there is a blacklist for the current adSlot, and the referrer is\n * mentioned in the blacklist - to indicate that the adSlot is 'blocked'.\n * @returns {boolean} true iff the ad cannot be displayed.\n */\n isBlacklisted() {\n let blacklisted = false;\n if (this.blacklistReferrers.length !== 0) {\n for (const referrer of this.blacklistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n blacklisted = true;\n break;\n }\n }\n }\n return blacklisted;\n }\n\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n show() {\n if (!this.shown === true) {\n this.shown = true; // Ensure show will be called once per adSlot\n googletag.cmd.push(() => {\n if (this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n // console.log('calling show for slot',this.id,' called @',window.performance.now());\n document.getElementById(this.id).classList.remove(hiddenClass);\n googletag.display(this.id);\n });\n }\n }\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n hide() {\n googletag.cmd.push(() => {\n document.getElementById(this.id).classList.add(hiddenClass);\n });\n }\n\n /**\n * Initializes page-level slot definition for the current slot\n * @return {Slot} slot - the Google Slot that was defined from this AdSlot configuration\n */\n defineSlot() {\n if (this.isMaavaron()) {\n const maavaronSlot = this.defineMaavaron();\n if (this.adManager.shouldSendRequestToDfp(this)) {\n if (!this.shown) {\n this.shown = true; // Ensure show will be called once\n maavaronSlot.display();\n }\n }\n return maavaronSlot;\n }\n const googletag = window.googletag;\n const pubads = googletag.pubads();\n const args = [];\n const defineFn = this.isOutOfPage() ? googletag.defineOutOfPageSlot : googletag.defineSlot;\n // 3 or 2 params according to the function that we want to activate.\n args.push(this.getPath());\n if (this.isOutOfPage() === false) {\n if (this.fluid) {\n args.push('fluid');\n }\n else {\n args.push(this.adSizeMapping);\n }\n }\n args.push(this.id);\n let slot = defineFn.apply(defineFn, args);\n if (slot) {\n // Responsive size Mapping\n if (this.responsive) {\n let responsiveSlotSizeMapping = googletag.sizeMapping();\n const breakpoints = globalConfig.breakpointsConfig.breakpoints;\n const keys = Object.keys(this.responsiveAdSizeMapping);\n for (const key of keys) { // ['xxs','xs',...]\n responsiveSlotSizeMapping.addSize(\n [breakpoints[key], 100], // 100 is a default height, since it is height agnostic\n !arraysEqual(this.responsiveAdSizeMapping[key], [[0, 0]]) ?\n this.responsiveAdSizeMapping[key] : []);\n }\n responsiveSlotSizeMapping = responsiveSlotSizeMapping.build();\n slot = slot.defineSizeMapping(responsiveSlotSizeMapping);\n }\n slot = slot.addService(pubads);\n if (this.isOutOfPage() === false) {\n slot.setCollapseEmptyDiv(true);\n }\n }\n return slot;\n }\n\n /**\n * Returns the current path calculated for the adSlot\n * @returns {String} a formatted string that represent the path for the slot definition\n */\n getPath() {\n /* eslint-disable no-shadow */\n let path = globalConfig.path || [];\n path = path.filter(path => path !== '.');\n path = path.map(section => `${this.id}${this.department}${section}`).join('/');\n // If a path exist, it will be preceded with a forward slash\n path = path && this.config.department !== '_homepage' ? `/${path}` : '';\n /* eslint-enable no-shadow */\n const calculatedPath = `/${this.config.network}/${this.config.adUnitBase}/${this.id}/${this.id}${this.department}${path}`; // eslint-disable-line max-len\n return calculatedPath.toLowerCase();\n }\n\n /* eslint-disable */\n slotRendered(event) {\n const id = event.slot.getAdUnitPath().split('/')[3]; // Convention: [0]/[1]network/[2]base/[3]id\n const isEmpty = event.isEmpty; // Did the ad return as empty?\n const resolvedSize = event.size; // What 'creative' size did the ad return with?\n // Empty or onload callback should be called next?\n }\n /* eslint-enable */\n\n /**\n * Refresh this adSlot\n */\n refresh() {\n googletag.cmd.push(() => {\n googletag.pubads().refresh([this.slot]);\n });\n }\n\n /**\n * Shows 'Maavaron' type adSlot using Passback definition\n * @return {Slot} slot - the Google Slot that was defined for Maavaron\n */\n defineMaavaron() {\n if (!document.referrer.match('loc.haaretz')) {\n const adUnitMaavaronPath = this.getPath();\n const adUnitMaavaronSize = [\n [2, 1],\n ];\n const slot = googletag.pubads().definePassback(adUnitMaavaronPath, adUnitMaavaronSize)\n .setTargeting('UserType', [this.user.type])\n .setTargeting('age', [this.user.age])\n .setTargeting('urgdr', [this.user.gender])\n .setTargeting('articleId', [globalConfig.articleId])\n .setTargeting('stg', [globalConfig.environment]);\n return slot;\n }\n return null;\n }\n}\n","/* global googletag */\nimport User from '../objects/user';\nimport ConflictResolver from '../objects/conflictResolver';\nimport AdSlot from '../objects/adSlot';\nimport { getBreakpoint, getBreakpointName } from '../utils/breakpoints';\nimport { arraysEqual } from '../utils/arrays';\nimport getCookieAsMap from '../utils/cookieUtils';\n\n// There are a total of 7 adTargets:\n// \"all\",\"nonPaying\",\"anonymous\",\"registered\",\"paying\",\"digitalOnly\" and \"digitalAndPrint\"\nexport const adPriorities = {\n high: 'high',\n normal: 'normal',\n low: 'low',\n};\n\nexport const adTargets = {\n all: 'all',\n nonPaying: 'nonPaying',\n anonymous: 'anonymous',\n registered: 'registered',\n paying: 'paying',\n digitalOnly: 'digitalOnly',\n digitalAndPrint: 'digitalAndPrint',\n};\n\n// There are a total of 3 userTypes: \"anonymous\", \"registered\" and \"payer\"\nexport const userTypes = {\n anonymous: 'anonymous',\n registered: 'registered',\n payer: 'payer',\n};\n\nexport const adTypes = {\n maavaron: '.maavaron',\n popunder: '.popunder',\n talkback: '.talkback',\n regular: '',\n};\n\n\nexport default class AdManager {\n\n constructor(config) {\n this.config = Object.assign({}, config);\n this.user = new User(config);\n this.conflictResolver = new ConflictResolver(config.conflictManagementConfig);\n /**\n * Avoid race conditions by making sure to respect the usual timing of GPT.\n * This DFP implementation uses Enable-Define-Display:\n * Define page-level settings\n * enableServices()\n * Define slots\n * Display slots\n */\n try {\n googletag.cmd.push(() => {\n this.initGoogleTargetingParams(); // Define page-level settings\n this.initGoogleGlobalSettings(); // enableServices()\n this.initSlotRenderedCallback(); // Define callbacks\n });\n // Mouse special treatment to base path on mobile breakpoints\n const currentBreakpointName = getBreakpointName(getBreakpoint());\n if (this.config.adManagerConfig.adUnitBase.indexOf('mouse.co.il') > -1 &&\n currentBreakpointName.indexOf('xs') > -1) {\n this.config.adManagerConfig.adUnitBase = 'mouse.co.il.mobile_web';\n }\n // Holds adSlot objects as soon as possible.\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n });\n // Once DOM ready, add more adSlots.\n const onDomLoaded = () => { // eslint-disable-line no-inner-declarations\n try {\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.normal);\n });\n });\n }\n catch (err) {\n console.log(err); // eslint-disable-line no-console\n }\n };\n // Once window was loaded, add the rest of the adSlots.\n const onWindowLoaded = () => { // eslint-disable-line no-inner-declarations\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.low);\n // Clean blocking adSlots that are not defined on this page\n for (const blockingAdSlotKey of this.conflictResolver.dependencyMap.keys()) {\n if (!this.adSlots.has(blockingAdSlotKey)) {\n this.conflictResolver.dependencyMap.delete(blockingAdSlotKey);\n }\n }\n this.showAllDeferredSlots();\n });\n };\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', onDomLoaded);\n window.addEventListener('load', onWindowLoaded);\n break;\n case 'interactive':\n onDomLoaded();\n window.addEventListener('load', onWindowLoaded);\n break;\n default: // 'complete' - no need for event listeners.\n onDomLoaded();\n onWindowLoaded();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Shows all of the adSlots that can be displayed.\n */\n showAllSlots() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.type !== adTypes.talkback && this.shouldSendRequestToDfp(adSlot)) {\n adSlot.show();\n }\n }\n }\n\n /**\n * Gets all adSlots that has a certain priority\n * @param {adPriority} priority - the priority of the ad {high, normal, low}\n * @return {Array} adSlots - all of the defined adSlots that matches\n * the given priority\n */\n getAdSlotsByPriority(priority) {\n function priorityFilter(adSlot) {\n return adSlot.priority === priority;\n }\n return Array.from(this.adSlots.values()).filter(priorityFilter);\n }\n\n showAllDeferredSlots() {\n for (const deferredSlotId of this.conflictResolver.deferredSlots) {\n if (this.adSlots.has(deferredSlotId)) {\n if (!this.conflictResolver.isBlocked(deferredSlotId)) {\n const deferredAdSlot = this.adSlots.get(deferredSlotId);\n if (this.shouldSendRequestToDfp(deferredAdSlot)) {\n deferredAdSlot.show();\n }\n }\n }\n }\n }\n\n /**\n * Refreshes all responsive adSlots\n */\n refreshAllSlots() {\n const currentBreakpoint = getBreakpoint();\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive && adSlot.type !== adTypes.maavaron) {\n if (adSlot.lastResolvedWithBreakpoint !== currentBreakpoint &&\n this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n }\n\n /**\n * Refreshes all adSlots\n */\n refreshAllSlotsInPage() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n\n /**\n * Refreshes adSlot\n */\n\n refreshSlot(adUnitName) {\n const adSlot = this.adSlots.get(adUnitName);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n\n\n /**\n * Initializes adSlots based on the currently found slot markup (HTML page specific),\n * and the predefined configuration for the slots.\n * @param {Object} adSlotConfig - the AdSlots configuration object (see: globalConfig)\n * @param {String} filteredPriority - filters out all adSlots that does not match\n * a given adPriority. This is used to cherry pick the init process of ads.\n * @returns {Map}\n */\n initAdSlots(adSlotConfig, filteredPriority) {\n const adSlots = new Map(this.adSlots);\n let adSlotPlaceholders = Array.from(document.getElementsByClassName('js-dfp-ad'));\n adSlotPlaceholders = adSlotPlaceholders.filter(node => node.id); // only nodes with an id\n const adSlotNodeSet = new Set();\n adSlotPlaceholders = Array.prototype.filter.call(adSlotPlaceholders, node => {\n if (adSlotNodeSet.has(node.id) === false) { // first occurrence of Node\n adSlotNodeSet.add(node.id);\n return true;\n }\n return false;\n });\n // adSlotPlaceholders = adSlotPlaceholders.sort((a, b) => a.offsetTop - b.offsetTop);\n adSlotPlaceholders.forEach(adSlot => {\n const adSlotPriority = adSlotConfig[adSlot.id] ?\n adSlotConfig[adSlot.id].priority || adPriorities.normal : undefined;\n if (adSlotConfig[adSlot.id] && adSlots.has(adSlot.id) === false &&\n adSlotPriority === filteredPriority) {\n // The markup has a matching configuration from adSlotConfig AND was not already defined\n try {\n // adSlotConfig is built from globalConfig, but can be overridden by markup\n const computedAdSlotConfig = Object.assign({}, adSlotConfig[adSlot.id], {\n id: adSlot.id,\n target: adSlot.attributes['data-audtarget'] ?\n adSlot.attributes['data-audtarget'].value : adTargets.all,\n type: this.getAdType(adSlot.id),\n responsive: adSlotConfig[adSlot.id].responsive,\n fluid: adSlotConfig[adSlot.id].fluid || false,\n user: this.user,\n adManager: this,\n htmlElement: adSlot,\n department: this.config.department,\n network: this.config.adManagerConfig.network,\n adUnitBase: this.config.adManagerConfig.adUnitBase,\n deferredSlot: this.conflictResolver.isBlocked(adSlot.id),\n priority: adSlotPriority,\n });\n const adSlotInstance = new AdSlot(computedAdSlotConfig);\n adSlots.set(adSlot.id, adSlotInstance);\n if (adSlotInstance.type !== adTypes.talkback &&\n adSlotInstance.priority === adPriorities.high &&\n this.shouldSendRequestToDfp(adSlotInstance)) {\n /*\n console.log('calling show for high priority slot', adSlotInstance.id, ' called @',\n window.performance.now());\n */\n adSlotInstance.show();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n });\n return adSlots;\n }\n\n isPriority(adSlotId) {\n return (typeof adSlotId === 'string' &&\n (adSlotId.indexOf('plazma') > 0 ||\n adSlotId.indexOf('maavaron') > 0 ||\n adSlotId.indexOf('popunder') > 0));\n }\n\n /**\n * Returns the adType based on the adSlot name.\n * @param {String} adSlotId - the adSlot's identifier.\n * @returns {*} enumerated export 'adTypes'\n */\n getAdType(adSlotId) {\n if (!adSlotId) {\n throw new Error('Missing argument: a call to getAdType must have an adSlotId');\n }\n if (adSlotId.indexOf(adTypes.maavaron) > -1) return adTypes.maavaron;\n if (adSlotId.indexOf(adTypes.popunder) > -1) return adTypes.popunder;\n if (adSlotId.indexOf(adTypes.talkback) > -1) return adTypes.talkback;\n return adTypes.regular;\n }\n\n /**\n * @param {object} adSlot the AdSlot\n * @returns {boolean|*}\n */\n shouldSendRequestToDfp(adSlot) {\n // Conflict management check\n return this.conflictResolver.isBlocked(adSlot.id) === false &&\n // Valid Referrer check\n adSlot.isWhitelisted() &&\n // Not in referrer Blacklist\n adSlot.isBlacklisted() === false &&\n this.shouldDisplayAdAfterAdBlockRemoval(adSlot) &&\n // if a paywall pop-up is shown And the number is 12 or more - SHOW MAAVRON\n this.shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) &&\n // Responsive: breakpoint contains ad?\n this.doesBreakpointContainAd(adSlot) &&\n // check in case of Smartphoneapp\n this.haveValidCookieForSmartphoneapp() &&\n // Targeting check (userType vs. slotTargeting)\n this.doesUserTypeMatchBannerTargeting(adSlot) &&\n // Impressions Manager check (limits number of impressions per slot)\n this.user.impressionManager.reachedQuota(adSlot.id) === false;\n }\n\n printShouldSendRequestToDfp(id) {\n let res = '';\n if (!this.adSlots.has(id)) {\n res = `id not exist: ${id}`;\n }\n else {\n const a = this.adSlots.get(id);\n res += this.conflictResolver.isBlocked(a.id) === !1 ? '' : 'isBlocked,';\n res += a.isWhitelisted() ? '' : 'isWhitelisted,';\n res += a.isBlacklisted() === !1 ? '' : 'isBlacklisted,';\n res += this.shouldDisplayAdAfterAdBlockRemoval(a) ? '' : 'AdBlockRemoval,';\n res += this.shouldDisplayAdMaavaronAfterPayWallBanner(a) ? '' : 'PayWallBanner,';\n res += this.doesBreakpointContainAd(a) ? '' : 'Breakpoint,';\n res += this.haveValidCookieForSmartphoneapp() ? '' : 'Smartphoneapp,';\n res += this.doesUserTypeMatchBannerTargeting(a) ? '' : 'Targeting,';\n res += this.user.impressionManager.reachedQuota(a.id) === !1 ? '' : 'reachedQuota,';\n res = `
${id}
${res}
`;\n }\n document.write(res);\n return res;\n }\n\n testShouldSendRequestToDfp(id) {\n // leave the old name for ios legacy\n let cookieMap = getCookieAsMap();\n cookieMap = JSON.stringify(cookieMap);\n cookieMap = cookieMap.replace(/,/g, '
');\n const res = `
${cookieMap}
`;\n document.write(res);\n return res;\n }\n\n shouldDisplayAdAfterAdBlockRemoval(adSlot) {\n return !(this.config.adBlockRemoved === true &&\n (adSlot.type === adTypes.maavaron ||\n adSlot.type === adTypes.popunder));\n }\n\n shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) {\n let shouldDisplay = true;\n if (this.config.site === 'haaretz' && adSlot.type === adTypes.maavaron) {\n try {\n const paywallBanner = JSON.parse(window.localStorage.getItem('_cobj'));\n shouldDisplay = !paywallBanner || ((paywallBanner.mc && paywallBanner.mc >= 12) ||\n (paywallBanner.nextslotLocation &&\n !paywallBanner.nextslotLocation.includes('pop')));\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error('ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner');\n /* eslint-enable no-console*/\n }\n }\n return shouldDisplay;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n\n haveValidCookieForSmartphoneapp() {\n return this.config.isValidForsmartPhone;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n doesUserTypeMatchBannerTargeting(adSlotOrTarget) {\n // if the user is smadar show her all the banners\n const cookieMap = getCookieAsMap();\n if (cookieMap.login === 'pilosmadar@gmail.com') {\n return true;\n }\n if (cookieMap.tmsso !== undefined && cookieMap.tmsso.userName === 'pilosmadar@gmail.com') {\n return true;\n }\n const userType = this.user.type;\n const adTarget = typeof adSlotOrTarget === 'string' ? adSlotOrTarget : adSlotOrTarget.target;\n\n switch (adTarget) {\n case adTargets.all : return true;\n case adTargets.nonPaying :\n return userType === userTypes.anonymous || userType === userTypes.registered;\n case adTargets.anonymous : return userType === userTypes.anonymous;\n case adTargets.registered : return userType === userTypes.registered;\n case adTargets.paying : return userType === userTypes.payer;\n case adTargets.digitalOnly : return userType === userTypes.payer;\n case adTargets.digitalAndPrint : return userType === userTypes.payer;\n default: return false;\n }\n }\n\n /**\n * Report to the AdManager that a breakpoint has been switched (passed from one break to\n * another). Should there be a responsive slot with a\n * @param {Breakpoint} breakpoint - the breakpoint that is currently being displayed\n * @returns {Integer} affected - the number of adSlots affected by the change\n */\n switchedToBreakpoint(breakpoint) {\n if (!breakpoint) {\n throw new Error('Missing argument: a call to switchedToBreakpoint must have an breakpoint');\n }\n let count = 0;\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive === true && adSlot.lastResolvedWithBreakpoint) {\n if (adSlot.lastResolvedWithBreakpoint !== breakpoint) {\n adSlot.refresh();\n count++;\n }\n }\n }\n return count;\n }\n\n /**\n * Checks whether an adSlot is defined for a given breakpoint (Default: current breakpoint)\n * @param {AdSlot} adSlot - the adSlot to check.\n * @param {Breakpoint} [breakpoint=currentBreakpoint] - the breakpoint to check this ad in.\n * @returns {boolean} true iff the adSlot is defined for the given breakpoint.\n */\n doesBreakpointContainAd(adSlot, breakpoint = getBreakpoint()) {\n if (!adSlot) {\n throw new Error('Missing argument: a call to doesBreakpointContainAd must have an adSlot');\n }\n let containsBreakpoint = true;\n if (adSlot.responsive === true) {\n const mapping = adSlot.responsiveAdSizeMapping[getBreakpointName(breakpoint)];\n if (Array.isArray(mapping) === false) {\n throw new Error(`Invalid argument: breakpoint:${breakpoint} doesn't exist!`, this);\n }\n containsBreakpoint = mapping.length > 0 && !arraysEqual(mapping, [[0, 0]]);\n }\n return containsBreakpoint;\n }\n\n /**\n * Initializes the callback from the 'slotRenderEnded' event for each slot\n */\n initSlotRenderedCallback() {\n if (window.googletag && window.googletag.apiReady) {\n const pubads = window.googletag.pubads();\n pubads.addEventListener('slotRenderEnded', event => {\n const id = event.slot.getAdUnitPath().split('/')[3];\n const isEmpty = event.isEmpty;\n const resolvedSize = event.size;\n // console.log('slotRenderEnded for slot',id,' called @',window.performance.now());\n if (this.adSlots.has(id)) {\n const adSlot = this.adSlots.get(id);\n adSlot.lastResolvedSize = resolvedSize;\n adSlot.lastResolvedWithBreakpoint = getBreakpoint();\n if (isEmpty) {\n adSlot.lastResolvedSize = ConflictResolver.EMPTY_SIZE;\n adSlot.hide();\n this.releaseSlotDependencies(adSlot);\n }\n else {\n this.releaseSlotDependencies(adSlot, adSlot.lastResolvedSize);\n }\n this.user.impressionManager.registerImpression(`${adSlot.id}${this.config.department}`);\n this.user.impressionManager.registerImpression(`${adSlot.id}_all`);\n }\n else {\n /*\n console.error(`Cannot find an adSlot with id: ${id} - Ad Unit path is\n ${event.slot.getAdUnitPath()}`);\n */\n }\n });\n }\n else {\n throw new Error('googletag api was not ready when \\'initSlotRenderedCallback\\' was called!');\n }\n }\n\n releaseSlotDependencies(adSlot) {\n try {\n const id = adSlot.id;\n this.conflictResolver.updateResolvedSlot(id, adSlot.lastResolvedSize);\n if (this.conflictResolver.isBlocking(id)) {\n // Hide all blocked adSlots\n for (const blockedSlot of this.conflictResolver.getBlockedSlotsIds(id)) {\n if (this.conflictResolver.isBlocked(blockedSlot)) {\n if (this.adSlots.has(blockedSlot)) {\n this.adSlots.get(blockedSlot).hide();\n }\n }\n }\n // Show the non blocked\n for (const deferredSlotKey of this.conflictResolver.deferredSlots.keys()) {\n const deferredAdSlot = this.adSlots.get(deferredSlotKey);\n if (deferredAdSlot && this.shouldSendRequestToDfp(deferredAdSlot)) {\n this.conflictResolver.deferredSlots.delete(deferredSlotKey);\n if (deferredAdSlot.deferredSlot) {\n deferredAdSlot.defineSlot();\n deferredAdSlot.deferredSlot = false;\n }\n deferredAdSlot.show();\n }\n }\n }\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error(`Cannot updateSlotDependencies for adSlot: ${adSlot.id}`);\n /* eslint-enable no-console*/\n }\n }\n\n setSsoGroupKey() {\n fetch(`/ssoGroupKey?value=${this.user.sso.userId}`, {\n method: 'GET',\n cache: 'no-cache',\n }).then(value => {\n if (value) {\n value.json().then(data => {\n if (data && data.result && data.result !== 'item not found'\n && data.result !== 'value is empty') {\n localStorage.setItem('_SsoGroupKey', data.result);\n }\n });\n }\n });\n }\n\n /**\n * Initializes page-level targeting params.\n */\n initGoogleTargetingParams() {\n if (window.googletag && window.googletag.apiReady) {\n // Returns a reference to the pubads service.\n let SsoGroupKey = null;\n try {\n SsoGroupKey = localStorage.getItem('_SsoGroupKey');\n if (!SsoGroupKey && this.user.sso.userId) {\n this.setSsoGroupKey();\n }\n }\n catch (e) {\n SsoGroupKey = null;\n }\n const pubads = googletag.pubads();\n // Environment targeting (dev, test, prod)\n if (this.config.environment) {\n pubads.setTargeting('stg', [this.config.environment]);\n }\n // App targeting\n // User targeting\n if (this.user.htz_type) {\n pubads.setTargeting('htz_user_type', [this.user.htz_type]);\n }\n if (this.user.tm_type) {\n pubads.setTargeting('tm_user_type', [this.user.tm_type]);\n }\n if (this.user.hdc_type) {\n pubads.setTargeting('hdc_user_type', [this.user.hdc_type]);\n }\n // Context targeting\n if (this.config.section) {\n pubads.setTargeting('section', [this.config.section]);\n }\n if (this.config.sub_section) {\n pubads.setTargeting('sub_section', [this.config.sub_section]);\n }\n if (this.config.articleId) {\n pubads.setTargeting('articleId', [this.config.articleId]);\n pubads.setTargeting('react', ['false']);\n }\n if (this.config.gStatCampaignNumber && this.config.gStatCampaignNumber !== -1) {\n pubads.setTargeting('gstat_campaign_id', [this.config.gStatCampaignNumber]);\n }\n if (this.config.proposalNumber) {\n pubads.setTargeting('proposaltype', [this.config.proposalNumber]);\n }\n if (this.config.pageType) {\n pubads.setTargeting('pageType', [this.config.pageType]);\n }\n if (this.config.isWriterAlerts) {\n pubads.setTargeting('WriterAlerts', ['true']);\n }\n // AdBlock removal\n if (this.config.adBlockRemoved) {\n pubads.setTargeting('adblock_removed', [this.config.adBlockRemoved]);\n }\n // University targeting - triggered via cookie\n if (this.config.wifiLocation) {\n pubads.setTargeting('wifi', [this.config.wifiLocation]);\n }\n if (this.config.tags && Array.isArray(this.config.tags)) {\n pubads.setTargeting('tags', [...this.config.tags]);\n }\n\n if (this.user.sso && this.user.sso.userId && SsoGroupKey) {\n pubads.setTargeting(SsoGroupKey, this.user.sso.userId);\n }\n if (this.config.anonymousId) {\n const anonymousIdKeyName = 'anonymousIdKey';\n pubads.setTargeting(anonymousIdKeyName, this.config.anonymousId);\n }\n if (this.user.country) {\n pubads.setTargeting('country', this.user.country);\n }\n\n const cityNames = this.getCityNames();\n if (cityNames) {\n pubads.setTargeting('cityName', [...cityNames]);\n }\n\n // Ads Centering\n pubads.setCentering(true);\n }\n else {\n throw new Error('googletag api was not ready when \\'initGoogleTargetingParams\\' was called!');\n }\n }\n\n /**\n * Initializes googletag services.\n */\n initGoogleGlobalSettings() {\n if (window.googletag && window.googletag.apiReady) {\n const googleGlobalSettings = this.config.googleGlobalSettings;\n // Enable GET parameter overrides\n if (window.location.search) {\n const search = window.location.search;\n if (search.indexOf('sraon') > 0) {\n console.log('Single Request Mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = true;\n }\n else if (search.indexOf('sraoff') > 0) {\n console.log('Single Request Mode: disabled');// eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = false;\n }\n if (search.indexOf('asyncrenderingon') > 0) {\n console.log('Async rendering mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = true;\n }\n else if (search.indexOf('asyncrenderingonoff') > 0) {\n console.log('Sync rendering mode: active');// eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = false;\n }\n }\n // Google services activation\n if (googleGlobalSettings.enableSingleRequest === true) {\n googletag.pubads().enableSingleRequest();\n }\n // if (googleGlobalSettings.enableAsyncRendering === true) {\n // googletag.pubads().enableAsyncRendering();\n // }\n // else {\n // googletag.pubads().enableSyncRendering();\n // }\n // Enables all GPT services that have been defined for ad slots on the page.\n googletag.enableServices();\n }\n else {\n throw new Error('googletag api wasn\\'t ready when \\'initGoogleGlobalSettings\\' was called!');\n }\n }\n\n\n getCityNames() {\n const cityNames = [];\n document.querySelectorAll('[data-location-city-name]').forEach((element) => {\n if (!cityNames.includes(element.dataset.locationCityName)) {\n cityNames.push(element.dataset.locationCityName);\n }\n });\n return cityNames.length > 0 ? cityNames : null;\n }\n\n}\n","/* globals googletag */\nimport AdManager from '../src/objects/adManager';\nimport globalConfig from './globalConfig';\nimport { getBreakpoint, debounce } from '../src/utils/breakpoints';\n\nconst defaultConfig = globalConfig || {};\nconst resizeTimeout = 250;\n\nexport default class DFP {\n\n constructor(config) {\n this.config = Object.assign({}, defaultConfig, config);\n this.wasInitialized = false;\n this.initStarted = false;\n this.breakpoint = getBreakpoint();\n this.initWindowResizeListener();\n }\n\n /**\n * This part of the object's construction is dependent on the call to 'init'\n */\n resumeInit() {\n try {\n this.adManager = this.adManager || new AdManager(this.config);\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * initializes the 'googletag' global namespace and add the\n * google publish tags library to the page\n * @returns {Promise} that resolves to true once the googletag api is ready to use\n * (googletag.apiReady = true)\n */\n initGoogleTag() {\n const dfpThis = this;\n return new Promise((resolve, reject) => {\n if (dfpThis.initStarted === true) {\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(dfpThis);\n });\n }\n else {\n dfpThis.initStarted = true;\n // set up a place holder for the gpt code downloaded from google\n window.googletag = window.googletag || {};\n\n // this is a command queue used by GPT any methods added to it will be\n // executed when GPT code is available, if GPT is already available they\n // will be executed immediately\n window.googletag.cmd = window.googletag.cmd || [];\n // load google tag services JavaScript\n (() => {\n const tag = window.document.createElement('script');\n tag.async = true;\n tag.type = 'text/javascript';\n // Supports both https and http\n tag.setAttribute('src', '//www.googletagservices.com/tag/js/gpt.js');\n const node = window.document.getElementsByTagName('script')[0];\n tag.addEventListener('load', () => {\n dfpThis.resumeInit();\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(this);\n });\n });\n tag.addEventListener('error', (error) => {\n dfpThis.wasInitialized = false;\n reject(error);\n });\n node.parentNode.insertBefore(tag, node);\n })();\n }\n });\n }\n\n /**\n * Returns true iff googletag was properly initialized on the page\n * @returns {boolean}\n */\n isGoogleTagReady() {\n if (this.wasInitialized === true || (window.googletag && window.googletag.apiReady)) {\n this.wasInitialized = true;\n }\n return this.wasInitialized;\n }\n\n /**\n * Initializes the window resize listener to support responsive ad refreshes\n */\n initWindowResizeListener() {\n const dfpThis = this;\n function onResize() {\n const currentBreakpoint = getBreakpoint();\n if (dfpThis.breakpoint !== currentBreakpoint) {\n dfpThis.breakpoint = currentBreakpoint;\n if (dfpThis.adManager) {\n dfpThis.adManager.refreshAllSlots();\n }\n else {\n throw new Error('initWindowResizeListener error - adManager instance is not available');\n }\n }\n }\n const debouncedFunction = debounce(onResize, resizeTimeout);\n window.onresize = debouncedFunction;\n }\n}\n","// generated by genversion\nexport const version = '2.6.5';\n","import DFP from './dfp';\nimport globalConfig from './globalConfig';\nimport { version as v } from './version';\n\n// DFP version is based on the package.json\nDFP.version = v || 'VERSION';\n\n/*\n // Only for development mode\n if ( process.env.NODE_ENV !== 'production' ) {\n DFP.dev = '123';\n }\n */\n\nexport const config = globalConfig;\nexport const version = DFP.version;\nexport default DFP;\n"]} \ No newline at end of file +{"version":3,"sources":["../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/classCallCheck.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/createClass.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/toConsumableArray.js","../src/utils/cookieUtils.js","../src/globalConfig.js","../src/utils/time.js","../src/utils/breakpoints.js","../src/objects/impressionsManager.js","../src/objects/user.js","../src/objects/conflictResolver.js","../src/utils/arrays.js","../src/objects/adSlot.js","../src/objects/adManager.js","../src/dfp.js","../src/version.js","../src/index.js"],"names":["instance","Constructor","TypeError","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","defineProperty","key","protoProps","staticProps","prototype","arr","Array","isArray","arr2","from","globalConfig","userTypes","ImpressionManager","ssoKey","arraysEqual","adSlot","AdSlot","DFP","version","v"],"mappings":";;;AAAA,uBAAgB,UAAUA,QAAV,EAAoBC,WAApB,EAAiC;MAC3C,EAAED,oBAAoBC,WAAtB,CAAJ,EAAwC;UAChC,IAAIC,SAAJ,CAAc,mC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AMyB;UACnB,UAAN;eACA,WAAoB;YACZ,oBAAN;YACI,QAAA,eAAJ,mBAA8C;kBAC5C,aAAA;cACI,QAAJ,WAAuB;oBACrB,UAAA;iBAEG;kBACG,IAAA,MAAN;;;;UAIA,oBAAoB,SAAA,UAA1B;aACA,WAAA;;;;;;;AC5GJ;AACA,AAAO,IAAMC,YAAU;;ACGvB;AACAD,MAAI,UAAUE,aAAK;;;;;;;;;AASnB,AAAO,IAAM,SAAST;AACtB,AAAO,IAAMQ,aAAUD,MAAI,QAC3B","file":"dfp.js","sourcesContent":["export default (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n});","export default (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();","export default (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n});","/**\n * Htz-cookie-util\n * @module htzCookieUtil\n * @author Elia Grady elia.grady@haaretz.co.il\n * @license MIT\n */\n\n/**\n * Translates Key-Value string into a convenient map.\n * @param {String} string String in format of \"keyvalue.....\"\n * @param {object} options object for overriding defaults:\n * options.separator is a String or regExp that separates between each key value pairs\n * (default is ';'). options.operator is a String or regExp that separates between each key\n * and value within a pair (default is '=').\n * @returns {object} a map object, with key-value mapping according to the passed configuration.\n */\nfunction stringToMap(string,\n { separator = ';', operator = '=' } = {}) {\n const map = {};\n const itemsArr = string.split(separator);\n itemsArr.forEach(element => {\n if (typeof element === 'string') {\n const keyValue = element.split(operator);\n if (keyValue.length === 2) {\n try {\n map[keyValue[0]] = decodeURIComponent(keyValue[1]);\n }\n catch (e) {\n // Do nothing, malformed URI\n }\n }\n }\n });\n return map;\n}\nexport const ssoKey = window.location.hostname.indexOf('haaretz.com') > -1 ? 'engsso' : 'tmsso';\n\n// Translates Cookie string into a convenient map.\nexport default function getCookieAsMap() {\n const map = stringToMap(document.cookie, { separator: /;\\s?/ });\n if (typeof map.tmsso === 'string') {\n map.tmsso = stringToMap(map.tmsso, { separator: ':' });\n }\n if (typeof map.engsso === 'string') {\n map.engsso = stringToMap(map.engsso, { separator: ':' });\n }\n return map;\n}\n","/* global dfpConfig */\nimport getCookieAsMap, { ssoKey } from './utils/cookieUtils';\n// globalConfig for DFP\nlet dfpBaseConf;\ntry {\n dfpBaseConf = window.JSON.parse(document.getElementById('dfpConfig').textContent);\n}\ncatch (err) {\n dfpBaseConf = window.dfpConfig;\n}\nconst dfpConfig = Object.assign({\n get referrer() {\n return document.referrer ? document.referrer : '';\n },\n get isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n },\n /**\n * Returns true iff the loaded page is the homepage (no inner path)\n * @returns {boolean}\n */\n get isHomepage() {\n return window.location.pathname === '/' || this.environment === 3; // 'prod'\n },\n get department() {\n return this.isHomepage ? '_homepage' : '_section';\n },\n /**\n * returns the domain the page was loaded to. i.e: 'haaretz.co.il', 'haaretz.com'\n * @returns {string} the domain name from the windows's location hostname property\n */\n get domain() {\n const regexMatch = /([\\d|\\w]+)(\\.co\\.il|\\.com)(.*)?/.exec(window.location.hostname);\n const result = regexMatch ? regexMatch[0] : window.location.hostname;\n return result;\n },\n /**\n * Returns an array of concatenated paths, separated by a dot.\n * For example, for the URL:\n * http://www.haaretz.co.il/news/world/america/us-election-2016/LIVE-1.2869045\n * the path is '/news/world/america/us-election-2016/LIVE-1.2869045'.\n * This function takes the directories ['news', 'world', 'america', 'us-election-2016']\n * and converts it to the following format:\n * ['.news', '.news.world', '.news.world.america', '.news.world.america.us-election-2016']\n * This denotes the path configuration for the given adSlot\n * non articles (sections) will be given a '0' - no articleId value for targeting purposes)\n * @returns {Array.} an array of path names\n */\n get path() {\n let sectionArray = this.articleId && this.articleId !== '0' ?\n window.location.pathname.split('/').slice(1, -1) :\n window.location.pathname.split('/').slice(1);\n sectionArray = sectionArray.filter(path =>\n path !== 'wwwMobileSite' && path !== 'whtzMobileSite');\n return sectionArray\n .map(section => `.${section}`)\n .map((section, index, arr) => arr.slice(0, index + 1)\n .reduce((last, current) => last.concat(current)));\n },\n /**\n * Returns a string representation for the name of the site\n * @return {*|string}\n */\n get site() {\n let site;\n if (window.location.hostname.indexOf('haaretz.co.il') > -1) {\n site = 'haaretz';\n }\n else if (window.location.hostname.indexOf('themarker.com') > -1) {\n site = 'themarker';\n }\n else if (window.location.hostname.indexOf('mouse.co.il') > -1) {\n site = 'mouse';\n }\n return site || 'haaretz';\n },\n /**\n * Returns the current environment targeting param, if such is defined.\n * @returns {number} targeting param, 1 for local development, 2 for test servers and 3 for prod.\n * May return undefined if no targeting is specified.\n */\n get environment() {\n const env = {\n dev: 1,\n test: 2,\n prod: 3,\n };\n return window.location.port === '8080' ? env.dev :\n (window.location.hostname.indexOf('pre.haaretz.co.il') > -1\n || window.location.hostname.indexOf('tmtest.themarker.com') > -1\n || window.location.hostname.indexOf('pre.haaretz.com') > -1\n || window.location.hostname.indexOf('prodmouse.mouse.co.il') > -1) ? env.test :\n (window.location.pathname.indexOf('/cmlink/Haaretz.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/TheMarker.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/Mouse.HomePage') > -1)\n ? env.prod : undefined;\n },\n /**\n * Returns the articleIf if on an article page, or null otherwise\n * @returns {string} an articleId string from the pathname, or 0 if not found\n */\n get articleId() {\n const articleIdMatch = /\\d\\.\\d+/g.exec(window.location.pathname);\n let articleId = '0';\n if (articleIdMatch) {\n articleId = articleIdMatch.pop(); // Converts [\"1.23145\"] to \"1.23145\"\n }\n return articleId;\n },\n utm_: {\n get content() {\n return this.getUrlParam('utm_content');\n },\n get source() {\n return this.getUrlParam('utm_source');\n },\n get medium() {\n return this.getUrlParam('utm_medium');\n },\n get campaign() {\n return this.getUrlParam('utm_campaign');\n },\n getUrlParam(key) {\n const results = RegExp(`(${key})(=)([^&\"]+)`).exec(window.location.search);\n return results && results[3] ? results[3] : undefined;\n },\n },\n get adBlockRemoved() {\n let adBlockRemoved = false;\n try {\n if (localStorage.getItem('adblock_removed')) {\n adBlockRemoved = true;\n }\n }\n catch (err) {\n // do nothing\n }\n return adBlockRemoved;\n },\n get ssoGroupKey() {\n return window.localStorage.getItem('_SsoGroupKey');\n },\n get anonymousId() {\n const cookieName = 'anonymousId';\n const cookieMap = getCookieAsMap();\n let anonymousId = '';\n if (cookieMap && cookieMap[cookieName]) {\n anonymousId = cookieMap[cookieName];\n }\n return anonymousId;\n },\n get isWriterAlerts() {\n return (location.search.indexOf('writerAlerts=true') > -1);\n },\n get wifiLocation() {\n let wifiLocation;\n const cookieName = '_htzwif'; // eslint-disable-line no-underscore-dangle\n const cookieMap = getCookieAsMap();\n try {\n if (cookieMap && cookieMap[cookieName]) {\n if (cookieMap[cookieName].toLowerCase() === 'arcaffe') {\n wifiLocation = 'ArCafe';\n }\n if (cookieMap[cookieName].toLowerCase() === 'university') {\n wifiLocation = 'university';\n }\n }\n if (cookieMap && cookieMap.fairs) {\n wifiLocation = 'fairs';\n }\n }\n catch (err) {\n // do nothing\n }\n return wifiLocation;\n },\n get isValidForsmartPhone() {\n let validForAds = true;\n const PageUrl = window.location.href;\n const isSmartphoneapp = PageUrl.match('haaretzsmartphoneapp');\n const cookieMap = getCookieAsMap();\n try {\n if (isSmartphoneapp) {\n // eslint-disable-line no-underscore-dangle\n if (cookieMap && cookieMap.HtzPusr &&\n (cookieMap.tmsso === undefined || cookieMap.tmsso.userName !== 'pilosmadar@gmail.com')) {\n validForAds = false;\n }\n }\n }\n catch (err) {\n // do nothing\n }\n return validForAds;\n },\n get gStatCampaignNumber() {\n let gstatCampaign;\n try {\n gstatCampaign = localStorage.getItem('GstatCampaign') ?\n JSON.parse(localStorage.getItem('GstatCampaign')) : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n gstatCampaign = undefined;\n }\n return gstatCampaign ? gstatCampaign.CampaignNumber : undefined;\n },\n get pageType() {\n let type = '';\n try {\n const htmlclassList = document.querySelector('html').classList;\n switch (true) {\n case /mouse_location/.test(htmlclassList):\n type = 'mouse_location';\n break;\n case /mouse_event/.test(htmlclassList):\n type = 'mouse_event';\n break;\n case /contentType-story/.test(htmlclassList):\n type = 'mouse_article';\n break;\n default:\n if (this.articleId !== '0') {\n switch (this.domain) {\n case 'haaretz.co.il':\n type = 'htz_article';\n break;\n case 'haaretz.com':\n type = 'hdc_article';\n break;\n case 'themarker.com':\n type = 'tm_article';\n break;\n default:\n type = '';\n }\n }\n else {\n type = '';\n }\n }\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n type = '';\n }\n return type;\n },\n get proposalNumber() {\n let proposal;\n try {\n proposal = localStorage.getItem('proposaltype') ?\n localStorage.getItem('proposaltype') : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n proposal = undefined;\n }\n return proposal;\n },\n adSlotConfig: {\n 'haaretz.co.il.example.slot': {\n id: 'slotId',\n // path : \"/network/base/slotId/slotId_subsection\", Will be calculated from AdManager\n responsive: true,\n adSizeMapping: [['width1', 'height1'], ...['widthN', 'heightN']],\n priority: 'normal',\n fluid: false,\n responsiveAdSizeMapping: {\n xxs: [['width1', 'height1'], ...['widthN', 'heightN']],\n xs: [['width1', 'height1'], ...['widthN', 'heightN']],\n s: [['width1', 'height1'], ...['widthN', 'heightN']],\n m: [['width1', 'height1'], ...['widthN', 'heightN']],\n l: [['width1', 'height1'], ...['widthN', 'heightN']],\n xl: [['width1', 'height1'], ...['widthN', 'heightN']],\n xxl: [['width1', 'height1'], ...['widthN', 'heightN']],\n },\n blacklistReferrers: 'comma, delimited, blacklisted, referrer, list',\n whitelistReferrers: 'comma, delimited, referrer, list',\n },\n },\n adManagerConfig: {\n network: '9401',\n adUnitBase: 'haaretz.co.il_Web',\n },\n breakpointsConfig: {\n get breakpoints() {\n // Override in VM from backend to control this toggle.\n let breakpoints;\n switch (dfpConfig.googleGlobalSettings.breakpointType) {\n case 'type1': breakpoints = this.breakpoints1; break;\n case 'type2': breakpoints = this.breakpoints2; break;\n case 'type3': breakpoints = this.breakpoints3; break;\n case 'type4': breakpoints = this.breakpoints4; break;\n default: breakpoints = this.breakpoints1;\n }\n return breakpoints;\n },\n // Type 1\n breakpoints1: {\n xxs: 600,\n xs: 761,\n s: 993,\n m: 1009,\n l: 1291,\n xl: 1600,\n xxl: 1900,\n },\n // Type 2\n breakpoints2: {\n xxs: 600,\n xs: 1000,\n s: 1150,\n m: 1281,\n l: 1600,\n xl: 1920,\n xxl: 1920,\n },\n // Type 3\n breakpoints3: {\n xxs: 100,\n xs: 480,\n s: 600,\n m: 768,\n l: 1024,\n xl: 1280,\n xxl: 1900,\n },\n // Type 4\n breakpoints4: {\n xxs: 600,\n xs: 768,\n s: 1024,\n m: 1280,\n l: 1900,\n xl: 1900,\n xxl: 1900,\n },\n },\n userConfig: {\n type: undefined,\n age: undefined,\n gender: undefined,\n },\n conflictManagementConfig: {\n 'blocking.ad.unit.name': [\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n ],\n },\n impressionManagerConfig: {\n 'ad.unit.name': {\n target: 'all|section|homepage',\n frequency: '$1/$2(day|hour)',\n exposed: 0,\n expires: (new Date()).getTime(),\n },\n },\n googleGlobalSettings: {\n enableSingleRequest: true,\n enableAsyncRendering: true,\n refreshIntervalTime: 1000,\n breakpointType: 'type1',\n },\n sso: ssoKey,\n\n}, dfpBaseConf);\n\nexport default dfpConfig;\n","/**\n * Helper function. Adds N hours to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Number} hours - the amount of hours to add, in whole numbers\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'hours' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given hours\n */\nexport function addHours(date, hours) {\n if (!date) {\n throw new SyntaxError('addHours called without a required \\'date\\' parameter!');\n }\n if (!hours) {\n throw new SyntaxError('addHours called without a required \\'hours\\' parameter!');\n }\n else if (isNaN(parseInt(hours, 10))) {\n throw new TypeError('addHours called with an invalid integer \\'hours\\' parameter!');\n }\n const result = new Date(date);\n result.setHours(result.getHours() + parseInt(hours, 10));\n return result;\n}\n\n/**\n * Helper function. Adds N days to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Integer} days - the amount of days to add\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'days' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given days\n */\nexport function addDays(date, days) {\n if (!date) {\n throw new SyntaxError('addDays called without a required \\'date\\' parameter!');\n }\n if (!days) {\n throw new SyntaxError('addDays called without a required \\'days\\' parameter!');\n }\n else if (isNaN(parseInt(days, 10))) {\n throw new TypeError('addDays called with an invalid integer \\'days\\' parameter!');\n }\n const result = new Date(date);\n result.setDate(result.getDate() + parseInt(days, 10));\n return result;\n}\n","import globalConfig from '../globalConfig';\n\nconst breakpoints = globalConfig.breakpointsConfig.breakpoints;\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param { function } func - the function to run\n * @param { number } wait - the timeout period to avoid running the function\n * @param { boolean } immediate - leading edge modifier\n * @returns {function } the debounced function\n */\nexport function debounce(func, wait = 100, immediate) {\n let timeout;\n return function debounced() {\n const context = this;\n const args = arguments;// eslint-disable-line prefer-rest-params\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @returns {number} the break that the current width represents\n */\nexport function getBreakpoint() {\n let breakpoint;\n const windowWidth = window.innerWidth\n || document.documentElement.clientWidth\n || document.body.clientWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: breakpoint = breakpoints.xxs; break;\n case windowWidth < breakpoints.s: breakpoint = breakpoints.xs; break;\n case windowWidth < breakpoints.m: breakpoint = breakpoints.s; break;\n case windowWidth < breakpoints.l: breakpoint = breakpoints.m; break;\n case windowWidth < breakpoints.xl: breakpoint = breakpoints.l; break;\n case windowWidth < breakpoints.xxl: breakpoint = breakpoints.xl; break;\n default: breakpoint = breakpoints.xxl;\n }\n return breakpoint;\n}\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @param {number} breakpoint - the breakpoint label enumerator that the current width represents\n * (yield with a getBreakpoint() call or passed manually )\n * @returns {string} breakpoint - the breakpoint label that the current width represents,\n * as a string\n */\nexport function getBreakpointName(breakpoint) {\n let resultBreakpoint;\n const windowWidth = breakpoint || window.innerWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: resultBreakpoint = 'xxs'; break;\n case windowWidth < breakpoints.s: resultBreakpoint = 'xs'; break;\n case windowWidth < breakpoints.m: resultBreakpoint = 's'; break;\n case windowWidth < breakpoints.l: resultBreakpoint = 'm'; break;\n case windowWidth < breakpoints.xl: resultBreakpoint = 'l'; break;\n case windowWidth < breakpoints.xxl: resultBreakpoint = 'xl'; break;\n default: resultBreakpoint = 'xxl';\n }\n return resultBreakpoint;\n}\n","import globalConfig from '../globalConfig';\nimport { addHours, addDays } from '../utils/time';\nimport { debounce } from '../utils/breakpoints';\n\nexport const keys = {\n impressions: 'impressions',\n frequency: 'frequency',\n /**\n * [0] - full match\n * [1] - impression count i.e: \"1\" | \"22\"\n * [2] - impression expiry range quantifier i.e: \"1\" | \"22\"\n * [3] - impression expiry range unit i.e: \"day\" | \"hour\"\n */\n frequencyRegex: /(\\d+)\\/(\\d+)(day|hour)/,\n expires: 'expires',\n exposed: 'exposed',\n target: 'target',\n maxImpressions: 'maxImpressions',\n hours: 'hour',\n days: 'day',\n adSlotId: 'id',\n};\n\nexport default class ImpressionsManager {\n\n constructor(impressionManagerConfig) {\n this.now = (new Date()).getTime(); // this date is used for comparisons only\n this.config = Object.assign({}, impressionManagerConfig);\n this.impressions = this.retrieveImpressionsData();\n this.initImpressionMap();\n }\n\n retrieveImpressionsData() {\n const impressions = this.migrateImpressionsData();\n /*\n Merge migrated data with new data\n console.log('Migrated: ',impressions);\n */\n Object.keys(impressions).map((key, index) => {\n impressions[key] = Object.assign({}, impressions[key], this.config[key]);\n return this;\n });\n /*\n console.log('Merged: ',impressions);\n Filter out entries without frequency\n */\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (!impressions[key][keys.frequency]) {\n // console.log(`Removing ${key} - since it does not have a frequency`,impressions[key]);\n delete impressions[key];\n }\n }\n }\n // console.log('Filtered: ',impressions);\n return impressions;\n }\n\n migrateImpressionsData() {\n let impressions;\n let impressionsData;\n try {\n impressionsData = window.localStorage.getItem(keys.impressions);\n }\n catch (err) {\n // In case of thrown 'SecurityError' or 'QuotaExceededError', the variable should be undefined\n impressionsData = undefined;\n }\n try {\n impressions = JSON.parse(impressionsData);\n }\n catch (err) {\n // Here is where old impression data is converted to new format\n impressions = {};\n const oldImpressionsArray = impressionsData.split(';').filter(e => e);\n\n oldImpressionsArray.forEach((impression) => {\n try {\n const adUnitImpression = impression.split(' = ');\n const name = adUnitImpression[0];\n const data = adUnitImpression[1];\n const tmp = name.split('.');\n let target = tmp.pop();\n if (target && target === 'hp') {\n target = 'homepage';\n }\n const slotId = tmp.join('.');\n const id = `${slotId}_${target}`;\n const exposed = parseInt(data.split('/')[0], 10) || 0;\n const expires = parseInt(data.split('/')[1], 10) || this.now;\n impressions[id] = {};\n impressions[id][keys.adSlotId] = slotId;\n impressions[id][keys.target] = target;\n impressions[id][keys.exposed] = exposed;\n impressions[id][keys.expires] = expires;\n }\n catch (err1) {\n // console.log(`Failed converting impression: ${impression}`, err1);\n }\n });\n }\n return impressions || {};\n }\n\n /**\n * Define the debounced version of the local storage save\n */\n saveImpressionsToLocalStorage() {\n if (this.debouncedSave && typeof this.debouncedSave === 'function') {\n this.debouncedSave();\n }\n else {\n this.debouncedSave = debounce(this.saveImpressionsToLocalStorageImpl, 250, false);\n this.debouncedSave();\n }\n }\n\n /**\n * Implementation of saving the impression map to localstorage\n */\n saveImpressionsToLocalStorageImpl() {\n try {\n localStorage.setItem(keys.impressions, JSON.stringify(this.impressions));\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the operation should not break*/\n console.error('localStorage isn\\'t available:', err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Initializes the impression map based on the retrieved impressions and the global\n * configuration.\n */\n initImpressionMap() {\n Object.keys(this.config).map((key, index) => {\n const adSlotId = key;\n const slot = this.impressions[adSlotId];\n let shouldUpdateExpiryDate = false;\n // Case I: Existing slot (update)\n if (slot) {\n // Case I.I Existing slot, frequency has changed\n if (this.config[adSlotId][keys.frequency] !== slot[keys.frequency]) {\n // Updating the frequency will trigger a new expiry date\n shouldUpdateExpiryDate = true;\n this.impressions[adSlotId][keys.frequency] = this.config[adSlotId][keys.frequency];\n } // Case I.II Existing slot, old expiry date\n else if (this.now > slot[keys.expires]) {\n // Old value that should trigger a new expiry date\n shouldUpdateExpiryDate = true;\n }\n } // Case II: Non-existing slot (create new slot)\n else {\n this.initSlotFromConfig(adSlotId);\n } // Finally, updates the expiry date (cases I.I and I.II)\n if (shouldUpdateExpiryDate) {\n this.updateExpiryDate(adSlotId);\n }\n return this;\n });\n }\n\n /**\n * Updates the expiry date of a slotName based on the configured slot frequency\n * @param {String} slotName - the slotName to update.\n */\n updateExpiryDate(slotName) {\n const now = new Date();\n if (!(this.impressions[slotName] && this.impressions[slotName][keys.frequency])) {\n throw new Error(`Unable to update expiry date for slot: ${slotName}\n - this.impressions[slotName]:`, this.impressions[slotName]);\n }\n const frequencyMap = this.impressions[slotName][keys.frequency].match(keys.frequencyRegex);\n now.setMilliseconds(0);\n now.setSeconds(0);\n now.setMinutes(0);\n if (frequencyMap.indexOf(keys.days) > -1) {\n now.setHours(0);\n }\n this.impressions[slotName][keys.expires] = (frequencyMap.indexOf(keys.days) > -1 ?\n addDays(now, frequencyMap[2]) : addHours(now, frequencyMap[2])).getTime();\n\n // Set max impressions:\n this.impressions[slotName][keys.maxImpressions] = parseInt(frequencyMap[1], 10);\n // Reset exposed\n this.impressions[slotName][keys.exposed] = 0;\n }\n\n /**\n * Initializes a non-existing slot from the passed global configuration for the slot\n * @param {String} slotName - the name of the slot to create\n */\n initSlotFromConfig(slotName) {\n const slot = this.impressions[slotName] || {};\n slot[keys.frequency] = this.config[slotName][keys.frequency];\n slot[keys.target] = this.config[slotName][keys.target];\n slot[keys.exposed] = 0;\n this.impressions[slotName] = slot;\n this.updateExpiryDate(slotName);\n }\n\n /**\n * Registers an impression for a given adSlot.\n * @param {String} adSlotId - the adSlot id to register an impression for\n * @returns {boolean} returns true iff the impression has been registered\n */\n registerImpression(adSlotId) {\n if (adSlotId) {\n const slot = this.impressions[adSlotId];\n if (slot) {\n const exposed = slot[keys.exposed];\n if (isNaN(parseInt(exposed, 10)) === false) {\n this.impressions[adSlotId][keys.exposed] += 1;\n try {\n this.saveImpressionsToLocalStorage();\n }\n catch (err) {\n // console.log('Error saving ad impressions to localStorage!', err);\n }\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Checks whether an adSlot has reached it's allocated impressions count.\n * @param {String} adSlotId - the adSlot to check\n * @returns {boolean} true iff there is a quota for the adSlot, and it has been reached\n */\n reachedQuota(adSlotId) {\n // An adSlotId is suffixed with _homepage | _section if it's targeting is different\n // between the two. If there is no difference, an _all suffix can be used.\n const slotName = this.impressions[`${adSlotId}${globalConfig.department}`] ?\n `${adSlotId}${globalConfig.department}` : `${adSlotId}_all`;\n\n const slot = this.impressions[slotName];\n let atQuota = false;\n if (slot) {\n const now = (new Date()).getTime();\n // Second element of 2/4day matches '2'\n const expires = this.impressions[slotName][keys.expires];\n if (expires < now) {\n this.updateExpiryDate(slotName);\n }\n else {\n const maxImpressions = this.impressions[slotName][keys.maxImpressions];\n // Not expired, did reach max impressions?\n if (maxImpressions) {\n atQuota = this.impressions[slotName][keys.exposed] >= maxImpressions;\n }\n }\n }\n return atQuota;\n }\n\n\n /**\n * Clears the impression map from 'exposed' impressions\n */\n resetImpressions() {\n const impressions = this.impressions;\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (impressions[key][keys.exposed]) {\n impressions[key][keys.exposed] = 0;\n }\n }\n }\n this.saveImpressionsToLocalStorage();\n }\n}\n","import getCookieAsMap from '../utils/cookieUtils';\nimport ImpressionManager from './impressionsManager';\nimport globalConfig from '../globalConfig';\n\nexport const userTypes = {\n payer: 'payer',\n registered: 'registered',\n anonymous: 'anonymous',\n trial: 'trial',\n guest: 'reg_guest',\n};\n\nexport const productTypes = {\n htz: 243,\n tm: 273,\n hdc: 239,\n htz_tm: 274,\n};\n\nexport default class User {\n constructor(config) {\n this.config = Object.assign({}, config.userConfig);\n const cookieMap = getCookieAsMap();\n this.ssoKey = globalConfig.sso;\n if (!cookieMap[this.ssoKey]) {\n // Flips the ssoKey, since cookieMap.ssoKey cannot be used to retrieve data\n this.ssoKey = this.ssoKey === 'tmsso' ? 'engsso' : 'tmsso';\n }\n this.type = this.getUserType(cookieMap);\n this.htz_type = this.getUserTypeByProduct(cookieMap, productTypes.htz, 'tmsso');\n this.tm_type = this.getUserTypeByProduct(cookieMap, productTypes.tm, 'tmsso');\n this.hdc_type = this.getUserTypeByProduct(cookieMap, productTypes.hdc, 'engsso');\n this.impressionManager = new ImpressionManager(config.impressionManagerConfig);\n this.age = this.getUserAge(cookieMap);\n this.gender = this.getUserGender(cookieMap);\n this.sso = this.getUserSSO(cookieMap, this.ssoKey);\n this.country = this.getUserCountry();\n }\n\n getUserType(cookieMap) {\n let userType;\n if (cookieMap && cookieMap[this.ssoKey]) {\n userType = (cookieMap.HtzPusr || cookieMap.TmPusr || cookieMap.HdcPusr) ?\n userTypes.payer : userTypes.registered;\n }\n else {\n userType = userTypes.anonymous;\n }\n return userType;\n }\n\n\n getUserTypeByProduct(cookieMap, productType, ssoKey) {\n let userType = userTypes.anonymous;\n if (cookieMap && cookieMap[ssoKey]) {\n if (cookieMap.userProducts) {\n let userProducts = decodeURIComponent(cookieMap.userProducts);\n userProducts = JSON.parse(userProducts);\n if (productType === productTypes.hdc) {\n userType = this.getHdcUserType(userProducts);\n }\n else {\n userType = this.getHtzTmUserType(userProducts, productType);\n }\n if (userType === userTypes.registered &&\n cookieMap[ssoKey].firstName === 'guest' &&\n cookieMap[ssoKey].lastName === 'guest') {\n userType = userTypes.guest;\n }\n }\n }\n return userType;\n }\n\n getHdcUserType(userProducts) {\n // user has hdc paying product\n if (this.userHasProduct(userProducts, productTypes.hdc, false)) {\n return userTypes.payer;\n }\n // user has hdc trial product\n else if (this.userHasProduct(userProducts, productTypes.hdc, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n getHtzTmUserType(userProducts, productType) {\n // user has htz/tm paying product\n if (this.userHasProduct(userProducts, productType, false) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, false)) {\n return userTypes.payer;\n }\n // user has htz/tm trial product\n else if (this.userHasProduct(userProducts, productType, true) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n userHasProduct(userProducts, productType, trial) {\n return userProducts.products\n .filter(product => product.prodNum === productType && product.trial === trial)\n .length > 0;\n }\n\n getUserAge(cookieMap) {\n let age;\n const usrae = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].usrae;\n if (usrae) {\n age = parseInt(cookieMap[this.ssoKey].usrae, 10);\n age = age > 0 ? age : undefined;\n }\n return age;\n }\n\n getUserGender(cookieMap) {\n let gender;\n const urgdr = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].urgdr;\n if (urgdr) {\n gender = parseInt(cookieMap[this.ssoKey].urgdr, 10);\n gender = gender === 2 || gender === 1 ? gender : undefined;\n }\n return gender;\n }\n\n getUserSSO(cookieMap, ssoKey) {\n return cookieMap[ssoKey];\n }\n\n getUserCountry() {\n const country = window.localStorage.getItem('country');\n if (!country) {\n fetch('https://ms-apps.haaretz.co.il/ms-ip2country/get', {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/jsonp',\n },\n }).then(resp => resp.json())\n .then(data => {\n window.localStorage.setItem('country', data.code);\n },\n err => {}\n );\n return null;\n }\n return country;\n }\n\n}\n","class ConflictResolver {\n constructor(conflictManagementConfig) {\n this.dependencyMap = this.initializeDependencyMap(conflictManagementConfig);\n this.deferredSlots = new Set();\n }\n initializeDependencyMap(conflictManagementJson) {\n const queue = new Map();\n Object.keys(conflictManagementJson).map((key, value) => {\n let rules = conflictManagementJson[key];\n if (rules) {\n rules = rules.filter((item) => item.onsize && item.avoid);\n }\n queue.set(key, {\n id: key,\n rules,\n resolvedWith: null,\n });\n return this;\n });\n return queue;\n }\n\n updateResolvedSlot(adSlotId, resolvedSize) {\n if (!adSlotId) {\n throw new Error('updateResolvedSlot must be called with an adSlotId!');\n }\n if (!resolvedSize) {\n throw new Error('updateResolvedSlot must be called with a resolved size!');\n }\n if (this.dependencyMap.has(adSlotId)) {\n this.dependencyMap.get(adSlotId).resolvedWith = resolvedSize;\n }\n }\n\n\n isBlocked(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocked must be called with an adSlotId!');\n }\n let isBlocked = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n const adSlot = this.dependencyMap.get(adSlotKey);\n for (const adSlotRule of adSlot.rules) {\n // Found rule specific to our target\n if (adSlotRule.avoid === adSlotId) {\n const parentResolvedWith = adSlot.resolvedWith;\n if (parentResolvedWith && adSlotRule.onsize.split(',').find(sizeString => { // eslint-disable-line\n const size = sizeString.split('x').map(numberStr => parseInt(numberStr, 10));\n return this.arraysEqual(size, parentResolvedWith);\n })) {\n // Block found\n this.deferredSlots.add(adSlotId);\n isBlocked = true;\n }\n }\n }\n }\n return isBlocked;\n }\n\n isBlocking(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocking must be called with an adSlotId!');\n }\n let isBlocking = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n if (adSlotKey === adSlotId) {\n isBlocking = true;\n }\n }\n return isBlocking;\n }\n\n /**\n * Gets an array of adSlot Ids for a given adSlotId, that are dependent on (blocked by)\n * @param {String} adSlotId - the blocking slot id\n * @return {Array} an array of blocked slot, that has a dependency on the given slot\n */\n getBlockedSlotsIds(adSlotId) {\n let result;\n if (this.dependencyMap.has(adSlotId)) {\n result = Array.from(this.dependencyMap.get(adSlotId).rules.map(adSlot => adSlot.avoid));\n }\n return result || [];\n }\n\n arraysEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n}\nConflictResolver.EMPTY_SIZE = [];\nexport default ConflictResolver;\n","/**\n * Checks whether two arrays are equal\n * @param {Array} a - the first array to check\n * @param {Array} b - the second array to check\n * @returns {Boolean} true iff both a and b are arrays, with equal values\n */\nexport function arraysEqual(a, b) {\n if (!a || !b) return false;\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (Array.isArray(a[i]) && Array.isArray(b[i])) {\n if (!arraysEqual(a[i], b[i])) return false;\n }\n else if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\nexport default arraysEqual;\n","/* global googletag */\nimport { adTypes } from '../objects/adManager';\nimport globalConfig from '../globalConfig';\nimport { arraysEqual } from '../utils/arrays';\n\nconst hiddenClass = globalConfig.site.indexOf('mouse') > -1 ? 'u-is-hidden' : 'h-hidden';\n\nexport default class adSlot {\n\n constructor(adSlotConfig) {\n this.config = Object.assign({}, adSlotConfig);\n\n // Part I : Markup configuration - passed from AdManager\n this.id = this.config.id;\n if (!this.config.id) {\n throw new Error('an adSlot requires an id!');\n }\n this.target = this.config.target;\n this.type = this.config.type;\n this.responsive = this.config.responsive;\n this.fluid = this.config.fluid;\n this.user = this.config.user;\n this.adManager = this.config.adManager;\n this.htmlElement = this.config.htmlElement;\n this.priority = this.config.priority;\n this.deferredSlot = this.config.deferredSlot;\n\n // Part II : Global, general ad configuration - passed from AdManager\n this.department = this.config.department;\n this.network = this.config.network;\n this.adUnitBase = this.config.adUnitBase;\n\n // Part III : ad specific configuration - passed from globalConfig.adSlotConfig\n this.adSizeMapping = this.config.adSizeMapping;\n this.responsiveAdSizeMapping = this.config.responsiveAdSizeMapping;\n this.blacklistReferrers = this.config.blacklistReferrers ?\n this.config.blacklistReferrers.split(',') : [];\n this.whitelistReferrers = this.config.whitelistReferrers ?\n this.config.whitelistReferrers.split(',') : [];\n\n\n // Part IV : Runtime configuration - calculated data - only present in runtime\n this.lastResolvedSize = undefined; // Initialized in 'slotRenderEnded' callback\n this.lastResolvedWithBreakpoint = undefined; // Initialized in 'slotRenderEnded' callback\n this.slot = undefined; // Holds a googletag.Slot object\n // [https://developers.google.com/doubleclick-gpt/reference#googletag.Slot]\n try {\n if (!this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Checks whether this adSlot is an 'Out-of-page' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isOutOfPage() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n case adTypes.popunder: return true;\n case adTypes.talkback: return false;\n case adTypes.regular: return false;\n default: return false;\n }\n }\n\n /**\n * Checks whether this adSlot is a 'maavaron' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isMaavaron() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n default: return false;\n }\n }\n\n isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n }\n /**\n * Checks whether or not this adSlot has a non-empty whitelist, and if so, that the current\n * referrer appears in the whitelist.\n * Should return false iff there is a whitelist for the current adSlot, but the referrer is not\n * mentioned in the whitelist.\n * @returns {boolean} true iff the ad can be displayed.\n */\n isWhitelisted() {\n let whitelisted = false;\n if (this.whitelistReferrers.length !== 0) {\n for (const referrer of this.whitelistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n whitelisted = true;\n break;\n }\n }\n }\n else {\n whitelisted = true;\n }\n return whitelisted;\n }\n\n /**\n * Checks whether or not this adSlot has a non-empty blacklist, and if so, that the current\n * referrer does not appear in the blacklist.\n * Should return true iff there is a blacklist for the current adSlot, and the referrer is\n * mentioned in the blacklist - to indicate that the adSlot is 'blocked'.\n * @returns {boolean} true iff the ad cannot be displayed.\n */\n isBlacklisted() {\n let blacklisted = false;\n if (this.blacklistReferrers.length !== 0) {\n for (const referrer of this.blacklistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n blacklisted = true;\n break;\n }\n }\n }\n return blacklisted;\n }\n\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n show() {\n if (!this.shown === true) {\n this.shown = true; // Ensure show will be called once per adSlot\n googletag.cmd.push(() => {\n if (this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n // console.log('calling show for slot',this.id,' called @',window.performance.now());\n document.getElementById(this.id).classList.remove(hiddenClass);\n googletag.display(this.id);\n });\n }\n }\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n hide() {\n googletag.cmd.push(() => {\n document.getElementById(this.id).classList.add(hiddenClass);\n });\n }\n\n /**\n * Initializes page-level slot definition for the current slot\n * @return {Slot} slot - the Google Slot that was defined from this AdSlot configuration\n */\n defineSlot() {\n if (this.isMaavaron()) {\n const maavaronSlot = this.defineMaavaron();\n if (this.adManager.shouldSendRequestToDfp(this)) {\n if (!this.shown) {\n this.shown = true; // Ensure show will be called once\n maavaronSlot.display();\n }\n }\n return maavaronSlot;\n }\n const googletag = window.googletag;\n const pubads = googletag.pubads();\n const args = [];\n const defineFn = this.isOutOfPage() ? googletag.defineOutOfPageSlot : googletag.defineSlot;\n // 3 or 2 params according to the function that we want to activate.\n args.push(this.getPath());\n if (this.isOutOfPage() === false) {\n if (this.fluid) {\n args.push('fluid');\n }\n else {\n args.push(this.adSizeMapping);\n }\n }\n args.push(this.id);\n let slot = defineFn.apply(defineFn, args);\n if (slot) {\n // Responsive size Mapping\n if (this.responsive) {\n let responsiveSlotSizeMapping = googletag.sizeMapping();\n const breakpoints = globalConfig.breakpointsConfig.breakpoints;\n const keys = Object.keys(this.responsiveAdSizeMapping);\n for (const key of keys) { // ['xxs','xs',...]\n responsiveSlotSizeMapping.addSize(\n [breakpoints[key], 100], // 100 is a default height, since it is height agnostic\n !arraysEqual(this.responsiveAdSizeMapping[key], [[0, 0]]) ?\n this.responsiveAdSizeMapping[key] : []);\n }\n responsiveSlotSizeMapping = responsiveSlotSizeMapping.build();\n slot = slot.defineSizeMapping(responsiveSlotSizeMapping);\n }\n slot = slot.addService(pubads);\n if (this.isOutOfPage() === false) {\n slot.setCollapseEmptyDiv(true);\n }\n }\n return slot;\n }\n\n /**\n * Returns the current path calculated for the adSlot\n * @returns {String} a formatted string that represent the path for the slot definition\n */\n getPath() {\n /* eslint-disable no-shadow */\n let path = globalConfig.path || [];\n path = path.filter(path => path !== '.');\n path = path.map(section => `${this.id}${this.department}${section}`).join('/');\n // If a path exist, it will be preceded with a forward slash\n path = path && this.config.department !== '_homepage' ? `/${path}` : '';\n /* eslint-enable no-shadow */\n const calculatedPath = `/${this.config.network}/${this.config.adUnitBase}/${this.id}/${this.id}${this.department}${path}`; // eslint-disable-line max-len\n return calculatedPath.toLowerCase();\n }\n\n /* eslint-disable */\n slotRendered(event) {\n const id = event.slot.getAdUnitPath().split('/')[3]; // Convention: [0]/[1]network/[2]base/[3]id\n const isEmpty = event.isEmpty; // Did the ad return as empty?\n const resolvedSize = event.size; // What 'creative' size did the ad return with?\n // Empty or onload callback should be called next?\n }\n /* eslint-enable */\n\n /**\n * Refresh this adSlot\n */\n refresh() {\n googletag.cmd.push(() => {\n googletag.pubads().refresh([this.slot]);\n });\n }\n\n /**\n * Shows 'Maavaron' type adSlot using Passback definition\n * @return {Slot} slot - the Google Slot that was defined for Maavaron\n */\n defineMaavaron() {\n if (!document.referrer.match('loc.haaretz')) {\n const adUnitMaavaronPath = this.getPath();\n const adUnitMaavaronSize = [\n [2, 1],\n ];\n const slot = googletag.pubads().definePassback(adUnitMaavaronPath, adUnitMaavaronSize)\n .setTargeting('UserType', [this.user.type])\n .setTargeting('age', [this.user.age])\n .setTargeting('urgdr', [this.user.gender])\n .setTargeting('articleId', [globalConfig.articleId])\n .setTargeting('stg', [globalConfig.environment]);\n return slot;\n }\n return null;\n }\n}\n","/* global googletag */\nimport User from '../objects/user';\nimport ConflictResolver from '../objects/conflictResolver';\nimport AdSlot from '../objects/adSlot';\nimport { getBreakpoint, getBreakpointName } from '../utils/breakpoints';\nimport { arraysEqual } from '../utils/arrays';\nimport getCookieAsMap from '../utils/cookieUtils';\n\n// There are a total of 7 adTargets:\n// \"all\",\"nonPaying\",\"anonymous\",\"registered\",\"paying\",\"digitalOnly\" and \"digitalAndPrint\"\nexport const adPriorities = {\n high: 'high',\n normal: 'normal',\n low: 'low',\n};\n\nexport const adTargets = {\n all: 'all',\n nonPaying: 'nonPaying',\n anonymous: 'anonymous',\n registered: 'registered',\n paying: 'paying',\n digitalOnly: 'digitalOnly',\n digitalAndPrint: 'digitalAndPrint',\n};\n\n// There are a total of 3 userTypes: \"anonymous\", \"registered\" and \"payer\"\nexport const userTypes = {\n anonymous: 'anonymous',\n registered: 'registered',\n payer: 'payer',\n};\n\nexport const adTypes = {\n maavaron: '.maavaron',\n popunder: '.popunder',\n talkback: '.talkback',\n regular: '',\n};\n\n\nexport default class AdManager {\n\n constructor(config) {\n this.config = Object.assign({}, config);\n this.user = new User(config);\n this.conflictResolver = new ConflictResolver(config.conflictManagementConfig);\n /**\n * Avoid race conditions by making sure to respect the usual timing of GPT.\n * This DFP implementation uses Enable-Define-Display:\n * Define page-level settings\n * enableServices()\n * Define slots\n * Display slots\n */\n try {\n googletag.cmd.push(() => {\n this.initGoogleTargetingParams(); // Define page-level settings\n this.initGoogleGlobalSettings(); // enableServices()\n this.initSlotRenderedCallback(); // Define callbacks\n });\n // Mouse special treatment to base path on mobile breakpoints\n const currentBreakpointName = getBreakpointName(getBreakpoint());\n if (this.config.adManagerConfig.adUnitBase.indexOf('mouse.co.il') > -1 &&\n currentBreakpointName.indexOf('xs') > -1) {\n this.config.adManagerConfig.adUnitBase = 'mouse.co.il.mobile_web';\n }\n // Holds adSlot objects as soon as possible.\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n });\n // Once DOM ready, add more adSlots.\n const onDomLoaded = () => { // eslint-disable-line no-inner-declarations\n try {\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.normal);\n });\n });\n }\n catch (err) {\n console.log(err); // eslint-disable-line no-console\n }\n };\n // Once window was loaded, add the rest of the adSlots.\n const onWindowLoaded = () => { // eslint-disable-line no-inner-declarations\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.low);\n // Clean blocking adSlots that are not defined on this page\n for (const blockingAdSlotKey of this.conflictResolver.dependencyMap.keys()) {\n if (!this.adSlots.has(blockingAdSlotKey)) {\n this.conflictResolver.dependencyMap.delete(blockingAdSlotKey);\n }\n }\n this.showAllDeferredSlots();\n });\n };\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', onDomLoaded);\n window.addEventListener('load', onWindowLoaded);\n break;\n case 'interactive':\n onDomLoaded();\n window.addEventListener('load', onWindowLoaded);\n break;\n default: // 'complete' - no need for event listeners.\n onDomLoaded();\n onWindowLoaded();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Shows all of the adSlots that can be displayed.\n */\n showAllSlots() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.type !== adTypes.talkback && this.shouldSendRequestToDfp(adSlot)) {\n adSlot.show();\n }\n }\n }\n\n /**\n * Gets all adSlots that has a certain priority\n * @param {adPriority} priority - the priority of the ad {high, normal, low}\n * @return {Array} adSlots - all of the defined adSlots that matches\n * the given priority\n */\n getAdSlotsByPriority(priority) {\n function priorityFilter(adSlot) {\n return adSlot.priority === priority;\n }\n return Array.from(this.adSlots.values()).filter(priorityFilter);\n }\n\n showAllDeferredSlots() {\n for (const deferredSlotId of this.conflictResolver.deferredSlots) {\n if (this.adSlots.has(deferredSlotId)) {\n if (!this.conflictResolver.isBlocked(deferredSlotId)) {\n const deferredAdSlot = this.adSlots.get(deferredSlotId);\n if (this.shouldSendRequestToDfp(deferredAdSlot)) {\n deferredAdSlot.show();\n }\n }\n }\n }\n }\n\n /**\n * Refreshes all responsive adSlots\n */\n refreshAllSlots() {\n const currentBreakpoint = getBreakpoint();\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive && adSlot.type !== adTypes.maavaron) {\n if (adSlot.lastResolvedWithBreakpoint !== currentBreakpoint &&\n this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n }\n\n /**\n * Refreshes all adSlots\n */\n refreshAllSlotsInPage() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n\n /**\n * Refreshes adSlot\n */\n\n refreshSlot(adUnitName) {\n const adSlot = this.adSlots.get(adUnitName);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n\n\n /**\n * Initializes adSlots based on the currently found slot markup (HTML page specific),\n * and the predefined configuration for the slots.\n * @param {Object} adSlotConfig - the AdSlots configuration object (see: globalConfig)\n * @param {String} filteredPriority - filters out all adSlots that does not match\n * a given adPriority. This is used to cherry pick the init process of ads.\n * @returns {Map}\n */\n initAdSlots(adSlotConfig, filteredPriority) {\n const adSlots = new Map(this.adSlots);\n let adSlotPlaceholders = Array.from(document.getElementsByClassName('js-dfp-ad'));\n adSlotPlaceholders = adSlotPlaceholders.filter(node => node.id); // only nodes with an id\n const adSlotNodeSet = new Set();\n adSlotPlaceholders = Array.prototype.filter.call(adSlotPlaceholders, node => {\n if (adSlotNodeSet.has(node.id) === false) { // first occurrence of Node\n adSlotNodeSet.add(node.id);\n return true;\n }\n return false;\n });\n // adSlotPlaceholders = adSlotPlaceholders.sort((a, b) => a.offsetTop - b.offsetTop);\n adSlotPlaceholders.forEach(adSlot => {\n const adSlotPriority = adSlotConfig[adSlot.id] ?\n adSlotConfig[adSlot.id].priority || adPriorities.normal : undefined;\n if (adSlotConfig[adSlot.id] && adSlots.has(adSlot.id) === false &&\n adSlotPriority === filteredPriority) {\n // The markup has a matching configuration from adSlotConfig AND was not already defined\n try {\n // adSlotConfig is built from globalConfig, but can be overridden by markup\n const computedAdSlotConfig = Object.assign({}, adSlotConfig[adSlot.id], {\n id: adSlot.id,\n target: adSlot.attributes['data-audtarget'] ?\n adSlot.attributes['data-audtarget'].value : adTargets.all,\n type: this.getAdType(adSlot.id),\n responsive: adSlotConfig[adSlot.id].responsive,\n fluid: adSlotConfig[adSlot.id].fluid || false,\n user: this.user,\n adManager: this,\n htmlElement: adSlot,\n department: this.config.department,\n network: this.config.adManagerConfig.network,\n adUnitBase: this.config.adManagerConfig.adUnitBase,\n deferredSlot: this.conflictResolver.isBlocked(adSlot.id),\n priority: adSlotPriority,\n });\n const adSlotInstance = new AdSlot(computedAdSlotConfig);\n adSlots.set(adSlot.id, adSlotInstance);\n if (adSlotInstance.type !== adTypes.talkback &&\n adSlotInstance.priority === adPriorities.high &&\n this.shouldSendRequestToDfp(adSlotInstance)) {\n /*\n console.log('calling show for high priority slot', adSlotInstance.id, ' called @',\n window.performance.now());\n */\n adSlotInstance.show();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n });\n return adSlots;\n }\n\n isPriority(adSlotId) {\n return (typeof adSlotId === 'string' &&\n (adSlotId.indexOf('plazma') > 0 ||\n adSlotId.indexOf('maavaron') > 0 ||\n adSlotId.indexOf('popunder') > 0));\n }\n\n /**\n * Returns the adType based on the adSlot name.\n * @param {String} adSlotId - the adSlot's identifier.\n * @returns {*} enumerated export 'adTypes'\n */\n getAdType(adSlotId) {\n if (!adSlotId) {\n throw new Error('Missing argument: a call to getAdType must have an adSlotId');\n }\n if (adSlotId.indexOf(adTypes.maavaron) > -1) return adTypes.maavaron;\n if (adSlotId.indexOf(adTypes.popunder) > -1) return adTypes.popunder;\n if (adSlotId.indexOf(adTypes.talkback) > -1) return adTypes.talkback;\n return adTypes.regular;\n }\n\n /**\n * @param {object} adSlot the AdSlot\n * @returns {boolean|*}\n */\n shouldSendRequestToDfp(adSlot) {\n // Conflict management check\n return this.conflictResolver.isBlocked(adSlot.id) === false &&\n // Valid Referrer check\n adSlot.isWhitelisted() &&\n // Not in referrer Blacklist\n adSlot.isBlacklisted() === false &&\n this.shouldDisplayAdAfterAdBlockRemoval(adSlot) &&\n // if a paywall pop-up is shown And the number is 12 or more - SHOW MAAVRON\n this.shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) &&\n // Responsive: breakpoint contains ad?\n this.doesBreakpointContainAd(adSlot) &&\n // check in case of Smartphoneapp\n this.haveValidCookieForSmartphoneapp() &&\n // Targeting check (userType vs. slotTargeting)\n this.doesUserTypeMatchBannerTargeting(adSlot) &&\n // Impressions Manager check (limits number of impressions per slot)\n this.user.impressionManager.reachedQuota(adSlot.id) === false &&\n // if the app promotion interstitial DOES NOT pop - SHOW MAAVARON\n this.shouldAppPromotionElementPop() === false;\n }\n\n printShouldSendRequestToDfp(id) {\n let res = '';\n if (!this.adSlots.has(id)) {\n res = `id not exist: ${id}`;\n }\n else {\n const a = this.adSlots.get(id);\n res += this.conflictResolver.isBlocked(a.id) === !1 ? '' : 'isBlocked,';\n res += a.isWhitelisted() ? '' : 'isWhitelisted,';\n res += a.isBlacklisted() === !1 ? '' : 'isBlacklisted,';\n res += this.shouldDisplayAdAfterAdBlockRemoval(a) ? '' : 'AdBlockRemoval,';\n res += this.shouldDisplayAdMaavaronAfterPayWallBanner(a) ? '' : 'PayWallBanner,';\n res += this.doesBreakpointContainAd(a) ? '' : 'Breakpoint,';\n res += this.haveValidCookieForSmartphoneapp() ? '' : 'Smartphoneapp,';\n res += this.doesUserTypeMatchBannerTargeting(a) ? '' : 'Targeting,';\n res += this.user.impressionManager.reachedQuota(a.id) === !1 ? '' : 'reachedQuota,';\n res = `
${id}
${res}
`;\n }\n document.write(res);\n return res;\n }\n\n testShouldSendRequestToDfp(id) {\n // leave the old name for ios legacy\n let cookieMap = getCookieAsMap();\n cookieMap = JSON.stringify(cookieMap);\n cookieMap = cookieMap.replace(/,/g, '
');\n const res = `
${cookieMap}
`;\n document.write(res);\n return res;\n }\n\n shouldDisplayAdAfterAdBlockRemoval(adSlot) {\n return !(this.config.adBlockRemoved === true &&\n (adSlot.type === adTypes.maavaron ||\n adSlot.type === adTypes.popunder));\n }\n\n shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) {\n let shouldDisplay = true;\n if (this.config.site === 'haaretz' && adSlot.type === adTypes.maavaron) {\n try {\n const paywallBanner = JSON.parse(window.localStorage.getItem('_cobj'));\n shouldDisplay = !paywallBanner || ((paywallBanner.mc && paywallBanner.mc >= 12) ||\n (paywallBanner.nextslotLocation &&\n !paywallBanner.nextslotLocation.includes('pop')));\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error('ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner');\n /* eslint-enable no-console*/\n }\n }\n return shouldDisplay;\n }\n\n /**\n * Check if the app promotion interstitial should pop\n * when it does, the maavaron should not show up\n * @returns {boolean} true if the interstitial element should pop\n */\n shouldAppPromotionElementPop() {\n return typeof window.appPromotionElement !== 'undefined' &&\n typeof window.appPromotionElement.getShouldPop === 'function' ?\n window.appPromotionElement.getShouldPop() : false;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n\n haveValidCookieForSmartphoneapp() {\n return this.config.isValidForsmartPhone;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n doesUserTypeMatchBannerTargeting(adSlotOrTarget) {\n // if the user is smadar show her all the banners\n const cookieMap = getCookieAsMap();\n if (cookieMap.login === 'pilosmadar@gmail.com') {\n return true;\n }\n if (cookieMap.tmsso !== undefined && cookieMap.tmsso.userName === 'pilosmadar@gmail.com') {\n return true;\n }\n const userType = this.user.type;\n const adTarget = typeof adSlotOrTarget === 'string' ? adSlotOrTarget : adSlotOrTarget.target;\n\n switch (adTarget) {\n case adTargets.all : return true;\n case adTargets.nonPaying :\n return userType === userTypes.anonymous || userType === userTypes.registered;\n case adTargets.anonymous : return userType === userTypes.anonymous;\n case adTargets.registered : return userType === userTypes.registered;\n case adTargets.paying : return userType === userTypes.payer;\n case adTargets.digitalOnly : return userType === userTypes.payer;\n case adTargets.digitalAndPrint : return userType === userTypes.payer;\n default: return false;\n }\n }\n\n /**\n * Report to the AdManager that a breakpoint has been switched (passed from one break to\n * another). Should there be a responsive slot with a\n * @param {Breakpoint} breakpoint - the breakpoint that is currently being displayed\n * @returns {Integer} affected - the number of adSlots affected by the change\n */\n switchedToBreakpoint(breakpoint) {\n if (!breakpoint) {\n throw new Error('Missing argument: a call to switchedToBreakpoint must have an breakpoint');\n }\n let count = 0;\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive === true && adSlot.lastResolvedWithBreakpoint) {\n if (adSlot.lastResolvedWithBreakpoint !== breakpoint) {\n adSlot.refresh();\n count++;\n }\n }\n }\n return count;\n }\n\n /**\n * Checks whether an adSlot is defined for a given breakpoint (Default: current breakpoint)\n * @param {AdSlot} adSlot - the adSlot to check.\n * @param {Breakpoint} [breakpoint=currentBreakpoint] - the breakpoint to check this ad in.\n * @returns {boolean} true iff the adSlot is defined for the given breakpoint.\n */\n doesBreakpointContainAd(adSlot, breakpoint = getBreakpoint()) {\n if (!adSlot) {\n throw new Error('Missing argument: a call to doesBreakpointContainAd must have an adSlot');\n }\n let containsBreakpoint = true;\n if (adSlot.responsive === true) {\n const mapping = adSlot.responsiveAdSizeMapping[getBreakpointName(breakpoint)];\n if (Array.isArray(mapping) === false) {\n throw new Error(`Invalid argument: breakpoint:${breakpoint} doesn't exist!`, this);\n }\n containsBreakpoint = mapping.length > 0 && !arraysEqual(mapping, [[0, 0]]);\n }\n return containsBreakpoint;\n }\n\n /**\n * Initializes the callback from the 'slotRenderEnded' event for each slot\n */\n initSlotRenderedCallback() {\n if (window.googletag && window.googletag.apiReady) {\n const pubads = window.googletag.pubads();\n pubads.addEventListener('slotRenderEnded', event => {\n const id = event.slot.getAdUnitPath().split('/')[3];\n const isEmpty = event.isEmpty;\n const resolvedSize = event.size;\n // console.log('slotRenderEnded for slot',id,' called @',window.performance.now());\n if (this.adSlots.has(id)) {\n const adSlot = this.adSlots.get(id);\n adSlot.lastResolvedSize = resolvedSize;\n adSlot.lastResolvedWithBreakpoint = getBreakpoint();\n if (isEmpty) {\n adSlot.lastResolvedSize = ConflictResolver.EMPTY_SIZE;\n adSlot.hide();\n this.releaseSlotDependencies(adSlot);\n }\n else {\n this.releaseSlotDependencies(adSlot, adSlot.lastResolvedSize);\n }\n this.user.impressionManager.registerImpression(`${adSlot.id}${this.config.department}`);\n this.user.impressionManager.registerImpression(`${adSlot.id}_all`);\n }\n else {\n /*\n console.error(`Cannot find an adSlot with id: ${id} - Ad Unit path is\n ${event.slot.getAdUnitPath()}`);\n */\n }\n });\n }\n else {\n throw new Error('googletag api was not ready when \\'initSlotRenderedCallback\\' was called!');\n }\n }\n\n releaseSlotDependencies(adSlot) {\n try {\n const id = adSlot.id;\n this.conflictResolver.updateResolvedSlot(id, adSlot.lastResolvedSize);\n if (this.conflictResolver.isBlocking(id)) {\n // Hide all blocked adSlots\n for (const blockedSlot of this.conflictResolver.getBlockedSlotsIds(id)) {\n if (this.conflictResolver.isBlocked(blockedSlot)) {\n if (this.adSlots.has(blockedSlot)) {\n this.adSlots.get(blockedSlot).hide();\n }\n }\n }\n // Show the non blocked\n for (const deferredSlotKey of this.conflictResolver.deferredSlots.keys()) {\n const deferredAdSlot = this.adSlots.get(deferredSlotKey);\n if (deferredAdSlot && this.shouldSendRequestToDfp(deferredAdSlot)) {\n this.conflictResolver.deferredSlots.delete(deferredSlotKey);\n if (deferredAdSlot.deferredSlot) {\n deferredAdSlot.defineSlot();\n deferredAdSlot.deferredSlot = false;\n }\n deferredAdSlot.show();\n }\n }\n }\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error(`Cannot updateSlotDependencies for adSlot: ${adSlot.id}`);\n /* eslint-enable no-console*/\n }\n }\n\n setSsoGroupKey() {\n fetch(`/ssoGroupKey?value=${this.user.sso.userId}`, {\n method: 'GET',\n cache: 'no-cache',\n }).then(value => {\n if (value) {\n value.json().then(data => {\n if (data && data.result && data.result !== 'item not found'\n && data.result !== 'value is empty') {\n localStorage.setItem('_SsoGroupKey', data.result);\n }\n });\n }\n });\n }\n\n /**\n * Initializes page-level targeting params.\n */\n initGoogleTargetingParams() {\n if (window.googletag && window.googletag.apiReady) {\n // Returns a reference to the pubads service.\n let SsoGroupKey = null;\n try {\n SsoGroupKey = localStorage.getItem('_SsoGroupKey');\n if (!SsoGroupKey && this.user.sso.userId) {\n this.setSsoGroupKey();\n }\n }\n catch (e) {\n SsoGroupKey = null;\n }\n const pubads = googletag.pubads();\n // Environment targeting (dev, test, prod)\n if (this.config.environment) {\n pubads.setTargeting('stg', [this.config.environment]);\n }\n // App targeting\n // User targeting\n if (this.user.htz_type) {\n pubads.setTargeting('htz_user_type', [this.user.htz_type]);\n }\n if (this.user.tm_type) {\n pubads.setTargeting('tm_user_type', [this.user.tm_type]);\n }\n if (this.user.hdc_type) {\n pubads.setTargeting('hdc_user_type', [this.user.hdc_type]);\n }\n // Context targeting\n if (this.config.section) {\n pubads.setTargeting('section', [this.config.section]);\n }\n if (this.config.sub_section) {\n pubads.setTargeting('sub_section', [this.config.sub_section]);\n }\n if (this.config.articleId) {\n pubads.setTargeting('articleId', [this.config.articleId]);\n pubads.setTargeting('react', ['false']);\n }\n if (this.config.gStatCampaignNumber && this.config.gStatCampaignNumber !== -1) {\n pubads.setTargeting('gstat_campaign_id', [this.config.gStatCampaignNumber]);\n }\n if (this.config.proposalNumber) {\n pubads.setTargeting('proposaltype', [this.config.proposalNumber]);\n }\n if (this.config.pageType) {\n pubads.setTargeting('pageType', [this.config.pageType]);\n }\n if (this.config.isWriterAlerts) {\n pubads.setTargeting('WriterAlerts', ['true']);\n }\n // AdBlock removal\n if (this.config.adBlockRemoved) {\n pubads.setTargeting('adblock_removed', [this.config.adBlockRemoved]);\n }\n // University targeting - triggered via cookie\n if (this.config.wifiLocation) {\n pubads.setTargeting('wifi', [this.config.wifiLocation]);\n }\n if (this.config.tags && Array.isArray(this.config.tags)) {\n pubads.setTargeting('tags', [...this.config.tags]);\n }\n\n if (this.user.sso && this.user.sso.userId && SsoGroupKey) {\n pubads.setTargeting(SsoGroupKey, this.user.sso.userId);\n }\n if (this.config.anonymousId) {\n const anonymousIdKeyName = 'anonymousIdKey';\n pubads.setTargeting(anonymousIdKeyName, this.config.anonymousId);\n }\n if (this.user.country) {\n pubads.setTargeting('country', this.user.country);\n }\n\n const cityNames = this.getCityNames();\n if (cityNames) {\n pubads.setTargeting('cityName', [...cityNames]);\n }\n\n // Ads Centering\n pubads.setCentering(true);\n }\n else {\n throw new Error('googletag api was not ready when \\'initGoogleTargetingParams\\' was called!');\n }\n }\n\n /**\n * Initializes googletag services.\n */\n initGoogleGlobalSettings() {\n if (window.googletag && window.googletag.apiReady) {\n const googleGlobalSettings = this.config.googleGlobalSettings;\n // Enable GET parameter overrides\n if (window.location.search) {\n const search = window.location.search;\n if (search.indexOf('sraon') > 0) {\n console.log('Single Request Mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = true;\n }\n else if (search.indexOf('sraoff') > 0) {\n console.log('Single Request Mode: disabled');// eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = false;\n }\n if (search.indexOf('asyncrenderingon') > 0) {\n console.log('Async rendering mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = true;\n }\n else if (search.indexOf('asyncrenderingonoff') > 0) {\n console.log('Sync rendering mode: active');// eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = false;\n }\n }\n // Google services activation\n if (googleGlobalSettings.enableSingleRequest === true) {\n googletag.pubads().enableSingleRequest();\n }\n // if (googleGlobalSettings.enableAsyncRendering === true) {\n // googletag.pubads().enableAsyncRendering();\n // }\n // else {\n // googletag.pubads().enableSyncRendering();\n // }\n // Enables all GPT services that have been defined for ad slots on the page.\n googletag.enableServices();\n }\n else {\n throw new Error('googletag api wasn\\'t ready when \\'initGoogleGlobalSettings\\' was called!');\n }\n }\n\n\n getCityNames() {\n const cityNames = [];\n document.querySelectorAll('[data-location-city-name]').forEach((element) => {\n if (!cityNames.includes(element.dataset.locationCityName)) {\n cityNames.push(element.dataset.locationCityName);\n }\n });\n return cityNames.length > 0 ? cityNames : null;\n }\n\n}\n","/* globals googletag */\nimport AdManager from '../src/objects/adManager';\nimport globalConfig from './globalConfig';\nimport { getBreakpoint, debounce } from '../src/utils/breakpoints';\n\nconst defaultConfig = globalConfig || {};\nconst resizeTimeout = 250;\n\nexport default class DFP {\n\n constructor(config) {\n this.config = Object.assign({}, defaultConfig, config);\n this.wasInitialized = false;\n this.initStarted = false;\n this.breakpoint = getBreakpoint();\n this.initWindowResizeListener();\n }\n\n /**\n * This part of the object's construction is dependent on the call to 'init'\n */\n resumeInit() {\n try {\n this.adManager = this.adManager || new AdManager(this.config);\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * initializes the 'googletag' global namespace and add the\n * google publish tags library to the page\n * @returns {Promise} that resolves to true once the googletag api is ready to use\n * (googletag.apiReady = true)\n */\n initGoogleTag() {\n const dfpThis = this;\n return new Promise((resolve, reject) => {\n if (dfpThis.initStarted === true) {\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(dfpThis);\n });\n }\n else {\n dfpThis.initStarted = true;\n // set up a place holder for the gpt code downloaded from google\n window.googletag = window.googletag || {};\n\n // this is a command queue used by GPT any methods added to it will be\n // executed when GPT code is available, if GPT is already available they\n // will be executed immediately\n window.googletag.cmd = window.googletag.cmd || [];\n // load google tag services JavaScript\n (() => {\n const tag = window.document.createElement('script');\n tag.async = true;\n tag.type = 'text/javascript';\n // Supports both https and http\n tag.setAttribute('src', '//www.googletagservices.com/tag/js/gpt.js');\n const node = window.document.getElementsByTagName('script')[0];\n tag.addEventListener('load', () => {\n dfpThis.resumeInit();\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(this);\n });\n });\n tag.addEventListener('error', (error) => {\n dfpThis.wasInitialized = false;\n reject(error);\n });\n node.parentNode.insertBefore(tag, node);\n })();\n }\n });\n }\n\n /**\n * Returns true iff googletag was properly initialized on the page\n * @returns {boolean}\n */\n isGoogleTagReady() {\n if (this.wasInitialized === true || (window.googletag && window.googletag.apiReady)) {\n this.wasInitialized = true;\n }\n return this.wasInitialized;\n }\n\n /**\n * Initializes the window resize listener to support responsive ad refreshes\n */\n initWindowResizeListener() {\n const dfpThis = this;\n function onResize() {\n const currentBreakpoint = getBreakpoint();\n if (dfpThis.breakpoint !== currentBreakpoint) {\n dfpThis.breakpoint = currentBreakpoint;\n if (dfpThis.adManager) {\n dfpThis.adManager.refreshAllSlots();\n }\n else {\n throw new Error('initWindowResizeListener error - adManager instance is not available');\n }\n }\n }\n const debouncedFunction = debounce(onResize, resizeTimeout);\n window.onresize = debouncedFunction;\n }\n}\n","// generated by genversion\nexport const version = '2.6.6';\n","import DFP from './dfp';\nimport globalConfig from './globalConfig';\nimport { version as v } from './version';\n\n// DFP version is based on the package.json\nDFP.version = v || 'VERSION';\n\n/*\n // Only for development mode\n if ( process.env.NODE_ENV !== 'production' ) {\n DFP.dev = '123';\n }\n */\n\nexport const config = globalConfig;\nexport const version = DFP.version;\nexport default DFP;\n"]} \ No newline at end of file diff --git a/dist/dfp.min.js b/dist/dfp.min.js index 1fa0281..ffb9d20 100644 --- a/dist/dfp.min.js +++ b/dist/dfp.min.js @@ -1,2 +1,2 @@ -!function(a){"use strict";function b(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.separator,d=void 0===c?";":c,e=b.operator,f=void 0===e?"=":e,g={};return a.split(d).forEach(function(a){if("string"==typeof a){var b=a.split(f);if(2===b.length)try{g[b[0]]=decodeURIComponent(b[1])}catch(a){}}}),g}function c(){var a=b(document.cookie,{separator:/;\s?/});return"string"==typeof a.tmsso&&(a.tmsso=b(a.tmsso,{separator:":"})),"string"==typeof a.engsso&&(a.engsso=b(a.engsso,{separator:":"})),a}function d(a,b){if(!a)throw new SyntaxError("addHours called without a required 'date' parameter!");if(!b)throw new SyntaxError("addHours called without a required 'hours' parameter!");if(isNaN(parseInt(b,10)))throw new TypeError("addHours called with an invalid integer 'hours' parameter!");var c=new Date(a);return c.setHours(c.getHours()+parseInt(b,10)),c}function e(a,b){if(!a)throw new SyntaxError("addDays called without a required 'date' parameter!");if(!b)throw new SyntaxError("addDays called without a required 'days' parameter!");if(isNaN(parseInt(b,10)))throw new TypeError("addDays called with an invalid integer 'days' parameter!");var c=new Date(a);return c.setDate(c.getDate()+parseInt(b,10)),c}function f(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,c=arguments[2],d=void 0;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}}function g(){var a=void 0,b=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;switch(!0){case b-1?"engsso":"tmsso",n=void 0;try{n=window.JSON.parse(document.getElementById("dfpConfig").textContent)}catch(a){n=window.dfpConfig}var o=Object.assign({get referrer(){return document.referrer?document.referrer:""},get isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent||"")},get isHomepage(){return"/"===window.location.pathname||3===this.environment},get department(){return this.isHomepage?"_homepage":"_section"},get domain(){var a=/([\d|\w]+)(\.co\.il|\.com)(.*)?/.exec(window.location.hostname);return a?a[0]:window.location.hostname},get path(){var a=this.articleId&&"0"!==this.articleId?window.location.pathname.split("/").slice(1,-1):window.location.pathname.split("/").slice(1);return a=a.filter(function(a){return"wwwMobileSite"!==a&&"whtzMobileSite"!==a}),a.map(function(a){return"."+a}).map(function(a,b,c){return c.slice(0,b+1).reduce(function(a,b){return a.concat(b)})})},get site(){var a=void 0;return window.location.hostname.indexOf("haaretz.co.il")>-1?a="haaretz":window.location.hostname.indexOf("themarker.com")>-1?a="themarker":window.location.hostname.indexOf("mouse.co.il")>-1&&(a="mouse"),a||"haaretz"},get environment(){var a={dev:1,test:2,prod:3};return"8080"===window.location.port?a.dev:window.location.hostname.indexOf("pre.haaretz.co.il")>-1||window.location.hostname.indexOf("tmtest.themarker.com")>-1||window.location.hostname.indexOf("pre.haaretz.com")>-1||window.location.hostname.indexOf("prodmouse.mouse.co.il")>-1?a.test:window.location.pathname.indexOf("/cmlink/Haaretz.HomePage")>-1||window.location.pathname.indexOf("/cmlink/TheMarker.HomePage")>-1||window.location.pathname.indexOf("/cmlink/Mouse.HomePage")>-1?a.prod:void 0},get articleId(){var a=/\d\.\d+/g.exec(window.location.pathname),b="0";return a&&(b=a.pop()),b},utm_:{get content(){return this.getUrlParam("utm_content")},get source(){return this.getUrlParam("utm_source")},get medium(){return this.getUrlParam("utm_medium")},get campaign(){return this.getUrlParam("utm_campaign")},getUrlParam:function(a){var b=RegExp("("+a+')(=)([^&"]+)').exec(window.location.search);return b&&b[3]?b[3]:void 0}},get adBlockRemoved(){var a=!1;try{localStorage.getItem("adblock_removed")&&(a=!0)}catch(a){}return a},get ssoGroupKey(){return window.localStorage.getItem("_SsoGroupKey")},get anonymousId(){var a="anonymousId",b=c(),d="";return b&&b[a]&&(d=b[a]),d},get isWriterAlerts(){return location.search.indexOf("writerAlerts=true")>-1},get wifiLocation(){var a=void 0,b="_htzwif",d=c();try{d&&d[b]&&("arcaffe"===d[b].toLowerCase()&&(a="ArCafe"),"university"===d[b].toLowerCase()&&(a="university")),d&&d.fairs&&(a="fairs")}catch(a){}return a},get isValidForsmartPhone(){var a=!0,b=window.location.href,d=b.match("haaretzsmartphoneapp"),e=c();try{d&&e&&e.HtzPusr&&(void 0===e.tmsso||"pilosmadar@gmail.com"!==e.tmsso.userName)&&(a=!1)}catch(a){}return a},get gStatCampaignNumber(){var a=void 0;try{a=localStorage.getItem("GstatCampaign")?JSON.parse(localStorage.getItem("GstatCampaign")):void 0}catch(b){a=void 0}return a?a.CampaignNumber:void 0},get pageType(){var a="";try{var b=document.querySelector("html").classList;switch(!0){case/mouse_location/.test(b):a="mouse_location";break;case/mouse_event/.test(b):a="mouse_event";break;case/contentType-story/.test(b):a="mouse_article";break;default:if("0"!==this.articleId)switch(this.domain){case"haaretz.co.il":a="htz_article";break;case"haaretz.com":a="hdc_article";break;case"themarker.com":a="tm_article";break;default:a=""}else a=""}}catch(b){a=""}return a},get proposalNumber(){var a=void 0;try{a=localStorage.getItem("proposaltype")?localStorage.getItem("proposaltype"):void 0}catch(b){a=void 0}return a},adSlotConfig:{"haaretz.co.il.example.slot":{id:"slotId",responsive:!0,adSizeMapping:[["width1","height1"]].concat(["widthN","heightN"]),priority:"normal",fluid:!1,responsiveAdSizeMapping:{xxs:[["width1","height1"]].concat(["widthN","heightN"]),xs:[["width1","height1"]].concat(["widthN","heightN"]),s:[["width1","height1"]].concat(["widthN","heightN"]),m:[["width1","height1"]].concat(["widthN","heightN"]),l:[["width1","height1"]].concat(["widthN","heightN"]),xl:[["width1","height1"]].concat(["widthN","heightN"]),xxl:[["width1","height1"]].concat(["widthN","heightN"])},blacklistReferrers:"comma, delimited, blacklisted, referrer, list",whitelistReferrers:"comma, delimited, referrer, list"}},adManagerConfig:{network:"9401",adUnitBase:"haaretz.co.il_Web"},breakpointsConfig:{get breakpoints(){var a=void 0;switch(o.googleGlobalSettings.breakpointType){case"type1":a=this.breakpoints1;break;case"type2":a=this.breakpoints2;break;case"type3":a=this.breakpoints3;break;case"type4":a=this.breakpoints4;break;default:a=this.breakpoints1}return a},breakpoints1:{xxs:600,xs:761,s:993,m:1009,l:1291,xl:1600,xxl:1900},breakpoints2:{xxs:600,xs:1e3,s:1150,m:1281,l:1600,xl:1920,xxl:1920},breakpoints3:{xxs:100,xs:480,s:600,m:768,l:1024,xl:1280,xxl:1900},breakpoints4:{xxs:600,xs:768,s:1024,m:1280,l:1900,xl:1900,xxl:1900}},userConfig:{type:void 0,age:void 0,gender:void 0},conflictManagementConfig:{"blocking.ad.unit.name":[{onsize:"1280x200,970x250,3x3",avoid:"blocked.ad.unit.name"},{onsize:"1280x200,970x250,3x3",avoid:"blocked.ad.unit.name"}]},impressionManagerConfig:{"ad.unit.name":{target:"all|section|homepage",frequency:"$1/$2(day|hour)",exposed:0,expires:(new Date).getTime()}},googleGlobalSettings:{enableSingleRequest:!0,enableAsyncRendering:!0,refreshIntervalTime:1e3,breakpointType:"type1"},sso:m},n),p=o.breakpointsConfig.breakpoints,q={impressions:"impressions",frequency:"frequency",frequencyRegex:/(\d+)\/(\d+)(day|hour)/,expires:"expires",exposed:"exposed",target:"target",maxImpressions:"maxImpressions",hours:"hour",days:"day",adSlotId:"id"},r=function(){function a(b){j(this,a),this.now=(new Date).getTime(),this.config=Object.assign({},b),this.impressions=this.retrieveImpressionsData(),this.initImpressionMap()}return k(a,[{key:"retrieveImpressionsData",value:function(){var a=this,b=this.migrateImpressionsData();Object.keys(b).map(function(c,d){return b[c]=Object.assign({},b[c],a.config[c]),a});for(var c in b)({}).hasOwnProperty.call(b,c)&&(b[c][q.frequency]||delete b[c]);return b}},{key:"migrateImpressionsData",value:function(){var a=this,b=void 0,c=void 0;try{c=window.localStorage.getItem(q.impressions)}catch(a){c=void 0}try{b=JSON.parse(c)}catch(e){b={};var d=c.split(";").filter(function(a){return a});d.forEach(function(c){try{var d=c.split(" = "),e=d[0],f=d[1],g=e.split("."),h=g.pop();h&&"hp"===h&&(h="homepage");var i=g.join("."),j=i+"_"+h,k=parseInt(f.split("/")[0],10)||0,l=parseInt(f.split("/")[1],10)||a.now;b[j]={},b[j][q.adSlotId]=i,b[j][q.target]=h,b[j][q.exposed]=k,b[j][q.expires]=l}catch(a){}})}return b||{}}},{key:"saveImpressionsToLocalStorage",value:function(){this.debouncedSave&&"function"==typeof this.debouncedSave?this.debouncedSave():(this.debouncedSave=f(this.saveImpressionsToLocalStorageImpl,250,!1),this.debouncedSave())}},{key:"saveImpressionsToLocalStorageImpl",value:function(){try{localStorage.setItem(q.impressions,JSON.stringify(this.impressions))}catch(a){console.error("localStorage isn't available:",a)}}},{key:"initImpressionMap",value:function(){var a=this;Object.keys(this.config).map(function(b,c){var d=b,e=a.impressions[d],f=!1;return e?a.config[d][q.frequency]!==e[q.frequency]?(f=!0,a.impressions[d][q.frequency]=a.config[d][q.frequency]):a.now>e[q.expires]&&(f=!0):a.initSlotFromConfig(d),f&&a.updateExpiryDate(d),a})}},{key:"updateExpiryDate",value:function(a){var b=new Date;if(!this.impressions[a]||!this.impressions[a][q.frequency])throw new Error("Unable to update expiry date for slot: "+a+"\n - this.impressions[slotName]:",this.impressions[a]);var c=this.impressions[a][q.frequency].match(q.frequencyRegex);b.setMilliseconds(0),b.setSeconds(0),b.setMinutes(0),c.indexOf(q.days)>-1&&b.setHours(0),this.impressions[a][q.expires]=(c.indexOf(q.days)>-1?e(b,c[2]):d(b,c[2])).getTime(),this.impressions[a][q.maxImpressions]=parseInt(c[1],10),this.impressions[a][q.exposed]=0}},{key:"initSlotFromConfig",value:function(a){var b=this.impressions[a]||{};b[q.frequency]=this.config[a][q.frequency],b[q.target]=this.config[a][q.target],b[q.exposed]=0,this.impressions[a]=b,this.updateExpiryDate(a)}},{key:"registerImpression",value:function(a){if(a){var b=this.impressions[a];if(b){var c=b[q.exposed];if(!1===isNaN(parseInt(c,10))){this.impressions[a][q.exposed]+=1;try{this.saveImpressionsToLocalStorage()}catch(a){}return!0}}}return!1}},{key:"reachedQuota",value:function(a){var b=this.impressions[""+a+o.department]?""+a+o.department:a+"_all",c=this.impressions[b],d=!1;if(c){var e=(new Date).getTime();if(this.impressions[b][q.expires]=f)}}return d}},{key:"resetImpressions",value:function(){var a=this.impressions;for(var b in a)({}).hasOwnProperty.call(a,b)&&a[b][q.exposed]&&(a[b][q.exposed]=0);this.saveImpressionsToLocalStorage()}}]),a}(),s={payer:"payer",registered:"registered",anonymous:"anonymous",trial:"trial",guest:"reg_guest"},t={htz:243,tm:273,hdc:239,htz_tm:274},u=function(){function a(b){j(this,a),this.config=Object.assign({},b.userConfig);var d=c();this.ssoKey=o.sso,d[this.ssoKey]||(this.ssoKey="tmsso"===this.ssoKey?"engsso":"tmsso"),this.type=this.getUserType(d),this.htz_type=this.getUserTypeByProduct(d,t.htz,"tmsso"),this.tm_type=this.getUserTypeByProduct(d,t.tm,"tmsso"),this.hdc_type=this.getUserTypeByProduct(d,t.hdc,"engsso"),this.impressionManager=new r(b.impressionManagerConfig),this.age=this.getUserAge(d),this.gender=this.getUserGender(d),this.sso=this.getUserSSO(d,this.ssoKey),this.country=this.getUserCountry()}return k(a,[{key:"getUserType",value:function(a){return a&&a[this.ssoKey]?a.HtzPusr||a.TmPusr||a.HdcPusr?s.payer:s.registered:s.anonymous}},{key:"getUserTypeByProduct",value:function(a,b,c){var d=s.anonymous;if(a&&a[c]&&a.userProducts){var e=decodeURIComponent(a.userProducts);e=JSON.parse(e),d=b===t.hdc?this.getHdcUserType(e):this.getHtzTmUserType(e,b),d===s.registered&&"guest"===a[c].firstName&&"guest"===a[c].lastName&&(d=s.guest)}return d}},{key:"getHdcUserType",value:function(a){return this.userHasProduct(a,t.hdc,!1)?s.payer:this.userHasProduct(a,t.hdc,!0)?s.trial:s.registered}},{key:"getHtzTmUserType",value:function(a,b){return this.userHasProduct(a,b,!1)||this.userHasProduct(a,t.htz_tm,!1)?s.payer:this.userHasProduct(a,b,!0)||this.userHasProduct(a,t.htz_tm,!0)?s.trial:s.registered}},{key:"userHasProduct",value:function(a,b,c){return a.products.filter(function(a){return a.prodNum===b&&a.trial===c}).length>0}},{key:"getUserAge",value:function(a){var b=void 0;return a[this.ssoKey]&&a[this.ssoKey].usrae&&(b=parseInt(a[this.ssoKey].usrae,10),b=b>0?b:void 0),b}},{key:"getUserGender",value:function(a){var b=void 0;return a[this.ssoKey]&&a[this.ssoKey].urgdr&&(b=parseInt(a[this.ssoKey].urgdr,10),b=2===b||1===b?b:void 0),b}},{key:"getUserSSO",value:function(a,b){return a[b]}},{key:"getUserCountry",value:function(){var a=window.localStorage.getItem("country");return a||(fetch("https://ms-apps.haaretz.co.il/ms-ip2country/get",{headers:{Accept:"application/json","Content-Type":"application/jsonp"}}).then(function(a){return a.json()}).then(function(a){window.localStorage.setItem("country",a.code)},function(a){}),null)}}]),a}(),v=function(){function a(b){j(this,a),this.dependencyMap=this.initializeDependencyMap(b),this.deferredSlots=new Set}return k(a,[{key:"initializeDependencyMap",value:function(a){var b=this,c=new Map;return Object.keys(a).map(function(d,e){var f=a[d];return f&&(f=f.filter(function(a){return a.onsize&&a.avoid})),c.set(d,{id:d,rules:f,resolvedWith:null}),b}),c}},{key:"updateResolvedSlot",value:function(a,b){if(!a)throw new Error("updateResolvedSlot must be called with an adSlotId!");if(!b)throw new Error("updateResolvedSlot must be called with a resolved size!");this.dependencyMap.has(a)&&(this.dependencyMap.get(a).resolvedWith=b)}},{key:"isBlocked",value:function(a){var b=this;if(!a)throw new Error("isBlocked must be called with an adSlotId!");var c=!1,d=!0,e=!1,f=void 0;try{for(var g,h=this.dependencyMap.keys()[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value,j=this.dependencyMap.get(i),k=!0,l=!1,m=void 0;try{for(var n,o=j.rules[Symbol.iterator]();!(k=(n=o.next()).done);k=!0){var p=n.value;p.avoid===a&&function(){var d=j.resolvedWith;d&&p.onsize.split(",").find(function(a){var c=a.split("x").map(function(a){return parseInt(a,10)});return b.arraysEqual(c,d)})&&(b.deferredSlots.add(a),c=!0)}()}}catch(a){l=!0,m=a}finally{try{!k&&o.return&&o.return()}finally{if(l)throw m}}}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return c}},{key:"isBlocking",value:function(a){if(!a)throw new Error("isBlocking must be called with an adSlotId!");var b=!1,c=!0,d=!1,e=void 0;try{for(var f,g=this.dependencyMap.keys()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){f.value===a&&(b=!0)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b}},{key:"getBlockedSlotsIds",value:function(a){var b=void 0;return this.dependencyMap.has(a)&&(b=Array.from(this.dependencyMap.get(a).rules.map(function(a){return a.avoid}))),b||[]}},{key:"arraysEqual",value:function(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a.length!==b.length)return!1;for(var c=0;c-1?"u-is-hidden":"h-hidden",x=function(){function a(b){if(j(this,a),this.config=Object.assign({},b),this.id=this.config.id,!this.config.id)throw new Error("an adSlot requires an id!");this.target=this.config.target,this.type=this.config.type,this.responsive=this.config.responsive,this.fluid=this.config.fluid,this.user=this.config.user,this.adManager=this.config.adManager,this.htmlElement=this.config.htmlElement,this.priority=this.config.priority,this.deferredSlot=this.config.deferredSlot,this.department=this.config.department,this.network=this.config.network,this.adUnitBase=this.config.adUnitBase,this.adSizeMapping=this.config.adSizeMapping,this.responsiveAdSizeMapping=this.config.responsiveAdSizeMapping,this.blacklistReferrers=this.config.blacklistReferrers?this.config.blacklistReferrers.split(","):[],this.whitelistReferrers=this.config.whitelistReferrers?this.config.whitelistReferrers.split(","):[],this.lastResolvedSize=void 0,this.lastResolvedWithBreakpoint=void 0,this.slot=void 0;try{this.deferredSlot||(this.slot=this.defineSlot())}catch(a){console.error(a)}}return k(a,[{key:"isOutOfPage",value:function(){if("string"!=typeof this.type)throw new Error("An adSlot cannot by typeless!",this);if(!0===this.isMobile())return!1;switch(this.type){case B.maavaron:return!1;case B.popunder:return!0;case B.talkback:case B.regular:default:return!1}}},{key:"isMaavaron",value:function(){if("string"!=typeof this.type)throw new Error("An adSlot cannot by typeless!",this);if(!0===this.isMobile())return!1;switch(this.type){case B.maavaron:default:return!1}}},{key:"isMobile",value:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent||"")}},{key:"isWhitelisted",value:function(){var a=!1;if(0!==this.whitelistReferrers.length){var b=!0,c=!1,d=void 0;try{for(var e,f=this.whitelistReferrers[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(o.referrer.indexOf(g)>-1){a=!0;break}}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}else a=!0;return a}},{key:"isBlacklisted",value:function(){var a=!1;if(0!==this.blacklistReferrers.length){var b=!0,c=!1,d=void 0;try{for(var e,f=this.blacklistReferrers[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(o.referrer.indexOf(g)>-1){a=!0;break}}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}return a}},{key:"show",value:function(){var a=this;!0==!this.shown&&(this.shown=!0,googletag.cmd.push(function(){a.deferredSlot&&(a.slot=a.defineSlot()),document.getElementById(a.id).classList.remove(w),googletag.display(a.id)}))}},{key:"hide",value:function(){var a=this;googletag.cmd.push(function(){document.getElementById(a.id).classList.add(w)})}},{key:"defineSlot",value:function(){if(this.isMaavaron()){var a=this.defineMaavaron();return this.adManager.shouldSendRequestToDfp(this)&&(this.shown||(this.shown=!0,a.display())),a}var b=window.googletag,c=b.pubads(),d=[],e=this.isOutOfPage()?b.defineOutOfPageSlot:b.defineSlot;d.push(this.getPath()),!1===this.isOutOfPage()&&(this.fluid?d.push("fluid"):d.push(this.adSizeMapping)),d.push(this.id);var f=e.apply(e,d);if(f){if(this.responsive){var g=b.sizeMapping(),h=o.breakpointsConfig.breakpoints,j=Object.keys(this.responsiveAdSizeMapping),k=!0,l=!1,m=void 0;try{for(var n,p=j[Symbol.iterator]();!(k=(n=p.next()).done);k=!0){var q=n.value;g.addSize([h[q],100],i(this.responsiveAdSizeMapping[q],[[0,0]])?[]:this.responsiveAdSizeMapping[q])}}catch(a){l=!0,m=a}finally{try{!k&&p.return&&p.return()}finally{if(l)throw m}}g=g.build(),f=f.defineSizeMapping(g)}f=f.addService(c),!1===this.isOutOfPage()&&f.setCollapseEmptyDiv(!0)}return f}},{key:"getPath",value:function(){var a=this,b=o.path||[];return b=b.filter(function(a){return"."!==a}),b=b.map(function(b){return""+a.id+a.department+b}).join("/"),b=b&&"_homepage"!==this.config.department?"/"+b:"",("/"+this.config.network+"/"+this.config.adUnitBase+"/"+this.id+"/"+this.id+this.department+b).toLowerCase()}},{key:"slotRendered",value:function(a){a.slot.getAdUnitPath().split("/")[3],a.isEmpty,a.size}},{key:"refresh",value:function(){var a=this;googletag.cmd.push(function(){googletag.pubads().refresh([a.slot])})}},{key:"defineMaavaron",value:function(){if(!document.referrer.match("loc.haaretz")){var a=this.getPath(),b=[[2,1]];return googletag.pubads().definePassback(a,b).setTargeting("UserType",[this.user.type]).setTargeting("age",[this.user.age]).setTargeting("urgdr",[this.user.gender]).setTargeting("articleId",[o.articleId]).setTargeting("stg",[o.environment])}return null}}]),a}(),y={high:"high",normal:"normal",low:"low"},z={all:"all",nonPaying:"nonPaying",anonymous:"anonymous",registered:"registered",paying:"paying",digitalOnly:"digitalOnly",digitalAndPrint:"digitalAndPrint"},A={anonymous:"anonymous",registered:"registered",payer:"payer"},B={maavaron:".maavaron",popunder:".popunder",talkback:".talkback",regular:""},C=function(){function a(b){var c=this;j(this,a),this.config=Object.assign({},b),this.user=new u(b),this.conflictResolver=new v(b.conflictManagementConfig);try{googletag.cmd.push(function(){c.initGoogleTargetingParams(),c.initGoogleGlobalSettings(),c.initSlotRenderedCallback()});var d=h(g());this.config.adManagerConfig.adUnitBase.indexOf("mouse.co.il")>-1&&d.indexOf("xs")>-1&&(this.config.adManagerConfig.adUnitBase="mouse.co.il.mobile_web"),googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.high)});var e=function(){try{googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.high),googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.normal)})})}catch(a){console.log(a)}},f=function(){googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.low);var a=!0,d=!1,e=void 0;try{for(var f,g=c.conflictResolver.dependencyMap.keys()[Symbol.iterator]();!(a=(f=g.next()).done);a=!0){var h=f.value;c.adSlots.has(h)||c.conflictResolver.dependencyMap.delete(h)}}catch(a){d=!0,e=a}finally{try{!a&&g.return&&g.return()}finally{if(d)throw e}}c.showAllDeferredSlots()})};switch(document.readyState){case"loading":document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",f);break;case"interactive":e(),window.addEventListener("load",f);break;default:e(),f()}}catch(a){console.error(a)}}return k(a,[{key:"showAllSlots",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.adSlots.keys()[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value,g=this.adSlots.get(f);g.type!==B.talkback&&this.shouldSendRequestToDfp(g)&&g.show()}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"getAdSlotsByPriority",value:function(a){function b(b){return b.priority===a}return Array.from(this.adSlots.values()).filter(b)}},{key:"showAllDeferredSlots",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.conflictResolver.deferredSlots[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value;if(this.adSlots.has(f)&&!this.conflictResolver.isBlocked(f)){var g=this.adSlots.get(f);this.shouldSendRequestToDfp(g)&&g.show()}}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"refreshAllSlots",value:function(){var a=g(),b=!0,c=!1,d=void 0;try{for(var e,f=this.adSlots.keys()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var h=e.value,i=this.adSlots.get(h);i.responsive&&i.type!==B.maavaron&&(i.lastResolvedWithBreakpoint!==a&&this.shouldSendRequestToDfp(i)?i.refresh():i.hide())}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}},{key:"refreshAllSlotsInPage",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.adSlots.keys()[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value,g=this.adSlots.get(f);this.shouldSendRequestToDfp(g)?g.refresh():g.hide()}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"refreshSlot",value:function(a){var b=this.adSlots.get(a);this.shouldSendRequestToDfp(b)?b.refresh():b.hide()}},{key:"initAdSlots",value:function(a,b){var c=this,d=new Map(this.adSlots),e=Array.from(document.getElementsByClassName("js-dfp-ad"));e=e.filter(function(a){return a.id});var f=new Set;return e=Array.prototype.filter.call(e,function(a){return!1===f.has(a.id)&&(f.add(a.id),!0)}),e.forEach(function(e){var f=a[e.id]?a[e.id].priority||y.normal:void 0;if(a[e.id]&&!1===d.has(e.id)&&f===b)try{var g=Object.assign({},a[e.id],{id:e.id,target:e.attributes["data-audtarget"]?e.attributes["data-audtarget"].value:z.all,type:c.getAdType(e.id),responsive:a[e.id].responsive,fluid:a[e.id].fluid||!1,user:c.user,adManager:c,htmlElement:e,department:c.config.department,network:c.config.adManagerConfig.network,adUnitBase:c.config.adManagerConfig.adUnitBase,deferredSlot:c.conflictResolver.isBlocked(e.id),priority:f}),h=new x(g);d.set(e.id,h),h.type!==B.talkback&&h.priority===y.high&&c.shouldSendRequestToDfp(h)&&h.show()}catch(a){console.error(a)}}),d}},{key:"isPriority",value:function(a){return"string"==typeof a&&(a.indexOf("plazma")>0||a.indexOf("maavaron")>0||a.indexOf("popunder")>0)}},{key:"getAdType",value:function(a){if(!a)throw new Error("Missing argument: a call to getAdType must have an adSlotId");return a.indexOf(B.maavaron)>-1?B.maavaron:a.indexOf(B.popunder)>-1?B.popunder:a.indexOf(B.talkback)>-1?B.talkback:B.regular}},{key:"shouldSendRequestToDfp",value:function(a){return!1===this.conflictResolver.isBlocked(a.id)&&a.isWhitelisted()&&!1===a.isBlacklisted()&&this.shouldDisplayAdAfterAdBlockRemoval(a)&&this.shouldDisplayAdMaavaronAfterPayWallBanner(a)&&this.doesBreakpointContainAd(a)&&this.haveValidCookieForSmartphoneapp()&&this.doesUserTypeMatchBannerTargeting(a)&&!1===this.user.impressionManager.reachedQuota(a.id)}},{key:"printShouldSendRequestToDfp",value:function(a){var b="";if(this.adSlots.has(a)){var c=this.adSlots.get(a);b+=!1===this.conflictResolver.isBlocked(c.id)?"":"isBlocked,",b+=c.isWhitelisted()?"":"isWhitelisted,",b+=!1===c.isBlacklisted()?"":"isBlacklisted,",b+=this.shouldDisplayAdAfterAdBlockRemoval(c)?"":"AdBlockRemoval,",b+=this.shouldDisplayAdMaavaronAfterPayWallBanner(c)?"":"PayWallBanner,",b+=this.doesBreakpointContainAd(c)?"":"Breakpoint,",b+=this.haveValidCookieForSmartphoneapp()?"":"Smartphoneapp,",b+=this.doesUserTypeMatchBannerTargeting(c)?"":"Targeting,",b+=!1===this.user.impressionManager.reachedQuota(c.id)?"":"reachedQuota,",b="
"+a+"
"+b+"
"}else b="id not exist: "+a;return document.write(b),b}},{key:"testShouldSendRequestToDfp",value:function(a){var b=c();b=JSON.stringify(b),b=b.replace(/,/g,"
");var d="
"+b+"
";return document.write(d),d}},{key:"shouldDisplayAdAfterAdBlockRemoval",value:function(a){return!(!0===this.config.adBlockRemoved&&(a.type===B.maavaron||a.type===B.popunder))}},{key:"shouldDisplayAdMaavaronAfterPayWallBanner",value:function(a){var b=!0;if("haaretz"===this.config.site&&a.type===B.maavaron)try{var c=JSON.parse(window.localStorage.getItem("_cobj"));b=!c||c.mc&&c.mc>=12||c.nextslotLocation&&!c.nextslotLocation.includes("pop")}catch(a){console.error("ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner")}return b}},{key:"haveValidCookieForSmartphoneapp",value:function(){return this.config.isValidForsmartPhone}},{key:"doesUserTypeMatchBannerTargeting",value:function(a){var b=c();if("pilosmadar@gmail.com"===b.login)return!0;if(void 0!==b.tmsso&&"pilosmadar@gmail.com"===b.tmsso.userName)return!0;var d=this.user.type;switch("string"==typeof a?a:a.target){case z.all:return!0;case z.nonPaying:return d===A.anonymous||d===A.registered;case z.anonymous:return d===A.anonymous;case z.registered:return d===A.registered;case z.paying:case z.digitalOnly:case z.digitalAndPrint:return d===A.payer;default:return!1}}},{key:"switchedToBreakpoint",value:function(a){if(!a)throw new Error("Missing argument: a call to switchedToBreakpoint must have an breakpoint");var b=0,c=!0,d=!1,e=void 0;try{for(var f,g=this.adSlots.keys()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value,i=this.adSlots.get(h);!0===i.responsive&&i.lastResolvedWithBreakpoint&&i.lastResolvedWithBreakpoint!==a&&(i.refresh(),b++)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b}},{key:"doesBreakpointContainAd",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g();if(!a)throw new Error("Missing argument: a call to doesBreakpointContainAd must have an adSlot");var c=!0;if(!0===a.responsive){var d=a.responsiveAdSizeMapping[h(b)];if(!1===Array.isArray(d))throw new Error("Invalid argument: breakpoint:"+b+" doesn't exist!",this);c=d.length>0&&!i(d,[[0,0]])}return c}},{key:"initSlotRenderedCallback",value:function(){var a=this;if(!window.googletag||!window.googletag.apiReady)throw new Error("googletag api was not ready when 'initSlotRenderedCallback' was called!");window.googletag.pubads().addEventListener("slotRenderEnded",function(b){var c=b.slot.getAdUnitPath().split("/")[3],d=b.isEmpty,e=b.size;if(a.adSlots.has(c)){var f=a.adSlots.get(c);f.lastResolvedSize=e,f.lastResolvedWithBreakpoint=g(),d?(f.lastResolvedSize=v.EMPTY_SIZE,f.hide(),a.releaseSlotDependencies(f)):a.releaseSlotDependencies(f,f.lastResolvedSize),a.user.impressionManager.registerImpression(""+f.id+a.config.department),a.user.impressionManager.registerImpression(f.id+"_all")}})}},{key:"releaseSlotDependencies",value:function(a){try{var b=a.id;if(this.conflictResolver.updateResolvedSlot(b,a.lastResolvedSize),this.conflictResolver.isBlocking(b)){var c=!0,d=!1,e=void 0;try{for(var f,g=this.conflictResolver.getBlockedSlotsIds(b)[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;this.conflictResolver.isBlocked(h)&&this.adSlots.has(h)&&this.adSlots.get(h).hide()}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}var i=!0,j=!1,k=void 0;try{for(var l,m=this.conflictResolver.deferredSlots.keys()[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value,o=this.adSlots.get(n);o&&this.shouldSendRequestToDfp(o)&&(this.conflictResolver.deferredSlots.delete(n),o.deferredSlot&&(o.defineSlot(),o.deferredSlot=!1),o.show())}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}}}catch(b){console.error("Cannot updateSlotDependencies for adSlot: "+a.id)}}},{key:"setSsoGroupKey",value:function(){fetch("/ssoGroupKey?value="+this.user.sso.userId,{method:"GET",cache:"no-cache"}).then(function(a){a&&a.json().then(function(a){a&&a.result&&"item not found"!==a.result&&"value is empty"!==a.result&&localStorage.setItem("_SsoGroupKey",a.result)})})}},{key:"initGoogleTargetingParams",value:function(){if(!window.googletag||!window.googletag.apiReady)throw new Error("googletag api was not ready when 'initGoogleTargetingParams' was called!");var a=null;try{a=localStorage.getItem("_SsoGroupKey"),!a&&this.user.sso.userId&&this.setSsoGroupKey()}catch(b){a=null}var b=googletag.pubads();if(this.config.environment&&b.setTargeting("stg",[this.config.environment]),this.user.htz_type&&b.setTargeting("htz_user_type",[this.user.htz_type]),this.user.tm_type&&b.setTargeting("tm_user_type",[this.user.tm_type]),this.user.hdc_type&&b.setTargeting("hdc_user_type",[this.user.hdc_type]),this.config.section&&b.setTargeting("section",[this.config.section]),this.config.sub_section&&b.setTargeting("sub_section",[this.config.sub_section]),this.config.articleId&&(b.setTargeting("articleId",[this.config.articleId]),b.setTargeting("react",["false"])),this.config.gStatCampaignNumber&&-1!==this.config.gStatCampaignNumber&&b.setTargeting("gstat_campaign_id",[this.config.gStatCampaignNumber]),this.config.proposalNumber&&b.setTargeting("proposaltype",[this.config.proposalNumber]),this.config.pageType&&b.setTargeting("pageType",[this.config.pageType]),this.config.isWriterAlerts&&b.setTargeting("WriterAlerts",["true"]),this.config.adBlockRemoved&&b.setTargeting("adblock_removed",[this.config.adBlockRemoved]),this.config.wifiLocation&&b.setTargeting("wifi",[this.config.wifiLocation]),this.config.tags&&Array.isArray(this.config.tags)&&b.setTargeting("tags",[].concat(l(this.config.tags))),this.user.sso&&this.user.sso.userId&&a&&b.setTargeting(a,this.user.sso.userId),this.config.anonymousId){b.setTargeting("anonymousIdKey",this.config.anonymousId)}this.user.country&&b.setTargeting("country",this.user.country);var c=this.getCityNames();c&&b.setTargeting("cityName",[].concat(l(c))),b.setCentering(!0)}},{key:"initGoogleGlobalSettings",value:function(){if(!window.googletag||!window.googletag.apiReady)throw new Error("googletag api wasn't ready when 'initGoogleGlobalSettings' was called!");var a=this.config.googleGlobalSettings;if(window.location.search){var b=window.location.search;b.indexOf("sraon")>0?(console.log("Single Request Mode: active"),a.enableSingleRequest=!0):b.indexOf("sraoff")>0&&(console.log("Single Request Mode: disabled"),a.enableSingleRequest=!1),b.indexOf("asyncrenderingon")>0?(console.log("Async rendering mode: active"),a.enableAsyncRendering=!0):b.indexOf("asyncrenderingonoff")>0&&(console.log("Sync rendering mode: active"),a.enableAsyncRendering=!1)}!0===a.enableSingleRequest&&googletag.pubads().enableSingleRequest(),googletag.enableServices()}},{key:"getCityNames",value:function(){var a=[];return document.querySelectorAll("[data-location-city-name]").forEach(function(b){a.includes(b.dataset.locationCityName)||a.push(b.dataset.locationCityName)}),a.length>0?a:null}}]),a}(),D=o||{},E=250,F=function(){function a(b){j(this,a),this.config=Object.assign({},D,b),this.wasInitialized=!1,this.initStarted=!1,this.breakpoint=g(),this.initWindowResizeListener()}return k(a,[{key:"resumeInit",value:function(){try{this.adManager=this.adManager||new C(this.config)}catch(a){console.error(a)}}},{key:"initGoogleTag",value:function(){var a=this,b=this;return new Promise(function(c,d){!0===b.initStarted?googletag.cmd.push(function(){b.wasInitialized=!0,c(b)}):(b.initStarted=!0,window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],function(){var e=window.document.createElement("script");e.async=!0,e.type="text/javascript",e.setAttribute("src","//www.googletagservices.com/tag/js/gpt.js");var f=window.document.getElementsByTagName("script")[0];e.addEventListener("load",function(){b.resumeInit(),googletag.cmd.push(function(){b.wasInitialized=!0,c(a)})}),e.addEventListener("error",function(a){b.wasInitialized=!1,d(a)}),f.parentNode.insertBefore(e,f)}())})}},{key:"isGoogleTagReady",value:function(){return(!0===this.wasInitialized||window.googletag&&window.googletag.apiReady)&&(this.wasInitialized=!0),this.wasInitialized}},{key:"initWindowResizeListener",value:function(){function a(){var a=g();if(b.breakpoint!==a){if(b.breakpoint=a,!b.adManager)throw new Error("initWindowResizeListener error - adManager instance is not available");b.adManager.refreshAllSlots()}}var b=this,c=f(a,E);window.onresize=c}}]),a}();F.version="2.6.5";var G=o,H=F.version;a.config=G,a.version=H,a.default=F}(this.DFP=this.DFP||{}); +!function(a){"use strict";function b(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=b.separator,d=void 0===c?";":c,e=b.operator,f=void 0===e?"=":e,g={};return a.split(d).forEach(function(a){if("string"==typeof a){var b=a.split(f);if(2===b.length)try{g[b[0]]=decodeURIComponent(b[1])}catch(a){}}}),g}function c(){var a=b(document.cookie,{separator:/;\s?/});return"string"==typeof a.tmsso&&(a.tmsso=b(a.tmsso,{separator:":"})),"string"==typeof a.engsso&&(a.engsso=b(a.engsso,{separator:":"})),a}function d(a,b){if(!a)throw new SyntaxError("addHours called without a required 'date' parameter!");if(!b)throw new SyntaxError("addHours called without a required 'hours' parameter!");if(isNaN(parseInt(b,10)))throw new TypeError("addHours called with an invalid integer 'hours' parameter!");var c=new Date(a);return c.setHours(c.getHours()+parseInt(b,10)),c}function e(a,b){if(!a)throw new SyntaxError("addDays called without a required 'date' parameter!");if(!b)throw new SyntaxError("addDays called without a required 'days' parameter!");if(isNaN(parseInt(b,10)))throw new TypeError("addDays called with an invalid integer 'days' parameter!");var c=new Date(a);return c.setDate(c.getDate()+parseInt(b,10)),c}function f(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,c=arguments[2],d=void 0;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}}function g(){var a=void 0,b=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;switch(!0){case b-1?"engsso":"tmsso",n=void 0;try{n=window.JSON.parse(document.getElementById("dfpConfig").textContent)}catch(a){n=window.dfpConfig}var o=Object.assign({get referrer(){return document.referrer?document.referrer:""},get isMobile(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent||"")},get isHomepage(){return"/"===window.location.pathname||3===this.environment},get department(){return this.isHomepage?"_homepage":"_section"},get domain(){var a=/([\d|\w]+)(\.co\.il|\.com)(.*)?/.exec(window.location.hostname);return a?a[0]:window.location.hostname},get path(){var a=this.articleId&&"0"!==this.articleId?window.location.pathname.split("/").slice(1,-1):window.location.pathname.split("/").slice(1);return a=a.filter(function(a){return"wwwMobileSite"!==a&&"whtzMobileSite"!==a}),a.map(function(a){return"."+a}).map(function(a,b,c){return c.slice(0,b+1).reduce(function(a,b){return a.concat(b)})})},get site(){var a=void 0;return window.location.hostname.indexOf("haaretz.co.il")>-1?a="haaretz":window.location.hostname.indexOf("themarker.com")>-1?a="themarker":window.location.hostname.indexOf("mouse.co.il")>-1&&(a="mouse"),a||"haaretz"},get environment(){var a={dev:1,test:2,prod:3};return"8080"===window.location.port?a.dev:window.location.hostname.indexOf("pre.haaretz.co.il")>-1||window.location.hostname.indexOf("tmtest.themarker.com")>-1||window.location.hostname.indexOf("pre.haaretz.com")>-1||window.location.hostname.indexOf("prodmouse.mouse.co.il")>-1?a.test:window.location.pathname.indexOf("/cmlink/Haaretz.HomePage")>-1||window.location.pathname.indexOf("/cmlink/TheMarker.HomePage")>-1||window.location.pathname.indexOf("/cmlink/Mouse.HomePage")>-1?a.prod:void 0},get articleId(){var a=/\d\.\d+/g.exec(window.location.pathname),b="0";return a&&(b=a.pop()),b},utm_:{get content(){return this.getUrlParam("utm_content")},get source(){return this.getUrlParam("utm_source")},get medium(){return this.getUrlParam("utm_medium")},get campaign(){return this.getUrlParam("utm_campaign")},getUrlParam:function(a){var b=RegExp("("+a+')(=)([^&"]+)').exec(window.location.search);return b&&b[3]?b[3]:void 0}},get adBlockRemoved(){var a=!1;try{localStorage.getItem("adblock_removed")&&(a=!0)}catch(a){}return a},get ssoGroupKey(){return window.localStorage.getItem("_SsoGroupKey")},get anonymousId(){var a="anonymousId",b=c(),d="";return b&&b[a]&&(d=b[a]),d},get isWriterAlerts(){return location.search.indexOf("writerAlerts=true")>-1},get wifiLocation(){var a=void 0,b="_htzwif",d=c();try{d&&d[b]&&("arcaffe"===d[b].toLowerCase()&&(a="ArCafe"),"university"===d[b].toLowerCase()&&(a="university")),d&&d.fairs&&(a="fairs")}catch(a){}return a},get isValidForsmartPhone(){var a=!0,b=window.location.href,d=b.match("haaretzsmartphoneapp"),e=c();try{d&&e&&e.HtzPusr&&(void 0===e.tmsso||"pilosmadar@gmail.com"!==e.tmsso.userName)&&(a=!1)}catch(a){}return a},get gStatCampaignNumber(){var a=void 0;try{a=localStorage.getItem("GstatCampaign")?JSON.parse(localStorage.getItem("GstatCampaign")):void 0}catch(b){a=void 0}return a?a.CampaignNumber:void 0},get pageType(){var a="";try{var b=document.querySelector("html").classList;switch(!0){case/mouse_location/.test(b):a="mouse_location";break;case/mouse_event/.test(b):a="mouse_event";break;case/contentType-story/.test(b):a="mouse_article";break;default:if("0"!==this.articleId)switch(this.domain){case"haaretz.co.il":a="htz_article";break;case"haaretz.com":a="hdc_article";break;case"themarker.com":a="tm_article";break;default:a=""}else a=""}}catch(b){a=""}return a},get proposalNumber(){var a=void 0;try{a=localStorage.getItem("proposaltype")?localStorage.getItem("proposaltype"):void 0}catch(b){a=void 0}return a},adSlotConfig:{"haaretz.co.il.example.slot":{id:"slotId",responsive:!0,adSizeMapping:[["width1","height1"]].concat(["widthN","heightN"]),priority:"normal",fluid:!1,responsiveAdSizeMapping:{xxs:[["width1","height1"]].concat(["widthN","heightN"]),xs:[["width1","height1"]].concat(["widthN","heightN"]),s:[["width1","height1"]].concat(["widthN","heightN"]),m:[["width1","height1"]].concat(["widthN","heightN"]),l:[["width1","height1"]].concat(["widthN","heightN"]),xl:[["width1","height1"]].concat(["widthN","heightN"]),xxl:[["width1","height1"]].concat(["widthN","heightN"])},blacklistReferrers:"comma, delimited, blacklisted, referrer, list",whitelistReferrers:"comma, delimited, referrer, list"}},adManagerConfig:{network:"9401",adUnitBase:"haaretz.co.il_Web"},breakpointsConfig:{get breakpoints(){var a=void 0;switch(o.googleGlobalSettings.breakpointType){case"type1":a=this.breakpoints1;break;case"type2":a=this.breakpoints2;break;case"type3":a=this.breakpoints3;break;case"type4":a=this.breakpoints4;break;default:a=this.breakpoints1}return a},breakpoints1:{xxs:600,xs:761,s:993,m:1009,l:1291,xl:1600,xxl:1900},breakpoints2:{xxs:600,xs:1e3,s:1150,m:1281,l:1600,xl:1920,xxl:1920},breakpoints3:{xxs:100,xs:480,s:600,m:768,l:1024,xl:1280,xxl:1900},breakpoints4:{xxs:600,xs:768,s:1024,m:1280,l:1900,xl:1900,xxl:1900}},userConfig:{type:void 0,age:void 0,gender:void 0},conflictManagementConfig:{"blocking.ad.unit.name":[{onsize:"1280x200,970x250,3x3",avoid:"blocked.ad.unit.name"},{onsize:"1280x200,970x250,3x3",avoid:"blocked.ad.unit.name"}]},impressionManagerConfig:{"ad.unit.name":{target:"all|section|homepage",frequency:"$1/$2(day|hour)",exposed:0,expires:(new Date).getTime()}},googleGlobalSettings:{enableSingleRequest:!0,enableAsyncRendering:!0,refreshIntervalTime:1e3,breakpointType:"type1"},sso:m},n),p=o.breakpointsConfig.breakpoints,q={impressions:"impressions",frequency:"frequency",frequencyRegex:/(\d+)\/(\d+)(day|hour)/,expires:"expires",exposed:"exposed",target:"target",maxImpressions:"maxImpressions",hours:"hour",days:"day",adSlotId:"id"},r=function(){function a(b){j(this,a),this.now=(new Date).getTime(),this.config=Object.assign({},b),this.impressions=this.retrieveImpressionsData(),this.initImpressionMap()}return k(a,[{key:"retrieveImpressionsData",value:function(){var a=this,b=this.migrateImpressionsData();Object.keys(b).map(function(c,d){return b[c]=Object.assign({},b[c],a.config[c]),a});for(var c in b)({}).hasOwnProperty.call(b,c)&&(b[c][q.frequency]||delete b[c]);return b}},{key:"migrateImpressionsData",value:function(){var a=this,b=void 0,c=void 0;try{c=window.localStorage.getItem(q.impressions)}catch(a){c=void 0}try{b=JSON.parse(c)}catch(e){b={};var d=c.split(";").filter(function(a){return a});d.forEach(function(c){try{var d=c.split(" = "),e=d[0],f=d[1],g=e.split("."),h=g.pop();h&&"hp"===h&&(h="homepage");var i=g.join("."),j=i+"_"+h,k=parseInt(f.split("/")[0],10)||0,l=parseInt(f.split("/")[1],10)||a.now;b[j]={},b[j][q.adSlotId]=i,b[j][q.target]=h,b[j][q.exposed]=k,b[j][q.expires]=l}catch(a){}})}return b||{}}},{key:"saveImpressionsToLocalStorage",value:function(){this.debouncedSave&&"function"==typeof this.debouncedSave?this.debouncedSave():(this.debouncedSave=f(this.saveImpressionsToLocalStorageImpl,250,!1),this.debouncedSave())}},{key:"saveImpressionsToLocalStorageImpl",value:function(){try{localStorage.setItem(q.impressions,JSON.stringify(this.impressions))}catch(a){console.error("localStorage isn't available:",a)}}},{key:"initImpressionMap",value:function(){var a=this;Object.keys(this.config).map(function(b,c){var d=b,e=a.impressions[d],f=!1;return e?a.config[d][q.frequency]!==e[q.frequency]?(f=!0,a.impressions[d][q.frequency]=a.config[d][q.frequency]):a.now>e[q.expires]&&(f=!0):a.initSlotFromConfig(d),f&&a.updateExpiryDate(d),a})}},{key:"updateExpiryDate",value:function(a){var b=new Date;if(!this.impressions[a]||!this.impressions[a][q.frequency])throw new Error("Unable to update expiry date for slot: "+a+"\n - this.impressions[slotName]:",this.impressions[a]);var c=this.impressions[a][q.frequency].match(q.frequencyRegex);b.setMilliseconds(0),b.setSeconds(0),b.setMinutes(0),c.indexOf(q.days)>-1&&b.setHours(0),this.impressions[a][q.expires]=(c.indexOf(q.days)>-1?e(b,c[2]):d(b,c[2])).getTime(),this.impressions[a][q.maxImpressions]=parseInt(c[1],10),this.impressions[a][q.exposed]=0}},{key:"initSlotFromConfig",value:function(a){var b=this.impressions[a]||{};b[q.frequency]=this.config[a][q.frequency],b[q.target]=this.config[a][q.target],b[q.exposed]=0,this.impressions[a]=b,this.updateExpiryDate(a)}},{key:"registerImpression",value:function(a){if(a){var b=this.impressions[a];if(b){var c=b[q.exposed];if(!1===isNaN(parseInt(c,10))){this.impressions[a][q.exposed]+=1;try{this.saveImpressionsToLocalStorage()}catch(a){}return!0}}}return!1}},{key:"reachedQuota",value:function(a){var b=this.impressions[""+a+o.department]?""+a+o.department:a+"_all",c=this.impressions[b],d=!1;if(c){var e=(new Date).getTime();if(this.impressions[b][q.expires]=f)}}return d}},{key:"resetImpressions",value:function(){var a=this.impressions;for(var b in a)({}).hasOwnProperty.call(a,b)&&a[b][q.exposed]&&(a[b][q.exposed]=0);this.saveImpressionsToLocalStorage()}}]),a}(),s={payer:"payer",registered:"registered",anonymous:"anonymous",trial:"trial",guest:"reg_guest"},t={htz:243,tm:273,hdc:239,htz_tm:274},u=function(){function a(b){j(this,a),this.config=Object.assign({},b.userConfig);var d=c();this.ssoKey=o.sso,d[this.ssoKey]||(this.ssoKey="tmsso"===this.ssoKey?"engsso":"tmsso"),this.type=this.getUserType(d),this.htz_type=this.getUserTypeByProduct(d,t.htz,"tmsso"),this.tm_type=this.getUserTypeByProduct(d,t.tm,"tmsso"),this.hdc_type=this.getUserTypeByProduct(d,t.hdc,"engsso"),this.impressionManager=new r(b.impressionManagerConfig),this.age=this.getUserAge(d),this.gender=this.getUserGender(d),this.sso=this.getUserSSO(d,this.ssoKey),this.country=this.getUserCountry()}return k(a,[{key:"getUserType",value:function(a){return a&&a[this.ssoKey]?a.HtzPusr||a.TmPusr||a.HdcPusr?s.payer:s.registered:s.anonymous}},{key:"getUserTypeByProduct",value:function(a,b,c){var d=s.anonymous;if(a&&a[c]&&a.userProducts){var e=decodeURIComponent(a.userProducts);e=JSON.parse(e),d=b===t.hdc?this.getHdcUserType(e):this.getHtzTmUserType(e,b),d===s.registered&&"guest"===a[c].firstName&&"guest"===a[c].lastName&&(d=s.guest)}return d}},{key:"getHdcUserType",value:function(a){return this.userHasProduct(a,t.hdc,!1)?s.payer:this.userHasProduct(a,t.hdc,!0)?s.trial:s.registered}},{key:"getHtzTmUserType",value:function(a,b){return this.userHasProduct(a,b,!1)||this.userHasProduct(a,t.htz_tm,!1)?s.payer:this.userHasProduct(a,b,!0)||this.userHasProduct(a,t.htz_tm,!0)?s.trial:s.registered}},{key:"userHasProduct",value:function(a,b,c){return a.products.filter(function(a){return a.prodNum===b&&a.trial===c}).length>0}},{key:"getUserAge",value:function(a){var b=void 0;return a[this.ssoKey]&&a[this.ssoKey].usrae&&(b=parseInt(a[this.ssoKey].usrae,10),b=b>0?b:void 0),b}},{key:"getUserGender",value:function(a){var b=void 0;return a[this.ssoKey]&&a[this.ssoKey].urgdr&&(b=parseInt(a[this.ssoKey].urgdr,10),b=2===b||1===b?b:void 0),b}},{key:"getUserSSO",value:function(a,b){return a[b]}},{key:"getUserCountry",value:function(){var a=window.localStorage.getItem("country");return a||(fetch("https://ms-apps.haaretz.co.il/ms-ip2country/get",{headers:{Accept:"application/json","Content-Type":"application/jsonp"}}).then(function(a){return a.json()}).then(function(a){window.localStorage.setItem("country",a.code)},function(a){}),null)}}]),a}(),v=function(){function a(b){j(this,a),this.dependencyMap=this.initializeDependencyMap(b),this.deferredSlots=new Set}return k(a,[{key:"initializeDependencyMap",value:function(a){var b=this,c=new Map;return Object.keys(a).map(function(d,e){var f=a[d];return f&&(f=f.filter(function(a){return a.onsize&&a.avoid})),c.set(d,{id:d,rules:f,resolvedWith:null}),b}),c}},{key:"updateResolvedSlot",value:function(a,b){if(!a)throw new Error("updateResolvedSlot must be called with an adSlotId!");if(!b)throw new Error("updateResolvedSlot must be called with a resolved size!");this.dependencyMap.has(a)&&(this.dependencyMap.get(a).resolvedWith=b)}},{key:"isBlocked",value:function(a){var b=this;if(!a)throw new Error("isBlocked must be called with an adSlotId!");var c=!1,d=!0,e=!1,f=void 0;try{for(var g,h=this.dependencyMap.keys()[Symbol.iterator]();!(d=(g=h.next()).done);d=!0){var i=g.value,j=this.dependencyMap.get(i),k=!0,l=!1,m=void 0;try{for(var n,o=j.rules[Symbol.iterator]();!(k=(n=o.next()).done);k=!0){var p=n.value;p.avoid===a&&function(){var d=j.resolvedWith;d&&p.onsize.split(",").find(function(a){var c=a.split("x").map(function(a){return parseInt(a,10)});return b.arraysEqual(c,d)})&&(b.deferredSlots.add(a),c=!0)}()}}catch(a){l=!0,m=a}finally{try{!k&&o.return&&o.return()}finally{if(l)throw m}}}}catch(a){e=!0,f=a}finally{try{!d&&h.return&&h.return()}finally{if(e)throw f}}return c}},{key:"isBlocking",value:function(a){if(!a)throw new Error("isBlocking must be called with an adSlotId!");var b=!1,c=!0,d=!1,e=void 0;try{for(var f,g=this.dependencyMap.keys()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){f.value===a&&(b=!0)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b}},{key:"getBlockedSlotsIds",value:function(a){var b=void 0;return this.dependencyMap.has(a)&&(b=Array.from(this.dependencyMap.get(a).rules.map(function(a){return a.avoid}))),b||[]}},{key:"arraysEqual",value:function(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a.length!==b.length)return!1;for(var c=0;c-1?"u-is-hidden":"h-hidden",x=function(){function a(b){if(j(this,a),this.config=Object.assign({},b),this.id=this.config.id,!this.config.id)throw new Error("an adSlot requires an id!");this.target=this.config.target,this.type=this.config.type,this.responsive=this.config.responsive,this.fluid=this.config.fluid,this.user=this.config.user,this.adManager=this.config.adManager,this.htmlElement=this.config.htmlElement,this.priority=this.config.priority,this.deferredSlot=this.config.deferredSlot,this.department=this.config.department,this.network=this.config.network,this.adUnitBase=this.config.adUnitBase,this.adSizeMapping=this.config.adSizeMapping,this.responsiveAdSizeMapping=this.config.responsiveAdSizeMapping,this.blacklistReferrers=this.config.blacklistReferrers?this.config.blacklistReferrers.split(","):[],this.whitelistReferrers=this.config.whitelistReferrers?this.config.whitelistReferrers.split(","):[],this.lastResolvedSize=void 0,this.lastResolvedWithBreakpoint=void 0,this.slot=void 0;try{this.deferredSlot||(this.slot=this.defineSlot())}catch(a){console.error(a)}}return k(a,[{key:"isOutOfPage",value:function(){if("string"!=typeof this.type)throw new Error("An adSlot cannot by typeless!",this);if(!0===this.isMobile())return!1;switch(this.type){case B.maavaron:return!1;case B.popunder:return!0;case B.talkback:case B.regular:default:return!1}}},{key:"isMaavaron",value:function(){if("string"!=typeof this.type)throw new Error("An adSlot cannot by typeless!",this);if(!0===this.isMobile())return!1;switch(this.type){case B.maavaron:default:return!1}}},{key:"isMobile",value:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent||"")}},{key:"isWhitelisted",value:function(){var a=!1;if(0!==this.whitelistReferrers.length){var b=!0,c=!1,d=void 0;try{for(var e,f=this.whitelistReferrers[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(o.referrer.indexOf(g)>-1){a=!0;break}}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}else a=!0;return a}},{key:"isBlacklisted",value:function(){var a=!1;if(0!==this.blacklistReferrers.length){var b=!0,c=!1,d=void 0;try{for(var e,f=this.blacklistReferrers[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var g=e.value;if(o.referrer.indexOf(g)>-1){a=!0;break}}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}return a}},{key:"show",value:function(){var a=this;!0==!this.shown&&(this.shown=!0,googletag.cmd.push(function(){a.deferredSlot&&(a.slot=a.defineSlot()),document.getElementById(a.id).classList.remove(w),googletag.display(a.id)}))}},{key:"hide",value:function(){var a=this;googletag.cmd.push(function(){document.getElementById(a.id).classList.add(w)})}},{key:"defineSlot",value:function(){if(this.isMaavaron()){var a=this.defineMaavaron();return this.adManager.shouldSendRequestToDfp(this)&&(this.shown||(this.shown=!0,a.display())),a}var b=window.googletag,c=b.pubads(),d=[],e=this.isOutOfPage()?b.defineOutOfPageSlot:b.defineSlot;d.push(this.getPath()),!1===this.isOutOfPage()&&(this.fluid?d.push("fluid"):d.push(this.adSizeMapping)),d.push(this.id);var f=e.apply(e,d);if(f){if(this.responsive){var g=b.sizeMapping(),h=o.breakpointsConfig.breakpoints,j=Object.keys(this.responsiveAdSizeMapping),k=!0,l=!1,m=void 0;try{for(var n,p=j[Symbol.iterator]();!(k=(n=p.next()).done);k=!0){var q=n.value;g.addSize([h[q],100],i(this.responsiveAdSizeMapping[q],[[0,0]])?[]:this.responsiveAdSizeMapping[q])}}catch(a){l=!0,m=a}finally{try{!k&&p.return&&p.return()}finally{if(l)throw m}}g=g.build(),f=f.defineSizeMapping(g)}f=f.addService(c),!1===this.isOutOfPage()&&f.setCollapseEmptyDiv(!0)}return f}},{key:"getPath",value:function(){var a=this,b=o.path||[];return b=b.filter(function(a){return"."!==a}),b=b.map(function(b){return""+a.id+a.department+b}).join("/"),b=b&&"_homepage"!==this.config.department?"/"+b:"",("/"+this.config.network+"/"+this.config.adUnitBase+"/"+this.id+"/"+this.id+this.department+b).toLowerCase()}},{key:"slotRendered",value:function(a){a.slot.getAdUnitPath().split("/")[3],a.isEmpty,a.size}},{key:"refresh",value:function(){var a=this;googletag.cmd.push(function(){googletag.pubads().refresh([a.slot])})}},{key:"defineMaavaron",value:function(){if(!document.referrer.match("loc.haaretz")){var a=this.getPath(),b=[[2,1]];return googletag.pubads().definePassback(a,b).setTargeting("UserType",[this.user.type]).setTargeting("age",[this.user.age]).setTargeting("urgdr",[this.user.gender]).setTargeting("articleId",[o.articleId]).setTargeting("stg",[o.environment])}return null}}]),a}(),y={high:"high",normal:"normal",low:"low"},z={all:"all",nonPaying:"nonPaying",anonymous:"anonymous",registered:"registered",paying:"paying",digitalOnly:"digitalOnly",digitalAndPrint:"digitalAndPrint"},A={anonymous:"anonymous",registered:"registered",payer:"payer"},B={maavaron:".maavaron",popunder:".popunder",talkback:".talkback",regular:""},C=function(){function a(b){var c=this;j(this,a),this.config=Object.assign({},b),this.user=new u(b),this.conflictResolver=new v(b.conflictManagementConfig);try{googletag.cmd.push(function(){c.initGoogleTargetingParams(),c.initGoogleGlobalSettings(),c.initSlotRenderedCallback()});var d=h(g());this.config.adManagerConfig.adUnitBase.indexOf("mouse.co.il")>-1&&d.indexOf("xs")>-1&&(this.config.adManagerConfig.adUnitBase="mouse.co.il.mobile_web"),googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.high)});var e=function(){try{googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.high),googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.normal)})})}catch(a){console.log(a)}},f=function(){googletag.cmd.push(function(){c.adSlots=c.initAdSlots(b.adSlotConfig,y.low);var a=!0,d=!1,e=void 0;try{for(var f,g=c.conflictResolver.dependencyMap.keys()[Symbol.iterator]();!(a=(f=g.next()).done);a=!0){var h=f.value;c.adSlots.has(h)||c.conflictResolver.dependencyMap.delete(h)}}catch(a){d=!0,e=a}finally{try{!a&&g.return&&g.return()}finally{if(d)throw e}}c.showAllDeferredSlots()})};switch(document.readyState){case"loading":document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",f);break;case"interactive":e(),window.addEventListener("load",f);break;default:e(),f()}}catch(a){console.error(a)}}return k(a,[{key:"showAllSlots",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.adSlots.keys()[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value,g=this.adSlots.get(f);g.type!==B.talkback&&this.shouldSendRequestToDfp(g)&&g.show()}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"getAdSlotsByPriority",value:function(a){function b(b){return b.priority===a}return Array.from(this.adSlots.values()).filter(b)}},{key:"showAllDeferredSlots",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.conflictResolver.deferredSlots[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value;if(this.adSlots.has(f)&&!this.conflictResolver.isBlocked(f)){var g=this.adSlots.get(f);this.shouldSendRequestToDfp(g)&&g.show()}}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"refreshAllSlots",value:function(){var a=g(),b=!0,c=!1,d=void 0;try{for(var e,f=this.adSlots.keys()[Symbol.iterator]();!(b=(e=f.next()).done);b=!0){var h=e.value,i=this.adSlots.get(h);i.responsive&&i.type!==B.maavaron&&(i.lastResolvedWithBreakpoint!==a&&this.shouldSendRequestToDfp(i)?i.refresh():i.hide())}}catch(a){c=!0,d=a}finally{try{!b&&f.return&&f.return()}finally{if(c)throw d}}}},{key:"refreshAllSlotsInPage",value:function(){var a=!0,b=!1,c=void 0;try{for(var d,e=this.adSlots.keys()[Symbol.iterator]();!(a=(d=e.next()).done);a=!0){var f=d.value,g=this.adSlots.get(f);this.shouldSendRequestToDfp(g)?g.refresh():g.hide()}}catch(a){b=!0,c=a}finally{try{!a&&e.return&&e.return()}finally{if(b)throw c}}}},{key:"refreshSlot",value:function(a){var b=this.adSlots.get(a);this.shouldSendRequestToDfp(b)?b.refresh():b.hide()}},{key:"initAdSlots",value:function(a,b){var c=this,d=new Map(this.adSlots),e=Array.from(document.getElementsByClassName("js-dfp-ad"));e=e.filter(function(a){return a.id});var f=new Set;return e=Array.prototype.filter.call(e,function(a){return!1===f.has(a.id)&&(f.add(a.id),!0)}),e.forEach(function(e){var f=a[e.id]?a[e.id].priority||y.normal:void 0;if(a[e.id]&&!1===d.has(e.id)&&f===b)try{var g=Object.assign({},a[e.id],{id:e.id,target:e.attributes["data-audtarget"]?e.attributes["data-audtarget"].value:z.all,type:c.getAdType(e.id),responsive:a[e.id].responsive,fluid:a[e.id].fluid||!1,user:c.user,adManager:c,htmlElement:e,department:c.config.department,network:c.config.adManagerConfig.network,adUnitBase:c.config.adManagerConfig.adUnitBase,deferredSlot:c.conflictResolver.isBlocked(e.id),priority:f}),h=new x(g);d.set(e.id,h),h.type!==B.talkback&&h.priority===y.high&&c.shouldSendRequestToDfp(h)&&h.show()}catch(a){console.error(a)}}),d}},{key:"isPriority",value:function(a){return"string"==typeof a&&(a.indexOf("plazma")>0||a.indexOf("maavaron")>0||a.indexOf("popunder")>0)}},{key:"getAdType",value:function(a){if(!a)throw new Error("Missing argument: a call to getAdType must have an adSlotId");return a.indexOf(B.maavaron)>-1?B.maavaron:a.indexOf(B.popunder)>-1?B.popunder:a.indexOf(B.talkback)>-1?B.talkback:B.regular}},{key:"shouldSendRequestToDfp",value:function(a){return!1===this.conflictResolver.isBlocked(a.id)&&a.isWhitelisted()&&!1===a.isBlacklisted()&&this.shouldDisplayAdAfterAdBlockRemoval(a)&&this.shouldDisplayAdMaavaronAfterPayWallBanner(a)&&this.doesBreakpointContainAd(a)&&this.haveValidCookieForSmartphoneapp()&&this.doesUserTypeMatchBannerTargeting(a)&&!1===this.user.impressionManager.reachedQuota(a.id)&&!1===this.shouldAppPromotionElementPop()}},{key:"printShouldSendRequestToDfp",value:function(a){var b="";if(this.adSlots.has(a)){var c=this.adSlots.get(a);b+=!1===this.conflictResolver.isBlocked(c.id)?"":"isBlocked,",b+=c.isWhitelisted()?"":"isWhitelisted,",b+=!1===c.isBlacklisted()?"":"isBlacklisted,",b+=this.shouldDisplayAdAfterAdBlockRemoval(c)?"":"AdBlockRemoval,",b+=this.shouldDisplayAdMaavaronAfterPayWallBanner(c)?"":"PayWallBanner,",b+=this.doesBreakpointContainAd(c)?"":"Breakpoint,",b+=this.haveValidCookieForSmartphoneapp()?"":"Smartphoneapp,",b+=this.doesUserTypeMatchBannerTargeting(c)?"":"Targeting,",b+=!1===this.user.impressionManager.reachedQuota(c.id)?"":"reachedQuota,",b="
"+a+"
"+b+"
"}else b="id not exist: "+a;return document.write(b),b}},{key:"testShouldSendRequestToDfp",value:function(a){var b=c();b=JSON.stringify(b),b=b.replace(/,/g,"
");var d="
"+b+"
";return document.write(d),d}},{key:"shouldDisplayAdAfterAdBlockRemoval",value:function(a){return!(!0===this.config.adBlockRemoved&&(a.type===B.maavaron||a.type===B.popunder))}},{key:"shouldDisplayAdMaavaronAfterPayWallBanner",value:function(a){var b=!0;if("haaretz"===this.config.site&&a.type===B.maavaron)try{var c=JSON.parse(window.localStorage.getItem("_cobj"));b=!c||c.mc&&c.mc>=12||c.nextslotLocation&&!c.nextslotLocation.includes("pop")}catch(a){console.error("ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner")}return b}},{key:"shouldAppPromotionElementPop",value:function(){return void 0!==window.appPromotionElement&&"function"==typeof window.appPromotionElement.getShouldPop&&window.appPromotionElement.getShouldPop()}},{key:"haveValidCookieForSmartphoneapp",value:function(){return this.config.isValidForsmartPhone}},{key:"doesUserTypeMatchBannerTargeting",value:function(a){var b=c();if("pilosmadar@gmail.com"===b.login)return!0;if(void 0!==b.tmsso&&"pilosmadar@gmail.com"===b.tmsso.userName)return!0;var d=this.user.type;switch("string"==typeof a?a:a.target){case z.all:return!0;case z.nonPaying:return d===A.anonymous||d===A.registered;case z.anonymous:return d===A.anonymous;case z.registered:return d===A.registered;case z.paying:case z.digitalOnly:case z.digitalAndPrint:return d===A.payer;default:return!1}}},{key:"switchedToBreakpoint",value:function(a){if(!a)throw new Error("Missing argument: a call to switchedToBreakpoint must have an breakpoint");var b=0,c=!0,d=!1,e=void 0;try{for(var f,g=this.adSlots.keys()[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value,i=this.adSlots.get(h);!0===i.responsive&&i.lastResolvedWithBreakpoint&&i.lastResolvedWithBreakpoint!==a&&(i.refresh(),b++)}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}return b}},{key:"doesBreakpointContainAd",value:function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g();if(!a)throw new Error("Missing argument: a call to doesBreakpointContainAd must have an adSlot");var c=!0;if(!0===a.responsive){var d=a.responsiveAdSizeMapping[h(b)];if(!1===Array.isArray(d))throw new Error("Invalid argument: breakpoint:"+b+" doesn't exist!",this);c=d.length>0&&!i(d,[[0,0]])}return c}},{key:"initSlotRenderedCallback",value:function(){var a=this;if(!window.googletag||!window.googletag.apiReady)throw new Error("googletag api was not ready when 'initSlotRenderedCallback' was called!");window.googletag.pubads().addEventListener("slotRenderEnded",function(b){var c=b.slot.getAdUnitPath().split("/")[3],d=b.isEmpty,e=b.size;if(a.adSlots.has(c)){var f=a.adSlots.get(c);f.lastResolvedSize=e,f.lastResolvedWithBreakpoint=g(),d?(f.lastResolvedSize=v.EMPTY_SIZE,f.hide(),a.releaseSlotDependencies(f)):a.releaseSlotDependencies(f,f.lastResolvedSize),a.user.impressionManager.registerImpression(""+f.id+a.config.department),a.user.impressionManager.registerImpression(f.id+"_all")}})}},{key:"releaseSlotDependencies",value:function(a){try{var b=a.id;if(this.conflictResolver.updateResolvedSlot(b,a.lastResolvedSize),this.conflictResolver.isBlocking(b)){var c=!0,d=!1,e=void 0;try{for(var f,g=this.conflictResolver.getBlockedSlotsIds(b)[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;this.conflictResolver.isBlocked(h)&&this.adSlots.has(h)&&this.adSlots.get(h).hide()}}catch(a){d=!0,e=a}finally{try{!c&&g.return&&g.return()}finally{if(d)throw e}}var i=!0,j=!1,k=void 0;try{for(var l,m=this.conflictResolver.deferredSlots.keys()[Symbol.iterator]();!(i=(l=m.next()).done);i=!0){var n=l.value,o=this.adSlots.get(n);o&&this.shouldSendRequestToDfp(o)&&(this.conflictResolver.deferredSlots.delete(n),o.deferredSlot&&(o.defineSlot(),o.deferredSlot=!1),o.show())}}catch(a){j=!0,k=a}finally{try{!i&&m.return&&m.return()}finally{if(j)throw k}}}}catch(b){console.error("Cannot updateSlotDependencies for adSlot: "+a.id)}}},{key:"setSsoGroupKey",value:function(){fetch("/ssoGroupKey?value="+this.user.sso.userId,{method:"GET",cache:"no-cache"}).then(function(a){a&&a.json().then(function(a){a&&a.result&&"item not found"!==a.result&&"value is empty"!==a.result&&localStorage.setItem("_SsoGroupKey",a.result)})})}},{key:"initGoogleTargetingParams",value:function(){if(!window.googletag||!window.googletag.apiReady)throw new Error("googletag api was not ready when 'initGoogleTargetingParams' was called!");var a=null;try{a=localStorage.getItem("_SsoGroupKey"),!a&&this.user.sso.userId&&this.setSsoGroupKey()}catch(b){a=null}var b=googletag.pubads();if(this.config.environment&&b.setTargeting("stg",[this.config.environment]),this.user.htz_type&&b.setTargeting("htz_user_type",[this.user.htz_type]),this.user.tm_type&&b.setTargeting("tm_user_type",[this.user.tm_type]),this.user.hdc_type&&b.setTargeting("hdc_user_type",[this.user.hdc_type]),this.config.section&&b.setTargeting("section",[this.config.section]),this.config.sub_section&&b.setTargeting("sub_section",[this.config.sub_section]),this.config.articleId&&(b.setTargeting("articleId",[this.config.articleId]),b.setTargeting("react",["false"])),this.config.gStatCampaignNumber&&-1!==this.config.gStatCampaignNumber&&b.setTargeting("gstat_campaign_id",[this.config.gStatCampaignNumber]),this.config.proposalNumber&&b.setTargeting("proposaltype",[this.config.proposalNumber]),this.config.pageType&&b.setTargeting("pageType",[this.config.pageType]),this.config.isWriterAlerts&&b.setTargeting("WriterAlerts",["true"]),this.config.adBlockRemoved&&b.setTargeting("adblock_removed",[this.config.adBlockRemoved]),this.config.wifiLocation&&b.setTargeting("wifi",[this.config.wifiLocation]),this.config.tags&&Array.isArray(this.config.tags)&&b.setTargeting("tags",[].concat(l(this.config.tags))),this.user.sso&&this.user.sso.userId&&a&&b.setTargeting(a,this.user.sso.userId),this.config.anonymousId){b.setTargeting("anonymousIdKey",this.config.anonymousId)}this.user.country&&b.setTargeting("country",this.user.country);var c=this.getCityNames();c&&b.setTargeting("cityName",[].concat(l(c))),b.setCentering(!0)}},{key:"initGoogleGlobalSettings",value:function(){if(!window.googletag||!window.googletag.apiReady)throw new Error("googletag api wasn't ready when 'initGoogleGlobalSettings' was called!");var a=this.config.googleGlobalSettings;if(window.location.search){var b=window.location.search;b.indexOf("sraon")>0?(console.log("Single Request Mode: active"),a.enableSingleRequest=!0):b.indexOf("sraoff")>0&&(console.log("Single Request Mode: disabled"),a.enableSingleRequest=!1),b.indexOf("asyncrenderingon")>0?(console.log("Async rendering mode: active"),a.enableAsyncRendering=!0):b.indexOf("asyncrenderingonoff")>0&&(console.log("Sync rendering mode: active"),a.enableAsyncRendering=!1)}!0===a.enableSingleRequest&&googletag.pubads().enableSingleRequest(),googletag.enableServices()}},{key:"getCityNames",value:function(){var a=[];return document.querySelectorAll("[data-location-city-name]").forEach(function(b){a.includes(b.dataset.locationCityName)||a.push(b.dataset.locationCityName)}),a.length>0?a:null}}]),a}(),D=o||{},E=250,F=function(){function a(b){j(this,a),this.config=Object.assign({},D,b),this.wasInitialized=!1,this.initStarted=!1,this.breakpoint=g(),this.initWindowResizeListener()}return k(a,[{key:"resumeInit",value:function(){try{this.adManager=this.adManager||new C(this.config)}catch(a){console.error(a)}}},{key:"initGoogleTag",value:function(){var a=this,b=this;return new Promise(function(c,d){!0===b.initStarted?googletag.cmd.push(function(){b.wasInitialized=!0,c(b)}):(b.initStarted=!0,window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],function(){var e=window.document.createElement("script");e.async=!0,e.type="text/javascript",e.setAttribute("src","//www.googletagservices.com/tag/js/gpt.js");var f=window.document.getElementsByTagName("script")[0];e.addEventListener("load",function(){b.resumeInit(),googletag.cmd.push(function(){b.wasInitialized=!0,c(a)})}),e.addEventListener("error",function(a){b.wasInitialized=!1,d(a)}),f.parentNode.insertBefore(e,f)}())})}},{key:"isGoogleTagReady",value:function(){return(!0===this.wasInitialized||window.googletag&&window.googletag.apiReady)&&(this.wasInitialized=!0),this.wasInitialized}},{key:"initWindowResizeListener",value:function(){function a(){var a=g();if(b.breakpoint!==a){if(b.breakpoint=a,!b.adManager)throw new Error("initWindowResizeListener error - adManager instance is not available");b.adManager.refreshAllSlots()}}var b=this,c=f(a,E);window.onresize=c}}]),a}();F.version="2.6.6";var G=o,H=F.version;a.config=G,a.version=H,a.default=F}(this.DFP=this.DFP||{}); //# sourceMappingURL=dfp.min.js.map \ No newline at end of file diff --git a/dist/dfp.min.js.map b/dist/dfp.min.js.map index c9e18a8..0a6d5b6 100644 --- a/dist/dfp.min.js.map +++ b/dist/dfp.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/utils/cookieUtils.js","../src/utils/time.js","../src/utils/breakpoints.js","../src/utils/arrays.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/classCallCheck.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/createClass.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/toConsumableArray.js","../src/globalConfig.js","../src/objects/impressionsManager.js","../src/objects/user.js","../src/objects/conflictResolver.js","../src/objects/adSlot.js","../src/objects/adManager.js","../src/dfp.js","../src/index.js","../src/version.js"],"names":["stringToMap","string","separator","undefined","_ref$separator","operator","_ref$operator","map","split","forEach","element","keyValue","length","decodeURIComponent","e","getCookieAsMap","document","cookie","tmsso","engsso","addHours","date","hours","SyntaxError","isNaN","parseInt","TypeError","result","Date","setHours","getHours","addDays","days","setDate","getDate","debounce","func","wait","arguments","immediate","timeout","context","this","args","later","apply","callNow","setTimeout","getBreakpoint","breakpoint","windowWidth","window","innerWidth","documentElement","clientWidth","body","breakpoints","xs","xxs","s","m","l","xl","xxl","getBreakpointName","resultBreakpoint","arraysEqual","a","b","Array","isArray","i","_classCallCheck","instance","Constructor","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","defineProperty","key","protoProps","staticProps","prototype","_toConsumableArray","arr","arr2","from","ssoKey","location","hostname","indexOf","dfpBaseConf","JSON","parse","getElementById","textContent","err","dfpConfig","Object","assign","referrer","test","navigator","userAgent","pathname","environment","isHomepage","regexMatch","exec","sectionArray","articleId","slice","filter","path","section","index","reduce","last","current","concat","site","env","port","dev","prod","articleIdMatch","pop","getUrlParam","results","RegExp","search","adBlockRemoved","localStorage","getItem","cookieName","cookieMap","anonymousId","wifiLocation","toLowerCase","fairs","validForAds","PageUrl","href","isSmartphoneapp","match","HtzPusr","userName","gstatCampaign","CampaignNumber","type","htmlclassList","querySelector","classList","domain","proposal","googleGlobalSettings","breakpointType","breakpoints1","breakpoints2","breakpoints3","breakpoints4","getTime","globalConfig","breakpointsConfig","keys","impressionManagerConfig","ImpressionsManager","now","config","impressions","retrieveImpressionsData","initImpressionMap","migrateImpressionsData","_this","hasOwnProperty","call","frequency","impressionsData","oldImpressionsArray","impression","adUnitImpression","name","data","tmp","slotId","join","id","exposed","expires","_this2","adSlotId","err1","debouncedSave","saveImpressionsToLocalStorageImpl","setItem","stringify","error","slot","_this3","shouldUpdateExpiryDate","initSlotFromConfig","updateExpiryDate","slotName","Error","frequencyMap","frequencyRegex","setMilliseconds","setSeconds","setMinutes","maxImpressions","saveImpressionsToLocalStorage","department","atQuota","userTypes","productTypes","User","userConfig","sso","getUserType","htz_type","getUserTypeByProduct","htz","tm_type","tm","hdc_type","hdc","impressionManager","ImpressionManager","age","getUserAge","gender","getUserGender","getUserSSO","country","getUserCountry","TmPusr","HdcPusr","payer","registered","anonymous","productType","userType","userProducts","getHdcUserType","getHtzTmUserType","firstName","lastName","guest","userHasProduct","trial","htz_tm","products","product","prodNum","usrae","urgdr","then","resp","json","code","ConflictResolver","conflictManagementConfig","dependencyMap","initializeDependencyMap","deferredSlots","Set","conflictManagementJson","queue","Map","value","rules","item","onsize","avoid","set","resolvedSize","has","get","resolvedWith","isBlocked","_step","Symbol","iterator","_iteratorNormalCompletion","_iterator","next","done","adSlotKey","adSlot","_step2","_iteratorNormalCompletion2","_iterator2","adSlotRule","parentResolvedWith","find","sizeString","size","numberStr","add","return","_iteratorError2","_iteratorError","isBlocking","_step3","_iteratorNormalCompletion3","_iterator3","_iteratorError3","EMPTY_SIZE","hiddenClass","adSlotConfig","responsive","fluid","user","adManager","htmlElement","priority","deferredSlot","network","adUnitBase","adSizeMapping","responsiveAdSizeMapping","blacklistReferrers","whitelistReferrers","lastResolvedSize","lastResolvedWithBreakpoint","defineSlot","isMobile","adTypes","maavaron","popunder","talkback","regular","whitelisted","blacklisted","shown","cmd","push","remove","display","isMaavaron","maavaronSlot","defineMaavaron","shouldSendRequestToDfp","googletag","pubads","defineFn","isOutOfPage","defineOutOfPageSlot","getPath","responsiveSlotSizeMapping","sizeMapping","addSize","build","defineSizeMapping","addService","setCollapseEmptyDiv","event","getAdUnitPath","isEmpty","refresh","_this4","adUnitMaavaronPath","adUnitMaavaronSize","definePassback","setTargeting","adPriorities","adTargets","AdManager","conflictResolver","initGoogleTargetingParams","initGoogleGlobalSettings","initSlotRenderedCallback","currentBreakpointName","adManagerConfig","adSlots","initAdSlots","high","onDomLoaded","normal","log","onWindowLoaded","low","blockingAdSlotKey","delete","showAllDeferredSlots","readyState","addEventListener","show","priorityFilter","values","deferredSlotId","deferredAdSlot","currentBreakpoint","_step4","_iteratorNormalCompletion4","_iterator4","hide","_iteratorError4","_step5","_iteratorNormalCompletion5","_iterator5","_iteratorError5","adUnitName","filteredPriority","adSlotPlaceholders","getElementsByClassName","node","adSlotNodeSet","adSlot$$1","adSlotPriority","computedAdSlotConfig","attributes","all","getAdType","adSlotInstance","AdSlot","isWhitelisted","isBlacklisted","shouldDisplayAdAfterAdBlockRemoval","shouldDisplayAdMaavaronAfterPayWallBanner","doesBreakpointContainAd","haveValidCookieForSmartphoneapp","doesUserTypeMatchBannerTargeting","reachedQuota","res","write","replace","shouldDisplay","paywallBanner","mc","nextslotLocation","includes","isValidForsmartPhone","adSlotOrTarget","login","nonPaying","paying","digitalOnly","digitalAndPrint","count","_step6","_iteratorNormalCompletion6","_iterator6","_iteratorError6","containsBreakpoint","mapping","apiReady","releaseSlotDependencies","registerImpression","updateResolvedSlot","_step7","getBlockedSlotsIds","_iteratorNormalCompletion7","_iterator7","blockedSlot","_iteratorError7","_step8","_iteratorNormalCompletion8","_iterator8","deferredSlotKey","_iteratorError8","userId","SsoGroupKey","setSsoGroupKey","sub_section","gStatCampaignNumber","proposalNumber","pageType","isWriterAlerts","tags","cityNames","getCityNames","setCentering","enableSingleRequest","enableAsyncRendering","enableServices","querySelectorAll","dataset","locationCityName","defaultConfig","resizeTimeout","DFP","wasInitialized","initStarted","initWindowResizeListener","dfpThis","Promise","resolve","reject","tag","createElement","async","setAttribute","getElementsByTagName","resumeInit","parentNode","insertBefore","onResize","refreshAllSlots","debouncedFunction","onresize","version"],"mappings":"yBAgBA,SAASA,GAAYC,uEACjBC,UAAAA,MAAAC,KAAAC,EAAY,IAA4BA,MAAvBC,SAAAA,MAAAF,KAAAG,EAAW,IAC9BA,EAAMC,WACWN,GAAOO,MAAMN,GACrBO,QAAQ,SAAAC,MACQ,gBAAZA,GAAsB,IACzBC,GAAWD,EAAQF,MAAMH,MACP,IAApBM,EAASC,aAELD,EAAS,IAAME,mBAAmBF,EAAS,IAEjD,MAAOG,QAMNP,EAKT,QAAw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DmI,QAEF,MAAAxE,WACEoG,MADUpG,kDAYZ3D,KAAMgc,EAANhc,eACOic,SAAY,SAAAC,EAAAC,IACjB,IAAIH,EAAAF,sBACFpJ,IAAAC,KAAmB,aACjBkJ,gBAAA,IACAG,QAIFF,aAAA,SAEA5I,UAAmBzS,OAAAyS,qBAKnBA,UAAAR,IAAuBjS,OAAAyS,UAAAR,sBAGf0J,GAAM3b,OAAAnC,SAAA+d,cAAZ,YACAC,OAAA,IACAtV,KAAA,oBAEAuV,aAAA,MAAA,gDACMtF,GAAOxW,OAAAnC,SAAAke,qBAAA,UAAb,KACA3G,iBAAA,OAA6B,aAC3B4G,uBACA/J,IAAAC,KAAmB,aACjBkJ,gBAAA,IAEDrT,SAEHqN,iBAAA,QAA8B,SAAA9L,KAC5B8R,gBAAA,IACA9R,OAEF2S,WAAAC,aAAAP,EAAAnF,4DAWF,IAAAjX,KAAA6b,gBAAiCpb,OAAAyS,WAAoBzS,OAAAyS,UAAzDuG,iBACEoC,gBAAA,GAEK7b,KAAP6b,0EAQAe,QACQzG,GAAN7V,OACI0b,EAAAzb,aAAJ4V,EAA8C,MAC5C5V,WAAA4V,GACI6F,EAAJ5K,eAIQ,IAAA9G,OAAN,0EAHA8G,UAAAyL,sBANAb,GAANhc,KAaM8c,EAAoBrd,EAAAmd,EAA1BjB,UACAoB,SAAAD,UCvGJlB,GAAIoB,QCJmB,ODavB,IAAa7U,GAASN,EACTmV,EAAUpB,EAAIoB","file":"dfp.min.js","sourcesContent":["/**\n * Htz-cookie-util\n * @module htzCookieUtil\n * @author Elia Grady elia.grady@haaretz.co.il\n * @license MIT\n */\n\n/**\n * Translates Key-Value string into a convenient map.\n * @param {String} string String in format of \"keyvalue.....\"\n * @param {object} options object for overriding defaults:\n * options.separator is a String or regExp that separates between each key value pairs\n * (default is ';'). options.operator is a String or regExp that separates between each key\n * and value within a pair (default is '=').\n * @returns {object} a map object, with key-value mapping according to the passed configuration.\n */\nfunction stringToMap(string,\n { separator = ';', operator = '=' } = {}) {\n const map = {};\n const itemsArr = string.split(separator);\n itemsArr.forEach(element => {\n if (typeof element === 'string') {\n const keyValue = element.split(operator);\n if (keyValue.length === 2) {\n try {\n map[keyValue[0]] = decodeURIComponent(keyValue[1]);\n }\n catch (e) {\n // Do nothing, malformed URI\n }\n }\n }\n });\n return map;\n}\nexport const ssoKey = window.location.hostname.indexOf('haaretz.com') > -1 ? 'engsso' : 'tmsso';\n\n// Translates Cookie string into a convenient map.\nexport default function getCookieAsMap() {\n const map = stringToMap(document.cookie, { separator: /;\\s?/ });\n if (typeof map.tmsso === 'string') {\n map.tmsso = stringToMap(map.tmsso, { separator: ':' });\n }\n if (typeof map.engsso === 'string') {\n map.engsso = stringToMap(map.engsso, { separator: ':' });\n }\n return map;\n}\n","/**\n * Helper function. Adds N hours to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Number} hours - the amount of hours to add, in whole numbers\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'hours' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given hours\n */\nexport function addHours(date, hours) {\n if (!date) {\n throw new SyntaxError('addHours called without a required \\'date\\' parameter!');\n }\n if (!hours) {\n throw new SyntaxError('addHours called without a required \\'hours\\' parameter!');\n }\n else if (isNaN(parseInt(hours, 10))) {\n throw new TypeError('addHours called with an invalid integer \\'hours\\' parameter!');\n }\n const result = new Date(date);\n result.setHours(result.getHours() + parseInt(hours, 10));\n return result;\n}\n\n/**\n * Helper function. Adds N days to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Integer} days - the amount of days to add\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'days' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given days\n */\nexport function addDays(date, days) {\n if (!date) {\n throw new SyntaxError('addDays called without a required \\'date\\' parameter!');\n }\n if (!days) {\n throw new SyntaxError('addDays called without a required \\'days\\' parameter!');\n }\n else if (isNaN(parseInt(days, 10))) {\n throw new TypeError('addDays called with an invalid integer \\'days\\' parameter!');\n }\n const result = new Date(date);\n result.setDate(result.getDate() + parseInt(days, 10));\n return result;\n}\n","import globalConfig from '../globalConfig';\n\nconst breakpoints = globalConfig.breakpointsConfig.breakpoints;\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param { function } func - the function to run\n * @param { number } wait - the timeout period to avoid running the function\n * @param { boolean } immediate - leading edge modifier\n * @returns {function } the debounced function\n */\nexport function debounce(func, wait = 100, immediate) {\n let timeout;\n return function debounced() {\n const context = this;\n const args = arguments;// eslint-disable-line prefer-rest-params\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @returns {number} the break that the current width represents\n */\nexport function getBreakpoint() {\n let breakpoint;\n const windowWidth = window.innerWidth\n || document.documentElement.clientWidth\n || document.body.clientWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: breakpoint = breakpoints.xxs; break;\n case windowWidth < breakpoints.s: breakpoint = breakpoints.xs; break;\n case windowWidth < breakpoints.m: breakpoint = breakpoints.s; break;\n case windowWidth < breakpoints.l: breakpoint = breakpoints.m; break;\n case windowWidth < breakpoints.xl: breakpoint = breakpoints.l; break;\n case windowWidth < breakpoints.xxl: breakpoint = breakpoints.xl; break;\n default: breakpoint = breakpoints.xxl;\n }\n return breakpoint;\n}\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @param {number} breakpoint - the breakpoint label enumerator that the current width represents\n * (yield with a getBreakpoint() call or passed manually )\n * @returns {string} breakpoint - the breakpoint label that the current width represents,\n * as a string\n */\nexport function getBreakpointName(breakpoint) {\n let resultBreakpoint;\n const windowWidth = breakpoint || window.innerWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: resultBreakpoint = 'xxs'; break;\n case windowWidth < breakpoints.s: resultBreakpoint = 'xs'; break;\n case windowWidth < breakpoints.m: resultBreakpoint = 's'; break;\n case windowWidth < breakpoints.l: resultBreakpoint = 'm'; break;\n case windowWidth < breakpoints.xl: resultBreakpoint = 'l'; break;\n case windowWidth < breakpoints.xxl: resultBreakpoint = 'xl'; break;\n default: resultBreakpoint = 'xxl';\n }\n return resultBreakpoint;\n}\n","/**\n * Checks whether two arrays are equal\n * @param {Array} a - the first array to check\n * @param {Array} b - the second array to check\n * @returns {Boolean} true iff both a and b are arrays, with equal values\n */\nexport function arraysEqual(a, b) {\n if (!a || !b) return false;\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (Array.isArray(a[i]) && Array.isArray(b[i])) {\n if (!arraysEqual(a[i], b[i])) return false;\n }\n else if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\nexport default arraysEqual;\n","export default (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n});","export default (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();","export default (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n});","/* global dfpConfig */\nimport getCookieAsMap, { ssoKey } from './utils/cookieUtils';\n// globalConfig for DFP\nlet dfpBaseConf;\ntry {\n dfpBaseConf = window.JSON.parse(document.getElementById('dfpConfig').textContent);\n}\ncatch (err) {\n dfpBaseConf = window.dfpConfig;\n}\nconst dfpConfig = Object.assign({\n get referrer() {\n return document.referrer ? document.referrer : '';\n },\n get isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n },\n /**\n * Returns true iff the loaded page is the homepage (no inner path)\n * @returns {boolean}\n */\n get isHomepage() {\n return window.location.pathname === '/' || this.environment === 3; // 'prod'\n },\n get department() {\n return this.isHomepage ? '_homepage' : '_section';\n },\n /**\n * returns the domain the page was loaded to. i.e: 'haaretz.co.il', 'haaretz.com'\n * @returns {string} the domain name from the windows's location hostname property\n */\n get domain() {\n const regexMatch = /([\\d|\\w]+)(\\.co\\.il|\\.com)(.*)?/.exec(window.location.hostname);\n const result = regexMatch ? regexMatch[0] : window.location.hostname;\n return result;\n },\n /**\n * Returns an array of concatenated paths, separated by a dot.\n * For example, for the URL:\n * http://www.haaretz.co.il/news/world/america/us-election-2016/LIVE-1.2869045\n * the path is '/news/world/america/us-election-2016/LIVE-1.2869045'.\n * This function takes the directories ['news', 'world', 'america', 'us-election-2016']\n * and converts it to the following format:\n * ['.news', '.news.world', '.news.world.america', '.news.world.america.us-election-2016']\n * This denotes the path configuration for the given adSlot\n * non articles (sections) will be given a '0' - no articleId value for targeting purposes)\n * @returns {Array.} an array of path names\n */\n get path() {\n let sectionArray = this.articleId && this.articleId !== '0' ?\n window.location.pathname.split('/').slice(1, -1) :\n window.location.pathname.split('/').slice(1);\n sectionArray = sectionArray.filter(path =>\n path !== 'wwwMobileSite' && path !== 'whtzMobileSite');\n return sectionArray\n .map(section => `.${section}`)\n .map((section, index, arr) => arr.slice(0, index + 1)\n .reduce((last, current) => last.concat(current)));\n },\n /**\n * Returns a string representation for the name of the site\n * @return {*|string}\n */\n get site() {\n let site;\n if (window.location.hostname.indexOf('haaretz.co.il') > -1) {\n site = 'haaretz';\n }\n else if (window.location.hostname.indexOf('themarker.com') > -1) {\n site = 'themarker';\n }\n else if (window.location.hostname.indexOf('mouse.co.il') > -1) {\n site = 'mouse';\n }\n return site || 'haaretz';\n },\n /**\n * Returns the current environment targeting param, if such is defined.\n * @returns {number} targeting param, 1 for local development, 2 for test servers and 3 for prod.\n * May return undefined if no targeting is specified.\n */\n get environment() {\n const env = {\n dev: 1,\n test: 2,\n prod: 3,\n };\n return window.location.port === '8080' ? env.dev :\n (window.location.hostname.indexOf('pre.haaretz.co.il') > -1\n || window.location.hostname.indexOf('tmtest.themarker.com') > -1\n || window.location.hostname.indexOf('pre.haaretz.com') > -1\n || window.location.hostname.indexOf('prodmouse.mouse.co.il') > -1) ? env.test :\n (window.location.pathname.indexOf('/cmlink/Haaretz.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/TheMarker.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/Mouse.HomePage') > -1)\n ? env.prod : undefined;\n },\n /**\n * Returns the articleIf if on an article page, or null otherwise\n * @returns {string} an articleId string from the pathname, or 0 if not found\n */\n get articleId() {\n const articleIdMatch = /\\d\\.\\d+/g.exec(window.location.pathname);\n let articleId = '0';\n if (articleIdMatch) {\n articleId = articleIdMatch.pop(); // Converts [\"1.23145\"] to \"1.23145\"\n }\n return articleId;\n },\n utm_: {\n get content() {\n return this.getUrlParam('utm_content');\n },\n get source() {\n return this.getUrlParam('utm_source');\n },\n get medium() {\n return this.getUrlParam('utm_medium');\n },\n get campaign() {\n return this.getUrlParam('utm_campaign');\n },\n getUrlParam(key) {\n const results = RegExp(`(${key})(=)([^&\"]+)`).exec(window.location.search);\n return results && results[3] ? results[3] : undefined;\n },\n },\n get adBlockRemoved() {\n let adBlockRemoved = false;\n try {\n if (localStorage.getItem('adblock_removed')) {\n adBlockRemoved = true;\n }\n }\n catch (err) {\n // do nothing\n }\n return adBlockRemoved;\n },\n get ssoGroupKey() {\n return window.localStorage.getItem('_SsoGroupKey');\n },\n get anonymousId() {\n const cookieName = 'anonymousId';\n const cookieMap = getCookieAsMap();\n let anonymousId = '';\n if (cookieMap && cookieMap[cookieName]) {\n anonymousId = cookieMap[cookieName];\n }\n return anonymousId;\n },\n get isWriterAlerts() {\n return (location.search.indexOf('writerAlerts=true') > -1);\n },\n get wifiLocation() {\n let wifiLocation;\n const cookieName = '_htzwif'; // eslint-disable-line no-underscore-dangle\n const cookieMap = getCookieAsMap();\n try {\n if (cookieMap && cookieMap[cookieName]) {\n if (cookieMap[cookieName].toLowerCase() === 'arcaffe') {\n wifiLocation = 'ArCafe';\n }\n if (cookieMap[cookieName].toLowerCase() === 'university') {\n wifiLocation = 'university';\n }\n }\n if (cookieMap && cookieMap.fairs) {\n wifiLocation = 'fairs';\n }\n }\n catch (err) {\n // do nothing\n }\n return wifiLocation;\n },\n get isValidForsmartPhone() {\n let validForAds = true;\n const PageUrl = window.location.href;\n const isSmartphoneapp = PageUrl.match('haaretzsmartphoneapp');\n const cookieMap = getCookieAsMap();\n try {\n if (isSmartphoneapp) {\n // eslint-disable-line no-underscore-dangle\n if (cookieMap && cookieMap.HtzPusr &&\n (cookieMap.tmsso === undefined || cookieMap.tmsso.userName !== 'pilosmadar@gmail.com')) {\n validForAds = false;\n }\n }\n }\n catch (err) {\n // do nothing\n }\n return validForAds;\n },\n get gStatCampaignNumber() {\n let gstatCampaign;\n try {\n gstatCampaign = localStorage.getItem('GstatCampaign') ?\n JSON.parse(localStorage.getItem('GstatCampaign')) : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n gstatCampaign = undefined;\n }\n return gstatCampaign ? gstatCampaign.CampaignNumber : undefined;\n },\n get pageType() {\n let type = '';\n try {\n const htmlclassList = document.querySelector('html').classList;\n switch (true) {\n case /mouse_location/.test(htmlclassList):\n type = 'mouse_location';\n break;\n case /mouse_event/.test(htmlclassList):\n type = 'mouse_event';\n break;\n case /contentType-story/.test(htmlclassList):\n type = 'mouse_article';\n break;\n default:\n if (this.articleId !== '0') {\n switch (this.domain) {\n case 'haaretz.co.il':\n type = 'htz_article';\n break;\n case 'haaretz.com':\n type = 'hdc_article';\n break;\n case 'themarker.com':\n type = 'tm_article';\n break;\n default:\n type = '';\n }\n }\n else {\n type = '';\n }\n }\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n type = '';\n }\n return type;\n },\n get proposalNumber() {\n let proposal;\n try {\n proposal = localStorage.getItem('proposaltype') ?\n localStorage.getItem('proposaltype') : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n proposal = undefined;\n }\n return proposal;\n },\n adSlotConfig: {\n 'haaretz.co.il.example.slot': {\n id: 'slotId',\n // path : \"/network/base/slotId/slotId_subsection\", Will be calculated from AdManager\n responsive: true,\n adSizeMapping: [['width1', 'height1'], ...['widthN', 'heightN']],\n priority: 'normal',\n fluid: false,\n responsiveAdSizeMapping: {\n xxs: [['width1', 'height1'], ...['widthN', 'heightN']],\n xs: [['width1', 'height1'], ...['widthN', 'heightN']],\n s: [['width1', 'height1'], ...['widthN', 'heightN']],\n m: [['width1', 'height1'], ...['widthN', 'heightN']],\n l: [['width1', 'height1'], ...['widthN', 'heightN']],\n xl: [['width1', 'height1'], ...['widthN', 'heightN']],\n xxl: [['width1', 'height1'], ...['widthN', 'heightN']],\n },\n blacklistReferrers: 'comma, delimited, blacklisted, referrer, list',\n whitelistReferrers: 'comma, delimited, referrer, list',\n },\n },\n adManagerConfig: {\n network: '9401',\n adUnitBase: 'haaretz.co.il_Web',\n },\n breakpointsConfig: {\n get breakpoints() {\n // Override in VM from backend to control this toggle.\n let breakpoints;\n switch (dfpConfig.googleGlobalSettings.breakpointType) {\n case 'type1': breakpoints = this.breakpoints1; break;\n case 'type2': breakpoints = this.breakpoints2; break;\n case 'type3': breakpoints = this.breakpoints3; break;\n case 'type4': breakpoints = this.breakpoints4; break;\n default: breakpoints = this.breakpoints1;\n }\n return breakpoints;\n },\n // Type 1\n breakpoints1: {\n xxs: 600,\n xs: 761,\n s: 993,\n m: 1009,\n l: 1291,\n xl: 1600,\n xxl: 1900,\n },\n // Type 2\n breakpoints2: {\n xxs: 600,\n xs: 1000,\n s: 1150,\n m: 1281,\n l: 1600,\n xl: 1920,\n xxl: 1920,\n },\n // Type 3\n breakpoints3: {\n xxs: 100,\n xs: 480,\n s: 600,\n m: 768,\n l: 1024,\n xl: 1280,\n xxl: 1900,\n },\n // Type 4\n breakpoints4: {\n xxs: 600,\n xs: 768,\n s: 1024,\n m: 1280,\n l: 1900,\n xl: 1900,\n xxl: 1900,\n },\n },\n userConfig: {\n type: undefined,\n age: undefined,\n gender: undefined,\n },\n conflictManagementConfig: {\n 'blocking.ad.unit.name': [\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n ],\n },\n impressionManagerConfig: {\n 'ad.unit.name': {\n target: 'all|section|homepage',\n frequency: '$1/$2(day|hour)',\n exposed: 0,\n expires: (new Date()).getTime(),\n },\n },\n googleGlobalSettings: {\n enableSingleRequest: true,\n enableAsyncRendering: true,\n refreshIntervalTime: 1000,\n breakpointType: 'type1',\n },\n sso: ssoKey,\n\n}, dfpBaseConf);\n\nexport default dfpConfig;\n","import globalConfig from '../globalConfig';\nimport { addHours, addDays } from '../utils/time';\nimport { debounce } from '../utils/breakpoints';\n\nexport const keys = {\n impressions: 'impressions',\n frequency: 'frequency',\n /**\n * [0] - full match\n * [1] - impression count i.e: \"1\" | \"22\"\n * [2] - impression expiry range quantifier i.e: \"1\" | \"22\"\n * [3] - impression expiry range unit i.e: \"day\" | \"hour\"\n */\n frequencyRegex: /(\\d+)\\/(\\d+)(day|hour)/,\n expires: 'expires',\n exposed: 'exposed',\n target: 'target',\n maxImpressions: 'maxImpressions',\n hours: 'hour',\n days: 'day',\n adSlotId: 'id',\n};\n\nexport default class ImpressionsManager {\n\n constructor(impressionManagerConfig) {\n this.now = (new Date()).getTime(); // this date is used for comparisons only\n this.config = Object.assign({}, impressionManagerConfig);\n this.impressions = this.retrieveImpressionsData();\n this.initImpressionMap();\n }\n\n retrieveImpressionsData() {\n const impressions = this.migrateImpressionsData();\n /*\n Merge migrated data with new data\n console.log('Migrated: ',impressions);\n */\n Object.keys(impressions).map((key, index) => {\n impressions[key] = Object.assign({}, impressions[key], this.config[key]);\n return this;\n });\n /*\n console.log('Merged: ',impressions);\n Filter out entries without frequency\n */\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (!impressions[key][keys.frequency]) {\n // console.log(`Removing ${key} - since it does not have a frequency`,impressions[key]);\n delete impressions[key];\n }\n }\n }\n // console.log('Filtered: ',impressions);\n return impressions;\n }\n\n migrateImpressionsData() {\n let impressions;\n let impressionsData;\n try {\n impressionsData = window.localStorage.getItem(keys.impressions);\n }\n catch (err) {\n // In case of thrown 'SecurityError' or 'QuotaExceededError', the variable should be undefined\n impressionsData = undefined;\n }\n try {\n impressions = JSON.parse(impressionsData);\n }\n catch (err) {\n // Here is where old impression data is converted to new format\n impressions = {};\n const oldImpressionsArray = impressionsData.split(';').filter(e => e);\n\n oldImpressionsArray.forEach((impression) => {\n try {\n const adUnitImpression = impression.split(' = ');\n const name = adUnitImpression[0];\n const data = adUnitImpression[1];\n const tmp = name.split('.');\n let target = tmp.pop();\n if (target && target === 'hp') {\n target = 'homepage';\n }\n const slotId = tmp.join('.');\n const id = `${slotId}_${target}`;\n const exposed = parseInt(data.split('/')[0], 10) || 0;\n const expires = parseInt(data.split('/')[1], 10) || this.now;\n impressions[id] = {};\n impressions[id][keys.adSlotId] = slotId;\n impressions[id][keys.target] = target;\n impressions[id][keys.exposed] = exposed;\n impressions[id][keys.expires] = expires;\n }\n catch (err1) {\n // console.log(`Failed converting impression: ${impression}`, err1);\n }\n });\n }\n return impressions || {};\n }\n\n /**\n * Define the debounced version of the local storage save\n */\n saveImpressionsToLocalStorage() {\n if (this.debouncedSave && typeof this.debouncedSave === 'function') {\n this.debouncedSave();\n }\n else {\n this.debouncedSave = debounce(this.saveImpressionsToLocalStorageImpl, 250, false);\n this.debouncedSave();\n }\n }\n\n /**\n * Implementation of saving the impression map to localstorage\n */\n saveImpressionsToLocalStorageImpl() {\n try {\n localStorage.setItem(keys.impressions, JSON.stringify(this.impressions));\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the operation should not break*/\n console.error('localStorage isn\\'t available:', err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Initializes the impression map based on the retrieved impressions and the global\n * configuration.\n */\n initImpressionMap() {\n Object.keys(this.config).map((key, index) => {\n const adSlotId = key;\n const slot = this.impressions[adSlotId];\n let shouldUpdateExpiryDate = false;\n // Case I: Existing slot (update)\n if (slot) {\n // Case I.I Existing slot, frequency has changed\n if (this.config[adSlotId][keys.frequency] !== slot[keys.frequency]) {\n // Updating the frequency will trigger a new expiry date\n shouldUpdateExpiryDate = true;\n this.impressions[adSlotId][keys.frequency] = this.config[adSlotId][keys.frequency];\n } // Case I.II Existing slot, old expiry date\n else if (this.now > slot[keys.expires]) {\n // Old value that should trigger a new expiry date\n shouldUpdateExpiryDate = true;\n }\n } // Case II: Non-existing slot (create new slot)\n else {\n this.initSlotFromConfig(adSlotId);\n } // Finally, updates the expiry date (cases I.I and I.II)\n if (shouldUpdateExpiryDate) {\n this.updateExpiryDate(adSlotId);\n }\n return this;\n });\n }\n\n /**\n * Updates the expiry date of a slotName based on the configured slot frequency\n * @param {String} slotName - the slotName to update.\n */\n updateExpiryDate(slotName) {\n const now = new Date();\n if (!(this.impressions[slotName] && this.impressions[slotName][keys.frequency])) {\n throw new Error(`Unable to update expiry date for slot: ${slotName}\n - this.impressions[slotName]:`, this.impressions[slotName]);\n }\n const frequencyMap = this.impressions[slotName][keys.frequency].match(keys.frequencyRegex);\n now.setMilliseconds(0);\n now.setSeconds(0);\n now.setMinutes(0);\n if (frequencyMap.indexOf(keys.days) > -1) {\n now.setHours(0);\n }\n this.impressions[slotName][keys.expires] = (frequencyMap.indexOf(keys.days) > -1 ?\n addDays(now, frequencyMap[2]) : addHours(now, frequencyMap[2])).getTime();\n\n // Set max impressions:\n this.impressions[slotName][keys.maxImpressions] = parseInt(frequencyMap[1], 10);\n // Reset exposed\n this.impressions[slotName][keys.exposed] = 0;\n }\n\n /**\n * Initializes a non-existing slot from the passed global configuration for the slot\n * @param {String} slotName - the name of the slot to create\n */\n initSlotFromConfig(slotName) {\n const slot = this.impressions[slotName] || {};\n slot[keys.frequency] = this.config[slotName][keys.frequency];\n slot[keys.target] = this.config[slotName][keys.target];\n slot[keys.exposed] = 0;\n this.impressions[slotName] = slot;\n this.updateExpiryDate(slotName);\n }\n\n /**\n * Registers an impression for a given adSlot.\n * @param {String} adSlotId - the adSlot id to register an impression for\n * @returns {boolean} returns true iff the impression has been registered\n */\n registerImpression(adSlotId) {\n if (adSlotId) {\n const slot = this.impressions[adSlotId];\n if (slot) {\n const exposed = slot[keys.exposed];\n if (isNaN(parseInt(exposed, 10)) === false) {\n this.impressions[adSlotId][keys.exposed] += 1;\n try {\n this.saveImpressionsToLocalStorage();\n }\n catch (err) {\n // console.log('Error saving ad impressions to localStorage!', err);\n }\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Checks whether an adSlot has reached it's allocated impressions count.\n * @param {String} adSlotId - the adSlot to check\n * @returns {boolean} true iff there is a quota for the adSlot, and it has been reached\n */\n reachedQuota(adSlotId) {\n // An adSlotId is suffixed with _homepage | _section if it's targeting is different\n // between the two. If there is no difference, an _all suffix can be used.\n const slotName = this.impressions[`${adSlotId}${globalConfig.department}`] ?\n `${adSlotId}${globalConfig.department}` : `${adSlotId}_all`;\n\n const slot = this.impressions[slotName];\n let atQuota = false;\n if (slot) {\n const now = (new Date()).getTime();\n // Second element of 2/4day matches '2'\n const expires = this.impressions[slotName][keys.expires];\n if (expires < now) {\n this.updateExpiryDate(slotName);\n }\n else {\n const maxImpressions = this.impressions[slotName][keys.maxImpressions];\n // Not expired, did reach max impressions?\n if (maxImpressions) {\n atQuota = this.impressions[slotName][keys.exposed] >= maxImpressions;\n }\n }\n }\n return atQuota;\n }\n\n\n /**\n * Clears the impression map from 'exposed' impressions\n */\n resetImpressions() {\n const impressions = this.impressions;\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (impressions[key][keys.exposed]) {\n impressions[key][keys.exposed] = 0;\n }\n }\n }\n this.saveImpressionsToLocalStorage();\n }\n}\n","import getCookieAsMap from '../utils/cookieUtils';\nimport ImpressionManager from './impressionsManager';\nimport globalConfig from '../globalConfig';\n\nexport const userTypes = {\n payer: 'payer',\n registered: 'registered',\n anonymous: 'anonymous',\n trial: 'trial',\n guest: 'reg_guest',\n};\n\nexport const productTypes = {\n htz: 243,\n tm: 273,\n hdc: 239,\n htz_tm: 274,\n};\n\nexport default class User {\n constructor(config) {\n this.config = Object.assign({}, config.userConfig);\n const cookieMap = getCookieAsMap();\n this.ssoKey = globalConfig.sso;\n if (!cookieMap[this.ssoKey]) {\n // Flips the ssoKey, since cookieMap.ssoKey cannot be used to retrieve data\n this.ssoKey = this.ssoKey === 'tmsso' ? 'engsso' : 'tmsso';\n }\n this.type = this.getUserType(cookieMap);\n this.htz_type = this.getUserTypeByProduct(cookieMap, productTypes.htz, 'tmsso');\n this.tm_type = this.getUserTypeByProduct(cookieMap, productTypes.tm, 'tmsso');\n this.hdc_type = this.getUserTypeByProduct(cookieMap, productTypes.hdc, 'engsso');\n this.impressionManager = new ImpressionManager(config.impressionManagerConfig);\n this.age = this.getUserAge(cookieMap);\n this.gender = this.getUserGender(cookieMap);\n this.sso = this.getUserSSO(cookieMap, this.ssoKey);\n this.country = this.getUserCountry();\n }\n\n getUserType(cookieMap) {\n let userType;\n if (cookieMap && cookieMap[this.ssoKey]) {\n userType = (cookieMap.HtzPusr || cookieMap.TmPusr || cookieMap.HdcPusr) ?\n userTypes.payer : userTypes.registered;\n }\n else {\n userType = userTypes.anonymous;\n }\n return userType;\n }\n\n\n getUserTypeByProduct(cookieMap, productType, ssoKey) {\n let userType = userTypes.anonymous;\n if (cookieMap && cookieMap[ssoKey]) {\n if (cookieMap.userProducts) {\n let userProducts = decodeURIComponent(cookieMap.userProducts);\n userProducts = JSON.parse(userProducts);\n if (productType === productTypes.hdc) {\n userType = this.getHdcUserType(userProducts);\n }\n else {\n userType = this.getHtzTmUserType(userProducts, productType);\n }\n if (userType === userTypes.registered &&\n cookieMap[ssoKey].firstName === 'guest' &&\n cookieMap[ssoKey].lastName === 'guest') {\n userType = userTypes.guest;\n }\n }\n }\n return userType;\n }\n\n getHdcUserType(userProducts) {\n // user has hdc paying product\n if (this.userHasProduct(userProducts, productTypes.hdc, false)) {\n return userTypes.payer;\n }\n // user has hdc trial product\n else if (this.userHasProduct(userProducts, productTypes.hdc, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n getHtzTmUserType(userProducts, productType) {\n // user has htz/tm paying product\n if (this.userHasProduct(userProducts, productType, false) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, false)) {\n return userTypes.payer;\n }\n // user has htz/tm trial product\n else if (this.userHasProduct(userProducts, productType, true) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n userHasProduct(userProducts, productType, trial) {\n return userProducts.products\n .filter(product => product.prodNum === productType && product.trial === trial)\n .length > 0;\n }\n\n getUserAge(cookieMap) {\n let age;\n const usrae = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].usrae;\n if (usrae) {\n age = parseInt(cookieMap[this.ssoKey].usrae, 10);\n age = age > 0 ? age : undefined;\n }\n return age;\n }\n\n getUserGender(cookieMap) {\n let gender;\n const urgdr = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].urgdr;\n if (urgdr) {\n gender = parseInt(cookieMap[this.ssoKey].urgdr, 10);\n gender = gender === 2 || gender === 1 ? gender : undefined;\n }\n return gender;\n }\n\n getUserSSO(cookieMap, ssoKey) {\n return cookieMap[ssoKey];\n }\n\n getUserCountry() {\n const country = window.localStorage.getItem('country');\n if (!country) {\n fetch('https://ms-apps.haaretz.co.il/ms-ip2country/get', {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/jsonp',\n },\n }).then(resp => resp.json())\n .then(data => {\n window.localStorage.setItem('country', data.code);\n },\n err => {}\n );\n return null;\n }\n return country;\n }\n\n}\n","class ConflictResolver {\n constructor(conflictManagementConfig) {\n this.dependencyMap = this.initializeDependencyMap(conflictManagementConfig);\n this.deferredSlots = new Set();\n }\n initializeDependencyMap(conflictManagementJson) {\n const queue = new Map();\n Object.keys(conflictManagementJson).map((key, value) => {\n let rules = conflictManagementJson[key];\n if (rules) {\n rules = rules.filter((item) => item.onsize && item.avoid);\n }\n queue.set(key, {\n id: key,\n rules,\n resolvedWith: null,\n });\n return this;\n });\n return queue;\n }\n\n updateResolvedSlot(adSlotId, resolvedSize) {\n if (!adSlotId) {\n throw new Error('updateResolvedSlot must be called with an adSlotId!');\n }\n if (!resolvedSize) {\n throw new Error('updateResolvedSlot must be called with a resolved size!');\n }\n if (this.dependencyMap.has(adSlotId)) {\n this.dependencyMap.get(adSlotId).resolvedWith = resolvedSize;\n }\n }\n\n\n isBlocked(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocked must be called with an adSlotId!');\n }\n let isBlocked = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n const adSlot = this.dependencyMap.get(adSlotKey);\n for (const adSlotRule of adSlot.rules) {\n // Found rule specific to our target\n if (adSlotRule.avoid === adSlotId) {\n const parentResolvedWith = adSlot.resolvedWith;\n if (parentResolvedWith && adSlotRule.onsize.split(',').find(sizeString => { // eslint-disable-line\n const size = sizeString.split('x').map(numberStr => parseInt(numberStr, 10));\n return this.arraysEqual(size, parentResolvedWith);\n })) {\n // Block found\n this.deferredSlots.add(adSlotId);\n isBlocked = true;\n }\n }\n }\n }\n return isBlocked;\n }\n\n isBlocking(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocking must be called with an adSlotId!');\n }\n let isBlocking = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n if (adSlotKey === adSlotId) {\n isBlocking = true;\n }\n }\n return isBlocking;\n }\n\n /**\n * Gets an array of adSlot Ids for a given adSlotId, that are dependent on (blocked by)\n * @param {String} adSlotId - the blocking slot id\n * @return {Array} an array of blocked slot, that has a dependency on the given slot\n */\n getBlockedSlotsIds(adSlotId) {\n let result;\n if (this.dependencyMap.has(adSlotId)) {\n result = Array.from(this.dependencyMap.get(adSlotId).rules.map(adSlot => adSlot.avoid));\n }\n return result || [];\n }\n\n arraysEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n}\nConflictResolver.EMPTY_SIZE = [];\nexport default ConflictResolver;\n","/* global googletag */\nimport { adTypes } from '../objects/adManager';\nimport globalConfig from '../globalConfig';\nimport { arraysEqual } from '../utils/arrays';\n\nconst hiddenClass = globalConfig.site.indexOf('mouse') > -1 ? 'u-is-hidden' : 'h-hidden';\n\nexport default class adSlot {\n\n constructor(adSlotConfig) {\n this.config = Object.assign({}, adSlotConfig);\n\n // Part I : Markup configuration - passed from AdManager\n this.id = this.config.id;\n if (!this.config.id) {\n throw new Error('an adSlot requires an id!');\n }\n this.target = this.config.target;\n this.type = this.config.type;\n this.responsive = this.config.responsive;\n this.fluid = this.config.fluid;\n this.user = this.config.user;\n this.adManager = this.config.adManager;\n this.htmlElement = this.config.htmlElement;\n this.priority = this.config.priority;\n this.deferredSlot = this.config.deferredSlot;\n\n // Part II : Global, general ad configuration - passed from AdManager\n this.department = this.config.department;\n this.network = this.config.network;\n this.adUnitBase = this.config.adUnitBase;\n\n // Part III : ad specific configuration - passed from globalConfig.adSlotConfig\n this.adSizeMapping = this.config.adSizeMapping;\n this.responsiveAdSizeMapping = this.config.responsiveAdSizeMapping;\n this.blacklistReferrers = this.config.blacklistReferrers ?\n this.config.blacklistReferrers.split(',') : [];\n this.whitelistReferrers = this.config.whitelistReferrers ?\n this.config.whitelistReferrers.split(',') : [];\n\n\n // Part IV : Runtime configuration - calculated data - only present in runtime\n this.lastResolvedSize = undefined; // Initialized in 'slotRenderEnded' callback\n this.lastResolvedWithBreakpoint = undefined; // Initialized in 'slotRenderEnded' callback\n this.slot = undefined; // Holds a googletag.Slot object\n // [https://developers.google.com/doubleclick-gpt/reference#googletag.Slot]\n try {\n if (!this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Checks whether this adSlot is an 'Out-of-page' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isOutOfPage() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n case adTypes.popunder: return true;\n case adTypes.talkback: return false;\n case adTypes.regular: return false;\n default: return false;\n }\n }\n\n /**\n * Checks whether this adSlot is a 'maavaron' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isMaavaron() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n default: return false;\n }\n }\n\n isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n }\n /**\n * Checks whether or not this adSlot has a non-empty whitelist, and if so, that the current\n * referrer appears in the whitelist.\n * Should return false iff there is a whitelist for the current adSlot, but the referrer is not\n * mentioned in the whitelist.\n * @returns {boolean} true iff the ad can be displayed.\n */\n isWhitelisted() {\n let whitelisted = false;\n if (this.whitelistReferrers.length !== 0) {\n for (const referrer of this.whitelistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n whitelisted = true;\n break;\n }\n }\n }\n else {\n whitelisted = true;\n }\n return whitelisted;\n }\n\n /**\n * Checks whether or not this adSlot has a non-empty blacklist, and if so, that the current\n * referrer does not appear in the blacklist.\n * Should return true iff there is a blacklist for the current adSlot, and the referrer is\n * mentioned in the blacklist - to indicate that the adSlot is 'blocked'.\n * @returns {boolean} true iff the ad cannot be displayed.\n */\n isBlacklisted() {\n let blacklisted = false;\n if (this.blacklistReferrers.length !== 0) {\n for (const referrer of this.blacklistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n blacklisted = true;\n break;\n }\n }\n }\n return blacklisted;\n }\n\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n show() {\n if (!this.shown === true) {\n this.shown = true; // Ensure show will be called once per adSlot\n googletag.cmd.push(() => {\n if (this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n // console.log('calling show for slot',this.id,' called @',window.performance.now());\n document.getElementById(this.id).classList.remove(hiddenClass);\n googletag.display(this.id);\n });\n }\n }\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n hide() {\n googletag.cmd.push(() => {\n document.getElementById(this.id).classList.add(hiddenClass);\n });\n }\n\n /**\n * Initializes page-level slot definition for the current slot\n * @return {Slot} slot - the Google Slot that was defined from this AdSlot configuration\n */\n defineSlot() {\n if (this.isMaavaron()) {\n const maavaronSlot = this.defineMaavaron();\n if (this.adManager.shouldSendRequestToDfp(this)) {\n if (!this.shown) {\n this.shown = true; // Ensure show will be called once\n maavaronSlot.display();\n }\n }\n return maavaronSlot;\n }\n const googletag = window.googletag;\n const pubads = googletag.pubads();\n const args = [];\n const defineFn = this.isOutOfPage() ? googletag.defineOutOfPageSlot : googletag.defineSlot;\n // 3 or 2 params according to the function that we want to activate.\n args.push(this.getPath());\n if (this.isOutOfPage() === false) {\n if (this.fluid) {\n args.push('fluid');\n }\n else {\n args.push(this.adSizeMapping);\n }\n }\n args.push(this.id);\n let slot = defineFn.apply(defineFn, args);\n if (slot) {\n // Responsive size Mapping\n if (this.responsive) {\n let responsiveSlotSizeMapping = googletag.sizeMapping();\n const breakpoints = globalConfig.breakpointsConfig.breakpoints;\n const keys = Object.keys(this.responsiveAdSizeMapping);\n for (const key of keys) { // ['xxs','xs',...]\n responsiveSlotSizeMapping.addSize(\n [breakpoints[key], 100], // 100 is a default height, since it is height agnostic\n !arraysEqual(this.responsiveAdSizeMapping[key], [[0, 0]]) ?\n this.responsiveAdSizeMapping[key] : []);\n }\n responsiveSlotSizeMapping = responsiveSlotSizeMapping.build();\n slot = slot.defineSizeMapping(responsiveSlotSizeMapping);\n }\n slot = slot.addService(pubads);\n if (this.isOutOfPage() === false) {\n slot.setCollapseEmptyDiv(true);\n }\n }\n return slot;\n }\n\n /**\n * Returns the current path calculated for the adSlot\n * @returns {String} a formatted string that represent the path for the slot definition\n */\n getPath() {\n /* eslint-disable no-shadow */\n let path = globalConfig.path || [];\n path = path.filter(path => path !== '.');\n path = path.map(section => `${this.id}${this.department}${section}`).join('/');\n // If a path exist, it will be preceded with a forward slash\n path = path && this.config.department !== '_homepage' ? `/${path}` : '';\n /* eslint-enable no-shadow */\n const calculatedPath = `/${this.config.network}/${this.config.adUnitBase}/${this.id}/${this.id}${this.department}${path}`; // eslint-disable-line max-len\n return calculatedPath.toLowerCase();\n }\n\n /* eslint-disable */\n slotRendered(event) {\n const id = event.slot.getAdUnitPath().split('/')[3]; // Convention: [0]/[1]network/[2]base/[3]id\n const isEmpty = event.isEmpty; // Did the ad return as empty?\n const resolvedSize = event.size; // What 'creative' size did the ad return with?\n // Empty or onload callback should be called next?\n }\n /* eslint-enable */\n\n /**\n * Refresh this adSlot\n */\n refresh() {\n googletag.cmd.push(() => {\n googletag.pubads().refresh([this.slot]);\n });\n }\n\n /**\n * Shows 'Maavaron' type adSlot using Passback definition\n * @return {Slot} slot - the Google Slot that was defined for Maavaron\n */\n defineMaavaron() {\n if (!document.referrer.match('loc.haaretz')) {\n const adUnitMaavaronPath = this.getPath();\n const adUnitMaavaronSize = [\n [2, 1],\n ];\n const slot = googletag.pubads().definePassback(adUnitMaavaronPath, adUnitMaavaronSize)\n .setTargeting('UserType', [this.user.type])\n .setTargeting('age', [this.user.age])\n .setTargeting('urgdr', [this.user.gender])\n .setTargeting('articleId', [globalConfig.articleId])\n .setTargeting('stg', [globalConfig.environment]);\n return slot;\n }\n return null;\n }\n}\n","/* global googletag */\nimport User from '../objects/user';\nimport ConflictResolver from '../objects/conflictResolver';\nimport AdSlot from '../objects/adSlot';\nimport { getBreakpoint, getBreakpointName } from '../utils/breakpoints';\nimport { arraysEqual } from '../utils/arrays';\nimport getCookieAsMap from '../utils/cookieUtils';\n\n// There are a total of 7 adTargets:\n// \"all\",\"nonPaying\",\"anonymous\",\"registered\",\"paying\",\"digitalOnly\" and \"digitalAndPrint\"\nexport const adPriorities = {\n high: 'high',\n normal: 'normal',\n low: 'low',\n};\n\nexport const adTargets = {\n all: 'all',\n nonPaying: 'nonPaying',\n anonymous: 'anonymous',\n registered: 'registered',\n paying: 'paying',\n digitalOnly: 'digitalOnly',\n digitalAndPrint: 'digitalAndPrint',\n};\n\n// There are a total of 3 userTypes: \"anonymous\", \"registered\" and \"payer\"\nexport const userTypes = {\n anonymous: 'anonymous',\n registered: 'registered',\n payer: 'payer',\n};\n\nexport const adTypes = {\n maavaron: '.maavaron',\n popunder: '.popunder',\n talkback: '.talkback',\n regular: '',\n};\n\n\nexport default class AdManager {\n\n constructor(config) {\n this.config = Object.assign({}, config);\n this.user = new User(config);\n this.conflictResolver = new ConflictResolver(config.conflictManagementConfig);\n /**\n * Avoid race conditions by making sure to respect the usual timing of GPT.\n * This DFP implementation uses Enable-Define-Display:\n * Define page-level settings\n * enableServices()\n * Define slots\n * Display slots\n */\n try {\n googletag.cmd.push(() => {\n this.initGoogleTargetingParams(); // Define page-level settings\n this.initGoogleGlobalSettings(); // enableServices()\n this.initSlotRenderedCallback(); // Define callbacks\n });\n // Mouse special treatment to base path on mobile breakpoints\n const currentBreakpointName = getBreakpointName(getBreakpoint());\n if (this.config.adManagerConfig.adUnitBase.indexOf('mouse.co.il') > -1 &&\n currentBreakpointName.indexOf('xs') > -1) {\n this.config.adManagerConfig.adUnitBase = 'mouse.co.il.mobile_web';\n }\n // Holds adSlot objects as soon as possible.\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n });\n // Once DOM ready, add more adSlots.\n const onDomLoaded = () => { // eslint-disable-line no-inner-declarations\n try {\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.normal);\n });\n });\n }\n catch (err) {\n console.log(err); // eslint-disable-line no-console\n }\n };\n // Once window was loaded, add the rest of the adSlots.\n const onWindowLoaded = () => { // eslint-disable-line no-inner-declarations\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.low);\n // Clean blocking adSlots that are not defined on this page\n for (const blockingAdSlotKey of this.conflictResolver.dependencyMap.keys()) {\n if (!this.adSlots.has(blockingAdSlotKey)) {\n this.conflictResolver.dependencyMap.delete(blockingAdSlotKey);\n }\n }\n this.showAllDeferredSlots();\n });\n };\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', onDomLoaded);\n window.addEventListener('load', onWindowLoaded);\n break;\n case 'interactive':\n onDomLoaded();\n window.addEventListener('load', onWindowLoaded);\n break;\n default: // 'complete' - no need for event listeners.\n onDomLoaded();\n onWindowLoaded();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Shows all of the adSlots that can be displayed.\n */\n showAllSlots() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.type !== adTypes.talkback && this.shouldSendRequestToDfp(adSlot)) {\n adSlot.show();\n }\n }\n }\n\n /**\n * Gets all adSlots that has a certain priority\n * @param {adPriority} priority - the priority of the ad {high, normal, low}\n * @return {Array} adSlots - all of the defined adSlots that matches\n * the given priority\n */\n getAdSlotsByPriority(priority) {\n function priorityFilter(adSlot) {\n return adSlot.priority === priority;\n }\n return Array.from(this.adSlots.values()).filter(priorityFilter);\n }\n\n showAllDeferredSlots() {\n for (const deferredSlotId of this.conflictResolver.deferredSlots) {\n if (this.adSlots.has(deferredSlotId)) {\n if (!this.conflictResolver.isBlocked(deferredSlotId)) {\n const deferredAdSlot = this.adSlots.get(deferredSlotId);\n if (this.shouldSendRequestToDfp(deferredAdSlot)) {\n deferredAdSlot.show();\n }\n }\n }\n }\n }\n\n /**\n * Refreshes all responsive adSlots\n */\n refreshAllSlots() {\n const currentBreakpoint = getBreakpoint();\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive && adSlot.type !== adTypes.maavaron) {\n if (adSlot.lastResolvedWithBreakpoint !== currentBreakpoint &&\n this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n }\n\n /**\n * Refreshes all adSlots\n */\n refreshAllSlotsInPage() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n\n /**\n * Refreshes adSlot\n */\n\n refreshSlot(adUnitName) {\n const adSlot = this.adSlots.get(adUnitName);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n\n\n /**\n * Initializes adSlots based on the currently found slot markup (HTML page specific),\n * and the predefined configuration for the slots.\n * @param {Object} adSlotConfig - the AdSlots configuration object (see: globalConfig)\n * @param {String} filteredPriority - filters out all adSlots that does not match\n * a given adPriority. This is used to cherry pick the init process of ads.\n * @returns {Map}\n */\n initAdSlots(adSlotConfig, filteredPriority) {\n const adSlots = new Map(this.adSlots);\n let adSlotPlaceholders = Array.from(document.getElementsByClassName('js-dfp-ad'));\n adSlotPlaceholders = adSlotPlaceholders.filter(node => node.id); // only nodes with an id\n const adSlotNodeSet = new Set();\n adSlotPlaceholders = Array.prototype.filter.call(adSlotPlaceholders, node => {\n if (adSlotNodeSet.has(node.id) === false) { // first occurrence of Node\n adSlotNodeSet.add(node.id);\n return true;\n }\n return false;\n });\n // adSlotPlaceholders = adSlotPlaceholders.sort((a, b) => a.offsetTop - b.offsetTop);\n adSlotPlaceholders.forEach(adSlot => {\n const adSlotPriority = adSlotConfig[adSlot.id] ?\n adSlotConfig[adSlot.id].priority || adPriorities.normal : undefined;\n if (adSlotConfig[adSlot.id] && adSlots.has(adSlot.id) === false &&\n adSlotPriority === filteredPriority) {\n // The markup has a matching configuration from adSlotConfig AND was not already defined\n try {\n // adSlotConfig is built from globalConfig, but can be overridden by markup\n const computedAdSlotConfig = Object.assign({}, adSlotConfig[adSlot.id], {\n id: adSlot.id,\n target: adSlot.attributes['data-audtarget'] ?\n adSlot.attributes['data-audtarget'].value : adTargets.all,\n type: this.getAdType(adSlot.id),\n responsive: adSlotConfig[adSlot.id].responsive,\n fluid: adSlotConfig[adSlot.id].fluid || false,\n user: this.user,\n adManager: this,\n htmlElement: adSlot,\n department: this.config.department,\n network: this.config.adManagerConfig.network,\n adUnitBase: this.config.adManagerConfig.adUnitBase,\n deferredSlot: this.conflictResolver.isBlocked(adSlot.id),\n priority: adSlotPriority,\n });\n const adSlotInstance = new AdSlot(computedAdSlotConfig);\n adSlots.set(adSlot.id, adSlotInstance);\n if (adSlotInstance.type !== adTypes.talkback &&\n adSlotInstance.priority === adPriorities.high &&\n this.shouldSendRequestToDfp(adSlotInstance)) {\n /*\n console.log('calling show for high priority slot', adSlotInstance.id, ' called @',\n window.performance.now());\n */\n adSlotInstance.show();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n });\n return adSlots;\n }\n\n isPriority(adSlotId) {\n return (typeof adSlotId === 'string' &&\n (adSlotId.indexOf('plazma') > 0 ||\n adSlotId.indexOf('maavaron') > 0 ||\n adSlotId.indexOf('popunder') > 0));\n }\n\n /**\n * Returns the adType based on the adSlot name.\n * @param {String} adSlotId - the adSlot's identifier.\n * @returns {*} enumerated export 'adTypes'\n */\n getAdType(adSlotId) {\n if (!adSlotId) {\n throw new Error('Missing argument: a call to getAdType must have an adSlotId');\n }\n if (adSlotId.indexOf(adTypes.maavaron) > -1) return adTypes.maavaron;\n if (adSlotId.indexOf(adTypes.popunder) > -1) return adTypes.popunder;\n if (adSlotId.indexOf(adTypes.talkback) > -1) return adTypes.talkback;\n return adTypes.regular;\n }\n\n /**\n * @param {object} adSlot the AdSlot\n * @returns {boolean|*}\n */\n shouldSendRequestToDfp(adSlot) {\n // Conflict management check\n return this.conflictResolver.isBlocked(adSlot.id) === false &&\n // Valid Referrer check\n adSlot.isWhitelisted() &&\n // Not in referrer Blacklist\n adSlot.isBlacklisted() === false &&\n this.shouldDisplayAdAfterAdBlockRemoval(adSlot) &&\n // if a paywall pop-up is shown And the number is 12 or more - SHOW MAAVRON\n this.shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) &&\n // Responsive: breakpoint contains ad?\n this.doesBreakpointContainAd(adSlot) &&\n // check in case of Smartphoneapp\n this.haveValidCookieForSmartphoneapp() &&\n // Targeting check (userType vs. slotTargeting)\n this.doesUserTypeMatchBannerTargeting(adSlot) &&\n // Impressions Manager check (limits number of impressions per slot)\n this.user.impressionManager.reachedQuota(adSlot.id) === false;\n }\n\n printShouldSendRequestToDfp(id) {\n let res = '';\n if (!this.adSlots.has(id)) {\n res = `id not exist: ${id}`;\n }\n else {\n const a = this.adSlots.get(id);\n res += this.conflictResolver.isBlocked(a.id) === !1 ? '' : 'isBlocked,';\n res += a.isWhitelisted() ? '' : 'isWhitelisted,';\n res += a.isBlacklisted() === !1 ? '' : 'isBlacklisted,';\n res += this.shouldDisplayAdAfterAdBlockRemoval(a) ? '' : 'AdBlockRemoval,';\n res += this.shouldDisplayAdMaavaronAfterPayWallBanner(a) ? '' : 'PayWallBanner,';\n res += this.doesBreakpointContainAd(a) ? '' : 'Breakpoint,';\n res += this.haveValidCookieForSmartphoneapp() ? '' : 'Smartphoneapp,';\n res += this.doesUserTypeMatchBannerTargeting(a) ? '' : 'Targeting,';\n res += this.user.impressionManager.reachedQuota(a.id) === !1 ? '' : 'reachedQuota,';\n res = `
${id}
${res}
`;\n }\n document.write(res);\n return res;\n }\n\n testShouldSendRequestToDfp(id) {\n // leave the old name for ios legacy\n let cookieMap = getCookieAsMap();\n cookieMap = JSON.stringify(cookieMap);\n cookieMap = cookieMap.replace(/,/g, '
');\n const res = `
${cookieMap}
`;\n document.write(res);\n return res;\n }\n\n shouldDisplayAdAfterAdBlockRemoval(adSlot) {\n return !(this.config.adBlockRemoved === true &&\n (adSlot.type === adTypes.maavaron ||\n adSlot.type === adTypes.popunder));\n }\n\n shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) {\n let shouldDisplay = true;\n if (this.config.site === 'haaretz' && adSlot.type === adTypes.maavaron) {\n try {\n const paywallBanner = JSON.parse(window.localStorage.getItem('_cobj'));\n shouldDisplay = !paywallBanner || ((paywallBanner.mc && paywallBanner.mc >= 12) ||\n (paywallBanner.nextslotLocation &&\n !paywallBanner.nextslotLocation.includes('pop')));\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error('ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner');\n /* eslint-enable no-console*/\n }\n }\n return shouldDisplay;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n\n haveValidCookieForSmartphoneapp() {\n return this.config.isValidForsmartPhone;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n doesUserTypeMatchBannerTargeting(adSlotOrTarget) {\n // if the user is smadar show her all the banners\n const cookieMap = getCookieAsMap();\n if (cookieMap.login === 'pilosmadar@gmail.com') {\n return true;\n }\n if (cookieMap.tmsso !== undefined && cookieMap.tmsso.userName === 'pilosmadar@gmail.com') {\n return true;\n }\n const userType = this.user.type;\n const adTarget = typeof adSlotOrTarget === 'string' ? adSlotOrTarget : adSlotOrTarget.target;\n\n switch (adTarget) {\n case adTargets.all : return true;\n case adTargets.nonPaying :\n return userType === userTypes.anonymous || userType === userTypes.registered;\n case adTargets.anonymous : return userType === userTypes.anonymous;\n case adTargets.registered : return userType === userTypes.registered;\n case adTargets.paying : return userType === userTypes.payer;\n case adTargets.digitalOnly : return userType === userTypes.payer;\n case adTargets.digitalAndPrint : return userType === userTypes.payer;\n default: return false;\n }\n }\n\n /**\n * Report to the AdManager that a breakpoint has been switched (passed from one break to\n * another). Should there be a responsive slot with a\n * @param {Breakpoint} breakpoint - the breakpoint that is currently being displayed\n * @returns {Integer} affected - the number of adSlots affected by the change\n */\n switchedToBreakpoint(breakpoint) {\n if (!breakpoint) {\n throw new Error('Missing argument: a call to switchedToBreakpoint must have an breakpoint');\n }\n let count = 0;\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive === true && adSlot.lastResolvedWithBreakpoint) {\n if (adSlot.lastResolvedWithBreakpoint !== breakpoint) {\n adSlot.refresh();\n count++;\n }\n }\n }\n return count;\n }\n\n /**\n * Checks whether an adSlot is defined for a given breakpoint (Default: current breakpoint)\n * @param {AdSlot} adSlot - the adSlot to check.\n * @param {Breakpoint} [breakpoint=currentBreakpoint] - the breakpoint to check this ad in.\n * @returns {boolean} true iff the adSlot is defined for the given breakpoint.\n */\n doesBreakpointContainAd(adSlot, breakpoint = getBreakpoint()) {\n if (!adSlot) {\n throw new Error('Missing argument: a call to doesBreakpointContainAd must have an adSlot');\n }\n let containsBreakpoint = true;\n if (adSlot.responsive === true) {\n const mapping = adSlot.responsiveAdSizeMapping[getBreakpointName(breakpoint)];\n if (Array.isArray(mapping) === false) {\n throw new Error(`Invalid argument: breakpoint:${breakpoint} doesn't exist!`, this);\n }\n containsBreakpoint = mapping.length > 0 && !arraysEqual(mapping, [[0, 0]]);\n }\n return containsBreakpoint;\n }\n\n /**\n * Initializes the callback from the 'slotRenderEnded' event for each slot\n */\n initSlotRenderedCallback() {\n if (window.googletag && window.googletag.apiReady) {\n const pubads = window.googletag.pubads();\n pubads.addEventListener('slotRenderEnded', event => {\n const id = event.slot.getAdUnitPath().split('/')[3];\n const isEmpty = event.isEmpty;\n const resolvedSize = event.size;\n // console.log('slotRenderEnded for slot',id,' called @',window.performance.now());\n if (this.adSlots.has(id)) {\n const adSlot = this.adSlots.get(id);\n adSlot.lastResolvedSize = resolvedSize;\n adSlot.lastResolvedWithBreakpoint = getBreakpoint();\n if (isEmpty) {\n adSlot.lastResolvedSize = ConflictResolver.EMPTY_SIZE;\n adSlot.hide();\n this.releaseSlotDependencies(adSlot);\n }\n else {\n this.releaseSlotDependencies(adSlot, adSlot.lastResolvedSize);\n }\n this.user.impressionManager.registerImpression(`${adSlot.id}${this.config.department}`);\n this.user.impressionManager.registerImpression(`${adSlot.id}_all`);\n }\n else {\n /*\n console.error(`Cannot find an adSlot with id: ${id} - Ad Unit path is\n ${event.slot.getAdUnitPath()}`);\n */\n }\n });\n }\n else {\n throw new Error('googletag api was not ready when \\'initSlotRenderedCallback\\' was called!');\n }\n }\n\n releaseSlotDependencies(adSlot) {\n try {\n const id = adSlot.id;\n this.conflictResolver.updateResolvedSlot(id, adSlot.lastResolvedSize);\n if (this.conflictResolver.isBlocking(id)) {\n // Hide all blocked adSlots\n for (const blockedSlot of this.conflictResolver.getBlockedSlotsIds(id)) {\n if (this.conflictResolver.isBlocked(blockedSlot)) {\n if (this.adSlots.has(blockedSlot)) {\n this.adSlots.get(blockedSlot).hide();\n }\n }\n }\n // Show the non blocked\n for (const deferredSlotKey of this.conflictResolver.deferredSlots.keys()) {\n const deferredAdSlot = this.adSlots.get(deferredSlotKey);\n if (deferredAdSlot && this.shouldSendRequestToDfp(deferredAdSlot)) {\n this.conflictResolver.deferredSlots.delete(deferredSlotKey);\n if (deferredAdSlot.deferredSlot) {\n deferredAdSlot.defineSlot();\n deferredAdSlot.deferredSlot = false;\n }\n deferredAdSlot.show();\n }\n }\n }\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error(`Cannot updateSlotDependencies for adSlot: ${adSlot.id}`);\n /* eslint-enable no-console*/\n }\n }\n\n setSsoGroupKey() {\n fetch(`/ssoGroupKey?value=${this.user.sso.userId}`, {\n method: 'GET',\n cache: 'no-cache',\n }).then(value => {\n if (value) {\n value.json().then(data => {\n if (data && data.result && data.result !== 'item not found'\n && data.result !== 'value is empty') {\n localStorage.setItem('_SsoGroupKey', data.result);\n }\n });\n }\n });\n }\n\n /**\n * Initializes page-level targeting params.\n */\n initGoogleTargetingParams() {\n if (window.googletag && window.googletag.apiReady) {\n // Returns a reference to the pubads service.\n let SsoGroupKey = null;\n try {\n SsoGroupKey = localStorage.getItem('_SsoGroupKey');\n if (!SsoGroupKey && this.user.sso.userId) {\n this.setSsoGroupKey();\n }\n }\n catch (e) {\n SsoGroupKey = null;\n }\n const pubads = googletag.pubads();\n // Environment targeting (dev, test, prod)\n if (this.config.environment) {\n pubads.setTargeting('stg', [this.config.environment]);\n }\n // App targeting\n // User targeting\n if (this.user.htz_type) {\n pubads.setTargeting('htz_user_type', [this.user.htz_type]);\n }\n if (this.user.tm_type) {\n pubads.setTargeting('tm_user_type', [this.user.tm_type]);\n }\n if (this.user.hdc_type) {\n pubads.setTargeting('hdc_user_type', [this.user.hdc_type]);\n }\n // Context targeting\n if (this.config.section) {\n pubads.setTargeting('section', [this.config.section]);\n }\n if (this.config.sub_section) {\n pubads.setTargeting('sub_section', [this.config.sub_section]);\n }\n if (this.config.articleId) {\n pubads.setTargeting('articleId', [this.config.articleId]);\n pubads.setTargeting('react', ['false']);\n }\n if (this.config.gStatCampaignNumber && this.config.gStatCampaignNumber !== -1) {\n pubads.setTargeting('gstat_campaign_id', [this.config.gStatCampaignNumber]);\n }\n if (this.config.proposalNumber) {\n pubads.setTargeting('proposaltype', [this.config.proposalNumber]);\n }\n if (this.config.pageType) {\n pubads.setTargeting('pageType', [this.config.pageType]);\n }\n if (this.config.isWriterAlerts) {\n pubads.setTargeting('WriterAlerts', ['true']);\n }\n // AdBlock removal\n if (this.config.adBlockRemoved) {\n pubads.setTargeting('adblock_removed', [this.config.adBlockRemoved]);\n }\n // University targeting - triggered via cookie\n if (this.config.wifiLocation) {\n pubads.setTargeting('wifi', [this.config.wifiLocation]);\n }\n if (this.config.tags && Array.isArray(this.config.tags)) {\n pubads.setTargeting('tags', [...this.config.tags]);\n }\n\n if (this.user.sso && this.user.sso.userId && SsoGroupKey) {\n pubads.setTargeting(SsoGroupKey, this.user.sso.userId);\n }\n if (this.config.anonymousId) {\n const anonymousIdKeyName = 'anonymousIdKey';\n pubads.setTargeting(anonymousIdKeyName, this.config.anonymousId);\n }\n if (this.user.country) {\n pubads.setTargeting('country', this.user.country);\n }\n\n const cityNames = this.getCityNames();\n if (cityNames) {\n pubads.setTargeting('cityName', [...cityNames]);\n }\n\n // Ads Centering\n pubads.setCentering(true);\n }\n else {\n throw new Error('googletag api was not ready when \\'initGoogleTargetingParams\\' was called!');\n }\n }\n\n /**\n * Initializes googletag services.\n */\n initGoogleGlobalSettings() {\n if (window.googletag && window.googletag.apiReady) {\n const googleGlobalSettings = this.config.googleGlobalSettings;\n // Enable GET parameter overrides\n if (window.location.search) {\n const search = window.location.search;\n if (search.indexOf('sraon') > 0) {\n console.log('Single Request Mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = true;\n }\n else if (search.indexOf('sraoff') > 0) {\n console.log('Single Request Mode: disabled');// eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = false;\n }\n if (search.indexOf('asyncrenderingon') > 0) {\n console.log('Async rendering mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = true;\n }\n else if (search.indexOf('asyncrenderingonoff') > 0) {\n console.log('Sync rendering mode: active');// eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = false;\n }\n }\n // Google services activation\n if (googleGlobalSettings.enableSingleRequest === true) {\n googletag.pubads().enableSingleRequest();\n }\n // if (googleGlobalSettings.enableAsyncRendering === true) {\n // googletag.pubads().enableAsyncRendering();\n // }\n // else {\n // googletag.pubads().enableSyncRendering();\n // }\n // Enables all GPT services that have been defined for ad slots on the page.\n googletag.enableServices();\n }\n else {\n throw new Error('googletag api wasn\\'t ready when \\'initGoogleGlobalSettings\\' was called!');\n }\n }\n\n\n getCityNames() {\n const cityNames = [];\n document.querySelectorAll('[data-location-city-name]').forEach((element) => {\n if (!cityNames.includes(element.dataset.locationCityName)) {\n cityNames.push(element.dataset.locationCityName);\n }\n });\n return cityNames.length > 0 ? cityNames : null;\n }\n\n}\n","/* globals googletag */\nimport AdManager from '../src/objects/adManager';\nimport globalConfig from './globalConfig';\nimport { getBreakpoint, debounce } from '../src/utils/breakpoints';\n\nconst defaultConfig = globalConfig || {};\nconst resizeTimeout = 250;\n\nexport default class DFP {\n\n constructor(config) {\n this.config = Object.assign({}, defaultConfig, config);\n this.wasInitialized = false;\n this.initStarted = false;\n this.breakpoint = getBreakpoint();\n this.initWindowResizeListener();\n }\n\n /**\n * This part of the object's construction is dependent on the call to 'init'\n */\n resumeInit() {\n try {\n this.adManager = this.adManager || new AdManager(this.config);\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * initializes the 'googletag' global namespace and add the\n * google publish tags library to the page\n * @returns {Promise} that resolves to true once the googletag api is ready to use\n * (googletag.apiReady = true)\n */\n initGoogleTag() {\n const dfpThis = this;\n return new Promise((resolve, reject) => {\n if (dfpThis.initStarted === true) {\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(dfpThis);\n });\n }\n else {\n dfpThis.initStarted = true;\n // set up a place holder for the gpt code downloaded from google\n window.googletag = window.googletag || {};\n\n // this is a command queue used by GPT any methods added to it will be\n // executed when GPT code is available, if GPT is already available they\n // will be executed immediately\n window.googletag.cmd = window.googletag.cmd || [];\n // load google tag services JavaScript\n (() => {\n const tag = window.document.createElement('script');\n tag.async = true;\n tag.type = 'text/javascript';\n // Supports both https and http\n tag.setAttribute('src', '//www.googletagservices.com/tag/js/gpt.js');\n const node = window.document.getElementsByTagName('script')[0];\n tag.addEventListener('load', () => {\n dfpThis.resumeInit();\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(this);\n });\n });\n tag.addEventListener('error', (error) => {\n dfpThis.wasInitialized = false;\n reject(error);\n });\n node.parentNode.insertBefore(tag, node);\n })();\n }\n });\n }\n\n /**\n * Returns true iff googletag was properly initialized on the page\n * @returns {boolean}\n */\n isGoogleTagReady() {\n if (this.wasInitialized === true || (window.googletag && window.googletag.apiReady)) {\n this.wasInitialized = true;\n }\n return this.wasInitialized;\n }\n\n /**\n * Initializes the window resize listener to support responsive ad refreshes\n */\n initWindowResizeListener() {\n const dfpThis = this;\n function onResize() {\n const currentBreakpoint = getBreakpoint();\n if (dfpThis.breakpoint !== currentBreakpoint) {\n dfpThis.breakpoint = currentBreakpoint;\n if (dfpThis.adManager) {\n dfpThis.adManager.refreshAllSlots();\n }\n else {\n throw new Error('initWindowResizeListener error - adManager instance is not available');\n }\n }\n }\n const debouncedFunction = debounce(onResize, resizeTimeout);\n window.onresize = debouncedFunction;\n }\n}\n","import DFP from './dfp';\nimport globalConfig from './globalConfig';\nimport { version as v } from './version';\n\n// DFP version is based on the package.json\nDFP.version = v || 'VERSION';\n\n/*\n // Only for development mode\n if ( process.env.NODE_ENV !== 'production' ) {\n DFP.dev = '123';\n }\n */\n\nexport const config = globalConfig;\nexport const version = DFP.version;\nexport default DFP;\n","// generated by genversion\nexport const version = '2.6.5';\n"]} \ No newline at end of file +{"version":3,"sources":["../src/utils/cookieUtils.js","../src/utils/time.js","../src/utils/breakpoints.js","../src/utils/arrays.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/classCallCheck.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/createClass.js","../jspm_packages/npm/systemjs-plugin-babel@0.0.17/babel-helpers/toConsumableArray.js","../src/globalConfig.js","../src/objects/impressionsManager.js","../src/objects/user.js","../src/objects/conflictResolver.js","../src/objects/adSlot.js","../src/objects/adManager.js","../src/dfp.js","../src/index.js","../src/version.js"],"names":["stringToMap","string","separator","undefined","_ref$separator","operator","_ref$operator","map","split","forEach","element","keyValue","length","decodeURIComponent","e","getCookieAsMap","document","cookie","tmsso","engsso","addHours","date","hours","SyntaxError","isNaN","parseInt","TypeError","result","Date","setHours","getHours","addDays","days","setDate","getDate","debounce","func","wait","arguments","immediate","timeout","context","this","args","later","apply","callNow","setTimeout","getBreakpoint","breakpoint","windowWidth","window","innerWidth","documentElement","clientWidth","body","breakpoints","xs","xxs","s","m","l","xl","xxl","getBreakpointName","resultBreakpoint","arraysEqual","a","b","Array","isArray","i","_classCallCheck","instance","Constructor","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","defineProperty","key","protoProps","staticProps","prototype","_toConsumableArray","arr","arr2","from","ssoKey","location","hostname","indexOf","dfpBaseConf","JSON","parse","getElementById","textContent","err","dfpConfig","Object","assign","referrer","test","navigator","userAgent","pathname","environment","isHomepage","regexMatch","exec","sectionArray","articleId","slice","filter","path","section","index","reduce","last","current","concat","site","env","port","dev","prod","articleIdMatch","pop","getUrlParam","results","RegExp","search","adBlockRemoved","localStorage","getItem","cookieName","cookieMap","anonymousId","wifiLocation","toLowerCase","fairs","validForAds","PageUrl","href","isSmartphoneapp","match","HtzPusr","userName","gstatCampaign","CampaignNumber","type","htmlclassList","querySelector","classList","domain","proposal","googleGlobalSettings","breakpointType","breakpoints1","breakpoints2","breakpoints3","breakpoints4","getTime","globalConfig","breakpointsConfig","keys","impressionManagerConfig","ImpressionsManager","now","config","impressions","retrieveImpressionsData","initImpressionMap","migrateImpressionsData","_this","hasOwnProperty","call","frequency","impressionsData","oldImpressionsArray","impression","adUnitImpression","name","data","tmp","slotId","join","id","exposed","expires","_this2","adSlotId","err1","debouncedSave","saveImpressionsToLocalStorageImpl","setItem","stringify","error","slot","_this3","shouldUpdateExpiryDate","initSlotFromConfig","updateExpiryDate","slotName","Error","frequencyMap","frequencyRegex","setMilliseconds","setSeconds","setMinutes","maxImpressions","saveImpressionsToLocalStorage","department","atQuota","userTypes","productTypes","User","userConfig","sso","getUserType","htz_type","getUserTypeByProduct","htz","tm_type","tm","hdc_type","hdc","impressionManager","ImpressionManager","age","getUserAge","gender","getUserGender","getUserSSO","country","getUserCountry","TmPusr","HdcPusr","payer","registered","anonymous","productType","userType","userProducts","getHdcUserType","getHtzTmUserType","firstName","lastName","guest","userHasProduct","trial","htz_tm","products","product","prodNum","usrae","urgdr","then","resp","json","code","ConflictResolver","conflictManagementConfig","dependencyMap","initializeDependencyMap","deferredSlots","Set","conflictManagementJson","queue","Map","value","rules","item","onsize","avoid","set","resolvedSize","has","get","resolvedWith","isBlocked","_step","Symbol","iterator","_iteratorNormalCompletion","_iterator","next","done","adSlotKey","adSlot","_step2","_iteratorNormalCompletion2","_iterator2","adSlotRule","parentResolvedWith","find","sizeString","size","numberStr","add","return","_iteratorError2","_iteratorError","isBlocking","_step3","_iteratorNormalCompletion3","_iterator3","_iteratorError3","EMPTY_SIZE","hiddenClass","adSlotConfig","responsive","fluid","user","adManager","htmlElement","priority","deferredSlot","network","adUnitBase","adSizeMapping","responsiveAdSizeMapping","blacklistReferrers","whitelistReferrers","lastResolvedSize","lastResolvedWithBreakpoint","defineSlot","isMobile","adTypes","maavaron","popunder","talkback","regular","whitelisted","blacklisted","shown","cmd","push","remove","display","isMaavaron","maavaronSlot","defineMaavaron","shouldSendRequestToDfp","googletag","pubads","defineFn","isOutOfPage","defineOutOfPageSlot","getPath","responsiveSlotSizeMapping","sizeMapping","addSize","build","defineSizeMapping","addService","setCollapseEmptyDiv","event","getAdUnitPath","isEmpty","refresh","_this4","adUnitMaavaronPath","adUnitMaavaronSize","definePassback","setTargeting","adPriorities","adTargets","AdManager","conflictResolver","initGoogleTargetingParams","initGoogleGlobalSettings","initSlotRenderedCallback","currentBreakpointName","adManagerConfig","adSlots","initAdSlots","high","onDomLoaded","normal","log","onWindowLoaded","low","blockingAdSlotKey","delete","showAllDeferredSlots","readyState","addEventListener","show","priorityFilter","values","deferredSlotId","deferredAdSlot","currentBreakpoint","_step4","_iteratorNormalCompletion4","_iterator4","hide","_iteratorError4","_step5","_iteratorNormalCompletion5","_iterator5","_iteratorError5","adUnitName","filteredPriority","adSlotPlaceholders","getElementsByClassName","node","adSlotNodeSet","adSlot$$1","adSlotPriority","computedAdSlotConfig","attributes","all","getAdType","adSlotInstance","AdSlot","isWhitelisted","isBlacklisted","shouldDisplayAdAfterAdBlockRemoval","shouldDisplayAdMaavaronAfterPayWallBanner","doesBreakpointContainAd","haveValidCookieForSmartphoneapp","doesUserTypeMatchBannerTargeting","reachedQuota","shouldAppPromotionElementPop","res","write","replace","shouldDisplay","paywallBanner","mc","nextslotLocation","includes","appPromotionElement","getShouldPop","isValidForsmartPhone","login","adSlotOrTarget","nonPaying","paying","digitalOnly","digitalAndPrint","count","_step6","_iteratorNormalCompletion6","_iterator6","_iteratorError6","containsBreakpoint","mapping","apiReady","releaseSlotDependencies","registerImpression","updateResolvedSlot","_step7","getBlockedSlotsIds","_iteratorNormalCompletion7","_iterator7","blockedSlot","_iteratorError7","_step8","_iteratorNormalCompletion8","_iterator8","deferredSlotKey","_iteratorError8","userId","SsoGroupKey","setSsoGroupKey","sub_section","gStatCampaignNumber","proposalNumber","pageType","isWriterAlerts","tags","cityNames","getCityNames","setCentering","enableSingleRequest","enableAsyncRendering","enableServices","querySelectorAll","dataset","locationCityName","defaultConfig","resizeTimeout","DFP","wasInitialized","initStarted","initWindowResizeListener","dfpThis","Promise","resolve","reject","tag","createElement","async","setAttribute","getElementsByTagName","resumeInit","parentNode","insertBefore","onResize","refreshAllSlots","debouncedFunction","onresize","version"],"mappings":"yBAgBA,SAASA,GAAYC,uEACjBC,UAAAA,MAAAC,KAAAC,EAAY,IAA4BA,MAAvBC,SAAAA,MAAAF,KAAAG,EAAW,IAC9BA,EAAMC,WACWN,GAAOO,MAAMN,GACrBO,QAAQ,SAAAC,MACQ,gBAAZA,GAAsB,IACzBC,GAAWD,EAAQF,MAAMH,MACP,IAApBM,EAASC,aAELD,EAAS,IAAME,mBAAmBF,EAAS,IAEjD,MAAOG,QAMNP,EAKT,QAAwBQ,QAChBR,GAAMP,EAAYgB,SAASC,QAAUf,UAAW,eAC7B,gBAAdK,GAAIW,UACTA,MAAQlB,EAAYO,EAAIW,OAAShB,UAAW,OAExB,gBAAfK,GAAIY,WACTA,OAASnB,EAAYO,EAAIY,QAAUjB,UAAW,OAE7CK,ECrCT,QAAgBa,GAASC,EAAMC,OACxBD,OACG,IAAIE,aAAY,4DAEnBD,OACG,IAAIC,aAAY,wDAEnB,IAAIC,MAAMC,SAASH,EAAO,UACvB,IAAII,WAAU,iEAEhBC,GAAS,GAAIC,MAAKP,YACjBQ,SAASF,EAAOG,WAAaL,SAASH,EAAO,KAC7CK,EAYT,QAAgBI,GAAQV,EAAMW,OACvBX,OACG,IAAIE,aAAY,2DAEnBS,OACG,IAAIT,aAAY,sDAEnB,IAAIC,MAAMC,SAASO,EAAM,UACt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AEDxT,SAEHqN,iBAAA,QAA8B,SAAA9L,KAC5BiS,gBAAA,IACAjS,OAEF8S,WAAAC,aAAAP,EAAAtF,4DAWF,IAAAjX,KAAAgc,gBAAiCvb,OAAAyS,WAAoBzS,OAAAyS,UAAzD0G,iBACEoC,gBAAA,GAEKhc,KAAPgc,0EAQAe,QACQ5G,GAAN7V,OACI6b,EAAA5b,aAAJ4V,EAA8C,MAC5C5V,WAAA4V,GACIgG,EAAJ/K,eAIQ,IAAA9G,OAAN,0EAHA8G,UAAA4L,sBANAb,GAANnc,KAaMid,EAAoBxd,EAAAsd,EAA1BjB,UACAoB,SAAAD,UCvGJlB,GAAIoB,QCJmB,ODavB,IAAahV,GAASN,EACTsV,EAAUpB,EAAIoB","file":"dfp.min.js","sourcesContent":["/**\n * Htz-cookie-util\n * @module htzCookieUtil\n * @author Elia Grady elia.grady@haaretz.co.il\n * @license MIT\n */\n\n/**\n * Translates Key-Value string into a convenient map.\n * @param {String} string String in format of \"keyvalue.....\"\n * @param {object} options object for overriding defaults:\n * options.separator is a String or regExp that separates between each key value pairs\n * (default is ';'). options.operator is a String or regExp that separates between each key\n * and value within a pair (default is '=').\n * @returns {object} a map object, with key-value mapping according to the passed configuration.\n */\nfunction stringToMap(string,\n { separator = ';', operator = '=' } = {}) {\n const map = {};\n const itemsArr = string.split(separator);\n itemsArr.forEach(element => {\n if (typeof element === 'string') {\n const keyValue = element.split(operator);\n if (keyValue.length === 2) {\n try {\n map[keyValue[0]] = decodeURIComponent(keyValue[1]);\n }\n catch (e) {\n // Do nothing, malformed URI\n }\n }\n }\n });\n return map;\n}\nexport const ssoKey = window.location.hostname.indexOf('haaretz.com') > -1 ? 'engsso' : 'tmsso';\n\n// Translates Cookie string into a convenient map.\nexport default function getCookieAsMap() {\n const map = stringToMap(document.cookie, { separator: /;\\s?/ });\n if (typeof map.tmsso === 'string') {\n map.tmsso = stringToMap(map.tmsso, { separator: ':' });\n }\n if (typeof map.engsso === 'string') {\n map.engsso = stringToMap(map.engsso, { separator: ':' });\n }\n return map;\n}\n","/**\n * Helper function. Adds N hours to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Number} hours - the amount of hours to add, in whole numbers\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'hours' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given hours\n */\nexport function addHours(date, hours) {\n if (!date) {\n throw new SyntaxError('addHours called without a required \\'date\\' parameter!');\n }\n if (!hours) {\n throw new SyntaxError('addHours called without a required \\'hours\\' parameter!');\n }\n else if (isNaN(parseInt(hours, 10))) {\n throw new TypeError('addHours called with an invalid integer \\'hours\\' parameter!');\n }\n const result = new Date(date);\n result.setHours(result.getHours() + parseInt(hours, 10));\n return result;\n}\n\n/**\n * Helper function. Adds N days to a given date object.\n * @param {Date} date - the date to derive from\n * @param {Integer} days - the amount of days to add\n * @throws {SyntaxError} Will throw if the 'date' param is not provided\n * @throws {SyntaxError} Will throw if the 'days' param is not provided\n * @throws {TypeError} Will throw if the 'hours' param is not a valid integer\n * @returns {Date} date - the new date, derived from adding the given days\n */\nexport function addDays(date, days) {\n if (!date) {\n throw new SyntaxError('addDays called without a required \\'date\\' parameter!');\n }\n if (!days) {\n throw new SyntaxError('addDays called without a required \\'days\\' parameter!');\n }\n else if (isNaN(parseInt(days, 10))) {\n throw new TypeError('addDays called with an invalid integer \\'days\\' parameter!');\n }\n const result = new Date(date);\n result.setDate(result.getDate() + parseInt(days, 10));\n return result;\n}\n","import globalConfig from '../globalConfig';\n\nconst breakpoints = globalConfig.breakpointsConfig.breakpoints;\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param { function } func - the function to run\n * @param { number } wait - the timeout period to avoid running the function\n * @param { boolean } immediate - leading edge modifier\n * @returns {function } the debounced function\n */\nexport function debounce(func, wait = 100, immediate) {\n let timeout;\n return function debounced() {\n const context = this;\n const args = arguments;// eslint-disable-line prefer-rest-params\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @returns {number} the break that the current width represents\n */\nexport function getBreakpoint() {\n let breakpoint;\n const windowWidth = window.innerWidth\n || document.documentElement.clientWidth\n || document.body.clientWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: breakpoint = breakpoints.xxs; break;\n case windowWidth < breakpoints.s: breakpoint = breakpoints.xs; break;\n case windowWidth < breakpoints.m: breakpoint = breakpoints.s; break;\n case windowWidth < breakpoints.l: breakpoint = breakpoints.m; break;\n case windowWidth < breakpoints.xl: breakpoint = breakpoints.l; break;\n case windowWidth < breakpoints.xxl: breakpoint = breakpoints.xl; break;\n default: breakpoint = breakpoints.xxl;\n }\n return breakpoint;\n}\n/**\n * Returns the current breakpoint that is closest to the window's width\n * @param {number} breakpoint - the breakpoint label enumerator that the current width represents\n * (yield with a getBreakpoint() call or passed manually )\n * @returns {string} breakpoint - the breakpoint label that the current width represents,\n * as a string\n */\nexport function getBreakpointName(breakpoint) {\n let resultBreakpoint;\n const windowWidth = breakpoint || window.innerWidth;\n switch (true) {\n case windowWidth < breakpoints.xs: resultBreakpoint = 'xxs'; break;\n case windowWidth < breakpoints.s: resultBreakpoint = 'xs'; break;\n case windowWidth < breakpoints.m: resultBreakpoint = 's'; break;\n case windowWidth < breakpoints.l: resultBreakpoint = 'm'; break;\n case windowWidth < breakpoints.xl: resultBreakpoint = 'l'; break;\n case windowWidth < breakpoints.xxl: resultBreakpoint = 'xl'; break;\n default: resultBreakpoint = 'xxl';\n }\n return resultBreakpoint;\n}\n","/**\n * Checks whether two arrays are equal\n * @param {Array} a - the first array to check\n * @param {Array} b - the second array to check\n * @returns {Boolean} true iff both a and b are arrays, with equal values\n */\nexport function arraysEqual(a, b) {\n if (!a || !b) return false;\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (Array.isArray(a[i]) && Array.isArray(b[i])) {\n if (!arraysEqual(a[i], b[i])) return false;\n }\n else if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\nexport default arraysEqual;\n","export default (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n});","export default (function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n})();","export default (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n});","/* global dfpConfig */\nimport getCookieAsMap, { ssoKey } from './utils/cookieUtils';\n// globalConfig for DFP\nlet dfpBaseConf;\ntry {\n dfpBaseConf = window.JSON.parse(document.getElementById('dfpConfig').textContent);\n}\ncatch (err) {\n dfpBaseConf = window.dfpConfig;\n}\nconst dfpConfig = Object.assign({\n get referrer() {\n return document.referrer ? document.referrer : '';\n },\n get isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n },\n /**\n * Returns true iff the loaded page is the homepage (no inner path)\n * @returns {boolean}\n */\n get isHomepage() {\n return window.location.pathname === '/' || this.environment === 3; // 'prod'\n },\n get department() {\n return this.isHomepage ? '_homepage' : '_section';\n },\n /**\n * returns the domain the page was loaded to. i.e: 'haaretz.co.il', 'haaretz.com'\n * @returns {string} the domain name from the windows's location hostname property\n */\n get domain() {\n const regexMatch = /([\\d|\\w]+)(\\.co\\.il|\\.com)(.*)?/.exec(window.location.hostname);\n const result = regexMatch ? regexMatch[0] : window.location.hostname;\n return result;\n },\n /**\n * Returns an array of concatenated paths, separated by a dot.\n * For example, for the URL:\n * http://www.haaretz.co.il/news/world/america/us-election-2016/LIVE-1.2869045\n * the path is '/news/world/america/us-election-2016/LIVE-1.2869045'.\n * This function takes the directories ['news', 'world', 'america', 'us-election-2016']\n * and converts it to the following format:\n * ['.news', '.news.world', '.news.world.america', '.news.world.america.us-election-2016']\n * This denotes the path configuration for the given adSlot\n * non articles (sections) will be given a '0' - no articleId value for targeting purposes)\n * @returns {Array.} an array of path names\n */\n get path() {\n let sectionArray = this.articleId && this.articleId !== '0' ?\n window.location.pathname.split('/').slice(1, -1) :\n window.location.pathname.split('/').slice(1);\n sectionArray = sectionArray.filter(path =>\n path !== 'wwwMobileSite' && path !== 'whtzMobileSite');\n return sectionArray\n .map(section => `.${section}`)\n .map((section, index, arr) => arr.slice(0, index + 1)\n .reduce((last, current) => last.concat(current)));\n },\n /**\n * Returns a string representation for the name of the site\n * @return {*|string}\n */\n get site() {\n let site;\n if (window.location.hostname.indexOf('haaretz.co.il') > -1) {\n site = 'haaretz';\n }\n else if (window.location.hostname.indexOf('themarker.com') > -1) {\n site = 'themarker';\n }\n else if (window.location.hostname.indexOf('mouse.co.il') > -1) {\n site = 'mouse';\n }\n return site || 'haaretz';\n },\n /**\n * Returns the current environment targeting param, if such is defined.\n * @returns {number} targeting param, 1 for local development, 2 for test servers and 3 for prod.\n * May return undefined if no targeting is specified.\n */\n get environment() {\n const env = {\n dev: 1,\n test: 2,\n prod: 3,\n };\n return window.location.port === '8080' ? env.dev :\n (window.location.hostname.indexOf('pre.haaretz.co.il') > -1\n || window.location.hostname.indexOf('tmtest.themarker.com') > -1\n || window.location.hostname.indexOf('pre.haaretz.com') > -1\n || window.location.hostname.indexOf('prodmouse.mouse.co.il') > -1) ? env.test :\n (window.location.pathname.indexOf('/cmlink/Haaretz.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/TheMarker.HomePage') > -1\n || window.location.pathname.indexOf('/cmlink/Mouse.HomePage') > -1)\n ? env.prod : undefined;\n },\n /**\n * Returns the articleIf if on an article page, or null otherwise\n * @returns {string} an articleId string from the pathname, or 0 if not found\n */\n get articleId() {\n const articleIdMatch = /\\d\\.\\d+/g.exec(window.location.pathname);\n let articleId = '0';\n if (articleIdMatch) {\n articleId = articleIdMatch.pop(); // Converts [\"1.23145\"] to \"1.23145\"\n }\n return articleId;\n },\n utm_: {\n get content() {\n return this.getUrlParam('utm_content');\n },\n get source() {\n return this.getUrlParam('utm_source');\n },\n get medium() {\n return this.getUrlParam('utm_medium');\n },\n get campaign() {\n return this.getUrlParam('utm_campaign');\n },\n getUrlParam(key) {\n const results = RegExp(`(${key})(=)([^&\"]+)`).exec(window.location.search);\n return results && results[3] ? results[3] : undefined;\n },\n },\n get adBlockRemoved() {\n let adBlockRemoved = false;\n try {\n if (localStorage.getItem('adblock_removed')) {\n adBlockRemoved = true;\n }\n }\n catch (err) {\n // do nothing\n }\n return adBlockRemoved;\n },\n get ssoGroupKey() {\n return window.localStorage.getItem('_SsoGroupKey');\n },\n get anonymousId() {\n const cookieName = 'anonymousId';\n const cookieMap = getCookieAsMap();\n let anonymousId = '';\n if (cookieMap && cookieMap[cookieName]) {\n anonymousId = cookieMap[cookieName];\n }\n return anonymousId;\n },\n get isWriterAlerts() {\n return (location.search.indexOf('writerAlerts=true') > -1);\n },\n get wifiLocation() {\n let wifiLocation;\n const cookieName = '_htzwif'; // eslint-disable-line no-underscore-dangle\n const cookieMap = getCookieAsMap();\n try {\n if (cookieMap && cookieMap[cookieName]) {\n if (cookieMap[cookieName].toLowerCase() === 'arcaffe') {\n wifiLocation = 'ArCafe';\n }\n if (cookieMap[cookieName].toLowerCase() === 'university') {\n wifiLocation = 'university';\n }\n }\n if (cookieMap && cookieMap.fairs) {\n wifiLocation = 'fairs';\n }\n }\n catch (err) {\n // do nothing\n }\n return wifiLocation;\n },\n get isValidForsmartPhone() {\n let validForAds = true;\n const PageUrl = window.location.href;\n const isSmartphoneapp = PageUrl.match('haaretzsmartphoneapp');\n const cookieMap = getCookieAsMap();\n try {\n if (isSmartphoneapp) {\n // eslint-disable-line no-underscore-dangle\n if (cookieMap && cookieMap.HtzPusr &&\n (cookieMap.tmsso === undefined || cookieMap.tmsso.userName !== 'pilosmadar@gmail.com')) {\n validForAds = false;\n }\n }\n }\n catch (err) {\n // do nothing\n }\n return validForAds;\n },\n get gStatCampaignNumber() {\n let gstatCampaign;\n try {\n gstatCampaign = localStorage.getItem('GstatCampaign') ?\n JSON.parse(localStorage.getItem('GstatCampaign')) : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n gstatCampaign = undefined;\n }\n return gstatCampaign ? gstatCampaign.CampaignNumber : undefined;\n },\n get pageType() {\n let type = '';\n try {\n const htmlclassList = document.querySelector('html').classList;\n switch (true) {\n case /mouse_location/.test(htmlclassList):\n type = 'mouse_location';\n break;\n case /mouse_event/.test(htmlclassList):\n type = 'mouse_event';\n break;\n case /contentType-story/.test(htmlclassList):\n type = 'mouse_article';\n break;\n default:\n if (this.articleId !== '0') {\n switch (this.domain) {\n case 'haaretz.co.il':\n type = 'htz_article';\n break;\n case 'haaretz.com':\n type = 'hdc_article';\n break;\n case 'themarker.com':\n type = 'tm_article';\n break;\n default:\n type = '';\n }\n }\n else {\n type = '';\n }\n }\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n type = '';\n }\n return type;\n },\n get proposalNumber() {\n let proposal;\n try {\n proposal = localStorage.getItem('proposaltype') ?\n localStorage.getItem('proposaltype') : undefined;\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the variable should be undefined */\n proposal = undefined;\n }\n return proposal;\n },\n adSlotConfig: {\n 'haaretz.co.il.example.slot': {\n id: 'slotId',\n // path : \"/network/base/slotId/slotId_subsection\", Will be calculated from AdManager\n responsive: true,\n adSizeMapping: [['width1', 'height1'], ...['widthN', 'heightN']],\n priority: 'normal',\n fluid: false,\n responsiveAdSizeMapping: {\n xxs: [['width1', 'height1'], ...['widthN', 'heightN']],\n xs: [['width1', 'height1'], ...['widthN', 'heightN']],\n s: [['width1', 'height1'], ...['widthN', 'heightN']],\n m: [['width1', 'height1'], ...['widthN', 'heightN']],\n l: [['width1', 'height1'], ...['widthN', 'heightN']],\n xl: [['width1', 'height1'], ...['widthN', 'heightN']],\n xxl: [['width1', 'height1'], ...['widthN', 'heightN']],\n },\n blacklistReferrers: 'comma, delimited, blacklisted, referrer, list',\n whitelistReferrers: 'comma, delimited, referrer, list',\n },\n },\n adManagerConfig: {\n network: '9401',\n adUnitBase: 'haaretz.co.il_Web',\n },\n breakpointsConfig: {\n get breakpoints() {\n // Override in VM from backend to control this toggle.\n let breakpoints;\n switch (dfpConfig.googleGlobalSettings.breakpointType) {\n case 'type1': breakpoints = this.breakpoints1; break;\n case 'type2': breakpoints = this.breakpoints2; break;\n case 'type3': breakpoints = this.breakpoints3; break;\n case 'type4': breakpoints = this.breakpoints4; break;\n default: breakpoints = this.breakpoints1;\n }\n return breakpoints;\n },\n // Type 1\n breakpoints1: {\n xxs: 600,\n xs: 761,\n s: 993,\n m: 1009,\n l: 1291,\n xl: 1600,\n xxl: 1900,\n },\n // Type 2\n breakpoints2: {\n xxs: 600,\n xs: 1000,\n s: 1150,\n m: 1281,\n l: 1600,\n xl: 1920,\n xxl: 1920,\n },\n // Type 3\n breakpoints3: {\n xxs: 100,\n xs: 480,\n s: 600,\n m: 768,\n l: 1024,\n xl: 1280,\n xxl: 1900,\n },\n // Type 4\n breakpoints4: {\n xxs: 600,\n xs: 768,\n s: 1024,\n m: 1280,\n l: 1900,\n xl: 1900,\n xxl: 1900,\n },\n },\n userConfig: {\n type: undefined,\n age: undefined,\n gender: undefined,\n },\n conflictManagementConfig: {\n 'blocking.ad.unit.name': [\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n {\n onsize: '1280x200,970x250,3x3',\n avoid: 'blocked.ad.unit.name',\n },\n ],\n },\n impressionManagerConfig: {\n 'ad.unit.name': {\n target: 'all|section|homepage',\n frequency: '$1/$2(day|hour)',\n exposed: 0,\n expires: (new Date()).getTime(),\n },\n },\n googleGlobalSettings: {\n enableSingleRequest: true,\n enableAsyncRendering: true,\n refreshIntervalTime: 1000,\n breakpointType: 'type1',\n },\n sso: ssoKey,\n\n}, dfpBaseConf);\n\nexport default dfpConfig;\n","import globalConfig from '../globalConfig';\nimport { addHours, addDays } from '../utils/time';\nimport { debounce } from '../utils/breakpoints';\n\nexport const keys = {\n impressions: 'impressions',\n frequency: 'frequency',\n /**\n * [0] - full match\n * [1] - impression count i.e: \"1\" | \"22\"\n * [2] - impression expiry range quantifier i.e: \"1\" | \"22\"\n * [3] - impression expiry range unit i.e: \"day\" | \"hour\"\n */\n frequencyRegex: /(\\d+)\\/(\\d+)(day|hour)/,\n expires: 'expires',\n exposed: 'exposed',\n target: 'target',\n maxImpressions: 'maxImpressions',\n hours: 'hour',\n days: 'day',\n adSlotId: 'id',\n};\n\nexport default class ImpressionsManager {\n\n constructor(impressionManagerConfig) {\n this.now = (new Date()).getTime(); // this date is used for comparisons only\n this.config = Object.assign({}, impressionManagerConfig);\n this.impressions = this.retrieveImpressionsData();\n this.initImpressionMap();\n }\n\n retrieveImpressionsData() {\n const impressions = this.migrateImpressionsData();\n /*\n Merge migrated data with new data\n console.log('Migrated: ',impressions);\n */\n Object.keys(impressions).map((key, index) => {\n impressions[key] = Object.assign({}, impressions[key], this.config[key]);\n return this;\n });\n /*\n console.log('Merged: ',impressions);\n Filter out entries without frequency\n */\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (!impressions[key][keys.frequency]) {\n // console.log(`Removing ${key} - since it does not have a frequency`,impressions[key]);\n delete impressions[key];\n }\n }\n }\n // console.log('Filtered: ',impressions);\n return impressions;\n }\n\n migrateImpressionsData() {\n let impressions;\n let impressionsData;\n try {\n impressionsData = window.localStorage.getItem(keys.impressions);\n }\n catch (err) {\n // In case of thrown 'SecurityError' or 'QuotaExceededError', the variable should be undefined\n impressionsData = undefined;\n }\n try {\n impressions = JSON.parse(impressionsData);\n }\n catch (err) {\n // Here is where old impression data is converted to new format\n impressions = {};\n const oldImpressionsArray = impressionsData.split(';').filter(e => e);\n\n oldImpressionsArray.forEach((impression) => {\n try {\n const adUnitImpression = impression.split(' = ');\n const name = adUnitImpression[0];\n const data = adUnitImpression[1];\n const tmp = name.split('.');\n let target = tmp.pop();\n if (target && target === 'hp') {\n target = 'homepage';\n }\n const slotId = tmp.join('.');\n const id = `${slotId}_${target}`;\n const exposed = parseInt(data.split('/')[0], 10) || 0;\n const expires = parseInt(data.split('/')[1], 10) || this.now;\n impressions[id] = {};\n impressions[id][keys.adSlotId] = slotId;\n impressions[id][keys.target] = target;\n impressions[id][keys.exposed] = exposed;\n impressions[id][keys.expires] = expires;\n }\n catch (err1) {\n // console.log(`Failed converting impression: ${impression}`, err1);\n }\n });\n }\n return impressions || {};\n }\n\n /**\n * Define the debounced version of the local storage save\n */\n saveImpressionsToLocalStorage() {\n if (this.debouncedSave && typeof this.debouncedSave === 'function') {\n this.debouncedSave();\n }\n else {\n this.debouncedSave = debounce(this.saveImpressionsToLocalStorageImpl, 250, false);\n this.debouncedSave();\n }\n }\n\n /**\n * Implementation of saving the impression map to localstorage\n */\n saveImpressionsToLocalStorageImpl() {\n try {\n localStorage.setItem(keys.impressions, JSON.stringify(this.impressions));\n }\n catch (err) {\n /* In case of thrown 'SecurityError' or 'QuotaExceededError',\n the operation should not break*/\n console.error('localStorage isn\\'t available:', err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Initializes the impression map based on the retrieved impressions and the global\n * configuration.\n */\n initImpressionMap() {\n Object.keys(this.config).map((key, index) => {\n const adSlotId = key;\n const slot = this.impressions[adSlotId];\n let shouldUpdateExpiryDate = false;\n // Case I: Existing slot (update)\n if (slot) {\n // Case I.I Existing slot, frequency has changed\n if (this.config[adSlotId][keys.frequency] !== slot[keys.frequency]) {\n // Updating the frequency will trigger a new expiry date\n shouldUpdateExpiryDate = true;\n this.impressions[adSlotId][keys.frequency] = this.config[adSlotId][keys.frequency];\n } // Case I.II Existing slot, old expiry date\n else if (this.now > slot[keys.expires]) {\n // Old value that should trigger a new expiry date\n shouldUpdateExpiryDate = true;\n }\n } // Case II: Non-existing slot (create new slot)\n else {\n this.initSlotFromConfig(adSlotId);\n } // Finally, updates the expiry date (cases I.I and I.II)\n if (shouldUpdateExpiryDate) {\n this.updateExpiryDate(adSlotId);\n }\n return this;\n });\n }\n\n /**\n * Updates the expiry date of a slotName based on the configured slot frequency\n * @param {String} slotName - the slotName to update.\n */\n updateExpiryDate(slotName) {\n const now = new Date();\n if (!(this.impressions[slotName] && this.impressions[slotName][keys.frequency])) {\n throw new Error(`Unable to update expiry date for slot: ${slotName}\n - this.impressions[slotName]:`, this.impressions[slotName]);\n }\n const frequencyMap = this.impressions[slotName][keys.frequency].match(keys.frequencyRegex);\n now.setMilliseconds(0);\n now.setSeconds(0);\n now.setMinutes(0);\n if (frequencyMap.indexOf(keys.days) > -1) {\n now.setHours(0);\n }\n this.impressions[slotName][keys.expires] = (frequencyMap.indexOf(keys.days) > -1 ?\n addDays(now, frequencyMap[2]) : addHours(now, frequencyMap[2])).getTime();\n\n // Set max impressions:\n this.impressions[slotName][keys.maxImpressions] = parseInt(frequencyMap[1], 10);\n // Reset exposed\n this.impressions[slotName][keys.exposed] = 0;\n }\n\n /**\n * Initializes a non-existing slot from the passed global configuration for the slot\n * @param {String} slotName - the name of the slot to create\n */\n initSlotFromConfig(slotName) {\n const slot = this.impressions[slotName] || {};\n slot[keys.frequency] = this.config[slotName][keys.frequency];\n slot[keys.target] = this.config[slotName][keys.target];\n slot[keys.exposed] = 0;\n this.impressions[slotName] = slot;\n this.updateExpiryDate(slotName);\n }\n\n /**\n * Registers an impression for a given adSlot.\n * @param {String} adSlotId - the adSlot id to register an impression for\n * @returns {boolean} returns true iff the impression has been registered\n */\n registerImpression(adSlotId) {\n if (adSlotId) {\n const slot = this.impressions[adSlotId];\n if (slot) {\n const exposed = slot[keys.exposed];\n if (isNaN(parseInt(exposed, 10)) === false) {\n this.impressions[adSlotId][keys.exposed] += 1;\n try {\n this.saveImpressionsToLocalStorage();\n }\n catch (err) {\n // console.log('Error saving ad impressions to localStorage!', err);\n }\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Checks whether an adSlot has reached it's allocated impressions count.\n * @param {String} adSlotId - the adSlot to check\n * @returns {boolean} true iff there is a quota for the adSlot, and it has been reached\n */\n reachedQuota(adSlotId) {\n // An adSlotId is suffixed with _homepage | _section if it's targeting is different\n // between the two. If there is no difference, an _all suffix can be used.\n const slotName = this.impressions[`${adSlotId}${globalConfig.department}`] ?\n `${adSlotId}${globalConfig.department}` : `${adSlotId}_all`;\n\n const slot = this.impressions[slotName];\n let atQuota = false;\n if (slot) {\n const now = (new Date()).getTime();\n // Second element of 2/4day matches '2'\n const expires = this.impressions[slotName][keys.expires];\n if (expires < now) {\n this.updateExpiryDate(slotName);\n }\n else {\n const maxImpressions = this.impressions[slotName][keys.maxImpressions];\n // Not expired, did reach max impressions?\n if (maxImpressions) {\n atQuota = this.impressions[slotName][keys.exposed] >= maxImpressions;\n }\n }\n }\n return atQuota;\n }\n\n\n /**\n * Clears the impression map from 'exposed' impressions\n */\n resetImpressions() {\n const impressions = this.impressions;\n for (const key in impressions) {\n if ({}.hasOwnProperty.call(impressions, key)) {\n if (impressions[key][keys.exposed]) {\n impressions[key][keys.exposed] = 0;\n }\n }\n }\n this.saveImpressionsToLocalStorage();\n }\n}\n","import getCookieAsMap from '../utils/cookieUtils';\nimport ImpressionManager from './impressionsManager';\nimport globalConfig from '../globalConfig';\n\nexport const userTypes = {\n payer: 'payer',\n registered: 'registered',\n anonymous: 'anonymous',\n trial: 'trial',\n guest: 'reg_guest',\n};\n\nexport const productTypes = {\n htz: 243,\n tm: 273,\n hdc: 239,\n htz_tm: 274,\n};\n\nexport default class User {\n constructor(config) {\n this.config = Object.assign({}, config.userConfig);\n const cookieMap = getCookieAsMap();\n this.ssoKey = globalConfig.sso;\n if (!cookieMap[this.ssoKey]) {\n // Flips the ssoKey, since cookieMap.ssoKey cannot be used to retrieve data\n this.ssoKey = this.ssoKey === 'tmsso' ? 'engsso' : 'tmsso';\n }\n this.type = this.getUserType(cookieMap);\n this.htz_type = this.getUserTypeByProduct(cookieMap, productTypes.htz, 'tmsso');\n this.tm_type = this.getUserTypeByProduct(cookieMap, productTypes.tm, 'tmsso');\n this.hdc_type = this.getUserTypeByProduct(cookieMap, productTypes.hdc, 'engsso');\n this.impressionManager = new ImpressionManager(config.impressionManagerConfig);\n this.age = this.getUserAge(cookieMap);\n this.gender = this.getUserGender(cookieMap);\n this.sso = this.getUserSSO(cookieMap, this.ssoKey);\n this.country = this.getUserCountry();\n }\n\n getUserType(cookieMap) {\n let userType;\n if (cookieMap && cookieMap[this.ssoKey]) {\n userType = (cookieMap.HtzPusr || cookieMap.TmPusr || cookieMap.HdcPusr) ?\n userTypes.payer : userTypes.registered;\n }\n else {\n userType = userTypes.anonymous;\n }\n return userType;\n }\n\n\n getUserTypeByProduct(cookieMap, productType, ssoKey) {\n let userType = userTypes.anonymous;\n if (cookieMap && cookieMap[ssoKey]) {\n if (cookieMap.userProducts) {\n let userProducts = decodeURIComponent(cookieMap.userProducts);\n userProducts = JSON.parse(userProducts);\n if (productType === productTypes.hdc) {\n userType = this.getHdcUserType(userProducts);\n }\n else {\n userType = this.getHtzTmUserType(userProducts, productType);\n }\n if (userType === userTypes.registered &&\n cookieMap[ssoKey].firstName === 'guest' &&\n cookieMap[ssoKey].lastName === 'guest') {\n userType = userTypes.guest;\n }\n }\n }\n return userType;\n }\n\n getHdcUserType(userProducts) {\n // user has hdc paying product\n if (this.userHasProduct(userProducts, productTypes.hdc, false)) {\n return userTypes.payer;\n }\n // user has hdc trial product\n else if (this.userHasProduct(userProducts, productTypes.hdc, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n getHtzTmUserType(userProducts, productType) {\n // user has htz/tm paying product\n if (this.userHasProduct(userProducts, productType, false) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, false)) {\n return userTypes.payer;\n }\n // user has htz/tm trial product\n else if (this.userHasProduct(userProducts, productType, true) ||\n this.userHasProduct(userProducts, productTypes.htz_tm, true)) {\n return userTypes.trial;\n }\n return userTypes.registered;\n }\n\n userHasProduct(userProducts, productType, trial) {\n return userProducts.products\n .filter(product => product.prodNum === productType && product.trial === trial)\n .length > 0;\n }\n\n getUserAge(cookieMap) {\n let age;\n const usrae = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].usrae;\n if (usrae) {\n age = parseInt(cookieMap[this.ssoKey].usrae, 10);\n age = age > 0 ? age : undefined;\n }\n return age;\n }\n\n getUserGender(cookieMap) {\n let gender;\n const urgdr = cookieMap[this.ssoKey] && cookieMap[this.ssoKey].urgdr;\n if (urgdr) {\n gender = parseInt(cookieMap[this.ssoKey].urgdr, 10);\n gender = gender === 2 || gender === 1 ? gender : undefined;\n }\n return gender;\n }\n\n getUserSSO(cookieMap, ssoKey) {\n return cookieMap[ssoKey];\n }\n\n getUserCountry() {\n const country = window.localStorage.getItem('country');\n if (!country) {\n fetch('https://ms-apps.haaretz.co.il/ms-ip2country/get', {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/jsonp',\n },\n }).then(resp => resp.json())\n .then(data => {\n window.localStorage.setItem('country', data.code);\n },\n err => {}\n );\n return null;\n }\n return country;\n }\n\n}\n","class ConflictResolver {\n constructor(conflictManagementConfig) {\n this.dependencyMap = this.initializeDependencyMap(conflictManagementConfig);\n this.deferredSlots = new Set();\n }\n initializeDependencyMap(conflictManagementJson) {\n const queue = new Map();\n Object.keys(conflictManagementJson).map((key, value) => {\n let rules = conflictManagementJson[key];\n if (rules) {\n rules = rules.filter((item) => item.onsize && item.avoid);\n }\n queue.set(key, {\n id: key,\n rules,\n resolvedWith: null,\n });\n return this;\n });\n return queue;\n }\n\n updateResolvedSlot(adSlotId, resolvedSize) {\n if (!adSlotId) {\n throw new Error('updateResolvedSlot must be called with an adSlotId!');\n }\n if (!resolvedSize) {\n throw new Error('updateResolvedSlot must be called with a resolved size!');\n }\n if (this.dependencyMap.has(adSlotId)) {\n this.dependencyMap.get(adSlotId).resolvedWith = resolvedSize;\n }\n }\n\n\n isBlocked(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocked must be called with an adSlotId!');\n }\n let isBlocked = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n const adSlot = this.dependencyMap.get(adSlotKey);\n for (const adSlotRule of adSlot.rules) {\n // Found rule specific to our target\n if (adSlotRule.avoid === adSlotId) {\n const parentResolvedWith = adSlot.resolvedWith;\n if (parentResolvedWith && adSlotRule.onsize.split(',').find(sizeString => { // eslint-disable-line\n const size = sizeString.split('x').map(numberStr => parseInt(numberStr, 10));\n return this.arraysEqual(size, parentResolvedWith);\n })) {\n // Block found\n this.deferredSlots.add(adSlotId);\n isBlocked = true;\n }\n }\n }\n }\n return isBlocked;\n }\n\n isBlocking(adSlotId) {\n if (!adSlotId) {\n throw new Error('isBlocking must be called with an adSlotId!');\n }\n let isBlocking = false;\n for (const adSlotKey of this.dependencyMap.keys()) {\n if (adSlotKey === adSlotId) {\n isBlocking = true;\n }\n }\n return isBlocking;\n }\n\n /**\n * Gets an array of adSlot Ids for a given adSlotId, that are dependent on (blocked by)\n * @param {String} adSlotId - the blocking slot id\n * @return {Array} an array of blocked slot, that has a dependency on the given slot\n */\n getBlockedSlotsIds(adSlotId) {\n let result;\n if (this.dependencyMap.has(adSlotId)) {\n result = Array.from(this.dependencyMap.get(adSlotId).rules.map(adSlot => adSlot.avoid));\n }\n return result || [];\n }\n\n arraysEqual(a, b) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n }\n}\nConflictResolver.EMPTY_SIZE = [];\nexport default ConflictResolver;\n","/* global googletag */\nimport { adTypes } from '../objects/adManager';\nimport globalConfig from '../globalConfig';\nimport { arraysEqual } from '../utils/arrays';\n\nconst hiddenClass = globalConfig.site.indexOf('mouse') > -1 ? 'u-is-hidden' : 'h-hidden';\n\nexport default class adSlot {\n\n constructor(adSlotConfig) {\n this.config = Object.assign({}, adSlotConfig);\n\n // Part I : Markup configuration - passed from AdManager\n this.id = this.config.id;\n if (!this.config.id) {\n throw new Error('an adSlot requires an id!');\n }\n this.target = this.config.target;\n this.type = this.config.type;\n this.responsive = this.config.responsive;\n this.fluid = this.config.fluid;\n this.user = this.config.user;\n this.adManager = this.config.adManager;\n this.htmlElement = this.config.htmlElement;\n this.priority = this.config.priority;\n this.deferredSlot = this.config.deferredSlot;\n\n // Part II : Global, general ad configuration - passed from AdManager\n this.department = this.config.department;\n this.network = this.config.network;\n this.adUnitBase = this.config.adUnitBase;\n\n // Part III : ad specific configuration - passed from globalConfig.adSlotConfig\n this.adSizeMapping = this.config.adSizeMapping;\n this.responsiveAdSizeMapping = this.config.responsiveAdSizeMapping;\n this.blacklistReferrers = this.config.blacklistReferrers ?\n this.config.blacklistReferrers.split(',') : [];\n this.whitelistReferrers = this.config.whitelistReferrers ?\n this.config.whitelistReferrers.split(',') : [];\n\n\n // Part IV : Runtime configuration - calculated data - only present in runtime\n this.lastResolvedSize = undefined; // Initialized in 'slotRenderEnded' callback\n this.lastResolvedWithBreakpoint = undefined; // Initialized in 'slotRenderEnded' callback\n this.slot = undefined; // Holds a googletag.Slot object\n // [https://developers.google.com/doubleclick-gpt/reference#googletag.Slot]\n try {\n if (!this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Checks whether this adSlot is an 'Out-of-page' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isOutOfPage() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n case adTypes.popunder: return true;\n case adTypes.talkback: return false;\n case adTypes.regular: return false;\n default: return false;\n }\n }\n\n /**\n * Checks whether this adSlot is a 'maavaron' slot or not.\n * An Out-of-page slot is a slot that is not embedded in the page 'normally'.\n * @returns {boolean} true iff this adSlot is one of the predefined 'out-of-page' slots.\n */\n isMaavaron() {\n if (typeof this.type !== 'string') {\n throw new Error('An adSlot cannot by typeless!', this);\n }\n if (this.isMobile() === true) {\n return false;\n }\n switch (this.type) {\n case adTypes.maavaron: return false;\n default: return false;\n }\n }\n\n isMobile() {\n return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i\n .test(window.navigator.userAgent || ''));\n }\n /**\n * Checks whether or not this adSlot has a non-empty whitelist, and if so, that the current\n * referrer appears in the whitelist.\n * Should return false iff there is a whitelist for the current adSlot, but the referrer is not\n * mentioned in the whitelist.\n * @returns {boolean} true iff the ad can be displayed.\n */\n isWhitelisted() {\n let whitelisted = false;\n if (this.whitelistReferrers.length !== 0) {\n for (const referrer of this.whitelistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n whitelisted = true;\n break;\n }\n }\n }\n else {\n whitelisted = true;\n }\n return whitelisted;\n }\n\n /**\n * Checks whether or not this adSlot has a non-empty blacklist, and if so, that the current\n * referrer does not appear in the blacklist.\n * Should return true iff there is a blacklist for the current adSlot, and the referrer is\n * mentioned in the blacklist - to indicate that the adSlot is 'blocked'.\n * @returns {boolean} true iff the ad cannot be displayed.\n */\n isBlacklisted() {\n let blacklisted = false;\n if (this.blacklistReferrers.length !== 0) {\n for (const referrer of this.blacklistReferrers) {\n if (globalConfig.referrer.indexOf(referrer) > -1) {\n blacklisted = true;\n break;\n }\n }\n }\n return blacklisted;\n }\n\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n show() {\n if (!this.shown === true) {\n this.shown = true; // Ensure show will be called once per adSlot\n googletag.cmd.push(() => {\n if (this.deferredSlot) {\n this.slot = this.defineSlot();\n }\n // console.log('calling show for slot',this.id,' called @',window.performance.now());\n document.getElementById(this.id).classList.remove(hiddenClass);\n googletag.display(this.id);\n });\n }\n }\n\n /**\n * Shows the current adSlot.\n * It assumes a markup is available for this slot (any tag with an id attribute = this.id)\n */\n hide() {\n googletag.cmd.push(() => {\n document.getElementById(this.id).classList.add(hiddenClass);\n });\n }\n\n /**\n * Initializes page-level slot definition for the current slot\n * @return {Slot} slot - the Google Slot that was defined from this AdSlot configuration\n */\n defineSlot() {\n if (this.isMaavaron()) {\n const maavaronSlot = this.defineMaavaron();\n if (this.adManager.shouldSendRequestToDfp(this)) {\n if (!this.shown) {\n this.shown = true; // Ensure show will be called once\n maavaronSlot.display();\n }\n }\n return maavaronSlot;\n }\n const googletag = window.googletag;\n const pubads = googletag.pubads();\n const args = [];\n const defineFn = this.isOutOfPage() ? googletag.defineOutOfPageSlot : googletag.defineSlot;\n // 3 or 2 params according to the function that we want to activate.\n args.push(this.getPath());\n if (this.isOutOfPage() === false) {\n if (this.fluid) {\n args.push('fluid');\n }\n else {\n args.push(this.adSizeMapping);\n }\n }\n args.push(this.id);\n let slot = defineFn.apply(defineFn, args);\n if (slot) {\n // Responsive size Mapping\n if (this.responsive) {\n let responsiveSlotSizeMapping = googletag.sizeMapping();\n const breakpoints = globalConfig.breakpointsConfig.breakpoints;\n const keys = Object.keys(this.responsiveAdSizeMapping);\n for (const key of keys) { // ['xxs','xs',...]\n responsiveSlotSizeMapping.addSize(\n [breakpoints[key], 100], // 100 is a default height, since it is height agnostic\n !arraysEqual(this.responsiveAdSizeMapping[key], [[0, 0]]) ?\n this.responsiveAdSizeMapping[key] : []);\n }\n responsiveSlotSizeMapping = responsiveSlotSizeMapping.build();\n slot = slot.defineSizeMapping(responsiveSlotSizeMapping);\n }\n slot = slot.addService(pubads);\n if (this.isOutOfPage() === false) {\n slot.setCollapseEmptyDiv(true);\n }\n }\n return slot;\n }\n\n /**\n * Returns the current path calculated for the adSlot\n * @returns {String} a formatted string that represent the path for the slot definition\n */\n getPath() {\n /* eslint-disable no-shadow */\n let path = globalConfig.path || [];\n path = path.filter(path => path !== '.');\n path = path.map(section => `${this.id}${this.department}${section}`).join('/');\n // If a path exist, it will be preceded with a forward slash\n path = path && this.config.department !== '_homepage' ? `/${path}` : '';\n /* eslint-enable no-shadow */\n const calculatedPath = `/${this.config.network}/${this.config.adUnitBase}/${this.id}/${this.id}${this.department}${path}`; // eslint-disable-line max-len\n return calculatedPath.toLowerCase();\n }\n\n /* eslint-disable */\n slotRendered(event) {\n const id = event.slot.getAdUnitPath().split('/')[3]; // Convention: [0]/[1]network/[2]base/[3]id\n const isEmpty = event.isEmpty; // Did the ad return as empty?\n const resolvedSize = event.size; // What 'creative' size did the ad return with?\n // Empty or onload callback should be called next?\n }\n /* eslint-enable */\n\n /**\n * Refresh this adSlot\n */\n refresh() {\n googletag.cmd.push(() => {\n googletag.pubads().refresh([this.slot]);\n });\n }\n\n /**\n * Shows 'Maavaron' type adSlot using Passback definition\n * @return {Slot} slot - the Google Slot that was defined for Maavaron\n */\n defineMaavaron() {\n if (!document.referrer.match('loc.haaretz')) {\n const adUnitMaavaronPath = this.getPath();\n const adUnitMaavaronSize = [\n [2, 1],\n ];\n const slot = googletag.pubads().definePassback(adUnitMaavaronPath, adUnitMaavaronSize)\n .setTargeting('UserType', [this.user.type])\n .setTargeting('age', [this.user.age])\n .setTargeting('urgdr', [this.user.gender])\n .setTargeting('articleId', [globalConfig.articleId])\n .setTargeting('stg', [globalConfig.environment]);\n return slot;\n }\n return null;\n }\n}\n","/* global googletag */\nimport User from '../objects/user';\nimport ConflictResolver from '../objects/conflictResolver';\nimport AdSlot from '../objects/adSlot';\nimport { getBreakpoint, getBreakpointName } from '../utils/breakpoints';\nimport { arraysEqual } from '../utils/arrays';\nimport getCookieAsMap from '../utils/cookieUtils';\n\n// There are a total of 7 adTargets:\n// \"all\",\"nonPaying\",\"anonymous\",\"registered\",\"paying\",\"digitalOnly\" and \"digitalAndPrint\"\nexport const adPriorities = {\n high: 'high',\n normal: 'normal',\n low: 'low',\n};\n\nexport const adTargets = {\n all: 'all',\n nonPaying: 'nonPaying',\n anonymous: 'anonymous',\n registered: 'registered',\n paying: 'paying',\n digitalOnly: 'digitalOnly',\n digitalAndPrint: 'digitalAndPrint',\n};\n\n// There are a total of 3 userTypes: \"anonymous\", \"registered\" and \"payer\"\nexport const userTypes = {\n anonymous: 'anonymous',\n registered: 'registered',\n payer: 'payer',\n};\n\nexport const adTypes = {\n maavaron: '.maavaron',\n popunder: '.popunder',\n talkback: '.talkback',\n regular: '',\n};\n\n\nexport default class AdManager {\n\n constructor(config) {\n this.config = Object.assign({}, config);\n this.user = new User(config);\n this.conflictResolver = new ConflictResolver(config.conflictManagementConfig);\n /**\n * Avoid race conditions by making sure to respect the usual timing of GPT.\n * This DFP implementation uses Enable-Define-Display:\n * Define page-level settings\n * enableServices()\n * Define slots\n * Display slots\n */\n try {\n googletag.cmd.push(() => {\n this.initGoogleTargetingParams(); // Define page-level settings\n this.initGoogleGlobalSettings(); // enableServices()\n this.initSlotRenderedCallback(); // Define callbacks\n });\n // Mouse special treatment to base path on mobile breakpoints\n const currentBreakpointName = getBreakpointName(getBreakpoint());\n if (this.config.adManagerConfig.adUnitBase.indexOf('mouse.co.il') > -1 &&\n currentBreakpointName.indexOf('xs') > -1) {\n this.config.adManagerConfig.adUnitBase = 'mouse.co.il.mobile_web';\n }\n // Holds adSlot objects as soon as possible.\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n });\n // Once DOM ready, add more adSlots.\n const onDomLoaded = () => { // eslint-disable-line no-inner-declarations\n try {\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.high);\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.normal);\n });\n });\n }\n catch (err) {\n console.log(err); // eslint-disable-line no-console\n }\n };\n // Once window was loaded, add the rest of the adSlots.\n const onWindowLoaded = () => { // eslint-disable-line no-inner-declarations\n googletag.cmd.push(() => {\n this.adSlots = this.initAdSlots(config.adSlotConfig, adPriorities.low);\n // Clean blocking adSlots that are not defined on this page\n for (const blockingAdSlotKey of this.conflictResolver.dependencyMap.keys()) {\n if (!this.adSlots.has(blockingAdSlotKey)) {\n this.conflictResolver.dependencyMap.delete(blockingAdSlotKey);\n }\n }\n this.showAllDeferredSlots();\n });\n };\n switch (document.readyState) {\n case 'loading':\n document.addEventListener('DOMContentLoaded', onDomLoaded);\n window.addEventListener('load', onWindowLoaded);\n break;\n case 'interactive':\n onDomLoaded();\n window.addEventListener('load', onWindowLoaded);\n break;\n default: // 'complete' - no need for event listeners.\n onDomLoaded();\n onWindowLoaded();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * Shows all of the adSlots that can be displayed.\n */\n showAllSlots() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.type !== adTypes.talkback && this.shouldSendRequestToDfp(adSlot)) {\n adSlot.show();\n }\n }\n }\n\n /**\n * Gets all adSlots that has a certain priority\n * @param {adPriority} priority - the priority of the ad {high, normal, low}\n * @return {Array} adSlots - all of the defined adSlots that matches\n * the given priority\n */\n getAdSlotsByPriority(priority) {\n function priorityFilter(adSlot) {\n return adSlot.priority === priority;\n }\n return Array.from(this.adSlots.values()).filter(priorityFilter);\n }\n\n showAllDeferredSlots() {\n for (const deferredSlotId of this.conflictResolver.deferredSlots) {\n if (this.adSlots.has(deferredSlotId)) {\n if (!this.conflictResolver.isBlocked(deferredSlotId)) {\n const deferredAdSlot = this.adSlots.get(deferredSlotId);\n if (this.shouldSendRequestToDfp(deferredAdSlot)) {\n deferredAdSlot.show();\n }\n }\n }\n }\n }\n\n /**\n * Refreshes all responsive adSlots\n */\n refreshAllSlots() {\n const currentBreakpoint = getBreakpoint();\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive && adSlot.type !== adTypes.maavaron) {\n if (adSlot.lastResolvedWithBreakpoint !== currentBreakpoint &&\n this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n }\n\n /**\n * Refreshes all adSlots\n */\n refreshAllSlotsInPage() {\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n }\n\n /**\n * Refreshes adSlot\n */\n\n refreshSlot(adUnitName) {\n const adSlot = this.adSlots.get(adUnitName);\n if (this.shouldSendRequestToDfp(adSlot)) {\n // console.log(`calling refresh for adSlot: ${adSlot.id}`);\n adSlot.refresh();\n }\n else {\n adSlot.hide();\n }\n }\n\n\n /**\n * Initializes adSlots based on the currently found slot markup (HTML page specific),\n * and the predefined configuration for the slots.\n * @param {Object} adSlotConfig - the AdSlots configuration object (see: globalConfig)\n * @param {String} filteredPriority - filters out all adSlots that does not match\n * a given adPriority. This is used to cherry pick the init process of ads.\n * @returns {Map}\n */\n initAdSlots(adSlotConfig, filteredPriority) {\n const adSlots = new Map(this.adSlots);\n let adSlotPlaceholders = Array.from(document.getElementsByClassName('js-dfp-ad'));\n adSlotPlaceholders = adSlotPlaceholders.filter(node => node.id); // only nodes with an id\n const adSlotNodeSet = new Set();\n adSlotPlaceholders = Array.prototype.filter.call(adSlotPlaceholders, node => {\n if (adSlotNodeSet.has(node.id) === false) { // first occurrence of Node\n adSlotNodeSet.add(node.id);\n return true;\n }\n return false;\n });\n // adSlotPlaceholders = adSlotPlaceholders.sort((a, b) => a.offsetTop - b.offsetTop);\n adSlotPlaceholders.forEach(adSlot => {\n const adSlotPriority = adSlotConfig[adSlot.id] ?\n adSlotConfig[adSlot.id].priority || adPriorities.normal : undefined;\n if (adSlotConfig[adSlot.id] && adSlots.has(adSlot.id) === false &&\n adSlotPriority === filteredPriority) {\n // The markup has a matching configuration from adSlotConfig AND was not already defined\n try {\n // adSlotConfig is built from globalConfig, but can be overridden by markup\n const computedAdSlotConfig = Object.assign({}, adSlotConfig[adSlot.id], {\n id: adSlot.id,\n target: adSlot.attributes['data-audtarget'] ?\n adSlot.attributes['data-audtarget'].value : adTargets.all,\n type: this.getAdType(adSlot.id),\n responsive: adSlotConfig[adSlot.id].responsive,\n fluid: adSlotConfig[adSlot.id].fluid || false,\n user: this.user,\n adManager: this,\n htmlElement: adSlot,\n department: this.config.department,\n network: this.config.adManagerConfig.network,\n adUnitBase: this.config.adManagerConfig.adUnitBase,\n deferredSlot: this.conflictResolver.isBlocked(adSlot.id),\n priority: adSlotPriority,\n });\n const adSlotInstance = new AdSlot(computedAdSlotConfig);\n adSlots.set(adSlot.id, adSlotInstance);\n if (adSlotInstance.type !== adTypes.talkback &&\n adSlotInstance.priority === adPriorities.high &&\n this.shouldSendRequestToDfp(adSlotInstance)) {\n /*\n console.log('calling show for high priority slot', adSlotInstance.id, ' called @',\n window.performance.now());\n */\n adSlotInstance.show();\n }\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n });\n return adSlots;\n }\n\n isPriority(adSlotId) {\n return (typeof adSlotId === 'string' &&\n (adSlotId.indexOf('plazma') > 0 ||\n adSlotId.indexOf('maavaron') > 0 ||\n adSlotId.indexOf('popunder') > 0));\n }\n\n /**\n * Returns the adType based on the adSlot name.\n * @param {String} adSlotId - the adSlot's identifier.\n * @returns {*} enumerated export 'adTypes'\n */\n getAdType(adSlotId) {\n if (!adSlotId) {\n throw new Error('Missing argument: a call to getAdType must have an adSlotId');\n }\n if (adSlotId.indexOf(adTypes.maavaron) > -1) return adTypes.maavaron;\n if (adSlotId.indexOf(adTypes.popunder) > -1) return adTypes.popunder;\n if (adSlotId.indexOf(adTypes.talkback) > -1) return adTypes.talkback;\n return adTypes.regular;\n }\n\n /**\n * @param {object} adSlot the AdSlot\n * @returns {boolean|*}\n */\n shouldSendRequestToDfp(adSlot) {\n // Conflict management check\n return this.conflictResolver.isBlocked(adSlot.id) === false &&\n // Valid Referrer check\n adSlot.isWhitelisted() &&\n // Not in referrer Blacklist\n adSlot.isBlacklisted() === false &&\n this.shouldDisplayAdAfterAdBlockRemoval(adSlot) &&\n // if a paywall pop-up is shown And the number is 12 or more - SHOW MAAVRON\n this.shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) &&\n // Responsive: breakpoint contains ad?\n this.doesBreakpointContainAd(adSlot) &&\n // check in case of Smartphoneapp\n this.haveValidCookieForSmartphoneapp() &&\n // Targeting check (userType vs. slotTargeting)\n this.doesUserTypeMatchBannerTargeting(adSlot) &&\n // Impressions Manager check (limits number of impressions per slot)\n this.user.impressionManager.reachedQuota(adSlot.id) === false &&\n // if the app promotion interstitial DOES NOT pop - SHOW MAAVARON\n this.shouldAppPromotionElementPop() === false;\n }\n\n printShouldSendRequestToDfp(id) {\n let res = '';\n if (!this.adSlots.has(id)) {\n res = `id not exist: ${id}`;\n }\n else {\n const a = this.adSlots.get(id);\n res += this.conflictResolver.isBlocked(a.id) === !1 ? '' : 'isBlocked,';\n res += a.isWhitelisted() ? '' : 'isWhitelisted,';\n res += a.isBlacklisted() === !1 ? '' : 'isBlacklisted,';\n res += this.shouldDisplayAdAfterAdBlockRemoval(a) ? '' : 'AdBlockRemoval,';\n res += this.shouldDisplayAdMaavaronAfterPayWallBanner(a) ? '' : 'PayWallBanner,';\n res += this.doesBreakpointContainAd(a) ? '' : 'Breakpoint,';\n res += this.haveValidCookieForSmartphoneapp() ? '' : 'Smartphoneapp,';\n res += this.doesUserTypeMatchBannerTargeting(a) ? '' : 'Targeting,';\n res += this.user.impressionManager.reachedQuota(a.id) === !1 ? '' : 'reachedQuota,';\n res = `
${id}
${res}
`;\n }\n document.write(res);\n return res;\n }\n\n testShouldSendRequestToDfp(id) {\n // leave the old name for ios legacy\n let cookieMap = getCookieAsMap();\n cookieMap = JSON.stringify(cookieMap);\n cookieMap = cookieMap.replace(/,/g, '
');\n const res = `
${cookieMap}
`;\n document.write(res);\n return res;\n }\n\n shouldDisplayAdAfterAdBlockRemoval(adSlot) {\n return !(this.config.adBlockRemoved === true &&\n (adSlot.type === adTypes.maavaron ||\n adSlot.type === adTypes.popunder));\n }\n\n shouldDisplayAdMaavaronAfterPayWallBanner(adSlot) {\n let shouldDisplay = true;\n if (this.config.site === 'haaretz' && adSlot.type === adTypes.maavaron) {\n try {\n const paywallBanner = JSON.parse(window.localStorage.getItem('_cobj'));\n shouldDisplay = !paywallBanner || ((paywallBanner.mc && paywallBanner.mc >= 12) ||\n (paywallBanner.nextslotLocation &&\n !paywallBanner.nextslotLocation.includes('pop')));\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error('ERROR ON shouldDisplayAdMaavaronAfterPayWallBanner');\n /* eslint-enable no-console*/\n }\n }\n return shouldDisplay;\n }\n\n /**\n * Check if the app promotion interstitial should pop\n * when it does, the maavaron should not show up\n * @returns {boolean} true if the interstitial element should pop\n */\n shouldAppPromotionElementPop() {\n return typeof window.appPromotionElement !== 'undefined' &&\n typeof window.appPromotionElement.getShouldPop === 'function' ?\n window.appPromotionElement.getShouldPop() : false;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n\n haveValidCookieForSmartphoneapp() {\n return this.config.isValidForsmartPhone;\n }\n\n /**\n * Check whether or not an ad slot should appear for the current user type\n * @param {String} adSlotOrTarget the adSlot to check or the target as a string\n * @returns {boolean} true iff the slot should appear for the user type\n */\n doesUserTypeMatchBannerTargeting(adSlotOrTarget) {\n // if the user is smadar show her all the banners\n const cookieMap = getCookieAsMap();\n if (cookieMap.login === 'pilosmadar@gmail.com') {\n return true;\n }\n if (cookieMap.tmsso !== undefined && cookieMap.tmsso.userName === 'pilosmadar@gmail.com') {\n return true;\n }\n const userType = this.user.type;\n const adTarget = typeof adSlotOrTarget === 'string' ? adSlotOrTarget : adSlotOrTarget.target;\n\n switch (adTarget) {\n case adTargets.all : return true;\n case adTargets.nonPaying :\n return userType === userTypes.anonymous || userType === userTypes.registered;\n case adTargets.anonymous : return userType === userTypes.anonymous;\n case adTargets.registered : return userType === userTypes.registered;\n case adTargets.paying : return userType === userTypes.payer;\n case adTargets.digitalOnly : return userType === userTypes.payer;\n case adTargets.digitalAndPrint : return userType === userTypes.payer;\n default: return false;\n }\n }\n\n /**\n * Report to the AdManager that a breakpoint has been switched (passed from one break to\n * another). Should there be a responsive slot with a\n * @param {Breakpoint} breakpoint - the breakpoint that is currently being displayed\n * @returns {Integer} affected - the number of adSlots affected by the change\n */\n switchedToBreakpoint(breakpoint) {\n if (!breakpoint) {\n throw new Error('Missing argument: a call to switchedToBreakpoint must have an breakpoint');\n }\n let count = 0;\n for (const adSlotKey of this.adSlots.keys()) {\n const adSlot = this.adSlots.get(adSlotKey);\n if (adSlot.responsive === true && adSlot.lastResolvedWithBreakpoint) {\n if (adSlot.lastResolvedWithBreakpoint !== breakpoint) {\n adSlot.refresh();\n count++;\n }\n }\n }\n return count;\n }\n\n /**\n * Checks whether an adSlot is defined for a given breakpoint (Default: current breakpoint)\n * @param {AdSlot} adSlot - the adSlot to check.\n * @param {Breakpoint} [breakpoint=currentBreakpoint] - the breakpoint to check this ad in.\n * @returns {boolean} true iff the adSlot is defined for the given breakpoint.\n */\n doesBreakpointContainAd(adSlot, breakpoint = getBreakpoint()) {\n if (!adSlot) {\n throw new Error('Missing argument: a call to doesBreakpointContainAd must have an adSlot');\n }\n let containsBreakpoint = true;\n if (adSlot.responsive === true) {\n const mapping = adSlot.responsiveAdSizeMapping[getBreakpointName(breakpoint)];\n if (Array.isArray(mapping) === false) {\n throw new Error(`Invalid argument: breakpoint:${breakpoint} doesn't exist!`, this);\n }\n containsBreakpoint = mapping.length > 0 && !arraysEqual(mapping, [[0, 0]]);\n }\n return containsBreakpoint;\n }\n\n /**\n * Initializes the callback from the 'slotRenderEnded' event for each slot\n */\n initSlotRenderedCallback() {\n if (window.googletag && window.googletag.apiReady) {\n const pubads = window.googletag.pubads();\n pubads.addEventListener('slotRenderEnded', event => {\n const id = event.slot.getAdUnitPath().split('/')[3];\n const isEmpty = event.isEmpty;\n const resolvedSize = event.size;\n // console.log('slotRenderEnded for slot',id,' called @',window.performance.now());\n if (this.adSlots.has(id)) {\n const adSlot = this.adSlots.get(id);\n adSlot.lastResolvedSize = resolvedSize;\n adSlot.lastResolvedWithBreakpoint = getBreakpoint();\n if (isEmpty) {\n adSlot.lastResolvedSize = ConflictResolver.EMPTY_SIZE;\n adSlot.hide();\n this.releaseSlotDependencies(adSlot);\n }\n else {\n this.releaseSlotDependencies(adSlot, adSlot.lastResolvedSize);\n }\n this.user.impressionManager.registerImpression(`${adSlot.id}${this.config.department}`);\n this.user.impressionManager.registerImpression(`${adSlot.id}_all`);\n }\n else {\n /*\n console.error(`Cannot find an adSlot with id: ${id} - Ad Unit path is\n ${event.slot.getAdUnitPath()}`);\n */\n }\n });\n }\n else {\n throw new Error('googletag api was not ready when \\'initSlotRenderedCallback\\' was called!');\n }\n }\n\n releaseSlotDependencies(adSlot) {\n try {\n const id = adSlot.id;\n this.conflictResolver.updateResolvedSlot(id, adSlot.lastResolvedSize);\n if (this.conflictResolver.isBlocking(id)) {\n // Hide all blocked adSlots\n for (const blockedSlot of this.conflictResolver.getBlockedSlotsIds(id)) {\n if (this.conflictResolver.isBlocked(blockedSlot)) {\n if (this.adSlots.has(blockedSlot)) {\n this.adSlots.get(blockedSlot).hide();\n }\n }\n }\n // Show the non blocked\n for (const deferredSlotKey of this.conflictResolver.deferredSlots.keys()) {\n const deferredAdSlot = this.adSlots.get(deferredSlotKey);\n if (deferredAdSlot && this.shouldSendRequestToDfp(deferredAdSlot)) {\n this.conflictResolver.deferredSlots.delete(deferredSlotKey);\n if (deferredAdSlot.deferredSlot) {\n deferredAdSlot.defineSlot();\n deferredAdSlot.deferredSlot = false;\n }\n deferredAdSlot.show();\n }\n }\n }\n }\n catch (err) {\n /* eslint-disable no-console*/\n console.error(`Cannot updateSlotDependencies for adSlot: ${adSlot.id}`);\n /* eslint-enable no-console*/\n }\n }\n\n setSsoGroupKey() {\n fetch(`/ssoGroupKey?value=${this.user.sso.userId}`, {\n method: 'GET',\n cache: 'no-cache',\n }).then(value => {\n if (value) {\n value.json().then(data => {\n if (data && data.result && data.result !== 'item not found'\n && data.result !== 'value is empty') {\n localStorage.setItem('_SsoGroupKey', data.result);\n }\n });\n }\n });\n }\n\n /**\n * Initializes page-level targeting params.\n */\n initGoogleTargetingParams() {\n if (window.googletag && window.googletag.apiReady) {\n // Returns a reference to the pubads service.\n let SsoGroupKey = null;\n try {\n SsoGroupKey = localStorage.getItem('_SsoGroupKey');\n if (!SsoGroupKey && this.user.sso.userId) {\n this.setSsoGroupKey();\n }\n }\n catch (e) {\n SsoGroupKey = null;\n }\n const pubads = googletag.pubads();\n // Environment targeting (dev, test, prod)\n if (this.config.environment) {\n pubads.setTargeting('stg', [this.config.environment]);\n }\n // App targeting\n // User targeting\n if (this.user.htz_type) {\n pubads.setTargeting('htz_user_type', [this.user.htz_type]);\n }\n if (this.user.tm_type) {\n pubads.setTargeting('tm_user_type', [this.user.tm_type]);\n }\n if (this.user.hdc_type) {\n pubads.setTargeting('hdc_user_type', [this.user.hdc_type]);\n }\n // Context targeting\n if (this.config.section) {\n pubads.setTargeting('section', [this.config.section]);\n }\n if (this.config.sub_section) {\n pubads.setTargeting('sub_section', [this.config.sub_section]);\n }\n if (this.config.articleId) {\n pubads.setTargeting('articleId', [this.config.articleId]);\n pubads.setTargeting('react', ['false']);\n }\n if (this.config.gStatCampaignNumber && this.config.gStatCampaignNumber !== -1) {\n pubads.setTargeting('gstat_campaign_id', [this.config.gStatCampaignNumber]);\n }\n if (this.config.proposalNumber) {\n pubads.setTargeting('proposaltype', [this.config.proposalNumber]);\n }\n if (this.config.pageType) {\n pubads.setTargeting('pageType', [this.config.pageType]);\n }\n if (this.config.isWriterAlerts) {\n pubads.setTargeting('WriterAlerts', ['true']);\n }\n // AdBlock removal\n if (this.config.adBlockRemoved) {\n pubads.setTargeting('adblock_removed', [this.config.adBlockRemoved]);\n }\n // University targeting - triggered via cookie\n if (this.config.wifiLocation) {\n pubads.setTargeting('wifi', [this.config.wifiLocation]);\n }\n if (this.config.tags && Array.isArray(this.config.tags)) {\n pubads.setTargeting('tags', [...this.config.tags]);\n }\n\n if (this.user.sso && this.user.sso.userId && SsoGroupKey) {\n pubads.setTargeting(SsoGroupKey, this.user.sso.userId);\n }\n if (this.config.anonymousId) {\n const anonymousIdKeyName = 'anonymousIdKey';\n pubads.setTargeting(anonymousIdKeyName, this.config.anonymousId);\n }\n if (this.user.country) {\n pubads.setTargeting('country', this.user.country);\n }\n\n const cityNames = this.getCityNames();\n if (cityNames) {\n pubads.setTargeting('cityName', [...cityNames]);\n }\n\n // Ads Centering\n pubads.setCentering(true);\n }\n else {\n throw new Error('googletag api was not ready when \\'initGoogleTargetingParams\\' was called!');\n }\n }\n\n /**\n * Initializes googletag services.\n */\n initGoogleGlobalSettings() {\n if (window.googletag && window.googletag.apiReady) {\n const googleGlobalSettings = this.config.googleGlobalSettings;\n // Enable GET parameter overrides\n if (window.location.search) {\n const search = window.location.search;\n if (search.indexOf('sraon') > 0) {\n console.log('Single Request Mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = true;\n }\n else if (search.indexOf('sraoff') > 0) {\n console.log('Single Request Mode: disabled');// eslint-disable-line no-console\n googleGlobalSettings.enableSingleRequest = false;\n }\n if (search.indexOf('asyncrenderingon') > 0) {\n console.log('Async rendering mode: active'); // eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = true;\n }\n else if (search.indexOf('asyncrenderingonoff') > 0) {\n console.log('Sync rendering mode: active');// eslint-disable-line no-console\n googleGlobalSettings.enableAsyncRendering = false;\n }\n }\n // Google services activation\n if (googleGlobalSettings.enableSingleRequest === true) {\n googletag.pubads().enableSingleRequest();\n }\n // if (googleGlobalSettings.enableAsyncRendering === true) {\n // googletag.pubads().enableAsyncRendering();\n // }\n // else {\n // googletag.pubads().enableSyncRendering();\n // }\n // Enables all GPT services that have been defined for ad slots on the page.\n googletag.enableServices();\n }\n else {\n throw new Error('googletag api wasn\\'t ready when \\'initGoogleGlobalSettings\\' was called!');\n }\n }\n\n\n getCityNames() {\n const cityNames = [];\n document.querySelectorAll('[data-location-city-name]').forEach((element) => {\n if (!cityNames.includes(element.dataset.locationCityName)) {\n cityNames.push(element.dataset.locationCityName);\n }\n });\n return cityNames.length > 0 ? cityNames : null;\n }\n\n}\n","/* globals googletag */\nimport AdManager from '../src/objects/adManager';\nimport globalConfig from './globalConfig';\nimport { getBreakpoint, debounce } from '../src/utils/breakpoints';\n\nconst defaultConfig = globalConfig || {};\nconst resizeTimeout = 250;\n\nexport default class DFP {\n\n constructor(config) {\n this.config = Object.assign({}, defaultConfig, config);\n this.wasInitialized = false;\n this.initStarted = false;\n this.breakpoint = getBreakpoint();\n this.initWindowResizeListener();\n }\n\n /**\n * This part of the object's construction is dependent on the call to 'init'\n */\n resumeInit() {\n try {\n this.adManager = this.adManager || new AdManager(this.config);\n }\n catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n }\n\n /**\n * initializes the 'googletag' global namespace and add the\n * google publish tags library to the page\n * @returns {Promise} that resolves to true once the googletag api is ready to use\n * (googletag.apiReady = true)\n */\n initGoogleTag() {\n const dfpThis = this;\n return new Promise((resolve, reject) => {\n if (dfpThis.initStarted === true) {\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(dfpThis);\n });\n }\n else {\n dfpThis.initStarted = true;\n // set up a place holder for the gpt code downloaded from google\n window.googletag = window.googletag || {};\n\n // this is a command queue used by GPT any methods added to it will be\n // executed when GPT code is available, if GPT is already available they\n // will be executed immediately\n window.googletag.cmd = window.googletag.cmd || [];\n // load google tag services JavaScript\n (() => {\n const tag = window.document.createElement('script');\n tag.async = true;\n tag.type = 'text/javascript';\n // Supports both https and http\n tag.setAttribute('src', '//www.googletagservices.com/tag/js/gpt.js');\n const node = window.document.getElementsByTagName('script')[0];\n tag.addEventListener('load', () => {\n dfpThis.resumeInit();\n googletag.cmd.push(() => {\n dfpThis.wasInitialized = true;\n resolve(this);\n });\n });\n tag.addEventListener('error', (error) => {\n dfpThis.wasInitialized = false;\n reject(error);\n });\n node.parentNode.insertBefore(tag, node);\n })();\n }\n });\n }\n\n /**\n * Returns true iff googletag was properly initialized on the page\n * @returns {boolean}\n */\n isGoogleTagReady() {\n if (this.wasInitialized === true || (window.googletag && window.googletag.apiReady)) {\n this.wasInitialized = true;\n }\n return this.wasInitialized;\n }\n\n /**\n * Initializes the window resize listener to support responsive ad refreshes\n */\n initWindowResizeListener() {\n const dfpThis = this;\n function onResize() {\n const currentBreakpoint = getBreakpoint();\n if (dfpThis.breakpoint !== currentBreakpoint) {\n dfpThis.breakpoint = currentBreakpoint;\n if (dfpThis.adManager) {\n dfpThis.adManager.refreshAllSlots();\n }\n else {\n throw new Error('initWindowResizeListener error - adManager instance is not available');\n }\n }\n }\n const debouncedFunction = debounce(onResize, resizeTimeout);\n window.onresize = debouncedFunction;\n }\n}\n","import DFP from './dfp';\nimport globalConfig from './globalConfig';\nimport { version as v } from './version';\n\n// DFP version is based on the package.json\nDFP.version = v || 'VERSION';\n\n/*\n // Only for development mode\n if ( process.env.NODE_ENV !== 'production' ) {\n DFP.dev = '123';\n }\n */\n\nexport const config = globalConfig;\nexport const version = DFP.version;\nexport default DFP;\n","// generated by genversion\nexport const version = '2.6.6';\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 72579d4..55ce6b5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "DFP", "description": "A DoubleClick for Publishers Implementation", - "version": "2.6.5", + "version": "2.6.6", "license": "MIT", "author": { "name": "Elia Grady", diff --git a/src/objects/adManager.js b/src/objects/adManager.js index f2b4741..f007f9b 100644 --- a/src/objects/adManager.js +++ b/src/objects/adManager.js @@ -313,7 +313,9 @@ export default class AdManager { // Targeting check (userType vs. slotTargeting) this.doesUserTypeMatchBannerTargeting(adSlot) && // Impressions Manager check (limits number of impressions per slot) - this.user.impressionManager.reachedQuota(adSlot.id) === false; + this.user.impressionManager.reachedQuota(adSlot.id) === false && + // if the app promotion interstitial DOES NOT pop - SHOW MAAVARON + this.shouldAppPromotionElementPop() === false; } printShouldSendRequestToDfp(id) { @@ -372,6 +374,17 @@ export default class AdManager { return shouldDisplay; } + /** + * Check if the app promotion interstitial should pop + * when it does, the maavaron should not show up + * @returns {boolean} true if the interstitial element should pop + */ + shouldAppPromotionElementPop() { + return typeof window.appPromotionElement !== 'undefined' && + typeof window.appPromotionElement.getShouldPop === 'function' ? + window.appPromotionElement.getShouldPop() : false; + } + /** * Check whether or not an ad slot should appear for the current user type * @param {String} adSlotOrTarget the adSlot to check or the target as a string diff --git a/src/version.js b/src/version.js index d7fea94..04f3014 100644 --- a/src/version.js +++ b/src/version.js @@ -1,2 +1,2 @@ // generated by genversion -export const version = '2.6.5'; +export const version = '2.6.6';