Skip to content

Commit

Permalink
refactor: Add plugin type
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Sep 14, 2024
1 parent ab38f05 commit 3854ef4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/ChatBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Settings } from "../types/Settings";
import { Styles } from "../types/Styles";
import { Flow } from "../types/Flow";
import { Theme } from "../types/Theme";
import { Plugin } from "../types/Plugin";

/**
* Determines if user gave a provider or if one needs to be created, before rendering the chatbot.
Expand All @@ -28,7 +29,7 @@ const ChatBot = ({
settings?: Settings;
styles?: Styles;
themes?: undefined | Theme | Array<Theme>;
plugins?: Array<(...args: unknown[]) => unknown>;
plugins?: Array<Plugin>;
}) => {

// checks if the ChatBot is inside a provider
Expand Down
3 changes: 2 additions & 1 deletion src/components/ChatBotContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useBotEffectInternal } from "../hooks/internal/useBotEffectInternal";
import { useBotRefsContext } from "../context/BotRefsContext";
import { useSettingsContext } from "../context/SettingsContext";
import { useStylesContext } from "../context/StylesContext";
import { Plugin } from "../types/Plugin";

import "./ChatBotContainer.css";

Expand All @@ -25,7 +26,7 @@ import "./ChatBotContainer.css";
const ChatBotContainer = ({
plugins
}: {
plugins?: Array<(...args: unknown[]) => unknown>;
plugins?: Array<Plugin>;
}) => {

// loads plugins
Expand Down
4 changes: 4 additions & 0 deletions src/types/Plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Defines a plugin type.
*/
export type Plugin = (...args: unknown[]) => unknown;

0 comments on commit 3854ef4

Please sign in to comment.