@bytebrand/fe-ui-core-autobahn 1.0.226 → 1.0.228

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 (58) hide show
  1. package/campaign/CampaignBand.tsx +26 -0
  2. package/campaign/campaignVars.ts +12 -0
  3. package/campaign/campaigns.ts +74 -0
  4. package/campaign/index.ts +6 -0
  5. package/cards/CarCard.tsx +393 -366
  6. package/cards/CarRow.tsx +8 -28
  7. package/cards/cardParts.tsx +23 -48
  8. package/cards/dealSignals.ts +36 -0
  9. package/cards/index.ts +0 -6
  10. package/chrome/Footer.tsx +3 -16
  11. package/chrome/TopBar.tsx +266 -139
  12. package/compat/CookieModal/CookieModal.tsx +6 -20
  13. package/compat/CookieModal/Modal.tsx +3 -6
  14. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
  15. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
  16. package/compat/CookieModal/useModal.ts +1 -5
  17. package/compat/Loader/Loader.tsx +7 -1
  18. package/compat/MdField/MdField.tsx +4 -28
  19. package/compat/PriceRating/PriceRating.styl +7 -5
  20. package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +6 -8
  21. package/compat/TimePicker/TimePicker.tsx +2 -12
  22. package/compat/legacy-theme/priceReviewColors.styl +5 -18
  23. package/constants/app.ts +11 -1
  24. package/constants/autobahn.ts +0 -39
  25. package/constants/core.ts +12 -1
  26. package/data/fieldMapping.ts +3 -3
  27. package/data/toAutobahnCar.ts +14 -30
  28. package/iconsvg/IconSVG.tsx +5 -1
  29. package/index.ts +19 -18
  30. package/locales/de/autobahn.json +862 -903
  31. package/locales/en/autobahn.json +862 -903
  32. package/package.json +2 -2
  33. package/theme/md3.css +11808 -15866
  34. package/ui/Dropdown.tsx +10 -29
  35. package/ui/FormCheckbox.tsx +2 -22
  36. package/ui/FormField.tsx +1 -2
  37. package/ui/Icon.tsx +0 -6
  38. package/ui/Modal.tsx +6 -84
  39. package/ui/Skeleton.tsx +20 -79
  40. package/ui/Stars.tsx +18 -36
  41. package/ui/StatChip.tsx +3 -8
  42. package/ui/index.ts +0 -3
  43. package/ui/usePortalMenuPosition.ts +15 -27
  44. package/utils/index.ts +0 -10
  45. package/vdp/FinanceCalculator.tsx +34 -162
  46. package/vdp/VdpModules.tsx +976 -348
  47. package/vdp/index.ts +3 -6
  48. package/vdp/types.ts +15 -25
  49. package/vehiclesProps/decoratedLightProps.tsx +0 -4
  50. package/vehiclesProps/decoratedProps.tsx +0 -4
  51. package/cards/CarCardSkeleton.tsx +0 -103
  52. package/cards/CarRowSkeleton.tsx +0 -152
  53. package/chrome/AccountMenuIcon.tsx +0 -109
  54. package/ui/MfieldCheckIcon.tsx +0 -13
  55. package/ui/ratingLink.ts +0 -36
  56. package/ui/scrollFieldIntoView.ts +0 -41
  57. package/utils/cookieConsent.ts +0 -84
  58. package/vehiclesProps/accidentDisclosure.ts +0 -25
package/cards/CarRow.tsx CHANGED
@@ -24,7 +24,6 @@ import React, { useState, useEffect, useRef } from 'react';
24
24
  import { TranslationFunction } from '../types';
25
25
 
26
26
  import { CardCarousel, IconButton, SaveChip, Button, Icon, StatChip } from '../ui';
