Skip to content

Commit

Permalink
chore: add event for workspace environment type [no-ticket] (Kong#7602)
Browse files Browse the repository at this point in the history
* chore: add event for workspace environment type [no-ticket]

* fix lint
  • Loading branch information
filfreire authored and stefancruz committed Jun 30, 2024
1 parent 2094687 commit 67a4016
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/insomnia/src/ui/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum SegmentEvent {
dataImport = 'Data Imported',
documentCreate = 'Document Created',
mockCreate = 'Mock Created',
environmentWorkspaceCreate = 'Environment Workspace Created',
loginSuccess = 'Login Success',
inviteTrigger = 'Invite Triggered From App',
exportAllCollections = 'Exported All Collections',
Expand Down
10 changes: 6 additions & 4 deletions packages/insomnia/src/ui/routes/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { isRequestGroupMeta } from '../../models/request-group-meta';
import { UnitTest } from '../../models/unit-test';
import { UnitTestSuite } from '../../models/unit-test-suite';
import { WebSocketRequest } from '../../models/websocket-request';
import { isCollection, isMockServer, scopeToActivity, Workspace } from '../../models/workspace';
import { isCollection, isEnvironment, scopeToActivity, Workspace } from '../../models/workspace';
import { WorkspaceMeta } from '../../models/workspace-meta';
import { getSendRequestCallback } from '../../network/unit-test-feature';
import { initializeLocalBackendProjectAndMarkForSync } from '../../sync/vcs/initialize-backend-project';
Expand Down Expand Up @@ -370,7 +370,9 @@ export const createNewWorkspaceAction: ActionFunction = async ({
workspace,
});
}

window.main.trackSegmentEvent({
event: SegmentEvent.mockCreate,
});
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspace._id}/${scopeToActivity(workspace.scope)}`);
}

Expand Down Expand Up @@ -398,8 +400,8 @@ export const createNewWorkspaceAction: ActionFunction = async ({

if (isCollection(workspace)) {
event = SegmentEvent.collectionCreate;
} else if (isMockServer(workspace)) {
event = SegmentEvent.mockCreate;
} else if (isEnvironment(workspace)) {
event = SegmentEvent.environmentWorkspaceCreate;
}

window.main.trackSegmentEvent({
Expand Down

0 comments on commit 67a4016

Please sign in to comment.