@bytebrand/fe-ui-core 4.8.111 → 4.8.112

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.
Files changed (198) hide show
  1. package/.husky/pre-push +4 -0
  2. package/.storybook/addons.js +4 -0
  3. package/.storybook/config.js +64 -0
  4. package/.storybook/postcss.config.js +6 -0
  5. package/.storybook/preview-head.html +10 -0
  6. package/.storybook/webpack.config.js +130 -0
  7. package/__tests__/components/Checkout/OrderOverviewItem/OrderOverviewItem.test.tsx +42 -0
  8. package/__tests__/components/Checkout/PaymentTypeCard/PaymentTypeCard.test.tsx +50 -0
  9. package/__tests__/components/Checkout/RadioGroup.test.tsx +95 -0
  10. package/__tests__/components/Checkout/ServiceCardWrapper.test.tsx +53 -0
  11. package/__tests__/components/Checkout/Switcher.test.tsx +43 -0
  12. package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
  13. package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
  14. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/AdditionalOrderInfo.test.tsx +127 -0
  15. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx +58 -0
  16. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCard.test.tsx +74 -0
  17. package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusSection.test.tsx +62 -0
  18. package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +117 -0
  19. package/__tests__/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.test.tsx +58 -0
  20. package/__tests__/components/VehicleSmallCard/VehicleInfo.test.tsx +88 -0
  21. package/__tests__/components/VehicleSmallCard/VehicleTitle.test.tsx +91 -0
  22. package/__tests__/components/_common/Badge/Badge.test.tsx +15 -0
  23. package/__tests__/components/_common/IconSVG/IconSVG.test.tsx +23 -0
  24. package/__tests__/components/_common/Image/Image.test.tsx +82 -0
  25. package/__tests__/components/_common/MaterialAutocomplete/MaterialAutocomplete.test.tsx +49 -0
  26. package/__tests__/components/_common/MaterialDatePicker/MaterialDatePicker.test.tsx +54 -0
  27. package/__tests__/components/_common/MaterialField/MaterialField.test.tsx +58 -0
  28. package/__tests__/components/_common/StarButton/StarButton.test.tsx +46 -0
  29. package/__tests__/mockedData/financingConfig.js +202 -0
  30. package/__tests__/mockedData/mockedPendingRequestedCar.js +69 -0
  31. package/__tests__/utils/CommonUtils/addPrefixToKeys.test.ts +18 -0
  32. package/__tests__/utils/CommonUtils/arrToObj.test.js +32 -0
  33. package/__tests__/utils/CommonUtils/checkRangeValuesOnEqual.test.ts +17 -0
  34. package/__tests__/utils/CommonUtils/fixNumber.test.ts +20 -0
  35. package/__tests__/utils/CommonUtils/formatMileage.test.ts +8 -0
  36. package/__tests__/utils/CommonUtils/getChipFilterValue.test.ts +22 -0
  37. package/__tests__/utils/CommonUtils/getFormattedNumber.test.ts +19 -0
  38. package/__tests__/utils/CommonUtils/getFormattedPrice.test.ts +19 -0
  39. package/__tests__/utils/CommonUtils/getGroupValuesForQuery.test.ts +51 -0
  40. package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +64 -0
  41. package/__tests__/utils/CommonUtils/getPriceRating.test.ts +26 -0
  42. package/__tests__/utils/CommonUtils/getPriceRatingConfig.test.ts +33 -0
  43. package/__tests__/utils/CommonUtils/preloadNearbyImages.test.ts +9 -0
  44. package/__tests__/utils/CommonUtils/sliceLessThan.test.ts +23 -0
  45. package/__tests__/utils/CommonUtils/sliceMoreThan.test.ts +23 -0
  46. package/media/locales/de/promoSlider.json +1 -0
  47. package/media/locales/en/promoSlider.json +1 -0
  48. package/package.json +118 -120
  49. package/source/components/AccordionWidget/AccordionWidget.styl +13 -1
  50. package/source/components/AccordionWidget/AccordionWidget.tsx +49 -8
  51. package/source/components/AdvantageItem/AdvantageItem.story.js +23 -0
  52. package/source/components/Alternative/Dealer.story.js +32 -0
  53. package/source/components/Alternative/Dealer.story.styl +3 -0
  54. package/source/components/Breadcrumbs/Breadcrumbs.story.js +40 -0
  55. package/source/components/Breadcrumbs/FirstInfoBlock/FirstInfoBlock.story.js +45 -0
  56. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.js +243 -0
  57. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.story.styl +21 -0
  58. package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.js +105 -0
  59. package/source/components/Checkout/RadioCards/RadioGroupCheckout.story.styl +37 -0
  60. package/source/components/Checkout/Switcher/Switcher.story.js +41 -0
  61. package/source/components/Checkout/Switcher/Switcher.story.styl +2 -0
  62. package/source/components/CompactSearchWidget/CompactSearchWidget.story.js +187 -0
  63. package/source/components/ContactForm/ContactForm.story.js +94 -0
  64. package/source/components/ContactForm/ContactForm.story.styl +0 -0
  65. package/source/components/ContactInfo/ContactInfo.story.js +58 -0
  66. package/source/components/CustomerQuote/CustomerQuote.story.js +41 -0
  67. package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.js +73 -0
  68. package/source/components/CustomerQuotesSlider/CustomerQuotesSlider.story.styl +5 -0
  69. package/source/components/FormattedNumber/FormattedNumber.story.js +114 -0
  70. package/source/components/InfoBlocks/InfoBlockWrapper.story.js +101 -0
  71. package/source/components/InfoBlocks/InfoBlockWrapper.story.styl +46 -0
  72. package/source/components/OfferPanel/AboAccordion/AboFaq/AboFaq.story.js +97 -0
  73. package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +2 -2
  74. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.styl +24 -0
  75. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -2
  76. package/source/components/OfferPanel/OfferPanel.story.js +139 -0
  77. package/source/components/OfferPanel/OfferPanel.tsx +1 -1
  78. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.js +35 -0
  79. package/source/components/OfferPanel/RangeGroup/RangeGroup.story.styl +3 -0
  80. package/source/components/PriceRating/PriceRating.story.js +39 -0
  81. package/source/components/PriceRating/PriceRating.story.styl +2 -0
  82. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.js +78 -0
  83. package/source/components/PriceRatingDetailed/PriceRatingDetailed.story.styl +11 -0
  84. package/source/components/RateSearchValue/RateSearchValue.story.js +78 -0
  85. package/source/components/RateSearchValue/RateSearchValue.story.styl +2 -0
  86. package/source/components/RateSearchWidget/RateSearchWidget.story.js +57 -0
  87. package/source/components/RateSearchWidget/RateSearchWidget.story.styl +12 -0
  88. package/source/components/SearchFilters/FiltersFactory.story.js +273 -0
  89. package/source/components/SearchPage/Filters/MakeModel/MakeModel.story.js +12 -0
  90. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.js +834 -0
  91. package/source/components/SearchWidget/BasicDataWidget/BasicDataWidget.story.styl +40 -0
  92. package/source/components/SearchWidget/SearchWidget.story.js +191 -0
  93. package/source/components/SearchWidget/SearchWidget.story.styl +6 -0
  94. package/source/components/Stepper/Stepper.story.js +119 -0
  95. package/source/components/Stepper/Stepper.story.styl +41 -0
  96. package/source/components/Theme.story.js +36 -0
  97. package/source/components/Theme.story.styl +85 -0
  98. package/source/components/TickerText/TickerText.story.js +17 -0
  99. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.story.js +95 -0
  100. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
  101. package/source/components/Vehicle/VehicleConsumption/VehicleConsumption.story.js +31 -0
  102. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.story.js +247 -0
  103. package/source/components/VehicleCompared/CompareGeneral/CompareGeneral.story.js +30 -0
  104. package/source/components/VehicleCompared/ComparePrice/ComparePrice.story.js +18 -0
  105. package/source/components/VehicleCompared/CompareTitle/CompareTitle.story.js +19 -0
  106. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.story.js +44 -0
  107. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +23 -11
  108. package/source/components/VehicleDetailedSidebar/partials/Properties.styl +5 -0
  109. package/source/components/VehicleDetailedSidebar/partials/Properties.tsx +56 -18
  110. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.story.js +120 -0
  111. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +2 -6
  112. package/source/components/VehiclePromoSlider/VehiclePromoInfo/VehiclePromoInfo.story.js +42 -0
  113. package/source/components/VehiclePromoSlider/VehiclePromoSlide/VehiclePromoSlide.story.js +62 -0
  114. package/source/components/VehiclePromoSlider/VehiclePromoSlider.story.js +42 -0
  115. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.styl +42 -0
  116. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +23 -11
  117. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.styl +60 -5
  118. package/source/components/VehicleSmallCard/VehicleData/VehicleInfo/VehicleInfo.tsx +36 -12
  119. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +3 -2
  120. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +18 -7
  121. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.styl +4 -1
  122. package/source/components/VehicleSmallCard/VehicleData/VehicleProperty/VehicleProperty.tsx +3 -2
  123. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +1 -1
  124. package/source/components/VehicleSmallCard/VehicleSmallCard.story.js +412 -0
  125. package/source/components/VehicleSmallCard/VehicleSmallCard.story.styl +56 -0
  126. package/source/components/VehicleSmallCard/VehicleSmallCard.styl +67 -2
  127. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +49 -3
  128. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.js +199 -0
  129. package/source/components/VehicleSmallCardForDealerships/VehicleSmallCardForDealerships.story.styl +40 -0
  130. package/source/components/_common/Accordion/Accordion.story.js +36 -0
  131. package/source/components/_common/Badge/Badge.story.js +27 -0
  132. package/source/components/_common/Badge/Badge.story.styl +5 -0
  133. package/source/components/_common/Bubble/Bubble.story.js +52 -0
  134. package/source/components/_common/Button/Button.story.js +52 -0
  135. package/source/components/_common/Button/Button.story.styl +5 -0
  136. package/source/components/_common/ButtonOld/Button.story.js +54 -0
  137. package/source/components/_common/ButtonOld/Button.story.styl +5 -0
  138. package/source/components/_common/Checkbox/Checkbox.story.js +85 -0
  139. package/source/components/_common/Checkbox/Checkbox.story.styl +14 -0
  140. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.js +126 -0
  141. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.story.styl +14 -0
  142. package/source/components/_common/Chip/Chip.story.js +43 -0
  143. package/source/components/_common/ChipList/ChipList.story.js +36 -0
  144. package/source/components/_common/DropDown/DropDown.story.js +35 -0
  145. package/source/components/_common/ExpandablePanel/ExpandablePanel.story.js +41 -0
  146. package/source/components/_common/Histogram/Histogram.story.js +51 -0
  147. package/source/components/_common/IconSVG/IconSVG.story.js +21 -0
  148. package/source/components/_common/IconSVG/IconSVG.story.styl +25 -0
  149. package/source/components/_common/Image/Image.story.js +142 -0
  150. package/source/components/_common/Image/Image.story.styl +18 -0
  151. package/source/components/_common/ImagesSet/ImagesSet.story.js +34 -0
  152. package/source/components/_common/ImagesSet/ImagesSet.story.styl +4 -0
  153. package/source/components/_common/Loader/Loader.story.js +21 -0
  154. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.story.js +49 -0
  155. package/source/components/_common/MaterialAccordionGroup/MaterialAccordionGroup.styled.tsx +4 -1
  156. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.js +45 -0
  157. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.story.styl +6 -0
  158. package/source/components/_common/MaterialField/MaterialField.story.js +87 -0
  159. package/source/components/_common/MaterialField/MaterialField.story.styl +34 -0
  160. package/source/components/_common/MaterialSelect/MaterialSelect.story.js +52 -0
  161. package/source/components/_common/MaterialSelect/MaterialSelect.story.styl +6 -0
  162. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.js +47 -0
  163. package/source/components/_common/MaterialStepButton/MaterialStepButton.story.styl +6 -0
  164. package/source/components/_common/MaterialSwitch/MaterialSwitch.story.js +17 -0
  165. package/source/components/_common/MaterialTooltip/MaterialTooltip.story.js +10 -0
  166. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +4 -3
  167. package/source/components/_common/Modal/Modal.story.js +37 -0
  168. package/source/components/_common/MuiGroupedSelect/MuiGroupedSelect.story.js +21 -0
  169. package/source/components/_common/PropertySelector/PSGroup.story.js +93 -0
  170. package/source/components/_common/PropertySelector/PSGroup.story.styl +25 -0
  171. package/source/components/_common/PropertySelector/ProperySelector.story.js +83 -0
  172. package/source/components/_common/Radio/FormRadioGroup.story.js +28 -0
  173. package/source/components/_common/Radio/FormRadioGroup.story.styl +2 -0
  174. package/source/components/_common/Radio/Radio.story.js +54 -0
  175. package/source/components/_common/Radio/RadioGroup.story.js +90 -0
  176. package/source/components/_common/Radio/RadioGroup.story.styl +39 -0
  177. package/source/components/_common/Range/Range.story.js +46 -0
  178. package/source/components/_common/Range/Range.story.styl +5 -0
  179. package/source/components/_common/SliderArrow/SliderArrow.story.js +18 -0
  180. package/source/components/_common/Tabs/Tabs.story.js +56 -0
  181. package/source/components/_common/TimePicker/TimePicker.story.js +37 -0
  182. package/source/components/_common/Tooltip/Tooltip.story.js +28 -0
  183. package/source/components/_common/UserMenu/MaterialMenu.story.js +73 -0
  184. package/source/components/_common/VehicleSlider/VehicleSlider.story.js +99 -0
  185. package/source/components/_common/VehicleSlider/VehicleSlider.story.styl +0 -0
  186. package/source/components/_common/withLabel/withLabel.story.js +62 -0
  187. package/source/components/_common/withPopover/withPopover.story.js +48 -0
  188. package/source/components/_common/withPopover/withPopover.story.styl +54 -0
  189. package/source/components/_common/withStats/withStats.story.js +75 -0
  190. package/source/components/_common/withStats/withStats.styl +10 -0
  191. package/source/framework/DataTransformers.ts +2 -0
  192. package/source/framework/constants/common.ts +8 -4
  193. package/source/framework/types/types.ts +1 -0
  194. package/source/framework/vehiclesProps/decoratedLightProps.tsx +109 -18
  195. package/source/framework/vehiclesProps/decoratedProps.tsx +68 -9
  196. package/source/framework/vehiclesProps/vehicleDetails.ts +3 -1
  197. package/source/locales/data.ts +13 -3
  198. package/bytebrand-fe-ui-core-4.8.110.tgz +0 -0
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import { storiesOf } from '@storybook/react';
4
+ import withPopover from './withPopover';
5
+ import styles from './withPopover.story.styl'
6
+
7
+ const Target = ({ isPopoverShown, text }) => {
8
+ const className = classnames(styles.target, { [styles.targetOpen]: isPopoverShown });
9
+ return <div className={className}>{text}</div>;
10
+ };
11
+
12
+ const Popover = ({ isPopoverShown, text }) => {
13
+ const className = classnames(styles.popover, { [styles.popoverOpen]: isPopoverShown });
14
+ return <div className={className}>{text}</div>;
15
+ };
16
+
17
+ const TargetWithPopover = withPopover(Target, Popover);
18
+
19
+ export class WithPopoverContainer extends React.Component {
20
+ state = {
21
+ type: 'click'
22
+ };
23
+
24
+ onCheckboxChange = () => {
25
+ this.setState({ type: this.state.type === 'click' ? 'hover' : 'click' });
26
+ };
27
+
28
+ render() {
29
+ const targetWithPopoverProps = {
30
+ targetProps: { text: 'Target' },
31
+ popoverProps: { text: 'Popover' },
32
+ type: this.state.type
33
+ };
34
+
35
+ return (
36
+ <React.Fragment>
37
+ <label className={styles.label}>
38
+ <input type='checkbox' value={this.state.showOnHover} onChange={this.onCheckboxChange} />
39
+ <span>Open on hover</span>
40
+ </label>
41
+ <TargetWithPopover {...targetWithPopoverProps} />
42
+ </React.Fragment>
43
+ );
44
+ }
45
+ }
46
+
47
+ storiesOf('_Common_UI', module)
48
+ .add('withPopover', () => <WithPopoverContainer />);
@@ -0,0 +1,54 @@
1
+ @import '../../../theme/theme.styl'
2
+
3
+ .label
4
+ display: block
5
+ font-family: $font-style-arial
6
+ margin-bottom: 20px
7
+
8
+ .target
9
+ position: relative
10
+ font-family: $font-style-arial
11
+ width: 150px
12
+ height: 30px
13
+ line-height: 30px
14
+ text-align: center
15
+ border 1px solid $grey-b
16
+ border-radius: 3px
17
+ transition: all 0.2s ease-in-out
18
+ cursor: pointer
19
+ &:hover
20
+ background-color: $grey-f2
21
+
22
+ .targetOpen
23
+ color: $primary
24
+ font-weight: bold
25
+ border-color: $primary
26
+ &:after
27
+ content: ''
28
+ position: absolute
29
+ display: block
30
+ width: 100%
31
+ height: 15px
32
+
33
+ .popover
34
+ position: relative
35
+ box-sizing: border-box
36
+ color: white
37
+ font-size: 25px
38
+ font-weight: bold
39
+ border 3px solid $yellow-f1
40
+ position: absolute
41
+ top: 45px
42
+ width: 250px
43
+ height: 100px
44
+ line-height: 100px
45
+ text-align: center
46
+ border-radius: 3px
47
+ background-color: $grassGreen
48
+ visibility: hidden
49
+ opacity: 0
50
+ transition: all 0.2s ease-in-out
51
+
52
+ .popoverOpen
53
+ visibility: visible
54
+ opacity: 1
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import styles from '../Image/Image.story.styl'
3
+
4
+ import { storiesOf } from '@storybook/react';
5
+
6
+ import Image from '../Image/Image.tsx';
7
+ import withStats from './withStats.tsx'
8
+ import { COLUMN_STYLES, CONTAINER_STYLES, ROW_STYLES } from '../../../framework/constants';
9
+
10
+ const SRC_HORIZONTAL = 'https://placekitten.com/400/300';
11
+
12
+ const ImageWithStats = withStats(Image);
13
+
14
+ export class ImageWithStatsContainer extends React.Component {
15
+ state = {
16
+ isFavoured: false
17
+ };
18
+
19
+ onFavoriteClick = () => {
20
+ this.setState({ isFavoured: !this.state.isFavoured })
21
+ };
22
+
23
+ render() {
24
+ const basicProps = {
25
+ isFavoured: this.state.isFavoured,
26
+ imagesCount: 10,
27
+ statsData: {
28
+ totalCarImpCount: 15,
29
+ totalFavCount: 20
30
+ },
31
+ statsSize: 'xs',
32
+ showNewLabel: true,
33
+ price: {
34
+ historyPriceDifference: 500,
35
+ historyPriceDifferencePerCent: 25
36
+ },
37
+ onFavoriteClick: this.onFavoriteClick
38
+ };
39
+
40
+ const xsProps = { ...basicProps, ...{ statsSize: 'xs' } };
41
+ const mdProps = { ...basicProps, ...{ statsSize: 'md', price: { historyPriceDifference: 499, historyPriceDifferencePerCent: 25 } } };
42
+
43
+ return (
44
+ <div style={CONTAINER_STYLES}>
45
+ <div style={COLUMN_STYLES}>
46
+ <div style={ROW_STYLES}>
47
+ <div className={styles.row}>
48
+ <div className={styles.col}>
49
+ <h2 className={styles.title}>XS Size</h2>
50
+ <div className={styles.row}>
51
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
52
+ <ImageWithStats src={SRC_HORIZONTAL} width='100%' ratioW={4} ratioH={3} {...xsProps} />
53
+ </div>
54
+ </div>
55
+ </div>
56
+ <div className={styles.col}>
57
+ <h2 className={styles.title}>MD Size ({'price difference < 500'})</h2>
58
+ <div className={styles.row}>
59
+ <div className={styles.col} style={{ width: '300px', maxWidth: '100%', margin: '0 auto' }}>
60
+ <ImageWithStats src={SRC_HORIZONTAL} width='100%' ratioW={4} ratioH={3} {...mdProps} />
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ );
69
+ }
70
+ }
71
+
72
+ storiesOf('_Common_UI', module)
73
+ .add('withStats', () => (
74
+ <ImageWithStatsContainer />
75
+ ));
@@ -150,10 +150,20 @@ $indent = 10px
150
150
  height: 18px
