@akropolys/kiku 1.5.18 → 1.6.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/README.md CHANGED
@@ -1,30 +1,16 @@
1
1
  # @akropolys/kiku
2
2
 
3
- > Plug-and-play React AI chat, search, and commerce UI components.
3
+ [![npm](https://img.shields.io/npm/v/@akropolys/kiku?color=orange)](https://www.npmjs.com/package/@akropolys/kiku) [![License](https://img.shields.io/npm/l/@akropolys/kiku)](https://github.com/akropolys/sdk/blob/main/LICENSE) [![TypeScript](https://img.shields.io/badge/types-included-blue)](https://www.typescriptlang.org/)
4
4
 
5
- Kiku is the ready-made UI layer for Akropolys. Drop in a floating chat button, a search bar with AI-powered results, a product comparison matrix, or a full checkout modal — all styled, animated, and wired to the Akropolys backend out of the box.
6
-
7
- If you want full control over the UI, use [`@akropolys/sdk`](https://www.npmjs.com/package/@akropolys/sdk) directly.
5
+ **[Docs](https://akropolys.io/docs)**  •  **[GitHub](https://github.com/akropolys/sdk)**
8
6
 
9
7
  ---
10
8
 
11
- ## Install
12
-
13
- ```bash
14
- npm install @akropolys/kiku @akropolys/sdk
15
- # or
16
- pnpm add @akropolys/kiku @akropolys/sdk
17
- ```
18
-
19
- **Import the stylesheet once in your app entry point:**
20
-
21
- ```ts
22
- import '@akropolys/kiku/styles.css';
23
- ```
9
+ ## The pre-built UI for a smarter search bar.
24
10
 
25
- ---
11
+ `@akropolys/kiku` is the ready-made front end for [`@akropolys/sdk`](https://www.npmjs.com/package/@akropolys/sdk) — a chat button, a search bar, a per-product "ask about this" prompt — so you don't have to design a search experience from scratch. Drop one in and it's already wired up to plain-language search.
26
12
 
27
- ## Quick start
13
+ Want to build your own UI instead? Use `@akropolys/sdk` directly and skip this package.
28
14
 
29
15
  ```tsx
30
16
  import { AkropolysProvider } from '@akropolys/sdk';
@@ -34,169 +20,39 @@ import '@akropolys/kiku/styles.css';
34
20
  export default function App() {
35
21
  return (
36
22
  <AkropolysProvider
37
- siteId="your-site-id"
38
- apiUrl="https://api.akropolys.io"
39
- apiToken="your-api-token"
23
+ siteId={process.env.NEXT_PUBLIC_AKROPOLYS_SITE_ID}
24
+ apiToken={process.env.NEXT_PUBLIC_AKROPOLYS_API_TOKEN}
40
25
  >
41
- {/* Floating chat button — renders the full AI shopping assistant */}
42
- <KikuButton label="Chat with Kiku" />
26
+ <KikuButton />
43
27
  </AkropolysProvider>
44
28
  );
45
29
  }
46
30
  ```
47
31
 
48
- ---
49
-
50
32
  ## Components
51
33
 
52
- ### `<KikuButton />` Floating AI chat assistant
53
-
54
- ```tsx
55
- import { KikuButton } from '@akropolys/kiku';
56
-
57
- <KikuButton
58
- label="Ask Kiku"
59
- title="Shopping Assistant"
60
- placeholder="What are you looking for?"
61
- theme="dark" // 'light' | 'dark' | AkropolysTheme
62
- chips={['Best phones', 'Laptops under KSh 50K']}
63
- onSelectSource={(src) => console.log(src)}
64
- />
65
- ```
66
-
67
- ---
68
-
69
- ### `<KikuChat />` — Inline embedded chat widget
70
-
71
- ```tsx
72
- import { KikuChat } from '@akropolys/kiku';
73
-
74
- <KikuChat
75
- title="AI Shopping Assistant"
76
- placeholder="Ask about anything in our store…"
77
- defaultCurrency="KES"
78
- />
79
- ```
80
-
81
- ---
82
-
83
- ### `<SearchBar />` — Debounced AI search with dropdown
84
-
85
- ```tsx
86
- import { SearchBar } from '@akropolys/kiku';
87
-
88
- <SearchBar
89
- placeholder="Search products…"
90
- limit={8}
91
- debounceMs={300}
92
- onSelect={(result) => {
93
- window.location.href = result.product.url;
94
- }}
95
- />
96
- ```
97
-
98
- ---
99
-
100
- ### `<Sparkle />` — Per-product AI assistant button
101
-
102
- ```tsx
103
- import { Sparkle } from '@akropolys/kiku';
104
-
105
- // Place next to any product on a listing or detail page
106
- <Sparkle productName="Samsung Galaxy S24" />
107
- ```
108
-
109
- ---
110
-
111
- ### `<ComparisonMatrix />` — Side-by-side product comparison table
112
-
113
- ```tsx
114
- import { ComparisonMatrix } from '@akropolys/kiku';
115
-
116
- // sources come from useKiku() or useSearch()
117
- <ComparisonMatrix sources={sources} defaultCurrency="KES" />
118
- ```
119
-
120
- ---
121
-
122
- ### `<CartBadge />` — Cart item count badge
123
-
124
- ```tsx
125
- import { CartBadge } from '@akropolys/kiku';
126
-
127
- <CartBadge className="my-badge" />
128
- ```
129
-
130
- ---
131
-
132
- ### `<CartDrawer />` — Slide-out cart drawer
133
-
134
- ```tsx
135
- import { CartDrawer } from '@akropolys/kiku';
136
-
137
- <CartDrawer trigger={<button>🛒 Cart</button>} theme="dark" />
138
- ```
139
-
140
- ---
141
-
142
- ### `<CheckoutModal />` — Full checkout modal (M-Pesa + extensible)
143
-
144
- ```tsx
145
- import { CheckoutModal } from '@akropolys/kiku';
146
-
147
- <CheckoutModal onClose={() => setOpen(false)} theme="dark" />
148
- ```
149
-
150
- ---
151
-
152
- ## Theming
153
-
154
- All components accept a `theme` prop. Pass `'light'` | `'dark'` for the built-in modes, or pass an `AkropolysTheme` object for full control:
155
-
156
- ```tsx
157
- <KikuButton
158
- theme={{
159
- primaryColor: '#6d28d9',
160
- backgroundColor: '#0f0f0f',
161
- textColor: '#f5f5f5',
162
- fontFamily: 'Inter, sans-serif',
163
- borderRadius: '12px',
164
- }}
165
- />
166
- ```
167
-
168
- Alternatively, override CSS variables globally in your stylesheet:
169
-
170
- ```css
171
- :root {
172
- --hsk-primary: #6d28d9;
173
- --hsk-bg: #0f0f0f;
174
- --hsk-text: #f5f5f5;
175
- --hsk-font: 'Inter', sans-serif;
176
- --hsk-border-radius: 12px;
177
- }
178
- ```
179
-
180
- ---
34
+ | Component | What it does |
35
+ |---|---|
36
+ | `<KikuButton />` | Floating chat assistant |
37
+ | `<KikuChat />` | Chat widget embedded inline on the page |
38
+ | `<SearchBar />` | Search box with a live results dropdown |
39
+ | `<Sparkle />` | Small "ask about this" button next to a product |
40
+ | `<ComparisonMatrix />` | Side-by-side product comparison |
41
+ | `<VoiceButton />` | Speak a query instead of typing it |
42
+ | `<VisualSearch />` | Search by uploading a photo |
181
43
 
182
- ## Using the headless SDK instead
183
-
184
- If you want to build your own UI from scratch, install only the core:
44
+ ## Install
185
45
 
186
46
  ```bash
187
- npm install @akropolys/sdk
47
+ npm install @akropolys/kiku @akropolys/sdk
188
48
  ```
189
49
 
190
- ```tsx
191
- import { useKiku } from '@akropolys/sdk';
192
-
193
- const { send, messages, loading, streaming } = useKiku({
194
- onToken: (token) => appendToMyUI(token),
195
- onMeta: (meta) => showProducts(meta.sources),
196
- onDone: (full) => saveToDatabase(full),
197
- });
50
+ ```ts
51
+ import '@akropolys/kiku/styles.css';
198
52
  ```
199
53
 
54
+ [Read the full docs →](https://akropolys.io/docs)
55
+
200
56
  ---
201
57
 
202
58
  ## License
package/dist/index.d.mts CHANGED
@@ -78,11 +78,11 @@ interface SparkleProps {
78
78
  onResult?: (results: SearchResult[]) => void;
79
79
  /** Override the backdrop colour (any CSS colour/gradient) */
80
80
  backdropColor?: string;
81
- /** Override backdrop blur e.g. "8px" or 8 */
81
+ /** Override backdrop blur — e.g. "8px" or 8 */
82
82
  backdropBlur?: string | number;
83
83
  /** Extra classes on the trigger button */
84
84
  className?: string;
85
- /** Called when user clicks a result return false to prevent default navigation */
85
+ /** Called when user clicks a result — return false to prevent default navigation */
86
86
  onNavigate?: (result: SearchResult) => boolean | void;
87
87
  theme?: AkropolysTheme;
88
88
  classNames?: {
@@ -96,23 +96,6 @@ interface SparkleProps {
96
96
  }
97
97
  declare function Sparkle({ productName, limit, onResult, backdropColor, backdropBlur, className, onNavigate, theme, classNames, product, children, }: SparkleProps): React.JSX.Element;
98
98
 
99
- declare function CartBadge({ className }: {
100
- className?: string;
101
- }): React.JSX.Element | null;
102
-
103
- declare function CartDrawer({ trigger, className, theme }: {
104
- trigger?: React.ReactNode;
105
- className?: string;
106
- theme?: 'light' | 'dark' | AkropolysTheme;
107
- }): React.JSX.Element;
108
-
109
- declare function CheckoutModal({ onClose, theme, customStyles, hskThemeAttr }: {
110
- onClose: () => void;
111
- theme?: string;
112
- customStyles?: React.CSSProperties;
113
- hskThemeAttr?: string;
114
- }): React.ReactPortal;
115
-
116
99
  interface ComparisonMatrixProps {
117
100
  sources: ChatSource[];
118
101
  defaultCurrency?: string;
@@ -163,4 +146,4 @@ interface VisualSearchProps {
163
146
  */
164
147
  declare function VisualSearch({ onResults, onError, categoryHint, className, disabled, }: VisualSearchProps): React.JSX.Element;
165
148
 
166
- 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 };
149
+ export { ChatWidget, type ChatWidgetProps, 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
@@ -78,11 +78,11 @@ interface SparkleProps {
78
78
  onResult?: (results: SearchResult[]) => void;
79
79
  /** Override the backdrop colour (any CSS colour/gradient) */
80
80
  backdropColor?: string;
81
- /** Override backdrop blur e.g. "8px" or 8 */
81
+ /** Override backdrop blur — e.g. "8px" or 8 */
82
82
  backdropBlur?: string | number;
83
83
  /** Extra classes on the trigger button */
84
84
  className?: string;
85
- /** Called when user clicks a result return false to prevent default navigation */
85
+ /** Called when user clicks a result — return false to prevent default navigation */
86
86
  onNavigate?: (result: SearchResult) => boolean | void;
87
87
  theme?: AkropolysTheme;
88
88
  classNames?: {
@@ -96,23 +96,6 @@ interface SparkleProps {
96
96
  }
97
97
  declare function Sparkle({ productName, limit, onResult, backdropColor, backdropBlur, className, onNavigate, theme, classNames, product, children, }: SparkleProps): React.JSX.Element;
98
98
 
99
- declare function CartBadge({ className }: {
100
- className?: string;
101
- }): React.JSX.Element | null;
102
-
103
- declare function CartDrawer({ trigger, className, theme }: {
104
- trigger?: React.ReactNode;
105
- className?: string;
106
- theme?: 'light' | 'dark' | AkropolysTheme;
107
- }): React.JSX.Element;
108
-
109
- declare function CheckoutModal({ onClose, theme, customStyles, hskThemeAttr }: {
110
- onClose: () => void;
111
- theme?: string;
112
- customStyles?: React.CSSProperties;
113
- hskThemeAttr?: string;
114
- }): React.ReactPortal;
115
-
116
99
  interface ComparisonMatrixProps {
117
100
  sources: ChatSource[];
118
101
  defaultCurrency?: string;
@@ -163,4 +146,4 @@ interface VisualSearchProps {
163
146
  */
164
147
  declare function VisualSearch({ onResults, onError, categoryHint, className, disabled, }: VisualSearchProps): React.JSX.Element;
165
148
 
166
- 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 };
149
+ export { ChatWidget, type ChatWidgetProps, ComparisonMatrix, KikuButton, type KikuButtonProps, ChatWidget as KikuChat, type ChatWidgetProps as KikuChatProps, SearchBar, type SearchBarProps, Sparkle, VisualSearch, type VisualSearchProps, VoiceButton, type VoiceButtonProps };