@botpress/webchat 1.0.15 → 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/App.d.ts +2 -2
- package/dist/client/ChatClient/index.d.ts +0 -0
- package/dist/client/ChatClient/state-machine.d.ts +0 -0
- package/dist/client/{adapters → MessagingClient/adapters}/Audio.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Card.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Carousel.d.ts +5 -5
- package/dist/client/{adapters → MessagingClient/adapters}/Choice.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Dropdown.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/File.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Image.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Location.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Message.d.ts +22 -22
- package/dist/client/{adapters → MessagingClient/adapters}/Text.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Utils.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Video.d.ts +1 -1
- package/dist/client/{adapters → MessagingClient/adapters}/Voice.d.ts +1 -1
- package/dist/client/{MessagingClient.d.ts → MessagingClient/client.d.ts} +6 -5
- package/dist/client/MessagingClient/index.d.ts +1 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +31 -0
- package/dist/contexts/WebchatContext.d.ts +5 -5
- package/dist/index.d.ts +3 -1
- package/dist/index.js +33165 -26237
- package/dist/index.umd.cjs +168 -142
- package/dist/main.d.ts +0 -2
- package/dist/options.d.ts +11 -0
- package/dist/providers/WebchatProvider.d.ts +2 -2
- package/dist/schemas/theme.d.ts +12 -0
- package/dist/themes/base.d.ts +2 -0
- package/dist/themes/dusk.d.ts +2 -0
- package/dist/themes/index.d.ts +1 -1
- package/dist/{Utils → utils}/index.d.ts +1 -0
- package/dist/utils/mergeThemes.d.ts +2 -0
- package/dist/utils/withBaseTheme.d.ts +316 -0
- package/package.json +6 -2
- package/dist/themes/duskTheme.d.ts +0 -2
- /package/dist/client/{adapters → MessagingClient/adapters}/index.d.ts +0 -0
- /package/dist/{Utils → utils}/colors.d.ts +0 -0
- /package/dist/{Utils → utils}/eventEmitter.d.ts +0 -0
- /package/dist/{Utils → utils}/hashStringToInt.d.ts +0 -0
package/dist/App.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { WebChatClient } from './client';
|
|
3
3
|
import { Container } from './components';
|
|
4
4
|
import { Theme } from './schemas';
|
|
5
5
|
type Props = {
|
|
6
6
|
theme: Theme;
|
|
7
|
-
client:
|
|
7
|
+
client: WebChatClient;
|
|
8
8
|
} & ComponentProps<typeof Container>;
|
|
9
9
|
export declare const App: ({ theme, client }: Props) => JSX.Element;
|
|
10
10
|
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ButtonBlock, ColumnBlock, ImageBlock, TextBlock } from '
|
|
2
|
+
import { ButtonBlock, ColumnBlock, ImageBlock, TextBlock } from '../../../types';
|
|
3
3
|
import { WithBubble } from './Utils';
|
|
4
4
|
export type CardBlockType = {
|
|
5
5
|
blocks: CardBlocks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CardBlockType } from './Card';
|
|
3
|
-
import { CarouselBlock } from '
|
|
3
|
+
import { CarouselBlock } from '../../../types';
|
|
4
4
|
type CarouselBlockType = {
|
|
5
5
|
blocks: CardBlockType[];
|
|
6
6
|
} & Omit<CarouselBlock, 'blocks'>;
|
|
@@ -23,7 +23,7 @@ export declare const CarouselSchema: z.ZodEffects<z.ZodObject<{
|
|
|
23
23
|
title: string;
|
|
24
24
|
text: string;
|
|
25
25
|
action: "Say something";
|
|
26
|
-
}>, import("
|
|
26
|
+
}>, import("../../../types").ButtonBlock, {
|
|
27
27
|
title: string;
|
|
28
28
|
text: string;
|
|
29
29
|
action: "Say something";
|
|
@@ -39,7 +39,7 @@ export declare const CarouselSchema: z.ZodEffects<z.ZodObject<{
|
|
|
39
39
|
title: string;
|
|
40
40
|
url: string;
|
|
41
41
|
action: "Open URL";
|
|
42
|
-
}>, import("
|
|
42
|
+
}>, import("../../../types").ButtonBlock, {
|
|
43
43
|
title: string;
|
|
44
44
|
url: string;
|
|
45
45
|
action: "Open URL";
|
|
@@ -55,13 +55,13 @@ export declare const CarouselSchema: z.ZodEffects<z.ZodObject<{
|
|
|
55
55
|
title: string;
|
|
56
56
|
action: "Postback";
|
|
57
57
|
payload: string;
|
|
58
|
-
}>, import("
|
|
58
|
+
}>, import("../../../types").ButtonBlock, {
|
|
59
59
|
title: string;
|
|
60
60
|
action: "Postback";
|
|
61
61
|
payload: string;
|
|
62
62
|
}>]>, "many">;
|
|
63
63
|
}, "type">, "strip", z.ZodTypeAny, {
|
|
64
|
-
actions: import("
|
|
64
|
+
actions: import("../../../types").ButtonBlock[];
|
|
65
65
|
title?: string | undefined;
|
|
66
66
|
image?: string | undefined;
|
|
67
67
|
subtitle?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ButtonBlock, ColumnBlock, RowBlock, TextBlock } from '
|
|
2
|
+
import { ButtonBlock, ColumnBlock, RowBlock, TextBlock } from '../../../types';
|
|
3
3
|
import { WithBubble } from './Utils';
|
|
4
4
|
type ButtonBlocks = {
|
|
5
5
|
blocks: ButtonBlock[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ColumnBlock, DropdownBlock, TextBlock } from '
|
|
2
|
+
import { ColumnBlock, DropdownBlock, TextBlock } from '../../../types';
|
|
3
3
|
import { WithBubble } from './Utils';
|
|
4
4
|
type DropdownBlockType = {
|
|
5
5
|
blocks: (DropdownBlock | TextBlock)[];
|
|
@@ -11,7 +11,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
11
11
|
text: string;
|
|
12
12
|
type: "text";
|
|
13
13
|
markdown?: boolean | undefined;
|
|
14
|
-
}>, import("./Utils.ts").WithBubble<import("
|
|
14
|
+
}>, import("./Utils.ts").WithBubble<import("../../../index.ts").TextBlock>, {
|
|
15
15
|
text: string;
|
|
16
16
|
type: "text";
|
|
17
17
|
markdown?: boolean | undefined;
|
|
@@ -27,7 +27,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
27
27
|
image: string;
|
|
28
28
|
type: "image";
|
|
29
29
|
title?: string | undefined;
|
|
30
|
-
}>, import("
|
|
30
|
+
}>, import("../../../index.ts").ImageBlock, {
|
|
31
31
|
image: string;
|
|
32
32
|
type: "image";
|
|
33
33
|
title?: string | undefined;
|
|
@@ -43,7 +43,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
43
43
|
audio: string;
|
|
44
44
|
type: "audio";
|
|
45
45
|
title?: string | undefined;
|
|
46
|
-
}>, import("
|
|
46
|
+
}>, import("../../../index.ts").AudioBlock, {
|
|
47
47
|
audio: string;
|
|
48
48
|
type: "audio";
|
|
49
49
|
title?: string | undefined;
|
|
@@ -59,7 +59,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
59
59
|
video: string;
|
|
60
60
|
type: "video";
|
|
61
61
|
title?: string | undefined;
|
|
62
|
-
}>, import("
|
|
62
|
+
}>, import("../../../index.ts").VideoBlock, {
|
|
63
63
|
video: string;
|
|
64
64
|
type: "video";
|
|
65
65
|
title?: string | undefined;
|
|
@@ -82,7 +82,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
82
82
|
title: string;
|
|
83
83
|
text: string;
|
|
84
84
|
action: "Say something";
|
|
85
|
-
}>, import("
|
|
85
|
+
}>, import("../../../index.ts").ButtonBlock, {
|
|
86
86
|
title: string;
|
|
87
87
|
text: string;
|
|
88
88
|
action: "Say something";
|
|
@@ -98,7 +98,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
98
98
|
title: string;
|
|
99
99
|
url: string;
|
|
100
100
|
action: "Open URL";
|
|
101
|
-
}>, import("
|
|
101
|
+
}>, import("../../../index.ts").ButtonBlock, {
|
|
102
102
|
title: string;
|
|
103
103
|
url: string;
|
|
104
104
|
action: "Open URL";
|
|
@@ -114,13 +114,13 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
114
114
|
title: string;
|
|
115
115
|
action: "Postback";
|
|
116
116
|
payload: string;
|
|
117
|
-
}>, import("
|
|
117
|
+
}>, import("../../../index.ts").ButtonBlock, {
|
|
118
118
|
title: string;
|
|
119
119
|
action: "Postback";
|
|
120
120
|
payload: string;
|
|
121
121
|
}>]>, "many">;
|
|
122
122
|
}, "type">, "strip", z.ZodTypeAny, {
|
|
123
|
-
actions: import("
|
|
123
|
+
actions: import("../../../index.ts").ButtonBlock[];
|
|
124
124
|
title?: string | undefined;
|
|
125
125
|
image?: string | undefined;
|
|
126
126
|
subtitle?: string | undefined;
|
|
@@ -184,7 +184,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
184
184
|
}[];
|
|
185
185
|
}>, {
|
|
186
186
|
blocks: import("./Card").CardBlockType[];
|
|
187
|
-
} & Omit<import("
|
|
187
|
+
} & Omit<import("../../../index.ts").CarouselBlock, "blocks">, {
|
|
188
188
|
type: "carousel";
|
|
189
189
|
items: {
|
|
190
190
|
actions: ({
|
|
@@ -221,7 +221,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
221
221
|
title: string;
|
|
222
222
|
text: string;
|
|
223
223
|
action: "Say something";
|
|
224
|
-
}>, import("
|
|
224
|
+
}>, import("../../../index.ts").ButtonBlock, {
|
|
225
225
|
title: string;
|
|
226
226
|
text: string;
|
|
227
227
|
action: "Say something";
|
|
@@ -237,7 +237,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
237
237
|
title: string;
|
|
238
238
|
url: string;
|
|
239
239
|
action: "Open URL";
|
|
240
|
-
}>, import("
|
|
240
|
+
}>, import("../../../index.ts").ButtonBlock, {
|
|
241
241
|
title: string;
|
|
242
242
|
url: string;
|
|
243
243
|
action: "Open URL";
|
|
@@ -253,14 +253,14 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
253
253
|
title: string;
|
|
254
254
|
action: "Postback";
|
|
255
255
|
payload: string;
|
|
256
|
-
}>, import("
|
|
256
|
+
}>, import("../../../index.ts").ButtonBlock, {
|
|
257
257
|
title: string;
|
|
258
258
|
action: "Postback";
|
|
259
259
|
payload: string;
|
|
260
260
|
}>]>, "many">;
|
|
261
261
|
}, "strip", z.ZodTypeAny, {
|
|
262
262
|
type: "card";
|
|
263
|
-
actions: import("
|
|
263
|
+
actions: import("../../../index.ts").ButtonBlock[];
|
|
264
264
|
title?: string | undefined;
|
|
265
265
|
subtitle?: string | undefined;
|
|
266
266
|
image?: string | undefined;
|
|
@@ -318,7 +318,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
318
318
|
longitude: number;
|
|
319
319
|
address?: string | undefined;
|
|
320
320
|
title?: string | undefined;
|
|
321
|
-
}>, import("
|
|
321
|
+
}>, import("../../../index.ts").LocationBlock, {
|
|
322
322
|
type: "location";
|
|
323
323
|
latitude: number;
|
|
324
324
|
longitude: number;
|
|
@@ -336,7 +336,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
336
336
|
type: "file";
|
|
337
337
|
file: string;
|
|
338
338
|
title?: string | undefined;
|
|
339
|
-
}>, import("
|
|
339
|
+
}>, import("../../../index.ts").FileBlock, {
|
|
340
340
|
type: "file";
|
|
341
341
|
file: string;
|
|
342
342
|
title?: string | undefined;
|
|
@@ -349,7 +349,7 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
349
349
|
}, {
|
|
350
350
|
audio: string;
|
|
351
351
|
type: "voice";
|
|
352
|
-
}>, import("
|
|
352
|
+
}>, import("../../../index.ts").AudioBlock, {
|
|
353
353
|
audio: string;
|
|
354
354
|
type: "voice";
|
|
355
355
|
}>, z.ZodEffects<z.ZodObject<{
|
|
@@ -380,10 +380,10 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
380
380
|
value: string;
|
|
381
381
|
}[];
|
|
382
382
|
}>, import("./Utils.ts").WithBubble<{
|
|
383
|
-
blocks: (import("
|
|
384
|
-
blocks: import("
|
|
385
|
-
} & Omit<import("
|
|
386
|
-
} & Omit<import("
|
|
383
|
+
blocks: (import("../../../index.ts").TextBlock | ({
|
|
384
|
+
blocks: import("../../../index.ts").ButtonBlock[];
|
|
385
|
+
} & Omit<import("../../../index.ts").RowBlock, "blocks">))[];
|
|
386
|
+
} & Omit<import("../../../index.ts").ColumnBlock, "blocks">>, {
|
|
387
387
|
text: string;
|
|
388
388
|
type: "single-choice";
|
|
389
389
|
choices: {
|
|
@@ -421,8 +421,8 @@ export declare const MessageContentSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<
|
|
|
421
421
|
text?: string | undefined;
|
|
422
422
|
message?: string | undefined;
|
|
423
423
|
}>, import("./Utils.ts").WithBubble<{
|
|
424
|
-
blocks: (import("
|
|
425
|
-
} & Omit<import("
|
|
424
|
+
blocks: (import("../../../index.ts").DropdownBlock | import("../../../index.ts").TextBlock)[];
|
|
425
|
+
} & Omit<import("../../../index.ts").ColumnBlock, "blocks">>, {
|
|
426
426
|
options: {
|
|
427
427
|
label: string;
|
|
428
428
|
value: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type MessagingSocketOptions, type UserCredentials
|
|
2
|
-
import { EventEmitter } from '
|
|
1
|
+
import { type MessagingSocketOptions, type UserCredentials } from '@botpress/messaging-socket';
|
|
2
|
+
import { EventEmitter } from '../../utils';
|
|
3
|
+
import { Message, WebChatClient } from '../types';
|
|
3
4
|
type Events = {
|
|
4
5
|
connect: UserCredentials;
|
|
5
6
|
disconnect: undefined;
|
|
@@ -10,7 +11,7 @@ type Events = {
|
|
|
10
11
|
startTyping: undefined;
|
|
11
12
|
stopTyping: undefined;
|
|
12
13
|
};
|
|
13
|
-
export declare class
|
|
14
|
+
export declare class MessagingClient implements WebChatClient {
|
|
14
15
|
private socket;
|
|
15
16
|
clientId: string | undefined;
|
|
16
17
|
userId: string | undefined;
|
|
@@ -24,8 +25,8 @@ export declare class WebchatClient {
|
|
|
24
25
|
disconnect(): Promise<void>;
|
|
25
26
|
sendMessage(message: string): Promise<void>;
|
|
26
27
|
switchConversation(id: string): Promise<void>;
|
|
27
|
-
|
|
28
|
+
conversationExists(id: string): Promise<boolean>;
|
|
28
29
|
newConversation(): Promise<void>;
|
|
29
|
-
listMessages(limit?: number): Promise<Message[]>;
|
|
30
|
+
listMessages(limit?: number): Promise<import("@botpress/messaging-socket").Message[]>;
|
|
30
31
|
}
|
|
31
32
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EventEmitter } from '../utils';
|
|
2
|
+
import { BlockObject } from '../types/block-type';
|
|
3
|
+
export type UserCredentials = {
|
|
4
|
+
userId: string;
|
|
5
|
+
userToken: string;
|
|
6
|
+
};
|
|
7
|
+
export type Message = {
|
|
8
|
+
id: string;
|
|
9
|
+
conversationId: string;
|
|
10
|
+
authorId: string | undefined;
|
|
11
|
+
sentOn: Date;
|
|
12
|
+
payload: BlockObject;
|
|
13
|
+
};
|
|
14
|
+
export type Events = {
|
|
15
|
+
conversation: string | undefined;
|
|
16
|
+
message: Message;
|
|
17
|
+
messageSent: string;
|
|
18
|
+
};
|
|
19
|
+
export type WebChatClient = {
|
|
20
|
+
clientId: string | undefined;
|
|
21
|
+
userId: string | undefined;
|
|
22
|
+
conversationId: string | undefined;
|
|
23
|
+
on: EventEmitter<Events>['on'];
|
|
24
|
+
connect(creds?: UserCredentials): Promise<UserCredentials | undefined>;
|
|
25
|
+
disconnect(): Promise<void>;
|
|
26
|
+
sendMessage(message: string): Promise<void>;
|
|
27
|
+
switchConversation(id: string): Promise<void>;
|
|
28
|
+
conversationExists(id: string): Promise<boolean>;
|
|
29
|
+
newConversation(): Promise<void>;
|
|
30
|
+
listMessages(): Promise<Message[]>;
|
|
31
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
2
|
import type { BlockObject, BlockStyles, MessageObject } from '../types';
|
|
3
|
-
import { EventEmitter, Events } from '../
|
|
3
|
+
import { EventEmitter, Events } from '../utils';
|
|
4
4
|
import { Theme } from '../schemas';
|
|
5
|
-
import { type
|
|
5
|
+
import { type WebChatClient } from '../client';
|
|
6
6
|
export type StyleOptions = {
|
|
7
7
|
className?: string;
|
|
8
8
|
style?: CSSProperties;
|
|
@@ -45,10 +45,10 @@ type ContextVaue = {
|
|
|
45
45
|
disableComposer: boolean;
|
|
46
46
|
};
|
|
47
47
|
client: {
|
|
48
|
-
on:
|
|
49
|
-
sendMessage:
|
|
48
|
+
on: WebChatClient['on'];
|
|
49
|
+
sendMessage: WebChatClient['sendMessage'];
|
|
50
50
|
restartConversation: () => void;
|
|
51
|
-
} & Pick<
|
|
51
|
+
} & Pick<WebChatClient, 'userId' | 'conversationId' | 'clientId'>;
|
|
52
52
|
setState: (state: Partial<ContextVaue['state']>) => void;
|
|
53
53
|
setTheme: (styles: Partial<Theme>) => void;
|
|
54
54
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
export * from './providers';
|
|
3
3
|
export * from './types';
|
|
4
|
-
export {
|
|
4
|
+
export { type WebChatClient as Client } from './client';
|
|
5
5
|
export { useWebchatContext } from './contexts';
|
|
6
|
+
export { dusk, eggplantTheme, galaxyTheme, prismTheme } from './themes';
|
|
7
|
+
export { mergeThemes } from './utils';
|