@bytebrand/fe-ui-core-autobahn 1.0.218 → 1.0.219
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 +13 -51
- package/cards/CarRow.tsx +1 -5
- package/cards/cardParts.tsx +1 -11
- package/constants/app.ts +1 -11
- package/constants/core.ts +1 -12
- package/package.json +2 -2
- package/theme/md3.css +3 -6
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';
|
|
@@ -105,11 +104,6 @@ export interface CarCardProps {
|
|
|
105
104
|
* when omitted the badge is not a link (a click opens the car via onOpen, as before).
|
|
106
105
|
*/
|
|
107
106
|
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
108
|
-
/**
|
|
109
|
-
* Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
|
|
110
|
-
* open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
|
|
111
|
-
*/
|
|
112
|
-
initialMode?: PaymentMode;
|
|
113
107
|
}
|
|
114
108
|
|
|
115
109
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -126,9 +120,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
126
120
|
onOpenRateAdjust,
|
|
127
121
|
onShowFinancingDetails,
|
|
128
122
|
onShowPriceRating,
|
|
129
|
-
initialMode,
|
|
130
123
|
}) => {
|
|
131
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
124
|
+
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
132
125
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
133
126
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
134
127
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -171,8 +164,6 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
171
164
|
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
172
165
|
const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
|
|
173
166
|
const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
|
|
174
|
-
// tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
|
|
175
|
-
const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
|
|
176
167
|
return (
|
|
177
168
|
<article
|
|
178
169
|
className="mcard mcard--interactive cc-card"
|
|
@@ -295,50 +286,21 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
295
286
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
296
287
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
297
288
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
298
|
-
{
|
|
299
|
-
visible, bottom-aligned — Kaufen's struck list price sits on its own line above
|
|
300
|
-
the price, so without this the row (and the card) grew/shrank by that line on
|
|
301
|
-
every tab switch. Same trick as .cc-terms-stack below. */}
|
|
302
|
-
<div className="cc-hero-stack">
|
|
303
|
-
{paymentModes.map((m) => (
|
|
304
|
-
<div
|
|
305
|
-
key={m}
|
|
306
|
-
className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
|
|
307
|
-
aria-hidden={m === mode ? undefined : true}
|
|
308
|
-
>
|
|
309
|
-
<PriceHero car={car} mode={m} t={t} alwaysShowUnit />
|
|
310
|
-
</div>
|
|
311
|
-
))}
|
|
312
|
-
</div>
|
|
289
|
+
<PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
|
|
313
290
|
<PriceEvalCol car={car} t={t} onActivate={onShowPriceRating ? () => onShowPriceRating(car) : undefined} />
|
|
314
291
|
</div>
|
|
315
292
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
316
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
>
|
|
328
|
-
<PriceTerms
|
|
329
|
-
car={car}
|
|
330
|
-
mode={m}
|
|
331
|
-
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
332
|
-
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
|
|
333
|
-
t={t}
|
|
334
|
-
/>
|
|
335
|
-
{/* ADV-405/407 Kreditkosten-Hinweis under the financing/leasing conditions line. Inside the
|
|
336
|
-
slot, so the stack keeps one height across the tabs (no jump on Kaufen); hidden slots
|
|
337
|
-
are visibility:hidden + aria-hidden like their terms line. */}
|
|
338
|
-
{m !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
339
|
-
</div>
|
|
340
|
-
))}
|
|
341
|
-
</div>
|
|
293
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
|
|
294
|
+
<PriceTerms
|
|
295
|
+
car={car}
|
|
296
|
+
mode={mode}
|
|
297
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
298
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
|
|
299
|
+
t={t}
|
|
300
|
+
/>
|
|
301
|
+
{/* ADV-405/407 Kreditkosten-Hinweis: below the conditions line, above the CTA row (mobile)
|
|
302
|
+
/ eco line (desktop); not on Kaufen, which shows no financing terms either. */}
|
|
303
|
+
{mode !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
342
304
|
</div>
|
|
343
305
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
344
306
|
rendered, with real fallbacks the page can override once it wires its own
|
package/cards/CarRow.tsx
CHANGED
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
ZeroDownChip,
|
|
43
43
|
fmtKm,
|
|
44
44
|
PaymentMode,
|
|
45
|
-
startPaymentMode,
|
|
46
45
|
ratingTone,
|
|
47
46
|
} from './cardParts';
|
|
48
47
|
import { AutobahnCar } from './types';
|
|
@@ -84,8 +83,6 @@ export interface CarRowProps {
|
|
|
84
83
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
85
84
|
/** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
|
|
86
85
|
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
87
|
-
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
88
|
-
initialMode?: PaymentMode;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -99,9 +96,8 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
99
96
|
adminAction,
|
|
100
97
|
onShowFinancingDetails,
|
|
101
98
|
onShowPriceRating,
|
|
102
|
-
initialMode,
|
|
103
99
|
}) => {
|
|
104
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
100
|
+
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
105
101
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
106
102
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
107
103
|
// The price-rating chip + bar link to the car's "Preis & Marktwert" section (page-owned
|
package/cards/cardParts.tsx
CHANGED
|
@@ -551,11 +551,6 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
|
|
|
551
551
|
|
|
552
552
|
export type PaymentMode = 'financing' | 'leasing' | 'buy';
|
|
553
553
|
|
|
554
|
-
/** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
|
|
555
|
-
* without a lease rate — PriceTabs has no Leasing tab for it. */
|
|
556
|
-
export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
|
|
557
|
-
requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
|
|
558
|
-
|
|
559
554
|
export interface PriceTabsProps {
|
|
560
555
|
car: AutobahnCar;
|
|
561
556
|
mode: PaymentMode;
|
|
@@ -790,12 +785,7 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
790
785
|
onShowDetails?: () => void;
|
|
791
786
|
t: TranslationFunction;
|
|
792
787
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
793
|
-
|
|
794
|
-
// here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
|
|
795
|
-
// real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
|
|
796
|
-
// every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
|
|
797
|
-
// FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
|
|
798
|
-
if (mode === 'buy') return <div className="cc-terms" />;
|
|
788
|
+
if (mode === 'buy') return null;
|
|
799
789
|
const finFirstInstallment =
|
|
800
790
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
801
791
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "1.0.219",
|
|
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",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
-
"@bytebrand/fe-financing": "^5.14.
|
|
13
|
+
"@bytebrand/fe-financing": "^5.14.31",
|
|
14
14
|
"classnames": "2.2.6",
|
|
15
15
|
"clsx": "^2.1.1",
|
|
16
16
|
"d3-format": "1.4.5",
|
package/theme/md3.css
CHANGED
|
@@ -10087,8 +10087,7 @@ line-height: 31px;
|
|
|
10087
10087
|
z-index: 71;
|
|
10088
10088
|
background: var(--md-surface);
|
|
10089
10089
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10090
|
-
|
|
10091
|
-
max-height: 92%;
|
|
10090
|
+
max-height: 92vh;
|
|
10092
10091
|
display: flex;
|
|
10093
10092
|
flex-direction: column;
|
|
10094
10093
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -14061,8 +14060,7 @@ color: #005CFF;
|
|
|
14061
14060
|
flex-direction: column;
|
|
14062
14061
|
width: 100%;
|
|
14063
14062
|
max-width: 560px;
|
|
14064
|
-
|
|
14065
|
-
max-height: 100%;
|
|
14063
|
+
max-height: calc(100vh - 32px);
|
|
14066
14064
|
background: var(--md-sc-lowest, #fff);
|
|
14067
14065
|
color: var(--md-on-surface);
|
|
14068
14066
|
border-radius: var(--md-r-lg);
|
|
@@ -14208,8 +14206,7 @@ color: #005CFF;
|
|
|
14208
14206
|
}
|
|
14209
14207
|
.md3 .mmodal {
|
|
14210
14208
|
max-width: 100%;
|
|
14211
|
-
|
|
14212
|
-
max-height: 92%;
|
|
14209
|
+
max-height: 92vh;
|
|
14213
14210
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14214
14211
|
border-bottom: 0;
|
|
14215
14212
|
animation: mmodal-sheet-up 0.25s ease-out;
|