@gymmymac/bob-widget 1.0.2 → 1.1.2
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/Bob.d.ts +1 -24
- package/dist/components/mobile/MobileBobCharacter.d.ts +12 -0
- package/dist/components/mobile/MobileBobLayout.d.ts +35 -0
- package/dist/components/mobile/MobileChatDrawer.d.ts +19 -0
- package/dist/components/mobile/MobileProductColumn.d.ts +18 -0
- package/dist/components/mobile/index.d.ts +4 -0
- package/dist/hooks/useBobAnimation.d.ts +14 -0
- package/dist/hooks/useBobAnimationData.d.ts +53 -0
- package/dist/hooks/useBobBackdrop.d.ts +17 -0
- package/dist/hooks/useBobStateTransitions.d.ts +22 -0
- package/dist/hooks/useSpeechRecognition.d.ts +18 -0
- package/dist/index.d.ts +11 -30
- package/dist/index.js +13 -13
- package/dist/index.mjs +2305 -788
- package/dist/types/product.d.ts +12 -1
- package/package.json +4 -3
package/dist/components/Bob.d.ts
CHANGED
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
-
export type BobVariant = "inline" | "floating" | "fullscreen";
|
|
3
|
+
export type BobVariant = "inline" | "floating" | "fullscreen" | "mobile";
|
|
4
4
|
interface BobProps {
|
|
5
|
-
/** Display variant */
|
|
6
5
|
variant?: BobVariant;
|
|
7
|
-
/** Initial animation state */
|
|
8
6
|
initialState?: string;
|
|
9
|
-
/** Show chat interface */
|
|
10
7
|
showChat?: boolean;
|
|
11
|
-
/** Custom class name */
|
|
12
8
|
className?: string;
|
|
13
|
-
/** Backdrop image URL */
|
|
14
9
|
backdropUrl?: string;
|
|
15
|
-
/** Counter overlay image URL */
|
|
16
10
|
counterOverlayUrl?: string;
|
|
17
|
-
/** Counter height as percentage */
|
|
18
11
|
counterHeightPercent?: number;
|
|
19
|
-
/** Default Bob image when no animations loaded */
|
|
20
12
|
defaultBobImage?: string;
|
|
21
|
-
/** Vertical offset for Bob positioning */
|
|
22
13
|
verticalOffset?: number;
|
|
23
|
-
/** Scale factor for Bob (100 = 100%) */
|
|
24
14
|
scale?: number;
|
|
25
15
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Main Bob component - combines character animation and chat interface
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* <Bob
|
|
32
|
-
* variant="inline"
|
|
33
|
-
* showChat={true}
|
|
34
|
-
* backdropUrl="https://example.com/backdrop.png"
|
|
35
|
-
* counterOverlayUrl="https://example.com/counter.png"
|
|
36
|
-
* />
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
16
|
export declare const Bob: React.FC<BobProps>;
|
|
40
17
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MobileBobCharacterProps {
|
|
4
|
+
currentImage: string;
|
|
5
|
+
animationState: string;
|
|
6
|
+
counterOverlayUrl?: string;
|
|
7
|
+
counterHeightPercent?: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
position?: 'center' | 'left';
|
|
10
|
+
}
|
|
11
|
+
export declare const MobileBobCharacter: React.FC<MobileBobCharacterProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Message, HighlightedProduct } from '../../types/message';
|
|
3
|
+
import { Product, ServicePackage } from '../../types';
|
|
4
|
+
import { Vehicle } from '../../types/vehicle';
|
|
5
|
+
|
|
6
|
+
interface MobileBobLayoutProps {
|
|
7
|
+
currentImage: string;
|
|
8
|
+
animationState: string;
|
|
9
|
+
backdropUrl?: string;
|
|
10
|
+
counterOverlayUrl?: string;
|
|
11
|
+
counterHeightPercent?: number;
|
|
12
|
+
messages: Message[];
|
|
13
|
+
input: string;
|
|
14
|
+
setInput: (value: string) => void;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
onSend: () => void;
|
|
17
|
+
onKeyPress: (e: React.KeyboardEvent) => void;
|
|
18
|
+
onInputFocus: () => void;
|
|
19
|
+
onInputBlur: () => void;
|
|
20
|
+
chatEndRef: React.RefObject<HTMLDivElement>;
|
|
21
|
+
isMuted?: boolean;
|
|
22
|
+
onToggleMute?: () => void;
|
|
23
|
+
isSpeaking?: boolean;
|
|
24
|
+
products: Product[];
|
|
25
|
+
servicePackages: ServicePackage[];
|
|
26
|
+
highlightedPartType?: string | null;
|
|
27
|
+
highlightedProduct?: HighlightedProduct | null;
|
|
28
|
+
onProductClick?: (product: Product) => void;
|
|
29
|
+
onPackageSelect?: (pkg: ServicePackage) => void;
|
|
30
|
+
isResearching?: boolean;
|
|
31
|
+
vehicle?: Vehicle | null;
|
|
32
|
+
onChangeVehicle?: () => void;
|
|
33
|
+
}
|
|
34
|
+
export declare const MobileBobLayout: React.FC<MobileBobLayoutProps>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Message } from '../../types/message';
|
|
3
|
+
|
|
4
|
+
interface MobileChatDrawerProps {
|
|
5
|
+
messages: Message[];
|
|
6
|
+
input: string;
|
|
7
|
+
setInput: (value: string) => void;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
onSend: () => void;
|
|
10
|
+
onKeyPress: (e: React.KeyboardEvent) => void;
|
|
11
|
+
onInputFocus: () => void;
|
|
12
|
+
onInputBlur: () => void;
|
|
13
|
+
chatEndRef: React.RefObject<HTMLDivElement>;
|
|
14
|
+
isMuted?: boolean;
|
|
15
|
+
onToggleMute?: () => void;
|
|
16
|
+
isSpeaking?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const MobileChatDrawer: React.FC<MobileChatDrawerProps>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Product, ServicePackage } from '../../types';
|
|
3
|
+
import { HighlightedProduct } from '../../types/message';
|
|
4
|
+
|
|
5
|
+
interface MobileProductColumnProps {
|
|
6
|
+
products: Product[];
|
|
7
|
+
servicePackages: ServicePackage[];
|
|
8
|
+
highlightedPartType?: string | null;
|
|
9
|
+
highlightedProduct?: HighlightedProduct | null;
|
|
10
|
+
onProductClick?: (product: Product) => void;
|
|
11
|
+
onPackageSelect?: (pkg: ServicePackage) => void;
|
|
12
|
+
isResearching?: boolean;
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
counterHeightPercent?: number;
|
|
15
|
+
hasVehicle?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const MobileProductColumn: React.FC<MobileProductColumnProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type AnimationState = string;
|
|
2
|
+
export declare const useBobAnimation: () => {
|
|
3
|
+
animationState: string;
|
|
4
|
+
setAnimationState: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
5
|
+
getCurrentImage: () => string;
|
|
6
|
+
getCurrentOffset: () => number;
|
|
7
|
+
getCurrentScale: () => number;
|
|
8
|
+
imageUrls: Record<string, any>;
|
|
9
|
+
availableStates: string[];
|
|
10
|
+
setTalkSpeed: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
11
|
+
manualMode: boolean;
|
|
12
|
+
setManualMode: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface BobAnimationConfig {
|
|
2
|
+
id: string;
|
|
3
|
+
animation_state: string;
|
|
4
|
+
image_url: string;
|
|
5
|
+
sequence_order: number;
|
|
6
|
+
is_active: boolean;
|
|
7
|
+
description: string | null;
|
|
8
|
+
vertical_offset: number;
|
|
9
|
+
look_id: string | null;
|
|
10
|
+
scale: number;
|
|
11
|
+
}
|
|
12
|
+
export interface AnimationStateDefinition {
|
|
13
|
+
id: string;
|
|
14
|
+
state_key: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description: string | null;
|
|
17
|
+
display_order: number;
|
|
18
|
+
is_active: boolean;
|
|
19
|
+
created_at: string;
|
|
20
|
+
updated_at: string;
|
|
21
|
+
animation_speed: number | null;
|
|
22
|
+
pause_duration: number | null;
|
|
23
|
+
loop_count: number | null;
|
|
24
|
+
chat_trigger: string | null;
|
|
25
|
+
idle_timeout_ms: number | null;
|
|
26
|
+
look_id: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface BobLook {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
is_active: boolean;
|
|
33
|
+
display_order: number;
|
|
34
|
+
created_at: string;
|
|
35
|
+
updated_at: string;
|
|
36
|
+
}
|
|
37
|
+
export interface BobAnimationData {
|
|
38
|
+
states: AnimationStateDefinition[];
|
|
39
|
+
configs: BobAnimationConfig[];
|
|
40
|
+
uploadedImages: string[];
|
|
41
|
+
looks: BobLook[];
|
|
42
|
+
activeLookId: string | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Centralized React Query hook for Bob's animation data.
|
|
46
|
+
* Fetches once, caches for 30 seconds, deduplicates requests across components.
|
|
47
|
+
* Includes realtime subscriptions for automatic updates.
|
|
48
|
+
*/
|
|
49
|
+
export declare const useBobAnimationData: (lookId?: string | null) => import('@tanstack/react-query').UseQueryResult<BobAnimationData, Error>;
|
|
50
|
+
/**
|
|
51
|
+
* Hook to invalidate and refetch Bob animation data.
|
|
52
|
+
*/
|
|
53
|
+
export declare const useInvalidateBobAnimationData: () => () => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface BobBackdrop {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
image_url: string;
|
|
5
|
+
is_active: boolean;
|
|
6
|
+
display_order: number;
|
|
7
|
+
created_at: string;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
counter_overlay_url: string | null;
|
|
10
|
+
counter_height_percent: number | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const useBobBackdrop: () => {
|
|
13
|
+
backdrops: BobBackdrop[];
|
|
14
|
+
activeBackdrop: BobBackdrop | undefined;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AnimationStateDefinition } from './useBobAnimationData';
|
|
2
|
+
|
|
3
|
+
type ChatStage = 'page_load' | 'awaiting_input' | 'idle' | 'processing_input' | 'streaming_response' | 'response_complete' | 'showing_product';
|
|
4
|
+
interface UseBobStateTransitionsProps {
|
|
5
|
+
states: AnimationStateDefinition[];
|
|
6
|
+
setAnimationState: (state: string) => void;
|
|
7
|
+
manualMode: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const useBobStateTransitions: ({ states, setAnimationState, manualMode }: UseBobStateTransitionsProps) => {
|
|
10
|
+
chatStage: ChatStage;
|
|
11
|
+
initialize: () => void;
|
|
12
|
+
onUserInput: () => void;
|
|
13
|
+
onStreamStart: () => void;
|
|
14
|
+
onStreamComplete: () => void;
|
|
15
|
+
onShowingProduct: () => void;
|
|
16
|
+
getStateSettings: (stateKey: string) => {
|
|
17
|
+
speed: number;
|
|
18
|
+
pauseDuration: number;
|
|
19
|
+
loopCount: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type SpeechMode = 'toggle' | 'ptt';
|
|
2
|
+
interface UseSpeechRecognitionProps {
|
|
3
|
+
onTranscript?: (transcript: string) => void;
|
|
4
|
+
onSpeechEnd?: (transcript: string) => void;
|
|
5
|
+
language?: string;
|
|
6
|
+
mode?: SpeechMode;
|
|
7
|
+
}
|
|
8
|
+
export declare const useSpeechRecognition: ({ onTranscript, onSpeechEnd, language, mode }?: UseSpeechRecognitionProps) => {
|
|
9
|
+
isListening: boolean;
|
|
10
|
+
transcript: string;
|
|
11
|
+
interimTranscript: string;
|
|
12
|
+
error: string | null;
|
|
13
|
+
isSupported: boolean;
|
|
14
|
+
startListening: () => void;
|
|
15
|
+
stopListening: () => void;
|
|
16
|
+
toggleListening: () => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,42 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @gymmymac/bob-widget
|
|
3
3
|
*
|
|
4
|
-
* AI-powered automotive parts assistant widget
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* import { BobProvider, Bob } from '@carfix/bob-widget';
|
|
9
|
-
*
|
|
10
|
-
* function App() {
|
|
11
|
-
* return (
|
|
12
|
-
* <BobProvider
|
|
13
|
-
* bobConfig={{
|
|
14
|
-
* supabaseUrl: 'https://your-bob-project.supabase.co',
|
|
15
|
-
* supabaseKey: 'your-anon-key',
|
|
16
|
-
* }}
|
|
17
|
-
* hostApiConfig={{
|
|
18
|
-
* baseUrl: 'https://your-api.com',
|
|
19
|
-
* apiKey: 'your-api-key',
|
|
20
|
-
* }}
|
|
21
|
-
* hostContext={{
|
|
22
|
-
* user: { email: 'user@example.com' },
|
|
23
|
-
* }}
|
|
24
|
-
* >
|
|
25
|
-
* <YourApp />
|
|
26
|
-
* <Bob variant="floating" />
|
|
27
|
-
* </BobProvider>
|
|
28
|
-
* );
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
4
|
+
* AI-powered automotive parts assistant widget - Full immersive experience
|
|
31
5
|
*/
|
|
32
6
|
export { BobProvider, useBobContext, useBobSupabase, useHostContext, useHostApiConfig, useBobCallbacks, } from './BobProvider';
|
|
33
7
|
export { Bob } from './components/Bob';
|
|
34
8
|
export type { BobVariant } from './components/Bob';
|
|
35
9
|
export { BobCharacter } from './components/BobCharacter';
|
|
36
10
|
export { ChatInterface } from './components/ChatInterface';
|
|
11
|
+
export { MobileBobCharacter, MobileChatDrawer, MobileProductColumn, MobileBobLayout } from './components/mobile';
|
|
37
12
|
export { useBobChat } from './hooks/useBobChat';
|
|
38
13
|
export { useSpeechSynthesis } from './hooks/useSpeechSynthesis';
|
|
14
|
+
export { useBobAnimation } from './hooks/useBobAnimation';
|
|
15
|
+
export { useBobAnimationData } from './hooks/useBobAnimationData';
|
|
16
|
+
export { useBobStateTransitions } from './hooks/useBobStateTransitions';
|
|
17
|
+
export { useSpeechRecognition } from './hooks/useSpeechRecognition';
|
|
18
|
+
export { useBobBackdrop } from './hooks/useBobBackdrop';
|
|
39
19
|
export type { HostContext, HostUserContext, HostVehicleContext, HostCartContext, HostHistoryContext, BobConfig, HostApiConfig, BobCallbacks, BobProviderConfig, } from './types/context';
|
|
40
|
-
export type { Vehicle
|
|
41
|
-
export type { APIPart, CartItem, ServicePackage, } from './types/product';
|
|
20
|
+
export type { Vehicle } from './types/vehicle';
|
|
21
|
+
export type { Product, APIPart, CartItem, ServicePackage, } from './types/product';
|
|
42
22
|
export type { Message, HighlightedProduct, } from './types/message';
|
|
23
|
+
export type { BobAnimationConfig, AnimationStateDefinition, BobLook, BobAnimationData, } from './hooks/useBobAnimationData';
|