@botpress/webchat 2.3.8 → 2.4.0-beta.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.
Files changed (69) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +2 -1
  2. package/.storybook/main.ts +25 -0
  3. package/.storybook/preview.tsx +112 -0
  4. package/.turbo/turbo-build.log +10 -14
  5. package/dist/client/client.d.ts +33 -41
  6. package/dist/client/index.d.ts +2 -0
  7. package/dist/client/legacyClient.d.ts +55 -0
  8. package/dist/client/types.d.ts +2 -11
  9. package/dist/components/Block.d.ts +4 -2
  10. package/dist/components/CloseWindowButton.d.ts +7 -0
  11. package/dist/components/Composer/Composer.d.ts +13 -1
  12. package/dist/components/Container/Container.d.ts +9 -1
  13. package/dist/components/Header/Header.d.ts +5 -1
  14. package/dist/components/Loader/Loader.d.ts +5 -0
  15. package/dist/components/Loader/index.d.ts +1 -0
  16. package/dist/components/Marquee/Marquee.d.ts +7 -1
  17. package/dist/components/Message/Message.d.ts +10 -6
  18. package/dist/components/MessageList/MessageList.d.ts +13 -7
  19. package/dist/components/RestartConversationButton.d.ts +7 -0
  20. package/dist/components/Webchat.d.ts +29 -1
  21. package/dist/components/index.d.ts +1 -1
  22. package/dist/components/renderers/Audio/Audio.d.ts +4 -2
  23. package/dist/components/renderers/Button/Button.d.ts +1 -1
  24. package/dist/components/renderers/Carousel/Carousel.d.ts +4 -2
  25. package/dist/components/renderers/Dropdown/Dropdown.d.ts +1 -1
  26. package/dist/components/renderers/File/File.d.ts +4 -2
  27. package/dist/components/renderers/Image/Image.d.ts +4 -2
  28. package/dist/components/renderers/Location/Location.d.ts +4 -2
  29. package/dist/components/renderers/Video/Video.d.ts +4 -2
  30. package/dist/components/renderers/index.d.ts +1 -1
  31. package/dist/contexts/index.d.ts +0 -1
  32. package/dist/gen/signals/index.d.ts +4 -4
  33. package/dist/gen/signals/messageCreated.z.d.ts +4 -4
  34. package/dist/hooks/index.d.ts +2 -1
  35. package/dist/hooks/useIsTyping.d.ts +4 -0
  36. package/dist/hooks/useWebchatClient.d.ts +48 -0
  37. package/dist/index.d.ts +3 -3
  38. package/dist/index.js +22478 -23312
  39. package/dist/index.umd.cjs +126 -126
  40. package/dist/providers/StylesheetProvider.d.ts +4 -0
  41. package/dist/providers/index.d.ts +1 -1
  42. package/dist/stores/index.d.ts +3 -1
  43. package/dist/stores/messageHistoryStore.d.ts +20 -0
  44. package/dist/stores/messagesStore.d.ts +20 -0
  45. package/dist/stores/userStore.d.ts +31 -0
  46. package/dist/stores/webchatStore.d.ts +5 -53
  47. package/dist/stories/Messages/Audio.stories.d.ts +6 -0
  48. package/dist/stories/Messages/Bloc.stories.d.ts +6 -0
  49. package/dist/stories/Messages/Card.stories.d.ts +6 -0
  50. package/dist/stories/Messages/Carousel.stories.d.ts +6 -0
  51. package/dist/stories/Messages/Choice.stories.d.ts +6 -0
  52. package/dist/stories/Messages/Dropdown.stories.d.ts +6 -0
  53. package/dist/stories/Messages/File.stories.d.ts +6 -0
  54. package/dist/stories/Messages/Image.stories.d.ts +6 -0
  55. package/dist/stories/Messages/Location.stories.d.ts +6 -0
  56. package/dist/stories/Messages/Text.stories.d.ts +6 -0
  57. package/dist/stories/Messages/Video.stories.d.ts +6 -0
  58. package/dist/stories/index.d.ts +1 -0
  59. package/dist/style.css +1 -1
  60. package/dist/styles/classes.d.ts +3 -0
  61. package/dist/types/block-type.d.ts +21 -5
  62. package/dist/utils/message.d.ts +2 -2
  63. package/package.json +19 -2
  64. package/dist/components/CloseWindow.d.ts +0 -5
  65. package/dist/components/RestartConversation.d.ts +0 -5
  66. package/dist/contexts/WebchatContext.d.ts +0 -73
  67. package/dist/hooks/useWebchatStore.d.ts +0 -2
  68. package/dist/providers/WebchatProvider.d.ts +0 -4
  69. package/dist/stores/offlineStore.d.ts +0 -33
