|
| 1 | +import { Organization, Project, User } from "@src/types/models"; |
| 2 | +import { ClarityUtils } from "@utilities/clarity.utils"; |
| 3 | +import { DatadogUtils } from "@utilities/datadog.utils"; |
| 4 | + |
| 5 | +export const UserTrackingUtils = { |
| 6 | + setUser: (userId: string, userInfo: User) => { |
| 7 | + ClarityUtils.setUser(userId, userInfo); |
| 8 | + DatadogUtils.setUser(userId, userInfo); |
| 9 | + }, |
| 10 | + |
| 11 | + setOrg: (orgId: string, orgInfo: Organization) => { |
| 12 | + ClarityUtils.setOrg(orgId, orgInfo); |
| 13 | + DatadogUtils.setOrg(orgId, orgInfo); |
| 14 | + }, |
| 15 | + |
| 16 | + setProject: (projectId: string, projectInfo: Project) => { |
| 17 | + ClarityUtils.setProject(projectId, projectInfo); |
| 18 | + DatadogUtils.setProject(projectId, projectInfo); |
| 19 | + }, |
| 20 | + |
| 21 | + setUserRole: (role: string) => { |
| 22 | + ClarityUtils.setUserRole(role); |
| 23 | + DatadogUtils.setUserRole(role); |
| 24 | + }, |
| 25 | + |
| 26 | + setPlanType: (planType: string) => { |
| 27 | + ClarityUtils.setPlanType(planType); |
| 28 | + DatadogUtils.setPlanType(planType); |
| 29 | + }, |
| 30 | + |
| 31 | + setDeploymentId: (deploymentId: string) => { |
| 32 | + ClarityUtils.setDeploymentId(deploymentId); |
| 33 | + DatadogUtils.setDeploymentId(deploymentId); |
| 34 | + }, |
| 35 | + |
| 36 | + trackEvent: (eventName: string, properties?: Record<string, any>) => { |
| 37 | + ClarityUtils.trackEvent(eventName, properties); |
| 38 | + DatadogUtils.trackEvent(eventName, properties); |
| 39 | + }, |
| 40 | + |
| 41 | + setSessionId: (sessionId: string) => { |
| 42 | + ClarityUtils.setSessionId(sessionId); |
| 43 | + DatadogUtils.setSessionId(sessionId); |
| 44 | + }, |
| 45 | + |
| 46 | + setEventId: (eventId: string) => { |
| 47 | + ClarityUtils.setEventId(eventId); |
| 48 | + DatadogUtils.setEventId(eventId); |
| 49 | + }, |
| 50 | +}; |
0 commit comments