@bytebrand/fe-ui-core 4.6.14 → 4.8.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.6.14",
3
+ "version": "4.8.0",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -4,7 +4,7 @@ import { Visible } from 'react-grid-system';
4
4
  import _get from 'lodash/get';
5
5
 
6
6
  import { getPowerLabel } from '../../framework/vehiclesProps/decoratedProps';
7
- import { getVehicleDetails, getOverviewDetails, dimensionDetails, availAbilityDetails, colorAndMaterialDetails, getWltpValues } from '../../framework/vehiclesProps/vehicleDetails';
7
+ import { getVehicleDetails, getOverviewDetails, dimensionDetails, availAbilityDetails, colorAndMaterialDetails, getWltpValues, getCostModelValues } from '../../framework/vehiclesProps/vehicleDetails';
8
8
 
9
9
  import {
10
10
  IEquipmentProps,
@@ -137,7 +137,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
137
137
  const engineProps = getVehicleDetails(consumption.fuel, 'engineData', engineData.hybridPlugin);
138
138
  const environmentProps = getVehicleDetails(consumption.fuel, 'environment', engineData.hybridPlugin);
139
139
  const wltpProps = getWltpValues(consumption.fuel, engineData.hybridPlugin);
140
- // const costModelProps = getCostModelValues();
140
+ const costModelProps = getCostModelValues();
141
141
  const dimensionProps = dimensionDetails;
142
142
  const availAbilityProps = availAbilityDetails;
143
143
  const colorAndMaterialProps = colorAndMaterialDetails;
@@ -148,6 +148,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
148
148
  {this.renderTable(decoratedProps, dimensionProps, t('accordion.tableDimensions'))}
149
149
  {this.renderTable(decoratedProps, wltpProps, t('accordion.tableEnvironmentWLTP'))}
150
150
  {this.renderTable(decoratedProps, environmentProps, t('accordion.tableEnvironment'))}
151
+ {this.renderTable(decoratedProps, costModelProps, t('accordion.tableCostsPerYear'))}
151
152
  {this.renderTable(decoratedProps, availAbilityProps, t('accordion.tableAvailability'))}
152
153
  {this.renderTable(decoratedProps, colorAndMaterialProps, t('accordion.tableMaterial'))}
153
154
  {this.renderExtendTable(carEquipment, t('accordion.tableEqipment'))}
@@ -18,6 +18,12 @@ export const FIVE = 5; // tab index
18
18
  export const FIFTEEN = 15; // font-size
19
19
  export const FOURTEEN = 14;
20
20
  export const HUNDRED = 100;
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
+
21
27
  export const CONTAINER_STYLES = {
22
28
  display: 'flex',
23
29
  flexDirection: 'row',
@@ -349,3 +349,10 @@ export interface ITFunction {
349
349
  <T = string>(key: string, options?: object): T;
350
350
  <T = string>(keys: string[], options?: object): T;
351
351
  }
352
+
353
+ export interface IWltpConsumption {
354
+ wltpCombined?: number;
355
+ wltpPowerCombined?: number;
356
+ wltpWeightedCombined?: number;
357
+ wltpWeightedPowerCombined?: number;
358
+ }
@@ -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 } from '../constants';
6
+ import { DELIVERY_PERIODS_EXTRA, WLTP_COMBINED_DEFAULT, WLTP_CO2_DEFAULT, WLTP_CO2_ELECTRIC_DEFAULT, WLTP_POWER_COMBINED_DEFAULT } from '../constants';
7
7
  import moment from 'moment';
8
8
  import { IDecoratedProp } from '../types/types';
9
9
 
@@ -123,6 +123,7 @@ const getDecoratedLightProps = (
123
123
  const translatedUnit = t(`cbd:${consumptionUnit}`);
124
124
  const wltpConsumptionCombined = car.consumption.wltpCombined || car.consumption.wltpWeightedCombined;
125
125
  const wltpCo2 = car.environmentEmissions.wltpCo2 || car.consumption.wltpCo2;
126
+ const consumptionPowerCombined = car.consumption.consumptionCombined;
126
127
 
127
128
  const co2 = car.environmentEmissions.co2;
128
129
 
@@ -142,10 +143,23 @@ const getDecoratedLightProps = (
142
143
  ? t('vehicleProps:value.consumptionCombined', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit })
143
144
  : t('vehicleProps:value.na');
144
145
 
146
+ const consumptionPowerCombinedContent = t('vehicleProps:value.consumptionPowerCombined', { consumption: consumptionPowerCombined.toLocaleString(language), unit: translatedUnit });
147
+
145
148
  const co2Value = Number.isFinite(co2)
146
149
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
147
150
  : t('vehicleProps:value.na');
148
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
+
149
163
  const hybridPlugin = car.engineData.hybridPlugin;
150
164
  const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
151
165
  const wltpWeightedCombined = car.consumption.wltpWeightedCombined;
@@ -154,17 +168,36 @@ const getDecoratedLightProps = (
154
168
  const wltpWeightedCombinedContent = wltpWeightedCombined ? t('vehicleProps:value.wltpCombined', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit }) : null;
155
169
 
156
170
  if (hybridPlugin) {
157
- return <React.Fragment>
158
- {wltpWeightedPowerCombinedContent ? `${wltpWeightedPowerCombinedContent}, ` : ''}
159
- {wltpWeightedCombinedContent ? `${wltpWeightedCombinedContent}, ` : ''}
160
- {wltpCo2PluginValue}
161
- </React.Fragment>
171
+ if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent && wltpCo2PluginValue) {
172
+ return <React.Fragment>
173
+ {`${wltpWeightedPowerCombinedContent}, `}
174
+ {`${wltpWeightedCombinedContent}, `}
175
+ {wltpCo2PluginValue}
176
+ </React.Fragment>
177
+ }
178
+ if ((!wltpWeightedPowerCombinedContent || !wltpWeightedCombinedContent || !wltpCo2PluginValue) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
179
+ return <React.Fragment>
180
+ {`${wltpPowerCombinedDefaultValue}, `}
181
+ {`${wltpCombinedDefaultValue}, `}
182
+ {wltpCo2DefaultWtdValue}
183
+ </React.Fragment>
184
+ }
185
+ return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
186
+ ? <React.Fragment>
187
+ {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionValue} <br /> {co2Value}
188
+ </React.Fragment>
189
+ : t('vehicleProps:value.na');
190
+
162
191
  }
163
192
 
164
193
  if (wltpConsumptionValue && wltpCo2Value) {
165
194
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
166
195
  }
167
196
 
197
+ if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
198
+ return <>{wltpCombinedDefaultValue} {wltpCo2DefaultValue}</>;
199
+ }
200
+
168
201
  return <>{consumptionValue} <br /> {co2Value}</>;
