@botpress/webchat 4.2.2 → 4.3.2

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,5 @@
1
1
 
2
- > @botpress/webchat@4.2.2 build /home/runner/work/genisys/genisys/packages/webchat-components
2
+ > @botpress/webchat@4.3.2 build /home/runner/work/genisys/genisys/packages/webchat-components
3
3
  > vite build
4
4
 
5
5
  vite v5.4.8 building for production...
@@ -10,12 +10,12 @@ rendering chunks...
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 679.60 kB │ gzip: 183.90 kB
13
+ dist/index.js 678.97 kB │ gzip: 183.72 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 18826ms.
17
+ [vite:dts] Declaration files built in 19456ms.
18
18
 
19
19
  dist/style.css  54.01 kB │ gzip: 9.07 kB
20
- dist/index.umd.cjs 451.67 kB │ gzip: 148.74 kB
21
- ✓ built in 23.52s
20
+ dist/index.umd.cjs 451.15 kB │ gzip: 148.59 kB
21
+ ✓ built in 24.07s
package/dist/index.d.ts CHANGED
@@ -1,31 +1,37 @@
1
1
  import { AddMessageFeedbackBody } from '@botpress/webchat-client';
2
- import { ClassAttributes } from 'react';
2
+ import { ClassAttributes } from '../../../node_modules/@types/react';
3
3
  import { Client } from '@botpress/webchat-client';
4
- import { ComponentProps } from 'react';
5
- import { ComponentPropsWithRef } from 'react';
4
+ import { ComponentProps } from '../../../node_modules/@types/react';
5
+ import { ComponentProps as ComponentProps_2 } from '../../node_modules/@types/react';
6
+ import { ComponentPropsWithRef } from '../../node_modules/@types/react';
6
7
  import { LatestWebchatConfig as Configuration } from '@bpinternal/shared';
7
- import { Context } from 'react';
8
- import { CSSProperties } from 'react';
8
+ import { Context } from '../../node_modules/@types/react';
9
+ import { CSSProperties } from '../../node_modules/@types/react';
9
10
  import * as Dialog from '@radix-ui/react-dialog';
10
- import { Dispatch } from 'react';
11
+ import { Dispatch } from '../../node_modules/@types/react';
11
12
  import { EventEmitter } from '@bpinternal/shared';
12
- import type { FC } from 'react';
13
- import { ForwardRefExoticComponent } from 'react';
14
- import { HTMLAttributes } from 'react';
13
+ import { FC } from '../../node_modules/@types/react';
14
+ import { ForwardRefExoticComponent } from '../../node_modules/@types/react';
15
+ import { ForwardRefExoticComponent as ForwardRefExoticComponent_2 } from '../../../node_modules/@types/react';
16
+ import { ForwardRefExoticComponent as ForwardRefExoticComponent_3 } from 'react';
17
+ import { HTMLAttributes } from '../../../node_modules/@types/react';
15
18
  import { IntegrationError } from '@botpress/webchat-client';
16
- import { JSX } from 'react';
19
+ import { JSX } from '../../node_modules/@types/react';
17
20
  import { JSX as JSX_2 } from 'react/jsx-runtime';
18
21
  import { LatestWebchatTheme } from '@bpinternal/shared';
19
- import { MemoExoticComponent } from 'react';
22
+ import { MemoExoticComponent } from '../../../node_modules/@types/react';
20
23
  import { Message as Message_2 } from '@botpress/webchat-client';
21
- import { NamedExoticComponent } from 'react';
24
+ import { NamedExoticComponent } from '../../../node_modules/@types/react';
22
25
  import { PersistOptions } from 'zustand/middleware';
23
- import { ReactNode } from 'react';
24
- import { Ref } from 'react';
25
- import { RefAttributes } from 'react';
26
- import { RefObject } from 'react';
26
+ import { ReactNode } from '../../../node_modules/@types/react';
27
+ import { ReactNode as ReactNode_2 } from '../../node_modules/@types/react';
28
+ import { Ref } from '../../../node_modules/@types/react';
29
+ import { RefAttributes } from '../../node_modules/@types/react';
30
+ import { RefAttributes as RefAttributes_2 } from '../../../node_modules/@types/react';
31
+ import { RefAttributes as RefAttributes_3 } from 'react';
32
+ import { RefObject } from '../../node_modules/@types/react';
27
33
  import { RotateCcw } from 'lucide-react';
