@schibsted/niche-ads
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,3 +0,13 @@ | ||
### [1.0.1](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v1.0.0...v1.0.1) (2022-03-16) | ||
## [1.1.0](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v1.0.1...v1.1.0) (2022-04-13) | ||
### Features | ||
- add glimr tags ([#36](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/36)) ([b3443a9](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/b3443a95ea6051a516eecc7932e54d77f8ac1cd5)) | ||
### Miscellaneous Chores | ||
- update babel monorepo ([#22](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/22)) ([2d0cfca](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/2d0cfcae7ccf2214876e6a950565be356a294e6d)) | ||
- update dependency release-it to ^14.14.0 ([#34](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/34)) ([1b6f7bf](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/1b6f7bf168976465685297f5a0e79ec5ffad4a00)) | ||
- update tool packages ([#31](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/issues/31)) ([a79fe57](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/commit/a79fe5797829e213d09d73da3426c60ed8c91ca0))### [1.0.1](https://github.schibsted.io/przemyslaw-babiarz/niche-ads/compare/v1.0.0...v1.0.1) (2022-03-16) | ||
### Bug Fixes | ||
@@ -4,0 +14,0 @@ |
@@ -60,3 +60,4 @@ "use strict"; | ||
device, | ||
wallpaper | ||
wallpaper, | ||
glimr | ||
} = _ref; | ||
@@ -131,3 +132,3 @@ const [placementsConfig, setPlacementsConfig] = (0, _react.useState)([]); | ||
(0, _appnexus.clearRequest)(); | ||
(0, _appnexus.setPageOpts)({ ...adsConfig.options, | ||
const pageOptions = { ...adsConfig.options, | ||
keywords: { ...buildKeywords(adsConfig.keywords, device, pageType), | ||
@@ -140,3 +141,17 @@ ...keywords, | ||
} | ||
}); | ||
}; | ||
if (glimr.enabled && (await glimr.shouldLoad())) { | ||
const { | ||
getGlimrTags | ||
} = await Promise.resolve().then(() => _interopRequireWildcard(require('./utils/glimr'))); | ||
const glimrTags = await getGlimrTags(glimr); | ||
if (glimrTags) { | ||
pageOptions.keywords['no-sno-geo'] = glimrTags; | ||
pageOptions.keywords['no-sno-weather'] = glimrTags; | ||
} | ||
} | ||
(0, _appnexus.setPageOpts)(pageOptions); | ||
let newPlacementConfig = adsConfig.placements[device][pageType]?.filter(placement => placement.invCode); | ||
@@ -157,3 +172,3 @@ | ||
setPlacementsConfig(newPlacementConfig); | ||
}, [device, adsConfig]); | ||
}, [device, adsConfig, glimr]); | ||
(0, _react.useEffect)(() => { | ||
@@ -256,3 +271,3 @@ if (retryLoadAds.current) { | ||
keywords: _propTypes.default.shape({ | ||
'no-sno-adformat': _propTypes.default.string | ||
'no-sno-adformat': _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]) | ||
}) | ||
@@ -339,2 +354,9 @@ }).isRequired; | ||
device: _propTypes.default.oneOf(['desktop', 'tablet', 'mobile']), | ||
glimr: _propTypes.default.shape({ | ||
enabled: _propTypes.default.bool.isRequired, | ||
shouldLoad: _propTypes.default.func.isRequired, | ||
clientId: _propTypes.default.string, | ||
localStorageKey: _propTypes.default.string, | ||
localStorageExpiration: _propTypes.default.number | ||
}), | ||
wallpaper: _propTypes.default.shape({ | ||
@@ -353,4 +375,10 @@ enabled: _propTypes.default.bool.isRequired, | ||
device: null, | ||
glimr: { | ||
enabled: false, | ||
shouldLoad: noop | ||
}, | ||
wallpaper: { | ||
enabled: false | ||
enabled: false, | ||
setWallpaperFunction: noop, | ||
setBackgroundColorFunction: noop | ||
} | ||
@@ -357,0 +385,0 @@ }; |
{ | ||
"name": "@schibsted/niche-ads", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Package containing ads logic reappearing across our projects", | ||
@@ -31,8 +31,8 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.17.0", | ||
"@babel/core": "^7.17.2", | ||
"@babel/cli": "^7.17.6", | ||
"@babel/core": "^7.17.7", | ||
"@babel/eslint-parser": "^7.17.0", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-react": "^7.16.7", | ||
"@commitlint/cli": "^16.2.1", | ||
"@commitlint/cli": "^16.2.3", | ||
"@commitlint/config-conventional": "^16.2.1", | ||
@@ -50,6 +50,6 @@ "@release-it/conventional-changelog": "^4.2.2", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.3.5", | ||
"lint-staged": "^12.3.7", | ||
"prettier": "^2.5.1", | ||
"prop-types": "^15.8.1", | ||
"release-it": "^14.12.5", | ||
"release-it": "^14.14.0", | ||
"rimraf": "^3.0.2" | ||
@@ -60,3 +60,5 @@ }, | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
"glimr-sdk": "^3.3.3" | ||
} | ||
} |
@@ -45,3 +45,3 @@ import { createContext, useCallback, useMemo, useState, useRef, useEffect } from 'react'; | ||
function AdContextProvider({ adsConfig, cdn, chatbot, children, cogwheelCdn, device, wallpaper }) { | ||
function AdContextProvider({ adsConfig, cdn, chatbot, children, cogwheelCdn, device, wallpaper, glimr }) { | ||
const [placementsConfig, setPlacementsConfig] = useState([]); | ||
@@ -122,3 +122,3 @@ const [placements, setPlacements] = useState({}); | ||
setPageOpts({ | ||
const pageOptions = { | ||
...adsConfig.options, | ||
@@ -133,4 +133,16 @@ keywords: { | ||
}, | ||
}); | ||
}; | ||
if (glimr.enabled && (await glimr.shouldLoad())) { | ||
const { getGlimrTags } = await import('./utils/glimr'); | ||
const glimrTags = await getGlimrTags(glimr); | ||
if (glimrTags) { | ||
pageOptions.keywords['no-sno-geo'] = glimrTags; | ||
pageOptions.keywords['no-sno-weather'] = glimrTags; | ||
} | ||
} | ||
setPageOpts(pageOptions); | ||
let newPlacementConfig = adsConfig.placements[device][pageType]?.filter((placement) => placement.invCode); | ||
@@ -148,3 +160,3 @@ if (!newPlacementConfig) { | ||
}, | ||
[device, adsConfig] | ||
[device, adsConfig, glimr] | ||
); | ||
@@ -238,3 +250,3 @@ | ||
keywords: PropTypes.shape({ | ||
'no-sno-adformat': PropTypes.string, | ||
'no-sno-adformat': PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), | ||
}), | ||
@@ -321,2 +333,9 @@ }).isRequired; | ||
device: PropTypes.oneOf(['desktop', 'tablet', 'mobile']), | ||
glimr: PropTypes.shape({ | ||
enabled: PropTypes.bool.isRequired, | ||
shouldLoad: PropTypes.func.isRequired, | ||
clientId: PropTypes.string, | ||
localStorageKey: PropTypes.string, | ||
localStorageExpiration: PropTypes.number, | ||
}), | ||
wallpaper: PropTypes.shape({ | ||
@@ -336,4 +355,10 @@ enabled: PropTypes.bool.isRequired, | ||
device: null, | ||
glimr: { | ||
enabled: false, | ||
shouldLoad: noop, | ||
}, | ||
wallpaper: { | ||
enabled: false, | ||
setWallpaperFunction: noop, | ||
setBackgroundColorFunction: noop, | ||
}, | ||
@@ -340,0 +365,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
80706
40
1346
2
+ Addedglimr-sdk@^3.3.3
+ Addedglimr-sdk@3.3.3(transitive)