@bytebrand/fe-ui-core-autobahn 1.0.226 → 1.0.228

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.
Files changed (58) hide show
  1. package/campaign/CampaignBand.tsx +26 -0
  2. package/campaign/campaignVars.ts +12 -0
  3. package/campaign/campaigns.ts +74 -0
  4. package/campaign/index.ts +6 -0
  5. package/cards/CarCard.tsx +393 -366
  6. package/cards/CarRow.tsx +8 -28
  7. package/cards/cardParts.tsx +23 -48
  8. package/cards/dealSignals.ts +36 -0
  9. package/cards/index.ts +0 -6
  10. package/chrome/Footer.tsx +3 -16
  11. package/chrome/TopBar.tsx +266 -139
  12. package/compat/CookieModal/CookieModal.tsx +6 -20
  13. package/compat/CookieModal/Modal.tsx +3 -6
  14. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
  15. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
  16. package/compat/CookieModal/useModal.ts +1 -5
  17. package/compat/Loader/Loader.tsx +7 -1
  18. package/compat/MdField/MdField.tsx +4 -28
  19. package/compat/PriceRating/PriceRating.styl +7 -5
  20. package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +6 -8
  21. package/compat/TimePicker/TimePicker.tsx +2 -12
  22. package/compat/legacy-theme/priceReviewColors.styl +5 -18
  23. package/constants/app.ts +11 -1
  24. package/constants/autobahn.ts +0 -39
  25. package/constants/core.ts +12 -1
  26. package/data/fieldMapping.ts +3 -3
  27. package/data/toAutobahnCar.ts +14 -30
  28. package/iconsvg/IconSVG.tsx +5 -1
  29. package/index.ts +19 -18
  30. package/locales/de/autobahn.json +862 -903
  31. package/locales/en/autobahn.json +862 -903
  32. package/package.json +2 -2
  33. package/theme/md3.css +11808 -15866
  34. package/ui/Dropdown.tsx +10 -29
  35. package/ui/FormCheckbox.tsx +2 -22
  36. package/ui/FormField.tsx +1 -2
  37. package/ui/Icon.tsx +0 -6
  38. package/ui/Modal.tsx +6 -84
  39. package/ui/Skeleton.tsx +20 -79
  40. package/ui/Stars.tsx +18 -36
  41. package/ui/StatChip.tsx +3 -8
  42. package/ui/index.ts +0 -3
  43. package/ui/usePortalMenuPosition.ts +15 -27
  44. package/utils/index.ts +0 -10
  45. package/vdp/FinanceCalculator.tsx +34 -162
  46. package/vdp/VdpModules.tsx +976 -348
  47. package/vdp/index.ts +3 -6
  48. package/vdp/types.ts +15 -25
  49. package/vehiclesProps/decoratedLightProps.tsx +0 -4
  50. package/vehiclesProps/decoratedProps.tsx +0 -4
  51. package/cards/CarCardSkeleton.tsx +0 -103
  52. package/cards/CarRowSkeleton.tsx +0 -152
  53. package/chrome/AccountMenuIcon.tsx +0 -109
  54. package/ui/MfieldCheckIcon.tsx +0 -13
  55. package/ui/ratingLink.ts +0 -36
  56. package/ui/scrollFieldIntoView.ts +0 -41
  57. package/utils/cookieConsent.ts +0 -84
  58. package/vehiclesProps/accidentDisclosure.ts +0 -25
@@ -8,43 +8,19 @@ import MaterialAccordionGroup from '../../../MdAccordionGroup/MdAccordionGroup';
8
8
  import MaterialSwitch from '../../../MdSwitch/MdSwitch';
9
9
  import { COOKIE_SCHEMA, COOKIE_SCHEMA_LINKS } from '../../../../constants/common';
10
10
  import { updateCookieList } from '../../../../utils/CommonUtils';
11
- import { saveCookieConfig } from '../../../../utils/cookieConsent';
12
- import { TranslationFunction } from '../../../../types';
13
11
 
14
12
  import styles from './ManageCookieModal.styl';
15
13
 
16
14
  interface IManageCookieModal {
17
15
  toggleModal: () => void;
18
16
  handleSentryInit?: () => void;
19
- /** the host's `t` with the `autobahn` namespace loaded; without it the dialog stays German (fe-landing) */
20
- t?: TranslationFunction;
21
17
  }
22
18
 
23
19
  interface IMarketingSwitches {
24
20
  [key: string]: any;
25
21
  }
26
22
 
