@botpress/webchat 1.0.16 → 1.0.17
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/ChatClient/index.d.ts +0 -29
- package/dist/client/ChatClient/state-machine.d.ts +0 -39
- package/dist/client/index.d.ts +0 -1
- package/dist/index.js +21965 -23919
- package/dist/index.umd.cjs +147 -149
- package/package.json +1 -2
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '../../utils';
|
|
2
|
-
import { Events, Message, UserCredentials, WebChatClient } from '../types';
|
|
3
|
-
export type ChatClientProps = {
|
|
4
|
-
apiUrl: string;
|
|
5
|
-
clientId: string;
|
|
6
|
-
};
|
|
7
|
-
export declare class ChatClient extends EventEmitter<Events> implements WebChatClient {
|
|
8
|
-
private _client;
|
|
9
|
-
private _webhookId;
|
|
10
|
-
private _state;
|
|
11
|
-
constructor(props: ChatClientProps);
|
|
12
|
-
get clientId(): string;
|
|
13
|
-
get userId(): string | undefined;
|
|
14
|
-
get conversationId(): string | undefined;
|
|
15
|
-
connect(creds?: UserCredentials): Promise<UserCredentials | undefined>;
|
|
16
|
-
private _initialConnect;
|
|
17
|
-
private _reConnect;
|
|
18
|
-
disconnect(): Promise<void>;
|
|
19
|
-
sendMessage(message: string): Promise<void>;
|
|
20
|
-
switchConversation(id: string): Promise<void>;
|
|
21
|
-
conversationExists(id: string): Promise<boolean>;
|
|
22
|
-
userExists(id: string): Promise<boolean>;
|
|
23
|
-
newConversation(): Promise<void>;
|
|
24
|
-
private _createNewConversation;
|
|
25
|
-
listMessages(): Promise<Message[]>;
|
|
26
|
-
private _connectConversation;
|
|
27
|
-
private _mapMessage;
|
|
28
|
-
private _mapPayload;
|
|
29
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Client } from 'chat-client';
|
|
2
|
-
export type SignalEmitter = Awaited<ReturnType<Client['listenConversation']>>;
|
|
3
|
-
export type DisconnectedState = {};
|
|
4
|
-
export type UserCreatingState = DisconnectedState & {};
|
|
5
|
-
export type UserCreatedState = UserCreatingState & {
|
|
6
|
-
userId: string;
|
|
7
|
-
};
|
|
8
|
-
export type ConversationCreatingState = UserCreatedState & {};
|
|
9
|
-
export type ConversationCreatedState = ConversationCreatingState & {
|
|
10
|
-
conversationId: string;
|
|
11
|
-
signalEmitter: SignalEmitter;
|
|
12
|
-
};
|
|
13
|
-
export type ChatClientState = (DisconnectedState & {
|
|
14
|
-
status: 'disconnected';
|
|
15
|
-
}) | (UserCreatingState & {
|
|
16
|
-
status: 'user_creating';
|
|
17
|
-
}) | (UserCreatedState & {
|
|
18
|
-
status: 'user_created';
|
|
19
|
-
}) | (ConversationCreatingState & {
|
|
20
|
-
status: 'conversation_creating';
|
|
21
|
-
}) | (ConversationCreatedState & {
|
|
22
|
-
status: 'conversation_created';
|
|
23
|
-
});
|
|
24
|
-
export type ChatClientStatus = ChatClientState['status'];
|
|
25
|
-
export type StateOf<S extends ChatClientStatus> = Extract<ChatClientState, {
|
|
26
|
-
status: S;
|
|
27
|
-
}>;
|
|
28
|
-
type GT<S extends ChatClientStatus> = S extends 'disconnected' ? 'user_creating' | 'user_created' | 'conversation_creating' | 'conversation_created' : S extends 'user_creating' ? 'user_created' | 'conversation_creating' | 'conversation_created' : S extends 'user_created' ? 'conversation_creating' | 'conversation_created' : S extends 'conversation_creating' ? 'conversation_created' : never;
|
|
29
|
-
type LT<S extends ChatClientStatus> = S extends 'conversation_created' ? 'conversation_creating' | 'user_created' | 'user_creating' | 'disconnected' : S extends 'conversation_creating' ? 'user_created' | 'user_creating' | 'disconnected' : S extends 'user_created' ? 'user_creating' | 'disconnected' : S extends 'user_creating' ? 'disconnected' : never;
|
|
30
|
-
export declare const isEq: <S extends "disconnected" | "user_creating" | "user_created" | "conversation_creating" | "conversation_created">(s: ChatClientState, target: S) => s is StateOf<S>;
|
|
31
|
-
export declare const isGt: <S extends "disconnected" | "user_creating" | "user_created" | "conversation_creating" | "conversation_created">(s: ChatClientState, target: S) => s is StateOf<GT<S>>;
|
|
32
|
-
export declare const isLt: <S extends "disconnected" | "user_creating" | "user_created" | "conversation_creating" | "conversation_created">(s: ChatClientState, target: S) => s is StateOf<LT<S>>;
|
|
33
|
-
export declare const isGte: <S extends "disconnected" | "user_creating" | "user_created" | "conversation_creating" | "conversation_created">(s: ChatClientState, target: S) => s is StateOf<S | GT<S>>;
|
|
34
|
-
export declare const isLte: <S extends "disconnected" | "user_creating" | "user_created" | "conversation_creating" | "conversation_created">(s: ChatClientState, target: S) => s is StateOf<S | LT<S>>;
|
|
35
|
-
export declare class InvalidStateError extends Error {
|
|
36
|
-
readonly state: ChatClientState;
|
|
37
|
-
constructor(state: ChatClientState);
|
|
38
|
-
}
|
|
39
|
-
export {};
|
package/dist/client/index.d.ts
CHANGED