@bytebrand/fe-ui-core 4.1.130 → 4.1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -531,17 +531,23 @@ export function setUtmParameters() {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
export const updateCookieList = () => {
|
|
534
|
-
let
|
|
534
|
+
let cookieConsentList = Object.keys(GOOGLE_BUNDLE_COOKIES);
|
|
535
|
+
let isFBGranted = true;
|
|
535
536
|
const cookieConfig = JSON.parse(localStorage.getItem('cookieConfig')) || {};
|
|
536
|
-
|
|
537
|
+
|
|
537
538
|
const parsedUrl = new URL(window.location.href);
|
|
538
539
|
const domain = parsedUrl.hostname.split('.').slice(-2).join('.');
|
|
539
540
|
Object.keys(cookieConfig).forEach((group: string) => {
|
|
540
541
|
cookieConfig[group].forEach((cookie: string) => {
|
|
541
542
|
Cookies.remove(cookie, { domain, path: '/' }); // manually remove selected cookies
|
|
542
|
-
|
|
543
|
+
// google
|
|
544
|
+
if (cookieConsentList.includes(cookie)) cookieConsentList = cookieConsentList.filter(i => i !== cookie); // deny google cookie consent for _gcl_au, _ga, _gid, _gat_UA-31842-13, etc
|
|
545
|
+
// fb
|
|
546
|
+
else if (cookie === '_fbp') isFBGranted = false;
|
|
543
547
|
});
|
|
544
548
|
});
|
|
545
|
-
// grant
|
|
546
|
-
window.grantCookieConsent(
|
|
549
|
+
// grant google cookies
|
|
550
|
+
window.grantCookieConsent(cookieConsentList);
|
|
551
|
+
// grant FB cookies
|
|
552
|
+
if (isFBGranted) window.fbq('consent', 'grant');
|
|
547
553
|
};
|