@bytebrand/fe-ui-core-autobahn 1.0.186 → 1.0.187
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 +47 -10
- package/cards/CarRow.tsx +5 -1
- package/cards/cardParts.tsx +11 -1
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/locales/de/autobahn.json +3 -3
- package/locales/en/autobahn.json +3 -3
- package/package.json +2 -2
- package/theme/md3.css +6 -3
package/cards/CarCard.tsx
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
GalleryActivityPill,
|
|
39
39
|
cardSpec,
|
|
40
40
|
PaymentMode,
|
|
41
|
+
startPaymentMode,
|
|
41
42
|
callDealerSalesPhone,
|
|
42
43
|
DEALER_SALES_PHONE,
|
|
43
44
|
} from './cardParts';
|
|
@@ -98,6 +99,11 @@ export interface CarCardProps {
|
|
|
98
99
|
* (still onOpenRateAdjust).
|
|
99
100
|
*/
|
|
100
101
|
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;
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -113,8 +119,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
113
119
|
onCall,
|
|
114
120
|
onOpenRateAdjust,
|
|
115
121
|
onShowFinancingDetails,
|
|
122
|
+
initialMode,
|
|
116
123
|
}) => {
|
|
117
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
124
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
118
125
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
119
126
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
120
127
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -157,6 +164,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
157
164
|
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
158
165
|
const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
|
|
159
166
|
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'];
|
|
160
169
|
return (
|
|
161
170
|
<article
|
|
162
171
|
className="mcard mcard--interactive cc-card"
|
|
@@ -277,18 +286,46 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
277
286
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
278
287
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
279
288
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
280
|
-
|
|
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>
|
|
281
304
|
<PriceEvalCol car={car} t={t} />
|
|
282
305
|
</div>
|
|
283
306
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
284
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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>
|
|
292
329
|
</div>
|
|
293
330
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
294
331
|
rendered, with real fallbacks the page can override once it wires its own
|
package/cards/CarRow.tsx
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
ZeroDownChip,
|
|
42
42
|
fmtKm,
|
|
43
43
|
PaymentMode,
|
|
44
|
+
startPaymentMode,
|
|
44
45
|
ratingTone,
|
|
45
46
|
} from './cardParts';
|
|
46
47
|
import { AutobahnCar } from './types';
|
|
@@ -80,6 +81,8 @@ export interface CarRowProps {
|
|
|
80
81
|
* links render as plain text (see PricePaths' own fallback).
|
|
81
82
|
*/
|
|
82
83
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
84
|
+
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
85
|
+
initialMode?: PaymentMode;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -92,8 +95,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
92
95
|
t,
|
|
93
96
|
adminAction,
|
|
94
97
|
onShowFinancingDetails,
|
|
98
|
+
initialMode,
|
|
95
99
|
}) => {
|
|
96
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
100
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
97
101
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
98
102
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
99
103
|
// always call the LATEST onMediaEnter without re-arming the observer on every render (the
|
package/cards/cardParts.tsx
CHANGED
|
@@ -489,6 +489,11 @@ 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
|
+
|
|
492
497
|
export interface PriceTabsProps {
|
|
493
498
|
car: AutobahnCar;
|
|
494
499
|
mode: PaymentMode;
|
|
@@ -710,7 +715,12 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
710
715
|
onShowDetails?: () => void;
|
|
711
716
|
t: TranslationFunction;
|
|
712
717
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
713
|
-
|
|
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" />;
|
|
714
724
|
const finFirstInstallment =
|
|
715
725
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
716
726
|
const finMonths = car.finMonths ?? _finMonths;
|
package/constants/app.ts
CHANGED
|
@@ -40,7 +40,17 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
40
40
|
i18n_KEY: 'i18nLanguage'
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
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';
|
|
44
54
|
|
|
45
55
|
// Default support contact phone
|
|
46
56
|
export const CONTACT_PHONE: string = '+498004030182';
|
package/constants/core.ts
CHANGED
|
@@ -35,7 +35,18 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
35
35
|
i18n_KEY: 'i18nLanguage'
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
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';
|
|
39
50
|
|
|
40
51
|
export const ROW_STYLES = {
|
|
41
52
|
marginBottom: 10
|
package/locales/de/autobahn.json
CHANGED
|
@@ -752,11 +752,11 @@
|
|
|
752
752
|
"lenderLabel": "Darlehensgeber:",
|
|
753
753
|
"lenderName": "Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach",
|
|
754
754
|
"leaseLenderLabel": "Leasinggeber:",
|
|
755
|
-
"leaseLenderName": "
|
|
755
|
+
"leaseLenderName": "Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach",
|
|
756
756
|
"contractTypeLabel": "Vertragsart:",
|
|
757
757
|
"contractTypeValue": "Restwertleasing",
|
|
758
758
|
"packageMandatoryNotice": "Das Rundum-Sorglos-Paket ist verpflichtend. In der dargestellten Konfiguration ist es als Einmalzahlung von {{amount}} € zu leisten und nicht in der Monatsrate enthalten. Bei Rateneinrechnung werden Monatsrate und Gesamtbeträge entsprechend angepasst.",
|
|
759
|
-
"legalFootnoteAcquisitionPrice": "¹ Der Anschaffungspreis bezeichnet den Preis, den die
|
|
759
|
+
"legalFootnoteAcquisitionPrice": "¹ Der Anschaffungspreis bezeichnet den Preis, den die Openbank Deutschland AG für das Fahrzeug zu bezahlen hat.",
|
|
760
760
|
"legalFootnoteListPriceLease": "² Listenpreis (UVP) = unverbindliche Preisempfehlung des Herstellers.",
|
|
761
761
|
"closingDisclaimerLine1": "Änderungen und Irrtümer vorbehalten. Farbe und Ausstattung können vom Angebot abweichen.",
|
|
762
762
|
"closingDisclaimerLine2": "Kostenpflichtige Sonderausstattung möglich.",
|
|
@@ -767,7 +767,7 @@
|
|
|
767
767
|
"legalNoticeVat": "Alle Preisangaben inkl. der jeweils gesetzlich gültigen MwSt., derzeit 19 %.",
|
|
768
768
|
"legalNoticeAddServices": "Das Rundum-Sorglos-Paket ist eine einmalige Zahlung.",
|
|
769
769
|
"listPriceFootnote": "³ Listenpreis (UVP) = unverbindliche Preisempfehlung des Herstellers.",
|
|
770
|
-
"legalLeasing": "Für Ihre Finanzierungswünsche stellen wir eine Bonitätsanfrage. Bonität vorausgesetzt, ist dies ein repräsentatives Berechnungsbeispiel gem. der Angaben, welches 2/3 aller Kunden, im Sinne des § 17a Abs. 4 PangV, erhalten. Dieses freibleibende Angebot der
|
|
770
|
+
"legalLeasing": "Für Ihre Finanzierungswünsche stellen wir eine Bonitätsanfrage. Bonität vorausgesetzt, ist dies ein repräsentatives Berechnungsbeispiel gem. der Angaben, welches 2/3 aller Kunden, im Sinne des § 17a Abs. 4 PangV, erhalten. Dieses freibleibende Angebot der Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach wird vermittelt durch die auto.de GmbH, Max-Planck-Str. 19, 06796 Sandersdorf-Brehna, die als ungebundener Vermittler nicht beratend tätig ist. Irrtümer vorbehalten. Preise ggf. inkl. MwSt.",
|
|
771
771
|
"legalFinancing": "Für Ihre Finanzierungswünsche stellen wir eine Bonitätsanfrage. Bonität vorausgesetzt, ist dies ein repräsentatives Berechnungsbeispiel gem. der Angaben, welches 2/3 aller Kunden, im Sinne des § 17a Abs. 4 PangV, erhalten. Dieses freibleibende Angebot der Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach wird vermittelt durch die auto.de GmbH, Max-Planck-Str. 19, 06796 Sandersdorf-Brehna, die als ungebundener Vermittler nicht beratend tätig ist. Irrtümer vorbehalten. Preise ggf. inkl. MwSt.",
|
|
772
772
|
"sheetTitleFinancing": "Kredit-Rate anpassen",
|
|
773
773
|
"sheetTitleLeasing": "Leasing-Rate anpassen",
|
package/locales/en/autobahn.json
CHANGED
|
@@ -752,11 +752,11 @@
|
|
|
752
752
|
"lenderLabel": "Lender:",
|
|
753
753
|
"lenderName": "Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach",
|
|
754
754
|
"leaseLenderLabel": "Lessor:",
|
|
755
|
-
"leaseLenderName": "
|
|
755
|
+
"leaseLenderName": "Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach",
|
|
756
756
|
"contractTypeLabel": "Contract type:",
|
|
757
757
|
"contractTypeValue": "Residual value leasing",
|
|
758
758
|
"packageMandatoryNotice": "The complete care package is mandatory. In the configuration shown, it must be paid as a one-time payment of {{amount}} € and is not included in the monthly rate. If rolled into the installments, the monthly rate and totals are adjusted accordingly.",
|
|
759
|
-
"legalFootnoteAcquisitionPrice": "¹ The acquisition price denotes the price
|
|
759
|
+
"legalFootnoteAcquisitionPrice": "¹ The acquisition price denotes the price Openbank Deutschland AG pays for the vehicle.",
|
|
760
760
|
"legalFootnoteListPriceLease": "² List price (RRP) = manufacturer's non-binding recommended retail price.",
|
|
761
761
|
"closingDisclaimerLine1": "Subject to change and errors. Color and equipment may differ from the offer shown.",
|
|
762
762
|
"closingDisclaimerLine2": "Optional equipment may incur additional costs.",
|
|
@@ -767,7 +767,7 @@
|
|
|
767
767
|
"legalNoticeVat": "All prices incl. the applicable statutory VAT, currently 19%.",
|
|
768
768
|
"legalNoticeAddServices": "The all-round care package is a one-time payment.",
|
|
769
769
|
"listPriceFootnote": "³ List price (RRP) = manufacturer's non-binding recommended retail price.",
|
|
770
|
-
"legalLeasing": "We run a credit check for your financing request. Subject to creditworthiness, this is a representative example per § 17a (4) PangV received by 2/3 of all customers. This non-binding offer of
|
|
770
|
+
"legalLeasing": "We run a credit check for your financing request. Subject to creditworthiness, this is a representative example per § 17a (4) PangV received by 2/3 of all customers. This non-binding offer of Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach is brokered by auto.de GmbH, Max-Planck-Str. 19, 06796 Sandersdorf-Brehna, acting as an untied intermediary without advising. Errors excepted. Prices may incl. VAT.",
|
|
771
771
|
"legalFinancing": "We run a credit check for your financing request. Subject to creditworthiness, this is a representative example per § 17a (4) PangV received by 2/3 of all customers. This non-binding offer of Openbank Deutschland AG, Santander-Platz 1, 41061 Mönchengladbach is brokered by auto.de GmbH, Max-Planck-Str. 19, 06796 Sandersdorf-Brehna, acting as an untied intermediary without advising. Errors excepted. Prices may incl. VAT.",
|
|
772
772
|
"sheetTitleFinancing": "Adjust credit rate",
|
|
773
773
|
"sheetTitleLeasing": "Adjust leasing rate",
|
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.187",
|
|
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.30",
|
|
14
14
|
"classnames": "2.2.6",
|
|
15
15
|
"clsx": "^2.1.1",
|
|
16
16
|
"d3-format": "1.4.5",
|
package/theme/md3.css
CHANGED
|
@@ -10100,7 +10100,8 @@ 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
|
-
|
|
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%;
|
|
10104
10105
|
display: flex;
|
|
10105
10106
|
flex-direction: column;
|
|
10106
10107
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -14258,7 +14259,8 @@ color: #005CFF;
|
|
|
14258
14259
|
flex-direction: column;
|
|
14259
14260
|
width: 100%;
|
|
14260
14261
|
max-width: 560px;
|
|
14261
|
-
|
|
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%;
|
|
14262
14264
|
background: var(--md-sc-lowest, #fff);
|
|
14263
14265
|
color: var(--md-on-surface);
|
|
14264
14266
|
border-radius: var(--md-r-lg);
|
|
@@ -14404,7 +14406,8 @@ color: #005CFF;
|
|
|
14404
14406
|
}
|
|
14405
14407
|
.md3 .mmodal {
|
|
14406
14408
|
max-width: 100%;
|
|
14407
|
-
|
|
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%;
|
|
14408
14411
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14409
14412
|
border-bottom: 0;
|
|
14410
14413
|
animation: mmodal-sheet-up 0.25s ease-out;
|