homeflowjs 1.0.46 → 1.0.47

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.
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
3
3
 
4
4
  import InstantValuation from '../instant-valuation/index';
5
5
  import store from '../store';
6
- import initCookieConsent from '../cookie-consent/cookie-consent';
6
+ import { initCookieConsent } from '../cookie-consent';
7
7
  import notify from './notify';
8
8
  import antiCSRF from './anti-csrf';
9
9
  import recaptcha from './recaptcha';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Retrieves the cookie consent information from the document cookies.
3
+ *
4
+ * @returns {Object} An object containing the action and categories of the cookie consent.
5
+ * @returns {string|null} return.action - The action taken for cookie consent ("accept", "reject", or null if not available).
6
+ * @returns {string[]} return.categories - An array of categories for which consent is given. Possible values are:
7
+ * "unclassified", "performance", "functionality", "targeting", "marketing".
8
+ * If no categories are found, an empty array is returned.
9
+ */
10
+ const getCookieConsent = () => {
11
+ const cookieString = document.cookie.split('; ').find(row => row.startsWith('CookieScriptConsent='));
12
+ if (!cookieString) return { action: null, categories: [] };
13
+
14
+ const cookieValue = cookieString.replace('CookieScriptConsent=', '');
15
+ try {
16
+ const cookieObj = JSON.parse(decodeURIComponent(cookieValue));
17
+ return {
18
+ action: cookieObj.action || null,
19
+ categories: cookieObj.categories ? JSON.parse(cookieObj.categories) : [],
20
+ };
21
+ } catch (e) {
22
+ console.error('Error parsing cookie:', e);
23
+ return { action: null, categories: [] };
24
+ }
25
+ }
26
+
27
+ export default getCookieConsent;
@@ -0,0 +1,7 @@
1
+ import initCookieConsent from './cookie-consent';
2
+ import getCookieConsent from './get-cookie-consent';
3
+
4
+ export {
5
+ initCookieConsent,
6
+ getCookieConsent,
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "sideEffects": [
5
5
  "modal/**/*",
6
6
  "user/default-profile/**/*",