|
39 | 39 | map = require('lodash/map'),
|
40 | 40 | helpers = require('./lib/helpers'),
|
41 | 41 | proxies = require('./lib/proxies'),
|
42 |
| - cookie = require('browser-cookie-lite'), |
43 | 42 | detectors = require('./lib/detectors'),
|
44 | 43 | sha1 = require('sha1'),
|
45 | 44 | links = require('./links'),
|
|
202 | 201 | // Default is user agent defined.
|
203 | 202 | configCookiePath = '/',
|
204 | 203 |
|
| 204 | + // First-party cookie samesite attribute |
| 205 | + configCookieSameSite = argmap.hasOwnProperty('cookieSameSite') ? argmap.cookieSameSite : 'None', |
| 206 | + |
| 207 | + // First-party cookie secure attribute |
| 208 | + configCookieSecure = argmap.hasOwnProperty('cookieSecure') ? argmap.cookieSecure : true, |
| 209 | + |
205 | 210 | // Do Not Track browser feature
|
206 | 211 | dnt = navigatorAlias.doNotTrack || navigatorAlias.msDoNotTrack || windowAlias.doNotTrack,
|
207 | 212 |
|
|
509 | 514 | // Set to true if Opt-out cookie is defined
|
510 | 515 | var toOptoutByCookie;
|
511 | 516 | if (configOptOutCookie) {
|
512 |
| - toOptoutByCookie = !!cookie.cookie(configOptOutCookie); |
| 517 | + toOptoutByCookie = !!helpers.cookie(configOptOutCookie); |
513 | 518 | } else {
|
514 | 519 | toOptoutByCookie = false;
|
515 | 520 | }
|
|
536 | 541 | return helpers.attemptGetLocalStorage(fullName);
|
537 | 542 | } else if (configStateStorageStrategy == 'cookie' ||
|
538 | 543 | configStateStorageStrategy == 'cookieAndLocalStorage') {
|
539 |
| - return cookie.cookie(fullName); |
| 544 | + return helpers.cookie(fullName); |
540 | 545 | }
|
541 | 546 | }
|
542 | 547 |
|
|
655 | 660 | helpers.attemptWriteLocalStorage(name, value, timeout);
|
656 | 661 | } else if (configStateStorageStrategy == 'cookie' ||
|
657 | 662 | configStateStorageStrategy == 'cookieAndLocalStorage') {
|
658 |
| - cookie.cookie(name, value, timeout, configCookiePath, configCookieDomain); |
| 663 | + helpers.cookie(name, value, timeout, configCookiePath, configCookieDomain, configCookieSameSite, configCookieSecure); |
659 | 664 | }
|
660 | 665 | }
|
661 | 666 |
|
|
766 | 771 |
|
767 | 772 | var toOptoutByCookie;
|
768 | 773 | if (configOptOutCookie) {
|
769 |
| - toOptoutByCookie = !!cookie.cookie(configOptOutCookie); |
| 774 | + toOptoutByCookie = !!helpers.cookie(configOptOutCookie); |
770 | 775 | } else {
|
771 | 776 | toOptoutByCookie = false;
|
772 | 777 | }
|
|
778 | 783 | helpers.attemptWriteLocalStorage(sesname, '');
|
779 | 784 | } else if (configStateStorageStrategy == 'cookie' ||
|
780 | 785 | configStateStorageStrategy == 'cookieAndLocalStorage') {
|
781 |
| - cookie.cookie(idname, '', -1, configCookiePath, configCookieDomain); |
782 |
| - cookie.cookie(sesname, '', -1, configCookiePath, configCookieDomain); |
| 786 | + helpers.cookie(idname, '', -1, configCookiePath, configCookieDomain, configCookieSameSite, configCookieSecure); |
| 787 | + helpers.cookie(sesname, '', -1, configCookiePath, configCookieDomain, configCookieSameSite, configCookieSecure); |
783 | 788 | }
|
784 | 789 | return;
|
785 | 790 | }
|
|
1452 | 1457 | function getGaCookiesContext() {
|
1453 | 1458 | var gaCookieData = {};
|
1454 | 1459 | forEach(['__utma', '__utmb', '__utmc', '__utmv', '__utmz', '_ga'], function (cookieType) {
|
1455 |
| - var value = cookie.cookie(cookieType); |
| 1460 | + var value = helpers.cookie(cookieType); |
1456 | 1461 | if (value) {
|
1457 | 1462 | gaCookieData[cookieType] = value;
|
1458 | 1463 | }
|
|
2176 | 2181 | * @param string cookieName Name of the cookie whose value will be assigned to businessUserId
|
2177 | 2182 | */
|
2178 | 2183 | apiMethods.setUserIdFromCookie = function(cookieName) {
|
2179 |
| - businessUserId = cookie.cookie(cookieName); |
| 2184 | + businessUserId = helpers.cookie(cookieName); |
2180 | 2185 | };
|
2181 | 2186 |
|
2182 | 2187 | /**
|
|
0 commit comments