@@ -2,7 +2,7 @@ import crypto from 'node:crypto';
22import os from 'node:os' ;
33import { PostHog } from 'posthog-node' ;
44import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb' ;
5- import { config , getBaseHeaders , getLoginDetails } from './config.js' ;
5+ import { config , getBaseHeaders } from './config.js' ;
66import { CreateClient } from './client/client.js' ;
77
88// Environment variables to allow opting out of telemetry
@@ -32,7 +32,7 @@ type PostHogFetchResponse = {
3232
3333type TelemetryIdentity = {
3434 userEmail ?: string ;
35- organizationSlug : string ;
35+ organizationId : string ;
3636} ;
3737
3838const buildPostHogOkResponse = ( ) => ( {
@@ -125,7 +125,7 @@ const getIdentity = async (): Promise<TelemetryIdentity> => {
125125 try {
126126 if ( ! apiClient ) {
127127 return {
128- organizationSlug : 'anonymous' ,
128+ organizationId : 'anonymous' ,
129129 } ;
130130 }
131131
@@ -138,7 +138,7 @@ const getIdentity = async (): Promise<TelemetryIdentity> => {
138138
139139 if ( resp . response ?. code === EnumStatusCode . OK ) {
140140 return {
141- organizationSlug : resp . organizationSlug ,
141+ organizationId : resp . organizationId || 'anonymous' ,
142142 userEmail : resp . userEmail || undefined ,
143143 } ;
144144 }
@@ -149,7 +149,7 @@ const getIdentity = async (): Promise<TelemetryIdentity> => {
149149 }
150150 }
151151 return {
152- organizationSlug : 'anonymous' ,
152+ organizationId : 'anonymous' ,
153153 } ;
154154} ;
155155
@@ -166,9 +166,9 @@ export const capture = async (eventName: string, properties: Record<string, any>
166166 const metadata = getMetadata ( ) ;
167167
168168 client . capture ( {
169- distinctId : identity . userEmail ?? identity . organizationSlug ,
169+ distinctId : identity . userEmail ?? identity . organizationId ,
170170 groups : {
171- orgslug : identity . organizationSlug ,
171+ cosmo_organization : identity . organizationId ?? '' ,
172172 } ,
173173 event : eventName ,
174174 properties : {
0 commit comments