169
202
  }
170
203
  },
@@ -177,9 +210,17 @@ const getDecoratedLightProps = (
177
210
  const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
178
211
  const translatedUnit = t(`cbd:${consumptionUnit}`);
179
212
  const co2 = car.environmentEmissions.co2;
180
- const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined;
213
+ const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined || car.consumption.wltpWeightedPowerCombined;
181
214
  const wltpCo2 = car.consumption.wltpCo2 || car.environmentEmissions.wltpCo2;
182
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);
223
+
183
224
  const wltpConsumptionValue = Number.isFinite(wltpConsumptionPowerCombined)
184
225
  ? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
185
226
  : null;
@@ -200,6 +241,10 @@ const getDecoratedLightProps = (
200
241
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
201
242
  }
202
243
 
244
+ if ((!wltpConsumptionValue && !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
245
+ return <>{wltpPowerCombinedDefaultValue}, {wltpCo2ElectricDefaultValue}</>;
246
+ }
247
+
203
248
  return <>{consumptionValue} <br /> {co2Value} </>;
204
249
  }
205
250
  },
@@ -210,8 +255,10 @@ const getDecoratedLightProps = (
210
255
  get value() {
211
256
  const consumptionCombined = +car.consumption.consumptionCombined;
212
257
  const consumptionPowerCombined = +car.consumption.consumptionPowerCombined;
213
- const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined;
214
- const wltpConsumptionCombined = car.consumption.wltpCombined;
258
+ const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined || car.consumption.wltpWeightedPowerCombined;
259
+
260
+ const wltpConsumptionCombined = car.consumption.wltpCombined || car.consumption.wltpWeightedCombined;
261
+
215
262
  const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
216
263
  const translatedUnit = t(`cbd:${consumptionUnit}`);
217
264
  const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
@@ -237,24 +284,54 @@ const getDecoratedLightProps = (
237
284
  : t('vehicleProps:value.na');
238
285
 
239
286
  const wltpCo2Value = Number.isFinite(co2)
240
- ? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language) })
241
- : null;
287
+ ? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language) })
288
+ : null;
289
+
290
+ const wltpCo2PluginValue = Number.isFinite(wltpCo2)
291
+ ? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language), unit: translatedUnit })
292
+ : null;
293
+
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);
242
302
 
