@bytebrand/fe-ui-core 4.8.30 → 4.8.32

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.8.30",
3
+ "version": "4.8.32",
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
 
@@ -149,7 +151,12 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
149
151
  ),
150
152
  ...routeObj,
151
153
  className: wrapClasses,
152
- onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
154
+ onClick: () => localStorage.setItem(
155
+ 'activeTabCDP',
156
+ _get(leasing, 'isActive', false)
157
+ ? t('vehicleProps:title.leasing')
158
+ : t('vehicleProps:title.financing')
159
+ ),
153
160
  href: url,
154
161
  target,
155
162
  rel
@@ -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} />
@@ -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 {
@@ -143,7 +143,9 @@ const getDecoratedLightProps = (
143
143
  ? t('vehicleProps:value.consumptionCombined', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit })
144
144
  : t('vehicleProps:value.na');
145
145
 
146
- const consumptionPowerCombinedContent = t('vehicleProps:value.consumptionPowerCombined', { consumption: consumptionPowerCombined.toLocaleString(language), unit: translatedUnit });
146
+ const consumptionPowerCombinedContent = Number.isFinite(consumptionPowerCombined)
147
+ ? t('vehicleProps:value.consumptionPowerCombined', { consumption: consumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
148
+ : null;
147
149
 
148
150
  const co2Value = Number.isFinite(co2)
149
151
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
@@ -233,8 +235,12 @@ const getDecoratedLightProps = (
233
235
 
234
236
  const consumptionPowerCombinedContent = t('vehicleProps:value.consumptionPowerCombined', { consumption: consumptionPowerCombined.toLocaleString(language), unit: translatedUnit });
235
237
  const consumptionCombinedContent = t('vehicleProps:value.consumptionCombined', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit });
236
- const wltpWeightedPowerCombinedContent = t('vehicleProps:value.wltpWeightedPowerCombined', { consumption: wltpWeightedPowerCombined.toLocaleString(language), unit: translatedUnit });
237
- const wltpWeightedCombinedContent = t('vehicleProps:value.wltpWeightedCombined', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
238
+ const wltpWeightedPowerCombinedContent = Number.isFinite(wltpWeightedPowerCombined)
239
+ ? t('vehicleProps:value.wltpWeightedPowerCombined', { consumption: wltpWeightedPowerCombined.toLocaleString(language), unit: translatedUnit })
240
+ : null;
241
+ const wltpWeightedCombinedContent = Number.isFinite(wltpWeightedCombined)
242
+ ? t('vehicleProps:value.wltpWeightedCombined', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit })
243
+ : null;
238
244
  const wltpConsumptionPowerCombinedContent = wltpConsumptionPowerCombined
239
245
  ? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
240
246
  : null;