@bytebrand/fe-ui-core 4.3.1 → 4.4.0

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 (125) hide show
  1. package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
  2. package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
  3. package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +4 -2
  4. package/common.ts +6 -2
  5. package/package.json +19 -28
  6. package/source/components/AccordionWidget/AccordionWidget.tsx +1 -3
  7. package/source/components/Breadcrumbs/Breadcrumbs.tsx +3 -3
  8. package/source/components/Checkout/CheckoutStepper/CheckoutStepper.styl +2 -190
  9. package/source/components/Checkout/CheckoutStepper/CheckoutStepper.tsx +15 -16
  10. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.styl +2 -2
  11. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.tsx +3 -3
  12. package/source/components/FormattedNumber/FormattedNumber.tsx +2 -3
  13. package/source/components/InfoBlocks/FirstInfoBlock/FirstInfoBlockItem/FirstInfoBlockItem.styl +4 -6
  14. package/source/components/OfferDetailedSection/partials/PanelConfig.tsx +0 -3
  15. package/source/components/OfferPanel/MuiOfferPeriod/{MuiOfferPeriod.theme.js → MuiOfferPeriod.theme.tsx} +8 -13
  16. package/source/components/OfferPanel/MuiOfferPeriod/MuiOfferPeriod.tsx +28 -4
  17. package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +6 -12
  18. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -1
  19. package/source/components/OfferPanel/OfferPanel.tsx +1 -1
  20. package/source/components/OfferPanel/OfferPeriod/OfferPeriod.tsx +0 -4
  21. package/source/components/OfferPanel/RangeGroup/RangeGroup.tsx +6 -4
  22. package/source/components/PriceRatingDetailed/PriceRatingDetailed.tsx +6 -2
  23. package/source/components/SearchFilters/filters/AlternativeID.tsx +42 -53
  24. package/source/components/SearchFilters/filters/DriveType.tsx +1 -1
  25. package/source/components/SearchFilters/filters/EmissionSticker.tsx +1 -1
  26. package/source/components/SearchFilters/filters/FirstRegistration.tsx +0 -1
  27. package/source/components/SearchFilters/filters/InteriorColor.tsx +1 -1
  28. package/source/components/SearchFilters/filters/InteriorMaterial.tsx +2 -1
  29. package/source/components/SearchFilters/filters/Mileage.tsx +1 -1
  30. package/source/components/SearchFilters/filters/Power.tsx +36 -17
  31. package/source/components/SearchFilters/filters/StateOptions.tsx +0 -1
  32. package/source/components/SearchFilters/filters/Transmission.tsx +1 -1
  33. package/source/components/SearchPage/SearchChips/SearchChips.tsx +1 -1
  34. package/source/components/SearchPageMobile/FiltersDetailed/BodyType.tsx +3 -3
  35. package/source/components/SearchPageMobile/FiltersDetailed/Consumption.tsx +2 -2
  36. package/source/components/SearchPageMobile/FiltersDetailed/Doors.tsx +1 -1
  37. package/source/components/SearchPageMobile/FiltersDetailed/MakeModel.tsx +1 -1
  38. package/source/components/SearchWidget/ColorWidget/BodyColorWidget.tsx +3 -3
  39. package/source/components/SearchWidget/EnvironmentWidget/EnvironmentWidget.tsx +3 -3
  40. package/source/components/SearchWidget/HighlightsWidget/HighlightsWidget.tsx +2 -2
  41. package/source/components/SearchWidget/StateWidget/StateWidget.tsx +1 -2
  42. package/source/components/SearchWidgetsMobile/BasicDataWidgetMobile/BasicDataWidgetMobile.tsx +4 -4
  43. package/source/components/SearchWidgetsMobile/EquipmentsWidget/EquipmentsWidget.tsx +16 -16
  44. package/source/components/SearchWidgetsMobile/HighlightsWidgetMobile/HighlightsWidgetMobile.tsx +1 -1
  45. package/source/components/SearchWidgetsMobile/InteriorWidget/InteriorWidget.tsx +1 -1
  46. package/source/components/SearchWidgetsMobile/SafetyWidget/SafetyWidget.tsx +6 -6
  47. package/source/components/Stepper/Stepper.tsx +4 -3
  48. package/source/components/UserDashboardPage/sections/CheckoutSection/CheckoutSection.styl +38 -0
  49. package/source/components/UserDashboardPage/sections/CheckoutSection/CheckoutSection.tsx +120 -0
  50. package/source/components/UserDashboardPage/sections/FavoriteSection/FavoriteSection.styl +22 -0
  51. package/source/components/UserDashboardPage/sections/FavoriteSection/FavoriteSection.tsx +84 -0
  52. package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.styl +11 -2
  53. package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.tsx +5 -5
  54. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar.tsx +57 -38
  55. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCard.tsx +2 -2
  56. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx +183 -101
  57. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.tsx +5 -7
  58. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.tsx +33 -7
  59. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.styl +10 -2
  60. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +54 -14
  61. package/source/components/VehicleDetailedSidebar/partials/Price.styl +5 -1
  62. package/source/components/VehicleDetailedSidebar/partials/Price.tsx +2 -1
  63. package/source/components/VehicleDetailedSidebar/partials/PriceContent.styl +16 -5
  64. package/source/components/VehicleDetailedSidebar/partials/PriceContent.tsx +9 -4
  65. package/source/components/VehicleDetailedSidebar/partials/Properties.tsx +1 -1
  66. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.styl +45 -0
  67. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +121 -42
  68. package/source/components/VehicleDetailedSlider/partials/PriceData.styl +4 -1
  69. package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +8 -1
  70. package/source/components/VehicleDetailedSlider/partials/Stats.tsx +2 -2
  71. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +9 -7
  72. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +35 -1
  73. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +9 -3
  74. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.styl +11 -2
  75. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +2 -1
  76. package/source/components/VehicleSmallCard/VehicleSmallCard.styl +3 -1
  77. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +3 -7
  78. package/source/components/_common/Badge/Badge.styl +3 -0
  79. package/source/components/_common/Badge/Badge.tsx +1 -1
  80. package/source/components/_common/Button/Button.tsx +5 -4
  81. package/source/components/_common/Checkbox/FormCheckbox.tsx +4 -4
  82. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.tsx +1 -1
  83. package/source/components/_common/Chip/Chip.tsx +1 -3
  84. package/source/components/_common/ExpansionPanel/ExpansionPanel.tsx +3 -3
  85. package/source/components/_common/IconSVG/IconSVGConfig.tsx +2 -0
  86. package/source/components/_common/IconSVG/SVG/flags/SK.tsx +0 -1
  87. package/source/components/_common/IconSVG/SVG/slider/360New.tsx +1 -1
  88. package/source/components/_common/IconSVG/SVG/slider/YoutubeButton.tsx +26 -0
  89. package/source/components/_common/MaterialAccordion/MaterialAccordion.tsx +22 -30
  90. package/source/components/_common/MaterialAutocomplete/MaterialAutocomplete.styled.tsx +8 -8
  91. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.styled.tsx +0 -1
  92. package/source/components/_common/MaterialSelect/MaterialSelect.styled.tsx +12 -15
  93. package/source/components/_common/MaterialSelect/MaterialSelect.tsx +3 -3
  94. package/source/components/_common/MaterialSwitch/MaterialSwitch.tsx +3 -1
  95. package/source/components/_common/MaterialTooltip/MaterialTooltip.styled.tsx +1 -1
  96. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +3 -3
  97. package/source/components/_common/Modal/CookieModal.tsx +1 -3
  98. package/source/components/_common/Modal/Modal.styled.tsx +2 -1
  99. package/source/components/_common/Modal/Modal.tsx +1 -5
  100. package/source/components/_common/Modal/ModalsConfig.tsx +5 -1
  101. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.styl +23 -7
  102. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.tsx +84 -36
  103. package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.styl +29 -14
  104. package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.tsx +17 -10
  105. package/source/components/_common/OfferRequestButtonWrapper/OfferRequestButtonWrapper.tsx +12 -4
  106. package/source/components/_common/Range/Range.tsx +26 -16
  107. package/source/components/_common/UserMenu/MaterialMenu.styled.tsx +0 -1
  108. package/source/components/_common/UserMenu/MaterialMenu.tsx +3 -3
  109. package/source/components/_common/UserMenu/MaterialMenuItem.tsx +42 -20
  110. package/source/components/_common/UserMenu/NestedMenu.tsx +1 -1
  111. package/source/components/_common/withStats/withStats.styl +3 -0
  112. package/source/components/_common/withStats/withStats.tsx +19 -16
  113. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.styl +14 -1
  114. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.tsx +78 -42
  115. package/source/framework/constants/common.ts +89 -60
  116. package/source/framework/constants/highlights.ts +1 -1
  117. package/source/framework/constants.ts +1 -1
  118. package/source/framework/types/types.ts +9 -4
  119. package/source/framework/utils/CommonUtils.ts +73 -62
  120. package/source/framework/utils/DateUtils.ts +10 -2
  121. package/source/framework/vehiclesProps/decoratedLightProps.tsx +1 -2
  122. package/source/framework/vehiclesProps/decoratedProps.tsx +1 -2
  123. package/source/locales/data.ts +2 -2
  124. package/tslint.json +1 -2
  125. package/utils.ts +2 -0
