@bytebrand/fe-ui-core-autobahn 1.0.183 → 1.0.184

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;
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.183",
3
+ "version": "1.0.184",
4
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
5
  "main": "index.ts",
6
6
  "license": "UNLICENSED",
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);
@@ -14259,8 +14258,7 @@ color: #005CFF;
14259
14258
  flex-direction: column;
14260
14259
  width: 100%;
14261
14260
  max-width: 560px;
14262
- /* % of the scrim (fixed, inset 0, 16px padding) instead of calc(100vh - 32px): see the iOS note on the mobile .mmodal below */
14263
- max-height: 100%;
14261
+ max-height: calc(100vh - 32px);
14264
14262
  background: var(--md-sc-lowest, #fff);
14265
14263
  color: var(--md-on-surface);
14266
14264
  border-radius: var(--md-r-lg);
@@ -14406,8 +14404,7 @@ color: #005CFF;
14406
14404
  }
14407
14405
  .md3 .mmodal {
14408
14406
  max-width: 100%;
14409
- /* % 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. */
14410
- max-height: 92%;
14407
+ max-height: 92vh;
14411
14408
  border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
14412
14409
  border-bottom: 0;
14413
14410
  animation: mmodal-sheet-up 0.25s ease-out;