@bytebrand/fe-ui-core 4.1.63 → 4.1.65

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.63",
3
+ "version": "4.1.65",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -116,15 +116,15 @@ const RangeControlled = ({
116
116
 
117
117
  const fromProps = {
118
118
  size: 'custom',
119
- value: from ? from : null,
119
+ value:from ? numberWithDot(from):null,
120
120
  label: `${t('filters.from')} ${unit ? unit : '€'}`,
121
121
  onChange: (value: any) => onDropDownChange('from', value),
122
- items: getOptions(sliceLessThan(getDropdownRange(name), to))
122
+ items: getOptions(sliceLessThan(getDropdownRange(name), to)),
123
123
  };
124
124
 
125
125
  const toProps = {
126
126
  size: 'custom',
127
- value: to ? to : null,
127
+ value:to ? numberWithDot(to):null,
128
128
  label: `${t('filters.to')} ${unit ? unit : '€'}`,
129
129
  onChange: (value: any) => onDropDownChange('to', value),
130
130
  items: getOptions(sliceMoreThan(getDropdownRange(name), from))
@@ -8,6 +8,8 @@ import MaterialAccordionGroup from '../../../MaterialAccordionGroup/MaterialAcco
8
8
  import classNames from 'classnames';
9
9
  import MaterialSwitch from '../../../MaterialSwitch/MaterialSwitch';
10
10
  import { COOKIE_SCHEMA } from '../../../../../framework/constants/common';
11
+ import Cookies from 'js-cookie';
12
+ import { config } from '../../../../../framework/constants/app';
11
13
 
12
14
  const ManageCookieModal = ({ onClearModalState }) => {
13
15
  const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(true);
@@ -32,8 +34,8 @@ const ManageCookieModal = ({ onClearModalState }) => {
32
34
  };
33
35
 
34
36
  const onHandleMarketingSwitchValue = (value: boolean) => {
35
- const newAnalyticsSwitches = Object.keys(analyticsSwitches).reduce((acc, item) => ({ ...acc, [item]: value }), {});
36
- setMarketingSwitches(newAnalyticsSwitches);
37
+ const newMarketingSwitches = Object.keys(marketingSwitches).reduce((acc, item) => ({ ...acc, [item]: value }), {});
38
+ setMarketingSwitches(newMarketingSwitches);
37
39
  setMarketingMasterSwitch(value);
38
40
  };
39
41
 
@@ -52,8 +54,18 @@ const ManageCookieModal = ({ onClearModalState }) => {
52
54
  onChange: () => {}
53
55
  };
54
56
 
55
- const onAccept = (value: object) => {
56
- localStorage.setItem('cookieConfig', JSON.stringify( value || {}));
57
+ const onAccept = (value?: object) => {
58
+ const cookieConfig = value || {
59
+ marketing: Object.keys(marketingSwitches).filter(i => !marketingSwitches[i]) || [],
60
+ analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
61
+ };
62
+ localStorage.setItem('cookieConfig', JSON.stringify(cookieConfig));
63
+
64
+ Object.keys(cookieConfig).forEach(group => {
65
+ cookieConfig[group].forEach((cookie: string) => {
66
+ Cookies.remove(cookie, { path: '/' });
67
+ })
68
+ })
57
69
  onClearModalState();
58
70
  };
59
71
 
@@ -77,7 +89,7 @@ const ManageCookieModal = ({ onClearModalState }) => {
77
89
  You can disable these cookies in your browser settings but if you do the site may not work as intended.
78
90
  </span>
79
91
  {Object.keys(COOKIE_SCHEMA.necessary).map(cookie =>
80
- <div className={styles.switchBlock}>
92
+ <div className={styles.switchBlock} key={cookie} >
81
93
  <span>{`${COOKIE_SCHEMA.necessary[cookie].name} (${cookie})`}</span>
82
94
  <MaterialSwitch disabled={true} value={true} onChange={() => {}} />
83
95
  </div>
@@ -95,7 +107,7 @@ const ManageCookieModal = ({ onClearModalState }) => {
95
107
  For example, we collect information about which pages you visit to help us present more relevant information.
96
108
  </span>
97
109
  {Object.keys(COOKIE_SCHEMA.analytics).map(cookie =>
98
- <div className={styles.switchBlock}>
110
+ <div className={styles.switchBlock} key={cookie} >
99
111
  <span>{`${COOKIE_SCHEMA.analytics[cookie].name} (${cookie})`}</span>
100
112
  <MaterialSwitch
101
113
  value={analyticsSwitches[cookie]}
@@ -116,7 +128,7 @@ const ManageCookieModal = ({ onClearModalState }) => {
116
128
  For example, we may serve you a personalized ad based on the pages you visit on our site.
117
129
  </span>
118
130
  {Object.keys(COOKIE_SCHEMA.marketing).map(cookie =>
119
- <div className={styles.switchBlock}>
131
+ <div className={styles.switchBlock} key={cookie} >
120
132
  <span>{`${COOKIE_SCHEMA.marketing[cookie].name} (${cookie})`}</span>
121
133
  <MaterialSwitch
122
134
  value={marketingSwitches[cookie]}
@@ -127,7 +139,7 @@ const ManageCookieModal = ({ onClearModalState }) => {
127
139
  </MaterialAccordionGroup>
128
140
  </div>
129
141
  <div className={styles.buttonsContainer}>
130
- <Button onClick={onAccept}className={classNames(styles.modalBtn, styles.outlinedBtn)} variant='outlined'>Cookie-Einstellungen</Button>
142
+ <Button onClick={() => onAccept()}className={classNames(styles.modalBtn, styles.outlinedBtn)} variant='outlined'>Cookie-Einstellungen</Button>
131
143
  <Button onClick={() => onAccept({})} className={styles.modalBtn}>zustimmen</Button>
132
144
  </div>
133
145
  </div>