@bytebrand/fe-ui-core 4.4.0 → 4.4.2

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.4.0",
3
+ "version": "4.4.2",
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 } from '../../framework/vehiclesProps/vehicleDetails';
7
+ import { getVehicleDetails, getOverviewDetails, dimensionDetails, availAbilityDetails, colorAndMaterialDetails, getWltpValues } from '../../framework/vehiclesProps/vehicleDetails';
8
8
 
9
9
  import {
10
10
  IEquipmentProps,
@@ -64,11 +64,11 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
64
64
  {propsList.map((prop, i) => {
65
65
  const { title, subTitle, value, isVisible = true, isLongTitle = false } = decoratedProps[prop];
66
66
  return isVisible && (
67
- <div key={i} className={styles.tr}>
68
- <div className={classnames(styles.th, isLongTitle ? styles.longTitle : '')}>
67
+ <div key={i} className={title ? styles.tr : ''}>
68
+ {title && <div className={classnames(styles.th, isLongTitle ? styles.longTitle : '')}>
69
69
  <span className={styles.title}>{title}</span>
70
70
  {subTitle ? <p className={styles.subTitle}>{subTitle}</p> : null}
71
- </div>
71
+ </div>}
72
72
  <div className={styles.td}>{value}</div>
73
73
  </div>
74
74
  );
@@ -136,6 +136,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
136
136
  const { t, car: { consumption, engineData }, decoratedProps, carEquipment } = this.props;
137
137
  const engineProps = getVehicleDetails(consumption.fuel, 'engineData', engineData.hybridPlugin);
138
138
  const environmentProps = getVehicleDetails(consumption.fuel, 'environment', engineData.hybridPlugin);
139
+ const wltpProps = getWltpValues(consumption.fuel, engineData.hybridPlugin);
139
140
  const dimensionProps = dimensionDetails;
140
141
  const availAbilityProps = availAbilityDetails;
141
142
  const colorAndMaterialProps = colorAndMaterialDetails;
@@ -144,6 +145,7 @@ class AccordionWidget extends React.Component<IAccardionSectionProps, IAccardion
144
145
  <div className={styles.wrapGrid}>
145
146
  {this.renderTable(decoratedProps, engineProps, t('accordion.tableEngine'))}
146
147
  {this.renderTable(decoratedProps, dimensionProps, t('accordion.tableDimensions'))}
148
+ {this.renderTable(decoratedProps, wltpProps, t('accordion.tableEnvironmentWLTP'))}
147
149
  {this.renderTable(decoratedProps, environmentProps, t('accordion.tableEnvironment'))}
148
150
  {this.renderTable(decoratedProps, availAbilityProps, t('accordion.tableAvailability'))}
149
151
  {this.renderTable(decoratedProps, colorAndMaterialProps, t('accordion.tableMaterial'))}
@@ -1,7 +1,6 @@
1
- import React, { useState, useEffect, useRef, FunctionComponent } from 'react';
1
+ import React, { useState, useEffect, FunctionComponent } from 'react';
2
2
  import _get from 'lodash/get';
3
3
  import { Hidden } from 'react-grid-system';
4
- import { isMobileOnly } from 'react-device-detect';
5
4
  import PriceContent from './partials/PriceContent';
6
5
  import Title from './partials/Title';
7
6
  import Price from './partials/Price';
@@ -13,11 +12,6 @@ import DealerInfo from '../Alternative/DealerInfo';
13
12
  import { Skeleton } from '@mui/material';
14
13
 
15
14
  declare global {
16
- // interface Window {
17
- // Trustpilot?: {
18
- // loadFromElement: (element: HTMLElement, autoload?: boolean) => void;
19
- // };
20
- // }
21
15
  }
22
16
 
23
17
  const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> = (props) => {
@@ -34,12 +28,10 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
34
28
  setActiveTab,
35
29
  carLoaded,
36
30
  originUrl,
37
- // isAlternative,
38
31
  infoSections,
39
32
  onCurrentSalesPriceChange,
40
33
  isFetching
41
34
  } = props;
42
- // const ref = useRef(null);
43
35
  const [offerBlockOpen, setOfferBlockOpen] = useState(false);
44
36
  const onAdjustRateClick = () => setOfferBlockOpen(!offerBlockOpen);
45
37
 
@@ -112,12 +104,6 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
112
104
  }
113
105
  ];
114
106
 
115
- // useEffect(() => {
116
- // if (window.Trustpilot) {
117
- // window.Trustpilot.loadFromElement(ref.current, true);
118
- // }
119
- // }, []);
120
-
121
107
  useEffect(() => {
122
108
  const getlocalStorageActiveTabCDP = localStorage.getItem('activeTabCDP');
123
109
  if (!getlocalStorageActiveTabCDP) return;
@@ -151,26 +137,7 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
151
137
  <Title {...titleProps} />
152
138
  <Price {...priceProps} />
153
139
  <Price {...priceProps} isSticky={true} />
154
- {/* {isMobileOnly && (
155
- <div
156
- ref={ref}
157
- data-locale='de-DE'
158
- data-template-id='5419b6a8b0d04a076446a9ad'
159
- data-businessunit-id='46edfd1c0000640005017f22'
160
- data-style-height='32px'
161
- data-style-width='100%'
162
- data-theme='light'
163
- data-style-alignment='center'
164
- >
165
- <a
166
- href='https://de.trustpilot.com/review/www.auto.de'
167
- target='_blank'
168
- rel='noopener noreferrer'
169
- >
170
- Trustpilot
171
- </a>
172
- </div>
173
- )} */}
140
+ {}
174
141
  {props.children}
175
142
  </div> : <div className={styles.skeletonInfoContainer}><Skeleton /></div>
176
143
  }
@@ -17,7 +17,7 @@
17
17
  .classContainer
18
18
  position: relative
19
19
  width 100%
20
- height 10px
20
+ height 14px
21
21
 
22
22
  .classContainer:not(:last-child)
23
23
  margin-bottom: 3px
@@ -25,7 +25,7 @@
25
25
  .class
26
26
  position: relative
27
27
  display: block
28
- height 10px
28
+ height 14px
29
29
  color white
30
30
  font-size 7px
31
31
  line-height 10px
@@ -41,9 +41,28 @@
41
41
  width 0
42
42
  height 0
43
43
  border-style solid
44
- border-width 5px 0 5px 5px
44
+ border-width 8px 0 5px 5px
45
45
  border-color transparent
46
46
 
47
+ .title
48
+ font-size: 15px
49
+ font-weight: 700
50
+ color: #000000DE
51
+
52
+ .subTitle
53
+ font-size: 12px
54
+ margin: 5px 0 24px
55
+ font-weight: 400
56
+ color: #000000DE
57
+
58
+ .divider
59
+ position: absolute
60
+ width: 1px
61
+ background-color: black
62
+ top: 0
63
+ left: 161px
64
+ height: 127px
65
+
47
66
  .activeClass
48
67
  @extends .class
49
68
  position: absolute
@@ -51,6 +70,8 @@
51
70
  right -20px
52
71
  padding 0 5px
53
72
  background-color $grey-3
73
+ display: flex
74
+ align-items: center
54
75
  .activeClass::before
55
76
  content ''
56
77
  position absolute
@@ -59,9 +80,54 @@
59
80
  width 0
60
81
  height 0
61
82
  border-style solid
62
- border-width 5px 5px 5px 0
83
+ border-width 7px 5px 6px 0
63
84
  border-color transparent $grey-3 transparent transparent
64
85
 
86
+ .secondActiveClass
87
+ @extends .class
88
+ position: absolute
89
+ top: 0
90
+ right -60px
91
+ padding 0 5px
92
+ background-color $grey-3
93
+ display: flex
94
+ align-items: center
95
+ .secondActiveClass::before
96
+ content ''
97
+ position absolute
98
+ top 0
99
+ left -5px
100
+ width 0
101
+ height 0
102
+ border-style solid
103
+ border-width 7px 5px 6px 0
104
+ border-color transparent $grey-3 transparent transparent
105
+
106
+ .levelsContainer
107
+ position relative
108
+
109
+ .container
110
+ position relative
111
+
112
+ .levelTitle
113
+ top: -21px;
114
+ left: 78px;
115
+ position: absolute;
116
+ width: 74px;
117
+ font-size: 9px;
118
+ text-align: right;
119
+
120
+ .wltpLevelTitle
121
+ width: 80px;
122
+ top: -21px
123
+ left: 172px
124
+ position: absolute
125
+ font-size: 9px
126
+
127
+ .wltpLevelsContainer
128
+ padding: 13.5px 7.5px
129
+ border-top: 1px solid #e8e8e8;
130
+
65
131
  :global
66
132
  .auto_de_selector_energyEfficiencyClass_appp
67
133
  background-color: #1D9453
@@ -6,8 +6,14 @@ import styles from './CO2Efficiency.styl';
6
6
 
7
7
  interface ICO2EfficiencyProps {
8
8
  level: string;
9
+ wltpLevel?: string;
9
10
  className?: string;
11
+ title?: string;
12
+ subTitle?: string;
10
13
  t?: (key: string, options?: object) => string;
14
+ levelTitle?: string;
15
+ wltpLevelTitle?: string;
16
+ hybridPlugin?: boolean;
11
17
  }
12
18
 
13
19
  // TODO: pass efficiency classes as a list into props.
@@ -18,11 +24,12 @@ class CO2Efficiency extends React.Component<ICO2EfficiencyProps> {
18
24
  };
19
25
 
20
26
  renderLevels = () => {
21
- const { level, t } = this.props;
27
+ const { level, wltpLevel, t, hybridPlugin } = this.props;
22
28
 
23
29
  return selectors.energyEfficiencyClass.map((key: string, i: number) => {
24
30
  const width: string = `${(i + 1) * 10 + 10}px`; // tslint:disable-line
25
31
  const isActive: boolean = key === level;
32
+ const isWltpActive: boolean = key === wltpLevel;
26
33
  const className: string = classnames(styles.class, `auto_de_${key}`);
27
34
  const translatedKey: string = t(`cbd:${key}`);
28
35
 
@@ -32,15 +39,30 @@ class CO2Efficiency extends React.Component<ICO2EfficiencyProps> {
32
39
  {translatedKey}
33
40
  </span>
34
41
  {isActive && <span className={styles.activeClass}>{translatedKey}</span>}
42
+ {isWltpActive && hybridPlugin && <span className={styles.secondActiveClass}>{translatedKey}</span>}
35
43
  </div>
36
44
  ) : false;
37
- });
38
- };
45
+ })}
39
46
 
