@bytebrand/fe-ui-core-autobahn 1.0.225 → 1.0.227
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 +14 -52
- package/cards/CarRow.tsx +1 -5
- package/cards/cardParts.tsx +2 -12
- 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';
|
|
@@ -96,7 +95,7 @@ export interface CarCardProps {
|
|
|
96
95
|
onOpenRateAdjust?: (mode: PaymentMode) => void;
|
|
97
96
|
/**
|
|
98
97
|
* takes over the "Finanzierungsdetails"/"Details" link under the price row — e.g. navigate to
|
|
99
|
-
* this car's own VDP and open its finance modal already expanded
|
|
98
|
+
* this car's own VDP and open its finance modal already expanded/scrolled to the breakdown,
|
|
100
99
|
* instead of the default plain onOpen(car) navigation. Receives the tab the card was showing
|
|
101
100
|
* (Finanzierung/Leasing/Kaufen) so the destination modal opens on the same one. Optional/
|
|
102
101
|
* page-owned like onOpenRateAdjust; the mobile CTA row's "Rate anpassen" button is untouched
|
|
@@ -109,11 +108,6 @@ export interface CarCardProps {
|
|
|
109
108
|
* when omitted the badge is not a link (a click opens the car via onOpen, as before).
|
|
110
109
|
*/
|
|
111
110
|
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
112
|
-
/**
|
|
113
|
-
* Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
|
|
114
|
-
* open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
|
|
115
|
-
*/
|
|
116
|
-
initialMode?: PaymentMode;
|
|
117
111
|
/**
|
|
118
112
|
* The campaign (campaign/campaigns.ts), e.g. CAMPAIGNS.blackFriday: its band is put on top of the card
|
|
119
113
|
* while the campaign runs and applies to this car. The band takes its height from the photo, so the card is as
|
|
@@ -136,10 +130,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
136
130
|
onOpenRateAdjust,
|
|
137
131
|
onShowFinancingDetails,
|
|
138
132
|
onShowPriceRating,
|
|
139
|
-
initialMode,
|
|
140
133
|
campaign,
|
|
141
134
|
}) => {
|
|
142
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
135
|
+
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
143
136
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
144
137
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
145
138
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -173,8 +166,6 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
173
166
|
}, [eagerMedia]);
|
|
174
167
|
const { drop: showDrop, save: showSave, percent: showPct, offer: showOfferBadge, neu: showNeu } = dealSignals(car);
|
|
175
168
|
const activeCampaign = campaignFor(car, campaign);
|
|
176
|
-
// tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
|
|
177
|
-
const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
|
|
178
169
|
return (
|
|
179
170
|
<article
|
|
180
171
|
className={'mcard mcard--interactive cc-card' + (activeCampaign ? ' mcard--campaign' : '')}
|
|
@@ -298,50 +289,21 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
298
289
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
299
290
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
300
291
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
301
|
-
{
|
|
302
|
-
visible, bottom-aligned — Kaufen's struck list price sits on its own line above
|
|
303
|
-
the price, so without this the row (and the card) grew/shrank by that line on
|
|
304
|
-
every tab switch. Same trick as .cc-terms-stack below. */}
|
|
305
|
-
<div className="cc-hero-stack">
|
|
306
|
-
{paymentModes.map((m) => (
|
|
307
|
-
<div
|
|
308
|
-
key={m}
|
|
309
|
-
className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
|
|
310
|
-
aria-hidden={m === mode ? undefined : true}
|
|
311
|
-
>
|
|
312
|
-
<PriceHero car={car} mode={m} t={t} alwaysShowUnit />
|
|
313
|
-
</div>
|
|
314
|
-
))}
|
|
315
|
-
</div>
|
|
292
|
+
<PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
|
|
316
293
|
<PriceEvalCol car={car} t={t} onActivate={onShowPriceRating ? () => onShowPriceRating(car) : undefined} />
|
|
317
294
|
</div>
|
|
318
295
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
319
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
{
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
>
|
|
331
|
-
<PriceTerms
|
|
332
|
-
car={car}
|
|
333
|
-
mode={m}
|
|
334
|
-
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
335
|
-
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
|
|
336
|
-
t={t}
|
|
337
|
-
/>
|
|
338
|
-
{/* ADV-405/407 Kreditkosten-Hinweis under the financing/leasing conditions line. Inside the
|
|
339
|
-
slot, so the stack keeps one height across the tabs (no jump on Kaufen); hidden slots
|
|
340
|
-
are visibility:hidden + aria-hidden like their terms line. */}
|
|
341
|
-
{m !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
342
|
-
</div>
|
|
343
|
-
))}
|
|
344
|
-
</div>
|
|
296
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
|
|
297
|
+
<PriceTerms
|
|
298
|
+
car={car}
|
|
299
|
+
mode={mode}
|
|
300
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
301
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
|
|
302
|
+
t={t}
|
|
303
|
+
/>
|
|
304
|
+
{/* ADV-405/407 Kreditkosten-Hinweis: below the conditions line, above the CTA row (mobile)
|
|
305
|
+
/ eco line (desktop); not on Kaufen, which shows no financing terms either. */}
|
|
306
|
+
{mode !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
345
307
|
</div>
|
|
346
308
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
347
309
|
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 CampaignBand from '../campaign/CampaignBand';
|
|
@@ -88,8 +87,6 @@ export interface CarRowProps {
|
|
|
88
87
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
89
88
|
/** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
|
|
90
89
|
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
91
|
-
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
92
|
-
initialMode?: PaymentMode;
|
|
93
90
|
/** The running campaign, its band spans the whole row — see CarCard's identically-named prop. */
|
|
94
91
|
campaign?: Campaign | null;
|
|
95
92
|
}
|
|
@@ -105,10 +102,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
105
102
|
adminAction,
|
|
106
103
|
onShowFinancingDetails,
|
|
107
104
|
onShowPriceRating,
|
|
108
|
-
initialMode,
|
|
109
105
|
campaign,
|
|
110
106
|
}) => {
|
|
111
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
107
|
+
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
112
108
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
113
109
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
114
110
|
// 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;
|
|
@@ -784,18 +779,13 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
784
779
|
mode: PaymentMode;
|
|
785
780
|
onOpenRateAdjust?: (mode: PaymentMode) => void;
|
|
786
781
|
/** takes over the "Finanzierungsdetails"/"Details" link's click (e.g. navigate to the VDP and
|
|
787
|
-
* open the finance modal already expanded,
|
|
782
|
+
* open the finance modal already expanded, scrolled to the breakdown) — when given, it wins
|
|
788
783
|
* over onOpenRateAdjust for THIS link only; the mobile CTA row's own "Rate anpassen" button
|
|
789
784
|
* keeps using onOpenRateAdjust regardless. */
|
|
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.227",
|
|
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
|
@@ -10770,8 +10770,7 @@ line-height: 31px;
|
|
|
10770
10770
|
z-index: 71;
|
|
10771
10771
|
background: var(--md-surface);
|
|
10772
10772
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10773
|
-
|
|
10774
|
-
max-height: 92%;
|
|
10773
|
+
max-height: 92vh;
|
|
10775
10774
|
display: flex;
|
|
10776
10775
|
flex-direction: column;
|
|
10777
10776
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -14759,8 +14758,7 @@ color: #005CFF;
|
|
|
14759
14758
|
flex-direction: column;
|
|
14760
14759
|
width: 100%;
|
|
14761
14760
|
max-width: 560px;
|
|
14762
|
-
|
|
14763
|
-
max-height: 100%;
|
|
14761
|
+
max-height: calc(100vh - 32px);
|
|
14764
14762
|
background: var(--md-sc-lowest, #fff);
|
|
14765
14763
|
color: var(--md-on-surface);
|
|
14766
14764
|
border-radius: var(--md-r-lg);
|
|
@@ -14906,8 +14904,7 @@ color: #005CFF;
|
|
|
14906
14904
|
}
|
|
14907
14905
|
.md3 .mmodal {
|
|
14908
14906
|
max-width: 100%;
|
|
14909
|
-
|
|
14910
|
-
max-height: 92%;
|
|
14907
|
+
max-height: 92vh;
|
|
14911
14908
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14912
14909
|
border-bottom: 0;
|
|
14913
14910
|
animation: mmodal-sheet-up 0.25s ease-out;
|