@botpress/webchat 5.3.2 → 5.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/.turbo/turbo-build.log +6 -6
- package/dist/index.d.ts +68 -3
- package/dist/index.js +9068 -8681
- package/dist/index.umd.cjs +134 -131
- package/package.json +19 -19
- package/vitest.config.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat@5.
|
|
2
|
+
> @botpress/webchat@5.5.1 build /home/runner/work/genisys/genisys/packages/webchat-components
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v5.4.8 [32mbuilding for production...[36m[39m
|
|
6
6
|
transforming...
|
|
7
|
-
[32m✓[39m
|
|
7
|
+
[32m✓[39m 2814 modules transformed.
|
|
8
8
|
rendering chunks...
|
|
9
9
|
|
|
10
10
|
[vite:dts] Start generate declaration files...
|
|
11
11
|
computing gzip size...
|
|
12
|
-
[2mdist/[22m[36mindex.js [39m[1m[33m1,
|
|
12
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m1,902.43 kB[39m[22m[2m │ gzip: 424.83 kB[22m
|
|
13
13
|
[vite:dts] Start rollup declaration files...
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
15
15
|
*** The target project appears to use TypeScript 5.9.3 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
16
|
-
[vite:dts] Declaration files built in
|
|
16
|
+
[vite:dts] Declaration files built in 27958ms.
|
|
17
17
|
|
|
18
|
-
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m1,
|
|
19
|
-
[32m✓ built in
|
|
18
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m1,213.64 kB[39m[22m[2m │ gzip: 350.13 kB[22m
|
|
19
|
+
[32m✓ built in 35.66s[39m
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ import { ListConversationsResponse } from '@botpress/webchat-client';
|
|
|
24
24
|
import { LucideIcon } from 'lucide-react';
|
|
25
25
|
import { MemoExoticComponent } from '../../../node_modules/@types/react';
|
|
26
26
|
import { Message as Message_2 } from '@botpress/webchat-client';
|
|
27
|
+
import { MessageStreamAbort } from '@botpress/webchat-client';
|
|
28
|
+
import { MessageStreamComplete } from '@botpress/webchat-client';
|
|
29
|
+
import { MessageStreamDelta } from '@botpress/webchat-client';
|
|
30
|
+
import { MessageStreamSnapshot } from '@botpress/webchat-client';
|
|
27
31
|
import { NamedExoticComponent } from '../../../node_modules/@types/react';
|
|
28
32
|
import { PersistOptions } from 'zustand/middleware';
|
|
29
33
|
import { ReactNode } from '../../node_modules/@types/react';
|
|
@@ -93,6 +97,7 @@ export declare type BlocIntegrationMessageItems = Extract<IntegrationMessage['pa
|
|
|
93
97
|
export declare type BlockContext = {
|
|
94
98
|
direction: 'incoming' | 'outgoing' | 'system';
|
|
95
99
|
messageId: string;
|
|
100
|
+
isStreaming?: boolean;
|
|
96
101
|
isReadOnly?: boolean;
|
|
97
102
|
sendMessage?: ScopedClient['sendMessage'];
|
|
98
103
|
/** All citation entries on the message (`metadata.citations`); renderers pick
|
|
@@ -166,7 +171,7 @@ export declare type CarouselBlock = {
|
|
|
166
171
|
cards: CardBlock[];
|
|
167
172
|
};
|
|
168
173
|
|
|
169
|
-
export declare const Chat: ({ connected, configuration, isTyping, messages, user, isLoading, isReadOnly, disableComposer, error, participants, closeWindow, sendMessage, addMessageFeedback, uploadFile, listConversations, restartConversation, clientId, storageKey, soundOn, toggleSound, disableSendButton, conversationId, expanded, onToggleExpand, locale, ...props }: ChatProps) => JSX.Element;
|
|
174
|
+
export declare const Chat: ({ connected, configuration, isTyping, messages, user, isLoading, isReadOnly, disableComposer, error, participants, closeWindow, sendMessage, addMessageFeedback, uploadFile, listConversations, restartConversation, clientId, storageKey, soundOn, toggleSound, disableSendButton, conversationId, expanded, onToggleExpand, locale, onComposerTextChange, ...props }: ChatProps) => JSX.Element;
|
|
170
175
|
|
|
171
176
|
export declare type ChatProps = {
|
|
172
177
|
className?: string;
|
|
@@ -195,6 +200,8 @@ export declare type ChatProps = {
|
|
|
195
200
|
expanded?: boolean;
|
|
196
201
|
onToggleExpand?: () => void;
|
|
197
202
|
locale?: Partial<WebchatTranslations>;
|
|
203
|
+
/** Fired on every composer keystroke; used to report the end user's typing upstream. */
|
|
204
|
+
onComposerTextChange?: (text: string) => void;
|
|
198
205
|
};
|
|
199
206
|
|
|
200
207
|
declare type ChatSoundStore = {
|
|
@@ -458,6 +465,11 @@ export declare const defaultTranslations: {
|
|
|
458
465
|
readonly 'csat.thanks': "Thanks — sent to the team";
|
|
459
466
|
};
|
|
460
467
|
|
|
468
|
+
export declare function deriveHitlStatus(messages: {
|
|
469
|
+
metadata?: Record<string, any>;
|
|
470
|
+
timestamp: Date;
|
|
471
|
+
}[]): HitlStatus;
|
|
472
|
+
|
|
461
473
|
export declare function detectLocale(language?: string): WebchatTranslations;
|
|
462
474
|
|
|
463
475
|
export declare type Dimensions = {
|
|
@@ -554,7 +566,7 @@ declare type HeaderProps = {
|
|
|
554
566
|
* Drives the header (amber "finding an agent" pulse / agent identity) and the
|
|
555
567
|
* in-stream waiting block.
|
|
556
568
|
*/
|
|
557
|
-
declare type HitlStatus = {
|
|
569
|
+
export declare type HitlStatus = {
|
|
558
570
|
mode: 'bot';
|
|
559
571
|
} | {
|
|
560
572
|
mode: 'waiting';
|
|
@@ -728,6 +740,14 @@ export declare type MessageRenderers = {
|
|
|
728
740
|
custom?: React.FC<CustomRendererProps>;
|
|
729
741
|
};
|
|
730
742
|
|
|
743
|
+
export { MessageStreamAbort }
|
|
744
|
+
|
|
745
|
+
export { MessageStreamComplete }
|
|
746
|
+
|
|
747
|
+
export { MessageStreamDelta }
|
|
748
|
+
|
|
749
|
+
export { MessageStreamSnapshot }
|
|
750
|
+
|
|
731
751
|
export declare const MISSING_API_URL = "The API url is required to initialize the webchat.";
|
|
732
752
|
|
|
733
753
|
export declare const MISSING_BOT_ID = "The Bot ID is required to initialize the webchat.";
|
|
@@ -935,6 +955,14 @@ export declare function renderBlock(block: MessageBlock, ctx: BlockContext): JSX
|
|
|
935
955
|
|
|
936
956
|
export declare const resolveStarterIcon: (icon?: string) => LucideIcon;
|
|
937
957
|
|
|
958
|
+
/**
|
|
959
|
+
* Resolves the translation map for the webchat: pick the base bundle for `language`
|
|
960
|
+
* (or auto-detect from navigator.language when omitted), then merge any custom string
|
|
961
|
+
* `overrides` on top. Overrides win per-key, so a site can localize into an unsupported
|
|
962
|
+
* language or tweak individual strings on top of a built-in bundle.
|
|
963
|
+
*/
|
|
964
|
+
export declare function resolveTranslations(language?: string, overrides?: Partial<WebchatTranslations>): WebchatTranslations;
|
|
965
|
+
|
|
938
966
|
export declare const retryWithBackoff: <T>(fn: () => Promise<T>, maxAttempts?: number, delayMs?: number) => Promise<T>;
|
|
939
967
|
|
|
940
968
|
export declare type RichBlockMessage = BlockMessage & {
|
|
@@ -993,7 +1021,7 @@ export declare type StyleOptions = {
|
|
|
993
1021
|
/**
|
|
994
1022
|
* StylesheetProvider component that manages theme styles and font loading
|
|
995
1023
|
*/
|
|
996
|
-
export declare const StylesheetProvider: ({ color, fontFamily, themeMode }: Props_20) => JSX.Element;
|
|
1024
|
+
export declare const StylesheetProvider: ({ color, fontFamily, themeMode, headerVariant }: Props_20) => JSX.Element;
|
|
997
1025
|
|
|
998
1026
|
declare const Text_2: ({ text, ctx, bare, citationPath, citationOffsetShift }: Props_6) => JSX.Element;
|
|
999
1027
|
export { Text_2 as Text }
|
|
@@ -1032,6 +1060,9 @@ declare type UseActiveConversationReturn = {
|
|
|
1032
1060
|
error?: WebchatError;
|
|
1033
1061
|
isTyping: boolean;
|
|
1034
1062
|
isAwaitingResponse: boolean;
|
|
1063
|
+
upsertMessageStream: (input: MessageStreamDelta) => void;
|
|
1064
|
+
completeMessageStream: (input: MessageStreamComplete) => void;
|
|
1065
|
+
abortMessageStream: (input: MessageStreamAbort) => void;
|
|
1035
1066
|
};
|
|
1036
1067
|
|
|
1037
1068
|
export declare function useConversationList({ userCredentials, listConversations, clientId, }: UseConversationListParams): UseConversationListReturn;
|
|
@@ -1065,6 +1096,23 @@ export declare function useMessageContext(): MessageContextVaue;
|
|
|
1065
1096
|
|
|
1066
1097
|
export declare function useModalContext(): ModalContextValue;
|
|
1067
1098
|
|
|
1099
|
+
/**
|
|
1100
|
+
* Reports the end user's presence to the conversation as a `userPresence` custom event so a
|
|
1101
|
+
* human agent (e.g. in Desk) can tell whether the visitor is around:
|
|
1102
|
+
* - `online` — stream connected, tab present, active within the last AWAY_MS
|
|
1103
|
+
* - `away` — connected but the tab has been blurred or idle for AWAY_MS
|
|
1104
|
+
* - `offline` — stream disconnected, or the tab is being closed
|
|
1105
|
+
* Only the transitions are emitted (deduped against the last reported state).
|
|
1106
|
+
*/
|
|
1107
|
+
export declare function usePresenceEmitter({ enabled, connected }: UsePresenceEmitterProps): void;
|
|
1108
|
+
|
|
1109
|
+
declare type UsePresenceEmitterProps = {
|
|
1110
|
+
/** Gate — only emit when the bot reports presence upstream (agentPresenceEnabled). */
|
|
1111
|
+
enabled?: boolean;
|
|
1112
|
+
/** Whether the webchat client's event stream is connected (drives online vs offline). */
|
|
1113
|
+
connected?: boolean;
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1068
1116
|
export { User }
|
|
1069
1117
|
|
|
1070
1118
|
export declare function useReadIndicator(): {
|
|
@@ -1088,6 +1136,20 @@ declare type UseSoundReturn = {
|
|
|
1088
1136
|
playNotificationSound: () => void;
|
|
1089
1137
|
};
|
|
1090
1138
|
|
|
1139
|
+
/**
|
|
1140
|
+
* Reports the end user's typing to the conversation as a `userTyping` custom event so a human
|
|
1141
|
+
* agent (e.g. in Desk) can see when the visitor is composing. Returns an `onTextChange` handler
|
|
1142
|
+
* to wire to the composer; it is `undefined` when disabled so nothing is emitted.
|
|
1143
|
+
*/
|
|
1144
|
+
export declare function useTypingEmitter({ enabled }: UseTypingEmitterProps): {
|
|
1145
|
+
onTextChange: ((text: string) => void) | undefined;
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
declare type UseTypingEmitterProps = {
|
|
1149
|
+
/** Gate — only emit when the bot reports presence upstream (agentPresenceEnabled). */
|
|
1150
|
+
enabled?: boolean;
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1091
1153
|
export declare const useUser: () => UseUserReturn;
|
|
1092
1154
|
|
|
1093
1155
|
declare type UseUserReturn = {
|
|
@@ -1190,6 +1252,9 @@ export declare type WebchatContextValue = {
|
|
|
1190
1252
|
isTyping: boolean;
|
|
1191
1253
|
isAwaitingResponse: boolean;
|
|
1192
1254
|
setAwaitingResponse: (state: boolean, timeout?: number) => void;
|
|
1255
|
+
upsertMessageStream: (input: MessageStreamDelta) => void;
|
|
1256
|
+
completeMessageStream: (input: MessageStreamComplete) => void;
|
|
1257
|
+
abortMessageStream: (input: MessageStreamAbort) => void;
|
|
1193
1258
|
emitter: ReturnType<typeof createEventEmitter<Events>>;
|
|
1194
1259
|
};
|
|
1195
1260
|
|