@bytebrand/fe-ui-core 4.2.94 → 4.2.96
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/.gitlab-ci.yml +50 -22
- package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +8 -7
- package/jest.config.js +1 -0
- package/package.json +3 -2
- package/source/components/VehicleDetailedSidebar/partials/PriceContent.styl +1 -2
- package/source/components/VehicleDetailedSidebar/partials/PriceContent.tsx +1 -1
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +1 -0
- package/source/components/_common/Modal/CookieModal.tsx +13 -2
- package/source/components/_common/Modal/Modal.tsx +3 -2
- package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.tsx +7 -2
- package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -3
- package/source/framework/constants/common.ts +1 -0
- package/source/framework/utils/CommonUtils.ts +10 -1
package/.gitlab-ci.yml
CHANGED
|
@@ -1,34 +1,62 @@
|
|
|
1
1
|
stages:
|
|
2
|
-
|
|
2
|
+
- build
|
|
3
3
|
- test
|
|
4
|
+
- deploy
|
|
4
5
|
|
|
5
6
|
image: node:16.13.2-buster
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# - sed -i s/npm_token_value/${NPM_TOKEN_VALUE}/ ./.npmrc
|
|
12
|
-
# - cat .npmrc
|
|
13
|
-
# - yarn install
|
|
14
|
-
# - yarn build:lib
|
|
15
|
-
# # only:
|
|
16
|
-
# # - master
|
|
17
|
-
# tags:
|
|
18
|
-
# - 01gitlab-runner-gcloud
|
|
8
|
+
before_script:
|
|
9
|
+
- "[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh"
|
|
10
|
+
- source ~/.bashrc
|
|
11
|
+
- nvm use 16
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
stage: test
|
|
13
|
+
build:
|
|
14
|
+
stage: build
|
|
23
15
|
script:
|
|
24
|
-
- "[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh"
|
|
25
|
-
- source ~/.bashrc
|
|
26
|
-
- nvm use 16
|
|
27
16
|
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN_VALUE" >> .npmrc
|
|
28
17
|
- sed -i s/npm_token_value/${NPM_TOKEN_VALUE}/ ./.npmrc
|
|
29
|
-
- yarn
|
|
18
|
+
- yarn
|
|
19
|
+
cache:
|
|
20
|
+
paths:
|
|
21
|
+
- node_modules/
|
|
22
|
+
artifacts:
|
|
23
|
+
expire_in: 1 days
|
|
24
|
+
when: on_success
|
|
25
|
+
paths:
|
|
26
|
+
- node_modules/
|
|
27
|
+
|
|
28
|
+
test:
|
|
29
|
+
stage: test
|
|
30
|
+
script:
|
|
30
31
|
- yarn test:ci
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
cache:
|
|
33
|
+
paths:
|
|
34
|
+
- coverage/
|
|
35
|
+
artifacts:
|
|
36
|
+
paths:
|
|
37
|
+
- coverage/
|
|
38
|
+
when: always
|
|
39
|
+
reports:
|
|
40
|
+
junit:
|
|
41
|
+
- junit.xml
|
|
42
|
+
coverage_report:
|
|
43
|
+
coverage_format: cobertura
|
|
44
|
+
path: coverage/cobertura-coverage.xml
|
|
45
|
+
# only:
|
|
46
|
+
# - master
|
|
33
47
|
tags:
|
|
34
48
|
- 01gitlab-runner-gcloud
|
|
49
|
+
|
|
50
|
+
pages:
|
|
51
|
+
stage: deploy
|
|
52
|
+
dependencies:
|
|
53
|
+
- test
|
|
54
|
+
script:
|
|
55
|
+
- mkdir .public
|
|
56
|
+
- cp -r coverage/cobertura-coverage.xml .public/cobertura-coverage.xml
|
|
57
|
+
- mv .public public
|
|
58
|
+
artifacts:
|
|
59
|
+
paths:
|
|
60
|
+
- public
|
|
61
|
+
only:
|
|
62
|
+
- master
|
|
@@ -69,45 +69,46 @@ const mockProps = {
|
|
|
69
69
|
requestedCars,
|
|
70
70
|
getSupportedImageFormat: jest.fn(),
|
|
71
71
|
redirectToCar: jest.fn(),
|
|
72
|
-
|
|
72
|
+
// tslint:disable-next-line:object-shorthand-properties-first
|
|
73
|
+
initHotjar: () => {}
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
describe('RequestedCarsSection', () => {
|
|
76
77
|
it('renders correctly', () => {
|
|
77
|
-
const { container } = render(<RequestedCarsSection {...mockProps} />);
|
|
78
|
+
const { container } = render(<RequestedCarsSection {...mockProps as any} />);
|
|
78
79
|
expect(container).toBeInTheDocument();
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
it('should display correct car data', () => {
|
|
82
|
-
const { container } = render(<RequestedCarsSection {...mockProps} />);
|
|
83
|
+
const { container } = render(<RequestedCarsSection {...mockProps as any} />);
|
|
83
84
|
const requestedCars = mockProps.requestedCars;
|
|
84
85
|
requestedCars.forEach((element) => {
|
|
85
86
|
expect(container).toHaveTextContent(element.buyingType);
|
|
86
87
|
});
|
|
87
88
|
});
|
|
88
89
|
it('should display correct car make and model', () => {
|
|
89
|
-
const { getByText } = render(<RequestedCarsSection {...mockProps} />);
|
|
90
|
+
const { getByText } = render(<RequestedCarsSection {...mockProps as any} />);
|
|
90
91
|
const requestedCars = mockProps.requestedCars;
|
|
91
92
|
requestedCars.forEach((element) => {
|
|
92
93
|
expect(getByText(`${element.car.mainData.make} ${element.car.mainData.model}`)).toBeInTheDocument();
|
|
93
94
|
});
|
|
94
95
|
});
|
|
95
96
|
it('should display correct car subModel', () => {
|
|
96
|
-
const { getByText } = render(<RequestedCarsSection {...mockProps} />);
|
|
97
|
+
const { getByText } = render(<RequestedCarsSection {...mockProps as any} />);
|
|
97
98
|
const requestedCars = mockProps.requestedCars;
|
|
98
99
|
requestedCars.forEach((element) => {
|
|
99
100
|
expect(getByText(`${element.car.mainData.subModel}`)).toBeInTheDocument();
|
|
100
101
|
});
|
|
101
102
|
});
|
|
102
103
|
it('should display correct car request number', () => {
|
|
103
|
-
const { getByText } = render(<RequestedCarsSection {...mockProps} />);
|
|
104
|
+
const { getByText } = render(<RequestedCarsSection {...mockProps as any} />);
|
|
104
105
|
const requestedCars = mockProps.requestedCars;
|
|
105
106
|
requestedCars.forEach((element) => {
|
|
106
107
|
expect(getByText(`${element.request}`)).toBeInTheDocument();
|
|
107
108
|
});
|
|
108
109
|
});
|
|
109
110
|
it('calls redirectToCar with car ID on button click', () => {
|
|
110
|
-
const { getByTestId } = render(<RequestedCarsSection {...mockProps} />);
|
|
111
|
+
const { getByTestId } = render(<RequestedCarsSection {...mockProps as any} />);
|
|
111
112
|
const carWrapper = getByTestId(mockProps.requestedCars[0].car._id);
|
|
112
113
|
fireEvent.click(carWrapper);
|
|
113
114
|
expect(mockProps.redirectToCar).toHaveBeenCalledTimes(1);
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.96",
|
|
4
4
|
"description": "UI components for the auto.de project",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"module": "dist/common.js",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"babel-plugin-minify-dead-code-elimination": "^0.5.0",
|
|
90
90
|
"babel-plugin-transform-imports": "^2.0.0",
|
|
91
91
|
"css-loader": "^3.2.0",
|
|
92
|
+
"jest-junit": "^15.0.0",
|
|
92
93
|
"lodash": "^4.17.15",
|
|
93
94
|
"mobx": "4.6.0",
|
|
94
95
|
"mobx-react": "5.4.3",
|
|
@@ -116,7 +117,7 @@
|
|
|
116
117
|
"build:lib": "yarn clean && webpack --config ./webpack.config.js --progress",
|
|
117
118
|
"build:story": "build-storybook",
|
|
118
119
|
"test": "jest --watch",
|
|
119
|
-
"test:ci": "jest",
|
|
120
|
+
"test:ci": "jest --config ./jest.config.js --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
|
|
120
121
|
"test:coverage": "yarn run test -- --coverage --watchAll=false || exit 0"
|
|
121
122
|
},
|
|
122
123
|
"author": "Maks Okhmatenko",
|
|
@@ -94,7 +94,7 @@ const PriceContent: React.FunctionComponent<IPriceContentProps> = ({
|
|
|
94
94
|
</div>
|
|
95
95
|
) : null}
|
|
96
96
|
</span>
|
|
97
|
-
<div
|
|
97
|
+
<div>
|
|
98
98
|
<PriceRating {...priceRatingProps} />
|
|
99
99
|
<span className={styles.priceInfo}>
|
|
100
100
|
<span className={styles.priceInfoLabel} onClick={onAdjustRateClick}>
|
|
@@ -78,6 +78,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
componentDidUpdate(prevProps: IProps) {
|
|
81
|
+
console.log('VehicleDetailedSlider-works!');
|
|
81
82
|
if (prevProps.photos.length !== this.props.photos.length && this.props.photos.length === 0) {
|
|
82
83
|
this.setState(() => ({
|
|
83
84
|
largeLoaded: false,
|
|
@@ -3,7 +3,12 @@ import useModal from '../../../framework/hooks/useModal';
|
|
|
3
3
|
import { updateCookieList } from '../../../framework/utils/CommonUtils';
|
|
4
4
|
import Modal from './Modal';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
export interface ICookieModal {
|
|
8
|
+
handleSentryInit?: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const CookieModal = ({ handleSentryInit }: ICookieModal) => {
|
|
7
12
|
const { isVisible, toggleModal } = useModal();
|
|
8
13
|
const [modal, setModal] = useState('');
|
|
9
14
|
|
|
@@ -13,7 +18,7 @@ const CookieModal = () => {
|
|
|
13
18
|
if (!cookieConfig) {
|
|
14
19
|
setModal('PREVIEW_COOKIE_MODAL');
|
|
15
20
|
toggleModal();
|
|
16
|
-
} else setTimeout(() => { updateCookieList(); }, 3000);
|
|
21
|
+
} else setTimeout(() => { updateCookieList(handleSentryInit); }, 3000);
|
|
17
22
|
},
|
|
18
23
|
[]
|
|
19
24
|
);
|
|
@@ -30,6 +35,7 @@ const CookieModal = () => {
|
|
|
30
35
|
return isVisible
|
|
31
36
|
? <Modal
|
|
32
37
|
isVisible={isVisible}
|
|
38
|
+
handleSentryInit={handleSentryInit}
|
|
33
39
|
toggleModal={toggleModal}
|
|
34
40
|
name={modal}
|
|
35
41
|
modalProps={modalProps}
|
|
@@ -37,4 +43,9 @@ const CookieModal = () => {
|
|
|
37
43
|
: <></>;
|
|
38
44
|
};
|
|
39
45
|
|
|
46
|
+
|
|
47
|
+
CookieModal.defaultProps = {
|
|
48
|
+
handleSentryInit: () => {},
|
|
49
|
+
};
|
|
50
|
+
|
|
40
51
|
export default CookieModal;
|
|
@@ -6,11 +6,12 @@ import { BaseModalWrapper } from './Modal.styled';
|
|
|
6
6
|
interface IBasicModal {
|
|
7
7
|
isVisible: boolean;
|
|
8
8
|
toggleModal: () => void;
|
|
9
|
+
handleSentryInit?: () => void;
|
|
9
10
|
name: string;
|
|
10
11
|
modalProps?: any;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
const BasicModal = ({ isVisible, toggleModal, name, modalProps }: IBasicModal) => {
|
|
14
|
+
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit }: IBasicModal) => {
|
|
14
15
|
const { onClearModalState } = modalProps;
|
|
15
16
|
return (
|
|
16
17
|
<Modal open={isVisible} onClose={() => {
|
|
@@ -18,7 +19,7 @@ const BasicModal = ({ isVisible, toggleModal, name, modalProps }: IBasicModal) =
|
|
|
18
19
|
// onClearModalState();
|
|
19
20
|
}}>
|
|
20
21
|
<BaseModalWrapper>
|
|
21
|
-
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal })}
|
|
22
|
+
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit })}
|
|
22
23
|
</BaseModalWrapper>
|
|
23
24
|
</Modal>
|
|
24
25
|
);
|
|
@@ -11,7 +11,12 @@ import { updateCookieList } from '../../../../../framework/utils/CommonUtils';
|
|
|
11
11
|
|
|
12
12
|
import styles from './ManageCookieModal.styl';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
interface IManageCookieModal {
|
|
15
|
+
toggleModal: () => void;
|
|
16
|
+
handleSentryInit?: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModal) => {
|
|
15
20
|
const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(true);
|
|
16
21
|
const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(true);
|
|
17
22
|
const [analyticsSwitches, setAnalyticsSwitches] = useState({});
|
|
@@ -61,7 +66,7 @@ const ManageCookieModal = ({ toggleModal }) => {
|
|
|
61
66
|
analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
|
|
62
67
|
};
|
|
63
68
|
localStorage.setItem('cookieConfig', JSON.stringify(cookieConfig));
|
|
64
|
-
updateCookieList();
|
|
69
|
+
updateCookieList(handleSentryInit);
|
|
65
70
|
toggleModal();
|
|
66
71
|
};
|
|
67
72
|
|
|
@@ -2,19 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import IconSVG from '../../../IconSVG/IconSVG';
|
|
3
3
|
import Button from '../../../Button/Button';
|
|
4
4
|
import styles from './PreviewCookieModal.styl';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
5
|
import { updateCookieList } from '../../../../../framework/utils/CommonUtils';
|
|
7
6
|
|
|
8
7
|
interface IPreviewCookieModal {
|
|
9
8
|
toggleModal: () => void;
|
|
9
|
+
handleSentryInit?: () => void;
|
|
10
10
|
setModal: (value: string) => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const PreviewCookieModal = ({ toggleModal, setModal }: IPreviewCookieModal) => {
|
|
13
|
+
const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
|
|
14
14
|
const environment = window.location.origin;
|
|
15
15
|
const onAcceptAll = () => {
|
|
16
16
|
localStorage.setItem('cookieConfig', JSON.stringify({}));
|
|
17
|
-
updateCookieList();
|
|
17
|
+
updateCookieList(handleSentryInit);
|
|
18
18
|
toggleModal();
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -21,6 +21,7 @@ declare global {
|
|
|
21
21
|
grantCookieConsentClarity?: () => void;
|
|
22
22
|
grantCookieConsentMicrosoft?: () => void;
|
|
23
23
|
grantCookieConsentFacebook?: () => void;
|
|
24
|
+
grantCookieConsentSentry?: () => void;
|
|
24
25
|
grantCookieConsent?: (list: string[]) => void;
|
|
25
26
|
allowGoogle?: () => void;
|
|
26
27
|
}
|
|
@@ -545,12 +546,13 @@ export function setUtmParameters() {
|
|
|
545
546
|
document.cookie = `marketing=${JSON.stringify(marketing)};expires=${expiresDate};domain=.${domain};path=/`;
|
|
546
547
|
}
|
|
547
548
|
|
|
548
|
-
export const updateCookieList = () => {
|
|
549
|
+
export const updateCookieList = (handleSentryInit: () => void) => {
|
|
549
550
|
let cookieConsentList = Object.keys(GOOGLE_BUNDLE_COOKIES);
|
|
550
551
|
let isHomeGoogleGranted = true; // home page google cookie
|
|
551
552
|
let isMicrosoftGranted = true; // Microsoft _uetvid _uetsid
|
|
552
553
|
let isMicrosoftClarity = true; // Microsoft Clarity _clck _clsk
|
|
553
554
|
let isFacebookGranted = true; // Facebook Clarity _fbp _f
|
|
555
|
+
let isSentryGranted = true; // Sentry
|
|
554
556
|
let isHotjarGranted = true;
|
|
555
557
|
const cookieConfig = JSON.parse(localStorage.getItem('cookieConfig')) || {};
|
|
556
558
|
|
|
@@ -569,6 +571,7 @@ export const updateCookieList = () => {
|
|
|
569
571
|
else if (cookie === '_uetvid' || cookie === '_uetsid') isMicrosoftGranted = false;
|
|
570
572
|
else if (cookie === '_clck' || cookie === '_clsk') isMicrosoftClarity = false;
|
|
571
573
|
else if (cookie === '_fbp') isFacebookGranted = false;
|
|
574
|
+
else if (cookie === 'sentry') isSentryGranted = false;
|
|
572
575
|
});
|
|
573
576
|
});
|
|
574
577
|
|
|
@@ -600,6 +603,12 @@ export const updateCookieList = () => {
|
|
|
600
603
|
if (isHotjarGranted && typeof window.grantHotjarCookieConsent === 'function') {
|
|
601
604
|
window.grantHotjarCookieConsent();
|
|
602
605
|
}
|
|
606
|
+
|
|
607
|
+
// grant Sentry cookies
|
|
608
|
+
if (isSentryGranted) {
|
|
609
|
+
handleSentryInit();
|
|
610
|
+
}
|
|
611
|
+
|
|
603
612
|
};
|
|
604
613
|
|
|
605
614
|
// function returns decimal part of number with 2 digits
|