@bytebrand/fe-ui-core-autobahn 1.0.190 → 1.0.191

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 (43) hide show
  1. package/cards/CarCard.tsx +12 -43
  2. package/cards/CarCardSkeleton.tsx +103 -0
  3. package/cards/CarRowSkeleton.tsx +152 -0
  4. package/cards/cardParts.tsx +1253 -1258
  5. package/cards/index.ts +6 -0
  6. package/chrome/AccountMenuIcon.tsx +109 -0
  7. package/chrome/Footer.tsx +16 -3
  8. package/chrome/TopBar.tsx +139 -266
  9. package/compat/CookieModal/CookieModal.tsx +20 -6
  10. package/compat/CookieModal/Modal.tsx +6 -3
  11. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
  12. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
  13. package/compat/CookieModal/useModal.ts +5 -1
  14. package/compat/Loader/Loader.tsx +1 -7
  15. package/compat/MdField/MdField.tsx +28 -4
  16. package/compat/TimePicker/TimePicker.tsx +12 -2
  17. package/constants/app.ts +1 -11
  18. package/constants/core.ts +1 -12
  19. package/data/toAutobahnCar.ts +16 -2
  20. package/iconsvg/IconSVG.tsx +1 -5
  21. package/locales/de/autobahn.json +880 -848
  22. package/locales/en/autobahn.json +880 -848
  23. package/package.json +2 -2
  24. package/theme/md3.css +5321 -1207
  25. package/ui/CreditCostNotice.tsx +43 -43
  26. package/ui/Dropdown.tsx +29 -10
  27. package/ui/FormCheckbox.tsx +22 -2
  28. package/ui/FormField.tsx +2 -1
  29. package/ui/Icon.tsx +6 -0
  30. package/ui/MfieldCheckIcon.tsx +13 -0
  31. package/ui/Modal.tsx +84 -6
  32. package/ui/Skeleton.tsx +79 -20
  33. package/ui/index.ts +93 -91
  34. package/ui/scrollFieldIntoView.ts +41 -0
  35. package/ui/usePortalMenuPosition.ts +27 -15
  36. package/utils/cookieConsent.ts +84 -0
  37. package/utils/index.ts +10 -0
  38. package/vdp/FinanceCalculator.tsx +1095 -1081
  39. package/vdp/VdpModules.tsx +4417 -4387
  40. package/vdp/types.ts +5 -5
  41. package/vehiclesProps/accidentDisclosure.ts +25 -0
  42. package/vehiclesProps/decoratedLightProps.tsx +4 -0
  43. package/vehiclesProps/decoratedProps.tsx +4 -0
package/vdp/types.ts CHANGED
@@ -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.'. */
@@ -191,8 +191,8 @@ export interface VehicleDetail {
191
191
  fuel: string;
192
192
  /** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
193
193
  gear: string;
194
- /** number of previous owners (rendered as 'N. Hand'). */
195
- owners: number;
194
+ /** number of previous owners (rendered as 'N. Hand'); null = not known, the fact is not shown. */
195
+ owners: number | null;
196
196
  /** number of seats. */
197
197
  seats: number;
198
198
  /** number of doors. */
@@ -302,7 +302,7 @@ export function defaultVdpSpecs(v: VehicleDetail): VdpSpec[] {
302
302
  [['cog', 'Getriebe', v.gear], true],
303
303
  [['users', 'Sitze', `${v.seats} Sitze`], false],
304
304
  [['door-open', 'Türen', `${v.doors} Türen`], false],
305
- [['user', 'Halter', `${v.owners}. Hand`], true], // 0 Vorbesitzer is valid
305
+ ...(v.owners == null ? [] : [[['user', 'Halter', `${v.owners}. Hand`], true] as const]), // 0 Vorbesitzer is valid
306
306
  [['palette', 'Außenfarbe', v.color], true],
307
307
  [['car-front', 'Karosserie', v.body], true],
308
308
  [['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
  },