@aigentyc/chat-sdk 0.4.0 → 0.5.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/context7.json +1 -1
- package/dist/{ChatInterface-0rq8D5-8.d.cts → ChatInterface-DrzYAWnG.d.cts} +1 -1
- package/dist/{ChatInterface--yaDB5yp.d.ts → ChatInterface-qiVhkmx3.d.ts} +1 -1
- package/dist/{SlotsContext-CWTjP0mA.d.ts → SlotsContext-B_087V7B.d.ts} +99 -5
- package/dist/{SlotsContext-u5CFB7MS.d.cts → SlotsContext-DAQiASVu.d.cts} +99 -5
- package/dist/ai-elements.cjs +164 -567
- package/dist/ai-elements.cjs.map +1 -1
- package/dist/ai-elements.d.cts +10 -2
- package/dist/ai-elements.d.ts +10 -2
- package/dist/ai-elements.js +17 -462
- package/dist/ai-elements.js.map +1 -1
- package/dist/{chunk-LSKOJ7SH.js → chunk-3H4CX3MS.js} +8 -5
- package/dist/chunk-3H4CX3MS.js.map +1 -0
- package/dist/{chunk-4WOBNRRB.cjs → chunk-6CVBJ4EI.cjs} +594 -10
- package/dist/chunk-6CVBJ4EI.cjs.map +1 -0
- package/dist/{chunk-3MP2EGEJ.cjs → chunk-72QJ2ORD.cjs} +4 -2
- package/dist/chunk-72QJ2ORD.cjs.map +1 -0
- package/dist/chunk-BYTPAQ7F.js +70 -0
- package/dist/chunk-BYTPAQ7F.js.map +1 -0
- package/dist/{chunk-P3RPAI4F.cjs → chunk-BYX6IOGX.cjs} +4 -4
- package/dist/{chunk-P3RPAI4F.cjs.map → chunk-BYX6IOGX.cjs.map} +1 -1
- package/dist/{chunk-B27JIQ4Z.js → chunk-CNGIOCLR.js} +577 -7
- package/dist/chunk-CNGIOCLR.js.map +1 -0
- package/dist/chunk-CNPYBLLT.js +81 -0
- package/dist/chunk-CNPYBLLT.js.map +1 -0
- package/dist/{chunk-6ZZTTD5E.js → chunk-CW6LCVNC.js} +3 -3
- package/dist/{chunk-6ZZTTD5E.js.map → chunk-CW6LCVNC.js.map} +1 -1
- package/dist/chunk-DDATCJ3O.cjs +75 -0
- package/dist/chunk-DDATCJ3O.cjs.map +1 -0
- package/dist/{chunk-LVWSWTI3.cjs → chunk-DTOOWY2S.cjs} +184 -74
- package/dist/chunk-DTOOWY2S.cjs.map +1 -0
- package/dist/{chunk-NYQSM3EB.cjs → chunk-DVWX2UGY.cjs} +16 -2
- package/dist/chunk-DVWX2UGY.cjs.map +1 -0
- package/dist/{chunk-TZ7EM3EG.cjs → chunk-EMVZ7HWM.cjs} +44 -2
- package/dist/chunk-EMVZ7HWM.cjs.map +1 -0
- package/dist/{chunk-3EN3DMUL.js → chunk-JAEXKKSE.js} +47 -38
- package/dist/chunk-JAEXKKSE.js.map +1 -0
- package/dist/{chunk-JHWSG5IB.js → chunk-JAOD6CNW.js} +38 -3
- package/dist/chunk-JAOD6CNW.js.map +1 -0
- package/dist/{chunk-OEEDYJTV.cjs → chunk-JEK2V5I3.cjs} +6 -6
- package/dist/{chunk-OEEDYJTV.cjs.map → chunk-JEK2V5I3.cjs.map} +1 -1
- package/dist/{chunk-QYCEHFAB.js → chunk-LDQVDUUJ.js} +4 -2
- package/dist/chunk-LDQVDUUJ.js.map +1 -0
- package/dist/{chunk-AWRQSM42.cjs → chunk-NBZDBH4M.cjs} +8 -5
- package/dist/chunk-NBZDBH4M.cjs.map +1 -0
- package/dist/{chunk-5F3O3ZJH.js → chunk-P7UR37HP.js} +17 -4
- package/dist/chunk-P7UR37HP.js.map +1 -0
- package/dist/{chunk-3KSMOHNY.js → chunk-R3TYC66R.js} +46 -81
- package/dist/chunk-R3TYC66R.js.map +1 -0
- package/dist/{chunk-RAQVW2D7.js → chunk-UTEGHMBN.js} +142 -33
- package/dist/chunk-UTEGHMBN.js.map +1 -0
- package/dist/{chunk-46MUOYPR.cjs → chunk-UXVOUC2A.cjs} +47 -38
- package/dist/chunk-UXVOUC2A.cjs.map +1 -0
- package/dist/{chunk-IU7Q7O5G.js → chunk-VQPOUMBC.js} +3 -3
- package/dist/{chunk-IU7Q7O5G.js.map → chunk-VQPOUMBC.js.map} +1 -1
- package/dist/chunk-VYBHYFG3.cjs +87 -0
- package/dist/chunk-VYBHYFG3.cjs.map +1 -0
- package/dist/{chunk-OU5OZKYH.cjs → chunk-Y4B45DW4.cjs} +48 -90
- package/dist/chunk-Y4B45DW4.cjs.map +1 -0
- package/dist/components.cjs +22 -21
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +3 -3
- package/dist/components.d.ts +3 -3
- package/dist/components.js +10 -9
- package/dist/components.js.map +1 -1
- package/dist/core.cjs +21 -82
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +2 -78
- package/dist/core.js.map +1 -1
- package/dist/hooks.cjs +36 -14
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +7 -5
- package/dist/hooks.js.map +1 -1
- package/dist/i18n.cjs +5 -5
- package/dist/i18n.d.cts +2 -2
- package/dist/i18n.d.ts +2 -2
- package/dist/i18n.js +1 -1
- package/dist/index.cjs +61 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +10 -10
- package/dist/styles.css +1 -1
- package/dist/theme.cjs +4 -4
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2 -2
- package/dist/tools.cjs +6 -5
- package/dist/tools.d.cts +2 -2
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +3 -2
- package/dist/{types-DQCjs81O.d.cts → types-DRa1zFlN.d.cts} +33 -1
- package/dist/{types-DQCjs81O.d.ts → types-DRa1zFlN.d.ts} +33 -1
- package/dist/ui.cjs +52 -52
- package/dist/ui.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-3EN3DMUL.js.map +0 -1
- package/dist/chunk-3KSMOHNY.js.map +0 -1
- package/dist/chunk-3MP2EGEJ.cjs.map +0 -1
- package/dist/chunk-46MUOYPR.cjs.map +0 -1
- package/dist/chunk-4WOBNRRB.cjs.map +0 -1
- package/dist/chunk-5F3O3ZJH.js.map +0 -1
- package/dist/chunk-AWRQSM42.cjs.map +0 -1
- package/dist/chunk-B27JIQ4Z.js.map +0 -1
- package/dist/chunk-JHWSG5IB.js.map +0 -1
- package/dist/chunk-LSKOJ7SH.js.map +0 -1
- package/dist/chunk-LVWSWTI3.cjs.map +0 -1
- package/dist/chunk-NYQSM3EB.cjs.map +0 -1
- package/dist/chunk-OU5OZKYH.cjs.map +0 -1
- package/dist/chunk-QYCEHFAB.js.map +0 -1
- package/dist/chunk-RAQVW2D7.js.map +0 -1
- package/dist/chunk-TZ7EM3EG.cjs.map +0 -1
package/context7.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Q as QuestionConfig } from './types-
|
|
2
|
+
import { Q as QuestionConfig } from './types-DRa1zFlN.cjs';
|
|
3
3
|
|
|
4
4
|
interface ChatInterfaceProps {
|
|
5
5
|
/** Allow per-instance overrides of any context value */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Q as QuestionConfig } from './types-
|
|
2
|
+
import { Q as QuestionConfig } from './types-DRa1zFlN.js';
|
|
3
3
|
|
|
4
4
|
interface ChatInterfaceProps {
|
|
5
5
|
/** Allow per-instance overrides of any context value */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RefObject, ComponentType } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { h as LiveChatState, g as LiveChatMessage, b as ChatProviderProps, f as ChatMessage, c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks } from './types-DRa1zFlN.js';
|
|
4
4
|
|
|
5
5
|
type ChatStatus$1 = "idle" | "streaming" | "error";
|
|
6
6
|
interface ActiveTool$1 {
|
|
@@ -34,7 +34,11 @@ interface UseAigentycChatReturn {
|
|
|
34
34
|
status: ChatStatus$1;
|
|
35
35
|
error: Error | undefined;
|
|
36
36
|
sessionId: string;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Sends a user turn. `files` travel with it as message parts; a turn carrying
|
|
39
|
+
* files may have empty text — an image on its own is a question.
|
|
40
|
+
*/
|
|
41
|
+
sendMessage: (content: string, files?: ChatAttachmentInput[]) => void;
|
|
38
42
|
stopGeneration: () => void;
|
|
39
43
|
newConversation: () => void;
|
|
40
44
|
clearMessages: () => void;
|
|
@@ -66,8 +70,21 @@ interface ChatContextValue {
|
|
|
66
70
|
sessionId: string;
|
|
67
71
|
config: ChatConfig;
|
|
68
72
|
activeTools: ActiveTool[];
|
|
69
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Sends a user turn. `files` travel with it as message parts; a turn carrying
|
|
75
|
+
* files may have empty text — an image on its own is a question.
|
|
76
|
+
*/
|
|
77
|
+
sendMessage: (content: string, files?: ChatAttachmentInput[]) => void;
|
|
70
78
|
stopGeneration: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Re-run the last turn after a failure. No-op while a turn is in flight.
|
|
81
|
+
*
|
|
82
|
+
* Worth offering for a transient refusal — a rate limit, a dropped stream, a
|
|
83
|
+
* momentary 503. It cannot clear a refusal caused by the history itself,
|
|
84
|
+
* because the same history is what gets re-sent; that needs
|
|
85
|
+
* {@link ChatContextValue.newConversation}.
|
|
86
|
+
*/
|
|
87
|
+
retryLastTurn: () => void;
|
|
71
88
|
newConversation: () => void;
|
|
72
89
|
clearMessages: () => void;
|
|
73
90
|
callbacks?: ChatEventCallbacks;
|
|
@@ -123,10 +140,87 @@ interface LiveChatContextValue {
|
|
|
123
140
|
*/
|
|
124
141
|
declare function useLiveChat(): LiveChatContextValue | null;
|
|
125
142
|
|
|
143
|
+
interface AutoResizeOptions {
|
|
144
|
+
/** Height of a single row, in px, before padding. */
|
|
145
|
+
minHeight?: number;
|
|
146
|
+
/** Where growth stops and the textarea starts scrolling internally. */
|
|
147
|
+
maxHeight?: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Grows a textarea with its content, up to a ceiling.
|
|
151
|
+
*
|
|
152
|
+
* Height is recomputed from `scrollHeight`, which only reports the content's
|
|
153
|
+
* real height once the element has been collapsed first — hence the reset to
|
|
154
|
+
* `auto` before every measurement. Runs in a layout effect so the box is already
|
|
155
|
+
* the right size on the frame the character appears, with no visible reflow.
|
|
156
|
+
*
|
|
157
|
+
* Returns the ref to attach and a manual `resize()` for the cases React does not
|
|
158
|
+
* see: a value set imperatively, or a font that finishes loading late.
|
|
159
|
+
*/
|
|
160
|
+
declare function useAutoResize<T extends HTMLTextAreaElement>(value: string, { minHeight, maxHeight }?: AutoResizeOptions): {
|
|
161
|
+
ref: React.RefObject<T | null>;
|
|
162
|
+
resize: () => void;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The scripts we can tell apart from a single character, mapped to the BCP-47
|
|
167
|
+
* tag a speech recogniser wants.
|
|
168
|
+
*
|
|
169
|
+
* Deliberately short. A script the visitor is not typing in cannot be guessed
|
|
170
|
+
* from their text, and a wrong guess is worse than the fallback — dictation in
|
|
171
|
+
* the wrong language produces confident nonsense rather than an obvious failure.
|
|
172
|
+
*/
|
|
173
|
+
/** Reported for Latin script, which pins a keyboard but not a language. */
|
|
174
|
+
declare const LATIN = "latin";
|
|
175
|
+
/**
|
|
176
|
+
* The BCP-47 tag implied by a character's script, {@link LATIN} when the script
|
|
177
|
+
* is Latin, or null when the character says nothing (digits, punctuation,
|
|
178
|
+
* whitespace, emoji).
|
|
179
|
+
*/
|
|
180
|
+
declare function scriptLanguageOf(char: string): string | null;
|
|
181
|
+
/**
|
|
182
|
+
* The language of the last character in `text` whose script is identifiable.
|
|
183
|
+
*
|
|
184
|
+
* Read from the end because that is what the visitor is typing now: a Hebrew
|
|
185
|
+
* question that opens with an English part number is still a Hebrew question.
|
|
186
|
+
*/
|
|
187
|
+
declare function detectLanguage(text: string): string | null;
|
|
188
|
+
interface KeyboardLanguageOptions {
|
|
189
|
+
/**
|
|
190
|
+
* Used until the visitor has typed something identifiable. Defaults to the
|
|
191
|
+
* browser's own language.
|
|
192
|
+
*/
|
|
193
|
+
fallback?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Tags this consumer can actually act on, e.g. the languages a recogniser is
|
|
196
|
+
* configured for. A detection outside the list is ignored rather than
|
|
197
|
+
* switching to something unsupported.
|
|
198
|
+
*/
|
|
199
|
+
supported?: string[];
|
|
200
|
+
/** Latin text is ambiguous; this is which Latin language to call it. */
|
|
201
|
+
latin?: string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Tracks which keyboard the visitor is typing on, by the script of what they type.
|
|
205
|
+
*
|
|
206
|
+
* The web exposes no keyboard-layout API, so the characters themselves are the
|
|
207
|
+
* signal — and they are a good one: a visitor typing Hebrew has a Hebrew
|
|
208
|
+
* keyboard active, which is exactly what dictation should follow. The answer is
|
|
209
|
+
* sticky, so clearing the box or dictating into it does not reset the language
|
|
210
|
+
* back to a default the visitor never chose.
|
|
211
|
+
*
|
|
212
|
+
* Feed it every value the composer sees via `observe`.
|
|
213
|
+
*/
|
|
214
|
+
declare function useKeyboardLanguage({ fallback, supported, latin, }?: KeyboardLanguageOptions): {
|
|
215
|
+
lang: string;
|
|
216
|
+
setLang: React.Dispatch<React.SetStateAction<string>>;
|
|
217
|
+
observe: (text: string) => void;
|
|
218
|
+
};
|
|
219
|
+
|
|
126
220
|
/**
|
|
127
221
|
* All available slot names that can be overridden.
|
|
128
222
|
*/
|
|
129
|
-
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState";
|
|
223
|
+
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState" | "error";
|
|
130
224
|
/**
|
|
131
225
|
* A slot component receives the default component as a prop alongside its own props.
|
|
132
226
|
*/
|
|
@@ -160,4 +254,4 @@ declare function useSlot<P = Record<string, unknown>>(name: SlotName): SlotCompo
|
|
|
160
254
|
*/
|
|
161
255
|
declare function renderSlot<P>(name: SlotName, props: P, DefaultComponent: ComponentType<P>, slots: SlotMap): React.ReactElement;
|
|
162
256
|
|
|
163
|
-
export { type
|
|
257
|
+
export { type AutoResizeOptions as A, type KeyboardLanguageOptions as K, LATIN as L, type SlotComponent as S, type UseAigentycChatOptions as U, type LiveChatReturn as a, type SlotName as b, type UseAigentycChatReturn as c, detectLanguage as d, useAutoResize as e, useChatContext as f, useKeyboardLanguage as g, useLiveChat as h, useSlot as i, useSlots as j, renderSlot as r, scriptLanguageOf as s, useAigentycChat as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RefObject, ComponentType } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { h as LiveChatState, g as LiveChatMessage, b as ChatProviderProps, f as ChatMessage, c as ChatAttachmentInput, d as ChatConfig, e as ChatEventCallbacks } from './types-DRa1zFlN.cjs';
|
|
4
4
|
|
|
5
5
|
type ChatStatus$1 = "idle" | "streaming" | "error";
|
|
6
6
|
interface ActiveTool$1 {
|
|
@@ -34,7 +34,11 @@ interface UseAigentycChatReturn {
|
|
|
34
34
|
status: ChatStatus$1;
|
|
35
35
|
error: Error | undefined;
|
|
36
36
|
sessionId: string;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Sends a user turn. `files` travel with it as message parts; a turn carrying
|
|
39
|
+
* files may have empty text — an image on its own is a question.
|
|
40
|
+
*/
|
|
41
|
+
sendMessage: (content: string, files?: ChatAttachmentInput[]) => void;
|
|
38
42
|
stopGeneration: () => void;
|
|
39
43
|
newConversation: () => void;
|
|
40
44
|
clearMessages: () => void;
|
|
@@ -66,8 +70,21 @@ interface ChatContextValue {
|
|
|
66
70
|
sessionId: string;
|
|
67
71
|
config: ChatConfig;
|
|
68
72
|
activeTools: ActiveTool[];
|
|
69
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Sends a user turn. `files` travel with it as message parts; a turn carrying
|
|
75
|
+
* files may have empty text — an image on its own is a question.
|
|
76
|
+
*/
|
|
77
|
+
sendMessage: (content: string, files?: ChatAttachmentInput[]) => void;
|
|
70
78
|
stopGeneration: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Re-run the last turn after a failure. No-op while a turn is in flight.
|
|
81
|
+
*
|
|
82
|
+
* Worth offering for a transient refusal — a rate limit, a dropped stream, a
|
|
83
|
+
* momentary 503. It cannot clear a refusal caused by the history itself,
|
|
84
|
+
* because the same history is what gets re-sent; that needs
|
|
85
|
+
* {@link ChatContextValue.newConversation}.
|
|
86
|
+
*/
|
|
87
|
+
retryLastTurn: () => void;
|
|
71
88
|
newConversation: () => void;
|
|
72
89
|
clearMessages: () => void;
|
|
73
90
|
callbacks?: ChatEventCallbacks;
|
|
@@ -123,10 +140,87 @@ interface LiveChatContextValue {
|
|
|
123
140
|
*/
|
|
124
141
|
declare function useLiveChat(): LiveChatContextValue | null;
|
|
125
142
|
|
|
143
|
+
interface AutoResizeOptions {
|
|
144
|
+
/** Height of a single row, in px, before padding. */
|
|
145
|
+
minHeight?: number;
|
|
146
|
+
/** Where growth stops and the textarea starts scrolling internally. */
|
|
147
|
+
maxHeight?: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Grows a textarea with its content, up to a ceiling.
|
|
151
|
+
*
|
|
152
|
+
* Height is recomputed from `scrollHeight`, which only reports the content's
|
|
153
|
+
* real height once the element has been collapsed first — hence the reset to
|
|
154
|
+
* `auto` before every measurement. Runs in a layout effect so the box is already
|
|
155
|
+
* the right size on the frame the character appears, with no visible reflow.
|
|
156
|
+
*
|
|
157
|
+
* Returns the ref to attach and a manual `resize()` for the cases React does not
|
|
158
|
+
* see: a value set imperatively, or a font that finishes loading late.
|
|
159
|
+
*/
|
|
160
|
+
declare function useAutoResize<T extends HTMLTextAreaElement>(value: string, { minHeight, maxHeight }?: AutoResizeOptions): {
|
|
161
|
+
ref: React.RefObject<T | null>;
|
|
162
|
+
resize: () => void;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The scripts we can tell apart from a single character, mapped to the BCP-47
|
|
167
|
+
* tag a speech recogniser wants.
|
|
168
|
+
*
|
|
169
|
+
* Deliberately short. A script the visitor is not typing in cannot be guessed
|
|
170
|
+
* from their text, and a wrong guess is worse than the fallback — dictation in
|
|
171
|
+
* the wrong language produces confident nonsense rather than an obvious failure.
|
|
172
|
+
*/
|
|
173
|
+
/** Reported for Latin script, which pins a keyboard but not a language. */
|
|
174
|
+
declare const LATIN = "latin";
|
|
175
|
+
/**
|
|
176
|
+
* The BCP-47 tag implied by a character's script, {@link LATIN} when the script
|
|
177
|
+
* is Latin, or null when the character says nothing (digits, punctuation,
|
|
178
|
+
* whitespace, emoji).
|
|
179
|
+
*/
|
|
180
|
+
declare function scriptLanguageOf(char: string): string | null;
|
|
181
|
+
/**
|
|
182
|
+
* The language of the last character in `text` whose script is identifiable.
|
|
183
|
+
*
|
|
184
|
+
* Read from the end because that is what the visitor is typing now: a Hebrew
|
|
185
|
+
* question that opens with an English part number is still a Hebrew question.
|
|
186
|
+
*/
|
|
187
|
+
declare function detectLanguage(text: string): string | null;
|
|
188
|
+
interface KeyboardLanguageOptions {
|
|
189
|
+
/**
|
|
190
|
+
* Used until the visitor has typed something identifiable. Defaults to the
|
|
191
|
+
* browser's own language.
|
|
192
|
+
*/
|
|
193
|
+
fallback?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Tags this consumer can actually act on, e.g. the languages a recogniser is
|
|
196
|
+
* configured for. A detection outside the list is ignored rather than
|
|
197
|
+
* switching to something unsupported.
|
|
198
|
+
*/
|
|
199
|
+
supported?: string[];
|
|
200
|
+
/** Latin text is ambiguous; this is which Latin language to call it. */
|
|
201
|
+
latin?: string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Tracks which keyboard the visitor is typing on, by the script of what they type.
|
|
205
|
+
*
|
|
206
|
+
* The web exposes no keyboard-layout API, so the characters themselves are the
|
|
207
|
+
* signal — and they are a good one: a visitor typing Hebrew has a Hebrew
|
|
208
|
+
* keyboard active, which is exactly what dictation should follow. The answer is
|
|
209
|
+
* sticky, so clearing the box or dictating into it does not reset the language
|
|
210
|
+
* back to a default the visitor never chose.
|
|
211
|
+
*
|
|
212
|
+
* Feed it every value the composer sees via `observe`.
|
|
213
|
+
*/
|
|
214
|
+
declare function useKeyboardLanguage({ fallback, supported, latin, }?: KeyboardLanguageOptions): {
|
|
215
|
+
lang: string;
|
|
216
|
+
setLang: React.Dispatch<React.SetStateAction<string>>;
|
|
217
|
+
observe: (text: string) => void;
|
|
218
|
+
};
|
|
219
|
+
|
|
126
220
|
/**
|
|
127
221
|
* All available slot names that can be overridden.
|
|
128
222
|
*/
|
|
129
|
-
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState";
|
|
223
|
+
type SlotName = "header" | "footer" | "input" | "welcomePage" | "userMessage" | "assistantMessage" | "systemMessage" | "loader" | "feedback" | "tools" | "toolRenderers" | "liveChatPanel" | "satisfactionRating" | "visitorIdentityForm" | "floatingButton" | "emptyState" | "error";
|
|
130
224
|
/**
|
|
131
225
|
* A slot component receives the default component as a prop alongside its own props.
|
|
132
226
|
*/
|
|
@@ -160,4 +254,4 @@ declare function useSlot<P = Record<string, unknown>>(name: SlotName): SlotCompo
|
|
|
160
254
|
*/
|
|
161
255
|
declare function renderSlot<P>(name: SlotName, props: P, DefaultComponent: ComponentType<P>, slots: SlotMap): React.ReactElement;
|
|
162
256
|
|
|
163
|
-
export { type
|
|
257
|
+
export { type AutoResizeOptions as A, type KeyboardLanguageOptions as K, LATIN as L, type SlotComponent as S, type UseAigentycChatOptions as U, type LiveChatReturn as a, type SlotName as b, type UseAigentycChatReturn as c, detectLanguage as d, useAutoResize as e, useChatContext as f, useKeyboardLanguage as g, useLiveChat as h, useSlot as i, useSlots as j, renderSlot as r, scriptLanguageOf as s, useAigentycChat as u };
|