40
47
  render(): JSX.Element {
48
+ const { title, subTitle, wltpLevel, levelTitle, wltpLevelTitle, hybridPlugin } = this.props;
49
+ const wltpLevelsContainerClassNames = classnames(
50
+ { [styles.wltpLevelsContainer]: wltpLevel }
51
+ )
41
52
  return (
42
- <div className={styles.co2Efficiency}>
43
- {this.renderLevels()}
53
+ <div className={wltpLevelsContainerClassNames}>
54
+ {wltpLevel && <div className={styles.title}>{title}</div>}
55
+ {wltpLevel && <div className={styles.subTitle}>{subTitle}</div>}
56
+ <div className={styles.container}>
57
+ {wltpLevel && hybridPlugin && <div className={styles.levelTitle}>{levelTitle}</div>}
58
+ {wltpLevel && hybridPlugin && <div className={styles.wltpLevelTitle}>{wltpLevelTitle}</div>}
59
+ </div>
60
+ <div className={styles.levelsContainer}>
61
+ <div className={styles.co2Efficiency}>
62
+ {this.renderLevels()}
63
+ </div>
64
+ {wltpLevel && hybridPlugin && <div className={styles.divider}></div>}
65
+ </div>
44
66
  </div>
45
67
  );
46
68
  }
