feat: introduce more events into the analytics pipeline (#3156)
This commit is contained in:
@@ -284,6 +284,14 @@ const importerAction = async (stepResults: StepReturnValue[]) => {
|
|||||||
emit("import-to-teams", result)
|
emit("import-to-teams", result)
|
||||||
} else {
|
} else {
|
||||||
appendRESTCollections(result)
|
appendRESTCollections(result)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_IMPORT_COLLECTION",
|
||||||
|
importer: importerModule.value!.name,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
fileImported()
|
fileImported()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ import {
|
|||||||
import { GQLError } from "~/helpers/backend/GQLClient"
|
import { GQLError } from "~/helpers/backend/GQLClient"
|
||||||
import { computedWithControl } from "@vueuse/core"
|
import { computedWithControl } from "@vueuse/core"
|
||||||
import { currentActiveTab } from "~/helpers/rest/tab"
|
import { currentActiveTab } from "~/helpers/rest/tab"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@@ -223,6 +224,13 @@ const saveRequestAs = async () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
requestSaved()
|
requestSaved()
|
||||||
} else if (picked.value.pickedType === "my-folder") {
|
} else if (picked.value.pickedType === "my-folder") {
|
||||||
if (!isHoppRESTRequest(requestUpdated))
|
if (!isHoppRESTRequest(requestUpdated))
|
||||||
@@ -243,6 +251,13 @@ const saveRequestAs = async () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
requestSaved()
|
requestSaved()
|
||||||
} else if (picked.value.pickedType === "my-request") {
|
} else if (picked.value.pickedType === "my-request") {
|
||||||
if (!isHoppRESTRequest(requestUpdated))
|
if (!isHoppRESTRequest(requestUpdated))
|
||||||
@@ -264,17 +279,38 @@ const saveRequestAs = async () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: false,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
requestSaved()
|
requestSaved()
|
||||||
} else if (picked.value.pickedType === "teams-collection") {
|
} else if (picked.value.pickedType === "teams-collection") {
|
||||||
if (!isHoppRESTRequest(requestUpdated))
|
if (!isHoppRESTRequest(requestUpdated))
|
||||||
throw new Error("requestUpdated is not a REST Request")
|
throw new Error("requestUpdated is not a REST Request")
|
||||||
|
|
||||||
updateTeamCollectionOrFolder(picked.value.collectionID, requestUpdated)
|
updateTeamCollectionOrFolder(picked.value.collectionID, requestUpdated)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
} else if (picked.value.pickedType === "teams-folder") {
|
} else if (picked.value.pickedType === "teams-folder") {
|
||||||
if (!isHoppRESTRequest(requestUpdated))
|
if (!isHoppRESTRequest(requestUpdated))
|
||||||
throw new Error("requestUpdated is not a REST Request")
|
throw new Error("requestUpdated is not a REST Request")
|
||||||
|
|
||||||
updateTeamCollectionOrFolder(picked.value.folderID, requestUpdated)
|
updateTeamCollectionOrFolder(picked.value.folderID, requestUpdated)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
} else if (picked.value.pickedType === "teams-request") {
|
} else if (picked.value.pickedType === "teams-request") {
|
||||||
if (!isHoppRESTRequest(requestUpdated))
|
if (!isHoppRESTRequest(requestUpdated))
|
||||||
throw new Error("requestUpdated is not a REST Request")
|
throw new Error("requestUpdated is not a REST Request")
|
||||||
@@ -292,6 +328,13 @@ const saveRequestAs = async () => {
|
|||||||
title: requestUpdated.name,
|
title: requestUpdated.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: false,
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
pipe(
|
pipe(
|
||||||
updateTeamRequest(picked.value.requestID, data),
|
updateTeamRequest(picked.value.requestID, data),
|
||||||
TE.match(
|
TE.match(
|
||||||
@@ -313,6 +356,13 @@ const saveRequestAs = async () => {
|
|||||||
requestUpdated as HoppGQLRequest
|
requestUpdated as HoppGQLRequest
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: false,
|
||||||
|
platform: "gql",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
requestSaved()
|
requestSaved()
|
||||||
} else if (picked.value.pickedType === "gql-my-folder") {
|
} else if (picked.value.pickedType === "gql-my-folder") {
|
||||||
// TODO: Check for GQL request ?
|
// TODO: Check for GQL request ?
|
||||||
@@ -321,6 +371,13 @@ const saveRequestAs = async () => {
|
|||||||
requestUpdated as HoppGQLRequest
|
requestUpdated as HoppGQLRequest
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "gql",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
requestSaved()
|
requestSaved()
|
||||||
} else if (picked.value.pickedType === "gql-my-collection") {
|
} else if (picked.value.pickedType === "gql-my-collection") {
|
||||||
// TODO: Check for GQL request ?
|
// TODO: Check for GQL request ?
|
||||||
@@ -329,6 +386,13 @@ const saveRequestAs = async () => {
|
|||||||
requestUpdated as HoppGQLRequest
|
requestUpdated as HoppGQLRequest
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "gql",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
requestSaved()
|
requestSaved()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import { useToast } from "@composables/toast"
|
|||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { HoppGQLRequest, makeCollection } from "@hoppscotch/data"
|
import { HoppGQLRequest, makeCollection } from "@hoppscotch/data"
|
||||||
import { addGraphqlCollection } from "~/newstore/collections"
|
import { addGraphqlCollection } from "~/newstore/collections"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -79,6 +80,13 @@ export default defineComponent({
|
|||||||
)
|
)
|
||||||
|
|
||||||
this.hideModal()
|
this.hideModal()
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_COLLECTION",
|
||||||
|
isRootCollection: true,
|
||||||
|
platform: "gql",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
},
|
},
|
||||||
hideModal() {
|
hideModal() {
|
||||||
this.name = null
|
this.name = null
|
||||||
|
|||||||
@@ -244,6 +244,14 @@ const importFromJSON = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
appendGraphqlCollections(collections)
|
appendGraphqlCollections(collections)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_IMPORT_COLLECTION",
|
||||||
|
importer: "json",
|
||||||
|
workspaceType: "personal",
|
||||||
|
platform: "gql",
|
||||||
|
})
|
||||||
|
|
||||||
fileImported()
|
fileImported()
|
||||||
}
|
}
|
||||||
reader.readAsText(inputChooseFileToImportFrom.value.files[0])
|
reader.readAsText(inputChooseFileToImportFrom.value.files[0])
|
||||||
@@ -257,6 +265,12 @@ const exportJSON = () => {
|
|||||||
const url = URL.createObjectURL(file)
|
const url = URL.createObjectURL(file)
|
||||||
a.href = url
|
a.href = url
|
||||||
|
|
||||||
|
platform?.analytics?.logEvent({
|
||||||
|
type: "HOPP_EXPORT_COLLECTION",
|
||||||
|
exporter: "json",
|
||||||
|
platform: "gql",
|
||||||
|
})
|
||||||
|
|
||||||
// TODO: get uri from meta
|
// TODO: get uri from meta
|
||||||
a.download = `${url.split("/").pop()!.split("#")[0].split("?")[0]}.json`
|
a.download = `${url.split("/").pop()!.split("#")[0].split("?")[0]}.json`
|
||||||
document.body.appendChild(a)
|
document.body.appendChild(a)
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ import IconArchive from "~icons/lucide/archive"
|
|||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useReadonlyStream } from "@composables/stream"
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
import { useColorMode } from "@composables/theming"
|
import { useColorMode } from "@composables/theming"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -277,6 +278,13 @@ export default defineComponent({
|
|||||||
response: "",
|
response: "",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
platform: "gql",
|
||||||
|
createdNow: true,
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
this.displayModalAddRequest(false)
|
this.displayModalAddRequest(false)
|
||||||
},
|
},
|
||||||
addRequest(payload) {
|
addRequest(payload) {
|
||||||
@@ -286,6 +294,14 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
onAddFolder({ name, path }) {
|
onAddFolder({ name, path }) {
|
||||||
addGraphqlFolder(name, path)
|
addGraphqlFolder(name, path)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_COLLECTION",
|
||||||
|
isRootCollection: false,
|
||||||
|
platform: "gql",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
this.displayModalAddFolder(false)
|
this.displayModalAddFolder(false)
|
||||||
},
|
},
|
||||||
addFolder(payload) {
|
addFolder(payload) {
|
||||||
|
|||||||
@@ -599,11 +599,25 @@ const addNewRootCollection = (name: string) => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_COLLECTION",
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "personal",
|
||||||
|
isRootCollection: true,
|
||||||
|
})
|
||||||
|
|
||||||
displayModalAdd(false)
|
displayModalAdd(false)
|
||||||
} else if (hasTeamWriteAccess.value) {
|
} else if (hasTeamWriteAccess.value) {
|
||||||
if (!collectionsType.value.selectedTeam) return
|
if (!collectionsType.value.selectedTeam) return
|
||||||
modalLoadingState.value = true
|
modalLoadingState.value = true
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_COLLECTION",
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "team",
|
||||||
|
isRootCollection: true,
|
||||||
|
})
|
||||||
|
|
||||||
pipe(
|
pipe(
|
||||||
createNewRootCollection(name, collectionsType.value.selectedTeam.id),
|
createNewRootCollection(name, collectionsType.value.selectedTeam.id),
|
||||||
TE.match(
|
TE.match(
|
||||||
@@ -652,6 +666,13 @@ const onAddRequest = (requestName: string) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
workspaceType: "personal",
|
||||||
|
createdNow: true,
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
displayModalAddRequest(false)
|
displayModalAddRequest(false)
|
||||||
} else if (hasTeamWriteAccess.value) {
|
} else if (hasTeamWriteAccess.value) {
|
||||||
const folder = editingFolder.value
|
const folder = editingFolder.value
|
||||||
@@ -667,6 +688,13 @@ const onAddRequest = (requestName: string) => {
|
|||||||
title: requestName,
|
title: requestName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
workspaceType: "team",
|
||||||
|
platform: "rest",
|
||||||
|
createdNow: true,
|
||||||
|
})
|
||||||
|
|
||||||
pipe(
|
pipe(
|
||||||
createRequestInCollection(folder.id, data),
|
createRequestInCollection(folder.id, data),
|
||||||
TE.match(
|
TE.match(
|
||||||
@@ -712,6 +740,14 @@ const onAddFolder = (folderName: string) => {
|
|||||||
if (collectionsType.value.type === "my-collections") {
|
if (collectionsType.value.type === "my-collections") {
|
||||||
if (!path) return
|
if (!path) return
|
||||||
addRESTFolder(folderName, path)
|
addRESTFolder(folderName, path)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_COLLECTION",
|
||||||
|
workspaceType: "personal",
|
||||||
|
isRootCollection: false,
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
displayModalAddFolder(false)
|
displayModalAddFolder(false)
|
||||||
} else if (hasTeamWriteAccess.value) {
|
} else if (hasTeamWriteAccess.value) {
|
||||||
const folder = editingFolder.value
|
const folder = editingFolder.value
|
||||||
@@ -719,6 +755,13 @@ const onAddFolder = (folderName: string) => {
|
|||||||
|
|
||||||
modalLoadingState.value = true
|
modalLoadingState.value = true
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_COLLECTION",
|
||||||
|
workspaceType: "personal",
|
||||||
|
isRootCollection: false,
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
pipe(
|
pipe(
|
||||||
createChildCollection(folderName, folder.id),
|
createChildCollection(folderName, folder.id),
|
||||||
TE.match(
|
TE.match(
|
||||||
@@ -1884,6 +1927,12 @@ const exportData = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const exportJSONCollection = async () => {
|
const exportJSONCollection = async () => {
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_EXPORT_COLLECTION",
|
||||||
|
exporter: "json",
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
await getJSONCollection()
|
await getJSONCollection()
|
||||||
|
|
||||||
initializeDownloadCollection(collectionJSON.value, null)
|
initializeDownloadCollection(collectionJSON.value, null)
|
||||||
@@ -1895,6 +1944,12 @@ const createCollectionGist = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_EXPORT_COLLECTION",
|
||||||
|
exporter: "gist",
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
creatingGistCollection.value = true
|
creatingGistCollection.value = true
|
||||||
await getJSONCollection()
|
await getJSONCollection()
|
||||||
|
|
||||||
@@ -1925,6 +1980,12 @@ const importToTeams = async (collection: HoppCollection<HoppRESTRequest>[]) => {
|
|||||||
|
|
||||||
importingMyCollections.value = true
|
importingMyCollections.value = true
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_EXPORT_COLLECTION",
|
||||||
|
exporter: "import-to-teams",
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
pipe(
|
pipe(
|
||||||
importJSONToTeam(
|
importJSONToTeam(
|
||||||
JSON.stringify(collection),
|
JSON.stringify(collection),
|
||||||
|
|||||||
@@ -190,6 +190,12 @@ const createEnvironmentGist = async () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
toast.success(t("export.gist_created").toString())
|
toast.success(t("export.gist_created").toString())
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_EXPORT_ENVIRONMENT",
|
||||||
|
platform: "rest",
|
||||||
|
})
|
||||||
|
|
||||||
window.open(res.data.html_url)
|
window.open(res.data.html_url)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast.error(t("error.something_went_wrong").toString())
|
toast.error(t("error.something_went_wrong").toString())
|
||||||
@@ -249,6 +255,13 @@ const openDialogChooseFileToImportFrom = () => {
|
|||||||
|
|
||||||
const importToTeams = async (content: Environment[]) => {
|
const importToTeams = async (content: Environment[]) => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_IMPORT_ENVIRONMENT",
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
for (const [i, env] of content.entries()) {
|
for (const [i, env] of content.entries()) {
|
||||||
if (i === content.length - 1) {
|
if (i === content.length - 1) {
|
||||||
await pipe(
|
await pipe(
|
||||||
@@ -301,6 +314,12 @@ const importFromJSON = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_IMPORT_ENVIRONMENT",
|
||||||
|
platform: "rest",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
|
|
||||||
reader.onload = ({ target }) => {
|
reader.onload = ({ target }) => {
|
||||||
@@ -352,6 +371,7 @@ const importFromPostman = ({
|
|||||||
const environment: Environment = { name, variables: [] }
|
const environment: Environment = { name, variables: [] }
|
||||||
values.forEach(({ key, value }) => environment.variables.push({ key, value }))
|
values.forEach(({ key, value }) => environment.variables.push({ key, value }))
|
||||||
const environments = [environment]
|
const environments = [environment]
|
||||||
|
|
||||||
importFromHoppscotch(environments)
|
importFromHoppscotch(environments)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ import { useToast } from "@composables/toast"
|
|||||||
import { useReadonlyStream } from "@composables/stream"
|
import { useReadonlyStream } from "@composables/stream"
|
||||||
import { useColorMode } from "@composables/theming"
|
import { useColorMode } from "@composables/theming"
|
||||||
import { environmentsStore } from "~/newstore/environments"
|
import { environmentsStore } from "~/newstore/environments"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
type EnvironmentVariable = {
|
type EnvironmentVariable = {
|
||||||
id: number
|
id: number
|
||||||
@@ -304,6 +305,11 @@ const saveEnvironment = () => {
|
|||||||
index: envList.value.length - 1,
|
index: envList.value.length - 1,
|
||||||
})
|
})
|
||||||
toast.success(`${t("environment.created")}`)
|
toast.success(`${t("environment.created")}`)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_ENVIRONMENT",
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
} else if (props.editingEnvironmentIndex === "Global") {
|
} else if (props.editingEnvironmentIndex === "Global") {
|
||||||
// Editing the Global environment
|
// Editing the Global environment
|
||||||
setGlobalEnvVariables(environmentUpdated.variables)
|
setGlobalEnvVariables(environmentUpdated.variables)
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ import IconTrash from "~icons/lucide/trash"
|
|||||||
import IconTrash2 from "~icons/lucide/trash-2"
|
import IconTrash2 from "~icons/lucide/trash-2"
|
||||||
import IconDone from "~icons/lucide/check"
|
import IconDone from "~icons/lucide/check"
|
||||||
import IconPlus from "~icons/lucide/plus"
|
import IconPlus from "~icons/lucide/plus"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
type EnvironmentVariable = {
|
type EnvironmentVariable = {
|
||||||
id: number
|
id: number
|
||||||
@@ -287,6 +288,11 @@ const saveEnvironment = async () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (props.action === "new") {
|
if (props.action === "new") {
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_ENVIRONMENT",
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
await pipe(
|
await pipe(
|
||||||
createTeamEnvironment(
|
createTeamEnvironment(
|
||||||
JSON.stringify(filterdVariables),
|
JSON.stringify(filterdVariables),
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ const onConnectClick = () => {
|
|||||||
if (!connected.value) {
|
if (!connected.value) {
|
||||||
props.conn.connect(url.value, headers.value as any, auth.value)
|
props.conn.connect(url.value, headers.value as any, auth.value)
|
||||||
|
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "graphql-schema",
|
platform: "graphql-schema",
|
||||||
strategy: getCurrentStrategyID(),
|
strategy: getCurrentStrategyID(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -741,7 +741,8 @@ const runQuery = async () => {
|
|||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "graphql-query",
|
platform: "graphql-query",
|
||||||
strategy: getCurrentStrategyID(),
|
strategy: getCurrentStrategyID(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ import IconCheck from "~icons/lucide/check"
|
|||||||
import IconWrapText from "~icons/lucide/wrap-text"
|
import IconWrapText from "~icons/lucide/wrap-text"
|
||||||
import { currentActiveTab } from "~/helpers/rest/tab"
|
import { currentActiveTab } from "~/helpers/rest/tab"
|
||||||
import cloneDeep from "lodash-es/cloneDeep"
|
import cloneDeep from "lodash-es/cloneDeep"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -247,6 +248,10 @@ watch(
|
|||||||
(goingToShow) => {
|
(goingToShow) => {
|
||||||
if (goingToShow) {
|
if (goingToShow) {
|
||||||
request.value = cloneDeep(currentActiveTab.value.document.request)
|
request.value = cloneDeep(currentActiveTab.value.document.request)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REST_CODEGEN_OPENED",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ import IconClipboard from "~icons/lucide/clipboard"
|
|||||||
import IconCheck from "~icons/lucide/check"
|
import IconCheck from "~icons/lucide/check"
|
||||||
import IconTrash2 from "~icons/lucide/trash-2"
|
import IconTrash2 from "~icons/lucide/trash-2"
|
||||||
import { currentActiveTab } from "~/helpers/rest/tab"
|
import { currentActiveTab } from "~/helpers/rest/tab"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -144,6 +145,10 @@ const handleImport = () => {
|
|||||||
try {
|
try {
|
||||||
const req = parseCurlToHoppRESTReq(text)
|
const req = parseCurlToHoppRESTReq(text)
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REST_IMPORT_CURL",
|
||||||
|
})
|
||||||
|
|
||||||
currentActiveTab.value.document.request = req
|
currentActiveTab.value.document.request = req
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|||||||
@@ -324,7 +324,8 @@ const newSendRequest = async () => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
// Log the request run into analytics
|
// Log the request run into analytics
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "rest",
|
platform: "rest",
|
||||||
strategy: getCurrentStrategyID(),
|
strategy: getCurrentStrategyID(),
|
||||||
})
|
})
|
||||||
@@ -446,6 +447,11 @@ const copyRequest = async () => {
|
|||||||
shareLink.value = ""
|
shareLink.value = ""
|
||||||
fetchingShareLink.value = true
|
fetchingShareLink.value = true
|
||||||
const shortcodeResult = await createShortcode(tab.value.document.request)()
|
const shortcodeResult = await createShortcode(tab.value.document.request)()
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SHORTCODE_CREATED",
|
||||||
|
})
|
||||||
|
|
||||||
if (E.isLeft(shortcodeResult)) {
|
if (E.isLeft(shortcodeResult)) {
|
||||||
toast.error(`${shortcodeResult.left.error}`)
|
toast.error(`${shortcodeResult.left.error}`)
|
||||||
shareLink.value = `${t("error.something_went_wrong")}`
|
shareLink.value = `${t("error.something_went_wrong")}`
|
||||||
@@ -516,6 +522,14 @@ const saveRequest = () => {
|
|||||||
editRESTRequest(saveCtx.folderPath, saveCtx.requestIndex, req)
|
editRESTRequest(saveCtx.folderPath, saveCtx.requestIndex, req)
|
||||||
|
|
||||||
tab.value.document.isDirty = false
|
tab.value.document.isDirty = false
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
platform: "rest",
|
||||||
|
createdNow: false,
|
||||||
|
workspaceType: "personal",
|
||||||
|
})
|
||||||
|
|
||||||
toast.success(`${t("request.saved")}`)
|
toast.success(`${t("request.saved")}`)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
tab.value.document.saveContext = undefined
|
tab.value.document.saveContext = undefined
|
||||||
@@ -526,6 +540,13 @@ const saveRequest = () => {
|
|||||||
|
|
||||||
// TODO: handle error case (NOTE: overwriteRequestTeams is async)
|
// TODO: handle error case (NOTE: overwriteRequestTeams is async)
|
||||||
try {
|
try {
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SAVE_REQUEST",
|
||||||
|
platform: "rest",
|
||||||
|
createdNow: false,
|
||||||
|
workspaceType: "team",
|
||||||
|
})
|
||||||
|
|
||||||
runMutation(UpdateRequestDocument, {
|
runMutation(UpdateRequestDocument, {
|
||||||
requestID: saveCtx.requestID,
|
requestID: saveCtx.requestID,
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import { createTeam } from "~/helpers/backend/mutations/Team"
|
|||||||
import { TeamNameCodec } from "~/helpers/backend/types/TeamName"
|
import { TeamNameCodec } from "~/helpers/backend/types/TeamName"
|
||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { useToast } from "@composables/toast"
|
import { useToast } from "@composables/toast"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -68,6 +69,12 @@ const addNewTeam = async () => {
|
|||||||
TE.fromEither,
|
TE.fromEither,
|
||||||
TE.mapLeft(() => "invalid_name" as const),
|
TE.mapLeft(() => "invalid_name" as const),
|
||||||
TE.chainW(createTeam),
|
TE.chainW(createTeam),
|
||||||
|
TE.chainFirstIOK(
|
||||||
|
() => () =>
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_CREATE_TEAM",
|
||||||
|
})
|
||||||
|
),
|
||||||
TE.match(
|
TE.match(
|
||||||
(err) => {
|
(err) => {
|
||||||
// err is of type "invalid_name" | GQLError<Err>
|
// err is of type "invalid_name" | GQLError<Err>
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ export class MQTTConnection {
|
|||||||
this.handleError(e)
|
this.handleError(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "mqtt",
|
platform: "mqtt",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ export class SIOConnection {
|
|||||||
this.handleError(error, "CONNECTION")
|
this.handleError(error, "CONNECTION")
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "socketio",
|
platform: "socketio",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ export class SSEConnection {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "sse",
|
platform: "sse",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ export class WSConnection {
|
|||||||
this.handleError(error as SyntaxError)
|
this.handleError(error as SyntaxError)
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.analytics?.logHoppRequestRunToAnalytics({
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REQUEST_RUN",
|
||||||
platform: "wss",
|
platform: "wss",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { refWithControl } from "@vueuse/core"
|
|||||||
import { HoppRESTResponse } from "../types/HoppRESTResponse"
|
import { HoppRESTResponse } from "../types/HoppRESTResponse"
|
||||||
import { getDefaultRESTRequest } from "./default"
|
import { getDefaultRESTRequest } from "./default"
|
||||||
import { HoppTestResult } from "../types/HoppTestResult"
|
import { HoppTestResult } from "../types/HoppTestResult"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
export type HoppRESTTab = {
|
export type HoppRESTTab = {
|
||||||
id: string
|
id: string
|
||||||
@@ -147,6 +148,10 @@ export function createNewTab(document: HoppRESTDocument, switchToIt = true) {
|
|||||||
currentTabID.value = id
|
currentTabID.value = id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_REST_NEW_TAB_OPENED",
|
||||||
|
})
|
||||||
|
|
||||||
return tab
|
return tab
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ import IconHome from "~icons/lucide/home"
|
|||||||
import IconRefreshCW from "~icons/lucide/refresh-cw"
|
import IconRefreshCW from "~icons/lucide/refresh-cw"
|
||||||
import { createNewTab } from "~/helpers/rest/tab"
|
import { createNewTab } from "~/helpers/rest/tab"
|
||||||
import { getDefaultRESTRequest } from "~/helpers/rest/default"
|
import { getDefaultRESTRequest } from "~/helpers/rest/default"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -120,6 +121,10 @@ const addRequestToTab = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform.analytics?.logEvent({
|
||||||
|
type: "HOPP_SHORTCODE_RESOLVED",
|
||||||
|
})
|
||||||
|
|
||||||
const request: unknown = JSON.parse(data.right.shortcode?.request as string)
|
const request: unknown = JSON.parse(data.right.shortcode?.request as string)
|
||||||
|
|
||||||
createNewTab({
|
createNewTab({
|
||||||
|
|||||||
@@ -5,8 +5,50 @@ export type HoppRequestEvent =
|
|||||||
}
|
}
|
||||||
| { platform: "wss" | "sse" | "socketio" | "mqtt" }
|
| { platform: "wss" | "sse" | "socketio" | "mqtt" }
|
||||||
|
|
||||||
|
export type AnalyticsEvent =
|
||||||
|
| ({ type: "HOPP_REQUEST_RUN" } & HoppRequestEvent)
|
||||||
|
| {
|
||||||
|
type: "HOPP_CREATE_ENVIRONMENT"
|
||||||
|
workspaceType: "personal" | "team"
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: "HOPP_CREATE_COLLECTION"
|
||||||
|
platform: "rest" | "gql"
|
||||||
|
isRootCollection: boolean
|
||||||
|
workspaceType: "personal" | "team"
|
||||||
|
}
|
||||||
|
| { type: "HOPP_CREATE_TEAM" }
|
||||||
|
| {
|
||||||
|
type: "HOPP_SAVE_REQUEST"
|
||||||
|
createdNow: boolean
|
||||||
|
workspaceType: "personal" | "team"
|
||||||
|
platform: "rest" | "gql"
|
||||||
|
}
|
||||||
|
| { type: "HOPP_SHORTCODE_CREATED" }
|
||||||
|
| { type: "HOPP_SHORTCODE_RESOLVED" }
|
||||||
|
| { type: "HOPP_REST_NEW_TAB_OPENED" }
|
||||||
|
| {
|
||||||
|
type: "HOPP_IMPORT_COLLECTION"
|
||||||
|
importer: string
|
||||||
|
workspaceType: "personal" | "team"
|
||||||
|
platform: "rest" | "gql"
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: "HOPP_IMPORT_ENVIRONMENT"
|
||||||
|
workspaceType: "personal" | "team"
|
||||||
|
platform: "rest" | "gql"
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: "HOPP_EXPORT_COLLECTION"
|
||||||
|
exporter: string
|
||||||
|
platform: "rest" | "gql"
|
||||||
|
}
|
||||||
|
| { type: "HOPP_EXPORT_ENVIRONMENT"; platform: "rest" | "gql" }
|
||||||
|
| { type: "HOPP_REST_CODEGEN_OPENED" }
|
||||||
|
| { type: "HOPP_REST_IMPORT_CURL" }
|
||||||
|
|
||||||
export type AnalyticsPlatformDef = {
|
export type AnalyticsPlatformDef = {
|
||||||
initAnalytics: () => void
|
initAnalytics: () => void
|
||||||
logHoppRequestRunToAnalytics: (ev: HoppRequestEvent) => void
|
logEvent: (ev: AnalyticsEvent) => void
|
||||||
logPageView: (pagePath: string) => void
|
logPageView: (pagePath: string) => void
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user