@bytebrand/fe-ui-core-autobahn 1.0.228 → 1.0.231
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/campaign/CampaignBand.tsx +26 -26
- package/campaign/CampaignBanner.tsx +86 -0
- package/campaign/CampaignBar.tsx +37 -0
- package/campaign/CampaignHero.tsx +56 -0
- package/campaign/CampaignSwitch.tsx +43 -0
- package/campaign/campaignVars.ts +12 -12
- package/campaign/campaigns.ts +77 -74
- package/campaign/index.ts +18 -6
- package/campaign/openInApp.ts +8 -0
- package/campaign/useCountdown.ts +28 -0
- package/cards/CarCard.tsx +407 -393
- package/cards/CarCardSkeleton.tsx +103 -0
- package/cards/CarRow.tsx +46 -22
- package/cards/CarRowSkeleton.tsx +152 -0
- package/cards/cardParts.tsx +53 -18
- package/cards/dealSignals.ts +36 -36
- package/cards/index.ts +6 -0
- package/chrome/AccountMenuIcon.tsx +109 -0
- package/chrome/Footer.tsx +16 -3
- package/chrome/TopBar.tsx +139 -266
- package/compat/CookieModal/CookieModal.tsx +20 -6
- package/compat/CookieModal/Modal.tsx +6 -3
- package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
- package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
- package/compat/CookieModal/useModal.ts +5 -1
- package/compat/Loader/Loader.tsx +1 -7
- package/compat/MdField/MdField.tsx +28 -4
- package/compat/PriceRating/PriceRating.styl +5 -7
- package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +8 -6
- package/compat/TimePicker/TimePicker.tsx +12 -2
- package/compat/legacy-theme/priceReviewColors.styl +18 -5
- package/constants/autobahn.ts +39 -0
- package/data/fieldMapping.ts +3 -3
- package/data/toAutobahnCar.ts +30 -14
- package/iconsvg/IconSVG.tsx +1 -5
- package/index.ts +19 -19
- package/locales/de/autobahn.json +925 -862
- package/locales/en/autobahn.json +925 -862
- package/package.json +2 -2
- package/theme/md3.css +16518 -11808
- package/ui/Dropdown.tsx +29 -10
- package/ui/FormCheckbox.tsx +22 -2
- package/ui/FormField.tsx +2 -1
- package/ui/Icon.tsx +6 -0
- package/ui/MfieldCheckIcon.tsx +13 -0
- package/ui/Modal.tsx +84 -6
- package/ui/Skeleton.tsx +79 -20
- package/ui/Stars.tsx +36 -18
- package/ui/StatChip.tsx +8 -3
- package/ui/index.ts +3 -0
- package/ui/ratingLink.ts +36 -0
- package/ui/scrollFieldIntoView.ts +41 -0
- package/ui/usePortalMenuPosition.ts +27 -15
- package/utils/cookieConsent.ts +84 -0
- package/utils/index.ts +10 -0
- package/vdp/FinanceCalculator.tsx +162 -34
- package/vdp/VdpModules.tsx +348 -976
- package/vdp/index.ts +6 -3
- package/vdp/types.ts +25 -15
- package/vehiclesProps/accidentDisclosure.ts +25 -0
- package/vehiclesProps/decoratedLightProps.tsx +4 -0
- package/vehiclesProps/decoratedProps.tsx +4 -0
|
@@ -8,19 +8,43 @@ 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';
|
|
11
13
|
|
|
12
14
|
import styles from './ManageCookieModal.styl';
|
|
13
15
|
|
|
14
16
|
interface IManageCookieModal {
|
|
15
17
|
toggleModal: () => void;
|
|
16
18
|
handleSentryInit?: () => void;
|
|
19
|
+
/** the host's `t` with the `autobahn` namespace loaded; without it the dialog stays German (fe-landing) */
|
|
20
|
+
t?: TranslationFunction;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
interface IMarketingSwitches {
|
|
20
24
|
[key: string]: any;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
|
|
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
|
+
};
|
|
24
48
|
const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(false);
|
|
25
49
|
const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(false);
|
|
26
50
|
const [analyticsSwitches, setAnalyticsSwitches] = useState<IMarketingSwitches>({});
|
|
@@ -44,6 +68,10 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
44
68
|
.reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledMarketing.includes(item) }), {});
|
|
45
69
|
setAnalyticsSwitches(newAnalyticsSwitches);
|
|
46
70
|
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));
|
|
47
75
|
},
|
|
48
76
|
[]
|
|
49
77
|
);
|
|
@@ -86,7 +114,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
86
114
|
marketing: Object.keys(marketingSwitches).filter(i => !marketingSwitches[i]) || [],
|
|
87
115
|
analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
|
|
88
116
|
};
|
|
89
|
-
|
|
117
|
+
saveCookieConfig(cookieConfig);
|
|
90
118
|
updateCookieList(handleSentryInit);
|
|
91
119
|
toggleModal();
|
|
92
120
|
};
|
|
@@ -110,34 +138,34 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
110
138
|
return (
|
|
111
139
|
<div className={styles.modalWrapper}>
|
|
112
140
|
<IconSVG name='autodeLogo' customDimensions />
|
|
113
|
-
<div className={styles.modalTitle}>
|
|
114
|
-
<div className={styles.modalContent}>
|
|
141
|
+
<div className={styles.modalTitle}>{tr('title')}</div>
|
|
142
|
+
<div className={styles.modalContent}>{tr('manageText')}</div>
|
|
115
143
|
<div className={styles.accordions}>
|
|
116
144
|
<MaterialAccordionGroup
|
|
117
|
-
title='
|
|
145
|
+
title={tr('necessary.title')}
|
|
118
146
|
// tooltipText='Notwendig'
|
|
119
147
|
withSwitch
|
|
120
148
|
switchProps={necessarySwitchProps}
|
|
121
149
|
>
|
|
122
|
-
<span className={styles.accordionDescription}>
|
|
150
|
+
<span className={styles.accordionDescription}>{tr('necessary.text')}</span>
|
|
123
151
|
{Object.keys(COOKIE_SCHEMA.necessary).map(cookie => {
|
|
124
152
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
125
153
|
return (
|
|
126
154
|
<div className={styles.switchBlock} key={cookie} >
|
|
127
155
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
128
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
156
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
|
|
129
157
|
<MaterialSwitch sx={{ marginLeft: 'auto' }} disabled={true} value={true} onChange={() => {}} />
|
|
130
158
|
</div>
|
|
131
159
|
);
|
|
132
160
|
})}
|
|
133
161
|
</MaterialAccordionGroup>
|
|
134
162
|
<MaterialAccordionGroup
|
|
135
|
-
title='
|
|
163
|
+
title={tr('analytics.title')}
|
|
136
164
|
withSwitch
|
|
137
165
|
// tooltipText='Analytisch'
|
|
138
166
|
switchProps={analyticsSwitchProps}
|
|
139
167
|
>
|
|
140
|
-
<span className={styles.accordionDescription}>
|
|
168
|
+
<span className={styles.accordionDescription}>{tr('analytics.text')}</span>
|
|
141
169
|
{Object.keys(COOKIE_SCHEMA.analytics).map(cookie => {
|
|
142
170
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `analytics['${cookie}']`, null);
|
|
143
171
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -145,7 +173,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
145
173
|
return (
|
|
146
174
|
<div className={styles.switchBlock} key={cookie} >
|
|
147
175
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
148
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
176
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
|
|
149
177
|
<MaterialSwitch
|
|
150
178
|
sx={{ marginLeft: 'auto' }}
|
|
151
179
|
value={isChecked}
|
|
@@ -156,12 +184,12 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
156
184
|
})}
|
|
157
185
|
</MaterialAccordionGroup>
|
|
158
186
|
<MaterialAccordionGroup
|
|
159
|
-
title='
|
|
187
|
+
title={tr('marketing.title')}
|
|
160
188
|
withSwitch
|
|
161
189
|
// tooltipText='Marketing'
|
|
162
190
|
switchProps={marketingSwitchProps}
|
|
163
191
|
>
|
|
164
|
-
<span className={styles.accordionDescription}>
|
|
192
|
+
<span className={styles.accordionDescription}>{tr('marketing.text')}</span>
|
|
165
193
|
{Object.keys(COOKIE_SCHEMA.marketing).map(cookie => {
|
|
166
194
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `marketing['${cookie}']`, null);
|
|
167
195
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -169,7 +197,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
169
197
|
return (
|
|
170
198
|
<div className={styles.switchBlock} key={cookie} >
|
|
171
199
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
172
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
200
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>{tr('privacyPolicy')}</a>
|
|
173
201
|
<MaterialSwitch
|
|
174
202
|
sx={{ marginLeft: 'auto' }}
|
|
175
203
|
value={isChecked}
|
|
@@ -181,8 +209,8 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModa
|
|
|
181
209
|
</MaterialAccordionGroup>
|
|
182
210
|
</div>
|
|
183
211
|
<div className={styles.buttonsContainer}>
|
|
184
|
-
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >
|
|
185
|
-
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>
|
|
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>
|
|
186
214
|
</div>
|
|
187
215
|
</div>
|
|
188
216
|
);
|
|
@@ -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 { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
6
7
|
import { COOKIE_SCHEMA } from '../../../../constants/common';
|
|
7
8
|
|
|
8
9
|
interface IPreviewCookieModal {
|
|
@@ -14,16 +15,16 @@ interface IPreviewCookieModal {
|
|
|
14
15
|
const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
|
|
15
16
|
const environment = window.location.origin;
|
|
16
17
|
const onAcceptAll = () => {
|
|
17
|
-
|
|
18
|
+
saveCookieConfig({ marketing: [], analytics: [] });
|
|
18
19
|
updateCookieList(handleSentryInit);
|
|
19
20
|
toggleModal();
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
const onDisableAll = () => {
|
|
23
|
-
|
|
24
|
+
saveCookieConfig({
|
|
24
25
|
marketing: Object.values(COOKIE_SCHEMA.marketing).reduce((acc: string[], val: string[]) => acc.concat(val), []),
|
|
25
26
|
analytics: Object.values(COOKIE_SCHEMA.analytics).reduce((acc: string[], val: string[]) => acc.concat(val), [])
|
|
26
|
-
})
|
|
27
|
+
});
|
|
27
28
|
updateCookieList(handleSentryInit);
|
|
28
29
|
toggleModal();
|
|
29
30
|
};
|
package/compat/Loader/Loader.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export interface ILoaderProps {
|
|
|
10
10
|
fluid?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const Loader: React.FC<ILoaderProps> = ({ className, size, fluid }) => {
|
|
13
|
+
const Loader: React.FC<ILoaderProps> = ({ className = '', size = 'medium', fluid = false }) => {
|
|
14
14
|
const classNames = classnames(
|
|
15
15
|
styles.loader,
|
|
16
16
|
{ [styles[size]]: !fluid },
|
|
@@ -23,10 +23,4 @@ const Loader: React.FC<ILoaderProps> = ({ className, size, fluid }) => {
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
Loader.defaultProps = {
|
|
27
|
-
className: '',
|
|
28
|
-
size: 'medium',
|
|
29
|
-
fluid: false
|
|
30
|
-
};
|
|
31
|
-
|
|
32
26
|
export default Loader;
|
|
@@ -8,6 +8,7 @@ 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';
|
|
11
12
|
|
|
12
13
|
export interface MdFieldProps {
|
|
13
14
|
className?: string;
|
|
@@ -32,12 +33,21 @@ export interface MdFieldProps {
|
|
|
32
33
|
* when empty and unfocused, then floats up to the normal small-label spot on focus
|
|
33
34
|
* or once a value is typed. Defaults to false — the static above-field label. */
|
|
34
35
|
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;
|
|
35
39
|
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;
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
39
49
|
className, error, sx, required, disabled, multiline, autoComplete,
|
|
40
|
-
value, type, name, rows, label, placeholder, floatingLabel, maxLength, onChange
|
|
50
|
+
value, type, name, rows, label, placeholder, floatingLabel, maxLength, showValid, onChange, onBlur
|
|
41
51
|
}) => {
|
|
42
52
|
const [reveal, setReveal] = React.useState(false);
|
|
43
53
|
const [focused, setFocused] = React.useState(false);
|
|
@@ -54,6 +64,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
54
64
|
// a value is typed, the real <label> appears in its normal static spot above the
|
|
55
65
|
// field and the native placeholder goes quiet — the two never show at the same time.
|
|
56
66
|
const hasValue = value != null && value !== '';
|
|
67
|
+
const isValid = !!showValid && !disabled && !isPassword && !hasError && hasValue;
|
|
57
68
|
const resting = !!floatingLabel && !focused && !hasValue;
|
|
58
69
|
const effectivePlaceholder = floatingLabel ? (resting ? (label || placeholder || '') : '') : (placeholder || '');
|
|
59
70
|
// The real <label> is skipped entirely while resting (see above), leaving the input with
|
|
@@ -71,7 +82,9 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
71
82
|
|
|
72
83
|
return (
|
|
73
84
|
<div className={classnames('mfield-group', className)} style={sx as React.CSSProperties}>
|
|
74
|
-
{
|
|
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 ? (
|
|
75
88
|
<label className='md-label-sm mfield-label' htmlFor={generatedId}>
|
|
76
89
|
{label}{required ? ' *' : ''}
|
|
77
90
|
</label>
|
|
@@ -87,8 +100,18 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
87
100
|
+ (hasError ? ' mfield--error' : '')
|
|
88
101
|
+ (disabled ? ' mfield--disabled' : '')
|
|
89
102
|
+ (floatingLabel ? ' mfield--floating' : '')
|
|
103
|
+
+ (isValid ? ' mfield--valid' : '')
|
|
90
104
|
}
|
|
91
105
|
>
|
|
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}
|
|
92
115
|
{multiline ? (
|
|
93
116
|
<textarea
|
|
94
117
|
id={generatedId}
|
|
@@ -96,7 +119,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
96
119
|
value={value == null ? '' : value}
|
|
97
120
|
onChange={handleChange}
|
|
98
121
|
onFocus={() => setFocused(true)}
|
|
99
|
-
onBlur={() => setFocused(false)}
|
|
122
|
+
onBlur={() => { setFocused(false); onBlur?.(); }}
|
|
100
123
|
disabled={disabled}
|
|
101
124
|
rows={rows || 3}
|
|
102
125
|
maxLength={maxLength}
|
|
@@ -115,7 +138,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
115
138
|
value={value == null ? '' : value}
|
|
116
139
|
onChange={handleChange}
|
|
117
140
|
onFocus={() => setFocused(true)}
|
|
118
|
-
onBlur={() => setFocused(false)}
|
|
141
|
+
onBlur={() => { setFocused(false); onBlur?.(); }}
|
|
119
142
|
disabled={disabled}
|
|
120
143
|
maxLength={maxLength}
|
|
121
144
|
placeholder={effectivePlaceholder}
|
|
@@ -137,6 +160,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
137
160
|
<Icon name={reveal ? 'eye-off' : 'eye'} size={18} />
|
|
138
161
|
</button>
|
|
139
162
|
) : null}
|
|
163
|
+
{isValid ? <span className="mfield-ok"><MfieldCheckIcon /></span> : null}
|
|
140
164
|
</div>
|
|
141
165
|
{hasError ? (
|
|
142
166
|
// role="alert" announces this to screen readers the moment it enters the DOM (e.g.
|
|
@@ -36,12 +36,10 @@
|
|
|
36
36
|
color: $priceReviewColors[darkBackground]
|
|
37
37
|
border: 2px solid $priceReviewColors[darkBackground]
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if $color == $priceReviewColors.noRating
|
|
42
|
-
$color = $priceReviewColors[darkBackground]
|
|
43
|
-
$backgroundColor = $priceReviewColors[colorName]
|
|
39
|
+
// label: the rating's text colour; segment: its scale colour
|
|
40
|
+
for colorName in $priceReviewTextColors
|
|
44
41
|
.{colorName}
|
|
45
|
-
color: $
|
|
42
|
+
color: $priceReviewTextColors[colorName]
|
|
43
|
+
for colorName in $priceReviewColors
|
|
46
44
|
.{colorName}Background
|
|
47
|
-
border: 2px solid $
|
|
45
|
+
border: 2px solid $priceReviewColors[colorName]
|
|
@@ -71,26 +71,28 @@
|
|
|
71
71
|
|
|
72
72
|
.noRatingTooltip
|
|
73
73
|
@extends .baseTooltip
|
|
74
|
-
color:
|
|
75
|
-
border-color:
|
|
74
|
+
color: $priceReviewTextColors[noRating]
|
|
75
|
+
border-color: #C8D1DE
|
|
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
|
|
81
82
|
for colorName in $priceReviewColors
|
|
82
83
|
$color = $priceReviewColors[colorName]
|
|
84
|
+
$textColor = $priceReviewTextColors[colorName] || $color
|
|
83
85
|
.{colorName}
|
|
84
86
|
&.segment
|
|
85
87
|
background-color $color
|
|
86
88
|
.tooltipWrapper
|
|
87
89
|
&:after
|
|
88
|
-
background-color: $
|
|
90
|
+
background-color: $textColor
|
|
89
91
|
.tooltip
|
|
90
|
-
border-color: $
|
|
91
|
-
color: $
|
|
92
|
+
border-color: $textColor
|
|
93
|
+
color: $textColor
|
|
92
94
|
&:after
|
|
93
|
-
background-color: $
|
|
95
|
+
background-color: $textColor
|
|
94
96
|
|
|
95
97
|
.compact
|
|
96
98
|
& .segment
|
|
@@ -41,9 +41,17 @@ 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;
|
|
45
44
|
const interval = 30 * 60 * 1000;
|
|
46
45
|
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;
|
|
47
55
|
const nextWeekDays = [...Array(7).keys()].map((days, index) => (
|
|
48
56
|
{
|
|
49
57
|
value: index,
|
|
@@ -87,7 +95,9 @@ const TimePicker = ({
|
|
|
87
95
|
dayRanges.push({ time, value: dayRanges.length, label: `${time} - ${rangeTime}` });
|
|
88
96
|
} // time ranges for full day
|
|
89
97
|
|
|
90
|
-
|
|
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;
|
|
91
101
|
};
|
|
92
102
|
|
|
93
103
|
useEffect(
|
|
@@ -1,12 +1,25 @@
|
|
|
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.
|
|
2
6
|
$priceReviewColors = {
|
|
3
7
|
noRating: rgba(76, 78, 100, 0.22)
|
|
4
8
|
darkBackground: rgba(76, 78, 100, 0.22)
|
|
5
|
-
highPrice:
|
|
6
|
-
increasedPrice:
|
|
7
|
-
fairPrice:
|
|
8
|
-
goodPrice:
|
|
9
|
-
topPrice:
|
|
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
|
|
10
23
|
}
|
|
11
24
|
|
|
12
25
|
|
package/constants/autobahn.ts
CHANGED
|
@@ -22,10 +22,49 @@ 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 */
|
|
25
26
|
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'];
|
|
26
34
|
export const TIER_BACKGROUNDS: readonly string[] = ['#DFF3E5', '#E4F3DF', '#FFF6DB', '#FFEFD5', '#FFD3D3'];
|
|
27
35
|
export type RatingTier = 0 | 1 | 2 | 3 | 4;
|
|
28
36
|
|
|
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
|
+
|
|
29
68
|
/** SRP sort options (labels match the design; mapped to real sort params by the SRP container). */
|
|
30
69
|
export const SORTS = [
|
|
31
70
|
'Relevanz',
|
package/data/fieldMapping.ts
CHANGED
|
@@ -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)→
|
|
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)",
|
|
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).
|
|
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.",
|
|
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'",
|
|
240
|
+
transform: "TIER_LABELS[tier] → 'Top Preis'|'Guter Preis'|'Fairer Preis'|'Erhöht'|'Hoher Preis', or NO_RATING_LABEL 'Keine Bewertung'",
|
|
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:
|
package/data/toAutobahnCar.ts
CHANGED
|
@@ -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 } from '../constants/autobahn';
|
|
32
|
+
import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class, NO_RATING_KEY, NO_RATING_LABEL } from '../constants/autobahn';
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Last-resort placeholder shown in the carousel until the real images for a car
|
|
@@ -43,6 +43,20 @@ import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class } from '../constants/aut
|
|
|
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
|
+
|
|
46
60
|
/**
|
|
47
61
|
* Dependencies the SRP container injects. Everything here is what the mapper
|
|
48
62
|
* needs from the outside world — keeping the function itself pure.
|
|
@@ -68,7 +82,7 @@ export interface ToAutobahnCarDeps {
|
|
|
68
82
|
t?: (key: string, options?: object) => string;
|
|
69
83
|
/** active UI language ('de' | 'en' …). Drives de-DE vs en-IN number grouping for the EnVKV line. */
|
|
70
84
|
language?: string;
|
|
71
|
-
/** placeholder image URL override (defaults to
|
|
85
|
+
/** placeholder image URL override (defaults to the one set with setPlaceholderImage). */
|
|
72
86
|
placeholder?: string;
|
|
73
87
|
/**
|
|
74
88
|
* Buyer-activity stats for this car — UserActionsAPI 'stats/viewers' response, loaded async and
|
|
@@ -224,13 +238,13 @@ export function co2ClassLetter(code: any): Co2Class | '' {
|
|
|
224
238
|
* topPrice(5)→0 'Top Preis' · goodPrice(4)→1 'Guter Preis' ·
|
|
225
239
|
* fairPrice(3)→2 'Fairer Preis' · increasedPrice(2)→3 'Erhöht' ·
|
|
226
240
|
* highPrice(1)→4 'Hoher Preis'.
|
|
227
|
-
* noRating(0)
|
|
228
|
-
*
|
|
229
|
-
* the
|
|
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".
|
|
230
245
|
*
|
|
231
|
-
* AutobahnCar.rating is a free string
|
|
232
|
-
*
|
|
233
|
-
* neutral 'fair' maps to the warn pill exactly like the design intends.
|
|
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 ''.
|
|
234
248
|
*/
|
|
235
249
|
const LEGACY_TO_TIER: Record<number, RatingTier> = {
|
|
236
250
|
5: 0, // topPrice → Top Preis
|
|
@@ -249,18 +263,20 @@ const TIER_TONE: Record<RatingTier, string> = {
|
|
|
249
263
|
|
|
250
264
|
export function mapRating(currentSalesPrice?: number, predicted?: number): { rating: string; ratingLabel: string } {
|
|
251
265
|
const legacy = getPriceRating(currentSalesPrice as number, predicted as number); // 0..5
|
|
252
|
-
|
|
253
|
-
|
|
266
|
+
const tier: RatingTier | undefined = LEGACY_TO_TIER[legacy];
|
|
267
|
+
if (tier == null) return { rating: NO_RATING_KEY, ratingLabel: NO_RATING_LABEL };
|
|
254
268
|
return { rating: TIER_TONE[tier], ratingLabel: TIER_LABELS[tier] };
|
|
255
269
|
}
|
|
256
270
|
|
|
257
271
|
/**
|
|
258
272
|
* Map the 5-tier rating to a 2-tone signal — only 'top'/'good' read as a genuinely good deal
|
|
259
273
|
* (green); 'fair'/'raised'/'high' all get the warn/peach tone (Figma: "Erhöhter-Preis" is
|
|
260
|
-
* peach, not green). Pure/non-React on purpose
|
|
261
|
-
*
|
|
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).
|
|
262
277
|
*/
|
|
263
|
-
export function ratingTone(rating: string): 'good' | 'warn' {
|
|
278
|
+
export function ratingTone(rating: string): 'good' | 'warn' | 'neutral' {
|
|
279
|
+
if (rating === NO_RATING_KEY) return 'neutral';
|
|
264
280
|
return rating === 'top' || rating === 'good' ? 'good' : 'warn';
|
|
265
281
|
}
|
|
266
282
|
|
|
@@ -273,7 +289,7 @@ function isPluginHybrid(fuel: any): boolean {
|
|
|
273
289
|
* `sizeOverride` lets a caller ask for a different size than `deps.imageSize` (e.g. a full-res
|
|
274
290
|
* set for a lightbox, while the card thumbnail itself stays on the smaller default). */
|
|
275
291
|
function buildGallery(storeCar: any, deps: ToAutobahnCarDeps, sizeOverride?: 'small' | 'medium' | 'large'): string[] {
|
|
276
|
-
const placeholder = deps.placeholder ||
|
|
292
|
+
const placeholder = deps.placeholder || defaultPlaceholder;
|
|
277
293
|
// Only 'small' and 'large' variants are pre-generated by image-generator; 'medium' has no cached file.
|
|
278
294
|
const size = sizeOverride || deps.imageSize || 'small';
|
|
279
295
|
|
package/iconsvg/IconSVG.tsx
CHANGED
|
@@ -7,7 +7,7 @@ type TIconSVG = {
|
|
|
7
7
|
customDimensions?: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions, ...props }: TIconSVG) => {
|
|
10
|
+
const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions = false, ...props }: TIconSVG) => {
|
|
11
11
|
if (!name) return null;
|
|
12
12
|
|
|
13
13
|
const Component: any = components[name.toString()];
|
|
@@ -23,8 +23,4 @@ const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions,
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
IconSVG.defaultProps = {
|
|
27
|
-
customDimensions: false
|
|
28
|
-
};
|
|
29
|
-
|
|
30
26
|
export default IconSVG;
|