@bytebrand/fe-ui-core 4.1.50 → 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.50",
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",
@@ -6,7 +6,7 @@ import { searchTopBarTranslate } from '../../../locales/data';
6
6
  import MaterialMenu from '../../_common/UserMenu/MaterialMenu';
7
7
  import { isMobileOnly } from 'react-device-detect';
8
8
  import MaterialAutocomplete from '../../_common/MaterialAutocomplete/MaterialAutocomplete';
9
- import { IconSVG } from '@bytebrand/fe-ui-core/common';
9
+ import IconSVG from '../../_common/IconSVG/IconSVG';
10
10
 
11
11
  interface ISearchTopBarProps {
12
12
  t?: (key: string, options?: object) => string;
@@ -19,4 +19,3 @@ const SvgDate = (props: any) => (
19
19
 
20
20
  export default SvgDate;
21
21
  /* tslint:enable */
22
-
@@ -16,4 +16,3 @@ const SvgOwner = (props: any) => (
16
16
 
17
17
  export default SvgOwner;
18
18
  /* tslint:enable */
19
-
@@ -22,7 +22,7 @@ const MaterialSwitch = ({ disabled, label, onChange, value = false, labelPlaceme
22
22
  labelPlacement={labelPlacement}
23
23
  control={
24
24
  <Switch
25
- checked={checked}
25
+ checked={value || checked}
26
26
  onChange={handleChange}
27
27
  disabled={disabled}
28
28
  onClick={e => e.stopPropagation()}
@@ -49,4 +49,8 @@
49
49
  text-transform: uppercase !important
50
50
 
51
51
  .outlinedBtn
52
- border: none !important
52
+ border: none !important
53
+
54
+ .switchBlock
55
+ display: flex
56
+ justify-content: space-between
@@ -1,12 +1,54 @@
1
- import React 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';
5
6
  import Button from '../../../Button/Button';
6
7
  import MaterialAccordionGroup from '../../../MaterialAccordionGroup/MaterialAccordionGroup';
7
8
  import classNames from 'classnames';
9
+ import MaterialSwitch from '../../../MaterialSwitch/MaterialSwitch';
10
+ import { COOKIE_SCHEMA } from '@bytebrand/fe-ui-core/source/framework/constants/common';
8
11
 
9
12
  const ManageCookieModal = () => {
13
+ const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(true);
14
+ const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(true);
15
+ const [analyticsSwitches, setAnalyticsSwitches] = useState({});
16
+ const [marketingSwitches, setMarketingSwitches] = useState({});
17
+
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
45
+ };
46
+
47
+ const necessarySwitchProps = {
48
+ value: true,
49
+ onChange: () => {}
50
+ };
51
+
10
52
  return (
11
53
  <div className={styles.modalWrapper}>
12
54
  <IconSVG name='autodeLogo' customDimensions />
@@ -17,30 +59,63 @@ const ManageCookieModal = () => {
17
59
  title='Notwendig'
18
60
  tooltipText='tooltip text'
19
61
  withSwitch
62
+ switchProps={necessarySwitchProps}
20
63
  >
64
+ <span>
21
65
  Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert.
22
66
  Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen
23
67
  können, wenn Sie auf unsere Website zurückkehren.
24
68
  For example, we store your website data collection preferences so we can honor them if you return to our site.
25
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
+ )}
26
77
  </MaterialAccordionGroup>
27
78
  <MaterialAccordionGroup
28
79
  title='Analytisch'
29
80
  withSwitch
81
+ switchProps={analyticsSwitchProps}
30
82
  >
31
- Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt
32
- unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen,
33
- damit wir Ihnen relevantere Informationen präsentieren können.
34
- 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
+ )}
35
98
  </MaterialAccordionGroup>
36
99
  <MaterialAccordionGroup
37
100
  title='Marketing'
38
101
  withSwitch
102
+ switchProps={marketingSwitchProps}
39
103
  >
40
- Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites.
41
- Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der Seiten, die Sie auf unserer
42
- Website besuchen, anzeigen.
43
- For example, we may serve you a personalized ad based on the pages you visit on our site.
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
+ )}
44
119
  </MaterialAccordionGroup>
45
120
  </div>
46
121
  <div className={styles.buttonsContainer}>
@@ -13,7 +13,8 @@ const PreviewCookieModal = ({ toggleModal, setModal }: IPreviewCookieModal) => {
13
13
  const onAcceptAll = () => {
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
+ }