28
- import { SetStateAction } from 'react';
34
+ import { SetStateAction } from '../../node_modules/@types/react';
29
35
  import { StoreApi } from 'zustand';
30
36
  import { UseBoundStore } from 'zustand';
31
37
  import { User } from '@botpress/webchat-client';
@@ -142,12 +148,6 @@ declare type ChatSoundStore = {
142
148
  toggleSound: () => void;
143
149
  };
144
150
 
145
- declare class ChatSoundStores {
146
- private static _instances;
147
- private constructor();
148
- static getInstance(name?: string): BoundChatSoundStore;
149
- }
150
-
151
151
  export declare type ColumnBlock = {
152
152
  type: 'column';
153
153
  blocks: GenericBlock[];
@@ -176,47 +176,47 @@ export declare type ComposableIntegrationMessagePayload = Extract<IntegrationMes
176
176
 
177
177
  declare type ComposableIntegrationMessageTypes = 'audio' | 'bloc' | 'file' | 'image' | 'location' | 'markdown' | 'text' | 'video';
178
178
 
179
- export declare const Composer: NamedExoticComponent<Omit<Props_3, "ref"> & RefAttributes<HTMLDivElement>>;
179
+ export declare const Composer: NamedExoticComponent<Omit<Props_3, "ref"> & RefAttributes_2<HTMLDivElement>>;
180
180
 
181
181
  export declare const CONFIG_ACCESS_DENIED = "Access denied to configuration file. Please check your credentials or your configuration URL and try again.";
182
182
 
183
183
  export { Configuration }
184
184
 
185
185
  export declare const Container: {
186
- ({ children, className, uploadFile, allowFileUpload, storageKey, connected: _, ...props }: Props_4): JSX_2.Element;
186
+ ({ children, className, uploadFile, allowFileUpload, storageKey, ...props }: Props_4): JSX_2.Element;
187
187
  displayName: string;
188
188
  };
189
189
 
190
190
  declare const createChatSoundStore: (storeName: string) => UseBoundStore<Omit<Omit<StoreApi<ChatSoundStore>, "setState"> & {
191
- setState<A extends string | {
192
- type: unknown;
193
- }>(partial: ChatSoundStore | Partial<ChatSoundStore> | ((state: ChatSoundStore) => ChatSoundStore | Partial<ChatSoundStore>), replace?: boolean | undefined, action?: A | undefined): void;
191
+ setState<A extends string | {
192
+ type: unknown;
193
+ }>(partial: ChatSoundStore | Partial<ChatSoundStore> | ((state: ChatSoundStore) => ChatSoundStore | Partial<ChatSoundStore>), replace?: boolean | undefined, action?: A | undefined): void;
194
194
  }, "persist"> & {
195
- persist: {
196
- setOptions: (options: Partial<PersistOptions<ChatSoundStore, ChatSoundStore>>) => void;
197
- clearStorage: () => void;
198
- rehydrate: () => Promise<void> | void;
199
- hasHydrated: () => boolean;
200
- onHydrate: (fn: (state: ChatSoundStore) => void) => () => void;
201
- onFinishHydration: (fn: (state: ChatSoundStore) => void) => () => void;
202
- getOptions: () => Partial<PersistOptions<ChatSoundStore, ChatSoundStore>>;
203
- };
195
+ persist: {
196
+ setOptions: (options: Partial<PersistOptions<ChatSoundStore, ChatSoundStore>>) => void;
197
+ clearStorage: () => void;
198
+ rehydrate: () => Promise<void> | void;
199
+ hasHydrated: () => boolean;
200
+ onHydrate: (fn: (state: ChatSoundStore) => void) => () => void;
201
+ onFinishHydration: (fn: (state: ChatSoundStore) => void) => () => void;
202
+ getOptions: () => Partial<PersistOptions<ChatSoundStore, ChatSoundStore>>;
203
+ };
204
204
  }>;
205
205
 
206
206
  declare const createWebchatClientStore: (storeName: string, storageLocation?: StorageLocation) => UseBoundStore<Omit<Omit<StoreApi<WebchatClientStore>, "setState"> & {
207
- setState<A extends string | {
208
- type: unknown;
209
- }>(partial: WebchatClientStore | Partial<WebchatClientStore> | ((state: WebchatClientStore) => WebchatClientStore | Partial<WebchatClientStore>), replace?: boolean | undefined, action?: A | undefined): void;
207
+ setState<A extends string | {
208
+ type: unknown;
209
+ }>(partial: WebchatClientStore | Partial<WebchatClientStore> | ((state: WebchatClientStore) => WebchatClientStore | Partial<WebchatClientStore>), replace?: boolean | undefined, action?: A | undefined): void;
210
210
  }, "persist"> & {
211
- persist: {
212
- setOptions: (options: Partial<PersistOptions<WebchatClientStore, unknown>>) => void;
213
- clearStorage: () => void;
214
- rehydrate: () => Promise<void> | void;
215
- hasHydrated: () => boolean;
216
- onHydrate: (fn: (state: WebchatClientStore) => void) => () => void;
217
- onFinishHydration: (fn: (state: WebchatClientStore) => void) => () => void;
218
- getOptions: () => Partial<PersistOptions<WebchatClientStore, unknown>>;
219
- };
211
+ persist: {
212
+ setOptions: (options: Partial<PersistOptions<WebchatClientStore, unknown>>) => void;
213
+ clearStorage: () => void;
214
+ rehydrate: () => Promise<void> | void;
215
+ hasHydrated: () => boolean;
216
+ onHydrate: (fn: (state: WebchatClientStore) => void) => () => void;
217
+ onFinishHydration: (fn: (state: WebchatClientStore) => void) => () => void;
218
+ getOptions: () => Partial<PersistOptions<WebchatClientStore, unknown>>;
219
+ };
220
220
  }>;
221
221
 
222
222
  export declare type CustomBlock = {
@@ -262,9 +262,9 @@ declare type Events_2 = {
262
262
  [key: string]: string;
263
263
  };
264
264
 
265
- export declare const Fab: ForwardRefExoticComponent<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
266
- imgUrl?: string;
267
- }, "ref"> & RefAttributes<HTMLDivElement>>;
265
+ export declare const Fab: ForwardRefExoticComponent_2<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
266
+ imgUrl?: string;
267
+ }, "ref"> & RefAttributes_2<HTMLDivElement>>;
268
268
 
