Skip to content

Commit 8b70aca

Browse files
authored
Merge pull request #2828 from mozilla/surveyFinal
Final survey. #2827
2 parents d6cb8f7 + 0539c12 commit 8b70aca

File tree

7 files changed

+178
-3
lines changed

7 files changed

+178
-3
lines changed

src/_locales

src/css/popup.css

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@
2626
src: url("/fonts/Inter-Medium.woff2") format("woff2");
2727
}
2828

29+
@font-face {
30+
font-family: "Inter-SemiBold";
31+
font-style: normal;
32+
font-weight: 700;
33+
src: url("/fonts/Inter-SemiBold.woff2") format("woff2");
34+
}
35+
2936
[data-theme="light"],
3037
:root {
3138
--fontInter: "Inter", sans-serif;
3239
--fontInterMedium: "Inter-Medium", sans-serif;
40+
--fontInterSemiBold: "Inter-SemiBold", sans-serif;
3341
--fontMetropolis: "Metropolis", sans-serif;
3442
--fontMetropolisLight: "Metropolis-Light", sans-serif;
3543
--iconArrowLeft: url("/img/arrow-icon-left.svg");
@@ -1651,8 +1659,20 @@ input[type=text] {
16511659
background-color: var(--button-bg-hover-color-primary);
16521660
}
16531661

1662+
#survey-achievement-done-button {
1663+
color: var(--button-bg-color-primary);
1664+
transition: color 0.1s ease;
1665+
font-size: 14px;
1666+
padding-inline: 3px;
1667+
padding-block: 1px;
1668+
border-radius: 1px;
1669+
text-align: center;
1670+
margin-inline: auto;
1671+
}
1672+
16541673
.onboarding-button:focus,
1655-
.half-onboarding-button:focus {
1674+
.half-onboarding-button:focus,
1675+
#survey-achievement-done-button:focus {
16561676
box-shadow:
16571677
0 0 0 2px var(--button-bg-color-secondary),
16581678
0 0 0 4px var(--button-bg-focus-color-primary);
@@ -2409,3 +2429,52 @@ tr:hover > td > .reset-button {
24092429
.searchbar input {
24102430
inline-size: 100%;
24112431
}
2432+
2433+
/* Survey Popup */
2434+
2435+
.survey-blurb,
2436+
#survey-panel h3.onboarding-title {
2437+
text-align: center;
2438+
margin-inline: auto;
2439+
}
2440+
2441+
#survey-panel h3.onboarding-title {
2442+
max-inline-size: 100%;
2443+
font-family: var(--fontInterSemiBold);
2444+
line-height: 24px;
2445+
margin-block-end: 12px;
2446+
}
2447+
2448+
#survey-panel {
2449+
padding-block: 40px;
2450+
padding-inline: 0;
2451+
}
2452+
2453+
.survey-blurb {
2454+
margin-block-end: 16px;
2455+
margin-inline: 24px;
2456+
}
2457+
2458+
#survey-img {
2459+
block-size: 180px;
2460+
margin-block-end: 16px;
2461+
}
2462+
2463+
#survey-button {
2464+
padding-block: 4px;
2465+
padding-inline: 16px;
2466+
margin-block: 0 8px;
2467+
min-block-size: 32px;
2468+
}
2469+
2470+
.share-ctas.survey-back {
2471+
margin-inline: auto;
2472+
}
2473+
2474+
#survey-achievement-done-button:hover {
2475+
color: var(--button-bg-hover-color-primary);
2476+
}
2477+
2478+
#survey-achievement-done-button:active {
2479+
color: var(--button-bg-active-color-primary);
2480+
}

src/fonts/Inter-SemiBold.woff2

141 KB
Binary file not shown.

src/img/survey.svg

Lines changed: 34 additions & 0 deletions
Loading

src/js/background/messageHandler.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ const messageHandler = {
257257
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
258258
browser.browserAction.setBadgeText({text: "NEW"});
259259
}
260+
261+
this.maybePrepareSurveyAchievementOnUpdate(countOfContainerTabsOpened);
260262
},
261263