151
151
  font-size: 10px
152
152
  min-width: 30px
153
+ .badgeFull
154
+ display: none
155
+ .badgeShort
156
+ display: inline
153
157
 
154
158
  .badgeItem
155
159
  // hook class for compact-mode overrides
156
160
 
161
+ .badgeFull
162
+ display: inline
163
+
164
+ .badgeShort
165
+ display: none
166
+
157
167
  .priceDifferencePerCent
158
168
  margin-left: auto;
159
169
 
@@ -69,6 +69,8 @@ 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),
73
+ wltpDischargedEnergyEfficiencyClass: _get(car, 'environmentEmissions.wltpDischargedEnergyEfficiencyClass', null),
72
74
  pluginHybrid: _get(car, 'engineData.pluginHybrid', null),
73
75
  wltpCombined: _get(car, 'consumption.wltpCombined', null),
74
76
  wltpPowerCombined: _get(car, 'consumption.wltpPowerCombined', null),
@@ -1,8 +1,12 @@
1
- export const SITE_DOMAIN: string = 'https://www.auto.de';
1
+ const _rawHost = typeof window !== 'undefined' ? window.location.host.replace('www.', '') : 'auto.de';
2
+ const _isIP = /^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(_rawHost);
3
+ const _imgBase = _isIP ? 'https://images.auto.de' : 'https://images.' + _rawHost;
2
4
 