243
303
  const hybridPlugin = car.engineData.hybridPlugin;
244
304
 
245
- if (wltpWeightedCombinedContent && wltpWeightedPowerCombinedContent && wltpCo2Value) {
246
- if (hybridPlugin) {
247
- return <React.Fragment>
248
- {`${wltpWeightedPowerCombinedContent}, `}
249
- {`${wltpWeightedCombinedContent}, `}
250
- {wltpCo2Value}
305
+ if (hybridPlugin) {
306
+ if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent && wltpCo2PluginValue) {
307
+ return <React.Fragment>
308
+ {`${wltpWeightedPowerCombinedContent}, `}
309
+ {`${wltpWeightedCombinedContent}, `}
310
+ {wltpCo2PluginValue}
311
+ </React.Fragment>
312
+ }
313
+ if ((!wltpWeightedPowerCombinedContent || !wltpWeightedCombinedContent || !wltpCo2PluginValue) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
314
+ return <React.Fragment>
315
+ {`${wltpPowerCombinedDefaultValue}, `}
316
+ {`${wltpCombinedDefaultValue}, `}
317
+ {wltpCo2DefaultWtdValue}
251
318
  </React.Fragment>
252
319
  }
320
+ }
321
+
322
+ if (wltpConsumptionPowerCombinedContent && wltpConsumptionCombinedContent && wltpCo2Value) {
253
323
  return <React.Fragment>
254
- {wltpConsumptionPowerCombinedContent && hybridPlugin ? `${wltpConsumptionPowerCombinedContent}, ` : ''}
255
- {wltpConsumptionPowerCombinedContent && hybridPlugin ? `${wltpConsumptionPowerCombinedContent}, ` : ''}
256
- {wltpConsumptionCombinedContent}, {wltpCo2Value}
257
- </React.Fragment>
324
+ {`${wltpConsumptionPowerCombinedContent}, `}
325
+ {`${wltpWeightedCombinedContent}, `}
326
+ {wltpCo2PluginValue}
327
+ </React.Fragment>
328
+ }
329
+
330
+ if ((!wltpConsumptionPowerCombinedContent || !wltpConsumptionCombinedContent || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
331
+ return <React.Fragment>
332
+ {`${wltpCombinedDefaultValue}, `}
333
+ {wltpCo2DefaultValue}
334
+ </React.Fragment>
258
335
  }
259
336
 
260
337
  return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
@@ -292,10 +369,21 @@ const getDecoratedLightProps = (
292
369
  ? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
293
370
  : null;
294
371
 
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
+
295
379
  if (wltpConsumptionValue && wltpCo2Value) {
296
380
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
297
381
  }
298
382
 
383
+ if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
384
+ return <>{wltpCombinedDefaultValue}, {wltpCo2DefaultValue}</>;
385
+ }
386
+
299
387
  return <>{consumptionValue} <br /> {co2Value}</>;
300
388
  }
301
389
  },
