-
-
-
-
-
- {{ t(caption) }}
-
-
-
+
+
+
+
+
+
+ {{ t(caption) }}
+
+
+
+
+ {{ t(description) }}
+
+
+
+
Promise>
loading?: boolean
+ description?: string
}>(),
- { fetchLogic: undefined, loading: false }
+ { fetchLogic: undefined, loading: false, description: undefined }
)
const emit = defineEmits<{
diff --git a/packages/hoppscotch-common/src/components/importExport/types.ts b/packages/hoppscotch-common/src/components/importExport/types.ts
index 5df9d9404..a5aed5896 100644
--- a/packages/hoppscotch-common/src/components/importExport/types.ts
+++ b/packages/hoppscotch-common/src/components/importExport/types.ts
@@ -1,6 +1,14 @@
+import { HoppCollection } from "@hoppscotch/data"
import { Component, Ref } from "vue"
import { defineStep } from "~/composables/step-components"
+export type SupportedImportFormat =
+ | "hoppscotch"
+ | "postman"
+ | "insomnia"
+ | "openapi"
+ | "har"
+
// TODO: move the metadata except disabled and isLoading to importers.ts
export type ImporterOrExporter = {
metadata: {
@@ -11,6 +19,7 @@ export type ImporterOrExporter = {
disabled: boolean
applicableTo: Array<"personal-workspace" | "team-workspace" | "url-import">
isLoading?: Ref
+ format?: SupportedImportFormat
}
supported_sources?: {
id: string
@@ -18,6 +27,10 @@ export type ImporterOrExporter = {
icon: Component
step: ReturnType
}[]
+ importSummary?: Ref<{
+ showImportSummary: boolean
+ importedCollections: HoppCollection[] | null
+ }>
component?: ReturnType
action?: (...args: any[]) => any
onSelect?: () => boolean
diff --git a/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/FileSource.ts b/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/FileSource.ts
index e3c1ffcff..aed2ccffc 100644
--- a/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/FileSource.ts
+++ b/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/FileSource.ts
@@ -9,6 +9,7 @@ export function FileSource(metadata: {
caption: string
onImportFromFile: (content: string[]) => any | Promise
isLoading?: Ref
+ description?: string
}) {
const stepID = uuidv4()
@@ -17,5 +18,6 @@ export function FileSource(metadata: {
caption: metadata.caption,
onImportFromFile: metadata.onImportFromFile,
loading: metadata.isLoading?.value,
+ description: metadata.description,
}))
}
diff --git a/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/GistSource.ts b/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/GistSource.ts
index 1e273acec..7e3b5e738 100644
--- a/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/GistSource.ts
+++ b/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/GistSource.ts
@@ -14,11 +14,13 @@ export function GistSource(metadata: {
importResult: E.Either
) => any | Promise
isLoading?: Ref
+ description?: string
}) {
const stepID = uuidv4()
return defineStep(stepID, UrlImport, () => ({
caption: metadata.caption,
+ description: metadata.description,
onImportFromURL: (gistResponse: unknown) => {
const fileSchema = z.object({
files: z.record(z.object({ content: z.string() })),
diff --git a/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/UrlSource.ts b/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/UrlSource.ts
index 4c5ebde06..6bed2bcd6 100644
--- a/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/UrlSource.ts
+++ b/packages/hoppscotch-common/src/helpers/import-export/import/import-sources/UrlSource.ts
@@ -9,6 +9,7 @@ export function UrlSource(metadata: {
onImportFromURL: (content: string) => any | Promise
fetchLogic?: (url: string) => Promise
isLoading?: Ref
+ description: string
}) {
const stepID = uuidv4()
@@ -20,5 +21,6 @@ export function UrlSource(metadata: {
}
},
loading: metadata.isLoading?.value,
+ description: metadata.description,
}))
}