@bytebrand/fe-ui-core-autobahn 1.0.54 → 1.0.56

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.
@@ -1,68 +1,69 @@
1
- // Autobahn (auto.de redesign) — shared lookup constants.
2
- // Typed replacement for the design kit's `window.*` globals (data.jsx / ui.jsx / CdpModules.jsx).
3
- // Pure data only — no DOM, no store access, no further imports. Split out of the package-root
4
- // `constants.ts` barrel so this file (and its importers) can be required WITHOUT also pulling in
5
- // `./constants/Search` (which `require()`s image assets — webpack-only, breaks any plain Node
6
- // consumer). `data/toAutobahnCar.ts` imports directly from here for that reason — see
7
- // [[meta-aia-marketing-image-generation]]. `constants.ts` re-exports everything here unchanged.
8
- //
9
- // NOTE on counts: the BODY_TYPES / QUICK_FILTERS sample counts below are the design's
10
- // placeholder figures. They are only used by the W2 filter UI, which will replace them with
11
- // REAL aggregation counts from searchStore.aggregation. They are not rendered as real data in W1.
12
-
13
- /** Pkw-EnVKV CO₂ efficiency classes (best → worst) and their band colors. */
14
- export const CO2_CLASSES = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] as const;
15
- export type Co2Class = (typeof CO2_CLASSES)[number];
16
- export const CO2_COLORS: readonly string[] = [
17
- '#1FA01F', '#5DAE2E', '#9FC21C', '#F2C200', '#F2900D', '#E8601A', '#D4202B',
18
- ];
19
-
20
- /** Preisbewertung (price-rating) tiers, index 0 = Top … 4 = Hoch. green → red. */
21
- export const TIER_LABELS = ['Top Preis', 'Guter Preis', 'Fairer Preis', 'Erhöht', 'Hoher Preis'] as const;
22
- // i18n key suffixes parallel to TIER_LABELS — components render t('autobahn:tier.<key>') so the
23
- // Preisbewertung label localizes (TIER_LABELS stays the German source-of-truth used for tier→index logic).
24
- export const TIER_KEYS = ['top', 'good', 'fair', 'raised', 'high'] as const;
25
- export const TIER_COLORS: readonly string[] = ['#0F7B43', '#4FA86B', '#C7B53A', '#E08A2B', '#D4502B'];
26
- export type RatingTier = 0 | 1 | 2 | 3 | 4;
27
-
28
- /** SRP sort options (labels match the design; mapped to real sort params by the SRP container). */
29
- export const SORTS = [
30
- 'Relevanz',
31
- 'Preis aufsteigend',
32
- 'Preis absteigend',
33
- 'Erstzulassung',
34
- 'Kilometerstand',
35
- 'Leistung',
36
- ] as const;
37
- export type SortLabel = (typeof SORTS)[number];
38
-
39
- /** Quick-filter chips for the srp-bar: [lucide icon, label, defaultActive?]. */
40
- export type QuickFilter = readonly [icon: string, label: string, defaultActive?: boolean];
41
- export const QUICK_FILTERS: readonly QuickFilter[] = [
42
- ['sliders-horizontal', 'Filter', true],
43
- ['fuel', 'Diesel'],
44
- ['cog', 'Automatik'],
45
- ['battery-charging', 'Hybrid'],
46
- ['gauge', 'bis 50.000 km'],
47
- ['wallet', 'bis 300 €/mtl.'],
48
- ['calendar', 'ab 2022'],
49
- ];
50
-
51
- /** Brand shortlist for the Marke select (full list comes from appStore.manufacturers at runtime). */
52
- export const BRANDS: readonly string[] = [
53
- 'VW', 'Mercedes-Benz', 'BMW', 'Audi', 'Opel', 'Škoda', 'Ford', 'Hyundai',
54
- ];
55
-
56
- /** Body-type tiles: [label, lucide icon, placeholder count]. Counts are design placeholders (W2 → real aggregations). */
57
- export type BodyType = readonly [label: string, icon: string, placeholderCount: string];
58
- export const BODY_TYPES: readonly BodyType[] = [
59
- ['Kleinwagen', 'car', '4.812'],
60
- ['Limousine', 'car-front', '5.530'],
61
- ['Kombi', 'caravan', '6.118'],
62
- ['SUV', 'truck', '7.940'],
63
- ['Cabrio', 'wind', '1.270'],
64
- ['Van', 'bus', '2.691'],
65
- ];
66
-
67
- /** Marker text rendered wherever the design shows a field we have no real data source for yet. */
68
- export const NEEDS_DATA_LABEL = 'Daten folgt';
1
+ // Autobahn (auto.de redesign) — shared lookup constants.
2
+ // Typed replacement for the design kit's `window.*` globals (data.jsx / ui.jsx / CdpModules.jsx).
3
+ // Pure data only — no DOM, no store access, no further imports. Split out of the package-root
4
+ // `constants.ts` barrel so this file (and its importers) can be required WITHOUT also pulling in
5
+ // `./constants/Search` (which `require()`s image assets — webpack-only, breaks any plain Node
6
+ // consumer). `data/toAutobahnCar.ts` imports directly from here for that reason.
7
+ // `constants.ts` re-exports everything here unchanged.
8
+ //
9
+ // NOTE on counts: the BODY_TYPES / QUICK_FILTERS sample counts below are the design's
10
+ // placeholder figures. They are only used by the W2 filter UI, which will replace them with
11
+ // REAL aggregation counts from searchStore.aggregation. They are not rendered as real data in W1.
12
+
13
+ /** Pkw-EnVKV CO₂ efficiency classes (best → worst) and their band colors. */
14
+ export const CO2_CLASSES = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] as const;
15
+ export type Co2Class = (typeof CO2_CLASSES)[number];
16
+ export const CO2_COLORS: readonly string[] = [
17
+ '#1FA01F', '#5DAE2E', '#9FC21C', '#F2C200', '#F2900D', '#E8601A', '#D4202B',
18
+ ];
19
+
20
+ /** Preisbewertung (price-rating) tiers, index 0 = Top … 4 = Hoch. green → red. */
21
+ export const TIER_LABELS = ['Top Preis', 'Guter Preis', 'Fairer Preis', 'Erhöht', 'Hoher Preis'] as const;
22
+ // i18n key suffixes parallel to TIER_LABELS — components render t('autobahn:tier.<key>') so the
23
+ // Preisbewertung label localizes (TIER_LABELS stays the German source-of-truth used for tier→index logic).
24
+ export const TIER_KEYS = ['top', 'good', 'fair', 'raised', 'high'] as const;
25
+ export const TIER_COLORS: readonly string[] = ['#168A45', '#66B84D', '#F7C544', '#F26B43', '#E60000'];
26
+ export const TIER_BACKGROUNDS: readonly string[] = ['#DFF3E5', '#E4F3DF', '#FFF6DB', '#FFEFD5', '#FFD3D3'];
27
+ export type RatingTier = 0 | 1 | 2 | 3 | 4;
28
+
29
+ /** SRP sort options (labels match the design; mapped to real sort params by the SRP container). */
30
+ export const SORTS = [
31
+ 'Relevanz',
32
+ 'Preis aufsteigend',
33
+ 'Preis absteigend',
34
+ 'Erstzulassung',
35
+ 'Kilometerstand',
36
+ 'Leistung',
37
+ ] as const;
38
+ export type SortLabel = (typeof SORTS)[number];
39
+
40
+ /** Quick-filter chips for the srp-bar: [lucide icon, label, defaultActive?]. */
41
+ export type QuickFilter = readonly [icon: string, label: string, defaultActive?: boolean];
42
+ export const QUICK_FILTERS: readonly QuickFilter[] = [
43
+ ['sliders-horizontal', 'Filter', true],
44
+ ['fuel', 'Diesel'],
45
+ ['cog', 'Automatik'],
46
+ ['battery-charging', 'Hybrid'],
47
+ ['gauge', 'bis 50.000 km'],
48
+ ['wallet', 'bis 300 €/mtl.'],
49
+ ['calendar', 'ab 2022'],
50
+ ];
51
+
52
+ /** Brand shortlist for the Marke select (full list comes from appStore.manufacturers at runtime). */
53
+ export const BRANDS: readonly string[] = [
54
+ 'VW', 'Mercedes-Benz', 'BMW', 'Audi', 'Opel', 'Škoda', 'Ford', 'Hyundai',
55
+ ];
56
+
57
+ /** Body-type tiles: [label, lucide icon, placeholder count]. Counts are design placeholders (W2 → real aggregations). */
58
+ export type BodyType = readonly [label: string, icon: string, placeholderCount: string];
59
+ export const BODY_TYPES: readonly BodyType[] = [
60
+ ['Kleinwagen', 'car', '4.812'],
61
+ ['Limousine', 'car-front', '5.530'],
62
+ ['Kombi', 'caravan', '6.118'],
63
+ ['SUV', 'truck', '7.940'],
64
+ ['Cabrio', 'wind', '1.270'],
65
+ ['Van', 'bus', '2.691'],
66
+ ];
67
+
68
+ /** Marker text rendered wherever the design shows a field we have no real data source for yet. */
69
+ export const NEEDS_DATA_LABEL = 'Daten folgt';
package/constants.ts CHANGED
@@ -1,31 +1,31 @@
1
- // Autobahn (auto.de redesign) — shared lookup constants barrel.
2
- // Pure data re-exported from ./constants/autobahn (kept import-safe for plain Node consumers,
3
- // see that file's header) plus the legacy fe-ui-core shim re-exports below.
4
- export * from './constants/autobahn';
5
-
6
- // ---------------------------------------------------------------------------
7
- // Legacy shared constants (moved here from fe-ui-core).
8
- //
9
- // This block mirrors the public symbol set of the old
10
- // `@bytebrand/fe-ui-core/constants` barrel so consumers can swap that
11
- // specifier for `@bytebrand/fe-ui-core-autobahn/constants` 1:1. The
12
- // implementations live under ./constants/ (core.ts, app.ts, price.ts,
13
- // Search.ts, …); fe-ui-core re-exports them via shims until it is deleted.
14
- // ---------------------------------------------------------------------------
15
-
16
- export {
17
- offers,
18
- checkoutOffers,
19
- checkoutWarranties,
20
- checkoutSteps,
21
- checkoutSubStep,
22
- DELIVERY_PERIODS_EXTRA,
23
- THREE,
24
- WLTP_ENERGY_EFFICIENCY_CLASS
25
- } from './constants/core';
26
-
27
- export { CUSTOM_ERROR_MESSAGES, supportPhone, supportPhoneLink } from './constants/app';
28
-
29
- export { priceRatings } from './constants/price';
30
-
31
- export { THROTTLE_DELAY } from './constants/Search';
1
+ // Autobahn (auto.de redesign) — shared lookup constants barrel.
2
+ // Pure data re-exported from ./constants/autobahn (kept import-safe for plain Node consumers,
3
+ // see that file's header) plus the legacy fe-ui-core shim re-exports below.
4
+ export * from './constants/autobahn';
5
+
6
+ // ---------------------------------------------------------------------------
7
+ // Legacy shared constants (moved here from fe-ui-core).
8
+ //
9
+ // This block mirrors the public symbol set of the old
10
+ // `@bytebrand/fe-ui-core/constants` barrel so consumers can swap that
11
+ // specifier for `@bytebrand/fe-ui-core-autobahn/constants` 1:1. The
12
+ // implementations live under ./constants/ (core.ts, app.ts, price.ts,
13
+ // Search.ts, …); fe-ui-core re-exports them via shims until it is deleted.
14
+ // ---------------------------------------------------------------------------
15
+
16
+ export {
17
+ offers,
18
+ checkoutOffers,
19
+ checkoutWarranties,
20
+ checkoutSteps,
21
+ checkoutSubStep,
22
+ DELIVERY_PERIODS_EXTRA,
23
+ THREE,
24
+ WLTP_ENERGY_EFFICIENCY_CLASS
25
+ } from './constants/core';
26
+
27
+ export { CUSTOM_ERROR_MESSAGES, supportPhone, supportPhoneLink } from './constants/app';
28
+
29
+ export { priceRatings } from './constants/price';
30
+
31
+ export { THROTTLE_DELAY } from './constants/Search';
@@ -137,8 +137,8 @@ const CBD_DE_FALLBACK: Record<string, string> = {
137
137
  multimedia_bluetooth: 'Bluetooth',
138
138
  };
