@bytebrand/fe-ui-core 4.8.31 → 4.8.33

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.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "consumptionCombined": "{{consumptionCombined}}l/100km (komb)*",
3
3
  "co2": "{{co2}}g CO2/km (komb)*",
4
+ "co2Class": "CO2-Klasse {{class}} (komb)",
4
5
  "weDeliverMagdeburg": "Wir liefern Ihr Auto zu Ihnen nach Magdeburg!",
5
6
  "weDeliverToYou": "Wir liefern Ihr Auto zu Ihnen!",
6
7
  "withoutDeposit": "ohne Anzahlung",
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "consumptionCombined": "{{consumptionCombined}}/100km (comb)*",
3
3
  "co2": "{{co2}}g CO2/km (comb)*",
4
+ "co2Class": "CO2-class {{class}} (comb)",
4
5
  "weDeliverMagdeburg": "We will deliver your car to Magdeburg!",
5
6
  "weDeliverToYou": "We deliver your car to you!",
6
7
  "withoutDeposit": "Without Deposit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.31",
3
+ "version": "4.8.33",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -1,6 +1,7 @@
1
1
  /* tslint:disable */
2
2
  import * as React from 'react';
3
3
  import classnames from 'classnames';
4
+ import _get from 'lodash/get';
4
5
  import styles from './VehicleInfo.styl';
5
6
  import PriceRating from '../../../PriceRating/PriceRating';
6
7
  import { Visible, Hidden } from 'react-grid-system';
@@ -43,7 +44,8 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
43
44
  consumption,
44
45
  location,
45
46
  offer,
46
- engineData
47
+ engineData,
48
+ leasing
47
49
  } = props;
48
50
  const firstRegistrationDate = regDate && regDate !== 0 ? regDate : 'N/A';
49
51
 
@@ -80,14 +82,19 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
80
82
 
81
83
  const decoratedProps = getDecoratedProps(dataDecoratedProps, t, language);
