@adobe/helix-rum-enhancer 1.18.0 → 1.18.1
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/index.js +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.18.1](https://github.com/adobe/helix-rum-enhancer/compare/v1.18.0...v1.18.1) (2024-05-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* avoid adding the mutation observer if cookie is present ([b93e598](https://github.com/adobe/helix-rum-enhancer/commit/b93e598cfc9de55dfdc4f6b47ca7f5f74b27bf62))
|
|
7
|
+
|
|
1
8
|
# [1.18.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.17.1...v1.18.0) (2024-05-24)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -204,29 +204,29 @@ if ([770, 1136].includes(Array.from(window.origin).map((a) => a.charCodeAt(0)).r
|
|
|
204
204
|
|
|
205
205
|
if (cmpCookie) {
|
|
206
206
|
sampleRUM('consent', { source: 'onetrust', target: 'hidden' });
|
|
207
|
-
}
|
|
207
|
+
} else {
|
|
208
|
+
let consentMutationObserver;
|
|
209
|
+
const trackShowConsent = () => {
|
|
210
|
+
if (document.querySelector('body > div#onetrust-consent-sdk')) {
|
|
211
|
+
sampleRUM('consent', { source: 'onetrust', target: 'show' });
|
|
212
|
+
if (consentMutationObserver) {
|
|
213
|
+
consentMutationObserver.disconnect();
|
|
214
|
+
}
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
return false;
|
|
218
|
+
};
|
|
208
219
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
sampleRUM('consent', { source: 'onetrust', target: 'show' });
|
|
220
|
+
if (!trackShowConsent()) {
|
|
221
|
+
// eslint-disable-next-line max-len
|
|
222
|
+
consentMutationObserver = window.MutationObserver ? new MutationObserver(trackShowConsent) : null;
|
|
213
223
|
if (consentMutationObserver) {
|
|
214
|
-
consentMutationObserver.
|
|
224
|
+
consentMutationObserver.observe(
|
|
225
|
+
document.body,
|
|
226
|
+
// eslint-disable-next-line object-curly-newline
|
|
227
|
+
{ attributes: false, childList: true, subtree: false },
|
|
228
|
+
);
|
|
215
229
|
}
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
return false;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
if (!trackShowConsent()) {
|
|
222
|
-
// eslint-disable-next-line max-len
|
|
223
|
-
consentMutationObserver = window.MutationObserver ? new MutationObserver(trackShowConsent) : null;
|
|
224
|
-
if (consentMutationObserver) {
|
|
225
|
-
consentMutationObserver.observe(
|
|
226
|
-
document.body,
|
|
227
|
-
// eslint-disable-next-line object-curly-newline
|
|
228
|
-
{ attributes: false, childList: true, subtree: false },
|
|
229
|
-
);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|