-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2263 from mozilla/feature.signupCodes2, r=@philbooth
- Loading branch information
Showing
29 changed files
with
974 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
packages/fxa-content-server/app/scripts/lib/experiments/grouping-rules/signup-code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
'use strict'; | ||
|
||
const BaseGroupingRule = require('./base'); | ||
const Constants = require('../../../lib/constants'); | ||
const GROUPS_DEFAULT = ['control, treatment']; | ||
|
||
const ROLLOUT_CLIENTS = { | ||
'37fdfa37698f251a': { | ||
enableTestEmails: false, | ||
groups: GROUPS_DEFAULT, | ||
name: 'Lockbox Extension', | ||
rolloutRate: 0.0, | ||
}, | ||
'3c49430b43dfba77': { | ||
enableTestEmails: false, | ||
groups: GROUPS_DEFAULT, | ||
name: 'Android Components Reference Browser', | ||
rolloutRate: 0.0, | ||
}, | ||
'98adfa37698f255b': { | ||
enableTestEmails: true, | ||
groups: GROUPS_DEFAULT, | ||
name: 'Lockbox Extension iOS', | ||
rolloutRate: 0.0, | ||
}, | ||
ecdb5ae7add825d4: { | ||
enableTestEmails: false, | ||
groups: GROUPS_DEFAULT, | ||
name: 'TestClient', | ||
rolloutRate: 0.0, | ||
}, | ||
}; | ||
|
||
module.exports = class SignupCodeGroupingRule extends BaseGroupingRule { | ||
constructor() { | ||
super(); | ||
this.name = 'signupCode'; | ||
this.SYNC_ROLLOUT_RATE = 0.0; | ||
this.ROLLOUT_CLIENTS = ROLLOUT_CLIENTS; | ||
} | ||
|
||
choose(subject) { | ||
if ( | ||
!subject || | ||
!subject.uniqueUserId || | ||
!subject.experimentGroupingRules || | ||
!subject.isSignupCodeSupported || | ||
!subject.account | ||
) { | ||
return false; | ||
} | ||
|
||
const { featureFlags } = subject; | ||
|
||
if (subject.clientId) { | ||
let client = this.ROLLOUT_CLIENTS[subject.clientId]; | ||
if (featureFlags && featureFlags.signupCodeClients) { | ||
client = featureFlags.signupCodeClients[subject.clientId]; | ||
} | ||
|
||
if (client) { | ||
const groups = client.groups || GROUPS_DEFAULT; | ||
|
||
// Check if this client supports test emails | ||
if ( | ||
client.enableTestEmails && | ||
this.isTestEmail(subject.account.get('email')) | ||
) { | ||
return this.uniformChoice(groups, subject.uniqueUserId); | ||
} | ||
|
||
if (this.bernoulliTrial(client.rolloutRate, subject.uniqueUserId)) { | ||
return this.uniformChoice(groups, subject.uniqueUserId); | ||
} | ||
} | ||
|
||
// If a clientId was specified but not defined in the rollout configuration, the default | ||
// is to disable the experiment for them. | ||
return false; | ||
} | ||
|
||
if (subject.service && subject.service === Constants.SYNC_SERVICE) { | ||
let syncRolloutRate = this.SYNC_ROLLOUT_RATE; | ||
if (featureFlags && featureFlags.signupCodeClients) { | ||
syncRolloutRate = featureFlags.signupCodeClients.sync.rolloutRate; | ||
} | ||
|
||
if (this.bernoulliTrial(syncRolloutRate, subject.uniqueUserId)) { | ||
return this.uniformChoice(GROUPS_DEFAULT, subject.uniqueUserId); | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/fxa-content-server/app/scripts/templates/confirm_signup_code.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<div id="main-content" class="card confirm-signup"> | ||
<header> | ||
{{#isTrailhead}} | ||
<div class="step step-3"></div> | ||
{{/isTrailhead}} | ||
<h1 id="fxa-confirm-signup-code-header"> | ||
{{#serviceName}} | ||
<!-- L10N: For languages structured like English, the second phrase can read "to continue to %(serviceName)s" --> | ||
{{#t}}Enter verification code{{/t}} <span class="service">{{#t}}Continue to %(serviceName)s{{/t}}</span> | ||
{{/serviceName}} | ||
{{^serviceName}} | ||
{{#t}}Enter verification code{{/t}} | ||
{{/serviceName}} | ||
</h1> | ||
</header> | ||
|
||
<section> | ||
<div class="error"></div> | ||
<div class="success"></div> | ||
|
||
<div class="graphic graphic-mail"></div> | ||
|
||
<p class="verification-email-message">{{#unsafeTranslate}}Please enter the verification code that was sent to %(escapedEmail)s within 20 minutes.{{/unsafeTranslate}}</p> | ||
<form novalidate> | ||
<div class="input-row"> | ||
<input type="number" pattern="\d*" class="tooltip-below token-code" placeholder="{{#t}}Enter 6-digit code{{/t}}" required autofocus /> | ||
</div> | ||
<div class="button-row"> | ||
<button id="submit-btn" type="submit">{{#t}}Verify{{/t}}</button> | ||
</div> | ||
<div class="links"> | ||
<a id="resend" class="left delayed-fadein" href="#">{{#t}}Not in inbox or spam folder? Resend{{/t}}</a> | ||
</div> | ||
</form> | ||
</section> | ||
</div> |
Oops, something went wrong.