269
269
  export declare type Feedback = AddMessageFeedbackBody;
270
270
 
@@ -284,9 +284,9 @@ export declare function generateThemeStylesheet(theme: LatestWebchatTheme): stri
284
284
 
285
285
  export declare type GenericBlock = AudioBlock | BubbleBlock | ButtonBlock | CarouselBlock | ColumnBlock | DropdownBlock | FileBlock | ImageBlock | LocationBlock | RowBlock | TextBlock | VideoBlock | CustomBlock;
286
286
 
287
- export declare const getUseChatSoundStore: typeof ChatSoundStores.getInstance;
287
+ export declare const getUseChatSoundStore: (name?: string) => BoundChatSoundStore;
288
288
 
289
- export declare const getUseWebchatClientStore: typeof WebchatClientStores.getInstance;
289
+ export declare const getUseWebchatClientStore: (name?: string, storageLocation?: StorageLocation) => BoundWebchatClientStore;
290
290
 
291
291
  export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, disabled, soundOn, toggleSound, clientId, ...props }: HeaderProps) => JSX_2.Element;
292
292
 
@@ -320,7 +320,7 @@ export declare type InputModalProps<T> = {
320
320
  Content?: ({ setValue }: {
321
321
  value: T | undefined;
322
322
  setValue: (value: T) => void;
323
- }) => ReactNode;
323
+ }) => ReactNode_2;
324
324
  };
