Skip to content

Commit e2cbbe4

Browse files
authored
Merge pull request #1380 from bookernath/STRF-4612
STRF-4612 - Remove unnecessary API call to get cookie notification st…
2 parents 359270f + 7f1d999 commit e2cbbe4

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Draft
4+
- Remove unnecessary API call to get cookie notification status [#1380](https://github.com/bigcommerce/cornerstone/pull/1380)
45

56
## 2.6.0 (2018-11-05)
67
- Add support for Card Management: List, Delete, Edit, Add and Default Payment Method [#1376](https://github.com/bigcommerce/cornerstone/pull/1376)

assets/js/theme/global/cookieNotification.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ export default function () {
1717
});
1818
*/
1919

20-
utils.hooks.on('cookie-privacy-notification', (event) => {
21-
event.preventDefault();
20+
const $privacyDialog = $('.cookieMessage');
2221

23-
const $privacyDialog = $('.cookieMessage');
22+
if (document.cookie.indexOf('ACCEPT_COOKIE_USAGE') === -1) {
2423
$privacyDialog.show();
24+
}
25+
26+
$('body').on('click', '[data-privacy-accept]', () => {
27+
const date = new Date();
28+
date.setDate(date.getDate() + 365);
29+
document.cookie = `ACCEPT_COOKIE_USAGE=1;expires=${date.toGMTString()}; path=/`;
2530

26-
$('body').on('click', '[data-privacy-accept]', () => {
27-
utils.hooks.emit('cookie-privacy-accepted');
28-
$privacyDialog.hide();
29-
});
31+
utils.hooks.emit('cookie-privacy-accepted');
32+
$privacyDialog.hide();
3033
});
3134
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "BigCommerce",
77
"license": "MIT",
88
"dependencies": {
9-
"@bigcommerce/stencil-utils": "^1.1.2",
9+
"@bigcommerce/stencil-utils": "^2.0.0",
1010
"babel-polyfill": "^6.26.0",
1111
"creditcards": "^3.0.1",
1212
"easyzoom": "^2.5.0",

0 commit comments

Comments
 (0)