Compare commits

..

3 Commits

Author SHA1 Message Date
ankitsridhar16
596ea7e364 chore: update variable names 2023-06-22 23:35:58 +05:30
ankitsridhar16
2c7f5f6173 fix: add check for existing invitation for the invitee and revoke 2023-06-22 23:35:58 +05:30
ankitsridhar16
f19dc700ef refactor: add service method to take invitee email and team ID as string to fetch invitation 2023-06-22 23:35:58 +05:30
37 changed files with 39 additions and 339 deletions

View File

@@ -31,7 +31,6 @@ MICROSOFT_CLIENT_ID="************************************************"
MICROSOFT_CLIENT_SECRET="************************************************" MICROSOFT_CLIENT_SECRET="************************************************"
MICROSOFT_CALLBACK_URL="http://localhost:3170/v1/auth/microsoft/callback" MICROSOFT_CALLBACK_URL="http://localhost:3170/v1/auth/microsoft/callback"
MICROSOFT_SCOPE="user.read" MICROSOFT_SCOPE="user.read"
MICROSOFT_TENANT="common"
# Mailer config # Mailer config
MAILER_SMTP_URL="smtps://user@domain.com:pass@smtp.domain.com" MAILER_SMTP_URL="smtps://user@domain.com:pass@smtp.domain.com"

View File

@@ -1,6 +1,6 @@
{ {
"name": "hoppscotch-backend", "name": "hoppscotch-backend",
"version": "2023.4.7", "version": "2023.4.6",
"description": "", "description": "",
"author": "", "author": "",
"private": true, "private": true,

View File

@@ -17,7 +17,7 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy) {
clientSecret: process.env.MICROSOFT_CLIENT_SECRET, clientSecret: process.env.MICROSOFT_CLIENT_SECRET,
callbackURL: process.env.MICROSOFT_CALLBACK_URL, callbackURL: process.env.MICROSOFT_CALLBACK_URL,
scope: [process.env.MICROSOFT_SCOPE], scope: [process.env.MICROSOFT_SCOPE],
tenant: process.env.MICROSOFT_TENANT, passReqToCallback: true,
store: true, store: true,
}); });
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "@hoppscotch/common", "name": "@hoppscotch/common",
"private": true, "private": true,
"version": "2023.4.7", "version": "2023.4.6",
"scripts": { "scripts": {
"dev": "pnpm exec npm-run-all -p -l dev:*", "dev": "pnpm exec npm-run-all -p -l dev:*",
"dev:vite": "vite", "dev:vite": "vite",

View File

@@ -44,9 +44,8 @@
class="flex flex-col items-center justify-center p-4 text-secondaryLight" class="flex flex-col items-center justify-center p-4 text-secondaryLight"
> >
<icon-lucide-search class="pb-2 opacity-75 svg-icons" /> <icon-lucide-search class="pb-2 opacity-75 svg-icons" />
<span class="my-2 text-center flex flex-col"> <span class="my-2 text-center">
{{ t("state.nothing_found") }} {{ t("state.nothing_found") }} "{{ filterText }}"
<span class="break-all">"{{ filterText }}"</span>
</span> </span>
</div> </div>
</div> </div>

View File

@@ -284,14 +284,6 @@ 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()
} }
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col flex-1"> <div class="flex flex-col flex-1 bg-primaryContrast">
<div <div
class="sticky z-10 flex justify-between flex-1 border-b bg-primary border-dividerLight" class="sticky z-10 flex justify-between flex-1 border-b bg-primary border-dividerLight"
:style=" :style="

View File

