implemented amplitude metrics (#1141)

This commit is contained in:
Danny Coates 2019-02-12 11:50:06 -08:00 committed by GitHub
parent 1a483cad55
commit 9b37e92a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 774 additions and 528 deletions

View file

@ -1,8 +1,9 @@
/* global LIMITS */
const html = require('choo/html');
const { bytes, platform } = require('../utils');
const { canceledSignup, submittedSignup } = require('../metrics');
module.exports = function() {
module.exports = function(trigger) {
return function(state, emit, close) {
const hidden = platform() === 'android' ? 'hidden' : '';
let submitting = false;
@ -37,7 +38,7 @@ module.exports = function() {
<button
class="my-4 text-blue hover:text-blue-dark focus:text-blue-darker font-medium"
title="${state.translate('deletePopupCancel')}"
onclick=${close}>${state.translate('deletePopupCancel')}
onclick=${cancel}>${state.translate('deletePopupCancel')}
</button>
</send-signup-dialog>`;
@ -50,6 +51,11 @@ module.exports = function() {
return a.length === 2 && a.every(s => s.length > 0);
}
function cancel(event) {
canceledSignup({ trigger });
close(event);
}
function submitEmail(event) {
event.preventDefault();
if (submitting) {
@ -59,6 +65,7 @@ module.exports = function() {
const el = document.getElementById('email-input');
const email = el.value;
submittedSignup({ trigger });
emit('login', emailish(email) ? email : null);
}
};