82
84
  const renderProperty = (renderProperties: any, vehicleComponentName?: any) => {
83
- const mainPropertiesList = renderProperties(dataDecoratedProps.consumption.fuel, combineRefAlternative).map((prop: string) => ({
84
- icon: decoratedProps[prop].icon,
85
- description: decoratedProps[prop].value,
86
- className: styles[decoratedProps[prop].name],
87
- classNameIcon: (vehicleComponentName === 'search' || 'myVehicles' || 'favorite' || 'recently') && styles.carIconSearch,
88
- smalltext: (decoratedProps[prop].name === 'consumptionCombined') && (vehicleComponentName !== 'search'),
89
- hybridPlugin: engineData.hybridPlugin && decoratedProps[prop].name === 'consumptionCombined' && vehicleComponentName !== 'search'
90
- }));
85
+ const mainPropertiesList = renderProperties(dataDecoratedProps.consumption.fuel, combineRefAlternative).map((prop: string) => {
86
+ const isConsumption = decoratedProps[prop].name === 'consumptionCombined';
87
+ // On non-SRL cards drop the fuel-pump icon next to the consumption row to free up space for the CO2-class line.
88
+ const hideConsumptionIcon = isConsumption && vehicleComponentName !== 'search';
89
+ return {
90
+ icon: hideConsumptionIcon ? '' : decoratedProps[prop].icon,
91
+ description: decoratedProps[prop].value,
92
+ className: styles[decoratedProps[prop].name],
93
+ classNameIcon: (vehicleComponentName === 'search' || 'myVehicles' || 'favorite' || 'recently') && styles.carIconSearch,
94
+ smalltext: isConsumption && (vehicleComponentName !== 'search'),
95
+ hybridPlugin: engineData.hybridPlugin && isConsumption && vehicleComponentName !== 'search'
96
+ };
97
+ });
91
98
 
92
99
  return mainPropertiesList.map((property: any, index: number) => (
93
100
  <VehicleProperty {...property} key={index} />
@@ -149,7 +156,12 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
149
156
  ),
150
157
  ...routeObj,
151
158
  className: wrapClasses,
152
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
159
+ onClick: () => localStorage.setItem(
160
+ 'activeTabCDP',
161
+ _get(leasing, 'isActive', false)
162
+ ? t('vehicleProps:title.leasing')
163
+ : t('vehicleProps:title.financing')
164
+ ),
153
165
  href: url,
154
166
  target,
155
167
  rel
@@ -26,5 +26,8 @@
26
26
  +media-tablet-landscape-up()
27
27
  margin-right: 10px
28
28
 
29
+ .noIcon
30
+ padding-left: 10px
31
+
29
32
  [class*='smallText']
30
33
  font-size:10px;
@@ -19,12 +19,13 @@ class VehicleProperty extends React.Component<IVehicleProperty, {}> {
19
19
 
20
20
  render(): React.ReactNode {
21
21
  const { className, classNameIcon, icon, description, smalltext, hybridPlugin } = this.props;
22
- const propertyClass: string = `${styles.carProp} ${className ? className : ''} ${smalltext ? styles.smallProp : ''} ${hybridPlugin ? styles.pluginVal : ''}`;
22
+ const noIcon: boolean = !icon;
23
+ const propertyClass: string = `${styles.carProp} ${className ? className : ''} ${smalltext ? styles.smallProp : ''} ${hybridPlugin ? styles.pluginVal : ''} ${noIcon ? styles.noIcon : ''}`;
23
24
  const propertyClassIcon: string = `${styles.carIcon} ${classNameIcon ? classNameIcon : ''}`;
24
25
 
25
26
  return (
26
27
  <div className={propertyClass}>
27
- <IconSVG className={propertyClassIcon} name={icon} customDimensions />
28
+ {!noIcon && <IconSVG className={propertyClassIcon} name={icon} customDimensions />}
28
29
  <span>{description}</span>
29
30
  </div>
30
31
  );
@@ -280,7 +280,12 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
280
280
  target,
281
281
  rel,
282
282
  className: `${styles.redirectClassLink} ${styles.gridAreaTitle}`,
283
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
283
+ onClick: () => localStorage.setItem(
284
+ 'activeTabCDP',
285
+ _get(price, 'leasing.isActive', false)
286
+ ? t('vehicleProps:title.leasing')
287
+ : t('vehicleProps:title.financing')
288
+ ),
284
289
  href: url
285
290
  })}
286
291
 
@@ -333,7 +338,12 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
333
338
  target,
334
339
  rel,
335
340
  className: `${styles.redirectClassLink} ${styles.gridAreaImage}`,
336
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
341
+ onClick: () => localStorage.setItem(
342
+ 'activeTabCDP',
343
+ _get(price, 'leasing.isActive', false)
344
+ ? t('vehicleProps:title.leasing')
345
+ : t('vehicleProps:title.financing')
346
+ ),
337
347
  href: url
338
348
  })}
339
349
  <VehicleInfo {...vehicleInfoProps} />