3
- export const PLACEHOLDER_IMAGE: string = 'https://images.auto.de/noimage/';
4
- export const PLACEHOLDER_IMAGE_SMALL_URL: string = `https://images.auto.de/noimage/noimage/small`;
5
- export const PLACEHOLDER_IMAGE_LARGE_URL: string = `https://images.auto.de/noimage/noimage/large`;
5
+ export const SITE_DOMAIN: string = typeof window !== 'undefined' ? 'https://' + window.location.host : 'https://www.auto.de';
6
+
7
+ export const PLACEHOLDER_IMAGE: string = _imgBase + '/noimage/';
8
+ export const PLACEHOLDER_IMAGE_SMALL_URL: string = _imgBase + '/noimage/small';
9
+ export const PLACEHOLDER_IMAGE_LARGE_URL: string = _imgBase + '/noimage/large';
6
10
 
7
11
  export const QUOTES_SLIDES_TO_SHOW_DEFAULT = 3;
8
12
 
@@ -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 {
@@ -123,7 +123,10 @@ const getDecoratedLightProps = (
123
123
  const translatedUnit = t(`cbd:${consumptionUnit}`);
124
124
  const wltpConsumptionCombined = car.consumption.wltpCombined;
125
125
  const wltpCo2 = car.environmentEmissions.wltpCo2;
126
- const consumptionPowerCombined = car.consumption.consumptionCombined;
126
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
127
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
128
+ ? t('vehicleProps:value.co2Class', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
129
+ : null;
127
130
 
128
131
  const co2 = car.environmentEmissions.co2;
129
132
 
@@ -143,41 +146,74 @@ const getDecoratedLightProps = (
143
146
  ? t('vehicleProps:value.consumptionCombined', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit })
144
147
  : t('vehicleProps:value.na');
145
148
 
146
- const consumptionPowerCombinedContent = t('vehicleProps:value.consumptionPowerCombined', { consumption: consumptionPowerCombined.toLocaleString(language), unit: translatedUnit });
147
-
148
149
  const co2Value = Number.isFinite(co2)
149
150
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
150
151
  : t('vehicleProps:value.na');
151
152
 
152
- const hybridPlugin = car.engineData.hybridPlugin;
153
+ // ADV-88: "is a hybrid car" is now determined by fuel type (hybrid electric + diesel/petrol),
154
+ // not engineData.hybridPlugin.
155
+ const hybridPlugin = car.consumption.fuel === 'selector_fuel_hybridElectricalDiesel'
156
+ || car.consumption.fuel === 'selector_fuel_hybridElectricalPetrol';
153
157
  const wltpWeightedPowerCombined = car.consumption.wltpWeightedPowerCombined;
154
158
  const wltpWeightedCombined = car.consumption.wltpWeightedCombined;
155
159
 
156
160
  const wltpWeightedPowerCombinedContent = wltpWeightedPowerCombined ? t('vehicleProps:value.wltpWeightedPowerCombined', { consumption: wltpWeightedPowerCombined.toLocaleString(language), unit: translatedUnit }) : null;
157
161
  const wltpWeightedCombinedContent = wltpWeightedCombined ? t('vehicleProps:value.wltpWeightedCombined', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit }) : null;
158
162
 
163
+ // ADV-88: the weighted+discharged (entladen) consumption treatment is shown for ANY plug-in
164
+ // hybrid (new or used) — gated on hybridPlugin only, no condition check.
159
165
  if (hybridPlugin) {
166
+ if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
167
+ const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
168
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
169
+ const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
170
+ const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
171
+ const co2WeightedContent = Number.isFinite(wltpCo2)
172
+ ? t('vehicleProps:value.wltpCo2WtdCombinedShort', { co2: wltpCo2.toLocaleString(language) })
173
+ : null;
174
+ const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
175
+ ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
176
+ : null;
177
+ const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
178
+ return <React.Fragment>
179
+ {`${wltpWeightedPowerCombinedContent} + `}
180
+ {`${weightedCombinedLabeled}, `}
181
+ {`${dischargedCombinedLabeled}`}
182
+ {co2WeightedContent && <>, {co2WeightedContent}</>}
183
+ {co2ClassWeighted && <>, {co2ClassWeighted}</>}
184
+ {<>, {co2ClassDischarged}</>}
185
+ </React.Fragment>
186
+ }
187
+
160
188
  if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent && wltpCo2PluginValue) {
161
189
  return <React.Fragment>
162
190
  {`${wltpWeightedPowerCombinedContent}, `}
163
191
  {`${wltpWeightedCombinedContent}, `}
164
192
  {wltpCo2PluginValue}
193
+ {co2ClassValue && <>, {co2ClassValue}</>}
165
194
  </React.Fragment>
166
195
  }
167
196
 
168
- return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
197
+ // ADV-88: only render the electric (kWh) line when the car actually has a combined
198
+ // power consumption — otherwise we printed "nullkWh/100km" for plug-ins lacking it.
199
+ const realPowerCombined = car.consumption.consumptionPowerCombined;
200
+ const powerCombinedLine = Number.isFinite(realPowerCombined)
201
+ ? t('vehicleProps:value.consumptionPowerCombined', { consumption: realPowerCombined.toLocaleString(language), unit: translatedUnit })
202
+ : null;
203
+ return Number.isFinite(consumptionCombined) || Number.isFinite(realPowerCombined)
169
204
  ? <React.Fragment>
170
- {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionValue} <br /> {co2Value}
205
+ {powerCombinedLine && <>{powerCombinedLine} <br /></>}{consumptionValue} <br /> {co2Value}
206
+ {co2ClassValue && <>, {co2ClassValue}</>}
171
207
  </React.Fragment>
172
208
  : t('vehicleProps:value.na');
173
209
 
174
210
  }
