@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.1.130",
3
+ "version": "4.1.131",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -531,17 +531,23 @@ export function setUtmParameters() {
531
531
  }
532
532
 
533
533
  export const updateCookieList = () => {
534
- let cookieConsentObj = {}
534
+ let cookieConsentList = Object.keys(GOOGLE_BUNDLE_COOKIES);
535
+ let isFBGranted = true;
535
536
  const cookieConfig = JSON.parse(localStorage.getItem('cookieConfig')) || {};
536
- const googleCookies = Object.keys(GOOGLE_BUNDLE_COOKIES);
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
- if (googleCookies.includes(cookie)) cookieConsentObj = { ...cookieConsentObj, [cookie]: 'granted' }; // deny google cookie consent for _gcl_au, _ga, _gid, _gat_UA-31842-13, etc
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 consent for setting google cookies
546
- window.grantCookieConsent(cookieConsentObj);
549
+ // grant google cookies
550
+ window.grantCookieConsent(cookieConsentList);
551
+ // grant FB cookies
552
+ if (isFBGranted) window.fbq('consent', 'grant');
547
553
  };