@qoretechnologies/qorus-chat 0.1.0-beta.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 +82 -0
- package/dist/client/chatClient.d.ts +16 -0
- package/dist/client/chatClient.d.ts.map +1 -0
- package/dist/client/sseParser.d.ts +3 -0
- package/dist/client/sseParser.d.ts.map +1 -0
- package/dist/client/types.d.ts +38 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/components/BubbleLauncher.d.ts +6 -0
- package/dist/components/BubbleLauncher.d.ts.map +1 -0
- package/dist/components/ChatShell.d.ts +24 -0
- package/dist/components/ChatShell.d.ts.map +1 -0
- package/dist/components/ChatWidget.d.ts +26 -0
- package/dist/components/ChatWidget.d.ts.map +1 -0
- package/dist/components/MessageInput.d.ts +11 -0
- package/dist/components/MessageInput.d.ts.map +1 -0
- package/dist/components/MessageList.d.ts +9 -0
- package/dist/components/MessageList.d.ts.map +1 -0
- package/dist/components/Sources.d.ts +6 -0
- package/dist/components/Sources.d.ts.map +1 -0
- package/dist/components/theme.d.ts +20 -0
- package/dist/components/theme.d.ts.map +1 -0
- package/dist/components/types.d.ts +15 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/components/useChatSession.d.ts +17 -0
- package/dist/components/useChatSession.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/qorus-chat.js +721 -0
- package/dist/qorus-chat.js.map +1 -0
- package/dist/widget.js +6550 -0
- package/dist/widget.js.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @qoretechnologies/qorus-chat
|
|
2
|
+
|
|
3
|
+
Embeddable chat widget for Qorus AI endpoints.
|
|
4
|
+
|
|
5
|
+
A single `<script>` tag drops a chatbot onto any website, backed by an `ai-endpoint`
|
|
6
|
+
authored in the Qorus IDE — model + system prompt + tools + RAG collections + guardrails
|
|
7
|
+
all wired server-side. The customer's HTML only carries the snippet.
|
|
8
|
+
|
|
9
|
+
## Distribution
|
|
10
|
+
|
|
11
|
+
- **Primary**: served by every Qorus instance at `/widget/qorus-chat.js`. The IDE
|
|
12
|
+
generates the snippet pre-filled with the user's Qorus URL and a public API key.
|
|
13
|
+
- **Mirror**: same artifact published to npm so jsDelivr / unpkg auto-host a CDN copy
|
|
14
|
+
for customers who want one URL across instances.
|
|
15
|
+
|
|
16
|
+
## Snippet
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<!-- Floating bubble (default) -->
|
|
20
|
+
<script src="https://<your-qorus>.example/widget/qorus-chat.js"
|
|
21
|
+
data-endpoint="<endpoint-uuid>"
|
|
22
|
+
data-key="qw_pk_..."
|
|
23
|
+
defer></script>
|
|
24
|
+
|
|
25
|
+
<!-- Inline mount -->
|
|
26
|
+
<div id="chat"></div>
|
|
27
|
+
<script src="https://<your-qorus>.example/widget/qorus-chat.js"
|
|
28
|
+
data-endpoint="<endpoint-uuid>"
|
|
29
|
+
data-key="qw_pk_..."
|
|
30
|
+
data-mode="inline"
|
|
31
|
+
data-mount="#chat"
|
|
32
|
+
defer></script>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Theming
|
|
36
|
+
|
|
37
|
+
The widget ships three curated base looks; the customer picks one and sets a brand
|
|
38
|
+
accent — they can't pass a broken theme.
|
|
39
|
+
|
|
40
|
+
| Attribute | JS option | Values | Effect |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| `data-theme` | `theme` | `qorus` (default), `dark`, `light` | Base panel look |
|
|
43
|
+
| `data-accent` | `accent` | any hex, e.g. `#ff5a1f` | Launcher, send button, user bubble |
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<script src="https://<your-qorus>.example/widget/qorus-chat.js"
|
|
47
|
+
data-endpoint="<endpoint-uuid>"
|
|
48
|
+
data-key="qw_pk_..."
|
|
49
|
+
data-theme="light"
|
|
50
|
+
data-accent="#ff5a1f"
|
|
51
|
+
defer></script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## JS API
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
window.QorusChat.mount({
|
|
58
|
+
endpoint: '<endpoint-uuid>',
|
|
59
|
+
apiKey: 'qw_pk_...',
|
|
60
|
+
baseUrl: 'https://<your-qorus>.example',
|
|
61
|
+
mode: 'bubble', // or 'inline'
|
|
62
|
+
mount: '#chat', // required for inline
|
|
63
|
+
theme: 'qorus', // 'qorus' | 'dark' | 'light'
|
|
64
|
+
accent: '#7b68ee', // brand accent hex
|
|
65
|
+
visitorId: 'anon-abc',
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Build
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
yarn install
|
|
73
|
+
yarn build # produces dist/widget.js
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The bundle is self-contained — React, react-dom, styled-components, and Reqore are
|
|
77
|
+
bundled in. No peer deps on the customer page.
|
|
78
|
+
|
|
79
|
+
## Related
|
|
80
|
+
|
|
81
|
+
- IDE-side task: `~/Projects/qorus-ide/.tasks/AI_ENDPOINT_PLAYGROUND_AND_EMBED.md`
|
|
82
|
+
- Server prerequisites (umbrella): qoretechnologies/qorus#226
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IChatClientOptions, IChatMessage, TChatStreamEvent } from './types';
|
|
2
|
+
export declare class QorusChatClient {
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
private readonly endpoint;
|
|
5
|
+
private readonly apiKey;
|
|
6
|
+
private readonly visitorId?;
|
|
7
|
+
constructor(opts: IChatClientOptions);
|
|
8
|
+
streamStateless(message: string): AsyncGenerator<TChatStreamEvent, void, void>;
|
|
9
|
+
createConversation(): Promise<{
|
|
10
|
+
uuid: string;
|
|
11
|
+
}>;
|
|
12
|
+
streamMessage(conversationUuid: string, message: string, history?: IChatMessage[]): AsyncGenerator<TChatStreamEvent, void, void>;
|
|
13
|
+
private postSse;
|
|
14
|
+
private headers;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=chatClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatClient.d.ts","sourceRoot":"","sources":["../../src/client/chatClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAqClF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;gBAExB,IAAI,EAAE,kBAAkB;IAO7B,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC;IAc/E,kBAAkB,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAY9C,aAAa,CAClB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY,EAAE,GACvB,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC;IAiB/C,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,OAAO;CAShB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sseParser.d.ts","sourceRoot":"","sources":["../../src/client/sseParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAWhD,wBAAuB,cAAc,CACnC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GACjC,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAwC9C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface IChatClientOptions {
|
|
2
|
+
endpoint: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
visitorId?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IChatMessage {
|
|
8
|
+
role: 'user' | 'assistant' | 'system';
|
|
9
|
+
content: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IChatTurnUsage {
|
|
12
|
+
prompt_tokens?: number;
|
|
13
|
+
completion_tokens?: number;
|
|
14
|
+
total_tokens?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface IChatTurnSource {
|
|
17
|
+
collection: string;
|
|
18
|
+
document_id?: string;
|
|
19
|
+
chunk_id?: string;
|
|
20
|
+
score?: number;
|
|
21
|
+
excerpt?: string;
|
|
22
|
+
}
|
|
23
|
+
export type TChatStreamEvent = {
|
|
24
|
+
type: 'delta';
|
|
25
|
+
delta: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'sources';
|
|
28
|
+
sources: IChatTurnSource[];
|
|
29
|
+
} | {
|
|
30
|
+
type: 'usage';
|
|
31
|
+
usage: IChatTurnUsage;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'done';
|
|
34
|
+
} | {
|
|
35
|
+
type: 'error';
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,eAAe,EAAE,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IChatShellProps } from './ChatShell';
|
|
2
|
+
export interface IBubbleLauncherProps extends IChatShellProps {
|
|
3
|
+
defaultOpen?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const BubbleLauncher: import('react').NamedExoticComponent<IBubbleLauncherProps>;
|
|
6
|
+
//# sourceMappingURL=BubbleLauncher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BubbleLauncher.d.ts","sourceRoot":"","sources":["../../src/components/BubbleLauncher.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AA+B9D,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,4DA0BzB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IReqorePanelAction } from '@qoretechnologies/reqore/dist/components/Panel';
|
|
2
|
+
export interface IChatShellProps {
|
|
3
|
+
endpoint: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
visitorId?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
subtitle?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
emptyText?: string;
|
|
11
|
+
/** Brand accent colour (hex) — send button + user bubble. */
|
|
12
|
+
accent: string;
|
|
13
|
+
showClose?: boolean;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Host-supplied panel-header actions, rendered to the **left** of the
|
|
17
|
+
* built-in **New conversation** / **Close** actions. Lets the embedder
|
|
18
|
+
* inject things like "Edit and publish" (qorus-ide's AI-endpoint
|
|
19
|
+
* playground) without breaking the widget's chrome.
|
|
20
|
+
*/
|
|
21
|
+
extraActions?: IReqorePanelAction[];
|
|
22
|
+
}
|
|
23
|
+
export declare const ChatShell: import('react').NamedExoticComponent<IChatShellProps>;
|
|
24
|
+
//# sourceMappingURL=ChatShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatShell.d.ts","sourceRoot":"","sources":["../../src/components/ChatShell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAKzF,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,SAAS,uDAgFrB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IReqorePanelAction } from '@qoretechnologies/reqore/dist/components/Panel';
|
|
2
|
+
import { TWidgetTheme } from './theme';
|
|
3
|
+
import { TMode } from './types';
|
|
4
|
+
export interface IChatWidgetProps {
|
|
5
|
+
endpoint: string;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
mode?: TMode;
|
|
9
|
+
visitorId?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
/** Curated base look: 'qorus' (default), 'dark' or 'light'. */
|
|
15
|
+
theme?: TWidgetTheme;
|
|
16
|
+
/** Brand accent colour (hex) — drives the launcher, send button and user bubble. */
|
|
17
|
+
accent?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Host-supplied panel-header actions, rendered before the widget's own
|
|
20
|
+
* **New conversation** / **Close** actions. Only honoured in `inline`
|
|
21
|
+
* mode (the bubble launcher hides the panel header by design).
|
|
22
|
+
*/
|
|
23
|
+
extraActions?: IReqorePanelAction[];
|
|
24
|
+
}
|
|
25
|
+
export declare const ChatWidget: import('react').NamedExoticComponent<IChatWidgetProps>;
|
|
26
|
+
//# sourceMappingURL=ChatWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatWidget.d.ts","sourceRoot":"","sources":["../../src/components/ChatWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGzF,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AASrC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,UAAU,wDAwCtB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IMessageInputProps {
|
|
2
|
+
isStreaming: boolean;
|
|
3
|
+
onSend: (text: string) => void;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Brand accent colour (hex) for the send button. */
|
|
8
|
+
accent: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const MessageInput: import('react').NamedExoticComponent<IMessageInputProps>;
|
|
11
|
+
//# sourceMappingURL=MessageInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../src/components/MessageInput.tsx"],"names":[],"mappings":"AA4BA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,0DAsDxB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IDisplayMessage } from './types';
|
|
2
|
+
export interface IMessageListProps {
|
|
3
|
+
messages: IDisplayMessage[];
|
|
4
|
+
isStreaming: boolean;
|
|
5
|
+
emptyText?: string;
|
|
6
|
+
accent: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const MessageList: import('react').NamedExoticComponent<IMessageListProps>;
|
|
9
|
+
//# sourceMappingURL=MessageList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../src/components/MessageList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiE/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,yDAiEtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../src/components/Sources.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA6BvD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,OAAO,qDA+BlB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IReqoreTheme } from '@qoretechnologies/reqore/dist/constants/theme';
|
|
2
|
+
import { IReqoreEffect } from '@qoretechnologies/reqore/dist/components/Effect';
|
|
3
|
+
/** Curated base looks. Customers pick one — they can't pass a broken theme. */
|
|
4
|
+
export type TWidgetTheme = 'dark' | 'light' | 'qorus';
|
|
5
|
+
export declare const DEFAULT_THEME: TWidgetTheme;
|
|
6
|
+
export declare const DEFAULT_ACCENT = "#7b68ee";
|
|
7
|
+
export declare function isWidgetTheme(value: unknown): value is TWidgetTheme;
|
|
8
|
+
/** Build the Reqore theme for a preset — fed to `ReqoreUIProvider`. */
|
|
9
|
+
export declare function buildWidgetTheme(theme?: TWidgetTheme): Partial<IReqoreTheme>;
|
|
10
|
+
/** Darken (`percent < 0`) or lighten (`percent > 0`) a `#rrggbb` hex. */
|
|
11
|
+
export declare function shade(hex: string, percent: number): `#${string}`;
|
|
12
|
+
/** Append a 2-digit alpha to a `#rrggbb` hex (`alpha` 0..1). */
|
|
13
|
+
export declare function withAlpha(hex: string, alpha: number): `#${string}`;
|
|
14
|
+
/** Solid accent gradient — send button. */
|
|
15
|
+
export declare function accentGradient(accent: string): IReqoreEffect;
|
|
16
|
+
/** Accent gradient with a glow — the floating launcher button. */
|
|
17
|
+
export declare function fabEffect(accent: string): IReqoreEffect;
|
|
18
|
+
/** Translucent accent gradient — the visitor's own message bubble. */
|
|
19
|
+
export declare function accentBubbleEffect(accent: string): IReqoreEffect;
|
|
20
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/components/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAErF,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,eAAO,MAAM,aAAa,EAAE,YAAsB,CAAC;AACnD,eAAO,MAAM,cAAc,YAAY,CAAC;AAWxC,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEnE;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,YAA4B,GAAG,OAAO,CAAC,YAAY,CAAC,CAG3F;AAED,yEAAyE;AACzE,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,CAQhE;AAED,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,CAKlE;AAED,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAO5D;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAQvD;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAOhE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IChatTurnSource, IChatTurnUsage } from '../client/types';
|
|
2
|
+
export type TChatRole = 'user' | 'assistant';
|
|
3
|
+
export type TMessageStatus = 'streaming' | 'complete' | 'error';
|
|
4
|
+
export interface IDisplayMessage {
|
|
5
|
+
id: string;
|
|
6
|
+
role: TChatRole;
|
|
7
|
+
content: string;
|
|
8
|
+
status: TMessageStatus;
|
|
9
|
+
sources?: IChatTurnSource[];
|
|
10
|
+
usage?: IChatTurnUsage;
|
|
11
|
+
error?: string;
|
|
12
|
+
createdAt: number;
|
|
13
|
+
}
|
|
14
|
+
export type TMode = 'bubble' | 'inline';
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IDisplayMessage } from './types';
|
|
2
|
+
export interface IUseChatSessionOptions {
|
|
3
|
+
endpoint: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
visitorId?: string;
|
|
7
|
+
mode?: 'stateless' | 'conversation';
|
|
8
|
+
}
|
|
9
|
+
export interface IUseChatSessionResult {
|
|
10
|
+
messages: IDisplayMessage[];
|
|
11
|
+
isStreaming: boolean;
|
|
12
|
+
send: (text: string) => Promise<void>;
|
|
13
|
+
cancel: () => void;
|
|
14
|
+
reset: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function useChatSession(opts: IUseChatSessionOptions): IUseChatSessionResult;
|
|
17
|
+
//# sourceMappingURL=useChatSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatSession.d.ts","sourceRoot":"","sources":["../../src/components/useChatSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAqB/C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;CACrC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB,GAAG,qBAAqB,CAkHlF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ChatWidget } from './components/ChatWidget';
|
|
2
|
+
export type { IChatWidgetProps } from './components/ChatWidget';
|
|
3
|
+
export { ChatShell } from './components/ChatShell';
|
|
4
|
+
export type { IChatShellProps } from './components/ChatShell';
|
|
5
|
+
export type { TWidgetTheme } from './components/theme';
|
|
6
|
+
export type { TMode } from './components/types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAIhE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
|