@bytebrand/fe-ui-core 4.1.51 → 4.1.52

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.51",
3
+ "version": "4.1.52",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
+ import _merge from 'lodash/merge';
2
3
  import styles from './ManageCookieModal.styl';
3
4
 
4
5
  import IconSVG from '../../../IconSVG/IconSVG';
@@ -6,18 +7,46 @@ import Button from '../../../Button/Button';
6
7
  import MaterialAccordionGroup from '../../../MaterialAccordionGroup/MaterialAccordionGroup';
7
8
  import classNames from 'classnames';
8
9
  import MaterialSwitch from '../../../MaterialSwitch/MaterialSwitch';
10
+ import { COOKIE_SCHEMA } from '@bytebrand/fe-ui-core/source/framework/constants/common';
9
11
 
10
12
  const ManageCookieModal = () => {
11
- const [accordionSwitchValue, setAccordionSwitchValue] = useState(false);
12
- const [switchValue, setSwitchValue] = useState(false);
13
+ const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(true);
14
+ const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(true);
15
+ const [analyticsSwitches, setAnalyticsSwitches] = useState({});
16
+ const [marketingSwitches, setMarketingSwitches] = useState({});
13
17
 
14
- const onHandleAccordionSwitchValue = (value: boolean) => {
15
- setAccordionSwitchValue(value);
18
+
19
+ useEffect(() => {
20
+ const newAnalyticsSwitches = COOKIE_SCHEMA.analytics.reduce((acc, item) => ({...acc, [item]: true}), {});
21
+ const newMarketingSwitches = COOKIE_SCHEMA.marketing.reduce((acc, item) => ({...acc, [item]: true}), {});
22
+ setAnalyticsSwitches(newAnalyticsSwitches);
23
+ setMarketingSwitches(newMarketingSwitches);
24
+ }, []);
25
+
26
+ const onHandleAnalyticsSwitchValue = (value: boolean) => {
27
+ const newAnalyticsSwitches = Object.keys(analyticsSwitches).reduce((acc, item) => ({ ...acc, [item]: value }), {})
28
+ setAnalyticsSwitches(newAnalyticsSwitches);
29
+ setAnalyticsMasterSwitch(value);
30
+ };
31
+
32
+ const onHandleMarketingSwitchValue = (value: boolean) => {
33
+ const newAnalyticsSwitches = Object.keys(analyticsSwitches).reduce((acc, item) => ({ ...acc, [item]: value }), {})
34
+ setMarketingSwitches(newAnalyticsSwitches);
35
+ setMarketingMasterSwitch(value);
36
+ };
37
+
38
+ const marketingSwitchProps = {
39
+ value: marketingMasterSwitch,
40
+ onChange: onHandleMarketingSwitchValue
41
+ };
42
+ const analyticsSwitchProps = {
43
+ value: analytcisMasterSwitch,
44
+ onChange: onHandleAnalyticsSwitchValue
16
45
  };
17
46
 
18
- const accordionSwitchProps = {
19
- value: accordionSwitchValue,
20
- onChange: onHandleAccordionSwitchValue
47
+ const necessarySwitchProps = {
48
+ value: true,
49
+ onChange: () => {}
21
50
  };
22
51
 
23
52
  return (
@@ -30,37 +59,63 @@ const ManageCookieModal = () => {
30
59
  title='Notwendig'
31
60
  tooltipText='tooltip text'
32
61
  withSwitch
33
- switchProps={accordionSwitchProps}
62
+ switchProps={necessarySwitchProps}
34
63
  >
64
+ <span>
35
65
  Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert.
36
66
  Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen
37
67
  können, wenn Sie auf unsere Website zurückkehren.
38
68
  For example, we store your website data collection preferences so we can honor them if you return to our site.
39
69
  You can disable these cookies in your browser settings but if you do the site may not work as intended.
70
+ </span>
71
+ {COOKIE_SCHEMA.necessary.map(cookie =>
72
+ <div className={styles.switchBlock}>
73
+ <span>{cookie}</span>
74
+ <MaterialSwitch value={true} onChange={(value: boolean) => {}} />
75
+ </div>
76
+ )}
40
77
  </MaterialAccordionGroup>
41
78
  <MaterialAccordionGroup
42
79
  title='Analytisch'
43
80
  withSwitch
44
- switchProps={accordionSwitchProps}
81
+ switchProps={analyticsSwitchProps}
45
82
  >
46
- Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt
47
- unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen,
48
- damit wir Ihnen relevantere Informationen präsentieren können.
49
- For example, we collect information about which pages you visit to help us present more relevant information.
83
+ <span>
84
+ Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt
85
+ unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen,
86
+ damit wir Ihnen relevantere Informationen präsentieren können.
87
+ For example, we collect information about which pages you visit to help us present more relevant information.
88
+ </span>
89
+ {COOKIE_SCHEMA.analytics.map(cookie =>
90
+ <div className={styles.switchBlock}>
91
+ <span>{cookie}</span>
92
+ <MaterialSwitch
93
+ value={analyticsSwitches[cookie]}
94
+ onChange={() => { setAnalyticsSwitches(s => ({ ...s, [cookie]: !s[cookie]})) }}
95
+ />
96
+ </div>
97
+ )}
50
98
  </MaterialAccordionGroup>
51
99
  <MaterialAccordionGroup
52
100
  title='Marketing'
53
101
  withSwitch
54
- switchProps={accordionSwitchProps}
102
+ switchProps={marketingSwitchProps}
55
103
  >
56
- Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites.
57
- Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der Seiten, die Sie auf unserer
58
- Website besuchen, anzeigen.
59
- For example, we may serve you a personalized ad based on the pages you visit on our site.
60
- <div className={styles.switchBlock}>
61
- <span>Cookie</span>
62
- <MaterialSwitch value={switchValue} onChange={(value: boolean) => setSwitchValue(value)} />
63
- </div>
104
+ <span>
105
+ Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites.
106
+ Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der Seiten, die Sie auf unserer
107
+ Website besuchen, anzeigen.
108
+ For example, we may serve you a personalized ad based on the pages you visit on our site.
109
+ </span>
110
+ {COOKIE_SCHEMA.marketing.map(cookie =>
111
+ <div className={styles.switchBlock}>
112
+ <span>Cookie</span>
113
+ <MaterialSwitch
114
+ value={marketingSwitches[cookie]}
115
+ onChange={() => setMarketingSwitches(s => ({ ...s, [cookie]: !s[cookie]}))}
116
+ />
117
+ </div>
118
+ )}
64
119
  </MaterialAccordionGroup>
65
120
  </div>
66
121
  <div className={styles.buttonsContainer}>
@@ -14,6 +14,7 @@ const PreviewCookieModal = ({ toggleModal, setModal }: IPreviewCookieModal) => {
14
14
  localStorage.setItem('cookieConfig', JSON.stringify([]));
15
15
  toggleModal();
16
16
  };
17
+
17
18
  return (
18
19
  <div className={styles.modalWrapper}>
19
20
  <IconSVG name='autodeLogo' customDimensions />
@@ -7,3 +7,10 @@ export const PLACEHOLDER_IMAGE_LARGE_URL: string = `https://images.auto.de/noima
7
7
  export const QUOTES_SLIDES_TO_SHOW_DEFAULT = 3;
8
8
 
9
9
  export const HUNDRED = 100;
10
+
11
+ export const COOKIE_SCHEMA = {
12
+ necessary: ['gdpr', '__cfruid', 'cf_chl_2', 'cf_chl_rc_ni', 'next-i18next', '_cfuvid', 'cf_chl_prog', '__cf_bm'],
13
+ analytics: ['PugT', 'locale', '_gcl_au', '_ga', '_gid', '_gat_UA-31842-13', 'uid', 'callback', 'demdex', '_hjFirstSeen', '_hjIncludedInSessionSample', '_hjIncludedInPageviewSample', '_hjAbsoluteSessionInProgress', 'vuid'],
14
+ marketing: ['_fbp', 'test_cookie', 'tuuid', 'tuuid_lu', 'c', 'CMID', 'CMPS', 'CMPRO', 'uuid2', 'IDE', 'um', 'umeh', 'cf', 'cip', 'cnac', 'car', 'KRTBCOOKIE_97', 'IDSYNC', 'dpm', '_kuid_', 'fr', 'cto_bundle',
15
+ 'visitor-id', 'data-c-ts', 'data-c', 'CMTS', 'mv_tokens', 'A3', 'mv_tokens_eu-v1', 'am_tokens', 'am_tokens_eu-v1', '_hjSessionUser_2590373', 'iteo', '_hjSession_2590373', 'MyVerivoxAuth', 'VxCheckAuth']
16
+ }