@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.
- package/constants/autobahn.ts +69 -68
- package/constants.ts +31 -31
- package/data/toAutobahnCar.ts +4 -5
- package/locales/de/autobahn.json +790 -783
- package/locales/en/autobahn.json +790 -783
- package/package.json +2 -5
- package/theme/autobahn.css +7 -4
- package/theme/md3.css +8184 -1585
- package/ui/CardCarousel.tsx +6 -2
- package/utils/financeFormat.ts +62 -62
- package/utils/priceRating.ts +58 -57
- package/vdp/FinanceCalculator.tsx +746 -651
- package/vdp/VdpModules.tsx +2995 -2384
- package/vdp/VdpViewer.tsx +698 -99
- package/cards/types.d.ts +0 -112
- package/cards/types.js +0 -14
- package/constants/autobahn.d.ts +0 -22
- package/constants/autobahn.js +0 -57
- package/constants/core.d.ts +0 -152
- package/constants/core.js +0 -125
- package/constants/price.d.ts +0 -2
- package/constants/price.js +0 -11
- package/constants/selectors.d.ts +0 -11
- package/constants/selectors.js +0 -32
- package/data/toAutobahnCar.d.ts +0 -89
- package/data/toAutobahnCar.js +0 -421
- package/tsconfig.node-safe.json +0 -25
- package/utils/DateUtils.d.ts +0 -21
- package/utils/DateUtils.js +0 -97
- package/utils/financeFormat.d.ts +0 -32
- package/utils/financeFormat.js +0 -42
- package/utils/power.d.ts +0 -1
- package/utils/power.js +0 -14
- package/utils/priceRating.d.ts +0 -3
- package/utils/priceRating.js +0 -55
package/utils/power.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPowerLabel = void 0;
|
|
4
|
-
// Pure power-label formatter, extracted from fe-ui-core's
|
|
5
|
-
// source/framework/vehiclesProps/decoratedProps.tsx (which stays in fe-ui-core
|
|
6
|
-
// because it drags React UI). Exactly one implementation lives here;
|
|
7
|
-
// decoratedProps re-exports it for backwards compatibility.
|
|
8
|
-
const getPowerLabel = (powerKW, powerPS) => {
|
|
9
|
-
const powerKWlabel = !!powerKW ? `${powerKW} kW ` : '';
|
|
10
|
-
const powerPSlabel = !!powerPS ? `${!!powerKW ? '(' : ''}${powerPS} PS${!!powerKW ? ')' : ''}` : '';
|
|
11
|
-
const powerKWpowerPS = `${powerKWlabel}${powerPSlabel}`;
|
|
12
|
-
return powerKWpowerPS;
|
|
13
|
-
};
|
|
14
|
-
exports.getPowerLabel = getPowerLabel;
|
package/utils/priceRating.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const getPriceRatingConfig: (currentPrice: number, pricePredicted: number) => any;
|
|
2
|
-
export declare const getPredictablePrice: (currentSalesPrice: number, predictablePrice: number) => number;
|
|
3
|
-
export declare const getPriceRating: (currentSalesPrice: number, predictablePrice: number) => number;
|
package/utils/priceRating.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPriceRating = exports.getPredictablePrice = exports.getPriceRatingConfig = void 0;
|
|
4
|
-
// Autobahn (auto.de redesign) — Preisbewertung rating math, extracted from CommonUtils.ts.
|
|
5
|
-
//
|
|
6
|
-
// Pulled out on purpose: CommonUtils.ts transitively imports `../constants/Search`, which
|
|
7
|
-
// `require()`s image assets (webpack-only — breaks any plain Node `require`/`tsc` consumer).
|
|
8
|
-
// This file only imports `../constants/price` (zero further imports), so the Meta AIA
|
|
9
|
-
// marketing-image renderer (a plain Node backend, see ../data/toAutobahnCar.ts's `mapRating`)
|
|
10
|
-
// can import real Preisbewertung math without dragging in frontend-only asset requires.
|
|
11
|
-
// CommonUtils.ts re-exports these for existing consumers — one implementation, not a fork.
|
|
12
|
-
const price_1 = require("../constants/price");
|
|
13
|
-
const core_1 = require("../constants/core");
|
|
14
|
-
const getPriceRatingConfig = (currentPrice, pricePredicted) => {
|
|
15
|
-
const round = (value) => {
|
|
16
|
-
return Number.isFinite(pricePredicted)
|
|
17
|
-
? Math.round((pricePredicted * (1 + (value / 100))) / 100) * 100 // tslint:disable-line
|
|
18
|
-
: '???';
|
|
19
|
-
};
|
|
20
|
-
if (currentPrice === 0) {
|
|
21
|
-
console.log('Empty current price');
|
|
22
|
-
}
|
|
23
|
-
return Object.keys(price_1.priceRatingConfig).reduce((acc, key) => {
|
|
24
|
-
const { min, max } = price_1.priceRatingConfig[key];
|
|
25
|
-
return { ...acc, [key]: { min: round(min), max: round(max) } };
|
|
26
|
-
}, {}); // tslint:disable-line
|
|
27
|
-
};
|
|
28
|
-
exports.getPriceRatingConfig = getPriceRatingConfig;
|
|
29
|
-
const getPredictablePrice = (currentSalesPrice, predictablePrice) => {
|
|
30
|
-
if (Number.isFinite(Number.parseFloat(`${predictablePrice}`))) {
|
|
31
|
-
return predictablePrice;
|
|
32
|
-
}
|
|
33
|
-
return currentSalesPrice * core_1.PREDICTABLE_PRICE_INDEX;
|
|
34
|
-
};
|
|
35
|
-
exports.getPredictablePrice = getPredictablePrice;
|
|
36
|
-
const getPriceRating = (currentSalesPrice, predictablePrice) => {
|
|
37
|
-
const isCorrectCurrentSalesPrice = Number.isFinite(Number.parseFloat(`${currentSalesPrice}`));
|
|
38
|
-
// const isCorrectPredictablePrice = Number.isFinite(Number.parseFloat(`${predictablePrice}`));
|
|
39
|
-
if (!isCorrectCurrentSalesPrice)
|
|
40
|
-
return 0;
|
|
41
|
-
const validatedPredictablePrice = (0, exports.getPredictablePrice)(currentSalesPrice, predictablePrice);
|
|
42
|
-
const ratingConfig = (0, exports.getPriceRatingConfig)(currentSalesPrice, validatedPredictablePrice);
|
|
43
|
-
for (const key of Object.keys(ratingConfig)) {
|
|
44
|
-
const { min, max } = ratingConfig[key];
|
|
45
|
-
const TOP_PRICE = 5;
|
|
46
|
-
if (key === 'highPrice' && currentSalesPrice === max)
|
|
47
|
-
return 1;
|
|
48
|
-
if (key === 'topPrice' && currentSalesPrice <= min)
|
|
49
|
-
return TOP_PRICE;
|
|
50
|
-
if (currentSalesPrice >= min && currentSalesPrice < max)
|
|
51
|
-
return price_1.priceRatings.indexOf(key);
|
|
52
|
-
}
|
|
53
|
-
return 0;
|
|
54
|
-
};
|
|
55
|
-
exports.getPriceRating = getPriceRating;
|