mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
feat(salesforce): Sync Salesforce templates to files in the template folder
Summary: Add Salesforce analytics template fixes fix opportunity updating Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://review.inboxapp.com/D1483
This commit is contained in:
parent
eb2e1b81b5
commit
621b6a0473
1 changed files with 32 additions and 11 deletions
|
@ -8,11 +8,31 @@ NamespaceStore = require './namespace-store'
|
||||||
module.exports =
|
module.exports =
|
||||||
AnalyticsStore = Reflux.createStore
|
AnalyticsStore = Reflux.createStore
|
||||||
init: ->
|
init: ->
|
||||||
|
@listenAndTrack = (dispatcher=Actions) => (callback, action) =>
|
||||||
|
@listenTo dispatcher[action], (args...) =>
|
||||||
|
@track(action, callback(args...))
|
||||||
|
|
||||||
@analytics = Mixpanel.init("625e2300ef07cb4eb70a69b3638ca579")
|
@analytics = Mixpanel.init("625e2300ef07cb4eb70a69b3638ca579")
|
||||||
@listenTo NamespaceStore, => @identify()
|
@listenTo NamespaceStore, => @identify()
|
||||||
@identify()
|
@identify()
|
||||||
|
|
||||||
@_listenToActions()
|
@_listenToCoreActions()
|
||||||
|
|
||||||
|
@_setupGlobalPackageActions()
|
||||||
|
|
||||||
|
addPackageActions: (listeners, dispatcher=Actions) ->
|
||||||
|
_.each listeners, @listenAndTrack(dispatcher)
|
||||||
|
|
||||||
|
addGlobalPackageActions: (listeners) ->
|
||||||
|
@_globalPackageActions = _.extend @_globalPackageActions, listeners
|
||||||
|
|
||||||
|
_setupGlobalPackageActions: ->
|
||||||
|
@_globalPackageActions = {}
|
||||||
|
@listenTo Actions.sendToAllWindows, (actionData={}) =>
|
||||||
|
return unless atom.isMainWindow()
|
||||||
|
callback = @_globalPackageActions[actionData.action]
|
||||||
|
if callback?
|
||||||
|
@track(actionData.action, callback(actionData))
|
||||||
|
|
||||||
# We white list actions to track.
|
# We white list actions to track.
|
||||||
#
|
#
|
||||||
|
@ -25,12 +45,7 @@ AnalyticsStore = Reflux.createStore
|
||||||
#
|
#
|
||||||
# Only completely anonymous data essential to future metrics or
|
# Only completely anonymous data essential to future metrics or
|
||||||
# debugging may be sent.
|
# debugging may be sent.
|
||||||
actionsToTrack: ->
|
coreWindowActions: ->
|
||||||
logout: -> {}
|
|
||||||
fileAborted: (uploadData={}) -> {fileSize: uploadData.fileSize}
|
|
||||||
fileUploaded: (uploadData={}) -> {fileSize: uploadData.fileSize}
|
|
||||||
sendDraftError: (dId, msg) -> {drafLocalId: dId, error: msg}
|
|
||||||
sendDraftSuccess: ({draftLocalId}) -> {draftLocalId: draftLocalId}
|
|
||||||
showDeveloperConsole: -> {}
|
showDeveloperConsole: -> {}
|
||||||
composeReply: ({threadId, messageId}) -> {threadId, messageId}
|
composeReply: ({threadId, messageId}) -> {threadId, messageId}
|
||||||
composeForward: ({threadId, messageId}) -> {threadId, messageId}
|
composeForward: ({threadId, messageId}) -> {threadId, messageId}
|
||||||
|
@ -45,6 +60,13 @@ AnalyticsStore = Reflux.createStore
|
||||||
abortDownload: -> {}
|
abortDownload: -> {}
|
||||||
fileDownloaded: -> {}
|
fileDownloaded: -> {}
|
||||||
|
|
||||||
|
coreGlobalActions: ->
|
||||||
|
logout: -> {}
|
||||||
|
fileAborted: (uploadData={}) -> {fileSize: uploadData.fileSize}
|
||||||
|
fileUploaded: (uploadData={}) -> {fileSize: uploadData.fileSize}
|
||||||
|
sendDraftError: (dId, msg) -> {drafLocalId: dId, error: msg}
|
||||||
|
sendDraftSuccess: ({draftLocalId}) -> {draftLocalId: draftLocalId}
|
||||||
|
|
||||||
track: (action, data={}) ->
|
track: (action, data={}) ->
|
||||||
@analytics.track(action, _.extend(data, namespaceId: NamespaceStore.current()?.id))
|
@analytics.track(action, _.extend(data, namespaceId: NamespaceStore.current()?.id))
|
||||||
|
|
||||||
|
@ -58,7 +80,6 @@ AnalyticsStore = Reflux.createStore
|
||||||
"$last_name": namespace.me().lastName()
|
"$last_name": namespace.me().lastName()
|
||||||
"namespaceId": namespace.id
|
"namespaceId": namespace.id
|
||||||
|
|
||||||
_listenToActions: ->
|
_listenToCoreActions: ->
|
||||||
_.each @actionsToTrack(), (callback, action) =>
|
_.each @coreWindowActions(), @listenAndTrack()
|
||||||
@listenTo Actions[action], (args...) =>
|
_.each @coreGlobalActions(), @listenAndTrack() if atom.isMainWindow()
|
||||||
@track(action, callback(args...))
|
|
||||||
|
|
Loading…
Reference in a new issue