Bug 1276054 - Uplift pocket changes from partner. r=gijs, a=gchang
authorMichael Kaply <mozilla@kaply.com>
Tue, 05 Jul 2016 09:34:30 -0500
changeset 339905 193762e3a279d424023b85b0ac86f9bb0e0e1687
parent 339904 0ad38f4e2b4d6bb798fdb13b1fa53cfc8aebe2c7
child 339906 496264b64d722c9e8c6713d4244536b258979c16
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs, gchang
bugs1276054
milestone49.0a2
Bug 1276054 - Uplift pocket changes from partner. r=gijs, a=gchang
browser/components/uitour/test/browser.ini
browser/extensions/pocket/content/main.js
browser/extensions/pocket/content/panels/js/signup.js
browser/extensions/pocket/content/pktApi.jsm
browser/extensions/pocket/install.rdf.in
--- a/browser/components/uitour/test/browser.ini
+++ b/browser/components/uitour/test/browser.ini
@@ -35,13 +35,13 @@ skip-if = os == "linux" # Linux: Bug 986
 skip-if = true # Bug 1225832 - New Loop architecture is not compatible with test.
 [browser_UITour_loop_panel.js]
 [browser_UITour_modalDialog.js]
 skip-if = os != "mac" # modal dialog disabling only working on OS X.
 [browser_UITour_observe.js]
 [browser_UITour_panel_close_annotation.js]
 skip-if = true # Disabled due to frequent failures, bugs 1026310 and 1032137
 [browser_UITour_pocket.js]
-skip-if = os == "linux" || debug
+skip-if = true # Disabled pending removal of pocket UI Tour
 [browser_UITour_registerPageID.js]
 [browser_UITour_resetProfile.js]
 [browser_UITour_sync.js]
 [browser_UITour_toggleReaderMode.js]