@@ -1,11 +1,12 @@
1
1
  /** @type {import("eslint").Linter.Config} */
2
2
  module.exports = {
3
3
  root: true,
4
- extends: ["@repo/eslint-config/react-internal.js"],
4
+ extends: ["@repo/eslint-config/react-internal.js", "plugin:storybook/recommended"],
5
5
  parser: "@typescript-eslint/parser",
6
6
  ignorePatterns: ["dist", "node_modules", "storybook-static", ".turbo", "turbo/*"],
7
7
  parserOptions: {
8
8
  project: "./tsconfig.json",
9
9
  tsconfigRootDir: __dirname,
10
10
  },
11
+
11
12
  };
@@ -0,0 +1,25 @@
1
+ import { join, dirname } from 'path'
2
+
3
+ /**
4
+ * This function is used to resolve the absolute path of a package.
5
+ * It is needed in projects that use Yarn PnP or are set up within a monorepo.
6
+ */
7
+ function getAbsolutePath(value) {
8
+ return dirname(require.resolve(join(value, 'package.json')))
9
+ }
10
+
11
+ /** @type { import('@storybook/react-vite').StorybookConfig } */
12
+ const config = {
13
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
14
+ addons: [
15
+ getAbsolutePath('@storybook/addon-onboarding'),
16
+ getAbsolutePath('@storybook/addon-essentials'),
17
+ getAbsolutePath('@chromatic-com/storybook'),
18
+ getAbsolutePath('@storybook/addon-interactions'),
19
+ ],
20
+ framework: {
21
+ name: getAbsolutePath('@storybook/react-vite'),
22
+ options: {},
23
+ },
24
+ }
25
+ export default config
@@ -0,0 +1,112 @@
1
+ // import '../src/index.css' // This has to be imported as early as possible
2
+ import React from 'react'
3
+ import type { Preview } from '@storybook/react'
4
+ import { StylesheetProvider } from '../src/providers'
5
+ import { Container } from '../src/components'
6
+
7
+ const radiusMap = {
8
+ none: 0,
9
+ sm: 0.5,
10
+ md: 1,
11
+ lg: 2,
12
+ xl: 4,
13
+ }
14
+
15
+ const colorMap = {
16
+ red: '#dc2626',
17
+ orange: '#ea580c',
18
+ amber: '#d97706',
19
+ yellow: '#eab308',
20
+ lime: '#a3e635',
21
+ green: '#22c55e',
22
+ emerald: '#10b981',
23
+ teal: '#14b8a6',
24
+ cyan: '#06b6d4',
25
+ sky: '#0ea5e9',
26
+ blue: '#3b82f6',
27
+ indigo: '#6366f1',
28
+ violet: '#8b5cf6',
29
+ purple: '#9333ea',
30
+ fuchsia: '#d946ef',
31
+ pink: '#ec4899',
32
+ }
33
+
34
+ /** @type { import('@storybook/react').Preview } */
35
+ const preview: Preview = {
36
+ initialGlobals: {
37
+ themeMode: 'light',
38
+ fontFamily: 'inter',
39
+ radius: 'md',
40
+ variant: 'solid',
41
+ color: 'blue',
42
+ },
43
+ globalTypes: {
44
+ themeMode: {
45
+ toolbar: {
46
+ dynamicTitle: true,
47
+ title: 'Theme',
48
+ icon: 'mirror',
49
+ items: ['light', 'dark'],
50
+ },
51
+ },
52
+ fontFamily: {
53
+ toolbar: {
54
+ title: 'Font Family',
55
+ dynamicTitle: true,
56
+ icon: 'edit',
57
+ items: ['rubik', 'inter', 'ibm', 'fira'],
58
+ },
59
+ },
60
+ radius: {
61
+ toolbar: {
62
+ title: 'Radius',
63
+ dynamicTitle: true,
64
+ icon: 'button',
65
+ items: Object.keys(radiusMap),
66
+ },
67
+ },
68
+ variant: {
69
+ toolbar: {
70
+ title: 'Variant',
71
+ dynamicTitle: true,
72
+ icon: 'expandalt',
73
+ items: ['solid', 'soft'],
74
+ },
75
+ },
76
+ color: {
77
+ toolbar: {
78
+ title: 'Color',
79
+ dynamicTitle: true,
80
+ icon: 'paintbrush',
81
+ items: Object.keys(colorMap),
82
+ },
83
+ },
84
+ },
85
+ parameters: {
86
+ controls: {
87
+ matchers: {
88
+ color: /(background|color)$/i,
89
+ date: /Date$/i,
90
+ },
91
+ },
92
+ },
93
+ decorators: [
94
+ (Story, context) => {
95
+ const { themeMode, variant, radius, fontFamily, color } = context.globals
96
+ return (
97
+ // TODO: These css hacks should not be required
98
+ <Container
99
+ className="bpReset bpContainer"
100
+ style={{ width: '400px', border: 'none', backgroundColor: 'transparent' }}
101
+ >
102
+ <StylesheetProvider
103
+ {...{ themeMode, variant, fontFamily, radius: radiusMap[radius], color: colorMap[color] }}
104
+ />
105
+ <Story />
106
+ </Container>
107
+ )
108
+ },
109
+ ],
110
+ }
111
+
112
+ export default preview
@@ -1,25 +1,21 @@
1
1
 
