Survey view

This commit is contained in:
Andrea Marchesini
2025-09-30 17:48:00 +02:00
parent adbf310a17
commit 0eb13f214d
6 changed files with 114 additions and 11 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "testpilot-containers", "name": "testpilot-containers",
"title": "Multi-Account Containers", "title": "Multi-Account Containers",
"description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.", "description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
"version": "8.3.0", "version": "8.3.1",
"author": "Andrea Marchesini, Luke Crouch, Lesley Norton, Kendall Werts, Maxx Crawford, Jonathan Kingston", "author": "Andrea Marchesini, Luke Crouch, Lesley Norton, Kendall Werts, Maxx Crawford, Jonathan Kingston",
"bugs": { "bugs": {
"url": "https://github.com/mozilla/multi-account-containers/issues" "url": "https://github.com/mozilla/multi-account-containers/issues"
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 58 KiB

+29
View File
@@ -257,6 +257,8 @@ const messageHandler = {
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"}); browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
browser.browserAction.setBadgeText({text: "NEW"}); browser.browserAction.setBadgeText({text: "NEW"});
} }
this.maybePrepareSurveyAchievementOnUpdate(countOfContainerTabsOpened);
}, },
async onFocusChangedCallback(windowId) { async onFocusChangedCallback(windowId) {
@@ -273,7 +275,34 @@ const messageHandler = {
}).catch((e) => { }).catch((e) => {
throw e; throw e;
}); });
},
async maybePrepareSurveyAchievementOnUpdate(countOpened) {
if (countOpened < 10) {
return;
} }
// Show the survey only for English locales (en or en-*).
const uiLang = browser.i18n.getUILanguage();
const lang = (uiLang || "").toLowerCase();
if (lang !== "en" && !lang.startsWith("en-")) {
return;
}
// Check if already scheduled in the past; if so, do not show again.
const achievementsStorage = await browser.storage.local.get({ achievements: [] });
const achievements = achievementsStorage.achievements;
const existing = achievements.find(a => a.name === "survey");
if (existing) {
return;
}
// Ensure the achievement exists and is pending.
achievements.push({ name: "survey", done: false });
browser.storage.local.set({ achievements });
browser.browserAction.setBadgeBackgroundColor({color: "rgba(0,217,0,255)"});
browser.browserAction.setBadgeText({text: "NEW"});
},
}; };
// Lets do this last as theme manager did a check before connecting before // Lets do this last as theme manager did a check before connecting before
+34 -8
View File
@@ -31,6 +31,7 @@ const P_CONTAINER_INFO = "containerInfo";
const P_CONTAINER_EDIT = "containerEdit"; const P_CONTAINER_EDIT = "containerEdit";
const P_CONTAINER_DELETE = "containerDelete"; const P_CONTAINER_DELETE = "containerDelete";
const P_CONTAINERS_ACHIEVEMENT = "containersAchievement"; const P_CONTAINERS_ACHIEVEMENT = "containersAchievement";
const P_SURVEY_ACHIEVEMENT = "surveyAchievement";
const P_CONTAINER_ASSIGNMENTS = "containerAssignments"; const P_CONTAINER_ASSIGNMENTS = "containerAssignments";
const P_CLEAR_CONTAINER_STORAGE = "clearContainerStorage"; const P_CLEAR_CONTAINER_STORAGE = "clearContainerStorage";
@@ -138,18 +139,23 @@ const Logic = {
async showAchievementOrContainersListPanel() { async showAchievementOrContainersListPanel() {
// Do we need to show an achievement panel? // Do we need to show an achievement panel?
let showAchievements = false;
const achievementsStorage = await browser.storage.local.get({ achievements: [] }); const achievementsStorage = await browser.storage.local.get({ achievements: [] });
for (const achievement of achievementsStorage.achievements) { const pending = achievementsStorage.achievements.filter(a => !a.done);
if (!achievement.done) {
showAchievements = true; if (pending.length) {
// Prefer showing the survey view first if present, otherwise fall back
// to the existing achievement panel.
const survey = pending.find(a => a.name === "survey");
if (survey) {
this.showPanel(P_SURVEY_ACHIEVEMENT);
return;
} }
}
if (showAchievements) {
this.showPanel(P_CONTAINERS_ACHIEVEMENT); this.showPanel(P_CONTAINERS_ACHIEVEMENT);
} else { return;
this.showPanel(P_CONTAINERS_LIST);
} }
this.showPanel(P_CONTAINERS_LIST);
}, },
// In case the user wants to click multiple actions, // In case the user wants to click multiple actions,
@@ -2376,6 +2382,26 @@ Logic.registerPanel(P_CONTAINERS_ACHIEVEMENT, {
}, },
}); });
// P_SURVEY_ACHIEVEMENT: A simple survey view.
// ----------------------------------------------------------------------------
Logic.registerPanel(P_SURVEY_ACHIEVEMENT, {
panelSelector: ".survey-panel",
// This method is called when the object is registered.
initialize() {
Utils.addEnterHandler(document.querySelector("#survey-achievement-done-button"), async () => {
await Logic.setAchievementDone("survey");
Logic.showPanel(P_CONTAINERS_LIST);
});
},
// This method is called when the panel is shown.
prepare() {
return Promise.resolve(null);
},
});
Logic.init(); Logic.init();
window.addEventListener("resize", function () { window.addEventListener("resize", function () {
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Firefox Multi-Account Containers", "name": "Firefox Multi-Account Containers",
"version": "8.3.0", "version": "8.3.1",
"incognito": "not_allowed", "incognito": "not_allowed",
"description": "__MSG_extensionDescription__", "description": "__MSG_extensionDescription__",
"icons": { "icons": {
+12
View File
@@ -106,6 +106,18 @@
<a href="#" id="achievement-done-button" class="onboarding-button keyboard-nav" data-i18n-message-id="done"></a> <a href="#" id="achievement-done-button" class="onboarding-button keyboard-nav" data-i18n-message-id="done"></a>
</div> </div>
<div class="panel survey-panel hide" id="survey-panel">
<img class="survey-img" alt="" src="/img/survey.svg" />
<h3 class="onboarding-title">Participate in Paid Research with Firefox</h3>
<p>We'd love to learn about your experiences with this add-on!</p>
<p>Join a 1:1 Zoom interview and receive a $75 Amazon e-giftcard or Paypal payment.</p>
<br /><p>Thank you for helping us improve Firefox.</p>
<p class="share-ctas">
<a class="cta-link onboarding-button keyboard-nav" href="https://qsurvey.mozilla.com/s3/Multi-Account-Containers-Research-Interest-Form" id="survey-button" target="_blank">Take Survey</a>
</p>
<a href="#" id="survey-achievement-done-button">Back</a>
</div>
<div class="panel menu-panel container-panel hide" id="container-panel"> <div class="panel menu-panel container-panel hide" id="container-panel">
<span class="popup-notification-card"></span> <span class="popup-notification-card"></span>
<h3 class="title">Firefox Multi-Account Containers</h3> <h3 class="title">Firefox Multi-Account Containers</h3>