@bytebrand/fe-ui-core 4.8.112 → 4.8.113
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,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect,
|
|
1
|
+
import React, { useState, useEffect, 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';
|
|
@@ -104,31 +104,22 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
|
|
|
104
104
|
}
|
|
105
105
|
];
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// ADV-116: the default CDP tab is driven solely by `activeTabCDP` (set to Financing by the
|
|
108
|
+
// originating card, or to the exact tab when a payment type is clicked directly). No
|
|
109
|
+
// leasing-based default override.
|
|
109
110
|
useEffect(() => {
|
|
110
111
|
const getlocalStorageActiveTabCDP = localStorage.getItem('activeTabCDP');
|
|
111
|
-
if (getlocalStorageActiveTabCDP)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
localStorage.removeItem('activeTabCDP');
|
|
121
|
-
initialDefaultAppliedForPath.current = pathname;
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (
|
|
125
|
-
initialDefaultAppliedForPath.current !== pathname
|
|
126
|
-
&& _get(price, 'leasing.isActive', false)
|
|
127
|
-
) {
|
|
128
|
-
setActiveTab(null, 1);
|
|
129
|
-
initialDefaultAppliedForPath.current = pathname;
|
|
112
|
+
if (!getlocalStorageActiveTabCDP) return;
|
|
113
|
+
const activeTab = tabsTitles.findIndex(({ title }: { title: string }) => {
|
|
114
|
+
return title === getlocalStorageActiveTabCDP;
|
|
115
|
+
});
|
|
116
|
+
if (activeTab === -1) {
|
|
117
|
+
setActiveTab(null, 0);
|
|
118
|
+
} else {
|
|
119
|
+
setActiveTab(null, activeTab);
|
|
130
120
|
}
|
|
131
|
-
|
|
121
|
+
localStorage.removeItem('activeTabCDP');
|
|
122
|
+
}, [pathname, activeTab]); // tslint:disable-line:align
|
|
132
123
|
|
|
133
124
|
const priceProps = {
|
|
134
125
|
tabsTitles,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import _get from 'lodash/get';
|
|
5
4
|
import styles from './VehicleInfo.styl';
|
|
6
5
|
import PriceRating from '../../../PriceRating/PriceRating';
|
|
7
6
|
import { Visible, Hidden } from 'react-grid-system';
|
|
@@ -45,7 +44,6 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
45
44
|
location,
|
|
46
45
|
offer,
|
|
47
46
|
engineData,
|
|
48
|
-
leasing,
|
|
49
47
|
suppressConsumption
|
|
50
48
|
} = props as (typeof props & { suppressConsumption?: boolean });
|
|
51
49
|
const firstRegistrationDate = regDate && regDate !== 0 ? regDate : 'N/A';
|
|
@@ -168,12 +166,8 @@ const VehicleInfo: React.FC<IVehicleInfoProps> = (props) => {
|
|
|
168
166
|
),
|
|
169
167
|
...routeObj,
|
|
170
168
|
className: wrapClasses,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
_get(leasing, 'isActive', false)
|
|
174
|
-
? t('vehicleProps:title.leasing')
|
|
175
|
-
: t('vehicleProps:title.financing')
|
|
176
|
-
),
|
|
169
|
+
// ADV-116: opening a CDP from a card defaults to the Financing tab.
|
|
170
|
+
onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
|
|
177
171
|
href: url,
|
|
178
172
|
target,
|
|
179
173
|
rel
|
|
@@ -318,12 +318,8 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
318
318
|
target,
|
|
319
319
|
rel,
|
|
320
320
|
className: `${styles.redirectClassLink} ${styles.gridAreaTitle}`,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
_get(price, 'leasing.isActive', false)
|
|
324
|
-
? t('vehicleProps:title.leasing')
|
|
325
|
-
: t('vehicleProps:title.financing')
|
|
326
|
-
),
|
|
321
|
+
// ADV-116: opening a CDP from a card defaults to the Financing tab.
|
|
322
|
+
onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
|
|
327
323
|
href: url
|
|
328
324
|
})}
|
|
329
325
|
|
|
@@ -376,12 +372,8 @@ const VehicleSmallCard: FunctionComponent<IVehicleSmallCardProps> = (props) => {
|
|
|
376
372
|
target,
|
|
377
373
|
rel,
|
|
378
374
|
className: `${styles.redirectClassLink} ${styles.gridAreaImage}`,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
_get(price, 'leasing.isActive', false)
|
|
382
|
-
? t('vehicleProps:title.leasing')
|
|
383
|
-
: t('vehicleProps:title.financing')
|
|
384
|
-
),
|
|
375
|
+
// ADV-116: opening a CDP from a card defaults to the Financing tab.
|
|
376
|
+
onClick: () => localStorage.setItem('activeTabCDP', t('vehicleProps:title.financing')),
|
|
385
377
|
href: url
|
|
386
378
|
})}
|
|
387
379
|
<VehicleInfo {...vehicleInfoProps} />
|