@schibsted/niche-ads
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,23 @@ | ||
### [2.0.2](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v2.0.1...v2.0.2) (2023-01-03) | ||
### Miscellaneous Chores | ||
- update babel monorepo ([#76](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/76)) ([84ba3ce](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/84ba3ce5d36f4dc54aba08bf9dc492751ae9368c)) | ||
- update babel monorepo ([#85](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/85)) ([717ae55](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/717ae55400e00b9afd709160c46c94bd8895eacd)) | ||
- update commitlint monorepo to ^17.3.0 ([#84](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/84)) ([79706e3](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/79706e3ff1155e825ed5f76d675b9cf9265c47b7)) | ||
- update dependency @release-it/conventional-changelog to ^5.1.1 ([#81](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/81)) ([61c28fc](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/61c28fc5f50e10a963af647c5892fd71c4a854cf)) | ||
- update dependency eslint to ^8.24.0 ([#79](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/79)) ([8346097](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/8346097e508ce64ce8b699e593ff652513dcdeae)) | ||
- update dependency eslint to ^8.26.0 ([#83](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/83)) ([ae0e4b9](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/ae0e4b9a5b5a0faf28a341e6abcf17f796fd3cb1)) | ||
- update dependency eslint-plugin-react to ^7.31.7 ([#75](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/75)) ([403bba7](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/403bba7545d6d294c8fbd948cebcc68de670c568)) | ||
- update dependency husky to ^8.0.2 ([#87](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/87)) ([ec8af43](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/ec8af4326eeac060acda7166afc2e5f9ac31da29)) | ||
- update dependency lint-staged to ^13.1.0 ([#88](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/88)) ([1cc6b4d](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/1cc6b4db46dca9853502b42fe4364457bd0fa5fe)) | ||
- update dependency release-it to ^15.4.2 ([#78](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/78)) ([a50008e](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/a50008e4e44e4d4c8ee34248e1b3d5b0c5076d4f)) | ||
- update dependency release-it to ^15.5.0 ([#80](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/80)) ([b0212c0](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/b0212c0bcdfd154842397972bf6b4d232e4ecd56)) | ||
- update dependency release-it to ^15.6.0 ([#89](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/89)) ([25f64fe](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/25f64fe478032fbb10406ac1482e558aaeb9664b)) | ||
- update json5 library ([#90](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/90)) ([33d8454](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/33d8454af65685715060473a3ffa3c9bdef9f95a)) | ||
- update linters ([#77](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/77)) ([9786ba3](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/9786ba399bf449a85a566c209451815c663cf826)) | ||
- update linters ([#82](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/82)) ([5283390](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/52833906cb0daa725e7439c141375d58068fdefb)) | ||
- update linters ([#86](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/86)) ([750466f](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/750466f79510ff5fe2ea314e81e0af093f78550f)) | ||
- update tool packages ([#72](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/72)) ([dd2d3dd](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/dd2d3dd3b20517fa9666a6b5e5bdcacb2793e3ac)) | ||
### [2.0.1](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v2.0.0...v2.0.1) (2022-09-02) | ||
@@ -2,0 +24,0 @@ |
@@ -8,37 +8,23 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = require("react"); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _splitEvery = _interopRequireDefault(require("./utils/splitEvery")); | ||
var _appnexus = require("./utils/appnexus"); | ||
var _loadScript = _interopRequireDefault(require("./utils/loadScript")); | ||
var _collapse = _interopRequireDefault(require("./appnexusMessageHandlers/collapse")); | ||
var _useEvent = _interopRequireDefault(require("./useEvent")); | ||
var _jsxRuntime = require("react/jsx-runtime"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function noop() { | ||
return null; | ||
} | ||
const AdContext = /*#__PURE__*/(0, _react.createContext)({}); | ||
const APPNEXUS_PLACEMENTS_PER_REQUEST_LIMIT = 12; | ||
const buildKeywords = (cfg, device, pageType) => ({ ...cfg.common, | ||
const buildKeywords = (cfg, device, pageType) => ({ | ||
...cfg.common, | ||
...cfg[device].common, | ||
...cfg[device][pageType] | ||
}); | ||
function cleanUpPlacement(targetId) { | ||
@@ -54,3 +40,2 @@ (0, _appnexus.offEvent)(_appnexus.APPNEXUS_EVENT_TYPES.adLoaded, targetId); | ||
} | ||
let resolveAdBlockerDetectedPromise; | ||
@@ -60,3 +45,2 @@ const adBlockerDetectedPromise = new Promise(resolve => { | ||
}); | ||
function AdContextProvider(_ref) { | ||
@@ -99,3 +83,2 @@ let { | ||
} | ||
(0, _appnexus.subscribeToASTLoad)(adReadyObserver); | ||
@@ -113,3 +96,2 @@ resolveAdBlockerDetectedPromise(false); | ||
} | ||
(0, _collapse.default)(event); | ||
@@ -131,3 +113,2 @@ }); | ||
await scriptsLoadPromise.current; | ||
if (!device || !adScriptsReadyRef.current) { | ||
@@ -142,3 +123,2 @@ retryLoadAds.current = { | ||
} | ||
retryLoadAds.current = false; | ||
@@ -148,4 +128,6 @@ setPlacements({}); | ||
(0, _appnexus.clearRequest)(); | ||
const pageOptions = { ...adsConfig.options, | ||
keywords: { ...buildKeywords(adsConfig.keywords, device, pageType), | ||
const pageOptions = { | ||
...adsConfig.options, | ||
keywords: { | ||
...buildKeywords(adsConfig.keywords, device, pageType), | ||
...keywords, | ||
@@ -158,3 +140,2 @@ 'aa-sch-externalid_src': Boolean((0, _appnexus.getAdId)()) + Boolean((0, _appnexus.getUserId)()) | ||
}; | ||
if (glimr.enabled && (await glimr.shouldLoad())) { | ||
@@ -165,3 +146,2 @@ const { | ||
const glimrTags = await getGlimrTags(glimr); | ||
if (glimrTags) { | ||
@@ -172,18 +152,13 @@ pageOptions.keywords['no-sno-geo'] = glimrTags; | ||
} | ||
(0, _appnexus.setPageOpts)(pageOptions); | ||
let newPlacementConfig = adsConfig.placements[device][pageType]?.filter(placement => placement.invCode); | ||
if (!newPlacementConfig) { | ||
throw new Error(`No configuration for device: ${device} and pageType: ${pageType}`); | ||
} | ||
if (allowlist?.length > 0) { | ||
newPlacementConfig = newPlacementConfig.filter(placement => allowlist.includes(placement.targetId)); | ||
} | ||
if (blocklist?.length > 0) { | ||
newPlacementConfig = newPlacementConfig.filter(placement => !blocklist.includes(placement.targetId)); | ||
} | ||
setPlacementsConfig(newPlacementConfig); | ||
@@ -203,3 +178,4 @@ }); | ||
placementsConfigChunk.forEach(placementConfig => { | ||
(0, _appnexus.defineTag)({ ...adsConfig.placements.common, | ||
(0, _appnexus.defineTag)({ | ||
...adsConfig.placements.common, | ||
...placementConfig | ||
@@ -211,5 +187,5 @@ }); | ||
} | ||
if (placementsMediation.current[placementConfig.targetId] && data.source !== 'csm') { | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: data | ||
@@ -220,3 +196,4 @@ })); | ||
(0, _appnexus.onEvent)(_appnexus.APPNEXUS_EVENT_TYPES.adAvailable, placementConfig.targetId, data => { | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: data | ||
@@ -230,3 +207,4 @@ })); | ||
}); | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: null | ||
@@ -240,3 +218,4 @@ })); | ||
}); | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: null | ||
@@ -246,3 +225,4 @@ })); | ||
(0, _appnexus.onEvent)(_appnexus.APPNEXUS_EVENT_TYPES.adCollapse, placementConfig.targetId, () => { | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: null | ||
@@ -252,3 +232,4 @@ })); | ||
(0, _appnexus.onEvent)(_appnexus.APPNEXUS_EVENT_TYPES.adNoBid, placementConfig.targetId, () => { | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: null | ||
@@ -262,3 +243,4 @@ })); | ||
}); | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: null | ||
@@ -268,3 +250,4 @@ })); | ||
(0, _appnexus.onEvent)(_appnexus.APPNEXUS_EVENT_TYPES.adRequested, placementConfig.targetId, () => { | ||
setPlacements(state => ({ ...state, | ||
setPlacements(state => ({ | ||
...state, | ||
[placementConfig.targetId]: undefined | ||
@@ -282,3 +265,2 @@ })); | ||
} | ||
return noop; | ||
@@ -306,3 +288,2 @@ }, [placementsConfig, adsConfig?.placements?.common]); | ||
} | ||
const PlacementPropTypes = _propTypes.default.shape({ | ||
@@ -316,3 +297,2 @@ targetId: _propTypes.default.string.isRequired, | ||
}).isRequired; | ||
const PlacementsByPagePropTypes = _propTypes.default.shape({ | ||
@@ -323,3 +303,2 @@ front: _propTypes.default.arrayOf(PlacementPropTypes), | ||
}).isRequired; | ||
AdContextProvider.propTypes = { | ||
@@ -326,0 +305,0 @@ adsConfig: _propTypes.default.shape({ |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _appnexus = require("../utils/appnexus"); | ||
function collapseAd() { | ||
@@ -16,3 +14,2 @@ let messageListenerEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
} = messageListenerEvent; | ||
if (data && typeof data === 'string' && data.startsWith('collapseAd:')) { | ||
@@ -23,4 +20,3 @@ const targetId = data.replace(/^collapseAd:/, ''); | ||
} | ||
var _default = collapseAd; | ||
exports.default = _default; |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = void 0; | ||
/** | ||
@@ -24,3 +23,2 @@ * This is an event handler for postMessage sent from wallpaper ad iframe. | ||
} = messageListenerEvent; | ||
if (data && typeof data === 'string') { | ||
@@ -31,3 +29,2 @@ if (data.startsWith('wallpaper:url:')) { | ||
} | ||
if (data.startsWith('wallpaper:color:')) { | ||
@@ -39,4 +36,3 @@ const backgroundColour = data.replace(/^wallpaper:color:/, ''); | ||
} | ||
var _default = attachWallpaperImageToPageBody; | ||
exports.default = _default; |
@@ -42,17 +42,9 @@ "use strict"; | ||
}); | ||
var _AdContext = _interopRequireWildcard(require("./AdContext")); | ||
var _appnexus = require("./utils/appnexus"); | ||
var _usePlacement = _interopRequireDefault(require("./usePlacement")); | ||
var _useLoadAds = _interopRequireDefault(require("./useLoadAds")); | ||
var _useClearPlacements = _interopRequireDefault(require("./useClearPlacements")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = require("react"); | ||
var _AdContext = _interopRequireDefault(require("./AdContext")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const useClearPlacements = () => { | ||
@@ -21,4 +17,3 @@ const { | ||
}; | ||
var _default = useClearPlacements; | ||
exports.default = _default; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = require("react"); | ||
function useEvent(handler) { | ||
@@ -18,4 +16,3 @@ const handlerRef = (0, _react.useRef)(handler); | ||
} | ||
var _default = useEvent; | ||
exports.default = _default; |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = require("react"); | ||
var _AdContext = _interopRequireDefault(require("./AdContext")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const useLoadAds = () => { | ||
@@ -21,4 +17,3 @@ const { | ||
}; | ||
var _default = useLoadAds; | ||
exports.default = _default; |
@@ -7,13 +7,7 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = require("react"); | ||
var _appnexus = require("./utils/appnexus"); | ||
var _AdContext = _interopRequireDefault(require("./AdContext")); | ||
var _useEvent = _interopRequireDefault(require("./useEvent")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const usePlacement = targetId => { | ||
@@ -33,4 +27,3 @@ const { | ||
}; | ||
var _default = usePlacement; | ||
exports.default = _default; |
@@ -10,6 +10,4 @@ "use strict"; | ||
isLoaded: false, | ||
set loaded(value) { | ||
this.isLoaded = value; | ||
if (value === true) { | ||
@@ -20,10 +18,8 @@ apntagLoadSubscribers.forEach(apntagLoadSubscriber => apntagLoadSubscriber(value)); | ||
}, | ||
get loaded() { | ||
return this.isLoaded; | ||
} | ||
}; | ||
const addToQueue = fn => apntag.anq.push(fn); | ||
const addToQueue = fn => apntag.anq.push(fn); | ||
/** | ||
@@ -36,6 +32,3 @@ * This function is some kind of hack that enables us to serve segmented ads on safari. | ||
*/ | ||
const getCookie = () => decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${encodeURIComponent('_pulse2data').replace(/[-.+*]/g, '\\$&')}\\s*\\=\\s*([^;]*).*$)|^.*$`), '$1')) || false; | ||
const APPNEXUS_EVENT_TYPES = { | ||
@@ -52,7 +45,4 @@ adRequested: 'adRequested', | ||
exports.APPNEXUS_EVENT_TYPES = APPNEXUS_EVENT_TYPES; | ||
const isASTLoaded = () => apntag.loaded; | ||
exports.isASTLoaded = isASTLoaded; | ||
const subscribeToASTLoad = callback => { | ||
@@ -65,5 +55,3 @@ if (apntag.loaded === true) { | ||
}; | ||
exports.subscribeToASTLoad = subscribeToASTLoad; | ||
const setUpAPNObject = () => { | ||
@@ -75,49 +63,27 @@ // eslint-disable-next-line no-multi-assign | ||
}; | ||
exports.setUpAPNObject = setUpAPNObject; | ||
const defineTag = tagDefinition => addToQueue(() => apntag.defineTag(tagDefinition)); | ||
exports.defineTag = defineTag; | ||
const clearRequest = () => addToQueue(() => apntag.clearRequest()); | ||
exports.clearRequest = clearRequest; | ||
const loadTags = () => { | ||
setTimeout(() => addToQueue(() => apntag.loadTags()), 0); | ||
}; | ||
exports.loadTags = loadTags; | ||
const refresh = targetIds => addToQueue(() => apntag.refresh(targetIds)); | ||
exports.refresh = refresh; | ||
const showTag = targetId => addToQueue(() => apntag.showTag(targetId)); | ||
exports.showTag = showTag; | ||
const setPageOpts = options => addToQueue(() => apntag.setPageOpts(options)); | ||
exports.setPageOpts = setPageOpts; | ||
const offEvent = (eventType, targetId) => addToQueue(() => apntag.offEvent(eventType, targetId)); | ||
exports.offEvent = offEvent; | ||
const onEvent = (eventType, targetId, handler) => addToQueue(() => apntag.onEvent(eventType, targetId, handler)); | ||
exports.onEvent = onEvent; | ||
const emitEvent = (eventType, targetId) => addToQueue(() => apntag.emitEvent(targetId, eventType)); | ||
exports.emitEvent = emitEvent; | ||
const fireImpressionTrackers = adPlacement => { | ||
addToQueue(() => apntag.fireImpressionTrackers(adPlacement)); | ||
}; | ||
exports.fireImpressionTrackers = fireImpressionTrackers; | ||
const getUserId = () => { | ||
@@ -127,5 +93,3 @@ const cookie = getCookie(); | ||
}; | ||
exports.getUserId = getUserId; | ||
const getAdId = () => { | ||
@@ -135,3 +99,2 @@ const cookie = getCookie(); | ||
}; | ||
exports.getAdId = getAdId; |
@@ -7,20 +7,13 @@ "use strict"; | ||
exports.getGlimrTags = getGlimrTags; | ||
var _localStorage = require("./localStorage"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const CLIENT_ID = 'H3IYO2A4LD43YPFZIJLN'; | ||
const LOCAL_STORAGE_KEY = 'glimrTags'; | ||
const LOCAL_STORAGE_EXPIRATION = 24 * 60 * 60 * 1000; | ||
async function getGlimrTags(options) { | ||
const cachedTags = (0, _localStorage.getFromLocalStorageWithExpiration)(options.localStorageKey || LOCAL_STORAGE_KEY, options.localStorageExpiration || LOCAL_STORAGE_EXPIRATION); | ||
if (cachedTags) { | ||
return cachedTags; | ||
} | ||
const glimr = (await Promise.resolve().then(() => _interopRequireWildcard(require('glimr-sdk'))))?.default; | ||
@@ -27,0 +20,0 @@ glimr.setTagCacheTimeInSeconds(300); // 300 is max https://developer.glimr.io/docs/retrieving-audiences#settagcachetimeinseconds |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = void 0; | ||
function loadScript(url, id) { | ||
@@ -17,7 +16,4 @@ return new Promise((resolve, reject) => { | ||
script.id = id; | ||
script.onerror = err => reject(err); | ||
script.onload = () => resolve(); | ||
script.async = true; | ||
@@ -28,4 +24,3 @@ document.body.appendChild(script); | ||
} | ||
var _default = loadScript; | ||
exports.default = _default; |
@@ -8,3 +8,2 @@ "use strict"; | ||
exports.saveToLocalStorageWithExpiration = saveToLocalStorageWithExpiration; | ||
function saveToLocalStorageWithExpiration(key, value) { | ||
@@ -19,17 +18,16 @@ try { | ||
} | ||
} catch (e) {// ignore | ||
} catch (e) { | ||
// ignore | ||
} | ||
} | ||
function getFromLocalStorageWithExpiration(key, expiration) { | ||
try { | ||
const data = JSON.parse(window.localStorage.getItem(key)); | ||
if (data?.timestamp && data.timestamp + expiration > new Date().getTime()) { | ||
return data.data; | ||
} | ||
} catch (e) {// ignore | ||
} catch (e) { | ||
// ignore | ||
} | ||
return undefined; | ||
} |
@@ -7,8 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
function splitEvery(chunkSize, array) { | ||
return new Array(Math.ceil(array.length / chunkSize)).fill().map((_, i) => array.slice(i * chunkSize, i * chunkSize + chunkSize)); | ||
} | ||
var _default = splitEvery; | ||
exports.default = _default; |
{ | ||
"name": "@schibsted/niche-ads", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Package containing ads logic reappearing across our projects", | ||
@@ -32,11 +32,11 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.18.10", | ||
"@babel/core": "^7.18.13", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.18.10", | ||
"@babel/cli": "^7.20.7", | ||
"@babel/core": "^7.20.7", | ||
"@babel/eslint-parser": "^7.19.1", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/preset-react": "^7.18.6", | ||
"@commitlint/cli": "^17.0.3", | ||
"@commitlint/config-conventional": "^17.0.3", | ||
"@release-it/conventional-changelog": "^5.1.0", | ||
"eslint": "^8.23.0", | ||
"@commitlint/cli": "^17.3.0", | ||
"@commitlint/config-conventional": "^17.3.0", | ||
"@release-it/conventional-changelog": "^5.1.1", | ||
"eslint": "^8.31.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
@@ -48,9 +48,9 @@ "eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.31.1", | ||
"eslint-plugin-react": "^7.31.11", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"husky": "^8.0.1", | ||
"lint-staged": "^13.0.3", | ||
"prettier": "^2.7.1", | ||
"husky": "^8.0.2", | ||
"lint-staged": "^13.1.0", | ||
"prettier": "^2.8.1", | ||
"prop-types": "^15.8.1", | ||
"release-it": "^15.3.0", | ||
"release-it": "^15.6.0", | ||
"rimraf": "^3.0.2" | ||
@@ -57,0 +57,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94878
1354