@bytebrand/fe-ui-core-autobahn 1.0.210 → 1.0.212

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.
Files changed (45) hide show
  1. package/cards/CarCard.tsx +8 -1
  2. package/cards/CarCardSkeleton.tsx +103 -0
  3. package/cards/CarRow.tsx +5 -1
  4. package/cards/CarRowSkeleton.tsx +152 -0
  5. package/cards/cardParts.tsx +1368 -1363
  6. package/cards/index.ts +6 -0
  7. package/cards/types.ts +182 -182
  8. package/chrome/AccountMenuIcon.tsx +109 -0
  9. package/chrome/Footer.tsx +16 -3
  10. package/chrome/TopBar.tsx +139 -266
  11. package/compat/CookieModal/CookieModal.tsx +20 -6
  12. package/compat/CookieModal/Modal.tsx +6 -3
  13. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
  14. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
  15. package/compat/CookieModal/useModal.ts +5 -1
  16. package/compat/Loader/Loader.tsx +1 -7
  17. package/compat/MdField/MdField.tsx +28 -4
  18. package/compat/TimePicker/TimePicker.tsx +12 -2
  19. package/data/toAutobahnCar.ts +600 -586
  20. package/iconsvg/IconSVG.tsx +1 -5
  21. package/locales/de/autobahn.json +891 -857
  22. package/locales/en/autobahn.json +891 -857
  23. package/package.json +2 -2
  24. package/theme/md3.css +15678 -11743
  25. package/ui/CreditCostNotice.tsx +44 -44
  26. package/ui/CreditKeyFigures.tsx +244 -244
  27. package/ui/Dropdown.tsx +29 -10
  28. package/ui/FormCheckbox.tsx +22 -2
  29. package/ui/FormField.tsx +2 -1
  30. package/ui/Icon.tsx +6 -0
  31. package/ui/MfieldCheckIcon.tsx +13 -0
  32. package/ui/Modal.tsx +84 -6
  33. package/ui/Skeleton.tsx +79 -20
  34. package/ui/index.ts +96 -94
  35. package/ui/scrollFieldIntoView.ts +41 -0
  36. package/ui/usePortalMenuPosition.ts +27 -15
  37. package/utils/cookieConsent.ts +84 -0
  38. package/utils/index.ts +10 -0
  39. package/vdp/FinanceCalculator.tsx +1148 -1134
  40. package/vdp/VdpModules.tsx +3869 -4437
  41. package/vdp/index.ts +0 -3
  42. package/vdp/types.ts +7 -17
  43. package/vehiclesProps/accidentDisclosure.ts +25 -0
  44. package/vehiclesProps/decoratedLightProps.tsx +4 -0
  45. package/vehiclesProps/decoratedProps.tsx +4 -0
