@bytebrand/fe-ui-core-autobahn 1.0.86 → 1.0.87

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.
@@ -28,13 +28,20 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
28
28
 
29
29
  useEffect(
30
30
  () => {
31
+ // switches represent "is allowed" (true = allowed). Default to off (nothing
32
+ // allowed) unless the visitor already saved a choice on a previous visit.
33
+ const savedConfigRaw = localStorage.getItem('cookieConfig');
34
+ const savedConfig = savedConfigRaw ? JSON.parse(savedConfigRaw) : null;
35
+ const savedDisabledAnalytics: string[] = savedConfig?.analytics || [];
36
+ const savedDisabledMarketing: string[] = savedConfig?.marketing || [];
37
+
31
38
  const newAnalyticsSwitches = Object.values(COOKIE_SCHEMA.analytics)
32
39
  .reduce((acc, val) => acc.concat(val), [])
33
- .reduce((acc, item) => ({ ...acc, [item]: true }), {});
40
+ .reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledAnalytics.includes(item) }), {});
34
41
 
35
42
  const newMarketingSwitches = Object.values(COOKIE_SCHEMA.marketing)
36
43
  .reduce((acc, val) => acc.concat(val), [])
37
- .reduce((acc, item) => ({ ...acc, [item]: true }), {});
44
+ .reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledMarketing.includes(item) }), {});
38
45
  setAnalyticsSwitches(newAnalyticsSwitches);
39
46
  setMarketingSwitches(newMarketingSwitches);
40
47
  },
@@ -42,11 +49,9 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
42
49
  );
43
50
 
