@ibti-tech/chatbot 0.8.0 → 0.8.1
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 +19 -1
- package/dist/index.d.ts +242 -105
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm install @ibti-tech/chatbot
|
|
|
21
21
|
## Usage (React)
|
|
22
22
|
|
|
23
23
|
```jsx
|
|
24
|
-
import { ChatbotProvider, ChatbotBar } from '@ibti-tech/chatbot'
|
|
24
|
+
import { ChatbotProvider, ChatbotBar, useChatbot } from '@ibti-tech/chatbot'
|
|
25
25
|
|
|
26
26
|
function App() {
|
|
27
27
|
return (
|
|
@@ -37,6 +37,8 @@ function App() {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
All public types (e.g. `ChatbotTypes`, `ChatbotBarProps`) and parameters are documented with JSDoc in English in the source—your IDE will show parameter names, types, and descriptions on hover.
|
|
41
|
+
|
|
40
42
|
### Main props
|
|
41
43
|
|
|
42
44
|
**ChatbotProvider**
|
|
@@ -62,6 +64,22 @@ function App() {
|
|
|
62
64
|
|
|
63
65
|
When using `pushContentDown={true}` with `verticalPosition="top"`, render `ChatbotBar` **before** your header/main content so it appears at the top.
|
|
64
66
|
|
|
67
|
+
### Types (`ChatbotTypes`)
|
|
68
|
+
|
|
69
|
+
Import: `import type { ChatbotTypes } from '@ibti-tech/chatbot'`
|
|
70
|
+
|
|
71
|
+
| Type | Description |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| `Theme` | `'light' \| 'dark'` |
|
|
74
|
+
| `Locale` | `'pt-BR' \| 'en'` |
|
|
75
|
+
| `CustomColors` | `{ primaryColor?, headerBackground?, userBalloonColor? }` (hex or rgb) |
|
|
76
|
+
| `ChatMessage` | `{ id, timestamp, role, content, error? }` — one message in the thread |
|
|
77
|
+
| `ChatContextItem` | `{ role, content }` — minimal shape for API context |
|
|
78
|
+
| `Status` | `'writing' \| 'loading' \| 'online' \| 'unavailable'` |
|
|
79
|
+
| `InitializationStatus` | `'loading' \| 'domain_not_allowed' \| 'error' \| 'ready'` |
|
|
80
|
+
| `ChatbotPublicResponse` | Response of GET `/chatbots/public/:hash` (id, name, domain, etc.) |
|
|
81
|
+
| `CustomTexts` / `Texts` | Override UI strings per locale (see JSDoc in `types/index.ts`) |
|
|
82
|
+
|
|
65
83
|
## Embed (no React)
|
|
66
84
|
|
|
67
85
|
For static HTML, WordPress, PHP, or any site without React, load the script from the CDN:
|
package/dist/index.d.ts
CHANGED
|
@@ -55,56 +55,42 @@ declare module '@ibti-tech/chatbot/components/ChatUserFeedbackRating/styles.d.ts
|
|
|
55
55
|
}
|
|
56
56
|
declare module '@ibti-tech/chatbot/components/ChatbotBar/index' {
|
|
57
57
|
import React from 'react';
|
|
58
|
+
/**
|
|
59
|
+
* Props for the ChatbotBar component (toggle button + floating chat panel).
|
|
60
|
+
* Use with ChatbotProvider; positioning is relative to viewport unless pushContentDown is used.
|
|
61
|
+
*/
|
|
58
62
|
export type ChatbotBarProps = {
|
|
63
|
+
/** Vertical anchor: 'top' | 'bottom'. Default: 'bottom'. */
|
|
59
64
|
verticalPosition?: 'top' | 'bottom';
|
|
65
|
+
/** Horizontal anchor of the bar: 'left' | 'right'. Default: 'right'. */
|
|
60
66
|
horizontalPosition?: 'left' | 'right';
|
|
61
67
|
/**
|
|
62
|
-
* Horizontal position of the
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* If not provided, the device will use the parent container's positioning.
|
|
68
|
+
* Horizontal position of the chat panel on desktop.
|
|
69
|
+
* Predefined: 'left' | 'right' | 'center', or any CSS length (e.g. '20px', '10%', 'calc(100% - 200px)').
|
|
70
|
+
* Custom values are applied as the 'left' CSS property. Omit to use parent positioning.
|
|
66
71
|
*/
|
|
67
72
|
deviceHorizontalPosition?: 'left' | 'right' | 'center' | string;
|
|
68
|
-
/**
|
|
69
|
-
* Custom z-index value. If not provided, uses theme.zIndex.modals
|
|
70
|
-
* Useful when you need the chatbot to appear above specific elements like headers
|
|
71
|
-
*/
|
|
73
|
+
/** Custom z-index for the bar/panel. If omitted, uses theme.zIndex.modals. Use to appear above headers. */
|
|
72
74
|
zIndex?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Offset from the top when verticalPosition is 'top'
|
|
75
|
-
* Can be a number (in pixels) or a string (e.g., '100px', '10rem')
|
|
76
|
-
* Useful to position the chatbot below a fixed header
|
|
77
|
-
*/
|
|
75
|
+
/** Offset from top when verticalPosition is 'top'. Number (px) or string (e.g. '100px', '10rem'). Use to sit below a fixed header. */
|
|
78
76
|
topOffset?: string | number;
|
|
79
|
-
/**
|
|
80
|
-
* Convenient prop to position the chatbot above header elements
|
|
81
|
-
* When true, sets z-index to 9999 and allows topOffset configuration
|
|
82
|
-
*/
|
|
77
|
+
/** When true, sets z-index to 9999 so the chatbot appears above header elements; use with topOffset. */
|
|
83
78
|
aboveHeader?: boolean;
|
|
84
79
|
/**
|
|
85
|
-
* When true and verticalPosition is 'top', the
|
|
86
|
-
* instead of overlaying
|
|
87
|
-
* When false, the chatbot will be fixed and overlay the content.
|
|
80
|
+
* When true and verticalPosition is 'top', the bar takes space in the document flow (pushes content down)
|
|
81
|
+
* instead of overlaying. When false, the bar is fixed and overlays content.
|
|
88
82
|
*/
|
|
89
83
|
pushContentDown?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Background color of the push-content-down row (full-width bar) for light theme.
|
|
92
|
-
* Does not affect the chatbot button. Accepts rgb(), hex (e.g. #e6e6e6), etc.
|
|
93
|
-
* Default: rgb(230, 230, 230)
|
|
94
|
-
*/
|
|
84
|
+
/** Background of the push-content-down full-width row (light theme). Hex or rgb(). Default: rgb(230, 230, 230). */
|
|
95
85
|
pushContentDownRowBackgroundLight?: string;
|
|
96
|
-
/**
|
|
97
|
-
* Background color of the push-content-down row (full-width bar) for dark theme.
|
|
98
|
-
* Does not affect the chatbot button. Accepts rgb(), hex (e.g. #000000), etc.
|
|
99
|
-
* Default: rgb(0, 0, 0)
|
|
100
|
-
*/
|
|
86
|
+
/** Background of the push-content-down full-width row (dark theme). Hex or rgb(). Default: rgb(0, 0, 0). */
|
|
101
87
|
pushContentDownRowBackgroundDark?: string;
|
|
102
88
|
};
|
|
103
89
|
export const ChatbotBar: ({ verticalPosition, horizontalPosition, deviceHorizontalPosition, zIndex, topOffset, aboveHeader, pushContentDown, pushContentDownRowBackgroundLight, pushContentDownRowBackgroundDark, }: ChatbotBarProps) => React.JSX.Element;
|
|
104
90
|
//# sourceMappingURL=index.d.ts.map
|
|
105
91
|
}
|
|
106
92
|
declare module '@ibti-tech/chatbot/components/ChatbotBar/index.d.ts' {
|
|
107
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/ChatbotBar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAIlD,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IACnC,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACrC
|
|
93
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/ChatbotBar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAIlD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAA;IACnC,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACrC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC/D,2GAA2G;IAC3G,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sIAAsI;IACtI,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,wGAAwG;IACxG,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,mHAAmH;IACnH,iCAAiC,CAAC,EAAE,MAAM,CAAA;IAC1C,4GAA4G;IAC5G,gCAAgC,CAAC,EAAE,MAAM,CAAA;CAC1C,CAAA;AAKD,eAAO,MAAM,UAAU,GAAI,2LAUxB,eAAe,sBAuFjB,CAAA"}
|
|
108
94
|
}
|
|
109
95
|
declare module '@ibti-tech/chatbot/components/ChatbotBar/styles' {
|
|
110
96
|
import { breakpoints } from '@ibti-tech/ui';
|
|
@@ -372,57 +358,84 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/context' {
|
|
|
372
358
|
import * as React from 'react';
|
|
373
359
|
import { ChatbotTypes } from 'types';
|
|
374
360
|
import { useChatbotSuggestedQuestions } from '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions';
|
|
361
|
+
/**
|
|
362
|
+
* Shape of the chatbot context provided by ChatbotProvider.
|
|
363
|
+
* Consume via useChatbot() inside the provider tree.
|
|
364
|
+
*/
|
|
375
365
|
export type ChatbotContextProps = {
|
|
366
|
+
/** Current locale: 'pt-BR' | 'en'. */
|
|
376
367
|
locale: ChatbotTypes.Locale;
|
|
368
|
+
/** Ordered list of chat messages (user + assistant). */
|
|
377
369
|
chatMessages: ChatbotTypes.ChatMessage[];
|
|
370
|
+
/** Optional ref for the scrollable messages container. */
|
|
378
371
|
scrollRef?: React.MutableRefObject<HTMLElement | null>;
|
|
372
|
+
/** Sends a user message and streams the assistant reply. Resolves when stream ends. */
|
|
379
373
|
makeQuestion: (question: string) => Promise<void>;
|
|
374
|
+
/** True while the assistant is streaming a response. */
|
|
380
375
|
writing: boolean;
|
|
376
|
+
/** True while the request is in flight (before first chunk). */
|
|
381
377
|
loading: boolean;
|
|
378
|
+
/** Whether the chat panel is open. */
|
|
382
379
|
opened: boolean;
|
|
380
|
+
/** Toggles opened state. */
|
|
383
381
|
openedToggle: () => void;
|
|
382
|
+
/** Derived status: 'writing' | 'loading' | 'online' | 'unavailable'. */
|
|
384
383
|
status: ChatbotTypes.Status;
|
|
384
|
+
/** True when API health check or request failed (e.g. network/CORS). */
|
|
385
385
|
apiConnectionError: boolean;
|
|
386
|
+
/** Suggested questions hook result: { loading, data, fetchData, resetData }. */
|
|
386
387
|
suggestedQuestions: ReturnType<typeof useChatbotSuggestedQuestions>;
|
|
388
|
+
/** Base URL of the chatbot API. */
|
|
387
389
|
apiURL: string;
|
|
390
|
+
/** Optional custom texts per locale (overrides defaults). */
|
|
388
391
|
texts?: ChatbotTypes.Texts;
|
|
392
|
+
/** Current theme: 'light' | 'dark'. */
|
|
389
393
|
theme: ChatbotTypes.Theme;
|
|
390
|
-
/** Lucide icon name for the chatbot
|
|
394
|
+
/** Optional Lucide icon name for the chatbot button/header (e.g. 'Bot', 'MessageCircle'). */
|
|
391
395
|
icon?: string;
|
|
392
|
-
/** Public hash of the chatbot
|
|
396
|
+
/** Public hash of the chatbot when using the public API. */
|
|
393
397
|
publicHash?: string;
|
|
394
|
-
/** Stable visitor
|
|
398
|
+
/** Stable visitor id for this session (when using publicHash). */
|
|
395
399
|
visitorId?: string;
|
|
396
|
-
/**
|
|
400
|
+
/** True when current origin is in the chatbot's allowed domains. */
|
|
397
401
|
domainAllowed: boolean;
|
|
398
|
-
/**
|
|
402
|
+
/** Widget init state: 'loading' | 'domain_not_allowed' | 'error' | 'ready'. */
|
|
399
403
|
initializationStatus: ChatbotTypes.InitializationStatus;
|
|
400
|
-
/** Chatbot
|
|
404
|
+
/** Chatbot config from GET /chatbots/public/:hash when initializationStatus is 'ready'. */
|
|
401
405
|
chatbot?: ChatbotTypes.ChatbotPublicResponse;
|
|
402
406
|
};
|
|
407
|
+
/** React context for chatbot state. Use useChatbot() to consume. */
|
|
403
408
|
export const ChatbotContext: React.Context<ChatbotContextProps>;
|
|
404
409
|
//# sourceMappingURL=context.d.ts.map
|
|
405
410
|
}
|
|
406
411
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/context.d.ts' {
|
|
407
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,YAAY,EAAE,YAAY,CAAC,WAAW,EAAE,CAAA;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACtD,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,kBAAkB,EAAE,OAAO,CAAA;IAC3B,kBAAkB,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA;IACnE,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;IAC1B,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;IACzB,
|
|
412
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAE7E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,sCAAsC;IACtC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,wDAAwD;IACxD,YAAY,EAAE,YAAY,CAAC,WAAW,EAAE,CAAA;IACxC,0DAA0D;IAC1D,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACtD,uFAAuF;IACvF,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAA;IAChB,sCAAsC;IACtC,MAAM,EAAE,OAAO,CAAA;IACf,4BAA4B;IAC5B,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,wEAAwE;IACxE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,wEAAwE;IACxE,kBAAkB,EAAE,OAAO,CAAA;IAC3B,gFAAgF;IAChF,kBAAkB,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA;IACnE,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;IAC1B,uCAAuC;IACvC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;IACzB,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oEAAoE;IACpE,aAAa,EAAE,OAAO,CAAA;IACtB,+EAA+E;IAC/E,oBAAoB,EAAE,YAAY,CAAC,oBAAoB,CAAA;IACvD,2FAA2F;IAC3F,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAA;CAC7C,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,cAAc,oCAAiD,CAAA"}
|
|
408
413
|
}
|
|
409
414
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/provider' {
|
|
410
415
|
import React, { ReactNode } from 'react';
|
|
411
416
|
import { ChatbotTypes } from 'types';
|
|
417
|
+
/**
|
|
418
|
+
* Props for ChatbotProvider. Wrap your app (or chatbot subtree) with this to enable useChatbot().
|
|
419
|
+
*/
|
|
412
420
|
export type ChatbotProviderProps = {
|
|
421
|
+
/** Locale: 'pt-BR' | 'en'. */
|
|
413
422
|
locale: ChatbotTypes.Locale;
|
|
423
|
+
/** Base URL of the chatbot API (e.g. https://api.example.com). */
|
|
414
424
|
apiURL: string;
|
|
415
|
-
/** Public hash of the chatbot (required for
|
|
425
|
+
/** Public hash of the chatbot (required for domain-validated API; omit for legacy). */
|
|
416
426
|
publicHash?: string;
|
|
417
427
|
children?: ReactNode;
|
|
428
|
+
/** UI theme: 'light' | 'dark'. */
|
|
418
429
|
theme: ChatbotTypes.Theme;
|
|
430
|
+
/** Initial open state of the chat panel. Default: false. */
|
|
419
431
|
isOpen?: boolean;
|
|
432
|
+
/** Optional custom texts per locale (key: 'pt-BR' | 'en', value: CustomTexts). */
|
|
420
433
|
texts?: ChatbotTypes.Texts;
|
|
421
|
-
/**
|
|
434
|
+
/** Origins that skip domain validation (e.g. for staging). */
|
|
422
435
|
allowedOriginsWithoutCheck?: string[];
|
|
423
|
-
/** When true (e.g. admin preview iframe)
|
|
436
|
+
/** When true, skip domain check (e.g. admin preview iframe). Do not use in production embed. */
|
|
424
437
|
skipDomainCheck?: boolean;
|
|
425
|
-
/** Custom colors
|
|
438
|
+
/** Custom colors: primaryColor, headerBackground, userBalloonColor (hex or rgb). */
|
|
426
439
|
colors?: ChatbotTypes.CustomColors;
|
|
427
440
|
/** Lucide icon name for the chatbot button/header (e.g. 'Bot', 'MessageCircle'). */
|
|
428
441
|
icon?: string;
|
|
@@ -431,13 +444,22 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/provider' {
|
|
|
431
444
|
//# sourceMappingURL=provider.d.ts.map
|
|
432
445
|
}
|
|
433
446
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/provider.d.ts' {
|
|
434
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASpC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,
|
|
447
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASpC;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,kCAAkC;IAClC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;IACzB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;IAC1B,8DAA8D;IAC9D,0BAA0B,CAAC,EAAE,MAAM,EAAE,CAAA;IACrC,gGAAgG;IAChG,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oFAAoF;IACpF,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,CAAA;IAClC,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,sJAY7B,oBAAoB,sBAgLtB,CAAA"}
|
|
435
448
|
}
|
|
436
449
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox' {
|
|
450
|
+
/** Parameters for sendUserRating from useChatFeedbackBox. */
|
|
437
451
|
type SendUserRatingProps = {
|
|
452
|
+
/** Rating value (e.g. 1–5). */
|
|
438
453
|
ratingScore: number;
|
|
454
|
+
/** Optional free-text feedback. */
|
|
439
455
|
description: string;
|
|
440
456
|
};
|
|
457
|
+
/**
|
|
458
|
+
* Hook for the feedback modal: open/close and send rating.
|
|
459
|
+
* Uses useChatbot() for apiURL, locale, chatMessages, publicHash, visitorId.
|
|
460
|
+
*
|
|
461
|
+
* @returns { opened, open, close, sendUserRating, loading } — loading true while submit in progress
|
|
462
|
+
*/
|
|
441
463
|
export const useChatFeedbackBox: () => {
|
|
442
464
|
opened: boolean;
|
|
443
465
|
open: () => void;
|
|
@@ -449,22 +471,35 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox' {
|
|
|
449
471
|
//# sourceMappingURL=useChatFeedbackBox.d.ts.map
|
|
450
472
|
}
|
|
451
473
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatFeedbackBox.d.ts' {
|
|
452
|
-
{"version":3,"file":"useChatFeedbackBox.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatFeedbackBox.ts"],"names":[],"mappings":"AAIA,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;oDAkB1B,mBAAmB;;CA6BvB,CAAA"}
|
|
474
|
+
{"version":3,"file":"useChatFeedbackBox.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatFeedbackBox.ts"],"names":[],"mappings":"AAIA,6DAA6D;AAC7D,KAAK,mBAAmB,GAAG;IACzB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;oDAkB1B,mBAAmB;;CA6BvB,CAAA"}
|
|
453
475
|
}
|
|
454
476
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbot' {
|
|
477
|
+
/**
|
|
478
|
+
* Returns the chatbot context (state and actions).
|
|
479
|
+
* Must be used within a ChatbotProvider; throws otherwise.
|
|
480
|
+
*
|
|
481
|
+
* @returns ChatbotContextProps (locale, chatMessages, makeQuestion, opened, openedToggle, status, etc.)
|
|
482
|
+
*/
|
|
455
483
|
export const useChatbot: () => import("@ibti-tech/chatbot/contexts/Chatbot/context").ChatbotContextProps;
|
|
456
484
|
export default useChatbot;
|
|
457
485
|
//# sourceMappingURL=useChatbot.d.ts.map
|
|
458
486
|
}
|
|
459
487
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbot.d.ts' {
|
|
460
|
-
{"version":3,"file":"useChatbot.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbot.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,+CAMtB,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
488
|
+
{"version":3,"file":"useChatbot.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbot.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,UAAU,+CAMtB,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
461
489
|
}
|
|
462
490
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotMessages' {
|
|
463
491
|
import { ChatbotTypes } from 'types';
|
|
492
|
+
/**
|
|
493
|
+
* Options for useChatbotMessages (used internally by ChatbotProvider).
|
|
494
|
+
*/
|
|
464
495
|
export type UseChatbotMessagesOptions = {
|
|
496
|
+
/** Base URL of the chatbot API. */
|
|
465
497
|
apiURL: string;
|
|
498
|
+
/** Locale: 'pt-BR' | 'en'. */
|
|
466
499
|
locale: ChatbotTypes.Locale;
|
|
500
|
+
/** Optional. Public hash when using the public API. */
|
|
467
501
|
publicHash?: string;
|
|
502
|
+
/** Optional. Visitor id for conversation continuity. */
|
|
468
503
|
visitorId?: string;
|
|
469
504
|
};
|
|
470
505
|
export const useChatbotMessages: ({ apiURL, locale, publicHash, visitorId, }: UseChatbotMessagesOptions) => {
|
|
@@ -485,15 +520,25 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotMessages' {
|
|
|
485
520
|
//# sourceMappingURL=useChatbotMessages.d.ts.map
|
|
486
521
|
}
|
|
487
522
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotMessages.d.ts' {
|
|
488
|
-
{"version":3,"file":"useChatbotMessages.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAYpC,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,4CAKhC,yBAAyB;;iCA2JgB,MAAM;;;;;;;;;;;CAqNjD,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
523
|
+
{"version":3,"file":"useChatbotMessages.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAYpC;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,4CAKhC,yBAAyB;;iCA2JgB,MAAM;;;;;;;;;;;CAqNjD,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
489
524
|
}
|
|
490
525
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions' {
|
|
491
526
|
import { ChatbotTypes } from 'types';
|
|
527
|
+
/**
|
|
528
|
+
* Options for useChatbotSuggestedQuestions (used internally for suggested questions).
|
|
529
|
+
*/
|
|
492
530
|
export type UseChatbotSuggestedQuestionsOptions = {
|
|
531
|
+
/** Current conversation context (role + content). */
|
|
493
532
|
chatContext: ChatbotTypes.ChatContextItem[];
|
|
533
|
+
/** Base URL of the API. */
|
|
494
534
|
apiURL: string;
|
|
535
|
+
/** Locale: 'pt-BR' | 'en'. */
|
|
495
536
|
locale: ChatbotTypes.Locale;
|
|
496
537
|
};
|
|
538
|
+
/**
|
|
539
|
+
* Hook for suggested questions (used by ChatbotProvider).
|
|
540
|
+
* Returns loading state, list of question strings, fetchData, and resetData.
|
|
541
|
+
*/
|
|
497
542
|
export const useChatbotSuggestedQuestions: ({ chatContext, locale, apiURL, }: UseChatbotSuggestedQuestionsOptions) => {
|
|
498
543
|
loading: boolean;
|
|
499
544
|
data: string[];
|
|
@@ -503,7 +548,7 @@ declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions
|
|
|
503
548
|
//# sourceMappingURL=useChatbotSuggestedQuestions.d.ts.map
|
|
504
549
|
}
|
|
505
550
|
declare module '@ibti-tech/chatbot/contexts/Chatbot/useChatbotSuggestedQuestions.d.ts' {
|
|
506
|
-
{"version":3,"file":"useChatbotSuggestedQuestions.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotSuggestedQuestions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,MAAM,MAAM,mCAAmC,GAAG;IAChD,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE,CAAA;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,4BAA4B,GAAI,kCAI1C,mCAAmC;;;;;CA2BrC,CAAA"}
|
|
551
|
+
{"version":3,"file":"useChatbotSuggestedQuestions.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/contexts/Chatbot/useChatbotSuggestedQuestions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,qDAAqD;IACrD,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE,CAAA;IAC3C,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;CAC5B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GAAI,kCAI1C,mCAAmC;;;;;CA2BrC,CAAA"}
|
|
507
552
|
}
|
|
508
553
|
declare module '@ibti-tech/chatbot/cookies/chat' {
|
|
509
554
|
import { ChatbotTypes } from 'types';
|
|
@@ -555,29 +600,37 @@ declare module '@ibti-tech/chatbot/cookies/chat.d.ts' {
|
|
|
555
600
|
}
|
|
556
601
|
declare module '@ibti-tech/chatbot/embed' {
|
|
557
602
|
/**
|
|
558
|
-
* Embed entry point for HTML/WordPress/PHP.
|
|
559
|
-
*
|
|
560
|
-
* Mounts the
|
|
603
|
+
* Embed entry point for HTML / WordPress / PHP.
|
|
604
|
+
* Config: window.IBTIChatbotConfig or data-* attributes on the script tag.
|
|
605
|
+
* Mounts the widget into #ibti-chatbot-root (or containerId). Exposes window.IBTIChatbotEmbed.init(config) and destroy().
|
|
561
606
|
*/
|
|
562
607
|
import type { ChatbotTypes } from '@ibti-tech/chatbot/types/index';
|
|
563
|
-
/**
|
|
608
|
+
/**
|
|
609
|
+
* Embed configuration. Pass to IBTIChatbotEmbed.init(config) or set window.IBTIChatbotConfig.
|
|
610
|
+
* data-* attributes: data-api-url, data-public-hash, data-locale, data-theme, data-position, data-colors (JSON), data-icon, data-texts (JSON).
|
|
611
|
+
*/
|
|
564
612
|
export interface IBTIChatbotEmbedConfig {
|
|
613
|
+
/** Base URL of the chatbot API. Required. */
|
|
565
614
|
apiURL: string;
|
|
615
|
+
/** Public hash of the chatbot. Required. */
|
|
566
616
|
publicHash: string;
|
|
617
|
+
/** Locale: 'pt-BR' | 'en'. Default: 'pt-BR'. */
|
|
567
618
|
locale?: ChatbotTypes.Locale;
|
|
619
|
+
/** Theme: 'light' | 'dark'. Default: 'light'. */
|
|
568
620
|
theme?: ChatbotTypes.Theme;
|
|
621
|
+
/** Bar position. Default: 'bottom-right'. */
|
|
569
622
|
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
570
|
-
/**
|
|
623
|
+
/** DOM id for the mount container. Default: 'ibti-chatbot-root'. If missing, a div is created and appended to body. */
|
|
571
624
|
containerId?: string;
|
|
572
|
-
/**
|
|
625
|
+
/** Skip domain validation (e.g. admin preview). Do not use in production. */
|
|
573
626
|
skipDomainCheck?: boolean;
|
|
574
|
-
/** Custom colors
|
|
627
|
+
/** Custom colors: primaryColor, headerBackground, userBalloonColor (hex or rgb). */
|
|
575
628
|
colors?: ChatbotTypes.CustomColors;
|
|
576
|
-
/** Initial open state of the
|
|
629
|
+
/** Initial open state of the chat panel. Default: false. */
|
|
577
630
|
isOpen?: boolean;
|
|
578
|
-
/** Lucide icon name for the
|
|
631
|
+
/** Lucide icon name for the button/header (e.g. 'Bot', 'MessageCircle'). */
|
|
579
632
|
icon?: string;
|
|
580
|
-
/** Custom texts per locale
|
|
633
|
+
/** Custom UI texts per locale: { 'pt-BR': CustomTexts, 'en': CustomTexts }. */
|
|
581
634
|
texts?: ChatbotTypes.Texts;
|
|
582
635
|
}
|
|
583
636
|
global {
|
|
@@ -593,7 +646,7 @@ declare module '@ibti-tech/chatbot/embed' {
|
|
|
593
646
|
//# sourceMappingURL=embed.d.ts.map
|
|
594
647
|
}
|
|
595
648
|
declare module '@ibti-tech/chatbot/embed.d.ts' {
|
|
596
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/embed.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C
|
|
649
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/embed.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,gDAAgD;IAChD,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAA;IAC5B,iDAAiD;IACjD,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;IACpE,uHAAuH;IACvH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oFAAoF;IACpF,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,CAAA;IAClC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+EAA+E;IAC/E,KAAK,CAAC,EAAE,YAAY,CAAC,KAAK,CAAA;CAC3B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,iBAAiB,CAAC,EAAE,sBAAsB,CAAA;QAC1C,gBAAgB,CAAC,EAAE;YACjB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,sBAAsB,KAAK,IAAI,CAAA;YAC/C,OAAO,EAAE,MAAM,IAAI,CAAA;SACpB,CAAA;KACF;CACF;AAyID,wBAAgB,UAAU,SAEzB"}
|
|
597
650
|
}
|
|
598
651
|
declare module '@ibti-tech/chatbot/events/assistant-answer' {
|
|
599
652
|
export const dispatchAssitantAnswer: () => void;
|
|
@@ -711,6 +764,18 @@ declare module '@ibti-tech/chatbot/i18n/index.d.ts' {
|
|
|
711
764
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,eAAO,MAAM,OAAO,0BAA2B,CAAA;AAE/C,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAGzD,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,MAAM,YAAY,CAAC,MAAM,gBAAe,CAAA"}
|
|
712
765
|
}
|
|
713
766
|
declare module '@ibti-tech/chatbot/index' {
|
|
767
|
+
/**
|
|
768
|
+
* @ibti-tech/chatbot — React package entry.
|
|
769
|
+
*
|
|
770
|
+
* React usage:
|
|
771
|
+
* - ChatbotProvider: wrap your app; props: locale, apiURL, publicHash, theme, isOpen?, texts?, colors?, icon?, skipDomainCheck?, allowedOriginsWithoutCheck?
|
|
772
|
+
* - ChatbotBar: floating bar + panel; props: verticalPosition?, horizontalPosition?, deviceHorizontalPosition?, zIndex?, topOffset?, aboveHeader?, pushContentDown?, pushContentDownRowBackgroundLight?, pushContentDownRowBackgroundDark?
|
|
773
|
+
* - useChatbot(): returns context (chatMessages, makeQuestion, opened, openedToggle, status, etc.)
|
|
774
|
+
* - ChatbotContext: React context (prefer useChatbot())
|
|
775
|
+
* - ChatbotDevice: inner device component (usually used by ChatbotBar)
|
|
776
|
+
*
|
|
777
|
+
* Types: ChatbotTypes (Theme, Locale, CustomColors, ChatMessage, ChatContextItem, Status, InitializationStatus, ChatbotPublicResponse, Config, CustomTexts, Texts)
|
|
778
|
+
*/
|
|
714
779
|
export { useChatbot } from 'contexts/Chatbot/useChatbot';
|
|
715
780
|
export { ChatbotContext } from 'contexts/Chatbot/context';
|
|
716
781
|
export { ChatbotProvider } from 'contexts/Chatbot/provider';
|
|
@@ -720,7 +785,7 @@ declare module '@ibti-tech/chatbot/index' {
|
|
|
720
785
|
//# sourceMappingURL=index.d.ts.map
|
|
721
786
|
}
|
|
722
787
|
declare module '@ibti-tech/chatbot/index.d.ts' {
|
|
723
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA"}
|
|
788
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA"}
|
|
724
789
|
}
|
|
725
790
|
declare module '@ibti-tech/chatbot/mocks/chatHistory' {
|
|
726
791
|
export const chatHistoryMocked: readonly [{
|
|
@@ -788,61 +853,67 @@ declare module '@ibti-tech/chatbot/mocks/chatHistory.d.ts' {
|
|
|
788
853
|
}
|
|
789
854
|
declare module '@ibti-tech/chatbot/services/api/http-client' {
|
|
790
855
|
/**
|
|
791
|
-
*
|
|
792
|
-
*
|
|
856
|
+
* Default headers for all chatbot API requests.
|
|
857
|
+
* - Content-Type: application/json
|
|
858
|
+
* - User-Agent: navigator.userAgent when available, else 'IBTI-Chatbot/1.0'
|
|
859
|
+
*
|
|
860
|
+
* @returns Record of header name to value (suitable for fetch headers)
|
|
793
861
|
*/
|
|
794
862
|
export const getDefaultHeaders: () => Record<string, string>;
|
|
795
863
|
//# sourceMappingURL=http-client.d.ts.map
|
|
796
864
|
}
|
|
797
865
|
declare module '@ibti-tech/chatbot/services/api/http-client.d.ts' {
|
|
798
|
-
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/api/http-client.ts"],"names":[],"mappings":"AAAA
|
|
866
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/api/http-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAIxD,CAAA"}
|
|
799
867
|
}
|
|
800
868
|
declare module '@ibti-tech/chatbot/services/chat/chat.api' {
|
|
801
869
|
import { ChatbotTypes } from 'types';
|
|
802
870
|
import type { SendNewQuestionOptions } from '@ibti-tech/chatbot/services/types/index';
|
|
803
871
|
/**
|
|
804
872
|
* Sends chat context to the completion endpoint and streams the response.
|
|
805
|
-
* POST /chat/completion?locale=&hash=&visitorId=
|
|
873
|
+
* Endpoint: POST /chat/completion?locale=&hash=&visitorId=
|
|
806
874
|
*
|
|
807
|
-
* @param options -
|
|
875
|
+
* @param options - SendNewQuestionOptions: chatContext, locale, apiURL, optional publicHash/visitorId, onReceiving, onDone
|
|
876
|
+
* @returns Promise that resolves when the stream ends (no value)
|
|
877
|
+
* @throws Error when response is not ok (includes status in message)
|
|
808
878
|
*/
|
|
809
879
|
export const sendChatContext: ({ chatContext, locale, onReceiving, onDone, apiURL, publicHash, visitorId, }: SendNewQuestionOptions) => Promise<void>;
|
|
810
880
|
/**
|
|
811
|
-
* Checks if the API is available
|
|
812
|
-
* Tries HEAD first
|
|
881
|
+
* Checks if the API is available (lightweight health check).
|
|
882
|
+
* Tries HEAD on /chat/welcome first; falls back to GET on failure. Timeout: 5s.
|
|
813
883
|
*
|
|
814
|
-
* @param apiUrl - Base URL of the API
|
|
815
|
-
* @param locale - Locale for
|
|
816
|
-
* @param publicHash - Optional;
|
|
817
|
-
* @returns true if
|
|
884
|
+
* @param apiUrl - Base URL of the API (e.g. https://api.example.com)
|
|
885
|
+
* @param locale - Locale for query: 'pt-BR' | 'en'
|
|
886
|
+
* @param publicHash - Optional; added as query param when provided
|
|
887
|
+
* @returns true if response is ok, false on error or timeout
|
|
818
888
|
*/
|
|
819
889
|
export const checkApiHealth: (apiUrl: string, locale?: ChatbotTypes.Locale, publicHash?: string) => Promise<boolean>;
|
|
820
890
|
/**
|
|
821
891
|
* Fetches the welcome message for the chatbot.
|
|
822
|
-
* GET /chat/welcome?locale=&hash=
|
|
892
|
+
* Endpoint: GET /chat/welcome?locale=&hash=
|
|
823
893
|
*
|
|
824
894
|
* @param apiUrl - Base URL of the API
|
|
825
|
-
* @param locale - Locale for the welcome message
|
|
826
|
-
* @param publicHash - Optional;
|
|
827
|
-
* @returns
|
|
895
|
+
* @param locale - Locale for the welcome message: 'pt-BR' | 'en'
|
|
896
|
+
* @param publicHash - Optional; chatbot identifier when using public API
|
|
897
|
+
* @returns Promise resolving to the welcome message string
|
|
898
|
+
* @throws Error when response is not ok (uses i18n error message + status)
|
|
828
899
|
*/
|
|
829
900
|
export const getWelcomeMessage: (apiUrl: string, locale?: ChatbotTypes.Locale, publicHash?: string) => Promise<string>;
|
|
830
901
|
//# sourceMappingURL=chat.api.d.ts.map
|
|
831
902
|
}
|
|
832
903
|
declare module '@ibti-tech/chatbot/services/chat/chat.api.d.ts' {
|
|
833
|
-
{"version":3,"file":"chat.api.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/chat/chat.api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEtD
|
|
904
|
+
{"version":3,"file":"chat.api.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/chat/chat.api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAU,8EAQnC,sBAAsB,KAAG,OAAO,CAAC,IAAI,CAwCvC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,SAAQ,YAAY,CAAC,MAAa,EAClC,aAAa,MAAM,KAClB,OAAO,CAAC,OAAO,CAuCjB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EACd,SAAQ,YAAY,CAAC,MAAa,EAClC,aAAa,MAAM,KAClB,OAAO,CAAC,MAAM,CAoBhB,CAAA"}
|
|
834
905
|
}
|
|
835
906
|
declare module '@ibti-tech/chatbot/services/chatbot/chatbot.api' {
|
|
836
907
|
import { ChatbotTypes } from 'types';
|
|
837
908
|
/**
|
|
838
909
|
* Fetches a chatbot by its public hash.
|
|
839
|
-
* GET /chatbots/public/:hash
|
|
840
|
-
* Results are cached in memory for 5 minutes
|
|
910
|
+
* Endpoint: GET /chatbots/public/:hash
|
|
911
|
+
* Results are cached in memory for 5 minutes (key: apiURL:publicHash).
|
|
841
912
|
*
|
|
842
|
-
* @param apiURL - Base URL of the API
|
|
843
|
-
* @param publicHash - Public hash of the chatbot
|
|
844
|
-
* @returns
|
|
845
|
-
* @throws Error when chatbot is not found (404 or
|
|
913
|
+
* @param apiURL - Base URL of the API (no trailing slash)
|
|
914
|
+
* @param publicHash - Public hash of the chatbot (from admin/embed config)
|
|
915
|
+
* @returns Promise resolving to ChatbotPublicResponse (id, name, domain, etc.)
|
|
916
|
+
* @throws Error when chatbot is not found (e.g. 404) or request fails
|
|
846
917
|
*/
|
|
847
918
|
export const getChatbotByPublicHash: (apiURL: string, publicHash: string) => Promise<ChatbotTypes.ChatbotPublicResponse>;
|
|
848
919
|
//# sourceMappingURL=chatbot.api.d.ts.map
|
|
@@ -853,25 +924,34 @@ declare module '@ibti-tech/chatbot/services/chatbot/chatbot.api.d.ts' {
|
|
|
853
924
|
declare module '@ibti-tech/chatbot/services/feedback/feedback.api' {
|
|
854
925
|
import type { SendUserChatFeedbackParams } from '@ibti-tech/chatbot/services/types/index';
|
|
855
926
|
/**
|
|
856
|
-
* Sends user feedback (rating) for the chat session.
|
|
857
|
-
* POST /chat/feedback
|
|
858
|
-
*
|
|
859
|
-
* When publicHash and visitorId are provided, the API can associate
|
|
860
|
-
* the feedback with the correct conversation.
|
|
927
|
+
* Sends user feedback (rating) for the current chat session.
|
|
928
|
+
* Endpoint: POST /chat/feedback
|
|
929
|
+
* Body: locale, rating_score, chat_context, message (optional), hash (optional), visitorId (optional).
|
|
861
930
|
*
|
|
862
|
-
* @param params -
|
|
863
|
-
* @returns
|
|
931
|
+
* @param params - SendUserChatFeedbackParams: apiURL, locale, chatContext, ratingScore, optional description, publicHash, visitorId
|
|
932
|
+
* @returns Promise resolving to the fetch Response; check response.ok for success
|
|
864
933
|
*/
|
|
865
934
|
export const sendUserChatFeedback: ({ apiURL, chatContext, locale, ratingScore, description, publicHash, visitorId, }: SendUserChatFeedbackParams) => Promise<Response>;
|
|
866
935
|
//# sourceMappingURL=feedback.api.d.ts.map
|
|
867
936
|
}
|
|
868
937
|
declare module '@ibti-tech/chatbot/services/feedback/feedback.api.d.ts' {
|
|
869
|
-
{"version":3,"file":"feedback.api.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/feedback/feedback.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAE1D
|
|
938
|
+
{"version":3,"file":"feedback.api.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/feedback/feedback.api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAU,mFAQxC,0BAA0B,KAAG,OAAO,CAAC,QAAQ,CAa/C,CAAA"}
|
|
870
939
|
}
|
|
871
940
|
declare module '@ibti-tech/chatbot/services/index' {
|
|
872
941
|
/**
|
|
873
|
-
*
|
|
874
|
-
*
|
|
942
|
+
* Chatbot API services (barrel).
|
|
943
|
+
* Use these when integrating the chatbot or building a custom client.
|
|
944
|
+
*
|
|
945
|
+
* Chatbot config:
|
|
946
|
+
* - getChatbotByPublicHash(apiURL, publicHash) → ChatbotPublicResponse
|
|
947
|
+
*
|
|
948
|
+
* Chat:
|
|
949
|
+
* - sendChatContext(options) → streams completion, calls onReceiving/onDone
|
|
950
|
+
* - checkApiHealth(apiUrl, locale?, publicHash?) → boolean
|
|
951
|
+
* - getWelcomeMessage(apiUrl, locale?, publicHash?) → string
|
|
952
|
+
*
|
|
953
|
+
* Feedback:
|
|
954
|
+
* - sendUserChatFeedback(params) → Response
|
|
875
955
|
*/
|
|
876
956
|
export { getChatbotByPublicHash } from '@ibti-tech/chatbot/services/chatbot/chatbot.api';
|
|
877
957
|
export { sendChatContext, checkApiHealth, getWelcomeMessage, } from '@ibti-tech/chatbot/services/chat/chat.api';
|
|
@@ -880,24 +960,32 @@ declare module '@ibti-tech/chatbot/services/index' {
|
|
|
880
960
|
//# sourceMappingURL=index.d.ts.map
|
|
881
961
|
}
|
|
882
962
|
declare module '@ibti-tech/chatbot/services/index.d.ts' {
|
|
883
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/index.ts"],"names":[],"mappings":"AAAA
|
|
963
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAE9D,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,SAAS,CAAA"}
|
|
884
964
|
}
|
|
885
965
|
declare module '@ibti-tech/chatbot/services/types/chat.types' {
|
|
886
966
|
import { ChatbotTypes } from 'types';
|
|
887
967
|
/**
|
|
888
|
-
* Options for sending a new question to the chat completion endpoint.
|
|
968
|
+
* Options for sending a new question to the chat completion endpoint (POST /chat/completion).
|
|
969
|
+
* Used by `sendChatContext`.
|
|
889
970
|
*/
|
|
890
971
|
export type SendNewQuestionOptions = {
|
|
972
|
+
/** Ordered list of messages (role + content) to send as context. */
|
|
891
973
|
chatContext: Pick<ChatbotTypes.ChatMessage, 'content' | 'role'>[];
|
|
974
|
+
/** Locale for the request: `'pt-BR'` | `'en'`. */
|
|
892
975
|
locale: ChatbotTypes.Locale;
|
|
976
|
+
/** Base URL of the chatbot API (no trailing slash). */
|
|
893
977
|
apiURL: string;
|
|
978
|
+
/** Optional. Public hash of the chatbot (required for domain-validated API). */
|
|
894
979
|
publicHash?: string;
|
|
980
|
+
/** Optional. Stable visitor id for conversation continuity. */
|
|
895
981
|
visitorId?: string;
|
|
982
|
+
/** Called for each streamed chunk: full message so far and the new chunk. */
|
|
896
983
|
onReceiving: (receivedMessage: string, receivedPart: string) => void;
|
|
984
|
+
/** Called when the stream finishes. */
|
|
897
985
|
onDone: () => void;
|
|
898
986
|
};
|
|
899
987
|
/**
|
|
900
|
-
* Options for fetching suggested questions (currently unused).
|
|
988
|
+
* Options for fetching suggested questions (currently unused in UI).
|
|
901
989
|
*/
|
|
902
990
|
export type GetSuggestedQuestions = {
|
|
903
991
|
chatContext: Pick<ChatbotTypes.ChatMessage, 'content' | 'role'>[];
|
|
@@ -905,32 +993,40 @@ declare module '@ibti-tech/chatbot/services/types/chat.types' {
|
|
|
905
993
|
apiURL: string;
|
|
906
994
|
};
|
|
907
995
|
/**
|
|
908
|
-
* DTO
|
|
996
|
+
* Suggested question DTO (single string per item; API may return an array of these).
|
|
909
997
|
*/
|
|
910
998
|
export type SuggestedQuestionDTO = string;
|
|
911
999
|
//# sourceMappingURL=chat.types.d.ts.map
|
|
912
1000
|
}
|
|
913
1001
|
declare module '@ibti-tech/chatbot/services/types/chat.types.d.ts' {
|
|
914
|
-
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/types/chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC
|
|
1002
|
+
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/types/chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,oEAAoE;IACpE,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,CAAA;IACjE,kDAAkD;IAClD,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,WAAW,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACpE,uCAAuC;IACvC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,CAAA;IACjE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAA"}
|
|
915
1003
|
}
|
|
916
1004
|
declare module '@ibti-tech/chatbot/services/types/feedback.types' {
|
|
917
1005
|
import { ChatbotTypes } from 'types';
|
|
918
1006
|
/**
|
|
919
|
-
* Parameters for sending user chat feedback (
|
|
1007
|
+
* Parameters for sending user chat feedback (POST /chat/feedback).
|
|
1008
|
+
* Used by `sendUserChatFeedback`.
|
|
920
1009
|
*/
|
|
921
1010
|
export type SendUserChatFeedbackParams = {
|
|
1011
|
+
/** Locale: `'pt-BR'` | `'en'`. */
|
|
922
1012
|
locale: ChatbotTypes.Locale;
|
|
1013
|
+
/** Base URL of the chatbot API. */
|
|
923
1014
|
apiURL: string;
|
|
1015
|
+
/** Optional. Public hash of the chatbot. */
|
|
924
1016
|
publicHash?: string;
|
|
1017
|
+
/** Optional. Visitor id to associate feedback with the conversation. */
|
|
925
1018
|
visitorId?: string;
|
|
1019
|
+
/** Current conversation context (role + content) for the session being rated. */
|
|
926
1020
|
chatContext: Pick<ChatbotTypes.ChatMessage, 'content' | 'role'>[];
|
|
1021
|
+
/** Rating score (e.g. 1–5). */
|
|
927
1022
|
ratingScore: number;
|
|
1023
|
+
/** Optional. Free-text feedback. */
|
|
928
1024
|
description?: string;
|
|
929
1025
|
};
|
|
930
1026
|
//# sourceMappingURL=feedback.types.d.ts.map
|
|
931
1027
|
}
|
|
932
1028
|
declare module '@ibti-tech/chatbot/services/types/feedback.types.d.ts' {
|
|
933
|
-
{"version":3,"file":"feedback.types.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/types/feedback.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC
|
|
1029
|
+
{"version":3,"file":"feedback.types.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/services/types/feedback.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEpC;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,kCAAkC;IAClC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAA;IAC3B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iFAAiF;IACjF,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,CAAA;IACjE,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA"}
|
|
934
1030
|
}
|
|
935
1031
|
declare module '@ibti-tech/chatbot/services/types/index' {
|
|
936
1032
|
export * from '@ibti-tech/chatbot/services/types/chat.types';
|
|
@@ -1072,33 +1168,64 @@ declare module '@ibti-tech/chatbot/themes/index.d.ts' {
|
|
|
1072
1168
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/themes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGlB,CAAA;AAED,gDAAgD;AAChD,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,OAAO,iBAAiB,EACnC,YAAY,CAAC,EAAE,YAAY,CAAC,YAAY,GACvC,OAAO,iBAAiB,CAqC1B"}
|
|
1073
1169
|
}
|
|
1074
1170
|
declare module '@ibti-tech/chatbot/types/index' {
|
|
1171
|
+
/**
|
|
1172
|
+
* Chatbot frontend type definitions.
|
|
1173
|
+
* Use these types when integrating the chatbot as a client (React app or embed).
|
|
1174
|
+
*/
|
|
1075
1175
|
export namespace ChatbotTypes {
|
|
1176
|
+
/** UI theme: `'light'` or `'dark'`. */
|
|
1076
1177
|
type Theme = 'light' | 'dark';
|
|
1178
|
+
/** Supported locales: `'pt-BR'` | `'en'`. */
|
|
1077
1179
|
type Locale = 'pt-BR' | 'en';
|
|
1078
|
-
/**
|
|
1180
|
+
/**
|
|
1181
|
+
* Custom colors to override chatbot theme elements.
|
|
1182
|
+
* Values: hex (e.g. `#rrggbb`) or `rgb(r,g,b)`.
|
|
1183
|
+
*/
|
|
1079
1184
|
interface CustomColors {
|
|
1080
|
-
/** Primary accent: header avatar, toggle, buttons, user balloons, links, scrollbars */
|
|
1185
|
+
/** Primary accent: header avatar, toggle button, action buttons, user balloons, links, scrollbars. */
|
|
1081
1186
|
primaryColor?: string;
|
|
1082
|
-
/** Header bar background. Defaults to primaryColor if not set */
|
|
1187
|
+
/** Header bar background. Defaults to `primaryColor` if not set. */
|
|
1083
1188
|
headerBackground?: string;
|
|
1084
|
-
/** User message balloon background. Defaults to primaryColor if not set */
|
|
1189
|
+
/** User message balloon background. Defaults to `primaryColor` if not set. */
|
|
1085
1190
|
userBalloonColor?: string;
|
|
1086
1191
|
}
|
|
1192
|
+
/**
|
|
1193
|
+
* A single message in the chat thread (user or assistant).
|
|
1194
|
+
*/
|
|
1087
1195
|
type ChatMessage = {
|
|
1196
|
+
/** Unique message id (e.g. UUID). */
|
|
1088
1197
|
id: string;
|
|
1198
|
+
/** ISO/UTC timestamp string. */
|
|
1089
1199
|
timestamp: string;
|
|
1200
|
+
/** Sender: `'user'` or `'assistant'`. */
|
|
1090
1201
|
role: 'user' | 'assistant';
|
|
1202
|
+
/** Message body (plain text). */
|
|
1091
1203
|
content: string;
|
|
1204
|
+
/** When true, content is an error message to display. */
|
|
1092
1205
|
error?: boolean;
|
|
1093
1206
|
};
|
|
1207
|
+
/**
|
|
1208
|
+
* Minimal message shape for API context (role + content only).
|
|
1209
|
+
* Used when sending chat context to completion or feedback endpoints.
|
|
1210
|
+
*/
|
|
1094
1211
|
type ChatContextItem = {
|
|
1095
1212
|
role: 'user' | 'assistant';
|
|
1096
1213
|
content: string;
|
|
1097
1214
|
};
|
|
1215
|
+
/** Widget status shown in the header: writing indicator, loading, online, or unavailable. */
|
|
1098
1216
|
type Status = 'writing' | 'loading' | 'online' | 'unavailable';
|
|
1099
|
-
/**
|
|
1217
|
+
/**
|
|
1218
|
+
* Initialization state of the widget (when using `publicHash`).
|
|
1219
|
+
* - `loading`: fetching chatbot config
|
|
1220
|
+
* - `domain_not_allowed`: current origin not in allowed domains
|
|
1221
|
+
* - `error`: network or API error
|
|
1222
|
+
* - `ready`: widget ready to chat
|
|
1223
|
+
*/
|
|
1100
1224
|
type InitializationStatus = 'loading' | 'domain_not_allowed' | 'error' | 'ready';
|
|
1101
|
-
/**
|
|
1225
|
+
/**
|
|
1226
|
+
* Response from GET `/chatbots/public/:hash`.
|
|
1227
|
+
* Contains chatbot metadata and domain info.
|
|
1228
|
+
*/
|
|
1102
1229
|
interface ChatbotPublicResponse {
|
|
1103
1230
|
id: number;
|
|
1104
1231
|
name: string;
|
|
@@ -1112,12 +1239,21 @@ declare module '@ibti-tech/chatbot/types/index' {
|
|
|
1112
1239
|
chatInstructions?: unknown;
|
|
1113
1240
|
client?: unknown;
|
|
1114
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Optional config for API and domain behaviour.
|
|
1244
|
+
* Used internally; for embed/client prefer ChatbotProvider props or IBTIChatbotEmbedConfig.
|
|
1245
|
+
*/
|
|
1115
1246
|
interface Config {
|
|
1116
1247
|
apiURL?: string;
|
|
1117
1248
|
publicHash?: string;
|
|
1118
1249
|
additionalInstructions?: string;
|
|
1250
|
+
/** Origins that skip domain validation (e.g. for preview). */
|
|
1119
1251
|
allowedOriginsWithoutCheck?: string[];
|
|
1120
1252
|
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Custom UI copy per section (locale key → strings).
|
|
1255
|
+
* Override only the keys you need; rest use defaults.
|
|
1256
|
+
*/
|
|
1121
1257
|
interface CustomTexts {
|
|
1122
1258
|
CHATBOT_NAME?: string;
|
|
1123
1259
|
INPUT_PLACEHOLDER?: string;
|
|
@@ -1155,6 +1291,7 @@ declare module '@ibti-tech/chatbot/types/index' {
|
|
|
1155
1291
|
USER_LABEL?: string;
|
|
1156
1292
|
WRITING_MESSAGE?: string;
|
|
1157
1293
|
}
|
|
1294
|
+
/** Map of locale code to CustomTexts. Example: `{ 'pt-BR': { ... }, 'en': { ... } }`. */
|
|
1158
1295
|
interface Texts {
|
|
1159
1296
|
[locale: string]: CustomTexts;
|
|
1160
1297
|
}
|
|
@@ -1162,7 +1299,7 @@ declare module '@ibti-tech/chatbot/types/index' {
|
|
|
1162
1299
|
//# sourceMappingURL=index.d.ts.map
|
|
1163
1300
|
}
|
|
1164
1301
|
declare module '@ibti-tech/chatbot/types/index.d.ts' {
|
|
1165
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/types/index.ts"],"names":[],"mappings":"AAAA,yBAAiB,YAAY,CAAC;IAC5B,KAAY,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;IAEpC,KAAY,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IAEnC
|
|
1302
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/types/index.ts"],"names":[],"mappings":"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"}
|
|
1166
1303
|
}
|
|
1167
1304
|
declare module '@ibti-tech/chatbot/utils/domainValidation' {
|
|
1168
1305
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibti-tech/chatbot",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Chatbot developed
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "Chatbot system developed to be embedded in any website",
|
|
5
5
|
"packageManager": "yarn@3.6.4",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|