@akropolys/kiku 1.2.3 → 1.4.0

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SearchResult, AkropolysTheme, ChatSource, Product } from '@akropolys/sdk';
2
+ import { SearchResult, AkropolysTheme, ChatSource, Product, VisualSearchResponse } from '@akropolys/sdk';
3
3
 
4
4
  interface SearchBarProps {
5
5
  placeholder?: string;
@@ -36,8 +36,14 @@ interface ChatWidgetProps {
36
36
  input?: string;
37
37
  };
38
38
  onSelectSource?: (source: ChatSource) => void;
39
+ /** Enable 🎙️ voice input via browser Web Speech API (free) */
40
+ enableVoice?: boolean;
41
+ /** Enable 📷 visual style-match search via Gemini (requires backend GEMINI_API_KEY) */
42
+ enableVision?: boolean;
43
+ /** Optional category hint for visual search (e.g. 'dress', 'curtains') */
44
+ visionCategoryHint?: string;
39
45
  }
40
- declare function ChatWidget({ title, placeholder, emptyStateText, emptyStateSuggestions, defaultCurrency, className, theme, classNames, onSelectSource }: ChatWidgetProps): React.JSX.Element;
46
+ declare function ChatWidget({ title, placeholder, emptyStateText, emptyStateSuggestions, defaultCurrency, className, theme, classNames, onSelectSource, enableVoice, enableVision, visionCategoryHint }: ChatWidgetProps): React.JSX.Element;
41
47
 
42
48
  interface KikuButtonProps {
43
49
  label?: string;
@@ -57,8 +63,14 @@ interface KikuButtonProps {
57
63
  input?: string;
58
64
  sendButton?: string;
59
65
  };
66
+ /** Enable 🎙️ voice input via browser Web Speech API (free) */
67
+ enableVoice?: boolean;
68
+ /** Enable 📷 visual style-match search via Gemini (requires backend GEMINI_API_KEY) */
69
+ enableVision?: boolean;
70
+ /** Optional category hint for visual search (e.g. 'dress', 'curtains') */
71
+ visionCategoryHint?: string;
60
72
  }
61
- declare function KikuButton({ label, title, placeholder, backdropColor, backdropBlur, className, onSelectSource, defaultCurrency, chips, theme, classNames, }: KikuButtonProps): React.JSX.Element;
73
+ declare function KikuButton({ label, title, placeholder, backdropColor, backdropBlur, className, onSelectSource, defaultCurrency, chips, theme, classNames, enableVoice, enableVision, visionCategoryHint, }: KikuButtonProps): React.JSX.Element;
62
74
 