44
51
  const onHandleAnalyticsSwitchValue = (value: boolean) => {
45
- // per-item state is stored inverted (false = this item is on — see isChecked below),
46
- // so turning the master ON (value=true) must store false on every item, not true.
47
52
  const newAnalyticsSwitches = Object.values(COOKIE_SCHEMA.analytics)
48
53
  .reduce((acc, val) => acc.concat(val), [])
49
- .reduce((acc, item) => ({ ...acc, [item]: !value }), {});
54
+ .reduce((acc, item) => ({ ...acc, [item]: value }), {});
50
55
 
51
56
  setAnalyticsSwitches(newAnalyticsSwitches);
52
57
  setAnalyticsMasterSwitch(value);
@@ -55,7 +60,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
55
60
  const onHandleMarketingSwitchValue = (value: boolean) => {
56
61
  const newMarketingSwitches = Object.values(COOKIE_SCHEMA.marketing)
57
62
  .reduce((acc, val) => acc.concat(val), [])
58
- .reduce((acc, item) => ({ ...acc, [item]: !value }), {});
63
+ .reduce((acc, item) => ({ ...acc, [item]: value }), {});
59
64
  setMarketingSwitches(newMarketingSwitches);
60
65
  setMarketingMasterSwitch(value);
61
66
  };
@@ -136,7 +141,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
136
141
  {Object.keys(COOKIE_SCHEMA.analytics).map(cookie => {
137
142
  const getItemsFromCategory = _get(COOKIE_SCHEMA, `analytics['${cookie}']`, null);
138
143
  const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
139
- const isChecked = getItemsFromCategory.every((item: string) => analyticsSwitches[item] === false);
144
+ const isChecked = getItemsFromCategory.every((item: string) => analyticsSwitches[item] === true);
140
145
  return (
141
146
  <div className={styles.switchBlock} key={cookie} >
142
147
  <span className={styles.switchBlockTitle}>{cookie}</span>
@@ -144,7 +149,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
144
149
  <MaterialSwitch
145
150
  sx={{ marginLeft: 'auto' }}
146
151
  value={isChecked}
147
- onChange={() => onHandleChangeInnerSwitchAnalytics(getItemsFromCategory, isChecked)}
152
+ onChange={(newValue: boolean) => onHandleChangeInnerSwitchAnalytics(getItemsFromCategory, newValue)}
148
153
  />
149
154
  </div>
150
155
  );
@@ -160,7 +165,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
160
165
  {Object.keys(COOKIE_SCHEMA.marketing).map(cookie => {
161
166
  const getItemsFromCategory = _get(COOKIE_SCHEMA, `marketing['${cookie}']`, null);
162
167
  const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
163
- const isChecked = getItemsFromCategory.every((item: string) => marketingSwitches[item] === false);
168
+ const isChecked = getItemsFromCategory.every((item: string) => marketingSwitches[item] === true);
164
169
  return (
165
170
  <div className={styles.switchBlock} key={cookie} >
166
171
  <span className={styles.switchBlockTitle}>{cookie}</span>
@@ -168,7 +173,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
168
173
  <MaterialSwitch
169
174
  sx={{ marginLeft: 'auto' }}
170
175
  value={isChecked}
171
- onChange={() => onHandleChangeInnerSwitchMarketing(getItemsFromCategory, isChecked)}
176
+ onChange={(newValue: boolean) => onHandleChangeInnerSwitchMarketing(getItemsFromCategory, newValue)}
172
177
  />
173
178
  </div>
174
179
  )
@@ -177,7 +182,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
177
182
  </div>
178
183
  <div className={styles.buttonsContainer}>
179
184
  <Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn)} >Auswahl speichern</Button>
180
- <Button onClick={() => onAccept({})} className={styles.modalBtn}>Alles akzeptieren</Button>
185
+ <Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={styles.modalBtn}>Alles akzeptieren</Button>
181
186
  </div>
182
187
  </div>
183
188
  );
@@ -3,6 +3,7 @@ import IconSVG from '../../../../iconsvg/IconSVG';
3
3
  import Button from '../../../Button/Button';
4
4
  import styles from './PreviewCookieModal.styl';
5
5
  import { updateCookieList } from '../../../../utils/CommonUtils';
6
+ import { COOKIE_SCHEMA } from '../../../../constants/common';
6
7
 
7
8
  interface IPreviewCookieModal {
8
9
  toggleModal: () => void;
@@ -13,15 +14,15 @@ interface IPreviewCookieModal {
13
14
  const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
14
15
  const environment = window.location.origin;
15
16
  const onAcceptAll = () => {
16
- localStorage.setItem('cookieConfig', JSON.stringify({}));
17
+ localStorage.setItem('cookieConfig', JSON.stringify({ marketing: [], analytics: [] }));
17
18
  updateCookieList(handleSentryInit);
18
19
  toggleModal();
19
20
  };
20
21
 
21
22
  const onDisableAll = () => {
22
23
  localStorage.setItem('cookieConfig', JSON.stringify({
23
- 'marketing':['cf','cip','cnac','car','test_cookie','IDE', 'bid','youtube'],
24
- 'analytics':['sentry','callback','locale','uid','PugT','demdex','cto_bundle','tuuid','tuuid_lu','c','CMID','CMPS','CMPRO','uuid2','um','umeh','KRTBCOOKIE_97','IDSYNC','dpm','_kuid_','visitor-id','data-c-ts','data-c','CMTS','mv_tokens','A3','mv_tokens_eu-v1','am_tokens','am_tokens_eu-v1','iteo','_fbp','_clck','_clsk','_uetsid','_uetvid','analytics_storage','ad_storage','functionality_storage','personalization_storage','security_storage','hotjar']
24
+ marketing: Object.values(COOKIE_SCHEMA.marketing).reduce((acc: string[], val: string[]) => acc.concat(val), []),
25
+ analytics: Object.values(COOKIE_SCHEMA.analytics).reduce((acc: string[], val: string[]) => acc.concat(val), [])
25
26
  }));
26
27
  updateCookieList(handleSentryInit);
27
28
  toggleModal();
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.86",
4
- "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
- "main": "index.ts",
6
- "license": "UNLICENSED",
7
- "peerDependencies": {
8
- "react": "^18.0.0",
9
- "react-dom": "^18.0.0"
10
- },
11
- "dependencies": {
12
- "@bytebrand/car-schema-selectors": "^2.0.7",
13
- "@bytebrand/fe-financing": "^5.14.12",
14
- "classnames": "2.2.6",
15
- "clsx": "^2.1.1",
16
- "d3-format": "1.4.5",
17
- "js-cookie": "^2.2.0",
18
- "lodash": "^4.17.21",
19
- "lucide-react": "^0.288.0",
20
- "mobx-react": "^7.6.0",
21
- "moment": "^2.29.1",
22
- "qs": "^6.6.0",
23
- "react-device-detect": "^2.1.2",
24
- "react-grid-system": "^5.0.2",
25
- "react-lazyload": "^3.2.0",
26
- "react-scroll": "^1.9.3",
27
- "react-slick": "^0.29.0",
28
- "slick-carousel": "1.8.1"
29
- }
30
- }
1
+ {
2
+ "name": "@bytebrand/fe-ui-core-autobahn",
3
+ "version": "1.0.87",
4
+ "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
+ "main": "index.ts",
6
+ "license": "UNLICENSED",
7
+ "peerDependencies": {
8
+ "react": "^18.0.0",
9
+ "react-dom": "^18.0.0"
10
+ },
11
+ "dependencies": {
12
+ "@bytebrand/car-schema-selectors": "^2.0.7",
13
+ "@bytebrand/fe-financing": "^5.14.12",
14
+ "classnames": "2.2.6",
15
+ "clsx": "^2.1.1",
16
+ "d3-format": "1.4.5",
17
+ "js-cookie": "^2.2.0",
18
+ "lodash": "^4.17.21",
19
+ "lucide-react": "^0.288.0",
20
+ "mobx-react": "^7.6.0",
21
+ "moment": "^2.29.1",
22
+ "qs": "^6.6.0",
23
+ "react-device-detect": "^2.1.2",
24
+ "react-grid-system": "^5.0.2",
25
+ "react-lazyload": "^3.2.0",
26
+ "react-scroll": "^1.9.3",
27
+ "react-slick": "^0.29.0",
28
+ "slick-carousel": "1.8.1"
29
+ }
30
+ }