2
- > @botpress/webchat@2.3.8 build /home/runner/work/genisys/genisys/packages/webchat-components
2
+ > @botpress/webchat@2.4.0-beta.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...
6
+ src/stories/utils.ts(4,14): error TS2742: The inferred type of 'mockBlockArgs' cannot be named without a reference to '.pnpm/@vitest+spy@2.0.5/node_modules/@vitest/spy'. This is likely not portable. A type annotation is necessary.
7
+
6
8
  transforming...
7
9
  [plugin:vite:resolve] [plugin vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by "/home/runner/work/genisys/genisys/node_modules/.pnpm/@bpinternal+webchat-http-client@0.2.3/node_modules/@bpinternal/webchat-http-client/dist/index.mjs". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
8
- [vite:css] /home/runner/work/genisys/genisys/packages/webchat-components/src/components/renderers/Audio/styles.css is empty
9
- 1 | @import './resets.css';
10
- | ^^^^^^^^^^^^^^^^^^^^^^^
11
- 2 | @import './theme.css';
12
- | ^^^^^^
13
- 3 | @import '../components/index.css'
14
- ✓ 3195 modules transformed.
10
+ ✓ 3103 modules transformed.
15
11
  rendering chunks...
16
12
 
17
13
  [vite:dts] Start generate declaration files...
18
14
  computing gzip size...
19
- dist/style.css  31.27 kB │ gzip: 5.81 kB
20
- dist/index.js 1,094.32 kB │ gzip: 287.43 kB
21
- [vite:dts] Declaration files built in 10676ms.
15
+ dist/style.css  32.56 kB │ gzip: 6.24 kB
16
+ dist/index.js 1,023.92 kB │ gzip: 267.60 kB
17
+ [vite:dts] Declaration files built in 11966ms.
22
18
 
23
- dist/style.css  31.27 kB │ gzip: 5.81 kB
24
- dist/index.umd.cjs 761.43 kB │ gzip: 242.07 kB
25
- ✓ built in 19.68s
19
+ dist/style.css  32.56 kB │ gzip: 6.24 kB
20
+ dist/index.umd.cjs 701.90 kB │ gzip: 223.00 kB
21
+ ✓ built in 20.48s
@@ -1,45 +1,37 @@
1
- import { EventEmitter } from '../utils';
2
- import { Events, UserCredentials, UserData, UserOptions, type Message, type User } from './types';
3
- import { type FileType } from '../types';
4
- import type { Message as WebchatMessage } from '../adapters/webchat';
5
- export type PushpinClientProps = {
1
+ import { Message as BotpressMessage } from '@bpinternal/webchat-http-client';
2
+ import type { MessageObject } from '../types';
3
+ type Props = {
6
4
  apiUrl: string;
7
5
  clientId: string;
6
+ sseTimeout?: number;
8
7
  };
9
- export declare class WebchatClient extends EventEmitter<Events> {
10
- private _client;
11
- private _webhookId;
12
- private _apiUrl;
13
- private _state;
14
- constructor(props: PushpinClientProps);
15
- readonly mode = "pushpin";
16
- get apiUrl(): string;
17
- get clientId(): string;
18
- get userId(): string | undefined;
19
- getUser(): Promise<{
20
- data: {
21
- [k: string]: any;
22
- } | undefined;
8
+ export type Client = ReturnType<typeof getClient>;
9
+ export declare function getClient({ apiUrl, clientId, sseTimeout }: Props): {
10
+ sendMessage: (props: Parameters<(input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/createMessage").CreateMessageInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/createMessage").CreateMessageResponse>>[number]) => Promise<MessageObject>;
11
+ getMessage: (props: Parameters<(input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/getMessage").GetMessageInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/getMessage").GetMessageResponse>>[number]) => Promise<MessageObject>;
12
+ listConversationMessages: (props: Parameters<(input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/listConversationMessages").ListConversationMessagesInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/listConversationMessages").ListConversationMessagesResponse>>[number]) => Promise<{
13
+ messages: MessageObject[];
14
+ meta: {
15
+ nextToken?: string;
16
+ };
23
17
  }>;
24
- updateUser(user: User): Promise<User>;
25
- get conversationId(): string | undefined;
26
- connect(creds?: UserCredentials, data?: UserData, opts?: UserOptions): Promise<UserCredentials | undefined>;
27
- private _initialConnect;
28
- private _reConnect;
29
- disconnect(): Promise<void>;
30
- sendFile(file: File): Promise<{
31
- fileUrl: string;
32
- name: string;
33
- type: FileType;
34
- }>;
35
- sendMessage(payload: WebchatMessage): Promise<void>;
36
- sendEvent(event: Record<string, any>): Promise<void>;
37
- switchConversation(id: string): Promise<void>;
38
- conversationExists(id: string): Promise<boolean>;
39
- userExists({ userToken }: UserCredentials): Promise<boolean>;
40
- newConversation(): Promise<void>;
41
- private _createNewConversation;
42
- listMessages(): Promise<Message[]>;
43
- private _connectConversation;
44
- private _mapMessage;
45
- }
18
+ createMessage: (props: Parameters<(input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/createMessage").CreateMessageInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/createMessage").CreateMessageResponse>>[number]) => Promise<MessageObject>;
19
+ addParticipant: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/addParticipant").AddParticipantInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/addParticipant").AddParticipantResponse>;
20
+ createConversation: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/createConversation").CreateConversationInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/createConversation").CreateConversationResponse>;
21
+ createEvent: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/createEvent").CreateEventInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/createEvent").CreateEventResponse>;
22
+ createFile: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/createFile").CreateFileInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/createFile").CreateFileResponse>;
23
+ createUser: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/createUser").CreateUserInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/createUser").CreateUserResponse>;
24
+ deleteConversation: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/deleteConversation").DeleteConversationInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/deleteConversation").DeleteConversationResponse>;
25
+ deleteMessage: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/deleteMessage").DeleteMessageInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/deleteMessage").DeleteMessageResponse>;
26
+ deleteUser: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/deleteUser").DeleteUserInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/deleteUser").DeleteUserResponse>;
27
+ getConversation: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/getConversation").GetConversationInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/getConversation").GetConversationResponse>;
28
+ getEvent: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/getEvent").GetEventInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/getEvent").GetEventResponse>;
29
+ getParticipant: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/getParticipant").GetParticipantInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/getParticipant").GetParticipantResponse>;
30
+ getUser: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/getUser").GetUserInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/getUser").GetUserResponse>;
31
+ listConversations: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/listConversations").ListConversationsInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/listConversations").ListConversationsResponse>;
32
+ removeParticipant: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/removeParticipant").RemoveParticipantInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/removeParticipant").RemoveParticipantResponse>;
33
+ updateUser: (input: import("@bpinternal/webchat-http-client/dist/gen/client/operations/updateUser").UpdateUserInput) => Promise<import("@bpinternal/webchat-http-client/dist/gen/client/operations/updateUser").UpdateUserResponse>;
34
+ listenConversation: ({ id, "x-user-key": userKey, }: import("@bpinternal/webchat-http-client/dist/gen/client/operations/listenConversation").ListenConversationInput) => Promise<import("@bpinternal/webchat-http-client").SignalListener>;
35
+ };
36
+ export declare function mapMessage(message: BotpressMessage): MessageObject;
37
+ export {};
@@ -1,2 +1,4 @@
1
1
  export * from './client';
