@bytebrand/fe-ui-core-autobahn 1.0.12 → 1.0.14

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.
@@ -29,11 +29,9 @@ const _leasCfg = (defaultConfig as any).leasing || {};
29
29
  /** financing terms inputs (rendered via t in PricePaths), e.g. "0 € Anzahlung · 48 Monate Laufzeit". */
30
30
  const _finFirstInstallment = (_finCfg.firstInstallment || 0).toLocaleString('de-DE');
31
31
  const _finMonths = _finCfg.rawPaybackPeriod || _finCfg.paybackPeriod || 48;
32
- /** leasing terms inputs (only when the config carries mileage + period), e.g. "10.000 km/Jahr · 48 Monate". */
32
+ /** leasing terms fallbacks (used when the car doesn't carry its own), e.g. "10.000 km/Jahr · 48 Monate". */
33
33
  const _leasPeriod = _leasCfg.rawPaybackPeriod || _leasCfg.paybackPeriod;
34
34
  const _leasMileage = _leasCfg.annualMileage || _leasCfg.mileage;
35
- const _hasLeasTerms = Boolean(_leasMileage && _leasPeriod);
36
- const _leasMileageStr = _leasMileage ? Number(_leasMileage).toLocaleString('de-DE') : '';
37
35
 
38
36
  /** mileage → 'X.XXX km' (de-DE grouping). */
