@bytebrand/fe-ui-core-autobahn 1.0.166 → 1.0.167

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/CarCard.tsx CHANGED
@@ -38,6 +38,7 @@ import {
38
38
  GalleryActivityPill,
39
39
  cardSpec,
40
40
  PaymentMode,
41
+ startPaymentMode,
41
42
  callDealerSalesPhone,
42
43
  DEALER_SALES_PHONE,
43
44
  } from './cardParts';
@@ -98,6 +99,11 @@ export interface CarCardProps {
98
99
  * (still onOpenRateAdjust).
99
100
  */
100
101
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
102
+ /**
103
+ * Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
104
+ * open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
105
+ */
106
+ initialMode?: PaymentMode;
101
107
  }
102
108
 
103
109
  const CarCard: React.FunctionComponent<CarCardProps> = ({
@@ -113,8 +119,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
113
119
  onCall,
114
120
  onOpenRateAdjust,
115
121
  onShowFinancingDetails,
122
+ initialMode,
116
123
  }) => {
117
- const [mode, setMode] = useState<PaymentMode>('financing');
124
+ const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
118
125
  const [photoIndex, setPhotoIndex] = useState(0);
119
126
  const [viewerOpen, setViewerOpen] = useState(false);
120
127
  const mediaRef = useRef<HTMLDivElement | null>(null);
package/cards/CarRow.tsx CHANGED
@@ -41,6 +41,7 @@ import {
41
41
  ZeroDownChip,
42
42
  fmtKm,
43
43
  PaymentMode,
44
+ startPaymentMode,
44
45
  ratingTone,
45
46
  } from './cardParts';
46
47
  import { AutobahnCar } from './types';
@@ -80,6 +81,8 @@ export interface CarRowProps {
80
81
  * links render as plain text (see PricePaths' own fallback).
81
82
  */
82
83
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
84
+ /** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
85
+ initialMode?: PaymentMode;
83
86
  }
84
87
 
85
88
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -92,8 +95,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
92
95
  t,
93
96
  adminAction,
94
97
  onShowFinancingDetails,
98
+ initialMode,
95
99
  }) => {
96
- const [mode, setMode] = useState<PaymentMode>('financing');
100
+ const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
97
101
  const [photoIndex, setPhotoIndex] = useState(0);
98
102
  const mediaRef = useRef<HTMLDivElement | null>(null);
99
103
  // always call the LATEST onMediaEnter without re-arming the observer on every render (the
@@ -489,6 +489,11 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
489
489
 
490
490
  export type PaymentMode = 'financing' | 'leasing' | 'buy';
491
491
 
492
+ /** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
493
+ * without a lease rate — PriceTabs has no Leasing tab for it. */
494
+ export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
495
+ requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
496
+
492
497
  export interface PriceTabsProps {
493
498
  car: AutobahnCar;
494
499
  mode: PaymentMode;
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.166",
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.20",
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.167",
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.20",
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,25 +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
- }
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
+ }