@bytebrand/fe-ui-core-autobahn 1.0.54 → 1.0.56
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/constants/autobahn.ts +69 -68
- package/constants.ts +31 -31
- package/data/toAutobahnCar.ts +4 -5
- package/locales/de/autobahn.json +790 -783
- package/locales/en/autobahn.json +790 -783
- package/package.json +2 -5
- package/theme/autobahn.css +7 -4
- package/theme/md3.css +8184 -1585
- package/ui/CardCarousel.tsx +6 -2
- package/utils/financeFormat.ts +62 -62
- package/utils/priceRating.ts +58 -57
- package/vdp/FinanceCalculator.tsx +746 -651
- package/vdp/VdpModules.tsx +2995 -2384
- package/vdp/VdpViewer.tsx +698 -99
- package/cards/types.d.ts +0 -112
- package/cards/types.js +0 -14
- package/constants/autobahn.d.ts +0 -22
- package/constants/autobahn.js +0 -57
- package/constants/core.d.ts +0 -152
- package/constants/core.js +0 -125
- package/constants/price.d.ts +0 -2
- package/constants/price.js +0 -11
- package/constants/selectors.d.ts +0 -11
- package/constants/selectors.js +0 -32
- package/data/toAutobahnCar.d.ts +0 -89
- package/data/toAutobahnCar.js +0 -421
- package/tsconfig.node-safe.json +0 -25
- package/utils/DateUtils.d.ts +0 -21
- package/utils/DateUtils.js +0 -97
- package/utils/financeFormat.d.ts +0 -32
- package/utils/financeFormat.js +0 -42
- package/utils/power.d.ts +0 -1
- package/utils/power.js +0 -14
- package/utils/priceRating.d.ts +0 -3
- package/utils/priceRating.js +0 -55
package/constants/autobahn.ts
CHANGED
|
@@ -1,68 +1,69 @@
|
|
|
1
|
-
// Autobahn (auto.de redesign) — shared lookup constants.
|
|
2
|
-
// Typed replacement for the design kit's `window.*` globals (data.jsx / ui.jsx / CdpModules.jsx).
|
|
3
|
-
// Pure data only — no DOM, no store access, no further imports. Split out of the package-root
|
|
4
|
-
// `constants.ts` barrel so this file (and its importers) can be required WITHOUT also pulling in
|
|
5
|
-
// `./constants/Search` (which `require()`s image assets — webpack-only, breaks any plain Node
|
|
6
|
-
// consumer). `data/toAutobahnCar.ts` imports directly from here for that reason
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// NOTE on counts: the BODY_TYPES / QUICK_FILTERS sample counts below are the design's
|
|
10
|
-
// placeholder figures. They are only used by the W2 filter UI, which will replace them with
|
|
11
|
-
// REAL aggregation counts from searchStore.aggregation. They are not rendered as real data in W1.
|
|
12
|
-
|
|
13
|
-
/** Pkw-EnVKV CO₂ efficiency classes (best → worst) and their band colors. */
|
|
14
|
-
export const CO2_CLASSES = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] as const;
|
|
15
|
-
export type Co2Class = (typeof CO2_CLASSES)[number];
|
|
16
|
-
export const CO2_COLORS: readonly string[] = [
|
|
17
|
-
'#1FA01F', '#5DAE2E', '#9FC21C', '#F2C200', '#F2900D', '#E8601A', '#D4202B',
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
/** Preisbewertung (price-rating) tiers, index 0 = Top … 4 = Hoch. green → red. */
|
|
21
|
-
export const TIER_LABELS = ['Top Preis', 'Guter Preis', 'Fairer Preis', 'Erhöht', 'Hoher Preis'] as const;
|
|
22
|
-
// i18n key suffixes parallel to TIER_LABELS — components render t('autobahn:tier.<key>') so the
|
|
23
|
-
// Preisbewertung label localizes (TIER_LABELS stays the German source-of-truth used for tier→index logic).
|
|
24
|
-
export const TIER_KEYS = ['top', 'good', 'fair', 'raised', 'high'] as const;
|
|
25
|
-
export const TIER_COLORS: readonly string[] = ['#
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'
|
|
32
|
-
'Preis
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
['
|
|
44
|
-
['
|
|
45
|
-
['
|
|
46
|
-
['
|
|
47
|
-
['
|
|
48
|
-
['
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
['
|
|
61
|
-
['
|
|
62
|
-
['
|
|
63
|
-
['
|
|
64
|
-
['
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
// Autobahn (auto.de redesign) — shared lookup constants.
|
|
2
|
+
// Typed replacement for the design kit's `window.*` globals (data.jsx / ui.jsx / CdpModules.jsx).
|
|
3
|
+
// Pure data only — no DOM, no store access, no further imports. Split out of the package-root
|
|
4
|
+
// `constants.ts` barrel so this file (and its importers) can be required WITHOUT also pulling in
|
|
5
|
+
// `./constants/Search` (which `require()`s image assets — webpack-only, breaks any plain Node
|
|
6
|
+
// consumer). `data/toAutobahnCar.ts` imports directly from here for that reason.
|
|
7
|
+
// `constants.ts` re-exports everything here unchanged.
|
|
8
|
+
//
|
|
9
|
+
// NOTE on counts: the BODY_TYPES / QUICK_FILTERS sample counts below are the design's
|
|
10
|
+
// placeholder figures. They are only used by the W2 filter UI, which will replace them with
|
|
11
|
+
// REAL aggregation counts from searchStore.aggregation. They are not rendered as real data in W1.
|
|
12
|
+
|
|
13
|
+
/** Pkw-EnVKV CO₂ efficiency classes (best → worst) and their band colors. */
|
|
14
|
+
export const CO2_CLASSES = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] as const;
|
|
15
|
+
export type Co2Class = (typeof CO2_CLASSES)[number];
|
|
16
|
+
export const CO2_COLORS: readonly string[] = [
|
|
17
|
+
'#1FA01F', '#5DAE2E', '#9FC21C', '#F2C200', '#F2900D', '#E8601A', '#D4202B',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/** Preisbewertung (price-rating) tiers, index 0 = Top … 4 = Hoch. green → red. */
|
|
21
|
+
export const TIER_LABELS = ['Top Preis', 'Guter Preis', 'Fairer Preis', 'Erhöht', 'Hoher Preis'] as const;
|
|
22
|
+
// i18n key suffixes parallel to TIER_LABELS — components render t('autobahn:tier.<key>') so the
|
|
23
|
+
// Preisbewertung label localizes (TIER_LABELS stays the German source-of-truth used for tier→index logic).
|
|
24
|
+
export const TIER_KEYS = ['top', 'good', 'fair', 'raised', 'high'] as const;
|
|
25
|
+
export const TIER_COLORS: readonly string[] = ['#168A45', '#66B84D', '#F7C544', '#F26B43', '#E60000'];
|
|
26
|
+
export const TIER_BACKGROUNDS: readonly string[] = ['#DFF3E5', '#E4F3DF', '#FFF6DB', '#FFEFD5', '#FFD3D3'];
|
|
27
|
+
export type RatingTier = 0 | 1 | 2 | 3 | 4;
|
|
28
|
+
|
|
29
|
+
/** SRP sort options (labels match the design; mapped to real sort params by the SRP container). */
|
|
30
|
+
export const SORTS = [
|
|
31
|
+
'Relevanz',
|
|
32
|
+
'Preis aufsteigend',
|
|
33
|
+
'Preis absteigend',
|
|
34
|
+
'Erstzulassung',
|
|
35
|
+
'Kilometerstand',
|
|
36
|
+
'Leistung',
|
|
37
|
+
] as const;
|
|
38
|
+
export type SortLabel = (typeof SORTS)[number];
|
|
39
|
+
|
|
40
|
+
/** Quick-filter chips for the srp-bar: [lucide icon, label, defaultActive?]. */
|
|
41
|
+
export type QuickFilter = readonly [icon: string, label: string, defaultActive?: boolean];
|
|
42
|
+
export const QUICK_FILTERS: readonly QuickFilter[] = [
|
|
43
|
+
['sliders-horizontal', 'Filter', true],
|
|
44
|
+
['fuel', 'Diesel'],
|
|
45
|
+
['cog', 'Automatik'],
|
|
46
|
+
['battery-charging', 'Hybrid'],
|
|
47
|
+
['gauge', 'bis 50.000 km'],
|
|
48
|
+
['wallet', 'bis 300 €/mtl.'],
|
|
49
|
+
['calendar', 'ab 2022'],
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
/** Brand shortlist for the Marke select (full list comes from appStore.manufacturers at runtime). */
|
|
53
|
+
export const BRANDS: readonly string[] = [
|
|
54
|
+
'VW', 'Mercedes-Benz', 'BMW', 'Audi', 'Opel', 'Škoda', 'Ford', 'Hyundai',
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
/** Body-type tiles: [label, lucide icon, placeholder count]. Counts are design placeholders (W2 → real aggregations). */
|
|
58
|
+
export type BodyType = readonly [label: string, icon: string, placeholderCount: string];
|
|
59
|
+
export const BODY_TYPES: readonly BodyType[] = [
|
|
60
|
+
['Kleinwagen', 'car', '4.812'],
|
|
61
|
+
['Limousine', 'car-front', '5.530'],
|
|
62
|
+
['Kombi', 'caravan', '6.118'],
|
|
63
|
+
['SUV', 'truck', '7.940'],
|
|
64
|
+
['Cabrio', 'wind', '1.270'],
|
|
65
|
+
['Van', 'bus', '2.691'],
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
/** Marker text rendered wherever the design shows a field we have no real data source for yet. */
|
|
69
|
+
export const NEEDS_DATA_LABEL = 'Daten folgt';
|
package/constants.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
// Autobahn (auto.de redesign) — shared lookup constants barrel.
|
|
2
|
-
// Pure data re-exported from ./constants/autobahn (kept import-safe for plain Node consumers,
|
|
3
|
-
// see that file's header) plus the legacy fe-ui-core shim re-exports below.
|
|
4
|
-
export * from './constants/autobahn';
|
|
5
|
-
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
// Legacy shared constants (moved here from fe-ui-core).
|
|
8
|
-
//
|
|
9
|
-
// This block mirrors the public symbol set of the old
|
|
10
|
-
// `@bytebrand/fe-ui-core/constants` barrel so consumers can swap that
|
|
11
|
-
// specifier for `@bytebrand/fe-ui-core-autobahn/constants` 1:1. The
|
|
12
|
-
// implementations live under ./constants/ (core.ts, app.ts, price.ts,
|
|
13
|
-
// Search.ts, …); fe-ui-core re-exports them via shims until it is deleted.
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
offers,
|
|
18
|
-
checkoutOffers,
|
|
19
|
-
checkoutWarranties,
|
|
20
|
-
checkoutSteps,
|
|
21
|
-
checkoutSubStep,
|
|
22
|
-
DELIVERY_PERIODS_EXTRA,
|
|
23
|
-
THREE,
|
|
24
|
-
WLTP_ENERGY_EFFICIENCY_CLASS
|
|
25
|
-
} from './constants/core';
|
|
26
|
-
|
|
27
|
-
export { CUSTOM_ERROR_MESSAGES, supportPhone, supportPhoneLink } from './constants/app';
|
|
28
|
-
|
|
29
|
-
export { priceRatings } from './constants/price';
|
|
30
|
-
|
|
31
|
-
export { THROTTLE_DELAY } from './constants/Search';
|
|
1
|
+
// Autobahn (auto.de redesign) — shared lookup constants barrel.
|
|
2
|
+
// Pure data re-exported from ./constants/autobahn (kept import-safe for plain Node consumers,
|
|
3
|
+
// see that file's header) plus the legacy fe-ui-core shim re-exports below.
|
|
4
|
+
export * from './constants/autobahn';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Legacy shared constants (moved here from fe-ui-core).
|
|
8
|
+
//
|
|
9
|
+
// This block mirrors the public symbol set of the old
|
|
10
|
+
// `@bytebrand/fe-ui-core/constants` barrel so consumers can swap that
|
|
11
|
+
// specifier for `@bytebrand/fe-ui-core-autobahn/constants` 1:1. The
|
|
12
|
+
// implementations live under ./constants/ (core.ts, app.ts, price.ts,
|
|
13
|
+
// Search.ts, …); fe-ui-core re-exports them via shims until it is deleted.
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
offers,
|
|
18
|
+
checkoutOffers,
|
|
19
|
+
checkoutWarranties,
|
|
20
|
+
checkoutSteps,
|
|
21
|
+
checkoutSubStep,
|
|
22
|
+
DELIVERY_PERIODS_EXTRA,
|
|
23
|
+
THREE,
|
|
24
|
+
WLTP_ENERGY_EFFICIENCY_CLASS
|
|
25
|
+
} from './constants/core';
|
|
26
|
+
|
|
27
|
+
export { CUSTOM_ERROR_MESSAGES, supportPhone, supportPhoneLink } from './constants/app';
|
|
28
|
+
|
|
29
|
+
export { priceRatings } from './constants/price';
|
|
30
|
+
|
|
31
|
+
export { THROTTLE_DELAY } from './constants/Search';
|
package/data/toAutobahnCar.ts
CHANGED
|
@@ -137,8 +137,8 @@ const CBD_DE_FALLBACK: Record<string, string> = {
|
|
|
137
137
|
multimedia_bluetooth: 'Bluetooth',
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
/** translate a cbd:* selector code → human label
|
|
141
|
-
*
|
|
140
|
+
/** translate a cbd:* selector code → human label — the built-in de fallback applies whenever
|
|
141
|
+
* no `t` is injected (e.g. no i18next available). */
|
|
142
142
|
export function cbd(code: any, t?: (key: string, options?: object) => string): string {
|
|
143
143
|
if (code == null || code === 'N/A') return '';
|
|
144
144
|
const key = String(code);
|
|
@@ -213,9 +213,8 @@ export function mapRating(currentSalesPrice?: number, predicted?: number): { rat
|
|
|
213
213
|
/**
|
|
214
214
|
* Map the 5-tier rating to a 2-tone signal — only 'top'/'good' read as a genuinely good deal
|
|
215
215
|
* (green); 'fair'/'raised'/'high' all get the warn/peach tone (Figma: "Erhöhter-Preis" is
|
|
216
|
-
* peach, not green). Pure/non-React on purpose: shared by the web card's StatChip
|
|
217
|
-
* cards/cardParts.tsx's re-export
|
|
218
|
-
* service that can't import React components).
|
|
216
|
+
* peach, not green). Pure/non-React on purpose: shared by the web card's StatChip via
|
|
217
|
+
* cards/cardParts.tsx's re-export.
|
|
219
218
|
*/
|
|
220
219
|
export function ratingTone(rating: string): 'good' | 'warn' {
|
|
221
220
|
return rating === 'top' || rating === 'good' ? 'good' : 'warn';
|