Bug 1859302 - NimbusRolloutMessageProvider should be listed as a generated file r=omc-reviewers,aminomancer

Patch invokes `import-rollouts` script that import Nimbus Rollout messages into NimbusRolloutMessageProvider.sys.mjs when running test using ` ./mach npm run test --prefix browser/components/asrouter`

Differential Revision: https://phabricator.services.mozilla.com/D205777
This commit is contained in:
Punam Dahiya 2024-03-27 22:12:31 +00:00
parent 68cb1a8b29
commit 87c4dca929
5 changed files with 427 additions and 110 deletions

View File

@ -60,6 +60,7 @@
"testmc:lint": "npm run lint",
"testmc:build": "npm run bundle:admin",
"testmc:unit": "karma start karma.mc.config.js",
"testmc:import": "npm run import-rollouts",
"tddmc": "karma start karma.mc.config.js --tdd",
"debugcoverage": "open logs/coverage/lcov-report/index.html",
"lint": "npm-run-all lint:*",

View File

@ -9,59 +9,11 @@
export const InflightAssetsMessageProvider = {
getMessages() {
return [
{
id: "MILESTONE_MESSAGE",
groups: ["cfr"],
content: {
anchor_id: "tracking-protection-icon-box",
bucket_id: "CFR_MILESTONE_MESSAGE",
buttons: {
primary: {
action: {
type: "OPEN_PROTECTION_REPORT",
},
event: "PROTECTION",
label: {
string_id: "cfr-doorhanger-milestone-ok-button",
},
},
secondary: [
{
label: {
string_id: "cfr-doorhanger-milestone-close-button",
},
action: {
type: "CANCEL",
},
event: "DISMISS",
},
],
},
category: "cfrFeatures",
heading_text: {
string_id: "cfr-doorhanger-milestone-heading",
},
layout: "short_message",
notification_text: "",
skip_address_bar_notifier: true,
text: "",
},
frequency: {
lifetime: 7,
},
targeting:
"pageLoad >= 4 && firefoxVersion < 87 && userPrefs.cfrFeatures",
template: "milestone_message",
trigger: {
id: "contentBlocking",
params: ["ContentBlockingMilestone"],
},
},
{
id: "MILESTONE_MESSAGE_87",
groups: ["cfr"],
content: {
anchor_id: "tracking-protection-icon-box",
anchor_id: "tracking-protection-icon-container",
bucket_id: "CFR_MILESTONE_MESSAGE",
buttons: {
primary: {
@ -98,7 +50,7 @@ export const InflightAssetsMessageProvider = {
lifetime: 7,
},
targeting:
"pageLoad >= 4 && firefoxVersion >= 87 && userPrefs.cfrFeatures",
"pageLoad >= 4 && firefoxVersion >= 115 && firefoxVersion < 121 && userPrefs.cfrFeatures",
template: "milestone_message",
trigger: {
id: "contentBlocking",
@ -275,66 +227,6 @@ export const InflightAssetsMessageProvider = {
],
},
},
{
id: "WNP_MOMENTS_12",
groups: ["moments-pages"],
content: {
action: {
data: {
expire: 1640908800000,
url: "https://www.mozilla.org/firefox/welcome/12",
},
id: "moments-wnp",
},
bucket_id: "WNP_MOMENTS_12",
},
targeting:
'localeLanguageCode == "en" && region in ["DE", "AT", "BE", "CA", "FR", "IE", "IT", "MY", "NL", "NZ", "SG", "CH", "US", "GB", "ES"] && (addonsInfo.addons|keys intersect ["@testpilot-containers"])|length == 1 && \'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features\'|preferenceValue && \'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons\'|preferenceValue',
template: "update_action",
trigger: {
id: "momentsUpdate",
},
},
{
id: "WNP_MOMENTS_13",
groups: ["moments-pages"],
content: {
action: {
data: {
expire: 1640908800000,
url: "https://www.mozilla.org/firefox/welcome/13",
},
id: "moments-wnp",
},
bucket_id: "WNP_MOMENTS_13",
},
targeting:
'(localeLanguageCode in ["en", "de", "fr", "nl", "it", "ms"] || locale == "es-ES") && region in ["DE", "AT", "BE", "CA", "FR", "IE", "IT", "MY", "NL", "NZ", "SG", "CH", "US", "GB", "ES"] && (addonsInfo.addons|keys intersect ["@testpilot-containers"])|length == 0 && \'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features\'|preferenceValue && \'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons\'|preferenceValue',
template: "update_action",
trigger: {
id: "momentsUpdate",
},
},
{
id: "WNP_MOMENTS_14",
groups: ["moments-pages"],
content: {
action: {
data: {
expire: 1668470400000,
url: "https://www.mozilla.org/firefox/welcome/14",
},
id: "moments-wnp",
},
bucket_id: "WNP_MOMENTS_14",
},
targeting:
'localeLanguageCode in ["en", "de", "fr"] && region in ["AT", "BE", "CA", "CH", "DE", "ES", "FI", "FR", "GB", "IE", "IT", "MY", "NL", "NZ", "SE", "SG", "US"] && \'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features\'|preferenceValue && \'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons\'|preferenceValue',
template: "update_action",
trigger: {
id: "momentsUpdate",
},
},
];
},
};

View File

@ -11,6 +11,427 @@
export const NimbusRolloutMessageProvider = {
getMessages() {
return [
{
// Nimbus slug: device-migration-q4-spotlights-remaining-population-esr:treatment (message 1 of 3)
// Recipe: https://experimenter.services.mozilla.com/nimbus/device-migration-q4-spotlights-remaining-population-esr/summary#treatment
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
groups: ["eco"],
content: {
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
modal: "tab",
screens: [
{
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT_BACKUP",
content: {
logo: {
height: "152px",
imageURL:
"https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/c92a41e4-82cf-4ad5-8480-04a138bfb3cd.png",
},
title: {
fontSize: "24px",
string_id: "device-migration-fxa-spotlight-heavy-user-header",
letterSpacing: 0,
},
subtitle: {
fontSize: "15px",
string_id: "device-migration-fxa-spotlight-heavy-user-body",
lineHeight: "1.4",
marginBlock: "8px 20px",
letterSpacing: 0,
paddingInline: "20px",
},
dismiss_button: {
action: {
navigate: true,
},
},
primary_button: {
label: {
string_id:
"device-migration-fxa-spotlight-heavy-user-primary-button",
paddingBlock: "4px",
paddingInline: "16px",
},
action: {
data: {
args: "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/switching-devices?utm_source=spotlight-default&utm_medium=firefox-desktop&utm_campaign=migration&utm_content=dont-forget-to-backup&entrypoint=device-migration-spotlight-experiment-v2",
where: "tabshifted",
},
type: "OPEN_URL",
navigate: true,
},
},
},
},
],
backdrop: "transparent",
template: "multistage",
transitions: true,
},
trigger: {
id: "defaultBrowserCheck",
},
template: "spotlight",
frequency: {
lifetime: 1,
},
targeting:
"source == 'startup' && !willShowDefaultPrompt && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue && !usesFirefoxSync && !hasActiveEnterprisePolicies && userMonthlyActivity[userMonthlyActivity|length - 2][1]|date >= currentDate|date - (28 * 24 * 60 * 60 * 1000) && (((currentDate|date - profileAgeCreated|date) / 86400000 >= 168) || totalBookmarksCount >= 35)",
},
{
// Nimbus slug: device-migration-q4-spotlights-remaining-population-esr:treatment (message 2 of 3)
// Recipe: https://experimenter.services.mozilla.com/nimbus/device-migration-q4-spotlights-remaining-population-esr/summary#treatment
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
groups: ["eco"],
content: {
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
modal: "tab",
screens: [
{
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT_PEACE",
content: {
logo: {
height: "133px",
imageURL:
"https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/4a56d3ed-98c8-4a33-b853-b2cf7646efd8.png",
marginBlock: "22px -10px",
},
title: {
fontSize: "24px",
string_id:
"device-migration-fxa-spotlight-older-device-header",
letterSpacing: 0,
},
subtitle: {
fontSize: "15px",
string_id: "device-migration-fxa-spotlight-older-device-body",
lineHeight: "1.4",
marginBlock: "8px 20px",
letterSpacing: 0,
paddingInline: "40px",
},
dismiss_button: {
action: {
navigate: true,
},
},
primary_button: {
label: {
string_id:
"device-migration-fxa-spotlight-older-device-primary-button",
marginBlock: "0 22px",
paddingBlock: "4px",
paddingInline: "16px",
},
action: {
data: {
args: "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/switching-devices?utm_source=spotlight-default&utm_medium=firefox-desktop&utm_campaign=migration&utm_content=peace-of-mind&entrypoint=device-migration-spotlight-experiment-v2",
where: "tabshifted",
},
type: "OPEN_URL",
navigate: true,
},
},
},
},
],
backdrop: "transparent",
template: "multistage",
transitions: true,
},
trigger: {
id: "defaultBrowserCheck",
},
template: "spotlight",
frequency: {
lifetime: 1,
},
targeting:
"source == 'startup' && !willShowDefaultPrompt && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue && !usesFirefoxSync && !hasActiveEnterprisePolicies && userMonthlyActivity[userMonthlyActivity|length - 2][1]|date >= currentDate|date - (28 * 24 * 60 * 60 * 1000) && !(((currentDate|date - profileAgeCreated|date) / 86400000 >= 168) || totalBookmarksCount >= 35) && os.isWindows && os.windowsVersion >= 6.1 && os.windowsBuildNumber < 22000",
},
{
// Nimbus slug: device-migration-q4-spotlights-remaining-population-esr:treatment (message 3 of 3)
// Recipe: https://experimenter.services.mozilla.com/nimbus/device-migration-q4-spotlights-remaining-population-esr/summary#treatment
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
groups: ["eco"],
content: {
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
modal: "tab",
screens: [
{
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT_NEW_DEVICE",
content: {
logo: {
height: "149px",
imageURL:
"https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/a43cd9cc-e8b2-477c-92f2-345557370de1.svg",
},
title: {
fontSize: "24px",
string_id:
"device-migration-fxa-spotlight-getting-new-device-header-2",
letterSpacing: 0,
},
subtitle: {
fontSize: "15px",
string_id:
"device-migration-fxa-spotlight-getting-new-device-body-2",
lineHeight: "1.4",
marginBlock: "8px 20px",
letterSpacing: 0,
paddingInline: "40px",
},
dismiss_button: {
action: {
navigate: true,
},
},
primary_button: {
label: {
string_id:
"device-migration-fxa-spotlight-getting-new-device-primary-button",
paddingBlock: "4px",
paddingInline: "16px",
},
action: {
data: {
args: "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/switching-devices?utm_source=spotlight-default&utm_medium=firefox-desktop&utm_campaign=migration&utm_content=new-device-in-your-future&entrypoint=device-migration-spotlight-experiment-v2",
where: "tabshifted",
},
type: "OPEN_URL",
navigate: true,
},
},
},
},
],
backdrop: "transparent",
template: "multistage",
transitions: true,
},
trigger: {
id: "defaultBrowserCheck",
},
template: "spotlight",
frequency: {
lifetime: 1,
},
targeting:
"source == 'startup' && !willShowDefaultPrompt && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue && !usesFirefoxSync && !hasActiveEnterprisePolicies && userMonthlyActivity[userMonthlyActivity|length - 2][1]|date >= currentDate|date - (28 * 24 * 60 * 60 * 1000) && !(((currentDate|date - profileAgeCreated|date) / 86400000 >= 168) || totalBookmarksCount >= 35) && !(os.isWindows && os.windowsVersion >= 6.1 && os.windowsBuildNumber < 22000)",
},
{
// Nimbus slug: device-migration-q4-spotlights-remaining-population:treatment (message 1 of 3)
// Version range: 122+
// Recipe: https://experimenter.services.mozilla.com/nimbus/device-migration-q4-spotlights-remaining-population/summary#treatment
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
groups: ["eco"],
content: {
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
modal: "tab",
screens: [
{
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT_BACKUP",
content: {
logo: {
height: "152px",
imageURL:
"https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/c92a41e4-82cf-4ad5-8480-04a138bfb3cd.png",
},
title: {
fontSize: "24px",
string_id: "device-migration-fxa-spotlight-heavy-user-header",
letterSpacing: 0,
},
subtitle: {
fontSize: "15px",
string_id: "device-migration-fxa-spotlight-heavy-user-body",
lineHeight: "1.4",
marginBlock: "8px 20px",
letterSpacing: 0,
paddingInline: "20px",
},
dismiss_button: {
action: {
navigate: true,
},
},
primary_button: {
label: {
string_id:
"device-migration-fxa-spotlight-heavy-user-primary-button",
paddingBlock: "4px",
paddingInline: "16px",
},
action: {
data: {
args: "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/switching-devices?utm_source=spotlight-default&utm_medium=firefox-desktop&utm_campaign=migration&utm_content=dont-forget-to-backup&entrypoint=device-migration-spotlight-experiment-v2",
where: "tabshifted",
},
type: "OPEN_URL",
navigate: true,
},
},
},
},
],
backdrop: "transparent",
template: "multistage",
transitions: true,
},
trigger: {
id: "defaultBrowserCheck",
},
template: "spotlight",
frequency: {
lifetime: 1,
},
targeting:
"source == 'startup' && !willShowDefaultPrompt && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue && !usesFirefoxSync && !hasActiveEnterprisePolicies && userMonthlyActivity[userMonthlyActivity|length - 2][1]|date >= currentDate|date - (28 * 24 * 60 * 60 * 1000) && (((currentDate|date - profileAgeCreated|date) / 86400000 >= 168) || totalBookmarksCount >= 35)",
},
{
// Nimbus slug: device-migration-q4-spotlights-remaining-population:treatment (message 2 of 3)
// Version range: 122+
// Recipe: https://experimenter.services.mozilla.com/nimbus/device-migration-q4-spotlights-remaining-population/summary#treatment
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
groups: ["eco"],
content: {
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
modal: "tab",
screens: [
{
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT_PEACE",
content: {
logo: {
height: "133px",
imageURL:
"https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/4a56d3ed-98c8-4a33-b853-b2cf7646efd8.png",
marginBlock: "22px -10px",
},
title: {
fontSize: "24px",
string_id:
"device-migration-fxa-spotlight-older-device-header",
letterSpacing: 0,
},
subtitle: {
fontSize: "15px",
string_id: "device-migration-fxa-spotlight-older-device-body",
lineHeight: "1.4",
marginBlock: "8px 20px",
letterSpacing: 0,
paddingInline: "40px",
},
dismiss_button: {
action: {
navigate: true,
},
},
primary_button: {
label: {
string_id:
"device-migration-fxa-spotlight-older-device-primary-button",
marginBlock: "0 22px",
paddingBlock: "4px",
paddingInline: "16px",
},
action: {
data: {
args: "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/switching-devices?utm_source=spotlight-default&utm_medium=firefox-desktop&utm_campaign=migration&utm_content=peace-of-mind&entrypoint=device-migration-spotlight-experiment-v2",
where: "tabshifted",
},
type: "OPEN_URL",
navigate: true,
},
},
},
},
],
backdrop: "transparent",
template: "multistage",
transitions: true,
},
trigger: {
id: "defaultBrowserCheck",
},
template: "spotlight",
frequency: {
lifetime: 1,
},
targeting:
"source == 'startup' && !willShowDefaultPrompt && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue && !usesFirefoxSync && !hasActiveEnterprisePolicies && userMonthlyActivity[userMonthlyActivity|length - 2][1]|date >= currentDate|date - (28 * 24 * 60 * 60 * 1000) && !(((currentDate|date - profileAgeCreated|date) / 86400000 >= 168) || totalBookmarksCount >= 35) && os.isWindows && os.windowsVersion >= 6.1 && os.windowsBuildNumber < 22000",
},
{
// Nimbus slug: device-migration-q4-spotlights-remaining-population:treatment (message 3 of 3)
// Version range: 122+
// Recipe: https://experimenter.services.mozilla.com/nimbus/device-migration-q4-spotlights-remaining-population/summary#treatment
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
groups: ["eco"],
content: {
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT",
modal: "tab",
screens: [
{
id: "Q4_DEVICE_MIGRATION_BACKUP_SPOTLIGHT_NEW_DEVICE",
content: {
logo: {
height: "149px",
imageURL:
"https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/a43cd9cc-e8b2-477c-92f2-345557370de1.svg",
},
title: {
fontSize: "24px",
string_id:
"device-migration-fxa-spotlight-getting-new-device-header-2",
letterSpacing: 0,
},
subtitle: {
fontSize: "15px",
string_id:
"device-migration-fxa-spotlight-getting-new-device-body-2",
lineHeight: "1.4",
marginBlock: "8px 20px",
letterSpacing: 0,
paddingInline: "40px",
},
dismiss_button: {
action: {
navigate: true,
},
},
primary_button: {
label: {
string_id:
"device-migration-fxa-spotlight-getting-new-device-primary-button",
paddingBlock: "4px",
paddingInline: "16px",
},
action: {
data: {
args: "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/switching-devices?utm_source=spotlight-default&utm_medium=firefox-desktop&utm_campaign=migration&utm_content=new-device-in-your-future&entrypoint=device-migration-spotlight-experiment-v2",
where: "tabshifted",
},
type: "OPEN_URL",
navigate: true,
},
},
},
},
],
backdrop: "transparent",
template: "multistage",
transitions: true,
},
trigger: {
id: "defaultBrowserCheck",
},
template: "spotlight",
frequency: {
lifetime: 1,
},
targeting:
"source == 'startup' && !willShowDefaultPrompt && 'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue && !usesFirefoxSync && !hasActiveEnterprisePolicies && userMonthlyActivity[userMonthlyActivity|length - 2][1]|date >= currentDate|date - (28 * 24 * 60 * 60 * 1000) && !(((currentDate|date - profileAgeCreated|date) / 86400000 >= 168) || totalBookmarksCount >= 35) && !(os.isWindows && os.windowsVersion >= 6.1 && os.windowsBuildNumber < 22000)",
},
{
// Nimbus slug: fox-doodle-set-to-default-early-day-user-de-fr-it-treatment-a-rollout:treatment-a
// Version range: 116+

View File

@ -19,6 +19,7 @@ scripts:
lint: =>lint
build: =>bundle:admin
unit: karma start karma.mc.config.js
import: =>import-rollouts
tddmc: karma start karma.mc.config.js --tdd

View File

@ -8,6 +8,8 @@ browser/components/asrouter/content/asrouter-admin.bundle.js
browser/components/asrouter/logs/
browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json
browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json
browser/components/asrouter/tests/InflightAssetsMessageProvider.sys.mjs
browser/components/asrouter/tests/NimbusRolloutMessageProvider.sys.mjs
browser/components/newtab/logs/
browser/components/newtab/node_modules/
browser/components/storybook/storybook-static/