@bmx-labs/chat-widget 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat/ChatButton.d.ts +0 -3
- package/dist/components/chat/ChatPanel.d.ts +0 -6
- package/dist/components/chat/SettingsPanel.d.ts +1 -7
- package/dist/components/ogl/Orb.d.ts +3 -4
- package/dist/components/ogl/OrbButton.d.ts +0 -3
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/useChatSettings.d.ts +7 -0
- package/dist/hooks/useChatState.d.ts +14 -0
- package/dist/hooks/useClickOutside.d.ts +8 -0
- package/dist/hooks/useIsMobile.d.ts +1 -0
- package/dist/hooks/useKeyboardShortcuts.d.ts +11 -0
- package/dist/hooks/useLocalStorage.d.ts +1 -0
- package/dist/hooks/useMessageHandling.d.ts +12 -0
- package/dist/hooks/usePortal.d.ts +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
interface ChatButtonProps {
|
|
2
2
|
open: boolean;
|
|
3
3
|
onClick: () => void;
|
|
4
|
-
hue?: number;
|
|
5
|
-
hoverIntensity?: number;
|
|
6
|
-
rotateOnHover?: boolean;
|
|
7
4
|
forceHoverState?: boolean;
|
|
8
5
|
}
|
|
9
6
|
export declare const ChatButton: import("react").ForwardRefExoticComponent<ChatButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -13,12 +13,6 @@ interface ChatPanelProps {
|
|
|
13
13
|
showSettings: boolean;
|
|
14
14
|
onToggleSettings: () => void;
|
|
15
15
|
onClearHistory: () => void;
|
|
16
|
-
hue: number;
|
|
17
|
-
onHueChange: (hue: number) => void;
|
|
18
|
-
hoverIntensity: number;
|
|
19
|
-
onHoverIntensityChange: (intensity: number) => void;
|
|
20
|
-
rotateOnHover: boolean;
|
|
21
|
-
onRotateOnHoverChange: (rotate: boolean) => void;
|
|
22
16
|
onSuggestionClick?: (suggestion: string) => void;
|
|
23
17
|
}
|
|
24
18
|
export declare const ChatPanel: import("react").ForwardRefExoticComponent<ChatPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -3,12 +3,6 @@ interface SettingsPanelProps {
|
|
|
3
3
|
onClose: () => void;
|
|
4
4
|
onClearHistory: () => void;
|
|
5
5
|
history: ChatMessage[];
|
|
6
|
-
hue: number;
|
|
7
|
-
onHueChange: (hue: number) => void;
|
|
8
|
-
hoverIntensity: number;
|
|
9
|
-
onHoverIntensityChange: (intensity: number) => void;
|
|
10
|
-
rotateOnHover: boolean;
|
|
11
|
-
onRotateOnHoverChange: (rotate: boolean) => void;
|
|
12
6
|
}
|
|
13
|
-
export declare function SettingsPanel({ onClose, onClearHistory, history,
|
|
7
|
+
export declare function SettingsPanel({ onClose, onClearHistory, history, }: SettingsPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
14
8
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { ChatSettings } from "../../types";
|
|
1
2
|
interface OrbProps {
|
|
2
|
-
hue?: number;
|
|
3
|
-
hoverIntensity?: number;
|
|
4
|
-
rotateOnHover?: boolean;
|
|
5
3
|
forceHoverState?: boolean;
|
|
4
|
+
settings: ChatSettings;
|
|
6
5
|
}
|
|
7
|
-
export default function Orb({
|
|
6
|
+
export default function Orb({ settings, forceHoverState }: OrbProps): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
interface OrbButtonProps {
|
|
2
2
|
open: boolean;
|
|
3
3
|
onClick: () => void;
|
|
4
|
-
hue?: number;
|
|
5
|
-
hoverIntensity?: number;
|
|
6
|
-
rotateOnHover?: boolean;
|
|
7
4
|
forceHoverState?: boolean;
|
|
8
5
|
}
|
|
9
6
|
export declare const OrbButton: import("react").ForwardRefExoticComponent<OrbButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { useIsMobile } from "./useIsMobile";
|
|
2
|
+
export { useChatState } from "./useChatState";
|
|
3
|
+
export { useKeyboardShortcuts } from "./useKeyboardShortcuts";
|
|
4
|
+
export { useClickOutside } from "./useClickOutside";
|
|
5
|
+
export { useMessageHandling } from "./useMessageHandling";
|
|
6
|
+
export { usePortal } from "./usePortal";
|
|
7
|
+
export { useLocalStorage } from "./useLocalStorage";
|
|
8
|
+
export { useChatSettings } from "./useChatSettings";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChatSettings } from "../types";
|
|
2
|
+
export declare function useChatSettings(): {
|
|
3
|
+
settings: ChatSettings;
|
|
4
|
+
updateHue: (hue: number) => void;
|
|
5
|
+
updateHoverIntensity: (hoverIntensity: number) => void;
|
|
6
|
+
updateRotateOnHover: (rotateOnHover: boolean) => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChatMessage } from "../types";
|
|
2
|
+
interface UseChatStateProps {
|
|
3
|
+
storage?: "local" | "none";
|
|
4
|
+
storageKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function useChatState({ storage, storageKey, }: UseChatStateProps): {
|
|
7
|
+
messages: ChatMessage[];
|
|
8
|
+
setMessages: import("react").Dispatch<import("react").SetStateAction<ChatMessage[]>>;
|
|
9
|
+
sending: boolean;
|
|
10
|
+
setSending: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
11
|
+
clearHistory: () => void;
|
|
12
|
+
addMessage: (message: ChatMessage) => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface UseClickOutsideProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
widgetRef: React.RefObject<HTMLDivElement>;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
chatButtonRef: React.RefObject<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useClickOutside({ isOpen, widgetRef, onClose, chatButtonRef, }: UseClickOutsideProps): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsMobile: (breakpoint?: number) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface UseKeyboardShortcutsProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
showSettings: boolean;
|
|
4
|
+
onToggleChat: () => void;
|
|
5
|
+
onToggleSettings: () => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
chatButtonRef: React.RefObject<HTMLButtonElement>;
|
|
8
|
+
chatPanelRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare function useKeyboardShortcuts({ open, showSettings, onToggleChat, onToggleSettings, onClose, chatButtonRef, chatPanelRef, }: UseKeyboardShortcutsProps): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLocalStorage<T>(key: string, defaultValue: T): [T, (value: T) => void];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BmxChatApiAdapter, ChatMessage } from "../types";
|
|
2
|
+
interface UseMessageHandlingProps {
|
|
3
|
+
api: BmxChatApiAdapter;
|
|
4
|
+
messages: ChatMessage[];
|
|
5
|
+
projectId?: string;
|
|
6
|
+
setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;
|
|
7
|
+
setSending: React.Dispatch<React.SetStateAction<boolean>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function useMessageHandling({ api, messages, projectId, setMessages, setSending, }: UseMessageHandlingProps): {
|
|
10
|
+
sendMessage: (messageText: string) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
package/dist/index.d.ts
CHANGED