{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/testpilot/pulls/comments/72715223","id":72715223,"diff_hunk":"@@ -0,0 +1,135 @@\n+import app from 'ampersand-app';\n+import BaseView from './base-view';\n+import emailValidator from 'micro-email-validator';\n+\n+export default BaseView.extend({\n+  _template: `\n+  <div class=\"modal-container\">\n+    <div data-hook=\"first-page\" class=\"modal feedback-modal modal-bounce-in\">\n+      <header>\n+        <h3 class=\"title\" data-l10n-id=\"emailOptInDialogTitle\">Welcome to Test Pilot!</h3>\n+      </header>\n+      <form>\n+        <div class=\"modal-content modal-form centered\">\n+          <p data-l10n-id=\"emailOptInMessage\" class=\"\">Find out about new experiments and see test results for experiments you've tried.</p>\n+          <p class=\"error\" data-hook=\"invalid-email\" data-l10n-id=\"emailValidationError\" >Please use a valid email address!</p>\n+          <input data-hook=\"email\" data-l10n-id=\"emailOptInInput\" placeholder=\"email goes here :)\">\n+        </div>\n+        <div class=\"modal-actions\">\n+          <button data-hook=\"submit-email\" data-l10n-id=\"emailOptInButton\" class=\"submit button large default\">Sign me up</button>\n+          <a data-hook=\"cancel-modal\" data-l10n-id=\"emailOptInSkip\" class=\"cancel modal-escape\" href=\"\">Skip</a>\n+        </div>\n+      </form>\n+    </div>\n+    <div data-hook=\"second-page\" class=\"modal\">\n+      <header>\n+        <h3 class=\"title\" data-l10n-id=\"emailOptInConfirmationTitle\">Email Sent</h3>\n+      </header>\n+      <div class=\"modal-content centered\">\n+        <img class=\"email-icon\" src=\"/* TODO: add this image to the images dir */\">\n+        <p data-l10n-id=\"emailOptInSuccessMessage\">When you get a chance, head over to your inbox to verify your email address. Thank you!</p>\n+        <button class=\"button default\" data-hook=\"continue\" data-l10n-id=\"emailOptInConfirmationClose\">On to the experiments...</button>\n+      </div>\n+    </div>\n+  </div>\n+  `,\n+\n+  session: {\n+    isFirstPage: { type: 'boolean', default: true },\n+    isValidEmail: { type: 'boolean', default: true }\n+  },\n+\n+  bindings: {\n+    'isFirstPage': [\n+      {\n+        type: 'toggle',\n+        hook: 'first-page'\n+      },\n+      {\n+        type: 'toggle',\n+        hook: 'second-page',\n+        invert: true\n+      }\n+    ],\n+    'isValidEmail': {\n+      type: 'toggle',\n+      hook: 'invalid-email',\n+      invert: true\n+    }\n+  },\n+\n+  events: {\n+    'click button[data-hook=submit-email]': 'submit',\n+    'click [data-hook=cancel-modal]': 'skip',\n+    'click [data-hook=continue]': 'continue'\n+  },\n+\n+  submit(e) {\n+    e.preventDefault();\n+\n+    // TODO: should we log the number of email validity failures? worth tracking?\n+    const email = this.query('input[data-hook=email]').value;\n+    if (!this.validate(email)) {\n+      console.log('email is invalid.');\n+      this.set('isValidEmail', false);\n+      return;\n+    }\n+    // Hide the email validation error message, if it's visible.\n+    this.set('isValidEmail', true);\n+\n+    app.sendToGA('event', {\n+      eventCategory: 'HomePage Interactions',\n+      eventAction: 'button click',\n+      eventLabel: 'Sign me up'\n+    });\n+\n+    app.subscribeToBasket(email, () => {\n+      // TODO: review question: basket failures are swallowed by the subscribeToBasket\n+      // function. Is it worth it to send a second GA ping to help us monitor the error\n+      // rate? If so, should I overload the button click interaction, as done below, or\n+      // use some other kind of category / action?\n+      app.sendToGA('event', {\n+        eventCategory: 'HomePage Interactions',\n+        eventAction: 'button click',\n+        eventLabel: 'email submitted to basket'\n+      });\n+    });\n+\n+    this.set('isFirstPage', false);\n+  },\n+\n+  skip(e) {\n+    e.preventDefault();\n+    e.stopPropagation();\n+\n+    app.sendToGA('event', {\n+      eventCategory: 'HomePage Interactions',\n+      eventAction: 'button click',\n+      // review TODO: The label says 'skip'. Should I just use that? Want to make\n+      // the events readable and specific on the GA side.\n+      eventLabel: 'Skip email'\n+    });\n+\n+    this._close();\n+  },\n+\n+  continue(e) {\n+    e.preventDefault();\n+\n+    app.sendToGA('event', {\n+      eventCategory: 'HomePage Interactions',\n+      eventAction: 'button click',\n+      eventLabel: 'On to the experiments'\n+    });\n+\n+    this._close();\n+  },\n+\n+  validate(email) {\n+    return emailValidator(email);","path":"testpilot/frontend/static-src/app/views/email-opt-in-dialog-view.js","position":129,"original_position":129,"commit_id":"30a01f073ab34ba99ba4f462ca48840828c51a25","original_commit_id":"30a01f073ab34ba99ba4f462ca48840828c51a25","user":{"login":"ckprice","id":8632184,"avatar_url":"https://avatars.githubusercontent.com/u/8632184?v=3","gravatar_id":"","url":"https://api.github.com/users/ckprice","html_url":"https://github.com/ckprice","followers_url":"https://api.github.com/users/ckprice/followers","following_url":"https://api.github.com/users/ckprice/following{/other_user}","gists_url":"https://api.github.com/users/ckprice/gists{/gist_id}","starred_url":"https://api.github.com/users/ckprice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckprice/subscriptions","organizations_url":"https://api.github.com/users/ckprice/orgs","repos_url":"https://api.github.com/users/ckprice/repos","events_url":"https://api.github.com/users/ckprice/events{/privacy}","received_events_url":"https://api.github.com/users/ckprice/received_events","type":"User","site_admin":false},"body":"`bob@bob` passed this validator. Looks like basket through an error though.\r\n\r\n![email validator](https://d7zby7rwtzqe4.cloudfront.net/items/3b2J3z1c0Z401w3Y3W0A/Image%202016-07-28%20at%203.29.56%20PM.png?v=0a6aaf66)","created_at":"2016-07-28T22:31:59Z","updated_at":"2016-07-28T22:31:59Z","html_url":"https://github.com/mozilla/testpilot/pull/1148#discussion_r72715223","pull_request_url":"https://api.github.com/repos/mozilla/testpilot/pulls/1148","_links":{"self":{"href":"https://api.github.com/repos/mozilla/testpilot/pulls/comments/72715223"},"html":{"href":"https://github.com/mozilla/testpilot/pull/1148#discussion_r72715223"},"pull_request":{"href":"https://api.github.com/repos/mozilla/testpilot/pulls/1148"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/testpilot/pulls/1148","id":79272220,"html_url":"https://github.com/mozilla/testpilot/pull/1148","diff_url":"https://github.com/mozilla/testpilot/pull/1148.diff","patch_url":"https://github.com/mozilla/testpilot/pull/1148.patch","issue_url":"https://api.github.com/repos/mozilla/testpilot/issues/1148","number":1148,"state":"open","locked":false,"title":"Add email opt-in modal to homepage flow","user":{"login":"6a68","id":96396,"avatar_url":"https://avatars.githubusercontent.com/u/96396?v=3","gravatar_id":"","url":"https://api.github.com/users/6a68","html_url":"https://github.com/6a68","followers_url":"https://api.github.com/users/6a68/followers","following_url":"https://api.github.com/users/6a68/following{/other_user}","gists_url":"https://api.github.com/users/6a68/gists{/gist_id}","starred_url":"https://api.github.com/users/6a68/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/6a68/subscriptions","organizations_url":"https://api.github.com/users/6a68/orgs","repos_url":"https://api.github.com/users/6a68/repos","events_url":"https://api.github.com/users/6a68/events{/privacy}","received_events_url":"https://api.github.com/users/6a68/received_events","type":"User","site_admin":false},"body":"Fixes #1043.\r\n\r\n- Set a cookie on addon install click, then on the experiment list page, if the cookie's set, unset it and show the modal.\r\n- Basket is all wired up (I'm getting like 20 test pilot newsletters ;-)\r\n- pull in HTML5 email validation rules using `micro-email-validator`\r\n\r\nLooks like the image is missing from the commit, I'll fix that later today.","created_at":"2016-07-28T21:31:35Z","updated_at":"2016-07-28T22:31:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e86c608256322c20c2be45827308226a41943f76","assignee":{"login":"meandavejustice","id":1844554,"avatar_url":"https://avatars.githubusercontent.com/u/1844554?v=3","gravatar_id":"","url":"https://api.github.com/users/meandavejustice","html_url":"https://github.com/meandavejustice","followers_url":"https://api.github.com/users/meandavejustice/followers","following_url":"https://api.github.com/users/meandavejustice/following{/other_user}","gists_url":"https://api.github.com/users/meandavejustice/gists{/gist_id}","starred_url":"https://api.github.com/users/meandavejustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meandavejustice/subscriptions","organizations_url":"https://api.github.com/users/meandavejustice/orgs","repos_url":"https://api.github.com/users/meandavejustice/repos","events_url":"https://api.github.com/users/meandavejustice/events{/privacy}","received_events_url":"https://api.github.com/users/meandavejustice/received_events","type":"User","site_admin":false},"assignees":[{"login":"meandavejustice","id":1844554,"avatar_url":"https://avatars.githubusercontent.com/u/1844554?v=3","gravatar_id":"","url":"https://api.github.com/users/meandavejustice","html_url":"https://github.com/meandavejustice","followers_url":"https://api.github.com/users/meandavejustice/followers","following_url":"https://api.github.com/users/meandavejustice/following{/other_user}","gists_url":"https://api.github.com/users/meandavejustice/gists{/gist_id}","starred_url":"https://api.github.com/users/meandavejustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meandavejustice/subscriptions","organizations_url":"https://api.github.com/users/meandavejustice/orgs","repos_url":"https://api.github.com/users/meandavejustice/repos","events_url":"https://api.github.com/users/meandavejustice/events{/privacy}","received_events_url":"https://api.github.com/users/meandavejustice/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/testpilot/pulls/1148/commits","review_comments_url":"https://api.github.com/repos/mozilla/testpilot/pulls/1148/comments","review_comment_url":"https://api.github.com/repos/mozilla/testpilot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/testpilot/issues/1148/comments","statuses_url":"https://api.github.com/repos/mozilla/testpilot/statuses/30a01f073ab34ba99ba4f462ca48840828c51a25","head":{"label":"6a68:1043-email-opt-in-dialog","ref":"1043-email-opt-in-dialog","sha":"30a01f073ab34ba99ba4f462ca48840828c51a25","user":{"login":"6a68","id":96396,"avatar_url":"https://avatars.githubusercontent.com/u/96396?v=3","gravatar_id":"","url":"https://api.github.com/users/6a68","html_url":"https://github.com/6a68","followers_url":"https://api.github.com/users/6a68/followers","following_url":"https://api.github.com/users/6a68/following{/other_user}","gists_url":"https://api.github.com/users/6a68/gists{/gist_id}","starred_url":"https://api.github.com/users/6a68/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/6a68/subscriptions","organizations_url":"https://api.github.com/users/6a68/orgs","repos_url":"https://api.github.com/users/6a68/repos","events_url":"https://api.github.com/users/6a68/events{/privacy}","received_events_url":"https://api.github.com/users/6a68/received_events","type":"User","site_admin":false},"repo":{"id":42327425,"name":"testpilot","full_name":"6a68/testpilot","owner":{"login":"6a68","id":96396,"avatar_url":"https://avatars.githubusercontent.com/u/96396?v=3","gravatar_id":"","url":"https://api.github.com/users/6a68","html_url":"https://github.com/6a68","followers_url":"https://api.github.com/users/6a68/followers","following_url":"https://api.github.com/users/6a68/following{/other_user}","gists_url":"https://api.github.com/users/6a68/gists{/gist_id}","starred_url":"https://api.github.com/users/6a68/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/6a68/subscriptions","organizations_url":"https://api.github.com/users/6a68/orgs","repos_url":"https://api.github.com/users/6a68/repos","events_url":"https://api.github.com/users/6a68/events{/privacy}","received_events_url":"https://api.github.com/users/6a68/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/6a68/testpilot","description":"yay all the ideas","fork":true,"url":"https://api.github.com/repos/6a68/testpilot","forks_url":"https://api.github.com/repos/6a68/testpilot/forks","keys_url":"https://api.github.com/repos/6a68/testpilot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/6a68/testpilot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/6a68/testpilot/teams","hooks_url":"https://api.github.com/repos/6a68/testpilot/hooks","issue_events_url":"https://api.github.com/repos/6a68/testpilot/issues/events{/number}","events_url":"https://api.github.com/repos/6a68/testpilot/events","assignees_url":"https://api.github.com/repos/6a68/testpilot/assignees{/user}","branches_url":"https://api.github.com/repos/6a68/testpilot/branches{/branch}","tags_url":"https://api.github.com/repos/6a68/testpilot/tags","blobs_url":"https://api.github.com/repos/6a68/testpilot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/6a68/testpilot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/6a68/testpilot/git/refs{/sha}","trees_url":"https://api.github.com/repos/6a68/testpilot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/6a68/testpilot/statuses/{sha}","languages_url":"https://api.github.com/repos/6a68/testpilot/languages","stargazers_url":"https://api.github.com/repos/6a68/testpilot/stargazers","contributors_url":"https://api.github.com/repos/6a68/testpilot/contributors","subscribers_url":"https://api.github.com/repos/6a68/testpilot/subscribers","subscription_url":"https://api.github.com/repos/6a68/testpilot/subscription","commits_url":"https://api.github.com/repos/6a68/testpilot/commits{/sha}","git_commits_url":"https://api.github.com/repos/6a68/testpilot/git/commits{/sha}","comments_url":"https://api.github.com/repos/6a68/testpilot/comments{/number}","issue_comment_url":"https://api.github.com/repos/6a68/testpilot/issues/comments{/number}","contents_url":"https://api.github.com/repos/6a68/testpilot/contents/{+path}","compare_url":"https://api.github.com/repos/6a68/testpilot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/6a68/testpilot/merges","archive_url":"https://api.github.com/repos/6a68/testpilot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/6a68/testpilot/downloads","issues_url":"https://api.github.com/repos/6a68/testpilot/issues{/number}","pulls_url":"https://api.github.com/repos/6a68/testpilot/pulls{/number}","milestones_url":"https://api.github.com/repos/6a68/testpilot/milestones{/number}","notifications_url":"https://api.github.com/repos/6a68/testpilot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/6a68/testpilot/labels{/name}","releases_url":"https://api.github.com/repos/6a68/testpilot/releases{/id}","deployments_url":"https://api.github.com/repos/6a68/testpilot/deployments","created_at":"2015-09-11T19:11:37Z","updated_at":"2016-07-07T20:11:01Z","pushed_at":"2016-07-28T21:29:35Z","git_url":"git://github.com/6a68/testpilot.git","ssh_url":"git@github.com:6a68/testpilot.git","clone_url":"https://github.com/6a68/testpilot.git","svn_url":"https://github.com/6a68/testpilot","homepage":null,"size":12109,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"b57669da4265949cc2199d9739c20cf947720013","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":40625180,"name":"testpilot","full_name":"mozilla/testpilot","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/testpilot","description":"Test Pilot is a platform for performing controlled tests of new product concepts in Firefox","fork":false,"url":"https://api.github.com/repos/mozilla/testpilot","forks_url":"https://api.github.com/repos/mozilla/testpilot/forks","keys_url":"https://api.github.com/repos/mozilla/testpilot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/testpilot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/testpilot/teams","hooks_url":"https://api.github.com/repos/mozilla/testpilot/hooks","issue_events_url":"https://api.github.com/repos/mozilla/testpilot/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/testpilot/events","assignees_url":"https://api.github.com/repos/mozilla/testpilot/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/testpilot/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/testpilot/tags","blobs_url":"https://api.github.com/repos/mozilla/testpilot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/testpilot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/testpilot/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/testpilot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/testpilot/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/testpilot/languages","stargazers_url":"https://api.github.com/repos/mozilla/testpilot/stargazers","contributors_url":"https://api.github.com/repos/mozilla/testpilot/contributors","subscribers_url":"https://api.github.com/repos/mozilla/testpilot/subscribers","subscription_url":"https://api.github.com/repos/mozilla/testpilot/subscription","commits_url":"https://api.github.com/repos/mozilla/testpilot/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/testpilot/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/testpilot/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/testpilot/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/testpilot/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/testpilot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/testpilot/merges","archive_url":"https://api.github.com/repos/mozilla/testpilot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/testpilot/downloads","issues_url":"https://api.github.com/repos/mozilla/testpilot/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/testpilot/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/testpilot/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/testpilot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/testpilot/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/testpilot/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/testpilot/deployments","created_at":"2015-08-12T21:27:27Z","updated_at":"2016-06-28T05:43:40Z","pushed_at":"2016-07-28T21:31:35Z","git_url":"git://github.com/mozilla/testpilot.git","ssh_url":"git@github.com:mozilla/testpilot.git","clone_url":"https://github.com/mozilla/testpilot.git","svn_url":"https://github.com/mozilla/testpilot","homepage":"https://testpilot.firefox.com/","size":16781,"stargazers_count":37,"watchers_count":37,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":125,"forks":27,"open_issues":125,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/testpilot/pulls/1148"},"html":{"href":"https://github.com/mozilla/testpilot/pull/1148"},"issue":{"href":"https://api.github.com/repos/mozilla/testpilot/issues/1148"},"comments":{"href":"https://api.github.com/repos/mozilla/testpilot/issues/1148/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/testpilot/pulls/1148/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/testpilot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/testpilot/pulls/1148/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/testpilot/statuses/30a01f073ab34ba99ba4f462ca48840828c51a25"}}}}
{"actor":{"display_login":"ckprice"}}