@botpress/webchat 3.2.2 → 3.2.6
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 +8 -8
- package/dist/index.d.ts +129 -15
- package/dist/index.js +7443 -7291
- package/dist/index.umd.cjs +100 -95
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat@3.2.
|
|
2
|
+
> @botpress/webchat@3.2.6 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 3182 modules transformed.
|
|
8
8
|
rendering chunks...
|
|
9
9
|
|
|
10
10
|
[vite:dts] Start generate declaration files...
|
|
11
11
|
computing gzip size...
|
|
12
|
-
[2mdist/[22m[35mstyle.css [39m[1m[2m 47.
|
|
13
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
12
|
+
[2mdist/[22m[35mstyle.css [39m[1m[2m 47.46 kB[22m[1m[22m[2m │ gzip: 8.72 kB[22m
|
|
13
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m783.42 kB[39m[22m[2m │ gzip: 218.64 kB[22m
|
|
14
14
|
[vite:dts] Start rollup declaration files...
|
|
15
15
|
Analysis will use the bundled TypeScript version 5.4.2
|
|
16
16
|
*** The target project appears to use TypeScript 5.6.2 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
17
|
-
[vite:dts] Declaration files built in
|
|
17
|
+
[vite:dts] Declaration files built in 19084ms.
|
|
18
18
|
|
|
19
|
-
[2mdist/[22m[35mstyle.css [39m[1m[2m 47.
|
|
20
|
-
[2mdist/[22m[36mindex.umd.cjs [39m[1m[
|
|
21
|
-
[32m✓ built in
|
|
19
|
+
[2mdist/[22m[35mstyle.css [39m[1m[2m 47.46 kB[22m[1m[22m[2m │ gzip: 8.72 kB[22m
|
|
20
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m526.62 kB[39m[22m[2m │ gzip: 179.50 kB[22m
|
|
21
|
+
[32m✓ built in 25.16s[39m
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { Client } from '@botpress/webchat-client';
|
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
import { ComponentPropsWithRef } from 'react';
|
|
6
6
|
import { LatestWebchatConfig as Configuration } from '@bpinternal/shared';
|
|
7
|
+
import { Context } from 'react';
|
|
7
8
|
import { CSSProperties } from 'react';
|
|
8
9
|
import * as Dialog from '@radix-ui/react-dialog';
|
|
10
|
+
import { Dispatch } from 'react';
|
|
9
11
|
import { EventEmitter } from '@bpinternal/shared';
|
|
10
12
|
import type { FC } from 'react';
|
|
11
13
|
import { ForwardRefExoticComponent } from 'react';
|
|
@@ -22,6 +24,7 @@ import { Ref } from 'react';
|
|
|
22
24
|
import { RefAttributes } from 'react';
|
|
23
25
|
import { RefObject } from 'react';
|
|
24
26
|
import { RotateCcw } from 'lucide-react';
|
|
27
|
+
import { SetStateAction } from 'react';
|
|
25
28
|
import { StoreApi } from 'zustand';
|
|
26
29
|
import { UseBoundStore } from 'zustand';
|
|
27
30
|
import { User } from '@botpress/webchat-client';
|
|
@@ -95,6 +98,8 @@ declare type BlockProps<T extends GenericBlock['type']> = {
|
|
|
95
98
|
|
|
96
99
|
export declare const BOT_IS_BLOCKED = "This bot has temporarily paused.\nPlease check back later.";
|
|
97
100
|
|
|
101
|
+
declare type BoundChatSoundStore = ReturnType<typeof createChatSoundStore>;
|
|
102
|
+
|
|
98
103
|
declare type BoundWebchatClientStore = ReturnType<typeof createWebchatClientStore>;
|
|
99
104
|
|
|
100
105
|
export declare type BubbleBlock = {
|
|
@@ -128,7 +133,19 @@ export declare type CarouselBlock = {
|
|
|
128
133
|
blocks: GenericBlock[];
|
|
129
134
|
};
|
|
130
135
|
|
|
131
|
-
export declare const Chat: ({ connected, configuration, isTyping, messages, user, isLoading, renderers, isReadOnly, disableComposer, allowFileUpload, error, participants, closeWindow, sendMessage, uploadFile, addMessageFeedback, restartConversation, storageKey, ...props }: Props) => JSX_3.Element;
|
|
136
|
+
export declare const Chat: ({ connected, configuration, isTyping, messages, user, isLoading, renderers, isReadOnly, disableComposer, allowFileUpload, error, participants, closeWindow, sendMessage, uploadFile, addMessageFeedback, restartConversation, clientId, storageKey, soundOn, toggleSound, ...props }: Props) => JSX_3.Element;
|
|
137
|
+
|
|
138
|
+
declare type ChatSoundStore = {
|
|
139
|
+
soundOn: boolean;
|
|
140
|
+
setSoundEnabled: (enabled: boolean) => void;
|
|
141
|
+
toggleSound: () => void;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
declare class ChatSoundStores {
|
|
145
|
+
private static _instances;
|
|
146
|
+
private constructor();
|
|
147
|
+
static getInstance(name?: string): BoundChatSoundStore;
|
|
148
|
+
}
|
|
132
149
|
|
|
133
150
|
export declare type ColumnBlock = {
|
|
134
151
|
type: 'column';
|
|
@@ -165,10 +182,26 @@ export declare const CONFIG_ACCESS_DENIED = "Access denied to configuration file
|
|
|
165
182
|
export { Configuration }
|
|
166
183
|
|
|
167
184
|
export declare const Container: {
|
|
168
|
-
({ children, className,
|
|
185
|
+
({ children, className, uploadFile, allowFileUpload, storageKey, ...props }: Props_4): JSX_3.Element;
|
|
169
186
|
displayName: string;
|
|
170
187
|
};
|
|
171
188
|
|
|
189
|
+
declare const createChatSoundStore: (storeName: string) => UseBoundStore<Omit<Omit<StoreApi<ChatSoundStore>, "setState"> & {
|
|
190
|
+
setState<A extends string | {
|
|
191
|
+
type: string;
|
|
192
|
+
}>(partial: ChatSoundStore | Partial<ChatSoundStore> | ((state: ChatSoundStore) => ChatSoundStore | Partial<ChatSoundStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
193
|
+
}, "persist"> & {
|
|
194
|
+
persist: {
|
|
195
|
+
setOptions: (options: Partial<PersistOptions<ChatSoundStore, ChatSoundStore>>) => void;
|
|
196
|
+
clearStorage: () => void;
|
|
197
|
+
rehydrate: () => Promise<void> | void;
|
|
198
|
+
hasHydrated: () => boolean;
|
|
199
|
+
onHydrate: (fn: (state: ChatSoundStore) => void) => () => void;
|
|
200
|
+
onFinishHydration: (fn: (state: ChatSoundStore) => void) => () => void;
|
|
201
|
+
getOptions: () => Partial<PersistOptions<ChatSoundStore, ChatSoundStore>>;
|
|
202
|
+
};
|
|
203
|
+
}>;
|
|
204
|
+
|
|
172
205
|
declare const createWebchatClientStore: (storeName: string, storageLocation?: StorageLocation) => UseBoundStore<Omit<Omit<StoreApi<WebchatClientStore>, "setState"> & {
|
|
173
206
|
setState<A extends string | {
|
|
174
207
|
type: string;
|
|
@@ -250,11 +283,13 @@ export declare function generateThemeStylesheet(theme: LatestWebchatTheme): stri
|
|
|
250
283
|
|
|
251
284
|
export declare type GenericBlock = AudioBlock | BubbleBlock | ButtonBlock | CarouselBlock | ColumnBlock | DropdownBlock | FileBlock | ImageBlock | LocationBlock | RowBlock | TextBlock | VideoBlock | CustomBlock;
|
|
252
285
|
|
|
286
|
+
export declare const getUseChatSoundStore: typeof ChatSoundStores.getInstance;
|
|
287
|
+
|
|
253
288
|
export declare const getUseWebchatClientStore: typeof WebchatClientStores.getInstance;
|
|
254
289
|
|
|
255
290
|
export declare const handleIntegrationError: (thrown: unknown) => WebchatError;
|
|
256
291
|
|
|
257
|
-
export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, ...props }: HeaderProps) => JSX_3.Element;
|
|
292
|
+
export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, soundOn, toggleSound, ...props }: HeaderProps) => JSX_3.Element;
|
|
258
293
|
|
|
259
294
|
declare type HeaderProps = {
|
|
260
295
|
defaultOpen?: boolean;
|
|
@@ -263,7 +298,11 @@ declare type HeaderProps = {
|
|
|
263
298
|
onOpenChange?(open: boolean): void;
|
|
264
299
|
restartConversation?: () => void;
|
|
265
300
|
closeWindow?: () => void;
|
|
266
|
-
|
|
301
|
+
clientId?: string;
|
|
302
|
+
soundOn?: boolean;
|
|
303
|
+
toggleSound?: () => void;
|
|
304
|
+
triggerNetworkError?: (errorType?: 'network' | 'timeout' | 'server', delay?: number) => Promise<never>;
|
|
305
|
+
configuration: Pick<Configuration, 'email' | 'phone' | 'privacyPolicy' | 'website' | 'termsOfService' | 'botAvatar' | 'botDescription' | 'botName' | 'soundEnabled'>;
|
|
267
306
|
};
|
|
268
307
|
|
|
269
308
|
export declare type ImageBlock = {
|
|
@@ -318,6 +357,7 @@ export declare const Message: MemoExoticComponent<ForwardRefExoticComponent<{
|
|
|
318
357
|
addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
|
|
319
358
|
isReadOnly?: boolean;
|
|
320
359
|
isLastDeliveredMessage?: boolean;
|
|
360
|
+
showAvatar?: boolean;
|
|
321
361
|
} & BlockMessage<GenericBlock> & {
|
|
322
362
|
direction: "incoming" | "outgoing" | "system";
|
|
323
363
|
sender: {
|
|
@@ -326,7 +366,14 @@ export declare const Message: MemoExoticComponent<ForwardRefExoticComponent<{
|
|
|
326
366
|
};
|
|
327
367
|
} & RefAttributes<HTMLDivElement>>>;
|
|
328
368
|
|
|
329
|
-
export declare const
|
|
369
|
+
export declare const MessageContext: Context<MessageContextVaue | null>;
|
|
370
|
+
|
|
371
|
+
declare type MessageContextVaue = {
|
|
372
|
+
isLoading: string[];
|
|
373
|
+
setIsLoading: Dispatch<SetStateAction<string[]>>;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export declare const MessageList: MemoExoticComponent<({ className, messages, isTyping, headerMessage, renderers, botAvatar, botDescription, botName, sendMessage, addMessageFeedback, showMarquee, showDateSystemMessage, showMessageStatus, showIncomingMessageAvatar, showOutgoingMessageAvatar, ...props }: ComponentProps<"ul"> & MessageListProps) => JSX_3.Element>;
|
|
330
377
|
|
|
331
378
|
declare type MessageListProps = {
|
|
332
379
|
messages?: RichBlockMessage[];
|
|
@@ -339,6 +386,10 @@ declare type MessageListProps = {
|
|
|
339
386
|
sendMessage?: (payload: IntegrationMessage['payload']) => void;
|
|
340
387
|
addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
|
|
341
388
|
showMarquee?: boolean;
|
|
389
|
+
showDateSystemMessage?: boolean;
|
|
390
|
+
showMessageStatus?: boolean;
|
|
391
|
+
showIncomingMessageAvatar?: boolean;
|
|
392
|
+
showOutgoingMessageAvatar?: boolean;
|
|
342
393
|
};
|
|
343
394
|
|
|
344
395
|
export declare const MISSING_API_URL = "The API url is required to initialize the webchat.";
|
|
@@ -371,6 +422,21 @@ declare function ModalContent({ children, title, description, confirmButton, onC
|
|
|
371
422
|
children: ReactNode;
|
|
372
423
|
}): JSX_3.Element;
|
|
373
424
|
|
|
425
|
+
export declare const ModalContext: Context<ModalContextValue>;
|
|
426
|
+
|
|
427
|
+
declare type ModalContextValue = {
|
|
428
|
+
open?: boolean;
|
|
429
|
+
showModal?: (props: {
|
|
430
|
+
title: string;
|
|
431
|
+
description: string;
|
|
432
|
+
confirmButton: string;
|
|
433
|
+
onConfirm: () => void;
|
|
434
|
+
cancelButton: string;
|
|
435
|
+
content?: ReactNode;
|
|
436
|
+
}) => void;
|
|
437
|
+
hideModal?: () => void;
|
|
438
|
+
};
|
|
439
|
+
|
|
374
440
|
export declare type ModalProps = {
|
|
375
441
|
title: string | null;
|
|
376
442
|
content: ReactNode | null;
|
|
@@ -414,7 +480,10 @@ export declare type Props = {
|
|
|
414
480
|
type: FileType;
|
|
415
481
|
}>;
|
|
416
482
|
addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
|
|
483
|
+
triggerNetworkError?: (errorType?: 'network' | 'timeout' | 'server', delay?: number) => Promise<never>;
|
|
417
484
|
error?: WebchatError;
|
|
485
|
+
soundOn?: boolean;
|
|
486
|
+
toggleSound?: () => void;
|
|
418
487
|
storageKey?: string;
|
|
419
488
|
};
|
|
420
489
|
|
|
@@ -423,10 +492,13 @@ declare type Props_2 = {
|
|
|
423
492
|
user?: UserCredentials;
|
|
424
493
|
conversationId?: string;
|
|
425
494
|
clientId: string;
|
|
495
|
+
botId?: string;
|
|
426
496
|
apiUrl?: string;
|
|
427
497
|
sseTimeout?: number;
|
|
428
498
|
storageKey?: string;
|
|
429
499
|
storageLocation?: StorageLocation;
|
|
500
|
+
playSound?: () => void;
|
|
501
|
+
soundEnabled?: boolean;
|
|
430
502
|
};
|
|
431
503
|
|
|
432
504
|
declare type Props_3 = ComponentProps<'div'> & {
|
|
@@ -466,6 +538,8 @@ declare type Props_6 = {
|
|
|
466
538
|
user?: UserCredentials;
|
|
467
539
|
conversationId?: string;
|
|
468
540
|
configuration?: Configuration;
|
|
541
|
+
soundOn?: boolean;
|
|
542
|
+
toggleSound?: () => void;
|
|
469
543
|
} & Pick<ComponentProps<typeof Chat>, 'allowFileUpload' | 'renderers'> & ComponentProps<'div'>;
|
|
470
544
|
|
|
471
545
|
declare type Props_7 = Partial<LatestWebchatTheme>;
|
|
@@ -512,6 +586,10 @@ declare type ScopedClient = {
|
|
|
512
586
|
updateUser: (user: UserProfile) => Promise<User>;
|
|
513
587
|
};
|
|
514
588
|
|
|
589
|
+
export declare const SOUND_EFFECTS: {
|
|
590
|
+
readonly chatMessageNotification: string;
|
|
591
|
+
};
|
|
592
|
+
|
|
515
593
|
export declare const SSE_DISCONNECTED_ERROR = "You've been disconnected from the conversation.\nPlease refresh the page.";
|
|
516
594
|
|
|
517
595
|
declare type StorageLocation = 'sessionStorage' | 'localStorage';
|
|
@@ -525,7 +603,7 @@ export declare type StyleOptions = {
|
|
|
525
603
|
* StylesheetProvider component that manages theme styles and font loading
|
|
526
604
|
* Handles both default fonts and custom Google Fonts
|
|
527
605
|
*/
|
|
528
|
-
export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant }: Props_7) => JSX_3.Element;
|
|
606
|
+
export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant, additionalStylesheetUrl, }: Props_7) => JSX_3.Element;
|
|
529
607
|
|
|
530
608
|
export declare type TextBlock = {
|
|
531
609
|
type: 'text';
|
|
@@ -546,14 +624,18 @@ export declare type UseImageSizeResult = [Dimensions | null, {
|
|
|
546
624
|
error: string | null;
|
|
547
625
|
}];
|
|
548
626
|
|
|
627
|
+
export declare function useMessageContext(): MessageContextVaue;
|
|
628
|
+
|
|
629
|
+
export declare function useModalContext(): ModalContextValue;
|
|
630
|
+
|
|
549
631
|
declare type UserProfile = Omit<User, 'id' | 'createdAt' | 'updatedAt'>;
|
|
550
632
|
|
|
551
633
|
declare type UserResponse = Awaited<ReturnType<Client['getUser']>>['user'];
|
|
552
634
|
|
|
553
|
-
export declare function useWebchat({ apiUrl, clientId, storageKey, storageLocation, adminKey, ...props }: Props_2): UseWebchatReturn;
|
|
635
|
+
export declare function useWebchat({ apiUrl, clientId, storageKey, storageLocation, adminKey, soundEnabled, ...props }: Props_2): UseWebchatReturn;
|
|
554
636
|
|
|
555
637
|
declare type UseWebchatReturn = {
|
|
556
|
-
clientState: 'connected'
|
|
638
|
+
clientState: 'connected';
|
|
557
639
|
on: EventEmitter<Events>['on'];
|
|
558
640
|
client: ScopedClient;
|
|
559
641
|
messages: BlockMessage[];
|
|
@@ -562,10 +644,12 @@ declare type UseWebchatReturn = {
|
|
|
562
644
|
isFetchingMessages: boolean;
|
|
563
645
|
user?: UserCredentials;
|
|
564
646
|
isTyping: boolean;
|
|
565
|
-
error?: WebchatError;
|
|
566
647
|
participants: User[];
|
|
648
|
+
soundOn: boolean;
|
|
649
|
+
toggleSound: () => void;
|
|
650
|
+
error?: WebchatError;
|
|
567
651
|
} | {
|
|
568
|
-
clientState: 'connecting' | 'error';
|
|
652
|
+
clientState: 'connecting' | 'error' | 'disconnected';
|
|
569
653
|
on: EventEmitter<Events>['on'];
|
|
570
654
|
client: undefined;
|
|
571
655
|
messages: BlockMessage[];
|
|
@@ -574,8 +658,10 @@ declare type UseWebchatReturn = {
|
|
|
574
658
|
isFetchingMessages: boolean;
|
|
575
659
|
user: undefined;
|
|
576
660
|
isTyping: undefined;
|
|
577
|
-
error?: WebchatError;
|
|
578
661
|
participants: User[];
|
|
662
|
+
soundOn: boolean;
|
|
663
|
+
toggleSound: () => void;
|
|
664
|
+
error?: WebchatError;
|
|
579
665
|
};
|
|
580
666
|
|
|
581
667
|
export declare const useWebchatStore: UseBoundStore<Omit<StoreApi<WebchatStore>, "setState"> & {
|
|
@@ -600,9 +686,6 @@ export declare const webchatClasses: {
|
|
|
600
686
|
readonly overlay: {
|
|
601
687
|
readonly className: "bpDropzoneOverlay";
|
|
602
688
|
};
|
|
603
|
-
readonly container: {
|
|
604
|
-
readonly className: "bpDropzoneContainer";
|
|
605
|
-
};
|
|
606
689
|
};
|
|
607
690
|
};
|
|
608
691
|
readonly loader: {
|
|
@@ -696,6 +779,9 @@ export declare const webchatClasses: {
|
|
|
696
779
|
readonly className: "bpHeaderContentAvatarFallback";
|
|
697
780
|
};
|
|
698
781
|
};
|
|
782
|
+
readonly toggleSound: {
|
|
783
|
+
readonly className: "bpHeaderSoundToggleButton";
|
|
784
|
+
};
|
|
699
785
|
readonly actions: {
|
|
700
786
|
readonly container: {
|
|
701
787
|
readonly className: "bpReset bpHeaderContentActionsContainer";
|
|
@@ -1035,7 +1121,12 @@ export declare const webchatClasses: {
|
|
|
1035
1121
|
readonly className: "bpErrorId";
|
|
1036
1122
|
};
|
|
1037
1123
|
readonly header: {
|
|
1038
|
-
readonly
|
|
1124
|
+
readonly container: {
|
|
1125
|
+
readonly className: "bpErrorHeader";
|
|
1126
|
+
};
|
|
1127
|
+
readonly actions: {
|
|
1128
|
+
readonly className: "bpErrorHeaderActions";
|
|
1129
|
+
};
|
|
1039
1130
|
};
|
|
1040
1131
|
readonly content: {
|
|
1041
1132
|
readonly className: "bpErrorContent";
|
|
@@ -1058,6 +1149,29 @@ export declare const webchatClasses: {
|
|
|
1058
1149
|
readonly className: "bpTypingIndicatorLoader";
|
|
1059
1150
|
};
|
|
1060
1151
|
};
|
|
1152
|
+
readonly proactiveBubble: {
|
|
1153
|
+
readonly container: {
|
|
1154
|
+
readonly className: "bpProactiveBubbleContainer";
|
|
1155
|
+
};
|
|
1156
|
+
readonly content: {
|
|
1157
|
+
readonly className: "bpProactiveBubbleContent";
|
|
1158
|
+
};
|
|
1159
|
+
readonly layout: {
|
|
1160
|
+
readonly className: "bpProactiveBubbleLayout";
|
|
1161
|
+
};
|
|
1162
|
+
readonly icon: {
|
|
1163
|
+
readonly className: "bpProactiveBubbleIcon";
|
|
1164
|
+
};
|
|
1165
|
+
readonly message: {
|
|
1166
|
+
readonly className: "bpProactiveBubbleMessage";
|
|
1167
|
+
};
|
|
1168
|
+
readonly closeButton: {
|
|
1169
|
+
readonly className: "bpProactiveBubbleCloseButton";
|
|
1170
|
+
};
|
|
1171
|
+
readonly arrow: {
|
|
1172
|
+
readonly className: "bpProactiveBubbleArrow";
|
|
1173
|
+
};
|
|
1174
|
+
};
|
|
1061
1175
|
};
|
|
1062
1176
|
|
|
1063
1177
|
declare type WebchatClientStore = {
|