@@ -89,7 +89,6 @@ 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()
@@ -224,13 +223,6 @@ 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))
@@ -251,13 +243,6 @@ 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))
@@ -279,38 +264,17 @@ 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")
@@ -328,13 +292,6 @@ 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(
@@ -356,13 +313,6 @@ 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 ?
@@ -371,13 +321,6 @@ 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 ?
@@ -386,13 +329,6 @@ const saveRequestAs = async () => {
requestUpdated as HoppGQLRequest requestUpdated as HoppGQLRequest
) )
platform.analytics?.logEvent({
type: "HOPP_SAVE_REQUEST",
createdNow: true,
platform: "gql",
workspaceType: "team",
})
requestSaved() requestSaved()
} }
} }

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col flex-1"> <div class="flex flex-col flex-1 bg-primaryContrast">
<div <div
class="sticky z-10 flex justify-between flex-1 border-b bg-primary border-dividerLight" class="sticky z-10 flex justify-between flex-1 border-b bg-primary border-dividerLight"
:style=" :style="

View File

@@ -46,7 +46,6 @@ 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: {
@@ -80,13 +79,6 @@ 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

View File

@@ -244,14 +244,6 @@ 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])
@@ -265,12 +257,6 @@ 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)

View File

@@ -153,7 +153,6 @@ 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: {
@@ -286,13 +285,6 @@ 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) {
@@ -302,14 +294,6 @@ 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) {

View File

@@ -599,25 +599,11 @@ 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(
@@ -666,13 +652,6 @@ 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
@@ -688,13 +667,6 @@ 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(
@@ -740,14 +712,6 @@ 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
@@ -755,13 +719,6 @@ 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(
@@ -1927,12 +1884,6 @@ 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)
@@ -1944,12 +1895,6 @@ 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()
@@ -1980,12 +1925,6 @@ 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),

View File

@@ -190,12 +190,6 @@ 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())
@@ -255,13 +249,6 @@ 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(
@@ -314,12 +301,6 @@ 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 }) => {
@@ -371,7 +352,6 @@ 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)
} }

View File

@@ -148,7 +148,6 @@ 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
@@ -312,11 +311,6 @@ 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)

View File

@@ -156,7 +156,6 @@ 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
@@ -295,11 +294,6 @@ 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),

View File

@@ -142,15 +142,15 @@
<div v-if="authType === 'basic'"> <div v-if="authType === 'basic'">
<div class="flex flex-1 border-b border-dividerLight"> <div class="flex flex-1 border-b border-dividerLight">
<SmartEnvInput <SmartEnvInput
:environmentHighlights="false"
v-model="basicUsername" v-model="basicUsername"
:environment-highlights="false"
:placeholder="t('authorization.username')" :placeholder="t('authorization.username')"
/> />
</div> </div>
<div class="flex flex-1 border-b border-dividerLight"> <div class="flex flex-1 border-b border-dividerLight">
<SmartEnvInput <SmartEnvInput
:environmentHighlights="false"
v-model="basicPassword" v-model="basicPassword"
:environment-highlights="false"
:placeholder="t('authorization.password')" :placeholder="t('authorization.password')"
/> />
</div> </div>
@@ -158,8 +158,8 @@
<div v-if="authType === 'bearer'"> <div v-if="authType === 'bearer'">
<div class="flex flex-1 border-b border-dividerLight"> <div class="flex flex-1 border-b border-dividerLight">
<SmartEnvInput <SmartEnvInput
:environmentHighlights="false"
v-model="bearerToken" v-model="bearerToken"
:environment-highlights="false"
placeholder="Token" placeholder="Token"
/> />
</div> </div>
@@ -167,8 +167,8 @@
<div v-if="authType === 'oauth-2'"> <div v-if="authType === 'oauth-2'">
<div class="flex flex-1 border-b border-dividerLight"> <div class="flex flex-1 border-b border-dividerLight">
<SmartEnvInput <SmartEnvInput
:environmentHighlights="false"
v-model="oauth2Token" v-model="oauth2Token"
:environment-highlights="false"
placeholder="Token" placeholder="Token"
/> />
</div> </div>
@@ -177,15 +177,15 @@
<div v-if="authType === 'api-key'"> <div v-if="authType === 'api-key'">
<div class="flex flex-1 border-b border-dividerLight"> <div class="flex flex-1 border-b border-dividerLight">
<SmartEnvInput <SmartEnvInput
:environmentHighlights="false"
v-model="apiKey" v-model="apiKey"
:environment-highlights="false"
placeholder="Key" placeholder="Key"
/> />
</div> </div>
<div class="flex flex-1 border-b border-dividerLight"> <div class="flex flex-1 border-b border-dividerLight">
<SmartEnvInput <SmartEnvInput
:environmentHighlights="false"
v-model="apiValue" v-model="apiValue"
:environment-highlights="false"
placeholder="Value" placeholder="Value"
/> />
</div> </div>