139
139
 
140
- /** translate a cbd:* selector code → human label. Exported: also used by the Meta AIA
141
- * marketing-image renderer (plain Node backend, no i18next — relies on the built-in de fallback). */
140
+ /** translate a cbd:* selector code → human label — the built-in de fallback applies whenever
141
+ * no `t` is injected (e.g. no i18next available). */
142
142
  export function cbd(code: any, t?: (key: string, options?: object) => string): string {
143
143
  if (code == null || code === 'N/A') return '';
144
144
  const key = String(code);
@@ -213,9 +213,8 @@ export function mapRating(currentSalesPrice?: number, predicted?: number): { rat
213
213
  /**
214
214
  * Map the 5-tier rating to a 2-tone signal — only 'top'/'good' read as a genuinely good deal
215
215
  * (green); 'fair'/'raised'/'high' all get the warn/peach tone (Figma: "Erhöhter-Preis" is
216
- * peach, not green). Pure/non-React on purpose: shared by the web card's StatChip (via
217
- * cards/cardParts.tsx's re-export) AND the Meta AIA marketing-image renderer (a plain Node
218
- * service that can't import React components).
216
+ * peach, not green). Pure/non-React on purpose: shared by the web card's StatChip via
217
+ * cards/cardParts.tsx's re-export.
219
218
  */
220
219
  export function ratingTone(rating: string): 'good' | 'warn' {
221
220
  return rating === 'top' || rating === 'good' ? 'good' : 'warn';