175
211
 
176
212
  if (wltpConsumptionValue && wltpCo2Value) {
177
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
213
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
178
214
  }
179
215
 
180
- return <>{consumptionValue} <br /> {co2Value}</>;
216
+ return <>{consumptionValue} <br /> {co2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
181
217
  }
182
218
  },
183
219
  consumptionPowerCombinedAlternateView: {
@@ -191,6 +227,10 @@ const getDecoratedLightProps = (
191
227
  const co2 = car.environmentEmissions.co2;
192
228
  const wltpConsumptionPowerCombined = car.consumption.wltpPowerCombined;
193
229
  const wltpCo2 = car.environmentEmissions.wltpCo2;
230
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
231
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
232
+ ? t('vehicleProps:value.co2Class', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
233
+ : null;
194
234
 
195
235
  const wltpConsumptionValue = Number.isFinite(wltpConsumptionPowerCombined)
196
236
  ? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
@@ -209,10 +249,10 @@ const getDecoratedLightProps = (
209
249
  : t('vehicleProps:value.na');
210
250
 
211
251
  if (wltpConsumptionValue && wltpCo2Value) {
212
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
252
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
213
253
  }
214
254
 
215
- return <>{consumptionValue} <br /> {co2Value} </>;
255
+ return <>{consumptionValue} <br /> {co2Value} {co2ClassValue && <>, {co2ClassValue}</>}</>;
216
256
  }
217
257
  },
218
258
 
@@ -233,8 +273,12 @@ const getDecoratedLightProps = (
233
273
 
234
274
  const consumptionPowerCombinedContent = t('vehicleProps:value.consumptionPowerCombined', { consumption: consumptionPowerCombined.toLocaleString(language), unit: translatedUnit });
235
275
  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 });
276
+ const wltpWeightedPowerCombinedContent = Number.isFinite(wltpWeightedPowerCombined)
277
+ ? t('vehicleProps:value.wltpWeightedPowerCombined', { consumption: wltpWeightedPowerCombined.toLocaleString(language), unit: translatedUnit })
278
+ : null;
279
+ const wltpWeightedCombinedContent = Number.isFinite(wltpWeightedCombined)
280
+ ? t('vehicleProps:value.wltpWeightedCombined', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit })
281
+ : null;
238
282
  const wltpConsumptionPowerCombinedContent = wltpConsumptionPowerCombined