@@ -0,0 +1,38 @@
1
+ @import '../../../../theme/mixins.styl'
2
+
3
+ .checkoutSection
4
+ padding: 0;
5
+ box-sizing: border-box;
6
+ max-width: calc(100vw - 32px);
7
+ // padding: 16px 16px 16px 22px;
8
+
9
+ +media-tablet-landscape-up()
10
+ max-width: 1100px;
11
+ padding: 0;
12
+
13
+ [class*='RecentlySection__wrapVehicleSmallCard']
14
+ max-width: calc(100vw - 32px);
15
+ box-sizing: border-box;
16
+
17
+ +media-tablet-up()
18
+ max-width: calc(50vw - 64px);
19
+
20
+ +media-tablet-landscape-up()
21
+ max-width: 346px;
22
+
23
+ .checkoutWrapItem
24
+ & + &
25
+ border-top: 1px solid rgba(76,78,100,0.12);
26
+
27
+ .wrapFavorites
28
+ border: none !important;
29
+
30
+ .favoriteBtn
31
+ height: 30px;
32
+ font-size: 13px;
33
+ text-transform: none !important
34
+ font-weight: 400 !important;
35
+
36
+ +media-tablet-landscape-up()
37
+ height: 38px;
38
+ font-size: 14px;
@@ -0,0 +1,120 @@
1
+ import * as React from 'react';
2
+ import _get from 'lodash/get';
3
+ import DashboardSection from '../../../containers/DasboardSection/DashboardSection';
4
+ import styles from './CheckoutSection.styl';
5
+ import { isMobileOnly } from 'react-device-detect';
6
+ import Slider from 'react-slick';
7
+ import { VehicleSmallCard } from '../../../../../common';
8
+ import { toJS } from 'mobx';
9
+ // import { toJS } from 'mobx';
10
+
11
+ interface ITFunction {
12
+ <T = string>(key: string, options?: object): T;
13
+ <T = string>(keys: string[], options?: object): T;
14
+ }
15
+
16
+ interface ICheckoutSectionProps {
17
+ carsStore: any;
18
+ appStore: any;
19
+ imagesStore: any;
20
+ t?: ITFunction;
21
+ LinkRouter: any;
22
+ PLACEHOLDER_IMAGE_SMALL_URL:string;
23
+ checkoutCars?:any;
24
+ }
25
+
26
+ class CheckoutSection extends React.Component<ICheckoutSectionProps, {}> {
27
+ onCarSelectCheckout = (carId?: string) => {
28
+ const checkoutCars = this.props.checkoutCars;
29
+ const car = checkoutCars.find((item: any) => item.id === carId);
30
+ const { mainImageId, title: { model, subModel, make } } = car;
31
+ window.open(`/checkout/contact-information?carId=${carId}&isSavedCheckout=true&mainImageId=${mainImageId}&model=${model}&subModel=${subModel}&make=${make}`, '_blank');
32
+ };
33
+
34
+ renderCheckouts = () => {
35
+ const { t, appStore: { language }, carsStore, imagesStore , PLACEHOLDER_IMAGE_SMALL_URL, checkoutCars } = this.props;
36
+ return checkoutCars.map((car: any) => {
37
+ const carId = _get(car, 'id');
38
+ const { mainImageId, title: { model, subModel, make } } = car;
39
+ const src = !!mainImageId && !!car.imagesCount
40
+ ? imagesStore.getSupportedImageFormat(carId, mainImageId, 'small')
41
+ : PLACEHOLDER_IMAGE_SMALL_URL;
42
+ const vehicleProps = {
43
+ ...car,
44
+ t,
45
+ language,
46
+ mainImageId,
47
+ src,
48
+ url: `/checkout/contact-information?carId=${carId}&isSavedCheckout=true&mainImageId=${mainImageId}&model=${model}&subModel=${subModel}&make=${make}`,
49
+ id: carId,
50
+ target: '_blank',
51
+ rel: 'noopener noreferrer',
52
+ showSlider: false,
53
+ showOfferBtn: true,
54
+ showFavoriteStar: false,
55
+ priceSubMtl: !isMobileOnly ? t('vehicleProps:value.priceSub') : null,
56
+ stats: {
57
+ imagesCount: _get(car, 'imagesCount'),
58
+ statsData: carsStore.aggStatsData.get(car.id)
59
+ },
60
+ dashboardButtonText: t('vehicleProps:title.toCheckoutCar'),
61
+ i18nPrefixForPriceRating: 'common:',
62
+ className: styles.wrapFavorites,
63
+ classButton: styles.favoriteBtn,
64
+ onDetailsClick: this.onCarSelectCheckout,
65
+ vehicleComponentName: 'favorite'
66
+ };
67
+
68
+ return (
69
+ <div key={`checkoutCar${carId}`} className={styles.checkoutWrapItem}>
70
+ <VehicleSmallCard {...vehicleProps} />
71
+ </div>
72
+ );
73
+ });
74
+ };
75
+
76
+ render(): JSX.Element {
77
+ const { t, checkoutCars } = this.props;
78
+
79
+ const sliderProps = {
80
+ slidesToShow: 3,
81
+ slidesToScroll: 1,
82
+ initialSlide: 2,
83
+ dots: false,
84
+ arrow: false,
85
+ mobileFirst: true,
86
+ responsive: [
87
+ {
88
+ breakpoint: 991,
89
+ settings: { slidesToShow: 3 }
90
+ },
91
+ {
92
+ breakpoint: 767,
93
+ settings: { slidesToShow: 2 }
94
+ },
95
+ {
96
+ breakpoint: 574,
97
+ settings: { slidesToShow: 1 }
98
+ }
99
+ ]
100
+ };
101
+
102
+ return (
103
+ <>
104
+ {checkoutCars?.length !== 0 ?
105
+ <DashboardSection className={styles.checkoutSection} title={t('DashboardPage:checkoutTitle')}>
106
+ {!isMobileOnly ?
107
+ this.renderCheckouts()
108
+ : <Slider {...sliderProps}>
109
+ {this.renderCheckouts()}
110
+ </Slider>
111
+ }
112
+ </DashboardSection>
113
+ : false
114
+ }
115
+ </>
116
+ );
117
+ }
118
+ }
119
+
120
+ export default CheckoutSection;
@@ -0,0 +1,22 @@
1
+ @import '../../../../theme/mixins.styl'
2
+
3
+ .wrapFavorites
4
+ border: none !important;
5
+
6
+ .favoriteBtn
7
+ height: 30px;
8
+ font-size: 13px;
9
+ text-transform: none !important
10
+ font-weight: 400 !important;
11
+
12
+ +media-tablet-landscape-up()
13
+ height: 38px;
14
+ font-size: 14px;
15
+
16
+ .btnCarToFavorites
17
+ height: 38px;
18
+ min-width: 160px !important;
19
+ font-size: 13px !important;
20
+ +media-tablet-landscape-up()
21
+ min-width: 224px !important;
22
+ font-size: 14px !important;
@@ -0,0 +1,84 @@
1
+ import * as React from 'react';
2
+ import _get from 'lodash/get';
3
+ import DashboardSection from '../../../containers/DasboardSection/DashboardSection';
4
+ import styles from './FavoriteSection.styl';
5
+ import { isMobileOnly } from 'react-device-detect';
6
+ import { VehicleSmallCard, Button } from '../../../../../common';
7
+
8
+ interface ITFunction {
9
+ <T = string>(key: string, options?: object): T;
10
+ <T = string>(keys: string[], options?: object): T;
11
+ }
12
+
13
+ interface IFavoriteSectionProps {
14
+ favoriteStore: any;
15
+ carsStore: any;
16
+ appStore: any;
17
+ imagesStore: any;
18
+ t?: ITFunction;
19
+ PLACEHOLDER_IMAGE_SMALL_URL: string;
20
+ LinkRouter: any;
21
+ favoriteCars:any;
22
+ }
23
+
24
+ class FavoriteSection extends React.Component<IFavoriteSectionProps, {}> {
25
+
26
+ onCarSelectFavorite = (url: string) => window.open(`/search/vehicle/${url}`, '_blank');
27
+
28
+ private renderFavorites = () => {
29
+ const { t, appStore: { language }, carsStore, imagesStore, PLACEHOLDER_IMAGE_SMALL_URL, LinkRouter,favoriteCars } = this.props;
30
+ return favoriteCars.map((car: any, key: any) => {
31
+ const carId = _get(car, 'id');
32
+ const mainImageId = _get(car, 'mainImageId');
33
+ const src = !!mainImageId && !!car.imagesCount
34
+ ? imagesStore.getSupportedImageFormat(carId, mainImageId, 'small')
35
+ : PLACEHOLDER_IMAGE_SMALL_URL;
36
+ const vehicleProps = {
37
+ ...car,
38
+ t,
39
+ language,
40
+ src,
41
+ linkTag: LinkRouter,
42
+ showSlider: false,
43
+ showOfferBtn: true,
44
+ showFavoriteStar: false,
45
+ priceSubMtl: !isMobileOnly ? t('vehicleProps:value.priceSub') : null,
46
+ stats: {
47
+ imagesCount: _get(car, 'imagesCount'),
48
+ statsData: carsStore.aggStatsData.get(car.id)
49
+ },
50
+ i18nPrefixForPriceRating: 'common:',
51
+ className: styles.wrapFavorites,
52
+ classButton: styles.favoriteBtn,
53
+ onDetailsClick: this.onCarSelectFavorite,
54
+ vehicleComponentName: 'favorite'
55
+ };
56
+
57
+ return (key === 0) && <VehicleSmallCard key={`favoriteCar${carId}`} {...vehicleProps} />;
58
+ });
59
+ };
60
+
61
+ render(): JSX.Element {
62
+ const { t, favoriteStore, LinkRouter } = this.props;
63
+
64
+ return (
65
+ <>
66
+ {favoriteStore.showList ? (
67
+ <DashboardSection
68
+ title={t('DashboardPage:favoriteTitle')}
69
+ link={
70
+ <LinkRouter to='/favourites'>
71
+ <Button className={styles.btnCarToFavorites} variant='outlined'>
72
+ {t('vehicleProps:title.toFavoritesCar')}
73
+ </Button>
74
+ </LinkRouter>}
75
+ >
76
+ {this.renderFavorites()}
77
+ </DashboardSection>
78
+ ) : false}
79
+ </>
80
+ );
81
+ }
82
+ }
83
+
84
+ export default FavoriteSection;
@@ -2,7 +2,7 @@
2
2
  @import '../../../../theme/mixins.styl'
