@bytebrand/fe-ui-core-autobahn 1.0.177 → 1.0.179
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/data/toAutobahnCar.ts
CHANGED
|
@@ -103,13 +103,13 @@ function pos(v: any): number | undefined {
|
|
|
103
103
|
return n != null && n > 0 ? n : undefined;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
const KG_FUELS = ['selector_fuel_naturalGas', '
|
|
106
|
+
/** fuels whose consumption is measured in kg/100 km (cbdConsumptionUnit set); Autogas/LPG is in litres. */
|
|
107
|
+
const KG_FUELS = ['selector_fuel_naturalGas', 'selector_fuel_hydrogen', 'selector_fuel_ethanol'];
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* EnVKV combined-consumption label, fuel-aware. Electric cars consume kWh — their
|
|
111
111
|
* l/100km fields (wltpCombined/consumptionCombined-as-liters) arrive as 0, so the
|
|
112
|
-
* flat `l/100 km` template printed "0 l/100 km" on every EV; gas/hydrogen cars
|
|
112
|
+
* flat `l/100 km` template printed "0 l/100 km" on every EV; natural gas/hydrogen cars
|
|
113
113
|
* measure kg. WLTP figure preferred, else NEDC — same order as before.
|
|
114
114
|
*/
|
|
115
115
|
function consumptionLabel(consumption: any, language?: string): string {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.179",
|
|
4
4
|
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -48,6 +48,10 @@ export const cbdFuel = (key: string) => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
/** The consumptionGas* and wltp*Gas props are shared: Autogas/LPG is in litres, natural gas and hydrogen in kg. */
|
|
52
|
+
export const gasConsumptionTemplate = (fuel?: string) =>
|
|
53
|
+
fuel === 'selector_fuel_carGas' ? 'vehicleProps:value.consumption' : 'vehicleProps:value.consumptionGas';
|
|
54
|
+
|
|
51
55
|
export const cbdConsumptionUnit = (key: string) => {
|
|
52
56
|
switch (key) {
|
|
53
57
|
case 'selector_fuel_petrol':
|
|
@@ -60,7 +64,7 @@ export const cbdConsumptionUnit = (key: string) => {
|
|
|
60
64
|
return 'kg/100km';
|
|
61
65
|
break;
|
|
62
66
|
case 'selector_fuel_carGas':
|
|
63
|
-
return '
|
|
67
|
+
return 'l/100km';
|
|
64
68
|
break;
|
|
65
69
|
case 'selector_fuel_electrical':
|
|
66
70
|
return 'kWh/100km';
|
|
@@ -94,7 +98,7 @@ export const cbdConsumptionUnitWithKomb = (key: string) => {
|
|
|
94
98
|
return 'kg/100km (komb)*';
|
|
95
99
|
break;
|
|
96
100
|
case 'selector_fuel_carGas':
|
|
97
|
-
return '
|
|
101
|
+
return 'l/100km (komb)*';
|
|
98
102
|
break;
|
|
99
103
|
case 'selector_fuel_electrical':
|
|
100
104
|
return 'kWh/100km (komb)*';
|
|
@@ -7,6 +7,7 @@ import { DELIVERY_PERIODS_EXTRA } from '../constants/core';
|
|
|
7
7
|
import moment from 'moment';
|
|
8
8
|
import { IDecoratedProp } from '../types/types';
|
|
9
9
|
import { strictAccidentStatus } from './accidentDisclosure';
|
|
10
|
+
import { gasConsumptionTemplate } from './cbdSelectors';
|
|
10
11
|
|
|
11
12
|
interface IDecoratedProps {
|
|
12
13
|
[key: string]: IDecoratedProp;
|
|
@@ -430,7 +431,7 @@ const getDecoratedLightProps = (
|
|
|
430
431
|
: null;
|
|
431
432
|
|
|
432
433
|
const consumptionValue = Number.isFinite(consumptionGasCombined)
|
|
433
|
-
? t(
|
|
434
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
|
|
434
435
|
: t('vehicleProps:value.na');
|
|
435
436
|
|
|
436
437
|
const co2Value = Number.isFinite(co2)
|
|
@@ -438,7 +439,7 @@ const getDecoratedLightProps = (
|
|
|
438
439
|
: t('vehicleProps:value.na');
|
|
439
440
|
|
|
440
441
|
const wltpConsumptionValue = Number.isFinite(wltpConsumptionCombined)
|
|
441
|
-
? t(
|
|
442
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpConsumptionCombined.toLocaleString(language), unit: translatedUnit })
|
|
442
443
|
: null;
|
|
443
444
|
|
|
444
445
|
const wltpCo2Value = Number.isFinite(wltpCo2)
|
|
@@ -10,6 +10,7 @@ import { DELIVERY_PERIODS_EXTRA } from '../constants';
|
|
|
10
10
|
import { IDecoratedProp, ICar, IFinancingUtils } from '../types/types';
|
|
11
11
|
import { getFormattedPrice } from '../utils/CommonUtils';
|
|
12
12
|
import { strictAccidentStatus } from './accidentDisclosure';
|
|
13
|
+
import { gasConsumptionTemplate } from './cbdSelectors';
|
|
13
14
|
|
|
14
15
|
const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
|
|
15
16
|
const count: number = +DELIVERY_PERIODS_EXTRA.find((period: any) => period.value === deliveryPeriod).label;
|
|
@@ -538,7 +539,7 @@ const getDecoratedProps = (
|
|
|
538
539
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
539
540
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
540
541
|
return Number.isFinite(consumptionGasInner)
|
|
541
|
-
? t(
|
|
542
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: consumptionGasInner.toLocaleString(language), unit: translatedUnit })
|
|
542
543
|
: t('vehicleProps:value.na');
|
|
543
544
|
}
|
|
544
545
|
},
|
|
@@ -603,7 +604,7 @@ const getDecoratedProps = (
|
|
|
603
604
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
604
605
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
605
606
|
return Number.isFinite(consumptionGasOuter)
|
|
606
|
-
? t(
|
|
607
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: consumptionGasOuter.toLocaleString(language), unit: translatedUnit })
|
|
607
608
|
: t('vehicleProps:value.na');
|
|
608
609
|
}
|
|
609
610
|
},
|
|
@@ -668,7 +669,7 @@ const getDecoratedProps = (
|
|
|
668
669
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
669
670
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
670
671
|
return Number.isFinite(consumptionGasCombined)
|
|
671
|
-
? t(
|
|
672
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
|
|
672
673
|
: t('vehicleProps:value.na');
|
|
673
674
|
}
|
|
674
675
|
},
|
|
@@ -804,7 +805,7 @@ const getDecoratedProps = (
|
|
|
804
805
|
const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
|
|
805
806
|
|
|
806
807
|
const consumptionValue = Number.isFinite(consumptionGasCombined)
|
|
807
|
-
? t(
|
|
808
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
|
|
808
809
|
: t('vehicleProps:value.na');
|
|
809
810
|
|
|
810
811
|
const co2Value = Number.isFinite(co2)
|
|
@@ -812,7 +813,7 @@ const getDecoratedProps = (
|
|
|
812
813
|
: t('vehicleProps:value.na');
|
|
813
814
|
|
|
814
815
|
const wltpConsumptionValue = Number.isFinite(wltpConsumptionCombined)
|
|
815
|
-
? t(
|
|
816
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpConsumptionCombined.toLocaleString(language), unit: translatedUnit })
|
|
816
817
|
: null;
|
|
817
818
|
|
|
818
819
|
const wltpCo2Value = Number.isFinite(wltpCo2)
|
|
@@ -1340,7 +1341,7 @@ const getDecoratedProps = (
|
|
|
1340
1341
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
1341
1342
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
1342
1343
|
return Number.isFinite(wltpCombined)
|
|
1343
|
-
? t(
|
|
1344
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpCombined.toLocaleString(language), unit: translatedUnit })
|
|
1344
1345
|
: t('vehicleProps:value.na');
|
|
1345
1346
|
}
|
|
1346
1347
|
},
|
|
@@ -1373,7 +1374,7 @@ const getDecoratedProps = (
|
|
|
1373
1374
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
1374
1375
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
1375
1376
|
return Number.isFinite(wltpSlow)
|
|
1376
|
-
? t(
|
|
1377
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpSlow.toLocaleString(language), unit: translatedUnit })
|
|
1377
1378
|
: t('vehicleProps:value.na');
|
|
1378
1379
|
}
|
|
1379
1380
|
},
|
|
@@ -1406,7 +1407,7 @@ const getDecoratedProps = (
|
|
|
1406
1407
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
1407
1408
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
1408
1409
|
return Number.isFinite(wltpMedium)
|
|
1409
|
-
? t(
|
|
1410
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpMedium.toLocaleString(language), unit: translatedUnit })
|
|
1410
1411
|
: t('vehicleProps:value.na');
|
|
1411
1412
|
}
|
|
1412
1413
|
},
|
|
@@ -1439,7 +1440,7 @@ const getDecoratedProps = (
|
|
|
1439
1440
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
1440
1441
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
1441
1442
|
return Number.isFinite(wltpFast)
|
|
1442
|
-
? t(
|
|
1443
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpFast.toLocaleString(language), unit: translatedUnit })
|
|
1443
1444
|
: t('vehicleProps:value.na');
|
|
1444
1445
|
}
|
|
1445
1446
|
},
|
|
@@ -1472,7 +1473,7 @@ const getDecoratedProps = (
|
|
|
1472
1473
|
const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
|
|
1473
1474
|
const translatedUnit = t(`cbd:${consumptionUnit}`);
|
|
1474
1475
|
return Number.isFinite(wltpVeryFast)
|
|
1475
|
-
? t(
|
|
1476
|
+
? t(gasConsumptionTemplate(car.consumption.fuel), { consumption: wltpVeryFast.toLocaleString(language), unit: translatedUnit })
|
|
1476
1477
|
: t('vehicleProps:value.na');
|
|
1477
1478
|
}
|
|
1478
1479
|
},
|