@@ -327,10 +415,21 @@ const getDecoratedLightProps = (
327
415
  ? t('vehicleProps:value.wltpCo2Combined', { co2: wltpCo2.toLocaleString(language) })
328
416
  : null;
329
417
 
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
+
330
425
  if (wltpConsumptionValue && wltpCo2Value) {
331
426
  return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
332
427
  }
333
428
 
429
+ if ((!wltpConsumptionValue || !wltpCo2Value) && (mileage <= 1000 || registrationDate >= eightMonthsAgo)) {
430
+ return <>{wltpCombinedDefaultValue}, {wltpCo2DefaultValue}</>;
431
+ }
432
+
334
433
  return <>{consumptionValue} <br /> {co2Value}</>;
335
434
  }
336
435
  },
@@ -9,6 +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 { IWltpConsumption } from '../types/types';
12
13
 
13
14
  const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
14
15
  const count: number = +DELIVERY_PERIODS_EXTRA.find((period: any) => period.value === deliveryPeriod).label;
@@ -71,7 +72,9 @@ const getDecoratedProps = (
71
72
  car: ICar, // @TODO should have a proper interface
72
73
  t: (key: string, options?: object) => string,
73
74
  language: string = 'en',
74
- simplifiedLabels: boolean = false // shortened labels for repsonsive layout (see 'power')
75
+ simplifiedLabels: boolean = false, // shortened labels for repsonsive layout (see 'power'),
76
+ getFuelPrice?: (fuelSelector: string, consumption: IWltpConsumption, hybridPlugin?: boolean) => number,
77
+ getVehicleTax?: (fuelType: string, cubicCapacity: number, co2: number, firstRegistration: number) => number
75
78
  ): IDecoratedProp => {
76
79
  const {
77
80
  offer = {},
@@ -1538,25 +1541,25 @@ const getDecoratedProps = (
1538
1541
  : t('vehicleProps:value.na');
1539
1542
  }
1540
1543
  },
1541
- // wltpEnergyCosts: {
1542
- // title: t('vehicleProps:title.wltpEnergyCosts'),
1543
- // get value() {
1544
- // const { fuel } = car.consumption;
1545
- // const { wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined } = car.consumption;
1546
- // const { hybridPlugin } = car.engineData;
1547
- // const consumption = {
1548
- // wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined
1549
- // }
1550
- // const fuelCost = getFuelPrice(fuel, consumption, hybridPlugin);
1551
- // return Number.isFinite(fuelCost)
1552
- // ? t('vehicleProps:value.price', { price: getFormattedPrice(fuelCost, '$,.2f') })
1553
- // : t('vehicleProps:value.na');
1554
- // }
1555
- // },
1544
+ wltpEnergyCosts: {
1545
+ title: t('vehicleProps:title.wltpEnergyCosts'),
1546
+ get value() {
1547
+ const { fuel } = car.consumption;
1548
+ const { wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined } = car.consumption;
1549
+ const { hybridPlugin } = car.engineData;
1550
+ const consumption = {
1551
+ wltpCombined, wltpPowerCombined, wltpWeightedCombined, wltpWeightedPowerCombined
1552
+ }
1553
+ const fuelCost = getFuelPrice(fuel, consumption, hybridPlugin);
1554
+ return Number.isFinite(fuelCost)
1555
+ ? t('vehicleProps:value.price', { price: getFormattedPrice(fuelCost, '$,.2f') })
1556
+ : t('vehicleProps:value.na');
1557
+ }
1558
+ },
1556
1559
  wltpCo2CostsLow: {
1557
1560
  title: t('vehicleProps:title.wltpCo2LowPrice'),
1558
1561
  get value() {
1559
- const { basePrice } = car.costModel.co2Costs.low;
1562
+ const basePrice = car.costModel.co2Costs.low.basePrice || 30;
1560
1563
  return Number.isFinite(basePrice)
1561
1564
  ? t('vehicleProps:value.price', { price: getFormattedPrice(basePrice, '$,.2f') })
1562
1565
  : t('vehicleProps:value.na');
@@ -1565,7 +1568,7 @@ const getDecoratedProps = (
1565
1568
  wltpCo2CostsMiddle: {
1566
1569
  title: t('vehicleProps:title.wltpCo2MidPrice'),
1567
1570
  get value() {
1568
- const { basePrice } = car.costModel.co2Costs.middle;
1571
+ const basePrice = car.costModel.co2Costs.middle.basePrice || 50;
1569
1572
  return Number.isFinite(basePrice)
1570
1573
  ? t('vehicleProps:value.price', { price: getFormattedPrice(basePrice, '$,.2f') })
1571
1574
  : t('vehicleProps:value.na');
@@ -1574,7 +1577,7 @@ const getDecoratedProps = (
1574
1577
  wltpCo2CostsHigh: {
1575
1578
  title: t('vehicleProps:title.wltpCo2HighPrice'),
1576
1579
  get value() {
1577
- const { basePrice } = car.costModel.co2Costs.high;
1580
+ const basePrice = car.costModel.co2Costs.high.basePrice || 70;
1578
1581
  return Number.isFinite(basePrice)
1579
1582
  ? t('vehicleProps:value.price', { price: getFormattedPrice(basePrice, '$,.2f') })
1580
1583
  : t('vehicleProps:value.na');
@@ -1592,7 +1595,22 @@ const getDecoratedProps = (
1592
1595
  fuelPrice: {
1593
1596
  title: t('vehicleProps:title.fuelPrice'),
1594
1597
  get value() {
1595
- const { fuelPrice } = car.costModel;
1598
+ 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
+ const { hybridPlugin } = car.engineData;
1612
+
1613
+ const fuelPrice = car.costModel.fuelPrice ? car.costModel.fuelPrice : getFuelPrice(fuel, wltpConsumption, hybridPlugin);
1596
1614
  return Number.isFinite(fuelPrice)
1597
1615
  ? t('vehicleProps:value.fuelPrice', { price: getFormattedPrice(fuelPrice, '$,.2f') })
1598
1616
  : t('vehicleProps:value.na');
@@ -1610,7 +1628,10 @@ const getDecoratedProps = (
1610
1628
  wltpCostModelTax: {
1611
1629
  title: t('vehicleProps:title.wltpVehicleTax'),
1612
1630
  get value() {
1613
- const { tax } = car.costModel;
1631
+ const cubicCapacity = car.engineData.cubicCapacity;
1632
+ const fuel = car.consumption.fuel;
1633
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
1634
+ const tax = car.costModel.tax ? car.costModel.tax : getVehicleTax(fuel, cubicCapacity, wltpCo2, firstRegistration);
1614
1635
  return Number.isFinite(tax)
1615
1636
  ? t('vehicleProps:value.price', { price: getFormattedPrice(tax, '$,.2f') })
1616
1637
  : 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', 'wltpCo2CostsLow',, 'wltpCo2CostsMiddle', 'wltpCo2CostsHigh', 'wltpCostModelTax'];
51
+ const costModel = ['wltpEnergyCosts', 'wltpCo2CostsLow', 'wltpCo2CostsMiddle', 'wltpCo2CostsHigh', 'wltpCostModelTax'];
52
52
 
53
53
  export const engineDetails: IEngineDetails = [
54
54
  {
@@ -356,9 +356,9 @@ export const getWltpValues = (selector: any, hybridPlugin: any = false) => {
356
356
  }, []);
357
357
  };
358
358
 
359
- // export const getCostModelValues = () => {
360
- // return costModel;
361
- // }
359
+ export const getCostModelValues = () => {
360
+ return costModel;
361
+ }
362
362
 
363
363
  export const getOverviewDetails = (selector: any) => {
364
364
  if (Object.keys(filtered(selector)).length === 0) {