@@ -21,7 +21,7 @@ export const Registry = {
21
21
} ;
22
22
23
23
class AnalyticsPlatform {
24
- private static nodeJsPlatformMapping = {
24
+ private static nodeJsPlatformMapping : Record < string , any > = {
25
25
aix : 'desktop' ,
26
26
android : 'android' ,
27
27
darwin : 'mac' ,
@@ -107,8 +107,13 @@ export async function issueCommentEvent(site: DetailedSiteInfo): Promise<TrackEv
107
107
return instanceTrackEvent ( site , 'created' , 'issueComment' ) ;
108
108
}
109
109
110
- export async function issueWorkStartedEvent ( site : DetailedSiteInfo ) : Promise < TrackEvent > {
111
- return instanceTrackEvent ( site , 'workStarted' , 'issue' ) ;
110
+ export async function issueWorkStartedEvent (
111
+ site : DetailedSiteInfo ,
112
+ pushBranchToRemoteChecked : boolean ,
113
+ ) : Promise < TrackEvent > {
114
+ const attributesObject = instanceType ( { } , site ) ;
115
+ attributesObject . attributes . pushBranchToRemoteChecked = pushBranchToRemoteChecked ;
116
+ return instanceTrackEvent ( site , 'workStarted' , 'issue' , attributesObject ) ;
112
117
}
113
118
114
119
export async function issueUpdatedEvent (
@@ -164,7 +169,7 @@ export async function prCommentEvent(site: DetailedSiteInfo): Promise<TrackEvent
164
169
}
165
170
166
171
export async function prTaskEvent ( site : DetailedSiteInfo , source : string ) : Promise < TrackEvent > {
167
- const attributesObject : any = instanceType ( { } , site ) ;
172
+ const attributesObject = instanceType ( { } , site ) ;
168
173
attributesObject . attributes . source = source ;
169
174
return trackEvent ( 'created' , 'pullRequestComment' , attributesObject ) ;
170
175
}
@@ -657,33 +662,27 @@ function tenantOrNull<T>(e: Object, tenantId?: string): T {
657
662
return newObj as T ;
658
663
}
659
664
660
- function instanceType ( eventProps : Object , site ?: DetailedSiteInfo , product ?: Product ) : Object {
661
- let attrs : Object | undefined = undefined ;
662
- const newObj = eventProps ;
665
+ function instanceType (
666
+ eventProps : Record < string , any > ,
667
+ site ?: DetailedSiteInfo ,
668
+ product ?: Product ,
669
+ ) : Record < string , any > {
670
+ eventProps . attributes = eventProps . attributes || { } ;
663
671
664
672
if ( product ) {
665
- attrs = { hostProduct : product . name } ;
673
+ eventProps . attributes . hostProduct = product . name ;
666
674
}
667
675
668
676
if ( site && ! isEmptySiteInfo ( site ) ) {
669
- const instanceType : string = site . isCloud ? 'cloud' : 'server' ;
670
- attrs = { instanceType : instanceType , hostProduct : site . product . name } ;
677
+ eventProps . attributes . instanceType = instanceType ;
678
+ eventProps . attributes . hostProduct = site . product . name ;
671
679
}
672
680
673
- if ( attrs ) {
674
- newObj [ 'attributes' ] = { ...newObj [ 'attributes' ] , ...attrs } ;
675
- }
676
-
677
- return newObj ;
681
+ return eventProps ;
678
682
}
679
683
680
- function excludeFromActivity ( eventProps : Object ) : Object {
681
- const newObj = eventProps ;
682
-
683
- if ( newObj [ 'attributes' ] ) {
684
- newObj [ 'attributes' ] = { ...newObj [ 'attributes' ] , ...{ excludeFromActivity : true } } ;
685
- } else {
686
- Object . assign ( newObj , { attributes : { excludeFromActivity : true } } ) ;
687
- }
688
- return newObj ;
684
+ function excludeFromActivity ( eventProps : Record < string , any > ) : Record < string , any > {
685
+ eventProps . attributes = eventProps . attributes || { } ;
686
+ eventProps . attributes . excludeFromActivity = true ;
687
+ return eventProps ;
689
688
}
0 commit comments