fix: track events issue and env variables fixes (#2184)

* fix: track event fixes

* fix: adding env variables to trubo
This commit is contained in:
sriram veeraghanta 2023-09-14 16:05:31 +05:30 committed by GitHub
parent a53b428bbd
commit 6659cfc8b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 903 additions and 971 deletions

View file

@ -3,9 +3,6 @@ import trackEventServices from "services/track-event.service";
import { ICurrentUserResponse } from "types";
import { API_BASE_URL } from "helpers/common.helper";
const trackEvent =
process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1";
class CSVIntegrationService extends APIService {
constructor() {
super(API_BASE_URL);
@ -21,14 +18,13 @@ class CSVIntegrationService extends APIService {
): Promise<any> {
return this.post(`/api/workspaces/${workspaceSlug}/export-issues/`, data)
.then((response) => {
if (trackEvent)
trackEventServices.trackExporterEvent(
{
workspaceSlug,
},
"CSV_EXPORTER_CREATE",
user
);
trackEventServices.trackExporterEvent(
{
workspaceSlug,
},
"CSV_EXPORTER_CREATE",
user
);
return response?.data;
})
.catch((error) => {

View file

@ -4,11 +4,6 @@ import { API_BASE_URL } from "helpers/common.helper";
import { ICurrentUserResponse, IGithubRepoInfo, IGithubServiceImportFormData } from "types";
const { NEXT_PUBLIC_API_BASE_URL } = process.env;
const trackEvent =
process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1";
const integrationServiceType: string = "github";
class GithubIntegrationService extends APIService {
constructor() {
@ -48,8 +43,7 @@ class GithubIntegrationService extends APIService {
data
)
.then((response) => {
if (trackEvent)
trackEventServices.trackImporterEvent(response?.data, "GITHUB_IMPORTER_CREATE", user);
trackEventServices.trackImporterEvent(response?.data, "GITHUB_IMPORTER_CREATE", user);
return response?.data;
})
.catch((error) => {

View file

@ -11,9 +11,6 @@ import {
} from "types";
import { API_BASE_URL } from "helpers/common.helper";
const trackEvent =
process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1";
class IntegrationService extends APIService {
constructor() {
super(API_BASE_URL);
@ -78,8 +75,7 @@ class IntegrationService extends APIService {
return this.delete(`/api/workspaces/${workspaceSlug}/importers/${service}/${importerId}/`)
.then((response) => {
const eventName = service === "github" ? "GITHUB_IMPORTER_DELETE" : "JIRA_IMPORTER_DELETE";
if (trackEvent) trackEventServices.trackImporterEvent(response?.data, eventName, user);
trackEventServices.trackImporterEvent(response?.data, eventName, user);
return response?.data;
})
.catch((error) => {

View file

@ -4,11 +4,6 @@ import { API_BASE_URL } from "helpers/common.helper";
// types
import { IJiraMetadata, IJiraResponse, IJiraImporterForm, ICurrentUserResponse } from "types";
const { NEXT_PUBLIC_API_BASE_URL } = process.env;
const trackEvent =
process.env.NEXT_PUBLIC_TRACK_EVENTS === "true" || process.env.NEXT_PUBLIC_TRACK_EVENTS === "1";
class JiraImportedService extends APIService {
constructor() {
super(API_BASE_URL);
@ -31,8 +26,7 @@ class JiraImportedService extends APIService {
): Promise<IJiraResponse> {
return this.post(`/api/workspaces/${workspaceSlug}/projects/importers/jira/`, data)
.then((response) => {
if (trackEvent)
trackEventServices.trackImporterEvent(response?.data, "JIRA_IMPORTER_CREATE", user);
trackEventServices.trackImporterEvent(response?.data, "JIRA_IMPORTER_CREATE", user);
return response?.data;
})
.catch((error) => {