@bytebrand/fe-ui-core 4.2.167 → 4.2.168

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.168",
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>