Bug 1596514 - Fix monitor dynamic triplets card targeting to use oauth client_id r=andreio,k88hudson
authorPunam Dahiya <punamdahiya@yahoo.com>
Tue, 19 Nov 2019 16:22:02 +0000
changeset 502650 c55086d8ed5e27323707b8b8d3f61c6571b936f6
parent 502649 56ac264094c4b16f4f27de706a48c56bd7e45b88
child 502651 b8ffac24c3db2ae823105413c56abbc18063fccf
push id100955
push userpdahiya@mozilla.com
push dateTue, 19 Nov 2019 16:34:58 +0000
treeherderautoland@c55086d8ed5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersandreio, k88hudson
bugs1596514
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596514 - Fix monitor dynamic triplets card targeting to use oauth client_id r=andreio,k88hudson Differential Revision: https://phabricator.services.mozilla.com/D53314
browser/components/newtab/content-src/asrouter/docs/targeting-attributes.md
browser/components/newtab/lib/OnboardingMessageProvider.jsm
--- a/browser/components/newtab/content-src/asrouter/docs/targeting-attributes.md
+++ b/browser/components/newtab/content-src/asrouter/docs/targeting-attributes.md
@@ -564,20 +564,20 @@ declare const userPrefs: {
 
 Information about connected services associated with the FxA Account.
 Return an empty array if no account is found or an error occurs.
 
 #### Definition
 
 ```
 interface OAuthClient {
+  // OAuth client_id of the service
+  // https://docs.telemetry.mozilla.org/datasets/fxa_metrics/attribution.html#service-attribution
   id: string;
-  // FxA service name
-  name: string;
-  lastAccessTime: UnixEpochNumber;
+  lastAccessedDaysAgo: number;
 }
 
 declare const attachedFxAOAuthClients: Promise<OAuthClient[]>
 ```
 
 #### Examples
 ```javascript
 {
--- a/browser/components/newtab/lib/OnboardingMessageProvider.jsm
+++ b/browser/components/newtab/lib/OnboardingMessageProvider.jsm
@@ -11,16 +11,17 @@ ChromeUtils.defineModuleGetter(
 ChromeUtils.defineModuleGetter(
   this,
   "AddonRepository",
   "resource://gre/modules/addons/AddonRepository.jsm"
 );
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const FIREFOX_VERSION = parseInt(Services.appinfo.version.match(/\d+/), 10);
 const ONE_MINUTE = 60 * 1000;
+const FX_MONITOR_CLIENT_ID = "802d56ef2a9af9fa";
 
 const L10N = new Localization([
   "branding/brand.ftl",
   "browser/branding/brandings.ftl",
   "browser/branding/sync-brand.ftl",
   "browser/newtab/onboarding.ftl",
 ]);
 
@@ -284,18 +285,19 @@ const ONBOARDING_MESSAGES = () => [
       primary_button: {
         label: { string_id: "onboarding-firefox-monitor-button" },
         action: {
           type: "OPEN_URL",
           data: { args: "https://monitor.firefox.com/", where: "tabshifted" },
         },
       },
     },
-    targeting:
-      "trailheadTriplet == 'supercharge' || (trailheadTriplet == 'dynamic' && !('Firefox Monitor' in attachedFxAOAuthClients|mapToProperty('name')))",
+    // Use service oauth client_id to identify 'Firefox Monitor' service attached to Firefox Account
+    // https://docs.telemetry.mozilla.org/datasets/fxa_metrics/attribution.html#service-attribution
+    targeting: `trailheadTriplet == 'supercharge' || (trailheadTriplet == 'dynamic' && !("${FX_MONITOR_CLIENT_ID}" in attachedFxAOAuthClients|mapToProperty('id')))`,
     trigger: { id: "showOnboarding" },
   },
   {
     id: "TRAILHEAD_CARD_4",
     template: "onboarding",
     bundled: 3,
     order: 3,
     content: {