From 8cd7d636ffeb4aa69a34bf0257524ed55f98d163 Mon Sep 17 00:00:00 2001 From: Alex Gibson Date: Thu, 21 Dec 2023 14:30:37 +0000 Subject: [PATCH] Data consent updates and privacy improvements (Fixes #14213) --- bedrock/base/templates/base-protocol.html | 26 +- .../templates/includes/affiliate-banner.html | 25 -- .../includes/banners/consent-banner.html | 25 ++ .../templates/includes/google-analytics.html | 4 +- .../includes/protocol/footer/footer.html | 5 +- bedrock/mozorg/nonlocale_urls.py | 1 + bedrock/mozorg/templates/mozorg/gpc.json | 4 + bedrock/mozorg/templates/mozorg/robots.txt | 1 + bedrock/mozorg/templatetags/misc.py | 10 + bedrock/mozorg/tests/test_helper_misc.py | 44 +++ bedrock/mozorg/views.py | 7 + .../templates/privacy/cookie-settings.html | 196 ++++++++++++ .../templates/privacy/includes/macros.html | 19 ++ bedrock/privacy/urls.py | 1 + .../products/templates/products/vpn/base.html | 6 +- .../products/vpn/landing-refresh.html | 3 - .../templates/products/vpn/landing.html | 4 - .../products/vpn/pricing-refresh.html | 4 - .../templates/products/vpn/pricing.html | 4 - bedrock/settings/base.py | 40 ++- docs/attribution/0007-consent-management.rst | 62 ++++ l10n/en/affiliate.ftl | 16 - l10n/en/banners/consent-banner.ftl | 2 +- media/css/privacy/cookie-settings-form.scss | 149 +++++++++ media/css/products/shared/affiliate.scss | 60 ---- media/css/protocol/common-old-ie.scss | 3 + media/css/protocol/protocol-firefox.scss | 3 + media/css/protocol/protocol-mozilla.scss | 4 +- .../img/privacy/cookie-settings/arrows-bg.png | Bin 0 -> 49351 bytes .../banners/firefox-app-store-banner-init.js | 26 -- .../banners/firefox-app-store-banner.es6.js | 19 ++ media/js/base/banners/mozilla-banner.es6.js | 140 +++++++++ media/js/base/banners/mozilla-banner.js | 119 -------- media/js/base/consent/allow-list.es6.js | 9 + media/js/base/consent/init.es6.js | 170 +++++++++++ .../privacy-helpers.js} | 7 + media/js/base/consent/utils.es6.js | 209 +++++++++++++ media/js/base/experiment-utils.es6.js | 18 +- media/js/base/fxa-bundle-init.es6.js | 17 +- media/js/base/fxa-bundle.es6.js | 71 +++++ media/js/base/fxa-form-consent.es6.js | 51 ++++ media/js/base/fxa-form-init.es6.js | 4 +- media/js/base/fxa-product-button-init.es6.js | 30 +- media/js/base/fxa-product-button.es6.js | 2 +- media/js/base/gtm-snippet.js | 24 -- .../gtm-snippet-init.es6.js} | 6 +- media/js/base/gtm/gtm-snippet.es6.js | 87 ++++++ .../js/base/gtm/ie/gtm-snippet-ie-init.es6.js | 66 ++++ media/js/base/sentry.es6.js | 48 +-- media/js/base/site-ie.js | 16 + media/js/base/stub-attribution-init-ie.js | 22 -- media/js/base/stub-attribution/consent.es6.js | 74 +++++ media/js/base/stub-attribution/init.es6.js | 9 + .../stub-attribution.js | 4 - .../firefox/new/common/thanks-direct.es6.js | 6 +- media/js/glean/init.es6.js | 65 +--- media/js/glean/utils.es6.js | 97 +++++- media/js/ie/gtm-snippet.js | 89 ------ media/js/mozorg/account.es6.js | 21 -- ...r-banner-init.js => monitor-banner.es6.js} | 12 +- .../privacy/cookie-settings-form-init.es6.js | 9 + media/js/privacy/cookie-settings-form.es6.js | 121 ++++++++ .../shared/affiliate-attribution.es6.js | 58 ---- .../products/shared/affiliate-consent.es6.js | 74 +++++ .../js/products/shared/affiliate-init.es6.js | 148 +-------- media/js/products/shared/stripe.es6.js | 21 ++ media/static-bundles.json | 75 +++-- package-lock.json | 9 + package.json | 1 + tests/unit/spec/base/consent/consent-utils.js | 286 ++++++++++++++++++ tests/unit/spec/base/experiment-utils.js | 29 ++ tests/unit/spec/base/fxa-bundle.js | 112 +++++++ tests/unit/spec/base/fxa-form-consent.js | 113 +++++++ tests/unit/spec/base/fxa-product-button.js | 6 +- tests/unit/spec/base/gtm/gtm-snippet.js | 123 ++++++++ tests/unit/spec/base/mozilla-banner.js | 99 ++++-- .../stub-attribution-consent.js | 144 +++++++++ .../stub-attribution.js | 10 - tests/unit/spec/glean/utils.js | 103 ++++++- tests/unit/spec/privacy/cookie-settings.js | 193 ++++++++++++ .../products/shared/affiliate-attribution.js | 189 +----------- .../spec/products/shared/affiliate-consent.js | 136 +++++++++ webpack.test.config.js | 4 +- 83 files changed, 3310 insertions(+), 1019 deletions(-) delete mode 100644 bedrock/base/templates/includes/affiliate-banner.html create mode 100644 bedrock/base/templates/includes/banners/consent-banner.html create mode 100644 bedrock/mozorg/templates/mozorg/gpc.json create mode 100644 bedrock/privacy/templates/privacy/cookie-settings.html create mode 100644 bedrock/privacy/templates/privacy/includes/macros.html create mode 100644 docs/attribution/0007-consent-management.rst delete mode 100644 l10n/en/affiliate.ftl create mode 100644 media/css/privacy/cookie-settings-form.scss delete mode 100644 media/css/products/shared/affiliate.scss create mode 100644 media/img/privacy/cookie-settings/arrows-bg.png delete mode 100644 media/js/base/banners/firefox-app-store-banner-init.js create mode 100644 media/js/base/banners/firefox-app-store-banner.es6.js create mode 100644 media/js/base/banners/mozilla-banner.es6.js delete mode 100644 media/js/base/banners/mozilla-banner.js create mode 100644 media/js/base/consent/allow-list.es6.js create mode 100644 media/js/base/consent/init.es6.js rename media/js/base/{dnt-helper.js => consent/privacy-helpers.js} (66%) create mode 100644 media/js/base/consent/utils.es6.js create mode 100644 media/js/base/fxa-bundle.es6.js create mode 100644 media/js/base/fxa-form-consent.es6.js delete mode 100644 media/js/base/gtm-snippet.js rename media/js/base/{stub-attribution-init.js => gtm/gtm-snippet-init.es6.js} (73%) create mode 100644 media/js/base/gtm/gtm-snippet.es6.js create mode 100644 media/js/base/gtm/ie/gtm-snippet-ie-init.es6.js create mode 100644 media/js/base/site-ie.js delete mode 100644 media/js/base/stub-attribution-init-ie.js create mode 100644 media/js/base/stub-attribution/consent.es6.js create mode 100644 media/js/base/stub-attribution/init.es6.js rename media/js/base/{ => stub-attribution}/stub-attribution.js (99%) delete mode 100644 media/js/ie/gtm-snippet.js delete mode 100644 media/js/mozorg/account.es6.js rename media/js/mozorg/home/{monitor-banner-init.js => monitor-banner.es6.js} (57%) create mode 100644 media/js/privacy/cookie-settings-form-init.es6.js create mode 100644 media/js/privacy/cookie-settings-form.es6.js create mode 100644 media/js/products/shared/affiliate-consent.es6.js create mode 100644 media/js/products/shared/stripe.es6.js create mode 100644 tests/unit/spec/base/consent/consent-utils.js create mode 100644 tests/unit/spec/base/fxa-bundle.js create mode 100644 tests/unit/spec/base/fxa-form-consent.js create mode 100644 tests/unit/spec/base/gtm/gtm-snippet.js create mode 100644 tests/unit/spec/base/stub-attribution/stub-attribution-consent.js rename tests/unit/spec/base/{ => stub-attribution}/stub-attribution.js (99%) create mode 100644 tests/unit/spec/privacy/cookie-settings.js create mode 100644 tests/unit/spec/products/shared/affiliate-consent.js diff --git a/bedrock/base/templates/base-protocol.html b/bedrock/base/templates/base-protocol.html index 6e852740f5a..3fce01408ae 100644 --- a/bedrock/base/templates/base-protocol.html +++ b/bedrock/base/templates/base-protocol.html @@ -6,7 +6,7 @@ {# Note the "windows" class, without javascript platform-specific assets default to windows #} - + {# Note: Must be within first 512 bytes of page #} @@ -16,6 +16,10 @@ {% block experiments %}{% endblock %} + + @@ -92,6 +96,10 @@ data-global-previous="{{ ftl('ui-previous') }}" {% block string_data %}{% endblock %}> + {% block consent_banner %} + {% include 'includes/banners/consent-banner.html' %} + {% endblock %} + {% block site_header %} {% include 'includes/protocol/navigation/navigation.html' %} {% endblock %} @@ -125,18 +133,18 @@ {{ js_bundle('fxa') }} {{ js_bundle('data') }} + + {% endblock %} {# Bug 1279291 #} {% block stub_attribution %} {% if settings.STUB_ATTRIBUTION_RATE %} - + {{ js_bundle('stub-attribution') }} - - {% endif %} {% endblock %} @@ -151,5 +159,11 @@ {% block third_party_js %}{% endblock %} + + {% block consent_banner_js %} + + {{ js_bundle('consent-banner') }} + + {% endblock %} diff --git a/bedrock/base/templates/includes/affiliate-banner.html b/bedrock/base/templates/includes/affiliate-banner.html deleted file mode 100644 index a46e2fec57b..00000000000 --- a/bedrock/base/templates/includes/affiliate-banner.html +++ /dev/null @@ -1,25 +0,0 @@ -{# - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at https://mozilla.org/MPL/2.0/. -#} - - diff --git a/bedrock/base/templates/includes/banners/consent-banner.html b/bedrock/base/templates/includes/banners/consent-banner.html new file mode 100644 index 00000000000..45b5517009d --- /dev/null +++ b/bedrock/base/templates/includes/banners/consent-banner.html @@ -0,0 +1,25 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. +#} + + diff --git a/bedrock/base/templates/includes/google-analytics.html b/bedrock/base/templates/includes/google-analytics.html index 73ea8d65a9a..47e33913b8b 100644 --- a/bedrock/base/templates/includes/google-analytics.html +++ b/bedrock/base/templates/includes/google-analytics.html @@ -20,8 +20,8 @@ {{ js_bundle('gtm-snippet') }} - {% endif %} diff --git a/bedrock/base/templates/includes/protocol/footer/footer.html b/bedrock/base/templates/includes/protocol/footer/footer.html index 825f3fa3919..f5f13108d6a 100644 --- a/bedrock/base/templates/includes/protocol/footer/footer.html +++ b/bedrock/base/templates/includes/protocol/footer/footer.html @@ -96,7 +96,10 @@