39
37
  export function fmtKm(n: number): string {
@@ -428,6 +426,10 @@ export const PricePaths: React.FunctionComponent<PricePathsProps> = ({ car, t })
428
426
  const finFirstInstallment =
429
427
  car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
430
428
  const finMonths = car.finMonths ?? _finMonths;
429
+ const leasMileage = car.leaseMileage ?? _leasMileage;
430
+ const leasMonths = car.leaseMonths ?? _leasPeriod;
431
+ const hasLeasTerms = Boolean(leasMileage && leasMonths);
432
+ const leasMileageStr = leasMileage ? Number(leasMileage).toLocaleString('de-DE') : '';
431
433
  return (
432
434
  <div className="pricepaths">
433
435
  <div className="pp-hero">
@@ -447,9 +449,9 @@ export const PricePaths: React.FunctionComponent<PricePathsProps> = ({ car, t })
447
449
  {hasLease && (
448
450
  <div className="pp-lease-row">
449
451
  <PpRow label={t('autobahn:card.price.leasing')} value={car.lease as number} unit="mtl." />
450
- {_hasLeasTerms && (
452
+ {hasLeasTerms && (
451
453
  <div className="pp-sub-terms">
452
- {t('autobahn:card.price.leaseTerms', { mileage: _leasMileageStr, months: _leasPeriod })}
454
+ {t('autobahn:card.price.leaseTerms', { mileage: leasMileageStr, months: leasMonths })}
453
455
  </div>
454
456
  )}
455
457
  </div>
package/cards/types.ts CHANGED
@@ -114,6 +114,12 @@ export interface AutobahnCar {
114
114
  marketHigh?: number;
115
115
  /** leasing monthly rate in EUR. */
116
116
  lease?: number;
117
+ /**
118
+ * leasing terms the `lease` rate was computed with — per-car merged config,
119
+ * same as finFirstInstallment/finMonths. Absent → default-config terms.
120
+ */
121
+ leaseMileage?: number;
122
+ leaseMonths?: number;
117
123
  /** number of buyers currently watching this car. */
118
124
  watchers?: number;
119
125
  /** number of recent views (drives the 'vor N Std' cue). */
package/chrome/TopBar.tsx CHANGED
@@ -35,8 +35,10 @@ const R_SAVED_SEARCHES = '/my-searches';
35
35
  const R_MY_VEHICLES = '/my-vehicles/overview';
36
36
  const R_SETTINGS = '/my-settings';
37
37
  const R_MY_ORDERS = '/account/my-orders';
38
- const R_DEALER_DASHBOARD = '/account/dashboard';
38
+ /** DashboardPage branches internally on authStore.isDealer — same route serves regular users too. */
39
+ const R_DASHBOARD = '/account/dashboard';
39
40
  const R_IMAGE_SETTINGS = '/account/image-settings';
41
+ const R_KONTAKT = '/account/kontakt';
40
42
 
41
43
  /** Languages offered in the account menu (legacy supports de/en/ru). Labels are proper nouns
42
44
  * (endonyms) and stay untranslated. */
@@ -215,15 +217,20 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
215
217
  <div className="md-label-sm" style={{ padding: '6px 14px 8px', color: 'var(--md-on-surface-variant)' }}>
216
218
  {userLabel || t('autobahn:chrome.myAccount')}
217
219
  </div>
220
+ {/* dealer-main users get the same route via the dedicated "Händler-Dashboard" row below */}
221
+ {!isDealerMain &&
222
+ row('autobahn:chrome.dashboard', t('autobahn:chrome.dashboard'), () => goRoute(R_DASHBOARD), { icon: 'layout-grid' })}
218
223
  {row('autobahn:chrome.myVehicles', t('autobahn:chrome.myVehicles'), () => goRoute(R_MY_VEHICLES), { icon: 'car' })}
219
- {row('autobahn:chrome.myOrders', t('autobahn:chrome.myOrders'), () => goRoute(R_MY_ORDERS), { icon: 'package', badge: ordersCount > 0 ? ordersCount : undefined })}
224
+ {ordersCount > 0 &&
225
+ row('autobahn:chrome.myOrders', t('autobahn:chrome.myOrders'), () => goRoute(R_MY_ORDERS), { icon: 'package', badge: ordersCount })}
220
226
  {row('autobahn:chrome.savedSearches', t('autobahn:chrome.savedSearches'), () => goRoute(R_SAVED_SEARCHES), { icon: 'bell' })}
221
227
  {row('autobahn:chrome.favorites', t('autobahn:chrome.favorites'), () => goRoute(R_FAVOURITES), { icon: 'heart', badge: favoritesCount })}
222
228
  {row('autobahn:chrome.settings', t('autobahn:chrome.settings'), () => goRoute(R_SETTINGS), { icon: 'settings' })}
229
+ {row('autobahn:chrome.helpContact', t('autobahn:chrome.helpContact'), () => goRoute(R_KONTAKT), { icon: 'help-circle' })}
223
230
  {isDealerMain && (
224
231
  <>
225
232
  {divider('d-dealer')}
226
- {row('autobahn:chrome.dealerDashboard', t('autobahn:chrome.dealerDashboard'), () => goRoute(R_DEALER_DASHBOARD), { icon: 'store' })}
233
+ {row('autobahn:chrome.dealerDashboard', t('autobahn:chrome.dealerDashboard'), () => goRoute(R_DASHBOARD), { icon: 'store' })}
227
234
  {row('autobahn:chrome.imageSettings', t('autobahn:chrome.imageSettings'), () => goRoute(R_IMAGE_SETTINGS), { icon: 'image' })}
228
235
  </>
229
236
  )}
@@ -308,8 +308,11 @@ export function toAutobahnCar(storeCar: any, deps: ToAutobahnCarDeps = {}): Auto
308
308
  // financing terms the monthly rate was computed with — same merged per-car
309
309
  // config (dealer rate + the user's saved localStorage adjustments, ADV-157).
310
310
  // Emitted only when real; the cards fall back to the default-config terms.
311
+ // paybackPeriod FIRST: it carries the user's saved term, while rawPaybackPeriod
312
+ // is stamped from the dealer rate at normalize time and never reflects
313
+ // adjustments (normalizeRateObject.ts `rawPaybackPeriod: paybackPeriod`).
311
314
  const finFirstInstallment = num(price?.financing?.firstInstallment);
312
- const finMonths = num(price?.financing?.rawPaybackPeriod) ?? num(price?.financing?.paybackPeriod);
315
+ const finMonths = num(price?.financing?.paybackPeriod) ?? num(price?.financing?.rawPaybackPeriod);
313
316
  // price ← price.currentSalesPrice (DataTransformers.ts:352).
314
317
  const purchase = num(price?.currentSalesPrice) ?? 0;
315
318
 
@@ -357,6 +360,11 @@ export function toAutobahnCar(storeCar: any, deps: ToAutobahnCarDeps = {}): Auto
357
360
  // (instead of computing/showing a leasing rate the car isn't eligible for).
358
361
  const leasingActive = !!(price && price.leasing && price.leasing.isActive);
359
362
  const lease = leasingActive ? num(price?.leasing?.monthlyInstallment) : undefined;
363
+ // leasing terms the lease rate was computed with — same merged per-car config
364
+ // as the financing terms above (annualMileage/paybackPeriod carry the user's
365
+ // saved adjustments). Only meaningful alongside an active lease rate.
366
+ const leaseMileage = leasingActive ? num(price?.leasing?.annualMileage) : undefined;
367
+ const leaseMonths = leasingActive ? num(price?.leasing?.paybackPeriod) : undefined;
360
368
 
361
369
  // --- optional: list price / savings — ONLY from a real strike price ---
362
370
  // transformDataForVehicles exposes oldMonthlyInstallment / highestPrice via
@@ -444,6 +452,8 @@ export function toAutobahnCar(storeCar: any, deps: ToAutobahnCarDeps = {}): Auto
444
452
  ...(listPrice != null ? { listPrice } : {}),
445
453
  ...(savings != null ? { savings } : {}),
446
454
  ...(lease != null ? { lease } : {}),
455
+ ...(leaseMileage != null ? { leaseMileage } : {}),
456
+ ...(leaseMonths != null ? { leaseMonths } : {}),
447
457
  ...(drop != null ? { drop } : {}),
448
458
  ...(dropPct != null ? { dropPct } : {}),
449
459
  ...(zeroDown ? { zeroDown } : {}),
@@ -214,6 +214,7 @@
214
214
  "navJobs": "Jobs",
215
215
  "myOrders": "Meine Bestellungen",
216
216
  "myDealers": "Meine Händler",
217
+ "dashboard": "Dashboard",
217
218
  "dealerDashboard": "Händler-Dashboard",
218
219
  "imageSettings": "Bildeinstellungen"
219
220
  },
@@ -214,6 +214,7 @@
214
214
  "navJobs": "Jobs",
215
215
  "myOrders": "My orders",
216
216
  "myDealers": "My dealers",
217
+ "dashboard": "Dashboard",
217
218
  "dealerDashboard": "Dealer dashboard",
218
219
  "imageSettings": "Image settings"
219
220
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
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
5
  "main": "index.ts",
6
6
  "license": "UNLICENSED",