@botpress/webchat 4.1.0 → 4.2.0

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.
@@ -1,5 +1,4 @@
1
- import { join, dirname } from 'path'
2
- import { withoutVitePlugins } from '@storybook/builder-vite'
1
+ import { dirname, join } from 'path'
3
2
  /**
4
3
  * This function is used to resolve the absolute path of a package.
5
4
  * It is needed in projects that use Yarn PnP or are set up within a monorepo.
@@ -21,9 +20,8 @@ const config = {
21
20
  name: getAbsolutePath('@storybook/react-vite'),
22
21
  options: {},
23
22
  },
24
- async viteFinal(config) {
25
- config.plugins = await withoutVitePlugins(config.plugins, ['vite:dts'])
26
-
23
+ viteFinal(config) {
24
+ config.plugins = (config.plugins ?? []).filter((plugin) => plugin && 'name' in plugin && plugin.name !== 'vite:dts')
27
25
  return config
28
26
  },
29
27
  }
@@ -1,21 +1,21 @@
1
1
 
2
- > @botpress/webchat@4.1.0 build /home/runner/work/genisys/genisys/packages/webchat-components
2
+ > @botpress/webchat@4.2.0 build /home/runner/work/genisys/genisys/packages/webchat-components
3
3
  > vite build
4
4
 
5
5
  vite v5.4.8 building for production...
6
6
  transforming...
7
- ✓ 2346 modules transformed.
7
+ ✓ 2383 modules transformed.
8
8
  rendering chunks...
9
9
 
10
10
  [vite:dts] Start generate declaration files...
11
11
  computing gzip size...
12
12
  dist/style.css  54.01 kB │ gzip: 9.07 kB
13
- dist/index.js 675.87 kB │ gzip: 182.59 kB
13
+ dist/index.js 681.72 kB │ gzip: 183.56 kB
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 20130ms.
17
+ [vite:dts] Declaration files built in 18681ms.
18
18
 
19
19
  dist/style.css  54.01 kB │ gzip: 9.07 kB
20
- dist/index.umd.cjs 449.08 kB │ gzip: 147.52 kB
21
- ✓ built in 25.01s
20
+ dist/index.umd.cjs 451.60 kB │ gzip: 148.63 kB
21
+ ✓ built in 28.70s
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AddMessageFeedbackBody } from '@botpress/webchat-client';
2
- import { ClassAttributes } from 'react';
3
2
  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,10 +11,9 @@ 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';
15
14
  import { IntegrationError } from '@botpress/webchat-client';
15
+ import { JSX } from 'react/jsx-runtime';
16
16
  import { JSX as JSX_2 } from 'react';
17
- import { JSX as JSX_3 } from 'react/jsx-runtime';
18
17
  import { LatestWebchatTheme } from '@bpinternal/shared';
19
18
  import { MemoExoticComponent } from 'react';
20
19
  import { Message as Message_2 } from '@botpress/webchat-client';
@@ -40,9 +39,13 @@ declare type AnyEvent = ValueOf<{
40
39
  export declare type AudioBlock = {
41
40
  type: 'audio';
42
41
  url: string;
42
+ ref?: Ref<HTMLAudioElement>;
43
43
  };
44
44
 
45
- export declare const Avatar: ForwardRefExoticComponent<Omit<AvatarProps, "ref"> & RefAttributes<HTMLSpanElement>>;
45
+ export declare const Avatar: {
46
+ ({ userId, src, container, image, fallback, ...props }: AvatarProps): JSX.Element;
47
+ displayName: string;
48
+ };
46
49
 
47
50
  declare type AvatarProps = {
48
51
  userId?: string;
@@ -133,7 +136,7 @@ export declare type CarouselBlock = {
133
136
  blocks: GenericBlock[];
134
137
  };
135
138
 
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, disableSendButton, ...props }: Props) => JSX_3.Element;
139
+ export declare const Chat: ({ ref, 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.Element;
137
140
 
138
141
  declare type ChatSoundStore = {
139
142
  soundOn: boolean;
@@ -175,14 +178,14 @@ export declare type ComposableIntegrationMessagePayload = Extract<IntegrationMes
175
178
 
176
179
  declare type ComposableIntegrationMessageTypes = 'audio' | 'bloc' | 'file' | 'image' | 'location' | 'markdown' | 'text' | 'video';
177
180
 
178
- export declare const Composer: MemoExoticComponent<ForwardRefExoticComponent<Omit<Props_3, "ref"> & RefAttributes<HTMLDivElement>>>;
181
+ export declare const Composer: MemoExoticComponent<({ ref, className, inputRef, disableComposer, isReadOnly, allowFileUpload, disableSendButton, connected, composerPlaceholder, footer, sendMessage, uploadFile, storageKey, children, ...props }: Props_3) => JSX.Element | null>;
179
182
 
180
183
  export declare const CONFIG_ACCESS_DENIED = "Access denied to configuration file. Please check your credentials or your configuration URL and try again.";
181
184
 
182
185
  export { Configuration }
183
186
 
184
187
  export declare const Container: {
185
- ({ children, className, uploadFile, allowFileUpload, storageKey, connected: _, ...props }: Props_4): JSX_3.Element;
188
+ ({ ref, children, className, uploadFile, allowFileUpload, storageKey, connected: _, ...props }: Props_4): JSX.Element;
186
189
  displayName: string;
187
190
  };
188
191
 
@@ -247,7 +250,7 @@ declare type ErrorProps = {
247
250
  closeWindow?: () => void;
248
251
  };
249
252
 
250
- export declare function ErrorState({ error, restartConversation, closeWindow }: ErrorProps): JSX_3.Element;
253
+ export declare function ErrorState({ error, restartConversation, closeWindow }: ErrorProps): JSX.Element;
251
254
 
252
255
  declare type EventError = Error & {
253
256
  type: 'error';
@@ -261,9 +264,15 @@ declare type Events_2 = {
261
264
  [key: string]: string;
262
265
  };
263
266
 
264
- export declare const Fab: ForwardRefExoticComponent<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
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
274
  imgUrl?: string;
266
- }, "ref"> & RefAttributes<HTMLDivElement>>;
275
+ };
267
276
 
268
277
  export declare type Feedback = AddMessageFeedbackBody;
269
278
 
@@ -287,9 +296,9 @@ export declare const getUseChatSoundStore: typeof ChatSoundStores.getInstance;
287
296
 
288
297
  export declare const getUseWebchatClientStore: typeof WebchatClientStores.getInstance;
289
298
 
290
- export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, soundOn, toggleSound, clientId, ...props }: HeaderProps) => JSX_3.Element;
299
+ export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, soundOn, toggleSound, clientId, ...props }: HeaderProps) => JSX.Element;
291
300
 
292
- declare type HeaderProps = {
301
+ declare type HeaderProps = ComponentProps<typeof Collapsible.Root> & {
293
302
  defaultOpen?: boolean;
294
303
  open?: boolean;
295
304
  disabled?: boolean;
@@ -363,21 +372,7 @@ export declare type LocationBlock = {
363
372
 
364
373
  export declare const mapToWebchatError: (thrown: unknown) => WebchatError;
365
374
 
366
- export declare const Message: MemoExoticComponent<ForwardRefExoticComponent<{
367
- children?: ReactNode;
368
- renderers?: Partial<Renderers>;
369
- sendMessage?: (payload: IntegrationMessage["payload"]) => void;
370
- addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
371
- isReadOnly?: boolean;
372
- isLastDeliveredMessage?: boolean;
373
- showAvatar?: boolean;
374
- } & BlockMessage<GenericBlock> & {
375
- direction: "incoming" | "outgoing" | "system";
376
- sender: {
377
- name: string;
378
- avatar?: string;
379
- };
380
- } & RefAttributes<HTMLDivElement>>>;
375
+ export declare const Message: MemoExoticComponent<({ ref, direction, block, disableInput, children, sender, id, authorId, status, renderers, isReadOnly, isLastDeliveredMessage, feedback, timestamp, metadata, sendMessage, addMessageFeedback, showAvatar, }: MessageProps) => JSX.Element>;
381
376
 
382
377
  export declare const MessageContext: Context<MessageContextVaue | null>;
383
378
 
@@ -386,9 +381,9 @@ declare type MessageContextVaue = {
386
381
  setIsLoading: Dispatch<SetStateAction<string[]>>;
387
382
  };
388
383
 
389
- 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_3.Element>;
384
+ export declare const MessageList: MemoExoticComponent<({ className, messages, isTyping, headerMessage, renderers, botAvatar, botDescription, botName, sendMessage, addMessageFeedback, showMarquee, showDateSystemMessage, showMessageStatus, showIncomingMessageAvatar, showOutgoingMessageAvatar, ...props }: MessageListProps) => JSX.Element>;
390
385
 
391
- declare type MessageListProps = {
386
+ declare type MessageListProps = ComponentProps<'div'> & {
392
387
  messages?: RichBlockMessage[];
393
388
  isTyping?: boolean;
394
389
  headerMessage?: string;
@@ -405,12 +400,27 @@ declare type MessageListProps = {
405
400
  showOutgoingMessageAvatar?: boolean;
406
401
  };
407
402
 
408
- export declare const MessagePreview: ForwardRefExoticComponent<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
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
409
  avatarUrl?: string;
410
410
  botName?: string;
411
411
  description?: string;
412
412
  onClose?: () => void;
413
- }, "ref"> & RefAttributes<HTMLDivElement>>;
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
424
 
415
425
  export declare const MISSING_API_URL = "The API url is required to initialize the webchat.";
416
426
 
@@ -424,7 +434,7 @@ export declare function Modal({ open, onOpenChange, children, }: {
424
434
  open?: boolean;
425
435
  onOpenChange?: (open: boolean) => void;
426
436
  children: ReactNode;
427
- }): JSX_3.Element;
437
+ }): JSX.Element;
428
438
 
429
439
  export declare namespace Modal {
430
440
  var Button: ForwardRefExoticComponent<Dialog.DialogTriggerProps & RefAttributes<HTMLButtonElement>>;
@@ -440,7 +450,7 @@ declare function ModalContent({ title, description, onConfirm, onCancel, confirm
440
450
  confirmButtonText?: string;
441
451
  cancelButtonText?: string;
442
452
  children: ReactNode;
443
- }): JSX_3.Element;
453
+ }): JSX.Element;
444
454
 
445
455
  export declare const ModalContext: Context<ModalContextValue>;
446
456
 
@@ -450,7 +460,7 @@ declare type ModalContextValue = {
450
460
 
451
461
  export declare const ModalProvider: ({ children }: {
452
462
  children: ReactNode;
453
- }) => JSX_3.Element;
463
+ }) => JSX.Element;
454
464
 
455
465
  export declare const NETWORK_ERROR = "Please check your internet connection and refresh the page.";
456
466
 
@@ -461,6 +471,7 @@ export declare type Options = {
461
471
  };
462
472
 
463
473
  export declare type Props = {
474
+ ref?: Ref<HTMLDivElement>;
464
475
  className?: string;
465
476
  renderers?: Partial<Renderers>;
466
477
  configuration: Configuration;
@@ -558,11 +569,12 @@ export declare type Renderers = {
558
569
 
559
570
  export declare const renderers: Renderers;
560
571
 
561
- export declare const RestartConversationButton: ({ restartConversation, ...props }: Props_5) => JSX_3.Element;
572
+ export declare const RestartConversationButton: ({ restartConversation, ...props }: Props_5) => JSX.Element;
562
573
 
563
574
  export declare const retryWithBackoff: <T>(fn: () => Promise<T>, maxAttempts?: number, delayMs?: number) => Promise<T>;
564
575
 
565
576
  export declare type RichBlockMessage<T = GenericBlock> = BlockMessage<T> & {
577
+ ref?: Ref<HTMLDivElement>;
566
578
  direction: 'incoming' | 'outgoing' | 'system';
567
579
  sender: {
568
580
  name: string;
@@ -613,7 +625,7 @@ export declare type StyleOptions = {
613
625
  /**
614
626
  * StylesheetProvider component that manages theme styles and font loading
615
627
  */