2
+ export * from './legacyClient';
3
+ export * from './state-machine';
2
4
  export * from './types';
@@ -0,0 +1,55 @@
1
+ import { EventEmitter } from '../utils';
2
+ import { Events, UserCredentials, UserData, UserOptions, type User } from './types';
3
+ import { type FileType } from '../types';
4
+ import type { Message as WebchatMessage } from '../adapters/webchat';
5
+ export type PushpinClientProps = {
6
+ apiUrl: string;
7
+ clientId: string;
8
+ };
9
+ export declare class WebchatClient extends EventEmitter<Events> {
10
+ private _client;
11
+ private _webhookId;
12
+ private _apiUrl;
13
+ private _state;
14
+ constructor(props: PushpinClientProps);
15
+ readonly mode = "pushpin";
16
+ get apiUrl(): string;
17
+ get clientId(): string;
18
+ get userId(): string | undefined;
19
+ getUser(): Promise<{
20
+ data: {
21
+ [k: string]: any;
22
+ } | undefined;
23
+ }>;
24
+ updateUser(user: User): Promise<User>;
25
+ get conversationId(): string | undefined;
26
+ connect(creds?: UserCredentials, data?: UserData, opts?: UserOptions): Promise<UserCredentials | undefined>;
27
+ private _initialConnect;
28
+ private _reConnect;
29
+ disconnect(): Promise<void>;
30
+ sendFile(file: File): Promise<{
31
+ fileUrl: string;
32
+ name: string;
33
+ type: FileType;
34
+ }>;
35
+ sendMessage(payload: WebchatMessage): Promise<void>;
36
+ sendEvent(event: Record<string, any>): Promise<void>;
37
+ switchConversation(id: string): Promise<void>;
38
+ conversationExists(id: string): Promise<boolean>;
39
+ userExists({ userToken }: UserCredentials): Promise<boolean>;
40
+ newConversation(): Promise<void>;
41
+ private _createNewConversation;
42
+ listMessages(): Promise<{
43
+ id: string;
44
+ conversationId: string;
45
+ authorId: string;
46
+ sentOn: Date;
47
+ payload: import("../adapters/target").Message;
48
+ disableInput: boolean | undefined;
49
+ metadata: {
50
+ [k: string]: any;
51
+ } | undefined;
52
+ }[]>;
53
+ private _connectConversation;
54
+ private _mapMessage;
55
+ }
@@ -1,4 +1,4 @@
1
- import { BlockObject } from '../types/block-type';
1
+ import { type MessageObject } from '../types/block-type';
2
2
  import { UserProps } from '../types';
