@comet/site-react 8.20.1 → 8.20.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOneTrustCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useOneTrustCookieApi.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"useOneTrustCookieApi.d.ts","sourceRoot":"","sources":["../../src/cookies/useOneTrustCookieApi.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAwBxD,eAAO,MAAM,oBAAoB,EAAE,aA8ClC,CAAC"}
|
|
@@ -7,17 +7,14 @@ const useOneTrustCookieApi = () => {
|
|
|
7
7
|
const [consentedCookies, setConsentedCookies] = useState([]);
|
|
8
8
|
const [initialized, setInitialized] = useState(false);
|
|
9
9
|
useEffect(() => {
|
|
10
|
-
const startListeningForConsentChanges = (
|
|
10
|
+
const startListeningForConsentChanges = (window2) => {
|
|
11
|
+
const oneTrust = window2.OneTrust;
|
|
11
12
|
const initialCookieConsent = [];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
initialCookieConsent.push(targetGroup.OptanonGroupId);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
13
|
+
if (window2.OnetrustActiveGroups) {
|
|
14
|
+
initialCookieConsent.push(
|
|
15
|
+
...window2.OnetrustActiveGroups.split(",").map((groupId) => groupId.trim()).filter(Boolean)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
21
18
|
setConsentedCookies(initialCookieConsent);
|
|
22
19
|
oneTrust.OnConsentChanged((event) => {
|
|
23
20
|
setConsentedCookies(event.detail);
|
|
@@ -27,7 +24,7 @@ const useOneTrustCookieApi = () => {
|
|
|
27
24
|
if (isWindowWithOneTrust(window)) {
|
|
28
25
|
setInitialized(true);
|
|
29
26
|
clearInterval(tryToAccessOneTrustInterval);
|
|
30
|
-
startListeningForConsentChanges(window
|
|
27
|
+
startListeningForConsentChanges(window);
|
|
31
28
|
}
|
|
32
29
|
}, 200);
|
|
33
30
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/site-react",
|
|
3
|
-
"version": "8.20.
|
|
3
|
+
"version": "8.20.3",
|
|
4
4
|
"description": "Comet Site React package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"vite-plugin-dts": "^4.5.4",
|
|
53
53
|
"vitest": "^4.0.16",
|
|
54
54
|
"webpack": "^5.102.1",
|
|
55
|
-
"@comet/cli": "8.20.
|
|
56
|
-
"@comet/eslint-config": "8.20.
|
|
55
|
+
"@comet/cli": "8.20.3",
|
|
56
|
+
"@comet/eslint-config": "8.20.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": "^18.0.0"
|