@bytebrand/fe-ui-core 4.1.70 → 4.1.71

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.70",
3
+ "version": "4.1.71",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -11,7 +11,7 @@ import { updateCookieList } from '../../../../../framework/utils/CommonUtils';
11
11
 
12
12
  import styles from './ManageCookieModal.styl';
13
13
 
14
- const ManageCookieModal = ({ onClearModalState }) => {
14
+ const ManageCookieModal = ({ toggleModal }) => {
15
15
  const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(true);
16
16
  const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(true);
17
17
  const [analyticsSwitches, setAnalyticsSwitches] = useState({});
@@ -62,7 +62,7 @@ const ManageCookieModal = ({ onClearModalState }) => {
62
62
  };
63
63
  localStorage.setItem('cookieConfig', JSON.stringify(cookieConfig));
64
64
  updateCookieList();
65
- onClearModalState();
65
+ toggleModal();
66
66
  };
67
67
 
68
68
  return (
@@ -528,14 +528,19 @@ export function setUtmParameters() {
528
528
  const expiresDate = new Date();
529
529
  expiresDate.setDate(expiresDate.getDate() + 1);
530
530
 
531
- document.cookie = `marketing=${JSON.stringify(marketing)};expires=${expiresDate};domain=.${config.DOMAIN};path=/`;
531
+ const parsedUrl = new URL(window.location.href);
532
+ const domain = parsedUrl.hostname.split('.').slice(-2).join('.');
533
+
534
+ document.cookie = `marketing=${JSON.stringify(marketing)};expires=${expiresDate};domain=.${domain};path=/`;
532
535
  };
533
536
 
534
537
  export const updateCookieList = () => {
535
538
  const cookieConfig = JSON.parse(localStorage.getItem('cookieConfig')) || {};
539
+ const parsedUrl = new URL(window.location.href);
540
+ const domain = parsedUrl.hostname.split('.').slice(-2).join('.');
536
541
  Object.keys(cookieConfig).forEach((group: string) => {
537
542
  cookieConfig[group].forEach((cookie: string) => {
538
- Cookies.remove(cookie, { path: '/', domain: config[process.env.NODE_ENV].DOMAIN });
543
+ Cookies.remove(cookie, { path: '/', domain });
539
544
  })
540
545
  });
541
546
  };