27
- import { ratingLinkProps } from '../ui/ratingLink';
28
27
  import {
29
28
  EcoLine,
30
29
  PriceMeter,
@@ -81,8 +80,6 @@ export interface CarRowProps {
81
80
  * links render as plain text (see PricePaths' own fallback).
82
81
  */
83
82
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
84
- /** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
85
- onShowPriceRating?: (car: AutobahnCar) => void;
86
83
  }
87
84
 
88
85
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -95,22 +92,10 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
95
92
  t,
96
93
  adminAction,
97
94
  onShowFinancingDetails,
98
- onShowPriceRating,
99
95
  }) => {
100
96
  const [mode, setMode] = useState<PaymentMode>('financing');
101
97
  const [photoIndex, setPhotoIndex] = useState(0);
102
98
  const mediaRef = useRef<HTMLDivElement | null>(null);
103
- // The price-rating chip + bar link to the car's "Preis & Marktwert" section (page-owned
104
- // onShowPriceRating, ratingLinkProps). Without it they stay plain: a click opens the car, as
105
- // before. `noTabStop`: clickable, but not a second tab stop next to the chip.
106
- const ratingLink = (className: string, noTabStop: boolean = false): React.HTMLAttributes<HTMLElement> => {
107
- if (!onShowPriceRating || !car.rating) return {};
108
- const props = ratingLinkProps(
109
- () => onShowPriceRating(car),
110
- t('autobahn:finance.priceRatingLink', { rating: t('autobahn:tier.' + car.rating) }),
111
- );
112
- return noTabStop ? { className, onClick: props.onClick, 'aria-hidden': true } : { className, ...props };
113
- };
114
99
  // always call the LATEST onMediaEnter without re-arming the observer on every render (the
115
100
  // page callers construct a fresh closure each render) — the effect itself only needs to run
116
101
  // once per mount. Identical pattern to CarCard.tsx — see its own comment for the rationale.
@@ -290,18 +275,13 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
290
275
  <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
291
276
  <PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
292
277
  {car.rating && (
293
- <span {...ratingLink('rating-link')}>
294
- <StatChip rating={car.rating} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
295
- {t('autobahn:tier.' + car.rating)}
296
- <sup>4</sup>
297
- </StatChip>
298
- </span>
278
+ <StatChip tone={ratingTone(car.rating)} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
279
+ {t('autobahn:tier.' + car.rating)}
280
+ {ratingTone(car.rating) === 'good' && <sup>4</sup>}
281
+ </StatChip>
299
282
  )}
300
283
  </div>
301
- {/* the bar is clickable too, but not a second tab stop (the chip above is the link) */}
302
- <div {...ratingLink('rating-link', true)}>
303
- <PriceMeter t={t} car={car} />
304
- </div>
284
+ <PriceMeter t={t} car={car} />
305
285
  <div className="pp-cta">
306
286
  <Button
307
287
  variant="filled"
@@ -340,11 +320,11 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
340
320
  />
341
321
  <div className="pp-purchase hide-mobile">
342
322
  <PriceKauf car={car} t={t} />
343
- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }} {...ratingLink('rating-link')}>
323
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
344
324
  {car.rating && (
345
- <StatChip rating={car.rating} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
325
+ <StatChip tone={ratingTone(car.rating)} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
346
326
  {t('autobahn:tier.' + car.rating)}
347
- <sup>4</sup>
327
+ {ratingTone(car.rating) === 'good' && <sup>4</sup>}
348
328
  </StatChip>
349
329
  )}
350
330
  <div style={{ flex: 1 }}>
@@ -20,9 +20,8 @@ import { defaultConfig } from '@bytebrand/fe-financing';
20
20
 
21
21
  import { Icon, Button, CreditCostNotice, CreditKeyFigures, hasCreditKeyFigures } from '../ui';
22
22
  import type { CreditKeyFiguresData } from '../ui';
23
- import { EvalBar, EvalPill } from '../vdp/FinanceCalculator';
24
- import { ratingLinkProps } from '../ui/ratingLink';
25
- import { CO2_CLASSES, CO2_COLORS, TIER_KEYS, TIER_COLORS, NO_RATING_KEY, ratingColorsOf } from '../constants';
23
+ import { EvalBar } from '../vdp/FinanceCalculator';
24
+ import { CO2_CLASSES, CO2_COLORS, TIER_KEYS, TIER_COLORS } from '../constants';
26
25
  import { AutobahnCar } from './types';