325
325
 
326
326
  export declare type IntegrationMessage = Message_2;
@@ -364,21 +364,21 @@ export declare type LocationBlock = {
364
364
 
365
365
  export declare const mapToWebchatError: (thrown: unknown) => WebchatError;
366
366
 
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;
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
375
  } & BlockMessage<GenericBlock> & {
376
- direction: "incoming" | "outgoing" | "system";
377
- sender: {
378
- name: string;
379
- avatar?: string;
380
- };
381
- } & RefAttributes<HTMLDivElement>>;
376
+ direction: "incoming" | "outgoing" | "system";
377
+ sender: {
378
+ name: string;
379
+ avatar?: string;
380
+ };
381
+ } & RefAttributes_2<HTMLDivElement>>;
382
382
 
383
383
  export declare const MessageContext: Context<MessageContextVaue | null>;
384
384
 
@@ -406,12 +406,12 @@ declare type MessageListProps = {
406
406
  showOutgoingMessageAvatar?: boolean;
407
407
  };
408
408
 
409
- export declare const MessagePreview: ForwardRefExoticComponent<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
410
- avatarUrl?: string;
411
- botName?: string;
412
- description?: string;
413
- onClose?: () => void;
414
- }, "ref"> & RefAttributes<HTMLDivElement>>;
409
+ export declare const MessagePreview: ForwardRefExoticComponent_2<Omit<ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement> & {
410
+ avatarUrl?: string;
411
+ botName?: string;
412
+ description?: string;
413
+ onClose?: () => void;
414
+ }, "ref"> & RefAttributes_2<HTMLDivElement>>;
415
415
 
416
416
  export declare const MISSING_API_URL = "The API url is required to initialize the webchat.";
417
417
 
@@ -428,8 +428,8 @@ export declare function Modal({ open, onOpenChange, children, }: {
428
428
  }): JSX_2.Element;
429
429
 
430
430
  export declare namespace Modal {
431
- var Button: ForwardRefExoticComponent<Dialog.DialogTriggerProps & RefAttributes<HTMLButtonElement>>;
432
- var Close: ForwardRefExoticComponent<Dialog.DialogCloseProps & RefAttributes<HTMLButtonElement>>;
431
+ var Button: ForwardRefExoticComponent_3<Dialog.DialogTriggerProps & RefAttributes_3<HTMLButtonElement>>;
432
+ var Close: ForwardRefExoticComponent_3<Dialog.DialogCloseProps & RefAttributes_3<HTMLButtonElement>>;
433
433
  var Content: typeof ModalContent;
434
434
  }
435
435
 
@@ -450,7 +450,7 @@ declare type ModalContextValue = {
450
450
  };
451
451
 
452
452
  export declare const ModalProvider: ({ children }: {
453
- children: ReactNode;
453
+ children: ReactNode_2;
454
454
  }) => JSX_2.Element;
455
455
 
456
456
  export declare const NETWORK_ERROR = "Please check your internet connection and refresh the page.";