@@ -609,9 +609,10 @@ const getDecoratedProps = (
609
609
  icon: 'fuelConsumption',
610
610
  title: t('vehicleProps:title.сonsumptionCombined'),
611
611
  get value() {
612
- const consumptionCombined = car.consumption.consumptionCombined;
612
+ const consumptionCombined = car.consumption.wltpCombined || car.consumption.consumptionCombined;
613
613
  const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
614
614
  const translatedUnit = t(`cbd:${consumptionUnit}`);
615
+ console.log('qqqqq consumptionCombined =====', t('vehicleProps:value.consumption', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit }));
615
616
  return Number.isFinite(consumptionCombined)
616
617
  ? t('vehicleProps:value.consumption', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit })
617
618
  : t('vehicleProps:value.na');
@@ -1048,6 +1049,220 @@ const getDecoratedProps = (
1048
1049
  return t('vehicleProps:value.countryVersionName', { countryName });
1049
1050
  }
1050
1051
  }
1052
+ },
1053
+ wltpCo2: {
1054
+ title: t('vehicleProps:title.wltpCo2'),
1055
+ get value() {
1056
+ const c02 = car.environmentEmissions.wltpCo2;
1057
+ return Number.isFinite(c02)
1058
+ ? t('vehicleProps:value.co2', { co2: c02.toLocaleString(language) })
1059
+ : t('vehicleProps:value.na');
1060
+ }
1061
+ },
1062
+ wltpCo2Discharged: {
1063
+ title: t('vehicleProps:title.wltpCo2Discharged'),
1064
+ get value() {
1065
+ const wltpCo2 = car.environmentEmissions.wltpCo2;
1066
+ return Number.isFinite(wltpCo2)
1067
+ ? t('vehicleProps:value.co2', { co2: wltpCo2.toLocaleString(language) })
1068
+ : t('vehicleProps:value.na');
1069
+ }
1070
+ },
1071
+ wltpEnergyEfficiencyClass: {
1072
+ // title: t('vehicleProps:title.wltpEnergyEfficiencyClass'),
1073
+ // subTitle: t('vehicleProps:title.subTitle'),
1074
+ get value() {
1075
+ const level = car.environmentEmissions.wltpEnergyEfficiencyClass;
1076
+ const wltpLevel = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
1077
+ const { hybridPlugin } = car.engineData;
1078
+ const subtitle = hybridPlugin ? t('vehicleProps:title.wltpCO2SubTitle') : t('vehicleProps:title.wltpCO2SubTitleComb');
1079
+ return isPropDefined(level) ?
1080
+ <CO2Efficiency
1081
+ title={t('vehicleProps:title.wltpCO2Title')}
1082
+ subTitle={subtitle}
1083
+ wltpLevel={wltpLevel}
1084
+ level={level}
1085
+ t={t}
1086
+ levelTitle={t('vehicleProps:title.wltpCO2WidgetComb')}
1087
+ wltpLevelTitle={t('vehicleProps:title.wltpCO2WidgetDischargedBattery')}
1088
+ hybridPlugin={hybridPlugin}
1089
+ /> : t('vehicleProps:value.na');
1090
+ }
1091
+ },
1092
+ wltpDischargedEnergyEfficiencyClass: {
1093
+ title: t('vehicleProps:title.wltpDischargedEnergyEfficiencyClass'),
1094
+ subTitle: t('vehicleProps:title.subTitle'),
1095
+ get value() {
1096
+ const level = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
1097
+ return isPropDefined(level) ? <CO2Efficiency level={level} t={t} /> : t('vehicleProps:value.na');
1098
+ }
1099
+ },
1100
+ wltpRange: {
1101
+ title: t('vehicleProps:title.wltpRange'),
1102
+ get value() {
1103
+ const wltpRange = car.battery && car.battery.wltpRange;
1104
+ return Number.isFinite(wltpRange)
1105
+ ? t('vehicleProps:value.batteryRangeElectric', { consumption: wltpRange.toLocaleString(language) })
1106
+ : t('vehicleProps:value.na');
1107
+ }
1108
+ },
1109
+ wltpTotalRange: {
1110
+ title: t('vehicleProps:title.wltpTotalRange'),
1111
+ get value() {
1112
+ const wltpTotalRange = car.battery && car.battery.wltpTotalRange;
1113
+ return Number.isFinite(wltpTotalRange)
1114
+ ? t('vehicleProps:value.batteryRangeElectric', { consumption: wltpTotalRange.toLocaleString(language) })
1115
+ : t('vehicleProps:value.na');
1116
+ }
1117
+ },
1118
+
1119
+ wltpRangeCity: {
1120
+ title: t('vehicleProps:title.wltpRangeCity'),
1121
+ get value() {
1122
+ const wltpRangeCity = car.battery && car.battery.wltpRangeCity;
1123
+ return Number.isFinite(wltpRangeCity)
1124
+ ? t('vehicleProps:value.batteryRangeElectric', { consumption: wltpRangeCity.toLocaleString(language) })
1125
+ : t('vehicleProps:value.na');
1126
+ }
1127
+ },
1128
+ wltpTotalRangeCity: {
1129
+ title: t('vehicleProps:title.wltpTotalRangeCity'),
1130
+ get value() {
1131
+ const wltpTotalRangeCity = car.battery && car.battery.wltpTotalRangeCity;
1132
+ return Number.isFinite(wltpTotalRangeCity)
1133
+ ? t('vehicleProps:value.batteryRangeElectric', { consumption: wltpTotalRangeCity.toLocaleString(language) })
1134
+ : t('vehicleProps:value.na');
1135
+ }
1136
+ },
1137
+ wltpWeightedCombined: {
1138
+ title: t('vehicleProps:title.wltpWeightedCombined'),
1139
+ get value() {
1140
+ const wltpWeightedCombined = car.consumption && car.consumption.wltpTotalRangeCity;
1141
+ return Number.isFinite(wltpWeightedCombined)
1142
+ ? t('vehicleProps:value.consumptionCombined', { consumption: wltpWeightedCombined.toLocaleString(language) })
1143
+ : t('vehicleProps:value.na');
1144
+ }
1145
+ },
1146
+ wltpCombined: {
1147
+ title: t('vehicleProps:title.wltpCombined'),
1148
+ get value() {
1149
+ const wltpCombined = car.consumption.wltpCombined;
1150
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1151
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1152
+ return Number.isFinite(wltpCombined)
1153
+ ? t('vehicleProps:value.consumption', { consumption: wltpCombined.toLocaleString(language), unit: translatedUnit })
1154
+ : t('vehicleProps:value.na');
1155
+ }
1156
+ },
1157
+ wltpSlow: {
1158
+ title: t('vehicleProps:title.wltpSlow'),
1159
+ get value() {
1160
+ const wltpSlow = car.consumption.wltpSlow;
1161
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1162
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1163
+ return Number.isFinite(wltpSlow)
1164
+ ? t('vehicleProps:value.consumption', { consumption: wltpSlow.toLocaleString(language), unit: translatedUnit })
1165
+ : t('vehicleProps:value.na');
1166
+ }
1167
+ },
1168
+ wltpMedium: {
1169
+ title: t('vehicleProps:title.wltpMedium'),
1170
+ get value() {
1171
+ const wltpMedium = car.consumption.wltpMedium;
1172
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1173
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1174
+ return Number.isFinite(wltpMedium)
1175
+ ? t('vehicleProps:value.consumption', { consumption: wltpMedium.toLocaleString(language), unit: translatedUnit })
1176
+ : t('vehicleProps:value.na');
1177
+ }
1178
+ },
1179
+ wltpFast: {
1180
+ title: t('vehicleProps:title.wltpFast'),
1181
+ get value() {
1182
+ const wltpFast = car.consumption.wltpFast;
1183
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1184
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1185
+ return Number.isFinite(wltpFast)
1186
+ ? t('vehicleProps:value.consumption', { consumption: wltpFast.toLocaleString(language), unit: translatedUnit })
1187
+ : t('vehicleProps:value.na');
1188
+ }
1189
+ },
1190
+ wltpVeryFast: {
1191
+ title: t('vehicleProps:title.wltpVeryFast'),
1192
+ get value() {
1193
+ const wltpVeryFast = car.consumption.wltpVeryFast;
1194
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1195
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1196
+ return Number.isFinite(wltpVeryFast)
1197
+ ? t('vehicleProps:value.consumption', { consumption: wltpVeryFast.toLocaleString(language), unit: translatedUnit })
1198
+ : t('vehicleProps:value.na');
1199
+ }
1200
+ },
1201
+ wltpWeightedPowerCombined: {
1202
+ title: t('vehicleProps:title.wltpWeightedPowerCombined'),
1203
+ get value() {
1204
+ const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
1205
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1206
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1207
+ return Number.isFinite(wltpWeightedPowerCombined)
1208
+ ? t('vehicleProps:value.consumptionPower', { consumption: wltpWeightedPowerCombined.toLocaleString(language), unit: translatedUnit })
1209
+ : t('vehicleProps:value.na');
1210
+ }
1211
+ },
1212
+ wltpPowerCombined: {
1213
+ title: t('vehicleProps:title.wltpPowerCombined'),
1214
+ get value() {
1215
+ const wltpPowerCombined = car.consumption.wltpPowerCombined;
1216
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1217
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1218
+ return Number.isFinite(wltpPowerCombined)
1219
+ ? t('vehicleProps:value.consumptionPower', { consumption: wltpPowerCombined.toLocaleString(language), unit: translatedUnit })
1220
+ : t('vehicleProps:value.na');
1221
+ }
1222
+ },
1223
+ wltpPowerSlow: {
1224
+ title: t('vehicleProps:title.wltpPowerSlow'),
1225
+ get value() {
1226
+ const wltpPowerSlow = car.consumption.wltpPowerSlow;
1227
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1228
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1229
+ return Number.isFinite(wltpPowerSlow)
1230
+ ? t('vehicleProps:value.consumptionPower', { consumption: wltpPowerSlow.toLocaleString(language), unit: translatedUnit })
1231
+ : t('vehicleProps:value.na');
1232
+ }
1233
+ },
1234
+ wltpPowerMedium: {
1235
+ title: t('vehicleProps:title.wltpPowerMedium'),
1236
+ get value() {
1237
+ const wltpPowerMedium = car.consumption.wltpPowerMedium;
1238
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1239
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1240
+ return Number.isFinite(wltpPowerMedium)
1241
+ ? t('vehicleProps:value.consumptionPower', { consumption: wltpPowerMedium.toLocaleString(language), unit: translatedUnit })
1242
+ : t('vehicleProps:value.na');
1243
+ }
1244
+ },
1245
+ wltpPowerFast: {
1246
+ title: t('vehicleProps:title.wltpPowerFast'),
1247
+ get value() {
1248
+ const wltpPowerFast = car.consumption.wltpPowerFast;
1249
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1250
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1251
+ return Number.isFinite(wltpPowerFast)
1252
+ ? t('vehicleProps:value.consumptionPower', { consumption: wltpPowerFast.toLocaleString(language), unit: translatedUnit })
1253
+ : t('vehicleProps:value.na');
1254
+ }
1255
+ },
1256
+ wltpPowerVeryFast: {
1257
+ title: t('vehicleProps:title.wltpPowerVeryFast'),
1258
+ get value() {
1259
+ const wltpPowerVeryFast = car.consumption.wltpPowerVeryFast;
1260
+ const consumptionUnit = car.consumption.consumptionUnit || 'consumption_consumptionUnit_l';
1261
+ const translatedUnit = t(`cbd:${consumptionUnit}`);
1262
+ return Number.isFinite(wltpPowerVeryFast)
1263
+ ? t('vehicleProps:value.consumptionPower', { consumption: wltpPowerVeryFast.toLocaleString(language), unit: translatedUnit })
1264
+ : t('vehicleProps:value.na');
1265
+ }
1051
1266
  }
