|
1
|
import { |
|
2
|
subscriberSnippetGenerator, |
|
3
|
SubscriberSnippetGeneratorOptions, |
|
4
|
} from "./snippet-generators/subscriber" |
|
5
|
|
|
6
|
export type UseGenerateSnippet = { |
|
7
|
type: "subscriber" |
|
8
|
options: SubscriberSnippetGeneratorOptions |
|
9
|
} |
|
10
|
|
|
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
|
12
|
const generators: Record<string, (options: any) => string> = { |
|
13
|
subscriber: subscriberSnippetGenerator, |
|
14
|
} |
|
15
|
|
|
16
|
export const useGenerateSnippet = ({ type, options }: UseGenerateSnippet) => { |
|
17
|
const snippet = generators[type](options) |
|
18
|
|
|
19
|
return { |
|
20
|
snippet, |
|
21
|
} |
|
22
|
} |