@@ -480,14 +480,9 @@ export declare type Props = {
480
480
  user?: {
481
481
  id: string;
482
482
  } & Record<string, unknown>;
483
- sendMessage?: (payload: IntegrationMessage['payload']) => Promise<void>;
484
- uploadFile?: (file: File) => Promise<{
485
- fileUrl: string;
486
- name: string;
487
- type: FileType;
488
- }>;
489
- addMessageFeedback?: (messageId: string, feedback: Feedback) => void;
490
- triggerNetworkError?: (errorType?: 'network' | 'timeout' | 'server', delay?: number) => Promise<never>;
483
+ sendMessage?: ScopedClient['sendMessage'];
484
+ uploadFile?: ScopedClient['uploadFile'];
485
+ addMessageFeedback?: ScopedClient['addMessageFeedback'];
491
486
  error?: WebchatError;
492
487
  soundOn?: boolean;
493
488
  toggleSound?: () => void;
@@ -514,29 +509,21 @@ declare type Props_3 = ComponentProps<'div'> & {
514
509
  allowFileUpload?: boolean;
515
510
  disableSendButton?: boolean;
516
511
  connected?: boolean;
517
- sendMessage?: (payload: IntegrationMessage['payload']) => void;
518
- uploadFile?: (file: File) => Promise<{
519
- fileUrl: string;
520
- name: string;
521
- type: FileType;
522
- }>;
512
+ sendMessage?: ScopedClient['sendMessage'];
513
+ uploadFile?: ScopedClient['uploadFile'];
523
514
  storageKey?: string;
524
515
  } & Pick<Configuration, 'composerPlaceholder' | 'footer'>;
525
516
 
526
517
  declare type Props_4 = ComponentProps<'div'> & {
527
518
  connected?: boolean;
528
- uploadFile?: (file: File) => Promise<{
529
- fileUrl: string;
530
- name: string;
531
- type: FileType;
532
- }>;
519
+ uploadFile?: ScopedClient['uploadFile'];
533
520
  allowFileUpload?: boolean;
534
521
  storageKey?: string;
535
522
  };
536
523
 
537
524
  declare type Props_5 = {
538
525
  restartConversation: () => void;
539
- } & ComponentProps<typeof RotateCcw>;
526
+ } & ComponentProps_2<typeof RotateCcw>;
540
527
 
541
528
  declare type Props_6 = {
542
529
  clientId: string;
@@ -547,7 +534,7 @@ declare type Props_6 = {
547
534
  configuration?: Configuration;
548
535
  soundOn?: boolean;
549
536
  toggleSound?: () => void;
550
- } & Pick<ComponentProps<typeof Chat>, 'allowFileUpload' | 'renderers'> & ComponentProps<'div'>;
537
+ } & Pick<ComponentProps_2<typeof Chat>, 'allowFileUpload' | 'renderers'> & ComponentProps_2<'div'>;
551
538
 
552
539
  declare type Props_7 = Partial<LatestWebchatTheme>;
553
540
 
@@ -592,6 +579,7 @@ declare type ScopedClient = {
592
579
  fileUrl: string;
593
580
  name: string;
594
581
  type: FileType;
582
+ fileId: string;
595
583
  }>;
596
584
  addMessageFeedback: (messageId: string, feedback: Feedback) => Promise<void>;
597
585
  getUser: () => Promise<UserResponse>;
@@ -676,9 +664,9 @@ declare type UseWebchatReturn = {
676
664
  };
677
665
 
678
666
  export declare const useWebchatStore: UseBoundStore<Omit<StoreApi<WebchatStore>, "setState"> & {
679
- setState<A extends string | {
680
- type: unknown;
681
- }>(partial: WebchatStore | Partial<WebchatStore> | ((state: WebchatStore) => WebchatStore | Partial<WebchatStore>), replace?: boolean | undefined, action?: A | undefined): void;
667
+ setState<A extends string | {
668
+ type: unknown;
669
+ }>(partial: WebchatStore | Partial<WebchatStore> | ((state: WebchatStore) => WebchatStore | Partial<WebchatStore>), replace?: boolean | undefined, action?: A | undefined): void;
682
670
  }>;
683
671
 
684
672
  declare type ValueOf<T> = T[keyof T];
@@ -1230,12 +1218,6 @@ export declare type WebchatClientState = {
1230
1218
 
1231
1219
  declare type WebchatClientStore = WebchatClientState & WebchatClientActions;
1232
1220
 
1233
- declare class WebchatClientStores {
1234
- private static _instances;
1235
- private constructor();
1236
- static getInstance(name?: string, storageLocation?: StorageLocation): BoundWebchatClientStore;
1237
- }
1238
-
1239
1221
  export declare type WebchatError = ({
1240
1222
  type: 'configuration';
1241
1223
  message: typeof MISSING_CLIENT_ID | typeof MISSING_API_URL | typeof MISSING_BOT_ID | typeof INVALID_CLIENT_ID | typeof INVALID_CONFIGURATION | typeof MISSING_CONFIG_URL;