@botpress/webchat 3.2.4 → 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 +114 -18
- package/dist/index.js +6822 -6775
- 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,
|
|
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,
|
|
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,8 +298,11 @@ declare type HeaderProps = {
|
|
|
263
298
|
onOpenChange?(open: boolean): void;
|
|
264
299
|
restartConversation?: () => void;
|
|
265
300
|
closeWindow?: () => void;
|
|
301
|
+
clientId?: string;
|
|
302
|
+
soundOn?: boolean;
|
|
303
|
+
toggleSound?: () => void;
|
|
266
304
|
triggerNetworkError?: (errorType?: 'network' | 'timeout' | 'server', delay?: number) => Promise<never>;
|
|
267
|
-
configuration: Pick<Configuration, 'email' | 'phone' | 'privacyPolicy' | 'website' | 'termsOfService' | 'botAvatar' | 'botDescription' | 'botName'>;
|
|
305
|
+
configuration: Pick<Configuration, 'email' | 'phone' | 'privacyPolicy' | 'website' | 'termsOfService' | 'botAvatar' | 'botDescription' | 'botName' | 'soundEnabled'>;
|
|
268
306
|
};
|
|
269
307
|
|
|
270
308
|
export declare type ImageBlock = {
|
|
@@ -328,6 +366,13 @@ export declare const Message: MemoExoticComponent<ForwardRefExoticComponent<{
|
|
|
328
366
|
};
|
|
329
367
|
} & RefAttributes<HTMLDivElement>>>;
|
|
330
368
|
|
|
369
|
+
export declare const MessageContext: Context<MessageContextVaue | null>;
|
|
370
|
+
|
|
371
|
+
declare type MessageContextVaue = {
|
|
372
|
+
isLoading: string[];
|
|
373
|
+
setIsLoading: Dispatch<SetStateAction<string[]>>;
|
|
374
|
+
};
|
|
375
|
+
|
|
331
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>;
|
|
332
377
|
|
|
333
378
|
declare type MessageListProps = {
|
|
@@ -377,6 +422,21 @@ declare function ModalContent({ children, title, description, confirmButton, onC
|
|
|
377
422
|
children: ReactNode;
|
|
378
423
|
}): JSX_3.Element;
|
|
379
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
|
+
|
|
380
440
|
export declare type ModalProps = {
|
|
381
441
|
title: string | null;
|
|
382
442
|
content: ReactNode | null;
|
|
@@ -422,6 +482,8 @@ export declare type Props = {
|
|
|
422
482
|
addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
|
|
423
483
|
triggerNetworkError?: (errorType?: 'network' | 'timeout' | 'server', delay?: number) => Promise<never>;
|
|
424
484
|
error?: WebchatError;
|
|
485
|
+
soundOn?: boolean;
|
|
486
|
+
toggleSound?: () => void;
|
|
425
487
|
storageKey?: string;
|
|
426
488
|
};
|
|
427
489
|
|
|
@@ -430,10 +492,13 @@ declare type Props_2 = {
|
|
|
430
492
|
user?: UserCredentials;
|
|
431
493
|
conversationId?: string;
|
|
432
494
|
clientId: string;
|
|
495
|
+
botId?: string;
|
|
433
496
|
apiUrl?: string;
|
|
434
497
|
sseTimeout?: number;
|
|
435
498
|
storageKey?: string;
|
|
436
499
|
storageLocation?: StorageLocation;
|
|
500
|
+
playSound?: () => void;
|
|
501
|
+
soundEnabled?: boolean;
|
|
437
502
|
};
|
|
438
503
|
|
|
439
504
|
declare type Props_3 = ComponentProps<'div'> & {
|
|
@@ -473,6 +538,8 @@ declare type Props_6 = {
|
|
|
473
538
|
user?: UserCredentials;
|
|
474
539
|
conversationId?: string;
|
|
475
540
|
configuration?: Configuration;
|
|
541
|
+
soundOn?: boolean;
|
|
542
|
+
toggleSound?: () => void;
|
|
476
543
|
} & Pick<ComponentProps<typeof Chat>, 'allowFileUpload' | 'renderers'> & ComponentProps<'div'>;
|
|
477
544
|
|
|
478
545
|
declare type Props_7 = Partial<LatestWebchatTheme>;
|
|
@@ -517,12 +584,10 @@ declare type ScopedClient = {
|
|
|
517
584
|
addMessageFeedback: (messageId: string, feedback: Feedback) => Promise<void>;
|
|
518
585
|
getUser: () => Promise<UserResponse>;
|
|
519
586
|
updateUser: (user: UserProfile) => Promise<User>;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
*/
|
|
525
|
-
triggerNetworkError: (errorType?: 'network' | 'timeout' | 'server', delay?: number) => Promise<never>;
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
export declare const SOUND_EFFECTS: {
|
|
590
|
+
readonly chatMessageNotification: string;
|
|
526
591
|
};
|
|
527
592
|
|
|
528
593
|
export declare const SSE_DISCONNECTED_ERROR = "You've been disconnected from the conversation.\nPlease refresh the page.";
|
|
@@ -559,14 +624,18 @@ export declare type UseImageSizeResult = [Dimensions | null, {
|
|
|
559
624
|
error: string | null;
|
|
560
625
|
}];
|
|
561
626
|
|
|
627
|
+
export declare function useMessageContext(): MessageContextVaue;
|
|
628
|
+
|
|
629
|
+
export declare function useModalContext(): ModalContextValue;
|
|
630
|
+
|
|
562
631
|
declare type UserProfile = Omit<User, 'id' | 'createdAt' | 'updatedAt'>;
|
|
563
632
|
|
|
564
633
|
declare type UserResponse = Awaited<ReturnType<Client['getUser']>>['user'];
|
|
565
634
|
|
|
566
|
-
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;
|
|
567
636
|
|
|
568
637
|
declare type UseWebchatReturn = {
|
|
569
|
-
clientState: 'connected'
|
|
638
|
+
clientState: 'connected';
|
|
570
639
|
on: EventEmitter<Events>['on'];
|
|
571
640
|
client: ScopedClient;
|
|
572
641
|
messages: BlockMessage[];
|
|
@@ -575,10 +644,12 @@ declare type UseWebchatReturn = {
|
|
|
575
644
|
isFetchingMessages: boolean;
|
|
576
645
|
user?: UserCredentials;
|
|
577
646
|
isTyping: boolean;
|
|
578
|
-
error?: WebchatError;
|
|
579
647
|
participants: User[];
|
|
648
|
+
soundOn: boolean;
|
|
649
|
+
toggleSound: () => void;
|
|
650
|
+
error?: WebchatError;
|
|
580
651
|
} | {
|
|
581
|
-
clientState: 'connecting' | 'error';
|
|
652
|
+
clientState: 'connecting' | 'error' | 'disconnected';
|
|
582
653
|
on: EventEmitter<Events>['on'];
|
|
583
654
|
client: undefined;
|
|
584
655
|
messages: BlockMessage[];
|
|
@@ -587,8 +658,10 @@ declare type UseWebchatReturn = {
|
|
|
587
658
|
isFetchingMessages: boolean;
|
|
588
659
|
user: undefined;
|
|
589
660
|
isTyping: undefined;
|
|
590
|
-
error?: WebchatError;
|
|
591
661
|
participants: User[];
|
|
662
|
+
soundOn: boolean;
|
|
663
|
+
toggleSound: () => void;
|
|
664
|
+
error?: WebchatError;
|
|
592
665
|
};
|
|
593
666
|
|
|
594
667
|
export declare const useWebchatStore: UseBoundStore<Omit<StoreApi<WebchatStore>, "setState"> & {
|
|
@@ -613,9 +686,6 @@ export declare const webchatClasses: {
|
|
|
613
686
|
readonly overlay: {
|
|
614
687
|
readonly className: "bpDropzoneOverlay";
|
|
615
688
|
};
|
|
616
|
-
readonly container: {
|
|
617
|
-
readonly className: "bpDropzoneContainer";
|
|
618
|
-
};
|
|
619
689
|
};
|
|
620
690
|
};
|
|
621
691
|
readonly loader: {
|
|
@@ -709,6 +779,9 @@ export declare const webchatClasses: {
|
|
|
709
779
|
readonly className: "bpHeaderContentAvatarFallback";
|
|
710
780
|
};
|
|
711
781
|
};
|
|
782
|
+
readonly toggleSound: {
|
|
783
|
+
readonly className: "bpHeaderSoundToggleButton";
|
|
784
|
+
};
|
|
712
785
|
readonly actions: {
|
|
713
786
|
readonly container: {
|
|
714
787
|
readonly className: "bpReset bpHeaderContentActionsContainer";
|
|
@@ -1076,6 +1149,29 @@ export declare const webchatClasses: {
|
|
|
1076
1149
|
readonly className: "bpTypingIndicatorLoader";
|
|
1077
1150
|
};
|
|
1078
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
|
+
};
|
|
1079
1175
|
};
|
|
1080
1176
|
|
|
1081
1177
|
declare type WebchatClientStore = {
|