239
283
  ? t('vehicleProps:value.wltpPowerCombined', { consumption: wltpConsumptionPowerCombined.toLocaleString(language), unit: translatedUnit })
240
284
  : null;
@@ -245,6 +289,10 @@ const getDecoratedLightProps = (
245
289
 
246
290
  const co2 = car.environmentEmissions.co2;
247
291
  const wltpCo2 = car.environmentEmissions.wltpCo2;
292
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
293
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
294
+ ? t('vehicleProps:value.co2Class', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
295
+ : null;
248
296
 
249
297
  const co2Value = Number.isFinite(co2)
250
298
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
@@ -258,14 +306,42 @@ const getDecoratedLightProps = (
258
306
  ? t('vehicleProps:value.wltpCo2WtdCombined', { co2: wltpCo2.toLocaleString(language), unit: translatedUnit })
259
307
  : null;
260
308
 
261
- const hybridPlugin = car.engineData.hybridPlugin;
309
+ // ADV-88: "is a hybrid car" is now determined by fuel type (hybrid electric + diesel/petrol),
310
+ // not engineData.hybridPlugin.
311
+ const hybridPlugin = car.consumption.fuel === 'selector_fuel_hybridElectricalDiesel'
312
+ || car.consumption.fuel === 'selector_fuel_hybridElectricalPetrol';
262
313
 
314
+ // ADV-88: the weighted+discharged (entladen) consumption treatment is shown for ANY plug-in
315
+ // hybrid (new or used) — gated on hybridPlugin only, no condition check.
263
316
  if (hybridPlugin) {
317
+ if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
318
+ const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
319
+ const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
320
+ const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
321
+ const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
322
+ const co2WeightedContent = Number.isFinite(wltpCo2)
323
+ ? t('vehicleProps:value.wltpCo2WtdCombinedShort', { co2: wltpCo2.toLocaleString(language) })
324
+ : null;
325
+ const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
326
+ ? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
327
+ : null;
328
+ const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
329
+ return <React.Fragment>
330
+ {`${wltpWeightedPowerCombinedContent} + `}
331
+ {`${weightedCombinedLabeled}, `}
332
+ {`${dischargedCombinedLabeled}`}
333
+ {co2WeightedContent && <>, {co2WeightedContent}</>}
334
+ {co2ClassWeighted && <>, {co2ClassWeighted}</>}
335
+ {<>, {co2ClassDischarged}</>}
336
+ </React.Fragment>
337
+ }
338
+
264
339
  if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent && wltpCo2PluginValue) {
265
340
  return <React.Fragment>
266
341
  {`${wltpWeightedPowerCombinedContent}, `}
267
342
  {`${wltpWeightedCombinedContent}, `}
268
343
  {wltpCo2PluginValue}
344
+ {co2ClassValue && <>, {co2ClassValue}</>}
269
345
  </React.Fragment>
270
346
  }
271
347
  }
@@ -275,12 +351,14 @@ const getDecoratedLightProps = (
275
351
  {`${wltpConsumptionPowerCombinedContent}, `}
276
352
  {`${wltpWeightedCombinedContent}, `}
277
353
  {wltpCo2PluginValue}
354
+ {co2ClassValue && <>, {co2ClassValue}</>}
278
355
  </React.Fragment>
279
356
  }
280
357
 
281
358
  return Number.isFinite(consumptionCombined) || Number.isFinite(consumptionPowerCombined)
282
359
  ? <React.Fragment>
283
360
  {consumptionPowerCombined ? consumptionPowerCombinedContent : t('vehicleProps:value.na')} <br />{consumptionCombinedContent} <br /> {co2Value}
361
+ {co2ClassValue && <>, {co2ClassValue}</>}
284
362
  </React.Fragment>
285
363
  : t('vehicleProps:value.na');
286
364
  }