27
- // the German copy (locales/de/autobahn.json `cookieModal`), used as is when the host passes no `t`
28
- const DE: Record<string, string> = {
29
- title: 'Nach den Cookies geht die Fahrt weiter.',
30
- manageText: 'Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.',
31
- 'necessary.title': 'Notwendig',
32
- 'necessary.text': 'Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.',
33
- 'analytics.title': 'Analytisch',
34
- 'analytics.text': 'Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.',
35
- 'marketing.title': 'Marketing',
36
- 'marketing.text': 'Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.',
37
- privacyPolicy: 'Datenschutzbestimmungen',
38
- saveSelection: 'Auswahl speichern',
39
- acceptAll: 'Alles akzeptieren'
40
- };
41
-
42
- const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieModal) => {
43
- // a key the host can't resolve (namespace not loaded) comes back as the key itself
44
- const tr = (key: string) => {
45
- const text = t ? t(`autobahn:cookieModal.${key}`) : '';
46
- return text && !text.endsWith(`cookieModal.${key}`) ? text : DE[key];
47
- };
23
+ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModal) => {
48
24
  const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(false);
49
25
  const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(false);
50
26
  const [analyticsSwitches, setAnalyticsSwitches] = useState<IMarketingSwitches>({});
@@ -68,10 +44,6 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
68
44
  .reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledMarketing.includes(item) }), {});
69
45
  setAnalyticsSwitches(newAnalyticsSwitches);
70
46
  setMarketingSwitches(newMarketingSwitches);
71
- // ADV-268: reopened from the account page, a category whose cookies are all allowed shows
72
- // its master switch on (it always started off)
73
- setAnalyticsMasterSwitch(Object.values(newAnalyticsSwitches).every(Boolean));
74
- setMarketingMasterSwitch(Object.values(newMarketingSwitches).every(Boolean));
75
47
  },
76
48
  []
77
49
  );
@@ -114,7 +86,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
114
86
  marketing: Object.keys(marketingSwitches).filter(i => !marketingSwitches[i]) || [],
115
87
  analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
116
88
  };
117
- saveCookieConfig(cookieConfig);
89
+ localStorage.setItem('cookieConfig', JSON.stringify(cookieConfig));
118
90
  updateCookieList(handleSentryInit);
119
91
  toggleModal();
120
92
  };
