Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-8650: Switch react and share to use hds cookie banner #826

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions assets/js/reactAndShareSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
'use strict';

var loadReactAndShare = function () {
// @todo UHF-8650: EU Cookie Compliance module will be removed.
// @todo UHF-8650: Convert the following code to support HDS cookie banner.
if (Drupal.eu_cookie_compliance.hasAgreed('statistics')) {
if (window && window.hds.cookieConsent && window.hds.cookieConsent.getConsentStatus(['statistics'])) {
window.rnsData = {
apiKey: drupalSettings.reactAndShareApiKey,
disableFa: true,
Expand Down Expand Up @@ -32,11 +30,9 @@
loadReactAndShare = function () {};
};

// Run after choosing cookie settings.
$(document).on('eu_cookie_compliance.changeStatus', loadReactAndShare);

// Run after page is ready.
$(document).ready(function () {
if (window.hds.cookieConsent) {
loadReactAndShare();
});
} else {
$(document).on('hds_cookieConsent_ready', loadReactAndShare);
}
})(jQuery, Drupal);