@bytebrand/fe-ui-core 4.8.0 → 4.8.1
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/package.json +2 -1
- package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +1 -1
- package/source/framework/DataTransformers.ts +1 -1
- package/source/framework/constants.ts +0 -4
- package/source/framework/vehiclesProps/decoratedLightProps.tsx +7 -85
- package/source/framework/vehiclesProps/decoratedProps.tsx +28 -32
- package/source/framework/vehiclesProps/vehicleDetails.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.1",
|
|
4
4
|
"description": "UI components for the auto.de project",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"module": "dist/common.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"@babel/preset-react": "^7.18.6",
|
|
14
14
|
"@babel/preset-typescript": "^7.21.0",
|
|
15
15
|
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
16
|
+
"@bytebrand/fe-financing": "^5.10.6",
|
|
16
17
|
"@bytebrand/fe-histoslider": "3.0.0",
|
|
17
18
|
"@bytebrand/i18n-dictionaries": "^0.7.5",
|
|
18
19
|
"@emotion/react": "^11.9.3",
|
|
@@ -65,7 +65,7 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
65
65
|
},
|
|
66
66
|
environmentEmissions: {
|
|
67
67
|
co2: environmentEmissions.co2,
|
|
68
|
-
wltpCo2: environmentEmissions.wltpCo2
|
|
68
|
+
wltpCo2: environmentEmissions.wltpCo2
|
|
69
69
|
},
|
|
70
70
|
consumption: {
|
|
71
71
|
fuel: consumption.fuel,
|
|
@@ -68,7 +68,7 @@ export const transformDataForDecoratedCar = (car: any) => {
|
|
|
68
68
|
tareWeight: _get(car, 'sizeVolumeWeight.emptyWeight', null),
|
|
69
69
|
bootCapacity: _get(car, 'sizeVolumeWeight.cargoCapacity', null),
|
|
70
70
|
capacityLoad: _get(car, 'sizeVolumeWeight.completeCapacity', null),
|
|
71
|
-
wltpCo2:
|
|
71
|
+
wltpCo2: _get(car, 'environmentEmissions.wltpCo2', null),
|
|
72
72
|
pluginHybrid: _get(car, 'engineData.pluginHybrid', null),
|
|
73
73
|
wltpCombined: _get(car, 'consumption.wltpCombined', _get(car, 'consumption.wltpWeightedCombined', null)),
|
|
74
74
|
wltpPowerCombined: _get(car, 'consumption.wltpPowerCombined', _get(car, 'consumption.wltpWeightedPowerCombined', null)),
|
|
@@ -19,10 +19,6 @@ export const FIFTEEN = 15; // font-size
|
|
|
19
19
|
export const FOURTEEN = 14;
|
|
20
20
|
export const HUNDRED = 100;
|
|
21
21
|
export const THOUSAND = 1000;
|
|
22
|
-
export const WLTP_COMBINED_DEFAULT = 19.9;
|
|
23
|
-
export const WLTP_POWER_COMBINED_DEFAULT = 29.9;
|
|
24
|
-
export const WLTP_CO2_DEFAULT = 499;
|
|
25
|
-
export const WLTP_CO2_ELECTRIC_DEFAULT = 0;
|
|
26
22
|
|
|
27
23
|
export const CONTAINER_STYLES = {
|
|
28
24
|
display: 'flex',
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
// import { cbdGearbox, cbdFuel } from './cbdSelectors'
|
|
4
4
|
import { formatMileage } from '../utils/CommonUtils';
|
|
5
5
|
import { formatTimestamp } from '../utils/DateUtils';
|
|
6
|
-
import { DELIVERY_PERIODS_EXTRA
|
|
6
|
+
import { DELIVERY_PERIODS_EXTRA } from '../constants';
|
|
7
7
|
import moment from 'moment';
|
|
8
8
|
import { IDecoratedProp } from '../types/types';
|
|
9
9
|
|
|
@@ -122,7 +122,7 @@ const getDecoratedLightProps = (
|
|
|
122
122
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
123
123
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
124
124
|
const wltpConsumptionCombined = car.consumption.wltpCombined || car.consumption.wltpWeightedCombined;
|
|
125
|
-
const wltpCo2 = car.environmentEmissions.wltpCo2
|
|
125
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
126
126
|
const consumptionPowerCombined = car.consumption.consumptionCombined;
|
|
127
127
|
|
|
128
128
|
const co2 = car.environmentEmissions.co2;
|
|
@@ -149,17 +149,6 @@ const getDecoratedLightProps = (
|
|
|
149
149
|
? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
|
|
150
150
|
: t('vehicleProps:value.na');
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
const wltpCo2DefaultWtdValue = t('vehicleProps:value.wltpCo2WtdCombined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
|
|
154
|
-
const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
|
|
155
|
-
const wltpPowerCombinedDefaultValue = t('vehicleProps:value.wltpPowerCombined', { consumption: WLTP_POWER_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
156
|
-
const wltpCombinedDefaultValue = t('vehicleProps:value.consumptionCombined', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
157
|
-
|
|
158
|
-
const eightMonthsAgo = new Date();
|
|
159
|
-
eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
|
|
160
|
-
|
|
161
|
-
const registrationDate = new Date(firstRegistration * 1000);
|
|
162
|
-
|
|
163
152
|
const hybridPlugin = car.engineData.hybridPlugin;
|
|
164
153
|
const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
|
|
165
154
|
const wltpWeightedCombined = car.consumption.wltpWeightedCombined;
|
|
@@ -175,13 +164,7 @@ const getDecoratedLightProps = (
|
|
|
175
164
|
{wltpCo2PluginValue}
|
|
176
165
|
</React.Fragment>
|
|
177
166
|
}
|
|
178
|
-
|
|
179
|
-
return <React.Fragment>
|
|
180
|
-
{`${wltpPowerCombinedDefaultValue}, `}
|
|
181
|
-
{`${wltpCombinedDefaultValue}, `}
|
|
182
|
-
{wltpCo2DefaultWtdValue}
|
|
183
|
-
</React.Fragment>
|
|
184
|
-
}
|
|
167
|
+
|
|
185
168
|
return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
|
|
186
169
|
? <React.Fragment>
|
|
187
170
|
{consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionValue} <br /> {co2Value}
|
|
@@ -194,10 +177,6 @@ const getDecoratedLightProps = (
|
|
|
194
177
|
return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
|
|
195
178
|
}
|
|
196
179
|
|
|
197
|
-
if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
|
|
198
|
-
return <>{wltpCombinedDefaultValue} {wltpCo2DefaultValue}</>;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
180
|
return <>{consumptionValue} <br /> {co2Value}</>;
|
|
202
181
|
}
|
|
203
182
|
},
|
|
@@ -211,15 +190,7 @@ const getDecoratedLightProps = (
|
|
|
211
190
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
212
191
|
const co2 = car.environmentEmissions.co2;
|
|
213
192
|
const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined || car.consumption.wltpWeightedPowerCombined;
|
|
214
|
-
const wltpCo2 = car.
|
|
215
|
-
|
|
216
|
-
const wltpCo2ElectricDefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_ELECTRIC_DEFAULT.toLocaleString(language) });
|
|
217
|
-
const wltpPowerCombinedDefaultValue = t('vehicleProps:value.wltpPowerCombined', { consumption: WLTP_POWER_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
218
|
-
|
|
219
|
-
const eightMonthsAgo = new Date();
|
|
220
|
-
eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
|
|
221
|
-
|
|
222
|
-
const registrationDate = new Date(firstRegistration * 1000);
|
|
193
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
223
194
|
|
|
224
195
|
const wltpConsumptionValue = Number.isFinite(wltpConsumptionPowerCombined)
|
|
225
196
|
? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
|
|
@@ -241,10 +212,6 @@ const getDecoratedLightProps = (
|
|
|
241
212
|
return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
|
|
242
213
|
}
|
|
243
214
|
|
|
244
|
-
if ((!wltpConsumptionValue && !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
|
|
245
|
-
return <>{wltpPowerCombinedDefaultValue}, {wltpCo2ElectricDefaultValue}</>;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
215
|
return <>{consumptionValue} <br /> {co2Value} </>;
|
|
249
216
|
}
|
|
250
217
|
},
|
|
@@ -277,7 +244,7 @@ const getDecoratedLightProps = (
|
|
|
277
244
|
: null;
|
|
278
245
|
|
|
279
246
|
const co2 = car.environmentEmissions.co2;
|
|
280
|
-
const wltpCo2 = car.
|
|
247
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
281
248
|
|
|
282
249
|
const co2Value = Number.isFinite(co2)
|
|
283
250
|
? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
|
|
@@ -291,15 +258,6 @@ const getDecoratedLightProps = (
|
|
|
291
258
|
? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language), unit: translatedUnit })
|
|
292
259
|
: null;
|
|
293
260
|
|
|
294
|
-
const wltpCo2DefaultWtdValue = t('vehicleProps:value.wltpCo2WtdCombined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
|
|
295
|
-
const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
|
|
296
|
-
const wltpPowerCombinedDefaultValue = t('vehicleProps:value.wltpPowerCombined', { consumption: WLTP_POWER_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
297
|
-
const wltpCombinedDefaultValue = t('vehicleProps:value.consumptionCombined', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
298
|
-
|
|
299
|
-
const eightMonthsAgo = new Date();
|
|
300
|
-
eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
|
|
301
|
-
const registrationDate = new Date(firstRegistration * 1000);
|
|
302
|
-
|
|
303
261
|
const hybridPlugin = car.engineData.hybridPlugin;
|
|
304
262
|
|
|
305
263
|
if (hybridPlugin) {
|
|
@@ -310,13 +268,6 @@ const getDecoratedLightProps = (
|
|
|
310
268
|
{wltpCo2PluginValue}
|
|
311
269
|
</React.Fragment>
|
|
312
270
|
}
|
|
313
|
-
if ((!wltpWeightedPowerCombinedContent || !wltpWeightedCombinedContent || !wltpCo2PluginValue) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
|
|
314
|
-
return <React.Fragment>
|
|
315
|
-
{`${wltpPowerCombinedDefaultValue}, `}
|
|
316
|
-
{`${wltpCombinedDefaultValue}, `}
|
|
317
|
-
{wltpCo2DefaultWtdValue}
|
|
318
|
-
</React.Fragment>
|
|
319
|
-
}
|
|
320
271
|
}
|
|
321
272
|
|
|
322
273
|
if (wltpConsumptionPowerCombinedContent && wltpConsumptionCombinedContent && wltpCo2Value) {
|
|
@@ -327,13 +278,6 @@ const getDecoratedLightProps = (
|
|
|
327
278
|
</React.Fragment>
|
|
328
279
|
}
|
|
329
280
|
|
|
330
|
-
if ((!wltpConsumptionPowerCombinedContent || !wltpConsumptionCombinedContent || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
|
|
331
|
-
return <React.Fragment>
|
|
332
|
-
{`${wltpCombinedDefaultValue}, `}
|
|
333
|
-
{wltpCo2DefaultValue}
|
|
334
|
-
</React.Fragment>
|
|
335
|
-
}
|
|
336
|
-
|
|
337
281
|
return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
|
|
338
282
|
? <React.Fragment>
|
|
339
283
|
{consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionCombinedContent} <br /> {co2Value}
|
|
@@ -352,7 +296,7 @@ const getDecoratedLightProps = (
|
|
|
352
296
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
353
297
|
const co2 = car.environmentEmissions.co2;
|
|
354
298
|
const wltpConsumptionCombined = car.consumption.wltpCombined;
|
|
355
|
-
const wltpCo2 = car.
|
|
299
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
356
300
|
|
|
357
301
|
const consumptionValue = Number.isFinite(consumptionHydrogenCombined)
|
|
358
302
|
? t('vehicleProps:value.consumptionGas', { consumption: consumptionHydrogenCombined.toLocaleString(language), unit: translatedUnit })
|
|
@@ -369,21 +313,10 @@ const getDecoratedLightProps = (
|
|
|
369
313
|
? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
|
|
370
314
|
: null;
|
|
371
315
|
|
|
372
|
-
const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
|
|
373
|
-
const wltpCombinedDefaultValue = t('vehicleProps:value.wltpCombinedGas', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
374
|
-
|
|
375
|
-
const eightMonthsAgo = new Date();
|
|
376
|
-
eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
|
|
377
|
-
const registrationDate = new Date(firstRegistration * 1000);
|
|
378
|
-
|
|
379
316
|
if (wltpConsumptionValue && wltpCo2Value) {
|
|
380
317
|
return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
|
|
381
318
|
}
|
|
382
319
|
|
|
383
|
-
if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
|
|
384
|
-
return <>{wltpCombinedDefaultValue}, {wltpCo2DefaultValue}</>;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
320
|
return <>{consumptionValue} <br /> {co2Value}</>;
|
|
388
321
|
}
|
|
389
322
|
},
|
|
@@ -397,7 +330,7 @@ const getDecoratedLightProps = (
|
|
|
397
330
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
398
331
|
const co2 = car.environmentEmissions.co2;
|
|
399
332
|
const wltpConsumptionCombined = car.consumption.wltpCombined;
|
|
400
|
-
const wltpCo2 = car.
|
|
333
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
401
334
|
|
|
402
335
|
const consumptionValue = Number.isFinite(consumptionGasCombined)
|
|
403
336
|
? t('vehicleProps:value.consumptionGas', { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
|
|
@@ -415,21 +348,10 @@ const getDecoratedLightProps = (
|
|
|
415
348
|
? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
|
|
416
349
|
: null;
|
|
417
350
|
|
|
418
|
-
const wltpCo2DefaultValue = t('vehicleProps:value.wltpCo2Combined', { co2: WLTP_CO2_DEFAULT.toLocaleString(language) });
|
|
419
|
-
const wltpCombinedDefaultValue = t('vehicleProps:value.wltpCombinedGas', { consumption: WLTP_COMBINED_DEFAULT.toLocaleString(language), unit: translatedUnit });
|
|
420
|
-
|
|
421
|
-
const eightMonthsAgo = new Date();
|
|
422
|
-
eightMonthsAgo.setMonth(eightMonthsAgo.getMonth() - 8); // Subtract 8 months from the current date
|
|
423
|
-
const registrationDate = new Date(firstRegistration * 1000);
|
|
424
|
-
|
|
425
351
|
if (wltpConsumptionValue && wltpCo2Value) {
|
|
426
352
|
return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
|
|
427
353
|
}
|
|
428
354
|
|
|
429
|
-
if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
|
|
430
|
-
return <>{wltpCombinedDefaultValue}, {wltpCo2DefaultValue}</>;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
355
|
return <>{consumptionValue} <br /> {co2Value}</>;
|
|
434
356
|
}
|
|
435
357
|
},
|
|
@@ -9,7 +9,7 @@ import { EMISSION_STICKERS_ICONS, WP_EMISSION_STICKERS_ICONS } from '../constant
|
|
|
9
9
|
import { DELIVERY_PERIODS_EXTRA } from '../constants';
|
|
10
10
|
import { IDecoratedProp, ICar } from '../types/types';
|
|
11
11
|
import { getFormattedPrice } from '../utils/CommonUtils';
|
|
12
|
-
import {
|
|
12
|
+
import { getVehicleTax, getFuelPrice, co2DefaultCostsLow, co2DefaultCostsMedium, co2DefaultCostsHigh, getBaseFuelPrice, getCo2Price } from '@bytebrand/fe-financing';
|
|
13
13
|
|
|
14
14
|
const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
|
|
15
15
|
const count: number = +DELIVERY_PERIODS_EXTRA.find((period: any) => period.value === deliveryPeriod).label;
|
|
@@ -72,9 +72,7 @@ const getDecoratedProps = (
|
|
|
72
72
|
car: ICar, // @TODO should have a proper interface
|
|
73
73
|
t: (key: string, options?: object) => string,
|
|
74
74
|
language: string = 'en',
|
|
75
|
-
simplifiedLabels: boolean = false
|
|
76
|
-
getFuelPrice?: (fuelSelector: string, consumption: IWltpConsumption, hybridPlugin?: boolean) => number,
|
|
77
|
-
getVehicleTax?: (fuelType: string, cubicCapacity: number, co2: number, firstRegistration: number) => number
|
|
75
|
+
simplifiedLabels: boolean = false // shortened labels for repsonsive layout (see 'power'),
|
|
78
76
|
): IDecoratedProp => {
|
|
79
77
|
const {
|
|
80
78
|
offer = {},
|
|
@@ -1171,7 +1169,7 @@ const getDecoratedProps = (
|
|
|
1171
1169
|
wltpCo2Discharged: {
|
|
1172
1170
|
title: t('vehicleProps:title.wltpCo2Discharged'),
|
|
1173
1171
|
get value() {
|
|
1174
|
-
const wltpCo2 = car.environmentEmissions.
|
|
1172
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
1175
1173
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
1176
1174
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
1177
1175
|
return Number.isFinite(wltpCo2)
|
|
@@ -1552,41 +1550,49 @@ const getDecoratedProps = (
|
|
|
1552
1550
|
}
|
|
1553
1551
|
const fuelCost = getFuelPrice(fuel, consumption, hybridPlugin);
|
|
1554
1552
|
return Number.isFinite(fuelCost)
|
|
1555
|
-
? t('vehicleProps:value.
|
|
1553
|
+
? t('vehicleProps:value.pricePerYear', { price: getFormattedPrice(fuelCost, '$,.2f') })
|
|
1556
1554
|
: t('vehicleProps:value.na');
|
|
1557
1555
|
}
|
|
1558
1556
|
},
|
|
1559
1557
|
wltpCo2CostsLow: {
|
|
1560
|
-
title: t('vehicleProps:title.wltpCo2LowPrice'),
|
|
1558
|
+
title: t('vehicleProps:title.wltpCo2LowPrice', { price: co2DefaultCostsLow }),
|
|
1561
1559
|
get value() {
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1564
|
-
|
|
1560
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
1561
|
+
const { co2PriceLow } = getCo2Price(wltpCo2);
|
|
1562
|
+
return Number.isFinite(co2PriceLow)
|
|
1563
|
+
? t('vehicleProps:value.wltpCo2Price', { price: getFormattedPrice(co2PriceLow, '$,.2f') })
|
|
1565
1564
|
: t('vehicleProps:value.na');
|
|
1566
1565
|
}
|
|
1567
1566
|
},
|
|
1568
1567
|
wltpCo2CostsMiddle: {
|
|
1569
|
-
title: t('vehicleProps:title.wltpCo2MidPrice'),
|
|
1568
|
+
title: t('vehicleProps:title.wltpCo2MidPrice', { price: co2DefaultCostsMedium }),
|
|
1570
1569
|
get value() {
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1573
|
-
|
|
1570
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
1571
|
+
const { co2PriceMedium } = getCo2Price(wltpCo2);
|
|
1572
|
+
return Number.isFinite(co2PriceMedium)
|
|
1573
|
+
? t('vehicleProps:value.wltpCo2Price', { price: getFormattedPrice(co2PriceMedium, '$,.2f') })
|
|
1574
1574
|
: t('vehicleProps:value.na');
|
|
1575
1575
|
}
|
|
1576
1576
|
},
|
|
1577
1577
|
wltpCo2CostsHigh: {
|
|
1578
|
-
title: t('vehicleProps:title.wltpCo2HighPrice'),
|
|
1578
|
+
title: t('vehicleProps:title.wltpCo2HighPrice', { price: co2DefaultCostsHigh }),
|
|
1579
1579
|
get value() {
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
|
|
1580
|
+
const wltpCo2 = car.environmentEmissions.wltpCo2;
|
|
1581
|
+
const { co2PriceHigh } = getCo2Price(wltpCo2);
|
|
1582
|
+
return Number.isFinite(co2PriceHigh)
|
|
1583
|
+
? t('vehicleProps:value.wltpCo2Price', { price: getFormattedPrice(co2PriceHigh, '$,.2f') })
|
|
1583
1584
|
: t('vehicleProps:value.na');
|
|
1584
1585
|
}
|
|
1585
1586
|
},
|
|
1586
1587
|
powerPrice: {
|
|
1587
1588
|
title: t('vehicleProps:title.powerPrice'),
|
|
1588
1589
|
get value() {
|
|
1589
|
-
const
|
|
1590
|
+
const fuel = car.consumption.fuel;
|
|
1591
|
+
const { hybridPlugin } = car.engineData;
|
|
1592
|
+
|
|
1593
|
+
const basePowerPrice = getBaseFuelPrice(fuel, hybridPlugin).powerPrice;
|
|
1594
|
+
const powerPrice = car.costModel.powerPrice ? car.costModel.powerPrice : basePowerPrice;
|
|
1595
|
+
|
|
1590
1596
|
return Number.isFinite(powerPrice)
|
|
1591
1597
|
? t('vehicleProps:value.powerPrice', { price: getFormattedPrice(powerPrice, '$,.2f') })
|
|
1592
1598
|
: t('vehicleProps:value.na');
|
|
@@ -1596,21 +1602,11 @@ const getDecoratedProps = (
|
|
|
1596
1602
|
title: t('vehicleProps:title.fuelPrice'),
|
|
1597
1603
|
get value() {
|
|
1598
1604
|
const fuel = car.consumption.fuel;
|
|
1599
|
-
const wltpCombined = car.consumption.wltpCombined || car.consumption.wltpWeightedCombined;
|
|
1600
|
-
const wltpPowerCombined = car.consumption.wltpPowerCombined || car.consumption.wltpWeightedPowerCombined;
|
|
1601
|
-
const wltpWeightedCombined = car.consumption.wltpWeightedCombined;
|
|
1602
|
-
const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
|
|
1603
|
-
|
|
1604
|
-
const wltpConsumption = {
|
|
1605
|
-
wltpCombined,
|
|
1606
|
-
wltpPowerCombined,
|
|
1607
|
-
wltpWeightedCombined,
|
|
1608
|
-
wltpWeightedPowerCombined
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
1605
|
const { hybridPlugin } = car.engineData;
|
|
1612
1606
|
|
|
1613
|
-
const
|
|
1607
|
+
const baseFuelPrice = getBaseFuelPrice(fuel, hybridPlugin);
|
|
1608
|
+
|
|
1609
|
+
const fuelPrice = car.costModel.fuelPrice ? car.costModel.fuelPrice : baseFuelPrice;
|
|
1614
1610
|
return Number.isFinite(fuelPrice)
|
|
1615
1611
|
? t('vehicleProps:value.fuelPrice', { price: getFormattedPrice(fuelPrice, '$,.2f') })
|
|
1616
1612
|
: t('vehicleProps:value.na');
|
|
@@ -48,7 +48,7 @@ const environmentPluginHybridWLTP = ['wltpWeightedCombined', 'wltpTotalRange', '
|
|
|
48
48
|
'fuelPrice', 'powerPrice', 'consumptionPriceYear', 'wltpEnergyEfficiencyClass'];
|
|
49
49
|
const environmentElectroBenzinDieselEthanolHybridWLTP = ['wltpCombined', 'wltpCo2', 'wltpSlow', 'wltpMedium', 'wltpFast', 'wltpVeryFast', 'fuelPrice', 'consumptionPriceYear', 'wltpEnergyEfficiencyClass'];
|
|
50
50
|
const environmentHydrogenWLTP = ['wltpCombinedGas', 'wltpCo2', 'wltpSlowGas', 'wltpMediumGas', 'wltpFastGas', 'wltpVeryFastGas', 'fuelPrice', 'consumptionPriceYear', 'wltpEnergyEfficiencyClass'];
|
|
51
|
-
const costModel = ['wltpEnergyCosts', '
|
|
51
|
+
const costModel = ['wltpEnergyCosts', 'wltpCo2CostsMiddle', 'wltpCo2CostsLow', 'wltpCo2CostsHigh', 'wltpCostModelTax'];
|
|
52
52
|
|
|
53
53
|
export const engineDetails: IEngineDetails = [
|
|
54
54
|
{
|