3
3
 
4
4
  .container
5
- padding: 8px 8px 16px
5
+ padding: 8px 8px 0px
6
6
  border-top: 1px solid rgba(76,78,100,0.12);
7
7
 
8
8
  +media-tablet-landscape-up()
@@ -28,6 +28,10 @@
28
28
  top: 0;
29
29
  left: -16px;
30
30
 
31
+ .overallRate
32
+ border-top: 1px solid rgba(76,78,100,0.12)
33
+ padding-top: 15px
34
+
31
35
  .labelText
32
36
  color: $black50
33
37
  font-size: 14px
@@ -40,6 +44,7 @@
40
44
  padding-bottom: 8px
41
45
  grid-area: addresses
42
46
  display: grid
47
+ row-gap: 12px
43
48
 
44
49
  .orderPriceSection
45
50
  grid-area: orderPrice
@@ -88,4 +93,8 @@
88
93
  font-size: 14px
89
94
 
90
95
  .montlyUnit
91
- font-size: 8px
96
+ font-size: 8px
97
+
98
+ .priceValue
99
+ text-align: right
100
+ min-width 100px
@@ -5,7 +5,7 @@ import VehicleFormattedPrice from '../../../Vehicle/VehicleFormattedPrice/Vehicl
5
5
  import Button from '../../../_common/Button/Button';
