@botpress/webchat 0.5.1 → 1.0.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.
- package/dist/App.d.ts +10 -0
- package/dist/Utils/colors.d.ts +18 -0
- package/dist/Utils/eventEmitter.d.ts +12 -0
- package/dist/Utils/index.d.ts +2 -0
- package/dist/client/MessagingClient.d.ts +27 -0
- package/dist/client/adapters/Audio.d.ts +19 -0
- package/dist/client/adapters/Card.d.ts +188 -0
- package/dist/client/adapters/Carousel.d.ts +147 -0
- package/dist/client/adapters/Choice.d.ts +45 -0
- package/dist/client/adapters/Dropdown.d.ts +46 -0
- package/dist/client/adapters/File.d.ts +19 -0
- package/dist/client/adapters/Image.d.ts +19 -0
- package/dist/client/adapters/Location.d.ts +27 -0
- package/dist/client/adapters/Message.d.ts +433 -0
- package/dist/client/adapters/Text.d.ts +20 -0
- package/dist/client/adapters/Utils.d.ts +5 -0
- package/dist/client/adapters/Video.d.ts +19 -0
- package/dist/client/adapters/Voice.d.ts +15 -0
- package/dist/client/adapters/index.d.ts +12 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/components/Avatar.d.ts +6 -0
- package/dist/components/Block.d.ts +4 -0
- package/dist/components/Composer.d.ts +12 -14
- package/dist/components/Container.d.ts +2 -12
- package/dist/components/Header.d.ts +36 -26
- package/dist/components/LoadingIndicator.d.ts +2 -0
- package/dist/components/Message.d.ts +7 -0
- package/dist/components/MessageList.d.ts +2 -0
- package/dist/components/Modal.d.ts +17 -0
- package/dist/components/RestartConversation.d.ts +5 -0
- package/dist/components/Webchat.d.ts +6 -0
- package/dist/components/dev-tools/DevTools.d.ts +1 -0
- package/dist/components/dev-tools/configuration.d.ts +2 -0
- package/dist/components/dev-tools/helpers.d.ts +5 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/renderers/Audio.d.ts +3 -0
- package/dist/components/renderers/Bubble.d.ts +5 -0
- package/dist/components/renderers/Button.d.ts +4 -0
- package/dist/components/renderers/Carousel.d.ts +3 -0
- package/dist/components/renderers/Column.d.ts +5 -0
- package/dist/components/renderers/Dropdown.d.ts +5 -0
- package/dist/components/renderers/File.d.ts +3 -0
- package/dist/components/renderers/Image.d.ts +3 -0
- package/dist/components/renderers/Location.d.ts +3 -0
- package/dist/components/renderers/Row.d.ts +5 -0
- package/dist/components/renderers/Text.d.ts +4 -0
- package/dist/components/renderers/Video.d.ts +3 -0
- package/dist/components/renderers/index.d.ts +2 -0
- package/dist/contexts/ComposerContext.d.ts +8 -0
- package/dist/contexts/MessageContext.d.ts +8 -0
- package/dist/contexts/ModalContext.d.ts +14 -0
- package/dist/contexts/WebchatContext.d.ts +56 -0
- package/dist/contexts/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useImageSize.d.ts +2 -0
- package/dist/hooks/useRefresh.d.ts +10 -0
- package/dist/hooks/useWebchatStore.d.ts +30 -0
- package/dist/index.d.ts +3 -17
- package/dist/index.js +43569 -48
- package/dist/index.umd.cjs +702 -0
- package/dist/main.d.ts +11 -13
- package/dist/providers/ModalProvider.d.ts +8 -0
- package/dist/providers/WebchatProvider.d.ts +13 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/theme.d.ts +3371 -0
- package/dist/services/clipboard.d.ts +1 -0
- package/dist/services/images.d.ts +2 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/toast.d.ts +17 -0
- package/dist/themes/dawn.d.ts +2 -0
- package/dist/themes/duskTheme.d.ts +2 -0
- package/dist/themes/eggplant.d.ts +2 -0
- package/dist/themes/galaxy.d.ts +2 -0
- package/dist/themes/index.d.ts +6 -0
- package/dist/themes/midnight.d.ts +2 -0
- package/dist/themes/prism.d.ts +2 -0
- package/dist/twind.config.d.ts +9 -0
- package/dist/types/block-type.d.ts +93 -0
- package/dist/types/image.d.ts +11 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/index.html +18 -0
- package/package.json +60 -49
- package/public/vite.svg +1 -0
- package/src/App.tsx +41 -0
- package/src/Utils/colors.ts +45 -0
- package/src/Utils/eventEmitter.ts +31 -0
- package/src/Utils/index.ts +2 -0
- package/src/assets/check-circle-bold.svg +5 -0
- package/src/assets/chevron-up.svg +3 -0
- package/src/assets/file-05.svg +6 -0
- package/src/assets/globe-02.svg +6 -0
- package/src/assets/help-circle.svg +3 -0
- package/src/assets/info-circle.svg +3 -0
- package/src/assets/lock-01.svg +4 -0
- package/src/assets/mail-01.svg +6 -0
- package/src/assets/minus-circle.svg +3 -0
- package/src/assets/phone.svg +6 -0
- package/src/assets/send-03.svg +4 -0
- package/src/assets/share-04.svg +5 -0
- package/src/assets/slash-circle-01.svg +3 -0
- package/src/assets/x-circle-bold.svg +5 -0
- package/src/assets/x-close.svg +3 -0
- package/src/assets/x.svg +3 -0
- package/src/client/MessagingClient.ts +87 -0
- package/src/client/adapters/Audio.ts +10 -0
- package/src/client/adapters/Card.ts +104 -0
- package/src/client/adapters/Carousel.ts +11 -0
- package/src/client/adapters/Choice.ts +48 -0
- package/src/client/adapters/Dropdown.ts +39 -0
- package/src/client/adapters/File.ts +10 -0
- package/src/client/adapters/Image.ts +10 -0
- package/src/client/adapters/Location.ts +18 -0
- package/src/client/adapters/Message.ts +26 -0
- package/src/client/adapters/Text.ts +11 -0
- package/src/client/adapters/Utils.ts +11 -0
- package/src/client/adapters/Video.ts +10 -0
- package/src/client/adapters/Voice.ts +9 -0
- package/src/client/adapters/index.ts +12 -0
- package/src/client/index.ts +2 -0
- package/src/components/Avatar.tsx +22 -0
- package/src/components/Block.tsx +17 -0
- package/src/components/Composer.tsx +115 -0
- package/src/components/Container.tsx +17 -0
- package/src/components/Header.tsx +141 -0
- package/src/components/LoadingIndicator.tsx +15 -0
- package/src/components/Message.tsx +52 -0
- package/src/components/MessageList.tsx +75 -0
- package/src/components/Modal.tsx +49 -0
- package/src/components/RestartConversation.tsx +52 -0
- package/src/components/Webchat.tsx +68 -0
- package/src/components/dev-tools/DevTools.tsx +496 -0
- package/src/components/dev-tools/configuration.tsx +27 -0
- package/src/components/dev-tools/helpers.ts +21 -0
- package/src/components/index.ts +12 -0
- package/src/components/renderers/Audio.tsx +11 -0
- package/src/components/renderers/Bubble.tsx +12 -0
- package/src/components/renderers/Button.tsx +59 -0
- package/src/components/renderers/Carousel.tsx +51 -0
- package/src/components/renderers/Column.tsx +22 -0
- package/src/components/renderers/Dropdown.tsx +170 -0
- package/src/components/renderers/File.tsx +13 -0
- package/src/components/renderers/Image.tsx +63 -0
- package/src/components/renderers/Location.tsx +16 -0
- package/src/components/renderers/Row.tsx +22 -0
- package/src/components/renderers/Text.tsx +32 -0
- package/src/components/renderers/Video.tsx +11 -0
- package/src/components/renderers/index.ts +28 -0
- package/src/contexts/ComposerContext.ts +16 -0
- package/src/contexts/MessageContext.ts +16 -0
- package/src/contexts/ModalContext.ts +19 -0
- package/src/contexts/WebchatContext.ts +61 -0
- package/src/contexts/index.ts +4 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useImageSize.ts +30 -0
- package/src/hooks/useRefresh.ts +33 -0
- package/src/hooks/useWebchatStore.ts +45 -0
- package/src/index.css +18 -0
- package/src/index.ts +3 -0
- package/src/main.tsx +33 -0
- package/src/providers/ModalProvider.tsx +35 -0
- package/src/providers/WebchatProvider.tsx +107 -0
- package/src/providers/index.ts +2 -0
- package/src/schemas/index.ts +1 -0
- package/src/schemas/theme.ts +188 -0
- package/src/services/clipboard.ts +8 -0
- package/src/services/images.ts +39 -0
- package/src/services/index.ts +3 -0
- package/src/services/toast.tsx +71 -0
- package/src/themes/dawn.ts +277 -0
- package/src/themes/duskTheme.ts +349 -0
- package/src/themes/eggplant.ts +353 -0
- package/src/themes/galaxy.ts +323 -0
- package/src/themes/index.ts +6 -0
- package/src/themes/midnight.ts +276 -0
- package/src/themes/prism.ts +349 -0
- package/src/twind.config.ts +31 -0
- package/src/types/block-type.ts +150 -0
- package/src/types/image.ts +10 -0
- package/src/types/index.ts +2 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +0 -0
- package/tsconfig.json +30 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +31 -0
- package/README.md +0 -41
- package/assets/fonts/roboto/roboto.woff2 +0 -0
- package/assets/fonts/roboto/roboto500.woff2 +0 -0
- package/assets/fonts/roboto.css +0 -128
- package/assets/notification.mp3 +0 -0
- package/dist/components/Composer.js +0 -118
- package/dist/components/Container.js +0 -62
- package/dist/components/ConversationList.d.ts +0 -10
- package/dist/components/ConversationList.js +0 -41
- package/dist/components/Footer.d.ts +0 -3
- package/dist/components/Footer.js +0 -21
- package/dist/components/Header.js +0 -181
- package/dist/components/VoiceRecorder.d.ts +0 -10
- package/dist/components/VoiceRecorder.js +0 -137
- package/dist/components/common/Avatar/index.d.ts +0 -9
- package/dist/components/common/Avatar/index.js +0 -13
- package/dist/components/common/BotInfo/index.d.ts +0 -10
- package/dist/components/common/BotInfo/index.js +0 -107
- package/dist/components/common/BotInfo/style.scss +0 -88
- package/dist/components/common/ConfirmDialog/index.d.ts +0 -11
- package/dist/components/common/ConfirmDialog/index.js +0 -78
- package/dist/components/common/ConfirmDialog/style.module.scss +0 -48
- package/dist/components/common/Dialog/index.d.ts +0 -17
- package/dist/components/common/Dialog/index.js +0 -57
- package/dist/components/common/Dialog/style.module.scss +0 -29
- package/dist/components/common/ToolTip/index.d.ts +0 -10
- package/dist/components/common/ToolTip/index.js +0 -163
- package/dist/components/common/ToolTip/style.module.scss +0 -108
- package/dist/components/common/ToolTip/utils.d.ts +0 -15
- package/dist/components/common/ToolTip/utils.js +0 -78
- package/dist/components/common/variables.scss +0 -38
- package/dist/components/messages/InlineFeedback.d.ts +0 -11
- package/dist/components/messages/InlineFeedback.js +0 -56
- package/dist/components/messages/Message.d.ts +0 -11
- package/dist/components/messages/Message.js +0 -106
- package/dist/components/messages/MessageGroup.d.ts +0 -23
- package/dist/components/messages/MessageGroup.js +0 -63
- package/dist/components/messages/MessageList.d.ts +0 -10
- package/dist/components/messages/MessageList.js +0 -148
- package/dist/core/api.d.ts +0 -23
- package/dist/core/api.js +0 -117
- package/dist/core/constants.d.ts +0 -14
- package/dist/core/constants.js +0 -29
- package/dist/core/socket.d.ts +0 -14
- package/dist/core/socket.js +0 -57
- package/dist/declaration.d.ts +0 -2
- package/dist/declaration.js +0 -1
- package/dist/fonts/roboto.d.ts +0 -4
- package/dist/fonts/roboto.js +0 -9
- package/dist/globals.d.ts +0 -7
- package/dist/globals.js +0 -2
- package/dist/icons/Add.d.ts +0 -6
- package/dist/icons/Add.js +0 -10
- package/dist/icons/Cancel.d.ts +0 -5
- package/dist/icons/Cancel.js +0 -10
- package/dist/icons/Chat.d.ts +0 -6
- package/dist/icons/Chat.js +0 -9
- package/dist/icons/Close.d.ts +0 -3
- package/dist/icons/Close.js +0 -10
- package/dist/icons/Delete.d.ts +0 -3
- package/dist/icons/Delete.js +0 -11
- package/dist/icons/Download.d.ts +0 -3
- package/dist/icons/Download.js +0 -10
- package/dist/icons/Email.d.ts +0 -3
- package/dist/icons/Email.js +0 -8
- package/dist/icons/Information.d.ts +0 -3
- package/dist/icons/Information.js +0 -12
- package/dist/icons/List.d.ts +0 -3
- package/dist/icons/List.js +0 -15
- package/dist/icons/Microphone.d.ts +0 -5
- package/dist/icons/Microphone.js +0 -12
- package/dist/icons/Phone.d.ts +0 -3
- package/dist/icons/Phone.js +0 -8
- package/dist/icons/Reload.d.ts +0 -3
- package/dist/icons/Reload.js +0 -10
- package/dist/icons/ThumbsDown.d.ts +0 -3
- package/dist/icons/ThumbsDown.js +0 -11
- package/dist/icons/ThumbsUp.d.ts +0 -3
- package/dist/icons/ThumbsUp.js +0 -11
- package/dist/icons/Website.d.ts +0 -3
- package/dist/icons/Website.js +0 -8
- package/dist/main.js +0 -336
- package/dist/store/composer.d.ts +0 -17
- package/dist/store/composer.js +0 -98
- package/dist/store/index.d.ts +0 -89
- package/dist/store/index.js +0 -604
- package/dist/store/view.d.ts +0 -61
- package/dist/store/view.js +0 -365
- package/dist/translations/ar.json +0 -30
- package/dist/translations/de.json +0 -32
- package/dist/translations/en.json +0 -40
- package/dist/translations/es.json +0 -19
- package/dist/translations/fr.json +0 -40
- package/dist/translations/index.d.ts +0 -9
- package/dist/translations/index.js +0 -95
- package/dist/translations/it.json +0 -38
- package/dist/translations/pt.json +0 -19
- package/dist/translations/ru.json +0 -24
- package/dist/translations/uk.json +0 -24
- package/dist/typings.d.ts +0 -410
- package/dist/typings.js +0 -2
- package/dist/utils/analytics.d.ts +0 -5
- package/dist/utils/analytics.js +0 -37
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -27
- package/dist/utils/storage.d.ts +0 -16
- package/dist/utils/storage.js +0 -129
- package/dist/utils/webchatEvents.d.ts +0 -2
- package/dist/utils/webchatEvents.js +0 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DevTools: () => JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BlockObject, MessageObject } from '../../types';
|
|
2
|
+
type Direction = 'incoming' | 'outgoing' | 'system';
|
|
3
|
+
export declare function messageInBubble(block: BlockObject, direction?: Direction): MessageObject;
|
|
4
|
+
export declare function splitCamelCase(text: string): string;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Avatar';
|
|
2
|
+
export * from './Block';
|
|
3
|
+
export * from './Composer';
|
|
4
|
+
export * from './Container';
|
|
5
|
+
export * from './Header';
|
|
6
|
+
export * from './LoadingIndicator';
|
|
7
|
+
export * from './Message';
|
|
8
|
+
export * from './MessageList';
|
|
9
|
+
export * from './Modal';
|
|
10
|
+
export * from './RestartConversation';
|
|
11
|
+
export * from './Webchat';
|
|
12
|
+
export * from './renderers';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { BubbleBlock, CommonBlockProps } from '../../types';
|
|
3
|
+
type Props = CommonBlockProps & BubbleBlock & ComponentProps<'div'>;
|
|
4
|
+
export declare const Bubble: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { ColumnBlock, CommonBlockProps } from '../../types';
|
|
3
|
+
type Props = CommonBlockProps & ColumnBlock & ComponentProps<'div'>;
|
|
4
|
+
export declare const Column: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CommonBlockProps, DropdownBlock } from '../../types';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
type Props = CommonBlockProps & DropdownBlock & ComponentProps<'div'>;
|
|
4
|
+
export declare const Dropdown: ({ styles, type, options, label, reusable }: Props) => JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { RowBlock, CommonBlockProps } from '../../types';
|
|
3
|
+
type Props = CommonBlockProps & RowBlock & ComponentProps<'div'>;
|
|
4
|
+
export declare const Row: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ComposerContextValue = {
|
|
3
|
+
value: string;
|
|
4
|
+
setValue: (value: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const ComposerContext: import("react").Context<ComposerContextValue | null>;
|
|
7
|
+
export declare function useComposerContext(): ComposerContextValue;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
type MessageContextVaue = {
|
|
3
|
+
isLoading: string[];
|
|
4
|
+
setIsLoading: Dispatch<SetStateAction<string[]>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const MessageContext: import("react").Context<MessageContextVaue | null>;
|
|
7
|
+
export declare function useMessageContext(): MessageContextVaue;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type ModalContextVaue = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
showModal: (props: {
|
|
5
|
+
title: string;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
}) => void;
|
|
8
|
+
hideModal: () => void;
|
|
9
|
+
title: string;
|
|
10
|
+
content: ReactNode | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const ModalContext: import("react").Context<ModalContextVaue | null>;
|
|
13
|
+
export declare function useModalContext(): ModalContextVaue;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
import type { BlockObject, BlockStyles, MessageObject } from '../types';
|
|
3
|
+
import { EventEmitter, Events } from '../Utils';
|
|
4
|
+
import { Theme } from '../schemas';
|
|
5
|
+
import { type WebchatClient } from '../client';
|
|
6
|
+
export type StyleOptions = {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
type DescriptionItem = {
|
|
11
|
+
title: string;
|
|
12
|
+
link?: string;
|
|
13
|
+
};
|
|
14
|
+
export type Configuration = {
|
|
15
|
+
composerPlaceholder?: string;
|
|
16
|
+
botName?: string;
|
|
17
|
+
botAvatar?: string;
|
|
18
|
+
botDescription?: string;
|
|
19
|
+
website?: DescriptionItem;
|
|
20
|
+
email?: DescriptionItem;
|
|
21
|
+
phone?: DescriptionItem;
|
|
22
|
+
privacyPolicy?: DescriptionItem;
|
|
23
|
+
termsOfService?: DescriptionItem;
|
|
24
|
+
};
|
|
25
|
+
export type Renderers<P extends BlockObject = BlockObject> = {
|
|
26
|
+
[T in P['type']]: FC<Extract<P, {
|
|
27
|
+
type: T;
|
|
28
|
+
}> & {
|
|
29
|
+
styles: BlockStyles;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
export type ModalProps = {
|
|
33
|
+
title: string | null;
|
|
34
|
+
content: ReactNode | null;
|
|
35
|
+
};
|
|
36
|
+
type ContextVaue = {
|
|
37
|
+
theme: Theme;
|
|
38
|
+
renderers: Renderers;
|
|
39
|
+
messages: MessageObject[];
|
|
40
|
+
eventEmitter: EventEmitter<Events>;
|
|
41
|
+
configuration: Configuration;
|
|
42
|
+
setConfiguration: React.Dispatch<React.SetStateAction<Configuration>>;
|
|
43
|
+
state: {
|
|
44
|
+
disableComposer: boolean;
|
|
45
|
+
};
|
|
46
|
+
client: {
|
|
47
|
+
on: WebchatClient['on'];
|
|
48
|
+
sendMessage: WebchatClient['sendMessage'];
|
|
49
|
+
restartConversation: () => void;
|
|
50
|
+
};
|
|
51
|
+
setState: (state: Partial<ContextVaue['state']>) => void;
|
|
52
|
+
setTheme: (styles: Partial<Theme>) => void;
|
|
53
|
+
};
|
|
54
|
+
export declare const WebchatContext: import("react").Context<ContextVaue | null>;
|
|
55
|
+
export declare function useWebchatContext(): ContextVaue;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const defaultGetRefreshTime: (expiresAt: Date) => number;
|
|
2
|
+
/**
|
|
3
|
+
* Utility hooks to force a state fresh based on a date
|
|
4
|
+
* @example
|
|
5
|
+
* const [onRefresh, setDate] = useDateRefresh()
|
|
6
|
+
* useEffect(() => {}, [onRefresh])
|
|
7
|
+
* setDate(futureDate) // The refresh function will trigger when the date passes
|
|
8
|
+
* @returns value to observe for refreshing and a function that set the refresh date
|
|
9
|
+
*/
|
|
10
|
+
export declare const useRefresh: (getRefreshTimeInMs?: (expiresAt: Date) => number) => [number, (date: Date) => void];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UserCredentials } from '@botpress/messaging-socket';
|
|
2
|
+
type WebchatState = {
|
|
3
|
+
messageHistory: {
|
|
4
|
+
[key: string]: string[];
|
|
5
|
+
};
|
|
6
|
+
user?: UserCredentials;
|
|
7
|
+
conversationId?: string;
|
|
8
|
+
addMessageToHistory: (props: {
|
|
9
|
+
userId: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
setUser: (userId?: UserCredentials) => void;
|
|
13
|
+
setConversationId: (conversationId?: string) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const useWebchatStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<WebchatState>, "setState"> & {
|
|
16
|
+
setState<A extends string | {
|
|
17
|
+
type: unknown;
|
|
18
|
+
}>(partial: WebchatState | Partial<WebchatState> | ((state: WebchatState) => WebchatState | Partial<WebchatState>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
19
|
+
}, "persist"> & {
|
|
20
|
+
persist: {
|
|
21
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<WebchatState, WebchatState>>) => void;
|
|
22
|
+
clearStorage: () => void;
|
|
23
|
+
rehydrate: () => void | Promise<void>;
|
|
24
|
+
hasHydrated: () => boolean;
|
|
25
|
+
onHydrate: (fn: (state: WebchatState) => void) => () => void;
|
|
26
|
+
onFinishHydration: (fn: (state: WebchatState) => void) => () => void;
|
|
27
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<WebchatState, WebchatState>>;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface State {
|
|
5
|
-
store: RootStore;
|
|
6
|
-
}
|
|
7
|
-
interface Props {
|
|
8
|
-
config?: Config;
|
|
9
|
-
fullscreen?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare class ExposedWebChat extends React.Component<Props, State> {
|
|
12
|
-
constructor(props: Props);
|
|
13
|
-
render(): JSX.Element;
|
|
14
|
-
}
|
|
15
|
-
export declare const Embedded: (props: Props) => ExposedWebChat;
|
|
16
|
-
export declare const Fullscreen: (props: Props) => ExposedWebChat;
|
|
17
|
-
export * from './typings';
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './providers';
|
|
3
|
+
export * from './types';
|