@bytebrand/fe-ui-core 4.2.167 → 4.2.169

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.2.167",
3
+ "version": "4.2.169",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, FunctionComponent } from 'react';
1
+ import React, { useState, useEffect, useRef, FunctionComponent } from 'react';
2
2
  import _get from 'lodash/get';
3
3
  import { Hidden } from 'react-grid-system';
4
4
  import PriceContent from './partials/PriceContent';
@@ -10,6 +10,14 @@ import { vehicleProps } from '../../locales/data';
10
10
  import { IVehicleDetailedSidebarProps } from '../../framework/types/types';
11
11
  import DealerInfo from '../Alternative/DealerInfo';
12
12
 
13
+ declare global {
14
+ interface Window {
15
+ Trustpilot?: {
16
+ loadFromElement: (element: HTMLElement, autoload?: boolean) => void;
17
+ };
18
+ }
19
+ }
20
+
13
21
  const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> = (props) => {
14
22
  const {
15
23
  t = (phrase: string) => _get(vehicleProps(car), phrase.replace(':', '.'), phrase),
@@ -28,6 +36,7 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
28
36
  infoSections,
29
37
  onCurrentSalesPriceChange
30
38
  } = props;
39
+ const ref = useRef(null);
31
40
  const [offerBlockOpen, setOfferBlockOpen] = useState(false);
32
41
  const onAdjustRateClick = () => setOfferBlockOpen(!offerBlockOpen);
33
42
 
@@ -100,6 +109,12 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
100
109
  }
101
110
  ];
102
111
 
112
+ useEffect(() => {
113
+ if (window.Trustpilot) {
114
+ window.Trustpilot.loadFromElement(ref.current, true);
115
+ }
116
+ }, []);
117
+
103
118
  useEffect(() => {
104
119
  const getlocalStorageActiveTabCDP = localStorage.getItem('activeTabCDP');
105
120
  if (!getlocalStorageActiveTabCDP) return;
@@ -133,6 +148,24 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
133
148
  <Title {...titleProps} />
134
149
  <Price {...priceProps} />
135
150
  <Price {...priceProps} isSticky={true} />
151
+ <div
152
+ ref={ref}
153
+ data-locale='de-DE'
154
+ data-template-id='5419b6a8b0d04a076446a9ad'
155
+ data-businessunit-id='46edfd1c0000640005017f22'
156
+ data-style-height='42px'
157
+ data-style-width='100%'
158
+ data-theme='light'
159
+ data-style-alignment='center'
160
+ >
161
+ <a
162
+ href='https://de.trustpilot.com/review/www.auto.de'
163
+ target='_blank'
164
+ rel='noopener noreferrer'
165
+ >
166
+ Trustpilot
167
+ </a>
168
+ </div>
136
169
  {props.children}
137
170
  </div>
138
171
  <div>
@@ -151,8 +151,10 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
151
151
  const prevSlide = (activeSlide - 1 % imagesCount + imagesCount) % imagesCount;
152
152
  const nextSlide = (activeSlide + 1 % imagesCount + imagesCount) % imagesCount;
153
153
 
154
- return photos.map(({ imageUrlLarge, imageUrlSmall }: IImage, index: number) => {
154
+ return photos.map((item: IImage, index: number) => {
155
155
  const showImage = index === currentSlide || index === prevSlide || index === nextSlide || this.imagesCache[index] !== undefined;
156
+ const imageUrlSmall = _get(item, 'imageUrlSmall', null);
157
+ const imageUrlLarge = _get(item, 'imageUrlLarge', null);
156
158
 
157
159
  this.imagesCache[currentSlide] = imageUrlLarge;
158
160
  this.imagesCache[prevSlide] = imageUrlLarge;
@@ -19,7 +19,6 @@ const MIN_PRICE_DIFFERENCE = 500;
19
19
  const EUR = `\u20AC`;
20
20
 
21
21
  const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, financingConfig, activeTab }) => {
22
- console.log('financingConfig', financingConfig);
23
22
  const percentageOfFirstInstallment = activeTab === 0 ? financingConfig!.financing.percentageOfFirstInstallment : financingConfig!.leasing.percentageOfFirstInstallment;
24
23
  return (
25
24
  <div className={styles.topWrapper}>
@@ -30,7 +29,7 @@ const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPr
30
29
  {` ${EUR} ${t('slider.save')}`}
31
30
  </Badge>
32
31
  )}
33
- {(!isNil(percentageOfFirstInstallment) && activeTab !== 2) &&
32
+ {(!isNil(percentageOfFirstInstallment) && activeTab !== 2) &&
34
33
  <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`${percentageOfFirstInstallment}${percentageOfFirstInstallment > 0 ? '%' : EUR} ${t('slider.firstInstallment')}`}</Badge>}
35
34
  {historyPriceDifferencePerCent >= MIN_PERCENT && (
36
35
  <Badge type='red' className={styles.priceDifferencePerCent}>