@botpress/webchat 1.2.0 → 1.3.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/client/MessagingClient/client.d.ts +7 -4
- package/dist/client/PushpinClient/index.d.ts +4 -2
- package/dist/client/PushpinClient/inner-client/index.d.ts +2 -0
- package/dist/client/types.d.ts +4 -1
- package/dist/components/Avatar.d.ts +2 -3
- package/dist/components/Block.d.ts +3 -2
- package/dist/components/CloseWindow.d.ts +5 -0
- package/dist/components/Composer.d.ts +1 -1
- package/dist/components/renderers/Audio.d.ts +1 -1
- package/dist/components/renderers/Carousel.d.ts +1 -1
- package/dist/components/renderers/File.d.ts +1 -1
- package/dist/components/renderers/Image.d.ts +1 -1
- package/dist/components/renderers/Location.d.ts +1 -1
- package/dist/components/renderers/Video.d.ts +1 -1
- package/dist/contexts/WebchatContext.d.ts +3 -3
- package/dist/gen/client/api.d.ts +330 -12
- package/dist/gen/client/client.d.ts +5 -1
- package/dist/gen/client/errors.d.ts +9 -2
- package/dist/gen/models/index.d.ts +186 -23
- package/dist/gen/models/message.j.d.ts +107 -5
- package/dist/gen/models/message.t.d.ts +49 -0
- package/dist/gen/models/message.z.d.ts +79 -12
- package/dist/gen/models/user.j.d.ts +0 -3
- package/dist/gen/models/user.t.d.ts +0 -1
- package/dist/gen/models/user.z.d.ts +0 -3
- package/dist/gen/signals/index.d.ts +218 -23
- package/dist/gen/signals/messageCreatedSignal.j.d.ts +107 -5
- package/dist/gen/signals/messageCreatedSignal.t.d.ts +49 -0
- package/dist/gen/signals/messageCreatedSignal.z.d.ts +111 -18
- package/dist/get-client.d.ts +8 -0
- package/dist/hooks/useClient.d.ts +2 -2
- package/dist/hooks/useWebchatStore.d.ts +3 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +33089 -40901
- package/dist/index.umd.cjs +96 -125
- package/dist/providers/WebchatProvider.d.ts +4 -3
- package/dist/schemas/configuration.d.ts +117 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/init.d.ts +3844 -0
- package/dist/schemas/theme.d.ts +231 -232
- package/dist/types/block-type.d.ts +3 -6
- package/dist/types/configuration.d.ts +4 -16
- package/dist/types/index.d.ts +2 -0
- package/dist/types/init.d.ts +6 -0
- package/dist/types/theme.d.ts +7 -0
- package/dist/utils/index.d.ts +0 -2
- package/package.json +11 -37
- package/dist/App.d.ts +0 -11
- package/dist/components/dev-tools/DevTools.d.ts +0 -1
- package/dist/components/dev-tools/configuration.d.ts +0 -2
- package/dist/components/dev-tools/helpers.d.ts +0 -5
- package/dist/main.d.ts +0 -0
- package/dist/options.d.ts +0 -11
- package/dist/themes/base.d.ts +0 -3
- package/dist/themes/baseColors.d.ts +0 -736
- package/dist/themes/dawn.d.ts +0 -4
- package/dist/themes/eggplant.d.ts +0 -4
- package/dist/themes/index.d.ts +0 -3
- package/dist/themes/prism.d.ts +0 -4
- package/dist/themes/themeBuilder.d.ts +0 -27
- package/dist/twind.config.d.ts +0 -9
- package/dist/twind.d.ts +0 -16
- package/dist/utils/mergeThemes.d.ts +0 -2
- package/dist/utils/withBaseTheme.d.ts +0 -384
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type MessagingSocketOptions, type UserCredentials } from '@botpress/messaging-socket';
|
|
2
2
|
import { EventEmitter } from '../../utils';
|
|
3
|
-
import { Events, WebchatClient } from '../types';
|
|
3
|
+
import { Events, UserData, WebchatClient } from '../types';
|
|
4
|
+
export type MessagingClientProps = MessagingSocketOptions;
|
|
4
5
|
export declare class MessagingClient implements WebchatClient {
|
|
5
6
|
private socket;
|
|
6
7
|
clientId: string | undefined;
|
|
@@ -10,15 +11,17 @@ export declare class MessagingClient implements WebchatClient {
|
|
|
10
11
|
private connected;
|
|
11
12
|
private readonly emitter;
|
|
12
13
|
on: EventEmitter<Events>['on'];
|
|
13
|
-
constructor(options:
|
|
14
|
-
|
|
14
|
+
constructor(options: MessagingClientProps);
|
|
15
|
+
readonly mode = "messaging";
|
|
16
|
+
connect(creds?: UserCredentials, data?: UserData): Promise<UserCredentials | undefined>;
|
|
15
17
|
disconnect(): Promise<void>;
|
|
16
18
|
sendMessage(message: string): Promise<void>;
|
|
19
|
+
sendEvent(event: Record<string, any>): Promise<void>;
|
|
17
20
|
switchConversation(id: string): Promise<void>;
|
|
18
21
|
conversationExists(id: string): Promise<boolean>;
|
|
19
22
|
newConversation(): Promise<void>;
|
|
20
23
|
listMessages(limit?: number): Promise<{
|
|
21
|
-
payload: import("
|
|
24
|
+
payload: import("webchat-adapters/src/target").Message;
|
|
22
25
|
id: string;
|
|
23
26
|
conversationId: string;
|
|
24
27
|
authorId: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../utils';
|
|
2
|
-
import { Events, Message, UserCredentials, WebchatClient } from '../types';
|
|
2
|
+
import { Events, Message, UserCredentials, UserData, WebchatClient } from '../types';
|
|
3
3
|
export type PushpinClientProps = {
|
|
4
4
|
apiUrl: string;
|
|
5
5
|
clientId: string;
|
|
@@ -9,14 +9,16 @@ export declare class PushpinClient extends EventEmitter<Events> implements Webch
|
|
|
9
9
|
private _webhookId;
|
|
10
10
|
private _state;
|
|
11
11
|
constructor(props: PushpinClientProps);
|
|
12
|
+
readonly mode = "pushpin";
|
|
12
13
|
get clientId(): string;
|
|
13
14
|
get userId(): string | undefined;
|
|
14
15
|
get conversationId(): string | undefined;
|
|
15
|
-
connect(creds?: UserCredentials): Promise<UserCredentials | undefined>;
|
|
16
|
+
connect(creds?: UserCredentials, data?: UserData): Promise<UserCredentials | undefined>;
|
|
16
17
|
private _initialConnect;
|
|
17
18
|
private _reConnect;
|
|
18
19
|
disconnect(): Promise<void>;
|
|
19
20
|
sendMessage(message: string): Promise<void>;
|
|
21
|
+
sendEvent(event: Record<string, any>): Promise<void>;
|
|
20
22
|
switchConversation(id: string): Promise<void>;
|
|
21
23
|
conversationExists(id: string): Promise<boolean>;
|
|
22
24
|
userExists({ userToken }: UserCredentials): Promise<boolean>;
|
|
@@ -35,5 +35,7 @@ export declare class Client implements IClient {
|
|
|
35
35
|
readonly getUser: IAutoClient['getUser'];
|
|
36
36
|
readonly updateUser: IAutoClient['updateUser'];
|
|
37
37
|
readonly deleteUser: IAutoClient['deleteUser'];
|
|
38
|
+
readonly createEvent: IAutoClient['createEvent'];
|
|
39
|
+
readonly getEvent: IAutoClient['getEvent'];
|
|
38
40
|
readonly listenConversation: ({ id, xUserKey }: ListenConversationArgs) => Promise<SignalListener>;
|
|
39
41
|
}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type UserCredentials = {
|
|
|
4
4
|
userId: string;
|
|
5
5
|
userToken: string;
|
|
6
6
|
};
|
|
7
|
+
export type UserData = Record<string, string>;
|
|
7
8
|
export type Message = {
|
|
8
9
|
id: string;
|
|
9
10
|
conversationId: string;
|
|
@@ -21,13 +22,15 @@ export type Events = {
|
|
|
21
22
|
customEvent: Record<string, any>;
|
|
22
23
|
};
|
|
23
24
|
export type WebchatClient = {
|
|
25
|
+
mode: 'messaging' | 'pushpin';
|
|
24
26
|
clientId: string | undefined;
|
|
25
27
|
userId: string | undefined;
|
|
26
28
|
conversationId: string | undefined;
|
|
27
29
|
on: EventEmitter<Events>['on'];
|
|
28
|
-
connect(creds?: UserCredentials): Promise<UserCredentials | undefined>;
|
|
30
|
+
connect(creds?: UserCredentials, data?: UserData): Promise<UserCredentials | undefined>;
|
|
29
31
|
disconnect(): Promise<void>;
|
|
30
32
|
sendMessage(message: string): Promise<void>;
|
|
33
|
+
sendEvent(event: Record<string, any>): Promise<void>;
|
|
31
34
|
switchConversation(id: string): Promise<void>;
|
|
32
35
|
conversationExists(id: string): Promise<boolean>;
|
|
33
36
|
newConversation(): Promise<void>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { AvatarTheme } from '../types';
|
|
1
2
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import * as Themes from '../schemas';
|
|
4
3
|
type AvatarProps = {
|
|
5
4
|
userId?: string;
|
|
6
5
|
src?: string;
|
|
7
|
-
} & Omit<ComponentPropsWithRef<'span'>, 'className' | 'style'> &
|
|
6
|
+
} & Omit<ComponentPropsWithRef<'span'>, 'className' | 'style'> & AvatarTheme;
|
|
8
7
|
export declare const Avatar: import("react").ForwardRefExoticComponent<Omit<AvatarProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
9
8
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BlockMap, BlockTypes, CommonBlockProps } from '../types';
|
|
3
|
+
export declare const Block: <T extends BlockTypes>({ block, styles, ...props }: {
|
|
3
4
|
block: BlockMap[T];
|
|
4
5
|
} & CommonBlockProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Theme } from '../types';
|
|
1
2
|
import { ComponentProps, FC } from 'react';
|
|
2
3
|
import { type StyleOptions } from '../contexts';
|
|
3
|
-
import { Theme } from '../schemas';
|
|
4
4
|
declare const Composer: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
5
5
|
declare const ComposerInput: import("react").MemoExoticComponent<({ ...props }: ComponentProps<'textarea'>) => import("react/jsx-runtime").JSX.Element>;
|
|
6
6
|
type ComposerButtonStyle = NonNullable<Theme['composer']>['button'];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CommonBlockProps } from '../../types';
|
|
3
|
-
export declare const Audio: import("react").ForwardRefExoticComponent<CommonBlockProps & import("
|
|
3
|
+
export declare const Audio: import("react").ForwardRefExoticComponent<CommonBlockProps & import("webchat-adapters/src/target").AudioMessage & import("react").RefAttributes<HTMLAudioElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CommonBlockProps } from '../../types';
|
|
3
|
-
export declare const Carousel: import("react").ForwardRefExoticComponent<CommonBlockProps & import("
|
|
3
|
+
export declare const Carousel: import("react").ForwardRefExoticComponent<CommonBlockProps & import("webchat-adapters/src/target").CarouselMessage & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CommonBlockProps } from '../../types';
|
|
3
|
-
export declare const File: import("react").ForwardRefExoticComponent<CommonBlockProps & import("
|
|
3
|
+
export declare const File: import("react").ForwardRefExoticComponent<CommonBlockProps & import("webchat-adapters/src/target").FileMessage & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CommonBlockProps } from '../../types';
|
|
3
|
-
export declare const Image: import("react").ForwardRefExoticComponent<CommonBlockProps & import("
|
|
3
|
+
export declare const Image: import("react").ForwardRefExoticComponent<CommonBlockProps & import("webchat-adapters/src/target").ImageMessage & import("react").RefAttributes<HTMLImageElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CommonBlockProps } from '../../types';
|
|
3
|
-
export declare const Location: import("react").ForwardRefExoticComponent<CommonBlockProps & import("
|
|
3
|
+
export declare const Location: import("react").ForwardRefExoticComponent<CommonBlockProps & import("webchat-adapters/src/target").LocationMessage & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CommonBlockProps } from '../../types';
|
|
3
|
-
export declare const Video: import("react").ForwardRefExoticComponent<CommonBlockProps & import("
|
|
3
|
+
export declare const Video: import("react").ForwardRefExoticComponent<CommonBlockProps & import("webchat-adapters/src/target").VideoMessage & import("react").RefAttributes<HTMLVideoElement>>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Theme, Configuration, BlockObject, BlockStyles, MessageObject } from '../types';
|
|
3
3
|
import { EventEmitter, Events } from '../utils';
|
|
4
|
-
import {
|
|
5
|
-
import { type WebchatClient } from '../client';
|
|
4
|
+
import { WebchatClient } from '../client';
|
|
6
5
|
export type StyleOptions = {
|
|
7
6
|
className?: string;
|
|
8
7
|
style?: CSSProperties;
|
|
@@ -39,6 +38,7 @@ export type ContextVaue = {
|
|
|
39
38
|
sendMessage: WebchatClient['sendMessage'];
|
|
40
39
|
restartConversation: () => void;
|
|
41
40
|
} & Pick<WebchatClient, 'userId' | 'conversationId' | 'clientId'>;
|
|
41
|
+
closeWindow?: () => void;
|
|
42
42
|
setState: (state: Partial<ContextVaue['state']>) => void;
|
|
43
43
|
setTheme: (styles: Partial<Theme>) => void;
|
|
44
44
|
};
|