@bytebrand/fe-ui-core-autobahn 1.0.212 → 1.0.214

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"
@@ -288,50 +279,21 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
288
279
  <div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
289
280
  <PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
290
281
  <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
291
- {/* every tab's hero stacked in one grid cell (.cc-hero-stack), only the active one
292
- visible, bottom-aligned — Kaufen's struck list price sits on its own line above
293
- the price, so without this the row (and the card) grew/shrank by that line on
294
- every tab switch. Same trick as .cc-terms-stack below. */}
295
- <div className="cc-hero-stack">
296
- {paymentModes.map((m) => (
297
- <div
298
- key={m}
299
- className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
300
- aria-hidden={m === mode ? undefined : true}
301
- >
302
- <PriceHero car={car} mode={m} t={t} alwaysShowUnit />
303
- </div>
304
- ))}
305
- </div>
282
+ <PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
306
283
  <PriceEvalCol car={car} t={t} />
307
284
  </div>
308
285
  {/* same fallback CardCtaRow already uses below: pages that haven't wired a real
309
- "Rate anpassen" sheet yet still get a working "Details" link (opens the car).
310
- Every tab's terms line is rendered into the same grid cell (.cc-terms-stack) and
311
- only the active one is visible — the cell is as tall as the tallest line, so the
312
- card keeps one height across Finanzierung/Leasing/Kaufen (Leasing's longer line
313
- wraps to 2 lines on narrow phones). No change to the visible line itself. */}
314
- <div className="cc-terms-stack">
315
- {paymentModes.map((m) => (
316
- <div
317
- key={m}
318
- className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
319
- aria-hidden={m === mode ? undefined : true}
320
- >
321
- <PriceTerms
322
- car={car}
323
- mode={m}
324
- onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
325
- onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
326
- t={t}
327
- />
328
- {/* ADV-405/407 Kreditkosten-Hinweis under the financing/leasing conditions line. Inside the
329
- slot, so the stack keeps one height across the tabs (no jump on Kaufen); hidden slots
330
- are visibility:hidden + aria-hidden like their terms line. */}
331
- {m !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
332
- </div>
333
- ))}
334
- </div>
286
+ "Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
287
+ <PriceTerms
288
+ car={car}
289
+ mode={mode}
290
+ onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
291
+ onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
292
+ t={t}
293
+ />
294
+ {/* ADV-405/407 Kreditkosten-Hinweis: below the conditions line, above the CTA row (mobile)
295
+ / eco line (desktop); not on Kaufen, which shows no financing terms either. */}
296
+ {mode !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
335
297
  </div>
336
298
  {/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
337
299
  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