@bytebrand/fe-ui-core-autobahn 1.0.200 → 1.0.202

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/types.ts CHANGED
@@ -1,165 +1,174 @@
1
- // Autobahn (auto.de redesign) — car-card view-model type.
2
- //
3
- // Typed contract for the ported car cards (CarCard / CarRow). This is a pure
4
- // presentational view-model: the cards receive a fully-resolved `AutobahnCar`
5
- // and never touch the store, API or `window`.
6
- //
7
- // IMPORTANT — needs-data discipline:
8
- // The REQUIRED fields below always carry real data from the search/listing
9
- // source. The OPTIONAL fields are ones we have NO real source for yet; they are
10
- // `?`-optional ON PURPOSE so the components can detect their absence and render
11
- // the `NEEDS_DATA_LABEL` ('Daten folgt') marker instead of a fabricated number.
12
- // Never default these to placeholder values.
13
-
14
- /** Pkw-EnVKV plug-in-hybrid consumption block (only present for PHEV cars). */
15
- export interface AutobahnPhev {
16
- /** electric consumption, e.g. '17,3 kWh/100 km'. */
17
- consEl: string;
18
- /** fuel consumption (weighted, combined), e.g. '1,2 l/100 km'. */
19
- consFuel: string;
20
- /** consumption when battery is discharged, e.g. '6,4 l/100 km'. */
21
- consDis: string;
22
- /** weighted combined CO₂, e.g. '28 g/km'. */
23
- co2w: string;
24
- /** CO₂ class (weighted). */
25
- co2classW: string;
26
- /** CO₂ class (discharged). */
27
- co2classD: string;
28
- }
29
-
30
- /**
31
- * View-model for a single car as rendered by the Autobahn car cards.
32
- *
33
- * REQUIRED fields are always populated with real data.
34
- * OPTIONAL fields (`?`) have no real data source yet — when absent the cards
35
- * render the 'Daten folgt' marker rather than inventing a value.
36
- */
37
- export interface AutobahnCar {
38
- // --- identity / headline (always real) ---
39
- make: string;
40
- model: string;
41
- trim: string;
42
-
43
- // --- key specs (always real) ---
44
- /** mileage in km (raw number; formatted de-DE by the cards). */
45
- km: number;
46
- /** first registration, e.g. '03/2021'. */
47
- reg: string;
48
- /** power label, e.g. '110 kW (150 PS)'. */
49
- power: string;
50
- /** fuel label, e.g. 'Benzin' / 'Plug-in-Hybrid'. */
51
- fuel: string;
52
- /** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
53
- gear: string;
54
- /** number of previous owners (rendered as 'N. Hand'). */
55
- owners: number;
56
-
57
- // --- price (always real) ---
58
- /** financing monthly rate in EUR — the LEAD price on every card. */
59
- monthly: number;
60
- /**
61
- * financing terms the `monthly` rate was computed with — the per-car merged
62
- * config (dealer rate + the user's saved localStorage adjustments, ADV-157).
63
- * Absent → the card falls back to the fe-financing default-config terms.
64
- */
65
- finFirstInstallment?: number;
66
- finMonths?: number;
67
- /** purchase price in EUR (raw number; formatted de-DE by the cards). */
68
- price: number;
69
-
70
- // --- media (always real) ---
71
- /** ready-to-use image URLs for the carousel. */
72
- gallery: string[];
73
- /**
74
- * Full-resolution counterpart of `gallery`, same length/order — only set when the card was
75
- * built with a smaller `imageSize` (grid cards). A lightbox opened from the card (CarCard's
76
- * photo-count pill → VdpViewer) should prefer this over the small thumbnail URLs.
77
- */
78
- galleryLarge?: string[];
79
- /** total photo count for the image-count badge. */
80
- photos: number;
81
-
82
- // --- legally-required Pkw-EnVKV consumption line (always real) ---
83
- /** combined fuel consumption label, e.g. '5,4 l/100 km'. */
84
- cons: string;
85
- /** combined CO₂ emissions label, e.g. '124 g/km'. */
86
- co2: string;
87
- /** CO₂ efficiency class letter, e.g. 'B'. */
88
- co2class: string;
89
- /** present only for plug-in hybrids — drives the dual-figure EnVKV line. */
90
- phev?: AutobahnPhev;
91
-
92
- // --- trust / features (always real) ---
93
- /** equipment highlight chips (first few are shown on the row card). */
94
- features: string[];
95
- /** full comma-joined spec + equipment line (fuel, category, gearbox, color, condition,
96
- * drive type, then every highlight) — the small gray footer line under the card's CTA
97
- * row, same field/format as the legacy VehicleSmallCard's SeoText. Optional: only
98
- * callers that already build this string (fe-landing's transformSearchResultItem)
99
- * populate it; others simply don't render the line. */
100
- seoText?: string;
101
- /** price rating tone: 'fair' → warn pill, anything else → good pill. */
102
- rating: string;
103
- /** price rating label shown in the pill, e.g. 'Guter Preis'. */
104
- ratingLabel: string;
105
- /** true → show the "NEU" badge (legacy showNewLabel: new / recently-listed car). */
106
- isNew?: boolean;
107
- /**
108
- * struck-through previous financing rate (getFinancing.ts `oldMonthlyInstallment`), gated by
109
- * the same real isStrikeShown flag as `listPrice`/`savings`. Absent → no strike under the
110
- * Finanzierung tab's hero rate.
111
- */
112
- oldMonthly?: number;
113
- /** struck-through previous leasing rate (getLeasing.ts `oldMonthlyInstallment`), same gating. */
114
- oldLease?: number;
115
- /** availability label, e.g. 'Sofort verfügbar' (offer.availabilityMode). Absent → not shown. */
116
- availability?: string;
117
- /** percent price reduction (price.historyPriceDifferencePerCent) — pairs with `drop` for the −X% badge. */
118
- dropPct?: number;
119
- /** 0 € Anzahlung available (offer.showDownPayment) — drives the "0 € Anz." badge. */
120
- zeroDown?: boolean;
121
- /**
122
- * as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
123
- * product rule for the drop/percent/NEU deal signals AND the strike-price/UVP-Rate display
124
- * (see toAutobahnCar.ts's isStrikeShown). Independent of NEU's own showNewLabel (which also
125
- * requires a recent modificationDate). Does NOT gate zeroDown.
126
- */
127
- asGoodAsNew?: boolean;
128
-
129
- // --- NEEDS DATA: no real source yet (NEVER fabricate) ---
130
- /** original list price (for the struck-through reference price). */
131
- listPrice?: number;
132
- /** savings vs. list price in EUR (gates the savings/strike UI; >600 to show). */
133
- savings?: number;
134
- /** real price reduction on THIS car in EUR (gates the DropChip). */
135
- drop?: number;
136
- /** lowest comparable market price in EUR (market band lower bound). */
137
- marketLow?: number;
138
- /** average comparable market price in EUR (market band reference). */
139
- marketAvg?: number;
140
- /** highest comparable market price in EUR (market band upper bound). */
141
- marketHigh?: number;
142
- /** leasing monthly rate in EUR. */
143
- lease?: number;
144
- /**
145
- * leasing terms the `lease` rate was computed with — per-car merged config,
146
- * same as finFirstInstallment/finMonths. Absent → default-config terms.
147
- */
148
- leaseMileage?: number;
149
- leaseMonths?: number;
150
- leaseFirstInstallment?: number;
151
- /** number of buyers currently watching this car. */
152
- watchers?: number;
153
- /** number of recent views (drives the 'vor N Std' cue). */
154
- views?: number;
155
-
156
- // --- gallery activity strip (real data: UserActionsAPI 'stats/viewers', loaded async and
157
- // keyed by carId in SearchResultsStore.statsData — see fieldMapping.ts). Absent until that
158
- // fetch resolves. Each pill in the badge row is independent (GalleryBadges): a missing or
159
- // zero count omits just that pill (never a "0×"), availability/Geprüft still show on their
160
- // own terms — the row is anchored to the right edge so it never looks lopsided. ---
161
- /** total detail-page views (stats totalCarImpCount) — shown as the eye pill under the image. */
162
- viewsCount?: number;
163
- /** total users who favorited this car (stats totalFavCount) — shown as the heart pill under the image. */
164
- favoritesCount?: number;
165
- }
1
+ // Autobahn (auto.de redesign) — car-card view-model type.
2
+ //
3
+ // Typed contract for the ported car cards (CarCard / CarRow). This is a pure
4
+ // presentational view-model: the cards receive a fully-resolved `AutobahnCar`
5
+ // and never touch the store, API or `window`.
6
+ //
7
+ // IMPORTANT — needs-data discipline:
8
+ // The REQUIRED fields below always carry real data from the search/listing
9
+ // source. The OPTIONAL fields are ones we have NO real source for yet; they are
10
+ // `?`-optional ON PURPOSE so the components can detect their absence and render
11
+ // the `NEEDS_DATA_LABEL` ('Daten folgt') marker instead of a fabricated number.
12
+ // Never default these to placeholder values.
13
+
14
+ /** Pkw-EnVKV plug-in-hybrid consumption block (only present for PHEV cars). */
15
+ export interface AutobahnPhev {
16
+ /** electric consumption, e.g. '17,3 kWh/100 km'. */
17
+ consEl: string;
18
+ /** fuel consumption (weighted, combined), e.g. '1,2 l/100 km'. */
19
+ consFuel: string;
20
+ /** consumption when battery is discharged, e.g. '6,4 l/100 km'. */
21
+ consDis: string;
22
+ /** weighted combined CO₂, e.g. '28 g/km'. */
23
+ co2w: string;
24
+ /** CO₂ class (weighted). */
25
+ co2classW: string;
26
+ /** CO₂ class (discharged). */
27
+ co2classD: string;
28
+ }
29
+
30
+ /**
31
+ * View-model for a single car as rendered by the Autobahn car cards.
32
+ *
33
+ * REQUIRED fields are always populated with real data.
34
+ * OPTIONAL fields (`?`) have no real data source yet — when absent the cards
35
+ * render the 'Daten folgt' marker rather than inventing a value.
36
+ */
37
+ export interface AutobahnCar {
38
+ // --- identity / headline (always real) ---
39
+ make: string;
40
+ model: string;
41
+ trim: string;
42
+
43
+ // --- key specs (always real) ---
44
+ /** mileage in km (raw number; formatted de-DE by the cards). */
45
+ km: number;
46
+ /** first registration, e.g. '03/2021'. */
47
+ reg: string;
48
+ /** power label, e.g. '110 kW (150 PS)'. */
49
+ power: string;
50
+ /** fuel label, e.g. 'Benzin' / 'Plug-in-Hybrid'. */
51
+ fuel: string;
52
+ /** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
53
+ gear: string;
54
+ /** number of previous owners (rendered as 'N. Hand'). */
55
+ owners: number;
56
+
57
+ // --- price (always real) ---
58
+ /** financing monthly rate in EUR — the LEAD price on every card. */
59
+ monthly: number;
60
+ /**
61
+ * financing terms the `monthly` rate was computed with — the per-car merged
62
+ * config (dealer rate + the user's saved localStorage adjustments, ADV-157).
63
+ * Absent → the card falls back to the fe-financing default-config terms.
64
+ */
65
+ finFirstInstallment?: number;
66
+ finMonths?: number;
67
+ /** financing key figures of the same computed rate (ADV-405 Kerndaten, as in the
68
+ * Finanzierungsdetails layer): net loan, total amount (totalFinancingAmount, else
69
+ * grossLoanAmount), nominal and effective annual rate. Absent → not shown. */
70
+ finNetLoan?: number;
71
+ finTotal?: number;
72
+ finNominal?: number;
73
+ finApr?: number;
74
+ /** final instalment (Schlussrate) of that rate — counts the monthly rates in the key figures. */
75
+ finFinal?: number;
76
+ /** purchase price in EUR (raw number; formatted de-DE by the cards). */
77
+ price: number;
78
+
79
+ // --- media (always real) ---
80
+ /** ready-to-use image URLs for the carousel. */
81
+ gallery: string[];
82
+ /**
83
+ * Full-resolution counterpart of `gallery`, same length/order — only set when the card was
84
+ * built with a smaller `imageSize` (grid cards). A lightbox opened from the card (CarCard's
85
+ * photo-count pill → VdpViewer) should prefer this over the small thumbnail URLs.
86
+ */
87
+ galleryLarge?: string[];
88
+ /** total photo count for the image-count badge. */
89
+ photos: number;
90
+
91
+ // --- legally-required Pkw-EnVKV consumption line (always real) ---
92
+ /** combined fuel consumption label, e.g. '5,4 l/100 km'. */
93
+ cons: string;
94
+ /** combined CO₂ emissions label, e.g. '124 g/km'. */
95
+ co2: string;
96
+ /** CO₂ efficiency class letter, e.g. 'B'. */
97
+ co2class: string;
98
+ /** present only for plug-in hybrids — drives the dual-figure EnVKV line. */
99
+ phev?: AutobahnPhev;
100
+
101
+ // --- trust / features (always real) ---
102
+ /** equipment highlight chips (first few are shown on the row card). */
103
+ features: string[];
104
+ /** full comma-joined spec + equipment line (fuel, category, gearbox, color, condition,
105
+ * drive type, then every highlight) — the small gray footer line under the card's CTA
106
+ * row, same field/format as the legacy VehicleSmallCard's SeoText. Optional: only
107
+ * callers that already build this string (fe-landing's transformSearchResultItem)
108
+ * populate it; others simply don't render the line. */
109
+ seoText?: string;
110
+ /** price rating tone: 'fair' → warn pill, anything else → good pill. */
111
+ rating: string;
112
+ /** price rating label shown in the pill, e.g. 'Guter Preis'. */
113
+ ratingLabel: string;
114
+ /** true → show the "NEU" badge (legacy showNewLabel: new / recently-listed car). */
115
+ isNew?: boolean;
116
+ /**
117
+ * struck-through previous financing rate (getFinancing.ts `oldMonthlyInstallment`), gated by
118
+ * the same real isStrikeShown flag as `listPrice`/`savings`. Absent → no strike under the
119
+ * Finanzierung tab's hero rate.
120
+ */
121
+ oldMonthly?: number;
122
+ /** struck-through previous leasing rate (getLeasing.ts `oldMonthlyInstallment`), same gating. */
123
+ oldLease?: number;
124
+ /** availability label, e.g. 'Sofort verfügbar' (offer.availabilityMode). Absent → not shown. */
125
+ availability?: string;
126
+ /** percent price reduction (price.historyPriceDifferencePerCent) — pairs with `drop` for the −X% badge. */
127
+ dropPct?: number;
128
+ /** 0 € Anzahlung available (offer.showDownPayment) — drives the "0 € Anz." badge. */
129
+ zeroDown?: boolean;
130
+ /**
131
+ * as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
132
+ * product rule for the drop/percent/NEU deal signals AND the strike-price/UVP-Rate display
133
+ * (see toAutobahnCar.ts's isStrikeShown). Independent of NEU's own showNewLabel (which also
134
+ * requires a recent modificationDate). Does NOT gate zeroDown.
135
+ */
136
+ asGoodAsNew?: boolean;
137
+
138
+ // --- NEEDS DATA: no real source yet (NEVER fabricate) ---
139
+ /** original list price (for the struck-through reference price). */
140
+ listPrice?: number;
141
+ /** savings vs. list price in EUR (gates the savings/strike UI; >600 to show). */
142
+ savings?: number;
143
+ /** real price reduction on THIS car in EUR (gates the DropChip). */
144
+ drop?: number;
145
+ /** lowest comparable market price in EUR (market band lower bound). */
146
+ marketLow?: number;
147
+ /** average comparable market price in EUR (market band reference). */
148
+ marketAvg?: number;
149
+ /** highest comparable market price in EUR (market band upper bound). */
150
+ marketHigh?: number;
151
+ /** leasing monthly rate in EUR. */
152
+ lease?: number;
153
+ /**
154
+ * leasing terms the `lease` rate was computed with — per-car merged config,
155
+ * same as finFirstInstallment/finMonths. Absent → default-config terms.
156
+ */
157
+ leaseMileage?: number;
158
+ leaseMonths?: number;
159
+ leaseFirstInstallment?: number;
160
+ /** number of buyers currently watching this car. */
161
+ watchers?: number;
162
+ /** number of recent views (drives the 'vor N Std' cue). */
163
+ views?: number;
164
+
165
+ // --- gallery activity strip (real data: UserActionsAPI 'stats/viewers', loaded async and
166
+ // keyed by carId in SearchResultsStore.statsData — see fieldMapping.ts). Absent until that
167
+ // fetch resolves. Each pill in the badge row is independent (GalleryBadges): a missing or
168
+ // zero count omits just that pill (never a "0×"), availability/Geprüft still show on their
169
+ // own terms — the row is anchored to the right edge so it never looks lopsided. ---
170
+ /** total detail-page views (stats totalCarImpCount) — shown as the eye pill under the image. */
171
+ viewsCount?: number;
172
+ /** total users who favorited this car (stats totalFavCount) — shown as the heart pill under the image. */
173
+ favoritesCount?: number;
174
+ }