Skip to content

Commit 6eb1a96

Browse files
committed
Add UK influencer campaign page (Fixes mozilla#15841)
1 parent b3110e2 commit 6eb1a96

File tree

8 files changed

+315
-5
lines changed

8 files changed

+315
-5
lines changed

bedrock/base/templates/base-protocol.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
<!--<![endif]-->
151151

152152
<!--[if IE 9]>
153-
{# IE9 has its own lib JS bundle containing dependencies for anaytics and consent management. #}
153+
{# IE9 has its own lib JS bundle containing dependencies for analytics and consent management. #}
154154
{{ js_bundle('lib-ie') }}
155155
<![endif]-->
156156
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{#
2+
This Source Code Form is subject to the terms of the Mozilla Public
3+
License, v. 2.0. If a copy of the MPL was not distributed with this
4+
file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
#}
6+
7+
{% extends "firefox/new/desktop/download.html" %}
8+
9+
{% block canonical_urls %}<meta name="robots" content="noindex,follow">{% endblock %}
10+
11+
{% set win_smi_download_id = 'partner-firefox-release-smi-smi-001-stub' %}
12+
{% set mac_smi_download_id = 'partner-firefox-release-smi-smi-001' %}
13+
14+
{% block string_data %}
15+
data-win-smi-id="{{ win_smi_download_id }}"
16+
data-mac-smi-id="{{ mac_smi_download_id }}"
17+
{% endblock %}
18+
19+
{% block primary_cta %}
20+
{{ download_firefox(dom_id='download-primary', force_direct=True, download_location='primary cta') }}
21+
{% endblock %}
22+
23+
{% block features_cta %}
24+
{{ download_firefox(dom_id='download-features', force_direct=True, download_location='features cta') }}
25+
{% endblock %}
26+
27+
{% block discover_cta %}
28+
{{ download_firefox(dom_id='download-discover', force_direct=True, download_location='discover cta') }}
29+
{% endblock %}
30+
31+
{% block js %}
32+
{{ super() }}
33+
{{ js_bundle('firefox_smi_download') }}
34+
{% endblock %}

bedrock/firefox/templates/firefox/new/desktop/download.html

+9-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ <h1 class="mzp-c-wordmark mzp-t-wordmark-md mzp-t-product-firefox">{{ ftl('firef
8989
<h2 class="mzp-has-zap-7">{{ ftl('firefox-desktop-download-get-the-browser') }}</h2>
9090
<p>{{ ftl('firefox-desktop-download-no-shady') }}</p>
9191
<div class="c-intro-download">
92-
{{ download_firefox_thanks(locale_in_transition=True, download_location='primary cta') }}
92+
{% block primary_cta %}
93+
{{ download_firefox_thanks(locale_in_transition=True, download_location='primary cta') }}
94+
{% endblock %}
9395

9496
<div class="c-intro-download-alt"><a href="{{ url('firefox.all') }}">{{ ftl('firefox-desktop-download-download-options') }}</a></div>
9597

@@ -384,8 +386,9 @@ <h3 class="mzp-u-title-xs">{{ ftl('firefox-desktop-download-customize-your-brows
384386
</ul>
385387
</div>
386388
</div>
387-
{{ download_firefox_thanks(dom_id='download-features', locale_in_transition=True, download_location='features cta') }}
388-
389+
{% block features_cta %}
390+
{{ download_firefox_thanks(dom_id='download-features', locale_in_transition=True, download_location='features cta') }}
391+
{% endblock %}
389392
</div>
390393
</section>
391394

@@ -545,7 +548,9 @@ <h3 class="mzp-u-title-xs">{{ ftl('firefox-desktop-download-picture-in-picture')
545548
<p>{{ ftl('firefox-desktop-download-from-watching-a') }}</p>
546549
</div>
547550
</div>
548-
{{ download_firefox_thanks(dom_id='download-discover', locale_in_transition=True, download_location='discover cta') }}
551+
{% block discover_cta %}
552+
{{ download_firefox_thanks(dom_id='download-discover', locale_in_transition=True, download_location='discover cta') }}
553+
{% endblock %}
549554
</section>
550555

551556
<section class="c-support">

bedrock/firefox/urls.py

+2
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@
270270
"firefox/firefox-20th/index.html",
271271
active_locales=["de", "fr", "en-US", "en-CA", "en-GB"],
272272
),
273+
# Issue 15841 - UK influencer campaign
274+
page("firefox/landing/productivity/", "firefox/landing/productivity.html", ftl_files="firefox/new/desktop", active_locales="en-GB"),
273275
)
274276

275277
# Contentful
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
*/
6+
7+
import SMIDownload from './smi-download.es6';
8+
9+
SMIDownload.init();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
*/
6+
7+
const SMIDownload = {};
8+
9+
let winDownloadID;
10+
let macDownloadID;
11+
12+
SMIDownload.createCustomDownloadURL = (link, id) => {
13+
const url = new URL(link.href);
14+
url.searchParams.set('product', id);
15+
link.href = url;
16+
};
17+
18+
SMIDownload.replaceWithCustomDownloadLinks = () => {
19+
const downloadLinksWin = Array.from(
20+
document.querySelectorAll(
21+
'.download-button .download-list .download-link[data-download-version="win"]'
22+
)
23+
);
24+
const downloadLinksMac = Array.from(
25+
document.querySelectorAll(
26+
'.download-button .download-list .download-link[data-download-version="osx"]'
27+
)
28+
);
29+
30+
downloadLinksWin.every((link) =>
31+
SMIDownload.createCustomDownloadURL(link, winDownloadID)
32+
);
33+
downloadLinksMac.every((link) =>
34+
SMIDownload.createCustomDownloadURL(link, macDownloadID)
35+
);
36+
};
37+
38+
SMIDownload.init = () => {
39+
const strings = document.getElementById('strings');
40+
winDownloadID = strings.getAttribute('data-win-smi-id');
41+
macDownloadID = strings.getAttribute('data-mac-smi-id');
42+
43+
if (typeof window.URL === 'function' && winDownloadID && macDownloadID) {
44+
SMIDownload.replaceWithCustomDownloadLinks();
45+
}
46+
};
47+
48+
export default SMIDownload;

media/static-bundles.json

+6
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,12 @@
17821782
"js/base/banners/fundraiser-experiment.es6.js"
17831783
],
17841784
"name": "fundraising-banner-experiment"
1785+
},
1786+
{
1787+
"files": [
1788+
"js/firefox/landing/smi-download-init.es6.js"
1789+
],
1790+
"name": "firefox_smi_download"
17851791
}
17861792
]
17871793
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
*/
6+
7+
/* For reference read the Jasmine and Sinon docs
8+
* Jasmine docs: https://jasmine.github.io/
9+
* Sinon docs: http://sinonjs.org/docs/
10+
*/
11+
12+
import SMIDownload from '../../../../../media/js/firefox/landing/smi-download.es6';
13+
14+
describe('smi-download.es6.js', function () {
15+
describe('init()', function () {
16+
beforeEach(function () {
17+
const strings = `<div id="strings" data-win-smi-id="partner-firefox-release-smi-smi-001-stub" data-mac-smi-id="partner-firefox-release-smi-smi-001"></div>`;
18+
19+
const button = `<div id="download-primary" class="download-button mzp-c-button-download-container">
20+
<ul class="download-list">
21+
<li class="os_win64">
22+
<a class="download-link button" id="download-primary-win64" href="https://download.mozilla.org/?product=firefox-stub&amp;os=win64&amp;lang=en-GB" data-download-version="win64">
23+
Download Firefox
24+
</a>
25+
</li>
26+
<li class="os_win64-msi">
27+
<a class="download-link button" id="download-primary-win64-msi" href="https://download.mozilla.org/?product=firefox-msi-latest-ssl&amp;os=win64&amp;lang=en-GB" data-download-version="win64-msi">
28+
>Download Firefox
29+
</a>
30+
</li>
31+
<li class="os_win64-aarch64">
32+
<a class="download-link button" id="download-primary-win64-aarch64" href="https://download.mozilla.org/?product=firefox-latest-ssl&amp;os=win64-aarch64&amp;lang=en-GB" data-download-version="win64-aarch64">
33+
Download Firefox
34+
</a>
35+
</li>
36+
<li class="os_win">
37+
<a class="download-link button" id="download-primary-win" href="https://download.mozilla.org/?product=firefox-stub&amp;os=win&amp;lang=en-GB" data-download-version="win">
38+
Download Firefox
39+
</a>
40+
</li>
41+
<li class="os_win-msi">
42+
<a class="download-link button" id="download-primary-win-msi" href="https://download.mozilla.org/?product=firefox-msi-latest-ssl&amp;os=win&amp;lang=en-GB" data-download-version="win-msi">
43+
Download Firefox
44+
</a>
45+
</li>
46+
<li class="os_osx">
47+
<a class="download-link button" id="download-primary-osx" href="https://download.mozilla.org/?product=firefox-latest-ssl&amp;os=osx&amp;lang=en-GB" data-download-version="osx">
48+
Download Firefox
49+
</a>
50+
</li>
51+
<li class="os_linux64">
52+
<a class="download-link button" id="download-primary-linux64" href="https://download.mozilla.org/?product=firefox-latest-ssl&amp;os=linux64&amp;lang=en-GB" data-download-version="linux64">
53+
Download for Linux 64-bit
54+
</a>
55+
</li>
56+
<li class="os_linux">
57+
<a class="download-link button" id="download-primary-linux" href="https://download.mozilla.org/?product=firefox-latest-ssl&amp;os=linux&amp;lang=en-GB" data-download-version="linux">
58+
Download for Linux 32-bit
59+
</a>
60+
</li>
61+
<li class="os_android">
62+
<a class="download-link button" id="download-primary-android" href="https://play.google.com/store/apps/details?id=org.mozilla.firefox&amp;referrer=utm_source%3Dmozilla%26utm_medium%3DReferral%26utm_campaign%3Dmozilla-org" data-download-version="android">
63+
Firefox for Android
64+
</a>
65+
</li>
66+
<li class="os_ios">
67+
<a class="download-link button" id="download-primary-ios" href="https://apps.apple.com/us/app/apple-store/id989804926" data-download-version="ios">
68+
Firefox for iOS
69+
</a>
70+
</li>
71+
</ul>
72+
</div>`;
73+
74+
document.body.insertAdjacentHTML('beforeend', strings);
75+
document.body.insertAdjacentHTML('beforeend', button);
76+
});
77+
78+
afterEach(function () {
79+
const strings = document.getElementById('strings');
80+
strings.parentNode.removeChild(strings);
81+
82+
const button = document.getElementById('download-primary');
83+
button.parentNode.removeChild(button);
84+
});
85+
86+
it('should should update Windows and macOS download URLs with a custom build link', function () {
87+
SMIDownload.init();
88+
89+
const downloadLinksWin = Array.from(
90+
document.querySelectorAll(
91+
'.download-button .download-list .download-link[data-download-version="win"]'
92+
)
93+
);
94+
const downloadLinksMac = Array.from(
95+
document.querySelectorAll(
96+
'.download-button .download-list .download-link[data-download-version="osx"]'
97+
)
98+
);
99+
100+
downloadLinksWin.every((link) =>
101+
expect(link.href).toContain(
102+
'?product=partner-firefox-release-smi-smi-001-stub'
103+
)
104+
);
105+
downloadLinksMac.every((link) =>
106+
expect(link.href).toContain(
107+
'?product=partner-firefox-release-smi-smi-001'
108+
)
109+
);
110+
});
111+
112+
it('should should not update Windows URLs that are not visible on landing page', function () {
113+
SMIDownload.init();
114+
115+
const downloadLinksWin64 = Array.from(
116+
document.querySelectorAll(
117+
'.download-button .download-list .download-link[data-download-version="win64"]'
118+
)
119+
);
120+
const downloadLinksWinMsi = Array.from(
121+
document.querySelectorAll(
122+
'.download-button .download-list .download-link[data-download-version="win64-msi"]'
123+
)
124+
);
125+
const downloadLinksWinAarch64 = Array.from(
126+
document.querySelectorAll(
127+
'.download-button .download-list .download-link[data-download-version="win64-aarch64"]'
128+
)
129+
);
130+
131+
downloadLinksWin64.every((link) =>
132+
expect(link.href).not.toContain(
133+
'?product=partner-firefox-release-smi-smi-001-stub'
134+
)
135+
);
136+
downloadLinksWinMsi.every((link) =>
137+
expect(link.href).not.toContain(
138+
'?product=partner-firefox-release-smi-smi-001'
139+
)
140+
);
141+
downloadLinksWinAarch64.every((link) =>
142+
expect(link.href).not.toContain(
143+
'?product=partner-firefox-release-smi-smi-001'
144+
)
145+
);
146+
});
147+
148+
it('should should not update Linux download URLs with a custom build link', function () {
149+
SMIDownload.init();
150+
151+
const downloadLinksLinux = Array.from(
152+
document.querySelectorAll(
153+
'.download-button .download-list .download-link[data-download-version="linux"]'
154+
)
155+
);
156+
const downloadLinksLinux64 = Array.from(
157+
document.querySelectorAll(
158+
'.download-button .download-list .download-link[data-download-version="linux64"]'
159+
)
160+
);
161+
162+
downloadLinksLinux.every((link) =>
163+
expect(link.href).not.toContain(
164+
'?product=partner-firefox-release-smi-smi-001'
165+
)
166+
);
167+
downloadLinksLinux64.every((link) =>
168+
expect(link.href).not.toContain(
169+
'?product=partner-firefox-release-smi-smi-001'
170+
)
171+
);
172+
});
173+
174+
it('should should not update iOS download URLs with a custom build link', function () {
175+
SMIDownload.init();
176+
177+
const downloadLinksIOS = Array.from(
178+
document.querySelectorAll(
179+
'.download-button .download-list .download-link[data-download-version="ios"]'
180+
)
181+
);
182+
183+
downloadLinksIOS.every((link) =>
184+
expect(link.href).not.toContain(
185+
'?product=partner-firefox-release-smi-smi-001'
186+
)
187+
);
188+
});
189+
190+
it('should should not update Android download URLs with a custom build link', function () {
191+
SMIDownload.init();
192+
193+
const downloadLinksAndroid = Array.from(
194+
document.querySelectorAll(
195+
'.download-button .download-list .download-link[data-download-version="android"]'
196+
)
197+
);
198+
199+
downloadLinksAndroid.every((link) =>
200+
expect(link.href).not.toContain(
201+
'?product=partner-firefox-release-smi-smi-001'
202+
)
203+
);
204+
});
205+
});
206+
});

0 commit comments

Comments
 (0)