@xpert-ai/chatkit-react 0.1.1 → 0.3.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
@@ -35,6 +35,7 @@ function App() {
35
35
  };
36
36
  }
37
37
  },
38
+ pet: true,
38
39
  onReady: () => {
39
40
  console.log('ChatKit is ready');
40
41
  }
@@ -70,6 +71,7 @@ interface UseChatKitOptions extends Partial<ChatKitOptions> {
70
71
  theme?: ThemeOptions;
71
72
  composer?: ComposerOptions;
72
73
  startScreen?: StartScreenOptions;
74
+ pet?: boolean | ChatKitPetOptions;
73
75
  onClientTool?: (params: ClientToolParams) => Promise<ClientToolMessageInput>;
74
76
  onError?: (error: Error) => void;
75
77
  onReady?: () => void;
@@ -186,6 +188,67 @@ const chatkit = useChatKit({
186
188
  });
187
189
  ```
188
190
 
191
+ ### Pet
192
+
193
+ Pet is disabled by default. Users can enable or disable it from the built-in
194
+ Settings panel or with `/pet`, `/pet on`, `/pet off`, and `/pet settings`;
195
+ v1 stores those preferences in browser `localStorage`.
196
+
197
+ `pet: true` enables the default file-backed animated pet from configuration. The
198
+ web component renders the pet over the host page viewport, so dragging is not
199
+ limited by the ChatKit iframe bounds while the chat panel itself stays in place.
200
+ The same `pet` option is part of the shared ChatKit options contract, so this
201
+ configuration shape also works in Angular and future Vue bindings.
202
+
203
+ ```tsx
204
+ const chatkit = useChatKit({
205
+ frameUrl: '<url-to-chatkit-frame>',
206
+ api: { /* ... */ },
207
+ pet: {
208
+ character: { type: 'sprite-atlas', src: '/pets/boba/spritesheet.webp' },
209
+ position: {
210
+ pin: 'bottom-right',
211
+ draggable: true,
212
+ persist: true,
213
+ scale: 0.25,
214
+ },
215
+ },
216
+ });
217
+ ```
218
+
219
+ Use `displayMode: 'pet'` to render only the pet launcher at first. Clicking the
220
+ pet opens the ChatKit iframe panel; the iframe is not placed in the host layout.
221
+ In this launcher mode, the pet cannot be hidden because it is the chat entry
222
+ point.
223
+
224
+ ```tsx
225
+ const chatkit = useChatKit({
226
+ frameUrl: '<url-to-chatkit-frame>',
227
+ api: { /* ... */ },
228
+ displayMode: 'pet',
229
+ pet: true,
230
+ });
231
+ ```
232
+
233
+ The settings UI exposes the file-backed pets bundled in
234
+ `chatkit-ui/public/pets` as built-in choices. You can also point directly at a
235
+ spritesheet-compatible image. Relative `src` values are resolved against the
236
+ ChatKit frame URL, not the host page URL, because the pet overlay renders in
237
+ the host document.
238
+
239
+ ```tsx
240
+ const chatkit = useChatKit({
241
+ frameUrl: '<url-to-chatkit-frame>',
242
+ api: { /* ... */ },
243
+ pet: {
244
+ character: {
245
+ type: 'sprite-atlas',
246
+ src: 'https://example.com/pets/boba/spritesheet.webp',
247
+ },
248
+ },
249
+ });
250
+ ```
251
+
189
252
  ### Handling Client Tools
190
253
 
191
254
  ```tsx
@@ -341,14 +404,14 @@ This package is written in TypeScript and includes full type definitions.
341
404
  ```typescript
342
405
  import type {
343
406
  ChatKitOptions,
407
+ ChatKitPetOptions,
344
408
  ClientToolMessageInput,
345
409
  SupportedLocale
346
410
  } from '@xpert-ai/chatkit-types';
347
411
  ```
348
412
 
349
413
  ## Requirements
350
-
351
- - React >= 18
414
+ React >= 18
352
415
  - React DOM >= 18
353
416
 
354
417
  ## Related Packages
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare type ChatKitMethods = {
23
23
  [K in ChatKitMethod]: XpertAIChatKit[K];
24
24
  };
25
25
 
26
- declare interface ChatKitProps extends React_2.HTMLAttributes<XpertAIChatKit> {
26
+ export declare interface ChatKitProps extends React_2.HTMLAttributes<XpertAIChatKit> {
27
27
  control: ChatKitControl;
28
28
  }
29
29
 
@@ -33,7 +33,7 @@ export declare type ToEventHandlerKey<K extends keyof ChatKitEvents> = DotToCame
33
33
 
34
34
  export declare function useChatKit(options: UseChatKitOptions): UseChatKitReturn;
35
35
 
36
- declare type UseChatKitOptions = ChatKitOptions & ChatKitEventHandlers;
36
+ export declare type UseChatKitOptions = ChatKitOptions & ChatKitEventHandlers;
37
37
 
38
38
  export declare type UseChatKitReturn = ChatKitMethods & {
39
39
  control: ChatKitControl;