@@ -69,6 +69,7 @@ export const transformDataForDecoratedCar = (car: any) => {
69
69
  bootCapacity: _get(car, 'sizeVolumeWeight.cargoCapacity', null),
70
70
  capacityLoad: _get(car, 'sizeVolumeWeight.completeCapacity', null),
71
71
  wltpCo2: _get(car, 'environmentEmissions.wltpCo2', null),
72
+ wltpEnergyEfficiencyClass: _get(car, 'environmentEmissions.wltpEnergyEfficiencyClass', null),
72
73
  pluginHybrid: _get(car, 'engineData.pluginHybrid', null),
73
74
  wltpCombined: _get(car, 'consumption.wltpCombined', null),
74
75
  wltpPowerCombined: _get(car, 'consumption.wltpPowerCombined', null),
@@ -115,6 +115,7 @@ export interface IVehicleInfo {
115
115
  url?: string;
116
116
  target?: string;
117
117
  rel?: string;
118
+ leasing?: ILeasing;
118
119
  }
119
120
 
120
121
  export interface IVehicleTitleProps {
@@ -124,6 +124,10 @@ const getDecoratedLightProps = (
124
124
  const wltpConsumptionCombined = car.consumption.wltpCombined;
125
125
  const wltpCo2 = car.environmentEmissions.wltpCo2;
126
126
  const consumptionPowerCombined = car.consumption.consumptionCombined;
127
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
128
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
129
+ ? t('vehicleProps:value.co2Class', { class: wltpEnergyEfficiencyClass })
130
+ : null;
127
131
 
128
132
  const co2 = car.environmentEmissions.co2;
129
133
 
@@ -164,22 +168,24 @@ const getDecoratedLightProps = (
164
168
  {`${wltpWeightedPowerCombinedContent}, `}
165
169
  {`${wltpWeightedCombinedContent}, `}
166
170
  {wltpCo2PluginValue}
171
+ {co2ClassValue && <><br />{co2ClassValue}</>}
167
172
  </React.Fragment>
168
173
  }
169
174
 
170
175
  return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
171
176
  ? <React.Fragment>
172
177
  {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionValue} <br /> {co2Value}
178
+ {co2ClassValue && <><br />{co2ClassValue}</>}
173
179
  </React.Fragment>
174
180
  : t('vehicleProps:value.na');
175
181
 
176
182
  }
177
183
 
178
184
  if (wltpConsumptionValue && wltpCo2Value) {
179
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
185
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
180
186
  }
181
187
 
182
- return <>{consumptionValue} <br /> {co2Value}</>;
188
+ return <>{consumptionValue} <br /> {co2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
183
189
  }
184
190
  },
185
191
  consumptionPowerCombinedAlternateView: {
@@ -193,6 +199,10 @@ const getDecoratedLightProps = (
193
199
  const co2 = car.environmentEmissions.co2;
194
200
  const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined;
195
201
  const wltpCo2 = car.environmentEmissions.wltpCo2;
202
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
203
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
204
+ ? t('vehicleProps:value.co2Class', { class: wltpEnergyEfficiencyClass })
205
+ : null;
196
206
 
197
207
  const wltpConsumptionValue = Number.isFinite(wltpConsumptionPowerCombined)
198
208
  ? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
@@ -211,10 +221,10 @@ const getDecoratedLightProps = (
211
221
  : t('vehicleProps:value.na');
212
222
 
213
223
  if (wltpConsumptionValue && wltpCo2Value) {
214
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
224
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
215
225
  }
216
226
 
217
- return <>{consumptionValue} <br /> {co2Value} </>;
227
+ return <>{consumptionValue} <br /> {co2Value} {co2ClassValue && <><br />{co2ClassValue}</>}</>;
218
228
  }
219
229
  },
220
230
 
@@ -251,6 +261,10 @@ const getDecoratedLightProps = (
251
261
 
252
262
  const co2 = car.environmentEmissions.co2;
253
263
  const wltpCo2 = car.environmentEmissions.wltpCo2;
264
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
265
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
266
+ ? t('vehicleProps:value.co2Class', { class: wltpEnergyEfficiencyClass })
267
+ : null;
254
268
 
255
269
  const co2Value = Number.isFinite(co2)
256
270
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
@@ -272,6 +286,7 @@ const getDecoratedLightProps = (
272
286
  {`${wltpWeightedPowerCombinedContent}, `}
273
287
  {`${wltpWeightedCombinedContent}, `}
274
288
  {wltpCo2PluginValue}
289
+ {co2ClassValue && <><br />{co2ClassValue}</>}
275
290
  </React.Fragment>
276
291
  }
277
292
  }
@@ -281,12 +296,14 @@ const getDecoratedLightProps = (
281
296
  {`${wltpConsumptionPowerCombinedContent}, `}
282
297
  {`${wltpWeightedCombinedContent}, `}
283
298
  {wltpCo2PluginValue}
299
+ {co2ClassValue && <><br />{co2ClassValue}</>}
284
300
  </React.Fragment>
285
301
  }
286
302
 
287
303
  return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
288
304
  ? <React.Fragment>
289
305
  {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionCombinedContent} <br /> {co2Value}
306
+ {co2ClassValue && <><br />{co2ClassValue}</>}
290
307
  </React.Fragment>
291
308
  : t('vehicleProps:value.na');
292
309
  }
@@ -303,6 +320,10 @@ const getDecoratedLightProps = (
303
320
  const co2 = car.environmentEmissions.co2;
304
321
  const wltpConsumptionCombined = car.consumption.wltpCombined;
305
322
  const wltpCo2 = car.environmentEmissions.wltpCo2;
323
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
324
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
325
+ ? t('vehicleProps:value.co2Class', { class: wltpEnergyEfficiencyClass })
326
+ : null;
306
327
 
307
328
  const consumptionValue = Number.isFinite(consumptionHydrogenCombined)
308
329
  ? t('vehicleProps:value.consumptionGas', { consumption: consumptionHydrogenCombined.toLocaleString(language), unit: translatedUnit })
@@ -320,10 +341,10 @@ const getDecoratedLightProps = (
320
341
  : null;
321
342
 
322
343
  if (wltpConsumptionValue && wltpCo2Value) {
323
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
344
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
324
345
  }
325
346
 
326
- return <>{consumptionValue} <br /> {co2Value}</>;
347
+ return <>{consumptionValue} <br /> {co2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
327
348
  }
328
349
  },
329
350
  consumptionGasCombinedAlternateView: {
@@ -337,6 +358,10 @@ const getDecoratedLightProps = (
337
358
  const co2 = car.environmentEmissions.co2;
338
359
  const wltpConsumptionCombined = car.consumption.wltpCombined;
339
360
  const wltpCo2 = car.environmentEmissions.wltpCo2;
361
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
362
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
363
+ ? t('vehicleProps:value.co2Class', { class: wltpEnergyEfficiencyClass })
364
+ : null;
340
365
 
341
366
  const consumptionValue = Number.isFinite(consumptionGasCombined)
342
367
  ? t('vehicleProps:value.consumptionGas', { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
@@ -355,10 +380,10 @@ const getDecoratedLightProps = (
355
380
  : null;
356
381
 
357
382
  if (wltpConsumptionValue && wltpCo2Value) {
358
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
383
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
359
384
  }
360
385
 
361
- return <>{consumptionValue} <br /> {co2Value}</>;
386
+ return <>{consumptionValue} <br /> {co2Value}{co2ClassValue && <><br />{co2ClassValue}</>}</>;
362
387
  }
363
388
  },
364
389
  consumptionCombinedDealer: {
@@ -370,6 +395,7 @@ const getDecoratedLightProps = (
370
395
  const translatedUnit = t(`cbd:${consumptionUnit}`);
371
396
 
372
397
  const co2 = car.environmentEmissions.co2;
398
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
373
399
 
374
400
  const consumptionValue = Number.isFinite(consumptionCombined)
375
401
  ? t('vehicleProps:value.consumptionCombined', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit })
@@ -379,7 +405,11 @@ const getDecoratedLightProps = (
379
405
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
380
406
  : t('vehicleProps:value.na');
381
407
 
382
- return <>{consumptionValue} | {co2Value}</>;
408
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
409
+ ? t('vehicleProps:value.co2Class', { class: wltpEnergyEfficiencyClass })
410
+ : null;
411
+
412
+ return <>{consumptionValue} | {co2Value}{co2ClassValue ? <> | {co2ClassValue}</> : null}</>;
383
413
  }
384
414
  },
385
415
  gearbox: {
@@ -38,6 +38,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
38
38
  promoSlider: {
39
39
  consumptionCombined: `${vehicleOption.consumptionCombined}l/100km (komb)*`,
40
40
  co2: `${vehicleOption.co2} g CO2/km (komb)*`,
41
+ co2Class: `CO2-Klasse ${vehicleOption.wltpEnergyEfficiencyClass} (komb)`,
41
42
  new: 'neu',
42
43
  wltpCo2: `${vehicleOption.wltpCo2}g CO2/km (WLTP, komb.)*`,
43
44
  wltpConsumptionCombined: `${vehicleOption.consumptionCombined}l/100km`
@@ -57,6 +58,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
57
58
  deliveryPeriodMonths: `${Math.round(monthsTo)} Monat\nab Bestellung`,
58
59
  deliveryPeriodDays: `${count} Tag\nab Bestellung`,
59
60
  co2Combined: `${vehicleOption.co2}g CO2/km (komb)*`,
61
+ co2Class: `CO2-Klasse ${vehicleOption.wltpEnergyEfficiencyClass} (komb)`,
60
62
  co2: `${vehicleOption.co2} g/km `,
61
63
  na: 'N/A',
62
64
  priceSub: '/mtl.',