@bytebrand/fe-ui-core 4.8.110 → 4.8.111

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.8.110",
3
+ "version": "4.8.111",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -38,6 +38,7 @@ interface IVehicleSmallCardProps {
38
38
  isReferenceSearch?: boolean;
39
39
  dashboardButtonText?: string;
40
40
  showNewLabel?: boolean;
41
+ disableDownPaymentLocalStorage?: boolean;
41
42
  CircularProgressbar?: any;
42
43
  slider?: IVehicleSliderProps | IVehicleSliderForSRLProps;
43
44
  stats?: IStatsWrapperProps;
@@ -108,6 +109,7 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
108
109
  price,
109
110
  seoText,
110
111
  showNewLabel,
112
+ disableDownPaymentLocalStorage,
111
113
  linkTag = 'a',
112
114
  language,
113
115
  className,
@@ -180,7 +182,8 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
180
182
  isReferenceSearch,
181
183
  isAlternative,
182
184
  typeAlternative,
183
- showDownPayment: !!(offer as any)?.showDownPayment
185
+ showDownPayment: !!(offer as any)?.showDownPayment,
186
+ disableDownPaymentLocalStorage,
184
187
  };
185
188
 
186
189
  const favoriteProps = {
@@ -261,6 +264,7 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
261
264
  price,
262
265
  showNewLabel,
263
266
  showDownPayment: !!(offer as any)?.showDownPayment,
267
+ disableDownPaymentLocalStorage,
264
268
  ...stats
265
269
  };
266
270
 
@@ -34,6 +34,7 @@ export interface IStatsWrapperProps {
34
34
  imagesCount?: number;
35
35
  showNewLabel?: boolean;
36
36
  showDownPayment?: boolean;
37
+ disableDownPaymentLocalStorage?: boolean;
37
38
  onFavoriteClick?: (event: any) => void;
38
39
  getCarImagesData?: (carId: string, force?: boolean, includeAll?: boolean, type?: any, typeAlternative?: string) => Promise<any>;
39
40
  [key: string]: any;
@@ -52,6 +53,7 @@ const withStats = (WrappedComponent: any) => ({
52
53
  classWrapPrice = '',
53
54
  showNewLabel = false,
54
55
  showDownPayment = false,
56
+ disableDownPaymentLocalStorage = false,
55
57
  statsSize = 'xs',
56
58
  price: { historyPriceDifference = 0, historyPriceDifferencePerCent = 0 },
57
59
  ...props
@@ -83,7 +85,10 @@ const withStats = (WrappedComponent: any) => ({
83
85
  setShowByLocalStorage(fin === 0 || lea === 0);
84
86
  }, []);
85
87
 
86
- const showByBackend = showDownPayment && (lsFinancingFirst === undefined || lsFinancingFirst === null);
88
+ const showByBackend = disableDownPaymentLocalStorage
89
+ ? !!showDownPayment
90
+ : showDownPayment && (lsFinancingFirst === undefined || lsFinancingFirst === null);
91
+ const effectiveShowByLocalStorage = disableDownPaymentLocalStorage ? false : showByLocalStorage;
87
92
 
88
93
  const onHandleSlideChange = (activeSlide: number) => {
89
94
  setActiveSlide(activeSlide);
@@ -171,13 +176,13 @@ const withStats = (WrappedComponent: any) => ({
171
176
 
172
177
  const allFourActive = showNewLabel
173
178
  && !!historyPriceDifference && historyPriceDifference >= MIN_PRICE_DIFFERENCE
174
- && (showByLocalStorage || showByBackend)
179
+ && (effectiveShowByLocalStorage || showByBackend)
175
180
  && !!historyPriceDifferencePerCent && historyPriceDifferencePerCent >= MIN_PERCENT;
176
181
 
177
182
  const activeBadgesCount = [
178
183
  showNewLabel,
179
184
  !!historyPriceDifference && historyPriceDifference >= MIN_PRICE_DIFFERENCE,
180
- showByLocalStorage || showByBackend,
185
+ effectiveShowByLocalStorage || showByBackend,
181
186
  !!historyPriceDifferencePerCent && historyPriceDifferencePerCent >= MIN_PERCENT
182
187
  ].filter(Boolean).length;
183
188
 
@@ -191,7 +196,7 @@ const withStats = (WrappedComponent: any) => ({
191
196
  {` ${EUR}`}
192
197
  </Badge>
193
198
  )}
194
- {(showByLocalStorage || showByBackend) && (
199
+ {(effectiveShowByLocalStorage || showByBackend) && (
195
200
  <Badge type='lightBlue' className={styles.badgeItem}>
196
201
  {isWideScreen && activeBadgesCount >= 3 ? downPaymentShortText : downPaymentText}
197
202
  </Badge>