@botpress/webchat 4.2.0 → 4.2.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/.storybook/main.ts +5 -3
- package/.turbo/turbo-build.log +5 -5
- package/dist/index.d.ts +41 -52
- package/dist/index.js +5930 -6746
- package/dist/index.umd.cjs +101 -101
- package/package.json +1 -3
package/.storybook/main.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join, dirname } from 'path'
|
|
2
|
+
import { withoutVitePlugins } from '@storybook/builder-vite'
|
|
2
3
|
/**
|
|
3
4
|
* This function is used to resolve the absolute path of a package.
|
|
4
5
|
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
|
|
@@ -20,8 +21,9 @@ const config = {
|
|
|
20
21
|
name: getAbsolutePath('@storybook/react-vite'),
|
|
21
22
|
options: {},
|
|
22
23
|
},
|
|
23
|
-
viteFinal(config) {
|
|
24
|
-
config.plugins = (config.plugins
|
|
24
|
+
async viteFinal(config) {
|
|
25
|
+
config.plugins = await withoutVitePlugins(config.plugins, ['vite:dts'])
|
|
26
|
+
|
|
25
27
|
return config
|
|
26
28
|
},
|
|
27
29
|
}
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat@4.2.
|
|
2
|
+
> @botpress/webchat@4.2.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
|
|
@@ -10,12 +10,12 @@ rendering chunks...
|
|
|
10
10
|
[vite:dts] Start generate declaration files...
|
|
11
11
|
computing gzip size...
|
|
12
12
|
[2mdist/[22m[35mstyle.css [39m[1m[2m 54.01 kB[22m[1m[22m[2m │ gzip: 9.07 kB[22m
|
|
13
|
-
[2mdist/[22m[36mindex.js [39m[1m[
|
|
13
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m679.73 kB[39m[22m[2m │ gzip: 183.94 kB[22m
|
|
14
14
|
[vite:dts] Start rollup declaration files...
|
|
15
15
|
Analysis will use the bundled TypeScript version 5.8.2
|
|
16
16
|
*** The target project appears to use TypeScript 5.9.3 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 19038ms.
|
|
18
18
|
|
|
19
19
|
[2mdist/[22m[35mstyle.css [39m[1m[2m 54.01 kB[22m[1m[22m[2m │ gzip: 9.07 kB[22m
|
|
20
|
-
[2mdist/[22m[36mindex.umd.cjs [39m[1m[2m451.
|
|
21
|
-
[32m✓ built in
|
|
20
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[2m451.76 kB[22m[1m[22m[2m │ gzip: 148.76 kB[22m
|
|
21
|
+
[32m✓ built in 23.74s[39m
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AddMessageFeedbackBody } from '@botpress/webchat-client';
|
|
2
|
+
import { ClassAttributes } from 'react';
|
|
2
3
|
import { Client } from '@botpress/webchat-client';
|
|
3
|
-
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
import { ComponentPropsWithRef } from 'react';
|
|
6
6
|
import { LatestWebchatConfig as Configuration } from '@bpinternal/shared';
|
|
@@ -11,12 +11,14 @@ import { Dispatch } from 'react';
|
|
|
11
11
|
import { EventEmitter } from '@bpinternal/shared';
|
|
12
12
|
import type { FC } from 'react';
|
|
13
13
|
import { ForwardRefExoticComponent } from 'react';
|
|
14
|
+
import { HTMLAttributes } from 'react';
|
|
14
15
|
import { IntegrationError } from '@botpress/webchat-client';
|
|
15
|
-
import { JSX } from 'react
|
|
16
|
-
import { JSX as JSX_2 } from 'react';
|
|
16
|
+
import { JSX } from 'react';
|
|
17
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
17
18
|
import { LatestWebchatTheme } from '@bpinternal/shared';
|
|
18
19
|
import { MemoExoticComponent } from 'react';
|
|
19
20
|
import { Message as Message_2 } from '@botpress/webchat-client';
|
|
21
|
+
import { NamedExoticComponent } from 'react';
|
|
20
22
|
import { PersistOptions } from 'zustand/middleware';
|
|
21
23
|
import { ReactNode } from 'react';
|
|
22
24
|
import { Ref } from 'react';
|
|
@@ -39,13 +41,9 @@ declare type AnyEvent = ValueOf<{
|
|
|
39
41
|
export declare type AudioBlock = {
|
|
40
42
|
type: 'audio';
|
|
41
43
|
url: string;
|
|
42
|
-
ref?: Ref<HTMLAudioElement>;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export declare const Avatar:
|
|
46
|
-
({ userId, src, container, image, fallback, ...props }: AvatarProps): JSX.Element;
|
|
47
|
-
displayName: string;
|
|
48
|
-
};
|
|
46
|
+
export declare const Avatar: ForwardRefExoticComponent<Omit<AvatarProps, "ref"> & RefAttributes<HTMLSpanElement>>;
|
|
49
47
|
|
|
50
48
|
declare type AvatarProps = {
|
|
51
49
|
userId?: string;
|
|
@@ -65,7 +63,7 @@ export declare type BlocIntegrationMessageItems = Extract<IntegrationMessage['pa
|
|
|
65
63
|
type: 'bloc';
|
|
66
64
|
}>['items'];
|
|
67
65
|
|
|
68
|
-
export declare const Block: <T extends GenericBlock["type"]>({ block, renderers, ...props }: BlockProps<T>) =>
|
|
66
|
+
export declare const Block: <T extends GenericBlock["type"]>({ block, renderers, ...props }: BlockProps<T>) => JSX.Element;
|
|
69
67
|
|
|
70
68
|
export declare type BlockMessage<T = GenericBlock> = {
|
|
71
69
|
id: string;
|
|
@@ -136,7 +134,7 @@ export declare type CarouselBlock = {
|
|
|
136
134
|
blocks: GenericBlock[];
|
|
137
135
|
};
|
|
138
136
|
|
|
139
|
-
export declare const Chat: ({
|
|
137
|
+
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, disableSendButton, ...props }: Props) => JSX_2.Element;
|
|
140
138
|
|
|
141
139
|
declare type ChatSoundStore = {
|
|
142
140
|
soundOn: boolean;
|
|
@@ -178,14 +176,14 @@ export declare type ComposableIntegrationMessagePayload = Extract<IntegrationMes
|
|
|
178
176
|
|
|
179
177
|
declare type ComposableIntegrationMessageTypes = 'audio' | 'bloc' | 'file' | 'image' | 'location' | 'markdown' | 'text' | 'video';
|
|
180
178
|
|
|
181
|
-
export declare const Composer:
|
|
179
|
+
export declare const Composer: NamedExoticComponent<Omit<Props_3, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
182
180
|
|
|
183
181
|
export declare const CONFIG_ACCESS_DENIED = "Access denied to configuration file. Please check your credentials or your configuration URL and try again.";
|
|
184
182
|
|
|
185
183
|
export { Configuration }
|
|
186
184
|
|
|
187
185
|
export declare const Container: {
|
|
188
|
-
({
|
|
186
|
+
({ children, className, uploadFile, allowFileUpload, storageKey, connected: _, ...props }: Props_4): JSX_2.Element;
|
|
189
187
|
displayName: string;
|
|
190
188
|
};
|
|
191
189
|
|
|
@@ -250,7 +248,7 @@ declare type ErrorProps = {
|
|
|
250
248
|
closeWindow?: () => void;
|
|
251
249
|
};
|
|
252
250
|
|
|
253
|
-
export declare function ErrorState({ error, restartConversation, closeWindow }: ErrorProps):
|
|
251
|
+
export declare function ErrorState({ error, restartConversation, closeWindow }: ErrorProps): JSX_2.Element;
|
|
254
252
|
|
|
255
253
|
declare type EventError = Error & {
|
|
256
254
|
type: 'error';
|
|
@@ -264,15 +262,9 @@ declare type Events_2 = {
|
|
|
264
262
|
[key: string]: string;
|
|
265
263
|
};
|
|
266
264
|
|
|
267
|
-
export declare const Fab: {
|
|
268
|
-
({ ref, onClick, imgUrl, ...props }: FabProps): JSX.Element;
|
|
269
|
-
displayName: string;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export declare type FabProps = ComponentProps<'div'> & {
|
|
273
|
-
onClick?: () => void;
|
|
265
|
+
export declare const Fab: ForwardRefExoticComponent<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
|
|
274
266
|
imgUrl?: string;
|
|
275
|
-
}
|
|
267
|
+
}, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
276
268
|
|
|
277
269
|
export declare type Feedback = AddMessageFeedbackBody;
|
|
278
270
|
|
|
@@ -296,9 +288,9 @@ export declare const getUseChatSoundStore: typeof ChatSoundStores.getInstance;
|
|
|
296
288
|
|
|
297
289
|
export declare const getUseWebchatClientStore: typeof WebchatClientStores.getInstance;
|
|
298
290
|
|
|
299
|
-
export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, soundOn, toggleSound, clientId, ...props }: HeaderProps) =>
|
|
291
|
+
export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, soundOn, toggleSound, clientId, ...props }: HeaderProps) => JSX_2.Element;
|
|
300
292
|
|
|
301
|
-
declare type HeaderProps =
|
|
293
|
+
declare type HeaderProps = {
|
|
302
294
|
defaultOpen?: boolean;
|
|
303
295
|
open?: boolean;
|
|
304
296
|
disabled?: boolean;
|
|
@@ -372,7 +364,21 @@ export declare type LocationBlock = {
|
|
|
372
364
|
|
|
373
365
|
export declare const mapToWebchatError: (thrown: unknown) => WebchatError;
|
|
374
366
|
|
|
375
|
-
export declare const Message:
|
|
367
|
+
export declare const Message: NamedExoticComponent<{
|
|
368
|
+
children?: ReactNode;
|
|
369
|
+
renderers?: Partial<Renderers>;
|
|
370
|
+
sendMessage?: (payload: IntegrationMessage["payload"]) => void;
|
|
371
|
+
addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
|
|
372
|
+
isReadOnly?: boolean;
|
|
373
|
+
isLastDeliveredMessage?: boolean;
|
|
374
|
+
showAvatar?: boolean;
|
|
375
|
+
} & BlockMessage<GenericBlock> & {
|
|
376
|
+
direction: "incoming" | "outgoing" | "system";
|
|
377
|
+
sender: {
|
|
378
|
+
name: string;
|
|
379
|
+
avatar?: string;
|
|
380
|
+
};
|
|
381
|
+
} & RefAttributes<HTMLDivElement>>;
|
|
376
382
|
|
|
377
383
|
export declare const MessageContext: Context<MessageContextVaue | null>;
|
|
378
384
|
|
|
@@ -381,9 +387,9 @@ declare type MessageContextVaue = {
|
|
|
381
387
|
setIsLoading: Dispatch<SetStateAction<string[]>>;
|
|
382
388
|
};
|
|
383
389
|
|
|
384
|
-
export declare const MessageList: MemoExoticComponent<({ className, messages, isTyping, headerMessage, renderers, botAvatar, botDescription, botName, sendMessage, addMessageFeedback, showMarquee, showDateSystemMessage, showMessageStatus, showIncomingMessageAvatar, showOutgoingMessageAvatar, ...props }: MessageListProps) =>
|
|
390
|
+
export declare const MessageList: MemoExoticComponent<({ className, messages, isTyping, headerMessage, renderers, botAvatar, botDescription, botName, sendMessage, addMessageFeedback, showMarquee, showDateSystemMessage, showMessageStatus, showIncomingMessageAvatar, showOutgoingMessageAvatar, ...props }: ComponentProps<"div"> & MessageListProps) => JSX_2.Element>;
|
|
385
391
|
|
|
386
|
-
declare type MessageListProps =
|
|
392
|
+
declare type MessageListProps = {
|
|
387
393
|
messages?: RichBlockMessage[];
|
|
388
394
|
isTyping?: boolean;
|
|
389
395
|
headerMessage?: string;
|
|
@@ -400,27 +406,12 @@ declare type MessageListProps = ComponentProps<'div'> & {
|
|
|
400
406
|
showOutgoingMessageAvatar?: boolean;
|
|
401
407
|
};
|
|
402
408
|
|
|
403
|
-
export declare const MessagePreview: {
|
|
404
|
-
({ ref, children, onClick, avatarUrl, botName, description, onClose, ...props }: MessagePreviewProps): JSX.Element;
|
|
405
|
-
displayName: string;
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
declare type MessagePreviewProps = ComponentProps<'div'> & {
|
|
409
|
+
export declare const MessagePreview: ForwardRefExoticComponent<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
|
|
409
410
|
avatarUrl?: string;
|
|
410
411
|
botName?: string;
|
|
411
412
|
description?: string;
|
|
412
413
|
onClose?: () => void;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
declare type MessageProps = {
|
|
416
|
-
children?: ReactNode;
|
|
417
|
-
renderers?: Partial<Renderers>;
|
|
418
|
-
sendMessage?: (payload: IntegrationMessage['payload']) => void;
|
|
419
|
-
addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
|
|
420
|
-
isReadOnly?: boolean;
|
|
421
|
-
isLastDeliveredMessage?: boolean;
|
|
422
|
-
showAvatar?: boolean;
|
|
423
|
-
} & RichBlockMessage;
|
|
414
|
+
}, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
424
415
|
|
|
425
416
|
export declare const MISSING_API_URL = "The API url is required to initialize the webchat.";
|
|
426
417
|
|
|
@@ -434,7 +425,7 @@ export declare function Modal({ open, onOpenChange, children, }: {
|
|
|
434
425
|
open?: boolean;
|
|
435
426
|
onOpenChange?: (open: boolean) => void;
|
|
436
427
|
children: ReactNode;
|
|
437
|
-
}):
|
|
428
|
+
}): JSX_2.Element;
|
|
438
429
|
|
|
439
430
|
export declare namespace Modal {
|
|
440
431
|
var Button: ForwardRefExoticComponent<Dialog.DialogTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -450,7 +441,7 @@ declare function ModalContent({ title, description, onConfirm, onCancel, confirm
|
|
|
450
441
|
confirmButtonText?: string;
|
|
451
442
|
cancelButtonText?: string;
|
|
452
443
|
children: ReactNode;
|
|
453
|
-
}):
|
|
444
|
+
}): JSX_2.Element;
|
|
454
445
|
|
|
455
446
|
export declare const ModalContext: Context<ModalContextValue>;
|
|
456
447
|
|
|
@@ -460,7 +451,7 @@ declare type ModalContextValue = {
|
|
|
460
451
|
|
|
461
452
|
export declare const ModalProvider: ({ children }: {
|
|
462
453
|
children: ReactNode;
|
|
463
|
-
}) =>
|
|
454
|
+
}) => JSX_2.Element;
|
|
464
455
|
|
|
465
456
|
export declare const NETWORK_ERROR = "Please check your internet connection and refresh the page.";
|
|
466
457
|
|
|
@@ -471,7 +462,6 @@ export declare type Options = {
|
|
|
471
462
|
};
|
|
472
463
|
|
|
473
464
|
export declare type Props = {
|
|
474
|
-
ref?: Ref<HTMLDivElement>;
|
|
475
465
|
className?: string;
|
|
476
466
|
renderers?: Partial<Renderers>;
|
|
477
467
|
configuration: Configuration;
|
|
@@ -569,12 +559,11 @@ export declare type Renderers = {
|
|
|
569
559
|
|
|
570
560
|
export declare const renderers: Renderers;
|
|
571
561
|
|
|
572
|
-
export declare const RestartConversationButton: ({ restartConversation, ...props }: Props_5) =>
|
|
562
|
+
export declare const RestartConversationButton: ({ restartConversation, ...props }: Props_5) => JSX_2.Element;
|
|
573
563
|
|
|
574
564
|
export declare const retryWithBackoff: <T>(fn: () => Promise<T>, maxAttempts?: number, delayMs?: number) => Promise<T>;
|
|
575
565
|
|
|
576
566
|
export declare type RichBlockMessage<T = GenericBlock> = BlockMessage<T> & {
|
|
577
|
-
ref?: Ref<HTMLDivElement>;
|
|
578
567
|
direction: 'incoming' | 'outgoing' | 'system';
|
|
579
568
|
sender: {
|
|
580
569
|
name: string;
|
|
@@ -625,7 +614,7 @@ export declare type StyleOptions = {
|
|
|
625
614
|
/**
|
|
626
615
|
* StylesheetProvider component that manages theme styles and font loading
|
|
627
616
|
*/
|
|
628
|
-
export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant, additionalStylesheetUrl, }: Props_7) =>
|
|
617
|
+
export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant, additionalStylesheetUrl, }: Props_7) => JSX_2.Element;
|
|
629
618
|
|
|
630
619
|
export declare type TextBlock = {
|
|
631
620
|
type: 'text';
|
|
@@ -639,7 +628,7 @@ declare type ToPayloadType<T extends IntegrationMessageTypes> = {
|
|
|
639
628
|
};
|
|
640
629
|
}[T];
|
|
641
630
|
|
|
642
|
-
export declare const TypingIndicator: MemoExoticComponent<({ ...props }: ComponentProps<"div">) =>
|
|
631
|
+
export declare const TypingIndicator: MemoExoticComponent<({ ...props }: ComponentProps<"div">) => JSX_2.Element>;
|
|
643
632
|
|
|
644
633
|
export declare type UseImageSizeResult = [Dimensions | null, {
|
|
645
634
|
loading: boolean;
|
|
@@ -699,7 +688,7 @@ export declare type VideoBlock = {
|
|
|
699
688
|
url: string;
|
|
700
689
|
};
|
|
701
690
|
|
|
702
|
-
export declare const Webchat: ({ clientId, storageKey, configuration, allowFileUpload, apiUrl, user, conversationId, ...props }: Props_6) =>
|
|
691
|
+
export declare const Webchat: ({ clientId, storageKey, configuration, allowFileUpload, apiUrl, user, conversationId, ...props }: Props_6) => JSX_2.Element;
|
|
703
692
|
|
|
704
693
|
export declare const webchatClasses: {
|
|
705
694
|
readonly container: {
|