View File

@@ -59,8 +59,7 @@ 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?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "graphql-schema", platform: "graphql-schema",
strategy: getCurrentStrategyID(), strategy: getCurrentStrategyID(),
}) })

View File

@@ -748,8 +748,7 @@ const runQuery = async () => {
console.error(e) console.error(e)
} }
platform.analytics?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "graphql-query", platform: "graphql-query",
strategy: getCurrentStrategyID(), strategy: getCurrentStrategyID(),
}) })

View File

@@ -72,11 +72,9 @@
class="flex items-center justify-between flex-1 min-w-0 transition cursor-pointer focus:outline-none text-secondaryLight text-tiny group" class="flex items-center justify-between flex-1 min-w-0 transition cursor-pointer focus:outline-none text-secondaryLight text-tiny group"
> >
<span <span
class="inline-flex items-center justify-center px-4 py-2 transition group-hover:text-secondary truncate" class="inline-flex items-center justify-center px-4 py-2 transition group-hover:text-secondary"
> >
<icon-lucide-chevron-right <icon-lucide-chevron-right class="mr-2 indicator" />
class="mr-2 indicator flex flex-shrink-0"
/>
<span <span
:class="[ :class="[
{ 'capitalize-first': groupSelection === 'TIME' }, { 'capitalize-first': groupSelection === 'TIME' },

View File

@@ -165,7 +165,6 @@ 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()
@@ -249,10 +248,6 @@ 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",
})
} }
} }
) )

View File