27
26
  // pure, non-React — shared with the Meta AIA marketing-image renderer (a plain Node service).
28
27
  export { ratingTone } from '../data/toAutobahnCar';
@@ -450,8 +449,6 @@ const TONE_TO_TIER: Record<string, number> = { top: 0, good: 1, fair: 2, raised:
450
449
  * Renders nothing when there is no rating/band (needs-data: we never draw a fake market position).
451
450
  */
452
451
  export const PriceMeter: React.FunctionComponent<{ car: AutobahnCar; t: TranslationFunction }> = ({ car }) => {
453
- // "Keine Bewertung": the price is outside the bands, so no marker anywhere on the scale
454
- if (car.rating === NO_RATING_KEY) return <EvalBar tier={null} />;
455
452
  const hasMarket =
456
453
  car.marketLow != null && car.marketAvg != null && car.marketHigh != null && car.marketHigh > car.marketLow;
457
454
  const bar = (tier: number) => {
@@ -463,7 +460,7 @@ export const PriceMeter: React.FunctionComponent<{ car: AutobahnCar; t: Translat
463
460
  <span key={i} className="fin-eval-seg" style={{ background: c }} />
464
461
  ))}
465
462
  <div
466
- className="fin-eval-thumb"
463
+ className={`fin-eval-thumb${TIER_KEYS[tierIndex] === 'good' ? ' fin-eval-thumb--good' : ''}`}
467
464
  style={{ left: `${leftPct}%`, borderColor: TIER_COLORS[tierIndex] }}
468
465
  />
469
466
  </div>
@@ -485,38 +482,9 @@ export const PriceMeter: React.FunctionComponent<{ car: AutobahnCar; t: Translat
485
482
  * Preisbewertung pill + segmented tier bar, grouped in one column exactly like the VDP
486
483
  * finance-calculator's mobile .fin-eval-col (FinanceCalculator.tsx/EvalBar) — the grid card's
487
484
  * replacement for the old StatChip pill + full-width gradient .pp-bar pairing. Renders nothing
488
- * without a rating (needs-data: never invent a tier). With `onActivate` the pill + bar are one link
489
- * (ratingLinkProps): the page opens the car's VDP at its "Preis & Marktwert" section.
485
+ * without a rating (needs-data: never invent a tier).
490
486
  */
491
- export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: TranslationFunction; onActivate?: () => void }> = ({
492
- car,
493
- t,
494
- onActivate,
495
- }) => {
496
- const linkProps = (label: string) =>
497
- onActivate
498
- ? { className: 'fin-eval-col rating-link', ...ratingLinkProps(onActivate, t('autobahn:finance.priceRatingLink', { rating: label })) }
499
- : { className: 'fin-eval-col' };
500
- if (car.rating === NO_RATING_KEY) {
501
- // "Keine Bewertung": grey pill, the usual bar without a marker
502
- const noRatingLabel = t('autobahn:tier.' + NO_RATING_KEY);
503
- const noRating = ratingColorsOf(NO_RATING_KEY);
504
- return (
505
- <div {...linkProps(noRatingLabel)}>
506
- <div className="fin-eval-pill-cell">
507
- <EvalPill
508
- label={noRatingLabel}
509
- color={noRating.color}
510
- background={noRating.background}
511
- ariaLabel={t('autobahn:finance.priceRatingAria', { rating: noRatingLabel })}
512
- />
513
- </div>
514
- <div className="fin-eval-bar-cell">
515
- <EvalBar tier={null} />
516
- </div>
517
- </div>
518
- );
519
- }
487
+ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: TranslationFunction }> = ({ car, t }) => {
520
488
  const tier = car.rating ? TONE_TO_TIER[car.rating] : undefined;
521
489
  if (tier == null) return null;
522
490
  const hasMarket =
@@ -529,18 +497,20 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
529
497
  // each tier shows its own real label now (Top/Guter/Fairer/Erhöht/Hoher Preis) — no more
530
498
  // collapsing 'good' onto the "Top-Preis" claim. Pill styling (colour/class/footnote) unchanged.
531
499
  const tierLabel = t('autobahn:tier.' + car.rating);
532
- // the tier's own badge colours (--rating-*), the same as on every other page
533
- const pill = ratingColorsOf(car.rating);
500
+ // 'good' collapses onto the 'top' tier's own color too (#168a45), matching the fixed
501
+ // "Top-Preis" text above rather than tier 1's lighter TIER_COLORS[1] green.
502
+ const pillColor = isGood ? TIER_COLORS[0] : TIER_COLORS[tier];
534
503
  return (
535
- <div {...linkProps(tierLabel)}>
504
+ <div className="fin-eval-col">
536
505
  <div className="fin-eval-pill-cell">
537
- <EvalPill
538
- label={tierLabel}
539
- color={pill.color}
540
- background={pill.background}
541
- good={isGood}
542
- ariaLabel={t('autobahn:finance.priceRatingAria', { rating: tierLabel })}
543
- />
506
+ <span
507
+ className={`fin-eval-pill${isGood ? ' fin-eval-pill--good' : ''}`}
508
+ style={{ color: pillColor, background: `color-mix(in srgb, ${pillColor} 16%, transparent)` }}
509
+ aria-label={t('autobahn:finance.priceRatingAria', { rating: tierLabel })}
510
+ >
511
+ {tierLabel}
512
+ {isGood && <sup>4</sup>}
513
+ </span>
544
514
  </div>
545
515
  <div className="fin-eval-bar-cell">
546
516
  <EvalBar tier={tier} leftPct={leftPct} />
@@ -785,7 +755,12 @@ export const PriceTerms: React.FunctionComponent<{
785
755
  onShowDetails?: () => void;
786
756
  t: TranslationFunction;
787
757
  }> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
788
- if (mode === 'buy') return null;
758
+ // Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
759
+ // here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
760
+ // real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
761
+ // every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
762
+ // FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
763
+ if (mode === 'buy') return <div className="cc-terms" />;
789
764
  const finFirstInstallment =
790
765
  car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
791
766
  const finMonths = car.finMonths ?? _finMonths;
@@ -0,0 +1,36 @@
1
+ // Autobahn (auto.de redesign) — which deal signals a card shows for a car.
2
+ //
3
+ // One rule for CarCard, CarRow, the vehicle page's gallery and the campaigns (campaign/campaigns.ts), so "this card shows the green −X € and the
4
+ // red −X % chip" means the same everywhere.
5
+
6
+ import { AutobahnCar } from './types';
7
+
8
+ export type DealSource = Pick<AutobahnCar, 'asGoodAsNew' | 'drop' | 'dropPct' | 'savings' | 'isNew' | 'zeroDown'>;
9
+
10
+ export interface DealSignals {
11
+ /** DropChip, "−X € zum UVP". */
12
+ drop: boolean;
13
+ /** SaveChip (only without a drop). */
14
+ save: boolean;
15
+ /** PercentChip, "−X %". */
16
+ percent: boolean;
17
+ /** OfferBadge, "Angebot". */
18
+ offer: boolean;
19
+ /** NEU badge. */
20
+ neu: boolean;
21
+ }
22
+
23
+ export const dealSignals = (car: DealSource): DealSignals => {
24
+ // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
25
+ // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
26
+ const asGoodAsNew = car.asGoodAsNew !== false;
27
+ const drop = asGoodAsNew && car.drop != null;
28
+ const save = asGoodAsNew && !drop && car.savings != null && car.savings > 600;
29
+ const percent = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
30
+ const offer = !!(car.isNew || drop || save || percent || car.zeroDown);
31
+ // PM call: the badge row only fits 3 pills — when Drop/Save + Percent + ZeroDown are all
32
+ // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
33
+ const activeChips = [drop || save, percent, !!car.zeroDown].filter(Boolean).length;
34
+ const neu = asGoodAsNew && !!car.isNew && activeChips < 3;
35
+ return { drop, save, percent, offer, neu };
36
+ };
package/cards/index.ts CHANGED
@@ -11,12 +11,6 @@ export type { CarCardProps } from './CarCard';
11
11
  export { default as CarRow } from './CarRow';
12
12
  export type { CarRowProps } from './CarRow';
13
13
 
14
- export { default as CarCardSkeleton } from './CarCardSkeleton';
15
- export type { CarCardSkeletonProps } from './CarCardSkeleton';
16
-
17
- export { default as CarRowSkeleton } from './CarRowSkeleton';
18
- export type { CarRowSkeletonProps } from './CarRowSkeleton';
19
-
20
14
  export {
21
15
  fmtKm,
22
16
  cardSpec,
package/chrome/Footer.tsx CHANGED
@@ -86,14 +86,6 @@ export interface FooterProps {
86
86
  * (VehicleDetailedNextPage), never site-wide, since every other page shows only footnotes 1-4.
87
87
  */
88
88
  showCostFootnotes?: boolean;
89
- /**
90
- * Hides the brand blurb + "stay in contact"/social + 3 link columns block (the
91
- * `.footer-grid`), leaving just the legal disclaimer and copyright/"Nach Oben" bar. Opt-in,
92
- * off by default — every other caller keeps the full footer. Only CheckoutThankYouPage.tsx
93
- * (checkout step 6 "Danke") uses this today: that page's own Figma reference (64637:37033)
94
- * has just the compact legal/copyright strip, not the full site footer.
95
- */
96
- hideBrandColumns?: boolean;
97
89
  }
98
90
 
99
91
  /**
@@ -101,7 +93,7 @@ export interface FooterProps {
101
93
  * disclaimer block, and a copyright + "Nach Oben" bar. Pure/presentational MD3 chrome — renders
102
94
  * correctly only inside a `<div className="md3">` subtree (scoped theme at source/theme/autobahn).
103
95
  */
104
- const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes, hideBrandColumns }) => {
96
+ const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes }) => {
105
97
  const scrollTop = (): void => window.scroll({ top: 0, left: 0, behavior: 'smooth' });
106
98
  const now = new Date();
107
99
  const year = now.getFullYear();
@@ -112,7 +104,6 @@ const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes, hi
112
104
 
113
105
  return (
114
106
  <footer style={{ background: 'var(--md-sc-low)', borderTop: '1px solid var(--md-outline-variant)' }}>
115
- {!hideBrandColumns ? (
116
107
  <div className="container footer-grid" style={{ padding: '40px 24px 24px' }}>
117
108
  <div>
118
109
  <img src={logoUrl} height="30" alt="auto.de" />
@@ -178,14 +169,10 @@ const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes, hi
178
169
  </div>
179
170
  ))}
180
171
  </div>
181
- ) : null}
182
172
 
183
173
  {/* Legally required disclaimers (PAngV §17a financing example w/ live APR/nominal rate +
184
- term, DAT CO₂-Leitfaden, MwSt, Streichpreis, image notice). Same text as the legacy footer.
185
- The top border separates this from .footer-grid above — with hideBrandColumns that
186
- block is gone, so the border would just double up against whatever's already directly
187
- above the footer on the page (CheckoutThankYouPage.tsx's own header border). */}
188
- <div style={hideBrandColumns ? undefined : { borderTop: '1px solid var(--md-outline-variant)' }}>
174
+ term, DAT CO₂-Leitfaden, MwSt, Streichpreis, image notice). Same text as the legacy footer. */}
175
+ <div style={{ borderTop: '1px solid var(--md-outline-variant)' }}>
189
176
  <div className="container" style={{ padding: '18px 24px' }}>
190
177
  <p
191
178
  className="md-label-sm"