diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fb6eb99be..938fec27e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Remove unnecessary API call to get cookie notification status [#1380](https://github.com/bigcommerce/cornerstone/pull/1380) ## 2.6.0 (2018-11-05) - Add support for Card Management: List, Delete, Edit, Add and Default Payment Method [#1376](https://github.com/bigcommerce/cornerstone/pull/1376) diff --git a/assets/js/theme/global/cookieNotification.js b/assets/js/theme/global/cookieNotification.js index 24501dc8a2..31cfb0e490 100644 --- a/assets/js/theme/global/cookieNotification.js +++ b/assets/js/theme/global/cookieNotification.js @@ -17,15 +17,18 @@ export default function () { }); */ - utils.hooks.on('cookie-privacy-notification', (event) => { - event.preventDefault(); + const $privacyDialog = $('.cookieMessage'); - const $privacyDialog = $('.cookieMessage'); + if (document.cookie.indexOf('ACCEPT_COOKIE_USAGE') === -1) { $privacyDialog.show(); + } + + $('body').on('click', '[data-privacy-accept]', () => { + const date = new Date(); + date.setDate(date.getDate() + 365); + document.cookie = `ACCEPT_COOKIE_USAGE=1;expires=${date.toGMTString()}; path=/`; - $('body').on('click', '[data-privacy-accept]', () => { - utils.hooks.emit('cookie-privacy-accepted'); - $privacyDialog.hide(); - }); + utils.hooks.emit('cookie-privacy-accepted'); + $privacyDialog.hide(); }); } diff --git a/package.json b/package.json index 51426a2e71..7ca2f6fbd3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "author": "BigCommerce", "license": "MIT", "dependencies": { - "@bigcommerce/stencil-utils": "^1.1.2", + "@bigcommerce/stencil-utils": "^2.0.0", "babel-polyfill": "^6.26.0", "creditcards": "^3.0.1", "easyzoom": "^2.5.0",