1052
1267
  };
1053
1268
  return props;
@@ -40,6 +40,13 @@ const consumptionPowerCombinedAlternateView = ['consumptionPowerCombinedAlternat
40
40
  const consumptionCombinedHybridAlternateView = ['consumptionCombinedHybridAlternateView'];
41
41
  const consumptionGasCombinedAlternateView = ['consumptionGasCombinedAlternateView'];
42
42
  const consumptionHydrogenCombinedAlternateView = ['consumptionHydrogenCombinedAlternateView'];
43
+ const environmentElectroWLTP = ['wltpPowerCombined', 'wltpCo2', 'wltpRange', 'wltpPowerSlow', 'wltpPowerMedium',
44
+ 'wltpPowerFast', 'wltpPowerVeryFast', 'wltpEnergyEfficiencyClass'];
45
+ const environmentPluginHybridWLTP = ['wltpWeightedCombined', 'wltpTotalRange', 'wltpWeightedPowerCombined', 'wltpCo2',
46
+ 'wltpCo2Discharged', 'wltpPowerSlow', 'wltpPowerMedium', 'wltpPowerFast', 'wltpPowerCombined', 'wltpPowerVeryFast',
47
+ 'wltpCombined', 'wltpSlow', 'wltpMedium', 'wltpFast', 'wltpVeryFast', 'wltpEnergyEfficiencyClass', 'wltpDischargedEnergyEfficiencyClass'];
48
+ const environmentElectroBenzinDieselEthanolHybridWLTP = ['wltpCombined', 'wltpCo2', 'wltpSlow', 'wltpMedium', 'wltpFast', 'wltpVeryFast', 'wltpEnergyEfficiencyClass'];
49
+ const environmentHydrogenWLTP = ['wltpCombined', 'wltpCo2', 'wltpSlow', 'wltpMedium', 'wltpFast', 'wltpVeryFast', 'wltpEnergyEfficiencyClass'];
43
50
 
44
51
  export const engineDetails: IEngineDetails = [
45
52
  {
@@ -67,6 +74,9 @@ export const engineDetails: IEngineDetails = [
67
74
  ],
68
75
  consumptionCombined: [
69
76
  ...consumptionPowerCombinedAlternateView
77
+ ],
78
+ wltp: [
79
+ ...environmentElectroWLTP
70
80
  ]
71
81
  },
72
82
  {
@@ -108,6 +118,9 @@ export const engineDetails: IEngineDetails = [
108
118
  ],
109
119
  consumptionCombined: [
110
120
  ...consumptionCombinedAlternateView
121
+ ],
122
+ wltp: [
123
+ ...environmentElectroBenzinDieselEthanolHybridWLTP
111
124
  ]
112
125
  },
113
126
  {
@@ -149,6 +162,9 @@ export const engineDetails: IEngineDetails = [
149
162
  ],
150
163
  consumptionCombined: [
151
164
  ...consumptionCombinedAlternateView
165
+ ],
166
+ wltp: [
167
+ ...environmentElectroBenzinDieselEthanolHybridWLTP
152
168
  ]
153
169
  },
154
170
  {
@@ -175,6 +191,9 @@ export const engineDetails: IEngineDetails = [
175
191
  ],
176
192
  consumptionCombined: [
177
193
  ...consumptionHydrogenCombinedAlternateView
194
+ ],
195
+ wltp: [
196
+ ...environmentHydrogenWLTP
178
197
  ]
179
198
  },
180
199
  {
@@ -203,6 +222,9 @@ export const engineDetails: IEngineDetails = [
203
222
  ],
204
223
  consumptionCombined: [
205
224
  ...consumptionGasCombinedAlternateView
225
+ ],
226
+ wltp: [
227
+ ...environmentHydrogenWLTP
206
228
  ]
207
229
  },
208
230
  {
@@ -231,10 +253,70 @@ export const engineDetails: IEngineDetails = [
231
253
  ],
232
254
  consumptionCombined: [
233
255
  ...consumptionGasCombinedAlternateView
256
+ ],
257
+ wltp: [
258
+ ...environmentHydrogenWLTP
234
259
  ]
235
260
  }
236
261
  ];
237
262
 
263
+ export const wltpDetails = [
264
+ {
265
+ selector: 'selector_fuel_diesel',
266
+ wltp: [
267
+ ...environmentElectroBenzinDieselEthanolHybridWLTP
268
+ ]
269
+ },
270
+ {
271
+ selector: 'selector_fuel_electrical',
272
+ wltp: [
273
+ ...environmentElectroWLTP
274
+ ]
275
+ },
276
+ {
277
+ selector: 'selector_fuel_electrical',
278
+ wltp: [
279
+ ...environmentElectroWLTP
280
+ ]
281
+ },
282
+ {
283
+ selector: 'selector_fuel_hybridElectricalPetrol',
284
+ wltp: [
285
+ ...environmentElectroBenzinDieselEthanolHybridWLTP
286
+ ]
287
+ },
288
+ {
289
+ selector: 'selector_fuel_naturalGas',
290
+ wltp: [
291
+ ...environmentHydrogenWLTP
292
+ ]
293
+ },
294
+ {
295
+ selector: 'selector_fuel_carGas',
296
+ wltp: [
297
+ ...environmentHydrogenWLTP
298
+ ]
299
+ },
300
+ {
301
+ selector: 'selector_fuel_petrol',
302
+ wltp: [
303
+ ...environmentElectroBenzinDieselEthanolHybridWLTP
304
+ ]
305
+ },
306
+ {
307
+ selector: 'selector_fuel_ethanol',
308
+ wltp: [
309
+ ...environmentElectroBenzinDieselEthanolHybridWLTP
310
+ ]
311
+ },
312
+ {
313
+ selector: 'selector_fuel_hydrogen',
314
+ wltp: [
315
+ ...environmentHydrogenWLTP
316
+ ]
317
+ }
318
+ ]
319
+
238
320
  export const dimensionDetails = [
239
321
  'category', 'length', 'width', 'height', 'base', 'capacityLoad', 'bootCapacity',
240
322
  'doors', 'seats', 'tare', 'maximumWeight', 'trailerWeightBraked', 'trailerWeightUnbraked'
@@ -263,6 +345,15 @@ export const getVehicleDetails = (selector: any, dataType: string, hybridPlugin:
263
345
  }, []); //tslint:disable-line
264
346
  };