262264
async onFocusChangedCallback(windowId) {
@@ -273,7 +275,34 @@ const messageHandler = {
273275
}).catch((e) => {
274276
throw e;
275277
});
276-
}
278+
},
279+
280+
async maybePrepareSurveyAchievementOnUpdate(countOpened) {
281+
if (countOpened < 10) {
282+
return;
283+
}
284+
285+
// Show the survey only for English locales (en or en-*).
286+
const uiLang = browser.i18n.getUILanguage();
287+
const lang = (uiLang || "").toLowerCase();
288+
if (lang !== "en" && !lang.startsWith("en-")) {
289+
return;
290+
}
291+
292+
// Check if already scheduled in the past; if so, do not show again.
293+
const achievementsStorage = await browser.storage.local.get({ achievements: [] });
294+
const achievements = achievementsStorage.achievements;
295+
const existing = achievements.find(a => a.name === "surveyFinal");
296+
if (existing) {
297+
return;
298+
}
299+
300+
// Ensure the achievement exists and is pending.
301+
achievements.push({ name: "surveyFinal", done: false });
302+
browser.storage.local.set({ achievements });
303+
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
304+
browser.browserAction.setBadgeText({text: "NEW"});
305+
},
277306
};
278307

279308
// Lets do this last as theme manager did a check before connecting before

src/js/popup.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const P_CONTAINER_INFO = "containerInfo";
3131
const P_CONTAINER_EDIT = "containerEdit";
3232
const P_CONTAINER_DELETE = "containerDelete";
3333
const P_CONTAINERS_ACHIEVEMENT = "containersAchievement";
34+
const P_SURVEY_ACHIEVEMENT = "surveyAchievement";
3435
const P_CONTAINER_ASSIGNMENTS = "containerAssignments";
3536
const P_CLEAR_CONTAINER_STORAGE = "clearContainerStorage";
3637

@@ -147,6 +148,11 @@ const Logic = {
147148
return;
148149
}
149150

151+
if (achievement.name === "surveyFinal") {
152+
this.showPanel(P_SURVEY_ACHIEVEMENT);
153+
return;
154+
}
155+
150156
// We have found an unknown achievement. Let's mark it as done.
151157
achievement.done = true;
152158
saveAchievements = true;
@@ -2383,6 +2389,30 @@ Logic.registerPanel(P_CONTAINERS_ACHIEVEMENT, {
23832389
},
23842390
});
23852391

2392+
// P_SURVEY_ACHIEVEMENT: A simple survey view.
2393+
// ----------------------------------------------------------------------------
2394+
2395+
Logic.registerPanel(P_SURVEY_ACHIEVEMENT, {
2396+
panelSelector: ".survey-panel",
2397+
2398+
// This method is called when the object is registered.
2399+
initialize() {
2400+
Utils.addEnterHandler(document.querySelector("#survey-achievement-done-button"), async () => {
2401+
await Logic.setAchievementDone("surveyFinal");
2402+
Logic.showPanel(P_CONTAINERS_LIST);
2403+
});
2404+
Utils.addEnterHandler(document.querySelector("#survey-button"), async () => {
2405+
await Logic.setAchievementDone("surveyFinal");
2406+
window.close();
2407+
});
2408+
},
2409+
2410+
// This method is called when the panel is shown.
2411+
prepare() {
2412+
return Promise.resolve(null);
2413+
},
2414+
});
2415+
23862416
Logic.init();
23872417

23882418
window.addEventListener("resize", function () {

src/popup.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ <h3 class="onboarding-title" data-i18n-message-id="oneHundredTabsHeader"></h3>
106106
<a href="#" id="achievement-done-button" class="onboarding-button keyboard-nav" data-i18n-message-id="done"></a>
107107
</div>
108108

109+
<div class="panel survey-panel hide" id="survey-panel">
110+
<img id="survey-img" alt="" src="/img/survey.svg" />
111+
112+
<h3 class="onboarding-title">Help Improve Containers</h3>
113+
<p class="survey-blurb">Please take 5 minutes to share your experiences with the add-on! This will help us effectively prioritize improvements.</p>
114+
<p class="survey-blurb">Learn more about the research here.</p>
115+
<br/><p class="survey-blurb">Thank you for using Multi-Account Containers!</p>
116+
<p class="share-ctas survey-back">
117+
<a class="cta-link onboarding-button keyboard-nav" href="https://mozilla.qualtrics.com/jfe/form/SV_2aSQMGyfp2DFLtI" id="survey-button" target="_blank">Take Survey</a>
118+
</p>
119+
<a href="#" id="survey-achievement-done-button">Back</a>
120+
</div>
121+
109122
<div class="panel menu-panel container-panel hide" id="container-panel">
110123
<span class="popup-notification-card"></span>
111124
<h3 class="title">Firefox Multi-Account Containers</h3>

0 commit comments

Comments
 (0)