@@ -4,7 +4,11 @@ import {
44 TaskCompleteResponse ,
55} from './types' ;
66import { CodedActionAppServiceModel } from './coded-action-app.models' ;
7- import { ActionCenterEventNames , ActionCenterEventResponsePayload } from './types.internal' ;
7+ import {
8+ ActionCenterEventNames ,
9+ ActionCenterEventResponsePayload ,
10+ TaskWithCloudUserId ,
11+ } from './types.internal' ;
812import { telemetryClient , track } from './telemetry' ;
913import { loadFromMetaTags } from './telemetry/runtime' ;
1014
@@ -18,7 +22,12 @@ export class CodedActionAppService implements CodedActionAppServiceModel {
1822 private isCompletingTask = false ;
1923
2024 constructor ( ) {
21- telemetryClient . initialize ( loadFromMetaTags ( ) ?? undefined ) ;
25+ const metaConfig = loadFromMetaTags ( ) ;
26+ telemetryClient . initialize (
27+ metaConfig
28+ ? { ...metaConfig , orgId : metaConfig . orgName , tenantId : metaConfig . tenantName }
29+ : undefined ,
30+ ) ;
2231 }
2332
2433 /**
@@ -111,7 +120,10 @@ export class CodedActionAppService implements CodedActionAppServiceModel {
111120 clearTimeout ( timer ) ;
112121
113122 this . cleanup ( messageListener ) ;
114- resolve ( event . data ?. content as Task ) ;
123+
124+ const task = event . data ?. content as TaskWithCloudUserId ;
125+ telemetryClient . setUserId ( task ?. cloudUserId ?? '' ) ;
126+ resolve ( task ) ;
115127 } ;
116128
117129 const timer = setTimeout ( ( ) => {
0 commit comments