@bytebrand/fe-ui-core-autobahn 1.0.223 → 1.0.225
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/campaign/CampaignBand.tsx +26 -0
- package/campaign/CampaignBanner.tsx +86 -0
- package/campaign/CampaignBar.tsx +37 -0
- package/campaign/CampaignHero.tsx +50 -0
- package/campaign/CampaignSwitch.tsx +43 -0
- package/campaign/campaignVars.ts +12 -0
- package/campaign/campaigns.ts +74 -0
- package/campaign/index.ts +18 -0
- package/campaign/openInApp.ts +8 -0
- package/campaign/useCountdown.ts +28 -0
- package/cards/CarCard.tsx +68 -27
- package/cards/CarRow.tsx +18 -14
- package/cards/cardParts.tsx +12 -2
- package/cards/dealSignals.ts +36 -0
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/index.ts +1 -0
- package/locales/de/autobahn.json +23 -0
- package/locales/en/autobahn.json +23 -0
- package/package.json +30 -30
- package/theme/md3.css +656 -3
- package/vdp/VdpModules.tsx +9 -23
package/cards/cardParts.tsx
CHANGED
|
@@ -551,6 +551,11 @@ 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
|
+
|
|
554
559
|
export interface PriceTabsProps {
|
|
555
560
|
car: AutobahnCar;
|
|
556
561
|
mode: PaymentMode;
|
|
@@ -779,13 +784,18 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
779
784
|
mode: PaymentMode;
|
|
780
785
|
onOpenRateAdjust?: (mode: PaymentMode) => void;
|
|
781
786
|
/** takes over the "Finanzierungsdetails"/"Details" link's click (e.g. navigate to the VDP and
|
|
782
|
-
* open the finance modal already expanded,
|
|
787
|
+
* open the finance modal already expanded, at its top) — when given, it wins
|
|
783
788
|
* over onOpenRateAdjust for THIS link only; the mobile CTA row's own "Rate anpassen" button
|
|
784
789
|
* keeps using onOpenRateAdjust regardless. */
|
|
785
790
|
onShowDetails?: () => void;
|
|
786
791
|
t: TranslationFunction;
|
|
787
792
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
788
|
-
|
|
793
|
+
// Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
|
|
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" />;
|
|
789
799
|
const finFirstInstallment =
|
|
790
800
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
791
801
|
const finMonths = car.finMonths ?? _finMonths;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Autobahn (auto.de redesign) — which deal signals a card shows for a car.
|
|
2
|
+
//
|
|
3
|
+
// One rule for CarCard, CarRow, the vehicle page's gallery and the campaigns (campaign/campaigns.ts), so "this card shows the green −X € and the
|
|
4
|
+
// red −X % chip" means the same everywhere.
|
|
5
|
+
|
|
6
|
+
import { AutobahnCar } from './types';
|
|
7
|
+
|
|
8
|
+
export type DealSource = Pick<AutobahnCar, 'asGoodAsNew' | 'drop' | 'dropPct' | 'savings' | 'isNew' | 'zeroDown'>;
|
|
9
|
+
|
|
10
|
+
export interface DealSignals {
|
|
11
|
+
/** DropChip, "−X € zum UVP". */
|
|
12
|
+
drop: boolean;
|
|
13
|
+
/** SaveChip (only without a drop). */
|
|
14
|
+
save: boolean;
|
|
15
|
+
/** PercentChip, "−X %". */
|
|
16
|
+
percent: boolean;
|
|
17
|
+
/** OfferBadge, "Angebot". */
|
|
18
|
+
offer: boolean;
|
|
19
|
+
/** NEU badge. */
|
|
20
|
+
neu: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const dealSignals = (car: DealSource): DealSignals => {
|
|
24
|
+
// as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
|
|
25
|
+
// undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
|
|
26
|
+
const asGoodAsNew = car.asGoodAsNew !== false;
|
|
27
|
+
const drop = asGoodAsNew && car.drop != null;
|
|
28
|
+
const save = asGoodAsNew && !drop && car.savings != null && car.savings > 600;
|
|
29
|
+
const percent = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
|
|
30
|
+
const offer = !!(car.isNew || drop || save || percent || car.zeroDown);
|
|
31
|
+
// PM call: the badge row only fits 3 pills — when Drop/Save + Percent + ZeroDown are all
|
|
32
|
+
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
33
|
+
const activeChips = [drop || save, percent, !!car.zeroDown].filter(Boolean).length;
|
|
34
|
+
const neu = asGoodAsNew && !!car.isNew && activeChips < 3;
|
|
35
|
+
return { drop, save, percent, offer, neu };
|
|
36
|
+
};
|
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/index.ts
CHANGED
package/locales/de/autobahn.json
CHANGED
|
@@ -64,6 +64,29 @@
|
|
|
64
64
|
"offer": "Angebot"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
"campaign": {
|
|
68
|
+
"days": "Tag",
|
|
69
|
+
"days_plural": "Tage",
|
|
70
|
+
"hours": "Std",
|
|
71
|
+
"minutes": "Min",
|
|
72
|
+
"timeLeft": "Noch {{days}} Tage, {{hours}} Stunden und {{minutes}} Minuten",
|
|
73
|
+
"vehicles": "{{number}} Fahrzeug",
|
|
74
|
+
"vehicles_plural": "{{number}} Fahrzeuge",
|
|
75
|
+
"endsInDays": "Endet in {{days}} T {{hours}} Std",
|
|
76
|
+
"endsInHours": "Endet in {{hours}} Std {{minutes}} Min",
|
|
77
|
+
"exampleCars": "Beispielfahrzeuge",
|
|
78
|
+
"blackFriday": {
|
|
79
|
+
"label": "Black Friday",
|
|
80
|
+
"only": "Nur Black-Friday-Angebote",
|
|
81
|
+
"offer": "Spare bis zu 35 %",
|
|
82
|
+
"bannerTitle": "Bis zu 35 % sparen",
|
|
83
|
+
"cta": "Angebote ansehen",
|
|
84
|
+
"period": "Black Friday Week · {{from}}–{{to}}",
|
|
85
|
+
"title": "Bis zu 35 % günstiger.",
|
|
86
|
+
"text": "Ausgewählte Fahrzeuge mit reduziertem Kaufpreis. Nur solange die Aktion läuft.",
|
|
87
|
+
"legal": "Durchgestrichene Preise zeigen den niedrigsten Gesamtpreis des jeweiligen Fahrzeugs in den letzten 30 Tagen vor der Preisermäßigung (§ 11 PAngV)."
|
|
88
|
+
}
|
|
89
|
+
},
|
|
67
90
|
"finance": {
|
|
68
91
|
"creditCostWarning": "Achtung! Kreditaufnahme kostet Geld.",
|
|
69
92
|
"kfMonths": "{{months}} Mon.",
|
package/locales/en/autobahn.json
CHANGED
|
@@ -64,6 +64,29 @@
|
|
|
64
64
|
"offer": "Offer"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
"campaign": {
|
|
68
|
+
"days": "Day",
|
|
69
|
+
"days_plural": "Days",
|
|
70
|
+
"hours": "Hrs",
|
|
71
|
+
"minutes": "Min",
|
|
72
|
+
"timeLeft": "{{days}} days, {{hours}} hours and {{minutes}} minutes left",
|
|
73
|
+
"vehicles": "{{number}} vehicle",
|
|
74
|
+
"vehicles_plural": "{{number}} vehicles",
|
|
75
|
+
"endsInDays": "Ends in {{days}}d {{hours}}h",
|
|
76
|
+
"endsInHours": "Ends in {{hours}}h {{minutes}}m",
|
|
77
|
+
"exampleCars": "Example vehicles",
|
|
78
|
+
"blackFriday": {
|
|
79
|
+
"label": "Black Friday",
|
|
80
|
+
"only": "Black Friday offers only",
|
|
81
|
+
"offer": "Save up to 35%",
|
|
82
|
+
"bannerTitle": "Save up to 35%",
|
|
83
|
+
"cta": "View offers",
|
|
84
|
+
"period": "Black Friday Week · {{from}}–{{to}}",
|
|
85
|
+
"title": "Save up to 35%.",
|
|
86
|
+
"text": "Selected vehicles at a reduced purchase price. Only while the campaign lasts.",
|
|
87
|
+
"legal": "Struck-through prices show the lowest total price of the respective vehicle in the 30 days before the price reduction (Section 11 PAngV)."
|
|
88
|
+
}
|
|
89
|
+
},
|
|
67
90
|
"finance": {
|
|
68
91
|
"creditCostWarning": "Warning! Financing comes at a cost.",
|
|
69
92
|
"kfMonths": "{{months}} mo.",
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
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
|
-
"main": "index.ts",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
|
-
"peerDependencies": {
|
|
8
|
-
"react": "^18.0.0",
|
|
9
|
-
"react-dom": "^18.0.0"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
-
"@bytebrand/fe-financing": "^5.14.
|
|
14
|
-
"classnames": "2.2.6",
|
|
15
|
-
"clsx": "^2.1.1",
|
|
16
|
-
"d3-format": "1.4.5",
|
|
17
|
-
"js-cookie": "^2.2.0",
|
|
18
|
-
"lodash": "^4.17.21",
|
|
19
|
-
"lucide-react": "^0.288.0",
|
|
20
|
-
"mobx-react": "^7.6.0",
|
|
21
|
-
"moment": "^2.29.1",
|
|
22
|
-
"qs": "^6.6.0",
|
|
23
|
-
"react-device-detect": "^2.1.2",
|
|
24
|
-
"react-grid-system": "^5.0.2",
|
|
25
|
-
"react-lazyload": "^3.2.0",
|
|
26
|
-
"react-scroll": "^1.9.3",
|
|
27
|
-
"react-slick": "^0.29.0",
|
|
28
|
-
"slick-carousel": "1.8.1"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
+
"version": "1.0.225",
|
|
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
|
+
"main": "index.ts",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": "^18.0.0",
|
|
9
|
+
"react-dom": "^18.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
+
"@bytebrand/fe-financing": "^5.14.30",
|
|
14
|
+
"classnames": "2.2.6",
|
|
15
|
+
"clsx": "^2.1.1",
|
|
16
|
+
"d3-format": "1.4.5",
|
|
17
|
+
"js-cookie": "^2.2.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"lucide-react": "^0.288.0",
|
|
20
|
+
"mobx-react": "^7.6.0",
|
|
21
|
+
"moment": "^2.29.1",
|
|
22
|
+
"qs": "^6.6.0",
|
|
23
|
+
"react-device-detect": "^2.1.2",
|
|
24
|
+
"react-grid-system": "^5.0.2",
|
|
25
|
+
"react-lazyload": "^3.2.0",
|
|
26
|
+
"react-scroll": "^1.9.3",
|
|
27
|
+
"react-slick": "^0.29.0",
|
|
28
|
+
"slick-carousel": "1.8.1"
|
|
29
|
+
}
|
|
30
|
+
}
|