diff --git a/browser/components/pocket/main.js b/browser/components/pocket/main.js
index 4ffc87b1a67..66b47abf557 100644
--- a/browser/components/pocket/main.js
+++ b/browser/components/pocket/main.js
@@ -294,7 +294,7 @@ var pktUI = (function() {
{
startheight = overflowMenuHeight;
}
- else if (pktApi.getSignupAB() == 'storyboard')
+ else if (pktApi.getSignupAB().indexOf('storyboard') > -1)
{
startheight = 460;
if (fxasignedin == '1')
diff --git a/browser/components/pocket/panels/css/signup.css b/browser/components/pocket/panels/css/signup.css
index 81086800a0b..e984d7204c0 100644
--- a/browser/components/pocket/panels/css/signup.css
+++ b/browser/components/pocket/panels/css/signup.css
@@ -108,6 +108,9 @@
.pkt_ext_containersignup .pkt_ext_learnmore {
font-size: 12px;
}
+.pkt_ext_containersignup .pkt_ext_learnmoreinactive {
+ visibility: hidden;
+}
.pkt_ext_signupdetail h4 {
font-size: 12px;
font-weight: normal;
@@ -356,6 +359,20 @@
.pkt_ext_signup_ru .signup-btn-firefox .text {
left: 15px;
}
+.pkt_ext_signup_de .signup-btn-firefox .logo,
+.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .logo,
+.pkt_ext_signup_ja .signup-btn-firefox .logo,
+.pkt_ext_signup_ru .signup-btn-firefox .logo {
+ height: 2.4em;
+}
+@media (min-resolution: 1.1dppx) {
+ .pkt_ext_signup_de .signup-btn-firefox .logo,
+ .pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .logo,
+ .pkt_ext_signup_ja .signup-btn-firefox .logo,
+ .pkt_ext_signup_ru .signup-btn-firefox .logo {
+ height: 2.5em;
+ }
+}
.pkt_ext_signup_de .signup-btn-email,
.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-email,
.pkt_ext_signup_ja .signup-btn-email,
diff --git a/browser/components/pocket/panels/js/saved.js b/browser/components/pocket/panels/js/saved.js
index c01ce8e8c6a..596aaefa01e 100644
--- a/browser/components/pocket/panels/js/saved.js
+++ b/browser/components/pocket/panels/js/saved.js
@@ -78,7 +78,7 @@ var PKT_SAVED_OVERLAY = function (options)
}
else if (resp.status == 'error') {
var msg = $('
');
- msg.text(resp.error);
+ msg.text(resp.error.message);
$('.pkt_ext_suggestedtag_detail').append(msg);
this.suggestedTagsLoaded = true;
if (!myself.mouseInside) {
@@ -315,7 +315,7 @@ var PKT_SAVED_OVERLAY = function (options)
thePKT_SAVED.sendMessage("addTags",
{
url: myself.savedUrl,
- tags: originaltags
+ tags: originaltags
}, function(resp)
{
if (resp.status == 'success')
@@ -324,7 +324,7 @@ var PKT_SAVED_OVERLAY = function (options)
}
else if (resp.status == 'error')
{
- $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error);
+ $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error.message);
}
});
});
@@ -348,7 +348,7 @@ var PKT_SAVED_OVERLAY = function (options)
myself.showStateFinalMsg(myself.dictJSON.pageremoved);
}
else if (resp.status == 'error') {
- $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error);
+ $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error.message);
}
});
}
diff --git a/browser/components/pocket/panels/js/signup.js b/browser/components/pocket/panels/js/signup.js
index 9979754d134..4600cbefd9f 100644
--- a/browser/components/pocket/panels/js/signup.js
+++ b/browser/components/pocket/panels/js/signup.js
@@ -188,6 +188,7 @@ PKT_SIGNUP_OVERLAY.prototype = {
this.dictJSON.fxasignedin = this.fxasignedin ? 1 : 0;
this.dictJSON.variant = (this.variant ? this.variant : 'undefined');
this.dictJSON.pockethost = this.pockethost;
+ this.dictJSON.showlearnmore = (this.variant.indexOf('_lm') > -1 || this.variant == 'storyboard' || this.variant == 'hero') ? 1 : 0;
// extra modifier class for collapsed state
if (this.inoverflowmenu)
@@ -202,7 +203,7 @@ PKT_SIGNUP_OVERLAY.prototype = {
}
// Create actual content
- if (this.variant == 'storyboard')
+ if (this.variant == 'storyboard' || this.variant == 'storyboard_lm' || this.variant == 'storyboard_nlm')
{
$('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON));
}
diff --git a/browser/components/pocket/panels/js/tmpl.js b/browser/components/pocket/panels/js/tmpl.js
index cf734c31278..469ccfc8456 100644
--- a/browser/components/pocket/panels/js/tmpl.js
+++ b/browser/components/pocket/panels/js/tmpl.js
@@ -29,74 +29,99 @@ templates['saved_shell'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":fun
},"useData":true});
templates['signup_shell'] = template({"1":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return "
"
- + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper)))
- + "
\n";
+ + "\" target=\"_blank\">"
+ + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
+ + "\n";
},"3":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
+ + "
\n";
+},"5":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " "
- + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper)))
- + "
\n "
+ + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper)))
+ + "
\n";
+},"7":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + "\" target=\"_blank\" class=\"btn signup-btn-firefox\">"
+ + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper)))
+ + "
\n "
+ escapeExpression(((helper = (helper = helpers.signupemail || (depth0 != null ? depth0.signupemail : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupemail","hash":{},"data":data}) : helper)))
+ "
\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "\n\n
"
+ + "\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "
\n \n\n
"
+ escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper)))
+ "
\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "
"
+ escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " "
+ + "\" target=\"_blank\">"
+ escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
+ ".
\n
";
},"useData":true});
templates['signupstoryboard_shell'] = template({"1":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " "
- + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper)))
- + "
\n";
+ + "\" target=\"_blank\">"
+ + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
+ + "\n";
},"3":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
+ + "
\n";
+},"5":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " "
- + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper)))
- + "
\n "
+ + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper)))
+ + "
\n";
+},"7":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + "\" target=\"_blank\" class=\"btn signup-btn-firefox\">"
+ + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper)))
+ + "
\n "
+ escapeExpression(((helper = (helper = helpers.signupemail || (depth0 != null ? depth0.signupemail : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupemail","hash":{},"data":data}) : helper)))
+ "
\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
@@ -104,24 +129,21 @@ templates['signupstoryboard_shell'] = template({"1":function(depth0,helpers,part
+ escapeExpression(((helper = (helper = helpers.taglinestory_one || (depth0 != null ? depth0.taglinestory_one : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"taglinestory_one","hash":{},"data":data}) : helper)))
+ "\n \n \n \n \n \n
\n
"
+ escapeExpression(((helper = (helper = helpers.taglinestory_two || (depth0 != null ? depth0.taglinestory_two : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"taglinestory_two","hash":{},"data":data}) : helper)))
- + "
\n
"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "
\n
\n
\n
\n\n\n
"
+ + "\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "
\n \n \n\n\n
"
+ escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper)))
+ "
\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "
"
+ escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " "
+ + "\" target=\"_blank\">"
+ escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
+ ".
\n
";
},"useData":true});
diff --git a/browser/components/pocket/panels/tmpl/signup_shell.handlebars b/browser/components/pocket/panels/tmpl/signup_shell.handlebars
index a12c611714a..6c60377f2fb 100644
--- a/browser/components/pocket/panels/tmpl/signup_shell.handlebars
+++ b/browser/components/pocket/panels/tmpl/signup_shell.handlebars
@@ -1,16 +1,20 @@
\ No newline at end of file
diff --git a/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars b/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars
index 0b2457bccdb..ff5b4090472 100644
--- a/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars
+++ b/browser/components/pocket/panels/tmpl/signupstoryboard_shell.handlebars
@@ -9,7 +9,11 @@
{{taglinestory_two}}
-
{{learnmore}}
+ {{#if showlearnmore}}
+
{{learnmore}}
+ {{else}}
+
{{learnmore}}
+ {{/if}}
@@ -17,10 +21,10 @@
\ No newline at end of file
diff --git a/browser/components/pocket/pktApi.js b/browser/components/pocket/pktApi.js
index 5bae2603ba1..d7f3c86b2d3 100644
--- a/browser/components/pocket/pktApi.js
+++ b/browser/components/pocket/pktApi.js
@@ -49,11 +49,8 @@ var pktApi = (function() {
*/
// Base url for all api calls
- // TODO: This is a dev server and will be changed before launch
- var pocketAPIhost = Services.prefs.getCharPref("browser.pocket.api");
- var pocketSiteHost = Services.prefs.getCharPref("browser.pocket.site");
-
- // Base url for all api calls
+ var pocketAPIhost = Services.prefs.getCharPref("browser.pocket.api"); // api.getpocket.com
+ var pocketSiteHost = Services.prefs.getCharPref("browser.pocket.site"); // getpocket.com
var baseAPIUrl = "https://" + pocketAPIhost + "/v3";
@@ -86,6 +83,23 @@ var pktApi = (function() {
return out;
}
+ var parseJSON = function(jsonString){
+ try {
+ var o = JSON.parse(jsonString);
+
+ // Handle non-exception-throwing cases:
+ // Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
+ // but... JSON.parse(null) returns 'null', and typeof null === "object",
+ // so we must check for that, too.
+ if (o && typeof o === "object" && o !== null) {
+ return o;
+ }
+ }
+ catch (e) { }
+
+ return undefined;
+ };
+
/**
* Settings
*/
@@ -173,6 +187,29 @@ var pktApi = (function() {
return pocketCookies['ftv1'];
}
+ /**
+ * Get the current premium status of the user
+ * @return {number | undefined} Premium status of user
+ */
+ function getPremiumStatus() {
+ var premiumStatus = getSetting("premium_status");
+ if (typeof premiumStatus === "undefined") {
+ // Premium status is not in settings try get it from cookie
+ var pocketCookies = getCookiesFromPocket();
+ premiumStatus = pocketCookies['ps'];
+ }
+ return premiumStatus;
+ }
+
+ /**
+ * Helper method to check if a user is premium or not
+ * @return {Boolean} Boolean if user is premium or not
+ */
+ function isPremiumUser() {
+ return getPremiumStatus() == 1;
+ }
+
+
/**
* Returns users logged in status
* @return {Boolean} Users logged in status
@@ -218,11 +255,16 @@ var pktApi = (function() {
request.onreadystatechange = function(e){
if (request.readyState == 4) {
if (request.status === 200) {
- if (options.success) {
- options.success(JSON.parse(request.response), request);
+ // There could still be an error if the response is no valid json
+ // or does not have status = 1
+ var response = parseJSON(request.response);
+ if (options.success && response && response.status == 1) {
+ options.success(response, request);
+ return;
}
- return;
}
+
+ // Handle error case
if (options.error) {
// In case the user did revoke the access token or it's not
// valid anymore clear the user data
@@ -231,7 +273,11 @@ var pktApi = (function() {
}
// Handle error message
- var errorMessage = request.getResponseHeader("X-Error") || request.statusText;
+ var errorMessage;
+ if (request.status !== 200) {
+ errorMessage = request.getResponseHeader("X-Error") || request.statusText;
+ errorMessage = JSON.parse('"' + errorMessage + '"');
+ }
var error = {message: errorMessage};
options.error(error, request);
}
@@ -509,13 +555,6 @@ var pktApi = (function() {
}
}
- /**
- * Helper method to check if a user is premium or not
- */
- function isPremiumUser() {
- return getSetting('premium_status') == 1;
- }
-
/**
* Fetch suggested tags for a given item id
* @param {string} itemId Item id of
@@ -565,14 +604,22 @@ var pktApi = (function() {
function getSignupAB() {
if (!getSetting('signupAB'))
{
- var rand = (Math.floor(Math.random()*2+1));
- if (rand == 2)
+ var rand = (Math.floor(Math.random()*100+1));
+ if (rand > 95)
{
- setSetting('signupAB','storyboard');
+ setSetting('signupAB','storyboard_nlm');
+ }
+ else if (rand > 90)
+ {
+ setSetting('signupAB','hero_nlm');
+ }
+ else if (rand > 45)
+ {
+ setSetting('signupAB','storyboard_lm');
}
else
{
- setSetting('signupAB','hero');
+ setSetting('signupAB','hero_lm');
}
}