616
- export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant, additionalStylesheetUrl, }: Props_7) => JSX_3.Element;
628
+ export declare const StylesheetProvider: ({ color, fontFamily, radius, themeMode, variant, headerVariant, additionalStylesheetUrl, }: Props_7) => JSX.Element;
617
629
 
618
630
  export declare type TextBlock = {
619
631
  type: 'text';
@@ -627,7 +639,7 @@ declare type ToPayloadType<T extends IntegrationMessageTypes> = {
627
639
  };
628
640
  }[T];
629
641
 
630
- export declare const TypingIndicator: MemoExoticComponent<({ ...props }: ComponentProps<"div">) => JSX_3.Element>;
642
+ export declare const TypingIndicator: MemoExoticComponent<({ ...props }: ComponentProps<"div">) => JSX.Element>;
631
643
 
632
644
  export declare type UseImageSizeResult = [Dimensions | null, {
633
645
  loading: boolean;
@@ -687,7 +699,7 @@ export declare type VideoBlock = {
687
699
  url: string;
688
700
  };
689
701
 
690
- export declare const Webchat: ({ clientId, storageKey, configuration, allowFileUpload, apiUrl, user, conversationId, ...props }: Props_6) => JSX_3.Element;
702
+ export declare const Webchat: ({ clientId, storageKey, configuration, allowFileUpload, apiUrl, user, conversationId, ...props }: Props_6) => JSX.Element;
691
703
 
692
704
  export declare const webchatClasses: {
693
705
  readonly container: {
@@ -1268,8 +1280,8 @@ export declare type WebchatEvents = {
1268
1280
  };
1269
1281
 
1270
1282
  declare type WebchatStore = {
1271
- messageContainerRef: RefObject<HTMLDivElement>;
1272
- setMessageContainerRef: (ref: RefObject<HTMLDivElement>) => void;
1283
+ messageContainerRef: RefObject<HTMLDivElement | null>;
1284
+ setMessageContainerRef: (ref: RefObject<HTMLDivElement | null>) => void;
1273
1285
  portalContainer: HTMLElement | null;
1274
1286
  setPortalContainer: (container: HTMLElement | null) => void;
1275
1287
  eventEmitter: EventEmitter<Events_2>;