@@ -138,34 +110,34 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
138
110
  return (
139
111
  <div className={styles.modalWrapper}>
140
112
  <IconSVG name='autodeLogo' customDimensions />
141
- <div className={styles.modalTitle}>{tr('title')}</div>
142
- <div className={styles.modalContent}>{tr('manageText')}</div>
113
+ <div className={styles.modalTitle}>Nach den Cookies geht die Fahrt weiter.</div>
114
+ <div className={styles.modalContent}>Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.</div>
143
115
  <div className={styles.accordions}>
144
116
  <MaterialAccordionGroup
145
- title={tr('necessary.title')}
117
+ title='Notwendig'
146
118
  // tooltipText='Notwendig'
147
119
  withSwitch
148
120
  switchProps={necessarySwitchProps}
149
121
  >
150
- <span className={styles.accordionDescription}>{tr('necessary.text')}</span>
122
+ <span className={styles.accordionDescription}>Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.</span>
151
123
  {Object.keys(COOKIE_SCHEMA.necessary).map(cookie => {
152
124
  const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
153
125
  return (
154
126
  <div className={styles.switchBlock} key={cookie} >
155
127
  <span className={styles.switchBlockTitle}>{cookie}</span>
156
- <a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
128
+ <a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
157
129
  <MaterialSwitch sx={{ marginLeft: 'auto' }} disabled={true} value={true} onChange={() => {}} />
158
130
  </div>
159
131
  );
160
132
  })}
161
133
  </MaterialAccordionGroup>
162
134
  <MaterialAccordionGroup
163
- title={tr('analytics.title')}
135
+ title='Analytisch'
164
136
  withSwitch
165
137
  // tooltipText='Analytisch'
166
138
  switchProps={analyticsSwitchProps}
167
139
  >
168
- <span className={styles.accordionDescription}>{tr('analytics.text')}</span>
140
+ <span className={styles.accordionDescription}>Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.</span>
169
141
  {Object.keys(COOKIE_SCHEMA.analytics).map(cookie => {
170
142
  const getItemsFromCategory = _get(COOKIE_SCHEMA, `analytics['${cookie}']`, null);
171
143
  const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
@@ -173,7 +145,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
173
145
  return (
174
146
  <div className={styles.switchBlock} key={cookie} >
175
147
  <span className={styles.switchBlockTitle}>{cookie}</span>
176
- <a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
148
+ <a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
177
149
  <MaterialSwitch
178
150
  sx={{ marginLeft: 'auto' }}
179
151
  value={isChecked}
@@ -184,12 +156,12 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
184
156
  })}
185
157
  </MaterialAccordionGroup>
186
158
  <MaterialAccordionGroup
187
- title={tr('marketing.title')}
159
+ title='Marketing'
188
160
  withSwitch
189
161
  // tooltipText='Marketing'
190
162
  switchProps={marketingSwitchProps}
191
163
  >
192
- <span className={styles.accordionDescription}>{tr('marketing.text')}</span>
164
+ <span className={styles.accordionDescription}>Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.</span>
193
165
  {Object.keys(COOKIE_SCHEMA.marketing).map(cookie => {
194
166
  const getItemsFromCategory = _get(COOKIE_SCHEMA, `marketing['${cookie}']`, null);
195
167
  const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
@@ -197,7 +169,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
197
169
  return (
198
170
  <div className={styles.switchBlock} key={cookie} >
199
171
  <span className={styles.switchBlockTitle}>{cookie}</span>
200
- <a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
172
+ <a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
201
173
  <MaterialSwitch
202
174
  sx={{ marginLeft: 'auto' }}
203
175
  value={isChecked}
@@ -209,8 +181,8 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
209
181
  </MaterialAccordionGroup>
210
182
  </div>
211
183
  <div className={styles.buttonsContainer}>
212
- <Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >{tr('saveSelection')}</Button>
213
- <Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>{tr('acceptAll')}</Button>
184
+ <Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >Auswahl speichern</Button>
185
+ <Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>Alles akzeptieren</Button>
214
186
  </div>
215
187
  </div>
216
188
  );
@@ -3,7 +3,6 @@ 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 { saveCookieConfig } from '../../../../utils/cookieConsent';
7
6
  import { COOKIE_SCHEMA } from '../../../../constants/common';
8
7
 
9
8
  interface IPreviewCookieModal {
@@ -15,16 +14,16 @@ interface IPreviewCookieModal {
15
14
  const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
16
15
  const environment = window.location.origin;
17
16
  const onAcceptAll = () => {
18
- saveCookieConfig({ marketing: [], analytics: [] });
17
+ localStorage.setItem('cookieConfig', JSON.stringify({ marketing: [], analytics: [] }));
19
18
  updateCookieList(handleSentryInit);
20
19
  toggleModal();
21
20
  };
22
21
 
23
22
  const onDisableAll = () => {
24
- saveCookieConfig({
23
+ localStorage.setItem('cookieConfig', JSON.stringify({
25
24
  marketing: Object.values(COOKIE_SCHEMA.marketing).reduce((acc: string[], val: string[]) => acc.concat(val), []),
26
25
  analytics: Object.values(COOKIE_SCHEMA.analytics).reduce((acc: string[], val: string[]) => acc.concat(val), [])
27
- });
26
+ }));
28
27
  updateCookieList(handleSentryInit);
29
28
  toggleModal();
30
29
  };
@@ -7,11 +7,7 @@ const useModal = () => {
7
7
  setIsVisible(!isVisible);
8
8
  };
9
9
 
10
- const openModal = () => {
11
- setIsVisible(true);
12
- };
13
-
14
- return { isVisible, toggleModal, openModal };
10
+ return { isVisible, toggleModal };
15
11
  };
16
12
 
17
13
  export default useModal;
@@ -10,7 +10,7 @@ export interface ILoaderProps {
10
10
  fluid?: boolean;
11
11
  }
12
12
 
13
- const Loader: React.FC<ILoaderProps> = ({ className = '', size = 'medium', fluid = false }) => {
13
+ const Loader: React.FC<ILoaderProps> = ({ className, size, fluid }) => {
14
14
  const classNames = classnames(
15
15
  styles.loader,
16
16
  { [styles[size]]: !fluid },
@@ -23,4 +23,10 @@ const Loader: React.FC<ILoaderProps> = ({ className = '', size = 'medium', fluid
23
23
  );
24
24
  };
25
25
 
26
+ Loader.defaultProps = {
27
+ className: '',
28
+ size: 'medium',
29
+ fluid: false
30
+ };
31
+
26
32
  export default Loader;
@@ -8,7 +8,6 @@ import * as React from 'react';
8
8
  import classnames from 'classnames';
9
9
 
10
10
  import Icon from '../../ui/Icon';
11
- import MfieldCheckIcon from '../../ui/MfieldCheckIcon';
12
11
 
13
12
  export interface MdFieldProps {
14
13
  className?: string;
@@ -33,21 +32,12 @@ export interface MdFieldProps {
33
32
  * when empty and unfocused, then floats up to the normal small-label spot on focus
34
33
  * or once a value is typed. Defaults to false — the static above-field label. */
35
34
  floatingLabel?: boolean;
36
- /** opt-in: show a green check + green border when the field is filled and valid (checkout).
37
- * Same contract/markup as FormField's own showValid (.mfield--valid/.mfield-ok, md3.css). */
38
- showValid?: boolean;
39
35
  onChange: (value: string, name?: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
40
- /** fires after the field's own internal blur handling (floating-label state). Callers use
41
- * this to trigger `field.validate()` (mobx-react-form) on blur — this component only owns
42
- * the `error` prop's display, not when validation actually runs, so without a caller wiring
43
- * this in, `field.error` never populates from blur and a required-but-empty field never
44
- * shows its error text/red border until some other validate() call happens to run. */
45
- onBlur?: () => void;
46
36
  }
47
37
 
48
38
  const MdField: React.FunctionComponent<MdFieldProps> = ({
49
39
  className, error, sx, required, disabled, multiline, autoComplete,
50
- value, type, name, rows, label, placeholder, floatingLabel, maxLength, showValid, onChange, onBlur
40
+ value, type, name, rows, label, placeholder, floatingLabel, maxLength, onChange
51
41
  }) => {
52
42
  const [reveal, setReveal] = React.useState(false);
53
43
  const [focused, setFocused] = React.useState(false);
@@ -64,7 +54,6 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
64
54
  // a value is typed, the real <label> appears in its normal static spot above the
65
55
  // field and the native placeholder goes quiet — the two never show at the same time.
66
56
  const hasValue = value != null && value !== '';
67
- const isValid = !!showValid && !disabled && !isPassword && !hasError && hasValue;
68
57
  const resting = !!floatingLabel && !focused && !hasValue;
69
58
  const effectivePlaceholder = floatingLabel ? (resting ? (label || placeholder || '') : '') : (placeholder || '');
70
59
  // The real <label> is skipped entirely while resting (see above), leaving the input with
@@ -82,9 +71,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
82
71
 
83
72
  return (
84
73
  <div className={classnames('mfield-group', className)} style={sx as React.CSSProperties}>
85
- {/* Non-floating fields (FormField's own call sites don't set floatingLabel) keep the
86
- plain label-above-the-box row — unchanged, still a .mfield-group flex child. */}
87
- {label && !resting && !floatingLabel ? (
74
+ {label && !resting ? (
88
75
  <label className='md-label-sm mfield-label' htmlFor={generatedId}>
89
76
  {label}{required ? ' *' : ''}
90
77
  </label>
@@ -100,18 +87,8 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
100
87
  + (hasError ? ' mfield--error' : '')
101
88
  + (disabled ? ' mfield--disabled' : '')
102
89
  + (floatingLabel ? ' mfield--floating' : '')
103
- + (isValid ? ' mfield--valid' : '')
104
90
  }
105
91
  >
106
- {/* floatingLabel + floated (focused or has a value): the Material "notched outline"
107
- treatment — label sits ON the border line, not stacked above it in its own row.
108
- Lives INSIDE .mfield (not .mfield-group) so it can position against .mfield's own
109
- edge (.mfield is position:relative already, md3.css) via .mfield-label--notch. */}
110
- {label && !resting && floatingLabel ? (
111
- <label className='md-label-sm mfield-label mfield-label--notch' htmlFor={generatedId}>
112
- {label}{required ? ' *' : ''}
113
- </label>
114
- ) : null}
115
92
  {multiline ? (
116
93
  <textarea
117
94
  id={generatedId}
@@ -119,7 +96,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
119
96
  value={value == null ? '' : value}
120
97
  onChange={handleChange}
121
98
  onFocus={() => setFocused(true)}
122
- onBlur={() => { setFocused(false); onBlur?.(); }}
99
+ onBlur={() => setFocused(false)}
123
100
  disabled={disabled}
124
101
  rows={rows || 3}
125
102
  maxLength={maxLength}
@@ -138,7 +115,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
138
115
  value={value == null ? '' : value}
139
116
  onChange={handleChange}
140
117
  onFocus={() => setFocused(true)}
141
- onBlur={() => { setFocused(false); onBlur?.(); }}
118
+ onBlur={() => setFocused(false)}
142
119
  disabled={disabled}
143
120
  maxLength={maxLength}
144
121
  placeholder={effectivePlaceholder}
@@ -160,7 +137,6 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
160
137
  <Icon name={reveal ? 'eye-off' : 'eye'} size={18} />
161
138
  </button>
162
139
  ) : null}
163
- {isValid ? <span className="mfield-ok"><MfieldCheckIcon /></span> : null}
164
140
  </div>
165
141
  {hasError ? (
166
142
  // role="alert" announces this to screen readers the moment it enters the DOM (e.g.
@@ -36,10 +36,12 @@
36
36
  color: $priceReviewColors[darkBackground]
37
37
  border: 2px solid $priceReviewColors[darkBackground]
38
38
 
39
- // label: the rating's text colour; segment: its scale colour
40
- for colorName in $priceReviewTextColors
41
- .{colorName}
42
- color: $priceReviewTextColors[colorName]
43
39
  for colorName in $priceReviewColors
40
+ $color = $priceReviewColors[colorName]
41
+ if $color == $priceReviewColors.noRating
42
+ $color = $priceReviewColors[darkBackground]
43
+ $backgroundColor = $priceReviewColors[colorName]
44
+ .{colorName}
45
+ color: $color
44
46
  .{colorName}Background
45
- border: 2px solid $priceReviewColors[colorName]
47
+ border: 2px solid $backgroundColor
@@ -71,28 +71,26 @@
71
71
 
72
72
  .noRatingTooltip
73
73
  @extends .baseTooltip
74
- color: $priceReviewTextColors[noRating]
75
- border-color: #C8D1DE
74
+ color: black
75
+ border-color: $priceReviewColors[darkBackground]
76
76
 
77
77
  .tooltip
78
78
  @extends .baseTooltip
79
79
  color: white
80
80
 
81
- // segment: the rating's scale colour; tooltip (text on white): its text colour
82
81
  for colorName in $priceReviewColors
83
82
  $color = $priceReviewColors[colorName]
84
- $textColor = $priceReviewTextColors[colorName] || $color
85
83
  .{colorName}
86
84
  &.segment
87
85
  background-color $color
88
86
  .tooltipWrapper
89
87
  &:after
90
- background-color: $textColor
88
+ background-color: $color
91
89
  .tooltip
92
- border-color: $textColor
93
- color: $textColor
90
+ border-color: $color
91
+ color: $color
94
92
  &:after
95
- background-color: $textColor
93
+ background-color: $color
96
94
 
97
95
  .compact
98
96
  & .segment
@@ -41,17 +41,9 @@ const TimePicker = ({
41
41
 
42
42
  const endOfTheDayTime = currentDay > 5 || currentDay < 1 ? '17:30:00' : '19:30:00';
43
43
  const startOfTheDayTime = currentDay > 5 || currentDay < 1 ? '09:00:00' : '08:30:00';
44
+ const setNewDay = new Date(`${date.toDateString()} ${endOfTheDayTime}`) > date ? 0 : 86400000;
44
45
  const interval = 30 * 60 * 1000;
45
46
  const roundedTime = new Date(Math.ceil(date / interval) * interval);
46
- // Today is open while a slot is left: the next half hour must not be past the last one (16:30 on
47
- // weekends, 19:30 on weekdays). Weekends 16:31–17:29 were still before closing but had no slot
48
- // left, which crashed the picker on an empty list. A closed today is left out of the dates, as
49
- // after hours. Today's own weekday decides, not the selected day's.
50
- const isTodayWeekend = date.getDay() > 5 || date.getDay() < 1;
51
- const todayEnd = new Date(`${date.toDateString()} ${isTodayWeekend ? '17:30:00' : '19:30:00'}`);
52
- const todayLastSlot = new Date(`${date.toDateString()} ${isTodayWeekend ? '16:30:00' : '19:30:00'}`);
53
- const isTodayOpen = todayEnd > date && roundedTime <= todayLastSlot;
54
- const setNewDay = isTodayOpen ? 0 : 86400000;
55
47
  const nextWeekDays = [...Array(7).keys()].map((days, index) => (
56
48
  {
57
49
  value: index,
@@ -95,9 +87,7 @@ const TimePicker = ({
95
87
  dayRanges.push({ time, value: dayRanges.length, label: `${time} - ${rangeTime}` });
96
88
  } // time ranges for full day
97
89
 
98
- // today's remaining slots only for today's date: the same weekday a week later gets the full day
99
- const isTodaySelected = new Date(nextWeekDaysFull[day]).toDateString() === new Date().toDateString();
100
- return isTodaySelected && isWorkingHours() ? currentDayRanges : dayRanges;
90
+ return currentDay === new Date().getDay() && isWorkingHours() ? currentDayRanges : dayRanges;
101
91
  };
102
92
 
103
93
  useEffect(
@@ -1,25 +1,12 @@
1
1
 
2
- // The old Preisbewertung popup (PriceRating, PriceRatingDetailed) in the price-rating colours every
3
- // other page uses (Figma 474sauvNgCYK2mEq5iks9e 142:3643; the lib's constants/autobahn.ts and md3.css
4
- // --rating-*). $priceReviewColors: the scale (TIER_COLORS, --rating-*-bar); noRating/darkBackground
5
- // stay the empty-segment grey.
6
2
  $priceReviewColors = {
7
3
  noRating: rgba(76, 78, 100, 0.22)
8
4
  darkBackground: rgba(76, 78, 100, 0.22)
9
- highPrice: #E60000
10
- increasedPrice: #F26B43
11
- fairPrice: #F7C544
12
- goodPrice: #66B84D
13
- topPrice: #168A45
14
- }
15
- // the rating labels' text (TIER_TEXT_COLORS / NO_RATING_COLOR, --rating-*-fg)
16
- $priceReviewTextColors = {
17
- noRating: #5B6B7F
18
- highPrice: #E60000
19
- increasedPrice: #F26B43
20
- fairPrice: #FFB800
21
- goodPrice: #66B84D
22
- topPrice: #168A45
5
+ highPrice: rgba(226, 108, 0, 1)
6
+ increasedPrice: rgba(237, 157, 55, 1)
7
+ fairPrice: rgba(173, 208, 66, 1)
8
+ goodPrice: rgba(102, 212, 102, 1)
9
+ topPrice: rgba(31, 193, 31, 1)
23
10
  }
24
11
 
25
12
 
package/constants/app.ts CHANGED
@@ -40,7 +40,17 @@ export const LOCAL_STORAGE_KEY = {
40
40
  i18n_KEY: 'i18nLanguage'
41
41
  };
42
42
 
43
- export const DEFAULT_LANG: string = typeof window !== 'undefined' ? localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : 'de';
43
+ // ADV-284: evaluated at import time — with site storage blocked, reading localStorage throws a
44
+ // SecurityError that took down the whole bundle. Blocked storage behaves like "nothing saved".
45
+ const readStoredLang = (): string | null => {
46
+ try {
47
+ return localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY);
48
+ } catch (e) {
49
+ return null;
50
+ }
51
+ };
52
+
53
+ export const DEFAULT_LANG: string = typeof window !== 'undefined' ? readStoredLang() : 'de';
44
54
 
45
55
  // Default support contact phone
46
56
  export const CONTACT_PHONE: string = '+498004030182';
@@ -22,49 +22,10 @@ export const TIER_LABELS = ['Top Preis', 'Guter Preis', 'Fairer Preis', 'Erhöht
22
22
  // i18n key suffixes parallel to TIER_LABELS — components render t('autobahn:tier.<key>') so the
23
23
  // Preisbewertung label localizes (TIER_LABELS stays the German source-of-truth used for tier→index logic).
24
24
  export const TIER_KEYS = ['top', 'good', 'fair', 'raised', 'high'] as const;
25
- /** the five segments (and the marker ring) of the price-rating bar */
26
25
  export const TIER_COLORS: readonly string[] = ['#168A45', '#66B84D', '#F7C544', '#F26B43', '#E60000'];
27
- /**
28
- * Price-rating badge colours, the same on every page (Figma 474sauvNgCYK2mEq5iks9e 142:3643
29
- * "Die auto.de Bewertungskategorien"): the label's text colour on its background, per tier.
30
- * md3.css repeats them as --rating-<key>-fg / --rating-<key>-bg for the CSS-only badges; fe-main's
31
- * ratingPalette test keeps the two in step.
32
- */
33
- export const TIER_TEXT_COLORS: readonly string[] = ['#168A45', '#66B84D', '#FFB800', '#F26B43', '#E60000'];
34
26
  export const TIER_BACKGROUNDS: readonly string[] = ['#DFF3E5', '#E4F3DF', '#FFF6DB', '#FFEFD5', '#FFD3D3'];
35
27
  export type RatingTier = 0 | 1 | 2 | 3 | 4;
36
28
 
37
- /**
38
- * "Keine Bewertung": getPriceRating returned 0 for a real price, because the price is outside the
39
- * rating bands (more than 25% above the market value). That is no tier, so it is never shown as
40
- * one. It is a grey "Keine Bewertung" pill; the bar keeps its usual colours but has no marker,
41
- * since the price has no place on the scale.
42
- * mapRating emits NO_RATING_KEY as `rating` and NO_RATING_LABEL as `ratingLabel`; the label key is
43
- * t('autobahn:tier.none').
44
- */
45
- export const NO_RATING_KEY = 'none';
46
- export const NO_RATING_LABEL = 'Keine Bewertung';
47
- /** "Keine Bewertung" badge text and background (Figma 142:3643, like TIER_TEXT_COLORS) */
48
- export const NO_RATING_COLOR = '#5B6B7F';
49
- export const NO_RATING_BACKGROUND = '#C8D1DE';
50
-
51
- /** Badge text colour and background of a mapRating() `rating` key ('top' … 'high', or
52
- * NO_RATING_KEY). An unknown key falls back to 'good', as evalTierOf does. */
53
- export function ratingColorsOf(rating?: string): { color: string; background: string } {
54
- if (rating === NO_RATING_KEY) return { color: NO_RATING_COLOR, background: NO_RATING_BACKGROUND };
55
- const index = TIER_KEYS.indexOf(rating as (typeof TIER_KEYS)[number]);
56
- const tier = index >= 0 ? index : 1;
57
- return { color: TIER_TEXT_COLORS[tier], background: TIER_BACKGROUNDS[tier] };
58
- }
59
-
60
- /** Tier index (0 Top … 4 Hoch) of a mapRating() `ratingLabel`, or null for "Keine Bewertung".
61
- * An unknown label falls back to 1, as the components always did. */
62
- export function evalTierOf(ratingLabel?: string): RatingTier | null {
63
- if (ratingLabel === NO_RATING_LABEL) return null;
64
- const index = TIER_LABELS.indexOf(ratingLabel as (typeof TIER_LABELS)[number]);
65
- return (index >= 0 ? index : 1) as RatingTier;
66
- }
67
-
68
29
  /** SRP sort options (labels match the design; mapped to real sort params by the SRP container). */
69
30
  export const SORTS = [
70
31
  'Relevanz',
package/constants/core.ts CHANGED
@@ -35,7 +35,18 @@ export const LOCAL_STORAGE_KEY = {
35
35
  i18n_KEY: 'i18nLanguage'
36
36
  };
37
37
 
38
- export const DEFAULT_LANG: string = (typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null) ?? 'de';
38
+ // ADV-284: evaluated at import time — with site storage blocked, merely reading
39
+ // window.localStorage throws a SecurityError, which took down the whole bundle (landing
40
+ // page never rendered). Treat blocked storage like "no language saved".
41
+ const readStoredLang = (): string | null => {
42
+ try {
43
+ return typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null;
44
+ } catch (e) {
45
+ return null;
46
+ }
47
+ };
48
+
49
+ export const DEFAULT_LANG: string = readStoredLang() ?? 'de';
39
50
 
40
51
  export const ROW_STYLES = {
41
52
  marginBottom: 10
@@ -226,18 +226,18 @@ export const FIELD_MAPPINGS: readonly FieldMapping[] = [
226
226
  status: 'wired',
227
227
  source: 'price.currentSalesPrice + price.mlCurrentSalesPricePredicted',
228
228
  transform:
229
- "getPriceRating(sale, predicted) [0..5] → autobahn tone: 5→'top' 4→'good' 3→'fair' 2→'raised' 1→'high'; 0(noRating, price more than 25% above the market value)→'none' (Keine Bewertung)",
229
+ "getPriceRating(sale, predicted) [0..5] → autobahn tone: 5→'top' 4→'good' 3→'fair' 2→'raised' 1→'high'; 0(noRating)→neutral 'fair'",
230
230
  confirmedAt:
231
231
  'VehicleInfo.tsx:160 (SRP card renders getPriceRating(currentSalesPrice, mlCurrentSalesPricePredicted)) · CommonUtils.ts:353-373 (getPriceRating) · price.ts:1 (priceRatings order) · DataTransformers.ts:354 (mlCurrentSalesPricePredicted)',
232
232
  notes:
233
- "REAL Preisbewertung. Card only special-cases tone==='fair' → warn pill; every other tone → good/green pill (CarCard.tsx:96-97). noRating is no tier: 'none', a grey Keine Bewertung pill without a marker (it used to be folded into 'fair'). predicted falls back to sale*1.07814 (PREDICTABLE_PRICE_INDEX) inside getPriceRating, exactly like the live card.",
233
+ "REAL Preisbewertung. Card only special-cases tone==='fair' → warn pill; every other tone → good/green pill (CarCard.tsx:96-97). For noRating we pick the NEUTRAL middle tier, never a flattering one. predicted falls back to sale*1.07814 (PREDICTABLE_PRICE_INDEX) inside getPriceRating, exactly like the live card.",
234
234
  },
235
235
  {
236
236
  field: 'ratingLabel',
237
237
  required: true,
238
238
  status: 'wired',
239
239
  source: 'derived from the rating tier',
240
- transform: "TIER_LABELS[tier] → 'Top Preis'|'Guter Preis'|'Fairer Preis'|'Erhöht'|'Hoher Preis', or NO_RATING_LABEL 'Keine Bewertung'",
240
+ transform: "TIER_LABELS[tier] → 'Top Preis'|'Guter Preis'|'Fairer Preis'|'Erhöht'|'Hoher Preis'",
241
241
  confirmedAt:
242
242
  'autobahn/constants.ts:17 (TIER_LABELS) · fe-ui-core locales/priceRating.ts:2-9 (legacy German labels: TOP/GUTER/FAIRER/ERHÖHTER/HOHER PREIS)',
243
243
  notes:
@@ -29,7 +29,7 @@ import { getPowerLabel } from '../utils/power';
29
29
 
30
30
  import { AutobahnCar, AutobahnPhev } from '../cards/types';
31
31
  import { leasingKeyFigures } from '../ui/CreditKeyFigures';
32
- import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class, NO_RATING_KEY, NO_RATING_LABEL } from '../constants/autobahn';
32
+ import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class } from '../constants/autobahn';
33
33
 
34
34
  /**
35
35
  * Last-resort placeholder shown in the carousel until the real images for a car
@@ -43,20 +43,6 @@ import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class, NO_RATING_KEY, NO_RATIN
43
43
  export const PLACEHOLDER_IMAGE =
44
44
  'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
45
45
 
46
- /**
47
- * The app-wide no-image asset, set ONCE at app start (fe-main's index.tsx passes its
48
- * PLACEHOLDER_IMAGE_LARGE_URL, built from config.imagesAPI.imgUrlBase) — so every card that
49
- * maps a car without a photo shows the "noimage" picture, not the transparent data URI above,
50
- * without each page having to remember `deps.placeholder` (most didn't: the home page, /search,
51
- * favourites and the dashboard all rendered an empty white photo). `deps.placeholder` still
52
- * wins per call; the data URI stays the last resort (tests, an app that never sets this).
53
- */
54
- let defaultPlaceholder: string = PLACEHOLDER_IMAGE;
55
-
56
- export function setPlaceholderImage(url: string): void {
57
- defaultPlaceholder = url || PLACEHOLDER_IMAGE;
58
- }
59
-
60
46
  /**
61
47
  * Dependencies the SRP container injects. Everything here is what the mapper
62
48
  * needs from the outside world — keeping the function itself pure.
@@ -82,7 +68,7 @@ export interface ToAutobahnCarDeps {
82
68
  t?: (key: string, options?: object) => string;
83
69
  /** active UI language ('de' | 'en' …). Drives de-DE vs en-IN number grouping for the EnVKV line. */
84
70
  language?: string;
85
- /** placeholder image URL override (defaults to the one set with setPlaceholderImage). */
71
+ /** placeholder image URL override (defaults to PLACEHOLDER_IMAGE). */
86
72
  placeholder?: string;
87
73
  /**
88
74
  * Buyer-activity stats for this car — UserActionsAPI 'stats/viewers' response, loaded async and
@@ -238,13 +224,13 @@ export function co2ClassLetter(code: any): Co2Class | '' {
238
224
  * topPrice(5)→0 'Top Preis' · goodPrice(4)→1 'Guter Preis' ·
239
225
  * fairPrice(3)→2 'Fairer Preis' · increasedPrice(2)→3 'Erhöht' ·
240
226
  * highPrice(1)→4 'Hoher Preis'.
241
- * noRating(0) means the price is outside the bands (more than 25% above the market value). It is
242
- * no tier: it maps to NO_RATING_KEY 'none' / NO_RATING_LABEL 'Keine Bewertung', a grey pill and
243
- * the usual bar without a marker. It used to be folded into 'Fairer Preis', so a car priced 57%
244
- * above the market showed "Fairer Preis".
227
+ * noRating(0) has no real comparison → neutral 'Fairer Preis' (tier 2) WITHOUT a
228
+ * flattering label (documented in fieldMapping.ts). The card only special-cases
229
+ * the 'fair' tone (warn pill); every other tone is the good/green pill.
245
230
  *
246
- * AutobahnCar.rating is a free string: the autobahn tier key ('top'|'good'|'fair'|'raised'|'high')
247
- * or 'none'. Callers only compute it for a real, positive price; without one it stays ''.
231
+ * AutobahnCar.rating is a free string; CarCard does `rating === 'fair' ? warn : good`.
232
+ * We emit the autobahn tier key ('top'|'good'|'fair'|'raised'|'high') so the
233
+ * neutral 'fair' maps to the warn pill exactly like the design intends.
248
234
  */
249
235
  const LEGACY_TO_TIER: Record<number, RatingTier> = {
250
236
  5: 0, // topPrice → Top Preis
@@ -263,20 +249,18 @@ const TIER_TONE: Record<RatingTier, string> = {
263
249
 
264
250
  export function mapRating(currentSalesPrice?: number, predicted?: number): { rating: string; ratingLabel: string } {
265
251
  const legacy = getPriceRating(currentSalesPrice as number, predicted as number); // 0..5
266
- const tier: RatingTier | undefined = LEGACY_TO_TIER[legacy];
267
- if (tier == null) return { rating: NO_RATING_KEY, ratingLabel: NO_RATING_LABEL };
252
+ // 0 = noRating: keep neutral (tier 2) — never invent a flattering rating.
253
+ const tier: RatingTier = legacy === 0 ? 2 : LEGACY_TO_TIER[legacy] ?? 2;
268
254
  return { rating: TIER_TONE[tier], ratingLabel: TIER_LABELS[tier] };
269
255
  }
270
256
 
271
257
  /**
272
258
  * Map the 5-tier rating to a 2-tone signal — only 'top'/'good' read as a genuinely good deal
273
259
  * (green); 'fair'/'raised'/'high' all get the warn/peach tone (Figma: "Erhöhter-Preis" is
274
- * peach, not green). "Keine Bewertung" is neither: 'neutral' (grey). Pure/non-React on purpose.
275
- * The rating chips take their colours per tier now (StatChip's `rating`, the --rating-* palette); this
276
- * only picks their icon (check for a good deal, minus otherwise).
260
+ * peach, not green). Pure/non-React on purpose: shared by the web card's StatChip via
261
+ * cards/cardParts.tsx's re-export.
277
262
  */
278
- export function ratingTone(rating: string): 'good' | 'warn' | 'neutral' {
279
- if (rating === NO_RATING_KEY) return 'neutral';
263
+ export function ratingTone(rating: string): 'good' | 'warn' {
280
264
  return rating === 'top' || rating === 'good' ? 'good' : 'warn';
281
265
  }
282
266
 
@@ -289,7 +273,7 @@ function isPluginHybrid(fuel: any): boolean {
289
273
  * `sizeOverride` lets a caller ask for a different size than `deps.imageSize` (e.g. a full-res
290
274
  * set for a lightbox, while the card thumbnail itself stays on the smaller default). */
291
275
  function buildGallery(storeCar: any, deps: ToAutobahnCarDeps, sizeOverride?: 'small' | 'medium' | 'large'): string[] {
292
- const placeholder = deps.placeholder || defaultPlaceholder;
276
+ const placeholder = deps.placeholder || PLACEHOLDER_IMAGE;
293
277
  // Only 'small' and 'large' variants are pre-generated by image-generator; 'medium' has no cached file.
294
278
  const size = sizeOverride || deps.imageSize || 'small';
295
279