@@ -338,7 +338,7 @@ watch(workingHeaders, (headersList) => {
// Sync logic between headers and working/bulk headers // Sync logic between headers and working/bulk headers
watch( watch(
() => request.value.headers, request.value.headers,
(newHeadersList) => { (newHeadersList) => {
// Sync should overwrite working headers // Sync should overwrite working headers
const filteredWorkingHeaders = pipe( const filteredWorkingHeaders = pipe(

View File

@@ -94,7 +94,6 @@ 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()
@@ -145,10 +144,6 @@ 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)

View File

@@ -324,8 +324,7 @@ const newSendRequest = async () => {
loading.value = true loading.value = true
// Log the request run into analytics // Log the request run into analytics
platform.analytics?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "rest", platform: "rest",
strategy: getCurrentStrategyID(), strategy: getCurrentStrategyID(),
}) })
@@ -447,11 +446,6 @@ 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")}`
@@ -522,14 +516,6 @@ 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
@@ -540,13 +526,6 @@ 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: {

View File

@@ -54,8 +54,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from "@composables/i18n" import { useI18n } from "@composables/i18n"
import { HoppRESTRequest } from "@hoppscotch/data" import { HoppRESTRequest } from "@hoppscotch/data"
import { useVModel } from "@vueuse/core" import { computed, ref, watch } from "vue"
import { computed, ref } from "vue"
export type RequestOptionTabs = export type RequestOptionTabs =
| "params" | "params"
@@ -71,7 +70,15 @@ const emit = defineEmits<{
(e: "update:modelValue", value: HoppRESTRequest): void (e: "update:modelValue", value: HoppRESTRequest): void
}>() }>()
const request = useVModel(props, "modelValue", emit) const request = ref(props.modelValue)
watch(
() => request.value,
(newVal) => {
emit("update:modelValue", newVal)
},
{ deep: true }
)
const selectedRealtimeTab = ref<RequestOptionTabs>("params") const selectedRealtimeTab = ref<RequestOptionTabs>("params")

View File

@@ -28,11 +28,9 @@
class="flex items-center justify-between flex-1 min-w-0 transition cursor-pointer focus:outline-none text-secondaryLight text-tiny group" class="flex items-center justify-between flex-1 min-w-0 transition cursor-pointer focus:outline-none text-secondaryLight text-tiny group"
> >
<span <span
class="inline-flex items-center justify-center px-4 py-2 transition group-hover:text-secondary truncate" class="inline-flex items-center justify-center px-4 py-2 transition group-hover:text-secondary"
> >
<icon-lucide-chevron-right <icon-lucide-chevron-right class="mr-2 indicator" />
class="mr-2 indicator flex flex-shrink-0"
/>
<span class="truncate capitalize-first"> <span class="truncate capitalize-first">
{{ t("environment.title") }} {{ t("environment.title") }}
</span> </span>

View File

@@ -44,7 +44,6 @@ 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()
@@ -69,12 +68,6 @@ 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>

View File

@@ -71,11 +71,9 @@ const parseURL = (urlText: string | number) =>
* @returns URL object * @returns URL object
*/ */
export function getURLObject(parsedArguments: parser.Arguments) { export function getURLObject(parsedArguments: parser.Arguments) {
const location = parsedArguments.location ?? undefined
return pipe( return pipe(
// contains raw url strings // contains raw url strings
[...parsedArguments._.slice(1), location], parsedArguments._.slice(1),
A.findFirstMap(parseURL), A.findFirstMap(parseURL),
// no url found // no url found
O.getOrElse(() => new URL(defaultRESTReq.endpoint)) O.getOrElse(() => new URL(defaultRESTReq.endpoint))

View File

@@ -105,8 +105,7 @@ export class MQTTConnection {
this.handleError(e) this.handleError(e)
} }
platform.analytics?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "mqtt", platform: "mqtt",
}) })
} }

View File

@@ -113,8 +113,7 @@ export class SIOConnection {
this.handleError(error, "CONNECTION") this.handleError(error, "CONNECTION")
} }
platform.analytics?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "socketio", platform: "socketio",
}) })
} }

View File

@@ -63,8 +63,7 @@ export class SSEConnection {
}) })
} }
platform.analytics?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "sse", platform: "sse",
}) })
} }

View File

@@ -71,8 +71,7 @@ export class WSConnection {
this.handleError(error as SyntaxError) this.handleError(error as SyntaxError)
} }
platform.analytics?.logEvent({ platform.analytics?.logHoppRequestRunToAnalytics({
type: "HOPP_REQUEST_RUN",
platform: "wss", platform: "wss",
}) })
} }

View File

@@ -6,7 +6,6 @@ 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
@@ -148,10 +147,6 @@ 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
} }

View File

@@ -84,7 +84,6 @@ 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()
@@ -121,10 +120,6 @@ 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({

View File

@@ -5,50 +5,8 @@ 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
logEvent: (ev: AnalyticsEvent) => void logHoppRequestRunToAnalytics: (ev: HoppRequestEvent) => void
logPageView: (pagePath: string) => void logPageView: (pagePath: string) => void
} }

View File

@@ -1,7 +1,7 @@
{ {
"name": "@hoppscotch/selfhost-web", "name": "@hoppscotch/selfhost-web",
"private": true, "private": true,
"version": "2023.4.7", "version": "2023.4.6",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev:vite": "vite", "dev:vite": "vite",

View File

@@ -1,7 +1,7 @@
{ {
"name": "hoppscotch-sh-admin", "name": "hoppscotch-sh-admin",
"private": true, "private": true,
"version": "2023.4.7", "version": "2023.4.6",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "pnpm exec npm-run-all -p -l dev:*", "dev": "pnpm exec npm-run-all -p -l dev:*",