@@ -297,6 +375,10 @@ const getDecoratedLightProps = (
297
375
  const co2 = car.environmentEmissions.co2;
298
376
  const wltpConsumptionCombined = car.consumption.wltpCombined;
299
377
  const wltpCo2 = car.environmentEmissions.wltpCo2;
378
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
379
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
380
+ ? t('vehicleProps:value.co2Class', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
381
+ : null;
300
382
 
301
383
  const consumptionValue = Number.isFinite(consumptionHydrogenCombined)
302
384
  ? t('vehicleProps:value.consumptionGas', { consumption: consumptionHydrogenCombined.toLocaleString(language), unit: translatedUnit })
@@ -314,10 +396,10 @@ const getDecoratedLightProps = (
314
396
  : null;
315
397
 
316
398
  if (wltpConsumptionValue && wltpCo2Value) {
317
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
399
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
318
400
  }
319
401
 
320
- return <>{consumptionValue} <br /> {co2Value}</>;
402
+ return <>{consumptionValue} <br /> {co2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
321
403
  }
322
404
  },
323
405
  consumptionGasCombinedAlternateView: {
@@ -331,6 +413,10 @@ const getDecoratedLightProps = (
331
413
  const co2 = car.environmentEmissions.co2;
332
414
  const wltpConsumptionCombined = car.consumption.wltpCombined;
333
415
  const wltpCo2 = car.environmentEmissions.wltpCo2;
416
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
417
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
418
+ ? t('vehicleProps:value.co2Class', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
419
+ : null;
334
420
 
335
421
  const consumptionValue = Number.isFinite(consumptionGasCombined)
336
422
  ? t('vehicleProps:value.consumptionGas', { consumption: consumptionGasCombined.toLocaleString(language), unit: translatedUnit })
@@ -349,10 +435,10 @@ const getDecoratedLightProps = (
349
435
  : null;
350
436
 
351
437
  if (wltpConsumptionValue && wltpCo2Value) {
352
- return <>{wltpConsumptionValue}, {wltpCo2Value}</>;
438
+ return <>{wltpConsumptionValue}, {wltpCo2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
353
439
  }
354
440
 
355
- return <>{consumptionValue} <br /> {co2Value}</>;
441
+ return <>{consumptionValue} <br /> {co2Value}{co2ClassValue && <>, {co2ClassValue}</>}</>;
356
442
  }
357
443
  },
358
444
  consumptionCombinedDealer: {
@@ -364,6 +450,7 @@ const getDecoratedLightProps = (
364
450
  const translatedUnit = t(`cbd:${consumptionUnit}`);
365
451
 
366
452
  const co2 = car.environmentEmissions.co2;
453
+ const wltpEnergyEfficiencyClass = car.environmentEmissions.wltpEnergyEfficiencyClass;
367
454
 
368
455
  const consumptionValue = Number.isFinite(consumptionCombined)
369
456
  ? t('vehicleProps:value.consumptionCombined', { consumption: consumptionCombined.toLocaleString(language), unit: translatedUnit })
@@ -373,7 +460,11 @@ const getDecoratedLightProps = (
373
460
  ? t('vehicleProps:value.co2Combined', { co2: co2.toLocaleString(language) })
374
461
  : t('vehicleProps:value.na');
375
462
 
376
- return <>{consumptionValue} | {co2Value}</>;
463
+ const co2ClassValue = isPropDefined(wltpEnergyEfficiencyClass)
464
+ ? t('vehicleProps:value.co2Class', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
465
+ : null;
466
+
467
+ return <>{consumptionValue} | {co2Value}{co2ClassValue ? <> | {co2ClassValue}</> : null}</>;
377
468
  }
378
469
  },
379
470
  gearbox: {