@bytebrand/fe-ui-core 4.1.67 → 4.1.69

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/common.ts CHANGED
@@ -111,6 +111,7 @@ export { default as StarButton } from './source/components/_common/StarButton/St
111
111
  export { default as TabPanel } from './source/components/_common/Tabs/TabPanel';
112
112
 
113
113
  export { default as MaterialDatePicker } from './source/components/_common/MaterialDatePicker/MaterialDatePicker';
114
+ export { default as CookieModal } from './source/components/_common/Modal/CookieModal';
114
115
 
115
116
  // common material
116
117
  import { StyledComponent } from './source/framework/utils/StyledComponent';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.1.67",
3
+ "version": "4.1.69",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -0,0 +1,37 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import useModal from '../../../framework/hooks/useModal';
3
+ import { updateCookieList } from '../../../framework/utils/CommonUtils';
4
+ import Modal from './Modal';
5
+
6
+ const CookieModal = () => {
7
+ const { isVisible, toggleModal } = useModal();
8
+ const [modal, setModal] = useState('');
9
+
10
+ useEffect(() => {
11
+ const cookieConfig = localStorage.getItem('cookieConfig');
12
+ if (!cookieConfig) {
13
+ setModal('PREVIEW_COOKIE_MODAL');
14
+ toggleModal();
15
+ } else setTimeout(() => { updateCookieList(); }, 3000);
16
+ }, []);
17
+
18
+ const onClearModalState = () => {
19
+ setModal('');
20
+ };
21
+
22
+ const modalProps = {
23
+ onClearModalState,
24
+ setModal
25
+ };
26
+
27
+ return isVisible
28
+ ? <Modal
29
+ isVisible={isVisible}
30
+ toggleModal={toggleModal}
31
+ name={modal}
32
+ modalProps={modalProps}
33
+ />
34
+ : <></>;
35
+ };
36
+
37
+ export default CookieModal;