package/vdp/index.ts CHANGED
@@ -35,7 +35,6 @@ export {
35
35
  Co2Label,
36
36
  VehicleDescription,
37
37
  TrustStrip,
38
- PriceHistory,
39
38
  ProtectionProducts,
40
39
  VdpAnchors,
41
40
  VdpStickyBar,
@@ -58,7 +57,6 @@ export type {
58
57
  VehicleDescriptionProps,
59
58
  TrustStripProps,
60
59
  TrustItem,
61
- PriceHistoryProps,
62
60
  ProtectionProductsProps,
63
61
  ProtectionProduct,
64
62
  VdpAnchorsProps,
@@ -84,7 +82,6 @@ export type {
84
82
  EnergyTaxSummary,
85
83
  Co2CostsSummary,
86
84
  EquipmentGroups,
87
- PriceHistoryPoint,
88
85
  PriceRatingBand,
89
86
  PriceRatingBands,
90
87
  VdpReview,
package/vdp/types.ts CHANGED
@@ -10,8 +10,8 @@
10
10
  // (`?`) fields are ones we have NO real source for yet; they are optional ON
11
11
  // PURPOSE so the components can detect their absence and render the
12
12
  // NEEDS_DATA_LABEL ('Daten folgt') marker instead of a fabricated value. Never
13
- // default these to placeholder numbers. priceHistory + the market band
14
- // (marketLow / marketAvg / marketHigh) are needs-data by default.
13
+ // default these to placeholder numbers. The market band (marketLow / marketAvg /
14
+ // marketHigh) is needs-data by default.
15
15
 
16
16
  import type { AutobahnPhev } from '../cards/types';
17
17
 
@@ -111,8 +111,8 @@ export interface Co2CostsSummary {
111
111
  export interface VehicleCondition {
112
112
  /** TÜV/HU validity, e.g. '03/2027' — or 'Neu' for a new HU. */
113
113
  hu: string;
114
- /** accident-free flag (Unfallfrei). */
115
- unfallfrei: boolean;
114
+ /** accident-free flag (Unfallfrei); null = not specified by the source ("keine Angabe"). */
115
+ unfallfrei: boolean | null;
116
116
  /** full service history (Scheckheftgepflegt). */
117
117
  scheckheft: boolean;
118
118
  /** warranty label, e.g. '12 Monate inkl.'. */
@@ -138,14 +138,6 @@ export interface VdpReview {
138
138
  rating: number;
139
139
  }
140
140
 
141
- /** One point on the price-history sparkline. */
142
- export interface PriceHistoryPoint {
143
- /** x-axis label, e.g. 'vor 6 Wo.' / 'heute'. */
144
- label: string;
145
- /** price in EUR at that point. */
146
- price: number;
147
- }
148
-
149
141
  /** One [min,max] EUR band of the 5-tier Preisbewertung (mirrors legacy IRatingConfig). */
150
142
  export interface PriceRatingBand {
151
143
  min: number;
@@ -191,8 +183,8 @@ export interface VehicleDetail {
191
183
  fuel: string;
192
184
  /** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
193
185
  gear: string;
194
- /** number of previous owners (rendered as 'N. Hand'). */
195
- owners: number;
186
+ /** number of previous owners (rendered as 'N. Hand'); null = not known, the fact is not shown. */
187
+ owners: number | null;
196
188
  /** number of seats. */
197
189
  seats: number;
198
190
  /** number of doors. */
@@ -267,8 +259,6 @@ export interface VehicleDetail {
267
259
  // --- NEEDS DATA: no real source yet (NEVER fabricate) ---
268
260
  /** original list price (for the struck-through reference + history endpoint). */
269
261
  listPrice?: number;
270
- /** price-history points (sparkline). Needs-data by default. */
271
- priceHistory?: PriceHistoryPoint[];
272
262
  /** lowest comparable market price in EUR (market band lower bound). */
273
263
  marketLow?: number;
274
264
  /** average comparable market price in EUR (market band reference). */
@@ -302,7 +292,7 @@ export function defaultVdpSpecs(v: VehicleDetail): VdpSpec[] {
302
292
  [['cog', 'Getriebe', v.gear], true],
303
293
  [['users', 'Sitze', `${v.seats} Sitze`], false],
304
294
  [['door-open', 'Türen', `${v.doors} Türen`], false],
305
- [['user', 'Halter', `${v.owners}. Hand`], true], // 0 Vorbesitzer is valid
295
+ ...(v.owners == null ? [] : [[['user', 'Halter', `${v.owners}. Hand`], true] as const]), // 0 Vorbesitzer is valid
306
296
  [['palette', 'Außenfarbe', v.color], true],
307
297
  [['car-front', 'Karosserie', v.body], true],
308
298
  [['droplet', 'Verbrauch komb.', v.cons], true], // Pkw-EnVKV — exempt from this rule
@@ -0,0 +1,25 @@
1
+ // FINN handover v0.6 (Daniel, 15.10.2026): for the owners set here, accident and owner facts follow
2
+ // only what the source states — mainData.accidentDamaged false → accident-free, true → accident,
3
+ // empty → not specified; an empty owner count is not shown as "0. Hand". Every other dealer keeps
4
+ // the old display (accident-free unless `damaged`). The app sets the owners once at start.
5
+ let strictOwners: ReadonlyArray<string> = [];
6
+
7
+ export function setStrictConditionOwners(ownerIds: ReadonlyArray<string>): void {
8
+ strictOwners = (ownerIds || []).filter(Boolean);
9
+ }
10
+
11
+ export function isStrictConditionOwner(car: any): boolean {
12
+ const ownerId = car?.metaData?.ownerId;
13
+ return !!ownerId && strictOwners.includes(ownerId);
14
+ }
15
+
16
+ export type AccidentStatus = 'accidentFree' | 'accident' | 'notSpecified';
17
+
18
+ // The strict status, or undefined when the car's owner keeps the old display.
19
+ export function strictAccidentStatus(car: any): AccidentStatus | undefined {
20
+ if (!isStrictConditionOwner(car)) return undefined;
21
+ const value = car?.mainData?.accidentDamaged;
22
+ if (value === true) return 'accident';
23
+ if (value === false) return 'accidentFree';
24
+ return 'notSpecified';
25
+ }
@@ -6,6 +6,7 @@ import { formatTimestamp } from '../utils/DateUtils';
6
6
  import { DELIVERY_PERIODS_EXTRA } from '../constants/core';
7
7
  import moment from 'moment';
8
8
  import { IDecoratedProp } from '../types/types';
9
+ import { strictAccidentStatus } from './accidentDisclosure';
9
10
  import { gasConsumptionTemplate } from './cbdSelectors';
10
11
 
11
12
  interface IDecoratedProps {
@@ -520,6 +521,9 @@ const getDecoratedLightProps = (
520
521
  title: t('cbd:mainData_accidentDamaged'),
521
522
  icon: 'wrench',
522
523
  get value() {
524
+ const strict = strictAccidentStatus(car);
525
+ if (strict === 'notSpecified') return t('vehicleProps:value.na');
526
+ if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
523
527
  return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
524
528
  }
525
529
  },
@@ -9,6 +9,7 @@ import { EMISSION_STICKERS_ICONS, WP_EMISSION_STICKERS_ICONS } from '../constant
9
9
  import { DELIVERY_PERIODS_EXTRA } from '../constants';
10
10
  import { IDecoratedProp, ICar, IFinancingUtils } from '../types/types';
11
11
  import { getFormattedPrice } from '../utils/CommonUtils';
12
+ import { strictAccidentStatus } from './accidentDisclosure';
12
13
  import { gasConsumptionTemplate } from './cbdSelectors';
13
14
 
14
15
  const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
@@ -196,6 +197,9 @@ const getDecoratedProps = (
196
197
  title: t('cbd:mainData_accidentDamaged'),
197
198
  icon: 'wrench',
198
199
  get value() {
200
+ const strict = strictAccidentStatus(car);
201
+ if (strict === 'notSpecified') return t('vehicleProps:value.na');
202
+ if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
199
203
  return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
200
204
  }
201
205
  },