This does a couple of things: * Instead of using the `not_now` telemetry event object for the cases where the dialog is closed by the Escape key or some other atypical way, reserve `not_now` -- renamed `not_now_link` -- specifically for clicks on the "Not now" link and add two new objects: `dismissed_escape_key` and `dismissed_other`. That should give us a little better understanding of how the dialog is being dismissed. The new `not_now_link` name is to avoid conflation with the previous meaning of `not_now`. * Add a new `browser.urlbar.quicksuggest.onboardingDialogChoice` pref that stores exactly the same values as the telemetry event. e.g., if the dialog is accepted, then we'll record a telemetry event whose object is `accept` and we'll also store `accept` in the pref. I figure if we decide to show the onboarding again for people who have already seen it, (1) we'll use this pref to decide the flow for any given user, and (2) we'll need to add another pref for the user's response to the "v2" dialog, or maybe we could morph this one into an array of responses or something more complex like that. Differential Revision: https://phabricator.services.mozilla.com/D127354
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
/* 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
const { ONBOARDING_CHOICE } = ChromeUtils.import(
|
|
"resource:///modules/UrlbarQuickSuggest.jsm"
|
|
);
|
|
|
|
document.addEventListener("dialogaccept", event => {
|
|
// dialogaccept is fired when the user presses the enter key even when an
|
|
// element other than the accept button is focused. If another element is
|
|
// focused, then peform its action.
|
|
switch (document.activeElement?.id) {
|
|
case "onboardingSettingsButton":
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.SETTINGS;
|
|
event.preventDefault();
|
|
window.close();
|
|
return;
|
|
case "onboardingNotNow":
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.NOT_NOW;
|
|
event.preventDefault();
|
|
window.close();
|
|
return;
|
|
case "onboardingLearnMore":
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.LEARN_MORE;
|
|
event.preventDefault();
|
|
window.close();
|
|
return;
|
|
}
|
|
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.ACCEPT;
|
|
});
|
|
|
|
document.addEventListener("dialogextra1", () => {
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.SETTINGS;
|
|
window.close();
|
|
});
|
|
|
|
document.getElementById("onboardingNotNow").addEventListener("click", () => {
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.NOT_NOW;
|
|
window.close();
|
|
});
|
|
|
|
document.getElementById("onboardingLearnMore").addEventListener("click", () => {
|
|
window.arguments[0].choice = ONBOARDING_CHOICE.LEARN_MORE;
|
|
window.close();
|
|
});
|