Bug 1596514 - Fix monitor dynamic triplets card targeting to use oauth client_id r=andreio
☠☠ backed out by 7a519d43db7f ☠ ☠
authorPunam Dahiya <punamdahiya@yahoo.com>
Mon, 18 Nov 2019 17:29:25 +0000
changeset 502443 28e92798b7fba8f17c9facb00cc66d845ef73779
parent 502442 5ebe15b529320ffc221ba354b30f526cb1a84a75
child 502444 820aca345d9e018e23d3273ff0cb7d1b7883bff3
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersandreio
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 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,20 @@ const ONBOARDING_MESSAGES = () => [
       primary_button: {
         label: { string_id: "onboarding-firefox-monitor-button" },
         action: {
           type: "OPEN_URL",
           data: { args: "https://monitor.firefox.com/", where: "tabshifted" },
         },
       },
     },
+    // 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' && !('Firefox Monitor' in attachedFxAOAuthClients|mapToProperty('name')))",
+      "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: {