Skip to content

Commit

Permalink
Merge pull request #1380 from bookernath/STRF-4612
Browse files Browse the repository at this point in the history
STRF-4612 - Remove unnecessary API call to get cookie notification st…
  • Loading branch information
mattolson authored Nov 9, 2018
2 parents 359270f + 7f1d999 commit e2cbbe4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
17 changes: 10 additions & 7 deletions assets/js/theme/global/cookieNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e2cbbe4

Please sign in to comment.