63
75
  interface SparkleProps {
64
76
  productName: string;
@@ -107,4 +119,47 @@ interface ComparisonMatrixProps {
107
119
  }
108
120
  declare function ComparisonMatrix({ sources, defaultCurrency }: ComparisonMatrixProps): React.JSX.Element | null;
109
121
 
110
- export { CartBadge, CartDrawer, ChatWidget, type ChatWidgetProps, CheckoutModal, ComparisonMatrix, KikuButton, type KikuButtonProps, ChatWidget as KikuChat, type ChatWidgetProps as KikuChatProps, SearchBar, type SearchBarProps, Sparkle };
122
+ interface VoiceButtonProps {
123
+ onTranscript: (text: string) => void;
124
+ onInterim?: (text: string) => void;
125
+ /** BCP-47 language tag. Defaults to 'en-US'. */
126
+ lang?: string;
127
+ className?: string;
128
+ disabled?: boolean;
129
+ }
130
+ /**
131
+ * VoiceButton — converts speech to text using the browser's free Web Speech API.
132
+ * No API key, no backend call, no cost.
133
+ *
134
+ * @example
135
+ * <VoiceButton onTranscript={(text) => setQuery(text)} />
136
+ */
137
+ declare function VoiceButton({ onTranscript, onInterim, lang, className, disabled, }: VoiceButtonProps): React.JSX.Element | null;
138
+
139
+ interface VisualSearchProps {
140
+ /** Called with search results + the base64 preview when Gemini responds. */
141
+ onResults: (res: VisualSearchResponse, previewBase64: string) => void;
142
+ onError?: (err: Error) => void;
143
+ /**
144
+ * Category hint sent to Gemini to sharpen the match_query.
145
+ * e.g. "dress", "curtains", "sofa", "shoes"
146
+ */
147
+ categoryHint?: string;
148
+ className?: string;
149
+ disabled?: boolean;
150
+ }
151
+ /**
152
+ * VisualSearch — camera/image-upload button that powers style-match search.
153
+ *
154
+ * User picks a photo → it's base64-encoded in-browser → sent to POST /search/visual
155
+ * → Gemini Flash extracts Style DNA → results returned via onResults().
156
+ *
157
+ * @example
158
+ * <VisualSearch
159
+ * categoryHint="dress"
160
+ * onResults={(res, preview) => setVisualResults(res)}
161
+ * />
162
+ */
163
+ declare function VisualSearch({ onResults, onError, categoryHint, className, disabled, }: VisualSearchProps): React.JSX.Element;
164
+
165
+ export { CartBadge, CartDrawer, ChatWidget, type ChatWidgetProps, CheckoutModal, ComparisonMatrix, KikuButton, type KikuButtonProps, ChatWidget as KikuChat, type ChatWidgetProps as KikuChatProps, SearchBar, type SearchBarProps, Sparkle, VisualSearch, type VisualSearchProps, VoiceButton, type VoiceButtonProps };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { SearchResult, AkropolysTheme, ChatSource, Product } from '@akropolys/sdk';
2
+ import { SearchResult, AkropolysTheme, ChatSource, Product, VisualSearchResponse } from '@akropolys/sdk';
3
3
 
4
4
  interface SearchBarProps {
5
5
  placeholder?: string;
@@ -36,8 +36,14 @@ interface ChatWidgetProps {
36
36
  input?: string;
37
37
  };
38
38
  onSelectSource?: (source: ChatSource) => void;
39
+ /** Enable 🎙️ voice input via browser Web Speech API (free) */
40
+ enableVoice?: boolean;
41
+ /** Enable 📷 visual style-match search via Gemini (requires backend GEMINI_API_KEY) */
42
+ enableVision?: boolean;
43
+ /** Optional category hint for visual search (e.g. 'dress', 'curtains') */
44
+ visionCategoryHint?: string;
39
45
  }
40
- declare function ChatWidget({ title, placeholder, emptyStateText, emptyStateSuggestions, defaultCurrency, className, theme, classNames, onSelectSource }: ChatWidgetProps): React.JSX.Element;
46
+ declare function ChatWidget({ title, placeholder, emptyStateText, emptyStateSuggestions, defaultCurrency, className, theme, classNames, onSelectSource, enableVoice, enableVision, visionCategoryHint }: ChatWidgetProps): React.JSX.Element;
41
47
 
42
48
  interface KikuButtonProps {
43
49
  label?: string;
@@ -57,8 +63,14 @@ interface KikuButtonProps {
57
63
  input?: string;
58
64
  sendButton?: string;
59
65
  };
66
+ /** Enable 🎙️ voice input via browser Web Speech API (free) */
67
+ enableVoice?: boolean;
68
+ /** Enable 📷 visual style-match search via Gemini (requires backend GEMINI_API_KEY) */
69
+ enableVision?: boolean;
70
+ /** Optional category hint for visual search (e.g. 'dress', 'curtains') */
71
+ visionCategoryHint?: string;
60
72
  }
61
- declare function KikuButton({ label, title, placeholder, backdropColor, backdropBlur, className, onSelectSource, defaultCurrency, chips, theme, classNames, }: KikuButtonProps): React.JSX.Element;
73
+ declare function KikuButton({ label, title, placeholder, backdropColor, backdropBlur, className, onSelectSource, defaultCurrency, chips, theme, classNames, enableVoice, enableVision, visionCategoryHint, }: KikuButtonProps): React.JSX.Element;
62
74
 
63
75
  interface SparkleProps {
64
76
  productName: string;
@@ -107,4 +119,47 @@ interface ComparisonMatrixProps {
107
119
  }
108
120
  declare function ComparisonMatrix({ sources, defaultCurrency }: ComparisonMatrixProps): React.JSX.Element | null;
109
121
 
110
- export { CartBadge, CartDrawer, ChatWidget, type ChatWidgetProps, CheckoutModal, ComparisonMatrix, KikuButton, type KikuButtonProps, ChatWidget as KikuChat, type ChatWidgetProps as KikuChatProps, SearchBar, type SearchBarProps, Sparkle };
122
+ interface VoiceButtonProps {
123
+ onTranscript: (text: string) => void;
124
+ onInterim?: (text: string) => void;
125
+ /** BCP-47 language tag. Defaults to 'en-US'. */
126
+ lang?: string;
127
+ className?: string;
128
+ disabled?: boolean;
129
+ }
130
+ /**
131
+ * VoiceButton — converts speech to text using the browser's free Web Speech API.
132
+ * No API key, no backend call, no cost.
133
+ *
134
+ * @example
135
+ * <VoiceButton onTranscript={(text) => setQuery(text)} />
136
+ */
137
+ declare function VoiceButton({ onTranscript, onInterim, lang, className, disabled, }: VoiceButtonProps): React.JSX.Element | null;
138
+
139
+ interface VisualSearchProps {
140
+ /** Called with search results + the base64 preview when Gemini responds. */
141
+ onResults: (res: VisualSearchResponse, previewBase64: string) => void;
142
+ onError?: (err: Error) => void;
143
+ /**
144
+ * Category hint sent to Gemini to sharpen the match_query.
145
+ * e.g. "dress", "curtains", "sofa", "shoes"
146
+ */
147
+ categoryHint?: string;
148
+ className?: string;
149
+ disabled?: boolean;
150
+ }
151
+ /**
152
+ * VisualSearch — camera/image-upload button that powers style-match search.
153
+ *
154
+ * User picks a photo → it's base64-encoded in-browser → sent to POST /search/visual
155
+ * → Gemini Flash extracts Style DNA → results returned via onResults().
156
+ *
157
+ * @example
158
+ * <VisualSearch
159
+ * categoryHint="dress"
160
+ * onResults={(res, preview) => setVisualResults(res)}
161
+ * />
162
+ */
163
+ declare function VisualSearch({ onResults, onError, categoryHint, className, disabled, }: VisualSearchProps): React.JSX.Element;
164
+
165
+ export { CartBadge, CartDrawer, ChatWidget, type ChatWidgetProps, CheckoutModal, ComparisonMatrix, KikuButton, type KikuButtonProps, ChatWidget as KikuChat, type ChatWidgetProps as KikuChatProps, SearchBar, type SearchBarProps, Sparkle, VisualSearch, type VisualSearchProps, VoiceButton, type VoiceButtonProps };