3
3
  import type { Message as WebchatMessage } from '../adapters/webchat';
4
4
  type SafeOmit<T, K extends keyof T> = Omit<T, K>;
@@ -9,18 +9,9 @@ export type UserCredentials = {
9
9
  export type User = UserProps;
10
10
  export type UserData = User['data'];
11
11
  export type UserOptions = SafeOmit<User, 'data'>;
12
- export type Message = {
13
- id: string;
14
- conversationId: string;
15
- authorId: string | undefined;
16
- sentOn: Date;
17
- disableInput?: boolean;
18
- payload: BlockObject;
19
- metadata?: Record<string, any>;
20
- };
21
12
  export type WebchatEvents = {
22
13
  conversation: string | undefined;
23
- message: Message;
14
+ message: MessageObject;
24
15
  messageSent: WebchatMessage;
25
16
  error: Error;
26
17
  webchatVisibility: 'show' | 'hide' | 'toggle';
@@ -1,7 +1,9 @@
1
1
  import { JSX } from 'react';
2
+ import { Renderers } from '../types';
2
3
  import { BlockObjects, BlockType, type CommonBlockProps } from '../types';
3
4
  type BlockProps<T extends BlockType> = {
4
5
  block: BlockObjects[T];
5
- } & Partial<CommonBlockProps>;
6
- export declare const Block: <T extends BlockType>({ block, ...props }: BlockProps<T>) => JSX.Element;
6
+ renderers?: Partial<Renderers>;
7
+ } & CommonBlockProps;
8
+ export declare const Block: <T extends BlockType>({ block, renderers, ...props }: BlockProps<T>) => JSX.Element;
7
9
  export {};
@@ -0,0 +1,7 @@
1
+ import { ComponentProps } from 'react';
2
+ import { XMarkIcon } from '@heroicons/react/24/outline';
3
+ type Props = ComponentProps<typeof XMarkIcon> & {
4
+ onClick?: () => void;
5
+ };
6
+ export declare const CloseWindowButton: ({ onClick, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -1,6 +1,18 @@
1
1
  import { ComponentProps, type Ref } from 'react';
2
+ import type { Configuration, FileType } from '../../types';
3
+ import type { Message } from '../../adapters/webchat';
2
4
  type Props = ComponentProps<'div'> & {
3
5
  inputRef?: Ref<HTMLTextAreaElement>;
4
- };
6
+ disableComposer?: boolean;
7
+ isReadOnly?: boolean;
8
+ allowFileUpload?: boolean;
9
+ connected?: boolean;
10
+ sendMessage?: (payload: Message) => void;
11
+ uploadFile?: (file: File) => Promise<{
12
+ fileUrl: string;
13
+ name: string;
14
+ type: FileType;
15
+ }>;
16
+ } & Pick<Configuration, 'composerPlaceholder' | 'showPoweredBy'>;
5
17
  export declare const Composer: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>>;
6
18
  export {};
@@ -1 +1,9 @@
1
- export declare const Container: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
1
+ import { ComponentProps } from 'react';
2
+ type Props = ComponentProps<'div'> & {
3
+ connected?: boolean;
4
+ };
5
+ export declare const Container: {
6
+ ({ children, className, connected, ...props }: Props): import("react/jsx-runtime").JSX.Element;
7
+ displayName: string;
8
+ };
9
+ export {};
@@ -1,8 +1,12 @@
1
+ import type { Configuration } from '../../types';
1
2
  type HeaderProps = {
2
3
  defaultOpen?: boolean;
3
4
  open?: boolean;
4
5
  disabled?: boolean;
5
6
  onOpenChange?(open: boolean): void;
7
+ restartConversation?: () => void;
8
+ closeWindow?: () => void;
9
+ configuration: Pick<Configuration, 'email' | 'phone' | 'privacyPolicy' | 'website' | 'termsOfService' | 'botAvatar' | 'botDescription' | 'botName'>;
6
10
  };
7
- export declare const Header: ({ defaultOpen, disabled, onOpenChange, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Header: ({ defaultOpen, closeWindow, configuration, restartConversation, ...props }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
8
12
  export {};
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ className?: string;
3
+ };
4
+ export declare const Loader: ({ className, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Loader';
@@ -1 +1,7 @@
1
- export declare function Marquee(): import("react/jsx-runtime").JSX.Element;
1
+ type Props = {
2
+ botAvatar?: string;
3
+ botDescription?: string;
4
+ botName?: string;
5
+ };
6
+ export declare function Marquee({ botAvatar, botDescription, botName }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -1,8 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { MessageObject } from '../../types';
3
- type MessageProps = {
4
- scroll: () => void;
2
+ import type { Renderers } from '../../types';
3
+ import type { Message as WebchatMessage } from '../../adapters/webchat';
4
+ export declare const Message: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
5
5
  children?: ReactNode;
6
- } & MessageObject;
7
- export declare const Message: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Partial<MessageProps> & import("react").RefAttributes<HTMLDivElement>>>;
8
- export {};
6
+ renderers?: Partial<Renderers>;
7
+ sendMessage?: (payload: WebchatMessage) => void;
8
+ isReadOnly?: boolean;
9
+ } & import("../..").MessageObject<import("../../adapters/target").Message> & {
10
+ direction: import("../..").MessageDirection;
11
+ sender: import("../..").Sender;
12
+ } & import("react").RefAttributes<HTMLDivElement>>>;
@@ -1,10 +1,16 @@
1
- import { ComponentProps, FC } from 'react';
2
- import { StyleOptions } from '../../contexts';
1
+ import { ComponentProps } from 'react';
2
+ import type { Renderers, RichMessageObject } from '../../types';
3
+ import type { Message as WebchatMessage } from '../../adapters/webchat';
3
4
  type MessageListProps = {
4
- scrollDownButton?: {
5
- text?: string;
6
- icon?: FC<StyleOptions>;
7
- };
5
+ messages?: RichMessageObject[];
6
+ isTyping?: boolean;
7
+ headerMessage?: string;
8
+ renderers?: Partial<Renderers>;
9
+ botAvatar?: string;
10
+ botDescription?: string;
11
+ botName?: string;
12
+ sendMessage?: (payload: WebchatMessage) => void;
13
+ showMarquee?: boolean;
8
14
  };
9
- export declare const MessageList: import("react").MemoExoticComponent<({ scrollDownButton, className, ...props }: ComponentProps<"ul"> & MessageListProps) => import("react/jsx-runtime").JSX.Element>;
15
+ export declare const MessageList: import("react").MemoExoticComponent<({ className, messages, isTyping, headerMessage, renderers, botAvatar, botDescription, botName, sendMessage, showMarquee, ...props }: ComponentProps<"ul"> & MessageListProps) => import("react/jsx-runtime").JSX.Element>;
10
16
  export {};
@@ -0,0 +1,7 @@
1
+ import { ArrowPathIcon } from '@heroicons/react/20/solid';
2
+ import { ComponentProps } from 'react';
3
+ type Props = {
4
+ onClick?: () => void;
5
+ } & ComponentProps<typeof ArrowPathIcon>;
6
+ export declare const RestartConversationButton: ({ onClick, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -1 +1,29 @@
1
- export declare const Webchat: () => import("react/jsx-runtime").JSX.Element;
1
+ import type { Configuration, FileType, MessageObject, Renderers } from '../types';
2
+ import type { Message } from '../adapters/webchat';
3
+ export type Props = {
4
+ renderers?: Partial<Renderers>;
5
+ configuration: Configuration;
6
+ messages: MessageObject[];
7
+ connected?: boolean;
8
+ disableComposer?: boolean;
9
+ isReadOnly?: boolean;
10
+ isLoading?: boolean;
11
+ isTyping?: boolean;
12
+ lastTypingHeartbeat?: Date | null;
13
+ allowFileUpload?: boolean;
14
+ clientId?: string;
15
+ closeWindow?: () => void;
16
+ restartConversation?: () => void;
17
+ user: {
18
+ id: string;
19
+ name?: string;
20
+ pictureUrl?: string;
21
+ } & Record<string, unknown>;
22
+ sendMessage?: (payload: Message) => void;
23
+ uploadFile?: (file: File) => Promise<{
24
+ fileUrl: string;
25
+ name: string;
26
+ type: FileType;
27
+ }>;
28
+ };
29
+ export declare const Webchat: ({ connected, configuration, closeWindow, isTyping, messages, user, sendMessage, uploadFile, isLoading, renderers, isReadOnly, disableComposer, restartConversation, }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -8,6 +8,6 @@ export * from './TypingIndicator';
8
8
  export * from './Message';
9
9
  export * from './MessageList';
10
10
  export * from './Modal';
11
- export * from './RestartConversation';
11
+ export * from './RestartConversationButton';
12
12
  export * from './Webchat';
13
13
  export * from './renderers';
@@ -1,4 +1,6 @@
1
- export declare const Audio: import("react").ForwardRefExoticComponent<import("../../../adapters/target").AudioMessage & Partial<Pick<import("../../..").MessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
1
+ export declare const Audio: import("react").ForwardRefExoticComponent<import("../../../adapters/target").AudioMessage & Pick<import("../../..").RichMessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
2
2
  messageId: string;
3
+ sendMessage?: (payload: import("../../../adapters/webchat").Message) => void;
3
4
  metadata?: Record<string, any>;
4
- }> & import("react").RefAttributes<HTMLAudioElement>>;
5
+ isReadOnly?: boolean;
6
+ } & import("react").RefAttributes<HTMLAudioElement>>;
@@ -1,4 +1,4 @@
1
1
  import { ButtonBlock, type CommonBlockProps } from '../../../types';
2
2
  type Props = ButtonBlock & CommonBlockProps;
3
- export declare const Button: ({ text, buttonValue, type, variant, groupId, reusable, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Button: ({ text, buttonValue, variant, groupId, reusable, sendMessage, isReadOnly, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
4
4
  export {};
@@ -1,4 +1,6 @@
1
- export declare const Carousel: import("react").ForwardRefExoticComponent<import("../../../adapters/target").CarouselMessage & Partial<Pick<import("../../..").MessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
1
+ export declare const Carousel: import("react").ForwardRefExoticComponent<import("../../../adapters/target").CarouselMessage & Pick<import("../../..").RichMessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
2
2
  messageId: string;
3
+ sendMessage?: (payload: import("../../../adapters/webchat").Message) => void;
3
4
  metadata?: Record<string, any>;
4
- }> & import("react").RefAttributes<HTMLDivElement>>;
5
+ isReadOnly?: boolean;
6
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,5 +1,5 @@
1
1
  import { DropdownBlock, type CommonBlockProps } from '../../../types';
2
2
  import { ComponentProps } from 'react';
3
3
  type Props = DropdownBlock & ComponentProps<'div'> & CommonBlockProps;
4
- export declare const Dropdown: ({ options, label, reusable }: Props) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Dropdown: ({ options, label, reusable, sendMessage, isReadOnly }: Props) => import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -1,4 +1,6 @@
1
- export declare const File: import("react").ForwardRefExoticComponent<import("../../../adapters/target").FileMessage & Partial<Pick<import("../../..").MessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
1
+ export declare const File: import("react").ForwardRefExoticComponent<import("../../../adapters/target").FileMessage & Pick<import("../../..").RichMessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
2
2
  messageId: string;
3
+ sendMessage?: (payload: import("../../../adapters/webchat").Message) => void;
3
4
  metadata?: Record<string, any>;
4
- }> & import("react").RefAttributes<HTMLAnchorElement>>;
5
+ isReadOnly?: boolean;
6
+ } & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -1,4 +1,6 @@
1
- export declare const Image: import("react").ForwardRefExoticComponent<import("../../../adapters/target").ImageMessage & Partial<Pick<import("../../..").MessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
1
+ export declare const Image: import("react").ForwardRefExoticComponent<import("../../../adapters/target").ImageMessage & Pick<import("../../..").RichMessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
2
2
  messageId: string;
3
+ sendMessage?: (payload: import("../../../adapters/webchat").Message) => void;
3
4
  metadata?: Record<string, any>;
4
- }> & import("react").RefAttributes<HTMLImageElement>>;
5
+ isReadOnly?: boolean;
6
+ } & import("react").RefAttributes<HTMLImageElement>>;
@@ -1,4 +1,6 @@
1
- export declare const Location: import("react").ForwardRefExoticComponent<import("../../../adapters/target").LocationMessage & Partial<Pick<import("../../..").MessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
1
+ export declare const Location: import("react").ForwardRefExoticComponent<import("../../../adapters/target").LocationMessage & Pick<import("../../..").RichMessageObject<import("../../../adapters/target").Message>, "direction" | "timestamp" | "sender"> & {
2
2
  messageId: string;
3
+ sendMessage?: (payload: import("../../../adapters/webchat").Message) => void;
3
4
  metadata?: Record<string, any>;
4
- }> & import("react").RefAttributes<HTMLAnchorElement>>;
5
+ isReadOnly?: boolean;
6
+ } & import("react").RefAttributes<HTMLAnchorElement>>;