--- a/browser/extensions/pocket/content/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -123,58 +123,70 @@ var pktUI = (function() {
 
 
     // -- Panel UI -- //
 
     /**
      * Show the sign-up panel
      */
     function showSignUp() {
+        // AB test: Direct logged-out users to tab vs panel
+        if (pktApi.getSignupPanelTabTestVariant() == 'tab')
+        {
+            let site = Services.prefs.getCharPref("extensions.pocket.site");
+            openTabWithUrl('https://' + site + '/firefox_learnmore?src=ff_ext&s=ffi&t=buttonclick', true);
+
+            // force the panel closed before it opens
+            // wrapped in setTimeout to avoid race condition after logging out
+            // if this test goes to 100%, we should move this logic up before
+            // the panel is actually opened
+            setTimeout(function() {
+                getPanel().hidePopup();
+            }, 0);
+
+            return;
+        }
+
+        // Control: Show panel as normal
         getFirefoxAccountSignedInUser(function(userdata)
         {
             var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0';
             var startheight = 490;
             var inOverflowMenu = isInOverflowMenu();
 
             if (inOverflowMenu)
             {
                 startheight = overflowMenuHeight;
             }
-            else if (pktApi.getSignupAB().indexOf('storyboard') > -1)
+            else
             {
                 startheight = 460;
                 if (fxasignedin == '1')
                 {
                     startheight = 406;
                 }
             }
-            else
-            {
-                if (fxasignedin == '1')
-                {
-                    startheight = 436;
-                }
-            }
             var variant;
             if (inOverflowMenu)
             {
                 variant = 'overflow';
             }
             else
             {
-                variant = pktApi.getSignupAB();
+                variant = 'storyboard_lm';
             }
+
             var panelId = showPanel("about:pocket-signup?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&fxasignedin=" + fxasignedin + "&variant=" + variant + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
                     onShow: function() {
                     },
                     onHide: panelDidHide,
                     width: inOverflowMenu ? overflowMenuWidth : 300,
                     height: startheight
-                });
             });
+        });
     }
 
     /**
      * Show the logged-out state / sign-up panel
      */
     function saveAndShowConfirmation(url, title) {
 
         // Validate input parameter
--- a/browser/extensions/pocket/content/panels/js/signup.js
+++ b/browser/extensions/pocket/content/panels/js/signup.js
@@ -99,38 +99,38 @@ PKT_SIGNUP_OVERLAY.prototype = {
         this.active = true;
 
         // set translations
         this.getTranslations();
         this.dictJSON.fxasignedin = this.fxasignedin ? 1 : 0;
         this.dictJSON.variant = (this.variant ? this.variant : 'undefined');
         this.dictJSON.variant += this.fxasignedin ? '_fxa' : '_nonfxa';
         this.dictJSON.pockethost = this.pockethost;
-        this.dictJSON.showlearnmore = (this.variant.indexOf('_lm') > -1 || this.variant == 'storyboard' || this.variant == 'hero') ? 1 : 0;
+        this.dictJSON.showlearnmore = true;
 
         // extra modifier class for collapsed state
         if (this.inoverflowmenu)
         {
             $('body').addClass('pkt_ext_signup_overflow');
         }
 
         // extra modifier class for language
         if (this.locale)
         {
             $('body').addClass('pkt_ext_signup_' + this.locale);
         }
 
         // Create actual content
-        if (this.variant == 'storyboard' || this.variant == 'storyboard_lm' || this.variant == 'storyboard_nlm')
+        if (this.variant == 'overflow')
         {
-            $('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON));
+            $('body').append(Handlebars.templates.signup_shell(this.dictJSON));
         }
         else
         {
-            $('body').append(Handlebars.templates.signup_shell(this.dictJSON));
+            $('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON));
         }
 
 
         // tell background we're ready
         thePKT_SIGNUP.sendMessage("show");
 
         // close events
         this.initCloseTabEvents();
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -604,43 +604,51 @@ var pktApi = (function() {
             success: options.success,
             error: options.error
         });
     }
 
     /**
      * Helper function to get current signup AB group the user is in
      */
-    function getSignupAB() {
-        var setting = getSetting('signupAB');
-        if (!setting || setting.includes('hero'))
+    function getSignupPanelTabTestVariant() {
+        return getSimpleTestOption('panelTab', 0.1, 'tab');
+    }
+
+    function getSimpleTestOption(testName, threshold, testOptionName) {
+        // Get the test from preferences if we've already assigned the user to a test
+        var settingName = 'test.' + testName;
+        var assignedValue = getSetting(settingName);
+
+        // If not assigned yet, pick and store a value
+        if (!assignedValue)
         {
-            var rand = (Math.floor(Math.random()*100+1));
-            if (rand > 90)
-            {
-                setting = 'storyboard_nlm';
+            if (Math.random() <= threshold) {
+                assignedValue = testOptionName;
             }
-            else
-            {
-                setting = 'storyboard_lm';
+            else {
+                assignedValue = 'control';
             }
-            setSetting('signupAB',setting);
+
+            setSetting('test.'+testName, assignedValue);
         }
-        return setting;
+
+        return assignedValue;
     }
 
+
     /**
      * Public functions
      */
     return {
         isUserLoggedIn : isUserLoggedIn,
         clearUserData: clearUserData,
         addLink: addLink,
         deleteItem: deleteItem,
         addTagsToItem: addTagsToItem,
         addTagsToURL: addTagsToURL,
         getTags: getTags,
         isPremiumUser: isPremiumUser,
         getSuggestedTagsForItem: getSuggestedTagsForItem,
         getSuggestedTagsForURL: getSuggestedTagsForURL,
-        getSignupAB: getSignupAB
+        getSignupPanelTabTestVariant: getSignupPanelTabTestVariant,
     };
 }());
--- a/browser/extensions/pocket/install.rdf.in
+++ b/browser/extensions/pocket/install.rdf.in
@@ -5,17 +5,17 @@
 
 #filter substitution
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>firefox@getpocket.com</em:id>
-    <em:version>1.0.3b1</em:version>
+    <em:version>1.0.4</em:version>
     <em:type>2</em:type>
     <em:bootstrap>true</em:bootstrap>
 
     <!-- Target Application this theme can install into,
         with minimum and maximum supported versions. -->
     <em:targetApplication>
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>