@bytebrand/fe-ui-core-autobahn 1.0.168 → 1.0.169

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/cards/CarCard.tsx CHANGED
@@ -38,7 +38,6 @@ import {
38
38
  GalleryActivityPill,
39
39
  cardSpec,
40
40
  PaymentMode,
41
- startPaymentMode,
42
41
  callDealerSalesPhone,
43
42
  DEALER_SALES_PHONE,
44
43
  } from './cardParts';
@@ -99,11 +98,6 @@ export interface CarCardProps {
99
98
  * (still onOpenRateAdjust).
100
99
  */
101
100
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
102
- /**
103
- * Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
104
- * open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
105
- */
106
- initialMode?: PaymentMode;
107
101
  }
108
102
 
109
103
  const CarCard: React.FunctionComponent<CarCardProps> = ({
@@ -119,9 +113,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
119
113
  onCall,
120
114
  onOpenRateAdjust,
121
115
  onShowFinancingDetails,
122
- initialMode,
123
116
  }) => {
124
- const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
117
+ const [mode, setMode] = useState<PaymentMode>('financing');
125
118
  const [photoIndex, setPhotoIndex] = useState(0);
126
119
  const [viewerOpen, setViewerOpen] = useState(false);
127
120
  const mediaRef = useRef<HTMLDivElement | null>(null);
@@ -164,8 +157,6 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
164
157
  // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
165
158
  const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
166
159
  const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
167
- // tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
168
- const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
169
160
  return (
170
161
  <article
171
162
  className="mcard mcard--interactive cc-card"
@@ -286,46 +277,18 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
286
277
  <div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
287
278
  <PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
288
279
  <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
289
- {/* every tab's hero stacked in one grid cell (.cc-hero-stack), only the active one
290
- visible, bottom-aligned — Kaufen's struck list price sits on its own line above
291
- the price, so without this the row (and the card) grew/shrank by that line on
292
- every tab switch. Same trick as .cc-terms-stack below. */}
293
- <div className="cc-hero-stack">
294
- {paymentModes.map((m) => (
295
- <div
296
- key={m}
297
- className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
298
- aria-hidden={m === mode ? undefined : true}
299
- >
300
- <PriceHero car={car} mode={m} t={t} alwaysShowUnit />
301
- </div>
302
- ))}
303
- </div>
280
+ <PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
304
281
  <PriceEvalCol car={car} t={t} />
305
282
  </div>
306
283
  {/* same fallback CardCtaRow already uses below: pages that haven't wired a real
307
- "Rate anpassen" sheet yet still get a working "Details" link (opens the car).
308
- Every tab's terms line is rendered into the same grid cell (.cc-terms-stack) and
309
- only the active one is visible — the cell is as tall as the tallest line, so the
310
- card keeps one height across Finanzierung/Leasing/Kaufen (Leasing's longer line
311
- wraps to 2 lines on narrow phones). No change to the visible line itself. */}
312
- <div className="cc-terms-stack">
313
- {paymentModes.map((m) => (
314
- <div
315
- key={m}
316
- className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
317
- aria-hidden={m === mode ? undefined : true}
318
- >
319
- <PriceTerms
320
- car={car}
321
- mode={m}
322
- onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
323
- onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
324
- t={t}
325
- />
326
- </div>
327
- ))}
328
- </div>
284
+ "Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
285
+ <PriceTerms
286
+ car={car}
287
+ mode={mode}
288
+ onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
289
+ onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
290
+ t={t}
291
+ />
329
292
  </div>
330
293
  {/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
331
294
  rendered, with real fallbacks the page can override once it wires its own
package/cards/CarRow.tsx CHANGED
@@ -41,7 +41,6 @@ import {
41
41
  ZeroDownChip,
42
42
  fmtKm,
43
43
  PaymentMode,
44
- startPaymentMode,
45
44
  ratingTone,
46
45
  } from './cardParts';
47
46
  import { AutobahnCar } from './types';
@@ -81,8 +80,6 @@ export interface CarRowProps {
81
80
  * links render as plain text (see PricePaths' own fallback).
82
81
  */
83
82
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
84
- /** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
85
- initialMode?: PaymentMode;
86
83
  }
87
84
 
88
85
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -95,9 +92,8 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
95
92
  t,
96
93
  adminAction,
97
94
  onShowFinancingDetails,
98
- initialMode,
99
95
  }) => {
100
- const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
96
+ const [mode, setMode] = useState<PaymentMode>('financing');
101
97
  const [photoIndex, setPhotoIndex] = useState(0);
102
98
  const mediaRef = useRef<HTMLDivElement | null>(null);
103
99
  // always call the LATEST onMediaEnter without re-arming the observer on every render (the
@@ -489,11 +489,6 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
489
489
 
490
490
  export type PaymentMode = 'financing' | 'leasing' | 'buy';
491
491
 
492
- /** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
493
- * without a lease rate — PriceTabs has no Leasing tab for it. */
494
- export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
495
- requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
496
-
497
492
  export interface PriceTabsProps {
498
493
  car: AutobahnCar;
499
494
  mode: PaymentMode;
@@ -715,12 +710,7 @@ export const PriceTerms: React.FunctionComponent<{
715
710
  onShowDetails?: () => void;
716
711
  t: TranslationFunction;
717
712
  }> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
718
- // Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
719
- // here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
720
- // real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
721
- // every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
722
- // FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
723
- if (mode === 'buy') return <div className="cc-terms" />;
713
+ if (mode === 'buy') return null;
724
714
  const finFirstInstallment =
725
715
  car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
726
716
  const finMonths = car.finMonths ?? _finMonths;
@@ -1,91 +1,91 @@
1
- import React from 'react';
2
-
3
- export type AccountMenuIconName =
4
- | 'layout-grid' | 'car-front' | 'bookmark' | 'star' | 'scale' | 'user' | 'help-circle' | 'log-out';
5
-
6
- /**
7
- * Row icons of the Konto menu (Figma "Konto / Kontomenü", 64243:14111): Lucide-style glyphs in a
8
- * 22px frame with a 1.8px stroke, but with Figma's own geometry — e.g. its bookmark is narrower and
9
- * square-cornered, unlike lucide-react 0.288's — so the paths are Figma's export, not the lib Icon.
10
- * `at` moves each export to where Figma places it in the frame: the group inset minus half the stroke.
11
- */
12
- const GLYPHS: Record<AccountMenuIconName, { at: [number, number]; d: string[] }> = {
13
- 'layout-grid': {
14
- at: [1.85, 1.85],
15
- d: [
16
- 'M1.81667 0.9H6.4C6.90626 0.9 7.31667 1.31041 7.31667 1.81667V6.4C7.31667 6.90626 6.90626 7.31667 6.4 7.31667H1.81667C1.31041 7.31667 0.9 6.90626 0.9 6.4V1.81667C0.9 1.31041 1.31041 0.9 1.81667 0.9Z',
17
- 'M11.9 0.9H16.4833C16.9896 0.9 17.4 1.31041 17.4 1.81667V6.4C17.4 6.90626 16.9896 7.31667 16.4833 7.31667H11.9C11.3937 7.31667 10.9833 6.90626 10.9833 6.4V1.81667C10.9833 1.31041 11.3937 0.9 11.9 0.9Z',
18
- 'M1.81667 10.9833H6.4C6.90626 10.9833 7.31667 11.3937 7.31667 11.9V16.4833C7.31667 16.9896 6.90626 17.4 6.4 17.4H1.81667C1.31041 17.4 0.9 16.9896 0.9 16.4833V11.9C0.9 11.3937 1.31041 10.9833 1.81667 10.9833Z',
19
- 'M11.9 10.9833H16.4833C16.9896 10.9833 17.4 11.3937 17.4 11.9V16.4833C17.4 16.9896 16.9896 17.4 16.4833 17.4H11.9C11.3937 17.4 10.9833 16.9896 10.9833 16.4833V11.9C10.9833 11.3937 11.3937 10.9833 11.9 10.9833Z',
20
- ],
21
- },
22
- 'car-front': {
23
- at: [1.85, 3.68333],
24
- d: [
25
- 'M2.73333 6.4L4.10833 2.275C4.20846 1.88695 4.43297 1.5424 4.74752 1.29408C5.06206 1.04575 5.44931 0.907329 5.85 0.9H12.45C12.8507 0.907329 13.2379 1.04575 13.5525 1.29408C13.867 1.5424 14.0915 1.88695 14.1917 2.275L15.5667 6.4',
26
- 'M2.73333 6.4H15.5667C16.5792 6.4 17.4 7.22081 17.4 8.23333V10.9833C17.4 11.9959 16.5792 12.8167 15.5667 12.8167H2.73333C1.72081 12.8167 0.9 11.9959 0.9 10.9833V8.23333C0.9 7.22081 1.72081 6.4 2.73333 6.4Z',
27
- 'M4.56667 12.8167V14.65M13.7333 12.8167V14.65',
28
- ],
29
- },
30
- bookmark: {
31
- at: [4.6, 1.85],
32
- d: ['M0.9 0.9H11.9V17.4L6.4 13.275L0.9 17.4V0.9Z'],
33
- },
34
- star: {
35
- at: [2.03333, 1.85],
36
- d: ['M8.96669 0.9L11.4417 6.03333L17.0334 6.85833L13 10.8L13.9167 16.3917L8.96669 13.7333L4.01669 16.3917L4.93336 10.8L0.900026 6.85833L6.49169 6.03333L8.96669 0.9Z'],
37
- },
38
- scale: {
39
- at: [1.85, 1.85],
40
- d: [
41
- 'M9.15 0.9V4.56667M9.15 4.56667V17.4M9.15 4.56667H3.65M9.15 4.56667H14.65',
42
- 'M3.65 4.56667L0.900003 10.9833H6.4L3.65 4.56667ZM14.65 4.56667L11.9 10.9833H17.4L14.65 4.56667Z',
43
- ],
44
- },
45
- user: {
46
- at: [2.76667, 2.76667],
47
- d: [
48
- 'M11.9 4.56667C11.9 6.59171 10.2584 8.23333 8.23333 8.23333C6.20829 8.23333 4.56667 6.59171 4.56667 4.56667C4.56667 2.54162 6.20829 0.9 8.23333 0.9C10.2584 0.9 11.9 2.54162 11.9 4.56667Z',
49
- 'M0.9 16.4833C0.9 12.8167 4.2 10.9833 8.23333 10.9833C12.2667 10.9833 15.5667 12.8167 15.5667 16.4833',
50
- ],
51
- },
52
- 'help-circle': {
53
- at: [1.85, 1.85],
54
- d: [
55
- 'M17.4 9.15C17.4 13.7063 13.7063 17.4 9.15 17.4C4.59365 17.4 0.9 13.7063 0.9 9.15C0.9 4.59365 4.59365 0.9 9.15 0.9C13.7063 0.9 17.4 4.59365 17.4 9.15Z',
56
- 'M6.85833 6.85833C6.84973 6.4229 6.96538 5.99402 7.19175 5.62195C7.41811 5.24988 7.74582 4.95001 8.13647 4.75748C8.52713 4.56495 8.96456 4.48772 9.39752 4.53485C9.83049 4.58197 10.2411 4.7515 10.5811 5.02357C10.9212 5.29564 11.1767 5.65898 11.3178 6.07104C11.4588 6.4831 11.4795 6.92681 11.3774 7.3502C11.2753 7.77359 11.0547 8.15913 10.7414 8.46165C10.4281 8.76417 10.035 8.97114 9.60833 9.05833V10.25',
57
- 'M9.15 13.7333H9.16',
58
- ],
59
- },
60
- 'log-out': {
61
- at: [1.85, 1.85],
62
- d: [
63
- 'M6.4 17.4H2.73333C2.2471 17.4 1.78079 17.2068 1.43697 16.863C1.09315 16.5192 0.9 16.0529 0.9 15.5667V2.73333C0.9 2.2471 1.09315 1.78079 1.43697 1.43697C1.78079 1.09315 2.2471 0.9 2.73333 0.9H6.4',
64
- 'M12.8167 4.56667L17.4 9.15L12.8167 13.7333M17.4 9.15H6.4',
65
- ],
66
- },
67
- };
68
-
69
- const AccountMenuIcon: React.FunctionComponent<{ name: AccountMenuIconName }> = ({ name }) => {
70
- const { at, d } = GLYPHS[name];
71
- return (
72
- <svg
73
- className="acct-icon"
74
- width="22"
75
- height="22"
76
- viewBox="0 0 22 22"
77
- fill="none"
78
- stroke="currentColor"
79
- strokeWidth="1.8"
80
- strokeLinecap="round"
81
- strokeLinejoin="round"
82
- aria-hidden="true"
83
- >
84
- <g transform={`translate(${at[0]} ${at[1]})`}>
85
- {d.map((path) => <path key={path} d={path} />)}
86
- </g>
87
- </svg>
88
- );
89
- };
90
-
91
- export default AccountMenuIcon;
1
+ import React from 'react';
2
+
3
+ export type AccountMenuIconName =
4
+ | 'layout-grid' | 'car-front' | 'bookmark' | 'star' | 'scale' | 'user' | 'help-circle' | 'log-out';
5
+
6
+ /**
7
+ * Row icons of the Konto menu (Figma "Konto / Kontomenü", 64243:14111): Lucide-style glyphs in a
8
+ * 22px frame with a 1.8px stroke, but with Figma's own geometry — e.g. its bookmark is narrower and
9
+ * square-cornered, unlike lucide-react 0.288's — so the paths are Figma's export, not the lib Icon.
10
+ * `at` moves each export to where Figma places it in the frame: the group inset minus half the stroke.
11
+ */
12
+ const GLYPHS: Record<AccountMenuIconName, { at: [number, number]; d: string[] }> = {
13
+ 'layout-grid': {
14
+ at: [1.85, 1.85],
15
+ d: [
16
+ 'M1.81667 0.9H6.4C6.90626 0.9 7.31667 1.31041 7.31667 1.81667V6.4C7.31667 6.90626 6.90626 7.31667 6.4 7.31667H1.81667C1.31041 7.31667 0.9 6.90626 0.9 6.4V1.81667C0.9 1.31041 1.31041 0.9 1.81667 0.9Z',
17
+ 'M11.9 0.9H16.4833C16.9896 0.9 17.4 1.31041 17.4 1.81667V6.4C17.4 6.90626 16.9896 7.31667 16.4833 7.31667H11.9C11.3937 7.31667 10.9833 6.90626 10.9833 6.4V1.81667C10.9833 1.31041 11.3937 0.9 11.9 0.9Z',
18
+ 'M1.81667 10.9833H6.4C6.90626 10.9833 7.31667 11.3937 7.31667 11.9V16.4833C7.31667 16.9896 6.90626 17.4 6.4 17.4H1.81667C1.31041 17.4 0.9 16.9896 0.9 16.4833V11.9C0.9 11.3937 1.31041 10.9833 1.81667 10.9833Z',
19
+ 'M11.9 10.9833H16.4833C16.9896 10.9833 17.4 11.3937 17.4 11.9V16.4833C17.4 16.9896 16.9896 17.4 16.4833 17.4H11.9C11.3937 17.4 10.9833 16.9896 10.9833 16.4833V11.9C10.9833 11.3937 11.3937 10.9833 11.9 10.9833Z',
20
+ ],
21
+ },
22
+ 'car-front': {
23
+ at: [1.85, 3.68333],
24
+ d: [
25
+ 'M2.73333 6.4L4.10833 2.275C4.20846 1.88695 4.43297 1.5424 4.74752 1.29408C5.06206 1.04575 5.44931 0.907329 5.85 0.9H12.45C12.8507 0.907329 13.2379 1.04575 13.5525 1.29408C13.867 1.5424 14.0915 1.88695 14.1917 2.275L15.5667 6.4',
26
+ 'M2.73333 6.4H15.5667C16.5792 6.4 17.4 7.22081 17.4 8.23333V10.9833C17.4 11.9959 16.5792 12.8167 15.5667 12.8167H2.73333C1.72081 12.8167 0.9 11.9959 0.9 10.9833V8.23333C0.9 7.22081 1.72081 6.4 2.73333 6.4Z',
27
+ 'M4.56667 12.8167V14.65M13.7333 12.8167V14.65',
28
+ ],
29
+ },
30
+ bookmark: {
31
+ at: [4.6, 1.85],
32
+ d: ['M0.9 0.9H11.9V17.4L6.4 13.275L0.9 17.4V0.9Z'],
33
+ },
34
+ star: {
35
+ at: [2.03333, 1.85],
36
+ d: ['M8.96669 0.9L11.4417 6.03333L17.0334 6.85833L13 10.8L13.9167 16.3917L8.96669 13.7333L4.01669 16.3917L4.93336 10.8L0.900026 6.85833L6.49169 6.03333L8.96669 0.9Z'],
37
+ },
38
+ scale: {
39
+ at: [1.85, 1.85],
40
+ d: [
41
+ 'M9.15 0.9V4.56667M9.15 4.56667V17.4M9.15 4.56667H3.65M9.15 4.56667H14.65',
42
+ 'M3.65 4.56667L0.900003 10.9833H6.4L3.65 4.56667ZM14.65 4.56667L11.9 10.9833H17.4L14.65 4.56667Z',
43
+ ],
44
+ },
45
+ user: {
46
+ at: [2.76667, 2.76667],
47
+ d: [
48
+ 'M11.9 4.56667C11.9 6.59171 10.2584 8.23333 8.23333 8.23333C6.20829 8.23333 4.56667 6.59171 4.56667 4.56667C4.56667 2.54162 6.20829 0.9 8.23333 0.9C10.2584 0.9 11.9 2.54162 11.9 4.56667Z',
49
+ 'M0.9 16.4833C0.9 12.8167 4.2 10.9833 8.23333 10.9833C12.2667 10.9833 15.5667 12.8167 15.5667 16.4833',
50
+ ],
51
+ },
52
+ 'help-circle': {
53
+ at: [1.85, 1.85],
54
+ d: [
55
+ 'M17.4 9.15C17.4 13.7063 13.7063 17.4 9.15 17.4C4.59365 17.4 0.9 13.7063 0.9 9.15C0.9 4.59365 4.59365 0.9 9.15 0.9C13.7063 0.9 17.4 4.59365 17.4 9.15Z',
56
+ 'M6.85833 6.85833C6.84973 6.4229 6.96538 5.99402 7.19175 5.62195C7.41811 5.24988 7.74582 4.95001 8.13647 4.75748C8.52713 4.56495 8.96456 4.48772 9.39752 4.53485C9.83049 4.58197 10.2411 4.7515 10.5811 5.02357C10.9212 5.29564 11.1767 5.65898 11.3178 6.07104C11.4588 6.4831 11.4795 6.92681 11.3774 7.3502C11.2753 7.77359 11.0547 8.15913 10.7414 8.46165C10.4281 8.76417 10.035 8.97114 9.60833 9.05833V10.25',
57
+ 'M9.15 13.7333H9.16',
58
+ ],
59
+ },
60
+ 'log-out': {
61
+ at: [1.85, 1.85],
62
+ d: [
63
+ 'M6.4 17.4H2.73333C2.2471 17.4 1.78079 17.2068 1.43697 16.863C1.09315 16.5192 0.9 16.0529 0.9 15.5667V2.73333C0.9 2.2471 1.09315 1.78079 1.43697 1.43697C1.78079 1.09315 2.2471 0.9 2.73333 0.9H6.4',
64
+ 'M12.8167 4.56667L17.4 9.15L12.8167 13.7333M17.4 9.15H6.4',
65
+ ],
66
+ },
67
+ };
68
+
69
+ const AccountMenuIcon: React.FunctionComponent<{ name: AccountMenuIconName }> = ({ name }) => {
70
+ const { at, d } = GLYPHS[name];
71
+ return (
72
+ <svg
73
+ className="acct-icon"
74
+ width="22"
75
+ height="22"
76
+ viewBox="0 0 22 22"
77
+ fill="none"
78
+ stroke="currentColor"
79
+ strokeWidth="1.8"
80
+ strokeLinecap="round"
81
+ strokeLinejoin="round"
82
+ aria-hidden="true"
83
+ >
84
+ <g transform={`translate(${at[0]} ${at[1]})`}>
85
+ {d.map((path) => <path key={path} d={path} />)}
86
+ </g>
87
+ </svg>
88
+ );
89
+ };
90
+
91
+ export default AccountMenuIcon;
package/constants/app.ts CHANGED
@@ -40,17 +40,7 @@ export const LOCAL_STORAGE_KEY = {
40
40
  i18n_KEY: 'i18nLanguage'
41
41
  };
42
42
 
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';
43
+ export const DEFAULT_LANG: string = typeof window !== 'undefined' ? localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : 'de';
54
44
 
55
45
  // Default support contact phone
56
46
  export const CONTACT_PHONE: string = '+498004030182';
package/constants/core.ts CHANGED
@@ -35,18 +35,7 @@ export const LOCAL_STORAGE_KEY = {
35
35
  i18n_KEY: 'i18nLanguage'
36
36
  };
37
37
 
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';
38
+ export const DEFAULT_LANG: string = (typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null) ?? 'de';
50
39
 
51
40
  export const ROW_STYLES = {
52
41
  marginBottom: 10
@@ -494,8 +494,7 @@
494
494
  "ratings": "Bewertungen"
495
495
  },
496
496
  "section": {
497
- "similar": "Ähnliche Fahrzeuge",
498
- "unavailableSimilar": "Ähnliche / vergleichbare Fahrzeuge"
497
+ "similar": "Ähnliche Fahrzeuge"
499
498
  },
500
499
  "breadcrumb": {
501
500
  "home": "Start",
@@ -806,8 +805,7 @@
806
805
  "serviceHistory": "Scheckheft",
807
806
  "warranty": "Garantie",
808
807
  "yes": "Ja",
809
- "no": "Nein",
810
- "notSpecified": "keine Angabe"
808
+ "no": "Nein"
811
809
  },
812
810
  "common": {
813
811
  "needsData": "Daten folgt"
@@ -494,8 +494,7 @@
494
494
  "ratings": "Ratings"
495
495
  },
496
496
  "section": {
497
- "similar": "Similar vehicles",
498
- "unavailableSimilar": "Similar / comparable vehicles"
497
+ "similar": "Similar vehicles"
499
498
  },
500
499
  "breadcrumb": {
501
500
  "home": "Home",
@@ -806,8 +805,7 @@
806
805
  "serviceHistory": "Full service history",
807
806
  "warranty": "Warranty",
808
807
  "yes": "Yes",
809
- "no": "No",
810
- "notSpecified": "not specified"
808
+ "no": "No"
811
809
  },
812
810
  "common": {
813
811
  "needsData": "Data coming soon"
@@ -103,8 +103,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
103
103
  wltpDischargedCombinedLabel: `${getFormattedNumber(vehicleOption.wltpCombined != null ? vehicleOption.wltpCombined : 19.9)}l/100km (entladen, komb)`,
104
104
  wltpCo2WtdCombinedShort: `${getFormattedNumber(vehicleOption.wltpCo2)}g CO2/km (gew., komb)*`,
105
105
  co2ClassWeighted: `CO2-Klasse ${(cbd.cbd as any)[vehicleOption.wltpEnergyEfficiencyClass] || vehicleOption.wltpEnergyEfficiencyClass || ''} (gew., komb)`,
106
- // ADV-187: no hard-coded fallback class — callers only render this when the class is defined.
107
- co2ClassDischarged: `CO2-Klasse ${(cbd.cbd as any)[vehicleOption.wltpDischargedEnergyEfficiencyClass] || vehicleOption.wltpDischargedEnergyEfficiencyClass || ''} (entladen, komb)`
106
+ co2ClassDischarged: `CO2-Klasse ${(cbd.cbd as any)[vehicleOption.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g'] || ''} (entladen, komb)`
108
107
  },
109
108
  title: {
110
109
  'addOfferToMainSlide': 'Zum Schieberegler hinzufügen',
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.168",
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.20",
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.169",
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.20",
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
+ }
package/theme/md3.css CHANGED
@@ -10100,8 +10100,7 @@ line-height: 31px;
10100
10100
  z-index: 71;
10101
10101
  background: var(--md-surface);
10102
10102
  border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
10103
- /* % of the fixed containing block, not vh/dvh: on iOS vh is the toolbars-collapsed height, and Chrome on iOS does not shrink dvh while its toolbars are shown either, so a 92vh/92dvh bottom sheet grew under the address bar and hid its own header (title, download, close). The fixed box itself always matches the visible area. */
10104
- max-height: 92%;
10103
+ max-height: 92vh;
10105
10104
  display: flex;
10106
10105
  flex-direction: column;
10107
10106
  box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
@@ -14252,8 +14251,7 @@ color: #005CFF;
14252
14251
  flex-direction: column;
14253
14252
  width: 100%;
14254
14253
  max-width: 560px;
14255
- /* % of the scrim (fixed, inset 0, 16px padding) instead of calc(100vh - 32px): see the iOS note on the mobile .mmodal below */
14256
- max-height: 100%;
14254
+ max-height: calc(100vh - 32px);
14257
14255
  background: var(--md-sc-lowest, #fff);
14258
14256
  color: var(--md-on-surface);
14259
14257
  border-radius: var(--md-r-lg);
@@ -14399,8 +14397,7 @@ color: #005CFF;
14399
14397
  }
14400
14398
  .md3 .mmodal {
14401
14399
  max-width: 100%;
14402
- /* % of the fixed containing block, not vh/dvh: on iOS vh is the toolbars-collapsed height, and Chrome on iOS does not shrink dvh while its toolbars are shown either, so a 92vh/92dvh bottom sheet grew under the address bar and hid its own header (title, download, close). The fixed box itself always matches the visible area. */
14403
- max-height: 92%;
14400
+ max-height: 92vh;
14404
14401
  border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
14405
14402
  border-bottom: 0;
14406
14403
  animation: mmodal-sheet-up 0.25s ease-out;
package/ui/Dropdown.tsx CHANGED
@@ -22,7 +22,6 @@ import * as ReactDOM from 'react-dom';
22
22
 
23
23
  import Icon from './Icon';
24
24
  import { usePortalMenuPosition } from './usePortalMenuPosition';
25
- import { scrollFieldIntoView } from './scrollFieldIntoView';
26
25
 
27
26
  export interface DropdownOption {
28
27
  value: string;
@@ -190,22 +189,15 @@ const Dropdown: React.FunctionComponent<DropdownProps> = ({
190
189
  if (allowCustomValue) setQuery(value || '');
191
190
  }, [disabled, selectedIndex, allowCustomValue, value]);
192
191
 
193
- // Scroll the trigger (searchable or not) to the top of the page on open, THEN — searchable
194
- // only — focus the search input instead of leaving focus on the trigger. Every Dropdown shares
195
- // this, not just searchable ones: on mobile a trigger sitting mid-page can open a menu that
196
- // runs off the bottom of the viewport with no way to see the rest of it, same underlying
197
- // problem a searchable trigger has with the keyboard eating the space below it. A plain
198
- // `scrollIntoView({block:'center'})` used to run here (searchable-only) — "center" only moves
199
- // the trigger when it's already near a viewport edge, so on a trigger that's roughly mid-page
200
- // already (the common case) it was a near no-op, leaving a few hundred px of dead space above
201
- // the trigger that the keyboard (searchable) or the menu's own bottom edge (any dropdown) then
202
- // ran into.
192
+ // when opened searchable, focus the search input instead of leaving focus on the trigger.
193
+ // scrollIntoView first: on mobile the keyboard is about to eat ~40% of the viewport, so the
194
+ // trigger (and the popover below it) needs to already be scrolled above the fold before focus
195
+ // fires, or the popover can end up hidden behind the keyboard with no way to see it open.
203
196
  React.useEffect(() => {
204
- if (!open) return;
205
- if (rootRef.current) scrollFieldIntoView(rootRef.current);
206
- // searchRef is only ever attached in the searchable+open (editing) render branch, so this
207
- // naturally no-ops for a non-searchable dropdown — nothing else to focus there, the trigger
208
- // <button> already has focus from the click/keypress that opened it.
197
+ if (!open || !searchable) return;
198
+ if (rootRef.current && rootRef.current.scrollIntoView) {
199
+ rootRef.current.scrollIntoView({ block: 'center', behavior: 'smooth' });
200
+ }
209
201
  if (searchRef.current) {
210
202
  searchRef.current.focus();
211
203
  // pre-filled custom value (see openMenu) starts selected, so typing immediately
package/ui/index.ts CHANGED
@@ -39,8 +39,6 @@ export type { FormFieldProps } from './FormField';
39
39
  export { default as Dropdown } from './Dropdown';
40
40
  export type { DropdownProps, DropdownOption } from './Dropdown';
41
41
 
42
- export { scrollFieldIntoView } from './scrollFieldIntoView';
43
-
44
42
  export { default as Spec } from './Spec';
45
43
  export type { SpecProps } from './Spec';
46
44
 
@@ -79,20 +79,6 @@ const ESTIMATED_MENU_HEIGHT = 300;
79
79
  // a scroll within this window of opening REPOSITIONS instead of closing — see the effect below.
80
80
  const SELF_SCROLL_GRACE_MS = 500;
81
81
 
82
- // Module-level (not hook-local) so Dropdown.tsx's own searchable-open scroll effect can reuse the
83
- // exact same measurement — the sticky app header (.topbar, position:sticky/top:0) sits over the
84
- // top of the viewport on every page that uses it (TopBar's autoHideOnScroll is opt-in, off by
85
- // default — most pages keep it permanently docked), so anything that scrolls/positions content
86
- // near the top of the viewport needs to stop at its live bottom edge, not y=0. Reading the
87
- // header's live bottom edge (0 when absent, e.g. inside a modal, or when autoHideOnScroll has slid
88
- // it away) gives a correct boundary without hardcoding a pixel height that could drift from the
89
- // header's own CSS.
90
- export const getSafeTop = (): number => {
91
- if (typeof document === 'undefined') return 0;
92
- const header = document.querySelector('.topbar');
93
- return header ? Math.max(0, header.getBoundingClientRect().bottom) : 0;
94
- };
95
-
96
82
  export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivElement>({
97
83
  enabled,
98
84
  open,
@@ -135,6 +121,18 @@ export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivEleme
135
121
  };
136
122
  }, [enabled, open, portalRoot]);
137
123
 
124
+ // the portal menu's z-index (1400, .mselect-menu--portal) is intentionally higher than every
125
+ // other fixed overlay it must paint over (checkout sheets/modals) — which also means it would
126
+ // paint over the sticky app header (.topbar, position:sticky/top:0/z-index:50) if left
127
+ // unconstrained. Reading the header's live bottom edge (0 when absent, e.g. inside a modal, or
128
+ // when TopBar's autoHideOnScroll has slid it away) gives a correct top boundary without
129
+ // hardcoding a pixel height that could drift from the header's own CSS.
130
+ const getSafeTop = (): number => {
131
+ if (typeof document === 'undefined') return 0;
132
+ const header = document.querySelector('.topbar');
133
+ return header ? Math.max(0, header.getBoundingClientRect().bottom) : 0;
134
+ };
135
+
138
136
  const [menuPos, setMenuPos] = React.useState<PortalMenuPos | null>(null);
139
137
 
140
138
  const positionMenu = React.useCallback(() => {
package/utils/index.ts CHANGED
@@ -83,5 +83,3 @@ export type { IValues, IFilters, IQuery } from './query';
83
83
  // Decorated car props (renders React UI; lives in vehiclesProps/ with its
84
84
  // IconContainer + Co2Widget dependencies under compat/).
85
85
  export { default as getDecoratedProps } from '../vehiclesProps/decoratedProps';
86
- export { setStrictConditionOwners, isStrictConditionOwner, strictAccidentStatus } from '../vehiclesProps/accidentDisclosure';
87
- export type { AccidentStatus } from '../vehiclesProps/accidentDisclosure';
@@ -92,7 +92,7 @@ export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({
92
92
  ['zap', extractPS(vehicle.power)],
93
93
  ['fuel', stripParen(vehicle.fuel)],
94
94
  ['cog', vehicle.gear],
95
- ...(vehicle.owners == null ? [] : ([['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })]] as const)),
95
+ ['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
96
96
  ];
97
97
  return (
98
98
  <>
@@ -142,7 +142,7 @@ export const VdpFactsGrid: React.FunctionComponent<VdpHeaderCardProps> = ({ vehi
142
142
  ['calendar', vehicle.reg],
143
143
  ['cog', vehicle.gear],
144
144
  ['fuel', stripParen(vehicle.fuel)],
145
- ...(vehicle.owners == null ? [] : ([['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })]] as const)),
145
+ ['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
146
146
  ...(vehicle.body ? ([['car-front', vehicle.body]] as const) : []),
147
147
  ];
148
148
  return (
@@ -216,7 +216,7 @@ export const VdpHeaderCondition: React.FunctionComponent<VdpHeaderCardProps> = (
216
216
  // only the Garantie tile has one, linking out to auto.de's warranty policy page.
217
217
  const tiles: ReadonlyArray<readonly [string, string, string, string?]> = [
218
218
  ['wrench', t('autobahn:header.huLabel'), condition.hu === 'Neu' ? t('autobahn:header.huNew') : t('autobahn:header.huUntil', { date: condition.hu })],
219
- ['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei == null ? t('autobahn:header.notSpecified', { defaultValue: 'keine Angabe' }) : condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
219
+ ['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
220
220
  ['clipboard-check', t('autobahn:header.serviceHistory'), condition.scheckheft ? t('autobahn:header.yes') : t('autobahn:header.no')],
221
221
  ['award', t('autobahn:header.warranty'), condition.garantie, 'https://www.auto.de/garantie/'],
222
222
  ];
package/vdp/types.ts CHANGED
@@ -111,8 +111,8 @@ export interface Co2CostsSummary {
111
111
  export interface VehicleCondition {
112
112
  /** TÜV/HU validity, e.g. '03/2027' — or 'Neu' for a new HU. */
113
113
  hu: string;
114
- /** accident-free flag (Unfallfrei); null = not specified by the source ("keine Angabe"). */
115
- unfallfrei: boolean | null;
114
+ /** accident-free flag (Unfallfrei). */
115
+ unfallfrei: boolean;
116
116
  /** full service history (Scheckheftgepflegt). */
117
117
  scheckheft: boolean;
118
118
  /** warranty label, e.g. '12 Monate inkl.'. */
@@ -191,8 +191,8 @@ export interface VehicleDetail {
191
191
  fuel: string;
192
192
  /** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
193
193
  gear: string;
194
- /** number of previous owners (rendered as 'N. Hand'); null = not known, the fact is not shown. */
195
- owners: number | null;
194
+ /** number of previous owners (rendered as 'N. Hand'). */
195
+ owners: number;
196
196
  /** number of seats. */
197
197
  seats: number;
198
198
  /** number of doors. */
@@ -302,7 +302,7 @@ export function defaultVdpSpecs(v: VehicleDetail): VdpSpec[] {
302
302
  [['cog', 'Getriebe', v.gear], true],
303
303
  [['users', 'Sitze', `${v.seats} Sitze`], false],
304
304
  [['door-open', 'Türen', `${v.doors} Türen`], false],
305
- ...(v.owners == null ? [] : [[['user', 'Halter', `${v.owners}. Hand`], true] as const]), // 0 Vorbesitzer is valid
305
+ [['user', 'Halter', `${v.owners}. Hand`], true], // 0 Vorbesitzer is valid
306
306
  [['palette', 'Außenfarbe', v.color], true],
307
307
  [['car-front', 'Karosserie', v.body], true],
308
308
  [['droplet', 'Verbrauch komb.', v.cons], true], // Pkw-EnVKV — exempt from this rule
@@ -6,7 +6,6 @@ import { formatTimestamp } from '../utils/DateUtils';
6
6
  import { DELIVERY_PERIODS_EXTRA } from '../constants/core';
7
7
  import moment from 'moment';
8
8
  import { IDecoratedProp } from '../types/types';
9
- import { strictAccidentStatus } from './accidentDisclosure';
10
9
 
11
10
  interface IDecoratedProps {
12
11
  [key: string]: IDecoratedProp;
@@ -166,10 +165,7 @@ const getDecoratedLightProps = (
166
165
  if (hybridPlugin) {
167
166
  if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
168
167
  const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
169
- // ADV-187: the discharged class is derived server-side from wltpCo2Discharged; when the
170
- // backend could not derive it the field is selector_unknown — hide the segment, never
171
- // fall back to a hard-coded class here.
172
- const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
168
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
173
169
  const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
174
170
  const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
175
171
  const co2WeightedContent = Number.isFinite(wltpCo2)
@@ -178,16 +174,14 @@ const getDecoratedLightProps = (
178
174
  const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
179
175
  ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
180
176
  : null;
181
- const co2ClassDischarged = isPropDefined(dischargedClass)
182
- ? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
183
- : null;
177
+ const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
184
178
  return <React.Fragment>
185
179
  {`${wltpWeightedPowerCombinedContent} + `}
186
180
  {`${weightedCombinedLabeled}, `}
187
181
  {`${dischargedCombinedLabeled}`}
188
182
  {co2WeightedContent && <>, {co2WeightedContent}</>}
189
183
  {co2ClassWeighted && <>, {co2ClassWeighted}</>}
190
- {co2ClassDischarged && <>, {co2ClassDischarged}</>}
184
+ {<>, {co2ClassDischarged}</>}
191
185
  </React.Fragment>
192
186
  }
193
187
 
@@ -322,10 +316,7 @@ const getDecoratedLightProps = (
322
316
  if (hybridPlugin) {
323
317
  if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
324
318
  const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
325
- // ADV-187: the discharged class is derived server-side from wltpCo2Discharged; when the
326
- // backend could not derive it the field is selector_unknown — hide the segment, never
327
- // fall back to a hard-coded class here.
328
- const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
319
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
329
320
  const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
330
321
  const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
331
322
  const co2WeightedContent = Number.isFinite(wltpCo2)
@@ -334,16 +325,14 @@ const getDecoratedLightProps = (
334
325
  const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
335
326
  ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
336
327
  : null;
337
- const co2ClassDischarged = isPropDefined(dischargedClass)
338
- ? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
339
- : null;
328
+ const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
340
329
  return <React.Fragment>
341
330
  {`${wltpWeightedPowerCombinedContent} + `}
342
331
  {`${weightedCombinedLabeled}, `}
343
332
  {`${dischargedCombinedLabeled}`}
344
333
  {co2WeightedContent && <>, {co2WeightedContent}</>}
345
334
  {co2ClassWeighted && <>, {co2ClassWeighted}</>}
346
- {co2ClassDischarged && <>, {co2ClassDischarged}</>}
335
+ {<>, {co2ClassDischarged}</>}
347
336
  </React.Fragment>
348
337
  }
349
338
 
@@ -520,9 +509,6 @@ const getDecoratedLightProps = (
520
509
  title: t('cbd:mainData_accidentDamaged'),
521
510
  icon: 'wrench',
522
511
  get value() {
523
- const strict = strictAccidentStatus(car);
524
- if (strict === 'notSpecified') return t('vehicleProps:value.na');
525
- if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
526
512
  return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
527
513
  }
528
514
  },
@@ -9,7 +9,6 @@ import { EMISSION_STICKERS_ICONS, WP_EMISSION_STICKERS_ICONS } from '../constant
9
9
  import { DELIVERY_PERIODS_EXTRA } from '../constants';
10
10
  import { IDecoratedProp, ICar, IFinancingUtils } from '../types/types';
11
11
  import { getFormattedPrice } from '../utils/CommonUtils';
12
- import { strictAccidentStatus } from './accidentDisclosure';
13
12
 
14
13
  const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
15
14
  const count: number = +DELIVERY_PERIODS_EXTRA.find((period: any) => period.value === deliveryPeriod).label;
@@ -196,9 +195,6 @@ const getDecoratedProps = (
196
195
  title: t('cbd:mainData_accidentDamaged'),
197
196
  icon: 'wrench',
198
197
  get value() {
199
- const strict = strictAccidentStatus(car);
200
- if (strict === 'notSpecified') return t('vehicleProps:value.na');
201
- if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
202
198
  return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
203
199
  }
204
200
  },
@@ -884,12 +880,10 @@ const getDecoratedProps = (
884
880
  // (entladen, komb) fuel consumption + a discharged CO2 class.
885
881
  if (hybridPlugin && wltpConsumptionWeightedPowerCombinedContent && wltpConsumptionWeightedCombinedContent) {
886
882
  const ADV88_DEFAULT_DISCHARGED_COMBINED = 19.9;
883
+ const ADV88_DEFAULT_DISCHARGED_CO2_CLASS = 'selector_energyEfficiencyClass_g';
887
884
 
888
885
  const dischargedCombined = Number.isFinite(wltpCombined) ? wltpCombined : ADV88_DEFAULT_DISCHARGED_COMBINED;
889
- // ADV-187: the discharged class is derived server-side from wltpCo2Discharged; when the
890
- // backend could not derive it the field is selector_unknown — hide the segment, never
891
- // fall back to a hard-coded class here.
892
- const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
886
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || ADV88_DEFAULT_DISCHARGED_CO2_CLASS;
893
887
 
894
888
  const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
895
889
  const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
@@ -899,9 +893,7 @@ const getDecoratedProps = (
899
893
  const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
900
894
  ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
901
895
  : null;
902
- const co2ClassDischarged = isPropDefined(dischargedClass)
903
- ? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
904
- : null;
896
+ const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
905
897
 
906
898
  return <React.Fragment>
907
899
  {wrapValue(wltpConsumptionWeightedPowerCombinedContent)}{' + '}
@@ -909,7 +901,7 @@ const getDecoratedProps = (
909
901
  {wrapValue(dischargedCombinedLabeled)}
910
902
  {co2WeightedContent && <>{', '}{wrapValue(co2WeightedContent)}</>}
911
903
  {co2ClassWeighted && <>{', '}{co2ClassWeighted}</>}
912
- {co2ClassDischarged && <>{', '}{co2ClassDischarged}</>}
904
+ {', '}{co2ClassDischarged}
913
905
  </React.Fragment>
914
906
  }
915
907
 
@@ -1,41 +0,0 @@
1
- // Autobahn (auto.de redesign) — shared "scroll a just-opened/just-focused field to the top of the
2
- // page" behaviour, used by Dropdown.tsx and by fe-main's DualRange/RateSlider (FilterContent.tsx)
3
- // text fields on /search/detailed. On mobile, opening a dropdown's menu or focusing a text field
4
- // brings the on-screen keyboard up and/or needs room for a popover below the field — if the field
5
- // is sitting mid-page, there may not be enough space left below it once the keyboard/menu takes
6
- // its share. Scrolling the field to the very top of the page first maximizes what's available.
7
- //
8
- // Extracted out of Dropdown.tsx so it can be shared verbatim with fe-main's non-Dropdown form
9
- // fields (DualRange/RateSlider's text inputs) — same problem, same fix, one place to keep them
10
- // from drifting apart. See Dropdown.tsx's own call site for the original reasoning this was
11
- // pulled from.
12
- export function scrollFieldIntoView(field: HTMLElement): void {
13
- if (typeof window === 'undefined') return;
14
- // Mobile-only: the on-screen-keyboard/popover space problem this fixes doesn't exist on
15
- // desktop, where there's no keyboard pushing the viewport around. Same breakpoint + matchMedia
16
- // pattern as Modal.tsx/CardCarousel.tsx elsewhere in this lib.
17
- if (window.matchMedia('(min-width: 601px)').matches) return;
18
- // Anchor on whichever is higher up: the field itself, or a short field label/caption sitting
19
- // directly above it (own previous sibling, or — the common "label above a row of controls"
20
- // shape, e.g. "Marke & Modell" above the Make/Model row on /search/detailed — the wrapping
21
- // row's previous sibling). Checked by height, not by class name, so this works for ANY
22
- // caller's label without this needing to know that call site's specific markup.
23
- const MAX_LABEL_HEIGHT = 30;
24
- const asLabel = (el: Element | null): HTMLElement | null => {
25
- if (!(el instanceof HTMLElement)) return null;
26
- const h = el.getBoundingClientRect().height;
27
- return h > 0 && h <= MAX_LABEL_HEIGHT ? el : null;
28
- };
29
- const anchor =
30
- asLabel(field.previousElementSibling) ||
31
- asLabel(field.parentElement && field.parentElement.previousElementSibling) ||
32
- field;
33
- // No sticky-header reservation here: every current caller (NewMainPage '/', FilterContent on
34
- // '/search*') sits on a page where TopBar's own autoHideOnScroll is on (App.tsx: isHomePage ||
35
- // isSearchPage) — the header slides itself out of the way the instant this scroll starts,
36
- // independently of this call, so reserving space for it here would double-count.
37
- const GAP = 8;
38
- const rect = anchor.getBoundingClientRect();
39
- const targetY = window.scrollY + rect.top - GAP;
40
- window.scrollTo({ top: Math.max(0, targetY), behavior: 'smooth' });
41
- }
@@ -1,25 +0,0 @@
1
- // FINN handover v0.6 (Daniel, 15.10.2026): for the owners set here, accident and owner facts follow
2
- // only what the source states — mainData.accidentDamaged false → accident-free, true → accident,
3
- // empty → not specified; an empty owner count is not shown as "0. Hand". Every other dealer keeps
4
- // the old display (accident-free unless `damaged`). The app sets the owners once at start.
5
- let strictOwners: ReadonlyArray<string> = [];
6
-
7
- export function setStrictConditionOwners(ownerIds: ReadonlyArray<string>): void {
8
- strictOwners = (ownerIds || []).filter(Boolean);
9
- }
10
-
11
- export function isStrictConditionOwner(car: any): boolean {
12
- const ownerId = car?.metaData?.ownerId;
13
- return !!ownerId && strictOwners.includes(ownerId);
14
- }
15
-
16
- export type AccidentStatus = 'accidentFree' | 'accident' | 'notSpecified';
17
-
18
- // The strict status, or undefined when the car's owner keeps the old display.
19
- export function strictAccidentStatus(car: any): AccidentStatus | undefined {
20
- if (!isStrictConditionOwner(car)) return undefined;
21
- const value = car?.mainData?.accidentDamaged;
22
- if (value === true) return 'accident';
23
- if (value === false) return 'accidentFree';
24
- return 'notSpecified';
25
- }