mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-22 12:35:59 +08:00
feat(analytics): update analytics libraries
Summary: See https://paper.dropbox.com/doc/Analytics-ID-Unification-oVDTkakFsiBBbk9aeuiA3 Test Plan: Manual Reviewers: juan, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2998
This commit is contained in:
parent
2501c78fbc
commit
7c870d7cd2
4 changed files with 24 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
/* eslint global-require: 0 */
|
||||
|
||||
import crypto from 'crypto';
|
||||
import {EdgehillAPI, NylasAPI, AccountStore, RegExpUtils} from 'nylas-exports';
|
||||
import {EdgehillAPI, NylasAPI, AccountStore, RegExpUtils, IdentityStore} from 'nylas-exports';
|
||||
import url from 'url';
|
||||
|
||||
function base64url(buf) {
|
||||
|
@ -59,15 +59,14 @@ export function buildGmailAuthURL(sessionKey) {
|
|||
});
|
||||
}
|
||||
|
||||
export function buildWelcomeURL(account) {
|
||||
export function buildWelcomeURL() {
|
||||
const identity = IdentityStore().identity();
|
||||
if (!identity) { NylasEnv.reportError(new Error("Can't find Nylas ID")) }
|
||||
return url.format({
|
||||
protocol: 'https',
|
||||
host: 'nylas.com/welcome',
|
||||
query: {
|
||||
n: base64url(NylasEnv.config.get("updateIdentity")),
|
||||
e: base64url(account.emailAddress),
|
||||
p: base64url(account.provider),
|
||||
a: base64url(account.id),
|
||||
n: base64url(id),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -51,6 +51,20 @@ class OnboardingStore extends NylasStore {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* User hits nylas.com for the first time and is given cookieId
|
||||
* All events must now be associated with cookieId or its current
|
||||
* alias.
|
||||
*
|
||||
* When this page is opened we pass our new Nylas ID. This will get
|
||||
* aliased to the current cookie on the page.
|
||||
*/
|
||||
_openWelcomePage() {
|
||||
// open the external welcome page
|
||||
const url = buildWelcomeURL(this._accountFromAuth);
|
||||
shell.openExternal(url, {activate: false});
|
||||
}
|
||||
|
||||
_onOnboardingComplete = () => {
|
||||
// When account JSON is received, we want to notify external services
|
||||
// that it succeeded. Unfortunately in this case we're likely to
|
||||
|
@ -93,6 +107,8 @@ class OnboardingStore extends NylasStore {
|
|||
const isFirstAccount = AccountStore.accounts().length === 0;
|
||||
|
||||
Actions.setNylasIdentity(json);
|
||||
this._openWelcomePage();
|
||||
Actions.recordUserEvent('Nylas Identity Set');
|
||||
|
||||
setTimeout(() => {
|
||||
if (isFirstAccount) {
|
||||
|
@ -123,10 +139,6 @@ class OnboardingStore extends NylasStore {
|
|||
if (isFirstAccount) {
|
||||
this._onMoveToPage('initial-preferences');
|
||||
Actions.recordUserEvent('First Account Linked');
|
||||
|
||||
// open the external welcome page
|
||||
const url = buildWelcomeURL(this._accountFromAuth);
|
||||
shell.openExternal(url, {activate: false});
|
||||
} else {
|
||||
this._onOnboardingComplete();
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ class DraftStore
|
|||
@listenTo Actions.sendQuickReply, @_onSendQuickReply
|
||||
|
||||
if NylasEnv.isMainWindow()
|
||||
ipcRenderer.on 'new-message', => @_onPopoutBlankDraft()
|
||||
ipcRenderer.on 'new-message', =>
|
||||
Actions.composeNewBlankDraft() # So Analytics can see it
|
||||
|
||||
# Remember that these two actions only fire in the current window and
|
||||
# are picked up by the instance of the DraftStore in the current
|
||||
|
|
2
src/pro
2
src/pro
|
@ -1 +1 @@
|
|||
Subproject commit 55757d08af0d431dd82899f0e53fda98b506f285
|
||||
Subproject commit 590b767ebcd186be0a932a08015fb3f1c67d947f
|
Loading…
Add table
Reference in a new issue