6
6
  import classNames from 'classnames';
7
7
 
8
- import { TFunction } from '../../../../framework/types/types';
8
+ import { ITFunction } from '../../../../framework/types/types';
9
9
 
10
10
  interface IAdditionalOrderData {
11
11
  addressData: ({ value: string; label: string; })[];
@@ -14,7 +14,7 @@ interface IAdditionalOrderData {
14
14
  }
15
15
 
16
16
  interface IAdditionalOrderInfo {
17
- t: TFunction;
17
+ t: ITFunction;
18
18
  additionalOrderData: IAdditionalOrderData;
19
19
  redirectToUrl: (url: string) => void;
20
20
  buyingType: string;
@@ -29,8 +29,8 @@ const AdditionalOrderInfo = ({ t, additionalOrderData, redirectToUrl, buyingType
29
29
 
30
30
  const supportSectionClassnames = classNames(
31
31
  styles.customerSuport,
32
- {[styles.supportSectionBorder]: addressData.length > 0}
33
- )
32
+ { [styles.supportSectionBorder]: addressData.length > 0 }
33
+ );
34
34
 
35
35
  return (
36
36
  <div className={styles.container}>
@@ -55,7 +55,7 @@ const AdditionalOrderInfo = ({ t, additionalOrderData, redirectToUrl, buyingType
55
55
  return (
56
56
  <div key={label} className={styles.flexContainer}>
57
57
  <div className={styles.labelText}>{label}</div>
58
- <div className={styles.labelText}>{value}</div>
58
+ <div className={classNames(styles.labelText, styles.priceValue)}>{value}</div>
59
59
  </div>
60
60
  );
61
61
  }
@@ -1,11 +1,12 @@
1
1
  import React, { useRef, useEffect, useState } from 'react';
2
2
  import styles from './OrderStatusSection.styl';
3
3
  import OrderStatusCard from './OrderStatusCard';
4
- import Image from '../../../_common/Image/Image';
4
+ // import Image from '../../../_common/Image/Image';
5
5
  import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
6
+ import AdditionalOrderInfo from './AdditionalOrderInfo';
6
7
 
7
8
  // tslint:disable-next-line:interface-name
8
- interface TFunction {
9
+ interface ITFunction {
9
10
  <T = string>(key: string, options?: object): T;
10
11
  <T = string>(keys: string[], options?: object): T;
11
12
  }
@@ -20,11 +21,16 @@ interface IOrderStatusCar {
20
21
  paybackPeriod?: number;
21
22
  monthlyInstallment?: number;
22
23
  status?: string;
23
- t: TFunction;
24
+ t: ITFunction;
24
25
  request: string;
25
26
  registration: boolean;
26
27
  currentSalesPrice: number;
27
28
  onClick: () => void;
29
+ isFinishedOrder?: boolean;
30
+ additionalOrderInfoProps?: any;
31
+ wonStatus?: string;
32
+ transformedDeliveryDate?: string | null;
33
+ delivery?: boolean;
28
34
  }
29
35
 
30
36
  const OrderStatusCar = ({
@@ -41,7 +47,11 @@ const OrderStatusCar = ({
41
47
  request,
42
48
  registration,
43
49
  currentSalesPrice,
44
- onClick
50
+ onClick,
51
+ additionalOrderInfoProps,
52
+ wonStatus,
53
+ transformedDeliveryDate,
54
+ delivery
45
55
  }: IOrderStatusCar) => {
46
56
  const ref = useRef(null);
47
57
  const [activeStep, setActiveStep] = useState(0); // 0 - when we have no active steps
@@ -50,11 +60,16 @@ const OrderStatusCar = ({
50
60
  { icon: 'orderReceivedDashboard', selector: 'selector_status_order_received' },
51
61
  { icon: 'preparaionDashboard', selector: 'selector_status_preparation' },
52
62
  { icon: 'registrationDashboard', selector: 'selector_status_registration' },
53
- selfPickup ? { icon: 'pickupDashboard', selector: 'selector_status_pick_up' }
63
+ selfPickup || !delivery ? { icon: 'pickupDashboard', selector: 'selector_status_pick_up' }
54
64
  : { icon: 'deliveryDashboard', selector: 'selector_status_delivery' },
55
65
  { icon: 'handingOverDashboard', selector: 'selector_status_handing_over' }
56
66
  ];
57
67
 
68
+ const steps = cardItems.map((step) => {
69
+ const { selector } = step;
70
+ return selector;
71
+ })
72
+
58
73
  useEffect(
59
74
  () => {
60
75
  cardItems.map((step, index) => {
@@ -63,13 +78,12 @@ const OrderStatusCar = ({
63
78
  setActiveStep(index + 1);
64
79
  }
65
80
  });
66
- // if (!!ref && !!ref.current) { TODO: fix scroll for active element for mobile
67
- // ref.current.scrollBy({
68
- // top: 0,
69
- // left: 156 * activeStep,
70
- // behavior: 'smooth'
71
- // });
72
- // }
81
+ if (!!ref && !!ref.current && typeof ref.current.scrollBy === 'function') {
82
+ ref.current.scrollBy({
83
+ behavior: 'smooth',
84
+ left: 156 * steps.indexOf(status)
85
+ })
86
+ }
73
87
  },
74
88
  []
75
89
  );
@@ -90,38 +104,43 @@ const OrderStatusCar = ({
90
104
  <img data-testid='car-image' src={imageUrl}/>
91
105
  </div>
92
106
  <div className={styles.requestId}>{request}</div>
93
- <div className={styles.carPayment} >
94
- {t(`buyingType.${buyingType}`)},&nbsp;
95
- {buyingType !== 'buy' && `${t('paybackPeriod', { paybackPeriod })},`}&nbsp;
96
- {buyingType === 'buy' ?
97
- t('currentSalesPrice', { currentSalesPrice: getFormattedPrice(currentSalesPrice) })
98
- : t('monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f') })
107
+ <div className={styles.carPayment}>
108
+ {wonStatus === 'won' && !!transformedDeliveryDate ? transformedDeliveryDate
109
+ : <>
110
+ {t(`buyingType.${buyingType}`)},&nbsp;
111
+ {buyingType !== 'buy' && `${t('paybackPeriod', { paybackPeriod })},`}&nbsp;
112
+ {buyingType === 'buy' ?
113
+ t('currentSalesPrice', { currentSalesPrice: getFormattedPrice(currentSalesPrice) })
114
+ : t('monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f') })
115
+ }
116
+ </>
99
117
  }
100
118
  </div>
101
119
  </div>
102
120
  </div>
103
- <div className={styles.cardsSection}>
104
- {cardItems.map((card, index) => {
105
- const { icon, selector } = card;
121
+ {wonStatus === 'won' ? <AdditionalOrderInfo { ...additionalOrderInfoProps } />
122
+ : <div className={styles.cardsSection} ref={ref}>
123
+ {cardItems.map((card, index) => {
124
+ const { icon, selector } = card;
106
125
 
107
- const statusDescription = !registration && index === 2 ?
108
- t('orderStatus.independentRegistration') :
109
- t(`orderStatus.${selector}_desc`);
126
+ const statusDescription = !registration && index === 2 ?
127
+ t('orderStatus.independentRegistration') :
128
+ t(`orderStatus.${selector}_desc`);
110
129
 
111
- return (
112
- <OrderStatusCard
113
- cardRef={selector === status ? ref : null}
114
- title={t(`orderStatus.${selector}`)}
115
- description={statusDescription}
116
- icon={icon}
117
- key={index}
118
- isActive={index + 1 === activeStep}
119
- isDisabled={index + 1 > activeStep}
120
- isDone={index + 1 < activeStep}
121
- />
122
- );
123
- })}
124
- </div>
130
+ return (
131
+ <OrderStatusCard
132
+ title={t(`orderStatus.${selector}`)}
133
+ description={statusDescription}
134
+ icon={icon}
135
+ key={index}
136
+ isActive={index + 1 === activeStep}
137
+ isDisabled={index + 1 > activeStep}
138
+ isDone={index + 1 < activeStep}
139
+ />
140
+ );
141
+ })}
142
+ </div>
143
+ }
125
144
  </div>
126
145
  </div>
127
146
  );
@@ -13,7 +13,7 @@ interface IOrderStatusCard {
13
13
  isDone?: boolean;
14
14
  }
15
15
 
16
- const OrderStatusCard = ({ icon, title, description, isDisabled, cardRef, isActive, isDone }: IOrderStatusCard) => {
16
+ const OrderStatusCard = ({ icon, title, description, isDisabled, isActive, isDone }: IOrderStatusCard) => {
17
17
  const orderReceivedCardClasses = classnames(
18
18
  styles.orderReceivedCard,
19
19
  { [styles.cardInProgress]: isActive }
@@ -27,7 +27,7 @@ const OrderStatusCard = ({ icon, title, description, isDisabled, cardRef, isActi
27
27
 
28
28
  return (
29
29
  <div className={styles.orderReceivedCardContainer}>
30
- <div data-testid='orderStatusCard' className={orderReceivedCardClasses} ref={cardRef}>
30
+ <div data-testid='orderStatusCard' className={orderReceivedCardClasses}>
31
31
  <div className={styles.cardIcon}>
32
32
  <IconSVG disabled={isDisabled} customDimensions name={icon} width={87}/>
33
33
  </div>