265
347
 
348
+ export const getWltpValues = (selector: any, hybridPlugin: any = false) => {
349
+ if (hybridPlugin) {
350
+ return [...environmentPluginHybridWLTP];
351
+ }
352
+ return _filter(wltpDetails, key => key.selector === selector).reduce((_selector, item) => {
353
+ return item.wltp;
354
+ }, []);
355
+ };
356
+
266
357
  export const getOverviewDetails = (selector: any) => {
267
358
  if (Object.keys(filtered(selector)).length === 0) {
268
359
  return [...mainPropertiesList, ...consumptionCombinedAlternateView];
@@ -169,7 +169,30 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
169
169
  'financingDescription': 'Bei der Finanzierung zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil. Zum Vertragsende können Sie entscheiden, ob Sie den Restbetrag ablösen oder weiter finanzieren wollen.',
170
170
  'leasingDescription': 'Beim Leasing zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil. Zum Vertragsende geben Sie das Auto einfach wieder zurück.',
171
171
  'aboDescription': 'Bei diesem Auto-Abo ist bereits alles an Bord. Teil- und Vollkasko sowie Haftpflicht sind inklusive, ebenso wie Wartungs- und Verschleißreparaturen. Sie zahlen also nur Ihre Rate und Kraftstoff.',
172
- 'buyDescription': 'Nach Kaufabschluss haben Sie die sofortigen Eigentumsrechte und keine Finanzierungskosten. Als Eigentümer können Sie Ihr Fahrzeug zu eigenen Konditionen weiter verkaufen und Änderungen vornehmen.'
172
+ 'buyDescription': 'Nach Kaufabschluss haben Sie die sofortigen Eigentumsrechte und keine Finanzierungskosten. Als Eigentümer können Sie Ihr Fahrzeug zu eigenen Konditionen weiter verkaufen und Änderungen vornehmen.',
173
+ 'wltpCo2': 'CO2-Ausstoß (WLTP, komb.)',
174
+ 'wltpCo2Discharged': 'CO2-Ausstoß (WLTP, bei entladener Batterie)',
175
+ 'wltpEnergyEfficiencyClass': 'CO2-Klasse *Auf der Grundlage der CO-2 Emissionen (kombiniert)',
176
+ 'wltpDischargedEnergyEfficiencyClass': 'CO2-Klasse *Auf der Grundlage der CO-2 Emissionen (bei entladener Batterie)',
177
+ 'wltpTotalRange': 'Reichweite (EAER) (WLTP, rein elektrisch)',
178
+ 'wltpRange': 'Reichweite (WLTP, rein elektrisch)',
179
+ 'wltpWeightedCombined': 'Verbrauch (WLTP, gew., komb.)',
180
+ 'wltpCombined': 'Verbrauch (WLTP, komb.)',
181
+ 'wltpSlow': 'Verbrauch Innenstadt (WLTP)',
182
+ 'wltpMedium': 'Verbrauch Stadtrand(WLTP)',
183
+ 'wltpFast': 'Verbrauch Landstraße(WLTP)',
184
+ 'wltpVeryFast': 'Verbrauch Autobahn (WLTP)',
185
+ 'wltpWeightedPowerCombined': 'Electricity consumption (WLTP, wtd. comb.)',
186
+ 'wltpPowerCombined': 'Stromverbrauch (WLTP, gew., komb.)',
187
+ 'wltpPowerSlow': 'Stromverbrauch Innenstadt(WLTP)',
188
+ 'wltpPowerMedium': 'Stromverbrauch Stadtrand(WLTP)',
189
+ 'wltpPowerFast': 'Stromverbrauch Landstraße(WLTP)',
190
+ 'wltpPowerVeryFast': 'Stromverbrauch Autobahn (WLTP)',
191
+ 'wltpCO2Title': 'CO2-Klasse',
192
+ 'wltpCO2SubTitle': '*Auf der Grundlage der CO-2 Emissionen',
193
+ 'wltpCO2WidgetDischargedBattery': 'bei entladener Batterie',
194
+ 'wltpCO2WidgetComb': 'gewichtet kombiniert',
195
+ 'wltpCO2SubTitleComb': '*Auf der Grundlage der CO-2 Emissionen (kombiniert)'
173
196
  }
174
197
  },
175
198
  sidebar: {