@bytebrand/fe-ui-core 4.2.166 → 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.166",
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>
@@ -27,11 +27,13 @@ interface IProps {
27
27
  statsData: any;
28
28
  isFavorite: boolean;
29
29
  showNewLabel: boolean;
30
+ activeTab:number;
30
31
  make: string;
31
32
  model: string;
32
33
  subModel: string;
33
34
  powerKW: number;
34
35
  powerPS: number;
36
+ financingConfig:any;
35
37
  showModal?: (id: string, props?: any) => void;
36
38
  hideModal: (id: string) => void;
37
39
  onCarFavorite: (event: MouseEvent<HTMLElement>) => void;
@@ -238,6 +240,8 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
238
240
  subModel,
239
241
  powerKW,
240
242
  powerPS,
243
+ activeTab,
244
+ financingConfig,
241
245
  onCarFavorite
242
246
  } = this.props;
243
247
  const { activeSlide } = this.state;
@@ -259,9 +263,11 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
259
263
 
260
264
  const priceProps = {
261
265
  t,
266
+ financingConfig,
262
267
  showNewLabel,
263
268
  historyPriceDifference: price ? price.historyPriceDifference : 0,
264
- historyPriceDifferencePerCent: price ? price.historyPriceDifferencePerCent : 0
269
+ historyPriceDifferencePerCent: price ? price.historyPriceDifferencePerCent : 0,
270
+ activeTab
265
271
  };
266
272
 
267
273
  const statsProps = {
@@ -45,3 +45,7 @@
45
45
  .new
46
46
  @extend .priceDifference
47
47
  margin-right: 12px
48
+
49
+ .percentageOfFirstInstallment
50
+ @extend .priceDifference
51
+ margin-left: 12px
@@ -3,19 +3,24 @@ import FormattedNumber from '../../FormattedNumber/FormattedNumber';
3
3
  import Badge from '../../_common/Badge/Badge';
4
4
 
5
5
  import styles from './PriceData.styl';
6
+ import { isNil } from 'lodash';
6
7
 
7
8
  interface IProps {
8
9
  t: (phrase: string, config?: any) => string;
9
10
  showNewLabel: boolean;
10
11
  historyPriceDifference: number;
11
12
  historyPriceDifferencePerCent: number;
13
+ financingConfig?:any;
14
+ activeTab?:number;
12
15
  }
13
16
 
14
17
  const MIN_PERCENT = 5;
15
18
  const MIN_PRICE_DIFFERENCE = 500;
16
19
  const EUR = `\u20AC`;
17
20
 
18
- const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent }) => {
21
+ const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPriceDifference, historyPriceDifferencePerCent, financingConfig, activeTab }) => {
22
+ console.log('financingConfig', financingConfig);
23
+ const percentageOfFirstInstallment = activeTab === 0 ? financingConfig!.financing.percentageOfFirstInstallment : financingConfig!.leasing.percentageOfFirstInstallment;
19
24
  return (
20
25
  <div className={styles.topWrapper}>
21
26
  {showNewLabel && <Badge type='blue' className={styles.new}>{t('slider.new')}</Badge>}
@@ -25,6 +30,8 @@ const PriceData: React.FunctionComponent<IProps> = ({ t, showNewLabel, historyPr
25
30
  {` ${EUR} ${t('slider.save')}`}
26
31
  </Badge>
27
32
  )}
33
+ {(!isNil(percentageOfFirstInstallment) && activeTab !== 2) &&
34
+ <Badge type='lightBlue' className={styles.percentageOfFirstInstallment}>{`${percentageOfFirstInstallment}${percentageOfFirstInstallment > 0 ? '%' : EUR} ${t('slider.firstInstallment')}`}</Badge>}
28
35
  {historyPriceDifferencePerCent >= MIN_PERCENT && (
29
36
  <Badge type='red' className={styles.priceDifferencePerCent}>
30
37
  -{historyPriceDifferencePerCent}%
@@ -35,6 +35,9 @@ $badge-border-width = 1px
35
35
  .blue
36
36
  background-color: $primary
37
37
  color: white
38
+ .lightBlue
39
+ background-color: #26C6F9
40
+ color: white
38
41
 
39
42
  .red
40
43
  color: #fff;
@@ -3,7 +3,7 @@ import classnames from 'classnames';
3
3
 
4
4
  import styles from './Badge.styl';
5
5
 
6
- export type TBadgeType = 'white' | 'gray' | 'green' | 'blue' | 'red';
6
+ export type TBadgeType = 'white' | 'gray' | 'green' | 'blue' | 'red' | 'lightBlue';
7
7
 
8
8
  export interface IBadgeProps {
9
9
  children: any;