Merge branch 'trailhead'
This commit is contained in:
Коммит
1734beda7f
|
@ -57,20 +57,25 @@ export class _Trailhead extends React.PureComponent {
|
|||
link.rel = "localization";
|
||||
});
|
||||
|
||||
if (this.props.fxaEndpoint && !this.fxaMetricsInitialized) {
|
||||
await this.componentWillUpdate(this.props);
|
||||
}
|
||||
|
||||
// Get the fxa data if we don't have it yet from mount or update
|
||||
async componentWillUpdate(props) {
|
||||
if (props.fxaEndpoint && !this.fxaMetricsInitialized) {
|
||||
try {
|
||||
this.fxaMetricsInitialized = true;
|
||||
const url = new URL(`${this.props.fxaEndpoint}/metrics-flow?entrypoint=activity-stream-firstrun&form_type=email`);
|
||||
const url = new URL(`${props.fxaEndpoint}/metrics-flow?entrypoint=activity-stream-firstrun&form_type=email`);
|
||||
this.addUtmParams(url);
|
||||
const response = await fetch(url, {credentials: "omit"});
|
||||
if (response.status === 200) {
|
||||
const {deviceId, flowId, flowBeginTime} = await response.json();
|
||||
this.setState({deviceId, flowId, flowBeginTime});
|
||||
} else {
|
||||
this.props.dispatch(ac.OnlyToMain({type: at.TELEMETRY_UNDESIRED_EVENT, data: {event: "FXA_METRICS_FETCH_ERROR", value: response.status}}));
|
||||
props.dispatch(ac.OnlyToMain({type: at.TELEMETRY_UNDESIRED_EVENT, data: {event: "FXA_METRICS_FETCH_ERROR", value: response.status}}));
|
||||
}
|
||||
} catch (error) {
|
||||
this.props.dispatch(ac.OnlyToMain({type: at.TELEMETRY_UNDESIRED_EVENT, data: {event: "FXA_METRICS_ERROR"}}));
|
||||
props.dispatch(ac.OnlyToMain({type: at.TELEMETRY_UNDESIRED_EVENT, data: {event: "FXA_METRICS_ERROR"}}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ const TRAILHEAD_CONFIG = {
|
|||
},
|
||||
LOCALES: ["en-US", "en-GB", "en-CA", "de", "de-DE", "fr", "fr-FR"],
|
||||
EXPERIMENT_RATIOS: [
|
||||
["", 1],
|
||||
["", 0],
|
||||
["interrupts", 1],
|
||||
["triplets", 1],
|
||||
["triplets", 3],
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ const {Localization} = ChromeUtils.import("resource://gre/modules/Localization.j
|
|||
const {FxAccountsConfig} = ChromeUtils.import("resource://gre/modules/FxAccountsConfig.jsm");
|
||||
const {AttributionCode} = ChromeUtils.import("resource:///modules/AttributionCode.jsm");
|
||||
const {AddonRepository} = ChromeUtils.import("resource://gre/modules/addons/AddonRepository.jsm");
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
async function getAddonInfo() {
|
||||
try {
|
||||
|
@ -223,7 +224,10 @@ const ONBOARDING_MESSAGES = async () => ([
|
|||
icon: "tracking",
|
||||
primary_button: {
|
||||
label: {string_id: "onboarding-tracking-protection-button2"},
|
||||
action: {
|
||||
action: Services.locale.appLocaleAsLangTag.substr(0, 2) === "en" ? {
|
||||
type: "OPEN_URL",
|
||||
data: {args: "https://mzl.la/ETPdefault", where: "tabshifted"},
|
||||
} : {
|
||||
type: "OPEN_PREFERENCES_PAGE",
|
||||
data: {category: "privacy-trackingprotection"},
|
||||
},
|
||||
|
@ -343,7 +347,7 @@ const ONBOARDING_MESSAGES = async () => ([
|
|||
label: {string_id: "onboarding-send-tabs-button"},
|
||||
action: {
|
||||
type: "OPEN_URL",
|
||||
data: {args: "https://support.mozilla.org/kb/send-tab-firefox-desktop-mobile", where: "tabshifted"},
|
||||
data: {args: "https://support.mozilla.org/kb/send-tab-firefox-desktop-other-devices", where: "tabshifted"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче